Skip to content

Commit 87df621

Browse files
authored
Merge pull request #246 from webpack/deps/upgrade
update dependencies
2 parents aa18aea + 4d4cd2e commit 87df621

24 files changed

+1680
-2635
lines changed

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package.json
2+
test/**/*.*
3+
!test/*.js

.prettierrc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ module.exports = {
22
printWidth: 80,
33
useTabs: true,
44
tabWidth: 2,
5+
trailingComma: "none",
6+
arrowParens: "avoid",
57
overrides: [
68
{
79
files: "*.json",

lib/CachedInputFileSystem.js

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -377,26 +377,32 @@ module.exports = class CachedInputFileSystem {
377377
this.fileSystem.statSync,
378378
this.fileSystem
379379
);
380-
this.stat = /** @type {FileSystem["stat"]} */ (this._statBackend.provide);
381-
this.statSync = /** @type {SyncFileSystem["statSync"]} */ (this._statBackend.provideSync);
380+
const stat = this._statBackend.provide;
381+
this.stat = /** @type {FileSystem["stat"]} */ (stat);
382+
const statSync = this._statBackend.provideSync;
383+
this.statSync = /** @type {SyncFileSystem["statSync"]} */ (statSync);
382384

383385
this._readdirBackend = createBackend(
384386
duration,
385387
this.fileSystem.readdir,
386388
this.fileSystem.readdirSync,
387389
this.fileSystem
388390
);
389-
this.readdir = /** @type {FileSystem["readdir"]} */ (this._readdirBackend.provide);
390-
this.readdirSync = /** @type {SyncFileSystem["readdirSync"]} */ (this._readdirBackend.provideSync);
391+
const readdir = this._readdirBackend.provide;
392+
this.readdir = /** @type {FileSystem["readdir"]} */ (readdir);
393+
const readdirSync = this._readdirBackend.provideSync;
394+
this.readdirSync = /** @type {SyncFileSystem["readdirSync"]} */ (readdirSync);
391395

392396
this._readFileBackend = createBackend(
393397
duration,
394398
this.fileSystem.readFile,
395399
this.fileSystem.readFileSync,
396400
this.fileSystem
397401
);
398-
this.readFile = /** @type {FileSystem["readFile"]} */ (this._readFileBackend.provide);
399-
this.readFileSync = /** @type {SyncFileSystem["readFileSync"]} */ (this._readFileBackend.provideSync);
402+
const readFile = this._readFileBackend.provide;
403+
this.readFile = /** @type {FileSystem["readFile"]} */ (readFile);
404+
const readFileSync = this._readFileBackend.provideSync;
405+
this.readFileSync = /** @type {SyncFileSystem["readFileSync"]} */ (readFileSync);
400406

401407
this._readJsonBackend = createBackend(
402408
duration,
@@ -426,17 +432,21 @@ module.exports = class CachedInputFileSystem {
426432
})),
427433
this.fileSystem
428434
);
429-
this.readJson = /** @type {FileSystem["readJson"]} */ (this._readJsonBackend.provide);
430-
this.readJsonSync = /** @type {SyncFileSystem["readJsonSync"]} */ (this._readJsonBackend.provideSync);
435+
const readJson = this._readJsonBackend.provide;
436+
this.readJson = /** @type {FileSystem["readJson"]} */ (readJson);
437+
const readJsonSync = this._readJsonBackend.provideSync;
438+
this.readJsonSync = /** @type {SyncFileSystem["readJsonSync"]} */ (readJsonSync);
431439

432440
this._readlinkBackend = createBackend(
433441
duration,
434442
this.fileSystem.readlink,
435443
this.fileSystem.readlinkSync,
436444
this.fileSystem
437445
);
438-
this.readlink = /** @type {FileSystem["readlink"]} */ (this._readlinkBackend.provide);
439-
this.readlinkSync = /** @type {SyncFileSystem["readlinkSync"]} */ (this._readlinkBackend.provideSync);
446+
const readlink = this._readlinkBackend.provide;
447+
this.readlink = /** @type {FileSystem["readlink"]} */ (readlink);
448+
const readlinkSync = this._readlinkBackend.provideSync;
449+
this.readlinkSync = /** @type {SyncFileSystem["readlinkSync"]} */ (readlinkSync);
440450
}
441451

