Skip to content

Commit

Permalink
chore: update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
cap-Bernardito committed Aug 26, 2020
1 parent 21832c7 commit ca8c327
Show file tree
Hide file tree
Showing 24 changed files with 6,081 additions and 3,980 deletions.
4 changes: 0 additions & 4 deletions .editorconfig
Expand Up @@ -9,8 +9,4 @@ insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
insert_final_newline = true
trim_trailing_whitespace = false

[test/cases/**]
insert_final_newline = false
2 changes: 1 addition & 1 deletion lint-staged.config.js
@@ -1,4 +1,4 @@
module.exports = {
'*.js': ['prettier --write', 'eslint --fix', 'git add'],
'*.{json,md,yml,css}': ['prettier --write', 'git add'],
'*.{json,md,yml,css,ts}': ['prettier --write', 'git add'],
};
9,893 changes: 5,982 additions & 3,911 deletions package-lock.json

Large diffs are not rendered by default.

46 changes: 23 additions & 23 deletions package.json
Expand Up @@ -22,15 +22,15 @@
"postbuild": "es-check es5 dist/hmr/hotModuleReplacement.js",
"clean": "del-cli dist",
"commitlint": "commitlint --from=master",
"lint:prettier": "prettier \"{**/*,*}.{js,json,md,yml,css}\" --list-different",
"lint:js": "eslint --cache src test",
"lint:prettier": "prettier \"{**/*,*}.{js,json,md,yml,css,ts}\" --list-different",
"lint:js": "eslint --cache .",
"lint": "npm-run-all -l -p \"lint:**\"",
"prepare": "npm run build",
"release": "standard-version",
"security": "npm audit",
"test:only": "cross-env NODE_ENV=test jest",
"test:watch": "cross-env NODE_ENV=test jest --watch",
"test:coverage": "cross-env NODE_ENV=test jest --collectCoverageFrom=\"src/**/*.js\" --coverage",
"test:watch": "npm run test:only -- --watch",
"test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",
"test:manual": "npm run build && webpack-dev-server test/manual/src/index.js --open --config test/manual/webpack.config.js",
"pretest": "npm run lint",
"test": "cross-env NODE_ENV=test npm run test:coverage",
Expand All @@ -49,31 +49,31 @@
"webpack-sources": "^1.1.0"
},
"devDependencies": {
"@babel/cli": "^7.7.5",
"@babel/core": "^7.7.5",
"@babel/preset-env": "^7.7.6",
"@commitlint/cli": "^8.1.0",
"@commitlint/config-conventional": "^8.1.0",
"@webpack-contrib/defaults": "^5.0.2",
"@babel/cli": "^7.10.5",
"@babel/core": "^7.11.4",
"@babel/preset-env": "^7.11.0",
"@commitlint/cli": "^9.1.2",
"@commitlint/config-conventional": "^9.1.2",
"@webpack-contrib/defaults": "^6.3.0",
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
"babel-eslint": "^10.0.2",
"babel-jest": "^24.8.0",
"cross-env": "^5.2.0",
"css-loader": "^3.3.2",
"del": "^4.1.1",
"del-cli": "^1.1.0",
"babel-jest": "^26.3.0",
"cross-env": "^7.0.2",
"css-loader": "^4.2.2",
"del": "^5.1.0",
"del-cli": "^3.0.1",
"es-check": "^5.0.0",
"eslint": "^6.7.2",
"eslint": "^7.7.0",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-import": "^2.19.1",
"file-loader": "^4.0.0",
"husky": "^3.0.0",
"jest": "^24.8.0",
"lint-staged": "^9.5.0",
"eslint-plugin-import": "^2.22.0",
"file-loader": "^6.0.0",
"husky": "^4.2.5",
"jest": "^24.9.0",
"lint-staged": "^10.2.13",
"memfs": "^3.0.2",
"npm-run-all": "^4.1.5",
"prettier": "^1.19.1",
"standard-version": "^8.0.1",
"prettier": "^2.1.1",
"standard-version": "^9.0.0",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.6",
"webpack-dev-server": "^3.7.2"
Expand Down
6 changes: 3 additions & 3 deletions src/hmr/hotModuleReplacement.js
Expand Up @@ -16,7 +16,7 @@ const { forEach } = Array.prototype;
function debounce(fn, time) {
let timeout = 0;

return function() {
return function () {
const self = this;
// eslint-disable-next-line prefer-rest-params
const args = arguments;
Expand Down Expand Up @@ -50,7 +50,7 @@ function getCurrentScriptUrl(moduleId) {
srcByModuleId[moduleId] = src;
}

return function(fileMap) {
return function (fileMap) {
if (!src) {
return null;
}
Expand Down Expand Up @@ -195,7 +195,7 @@ function isUrlRequest(url) {
return true;
}

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

Expand Down
3 changes: 2 additions & 1 deletion src/loader.js
Expand Up @@ -223,4 +223,5 @@ export function pitch(request) {
});
}

export default function() {}
// eslint-disable-next-line func-names
export default function () {}
54 changes: 43 additions & 11 deletions test/TestCases.test.js
Expand Up @@ -7,6 +7,23 @@ import path from 'path';

import webpack from 'webpack';

function clearDirectory(dirPath) {
let files;

try {
files = fs.readdirSync(dirPath);
} catch (e) {
return;
}
if (files.length > 0)
for (let i = 0; i < files.length; i++) {
const filePath = `${dirPath}/${files[i]}`;
if (fs.statSync(filePath).isFile()) fs.unlinkSync(filePath);
else clearDirectory(filePath);
}
fs.rmdirSync(dirPath);
}

function compareDirectory(actual, expected) {
const files = fs.readdirSync(expected);

Expand All @@ -22,7 +39,19 @@ function compareDirectory(actual, expected) {
);
} else if (stats.isFile()) {
const content = fs.readFileSync(path.resolve(expected, file), 'utf8');
const actualContent = fs.readFileSync(path.resolve(actual, file), 'utf8');
let actualContent;

try {
actualContent = fs.readFileSync(path.resolve(actual, file), 'utf8');
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);

const dir = fs.readdirSync(actual);

// eslint-disable-next-line no-console
console.log({ [actual]: dir });
}

expect(actualContent).toEqual(content);
}
Expand All @@ -48,6 +77,8 @@ describe('TestCases', () => {
return true;
});

clearDirectory(outputDirectory);

for (const directory of tests) {
if (!/^(\.|_)/.test(directory)) {
// eslint-disable-next-line no-loop-func
Expand Down Expand Up @@ -86,21 +117,22 @@ describe('TestCases', () => {
done();

// eslint-disable-next-line no-console
console.log(
stats.toString({
context: path.resolve(__dirname, '..'),
chunks: true,
chunkModules: true,
modules: false,
})
);

if (stats.hasErrors()) {
// console.log(
// stats.toString({
// context: path.resolve(__dirname, '..'),
// chunks: true,
// chunkModules: true,
// modules: false,
// })
// );

if (stats.hasErrors() && stats.hasWarnings()) {
done(
new Error(
stats.toString({
context: path.resolve(__dirname, '..'),
errorDetails: true,
warnings: true,
})
)
);
Expand Down
@@ -0,0 +1,4 @@
._1vsR78e9UKJf5jCq7eLSYu {
background: red;
}

This file was deleted.

@@ -0,0 +1,5 @@

._1vsR78e9UKJf5jCq7eLSYu {
background: green;
}

This file was deleted.

@@ -0,0 +1,5 @@

._1vsR78e9UKJf5jCq7eLSYu {
background: green;
}

This file was deleted.

@@ -0,0 +1,4 @@
._1vsR78e9UKJf5jCq7eLSYu {
background: red;
}

This file was deleted.

2 changes: 1 addition & 1 deletion test/cases/publicpath-emptystring/expected/main.css
@@ -1,5 +1,5 @@
body {
background: red;
background-image: url(cd0bb358c45b584743d8ce4991777c42.svg);
background-image: url(c9e192c015437a21dea1faa1d30f4941.svg);
}

@@ -1,5 +1,5 @@
body {
background: green;
background-image: url(../../cd0bb358c45b584743d8ce4991777c42.svg);
background-image: url(../../c9e192c015437a21dea1faa1d30f4941.svg);
}

2 changes: 1 addition & 1 deletion test/cases/publicpath-function/expected/nested/style.css
@@ -1,5 +1,5 @@
body {
background: red;
background-image: url(../cd0bb358c45b584743d8ce4991777c42.svg);
background-image: url(../c9e192c015437a21dea1faa1d30f4941.svg);
}

2 changes: 1 addition & 1 deletion test/cases/publicpath-trailing-slash/expected/main.css
@@ -1,5 +1,5 @@
body {
background: red;
background-image: url(/static/img/cd0bb358c45b584743d8ce4991777c42.svg);
background-image: url(/static/img/c9e192c015437a21dea1faa1d30f4941.svg);
}

2 changes: 1 addition & 1 deletion test/cases/simple-async-source-map/expected/1.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/cases/simple-async-source-map/expected/2.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/cases/simple-async-source-map/expected/main.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/cases/simple-publicpath/expected/main.css
@@ -1,5 +1,5 @@
body {
background: red;
background-image: url(/static/img/cd0bb358c45b584743d8ce4991777c42.svg);
background-image: url(/static/img/c9e192c015437a21dea1faa1d30f4941.svg);
}

1 change: 1 addition & 0 deletions test/helpers/source.js
Expand Up @@ -15,5 +15,6 @@ export default function getSource(name, stats) {
}
}

// eslint-disable-next-line no-undefined
return undefined;
}

0 comments on commit ca8c327

Please sign in to comment.