Skip to content

Commit 17c29a5

Browse files
fix: support webpack@5 (#146)
1 parent b896c5a commit 17c29a5

File tree

68 files changed

+3366
-2027
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+3366
-2027
lines changed

.editorconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ insert_final_newline = true
99
trim_trailing_whitespace = true
1010

1111
[*.md]
12-
insert_final_newline = true
1312
trim_trailing_whitespace = false

.github/CONTRIBUTING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,14 @@ module. Thankfully, Github provides a means to do this. Add a dependency to the
147147

148148
Where `{id}` is the # ID of your Pull Request.
149149

150+
## Contributor License Agreement
151+
152+
When submitting your contribution, a CLA (Contributor License Agreement) bot will come by to verify that you signed the [CLA](https://cla.js.foundation/webpack-contrib/compression-webpack-plugin).
153+
If it is your first time, it will link you to the right place to sign it.
154+
However, if you have committed your contributions using an email that is not the same as your email used on GitHub, the CLA bot can't accept your contribution.
155+
156+
Run `git config user.email` to see your Git email, and verify it with [your GitHub email](https://github.com/settings/emails).
157+
150158
## Thanks
151159

152160
For your interest, time, understanding, and for following this simple guide.

azure-pipelines.yml

Lines changed: 45 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ trigger:
22
- master
33
- next
44

5+
variables:
6+
npm_config_cache: $(Pipeline.Workspace)/.npm
7+
58
jobs:
69
- job: Lint
710
pool:
8-
vmImage: ubuntu-16.04
11+
vmImage: ubuntu-latest
912
steps:
1013
- task: NodeTool@0
1114
inputs:
@@ -20,10 +23,12 @@ jobs:
2023
node -v
2124
npm -v
2225
displayName: 'Print versions'
23-
- task: Npm@1
26+
- task: CacheBeta@1
2427
inputs:
25-
command: custom
26-
customCommand: ci
28+
key: npm | $(Agent.OS) | package-lock.json
29+
path: $(npm_config_cache)
30+
displayName: 'Cache npm'
31+
- script: npm ci
2732
displayName: 'Install dependencies'
2833
- script: npm run lint
2934
displayName: 'Run lint'
@@ -34,10 +39,13 @@ jobs:
3439

3540
- job: Linux
3641
pool:
37-
vmImage: ubuntu-16.04
42+
vmImage: ubuntu-latest
3843
strategy:
39-
maxParallel: 4
44+
maxParallel: 5
4045
matrix:
46+
node-13:
47+
node_version: ^13.0.0
48+
webpack_version: latest
4149
node-12:
4250
node_version: ^12.0.0
4351
webpack_version: latest
@@ -47,10 +55,9 @@ jobs:
4755
node-8:
4856
node_version: ^8.9.0
4957
webpack_version: latest
50-
node-8-canary:
51-
node_version: ^8.9.0
58+
node-10-canary:
59+
node_version: ^10.13.0
5260
webpack_version: next
53-
continue_on_error: true
5461
steps:
5562
- task: NodeTool@0
5663
inputs:
@@ -65,10 +72,12 @@ jobs:
6572
node -v
6673
npm -v
6774
displayName: 'Print versions'
68-
- task: Npm@1
75+
- task: CacheBeta@1
6976
inputs:
70-
command: custom
71-
customCommand: ci
77+
key: npm | $(Agent.OS) | package-lock.json
78+
path: $(npm_config_cache)
79+
displayName: 'Cache npm'
80+
- script: npm ci
7281
displayName: 'Install dependencies'
7382
- script: npm i webpack@$(webpack_version)
7483
displayName: 'Install "webpack@$(webpack_version)"'
@@ -86,10 +95,13 @@ jobs:
8695

8796
- job: macOS
8897
pool:
89-
vmImage: macOS-10.14
98+
vmImage: macOS-latest
9099
strategy:
91-
maxParallel: 4
100+
maxParallel: 5
92101
matrix:
102+
node-13:
103+
node_version: ^13.0.0
104+
webpack_version: latest
93105
node-12:
94106
node_version: ^12.0.0
95107
webpack_version: latest
@@ -99,10 +111,9 @@ jobs:
99111
node-8:
100112
node_version: ^8.9.0
101113
webpack_version: latest
102-
node-8-canary:
103-
node_version: ^8.9.0
114+
node-10-canary:
115+
node_version: ^10.13.0
104116
webpack_version: next
105-
continue_on_error: true
106117
steps:
107118
- task: NodeTool@0
108119
inputs:
@@ -117,10 +128,12 @@ jobs:
117128
node -v
118129
npm -v
119130
displayName: 'Print versions'
120-
- task: Npm@1
131+
- task: CacheBeta@1
121132
inputs:
122-
command: custom
123-
customCommand: ci
133+
key: npm | $(Agent.OS) | package-lock.json
134+
path: $(npm_config_cache)
135+
displayName: 'Cache npm'
136+
- script: npm ci
124137
displayName: 'Install dependencies'
125138
- script: npm i webpack@$(webpack_version)
126139
displayName: 'Install "webpack@$(webpack_version)"'
@@ -138,10 +151,13 @@ jobs:
138151

139152
- job: Windows
140153
pool:
141-
vmImage: windows-2019
154+
vmImage: windows-latest
142155
strategy:
143-
maxParallel: 4
156+
maxParallel: 5
144157
matrix:
158+
node-13:
159+
node_version: ^13.0.0
160+
webpack_version: latest
145161
node-12:
146162
node_version: ^12.0.0
147163
webpack_version: latest
@@ -151,10 +167,9 @@ jobs:
151167
node-8:
152168
node_version: ^8.9.0
153169
webpack_version: latest
154-
node-8-canary:
155-
node_version: ^8.9.0
170+
node-10-canary:
171+
node_version: ^10.13.0
156172
webpack_version: next
157-
continue_on_error: true
158173
steps:
159174
- script: 'git config --global core.autocrlf input'
160175
displayName: 'Config git core.autocrlf'
@@ -172,10 +187,12 @@ jobs:
172187
node -v
173188
npm -v
174189
displayName: 'Print versions'
175-
- task: Npm@1
190+
- task: CacheBeta@1
176191
inputs:
177-
command: custom
178-
customCommand: ci
192+
key: npm | $(Agent.OS) | package-lock.json
193+
path: $(npm_config_cache)
194+
displayName: 'Cache npm'
195+
- script: npm ci
179196
displayName: 'Install dependencies'
180197
- script: npm i webpack@$(webpack_version)
181198
displayName: 'Install "webpack@$(webpack_version)"'

jest.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
testEnvironment: 'node',
3+
snapshotResolver: './test/helpers/snapshotResolver.js',
4+
};

package-lock.json

Lines changed: 40 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,38 @@
77
"author": "Tobias Koppers @sokra",
88
"homepage": "https://github.com/webpack-contrib/compression-webpack-plugin",
99
"bugs": "https://github.com/webpack-contrib/compression-webpack-plugin/issues",
10+
"funding": {
11+
"type": "opencollective",
12+
"url": "https://opencollective.com/webpack"
13+
},
1014
"main": "dist/cjs.js",
1115
"engines": {
1216
"node": ">= 8.9.0"
1317
},
1418
"scripts": {
1519
"start": "npm run build -- -w",
16-
"prebuild": "npm run clean",
17-
"build": "cross-env NODE_ENV=production babel src -d dist --ignore \"src/**/*.test.js\" --copy-files",
1820
"clean": "del-cli dist",
21+
"prebuild": "npm run clean",
22+
"build": "cross-env NODE_ENV=production babel src -d dist --copy-files",
1923
"commitlint": "commitlint --from=master",
20-
"lint:prettier": "prettier \"{**/*,*}.{js,json,md,yml,css}\" --list-different",
21-
"lint:js": "eslint --cache src test",
22-
"lint": "npm-run-all -l -p \"lint:**\"",
23-
"prepare": "npm run build",
24-
"release": "standard-version",
2524
"security": "npm audit",
25+
"lint:prettier": "prettier \"{**/*,*}.{js,json,md,yml,css,ts}\" --list-different",
26+
"lint:js": "eslint --cache .",
27+
"lint": "npm-run-all -l -p \"lint:**\"",
2628
"test:only": "cross-env NODE_ENV=test jest",
27-
"test:watch": "cross-env NODE_ENV=test jest --watch",
28-
"test:coverage": "cross-env NODE_ENV=test jest --collectCoverageFrom=\"src/**/*.js\" --coverage",
29+
"test:watch": "npm run test:only -- --watch",
30+
"test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",
2931
"pretest": "npm run lint",
30-
"test": "cross-env NODE_ENV=test npm run test:coverage",
32+
"test": "npm run test:coverage",
33+
"prepare": "npm run build",
34+
"release": "standard-version",
3135
"defaults": "webpack-defaults"
3236
},
3337
"files": [
3438
"dist"
3539
],
3640
"peerDependencies": {
37-
"webpack": "^4.3.0"
41+
"webpack": "^4.3.0 || ^5.0.0"
3842
},
3943
"dependencies": {
4044
"cacache": "^13.0.1",
@@ -51,7 +55,7 @@
5155
"@commitlint/cli": "^8.2.0",
5256
"@commitlint/config-conventional": "^8.2.0",
5357
"@gfx/zopfli": "^1.0.8",
54-
"@webpack-contrib/defaults": "^5.0.0",
58+
"@webpack-contrib/defaults": "^6.3.0",
5559
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
5660
"babel-jest": "^24.9.0",
5761
"commitlint-azure-pipelines-cli": "^1.0.2",
@@ -66,7 +70,7 @@
6670
"jest": "^24.9.0",
6771
"jest-junit": "^10.0.0",
6872
"lint-staged": "^9.5.0",
69-
"memory-fs": "^0.5.0",
73+
"memfs": "^3.0.3",
7074
"npm-run-all": "^4.1.5",
7175
"prettier": "^1.19.1",
7276
"standard-version": "^7.0.1",

src/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ import schema from './options.json';
2222

2323
class CompressionPlugin {
2424
constructor(options = {}) {
25-
validateOptions(schema, options, 'Compression Plugin');
25+
validateOptions(schema, options, {
26+
name: 'Compression Plugin',
27+
baseDataPath: 'options',
28+
});
2629

2730
const {
2831
test,

0 commit comments

Comments
 (0)