Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2ef7b37

Browse files
authored
chore!: minimum supported Node.js version is 18.12.0
1 parent 810e96b commit 2ef7b37

29 files changed

+8798
-17888
lines changed

.github/workflows/nodejs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
strategy:
6767
matrix:
6868
os: [ubuntu-latest, windows-latest, macos-latest]
69-
node-version: [14.x, 16.x, 18.x, 20.x]
69+
node-version: [18.x, 20.x, 21.x]
7070
webpack-version: [latest]
7171

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

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ type algorithm =
162162
}
163163
| {
164164
[Symbol.toPrimitive](hint: "string"): string;
165-
}
166-
) => void
165+
},
166+
) => void,
167167
) => any);
168168
```
169169

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: "14.15.0",
13+
node: "18.12.0",
1414
},
1515
},
1616
],

package-lock.json

+8,413-17,503
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+20-20
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"main": "dist/index.js",
1515
"types": "types/index.d.ts",
1616
"engines": {
17-
"node": ">= 14.15.0"
17+
"node": ">= 18.12.0"
1818
},
1919
"scripts": {
2020
"start": "npm run build -- -w",
@@ -50,38 +50,38 @@
5050
},
5151
"dependencies": {
5252
"schema-utils": "^4.2.0",
53-
"serialize-javascript": "^6.0.1"
53+
"serialize-javascript": "^6.0.2"
5454
},
5555
"devDependencies": {
5656
"@babel/cli": "^7.23.4",
57-
"@babel/core": "^7.23.3",
58-
"@babel/preset-env": "^7.23.3",
59-
"@commitlint/cli": "^17.7.2",
60-
"@commitlint/config-conventional": "^17.7.0",
57+
"@babel/core": "^7.23.7",
58+
"@babel/preset-env": "^7.23.8",
59+
"@commitlint/cli": "^18.4.4",
60+
"@commitlint/config-conventional": "^18.4.4",
6161
"@gfx/zopfli": "^1.0.15",
62-
"@types/node": "^18.15.11",
63-
"@types/serialize-javascript": "^5.0.2",
62+
"@types/node": "^20.11.2",
63+
"@types/serialize-javascript": "^5.0.4",
6464
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
6565
"babel-jest": "^29.7.0",
6666
"cross-env": "^7.0.3",
67-
"cspell": "^6.31.2",
68-
"del": "^6.1.1",
69-
"del-cli": "^4.0.0",
70-
"eslint": "^8.54.0",
71-
"eslint-config-prettier": "^8.9.0",
72-
"eslint-plugin-import": "^2.29.0",
67+
"cspell": "^8.3.2",
68+
"del": "^7.1.0",
69+
"del-cli": "^5.1.0",
70+
"eslint": "^8.56.0",
71+
"eslint-config-prettier": "^9.1.0",
72+
"eslint-plugin-import": "^2.29.1",
7373
"file-loader": "^6.2.0",
7474
"husky": "^8.0.3",
7575
"jest": "^29.7.0",
76-
"lint-staged": "^13.2.3",
77-
"memfs": "^3.5.3",
76+
"lint-staged": "^15.2.0",
77+
"memfs": "^4.6.0",
7878
"npm-run-all": "^4.1.5",
79-
"prettier": "^2.8.8",
80-
"standard-version": "^9.3.0",
81-
"typescript": "^4.9.5",
79+
"prettier": "^3.2.2",
80+
"standard-version": "^9.5.0",
81+
"typescript": "^5.3.3",
8282
"webpack": "^5.89.0",
8383
"webpack-stats-plugin": "^1.1.3",
84-
"workbox-webpack-plugin": "^6.5.4"
84+
"workbox-webpack-plugin": "^7.0.0"
8585
},
8686
"keywords": [
8787
"webpack"

src/index.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class CompressionPlugin {
154154

155155
if (!this.algorithm) {
156156
throw new Error(
157-
`Algorithm "${this.options.algorithm}" is not found in "zlib"`
157+
`Algorithm "${this.options.algorithm}" is not found in "zlib"`,
158158
);
159159
}
160160

@@ -211,7 +211,7 @@ class CompressionPlugin {
211211
} else {
212212
resolve(result);
213213
}
214-
}
214+
},
215215
);
216216
});
217217
}
@@ -240,7 +240,7 @@ class CompressionPlugin {
240240
!compiler.webpack.ModuleFilenameHelpers.matchObject.bind(
241241
// eslint-disable-next-line no-undefined
242242
undefined,
243-
this.options
243+
this.options,
244244
)(name)
245245
) {
246246
return false;
@@ -289,7 +289,7 @@ class CompressionPlugin {
289289
algorithm: this.options.algorithm,
290290
compressionOptions: this.options.compressionOptions,
291291
}),
292-
cache.getLazyHashedEtag(source)
292+
cache.getLazyHashedEtag(source),
293293
);
294294
const output = (await cacheItem.getPromise()) || {};
295295

@@ -317,7 +317,7 @@ class CompressionPlugin {
317317
}
318318

319319
return { name, source, info, buffer, output, cacheItem, relatedName };
320-
})
320+
}),
321321
)
322322
).filter((assetForMinify) => Boolean(assetForMinify));
323323

@@ -388,7 +388,7 @@ class CompressionPlugin {
388388
}
389389

390390
compilation.emitAsset(newFilename, output.source, newInfo);
391-
})()
391+
})(),
392392
);
393393
}
394394

@@ -410,7 +410,7 @@ class CompressionPlugin {
410410
compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER,
411411
additionalAssets: true,
412412
},
413-
(assets) => this.compress(compiler, compilation, assets)
413+
(assets) => this.compress(compiler, compilation, assets),
414414
);
415415

416416
compilation.hooks.statsPrinter.tap(pluginName, (stats) => {
@@ -421,9 +421,9 @@ class CompressionPlugin {
421421
(compressed, { green, formatFlag }) =>
422422
compressed
423423
? /** @type {Function} */ (green)(
424-
/** @type {Function} */ (formatFlag)("compressed")
424+
/** @type {Function} */ (formatFlag)("compressed"),
425425
)
426-
: ""
426+
: "",
427427
);
428428
});
429429
});

test/CompressionPlugin.test.js

+21-21
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe("CompressionPlugin", () => {
2828
filename: "[name].js?var=[hash]",
2929
chunkFilename: "[id].[name].js?ver=[hash]",
3030
},
31-
}
31+
},
3232
);
3333

3434
new CompressionPlugin().apply(compiler);
@@ -51,7 +51,7 @@ describe("CompressionPlugin", () => {
5151
filename: "[name].js?var=[hash]",
5252
chunkFilename: "[id].[name].js?ver=[hash]",
5353
},
54-
}
54+
},
5555
);
5656

5757
new CompressionPlugin().apply(compiler);
@@ -82,7 +82,7 @@ describe("CompressionPlugin", () => {
8282
rules: [
8383
{
8484
loader: require.resolve(
85-
"./helpers/loader-with-child-compilation.js"
85+
"./helpers/loader-with-child-compilation.js",
8686
),
8787
},
8888
],
@@ -97,7 +97,7 @@ describe("CompressionPlugin", () => {
9797
},
9898
],
9999
},
100-
}
100+
},
101101
);
102102

103103
new CompressionPlugin().apply(compiler);
@@ -122,7 +122,7 @@ describe("CompressionPlugin", () => {
122122
filename: "[name].js?var=[hash]",
123123
chunkFilename: "[id].[name].js?ver=[hash]",
124124
},
125-
}
125+
},
126126
);
127127

128128
new CompressionPlugin({
@@ -162,7 +162,7 @@ describe("CompressionPlugin", () => {
162162
filename: "[name].js",
163163
chunkFilename: "[id].[name].js",
164164
},
165-
}
165+
},
166166
);
167167

168168
new CompressionPlugin().apply(compiler);
@@ -188,7 +188,7 @@ describe("CompressionPlugin", () => {
188188
filename: "[name].[contenthash].js",
189189
chunkFilename: "[id].[name].[contenthash].js",
190190
},
191-
}
191+
},
192192
);
193193

194194
new CompressionPlugin().apply(compiler);
@@ -223,7 +223,7 @@ describe("CompressionPlugin", () => {
223223
expect(newStats.compilation.emittedAssets.size).toBe(0);
224224

225225
expect(getAssetsNameAndSize(newStats, compiler)).toMatchSnapshot(
226-
"assets"
226+
"assets",
227227
);
228228
expect(getWarnings(newStats)).toMatchSnapshot("errors");
229229
expect(getErrors(newStats)).toMatchSnapshot("warnings");
@@ -243,7 +243,7 @@ describe("CompressionPlugin", () => {
243243
filename: "[name].js",
244244
chunkFilename: "[id].js",
245245
},
246-
}
246+
},
247247
);
248248

249249
new CompressionPlugin().apply(compiler);
@@ -262,7 +262,7 @@ describe("CompressionPlugin", () => {
262262
expect(newStats.compilation.emittedAssets.size).toBe(0);
263263

264264
expect(getAssetsNameAndSize(newStats, compiler)).toMatchSnapshot(
265-
"assets"
265+
"assets",
266266
);
267267
expect(getWarnings(newStats)).toMatchSnapshot("errors");
268268
expect(getErrors(newStats)).toMatchSnapshot("warnings");
@@ -282,7 +282,7 @@ describe("CompressionPlugin", () => {
282282
filename: "[name].js",
283283
chunkFilename: "[id].js",
284284
},
285-
}
285+
},
286286
);
287287

288288
new CompressionPlugin().apply(compiler);
@@ -306,7 +306,7 @@ describe("CompressionPlugin", () => {
306306
expect(newStats.compilation.emittedAssets.size).toBe(2);
307307

308308
expect(getAssetsNameAndSize(newStats, compiler)).toMatchSnapshot(
309-
"assets"
309+
"assets",
310310
);
311311
expect(getWarnings(newStats)).toMatchSnapshot("errors");
312312
expect(getErrors(newStats)).toMatchSnapshot("warnings");
@@ -328,7 +328,7 @@ describe("CompressionPlugin", () => {
328328
filename: "[name].js",
329329
chunkFilename: "[id].js",
330330
},
331-
}
331+
},
332332
);
333333

334334
new CompressionPlugin().apply(compiler);
@@ -352,7 +352,7 @@ describe("CompressionPlugin", () => {
352352
expect(newStats.compilation.emittedAssets.size).toBe(2);
353353

354354
expect(getAssetsNameAndSize(newStats, compiler)).toMatchSnapshot(
355-
"assets"
355+
"assets",
356356
);
357357
expect(getWarnings(newStats)).toMatchSnapshot("errors");
358358
expect(getErrors(newStats)).toMatchSnapshot("warnings");
@@ -372,7 +372,7 @@ describe("CompressionPlugin", () => {
372372
filename: "[name].js",
373373
chunkFilename: "[id].js",
374374
},
375-
}
375+
},
376376
);
377377

378378
new CompressionPlugin({
@@ -403,7 +403,7 @@ describe("CompressionPlugin", () => {
403403
expect(newStats.compilation.emittedAssets.size).toBe(0);
404404

405405
expect(getAssetsNameAndSize(newStats, compiler)).toMatchSnapshot(
406-
"assets"
406+
"assets",
407407
);
408408
expect(getWarnings(newStats)).toMatchSnapshot("errors");
409409
expect(getErrors(newStats)).toMatchSnapshot("warnings");
@@ -425,7 +425,7 @@ describe("CompressionPlugin", () => {
425425
filename: "[name].js",
426426
chunkFilename: "[id].[name].js",
427427
},
428-
}
428+
},
429429
);
430430

431431
new CompressionPlugin().apply(compiler);
@@ -444,7 +444,7 @@ describe("CompressionPlugin", () => {
444444
expect(newStats.compilation.emittedAssets.size).toBe(7);
445445

446446
expect(getAssetsNameAndSize(newStats, compiler)).toMatchSnapshot(
447-
"assets"
447+
"assets",
448448
);
449449
expect(getWarnings(newStats)).toMatchSnapshot("errors");
450450
expect(getErrors(newStats)).toMatchSnapshot("warnings");
@@ -463,7 +463,7 @@ describe("CompressionPlugin", () => {
463463
filename: "[name].js",
464464
chunkFilename: "[id].js",
465465
},
466-
}
466+
},
467467
);
468468

469469
new CompressionPlugin({ minRatio: 10 }).apply(compiler);
@@ -487,7 +487,7 @@ describe("CompressionPlugin", () => {
487487
filename: "[name].js?var=[hash]",
488488
chunkFilename: "[id].[name].js?ver=[hash]",
489489
},
490-
}
490+
},
491491
);
492492

493493
new CompressionPlugin().apply(compiler);
@@ -511,7 +511,7 @@ describe("CompressionPlugin", () => {
511511
filename: "[name].js?var=[hash]",
512512
chunkFilename: "[id].[name].js?ver=[hash]",
513513
},
514-
}
514+
},
515515
);
516516

517517
new CompressionPlugin().apply(compiler);

0 commit comments

Comments
 (0)