enhanced-resolve
Advanced tools
Comparing version 4.0.0-beta.4 to 4.0.0
@@ -19,5 +19,4 @@ /* | ||
function createIteratorCallback(i) { | ||
return function() { | ||
return(...args) => { // eslint-disable-line | ||
if(i >= currentPos) return; // ignore | ||
const args = Array.prototype.slice.call(arguments); | ||
done.push(i); | ||
@@ -51,5 +50,4 @@ if(args.length > 0) { | ||
function createIteratorCallback(i) { | ||
return function() { | ||
return(...args) => { // eslint-disable-line | ||
if(i >= currentPos) return; // ignore | ||
const args = Array.prototype.slice.call(arguments); | ||
done.push(i); | ||
@@ -56,0 +54,0 @@ if(args.length > 0) { |
@@ -9,24 +9,36 @@ /* | ||
function NodeJsInputFileSystem() {} | ||
module.exports = NodeJsInputFileSystem; | ||
class NodeJsInputFileSystem { | ||
readdir(path, callback) { | ||
fs.readdir(path, (err, files) => { | ||
callback(err, files && files.map(file => { | ||
return file.normalize ? file.normalize("NFC") : file; | ||
})); | ||
}); | ||
} | ||
NodeJsInputFileSystem.prototype.stat = fs.stat.bind(fs); | ||
NodeJsInputFileSystem.prototype.readdir = function readdir(path, callback) { | ||
fs.readdir(path, (err, files) => { | ||
callback(err, files && files.map(file => { | ||
readdirSync(path) { | ||
const files = fs.readdirSync(path); | ||
return files && files.map(file => { | ||
return file.normalize ? file.normalize("NFC") : file; | ||
})); | ||
}); | ||
} | ||
} | ||
const fsMethods = [ | ||
"stat", | ||
"statSync", | ||
"readFile", | ||
"readFileSync", | ||
"readlink", | ||
"readlinkSync" | ||
]; | ||
for(const key of fsMethods) { | ||
Object.defineProperty(NodeJsInputFileSystem.prototype, key, { | ||
configurable: true, | ||
writable: true, | ||
value: fs[key].bind(fs) | ||
}); | ||
}; | ||
NodeJsInputFileSystem.prototype.readFile = fs.readFile.bind(fs); | ||
NodeJsInputFileSystem.prototype.readlink = fs.readlink.bind(fs); | ||
} | ||
NodeJsInputFileSystem.prototype.statSync = fs.statSync.bind(fs); | ||
NodeJsInputFileSystem.prototype.readdirSync = function readdirSync(path) { | ||
const files = fs.readdirSync(path); | ||
return files && files.map(file => { | ||
return file.normalize ? file.normalize("NFC") : file; | ||
}); | ||
}; | ||
NodeJsInputFileSystem.prototype.readFileSync = fs.readFileSync.bind(fs); | ||
NodeJsInputFileSystem.prototype.readlinkSync = fs.readlinkSync.bind(fs); | ||
module.exports = NodeJsInputFileSystem; |
{ | ||
"name": "enhanced-resolve", | ||
"version": "4.0.0-beta.4", | ||
"version": "4.0.0", | ||
"author": "Tobias Koppers @sokra", | ||
"description": "Offers a async require.resolve function. It's highly configurable.", | ||
"files": [ | ||
"lib" | ||
"lib", | ||
"LICENSE" | ||
], | ||
@@ -12,3 +13,3 @@ "dependencies": { | ||
"memory-fs": "^0.4.0", | ||
"tapable": "^1.0.0-beta.4" | ||
"tapable": "^1.0.0" | ||
}, | ||
@@ -34,3 +35,3 @@ "licenses": [ | ||
"engines": { | ||
"node": ">=4.3.0 <5.0.0 || >=5.10" | ||
"node": ">=6.11.5" | ||
}, | ||
@@ -37,0 +38,0 @@ "main": "lib/node.js", |
@@ -40,5 +40,6 @@ # enhanced-resolve | ||
const context = {}; | ||
const resolveContext = {}; | ||
const lookupStartPath = '/Users/webpack/some/root/dir'; | ||
const request = './path/to-look-up.js'; | ||
myResolver.resolve({}, lookupStartPath, request, (err/*Error*/, filepath/*string*/) => { | ||
myResolver.resolve({}, lookupStartPath, request, resolveContext, (err/*Error*/, filepath/*string*/) => { | ||
// Do something with the path | ||
@@ -52,17 +53,18 @@ }); | ||
| ------------------------ | --------------------------- | ---------------------------------------------------------------------------------- | | ||
| modules | ["node_modules"] | A list of directories to resolve modules from, can be absolute path or folder name | | ||
| alias | [] | A list of module alias configurations or an object which maps key to value | | ||
| aliasFields | [] | A list of alias fields in description files | | ||
| cacheWithContext | true | If unsafe cache is enabled, includes `request.context` in the cache key | | ||
| descriptionFiles | ["package.json"] | A list of description files to read from | | ||
| plugins | [] | A list of additional resolve plugins which should be applied | | ||
| enforceExtension | false | Enforce that a extension from extensions must be used | | ||
| enforceModuleExtension | false | Enforce that a extension from moduleExtensions must be used | | ||
| extensions | [".js", ".json", ".node"] | A list of extensions which should be tried for files | | ||
| mainFields | ["main"] | A list of main fields in description files | | ||
| aliasFields | [] | A list of alias fields in description files | | ||
| mainFiles | ["index"] | A list of main files in directories | | ||
| extensions | [".js", ".json", ".node"] | A list of extensions which should be tried for files | | ||
| enforceExtension | false | Enforce that a extension from extensions must be used | | ||
| modules | ["node_modules"] | A list of directories to resolve modules from, can be absolute path or folder name | | ||
| unsafeCache | false | Use this cache object to unsafely cache the successful requests | | ||
| plugins | [] | A list of additional resolve plugins which should be applied | | ||
| symlinks | false | Whether to resolve symlinks to their symlinked location | | ||
| 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. | | ||
| moduleExtensions | [] | A list of module extensions which should be tried for modules | | ||
| enforceModuleExtension | false | Enforce that a extension from moduleExtensions must be used | | ||
| alias | [] | A list of module alias configurations or an object which maps key to value | | ||
| resolveToContext | false | Resolve to a context instead of a file | | ||
| unsafeCache | false | Use this cache object to unsafely cache the successful requests | | ||
| cacheWithContext | true | If unsafe cache is enabled, includes `request.context` in the cache key | | ||
| 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. | | ||
| fileSystem | | The file system which should be used | | ||
@@ -69,0 +71,0 @@ | resolver | undefined | A prepared Resolver to which the plugins are attached | |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
87441
42
2430
0
121
Updatedtapable@^1.0.0