@node-minify/uglify-js 9.0.0 → 10.0.0-next.0

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/dist/index.cjs ADDED
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ default: () => src_default
34
+ });
35
+ module.exports = __toCommonJS(src_exports);
36
+ var import_utils = require("@node-minify/utils");
37
+ var import_uglify_js = __toESM(require("uglify-js"), 1);
38
+ var minifyUglifyJS = ({
39
+ settings,
40
+ content,
41
+ callback,
42
+ index
43
+ }) => {
44
+ const contentMinified = import_uglify_js.default.minify(content ?? "", settings?.options);
45
+ if (contentMinified.error) {
46
+ if (callback) {
47
+ return callback(contentMinified.error);
48
+ }
49
+ }
50
+ if (contentMinified.map && typeof settings?.options?.sourceMap === "object" && "filename" in settings.options.sourceMap) {
51
+ import_utils.utils.writeFile({
52
+ file: typeof settings.options.sourceMap.filename === "string" ? settings.options.sourceMap.filename : "",
53
+ content: contentMinified.map,
54
+ index
55
+ });
56
+ }
57
+ if (settings && !settings.content && settings.output) {
58
+ import_utils.utils.writeFile({
59
+ file: settings.output,
60
+ content: contentMinified.code,
61
+ index
62
+ });
63
+ }
64
+ if (callback) {
65
+ return callback(null, contentMinified.code);
66
+ }
67
+ return contentMinified.code;
68
+ };
69
+ minifyUglifyJS.default = minifyUglifyJS;
70
+ var src_default = minifyUglifyJS;
71
+ /*!
72
+ * node-minify
73
+ * Copyright(c) 2011-2024 Rodolphe Stoclin
74
+ * MIT Licensed
75
+ */
76
+
77
+ // fix-cjs-exports
78
+ if (module.exports.default) {
79
+ Object.assign(module.exports.default, module.exports);
80
+ module.exports = module.exports.default;
81
+ delete module.exports.default;
82
+ }
@@ -12,3 +12,4 @@ declare const minifyUglifyJS: {
12
12
  };
13
13
 
14
14
  export { minifyUglifyJS as default };
15
+ export = minifyUglifyJS
package/dist/index.d.ts CHANGED
@@ -12,3 +12,4 @@ declare const minifyUglifyJS: {
12
12
  };
13
13
 
14
14
  export { minifyUglifyJS as default };
15
+ export = minifyUglifyJS
package/dist/index.js CHANGED
@@ -1,51 +1,27 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
-
25
1
  // src/index.ts
