@node-minify/babel-minify 8.0.1-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 +4 -8
- package/dist/index.js +3 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* @param {String} content
|
|
14
|
-
* @param {Function} callback
|
|
15
|
-
*/
|
|
16
|
-
declare const minifyBabel: ({ settings, content, callback, index }: MinifierOptions) => any;
|
|
9
|
+
declare const minifyBabel: {
|
|
10
|
+
({ settings, content, callback, index }: MinifierOptions): any;
|
|
11
|
+
default: any;
|
|
12
|
+
};
|
|
17
13
|
|
|
18
14
|
export { minifyBabel 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_babel_core = require("babel-core");
|
|
32
23
|
var import_babel_preset_minify = __toESM(require("babel-preset-minify"));
|
|
33
24
|
var import_utils = require("@node-minify/utils");
|
|
@@ -54,9 +45,8 @@ var minifyBabel = ({ settings, content, callback, index }) => {
|
|
|
54
45
|
}
|
|
55
46
|
return contentMinified.code;
|
|
56
47
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
0 && (module.exports = {});
|
|
48
|
+
minifyBabel.default = minifyBabel;
|
|
49
|
+
module.exports = minifyBabel;
|
|
60
50
|
/*!
|
|
61
51
|
* node-minify
|
|
62
52
|
* Copyright(c) 2011-2022 Rodolphe Stoclin
|
package/dist/index.js.map
CHANGED
|
@@ -1 +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 { transform } from 'babel-core';\nimport minify from 'babel-preset-minify';\nimport { utils } from '@node-minify/utils';\nimport { MinifierOptions } from '@node-minify/types';\n\
|
|
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 { transform } from 'babel-core';\nimport minify from 'babel-preset-minify';\nimport { utils } from '@node-minify/utils';\nimport { MinifierOptions } from '@node-minify/types';\n\ninterface BabelOptions {\n presets: string[];\n}\n\n/**\n * Run babel-minify.\n *\n * @param {Object} settings\n * @param {String} content\n * @param {Function} callback\n */\nconst minifyBabel = ({ settings, content, callback, index }: MinifierOptions) => {\n let babelOptions: BabelOptions = {\n presets: []\n };\n\n if (settings && settings.options && settings.options.babelrc) {\n babelOptions = JSON.parse(utils.readFile(settings.options.babelrc));\n }\n\n if (settings && settings.options && settings.options.presets) {\n const babelrcPresets = babelOptions.presets || [];\n babelOptions.presets = babelrcPresets.concat(settings.options.presets);\n }\n\n if (babelOptions.presets.indexOf('minify') === -1) {\n babelOptions.presets = babelOptions.presets.concat([minify]);\n }\n\n const contentMinified = transform(content || '', babelOptions);\n if (settings && !settings.content) {\n utils.writeFile({ file: settings.output, content: contentMinified.code, index });\n }\n if (callback) {\n return callback(null, contentMinified.code);\n }\n return contentMinified.code;\n};\n\n/**\n * Expose `minifyBabel()`.\n */\nminifyBabel.default = minifyBabel;\nexport = minifyBabel;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AASA,wBAA0B;AAC1B,iCAAmB;AACnB,mBAAsB;AActB,IAAM,cAAc,CAAC,EAAE,UAAU,SAAS,UAAU,MAAM,MAAuB;AAC/E,MAAI,eAA6B;AAAA,IAC/B,SAAS,CAAC;AAAA,EACZ;AAEA,MAAI,YAAY,SAAS,WAAW,SAAS,QAAQ,SAAS;AAC5D,mBAAe,KAAK,MAAM,mBAAM,SAAS,SAAS,QAAQ,OAAO,CAAC;AAAA,EACpE;AAEA,MAAI,YAAY,SAAS,WAAW,SAAS,QAAQ,SAAS;AAC5D,UAAM,iBAAiB,aAAa,WAAW,CAAC;AAChD,iBAAa,UAAU,eAAe,OAAO,SAAS,QAAQ,OAAO;AAAA,EACvE;AAEA,MAAI,aAAa,QAAQ,QAAQ,QAAQ,MAAM,IAAI;AACjD,iBAAa,UAAU,aAAa,QAAQ,OAAO,CAAC,2BAAAA,OAAM,CAAC;AAAA,EAC7D;AAEA,QAAM,sBAAkB,6BAAU,WAAW,IAAI,YAAY;AAC7D,MAAI,YAAY,CAAC,SAAS,SAAS;AACjC,uBAAM,UAAU,EAAE,MAAM,SAAS,QAAQ,SAAS,gBAAgB,MAAM,MAAM,CAAC;AAAA,EACjF;AACA,MAAI,UAAU;AACZ,WAAO,SAAS,MAAM,gBAAgB,IAAI;AAAA,EAC5C;AACA,SAAO,gBAAgB;AACzB;AAKA,YAAY,UAAU;AACtB,iBAAS;","names":["minify"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,34 +1,42 @@
|
|
|
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 { transform } from "babel-core";
|
|
3
8
|
import minify from "babel-preset-minify";
|
|
4
9
|
import { utils } from "@node-minify/utils";
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
var require_src = __commonJS({
|
|
11
|
+
"src/index.ts"(exports, module) {
|
|
12
|
+
var minifyBabel = ({ settings, content, callback, index }) => {
|
|
13
|
+
let babelOptions = {
|
|
14
|
+
presets: []
|
|
15
|
+
};
|
|
16
|
+
if (settings && settings.options && settings.options.babelrc) {
|
|
17
|
+
babelOptions = JSON.parse(utils.readFile(settings.options.babelrc));
|
|
18
|
+
}
|
|
19
|
+
if (settings && settings.options && settings.options.presets) {
|
|
20
|
+
const babelrcPresets = babelOptions.presets || [];
|
|
21
|
+
babelOptions.presets = babelrcPresets.concat(settings.options.presets);
|
|
22
|
+
}
|
|
23
|
+
if (babelOptions.presets.indexOf("minify") === -1) {
|
|
24
|
+
babelOptions.presets = babelOptions.presets.concat([minify]);
|
|
25
|
+
}
|
|
26
|
+
const contentMinified = transform(content || "", babelOptions);
|
|
27
|
+
if (settings && !settings.content) {
|
|
28
|
+
utils.writeFile({ file: settings.output, content: contentMinified.code, index });
|
|
29
|
+
}
|
|
30
|
+
if (callback) {
|
|
31
|
+
return callback(null, contentMinified.code);
|
|
32
|
+
}
|
|
33
|
+
return contentMinified.code;
|
|
34
|
+
};
|
|
35
|
+
minifyBabel.default = minifyBabel;
|
|
36
|
+
module.exports = minifyBabel;
|
|
22
37
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
return contentMinified.code;
|
|
27
|
-
};
|
|
28
|
-
var src_default = minifyBabel;
|
|
29
|
-
export {
|
|
30
|
-
src_default as default
|
|
31
|
-
};
|
|
38
|
+
});
|
|
39
|
+
export default require_src();
|
|
32
40
|
/*!
|
|
33
41
|
* node-minify
|
|
34
42
|
* Copyright(c) 2011-2022 Rodolphe Stoclin
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +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 { transform } from 'babel-core';\nimport minify from 'babel-preset-minify';\nimport { utils } from '@node-minify/utils';\nimport { MinifierOptions } from '@node-minify/types';\n\
|
|
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 { transform } from 'babel-core';\nimport minify from 'babel-preset-minify';\nimport { utils } from '@node-minify/utils';\nimport { MinifierOptions } from '@node-minify/types';\n\ninterface BabelOptions {\n presets: string[];\n}\n\n/**\n * Run babel-minify.\n *\n * @param {Object} settings\n * @param {String} content\n * @param {Function} callback\n */\nconst minifyBabel = ({ settings, content, callback, index }: MinifierOptions) => {\n let babelOptions: BabelOptions = {\n presets: []\n };\n\n if (settings && settings.options && settings.options.babelrc) {\n babelOptions = JSON.parse(utils.readFile(settings.options.babelrc));\n }\n\n if (settings && settings.options && settings.options.presets) {\n const babelrcPresets = babelOptions.presets || [];\n babelOptions.presets = babelrcPresets.concat(settings.options.presets);\n }\n\n if (babelOptions.presets.indexOf('minify') === -1) {\n babelOptions.presets = babelOptions.presets.concat([minify]);\n }\n\n const contentMinified = transform(content || '', babelOptions);\n if (settings && !settings.content) {\n utils.writeFile({ file: settings.output, content: contentMinified.code, index });\n }\n if (callback) {\n return callback(null, contentMinified.code);\n }\n return contentMinified.code;\n};\n\n/**\n * Expose `minifyBabel()`.\n */\nminifyBabel.default = minifyBabel;\nexport = minifyBabel;\n"],"mappings":";;;;;;AASA,SAAS,iBAAiB;AAC1B,OAAO,YAAY;AACnB,SAAS,aAAa;AAXtB;AAAA;AAyBA,QAAM,cAAc,CAAC,EAAE,UAAU,SAAS,UAAU,MAAM,MAAuB;AAC/E,UAAI,eAA6B;AAAA,QAC/B,SAAS,CAAC;AAAA,MACZ;AAEA,UAAI,YAAY,SAAS,WAAW,SAAS,QAAQ,SAAS;AAC5D,uBAAe,KAAK,MAAM,MAAM,SAAS,SAAS,QAAQ,OAAO,CAAC;AAAA,MACpE;AAEA,UAAI,YAAY,SAAS,WAAW,SAAS,QAAQ,SAAS;AAC5D,cAAM,iBAAiB,aAAa,WAAW,CAAC;AAChD,qBAAa,UAAU,eAAe,OAAO,SAAS,QAAQ,OAAO;AAAA,MACvE;AAEA,UAAI,aAAa,QAAQ,QAAQ,QAAQ,MAAM,IAAI;AACjD,qBAAa,UAAU,aAAa,QAAQ,OAAO,CAAC,MAAM,CAAC;AAAA,MAC7D;AAEA,YAAM,kBAAkB,UAAU,WAAW,IAAI,YAAY;AAC7D,UAAI,YAAY,CAAC,SAAS,SAAS;AACjC,cAAM,UAAU,EAAE,MAAM,SAAS,QAAQ,SAAS,gBAAgB,MAAM,MAAM,CAAC;AAAA,MACjF;AACA,UAAI,UAAU;AACZ,eAAO,SAAS,MAAM,gBAAgB,IAAI;AAAA,MAC5C;AACA,aAAO,gBAAgB;AAAA,IACzB;AAKA,gBAAY,UAAU;AACtB,qBAAS;AAAA;AAAA;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-minify/babel-minify",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.2-beta.0",
|
|
4
4
|
"description": "babel-minify plugin for @node-minify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compressor",
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"prepublishOnly": "npm run build"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@node-minify/utils": "8.0.
|
|
48
|
+
"@node-minify/utils": "8.0.2-beta.0",
|
|
49
49
|
"babel-core": "6.26.3",
|
|
50
50
|
"babel-preset-minify": "0.5.2"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@node-minify/types": "8.0.
|
|
53
|
+
"@node-minify/types": "8.0.2-beta.0",
|
|
54
54
|
"@types/babel-core": "^6.25.7",
|
|
55
55
|
"babel-preset-env": "1.7.0"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "bd2fe186257749fcb9bf7a9ff1ce61fb922c4ade"
|
|
58
58
|
}
|