@node-minify/babel-minify 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.
- package/lib/babel-minify.js +1 -13
- package/package.json +3 -3
package/lib/babel-minify.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _babelCore = require("babel-core");
|
|
4
|
-
|
|
5
4
|
var _babelPresetMinify = _interopRequireDefault(require("babel-preset-minify"));
|
|
6
|
-
|
|
7
5
|
var _utils = require("@node-minify/utils");
|
|
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
|
|
@@ -34,22 +30,17 @@ const minifyBabel = ({
|
|
|
34
30
|
let babelOptions = {
|
|
35
31
|
presets: []
|
|
36
32
|
};
|
|
37
|
-
|
|
38
33
|
if (settings.options.babelrc) {
|
|
39
34
|
babelOptions = JSON.parse(_utils.utils.readFile(settings.options.babelrc));
|
|
40
35
|
}
|
|
41
|
-
|
|
42
36
|
if (settings.options.presets) {
|
|
43
37
|
const babelrcPresets = babelOptions.presets || [];
|
|
44
38
|
babelOptions.presets = babelrcPresets.concat(settings.options.presets);
|
|
45
39
|
}
|
|
46
|
-
|
|
47
40
|
if (babelOptions.presets.indexOf('minify') === -1) {
|
|
48
41
|
babelOptions.presets = babelOptions.presets.concat([_babelPresetMinify.default]);
|
|
49
42
|
}
|
|
50
|
-
|
|
51
43
|
const contentMinified = (0, _babelCore.transform)(content, babelOptions);
|
|
52
|
-
|
|
53
44
|
if (!settings.content) {
|
|
54
45
|
_utils.utils.writeFile({
|
|
55
46
|
file: settings.output,
|
|
@@ -57,16 +48,13 @@ const minifyBabel = ({
|
|
|
57
48
|
index
|
|
58
49
|
});
|
|
59
50
|
}
|
|
60
|
-
|
|
61
51
|
if (callback) {
|
|
62
52
|
return callback(null, contentMinified.code);
|
|
63
53
|
}
|
|
64
|
-
|
|
65
54
|
return contentMinified.code;
|
|
66
55
|
};
|
|
56
|
+
|
|
67
57
|
/**
|
|
68
58
|
* Expose `minifyBabel()`.
|
|
69
59
|
*/
|
|
70
|
-
|
|
71
|
-
|
|
72
60
|
module.exports = minifyBabel;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-minify/babel-minify",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "babel-minify plugin for @node-minify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compressor",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"url": "https://github.com/srod/node-minify/issues"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@node-minify/utils": "^7.
|
|
36
|
+
"@node-minify/utils": "^7.1.0",
|
|
37
37
|
"babel-core": "6.26.3",
|
|
38
38
|
"babel-preset-minify": "0.5.2"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "94cef2d5d653c3bddc3e603b4e25c135b0b6f4b3"
|
|
41
41
|
}
|