How to use the enhanced-resolve.ResolverFactory.createResolver function in enhanced-resolve

To help you get started, we’ve selected a few enhanced-resolve examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ryanelian / instapack / src / SassImportResolver.ts View on Github external
// 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)
}
github ryanelian / instapack / src / SassImportResolver.ts View on Github external
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);
github ark120202 / babel-lua / packages / babel-lua-module-resolver / __tests__ / index.js View on Github external
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');
  });
github Graphite-Docs / graphite / node_modules / webpack / lib / WebpackOptionsApply.js View on Github external
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;
	}
}
github fossasia / susper.com / node_modules / webpack / lib / WebpackOptionsApply.js View on Github external
}

		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;
	}
}
github ternjs / tern / plugin / webpack.js View on Github external
} 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);
}
github xxxgitone / learningProcess / WebPack-Beginner / node_modules / webpack / lib / WebpackOptionsApply.js View on Github external
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;
	}
}
github daviddbarrero / Ionic-4-firebase / node_modules / webpack / lib / WebpackOptionsApply.js View on Github external
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;
	}
}
github sx1989827 / DOClever / SBDocClient / node_modules / webpack / lib / WebpackOptionsApply.js View on Github external
}

		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;
	}
}
github Graphite-Docs / graphite / node_modules / webpack / lib / WebpackOptionsApply.js View on Github external
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;
	}
}