Skip to content

Commit 809ef42

Browse files
chore(deps): update (#368)
1 parent 562d121 commit 809ef42

17 files changed

+1623
-1798
lines changed

package-lock.json

Lines changed: 613 additions & 887 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 & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,41 +46,41 @@
4646
},
4747
"dependencies": {
4848
"jest-worker": "^26.6.2",
49-
"p-limit": "^3.0.2",
49+
"p-limit": "^3.1.0",
5050
"schema-utils": "^3.0.0",
5151
"serialize-javascript": "^5.0.1",
5252
"source-map": "^0.6.1",
53-
"terser": "^5.3.8"
53+
"terser": "^5.5.1"
5454
},
5555
"devDependencies": {
56-
"@babel/cli": "^7.12.1",
57-
"@babel/core": "^7.12.3",
58-
"@babel/preset-env": "^7.12.1",
56+
"@babel/cli": "^7.12.10",
57+
"@babel/core": "^7.12.10",
58+
"@babel/preset-env": "^7.12.11",
5959
"@commitlint/cli": "^11.0.0",
6060
"@commitlint/config-conventional": "^11.0.0",
61-
"@types/serialize-javascript": "^4.0.0",
61+
"@types/serialize-javascript": "^5.0.0",
6262
"@webpack-contrib/defaults": "^6.3.0",
6363
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
6464
"babel-jest": "^26.6.3",
65-
"copy-webpack-plugin": "^6.3.0",
66-
"cross-env": "^7.0.2",
65+
"copy-webpack-plugin": "^7.0.0",
66+
"cross-env": "^7.0.3",
6767
"del": "^6.0.0",
6868
"del-cli": "^3.0.1",
69-
"eslint": "^7.13.0",
70-
"eslint-config-prettier": "^6.15.0",
69+
"eslint": "^7.15.0",
70+
"eslint-config-prettier": "^7.0.0",
7171
"eslint-plugin-import": "^2.22.1",
7272
"file-loader": "^6.2.0",
73-
"husky": "^4.3.0",
73+
"husky": "^4.3.6",
7474
"jest": "^26.6.3",
75-
"lint-staged": "^10.5.1",
75+
"lint-staged": "^10.5.3",
7676
"memfs": "^3.2.0",
7777
"npm-run-all": "^4.1.5",
78-
"prettier": "^2.1.2",
78+
"prettier": "^2.2.1",
7979
"standard-version": "^9.0.0",
80-
"typescript": "^4.0.5",
81-
"uglify-js": "^3.11.5",
82-
"webpack": "^5.4.0",
83-
"worker-loader": "^3.0.5"
80+
"typescript": "^4.1.3",
81+
"uglify-js": "^3.12.1",
82+
"webpack": "^5.10.3",
83+
"worker-loader": "^3.0.6"
8484
},
8585
"keywords": [
8686
"uglify",

src/index.js

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@ import { minify as minifyFn } from "./minify";
1515
/** @typedef {import("webpack").Compiler} Compiler */
1616
/** @typedef {import("webpack").Compilation} Compilation */
1717
/** @typedef {import("webpack").Rules} Rules */
18-
/** @typedef {import("webpack").Source} Source */
1918
/** @typedef {import("webpack").WebpackError} WebpackError */
2019
/** @typedef {import("webpack").Asset} Asset */
2120
/** @typedef {import("webpack").AssetInfo} AssetInfo */
2221
/** @typedef {import("terser").ECMA} TerserECMA */
2322
/** @typedef {import("terser").MinifyOptions} TerserMinifyOptions */
2423
/** @typedef {import("jest-worker").default} JestWorker */
25-
/** @typedef {import("source-map").RawSourceMap} SourceMapRawSourceMap */
24+
/** @typedef {import("source-map").RawSourceMap} RawSourceMap */
2625
/** @typedef {import("./minify.js").InternalMinifyOptions} InternalMinifyOptions */
2726
/** @typedef {import("./minify.js").InternalMinifyResult} InternalMinifyResult */
2827

@@ -59,7 +58,7 @@ import { minify as minifyFn } from "./minify";
5958
/**
6059
* @callback CustomMinifyFunction
6160
* @param {Object.<string, string>} file
62-
* @param {SourceMapRawSourceMap} sourceMap
61+
* @param {RawSourceMap | undefined} sourceMap
6362
* @param {MinifyOptions} minifyOptions
6463
*/
6564

@@ -191,7 +190,7 @@ class TerserPlugin {
191190
/**
192191
* @param {Compiler} compiler
193192
* @param {Compilation} compilation
194-
* @param {Record<string, Source>} assets
193+
* @param {Record<string, import("webpack").sources.Source>} assets
195194
* @param {{availableNumberOfCores: number}} optimizeOptions
196195
* @returns {Promise<void>}
197196
*/
@@ -265,17 +264,13 @@ class TerserPlugin {
265264
const workerStdout = initializedWorker.getStdout();
266265

267266
if (workerStdout) {
268-
workerStdout.on("data", (chunk) => {
269-
return process.stdout.write(chunk);
270-
});
267+
workerStdout.on("data", (chunk) => process.stdout.write(chunk));
271268
}
272269

273270
const workerStderr = initializedWorker.getStderr();
274271

275272
if (workerStderr) {
276-
workerStderr.on("data", (chunk) => {
277-
return process.stderr.write(chunk);
278-
});
273+
workerStderr.on("data", (chunk) => process.stderr.write(chunk));
279274
}
280275

281276
return initializedWorker;
@@ -303,6 +298,7 @@ class TerserPlugin {
303298

304299
if (!output) {
305300
let input;
301+
/** @type {RawSourceMap | undefined} */
306302
let inputSourceMap;
307303

308304
const {
@@ -314,9 +310,9 @@ class TerserPlugin {
314310

315311
if (map) {
316312
if (TerserPlugin.isSourceMap(map)) {
317-
inputSourceMap = map;
313+
inputSourceMap = /** @type {RawSourceMap} */ (map);
318314
} else {
319-
inputSourceMap = map;
315+
inputSourceMap = /** @type {RawSourceMap} */ (map);
320316

321317
compilation.warnings.push(
322318
/** @type {WebpackError} */
@@ -329,6 +325,7 @@ class TerserPlugin {
329325
input = input.toString();
330326
}
331327

328+
/** @type {InternalMinifyOptions} */
332329
const options = {
333330
name,
334331
input,
@@ -364,7 +361,7 @@ class TerserPlugin {
364361
hasSourceMap ? compilation.requestShortener : undefined,
365362
hasSourceMap
366363
? new SourceMapConsumer(
367-
/** @type {SourceMapRawSourceMap} */ (inputSourceMap)
364+
/** @type {RawSourceMap} */ (inputSourceMap)
368365
)
369366
: // eslint-disable-next-line no-undefined
370367
undefined
@@ -395,7 +392,7 @@ class TerserPlugin {
395392
name,
396393
output.map,
397394
input,
398-
/** @type {SourceMapRawSourceMap} */ (inputSourceMap),
395+
/** @type {RawSourceMap} */ (inputSourceMap),
399396
true
400397
);
401398
} else {

src/minify.js

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ const { minify: terserMinify } = require("terser");
1515
* @typedef {Object} InternalMinifyOptions
1616
* @property {string} name
1717
* @property {string} input
18-
* @property {RawSourceMap} inputSourceMap
18+
* @property {RawSourceMap | undefined} inputSourceMap
1919
* @property {ExtractCommentsOptions} extractComments
20-
* @property {CustomMinifyFunction} minify
20+
* @property {CustomMinifyFunction | undefined} minify
2121
* @property {MinifyOptions} minifyOptions
2222
*/
2323

@@ -135,12 +135,9 @@ function buildComments(extractComments, terserOptions, extractedComments) {
135135
condition[key] = /** @type {ExtractCommentsFunction} */ ((
136136
astNode,
137137
comment
138-
) => {
139-
return (
140-
(comment.type === "comment2" || comment.type === "comment1") &&
141-
/@preserve|@lic|@cc_on|^\**!/i.test(comment.value)
142-
);
143-
});
138+
) =>
139+
(comment.type === "comment2" || comment.type === "comment1") &&
140+
/@preserve|@lic|@cc_on|^\**!/i.test(comment.value));
144141

145142
break;
146143
}
@@ -150,11 +147,7 @@ function buildComments(extractComments, terserOptions, extractedComments) {
150147
condition[key] = /** @type {ExtractCommentsFunction} */ ((
151148
astNode,
152149
comment
153-
) => {
154-
return new RegExp(/** @type {string} */ (regexStr)).test(
155-
comment.value
156-
);
157-
});
150+
) => new RegExp(/** @type {string} */ (regexStr)).test(comment.value));
158151

159152
break;
160153
default:

0 commit comments

Comments
 (0)