File: //opt/code/node_modules/webpack/node_modules/enhanced-resolve/package.json
{
"name": "enhanced-resolve",
"version": "3.4.1",
"author": {
"name": "Tobias Koppers @sokra"
},
"description": "Offers a async require.resolve function. It's highly configurable.",
"files": [
"lib"
],
"dependencies": {
"graceful-fs": "^4.1.2",
"memory-fs": "^0.4.0",
"object-assign": "^4.0.1",
"tapable": "^0.2.7"
},
"licenses": [
{
"type": "MIT",
"url": "http://www.opensource.org/licenses/mit-license.php"
}
],
"devDependencies": {
"beautify-lint": "^1.0.3",
"codecov.io": "^0.1.6",
"coveralls": "^2.11.6",
"eslint": "^3.14.1",
"eslint-plugin-node": "^3.0.5",
"eslint-plugin-nodeca": "^1.0.3",
"istanbul": "^0.4.1",
"js-beautify": "^1.5.10",
"mocha": "^2.3.4",
"should": "^8.0.2"
},
"engines": {
"node": ">=4.3.0 <5.0.0 || >=5.10"
},
"main": "lib/node.js",
"homepage": "http://github.com/webpack/enhanced-resolve",
"scripts": {
"beautify-lint": "beautify-lint lib/**.js test/*.js",
"beautify": "beautify-rewrite lib/**.js test/*.js",
"lint": "eslint lib test",
"pretest": "npm run lint && npm run beautify-lint",
"test": "mocha --full-trace --check-leaks",
"precover": "npm run lint && npm run beautify-lint",
"cover": "istanbul cover node_modules/mocha/bin/_mocha",
"travis": "npm run cover -- --report lcovonly"
},
"repository": {
"type": "git",
"url": "git://github.com/webpack/enhanced-resolve.git"
},
"readme": "# enhanced-resolve\r\n\r\nOffers an async require.resolve function. It's highly configurable.\r\n\r\n## Features\r\n\r\n* plugin system\r\n* provide a custom filesystem\r\n* sync and async node.js filesystems included\r\n\r\n\r\n## Getting Started\r\n### Install\r\n```sh\r\n# npm\r\nnpm install enhanced-resolve\r\n# or Yarn\r\nyarn add enhanced-resolve\r\n```\r\n\r\n### Creating a Resolver\r\nThe easiest way to create a resolver is to use the `createResolver` function on `ResolveFactory`, along with one of the supplied File System implementations.\r\n```js\r\nconst {\r\n NodeJsInputFileSystem,\r\n CachedInputFileSystem,\r\n ResolverFactory\r\n} = require('enhanced-resolve');\r\n\r\n// create a resolver\r\nconst myResolver = ResolverFactory.createResolver({\r\n // Typical usage will consume the `NodeJsInputFileSystem` + `CachedInputFileSystem`, which wraps the Node.js `fs` wrapper to add resilience + caching.\r\n fileSystem: new CachedInputFileSystem(new NodeJsInputFileSystem(), 4000),\r\n extensions: ['.js', '.json']\r\n /* any other resolver options here. Options/defaults can be seen below */\r\n});\r\n\r\n// resolve a file with the new resolver\r\nconst context = {};\r\nconst lookupStartPath = '/Users/webpack/some/root/dir';\r\nconst request = './path/to-look-up.js';\r\nmyResolver.resolve({}, lookupStartPath, request, (err/*Error*/, filepath/*string*/) => {\r\n // Do something with the path\r\n});\r\n```\r\n\r\nFor more examples creating different types resolvers (sync/async, context, etc) see `lib/node.js`.\r\n#### Resolver Options\r\n| Field | Default | Description |\r\n| ------------------------ | --------------------------- | ---------------------------------------------------------------------------------- |\r\n| modules | [\"node_modules\"] | A list of directories to resolve modules from, can be absolute path or folder name |\r\n| descriptionFiles | [\"package.json\"] | A list of description files to read from |\r\n| plugins | [] | A list of additional resolve plugins which should be applied |\r\n| mainFields | [\"main\"] | A list of main fields in description files |\r\n| aliasFields | [] | A list of alias fields in description files |\r\n| mainFiles | [\"index\"] | A list of main files in directories |\r\n| extensions | [\".js\", \".json\", \".node\"] | A list of extensions which should be tried for files |\r\n| enforceExtension | false | Enforce that a extension from extensions must be used |\r\n| moduleExtensions | [] | A list of module extensions which should be tried for modules |\r\n| enforceModuleExtension | false | Enforce that a extension from moduleExtensions must be used |\r\n| alias | [] | A list of module alias configurations or an object which maps key to value |\r\n| resolveToContext | false | Resolve to a context instead of a file |\r\n| unsafeCache | false | Use this cache object to unsafely cache the successful requests |\r\n| cacheWithContext | true | If unsafe cache is enabled, includes `request.context` in the cache key |\r\n| cachePredicate | function() { return true }; | A function which decides whether a request should be cached or not. An object is passed to the function with `path` and `request` properties. |\r\n| fileSystem | | The file system which should be used |\r\n| resolver | undefined | A prepared Resolver to which the plugins are attached |\r\n\r\n## Plugins\r\nSimilar to `webpack`, the core of `enhanced-resolve` functionality is implemented as individual plugins that are executed using [`Tapable`](https://github.com/webpack/tapable). These plugins can extend the functionality of the library, adding other ways for files/contexts to be resolved.\r\n\r\nA plugin should be a `class` (or its ES5 equivalent) with an `apply` method. The `apply` method will receive a `resolver` instance, that can be used to hook in to the event system.\r\n\r\n### Plugin Boilerplate\r\n```js\r\nclass MyResolverPlugin {\r\n constructor(source, target) {\r\n this.source = source;\r\n this.target = target;\r\n }\r\n\r\n apply(resolver) {\r\n resolver.plugin(this.source, (request, callback) => {\r\n // Any logic you need to create a new `request` can go here\r\n resolver.doResolve(this.target, request, null, callback);\r\n });\r\n }\r\n}\r\n```\r\n\r\nPlugins are executed in a pipeline, and register which event they should be executed before/after. In the example above, `source` is the name of the event that starts the pipeline, and `target` is what event this plugin should fire, which is what continues the execution of the pipeline. For an example of how these different plugin events create a chain, see `lib/ResolverFactory.js`, in the `//// pipeline ////` section.\r\n\r\n## Tests\r\n\r\n``` javascript\r\nnpm test\r\n```\r\n\r\n[](http://travis-ci.org/webpack/enhanced-resolve)\r\n\r\n\r\n## Passing options from webpack\r\nIf you are using `webpack`, and you want to pass custom options to `enhanced-resolve`, the options are passed from the `resolve` key of your webpack configuration e.g.:\r\n\r\n```\r\nresolve: {\r\n extensions: ['', '.js', '.jsx'],\r\n modules: ['src', 'node_modules'],\r\n plugins: [new DirectoryNamedWebpackPlugin()]\r\n ...\r\n},\r\n```\r\n\r\n## License\r\n\r\nCopyright (c) 2012-2016 Tobias Koppers\r\n\r\nMIT (http://www.opensource.org/licenses/mit-license.php)\r\n",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/webpack/enhanced-resolve/issues"
},
"_id": "enhanced-resolve@3.4.1",
"dist": {
"shasum": "80581a379b6ef7edc2b384fffbad95b023d87c80"
},
"_from": "enhanced-resolve@^3.3.0",
"_resolved": "http://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-3.4.1.tgz"
}