Skip to content

Commit ca8c327

Browse files
chore: update deps
1 parent 21832c7 commit ca8c327

24 files changed

+6081
-3980
lines changed

.editorconfig

-4
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,4 @@ insert_final_newline = true
99
trim_trailing_whitespace = true
1010

1111
[*.md]
12-
insert_final_newline = true
1312
trim_trailing_whitespace = false
14-
15-
[test/cases/**]
16-
insert_final_newline = false

lint-staged.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
22
'*.js': ['prettier --write', 'eslint --fix', 'git add'],
3-
'*.{json,md,yml,css}': ['prettier --write', 'git add'],
3+
'*.{json,md,yml,css,ts}': ['prettier --write', 'git add'],
44
};

package-lock.json

+5,982-3,911
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+23-23
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
"postbuild": "es-check es5 dist/hmr/hotModuleReplacement.js",
2323
"clean": "del-cli dist",
2424
"commitlint": "commitlint --from=master",
25-
"lint:prettier": "prettier \"{**/*,*}.{js,json,md,yml,css}\" --list-different",
26-
"lint:js": "eslint --cache src test",
25+
"lint:prettier": "prettier \"{**/*,*}.{js,json,md,yml,css,ts}\" --list-different",
26+
"lint:js": "eslint --cache .",
2727
"lint": "npm-run-all -l -p \"lint:**\"",
2828
"prepare": "npm run build",
2929
"release": "standard-version",
3030
"security": "npm audit",
3131
"test:only": "cross-env NODE_ENV=test jest",
32-
"test:watch": "cross-env NODE_ENV=test jest --watch",
33-
"test:coverage": "cross-env NODE_ENV=test jest --collectCoverageFrom=\"src/**/*.js\" --coverage",
32+
"test:watch": "npm run test:only -- --watch",
33+
"test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",
3434
"test:manual": "npm run build && webpack-dev-server test/manual/src/index.js --open --config test/manual/webpack.config.js",
3535
"pretest": "npm run lint",
3636
"test": "cross-env NODE_ENV=test npm run test:coverage",
@@ -49,31 +49,31 @@
4949
"webpack-sources": "^1.1.0"
5050
},
5151
"devDependencies": {
52-
"@babel/cli": "^7.7.5",
53-
"@babel/core": "^7.7.5",
54-
"@babel/preset-env": "^7.7.6",
55-
"@commitlint/cli": "^8.1.0",
56-
"@commitlint/config-conventional": "^8.1.0",
57-
"@webpack-contrib/defaults": "^5.0.2",
52+
"@babel/cli": "^7.10.5",
53+
"@babel/core": "^7.11.4",
54+
"@babel/preset-env": "^7.11.0",
55+
"@commitlint/cli": "^9.1.2",
56+
"@commitlint/config-conventional": "^9.1.2",
57+
"@webpack-contrib/defaults": "^6.3.0",
5858
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
5959
"babel-eslint": "^10.0.2",
60-
"babel-jest": "^24.8.0",
61-
"cross-env": "^5.2.0",
62-
"css-loader": "^3.3.2",
63-
"del": "^4.1.1",
64-
"del-cli": "^1.1.0",
60+
"babel-jest": "^26.3.0",
61+
"cross-env": "^7.0.2",
62+
"css-loader": "^4.2.2",
63+
"del": "^5.1.0",
64+
"del-cli": "^3.0.1",
6565
"es-check": "^5.0.0",
66-
"eslint": "^6.7.2",
66+
"eslint": "^7.7.0",
6767
"eslint-config-prettier": "^6.0.0",
68-
"eslint-plugin-import": "^2.19.1",
69-
"file-loader": "^4.0.0",
70-
"husky": "^3.0.0",
71-
"jest": "^24.8.0",
72-
"lint-staged": "^9.5.0",
68+
"eslint-plugin-import": "^2.22.0",
69+
"file-loader": "^6.0.0",
70+
"husky": "^4.2.5",
71+
"jest": "^24.9.0",
72+
"lint-staged": "^10.2.13",
7373
"memfs": "^3.0.2",
7474
"npm-run-all": "^4.1.5",
75-
"prettier": "^1.19.1",
76-
"standard-version": "^8.0.1",
75+
"prettier": "^2.1.1",
76+
"standard-version": "^9.0.0",
7777
"webpack": "^4.44.1",
7878
"webpack-cli": "^3.3.6",
7979
"webpack-dev-server": "^3.7.2"

src/hmr/hotModuleReplacement.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const { forEach } = Array.prototype;
1616
function debounce(fn, time) {
1717
let timeout = 0;
1818

19-
return function() {
19+
return function () {
2020
const self = this;
2121
// eslint-disable-next-line prefer-rest-params
2222
const args = arguments;
@@ -50,7 +50,7 @@ function getCurrentScriptUrl(moduleId) {
5050
srcByModuleId[moduleId] = src;
5151
}
5252

53-
return function(fileMap) {
53+
return function (fileMap) {
5454
if (!src) {
5555
return null;
5656
}
@@ -195,7 +195,7 @@ function isUrlRequest(url) {
195195
return true;
196196
}
197197

198-
module.exports = function(moduleId, options) {
198+
module.exports = function (moduleId, options) {
199199
if (noDocument) {
200200
console.log('no window.document found, will not HMR CSS');
201201

src/loader.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -223,4 +223,5 @@ export function pitch(request) {
223223
});
224224
}
225225

226-
export default function() {}
226+
// eslint-disable-next-line func-names
227+
export default function () {}

test/TestCases.test.js

+43-11
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,23 @@ import path from 'path';
77

88
import webpack from 'webpack';
99

10+
function clearDirectory(dirPath) {
11+
let files;
12+
13+
try {
14+
files = fs.readdirSync(dirPath);
15+
} catch (e) {
16+
return;
17+
}
18+
if (files.length > 0)
19+
for (let i = 0; i < files.length; i++) {
20+
const filePath = `${dirPath}/${files[i]}`;
21+
if (fs.statSync(filePath).isFile()) fs.unlinkSync(filePath);
22+
else clearDirectory(filePath);
23+
}
24+
fs.rmdirSync(dirPath);
25+
}
26+
1027
function compareDirectory(actual, expected) {
1128
const files = fs.readdirSync(expected);
1229

@@ -22,7 +39,19 @@ function compareDirectory(actual, expected) {
2239
);
2340
} else if (stats.isFile()) {
2441
const content = fs.readFileSync(path.resolve(expected, file), 'utf8');
25-
const actualContent = fs.readFileSync(path.resolve(actual, file), 'utf8');
42+
let actualContent;
43+
44+
try {
45+
actualContent = fs.readFileSync(path.resolve(actual, file), 'utf8');
46+
} catch (error) {
47+
// eslint-disable-next-line no-console
48+
console.log(error);
49+
50+
const dir = fs.readdirSync(actual);
51+
52+
// eslint-disable-next-line no-console
53+
console.log({ [actual]: dir });
54+
}
2655

2756
expect(actualContent).toEqual(content);
2857
}
@@ -48,6 +77,8 @@ describe('TestCases', () => {
4877
return true;
4978
});
5079

80+
clearDirectory(outputDirectory);
81+
5182
for (const directory of tests) {
5283
if (!/^(\.|_)/.test(directory)) {
5384
// eslint-disable-next-line no-loop-func
@@ -86,21 +117,22 @@ describe('TestCases', () => {
86117
done();
87118

88119
// eslint-disable-next-line no-console
89-
console.log(
90-
stats.toString({
91-
context: path.resolve(__dirname, '..'),
92-
chunks: true,
93-
chunkModules: true,
94-
modules: false,
95-
})
96-
);
97-
98-
if (stats.hasErrors()) {
120+
// console.log(
121+
// stats.toString({
122+
// context: path.resolve(__dirname, '..'),
123+
// chunks: true,
124+
// chunkModules: true,
125+
// modules: false,
126+
// })
127+
// );
128+
129+
if (stats.hasErrors() && stats.hasWarnings()) {
99130
done(
100131
new Error(
101132
stats.toString({
102133
context: path.resolve(__dirname, '..'),
103134
errorDetails: true,
135+
warnings: true,
104136
})
105137
)
106138
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
._1vsR78e9UKJf5jCq7eLSYu {
2+
background: red;
3+
}
4+

test/cases/js-hash/expected/webpack-4/style.922798e08e96756adb4a.1.css

-4
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
._1vsR78e9UKJf5jCq7eLSYu {
3+
background: green;
4+
}
5+

test/cases/js-hash/expected/webpack-4/style.fe78b7a6c50df391f00c.2.css

-5
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
._1vsR78e9UKJf5jCq7eLSYu {
3+
background: green;
4+
}
5+

test/cases/js-hash/expected/webpack-5/style.4f0aa841b4118672e0bb.1.css

-4
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
._1vsR78e9UKJf5jCq7eLSYu {
2+
background: red;
3+
}
4+

test/cases/js-hash/expected/webpack-5/style.e1a3bf1ea392f574ca3d.2.css

-5
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
body {
22
background: red;
3-
background-image: url(cd0bb358c45b584743d8ce4991777c42.svg);
3+
background-image: url(c9e192c015437a21dea1faa1d30f4941.svg);
44
}
55

Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
body {
22
background: green;
3-
background-image: url(../../cd0bb358c45b584743d8ce4991777c42.svg);
3+
background-image: url(../../c9e192c015437a21dea1faa1d30f4941.svg);
44
}
55

Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
body {
22
background: red;
3-
background-image: url(../cd0bb358c45b584743d8ce4991777c42.svg);
3+
background-image: url(../c9e192c015437a21dea1faa1d30f4941.svg);
44
}
55

Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
body {
22
background: red;
3-
background-image: url(/static/img/cd0bb358c45b584743d8ce4991777c42.svg);
3+
background-image: url(/static/img/c9e192c015437a21dea1faa1d30f4941.svg);
44
}
55

test/cases/simple-async-source-map/expected/1.css.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/cases/simple-async-source-map/expected/2.css.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/cases/simple-async-source-map/expected/main.css.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
body {
22
background: red;
3-
background-image: url(/static/img/cd0bb358c45b584743d8ce4991777c42.svg);
3+
background-image: url(/static/img/c9e192c015437a21dea1faa1d30f4941.svg);
44
}
55

test/helpers/source.js

+1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ export default function getSource(name, stats) {
1515
}
1616
}
1717

18+
// eslint-disable-next-line no-undefined
1819
return undefined;
1920
}

0 commit comments

Comments
 (0)