26
- var import_utils = require("@node-minify/utils");
27
- var import_uglify_js = __toESM(require("uglify-js"));
2
+ import { utils } from "@node-minify/utils";
3
+ import uglifyJS from "uglify-js";
28
4
  var minifyUglifyJS = ({
29
5
  settings,
30
6
  content,
31
7
  callback,
32
8
  index
33
9
  }) => {
34
- const contentMinified = import_uglify_js.default.minify(content ?? "", settings?.options);
10
+ const contentMinified = uglifyJS.minify(content ?? "", settings?.options);
35
11
  if (contentMinified.error) {
36
12
  if (callback) {
37
13
  return callback(contentMinified.error);
38
14
  }
39
15
  }
40
16
  if (contentMinified.map && typeof settings?.options?.sourceMap === "object" && "filename" in settings.options.sourceMap) {
41
- import_utils.utils.writeFile({
17
+ utils.writeFile({
42
18
  file: typeof settings.options.sourceMap.filename === "string" ? settings.options.sourceMap.filename : "",
43
19
  content: contentMinified.map,
44
20
  index
45
21
  });
46
22
  }
47
23
  if (settings && !settings.content && settings.output) {
48
- import_utils.utils.writeFile({
24
+ utils.writeFile({
49
25
  file: settings.output,
50
26
  content: contentMinified.code,
51
27
  index
@@ -57,10 +33,12 @@ var minifyUglifyJS = ({
57
33
  return contentMinified.code;
58
34
  };
59
35
  minifyUglifyJS.default = minifyUglifyJS;
60
- module.exports = minifyUglifyJS;
36
+ var src_default = minifyUglifyJS;
37
+ export {
38
+ src_default as default
39
+ };
61
40
  /*!
62
41
  * node-minify
63
42
  * Copyright(c) 2011-2024 Rodolphe Stoclin
64
43
  * MIT Licensed
65
44
  */
66
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-minify/uglify-js",
3
- "version": "9.0.0",
3
+ "version": "10.0.0-next.0",
4
4
  "description": "uglify-js plugin for @node-minify",
5
5
  "keywords": [
6
6
  "compressor",
@@ -9,23 +9,22 @@
9
9
  "uglify-js"
10
10
  ],
11
11
  "author": "Rodolphe Stoclin <srodolphe@gmail.com>",
12
- "homepage": "https://github.com/srod/node-minify/tree/master/packages/uglify-js#readme",
12
+ "homepage": "https://github.com/srod/node-minify/tree/main/packages/uglify-js#readme",
13
13
  "license": "MIT",
14
+ "type": "module",
14
15
  "engines": {
15
- "node": ">=18.0.0"
16
+ "node": ">=22.0.0"
16
17
  },
17
18
  "directories": {
18
19
  "lib": "dist",
19
20
  "test": "__tests__"
20
21
  },
21
- "main": "./dist/index.js",
22
- "module": "./dist/index.mjs",
23
- "types": "./dist/index.d.ts",
22
+ "main": "./dist/index.cjs",
24
23
  "exports": {
24
+ "./package.json": "./package.json",
25
25
  ".": {
26
- "types": "./dist/index.d.ts",
27
- "import": "./dist/index.mjs",
28
- "require": "./dist/index.cjs"
26
+ "import": "./dist/index.js",
27
+ "default": "./dist/index.cjs"
29
28
  }
30
29
  },
31
30
  "files": [
@@ -41,20 +40,22 @@
41
40
  "bugs": {
42
41
  "url": "https://github.com/srod/node-minify/issues"
43
42
  },
44
- "dependencies": {
45
- "uglify-js": "3.19.3",
46
- "@node-minify/utils": "9.0.0"
47
- },
48
- "devDependencies": {
49
- "@types/uglify-js": "^3.17.1",
50
- "@node-minify/types": "9.0.0"
51
- },
52
43
  "scripts": {
53
- "clean": "pnpm dlx rimraf dist",
54
- "build": "pnpm clean && tsup src/index.ts --format cjs,esm --dts --clean --sourcemap",
44
+ "build": "tsup src/index.ts --format cjs,esm --dts --clean && bunx fix-tsup-cjs",
45
+ "check-exports": "attw --pack .",
46
+ "format:check": "biome check .",
55
47
  "lint": "biome lint .",
48
+ "prepublishOnly": "bun run build",
56
49
  "test": "vitest run",
57
50
  "test:ci": "vitest run --coverage",
58
51
  "test:watch": "vitest"
52
+ },
53
+ "dependencies": {
54
+ "@node-minify/utils": "workspace:*",
55
+ "uglify-js": "3.19.3"
56
+ },
57
+ "devDependencies": {
58
+ "@node-minify/types": "workspace:*",
59
+ "@types/uglify-js": "^3.17.5"
59
60
  }
60
- }
61
+ }
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
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 { MinifierOptions } from \"@node-minify/types\";\nimport { utils } from \"@node-minify/utils\";\nimport uglifyJS from \"uglify-js\";\n\n/**\n * Run uglifyJS.\n * @param settings UglifyJS 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 minifyUglifyJS = ({\n settings,\n content,\n callback,\n index,\n}: MinifierOptions) => {\n const contentMinified = uglifyJS.minify(content ?? \"\", settings?.options);\n if (contentMinified.error) {\n if (callback) {\n return callback(contentMinified.error);\n }\n }\n if (\n contentMinified.map &&\n typeof settings?.options?.sourceMap === \"object\" &&\n \"filename\" in settings.options.sourceMap\n ) {\n utils.writeFile({\n file:\n typeof settings.options.sourceMap.filename === \"string\"\n ? settings.options.sourceMap.filename\n : \"\",\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 `minifyUglifyJS()`.\n */\nminifyUglifyJS.default = minifyUglifyJS;\nexport = minifyUglifyJS;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAUA,mBAAsB;AACtB,uBAAqB;AAUrB,IAAM,iBAAiB,CAAC;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ,MAAuB;AACnB,QAAM,kBAAkB,iBAAAA,QAAS,OAAO,WAAW,IAAI,UAAU,OAAO;AACxE,MAAI,gBAAgB,OAAO;AACvB,QAAI,UAAU;AACV,aAAO,SAAS,gBAAgB,KAAK;AAAA,IACzC;AAAA,EACJ;AACA,MACI,gBAAgB,OAChB,OAAO,UAAU,SAAS,cAAc,YACxC,cAAc,SAAS,QAAQ,WACjC;AACE,uBAAM,UAAU;AAAA,MACZ,MACI,OAAO,SAAS,QAAQ,UAAU,aAAa,WACzC,SAAS,QAAQ,UAAU,WAC3B;AAAA,MACV,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":["uglifyJS"]}
package/dist/index.mjs DELETED
@@ -1,52 +0,0 @@
1
- var __getOwnPropNames = Object.getOwnPropertyNames;
2
- var __commonJS = (cb, mod) => function __require() {
3
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
4
- };
5
-
6
- // src/index.ts
7
- import { utils } from "@node-minify/utils";
8
- import uglifyJS from "uglify-js";
9
- var require_src = __commonJS({
10
- "src/index.ts"(exports, module) {
11
- var minifyUglifyJS = ({
12
- settings,
13
- content,
14
- callback,
15
- index
16
- }) => {
17
- const contentMinified = uglifyJS.minify(content ?? "", settings?.options);
18
- if (contentMinified.error) {
19
- if (callback) {
20
- return callback(contentMinified.error);
21
- }
22
- }
23
- if (contentMinified.map && typeof settings?.options?.sourceMap === "object" && "filename" in settings.options.sourceMap) {
24
- utils.writeFile({
25
- file: typeof settings.options.sourceMap.filename === "string" ? settings.options.sourceMap.filename : "",
26
- content: contentMinified.map,
27
- index
28
- });
29
- }
30
- if (settings && !settings.content && settings.output) {
31
- utils.writeFile({
32
- file: settings.output,
33
- content: contentMinified.code,
34
- index
35
- });
36
- }
37
- if (callback) {
38
- return callback(null, contentMinified.code);
39
- }
40
- return contentMinified.code;
41
- };
42
- minifyUglifyJS.default = minifyUglifyJS;
43
- module.exports = minifyUglifyJS;
44
- }
45
- });
46
- export default require_src();
47
- /*!
48
- * node-minify
49
- * Copyright(c) 2011-2024 Rodolphe Stoclin
50
- * MIT Licensed
51
- */
52
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
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 { MinifierOptions } from \"@node-minify/types\";\nimport { utils } from \"@node-minify/utils\";\nimport uglifyJS from \"uglify-js\";\n\n/**\n * Run uglifyJS.\n * @param settings UglifyJS 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 minifyUglifyJS = ({\n settings,\n content,\n callback,\n index,\n}: MinifierOptions) => {\n const contentMinified = uglifyJS.minify(content ?? \"\", settings?.options);\n if (contentMinified.error) {\n if (callback) {\n return callback(contentMinified.error);\n }\n }\n if (\n contentMinified.map &&\n typeof settings?.options?.sourceMap === \"object\" &&\n \"filename\" in settings.options.sourceMap\n ) {\n utils.writeFile({\n file:\n typeof settings.options.sourceMap.filename === \"string\"\n ? settings.options.sourceMap.filename\n : \"\",\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 `minifyUglifyJS()`.\n */\nminifyUglifyJS.default = minifyUglifyJS;\nexport = minifyUglifyJS;\n"],"mappings":";;;;;;AAUA,SAAS,aAAa;AACtB,OAAO,cAAc;AAXrB;AAAA;AAqBA,QAAM,iBAAiB,CAAC;AAAA,MACpB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ,MAAuB;AACnB,YAAM,kBAAkB,SAAS,OAAO,WAAW,IAAI,UAAU,OAAO;AACxE,UAAI,gBAAgB,OAAO;AACvB,YAAI,UAAU;AACV,iBAAO,SAAS,gBAAgB,KAAK;AAAA,QACzC;AAAA,MACJ;AACA,UACI,gBAAgB,OAChB,OAAO,UAAU,SAAS,cAAc,YACxC,cAAc,SAAS,QAAQ,WACjC;AACE,cAAM,UAAU;AAAA,UACZ,MACI,OAAO,SAAS,QAAQ,UAAU,aAAa,WACzC,SAAS,QAAQ,UAAU,WAC3B;AAAA,UACV,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":[]}