442452
purge(what) {

lib/ResolverFactory.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const UseFilePlugin = require("./UseFilePlugin");
4040
/** @typedef {import("./PnpPlugin").PnpApiImpl} PnpApi */
4141
/** @typedef {import("./Resolver").FileSystem} FileSystem */
4242
/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */
43+
/** @typedef {import("./Resolver").SyncFileSystem} SyncFileSystem */
4344

4445
/** @typedef {string|string[]|false} AliasOptionNewRequest */
4546
/** @typedef {{[k: string]: AliasOptionNewRequest}} AliasOptions */
@@ -171,7 +172,7 @@ function createOptions(options) {
171172
aliasFields: new Set(options.aliasFields),
172173
cachePredicate:
173174
options.cachePredicate ||
174-
function() {
175+
function () {
175176
return true;
176177
},
177178
cacheWithContext:
@@ -187,7 +188,11 @@ function createOptions(options) {
187188
enforceExtension: options.enforceExtension || false,
188189
extensions: new Set(options.extensions || [".js", ".json", ".node"]),
189190
fileSystem: options.useSyncFileSystemCalls
190-
? new SyncAsyncFileSystemDecorator(options.fileSystem)
191+
? new SyncAsyncFileSystemDecorator(
192+
/** @type {SyncFileSystem} */ (
193+
/** @type {unknown} */ (options.fileSystem)
194+
)
195+
)
191196
: options.fileSystem,
192197
unsafeCache:
193198
options.unsafeCache && typeof options.unsafeCache !== "object"
@@ -221,7 +226,7 @@ function createOptions(options) {
221226
* @param {UserResolveOptions} options resolve options
222227
* @returns {Resolver} created resolver
223228
*/
224-
exports.createResolver = function(options) {
229+
exports.createResolver = function (options) {
225230
const normalizedOptions = createOptions(options);
226231

227232
const {

lib/SyncAsyncFileSystemDecorator.js

Lines changed: 50 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -5,79 +5,74 @@
55

66
"use strict";
77

8+
/** @typedef {import("./Resolver").FileSystem} FileSystem */
9+
/** @typedef {import("./Resolver").SyncFileSystem} SyncFileSystem */
10+
811
/**
9-
* @param {Object} fs file system implementation
12+
* @param {SyncFileSystem} fs file system implementation
1013
* @constructor
1114
*/
1215
function SyncAsyncFileSystemDecorator(fs) {
13-
/**
14-
* @type {Object}
15-
*/
1616
this.fs = fs;
17-
if (fs.statSync) {
18-
this.stat = (arg, callback) => {
19-
let result;
20-
try {
21-
result = fs.statSync(arg);
22-
} catch (e) {
23-
return callback(e);
24-
}
25-
callback(null, result);
26-
};
17+
this.stat = (arg, callback) => {
18+
let result;
19+
try {
20+
result = fs.statSync(arg);
21+
} catch (e) {
22+
return callback(e);
23+
}
24+
callback(null, result);
25+
};
26+
this.statSync = arg => fs.statSync(arg);
2727

28-
this.statSync = arg => fs.statSync(arg);
29-
}
30-
if (fs.readdirSync) {
31-
this.readdir = (arg, callback) => {
32-
let result;
33-
try {
34-
result = fs.readdirSync(arg);
35-
} catch (e) {
36-
return callback(e);
37-
}
38-
callback(null, result);
39-
};
28+
this.readdir = (arg, callback) => {
29+
let result;
30+
try {
31+
result = fs.readdirSync(arg);
32+
} catch (e) {
33+
return callback(e);
34+
}
35+
callback(null, result);
36+
};
37+
this.readdirSync = arg => fs.readdirSync(arg);
4038

41-
this.readdirSync = arg => fs.readdirSync(arg);
42-
}
43-
if (fs.readFileSync) {
44-
this.readFile = (arg, callback) => {
45-
let result;
46-
try {
47-
result = fs.readFileSync(arg);
48-
} catch (e) {
49-
return callback(e);
50-
}
51-
callback(null, result);
52-
};
39+
this.readFile = (arg, callback) => {
40+
let result;
41+
try {
42+
result = fs.readFileSync(arg);
43+
} catch (e) {
44+
return callback(e);
45+
}
46+
callback(null, result);
47+
};
48+
this.readFileSync = arg => fs.readFileSync(arg);
5349

54-
this.readFileSync = arg => fs.readFileSync(arg);
55-
}
56-
if (fs.readlinkSync) {
57-
this.readlink = (arg, callback) => {
58-
let result;
59-
try {
60-
result = fs.readlinkSync(arg);
61-
} catch (e) {
62-
return callback(e);
63-
}
64-
callback(null, result);
65-
};
50+
this.readlink = (arg, callback) => {
51+
let result;
52+
try {
53+
result = fs.readlinkSync(arg);
54+
} catch (e) {
55+
return callback(e);
56+
}
57+
callback(null, result);
58+
};
59+
this.readlinkSync = arg => fs.readlinkSync(arg);
6660

67-
this.readlinkSync = arg => fs.readlinkSync(arg);
68-
}
69-
if (fs.readJsonSync) {
61+
this.readJson = undefined;
62+
this.readJsonSync = undefined;
63+
const readJsonSync = fs.readJsonSync;
64+
if (readJsonSync) {
7065
this.readJson = (arg, callback) => {
7166
let result;
7267
try {
73-
result = fs.readJsonSync(arg);
68+
result = readJsonSync.call(fs, arg);
7469
} catch (e) {
7570
return callback(e);
7671
}
7772
callback(null, result);
7873
};
7974

80-
this.readJsonSync = arg => fs.readJsonSync(arg);
75+
this.readJsonSync = arg => readJsonSync.call(fs, arg);
8176
}
8277
}
8378
module.exports = SyncAsyncFileSystemDecorator;

lib/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function create(options) {
6363
...options
6464
};
6565
const resolver = ResolverFactory.createResolver(options);
66-
return function(context, path, request, resolveContext, callback) {
66+
return function (context, path, request, resolveContext, callback) {
6767
if (typeof context === "string") {
6868
callback = resolveContext;
6969
resolveContext = request;
@@ -85,7 +85,7 @@ function createSync(options) {
8585
...options
8686
};
8787
const resolver = ResolverFactory.createResolver(options);
88-
return function(context, path, request) {
88+
return function (context, path, request) {
8989
if (typeof context === "string") {
9090
request = path;
9191
path = context;

package.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,27 @@
99
"LICENSE"
1010
],
1111
"dependencies": {
12-
"graceful-fs": "^4.2.0",
13-
"tapable": "^2.0.0-beta.10"
12+
"graceful-fs": "^4.2.4",
13+
"tapable": "^2.0.0"
1414
},
1515
"license": "MIT",
1616
"devDependencies": {
17-
"@types/mocha": "^7.0.2",
18-
"@types/node": "^13.7.7",
19-
"eslint": "^6.8.0",
20-
"eslint-config-prettier": "^6.10.0",
21-
"eslint-plugin-jsdoc": "^22.0.0",
22-
"eslint-plugin-node": "^11.0.0",
23-
"eslint-plugin-prettier": "^3.1.2",
24-
"husky": "^1.2.0",
25-
"lint-staged": "^8.1.0",
26-
"memfs": "^2.15.4",
27-
"mocha": "^7.1.0",
28-
"nyc": "^14.1.1",
29-
"prettier": "^1.15.2",
17+
"@types/mocha": "^8.0.3",
18+
"@types/node": "^14.11.1",
19+
"eslint": "^7.9.0",
20+
"eslint-config-prettier": "^6.11.0",
21+
"eslint-plugin-jsdoc": "^30.5.1",
22+
"eslint-plugin-node": "^11.1.0",
23+
"eslint-plugin-prettier": "^3.1.4",
24+
"husky": "^4.3.0",
25+
"lint-staged": "^10.4.0",
26+
"memfs": "^3.2.0",
27+
"mocha": "^8.1.3",
28+
"nyc": "^15.1.0",
29+
"prettier": "^2.1.2",
3030
"should": "^13.2.3",
31-
"tooling": "webpack/tooling#v1.6.0",
32-
"typescript": "^3.8.3"
31+
"tooling": "webpack/tooling#v1.8.0",
32+
"typescript": "^4.0.2"
3333
},
3434
"engines": {
3535
"node": ">=10.13.0"
@@ -45,7 +45,7 @@
4545
"type-lint": "tsc",
4646
"special-lint": "node node_modules/tooling/lockfile-lint && node node_modules/tooling/inherit-types && node node_modules/tooling/format-file-header && node node_modules/tooling/generate-types",
4747
"special-lint-fix": "node node_modules/tooling/inherit-types --write && node node_modules/tooling/format-file-header --write && node node_modules/tooling/generate-types --write",
48-
"pretty": "prettier --loglevel warn --write \"{lib,test}/**/*.{js,json}\"",
48+
"pretty": "prettier --loglevel warn --write \"lib/**/*.{js,json}\" \"test/*.js\"",
4949
"pretest": "yarn lint",
5050
"test": "mocha --full-trace --check-leaks",
5151
"precover": "yarn lint",

0 commit comments

Comments
 (0)