terser-webpack-plugin
Advanced tools
Comparing version 5.3.10 to 5.3.9
@@ -10,3 +10,2 @@ "use strict"; | ||
throttleAll, | ||
memoize, | ||
terserMinify, | ||
@@ -157,2 +156,24 @@ uglifyJsMinify, | ||
/** | ||
* @template T | ||
* @param fn {(function(): any) | undefined} | ||
* @returns {function(): T} | ||
*/ | ||
const memoize = fn => { | ||
let cache = false; | ||
/** @type {T} */ | ||
let result; | ||
return () => { | ||
if (cache) { | ||
return result; | ||
} | ||
result = /** @type {function(): any} */fn(); | ||
cache = true; | ||
// Allow to clean up memory for fn | ||
// and all dependent resources | ||
// eslint-disable-next-line no-undefined, no-param-reassign | ||
fn = undefined; | ||
return result; | ||
}; | ||
}; | ||
const getTraceMapping = memoize(() => | ||
@@ -180,4 +201,4 @@ // eslint-disable-next-line global-require | ||
const { | ||
minify = ( /** @type {MinimizerImplementation<T>} */terserMinify), | ||
terserOptions = ( /** @type {MinimizerOptions<T>} */{}), | ||
minify = /** @type {MinimizerImplementation<T>} */terserMinify, | ||
terserOptions = /** @type {MinimizerOptions<T>} */{}, | ||
test = /\.[cm]?js(\?.*)?$/i, | ||
@@ -581,3 +602,3 @@ extractComments = true, | ||
} | ||
const limit = getWorker && numberOfAssets > 0 ? ( /** @type {number} */numberOfWorkers) : scheduledTasks.length; | ||
const limit = getWorker && numberOfAssets > 0 ? /** @type {number} */numberOfWorkers : scheduledTasks.length; | ||
await throttleAll(limit, scheduledTasks); | ||
@@ -584,0 +605,0 @@ if (initializedWorker) { |
@@ -166,3 +166,4 @@ "use strict"; | ||
} | ||
return /** @type {{ preserve: ExtractCommentsFunction }} */condition.preserve(astNode, comment); | ||
return (/** @type {{ preserve: ExtractCommentsFunction }} */condition.preserve(astNode, comment) | ||
); | ||
}; | ||
@@ -252,6 +253,6 @@ }; | ||
return { | ||
code: ( /** @type {string} **/result.code), | ||
code: /** @type {string} **/result.code, | ||
// @ts-ignore | ||
// eslint-disable-next-line no-undefined | ||
map: result.map ? ( /** @type {SourceMapInput} **/result.map) : undefined, | ||
map: result.map ? /** @type {SourceMapInput} **/result.map : undefined, | ||
extractedComments | ||
@@ -365,3 +366,4 @@ }; | ||
} | ||
return /** @type {{ preserve: ExtractCommentsFunction }} */condition.preserve(astNode, comment); | ||
return (/** @type {{ preserve: ExtractCommentsFunction }} */condition.preserve(astNode, comment) | ||
); | ||
}; | ||
@@ -610,28 +612,4 @@ }; | ||
}; | ||
/** | ||
* @template T | ||
* @param fn {(function(): any) | undefined} | ||
* @returns {function(): T} | ||
*/ | ||
function memoize(fn) { | ||
let cache = false; | ||
/** @type {T} */ | ||
let result; | ||
return () => { | ||
if (cache) { | ||
return result; | ||
} | ||
result = /** @type {function(): any} */fn(); | ||
cache = true; | ||
// Allow to clean up memory for fn | ||
// and all dependent resources | ||
// eslint-disable-next-line no-undefined, no-param-reassign | ||
fn = undefined; | ||
return result; | ||
}; | ||
} | ||
module.exports = { | ||
throttleAll, | ||
memoize, | ||
terserMinify, | ||
@@ -638,0 +616,0 @@ uglifyJsMinify, |
{ | ||
"name": "terser-webpack-plugin", | ||
"version": "5.3.10", | ||
"version": "5.3.9", | ||
"description": "Terser plugin for webpack", | ||
@@ -62,15 +62,15 @@ "license": "MIT", | ||
"dependencies": { | ||
"@jridgewell/trace-mapping": "^0.3.20", | ||
"@jridgewell/trace-mapping": "^0.3.17", | ||
"jest-worker": "^27.4.5", | ||
"schema-utils": "^3.1.1", | ||
"serialize-javascript": "^6.0.1", | ||
"terser": "^5.26.0" | ||
"terser": "^5.16.8" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.22.15", | ||
"@babel/core": "^7.22.17", | ||
"@babel/preset-env": "^7.22.15", | ||
"@commitlint/cli": "^17.7.1", | ||
"@commitlint/config-conventional": "^17.7.0", | ||
"@swc/core": "^1.3.84", | ||
"@babel/cli": "^7.21.0", | ||
"@babel/core": "^7.21.4", | ||
"@babel/preset-env": "^7.21.4", | ||
"@commitlint/cli": "^17.5.1", | ||
"@commitlint/config-conventional": "^17.4.4", | ||
"@swc/core": "^1.3.44", | ||
"@types/node": "^18.15.11", | ||
@@ -83,13 +83,13 @@ "@types/serialize-javascript": "^5.0.2", | ||
"cross-env": "^7.0.3", | ||
"cspell": "^6.31.2", | ||
"cspell": "^6.31.1", | ||
"del": "^6.0.0", | ||
"del-cli": "^3.0.1", | ||
"esbuild": "^0.19.10", | ||
"esbuild": "^0.14.51", | ||
"eslint": "^7.32.0", | ||
"eslint-config-prettier": "^8.9.0", | ||
"eslint-plugin-import": "^2.28.1", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-plugin-import": "^2.27.5", | ||
"file-loader": "^6.2.0", | ||
"husky": "^7.0.2", | ||
"jest": "^27.5.1", | ||
"lint-staged": "^13.2.3", | ||
"lint-staged": "^13.2.0", | ||
"memfs": "^3.4.13", | ||
@@ -101,3 +101,3 @@ "npm-run-all": "^4.1.5", | ||
"uglify-js": "^3.17.4", | ||
"webpack": "^5.88.2", | ||
"webpack": "^5.83.1", | ||
"webpack-cli": "^4.10.0", | ||
@@ -104,0 +104,0 @@ "worker-loader": "^3.0.8" |
@@ -31,8 +31,2 @@ export type Task<T> = () => Promise<T>; | ||
/** | ||
* @template T | ||
* @param fn {(function(): any) | undefined} | ||
* @returns {function(): T} | ||
*/ | ||
export function memoize<T>(fn: (() => any) | undefined): () => T; | ||
/** | ||
* @param {Input} input | ||
@@ -39,0 +33,0 @@ * @param {SourceMapInput | undefined} sourceMap |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
87860
1780
+ Added@types/node@22.7.7(transitive)
+ Addedbrowserslist@4.24.0(transitive)
+ Addedelectron-to-chromium@1.5.41(transitive)
+ Addedterser-webpack-plugin@5.3.10(transitive)
- Removed@types/node@22.7.8(transitive)
- Removedbrowserslist@4.24.2(transitive)
- Removedelectron-to-chromium@1.5.42(transitive)
Updatedterser@^5.16.8