Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// mainFields: ['sass']
});
// 2: E:/VS/MyProject/client/css/@ryan/something.scss (Standard)
// 5: E:/VS/MyProject/client/css/@ryan/something/_index.scss (Standard https://github.com/sass/sass/issues/690)
// 5: E:/VS/MyProject/client/css/@ryan/something/index.scss (Standard https://github.com/sass/sass/issues/690)
// 7: E:/VS/MyProject/node_modules/@ryan/something.scss (Standard+)
// 7: E:/VS/MyProject/node_modules/@ryan/something/_index.scss (Standard+)
// 7: E:/VS/MyProject/node_modules/@ryan/something/index.scss (Standard+)
try {
return await resolveAsync(sassResolver, lookupStartPath, request);
} catch (ex) {
// continue module resolution
}
const cssResolver = ResolverFactory.createResolver({
fileSystem: fs,
extensions: ['.css'],
modules: [lookupStartPath, 'node_modules'],
mainFields: ['style']
});
// http://sass.logdown.com/posts/7807041-feature-watchcss-imports-and-css-compatibility
// 4: E:/VS/MyProject/client/css/@ryan/something.css (Standard)
// 6: E:/VS/MyProject/client/css/@ryan/something/index.css (Standard)
// 9: E:/VS/MyProject/node_modules/@ryan/something.css (Standard+)
// 9: E:/VS/MyProject/node_modules/@ryan/something/index.css (Standard+)
// 10: E:/VS/MyProject/node_modules/@ryan/something/package.json:style (Custom, Node-like)
return await resolveAsync(cssResolver, lookupStartPath, request);
// Standard+: when using node-sass includePaths option set to the node_modules folder. (Older instapack behavior)
}
descriptionFiles: []
});
const partialFileName = '_' + upath.addExt(requestFileName, '.scss'); // _something.scss
const partialRequest = upath.join(requestDir, partialFileName); // @ryan/_something.scss
// 3: E:/VS/MyProject/client/css/@ryan/_something.scss (Standard)
// 8: E:/VS/MyProject/node_modules/@ryan/_something.scss (Standard+)
try {
return await resolveAsync(partialSassResolver, lookupStartPath, partialRequest);
} catch (ex) {
// continue module resolution
}
}
const sassResolver = ResolverFactory.createResolver({
fileSystem: fs,
extensions: ['.scss'],
modules: [lookupStartPath, 'node_modules'],
mainFiles: ['_index', 'index'],
descriptionFiles: [],
// mainFields: ['sass']
});
// 2: E:/VS/MyProject/client/css/@ryan/something.scss (Standard)
// 5: E:/VS/MyProject/client/css/@ryan/something/_index.scss (Standard https://github.com/sass/sass/issues/690)
// 5: E:/VS/MyProject/client/css/@ryan/something/index.scss (Standard https://github.com/sass/sass/issues/690)
// 7: E:/VS/MyProject/node_modules/@ryan/something.scss (Standard+)
// 7: E:/VS/MyProject/node_modules/@ryan/something/_index.scss (Standard+)
// 7: E:/VS/MyProject/node_modules/@ryan/something/index.scss (Standard+)
try {
return await resolveAsync(sassResolver, lookupStartPath, request);
describe('LuaModuleResolverPlugin', () => {
const luaRoot = __dirname;
const localRoot = path.resolve(__dirname, '..');
const context = path.join(__dirname, 'fixtures');
const resolver = ResolverFactory.createResolver({
extensions: ['.js', '.lua'],
fileSystem: new CachedInputFileSystem(new NodeJsInputFileSystem(), 4000),
plugins: [new LuaModuleResolverPlugin(localRoot, luaRoot)],
useSyncFileSystemCalls: true,
});
const resolve = request => resolver.resolveSync({}, context, request);
test('should resolve relative to luaRoot', () => {
expect(resolve('./test.js')).toBe('fixtures.test');
});
test('should resolve .lua and .js', () => {
expect(resolve('./test.js')).toBe('fixtures.test');
expect(resolve('./test.lua')).toBe('fixtures.test');
});
compiler.apply(new RecordIdsPlugin());
compiler.apply(new WarnCaseSensitiveModulesPlugin());
if(options.cache) {
let CachePlugin = require("./CachePlugin");
compiler.apply(new CachePlugin(typeof options.cache === "object" ? options.cache : null));
}
compiler.applyPlugins("after-plugins", compiler);
if(!compiler.inputFileSystem) throw new Error("No input filesystem provided");
compiler.resolvers.normal = ResolverFactory.createResolver(Object.assign({
fileSystem: compiler.inputFileSystem
}, options.resolve));
compiler.resolvers.context = ResolverFactory.createResolver(Object.assign({
fileSystem: compiler.inputFileSystem,
resolveToContext: true
}, options.resolve));
compiler.resolvers.loader = ResolverFactory.createResolver(Object.assign({
fileSystem: compiler.inputFileSystem
}, options.resolveLoader));
compiler.applyPlugins("after-resolvers", compiler);
return options;
}
}
}
compiler.apply(new TemplatedPathPlugin());
compiler.apply(new RecordIdsPlugin());
compiler.apply(new WarnCaseSensitiveModulesPlugin());
if(options.cache) {
let CachePlugin = require("./CachePlugin");
compiler.apply(new CachePlugin(typeof options.cache === "object" ? options.cache : null));
}
compiler.applyPlugins("after-plugins", compiler);
if(!compiler.inputFileSystem) throw new Error("No input filesystem provided");
compiler.resolvers.normal = ResolverFactory.createResolver(Object.assign({
fileSystem: compiler.inputFileSystem
}, options.resolve));
compiler.resolvers.context = ResolverFactory.createResolver(Object.assign({
fileSystem: compiler.inputFileSystem,
resolveToContext: true
}, options.resolve));
compiler.resolvers.loader = ResolverFactory.createResolver(Object.assign({
fileSystem: compiler.inputFileSystem
}, options.resolveLoader));
compiler.applyPlugins("after-resolvers", compiler);
return options;
}
}
} else if (key === 'fallback') {
var fallback = resolveConfig[key];
if (isArray(fallback)) {
config.modules = config.modules.concat(fallback);
} else {
config.modules.push(fallback);
}
} else if (key === 'modules') {
config.modules = config.modules.concat(resolveConfig[key]);
} else {
config[key] = resolveConfig[key];
}
});
}
return ResolverFactory.createResolver(config);
}
if(options.cache) {
let CachePlugin = require("./CachePlugin");
compiler.apply(new CachePlugin(typeof options.cache === "object" ? options.cache : null));
}
compiler.applyPlugins("after-plugins", compiler);
if(!compiler.inputFileSystem) throw new Error("No input filesystem provided");
compiler.resolvers.normal = ResolverFactory.createResolver(Object.assign({
fileSystem: compiler.inputFileSystem
}, options.resolve));
compiler.resolvers.context = ResolverFactory.createResolver(Object.assign({
fileSystem: compiler.inputFileSystem,
resolveToContext: true
}, options.resolve));
compiler.resolvers.loader = ResolverFactory.createResolver(Object.assign({
fileSystem: compiler.inputFileSystem
}, options.resolveLoader));
compiler.applyPlugins("after-resolvers", compiler);
return options;
}
}
if(options.cache) {
let CachePlugin = require("./CachePlugin");
compiler.apply(new CachePlugin(typeof options.cache === "object" ? options.cache : null));
}
compiler.applyPlugins("after-plugins", compiler);
if(!compiler.inputFileSystem) throw new Error("No input filesystem provided");
compiler.resolvers.normal = ResolverFactory.createResolver(Object.assign({
fileSystem: compiler.inputFileSystem
}, options.resolve));
compiler.resolvers.context = ResolverFactory.createResolver(Object.assign({
fileSystem: compiler.inputFileSystem,
resolveToContext: true
}, options.resolve));
compiler.resolvers.loader = ResolverFactory.createResolver(Object.assign({
fileSystem: compiler.inputFileSystem
}, options.resolveLoader));
compiler.applyPlugins("after-resolvers", compiler);
return options;
}
}
}
compiler.apply(new TemplatedPathPlugin());
compiler.apply(new RecordIdsPlugin());
compiler.apply(new WarnCaseSensitiveModulesPlugin());
if(options.cache) {
let CachePlugin = require("./CachePlugin");
compiler.apply(new CachePlugin(typeof options.cache === "object" ? options.cache : null));
}
compiler.applyPlugins("after-plugins", compiler);
if(!compiler.inputFileSystem) throw new Error("No input filesystem provided");
compiler.resolvers.normal = ResolverFactory.createResolver(Object.assign({
fileSystem: compiler.inputFileSystem
}, options.resolve));
compiler.resolvers.context = ResolverFactory.createResolver(Object.assign({
fileSystem: compiler.inputFileSystem,
resolveToContext: true
}, options.resolve));
compiler.resolvers.loader = ResolverFactory.createResolver(Object.assign({
fileSystem: compiler.inputFileSystem
}, options.resolveLoader));
compiler.applyPlugins("after-resolvers", compiler);
return options;
}
}
if(options.cache) {
let CachePlugin = require("./CachePlugin");
compiler.apply(new CachePlugin(typeof options.cache === "object" ? options.cache : null));
}
compiler.applyPlugins("after-plugins", compiler);
if(!compiler.inputFileSystem) throw new Error("No input filesystem provided");
compiler.resolvers.normal = ResolverFactory.createResolver(Object.assign({
fileSystem: compiler.inputFileSystem
}, options.resolve));
compiler.resolvers.context = ResolverFactory.createResolver(Object.assign({
fileSystem: compiler.inputFileSystem,
resolveToContext: true
}, options.resolve));
compiler.resolvers.loader = ResolverFactory.createResolver(Object.assign({
fileSystem: compiler.inputFileSystem
}, options.resolveLoader));
compiler.applyPlugins("after-resolvers", compiler);
return options;
}
}