@node-minify/uglify-es 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,88 @@
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_es = __toESM(require("uglify-es"), 1);
38
+ var minifyUglifyES = ({
39
+ settings,
40
+ content,
41
+ callback,
42
+ index
43
+ }) => {
44
+ let content2 = content ?? "";
45
+ if (typeof settings.options.sourceMap === "object") {
46
+ content2 = {
47
+ [settings.options.sourceMap.filename ?? ""]: content ?? ""
48
+ };
49
+ }
50
+ const contentMinified = import_uglify_es.default.minify(content2, settings.options);
51
+ if (contentMinified.error) {
52
+ if (callback) {
53
+ return callback(contentMinified.error);
54
+ }
55
+ }
56
+ if (contentMinified.map && settings.options.sourceMap) {
57
+ import_utils.utils.writeFile({
58
+ file: `${settings.output}.map`,
59
+ content: contentMinified.map,
60
+ index
61
+ });
62
+ }
63
+ if (settings && !settings.content && settings.output) {
64
+ import_utils.utils.writeFile({
65
+ file: settings.output,
66
+ content: contentMinified.code,
67
+ index
68
+ });
69
+ }
70
+ if (callback) {
71
+ return callback(null, contentMinified.code);
72
+ }
73
+ return contentMinified.code;
74
+ };
75
+ minifyUglifyES.default = minifyUglifyES;
76
+ var src_default = minifyUglifyES;
77
+ /*!
78
+ * node-minify
79
+ * Copyright(c) 2011-2024 Rodolphe Stoclin
80
+ * MIT Licensed
81
+ */
82
+
83
+ // fix-cjs-exports
84
+ if (module.exports.default) {
85
+ Object.assign(module.exports.default, module.exports);
86
+ module.exports = module.exports.default;
87
+ delete module.exports.default;
88
+ }
@@ -23,3 +23,4 @@ declare const minifyUglifyES: {
23
23
  };
24
24
 
25
25
  export { minifyUglifyES as default };
26
+ export = minifyUglifyES
package/dist/index.d.ts CHANGED
@@ -23,3 +23,4 @@ declare const minifyUglifyES: {
23
23
  };
24
24
 
25
25
  export { minifyUglifyES as default };
26
+ export = minifyUglifyES
package/dist/index.js CHANGED
@@ -1,30 +1,6 @@
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_es = __toESM(require("uglify-es"));
2
+ import { utils } from "@node-minify/utils";
3
+ import uglifyES from "uglify-es";
28
4
  var minifyUglifyES = ({
29
5
  settings,
30
6
  content,
@@ -37,21 +13,21 @@ var minifyUglifyES = ({
37
13
  [settings.options.sourceMap.filename ?? ""]: content ?? ""
38
14
  };
39
15
  }
40
- const contentMinified = import_uglify_es.default.minify(content2, settings.options);
16
+ const contentMinified = uglifyES.minify(content2, settings.options);
41
17
  if (contentMinified.error) {
42
18
  if (callback) {
43
19
  return callback(contentMinified.error);
44
20
  }
45
21
  }
46
22
  if (contentMinified.map && settings.options.sourceMap) {
47
- import_utils.utils.writeFile({
23
+ utils.writeFile({
48
24
  file: `${settings.output}.map`,
49
25
  content: contentMinified.map,
50
26
  index
51
27
  });
52
28
  }
53
29
  if (settings && !settings.content && settings.output) {
54
- import_utils.utils.writeFile({
30
+ utils.writeFile({
55
31
  file: settings.output,
56
32
  content: contentMinified.code,
57
33
  index
@@ -63,10 +39,12 @@ var minifyUglifyES = ({
63
39
  return contentMinified.code;
64
40
  };
65
41
  minifyUglifyES.default = minifyUglifyES;
66
- module.exports = minifyUglifyES;
42
+ var src_default = minifyUglifyES;
43
+ export {
44
+ src_default as default
45
+ };
67
46
  /*!
68
47
  * node-minify
69
48
  * Copyright(c) 2011-2024 Rodolphe Stoclin
70
49
  * MIT Licensed
71
50
  */
72
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-minify/uglify-es",
3
- "version": "9.0.0",
3
+ "version": "10.0.0-next.0",
4
4
  "description": "uglify-es plugin for @node-minify",
5
5
  "keywords": [
6
6
  "compressor",
@@ -9,23 +9,22 @@
9
9
  "uglify-es"
10
10
  ],
11
11
  "author": "Rodolphe Stoclin <srodolphe@gmail.com>",
12
- "homepage": "https://github.com/srod/node-minify/tree/master/packages/uglify-es#readme",
12
+ "homepage": "https://github.com/srod/node-minify/tree/main/packages/uglify-es#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-es": "3.3.9",
46
- "@node-minify/utils": "9.0.0"
47
- },
48
- "devDependencies": {
49
- "@types/uglify-es": "^3.0.0",
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-es": "3.3.9"
56
+ },
57
+ "devDependencies": {
58
+ "@node-minify/types": "workspace:*",
59
+ "@types/uglify-es": "^3.0.3"
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 { 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 DELETED
@@ -1,58 +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 uglifyES from "uglify-es";
9
- var require_src = __commonJS({
10
- "src/index.ts"(exports, module) {
11
- var minifyUglifyES = ({
12
- settings,
13
- content,
14
- callback,
15
- index
16
- }) => {
17
- let content2 = content ?? "";
18
- if (typeof settings.options.sourceMap === "object") {
19
- content2 = {
20
- [settings.options.sourceMap.filename ?? ""]: content ?? ""
21
- };
22
- }
23
- const contentMinified = uglifyES.minify(content2, settings.options);
24
- if (contentMinified.error) {
25
- if (callback) {
26
- return callback(contentMinified.error);
27
- }
28
- }
29
- if (contentMinified.map && settings.options.sourceMap) {
30
- utils.writeFile({
31
- file: `${settings.output}.map`,
32
- content: contentMinified.map,
33
- index
34
- });
35
- }
36
- if (settings && !settings.content && settings.output) {
37
- utils.writeFile({
38
- file: settings.output,
39
- content: contentMinified.code,
40
- index
41
- });
42
- }
43
- if (callback) {
44
- return callback(null, contentMinified.code);
45
- }
46
- return contentMinified.code;
47
- };
48
- minifyUglifyES.default = minifyUglifyES;
49
- module.exports = minifyUglifyES;
50
- }
51
- });
52
- export default require_src();
53
- /*!
54
- * node-minify
55
- * Copyright(c) 2011-2024 Rodolphe Stoclin
56
- * MIT Licensed
57
- */
58
- //# 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 { 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":[]}