Socket
Socket
Sign inDemoInstall

terser-webpack-plugin

Package Overview
Dependencies
76
Maintainers
3
Versions
77
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.3.9 to 5.3.10

29

dist/index.js

@@ -10,2 +10,3 @@ "use strict";

throttleAll,
memoize,
terserMinify,

@@ -156,24 +157,2 @@ 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(() =>

@@ -201,4 +180,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,

@@ -602,3 +581,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);

@@ -605,0 +584,0 @@ if (initializedWorker) {

34

dist/utils.js

@@ -166,4 +166,3 @@ "use strict";

}
return (/** @type {{ preserve: ExtractCommentsFunction }} */condition.preserve(astNode, comment)
);
return /** @type {{ preserve: ExtractCommentsFunction }} */condition.preserve(astNode, comment);
};

@@ -253,6 +252,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

@@ -366,4 +365,3 @@ };

}
return (/** @type {{ preserve: ExtractCommentsFunction }} */condition.preserve(astNode, comment)
);
return /** @type {{ preserve: ExtractCommentsFunction }} */condition.preserve(astNode, comment);
};

@@ -612,4 +610,28 @@ };

};
/**
* @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,

@@ -616,0 +638,0 @@ uglifyJsMinify,

{
"name": "terser-webpack-plugin",
"version": "5.3.9",
"version": "5.3.10",
"description": "Terser plugin for webpack",

@@ -62,15 +62,15 @@ "license": "MIT",

"dependencies": {
"@jridgewell/trace-mapping": "^0.3.17",
"@jridgewell/trace-mapping": "^0.3.20",
"jest-worker": "^27.4.5",
"schema-utils": "^3.1.1",
"serialize-javascript": "^6.0.1",
"terser": "^5.16.8"
"terser": "^5.26.0"
},
"devDependencies": {
"@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",
"@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",
"@types/node": "^18.15.11",

@@ -83,13 +83,13 @@ "@types/serialize-javascript": "^5.0.2",

"cross-env": "^7.0.3",
"cspell": "^6.31.1",
"cspell": "^6.31.2",
"del": "^6.0.0",
"del-cli": "^3.0.1",
"esbuild": "^0.14.51",
"esbuild": "^0.19.10",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-config-prettier": "^8.9.0",
"eslint-plugin-import": "^2.28.1",
"file-loader": "^6.2.0",
"husky": "^7.0.2",
"jest": "^27.5.1",
"lint-staged": "^13.2.0",
"lint-staged": "^13.2.3",
"memfs": "^3.4.13",

@@ -101,3 +101,3 @@ "npm-run-all": "^4.1.5",

"uglify-js": "^3.17.4",
"webpack": "^5.83.1",
"webpack": "^5.88.2",
"webpack-cli": "^4.10.0",

@@ -104,0 +104,0 @@ "worker-loader": "^3.0.8"

@@ -31,2 +31,8 @@ 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

@@ -33,0 +39,0 @@ * @param {SourceMapInput | undefined} sourceMap

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc