@node-minify/google-closure-compiler 8.0.2-beta.0 → 8.0.5-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/LICENSE +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
package/LICENSE
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ import { MinifierOptions } from '@node-minify/types';
|
|
|
2
2
|
|
|
3
3
|
/*!
|
|
4
4
|
* node-minify
|
|
5
|
-
* Copyright(c) 2011-
|
|
5
|
+
* Copyright(c) 2011-2023 Rodolphe Stoclin
|
|
6
6
|
* MIT Licensed
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
declare const minifyGCC: {
|
|
10
|
-
({ settings, content, callback, index }: MinifierOptions):
|
|
10
|
+
({ settings, content, callback, index }: MinifierOptions): void | null;
|
|
11
11
|
default: any;
|
|
12
12
|
};
|
|
13
13
|
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
14
|
return to;
|
|
15
15
|
};
|
|
16
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.
|
|
17
21
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
18
22
|
mod
|
|
19
23
|
));
|
|
@@ -57,7 +61,7 @@ var minifyGCC = ({ settings, content, callback, index }) => {
|
|
|
57
61
|
throw err;
|
|
58
62
|
}
|
|
59
63
|
}
|
|
60
|
-
if (settings && !settings.content) {
|
|
64
|
+
if (settings && !settings.content && settings.output) {
|
|
61
65
|
import_utils.utils.writeFile({ file: settings.output, content: content2, index });
|
|
62
66
|
}
|
|
63
67
|
if (callback) {
|
|
@@ -81,7 +85,7 @@ minifyGCC.default = minifyGCC;
|
|
|
81
85
|
module.exports = minifyGCC;
|
|
82
86
|
/*!
|
|
83
87
|
* node-minify
|
|
84
|
-
* Copyright(c) 2011-
|
|
88
|
+
* Copyright(c) 2011-2023 Rodolphe Stoclin
|
|
85
89
|
* MIT Licensed
|
|
86
90
|
*/
|
|
87
91
|
//# 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-2023 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: unknown, content?: string) => {\n if (err) {\n if (callback) {\n return callback(err);\n } else {\n throw err;\n }\n }\n if (settings && !settings.content && settings.output) {\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 = (\n flags: Dictionary<string | boolean | [] | { url: string } | { filename: string } | undefined>,\n options: Options\n) => {\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 = (\n options: Dictionary<string | boolean | [] | { url: string } | { filename: string } | undefined>\n) => {\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,KAAcA,aAAqB;AAC5C,UAAI,KAAK;AACP,YAAI,UAAU;AACZ,iBAAO,SAAS,GAAG;AAAA,QACrB,OAAO;AACL,gBAAM;AAAA,QACR;AAAA,MACF;AACA,UAAI,YAAY,CAAC,SAAS,WAAW,SAAS,QAAQ;AACpD,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,CACnB,OACA,YACG;AACH,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,MAAM,IAAI,QAAQ,MAAM,CAAE;AACtD,SAAO;AACT;AAMA,IAAM,aAAa,CACjB,YACG;AACH,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
|
@@ -44,7 +44,7 @@ var require_src = __commonJS({
|
|
|
44
44
|
throw err;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
if (settings && !settings.content) {
|
|
47
|
+
if (settings && !settings.content && settings.output) {
|
|
48
48
|
utils.writeFile({ file: settings.output, content: content2, index });
|
|
49
49
|
}
|
|
50
50
|
if (callback) {
|
|
@@ -71,7 +71,7 @@ var require_src = __commonJS({
|
|
|
71
71
|
export default require_src();
|
|
72
72
|
/*!
|
|
73
73
|
* node-minify
|
|
74
|
-
* Copyright(c) 2011-
|
|
74
|
+
* Copyright(c) 2011-2023 Rodolphe Stoclin
|
|
75
75
|
* MIT Licensed
|
|
76
76
|
*/
|
|
77
77
|
//# 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-2023 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: unknown, content?: string) => {\n if (err) {\n if (callback) {\n return callback(err);\n } else {\n throw err;\n }\n }\n if (settings && !settings.content && settings.output) {\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 = (\n flags: Dictionary<string | boolean | [] | { url: string } | { filename: string } | undefined>,\n options: Options\n) => {\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 = (\n options: Dictionary<string | boolean | [] | { url: string } | { filename: string } | undefined>\n) => {\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,KAAcA,aAAqB;AAC5C,cAAI,KAAK;AACP,gBAAI,UAAU;AACZ,qBAAO,SAAS,GAAG;AAAA,YACrB,OAAO;AACL,oBAAM;AAAA,YACR;AAAA,UACF;AACA,cAAI,YAAY,CAAC,SAAS,WAAW,SAAS,QAAQ;AACpD,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,CACnB,OACA,YACG;AACH,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,MAAM,IAAI,QAAQ,MAAM,CAAE;AACtD,aAAO;AAAA,IACT;AAMA,QAAM,aAAa,CACjB,YACG;AACH,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.
|
|
3
|
+
"version": "8.0.5-beta.0",
|
|
4
4
|
"description": "google closure compiler plugin for @node-minify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compressor",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"homepage": "https://github.com/srod/node-minify/tree/master/packages/google-closure-compiler#readme",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"engines": {
|
|
16
|
-
"node": ">=
|
|
16
|
+
"node": ">=16.0.0"
|
|
17
17
|
},
|
|
18
18
|
"directories": {
|
|
19
19
|
"lib": "dist",
|
|
@@ -42,16 +42,16 @@
|
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"clean": "pnpm dlx rimraf dist",
|
|
45
|
-
"build": "
|
|
46
|
-
"prepublishOnly": "
|
|
45
|
+
"build": "pnpm clean && tsup src/index.ts --format cjs,esm --dts --clean --sourcemap",
|
|
46
|
+
"prepublishOnly": "pnpm build"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@node-minify/run": "8.0.
|
|
50
|
-
"@node-minify/utils": "8.0.
|
|
49
|
+
"@node-minify/run": "8.0.5-beta.0",
|
|
50
|
+
"@node-minify/utils": "8.0.5-beta.0",
|
|
51
51
|
"google-closure-compiler-java": "20221102.0.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@node-minify/types": "8.0.
|
|
54
|
+
"@node-minify/types": "8.0.3-beta.0"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "22a7b887ea22743702b1dc5a613755ae20838a73"
|
|
57
57
|
}
|