@node-minify/uglify-es 8.0.6 → 9.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/index.d.mts +25 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +21 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -16
package/LICENSE
CHANGED
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { MinifierOptions } from '@node-minify/types';
|
|
2
|
+
|
|
3
|
+
/*!
|
|
4
|
+
* node-minify
|
|
5
|
+
* Copyright(c) 2011-2024 Rodolphe Stoclin
|
|
6
|
+
* MIT Licensed
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
type OptionsUglifyES = {
|
|
10
|
+
sourceMap?: {
|
|
11
|
+
filename: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
type SettingsUglifyES = {
|
|
15
|
+
options: OptionsUglifyES;
|
|
16
|
+
};
|
|
17
|
+
type MinifierOptionsUglifyES = {
|
|
18
|
+
settings: SettingsUglifyES;
|
|
19
|
+
};
|
|
20
|
+
declare const minifyUglifyES: {
|
|
21
|
+
({ settings, content, callback, index, }: MinifierOptions & MinifierOptionsUglifyES): string | void;
|
|
22
|
+
default: any;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { minifyUglifyES as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { MinifierOptions } from '@node-minify/types';
|
|
|
2
2
|
|
|
3
3
|
/*!
|
|
4
4
|
* node-minify
|
|
5
|
-
* Copyright(c) 2011-
|
|
5
|
+
* Copyright(c) 2011-2024 Rodolphe Stoclin
|
|
6
6
|
* MIT Licensed
|
|
7
7
|
*/
|
|
8
8
|
|
|
@@ -18,7 +18,7 @@ type MinifierOptionsUglifyES = {
|
|
|
18
18
|
settings: SettingsUglifyES;
|
|
19
19
|
};
|
|
20
20
|
declare const minifyUglifyES: {
|
|
21
|
-
({ settings, content, callback, index }: MinifierOptions & MinifierOptionsUglifyES): string | void;
|
|
21
|
+
({ settings, content, callback, index, }: MinifierOptions & MinifierOptionsUglifyES): string | void;
|
|
22
22
|
default: any;
|
|
23
23
|
};
|
|
24
24
|
|
package/dist/index.js
CHANGED
|
@@ -23,12 +23,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
));
|
|
24
24
|
|
|
25
25
|
// src/index.ts
|
|
26
|
-
var import_uglify_es = __toESM(require("uglify-es"));
|
|
27
26
|
var import_utils = require("@node-minify/utils");
|
|
28
|
-
var
|
|
27
|
+
var import_uglify_es = __toESM(require("uglify-es"));
|
|
28
|
+
var minifyUglifyES = ({
|
|
29
|
+
settings,
|
|
30
|
+
content,
|
|
31
|
+
callback,
|
|
32
|
+
index
|
|
33
|
+
}) => {
|
|
29
34
|
let content2 = content ?? "";
|
|
30
35
|
if (typeof settings.options.sourceMap === "object") {
|
|
31
|
-
content2 = {
|
|
36
|
+
content2 = {
|
|
37
|
+
[settings.options.sourceMap.filename ?? ""]: content ?? ""
|
|
38
|
+
};
|
|
32
39
|
}
|
|
33
40
|
const contentMinified = import_uglify_es.default.minify(content2, settings.options);
|
|
34
41
|
if (contentMinified.error) {
|
|
@@ -37,10 +44,18 @@ var minifyUglifyES = ({ settings, content, callback, index }) => {
|
|
|
37
44
|
}
|
|
38
45
|
}
|
|
39
46
|
if (contentMinified.map && settings.options.sourceMap) {
|
|
40
|
-
import_utils.utils.writeFile({
|
|
47
|
+
import_utils.utils.writeFile({
|
|
48
|
+
file: `${settings.output}.map`,
|
|
49
|
+
content: contentMinified.map,
|
|
50
|
+
index
|
|
51
|
+
});
|
|
41
52
|
}
|
|
42
53
|
if (settings && !settings.content && settings.output) {
|
|
43
|
-
import_utils.utils.writeFile({
|
|
54
|
+
import_utils.utils.writeFile({
|
|
55
|
+
file: settings.output,
|
|
56
|
+
content: contentMinified.code,
|
|
57
|
+
index
|
|
58
|
+
});
|
|
44
59
|
}
|
|
45
60
|
if (callback) {
|
|
46
61
|
return callback(null, contentMinified.code);
|
|
@@ -51,7 +66,7 @@ minifyUglifyES.default = minifyUglifyES;
|
|
|
51
66
|
module.exports = minifyUglifyES;
|
|
52
67
|
/*!
|
|
53
68
|
* node-minify
|
|
54
|
-
* Copyright(c) 2011-
|
|
69
|
+
* Copyright(c) 2011-2024 Rodolphe Stoclin
|
|
55
70
|
* MIT Licensed
|
|
56
71
|
*/
|
|
57
72
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-2024 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\nimport type { Dictionary, MinifierOptions } from \"@node-minify/types\";\nimport { utils } from \"@node-minify/utils\";\nimport uglifyES from \"uglify-es\";\n\ntype OptionsUglifyES = {\n sourceMap?: { filename: string };\n};\n\ntype SettingsUglifyES = {\n options: OptionsUglifyES;\n};\n\ntype MinifierOptionsUglifyES = {\n settings: SettingsUglifyES;\n};\n\n/**\n * Run uglifyES.\n * @param settings UglifyES options\n * @param content Content to minify\n * @param callback Callback\n * @param index Index of current file in array\n * @returns Minified content\n */\nconst minifyUglifyES = ({\n settings,\n content,\n callback,\n index,\n}: MinifierOptions & MinifierOptionsUglifyES) => {\n let content2: string | Dictionary<string> = content ?? \"\";\n if (typeof settings.options.sourceMap === \"object\") {\n content2 = {\n [settings.options.sourceMap.filename ?? \"\"]: content ?? \"\",\n };\n }\n const contentMinified = uglifyES.minify(content2, settings.options);\n if (contentMinified.error) {\n if (callback) {\n return callback(contentMinified.error);\n }\n }\n if (contentMinified.map && settings.options.sourceMap) {\n utils.writeFile({\n file: `${settings.output}.map`,\n content: contentMinified.map,\n index,\n });\n }\n if (settings && !settings.content && settings.output) {\n utils.writeFile({\n file: settings.output,\n content: contentMinified.code,\n index,\n });\n }\n if (callback) {\n return callback(null, contentMinified.code);\n }\n return contentMinified.code;\n};\n\n/**\n * Expose `minifyUglifyES()`.\n */\nminifyUglifyES.default = minifyUglifyES;\nexport = minifyUglifyES;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAUA,mBAAsB;AACtB,uBAAqB;AAsBrB,IAAM,iBAAiB,CAAC;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ,MAAiD;AAC7C,MAAI,WAAwC,WAAW;AACvD,MAAI,OAAO,SAAS,QAAQ,cAAc,UAAU;AAChD,eAAW;AAAA,MACP,CAAC,SAAS,QAAQ,UAAU,YAAY,EAAE,GAAG,WAAW;AAAA,IAC5D;AAAA,EACJ;AACA,QAAM,kBAAkB,iBAAAA,QAAS,OAAO,UAAU,SAAS,OAAO;AAClE,MAAI,gBAAgB,OAAO;AACvB,QAAI,UAAU;AACV,aAAO,SAAS,gBAAgB,KAAK;AAAA,IACzC;AAAA,EACJ;AACA,MAAI,gBAAgB,OAAO,SAAS,QAAQ,WAAW;AACnD,uBAAM,UAAU;AAAA,MACZ,MAAM,GAAG,SAAS,MAAM;AAAA,MACxB,SAAS,gBAAgB;AAAA,MACzB;AAAA,IACJ,CAAC;AAAA,EACL;AACA,MAAI,YAAY,CAAC,SAAS,WAAW,SAAS,QAAQ;AAClD,uBAAM,UAAU;AAAA,MACZ,MAAM,SAAS;AAAA,MACf,SAAS,gBAAgB;AAAA,MACzB;AAAA,IACJ,CAAC;AAAA,EACL;AACA,MAAI,UAAU;AACV,WAAO,SAAS,MAAM,gBAAgB,IAAI;AAAA,EAC9C;AACA,SAAO,gBAAgB;AAC3B;AAKA,eAAe,UAAU;AACzB,iBAAS;","names":["uglifyES"]}
|
package/dist/index.mjs
CHANGED
|
@@ -4,14 +4,21 @@ var __commonJS = (cb, mod) => function __require() {
|
|
|
4
4
|
};
|
|
5
5
|
|
|
6
6
|
// src/index.ts
|
|
7
|
-
import uglifyES from "uglify-es";
|
|
8
7
|
import { utils } from "@node-minify/utils";
|
|
8
|
+
import uglifyES from "uglify-es";
|
|
9
9
|
var require_src = __commonJS({
|
|
10
10
|
"src/index.ts"(exports, module) {
|
|
11
|
-
var minifyUglifyES = ({
|
|
11
|
+
var minifyUglifyES = ({
|
|
12
|
+
settings,
|
|
13
|
+
content,
|
|
14
|
+
callback,
|
|
15
|
+
index
|
|
16
|
+
}) => {
|
|
12
17
|
let content2 = content ?? "";
|
|
13
18
|
if (typeof settings.options.sourceMap === "object") {
|
|
14
|
-
content2 = {
|
|
19
|
+
content2 = {
|
|
20
|
+
[settings.options.sourceMap.filename ?? ""]: content ?? ""
|
|
21
|
+
};
|
|
15
22
|
}
|
|
16
23
|
const contentMinified = uglifyES.minify(content2, settings.options);
|
|
17
24
|
if (contentMinified.error) {
|
|
@@ -20,10 +27,18 @@ var require_src = __commonJS({
|
|
|
20
27
|
}
|
|
21
28
|
}
|
|
22
29
|
if (contentMinified.map && settings.options.sourceMap) {
|
|
23
|
-
utils.writeFile({
|
|
30
|
+
utils.writeFile({
|
|
31
|
+
file: `${settings.output}.map`,
|
|
32
|
+
content: contentMinified.map,
|
|
33
|
+
index
|
|
34
|
+
});
|
|
24
35
|
}
|
|
25
36
|
if (settings && !settings.content && settings.output) {
|
|
26
|
-
utils.writeFile({
|
|
37
|
+
utils.writeFile({
|
|
38
|
+
file: settings.output,
|
|
39
|
+
content: contentMinified.code,
|
|
40
|
+
index
|
|
41
|
+
});
|
|
27
42
|
}
|
|
28
43
|
if (callback) {
|
|
29
44
|
return callback(null, contentMinified.code);
|
|
@@ -37,7 +52,7 @@ var require_src = __commonJS({
|
|
|
37
52
|
export default require_src();
|
|
38
53
|
/*!
|
|
39
54
|
* node-minify
|
|
40
|
-
* Copyright(c) 2011-
|
|
55
|
+
* Copyright(c) 2011-2024 Rodolphe Stoclin
|
|
41
56
|
* MIT Licensed
|
|
42
57
|
*/
|
|
43
58
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-2024 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\nimport type { Dictionary, MinifierOptions } from \"@node-minify/types\";\nimport { utils } from \"@node-minify/utils\";\nimport uglifyES from \"uglify-es\";\n\ntype OptionsUglifyES = {\n sourceMap?: { filename: string };\n};\n\ntype SettingsUglifyES = {\n options: OptionsUglifyES;\n};\n\ntype MinifierOptionsUglifyES = {\n settings: SettingsUglifyES;\n};\n\n/**\n * Run uglifyES.\n * @param settings UglifyES options\n * @param content Content to minify\n * @param callback Callback\n * @param index Index of current file in array\n * @returns Minified content\n */\nconst minifyUglifyES = ({\n settings,\n content,\n callback,\n index,\n}: MinifierOptions & MinifierOptionsUglifyES) => {\n let content2: string | Dictionary<string> = content ?? \"\";\n if (typeof settings.options.sourceMap === \"object\") {\n content2 = {\n [settings.options.sourceMap.filename ?? \"\"]: content ?? \"\",\n };\n }\n const contentMinified = uglifyES.minify(content2, settings.options);\n if (contentMinified.error) {\n if (callback) {\n return callback(contentMinified.error);\n }\n }\n if (contentMinified.map && settings.options.sourceMap) {\n utils.writeFile({\n file: `${settings.output}.map`,\n content: contentMinified.map,\n index,\n });\n }\n if (settings && !settings.content && settings.output) {\n utils.writeFile({\n file: settings.output,\n content: contentMinified.code,\n index,\n });\n }\n if (callback) {\n return callback(null, contentMinified.code);\n }\n return contentMinified.code;\n};\n\n/**\n * Expose `minifyUglifyES()`.\n */\nminifyUglifyES.default = minifyUglifyES;\nexport = minifyUglifyES;\n"],"mappings":";;;;;;AAUA,SAAS,aAAa;AACtB,OAAO,cAAc;AAXrB;AAAA;AAiCA,QAAM,iBAAiB,CAAC;AAAA,MACpB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ,MAAiD;AAC7C,UAAI,WAAwC,WAAW;AACvD,UAAI,OAAO,SAAS,QAAQ,cAAc,UAAU;AAChD,mBAAW;AAAA,UACP,CAAC,SAAS,QAAQ,UAAU,YAAY,EAAE,GAAG,WAAW;AAAA,QAC5D;AAAA,MACJ;AACA,YAAM,kBAAkB,SAAS,OAAO,UAAU,SAAS,OAAO;AAClE,UAAI,gBAAgB,OAAO;AACvB,YAAI,UAAU;AACV,iBAAO,SAAS,gBAAgB,KAAK;AAAA,QACzC;AAAA,MACJ;AACA,UAAI,gBAAgB,OAAO,SAAS,QAAQ,WAAW;AACnD,cAAM,UAAU;AAAA,UACZ,MAAM,GAAG,SAAS,MAAM;AAAA,UACxB,SAAS,gBAAgB;AAAA,UACzB;AAAA,QACJ,CAAC;AAAA,MACL;AACA,UAAI,YAAY,CAAC,SAAS,WAAW,SAAS,QAAQ;AAClD,cAAM,UAAU;AAAA,UACZ,MAAM,SAAS;AAAA,UACf,SAAS,gBAAgB;AAAA,UACzB;AAAA,QACJ,CAAC;AAAA,MACL;AACA,UAAI,UAAU;AACV,eAAO,SAAS,MAAM,gBAAgB,IAAI;AAAA,MAC9C;AACA,aAAO,gBAAgB;AAAA,IAC3B;AAKA,mBAAe,UAAU;AACzB,qBAAS;AAAA;AAAA;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-minify/uglify-es",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"description": "uglify-es plugin for @node-minify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compressor",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"homepage": "https://github.com/srod/node-minify/tree/master/packages/uglify-es#readme",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"engines": {
|
|
15
|
-
"node": ">=
|
|
15
|
+
"node": ">=18.0.0"
|
|
16
16
|
},
|
|
17
17
|
"directories": {
|
|
18
18
|
"lib": "dist",
|
|
@@ -22,9 +22,11 @@
|
|
|
22
22
|
"module": "./dist/index.mjs",
|
|
23
23
|
"types": "./dist/index.d.ts",
|
|
24
24
|
"exports": {
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"import": "./dist/index.mjs",
|
|
28
|
+
"require": "./dist/index.js"
|
|
29
|
+
}
|
|
28
30
|
},
|
|
29
31
|
"files": [
|
|
30
32
|
"dist/**/*"
|
|
@@ -39,18 +41,20 @@
|
|
|
39
41
|
"bugs": {
|
|
40
42
|
"url": "https://github.com/srod/node-minify/issues"
|
|
41
43
|
},
|
|
42
|
-
"scripts": {
|
|
43
|
-
"clean": "pnpm dlx rimraf dist",
|
|
44
|
-
"build": "pnpm clean && tsup src/index.ts --format cjs,esm --dts --clean --sourcemap",
|
|
45
|
-
"prepublishOnly": "pnpm build"
|
|
46
|
-
},
|
|
47
44
|
"dependencies": {
|
|
48
|
-
"
|
|
49
|
-
"
|
|
45
|
+
"uglify-es": "3.3.9",
|
|
46
|
+
"@node-minify/utils": "9.0.1"
|
|
50
47
|
},
|
|
51
48
|
"devDependencies": {
|
|
52
|
-
"@
|
|
53
|
-
"@types
|
|
49
|
+
"@types/uglify-es": "^3.0.0",
|
|
50
|
+
"@node-minify/types": "9.0.0"
|
|
54
51
|
},
|
|
55
|
-
"
|
|
56
|
-
|
|
52
|
+
"scripts": {
|
|
53
|
+
"clean": "pnpm dlx rimraf dist",
|
|
54
|
+
"build": "pnpm clean && tsup src/index.ts --format cjs,esm --dts --clean --sourcemap",
|
|
55
|
+
"lint": "biome lint .",
|
|
56
|
+
"test": "vitest run",
|
|
57
|
+
"test:ci": "vitest run --coverage",
|
|
58
|
+
"test:watch": "vitest"
|
|
59
|
+
}
|
|
60
|
+
}
|