balm-core 3.26.3 → 3.28.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/balm.js +0 -22
- package/lib/bootstrap/check_config.js +4 -10
- package/lib/bootstrap/index.js +17 -28
- package/lib/bundler/esbuild/build.js +0 -4
- package/lib/bundler/esbuild/index.js +0 -5
- package/lib/bundler/esbuild/transform.js +0 -33
- package/lib/bundler/rollup/build.js +2 -17
- package/lib/bundler/rollup/entry.js +2 -6
- package/lib/bundler/rollup/index.js +0 -32
- package/lib/bundler/rollup/output.js +0 -6
- package/lib/bundler/rollup/plugins.js +0 -11
- package/lib/bundler/webpack/config/common.js +3 -26
- package/lib/bundler/webpack/config/dev.js +2 -6
- package/lib/bundler/webpack/config/index.js +0 -5
- package/lib/bundler/webpack/config/prod.js +2 -17
- package/lib/bundler/webpack/entry.js +12 -23
- package/lib/bundler/webpack/index.js +5 -14
- package/lib/bundler/webpack/loaders.js +0 -10
- package/lib/bundler/webpack/output.js +0 -7
- package/lib/bundler/webpack/rules/babel.js +3 -7
- package/lib/bundler/webpack/rules/css.js +2 -7
- package/lib/bundler/webpack/rules/html.js +0 -3
- package/lib/bundler/webpack/rules/url.js +2 -6
- package/lib/config/assets.js +0 -5
- package/lib/config/env.js +0 -2
- package/lib/config/globals.js +3 -10
- package/lib/config/html.js +0 -1
- package/lib/config/index.js +0 -21
- package/lib/config/logs.js +0 -1
- package/lib/config/paths.js +2 -3
- package/lib/config/pwa.js +0 -3
- package/lib/config/roots.js +0 -3
- package/lib/config/scripts.js +24 -32
- package/lib/config/server.js +4 -11
- package/lib/config/styles.js +2 -10
- package/lib/config/version.js +0 -3
- package/lib/hello.js +0 -5
- package/lib/hooks/index.js +20 -27
- package/lib/hooks/maker.js +2 -22
- package/lib/index.js +0 -5
- package/lib/middlewares/history.js +0 -3
- package/lib/middlewares/index.js +0 -9
- package/lib/middlewares/proxy.js +1 -9
- package/lib/middlewares/webpack.js +0 -6
- package/lib/plugins/htmlmin.js +1 -7
- package/lib/plugins/imagemin.js +1 -29
- package/lib/plugins/index.js +0 -12
- package/lib/plugins/jsmin.js +0 -20
- package/lib/plugins/less.js +7 -19
- package/lib/plugins/plumber.js +5 -24
- package/lib/plugins/postcss-plugins.js +0 -9
- package/lib/plugins/postcss.js +9 -27
- package/lib/plugins/rename.js +3 -16
- package/lib/plugins/replace.js +4 -26
- package/lib/plugins/sass.js +31 -45
- package/lib/plugins/sftp.js +36 -69
- package/lib/tasks/default.js +2 -23
- package/lib/tasks/foundation/balm.js +0 -19
- package/lib/tasks/foundation/balm_style.js +2 -27
- package/lib/tasks/foundation/index.js +0 -5
- package/lib/tasks/index.js +7 -16
- package/lib/tasks/private/build.js +0 -17
- package/lib/tasks/private/cache.js +0 -19
- package/lib/tasks/private/clean.js +0 -33
- package/lib/tasks/private/end.js +0 -23
- package/lib/tasks/private/extra.js +4 -29
- package/lib/tasks/private/font.js +0 -17
- package/lib/tasks/private/image.js +1 -28
- package/lib/tasks/private/lint.js +0 -17
- package/lib/tasks/private/media.js +0 -17
- package/lib/tasks/private/modernizr.js +0 -39
- package/lib/tasks/private/pwa-cache.js +0 -21
- package/lib/tasks/private/script.js +0 -13
- package/lib/tasks/private/sprite.js +3 -37
- package/lib/tasks/private/start.js +0 -23
- package/lib/tasks/private/style.js +0 -14
- package/lib/tasks/private/workbox-sw.js +0 -17
- package/lib/tasks/public/copy.js +0 -17
- package/lib/tasks/public/esbuild.js +0 -19
- package/lib/tasks/public/ftp.js +1 -22
- package/lib/tasks/public/html.js +0 -31
- package/lib/tasks/public/jsmin.js +0 -17
- package/lib/tasks/public/less.js +0 -17
- package/lib/tasks/public/postcss.js +0 -16
- package/lib/tasks/public/publish.js +3 -29
- package/lib/tasks/public/pwa.js +1 -30
- package/lib/tasks/public/remove.js +2 -34
- package/lib/tasks/public/replace.js +0 -18
- package/lib/tasks/public/rollup.js +0 -20
- package/lib/tasks/public/sass.js +0 -17
- package/lib/tasks/public/server.js +5 -44
- package/lib/tasks/public/url.js +0 -24
- package/lib/tasks/public/version.js +0 -17
- package/lib/tasks/public/webpack.js +2 -27
- package/lib/tasks/public/zip.js +0 -18
- package/lib/utilities/address.js +5 -21
- package/lib/utilities/cache-core.js +5 -21
- package/lib/utilities/color.js +0 -8
- package/lib/utilities/compiling.js +0 -15
- package/lib/utilities/detect-port.js +6 -26
- package/lib/utilities/escape-string-regexp.js +3 -5
- package/lib/utilities/file.js +3 -23
- package/lib/utilities/index.js +0 -5
- package/lib/utilities/loading.js +0 -23
- package/lib/utilities/logger.js +0 -21
- package/lib/utilities/merge-stream.js +0 -11
- package/lib/utilities/namespace.js +0 -4
- package/lib/utilities/public-url.js +9 -12
- package/lib/utilities/replacestream.js +5 -31
- package/lib/utilities/typeof.js +0 -2
- package/lib/utilities/utils.js +2 -12
- package/package.json +12 -12
- package/tslib/bundler/esbuild/transform.js +26 -19
- package/tslib/bundler/rollup/index.js +12 -5
package/lib/balm.js
CHANGED
|
@@ -1,54 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
10
|
var _classPrivateFieldGet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldGet"));
|
|
15
|
-
|
|
16
11
|
var _classPrivateFieldSet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldSet"));
|
|
17
|
-
|
|
18
12
|
require("./config");
|
|
19
|
-
|
|
20
13
|
require("./utilities");
|
|
21
|
-
|
|
22
14
|
require("./plugins");
|
|
23
|
-
|
|
24
15
|
var _tasks = _interopRequireDefault(require("./tasks"));
|
|
25
|
-
|
|
26
16
|
var _bootstrap = require("./bootstrap");
|
|
27
|
-
|
|
28
17
|
var _loading = _interopRequireDefault(require("./utilities/loading"));
|
|
29
|
-
|
|
30
18
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
31
|
-
|
|
32
19
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
33
|
-
|
|
34
20
|
var _config = /*#__PURE__*/new WeakMap();
|
|
35
|
-
|
|
36
21
|
var Balm = /*#__PURE__*/function () {
|
|
37
22
|
function Balm() {
|
|
38
23
|
(0, _classCallCheck2["default"])(this, Balm);
|
|
39
|
-
|
|
40
24
|
_classPrivateFieldInitSpec(this, _config, {
|
|
41
25
|
writable: true,
|
|
42
26
|
value: void 0
|
|
43
27
|
});
|
|
44
|
-
|
|
45
28
|
BalmJS.loading = false;
|
|
46
|
-
|
|
47
29
|
_loading["default"].succeed();
|
|
48
|
-
|
|
49
30
|
(0, _classPrivateFieldSet2["default"])(this, _config, BalmJS.config);
|
|
50
31
|
}
|
|
51
|
-
|
|
52
32
|
(0, _createClass2["default"])(Balm, [{
|
|
53
33
|
key: "config",
|
|
54
34
|
get: function get() {
|
|
@@ -72,7 +52,6 @@ var Balm = /*#__PURE__*/function () {
|
|
|
72
52
|
key: "go",
|
|
73
53
|
value: function go() {
|
|
74
54
|
var recipe = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : NOOP;
|
|
75
|
-
|
|
76
55
|
if (BalmJS.utils.isFunction(recipe)) {
|
|
77
56
|
(0, _tasks["default"])(recipe);
|
|
78
57
|
} else {
|
|
@@ -92,6 +71,5 @@ var Balm = /*#__PURE__*/function () {
|
|
|
92
71
|
}]);
|
|
93
72
|
return Balm;
|
|
94
73
|
}();
|
|
95
|
-
|
|
96
74
|
var _default = Balm;
|
|
97
75
|
exports["default"] = _default;
|
|
@@ -4,47 +4,41 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _constants = require("../config/constants");
|
|
9
|
-
|
|
10
8
|
var docsBaseURL = "".concat(_constants.DOMAIN, "/docs/config");
|
|
11
|
-
|
|
12
9
|
function upgradeGuide(key, value, message) {
|
|
13
10
|
var page = key === 'scripts' ? 'scripts-webpack' : key.toLowerCase();
|
|
14
11
|
return "".concat(message, " See ").concat(docsBaseURL, "/").concat(page, ".html#").concat(key, "-").concat(value.toLowerCase());
|
|
15
12
|
}
|
|
16
|
-
|
|
17
13
|
function upgradeRenamed(version, configCategory, from, to) {
|
|
18
14
|
if (BalmJS.config[configCategory][from]) {
|
|
19
15
|
BalmJS.logger.warn("balm@".concat(version, "+ config"), upgradeGuide(configCategory, to, "'".concat(configCategory, ".").concat(from, "' was renamed to '").concat(configCategory, ".").concat(to, "'.")));
|
|
20
16
|
}
|
|
21
17
|
}
|
|
22
|
-
|
|
23
18
|
function upgradeMigrated(version, configName, from, to) {
|
|
24
19
|
if (BalmJS.config[from][configName]) {
|
|
25
20
|
BalmJS.logger.warn("balm@".concat(version, "+ config"), upgradeGuide(to, configName, "'".concat(from, ".").concat(configName, "' was migrated to '").concat(to, ".").concat(configName, "'.")));
|
|
26
21
|
}
|
|
27
22
|
}
|
|
28
|
-
|
|
29
23
|
function upgradeDeprecated(version, configCategory, configName) {
|
|
30
24
|
if (BalmJS.config[configCategory][configName]) {
|
|
31
25
|
BalmJS.logger.warn("balm@".concat(version, "+ config"), "'".concat(configCategory, ".").concat(configName, "' was deprecated."));
|
|
32
26
|
}
|
|
33
|
-
}
|
|
34
|
-
|
|
27
|
+
}
|
|
35
28
|
|
|
29
|
+
// Compatibility for upgrade balm
|
|
36
30
|
function checkConfig() {
|
|
37
31
|
// For v2
|
|
38
32
|
upgradeRenamed('2.5.0', 'scripts', 'disableDefaultLoaders', 'defaultLoaders');
|
|
39
33
|
upgradeMigrated('2.11.0', 'postcssLoaderOptions', 'styles', 'scripts');
|
|
40
|
-
upgradeRenamed('2.22.0', 'images', 'defaultPlugins', 'plugins');
|
|
34
|
+
upgradeRenamed('2.22.0', 'images', 'defaultPlugins', 'plugins');
|
|
41
35
|
|
|
36
|
+
// For v3
|
|
42
37
|
upgradeRenamed('3.0.0', 'styles', 'minified', 'minify');
|
|
43
38
|
upgradeRenamed('3.9.0', 'scripts', 'options', 'minifyOptions');
|
|
44
39
|
upgradeRenamed('3.16.0', 'scripts', 'inject', 'useCache');
|
|
45
40
|
upgradeDeprecated('3.17.0', 'styles', 'darkSass');
|
|
46
41
|
upgradeDeprecated('3.19.0', 'scripts', 'useCache');
|
|
47
42
|
}
|
|
48
|
-
|
|
49
43
|
var _default = checkConfig;
|
|
50
44
|
exports["default"] = _default;
|
package/lib/bootstrap/index.js
CHANGED
|
@@ -1,106 +1,96 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.setConfig = setConfig;
|
|
9
8
|
exports.setTask = setTask;
|
|
10
|
-
|
|
11
9
|
var _check_config = _interopRequireDefault(require("./check_config"));
|
|
12
|
-
|
|
13
10
|
var _constants = require("../config/constants");
|
|
14
|
-
|
|
15
11
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
16
|
-
|
|
17
12
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
|
-
|
|
19
13
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
20
|
-
|
|
21
14
|
function createQuickPath(config, rootKey) {
|
|
22
15
|
var result = {};
|
|
23
16
|
var rootValue = config.roots[rootKey];
|
|
24
|
-
|
|
25
17
|
for (var _i = 0, _Object$keys = Object.keys(config.paths[rootKey]); _i < _Object$keys.length; _i++) {
|
|
26
18
|
var pathKey = _Object$keys[_i];
|
|
27
19
|
var pathValue = config.paths[rootKey][pathKey];
|
|
28
20
|
result[pathKey] = rootKey === 'target' && _constants.ASSETS_KEYS.includes(pathKey) ? path.join(rootValue, BalmJS.config.assets.virtualDir, BalmJS.file.assetsSuffixPath, pathValue) : path.join(rootValue, pathValue);
|
|
29
21
|
}
|
|
30
|
-
|
|
31
22
|
return rootKey === 'source' ? result : result;
|
|
32
23
|
}
|
|
33
|
-
|
|
34
24
|
function ready(config) {
|
|
35
25
|
// Create local quick directories
|
|
36
26
|
config.src = createQuickPath(config, 'source');
|
|
37
27
|
config.dest = createQuickPath(config, config.env.isProd || !config.inFrontend ? 'target' : 'tmp');
|
|
38
|
-
config.dest["static"] = path.join(config.dest.base, BalmJS.config.assets.virtualDir, BalmJS.file.assetsSuffixPath);
|
|
28
|
+
config.dest["static"] = path.join(config.dest.base, BalmJS.config.assets.virtualDir, BalmJS.file.assetsSuffixPath);
|
|
39
29
|
|
|
30
|
+
// Create remote quick directories
|
|
40
31
|
config.assets["static"] = path.join(config.assets.root, config.assets.mainDir, BalmJS.file.assetsSuffixPath);
|
|
41
|
-
|
|
42
32
|
var _iterator = _createForOfIteratorHelper(_constants.ASSETS_KEYS),
|
|
43
|
-
|
|
44
|
-
|
|
33
|
+
_step;
|
|
45
34
|
try {
|
|
46
35
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
47
36
|
var assetKey = _step.value;
|
|
48
37
|
config.assets[assetKey] = path.join(config.assets["static"], config.paths.target[assetKey]);
|
|
49
|
-
}
|
|
38
|
+
}
|
|
50
39
|
|
|
40
|
+
// Set HMR flag
|
|
51
41
|
} catch (err) {
|
|
52
42
|
_iterator.e(err);
|
|
53
43
|
} finally {
|
|
54
44
|
_iterator.f();
|
|
55
45
|
}
|
|
56
|
-
|
|
57
46
|
var HMR_ENV = config.useDefaults && config.env.isDev && !config.env.inSSR && !config.env.isMP;
|
|
58
47
|
var HMR_Enabling = config.scripts.bundler === BalmJS.Bundler.webpack && !config.scripts.ie8;
|
|
59
|
-
config.server.useHMR = HMR_ENV && HMR_Enabling;
|
|
48
|
+
config.server.useHMR = HMR_ENV && HMR_Enabling;
|
|
60
49
|
|
|
61
|
-
|
|
50
|
+
// Set desktop app flag
|
|
51
|
+
config.inDesktopApp = /^electron-.*/.test(config.scripts.target);
|
|
62
52
|
|
|
53
|
+
// Set use cache for webpack
|
|
63
54
|
config.scripts.useCache = config.env.isProd && config.assets.cache && config.scripts.injectHtml;
|
|
64
55
|
return config;
|
|
65
56
|
}
|
|
66
|
-
|
|
67
57
|
function resetConfig() {
|
|
68
58
|
BalmJS.config.roots.target = 'dist';
|
|
69
59
|
BalmJS.config.roots.tmp = '.tmp';
|
|
70
60
|
return BalmJS.config;
|
|
71
61
|
}
|
|
72
|
-
|
|
73
62
|
function setConfig(customConfig) {
|
|
74
|
-
var defaultConfig = resetConfig();
|
|
63
|
+
var defaultConfig = resetConfig();
|
|
75
64
|
|
|
65
|
+
// 1. Overwrite config
|
|
76
66
|
var newConfig = BalmJS.utils.deepMerge(defaultConfig, customConfig);
|
|
77
|
-
(0, _check_config["default"])();
|
|
67
|
+
(0, _check_config["default"])();
|
|
78
68
|
|
|
69
|
+
// 2. Copy `config.paths.target` to `config.paths.tmp`
|
|
79
70
|
var config = BalmJS.utils.deepMerge(newConfig, {
|
|
80
71
|
paths: {
|
|
81
72
|
tmp: newConfig.paths.target
|
|
82
73
|
}
|
|
83
|
-
});
|
|
74
|
+
});
|
|
84
75
|
|
|
76
|
+
// 3. For the dynamic project
|
|
85
77
|
if (!config.inFrontend) {
|
|
86
78
|
if (config.roots.target === 'dist') {
|
|
87
79
|
config.roots.target = config.assets.mainDir; // NOTE: `BalmJS.config.roots.target = 'public'` for back-end project
|
|
88
80
|
}
|
|
89
81
|
|
|
90
82
|
config.roots.tmp = config.roots.target;
|
|
91
|
-
}
|
|
92
|
-
|
|
83
|
+
}
|
|
93
84
|
|
|
85
|
+
// 4. Before created
|
|
94
86
|
config = ready(config);
|
|
95
87
|
BalmJS.logger.success('balm configuration', config, {
|
|
96
88
|
pre: true
|
|
97
89
|
});
|
|
98
90
|
return config;
|
|
99
91
|
}
|
|
100
|
-
|
|
101
92
|
function setTask(name) {
|
|
102
93
|
var result = undefined;
|
|
103
|
-
|
|
104
94
|
if (BalmJS.utils.isFunction(name)) {
|
|
105
95
|
result = name;
|
|
106
96
|
} else if (BalmJS.utils.isString(name)) {
|
|
@@ -112,6 +102,5 @@ function setTask(name) {
|
|
|
112
102
|
} else {
|
|
113
103
|
BalmJS.logger.error('before/end task', 'Task must be a string (gulp task name) or function');
|
|
114
104
|
}
|
|
115
|
-
|
|
116
105
|
return result;
|
|
117
106
|
}
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _options = require("./options");
|
|
9
|
-
|
|
10
8
|
var esBuild = function esBuild(entryPoints, output, customBuildOptions, callback) {
|
|
11
9
|
var defaultBuildOptions = {
|
|
12
10
|
entryPoints: BalmJS.file.absPaths(entryPoints),
|
|
@@ -24,13 +22,11 @@ var esBuild = function esBuild(entryPoints, output, customBuildOptions, callback
|
|
|
24
22
|
BalmJS.logger.success('esbuild options', options, {
|
|
25
23
|
pre: true
|
|
26
24
|
});
|
|
27
|
-
|
|
28
25
|
require('esbuild').build(options)["catch"](function (error) {
|
|
29
26
|
BalmJS.logger.error('esbuild', error.message);
|
|
30
27
|
})["finally"](function () {
|
|
31
28
|
callback();
|
|
32
29
|
});
|
|
33
30
|
};
|
|
34
|
-
|
|
35
31
|
var _default = esBuild;
|
|
36
32
|
exports["default"] = _default;
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _build = _interopRequireDefault(require("./build"));
|
|
11
|
-
|
|
12
9
|
var _transform = _interopRequireDefault(require("./transform"));
|
|
13
|
-
|
|
14
10
|
var esbuild = function esbuild(input, output, customOptions, callback) {
|
|
15
11
|
var entryPoints = BalmJS.utils.isString(input) ? [input] : input;
|
|
16
12
|
BalmJS.config.scripts.useTransform ? (0, _transform["default"])(entryPoints, output, customOptions, callback) : (0, _build["default"])(entryPoints, output, customOptions, callback);
|
|
17
13
|
};
|
|
18
|
-
|
|
19
14
|
var _default = esbuild;
|
|
20
15
|
exports["default"] = _default;
|
|
@@ -1,24 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
10
|
var _fs = _interopRequireDefault(require("fs"));
|
|
15
|
-
|
|
16
11
|
var _options = require("./options");
|
|
17
|
-
|
|
18
12
|
function _asyncIterator(iterable) { var method, async, sync, retry = 2; for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { if (async && null != (method = iterable[async])) return method.call(iterable); if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable)); async = "@@asyncIterator", sync = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
|
|
19
|
-
|
|
20
13
|
function AsyncFromSyncIterator(s) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var done = r.done; return Promise.resolve(r.value).then(function (value) { return { value: value, done: done }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { this.s = s, this.n = s.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, "return": function _return(value) { var ret = this.s["return"]; return void 0 === ret ? Promise.resolve({ value: value, done: !0 }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); }, "throw": function _throw(value) { var thr = this.s["return"]; return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(s); }
|
|
21
|
-
|
|
22
14
|
var esTransform = function esTransform(entryPoints, output, customTransformOptions, callback) {
|
|
23
15
|
var build = {
|
|
24
16
|
output: BalmJS.file.absPath(output)
|
|
@@ -27,7 +19,6 @@ var esTransform = function esTransform(entryPoints, output, customTransformOptio
|
|
|
27
19
|
var options = Object.assign(transformOptions, BalmJS.config.scripts.transformOptions, customTransformOptions);
|
|
28
20
|
(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
29
21
|
var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, entryPoint, filename, inputCode, result;
|
|
30
|
-
|
|
31
22
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
32
23
|
while (1) {
|
|
33
24
|
switch (_context.prev = _context.next) {
|
|
@@ -37,17 +28,14 @@ var esTransform = function esTransform(entryPoints, output, customTransformOptio
|
|
|
37
28
|
_didIteratorError = false;
|
|
38
29
|
_context.prev = 3;
|
|
39
30
|
_iterator = _asyncIterator(entryPoints);
|
|
40
|
-
|
|
41
31
|
case 5:
|
|
42
32
|
_context.next = 7;
|
|
43
33
|
return _iterator.next();
|
|
44
|
-
|
|
45
34
|
case 7:
|
|
46
35
|
if (!(_iteratorAbruptCompletion = !(_step = _context.sent).done)) {
|
|
47
36
|
_context.next = 25;
|
|
48
37
|
break;
|
|
49
38
|
}
|
|
50
|
-
|
|
51
39
|
entryPoint = _step.value;
|
|
52
40
|
build.input = BalmJS.file.absPath(entryPoint);
|
|
53
41
|
BalmJS.logger.debug('esbuild bundler - transform', {
|
|
@@ -57,79 +45,59 @@ var esTransform = function esTransform(entryPoints, output, customTransformOptio
|
|
|
57
45
|
pre: true
|
|
58
46
|
});
|
|
59
47
|
filename = entryPoint.split('/').pop();
|
|
60
|
-
|
|
61
48
|
if (!(filename && _fs["default"].existsSync(build.input))) {
|
|
62
49
|
_context.next = 21;
|
|
63
50
|
break;
|
|
64
51
|
}
|
|
65
|
-
|
|
66
52
|
inputCode = _fs["default"].readFileSync(build.input, 'utf8');
|
|
67
53
|
_context.next = 16;
|
|
68
54
|
return require('esbuild').transform(inputCode, options);
|
|
69
|
-
|
|
70
55
|
case 16:
|
|
71
56
|
result = _context.sent;
|
|
72
|
-
|
|
73
57
|
_fs["default"].mkdirSync(build.output, {
|
|
74
58
|
recursive: true
|
|
75
59
|
});
|
|
76
|
-
|
|
77
60
|
_fs["default"].writeFileSync(path.join(build.output, filename), result.code);
|
|
78
|
-
|
|
79
61
|
_context.next = 22;
|
|
80
62
|
break;
|
|
81
|
-
|
|
82
63
|
case 21:
|
|
83
64
|
BalmJS.logger.warn('esbuild', "Invalid entry point: ".concat(entryPoint));
|
|
84
|
-
|
|
85
65
|
case 22:
|
|
86
66
|
_iteratorAbruptCompletion = false;
|
|
87
67
|
_context.next = 5;
|
|
88
68
|
break;
|
|
89
|
-
|
|
90
69
|
case 25:
|
|
91
70
|
_context.next = 31;
|
|
92
71
|
break;
|
|
93
|
-
|
|
94
72
|
case 27:
|
|
95
73
|
_context.prev = 27;
|
|
96
74
|
_context.t0 = _context["catch"](3);
|
|
97
75
|
_didIteratorError = true;
|
|
98
76
|
_iteratorError = _context.t0;
|
|
99
|
-
|
|
100
77
|
case 31:
|
|
101
78
|
_context.prev = 31;
|
|
102
79
|
_context.prev = 32;
|
|
103
|
-
|
|
104
80
|
if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
|
|
105
81
|
_context.next = 36;
|
|
106
82
|
break;
|
|
107
83
|
}
|
|
108
|
-
|
|
109
84
|
_context.next = 36;
|
|
110
85
|
return _iterator["return"]();
|
|
111
|
-
|
|
112
86
|
case 36:
|
|
113
87
|
_context.prev = 36;
|
|
114
|
-
|
|
115
88
|
if (!_didIteratorError) {
|
|
116
89
|
_context.next = 39;
|
|
117
90
|
break;
|
|
118
91
|
}
|
|
119
|
-
|
|
120
92
|
throw _iteratorError;
|
|
121
|
-
|
|
122
93
|
case 39:
|
|
123
94
|
return _context.finish(36);
|
|
124
|
-
|
|
125
95
|
case 40:
|
|
126
96
|
return _context.finish(31);
|
|
127
|
-
|
|
128
97
|
case 41:
|
|
129
98
|
_context.prev = 41;
|
|
130
99
|
callback();
|
|
131
100
|
return _context.finish(41);
|
|
132
|
-
|
|
133
101
|
case 44:
|
|
134
102
|
case "end":
|
|
135
103
|
return _context.stop();
|
|
@@ -138,6 +106,5 @@ var esTransform = function esTransform(entryPoints, output, customTransformOptio
|
|
|
138
106
|
}, _callee, null, [[0,, 41, 44], [3, 27, 31, 41], [32,, 36, 40]]);
|
|
139
107
|
}))();
|
|
140
108
|
};
|
|
141
|
-
|
|
142
109
|
var _default = esTransform;
|
|
143
110
|
exports["default"] = _default;
|
|
@@ -1,42 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
10
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
15
|
-
|
|
16
11
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
17
|
-
|
|
18
12
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
19
|
-
|
|
20
13
|
var build = /*#__PURE__*/function () {
|
|
21
14
|
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(bundle, outputOptions) {
|
|
22
15
|
var _yield$bundle$generat, output, _iterator, _step, chunkOrAsset;
|
|
23
|
-
|
|
24
16
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
25
17
|
while (1) {
|
|
26
18
|
switch (_context.prev = _context.next) {
|
|
27
19
|
case 0:
|
|
28
20
|
_context.next = 2;
|
|
29
21
|
return bundle.generate(outputOptions);
|
|
30
|
-
|
|
31
22
|
case 2:
|
|
32
23
|
_yield$bundle$generat = _context.sent;
|
|
33
24
|
output = _yield$bundle$generat.output;
|
|
34
25
|
_iterator = _createForOfIteratorHelper(output);
|
|
35
|
-
|
|
36
26
|
try {
|
|
37
27
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
38
28
|
chunkOrAsset = _step.value;
|
|
39
|
-
|
|
40
29
|
if (chunkOrAsset.type === 'asset') {
|
|
41
30
|
// For assets, this contains
|
|
42
31
|
// {
|
|
@@ -78,20 +67,18 @@ var build = /*#__PURE__*/function () {
|
|
|
78
67
|
pre: true
|
|
79
68
|
});
|
|
80
69
|
}
|
|
81
|
-
}
|
|
70
|
+
}
|
|
82
71
|
|
|
72
|
+
// or write the bundle to disk
|
|
83
73
|
} catch (err) {
|
|
84
74
|
_iterator.e(err);
|
|
85
75
|
} finally {
|
|
86
76
|
_iterator.f();
|
|
87
77
|
}
|
|
88
|
-
|
|
89
78
|
_context.next = 8;
|
|
90
79
|
return bundle.write(outputOptions);
|
|
91
|
-
|
|
92
80
|
case 8:
|
|
93
81
|
return _context.abrupt("return", _context.sent);
|
|
94
|
-
|
|
95
82
|
case 9:
|
|
96
83
|
case "end":
|
|
97
84
|
return _context.stop();
|
|
@@ -99,11 +86,9 @@ var build = /*#__PURE__*/function () {
|
|
|
99
86
|
}
|
|
100
87
|
}, _callee);
|
|
101
88
|
}));
|
|
102
|
-
|
|
103
89
|
return function build(_x, _x2) {
|
|
104
90
|
return _ref.apply(this, arguments);
|
|
105
91
|
};
|
|
106
92
|
}();
|
|
107
|
-
|
|
108
93
|
var _default = build;
|
|
109
94
|
exports["default"] = _default;
|
|
@@ -4,18 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _plugins = require("./plugins");
|
|
9
|
-
|
|
10
8
|
function getEntry(inputOptions) {
|
|
11
9
|
// Set plugins
|
|
12
10
|
var inputPlugins = (0, _plugins.getInputPlugins)(inputOptions);
|
|
13
11
|
var options = Object.assign({}, BalmJS.config.scripts.inputOptions, inputOptions);
|
|
14
|
-
options.plugins = inputPlugins;
|
|
12
|
+
options.plugins = inputPlugins;
|
|
15
13
|
|
|
14
|
+
// Set entry points
|
|
16
15
|
var input = options.input;
|
|
17
16
|
var rollupEntries = input;
|
|
18
|
-
|
|
19
17
|
if (BalmJS.utils.isObject(input)) {
|
|
20
18
|
var entries = input;
|
|
21
19
|
Object.keys(entries).forEach(function (entryAlias) {
|
|
@@ -25,13 +23,11 @@ function getEntry(inputOptions) {
|
|
|
25
23
|
} else {
|
|
26
24
|
rollupEntries = BalmJS.file.absPaths(input);
|
|
27
25
|
}
|
|
28
|
-
|
|
29
26
|
options.input = rollupEntries;
|
|
30
27
|
BalmJS.logger.debug('rollup input options', options, {
|
|
31
28
|
pre: true
|
|
32
29
|
});
|
|
33
30
|
return options;
|
|
34
31
|
}
|
|
35
|
-
|
|
36
32
|
var _default = getEntry;
|
|
37
33
|
exports["default"] = _default;
|
|
@@ -1,30 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
10
|
var _entry = _interopRequireDefault(require("./entry"));
|
|
15
|
-
|
|
16
11
|
var _output = _interopRequireDefault(require("./output"));
|
|
17
|
-
|
|
18
12
|
var _build = _interopRequireDefault(require("./build"));
|
|
19
|
-
|
|
20
13
|
function _asyncIterator(iterable) { var method, async, sync, retry = 2; for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { if (async && null != (method = iterable[async])) return method.call(iterable); if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable)); async = "@@asyncIterator", sync = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
|
|
21
|
-
|
|
22
14
|
function AsyncFromSyncIterator(s) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var done = r.done; return Promise.resolve(r.value).then(function (value) { return { value: value, done: done }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { this.s = s, this.n = s.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, "return": function _return(value) { var ret = this.s["return"]; return void 0 === ret ? Promise.resolve({ value: value, done: !0 }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); }, "throw": function _throw(value) { var thr = this.s["return"]; return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(s); }
|
|
23
|
-
|
|
24
15
|
var buildLibrary = /*#__PURE__*/function () {
|
|
25
16
|
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(inputOptions, outputOptions) {
|
|
26
17
|
var rollup, rollupOptions, bundle, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, outputOption;
|
|
27
|
-
|
|
28
18
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
29
19
|
while (1) {
|
|
30
20
|
switch (_context.prev = _context.next) {
|
|
@@ -37,85 +27,65 @@ var buildLibrary = /*#__PURE__*/function () {
|
|
|
37
27
|
});
|
|
38
28
|
_context.next = 6;
|
|
39
29
|
return rollup.rollup(rollupOptions);
|
|
40
|
-
|
|
41
30
|
case 6:
|
|
42
31
|
bundle = _context.sent;
|
|
43
|
-
|
|
44
32
|
if (!Array.isArray(outputOptions)) {
|
|
45
33
|
_context.next = 39;
|
|
46
34
|
break;
|
|
47
35
|
}
|
|
48
|
-
|
|
49
36
|
_iteratorAbruptCompletion = false;
|
|
50
37
|
_didIteratorError = false;
|
|
51
38
|
_context.prev = 10;
|
|
52
39
|
_iterator = _asyncIterator(outputOptions);
|
|
53
|
-
|
|
54
40
|
case 12:
|
|
55
41
|
_context.next = 14;
|
|
56
42
|
return _iterator.next();
|
|
57
|
-
|
|
58
43
|
case 14:
|
|
59
44
|
if (!(_iteratorAbruptCompletion = !(_step = _context.sent).done)) {
|
|
60
45
|
_context.next = 21;
|
|
61
46
|
break;
|
|
62
47
|
}
|
|
63
|
-
|
|
64
48
|
outputOption = _step.value;
|
|
65
49
|
_context.next = 18;
|
|
66
50
|
return (0, _build["default"])(bundle, outputOption);
|
|
67
|
-
|
|
68
51
|
case 18:
|
|
69
52
|
_iteratorAbruptCompletion = false;
|
|
70
53
|
_context.next = 12;
|
|
71
54
|
break;
|
|
72
|
-
|
|
73
55
|
case 21:
|
|
74
56
|
_context.next = 27;
|
|
75
57
|
break;
|
|
76
|
-
|
|
77
58
|
case 23:
|
|
78
59
|
_context.prev = 23;
|
|
79
60
|
_context.t0 = _context["catch"](10);
|
|
80
61
|
_didIteratorError = true;
|
|
81
62
|
_iteratorError = _context.t0;
|
|
82
|
-
|
|
83
63
|
case 27:
|
|
84
64
|
_context.prev = 27;
|
|
85
65
|
_context.prev = 28;
|
|
86
|
-
|
|
87
66
|
if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
|
|
88
67
|
_context.next = 32;
|
|
89
68
|
break;
|
|
90
69
|
}
|
|
91
|
-
|
|
92
70
|
_context.next = 32;
|
|
93
71
|
return _iterator["return"]();
|
|
94
|
-
|
|
95
72
|
case 32:
|
|
96
73
|
_context.prev = 32;
|
|
97
|
-
|
|
98
74
|
if (!_didIteratorError) {
|
|
99
75
|
_context.next = 35;
|
|
100
76
|
break;
|
|
101
77
|
}
|
|
102
|
-
|
|
103
78
|
throw _iteratorError;
|
|
104
|
-
|
|
105
79
|
case 35:
|
|
106
80
|
return _context.finish(32);
|
|
107
|
-
|
|
108
81
|
case 36:
|
|
109
82
|
return _context.finish(27);
|
|
110
|
-
|
|
111
83
|
case 37:
|
|
112
84
|
_context.next = 41;
|
|
113
85
|
break;
|
|
114
|
-
|
|
115
86
|
case 39:
|
|
116
87
|
_context.next = 41;
|
|
117
88
|
return (0, _build["default"])(bundle, outputOptions);
|
|
118
|
-
|
|
119
89
|
case 41:
|
|
120
90
|
case "end":
|
|
121
91
|
return _context.stop();
|
|
@@ -123,11 +93,9 @@ var buildLibrary = /*#__PURE__*/function () {
|
|
|
123
93
|
}
|
|
124
94
|
}, _callee, null, [[10, 23, 27, 37], [28,, 32, 36]]);
|
|
125
95
|
}));
|
|
126
|
-
|
|
127
96
|
return function buildLibrary(_x, _x2) {
|
|
128
97
|
return _ref.apply(this, arguments);
|
|
129
98
|
};
|
|
130
99
|
}();
|
|
131
|
-
|
|
132
100
|
var _default = buildLibrary;
|
|
133
101
|
exports["default"] = _default;
|