Skip to content

Commit beff64e

Browse files
authoredMay 21, 2021
refactor: nodejs v10 dropped (#606)
BREAKING CHANGE: minimum supported `Node.js` version is `12.13.0`
1 parent 3a1139e commit beff64e

11 files changed

+2106
-1867
lines changed
 

‎.github/workflows/nodejs.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ jobs:
2929
with:
3030
fetch-depth: 0
3131

32-
- name: Use Node.js ${{ env.node-version }}
32+
- name: Use Node.js ${{ matrix.node-version }}
3333
uses: actions/setup-node@v1
3434
with:
35-
node-version: ${{ env.node-version }}
35+
node-version: ${{ matrix.node-version }}
3636

3737
- name: Use latest NPM
3838
run: sudo npm i -g npm
@@ -55,7 +55,7 @@ jobs:
5555
strategy:
5656
matrix:
5757
os: [ubuntu-latest, windows-latest, macos-latest]
58-
node-version: [10.x, 12.x, 14.x]
58+
node-version: [12.x, 14.x, 16.x]
5959
webpack-version: [latest]
6060

6161
runs-on: ${{ matrix.os }}

‎.husky/commit-msg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
npx commitlint --edit $1
4+
npx --no-install commitlint --edit $1

‎.husky/pre-commit

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
npx lint-staged
4+
npx --no-install lint-staged

‎babel.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = (api) => {
1010
"@babel/preset-env",
1111
{
1212
targets: {
13-
node: "10.13.0",
13+
node: "12.13.0",
1414
},
1515
},
1616
],

‎package-lock.json

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

‎package.json

+19-20
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"main": "dist/cjs.js",
1515
"engines": {
16-
"node": ">= 10.13.0"
16+
"node": ">= 12.13.0"
1717
},
1818
"scripts": {
1919
"start": "npm run build -- -w",
@@ -31,8 +31,7 @@
3131
"pretest": "npm run lint",
3232
"test": "npm run test:coverage",
3333
"prepare": "husky install && npm run build",
34-
"release": "standard-version",
35-
"defaults": "webpack-defaults"
34+
"release": "standard-version"
3635
},
3736
"files": [
3837
"dist"
@@ -42,38 +41,38 @@
4241
},
4342
"dependencies": {
4443
"fast-glob": "^3.2.5",
45-
"glob-parent": "^5.1.1",
44+
"glob-parent": "^6.0.0",
4645
"globby": "^11.0.3",
4746
"normalize-path": "^3.0.0",
4847
"p-limit": "^3.1.0",
4948
"schema-utils": "^3.0.0",
5049
"serialize-javascript": "^5.0.1"
5150
},
5251
"devDependencies": {
53-
"@babel/cli": "^7.13.10",
54-
"@babel/core": "^7.13.10",
55-
"@babel/preset-env": "^7.13.12",
56-
"@commitlint/cli": "^12.0.1",
57-
"@commitlint/config-conventional": "^12.0.1",
52+
"@babel/cli": "^7.14.3",
53+
"@babel/core": "^7.14.3",
54+
"@babel/preset-env": "^7.14.2",
55+
"@commitlint/cli": "^12.1.4",
56+
"@commitlint/config-conventional": "^12.1.4",
5857
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
5958
"babel-jest": "^26.6.3",
60-
"cross-env": "^7.0.2",
59+
"cross-env": "^7.0.3",
6160
"del": "^6.0.0",
6261
"del-cli": "^3.0.1",
63-
"eslint": "^7.22.0",
64-
"eslint-config-prettier": "^8.1.0",
65-
"eslint-plugin-import": "^2.22.1",
66-
"file-loader": "^6.1.1",
67-
"husky": "^5.2.0",
62+
"eslint": "^7.26.0",
63+
"eslint-config-prettier": "^8.3.0",
64+
"eslint-plugin-import": "^2.23.2",
65+
"file-loader": "^6.2.0",
66+
"husky": "^6.0.0",
6867
"is-gzip": "^2.0.0",
6968
"jest": "^26.6.3",
70-
"lint-staged": "^10.5.4",
71-
"memfs": "^3.2.0",
69+
"lint-staged": "^11.0.0",
70+
"memfs": "^3.2.2",
7271
"mkdirp": "^1.0.4",
7372
"npm-run-all": "^4.1.5",
74-
"prettier": "^2.1.2",
75-
"standard-version": "^9.1.1",
76-
"webpack": "^5.27.2"
73+
"prettier": "^2.3.0",
74+
"standard-version": "^9.3.0",
75+
"webpack": "^5.37.1"
7776
},
7877
"keywords": [
7978
"webpack",

‎src/index.js

+7-21
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,8 @@ class CopyPlugin {
7171

7272
static getContentHash(compiler, compilation, source) {
7373
const { outputOptions } = compilation;
74-
const {
75-
hashDigest,
76-
hashDigestLength,
77-
hashFunction,
78-
hashSalt,
79-
} = outputOptions;
74+
const { hashDigest, hashDigestLength, hashFunction, hashSalt } =
75+
outputOptions;
8076
const hash = compiler.webpack.util.createHash(hashFunction);
8177

8278
if (hashSalt) {
@@ -567,13 +563,8 @@ class CopyPlugin {
567563
contentHash,
568564
},
569565
};
570-
const {
571-
path: interpolatedFilename,
572-
info: assetInfo,
573-
} = compilation.getPathWithInfo(
574-
normalizePath(result.filename),
575-
data
576-
);
566+
const { path: interpolatedFilename, info: assetInfo } =
567+
compilation.getPathWithInfo(normalizePath(result.filename), data);
577568

578569
result.info = { ...result.info, ...assetInfo };
579570
result.filename = interpolatedFilename;
@@ -715,19 +706,14 @@ class CopyPlugin {
715706
transformedAsset.data
716707
);
717708

718-
const {
719-
path: interpolatedFilename,
720-
info: assetInfo,
721-
} = compilation.getPathWithInfo(
722-
normalizePath(item.to),
723-
{
709+
const { path: interpolatedFilename, info: assetInfo } =
710+
compilation.getPathWithInfo(normalizePath(item.to), {
724711
contentHash,
725712
chunk: {
726713
hash: contentHash,
727714
contentHash,
728715
},
729-
}
730-
);
716+
});
731717

732718
transformedAsset.filename = interpolatedFilename;
733719
transformedAsset.info = assetInfo;

‎test/CopyPlugin.test.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import path from "path";
22

3+
// eslint-disable-next-line import/no-extraneous-dependencies
34
import webpack from "webpack";
5+
// eslint-disable-next-line import/no-extraneous-dependencies
46
import del from "del";
7+
// eslint-disable-next-line import/no-extraneous-dependencies
58
import { createFsFromVolume, Volume } from "memfs";
69

710
import CopyPlugin from "../src/index";

‎test/helpers/getCompiler.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import path from "path";
22

3+
// eslint-disable-next-line import/no-extraneous-dependencies
34
import webpack from "webpack";
5+
// eslint-disable-next-line import/no-extraneous-dependencies
46
import { createFsFromVolume, Volume } from "memfs";
57

68
export default (config = {}) => {

‎test/to-option.test.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -961,8 +961,7 @@ describe("to option", () => {
961961
patterns: [
962962
{
963963
from: "directory/directoryfile.*",
964-
to:
965-
"[path][base]-new-[name][ext].[contenthash].[hash]-[fullhash][ext]--[unknown]",
964+
to: "[path][base]-new-[name][ext].[contenthash].[hash]-[fullhash][ext]--[unknown]",
966965
},
967966
],
968967
})

‎test/toType-option.test.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ describe("toType option", () => {
4545
patterns: [
4646
{
4747
from: "directory/directoryfile.*",
48-
to:
49-
"[path][base]-new-[name][ext].[contenthash].[hash]-[fullhash][ext]",
48+
to: "[path][base]-new-[name][ext].[contenthash].[hash]-[fullhash][ext]",
5049
toType: "template",
5150
},
5251
],

0 commit comments

Comments
 (0)
Please sign in to comment.