Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Node.js v10 dropped #606

Merged
merged 1 commit into from May 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/nodejs.yml
Expand Up @@ -29,10 +29,10 @@ jobs:
with:
fetch-depth: 0

- name: Use Node.js ${{ env.node-version }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.node-version }}
node-version: ${{ matrix.node-version }}

- name: Use latest NPM
run: sudo npm i -g npm
Expand All @@ -55,7 +55,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [10.x, 12.x, 14.x]
node-version: [12.x, 14.x, 16.x]
webpack-version: [latest]

runs-on: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion .husky/commit-msg
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx commitlint --edit $1
npx --no-install commitlint --edit $1
2 changes: 1 addition & 1 deletion .husky/pre-commit
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
npx --no-install lint-staged
2 changes: 1 addition & 1 deletion babel.config.js
Expand Up @@ -10,7 +10,7 @@ module.exports = (api) => {
"@babel/preset-env",
{
targets: {
node: "10.13.0",
node: "12.13.0",
},
},
],
Expand Down
3,883 changes: 2,067 additions & 1,816 deletions package-lock.json

Large diffs are not rendered by default.

39 changes: 19 additions & 20 deletions package.json
Expand Up @@ -13,7 +13,7 @@
},
"main": "dist/cjs.js",
"engines": {
"node": ">= 10.13.0"
"node": ">= 12.13.0"
},
"scripts": {
"start": "npm run build -- -w",
Expand All @@ -31,8 +31,7 @@
"pretest": "npm run lint",
"test": "npm run test:coverage",
"prepare": "husky install && npm run build",
"release": "standard-version",
"defaults": "webpack-defaults"
"release": "standard-version"
},
"files": [
"dist"
Expand All @@ -42,38 +41,38 @@
},
"dependencies": {
"fast-glob": "^3.2.5",
"glob-parent": "^5.1.1",
"glob-parent": "^6.0.0",
"globby": "^11.0.3",
"normalize-path": "^3.0.0",
"p-limit": "^3.1.0",
"schema-utils": "^3.0.0",
"serialize-javascript": "^5.0.1"
},
"devDependencies": {
"@babel/cli": "^7.13.10",
"@babel/core": "^7.13.10",
"@babel/preset-env": "^7.13.12",
"@commitlint/cli": "^12.0.1",
"@commitlint/config-conventional": "^12.0.1",
"@babel/cli": "^7.14.3",
"@babel/core": "^7.14.3",
"@babel/preset-env": "^7.14.2",
"@commitlint/cli": "^12.1.4",
"@commitlint/config-conventional": "^12.1.4",
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
"babel-jest": "^26.6.3",
"cross-env": "^7.0.2",
"cross-env": "^7.0.3",
"del": "^6.0.0",
"del-cli": "^3.0.1",
"eslint": "^7.22.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-import": "^2.22.1",
"file-loader": "^6.1.1",
"husky": "^5.2.0",
"eslint": "^7.26.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.23.2",
"file-loader": "^6.2.0",
"husky": "^6.0.0",
"is-gzip": "^2.0.0",
"jest": "^26.6.3",
"lint-staged": "^10.5.4",
"memfs": "^3.2.0",
"lint-staged": "^11.0.0",
"memfs": "^3.2.2",
"mkdirp": "^1.0.4",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.2",
"standard-version": "^9.1.1",
"webpack": "^5.27.2"
"prettier": "^2.3.0",
"standard-version": "^9.3.0",
"webpack": "^5.37.1"
},
"keywords": [
"webpack",
Expand Down
28 changes: 7 additions & 21 deletions src/index.js
Expand Up @@ -71,12 +71,8 @@ class CopyPlugin {

static getContentHash(compiler, compilation, source) {
const { outputOptions } = compilation;
const {
hashDigest,
hashDigestLength,
hashFunction,
hashSalt,
} = outputOptions;
const { hashDigest, hashDigestLength, hashFunction, hashSalt } =
outputOptions;
const hash = compiler.webpack.util.createHash(hashFunction);

if (hashSalt) {
Expand Down Expand Up @@ -567,13 +563,8 @@ class CopyPlugin {
contentHash,
},
};
const {
path: interpolatedFilename,
info: assetInfo,
} = compilation.getPathWithInfo(
normalizePath(result.filename),
data
);
const { path: interpolatedFilename, info: assetInfo } =
compilation.getPathWithInfo(normalizePath(result.filename), data);

result.info = { ...result.info, ...assetInfo };
result.filename = interpolatedFilename;
Expand Down Expand Up @@ -715,19 +706,14 @@ class CopyPlugin {
transformedAsset.data
);

const {
path: interpolatedFilename,
info: assetInfo,
} = compilation.getPathWithInfo(
normalizePath(item.to),
{
const { path: interpolatedFilename, info: assetInfo } =
compilation.getPathWithInfo(normalizePath(item.to), {
contentHash,
chunk: {
hash: contentHash,
contentHash,
},
}
);
});

transformedAsset.filename = interpolatedFilename;
transformedAsset.info = assetInfo;
Expand Down
3 changes: 3 additions & 0 deletions test/CopyPlugin.test.js
@@ -1,7 +1,10 @@
import path from "path";

// eslint-disable-next-line import/no-extraneous-dependencies
import webpack from "webpack";
// eslint-disable-next-line import/no-extraneous-dependencies
import del from "del";
// eslint-disable-next-line import/no-extraneous-dependencies
import { createFsFromVolume, Volume } from "memfs";

import CopyPlugin from "../src/index";
Expand Down
2 changes: 2 additions & 0 deletions test/helpers/getCompiler.js
@@ -1,6 +1,8 @@
import path from "path";

// eslint-disable-next-line import/no-extraneous-dependencies
import webpack from "webpack";
// eslint-disable-next-line import/no-extraneous-dependencies
import { createFsFromVolume, Volume } from "memfs";

export default (config = {}) => {
Expand Down
3 changes: 1 addition & 2 deletions test/to-option.test.js
Expand Up @@ -961,8 +961,7 @@ describe("to option", () => {
patterns: [
{
from: "directory/directoryfile.*",
to:
"[path][base]-new-[name][ext].[contenthash].[hash]-[fullhash][ext]--[unknown]",
to: "[path][base]-new-[name][ext].[contenthash].[hash]-[fullhash][ext]--[unknown]",
},
],
})
Expand Down
3 changes: 1 addition & 2 deletions test/toType-option.test.js
Expand Up @@ -45,8 +45,7 @@ describe("toType option", () => {
patterns: [
{
from: "directory/directoryfile.*",
to:
"[path][base]-new-[name][ext].[contenthash].[hash]-[fullhash][ext]",
to: "[path][base]-new-[name][ext].[contenthash].[hash]-[fullhash][ext]",
toType: "template",
},
],
Expand Down