@node-minify/run 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.
Files changed (2) hide show
  1. package/lib/run.js +3 -15
  2. package/package.json +2 -2
package/lib/run.js CHANGED
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.runCommandLine = void 0;
7
-
8
7
  var _child_process = _interopRequireDefault(require("child_process"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
9
  /*!
13
10
  * node-minify
14
11
  * Copyright(c) 2011-2022 Rodolphe Stoclin
@@ -41,13 +38,13 @@ const runCommandLine = ({
41
38
  callback
42
39
  });
43
40
  }
44
-
45
41
  return runAsync({
46
42
  data,
47
43
  args,
48
44
  callback
49
45
  });
50
46
  };
47
+
51
48
  /**
52
49
  * Exec command as async.
53
50
  *
@@ -55,10 +52,7 @@ const runCommandLine = ({
55
52
  * @param {Array} args
56
53
  * @param {Function} callback
57
54
  */
58
-
59
-
60
55
  exports.runCommandLine = runCommandLine;
61
-
62
56
  const runAsync = ({
63
57
  data,
64
58
  args,
@@ -66,11 +60,9 @@ const runAsync = ({
66
60
  }) => {
67
61
  let stdout = '';
68
62
  let stderr = '';
69
-
70
63
  const child = _child_process.default.spawn('java', args, {
71
64
  stdio: 'pipe'
72
65
  });
73
-
74
66
  child.on('error', console.log.bind(console, 'child'));
75
67
  child.stdin.on('error', console.log.bind(console, 'child.stdin'));
76
68
  child.stdout.on('error', console.log.bind(console, 'child.stdout'));
@@ -79,7 +71,6 @@ const runAsync = ({
79
71
  if (code !== 0) {
80
72
  return callback(new Error(stderr));
81
73
  }
82
-
83
74
  return callback(null, stdout);
84
75
  });
85
76
  child.stdout.on('data', chunk => {
@@ -90,6 +81,7 @@ const runAsync = ({
90
81
  });
91
82
  child.stdin.end(data);
92
83
  };
84
+
93
85
  /**
94
86
  * Exec command as sync.
95
87
  *
@@ -98,8 +90,6 @@ const runAsync = ({
98
90
  * @param {Array} args
99
91
  * @param {Function} callback
100
92
  */
101
-
102
-
103
93
  const runSync = ({
104
94
  settings,
105
95
  data,
@@ -112,20 +102,18 @@ const runSync = ({
112
102
  stdio: 'pipe',
113
103
  maxBuffer: settings.buffer
114
104
  });
115
-
116
105
  const stdout = child.stdout.toString();
117
106
  const stderr = child.stderr.toString();
118
107
  const code = child.status;
119
-
120
108
  if (code !== 0) {
121
109
  return callback(new Error(stderr));
122
110
  }
123
-
124
111
  return callback(null, stdout);
125
112
  } catch (err) {
126
113
  return callback(err);
127
114
  }
128
115
  };
116
+
129
117
  /**
130
118
  * Expose `runCommandLine()`.
131
119
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-minify/run",
3
- "version": "7.0.0",
3
+ "version": "7.1.0",
4
4
  "description": "exec commands for @node-minify",
5
5
  "keywords": [
6
6
  "compressor",
@@ -31,5 +31,5 @@
31
31
  "bugs": {
32
32
  "url": "https://github.com/srod/node-minify/issues"
33
33
  },
34
- "gitHead": "8b5bda6f1ac9fe7180006f2a19ec3253e8fff4ec"
34
+ "gitHead": "94cef2d5d653c3bddc3e603b4e25c135b0b6f4b3"
35
35
  }