balm-core 3.36.0 → 3.37.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/bundler/esbuild/transform.js +37 -37
- package/lib/bundler/rollup/build.js +6 -6
- package/lib/bundler/rollup/index.js +37 -37
- package/lib/plugins/imagemin.js +11 -11
- package/lib/plugins/jsmin.js +17 -17
- package/lib/tasks/private/clean.js +4 -4
- package/lib/tasks/private/end.js +5 -5
- package/lib/tasks/private/modernizr.js +10 -10
- package/lib/tasks/private/start.js +5 -5
- package/lib/tasks/public/pwa.js +16 -16
- package/lib/tasks/public/remove.js +8 -8
- package/lib/tasks/public/rollup.js +4 -4
- package/package.json +9 -9
- package/tslib/bootstrap/index.js +2 -3
- package/tslib/bundler/esbuild/transform.js +17 -22
- package/tslib/bundler/rollup/index.js +3 -8
- package/tslib/bundler/rollup/plugins.js +2 -3
- package/tslib/bundler/webpack/index.js +2 -2
- package/tslib/plugins/plumber.js +1 -2
|
@@ -18,21 +18,21 @@ var esTransform = function esTransform(entryPoints, output, customTransformOptio
|
|
|
18
18
|
var transformOptions = BalmJS.config.env.isProd ? Object.assign({}, _options.minifyOptions) : {};
|
|
19
19
|
var options = Object.assign(transformOptions, BalmJS.config.scripts.transformOptions, customTransformOptions);
|
|
20
20
|
(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
21
|
-
var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, entryPoint, filename, inputCode, result;
|
|
22
|
-
return _regenerator["default"].wrap(function
|
|
21
|
+
var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, entryPoint, filename, inputCode, result, _t;
|
|
22
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
23
23
|
while (1) switch (_context.prev = _context.next) {
|
|
24
24
|
case 0:
|
|
25
25
|
_context.prev = 0;
|
|
26
26
|
_iteratorAbruptCompletion = false;
|
|
27
27
|
_didIteratorError = false;
|
|
28
|
-
_context.prev =
|
|
28
|
+
_context.prev = 1;
|
|
29
29
|
_iterator = _asyncIterator(entryPoints);
|
|
30
|
-
case
|
|
31
|
-
_context.next =
|
|
30
|
+
case 2:
|
|
31
|
+
_context.next = 3;
|
|
32
32
|
return _iterator.next();
|
|
33
|
-
case
|
|
33
|
+
case 3:
|
|
34
34
|
if (!(_iteratorAbruptCompletion = !(_step = _context.sent).done)) {
|
|
35
|
-
_context.next =
|
|
35
|
+
_context.next = 7;
|
|
36
36
|
break;
|
|
37
37
|
}
|
|
38
38
|
entryPoint = _step.value;
|
|
@@ -45,63 +45,63 @@ var esTransform = function esTransform(entryPoints, output, customTransformOptio
|
|
|
45
45
|
});
|
|
46
46
|
filename = entryPoint.split('/').pop();
|
|
47
47
|
if (!(filename && _fs["default"].existsSync(build.input))) {
|
|
48
|
-
_context.next =
|
|
48
|
+
_context.next = 5;
|
|
49
49
|
break;
|
|
50
50
|
}
|
|
51
51
|
inputCode = _fs["default"].readFileSync(build.input, 'utf8');
|
|
52
|
-
_context.next =
|
|
52
|
+
_context.next = 4;
|
|
53
53
|
return require('esbuild').transform(inputCode, options);
|
|
54
|
-
case
|
|
54
|
+
case 4:
|
|
55
55
|
result = _context.sent;
|
|
56
56
|
_fs["default"].mkdirSync(build.output, {
|
|
57
57
|
recursive: true
|
|
58
58
|
});
|
|
59
59
|
_fs["default"].writeFileSync(path.join(build.output, filename), result.code);
|
|
60
|
-
_context.next =
|
|
60
|
+
_context.next = 6;
|
|
61
61
|
break;
|
|
62
|
-
case
|
|
62
|
+
case 5:
|
|
63
63
|
BalmJS.logger.warn('esbuild', "Invalid entry point: ".concat(entryPoint));
|
|
64
|
-
case
|
|
64
|
+
case 6:
|
|
65
65
|
_iteratorAbruptCompletion = false;
|
|
66
|
-
_context.next =
|
|
66
|
+
_context.next = 2;
|
|
67
67
|
break;
|
|
68
|
-
case
|
|
69
|
-
_context.next =
|
|
68
|
+
case 7:
|
|
69
|
+
_context.next = 9;
|
|
70
70
|
break;
|
|
71
|
-
case
|
|
72
|
-
_context.prev =
|
|
73
|
-
|
|
71
|
+
case 8:
|
|
72
|
+
_context.prev = 8;
|
|
73
|
+
_t = _context["catch"](1);
|
|
74
74
|
_didIteratorError = true;
|
|
75
|
-
_iteratorError =
|
|
76
|
-
case
|
|
77
|
-
_context.prev =
|
|
78
|
-
_context.prev =
|
|
75
|
+
_iteratorError = _t;
|
|
76
|
+
case 9:
|
|
77
|
+
_context.prev = 9;
|
|
78
|
+
_context.prev = 10;
|
|
79
79
|
if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
|
|
80
|
-
_context.next =
|
|
80
|
+
_context.next = 11;
|
|
81
81
|
break;
|
|
82
82
|
}
|
|
83
|
-
_context.next =
|
|
83
|
+
_context.next = 11;
|
|
84
84
|
return _iterator["return"]();
|
|
85
|
-
case
|
|
86
|
-
_context.prev =
|
|
85
|
+
case 11:
|
|
86
|
+
_context.prev = 11;
|
|
87
87
|
if (!_didIteratorError) {
|
|
88
|
-
_context.next =
|
|
88
|
+
_context.next = 12;
|
|
89
89
|
break;
|
|
90
90
|
}
|
|
91
91
|
throw _iteratorError;
|
|
92
|
-
case
|
|
93
|
-
return _context.finish(
|
|
94
|
-
case
|
|
95
|
-
return _context.finish(
|
|
96
|
-
case
|
|
97
|
-
_context.prev =
|
|
92
|
+
case 12:
|
|
93
|
+
return _context.finish(11);
|
|
94
|
+
case 13:
|
|
95
|
+
return _context.finish(9);
|
|
96
|
+
case 14:
|
|
97
|
+
_context.prev = 14;
|
|
98
98
|
callback();
|
|
99
|
-
return _context.finish(
|
|
100
|
-
case
|
|
99
|
+
return _context.finish(14);
|
|
100
|
+
case 15:
|
|
101
101
|
case "end":
|
|
102
102
|
return _context.stop();
|
|
103
103
|
}
|
|
104
|
-
}, _callee, null, [[0,,
|
|
104
|
+
}, _callee, null, [[0,, 14, 15], [1, 8, 9, 14], [10,, 11, 13]]);
|
|
105
105
|
}))();
|
|
106
106
|
};
|
|
107
107
|
var _default = exports["default"] = esTransform;
|
|
@@ -13,12 +13,12 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
13
13
|
var build = /*#__PURE__*/function () {
|
|
14
14
|
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(bundle, outputOptions) {
|
|
15
15
|
var _yield$bundle$generat, output, _iterator, _step, chunkOrAsset;
|
|
16
|
-
return _regenerator["default"].wrap(function
|
|
16
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
17
17
|
while (1) switch (_context.prev = _context.next) {
|
|
18
18
|
case 0:
|
|
19
|
-
_context.next =
|
|
19
|
+
_context.next = 1;
|
|
20
20
|
return bundle.generate(outputOptions);
|
|
21
|
-
case
|
|
21
|
+
case 1:
|
|
22
22
|
_yield$bundle$generat = _context.sent;
|
|
23
23
|
output = _yield$bundle$generat.output;
|
|
24
24
|
_iterator = _createForOfIteratorHelper(output);
|
|
@@ -74,11 +74,11 @@ var build = /*#__PURE__*/function () {
|
|
|
74
74
|
} finally {
|
|
75
75
|
_iterator.f();
|
|
76
76
|
}
|
|
77
|
-
_context.next =
|
|
77
|
+
_context.next = 2;
|
|
78
78
|
return bundle.write(outputOptions);
|
|
79
|
-
case
|
|
79
|
+
case 2:
|
|
80
80
|
return _context.abrupt("return", _context.sent);
|
|
81
|
-
case
|
|
81
|
+
case 3:
|
|
82
82
|
case "end":
|
|
83
83
|
return _context.stop();
|
|
84
84
|
}
|
|
@@ -14,8 +14,8 @@ function _asyncIterator(r) { var n, t, o, e = 2; for ("undefined" != typeof Symb
|
|
|
14
14
|
function AsyncFromSyncIterator(r) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var n = r.done; return Promise.resolve(r.value).then(function (r) { return { value: r, done: n }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) { this.s = r, this.n = r.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, "return": function _return(r) { var n = this.s["return"]; return void 0 === n ? Promise.resolve({ value: r, done: !0 }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); }, "throw": function _throw(r) { var n = this.s["return"]; return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(r); }
|
|
15
15
|
var buildLibrary = /*#__PURE__*/function () {
|
|
16
16
|
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(inputOptions, outputOptions) {
|
|
17
|
-
var rollup, rollupOptions, bundle, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, outputOption;
|
|
18
|
-
return _regenerator["default"].wrap(function
|
|
17
|
+
var rollup, rollupOptions, bundle, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, outputOption, _t;
|
|
18
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
19
19
|
while (1) switch (_context.prev = _context.next) {
|
|
20
20
|
case 0:
|
|
21
21
|
rollup = require('rollup');
|
|
@@ -24,72 +24,72 @@ var buildLibrary = /*#__PURE__*/function () {
|
|
|
24
24
|
rollupOptions = Object.assign({}, inputOptions, {
|
|
25
25
|
output: outputOptions
|
|
26
26
|
});
|
|
27
|
-
_context.next =
|
|
27
|
+
_context.next = 1;
|
|
28
28
|
return rollup.rollup(rollupOptions);
|
|
29
|
-
case
|
|
29
|
+
case 1:
|
|
30
30
|
bundle = _context.sent;
|
|
31
31
|
if (!Array.isArray(outputOptions)) {
|
|
32
|
-
_context.next =
|
|
32
|
+
_context.next = 14;
|
|
33
33
|
break;
|
|
34
34
|
}
|
|
35
35
|
_iteratorAbruptCompletion = false;
|
|
36
36
|
_didIteratorError = false;
|
|
37
|
-
_context.prev =
|
|
37
|
+
_context.prev = 2;
|
|
38
38
|
_iterator = _asyncIterator(outputOptions);
|
|
39
|
-
case
|
|
40
|
-
_context.next =
|
|
39
|
+
case 3:
|
|
40
|
+
_context.next = 4;
|
|
41
41
|
return _iterator.next();
|
|
42
|
-
case
|
|
42
|
+
case 4:
|
|
43
43
|
if (!(_iteratorAbruptCompletion = !(_step = _context.sent).done)) {
|
|
44
|
-
_context.next =
|
|
44
|
+
_context.next = 6;
|
|
45
45
|
break;
|
|
46
46
|
}
|
|
47
47
|
outputOption = _step.value;
|
|
48
|
-
_context.next =
|
|
48
|
+
_context.next = 5;
|
|
49
49
|
return (0, _build["default"])(bundle, outputOption);
|
|
50
|
-
case
|
|
50
|
+
case 5:
|
|
51
51
|
_iteratorAbruptCompletion = false;
|
|
52
|
-
_context.next =
|
|
52
|
+
_context.next = 3;
|
|
53
53
|
break;
|
|
54
|
-
case
|
|
55
|
-
_context.next =
|
|
54
|
+
case 6:
|
|
55
|
+
_context.next = 8;
|
|
56
56
|
break;
|
|
57
|
-
case
|
|
58
|
-
_context.prev =
|
|
59
|
-
|
|
57
|
+
case 7:
|
|
58
|
+
_context.prev = 7;
|
|
59
|
+
_t = _context["catch"](2);
|
|
60
60
|
_didIteratorError = true;
|
|
61
|
-
_iteratorError =
|
|
62
|
-
case
|
|
63
|
-
_context.prev =
|
|
64
|
-
_context.prev =
|
|
61
|
+
_iteratorError = _t;
|
|
62
|
+
case 8:
|
|
63
|
+
_context.prev = 8;
|
|
64
|
+
_context.prev = 9;
|
|
65
65
|
if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
|
|
66
|
-
_context.next =
|
|
66
|
+
_context.next = 10;
|
|
67
67
|
break;
|
|
68
68
|
}
|
|
69
|
-
_context.next =
|
|
69
|
+
_context.next = 10;
|
|
70
70
|
return _iterator["return"]();
|
|
71
|
-
case
|
|
72
|
-
_context.prev =
|
|
71
|
+
case 10:
|
|
72
|
+
_context.prev = 10;
|
|
73
73
|
if (!_didIteratorError) {
|
|
74
|
-
_context.next =
|
|
74
|
+
_context.next = 11;
|
|
75
75
|
break;
|
|
76
76
|
}
|
|
77
77
|
throw _iteratorError;
|
|
78
|
-
case
|
|
79
|
-
return _context.finish(
|
|
80
|
-
case
|
|
81
|
-
return _context.finish(
|
|
82
|
-
case
|
|
83
|
-
_context.next =
|
|
78
|
+
case 11:
|
|
79
|
+
return _context.finish(10);
|
|
80
|
+
case 12:
|
|
81
|
+
return _context.finish(8);
|
|
82
|
+
case 13:
|
|
83
|
+
_context.next = 15;
|
|
84
84
|
break;
|
|
85
|
-
case
|
|
86
|
-
_context.next =
|
|
85
|
+
case 14:
|
|
86
|
+
_context.next = 15;
|
|
87
87
|
return (0, _build["default"])(bundle, outputOptions);
|
|
88
|
-
case
|
|
88
|
+
case 15:
|
|
89
89
|
case "end":
|
|
90
90
|
return _context.stop();
|
|
91
91
|
}
|
|
92
|
-
}, _callee, null, [[
|
|
92
|
+
}, _callee, null, [[2, 7, 8, 13], [9,, 10, 12]]);
|
|
93
93
|
}));
|
|
94
94
|
return function buildLibrary(_x, _x2) {
|
|
95
95
|
return _ref.apply(this, arguments);
|
package/lib/plugins/imagemin.js
CHANGED
|
@@ -61,16 +61,16 @@ var gulpImagemin = function gulpImagemin(customPlugins) {
|
|
|
61
61
|
}
|
|
62
62
|
var plugins = customPlugins || getDefaultPlugins();
|
|
63
63
|
(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
64
|
-
var data, originalSize, optimizedSize, saved, percent, savedMsg, msg;
|
|
65
|
-
return _regenerator["default"].wrap(function
|
|
64
|
+
var data, originalSize, optimizedSize, saved, percent, savedMsg, msg, _t;
|
|
65
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
66
66
|
while (1) switch (_context.prev = _context.next) {
|
|
67
67
|
case 0:
|
|
68
68
|
_context.prev = 0;
|
|
69
|
-
_context.next =
|
|
69
|
+
_context.next = 1;
|
|
70
70
|
return require('imagemin').buffer(file.contents, {
|
|
71
71
|
plugins: plugins
|
|
72
72
|
});
|
|
73
|
-
case
|
|
73
|
+
case 1:
|
|
74
74
|
data = _context.sent;
|
|
75
75
|
originalSize = file.contents.length;
|
|
76
76
|
optimizedSize = data.length;
|
|
@@ -86,19 +86,19 @@ var gulpImagemin = function gulpImagemin(customPlugins) {
|
|
|
86
86
|
BalmJS.logger.debug(PLUGIN_NAME, "".concat(file.relative, " (").concat(msg, ")"));
|
|
87
87
|
file.contents = data;
|
|
88
88
|
callback(null, file);
|
|
89
|
-
_context.next =
|
|
89
|
+
_context.next = 3;
|
|
90
90
|
break;
|
|
91
|
-
case
|
|
92
|
-
_context.prev =
|
|
93
|
-
|
|
94
|
-
callback(new PluginError(PLUGIN_NAME,
|
|
91
|
+
case 2:
|
|
92
|
+
_context.prev = 2;
|
|
93
|
+
_t = _context["catch"](0);
|
|
94
|
+
callback(new PluginError(PLUGIN_NAME, _t, {
|
|
95
95
|
fileName: file.path
|
|
96
96
|
}));
|
|
97
|
-
case
|
|
97
|
+
case 3:
|
|
98
98
|
case "end":
|
|
99
99
|
return _context.stop();
|
|
100
100
|
}
|
|
101
|
-
}, _callee, null, [[0,
|
|
101
|
+
}, _callee, null, [[0, 2]]);
|
|
102
102
|
}))();
|
|
103
103
|
}
|
|
104
104
|
function flush(callback) {
|
package/lib/plugins/jsmin.js
CHANGED
|
@@ -13,46 +13,46 @@ function jsMinify(_x, _x2, _x3) {
|
|
|
13
13
|
}
|
|
14
14
|
function _jsMinify() {
|
|
15
15
|
_jsMinify = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(file, opts, cb) {
|
|
16
|
-
var terser, extname, code, content, result, error;
|
|
17
|
-
return _regenerator["default"].wrap(function
|
|
16
|
+
var terser, extname, code, content, result, error, _t;
|
|
17
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
18
18
|
while (1) switch (_context.prev = _context.next) {
|
|
19
19
|
case 0:
|
|
20
20
|
terser = require('terser');
|
|
21
21
|
extname = path.extname(file.path);
|
|
22
22
|
if (!(extname === '.js')) {
|
|
23
|
-
_context.next =
|
|
23
|
+
_context.next = 5;
|
|
24
24
|
break;
|
|
25
25
|
}
|
|
26
26
|
code = {};
|
|
27
27
|
content = file.contents.toString();
|
|
28
28
|
code[path.basename(file.path)] = content;
|
|
29
|
-
_context.prev =
|
|
30
|
-
_context.next =
|
|
29
|
+
_context.prev = 1;
|
|
30
|
+
_context.next = 2;
|
|
31
31
|
return terser.minify(code, opts);
|
|
32
|
-
case
|
|
32
|
+
case 2:
|
|
33
33
|
result = _context.sent;
|
|
34
34
|
content = result.code;
|
|
35
35
|
file.contents = Buffer.from(content);
|
|
36
36
|
cb(null, file);
|
|
37
|
-
_context.next =
|
|
37
|
+
_context.next = 4;
|
|
38
38
|
break;
|
|
39
|
-
case
|
|
40
|
-
_context.prev =
|
|
41
|
-
|
|
42
|
-
error = new PluginError(PLUGIN_NAME,
|
|
39
|
+
case 3:
|
|
40
|
+
_context.prev = 3;
|
|
41
|
+
_t = _context["catch"](1);
|
|
42
|
+
error = new PluginError(PLUGIN_NAME, _t);
|
|
43
43
|
cb(error);
|
|
44
|
-
case
|
|
45
|
-
_context.next =
|
|
44
|
+
case 4:
|
|
45
|
+
_context.next = 6;
|
|
46
46
|
break;
|
|
47
|
-
case
|
|
47
|
+
case 5:
|
|
48
48
|
BalmJS.logger.error(PLUGIN_NAME, 'Invalid JS file');
|
|
49
|
-
case
|
|
49
|
+
case 6:
|
|
50
50
|
return _context.abrupt("return", file);
|
|
51
|
-
case
|
|
51
|
+
case 7:
|
|
52
52
|
case "end":
|
|
53
53
|
return _context.stop();
|
|
54
54
|
}
|
|
55
|
-
}, _callee, null, [[
|
|
55
|
+
}, _callee, null, [[1, 3]]);
|
|
56
56
|
}));
|
|
57
57
|
return _jsMinify.apply(this, arguments);
|
|
58
58
|
}
|
|
@@ -47,7 +47,7 @@ var CleanTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
|
47
47
|
(0, _defineProperty2["default"])(_this, "fn", /*#__PURE__*/function () {
|
|
48
48
|
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(callback) {
|
|
49
49
|
var taskName, directories, deletedPaths;
|
|
50
|
-
return _regenerator["default"].wrap(function
|
|
50
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
51
51
|
while (1) switch (_context.prev = _context.next) {
|
|
52
52
|
case 0:
|
|
53
53
|
taskName = "".concat(_this.name, " task");
|
|
@@ -60,11 +60,11 @@ var CleanTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
|
60
60
|
}, {
|
|
61
61
|
pre: true
|
|
62
62
|
});
|
|
63
|
-
_context.next =
|
|
63
|
+
_context.next = 1;
|
|
64
64
|
return require('del')(directories, {
|
|
65
65
|
force: true
|
|
66
66
|
});
|
|
67
|
-
case
|
|
67
|
+
case 1:
|
|
68
68
|
deletedPaths = _context.sent;
|
|
69
69
|
BalmJS.logger.warn(taskName, {
|
|
70
70
|
deletedPaths: deletedPaths
|
|
@@ -72,7 +72,7 @@ var CleanTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
|
72
72
|
pre: true
|
|
73
73
|
});
|
|
74
74
|
callback();
|
|
75
|
-
case
|
|
75
|
+
case 2:
|
|
76
76
|
case "end":
|
|
77
77
|
return _context.stop();
|
|
78
78
|
}
|
package/lib/tasks/private/end.js
CHANGED
|
@@ -22,20 +22,20 @@ var EndTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
|
22
22
|
_this = _callSuper(this, EndTask, ['end']);
|
|
23
23
|
(0, _defineProperty2["default"])(_this, "fn", /*#__PURE__*/function () {
|
|
24
24
|
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(callback) {
|
|
25
|
-
return _regenerator["default"].wrap(function
|
|
25
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
26
26
|
while (1) switch (_context.prev = _context.next) {
|
|
27
27
|
case 0:
|
|
28
28
|
if (!BalmJS.utils.isFunction(BalmJS.afterTask)) {
|
|
29
|
-
_context.next =
|
|
29
|
+
_context.next = 1;
|
|
30
30
|
break;
|
|
31
31
|
}
|
|
32
|
-
_context.next =
|
|
32
|
+
_context.next = 1;
|
|
33
33
|
return BalmJS.afterTask();
|
|
34
|
-
case
|
|
34
|
+
case 1:
|
|
35
35
|
_this.time();
|
|
36
36
|
BalmJS.emitter.emit('exit');
|
|
37
37
|
callback();
|
|
38
|
-
case
|
|
38
|
+
case 2:
|
|
39
39
|
case "end":
|
|
40
40
|
return _context.stop();
|
|
41
41
|
}
|
|
@@ -60,32 +60,32 @@ var ModernizrTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
|
60
60
|
(0, _defineProperty2["default"])(_this, "fn", /*#__PURE__*/function () {
|
|
61
61
|
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(callback) {
|
|
62
62
|
var _yield$Promise$all, _yield$Promise$all2, config;
|
|
63
|
-
return _regenerator["default"].wrap(function
|
|
63
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
64
64
|
while (1) switch (_context.prev = _context.next) {
|
|
65
65
|
case 0:
|
|
66
66
|
_this.init();
|
|
67
67
|
if (!_fs["default"].existsSync(_this.input)) {
|
|
68
|
-
_context.next =
|
|
68
|
+
_context.next = 3;
|
|
69
69
|
break;
|
|
70
70
|
}
|
|
71
|
-
_context.next =
|
|
71
|
+
_context.next = 1;
|
|
72
72
|
return Promise.all([_classPrivateFieldGet(_readConfig, _this).call(_this), _classPrivateFieldGet(_createDir, _this).call(_this)]);
|
|
73
|
-
case
|
|
73
|
+
case 1:
|
|
74
74
|
_yield$Promise$all = _context.sent;
|
|
75
75
|
_yield$Promise$all2 = (0, _slicedToArray2["default"])(_yield$Promise$all, 1);
|
|
76
76
|
config = _yield$Promise$all2[0];
|
|
77
|
-
_context.next =
|
|
77
|
+
_context.next = 2;
|
|
78
78
|
return _classPrivateFieldGet(_generateScript, _this).call(_this, config);
|
|
79
|
-
case
|
|
80
|
-
_context.next =
|
|
79
|
+
case 2:
|
|
80
|
+
_context.next = 4;
|
|
81
81
|
break;
|
|
82
|
-
case
|
|
82
|
+
case 3:
|
|
83
83
|
BalmJS.logger.warn("".concat(_this.name, " task"), "The '".concat(_this.input, "' does not exist"), {
|
|
84
84
|
logLevel: BalmJS.LogLevel.Info
|
|
85
85
|
});
|
|
86
|
-
case
|
|
86
|
+
case 4:
|
|
87
87
|
callback();
|
|
88
|
-
case
|
|
88
|
+
case 5:
|
|
89
89
|
case "end":
|
|
90
90
|
return _context.stop();
|
|
91
91
|
}
|
|
@@ -22,19 +22,19 @@ var StartTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
|
22
22
|
_this = _callSuper(this, StartTask, ['start']);
|
|
23
23
|
(0, _defineProperty2["default"])(_this, "fn", /*#__PURE__*/function () {
|
|
24
24
|
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(callback) {
|
|
25
|
-
return _regenerator["default"].wrap(function
|
|
25
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
26
26
|
while (1) switch (_context.prev = _context.next) {
|
|
27
27
|
case 0:
|
|
28
28
|
BalmJS.start = process.hrtime();
|
|
29
29
|
if (!BalmJS.utils.isFunction(BalmJS.beforeTask)) {
|
|
30
|
-
_context.next =
|
|
30
|
+
_context.next = 1;
|
|
31
31
|
break;
|
|
32
32
|
}
|
|
33
|
-
_context.next =
|
|
33
|
+
_context.next = 1;
|
|
34
34
|
return BalmJS.beforeTask();
|
|
35
|
-
case
|
|
35
|
+
case 1:
|
|
36
36
|
callback();
|
|
37
|
-
case
|
|
37
|
+
case 2:
|
|
38
38
|
case "end":
|
|
39
39
|
return _context.stop();
|
|
40
40
|
}
|
package/lib/tasks/public/pwa.js
CHANGED
|
@@ -38,8 +38,8 @@ var PwaTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
|
38
38
|
var customOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
39
39
|
var balmPwa = /*#__PURE__*/function () {
|
|
40
40
|
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(callback) {
|
|
41
|
-
var mode, options, globDirectory, swDest, swSrc, valid;
|
|
42
|
-
return _regenerator["default"].wrap(function
|
|
41
|
+
var mode, options, globDirectory, swDest, swSrc, valid, _t;
|
|
42
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
43
43
|
while (1) switch (_context.prev = _context.next) {
|
|
44
44
|
case 0:
|
|
45
45
|
mode = customMode || BalmJS.config.pwa.mode;
|
|
@@ -48,34 +48,34 @@ var PwaTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
|
48
48
|
swDest = BalmJS.file.absPath("".concat(globDirectory, "/").concat(BalmJS.config.pwa.swDestFilename));
|
|
49
49
|
swSrc = BalmJS.file.absPath("".concat(BalmJS.config.src.base, "/").concat(BalmJS.config.pwa.swSrcFilename));
|
|
50
50
|
valid = true;
|
|
51
|
-
|
|
52
|
-
_context.next =
|
|
51
|
+
_t = mode;
|
|
52
|
+
_context.next = _t === 'generateSW' ? 1 : _t === 'injectManifest' ? 2 : 3;
|
|
53
53
|
break;
|
|
54
|
-
case
|
|
54
|
+
case 1:
|
|
55
55
|
options = Object.assign({
|
|
56
56
|
globDirectory: globDirectory,
|
|
57
57
|
swDest: swDest
|
|
58
58
|
}, BalmJS.config.pwa.options, customOptions);
|
|
59
|
-
return _context.abrupt("
|
|
60
|
-
case
|
|
59
|
+
return _context.abrupt("continue", 4);
|
|
60
|
+
case 2:
|
|
61
61
|
options = Object.assign({
|
|
62
62
|
globDirectory: globDirectory,
|
|
63
63
|
swDest: swDest,
|
|
64
64
|
swSrc: swSrc
|
|
65
65
|
}, BalmJS.config.pwa.options, customOptions);
|
|
66
|
-
return _context.abrupt("
|
|
67
|
-
case
|
|
66
|
+
return _context.abrupt("continue", 4);
|
|
67
|
+
case 3:
|
|
68
68
|
valid = false;
|
|
69
|
-
case
|
|
69
|
+
case 4:
|
|
70
70
|
if (!valid) {
|
|
71
|
-
_context.next =
|
|
71
|
+
_context.next = 6;
|
|
72
72
|
break;
|
|
73
73
|
}
|
|
74
74
|
options = _this.setIgnores(options);
|
|
75
75
|
BalmJS.logger.debug("pwa - ".concat(mode), options, {
|
|
76
76
|
pre: true
|
|
77
77
|
});
|
|
78
|
-
_context.next =
|
|
78
|
+
_context.next = 5;
|
|
79
79
|
return require('workbox-build')[mode](options).then(function (_ref2) {
|
|
80
80
|
var count = _ref2.count,
|
|
81
81
|
size = _ref2.size;
|
|
@@ -84,14 +84,14 @@ var PwaTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
|
84
84
|
})["catch"](function (err) {
|
|
85
85
|
BalmJS.logger.warn("pwa - ".concat(mode), "Service worker generation failed: ".concat(err));
|
|
86
86
|
});
|
|
87
|
-
case
|
|
87
|
+
case 5:
|
|
88
88
|
callback();
|
|
89
|
-
_context.next =
|
|
89
|
+
_context.next = 7;
|
|
90
90
|
break;
|
|
91
|
-
case
|
|
91
|
+
case 6:
|
|
92
92
|
BalmJS.logger.warn('pwa task', 'Invalid PWA mode');
|
|
93
93
|
callback();
|
|
94
|
-
case
|
|
94
|
+
case 7:
|
|
95
95
|
case "end":
|
|
96
96
|
return _context.stop();
|
|
97
97
|
}
|
|
@@ -42,12 +42,12 @@ var RemoveTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
|
42
42
|
var balmRemove = /*#__PURE__*/function () {
|
|
43
43
|
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(callback) {
|
|
44
44
|
var canDel, files, deletedPaths;
|
|
45
|
-
return _regenerator["default"].wrap(function
|
|
45
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
46
46
|
while (1) switch (_context.prev = _context.next) {
|
|
47
47
|
case 0:
|
|
48
48
|
canDel = !!(BalmJS.utils.isString(input) && input.trim() || BalmJS.utils.isArray(input) && input.length);
|
|
49
49
|
if (!canDel) {
|
|
50
|
-
_context.next =
|
|
50
|
+
_context.next = 2;
|
|
51
51
|
break;
|
|
52
52
|
}
|
|
53
53
|
files = _classPrivateFieldGet(_getFiles, _this2).call(_this2, input);
|
|
@@ -56,24 +56,24 @@ var RemoveTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
|
56
56
|
}, {
|
|
57
57
|
pre: true
|
|
58
58
|
});
|
|
59
|
-
_context.next =
|
|
59
|
+
_context.next = 1;
|
|
60
60
|
return require('del')(files, {
|
|
61
61
|
force: true
|
|
62
62
|
});
|
|
63
|
-
case
|
|
63
|
+
case 1:
|
|
64
64
|
deletedPaths = _context.sent;
|
|
65
65
|
BalmJS.logger.warn("".concat(_this2.name, " task"), {
|
|
66
66
|
deletedPaths: deletedPaths
|
|
67
67
|
}, {
|
|
68
68
|
pre: true
|
|
69
69
|
});
|
|
70
|
-
_context.next =
|
|
70
|
+
_context.next = 3;
|
|
71
71
|
break;
|
|
72
|
-
case
|
|
72
|
+
case 2:
|
|
73
73
|
BalmJS.logger.error("".concat(_this2.name, " task"), 'Invalid input');
|
|
74
|
-
case
|
|
74
|
+
case 3:
|
|
75
75
|
callback();
|
|
76
|
-
case
|
|
76
|
+
case 4:
|
|
77
77
|
case "end":
|
|
78
78
|
return _context.stop();
|
|
79
79
|
}
|
|
@@ -26,14 +26,14 @@ var RollupTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
|
26
26
|
value: function recipe(input, output) {
|
|
27
27
|
var balmBundler = /*#__PURE__*/function () {
|
|
28
28
|
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(callback) {
|
|
29
|
-
return _regenerator["default"].wrap(function
|
|
29
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
30
30
|
while (1) switch (_context.prev = _context.next) {
|
|
31
31
|
case 0:
|
|
32
|
-
_context.next =
|
|
32
|
+
_context.next = 1;
|
|
33
33
|
return (0, _rollup["default"])(input, output);
|
|
34
|
-
case
|
|
34
|
+
case 1:
|
|
35
35
|
callback();
|
|
36
|
-
case
|
|
36
|
+
case 2:
|
|
37
37
|
case "end":
|
|
38
38
|
return _context.stop();
|
|
39
39
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "balm-core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.37.0",
|
|
4
4
|
"description": "BalmJS compiler core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"balm",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"async": "^3.2.6",
|
|
45
45
|
"autoprefixer": "9",
|
|
46
46
|
"babel-loader": "8",
|
|
47
|
-
"browser-sync": "^3.0.
|
|
47
|
+
"browser-sync": "^3.0.4",
|
|
48
48
|
"connect-history-api-fallback": "^2.0.0",
|
|
49
49
|
"css-loader": "5",
|
|
50
50
|
"cssnano": "4",
|
|
51
51
|
"del": "6",
|
|
52
|
-
"esbuild": "^0.
|
|
52
|
+
"esbuild": "^0.28.0",
|
|
53
53
|
"fancy-log": "^2.0.0",
|
|
54
54
|
"file-loader": "6",
|
|
55
55
|
"gulp-eslint": "^6.0.0",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"http-proxy-middleware": "1",
|
|
68
68
|
"imagemin": "7",
|
|
69
69
|
"istextorbinary": "6",
|
|
70
|
-
"less": "^4.
|
|
70
|
+
"less": "^4.6.4",
|
|
71
71
|
"mini-css-extract-plugin": "1",
|
|
72
72
|
"modernizr": "^3.13.1",
|
|
73
73
|
"optimize-css-assets-webpack-plugin": "5",
|
|
@@ -91,19 +91,19 @@
|
|
|
91
91
|
"strip-ansi": "6",
|
|
92
92
|
"style-loader": "2",
|
|
93
93
|
"tailwindcss": "npm:@tailwindcss/postcss7-compat@2.1.4",
|
|
94
|
-
"terser": "^5.
|
|
94
|
+
"terser": "^5.47.0",
|
|
95
95
|
"terser-webpack-plugin": "4",
|
|
96
|
-
"through2": "
|
|
96
|
+
"through2": "4",
|
|
97
97
|
"through2-concurrent": "^2.0.0",
|
|
98
98
|
"tslib": "^2.8.1",
|
|
99
99
|
"url-loader": "4",
|
|
100
100
|
"vinyl-sourcemaps-apply": "^0.2.1",
|
|
101
101
|
"webpack": "4",
|
|
102
|
-
"webpack-bundle-analyzer": "
|
|
102
|
+
"webpack-bundle-analyzer": "4",
|
|
103
103
|
"webpack-dev-middleware": "3",
|
|
104
104
|
"webpack-hot-middleware": "^2.26.1",
|
|
105
105
|
"webpack-merge": "5",
|
|
106
|
-
"workbox-build": "^7.
|
|
106
|
+
"workbox-build": "^7.4.1"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
109
|
"@types/express": "4",
|
|
@@ -119,5 +119,5 @@
|
|
|
119
119
|
"engines": {
|
|
120
120
|
"node": ">=10.13.0"
|
|
121
121
|
},
|
|
122
|
-
"gitHead": "
|
|
122
|
+
"gitHead": "ae455031deb87887f9438974d7214038a71e3dca"
|
|
123
123
|
}
|
package/tslib/bootstrap/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.setConfig = setConfig;
|
|
4
|
+
exports.setTask = setTask;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const check_config_1 = tslib_1.__importDefault(require("./check_config"));
|
|
6
7
|
const constants_1 = require("../config/constants");
|
|
@@ -63,7 +64,6 @@ function setConfig(customConfig) {
|
|
|
63
64
|
});
|
|
64
65
|
return config;
|
|
65
66
|
}
|
|
66
|
-
exports.setConfig = setConfig;
|
|
67
67
|
function setTask(name) {
|
|
68
68
|
let result = undefined;
|
|
69
69
|
if (BalmJS.utils.isFunction(name)) {
|
|
@@ -82,4 +82,3 @@ function setTask(name) {
|
|
|
82
82
|
}
|
|
83
83
|
return result;
|
|
84
84
|
}
|
|
85
|
-
exports.setTask = setTask;
|
|
@@ -15,31 +15,26 @@ const esTransform = (entryPoints, output, customTransformOptions, callback) => {
|
|
|
15
15
|
var _a, e_1, _b, _c;
|
|
16
16
|
try {
|
|
17
17
|
try {
|
|
18
|
-
for (var _d = true, entryPoints_1 = tslib_1.__asyncValues(entryPoints), entryPoints_1_1; entryPoints_1_1 = await entryPoints_1.next(), _a = entryPoints_1_1.done, !_a;) {
|
|
18
|
+
for (var _d = true, entryPoints_1 = tslib_1.__asyncValues(entryPoints), entryPoints_1_1; entryPoints_1_1 = await entryPoints_1.next(), _a = entryPoints_1_1.done, !_a; _d = true) {
|
|
19
19
|
_c = entryPoints_1_1.value;
|
|
20
20
|
_d = false;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
fs_1.default.writeFileSync(path.join(build.output, filename), result.code);
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
BalmJS.logger.warn('esbuild', `Invalid entry point: ${entryPoint}`);
|
|
39
|
-
}
|
|
21
|
+
const entryPoint = _c;
|
|
22
|
+
build.input = BalmJS.file.absPath(entryPoint);
|
|
23
|
+
BalmJS.logger.debug('esbuild bundler - transform', {
|
|
24
|
+
input: build.input,
|
|
25
|
+
output: build.output
|
|
26
|
+
}, {
|
|
27
|
+
pre: true
|
|
28
|
+
});
|
|
29
|
+
const filename = entryPoint.split('/').pop();
|
|
30
|
+
if (filename && fs_1.default.existsSync(build.input)) {
|
|
31
|
+
const inputCode = fs_1.default.readFileSync(build.input, 'utf8');
|
|
32
|
+
const result = await require('esbuild').transform(inputCode, options);
|
|
33
|
+
fs_1.default.mkdirSync(build.output, { recursive: true });
|
|
34
|
+
fs_1.default.writeFileSync(path.join(build.output, filename), result.code);
|
|
40
35
|
}
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
else {
|
|
37
|
+
BalmJS.logger.warn('esbuild', `Invalid entry point: ${entryPoint}`);
|
|
43
38
|
}
|
|
44
39
|
}
|
|
45
40
|
}
|
|
@@ -15,16 +15,11 @@ const buildLibrary = async (inputOptions, outputOptions) => {
|
|
|
15
15
|
const bundle = await rollup.rollup(rollupOptions);
|
|
16
16
|
if (Array.isArray(outputOptions)) {
|
|
17
17
|
try {
|
|
18
|
-
for (var _d = true, outputOptions_1 = tslib_1.__asyncValues(outputOptions), outputOptions_1_1; outputOptions_1_1 = await outputOptions_1.next(), _a = outputOptions_1_1.done, !_a;) {
|
|
18
|
+
for (var _d = true, outputOptions_1 = tslib_1.__asyncValues(outputOptions), outputOptions_1_1; outputOptions_1_1 = await outputOptions_1.next(), _a = outputOptions_1_1.done, !_a; _d = true) {
|
|
19
19
|
_c = outputOptions_1_1.value;
|
|
20
20
|
_d = false;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
await (0, build_1.default)(bundle, outputOption);
|
|
24
|
-
}
|
|
25
|
-
finally {
|
|
26
|
-
_d = true;
|
|
27
|
-
}
|
|
21
|
+
const outputOption = _c;
|
|
22
|
+
await (0, build_1.default)(bundle, outputOption);
|
|
28
23
|
}
|
|
29
24
|
}
|
|
30
25
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getInputPlugins = getInputPlugins;
|
|
4
|
+
exports.getOutputPlugins = getOutputPlugins;
|
|
4
5
|
function getInputPlugins(customInputOptions) {
|
|
5
6
|
const { inputOptions } = BalmJS.config.scripts;
|
|
6
7
|
const inputPlugins = [];
|
|
@@ -12,7 +13,6 @@ function getInputPlugins(customInputOptions) {
|
|
|
12
13
|
}
|
|
13
14
|
return inputPlugins;
|
|
14
15
|
}
|
|
15
|
-
exports.getInputPlugins = getInputPlugins;
|
|
16
16
|
function getOutputPlugins(customOutputOptions) {
|
|
17
17
|
const { outputOptions } = BalmJS.config.scripts;
|
|
18
18
|
const outputPlugins = [];
|
|
@@ -27,4 +27,3 @@ function getOutputPlugins(customOutputOptions) {
|
|
|
27
27
|
}
|
|
28
28
|
return outputPlugins;
|
|
29
29
|
}
|
|
30
|
-
exports.getOutputPlugins = getOutputPlugins;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.webpack = void 0;
|
|
4
|
+
exports.webpackConfig = webpackConfig;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const webpack_merge_1 = tslib_1.__importDefault(require("webpack-merge"));
|
|
6
7
|
const entry_1 = tslib_1.__importDefault(require("./entry"));
|
|
@@ -44,4 +45,3 @@ function webpackConfig(input, output, customWebpackOptions = {}, isHook = false)
|
|
|
44
45
|
});
|
|
45
46
|
return configuration;
|
|
46
47
|
}
|
|
47
|
-
exports.webpackConfig = webpackConfig;
|
package/tslib/plugins/plumber.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stop =
|
|
3
|
+
exports.stop = stop;
|
|
4
4
|
const events_1 = require("events");
|
|
5
5
|
const PLUGIN_NAME = 'plumber';
|
|
6
6
|
const emitter = new events_1.EventEmitter();
|
|
@@ -80,5 +80,4 @@ function stop() {
|
|
|
80
80
|
through._unplumbed = true;
|
|
81
81
|
return through;
|
|
82
82
|
}
|
|
83
|
-
exports.stop = stop;
|
|
84
83
|
exports.default = gulpPlumber;
|