@node-minify/google-closure-compiler 7.0.0 → 7.1.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.
@@ -1,13 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  var _googleClosureCompilerJava = _interopRequireDefault(require("google-closure-compiler-java"));
4
-
5
4
  var _utils = require("@node-minify/utils");
6
-
7
5
  var _run = require("@node-minify/run");
8
-
9
6
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
-
11
7
  /*!
12
8
  * node-minify
13
9
  * Copyright(c) 2011-2022 Rodolphe Stoclin
@@ -17,8 +13,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
17
13
  /**
18
14
  * Module dependencies.
19
15
  */
16
+
20
17
  // the allowed flags, taken from https://github.com/google/closure-compiler/wiki/Flags-and-Options
21
18
  const allowedFlags = ['angular_pass', 'assume_function_wrapper', 'checks_only', 'compilation_level', 'create_source_map', 'define', 'env', 'externs', 'export_local_property_definitions', 'generate_exports', 'language_in', 'language_out', 'output_wrapper', 'polymer_version', 'process_common_js_modules', 'rename_prefix_namespace', 'rewrite_polyfills', 'use_types_for_optimization', 'warning_level'];
19
+
22
20
  /**
23
21
  * Run Google Closure Compiler.
24
22
  *
@@ -26,7 +24,6 @@ const allowedFlags = ['angular_pass', 'assume_function_wrapper', 'checks_only',
26
24
  * @param {String} content
27
25
  * @param {Function} callback
28
26
  */
29
-
30
27
  const minifyGCC = ({
31
28
  settings,
32
29
  content,
@@ -46,7 +43,6 @@ const minifyGCC = ({
46
43
  throw err;
47
44
  }
48
45
  }
49
-
50
46
  if (!settings.content) {
51
47
  _utils.utils.writeFile({
52
48
  file: settings.output,
@@ -54,42 +50,37 @@ const minifyGCC = ({
54
50
  index
55
51
  });
56
52
  }
57
-
58
53
  if (callback) {
59
54
  return callback(null, content);
60
55
  }
61
-
62
56
  return content;
63
57
  }
64
58
  });
65
59
  };
60
+
66
61
  /**
67
62
  * Adds any valid options passed in the options parameters to the flags parameter and returns the flags object.
68
63
  * @param {Object} flags
69
64
  * @param {Object} options
70
65
  * @returns {Object} flags
71
66
  */
72
-
73
-
74
67
  const applyOptions = (flags, options) => {
75
68
  if (!options || Object.keys(options).length === 0) {
76
69
  return flags;
77
70
  }
78
-
79
71
  Object.keys(options).filter(option => allowedFlags.indexOf(option) > -1).forEach(option => flags[option] = options[option]);
80
72
  return flags;
81
73
  };
74
+
82
75
  /**
83
76
  * GCC command line.
84
77
  */
85
78
 
86
-
87
79
  const gccCommand = options => {
88
80
  return ['-jar', _googleClosureCompilerJava.default].concat(_utils.utils.buildArgs(options || {}));
89
81
  };
82
+
90
83
  /**
91
84
  * Expose `minifyGCC()`.
92
85
  */
93
-
94
-
95
86
  module.exports = minifyGCC;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-minify/google-closure-compiler",
3
- "version": "7.0.0",
3
+ "version": "7.1.0",
4
4
  "description": "google closure compiler plugin for @node-minify",
5
5
  "keywords": [
6
6
  "compressor",
@@ -34,8 +34,9 @@
34
34
  "url": "https://github.com/srod/node-minify/issues"
35
35
  },
36
36
  "dependencies": {
37
- "@node-minify/utils": "^7.0.0",
38
- "google-closure-compiler-java": "20220719.0.0"
37
+ "@node-minify/run": "^7.1.0",
38
+ "@node-minify/utils": "^7.1.0",
39
+ "google-closure-compiler-java": "20221102.0.1"
39
40
  },
40
- "gitHead": "8b5bda6f1ac9fe7180006f2a19ec3253e8fff4ec"
41
+ "gitHead": "94cef2d5d653c3bddc3e603b4e25c135b0b6f4b3"
41
42
  }