@node-minify/google-closure-compiler 8.0.0-beta.0 → 8.0.2-beta.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.d.ts CHANGED
@@ -6,13 +6,9 @@ import { MinifierOptions } from '@node-minify/types';
6
6
  * MIT Licensed
7
7
  */
8
8
 
9
- /**
10
- * Run Google Closure Compiler.
11
- *
12
- * @param {Object} settings
13
- * @param {String} content
14
- * @param {Function} callback
15
- */
16
- declare const minifyGCC: ({ settings, content, callback, index }: MinifierOptions) => any;
9
+ declare const minifyGCC: {
10
+ ({ settings, content, callback, index }: MinifierOptions): any;
11
+ default: any;
12
+ };
17
13
 
18
14
  export { minifyGCC as default };
package/dist/index.js CHANGED
@@ -1,13 +1,10 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
6
  var __getProtoOf = Object.getPrototypeOf;
6
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
8
  var __copyProps = (to, from, except, desc) => {
12
9
  if (from && typeof from === "object" || typeof from === "function") {
13
10
  for (let key of __getOwnPropNames(from))
@@ -20,14 +17,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
20
17
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
18
  mod
22
19
  ));
23
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
20
 
25
21
  // src/index.ts
26
- var src_exports = {};
27
- __export(src_exports, {
28
- default: () => src_default
29
- });
30
- module.exports = __toCommonJS(src_exports);
31
22
  var import_google_closure_compiler_java = __toESM(require("google-closure-compiler-java"));
32
23
  var import_utils = require("@node-minify/utils");
33
24
  var import_run = require("@node-minify/run");
@@ -86,11 +77,11 @@ var applyOptions = (flags, options) => {
86
77
  var gccCommand = (options) => {
87
78
  return ["-jar", import_google_closure_compiler_java.default].concat(import_utils.utils.buildArgs(options || {}));
88
79
  };
89
- var src_default = minifyGCC;
90
- // Annotate the CommonJS export names for ESM import in node:
91
- 0 && (module.exports = {});
80
+ minifyGCC.default = minifyGCC;
81
+ module.exports = minifyGCC;
92
82
  /*!
93
83
  * node-minify
94
84
  * Copyright(c) 2011-2022 Rodolphe Stoclin
95
85
  * MIT Licensed
96
86
  */
87
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-2022 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\nimport compilerPath from 'google-closure-compiler-java';\nimport { utils } from '@node-minify/utils';\nimport { runCommandLine } from '@node-minify/run';\nimport { MinifierOptions, Options, Dictionary } from '@node-minify/types';\n\n// the allowed flags, taken from https://github.com/google/closure-compiler/wiki/Flags-and-Options\nconst allowedFlags = [\n 'angular_pass',\n 'assume_function_wrapper',\n 'checks_only',\n 'compilation_level',\n 'create_source_map',\n 'define',\n 'env',\n 'externs',\n 'export_local_property_definitions',\n 'generate_exports',\n 'language_in',\n 'language_out',\n 'output_wrapper',\n 'polymer_version',\n 'process_common_js_modules',\n 'rename_prefix_namespace',\n 'rewrite_polyfills',\n 'use_types_for_optimization',\n 'warning_level'\n];\n\n/**\n * Run Google Closure Compiler.\n *\n * @param {Object} settings\n * @param {String} content\n * @param {Function} callback\n */\nconst minifyGCC = ({ settings, content, callback, index }: MinifierOptions) => {\n const options = applyOptions({}, (settings && settings.options) || {});\n return runCommandLine({\n args: gccCommand(options),\n data: content,\n settings,\n callback: (err: Error, content: string) => {\n if (err) {\n if (callback) {\n return callback(err);\n } else {\n throw err;\n }\n }\n if (settings && !settings.content) {\n utils.writeFile({ file: settings.output, content, index });\n }\n if (callback) {\n return callback(null, content);\n }\n return content;\n }\n });\n};\n\n/**\n * Adds any valid options passed in the options parameters to the flags parameter and returns the flags object.\n * @param {Object} flags\n * @param {Object} options\n * @returns {Object} flags\n */\nconst applyOptions = (flags: Dictionary<string>, options: Options) => {\n if (!options || Object.keys(options).length === 0) {\n return flags;\n }\n Object.keys(options)\n .filter(option => allowedFlags.indexOf(option) > -1)\n .forEach(option => (flags[option] = options[option]));\n return flags;\n};\n\n/**\n * GCC command line.\n */\n\nconst gccCommand = (options: {}) => {\n return ['-jar', compilerPath].concat(utils.buildArgs(options || {}));\n};\n\n/**\n * Expose `minifyGCC()`.\n */\nminifyGCC.default = minifyGCC;\nexport = minifyGCC;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AASA,0CAAyB;AACzB,mBAAsB;AACtB,iBAA+B;AAI/B,IAAM,eAAe;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AASA,IAAM,YAAY,CAAC,EAAE,UAAU,SAAS,UAAU,MAAM,MAAuB;AAC7E,QAAM,UAAU,aAAa,CAAC,GAAI,YAAY,SAAS,WAAY,CAAC,CAAC;AACrE,aAAO,2BAAe;AAAA,IACpB,MAAM,WAAW,OAAO;AAAA,IACxB,MAAM;AAAA,IACN;AAAA,IACA,UAAU,CAAC,KAAYA,aAAoB;AACzC,UAAI,KAAK;AACP,YAAI,UAAU;AACZ,iBAAO,SAAS,GAAG;AAAA,QACrB,OAAO;AACL,gBAAM;AAAA,QACR;AAAA,MACF;AACA,UAAI,YAAY,CAAC,SAAS,SAAS;AACjC,2BAAM,UAAU,EAAE,MAAM,SAAS,QAAQ,SAAAA,UAAS,MAAM,CAAC;AAAA,MAC3D;AACA,UAAI,UAAU;AACZ,eAAO,SAAS,MAAMA,QAAO;AAAA,MAC/B;AACA,aAAOA;AAAA,IACT;AAAA,EACF,CAAC;AACH;AAQA,IAAM,eAAe,CAAC,OAA2B,YAAqB;AACpE,MAAI,CAAC,WAAW,OAAO,KAAK,OAAO,EAAE,WAAW,GAAG;AACjD,WAAO;AAAA,EACT;AACA,SAAO,KAAK,OAAO,EAChB,OAAO,YAAU,aAAa,QAAQ,MAAM,IAAI,EAAE,EAClD,QAAQ,YAAW,MAAM,UAAU,QAAQ,OAAQ;AACtD,SAAO;AACT;AAMA,IAAM,aAAa,CAAC,YAAgB;AAClC,SAAO,CAAC,QAAQ,oCAAAC,OAAY,EAAE,OAAO,mBAAM,UAAU,WAAW,CAAC,CAAC,CAAC;AACrE;AAKA,UAAU,UAAU;AACpB,iBAAS;","names":["content","compilerPath"]}
package/dist/index.mjs CHANGED
@@ -1,68 +1,77 @@
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
+
1
6
  // src/index.ts
2
7
  import compilerPath from "google-closure-compiler-java";
3
8
  import { utils } from "@node-minify/utils";
4
9
  import { runCommandLine } from "@node-minify/run";
5
- var allowedFlags = [
6
- "angular_pass",
7
- "assume_function_wrapper",
8
- "checks_only",
9
- "compilation_level",
10
- "create_source_map",
11
- "define",
12
- "env",
13
- "externs",
14
- "export_local_property_definitions",
15
- "generate_exports",
16
- "language_in",
17
- "language_out",
18
- "output_wrapper",
19
- "polymer_version",
20
- "process_common_js_modules",
21
- "rename_prefix_namespace",
22
- "rewrite_polyfills",
23
- "use_types_for_optimization",
24
- "warning_level"
25
- ];
26
- var minifyGCC = ({ settings, content, callback, index }) => {
27
- const options = applyOptions({}, settings && settings.options || {});
28
- return runCommandLine({
29
- args: gccCommand(options),
30
- data: content,
31
- settings,
32
- callback: (err, content2) => {
33
- if (err) {
34
- if (callback) {
35
- return callback(err);
36
- } else {
37
- throw err;
10
+ var require_src = __commonJS({
11
+ "src/index.ts"(exports, module) {
12
+ var allowedFlags = [
13
+ "angular_pass",
14
+ "assume_function_wrapper",
15
+ "checks_only",
16
+ "compilation_level",
17
+ "create_source_map",
18
+ "define",
19
+ "env",
20
+ "externs",
21
+ "export_local_property_definitions",
22
+ "generate_exports",
23
+ "language_in",
24
+ "language_out",
25
+ "output_wrapper",
26
+ "polymer_version",
27
+ "process_common_js_modules",
28
+ "rename_prefix_namespace",
29
+ "rewrite_polyfills",
30
+ "use_types_for_optimization",
31
+ "warning_level"
32
+ ];
33
+ var minifyGCC = ({ settings, content, callback, index }) => {
34
+ const options = applyOptions({}, settings && settings.options || {});
35
+ return runCommandLine({
36
+ args: gccCommand(options),
37
+ data: content,
38
+ settings,
39
+ callback: (err, content2) => {
40
+ if (err) {
41
+ if (callback) {
42
+ return callback(err);
43
+ } else {
44
+ throw err;
45
+ }
46
+ }
47
+ if (settings && !settings.content) {
48
+ utils.writeFile({ file: settings.output, content: content2, index });
49
+ }
50
+ if (callback) {
51
+ return callback(null, content2);
52
+ }
53
+ return content2;
38
54
  }
55
+ });
56
+ };
57
+ var applyOptions = (flags, options) => {
58
+ if (!options || Object.keys(options).length === 0) {
59
+ return flags;
39
60
  }
40
- if (settings && !settings.content) {
41
- utils.writeFile({ file: settings.output, content: content2, index });
42
- }
43
- if (callback) {
44
- return callback(null, content2);
45
- }
46
- return content2;
47
- }
48
- });
49
- };
50
- var applyOptions = (flags, options) => {
51
- if (!options || Object.keys(options).length === 0) {
52
- return flags;
61
+ Object.keys(options).filter((option) => allowedFlags.indexOf(option) > -1).forEach((option) => flags[option] = options[option]);
62
+ return flags;
63
+ };
64
+ var gccCommand = (options) => {
65
+ return ["-jar", compilerPath].concat(utils.buildArgs(options || {}));
66
+ };
67
+ minifyGCC.default = minifyGCC;
68
+ module.exports = minifyGCC;
53
69
  }
54
- Object.keys(options).filter((option) => allowedFlags.indexOf(option) > -1).forEach((option) => flags[option] = options[option]);
55
- return flags;
56
- };
57
- var gccCommand = (options) => {
58
- return ["-jar", compilerPath].concat(utils.buildArgs(options || {}));
59
- };
60
- var src_default = minifyGCC;
61
- export {
62
- src_default as default
63
- };
70
+ });
71
+ export default require_src();
64
72
  /*!
65
73
  * node-minify
66
74
  * Copyright(c) 2011-2022 Rodolphe Stoclin
67
75
  * MIT Licensed
68
76
  */
77
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-2022 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\nimport compilerPath from 'google-closure-compiler-java';\nimport { utils } from '@node-minify/utils';\nimport { runCommandLine } from '@node-minify/run';\nimport { MinifierOptions, Options, Dictionary } from '@node-minify/types';\n\n// the allowed flags, taken from https://github.com/google/closure-compiler/wiki/Flags-and-Options\nconst allowedFlags = [\n 'angular_pass',\n 'assume_function_wrapper',\n 'checks_only',\n 'compilation_level',\n 'create_source_map',\n 'define',\n 'env',\n 'externs',\n 'export_local_property_definitions',\n 'generate_exports',\n 'language_in',\n 'language_out',\n 'output_wrapper',\n 'polymer_version',\n 'process_common_js_modules',\n 'rename_prefix_namespace',\n 'rewrite_polyfills',\n 'use_types_for_optimization',\n 'warning_level'\n];\n\n/**\n * Run Google Closure Compiler.\n *\n * @param {Object} settings\n * @param {String} content\n * @param {Function} callback\n */\nconst minifyGCC = ({ settings, content, callback, index }: MinifierOptions) => {\n const options = applyOptions({}, (settings && settings.options) || {});\n return runCommandLine({\n args: gccCommand(options),\n data: content,\n settings,\n callback: (err: Error, content: string) => {\n if (err) {\n if (callback) {\n return callback(err);\n } else {\n throw err;\n }\n }\n if (settings && !settings.content) {\n utils.writeFile({ file: settings.output, content, index });\n }\n if (callback) {\n return callback(null, content);\n }\n return content;\n }\n });\n};\n\n/**\n * Adds any valid options passed in the options parameters to the flags parameter and returns the flags object.\n * @param {Object} flags\n * @param {Object} options\n * @returns {Object} flags\n */\nconst applyOptions = (flags: Dictionary<string>, options: Options) => {\n if (!options || Object.keys(options).length === 0) {\n return flags;\n }\n Object.keys(options)\n .filter(option => allowedFlags.indexOf(option) > -1)\n .forEach(option => (flags[option] = options[option]));\n return flags;\n};\n\n/**\n * GCC command line.\n */\n\nconst gccCommand = (options: {}) => {\n return ['-jar', compilerPath].concat(utils.buildArgs(options || {}));\n};\n\n/**\n * Expose `minifyGCC()`.\n */\nminifyGCC.default = minifyGCC;\nexport = minifyGCC;\n"],"mappings":";;;;;;AASA,OAAO,kBAAkB;AACzB,SAAS,aAAa;AACtB,SAAS,sBAAsB;AAX/B;AAAA;AAeA,QAAM,eAAe;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AASA,QAAM,YAAY,CAAC,EAAE,UAAU,SAAS,UAAU,MAAM,MAAuB;AAC7E,YAAM,UAAU,aAAa,CAAC,GAAI,YAAY,SAAS,WAAY,CAAC,CAAC;AACrE,aAAO,eAAe;AAAA,QACpB,MAAM,WAAW,OAAO;AAAA,QACxB,MAAM;AAAA,QACN;AAAA,QACA,UAAU,CAAC,KAAYA,aAAoB;AACzC,cAAI,KAAK;AACP,gBAAI,UAAU;AACZ,qBAAO,SAAS,GAAG;AAAA,YACrB,OAAO;AACL,oBAAM;AAAA,YACR;AAAA,UACF;AACA,cAAI,YAAY,CAAC,SAAS,SAAS;AACjC,kBAAM,UAAU,EAAE,MAAM,SAAS,QAAQ,SAAAA,UAAS,MAAM,CAAC;AAAA,UAC3D;AACA,cAAI,UAAU;AACZ,mBAAO,SAAS,MAAMA,QAAO;AAAA,UAC/B;AACA,iBAAOA;AAAA,QACT;AAAA,MACF,CAAC;AAAA,IACH;AAQA,QAAM,eAAe,CAAC,OAA2B,YAAqB;AACpE,UAAI,CAAC,WAAW,OAAO,KAAK,OAAO,EAAE,WAAW,GAAG;AACjD,eAAO;AAAA,MACT;AACA,aAAO,KAAK,OAAO,EAChB,OAAO,YAAU,aAAa,QAAQ,MAAM,IAAI,EAAE,EAClD,QAAQ,YAAW,MAAM,UAAU,QAAQ,OAAQ;AACtD,aAAO;AAAA,IACT;AAMA,QAAM,aAAa,CAAC,YAAgB;AAClC,aAAO,CAAC,QAAQ,YAAY,EAAE,OAAO,MAAM,UAAU,WAAW,CAAC,CAAC,CAAC;AAAA,IACrE;AAKA,cAAU,UAAU;AACpB,qBAAS;AAAA;AAAA;","names":["content"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-minify/google-closure-compiler",
3
- "version": "8.0.0-beta.0",
3
+ "version": "8.0.2-beta.0",
4
4
  "description": "google closure compiler plugin for @node-minify",
5
5
  "keywords": [
6
6
  "compressor",
@@ -42,16 +42,16 @@
42
42
  },
43
43
  "scripts": {
44
44
  "clean": "pnpm dlx rimraf dist",
45
- "build": "npm run clean && tsup src/index.ts --format cjs,esm --dts --clean",
45
+ "build": "npm run clean && tsup src/index.ts --format cjs,esm --dts --clean --sourcemap",
46
46
  "prepublishOnly": "npm run build"
47
47
  },
48
48
  "dependencies": {
49
- "@node-minify/run": "8.0.0-beta.0",
50
- "@node-minify/utils": "8.0.0-beta.0",
49
+ "@node-minify/run": "8.0.2-beta.0",
50
+ "@node-minify/utils": "8.0.2-beta.0",
51
51
  "google-closure-compiler-java": "20221102.0.1"
52
52
  },
53
53
  "devDependencies": {
54
- "@node-minify/types": "8.0.0-beta.0"
54
+ "@node-minify/types": "8.0.2-beta.0"
55
55
  },
56
- "gitHead": "0507c6190577e1939997a8231b07952ba167a780"
56
+ "gitHead": "bd2fe186257749fcb9bf7a9ff1ce61fb922c4ade"
57
57
  }