balm-core 3.30.0 → 3.30.1
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/bootstrap/index.js +1 -1
- package/lib/bundler/esbuild/transform.js +77 -79
- package/lib/bundler/rollup/build.js +66 -68
- package/lib/bundler/rollup/index.js +68 -70
- package/lib/bundler/webpack/config/common.js +1 -1
- package/lib/config/index.js +6 -6
- package/lib/plugins/imagemin.js +34 -36
- package/lib/plugins/jsmin.js +35 -37
- package/lib/tasks/private/clean.js +27 -29
- package/lib/tasks/private/end.js +14 -16
- package/lib/tasks/private/extra.js +1 -1
- package/lib/tasks/private/image.js +1 -1
- package/lib/tasks/private/modernizr.js +26 -28
- package/lib/tasks/private/sprite.js +2 -2
- package/lib/tasks/private/start.js +13 -15
- package/lib/tasks/public/pwa.js +53 -55
- package/lib/tasks/public/remove.js +32 -34
- package/lib/tasks/public/rollup.js +9 -11
- package/lib/utilities/file.js +1 -1
- package/package.json +5 -5
package/lib/bootstrap/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var _check_config = _interopRequireDefault(require("./check_config"));
|
|
|
10
10
|
var _constants = require("../config/constants");
|
|
11
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; } } }; }
|
|
12
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); }
|
|
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++)
|
|
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; }
|
|
14
14
|
function createQuickPath(config, rootKey) {
|
|
15
15
|
var result = {};
|
|
16
16
|
var rootValue = config.roots[rootKey];
|
|
@@ -20,88 +20,86 @@ var esTransform = function esTransform(entryPoints, output, customTransformOptio
|
|
|
20
20
|
(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
21
21
|
var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, entryPoint, filename, inputCode, result;
|
|
22
22
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
23
|
-
while (1) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
_context.next = 25;
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
entryPoint = _step.value;
|
|
40
|
-
build.input = BalmJS.file.absPath(entryPoint);
|
|
41
|
-
BalmJS.logger.debug('esbuild bundler - transform', {
|
|
42
|
-
input: build.input,
|
|
43
|
-
output: build.output
|
|
44
|
-
}, {
|
|
45
|
-
pre: true
|
|
46
|
-
});
|
|
47
|
-
filename = entryPoint.split('/').pop();
|
|
48
|
-
if (!(filename && _fs["default"].existsSync(build.input))) {
|
|
49
|
-
_context.next = 21;
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
inputCode = _fs["default"].readFileSync(build.input, 'utf8');
|
|
53
|
-
_context.next = 16;
|
|
54
|
-
return require('esbuild').transform(inputCode, options);
|
|
55
|
-
case 16:
|
|
56
|
-
result = _context.sent;
|
|
57
|
-
_fs["default"].mkdirSync(build.output, {
|
|
58
|
-
recursive: true
|
|
59
|
-
});
|
|
60
|
-
_fs["default"].writeFileSync(path.join(build.output, filename), result.code);
|
|
61
|
-
_context.next = 22;
|
|
23
|
+
while (1) switch (_context.prev = _context.next) {
|
|
24
|
+
case 0:
|
|
25
|
+
_context.prev = 0;
|
|
26
|
+
_iteratorAbruptCompletion = false;
|
|
27
|
+
_didIteratorError = false;
|
|
28
|
+
_context.prev = 3;
|
|
29
|
+
_iterator = _asyncIterator(entryPoints);
|
|
30
|
+
case 5:
|
|
31
|
+
_context.next = 7;
|
|
32
|
+
return _iterator.next();
|
|
33
|
+
case 7:
|
|
34
|
+
if (!(_iteratorAbruptCompletion = !(_step = _context.sent).done)) {
|
|
35
|
+
_context.next = 25;
|
|
62
36
|
break;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
37
|
+
}
|
|
38
|
+
entryPoint = _step.value;
|
|
39
|
+
build.input = BalmJS.file.absPath(entryPoint);
|
|
40
|
+
BalmJS.logger.debug('esbuild bundler - transform', {
|
|
41
|
+
input: build.input,
|
|
42
|
+
output: build.output
|
|
43
|
+
}, {
|
|
44
|
+
pre: true
|
|
45
|
+
});
|
|
46
|
+
filename = entryPoint.split('/').pop();
|
|
47
|
+
if (!(filename && _fs["default"].existsSync(build.input))) {
|
|
48
|
+
_context.next = 21;
|
|
68
49
|
break;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
50
|
+
}
|
|
51
|
+
inputCode = _fs["default"].readFileSync(build.input, 'utf8');
|
|
52
|
+
_context.next = 16;
|
|
53
|
+
return require('esbuild').transform(inputCode, options);
|
|
54
|
+
case 16:
|
|
55
|
+
result = _context.sent;
|
|
56
|
+
_fs["default"].mkdirSync(build.output, {
|
|
57
|
+
recursive: true
|
|
58
|
+
});
|
|
59
|
+
_fs["default"].writeFileSync(path.join(build.output, filename), result.code);
|
|
60
|
+
_context.next = 22;
|
|
61
|
+
break;
|
|
62
|
+
case 21:
|
|
63
|
+
BalmJS.logger.warn('esbuild', "Invalid entry point: ".concat(entryPoint));
|
|
64
|
+
case 22:
|
|
65
|
+
_iteratorAbruptCompletion = false;
|
|
66
|
+
_context.next = 5;
|
|
67
|
+
break;
|
|
68
|
+
case 25:
|
|
69
|
+
_context.next = 31;
|
|
70
|
+
break;
|
|
71
|
+
case 27:
|
|
72
|
+
_context.prev = 27;
|
|
73
|
+
_context.t0 = _context["catch"](3);
|
|
74
|
+
_didIteratorError = true;
|
|
75
|
+
_iteratorError = _context.t0;
|
|
76
|
+
case 31:
|
|
77
|
+
_context.prev = 31;
|
|
78
|
+
_context.prev = 32;
|
|
79
|
+
if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
|
|
84
80
|
_context.next = 36;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
_context.next = 36;
|
|
84
|
+
return _iterator["return"]();
|
|
85
|
+
case 36:
|
|
86
|
+
_context.prev = 36;
|
|
87
|
+
if (!_didIteratorError) {
|
|
88
|
+
_context.next = 39;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
throw _iteratorError;
|
|
92
|
+
case 39:
|
|
93
|
+
return _context.finish(36);
|
|
94
|
+
case 40:
|
|
95
|
+
return _context.finish(31);
|
|
96
|
+
case 41:
|
|
97
|
+
_context.prev = 41;
|
|
98
|
+
callback();
|
|
99
|
+
return _context.finish(41);
|
|
100
|
+
case 44:
|
|
101
|
+
case "end":
|
|
102
|
+
return _context.stop();
|
|
105
103
|
}
|
|
106
104
|
}, _callee, null, [[0,, 41, 44], [3, 27, 31, 41], [32,, 36, 40]]);
|
|
107
105
|
}))();
|
|
@@ -9,80 +9,78 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
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; } } }; }
|
|
11
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); }
|
|
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++)
|
|
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; }
|
|
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
16
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
17
|
-
while (1) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
//
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
});
|
|
69
|
-
}
|
|
17
|
+
while (1) switch (_context.prev = _context.next) {
|
|
18
|
+
case 0:
|
|
19
|
+
_context.next = 2;
|
|
20
|
+
return bundle.generate(outputOptions);
|
|
21
|
+
case 2:
|
|
22
|
+
_yield$bundle$generat = _context.sent;
|
|
23
|
+
output = _yield$bundle$generat.output;
|
|
24
|
+
_iterator = _createForOfIteratorHelper(output);
|
|
25
|
+
try {
|
|
26
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
27
|
+
chunkOrAsset = _step.value;
|
|
28
|
+
if (chunkOrAsset.type === 'asset') {
|
|
29
|
+
// For assets, this contains
|
|
30
|
+
// {
|
|
31
|
+
// fileName: string, // the asset file name
|
|
32
|
+
// source: string | Uint8Array // the asset source
|
|
33
|
+
// type: 'asset' // signifies that this is an asset
|
|
34
|
+
// }
|
|
35
|
+
BalmJS.logger.debug('rollup bundler - Asset', chunkOrAsset, {
|
|
36
|
+
pre: true
|
|
37
|
+
});
|
|
38
|
+
} else {
|
|
39
|
+
// For chunks, this contains
|
|
40
|
+
// {
|
|
41
|
+
// code: string, // the generated JS code
|
|
42
|
+
// dynamicImports: string[], // external modules imported dynamically by the chunk
|
|
43
|
+
// exports: string[], // exported variable names
|
|
44
|
+
// facadeModuleId: string | null, // the id of a module that this chunk corresponds to
|
|
45
|
+
// fileName: string, // the chunk file name
|
|
46
|
+
// implicitlyLoadedBefore: string[]; // entries that should only be loaded after this chunk
|
|
47
|
+
// imports: string[], // external modules imported statically by the chunk
|
|
48
|
+
// importedBindings: {[imported: string]: string[]} // imported bindings per dependency
|
|
49
|
+
// isDynamicEntry: boolean, // is this chunk a dynamic entry point
|
|
50
|
+
// isEntry: boolean, // is this chunk a static entry point
|
|
51
|
+
// isImplicitEntry: boolean, // should this chunk only be loaded after other chunks
|
|
52
|
+
// map: string | null, // sourcemaps if present
|
|
53
|
+
// modules: { // information about the modules in this chunk
|
|
54
|
+
// [id: string]: {
|
|
55
|
+
// renderedExports: string[]; // exported variable names that were included
|
|
56
|
+
// removedExports: string[]; // exported variable names that were removed
|
|
57
|
+
// renderedLength: number; // the length of the remaining code in this module
|
|
58
|
+
// originalLength: number; // the original length of the code in this module
|
|
59
|
+
// };
|
|
60
|
+
// },
|
|
61
|
+
// name: string // the name of this chunk as used in naming patterns
|
|
62
|
+
// referencedFiles: string[] // files referenced via import.meta.ROLLUP_FILE_URL_<id>
|
|
63
|
+
// type: 'chunk', // signifies that this is a chunk
|
|
64
|
+
// }
|
|
65
|
+
BalmJS.logger.debug('rollup bundler - Chunk', chunkOrAsset.modules, {
|
|
66
|
+
pre: true
|
|
67
|
+
});
|
|
70
68
|
}
|
|
71
|
-
|
|
72
|
-
// or write the bundle to disk
|
|
73
|
-
} catch (err) {
|
|
74
|
-
_iterator.e(err);
|
|
75
|
-
} finally {
|
|
76
|
-
_iterator.f();
|
|
77
69
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
70
|
+
|
|
71
|
+
// or write the bundle to disk
|
|
72
|
+
} catch (err) {
|
|
73
|
+
_iterator.e(err);
|
|
74
|
+
} finally {
|
|
75
|
+
_iterator.f();
|
|
76
|
+
}
|
|
77
|
+
_context.next = 8;
|
|
78
|
+
return bundle.write(outputOptions);
|
|
79
|
+
case 8:
|
|
80
|
+
return _context.abrupt("return", _context.sent);
|
|
81
|
+
case 9:
|
|
82
|
+
case "end":
|
|
83
|
+
return _context.stop();
|
|
86
84
|
}
|
|
87
85
|
}, _callee);
|
|
88
86
|
}));
|
|
@@ -16,80 +16,78 @@ var buildLibrary = /*#__PURE__*/function () {
|
|
|
16
16
|
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(inputOptions, outputOptions) {
|
|
17
17
|
var rollup, rollupOptions, bundle, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, outputOption;
|
|
18
18
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
19
|
-
while (1) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
_context.next = 39;
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
_iteratorAbruptCompletion = false;
|
|
37
|
-
_didIteratorError = false;
|
|
38
|
-
_context.prev = 10;
|
|
39
|
-
_iterator = _asyncIterator(outputOptions);
|
|
40
|
-
case 12:
|
|
41
|
-
_context.next = 14;
|
|
42
|
-
return _iterator.next();
|
|
43
|
-
case 14:
|
|
44
|
-
if (!(_iteratorAbruptCompletion = !(_step = _context.sent).done)) {
|
|
45
|
-
_context.next = 21;
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
outputOption = _step.value;
|
|
49
|
-
_context.next = 18;
|
|
50
|
-
return (0, _build["default"])(bundle, outputOption);
|
|
51
|
-
case 18:
|
|
52
|
-
_iteratorAbruptCompletion = false;
|
|
53
|
-
_context.next = 12;
|
|
19
|
+
while (1) switch (_context.prev = _context.next) {
|
|
20
|
+
case 0:
|
|
21
|
+
rollup = require('rollup');
|
|
22
|
+
inputOptions = (0, _entry["default"])(inputOptions);
|
|
23
|
+
outputOptions = (0, _output["default"])(outputOptions);
|
|
24
|
+
rollupOptions = Object.assign({}, inputOptions, {
|
|
25
|
+
output: outputOptions
|
|
26
|
+
});
|
|
27
|
+
_context.next = 6;
|
|
28
|
+
return rollup.rollup(rollupOptions);
|
|
29
|
+
case 6:
|
|
30
|
+
bundle = _context.sent;
|
|
31
|
+
if (!Array.isArray(outputOptions)) {
|
|
32
|
+
_context.next = 39;
|
|
54
33
|
break;
|
|
55
|
-
|
|
56
|
-
|
|
34
|
+
}
|
|
35
|
+
_iteratorAbruptCompletion = false;
|
|
36
|
+
_didIteratorError = false;
|
|
37
|
+
_context.prev = 10;
|
|
38
|
+
_iterator = _asyncIterator(outputOptions);
|
|
39
|
+
case 12:
|
|
40
|
+
_context.next = 14;
|
|
41
|
+
return _iterator.next();
|
|
42
|
+
case 14:
|
|
43
|
+
if (!(_iteratorAbruptCompletion = !(_step = _context.sent).done)) {
|
|
44
|
+
_context.next = 21;
|
|
57
45
|
break;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
46
|
+
}
|
|
47
|
+
outputOption = _step.value;
|
|
48
|
+
_context.next = 18;
|
|
49
|
+
return (0, _build["default"])(bundle, outputOption);
|
|
50
|
+
case 18:
|
|
51
|
+
_iteratorAbruptCompletion = false;
|
|
52
|
+
_context.next = 12;
|
|
53
|
+
break;
|
|
54
|
+
case 21:
|
|
55
|
+
_context.next = 27;
|
|
56
|
+
break;
|
|
57
|
+
case 23:
|
|
58
|
+
_context.prev = 23;
|
|
59
|
+
_context.t0 = _context["catch"](10);
|
|
60
|
+
_didIteratorError = true;
|
|
61
|
+
_iteratorError = _context.t0;
|
|
62
|
+
case 27:
|
|
63
|
+
_context.prev = 27;
|
|
64
|
+
_context.prev = 28;
|
|
65
|
+
if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
|
|
70
66
|
_context.next = 32;
|
|
71
|
-
return _iterator["return"]();
|
|
72
|
-
case 32:
|
|
73
|
-
_context.prev = 32;
|
|
74
|
-
if (!_didIteratorError) {
|
|
75
|
-
_context.next = 35;
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
throw _iteratorError;
|
|
79
|
-
case 35:
|
|
80
|
-
return _context.finish(32);
|
|
81
|
-
case 36:
|
|
82
|
-
return _context.finish(27);
|
|
83
|
-
case 37:
|
|
84
|
-
_context.next = 41;
|
|
85
67
|
break;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
68
|
+
}
|
|
69
|
+
_context.next = 32;
|
|
70
|
+
return _iterator["return"]();
|
|
71
|
+
case 32:
|
|
72
|
+
_context.prev = 32;
|
|
73
|
+
if (!_didIteratorError) {
|
|
74
|
+
_context.next = 35;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
throw _iteratorError;
|
|
78
|
+
case 35:
|
|
79
|
+
return _context.finish(32);
|
|
80
|
+
case 36:
|
|
81
|
+
return _context.finish(27);
|
|
82
|
+
case 37:
|
|
83
|
+
_context.next = 41;
|
|
84
|
+
break;
|
|
85
|
+
case 39:
|
|
86
|
+
_context.next = 41;
|
|
87
|
+
return (0, _build["default"])(bundle, outputOptions);
|
|
88
|
+
case 41:
|
|
89
|
+
case "end":
|
|
90
|
+
return _context.stop();
|
|
93
91
|
}
|
|
94
92
|
}, _callee, null, [[10, 23, 27, 37], [28,, 32, 36]]);
|
|
95
93
|
}));
|
|
@@ -10,7 +10,7 @@ var _loaders = _interopRequireDefault(require("../loaders"));
|
|
|
10
10
|
var _constants = require("../../../config/constants");
|
|
11
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; } } }; }
|
|
12
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); }
|
|
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++)
|
|
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; }
|
|
14
14
|
function getDefaultPlugins(webpack, scripts) {
|
|
15
15
|
var plugins = [
|
|
16
16
|
// Moment.js is an extremely popular library that bundles large locale files
|
package/lib/config/index.js
CHANGED
|
@@ -19,20 +19,20 @@ var _server = _interopRequireDefault(require("./server"));
|
|
|
19
19
|
var _ftp = _interopRequireDefault(require("./ftp"));
|
|
20
20
|
var _pwa = _interopRequireDefault(require("./pwa"));
|
|
21
21
|
var _logs = _interopRequireDefault(require("./logs"));
|
|
22
|
-
var LogLevel
|
|
23
|
-
(function (LogLevel) {
|
|
22
|
+
var LogLevel = /*#__PURE__*/function (LogLevel) {
|
|
24
23
|
LogLevel[LogLevel["Trace"] = 0] = "Trace";
|
|
25
24
|
LogLevel[LogLevel["Debug"] = 1] = "Debug";
|
|
26
25
|
LogLevel[LogLevel["Info"] = 2] = "Info";
|
|
27
26
|
LogLevel[LogLevel["Warn"] = 3] = "Warn";
|
|
28
27
|
LogLevel[LogLevel["Error"] = 4] = "Error";
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
return LogLevel;
|
|
29
|
+
}(LogLevel || {});
|
|
30
|
+
var Bundler = /*#__PURE__*/function (Bundler) {
|
|
32
31
|
Bundler["webpack"] = "webpack";
|
|
33
32
|
Bundler["rollup"] = "rollup";
|
|
34
33
|
Bundler["esbuild"] = "esbuild";
|
|
35
|
-
|
|
34
|
+
return Bundler;
|
|
35
|
+
}(Bundler || {});
|
|
36
36
|
var vendors = [];
|
|
37
37
|
var workspace = process.env.BALM_CWD;
|
|
38
38
|
/**
|
package/lib/plugins/imagemin.js
CHANGED
|
@@ -63,42 +63,40 @@ var gulpImagemin = function gulpImagemin(customPlugins) {
|
|
|
63
63
|
(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
64
64
|
var data, originalSize, optimizedSize, saved, percent, savedMsg, msg;
|
|
65
65
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
66
|
-
while (1) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return _context.stop();
|
|
101
|
-
}
|
|
66
|
+
while (1) switch (_context.prev = _context.next) {
|
|
67
|
+
case 0:
|
|
68
|
+
_context.prev = 0;
|
|
69
|
+
_context.next = 3;
|
|
70
|
+
return require('imagemin').buffer(file.contents, {
|
|
71
|
+
plugins: plugins
|
|
72
|
+
});
|
|
73
|
+
case 3:
|
|
74
|
+
data = _context.sent;
|
|
75
|
+
originalSize = file.contents.length;
|
|
76
|
+
optimizedSize = data.length;
|
|
77
|
+
saved = originalSize - optimizedSize;
|
|
78
|
+
percent = originalSize > 0 ? saved / originalSize * 100 : 0;
|
|
79
|
+
savedMsg = "saved ".concat((0, _prettyBytes["default"])(saved), " - ").concat(percent.toFixed(1).replace(/\.0$/, ''), "%");
|
|
80
|
+
msg = saved > 0 ? savedMsg : 'already optimized';
|
|
81
|
+
if (saved > 0) {
|
|
82
|
+
totalBytes += originalSize;
|
|
83
|
+
totalSavedBytes += saved;
|
|
84
|
+
totalFiles++;
|
|
85
|
+
}
|
|
86
|
+
BalmJS.logger.debug(PLUGIN_NAME, "".concat(file.relative, " (").concat(msg, ")"));
|
|
87
|
+
file.contents = data;
|
|
88
|
+
callback(null, file);
|
|
89
|
+
_context.next = 19;
|
|
90
|
+
break;
|
|
91
|
+
case 16:
|
|
92
|
+
_context.prev = 16;
|
|
93
|
+
_context.t0 = _context["catch"](0);
|
|
94
|
+
callback(new PluginError(PLUGIN_NAME, _context.t0, {
|
|
95
|
+
fileName: file.path
|
|
96
|
+
}));
|
|
97
|
+
case 19:
|
|
98
|
+
case "end":
|
|
99
|
+
return _context.stop();
|
|
102
100
|
}
|
|
103
101
|
}, _callee, null, [[0, 16]]);
|
|
104
102
|
}))();
|
package/lib/plugins/jsmin.js
CHANGED
|
@@ -15,44 +15,42 @@ function _jsMinify() {
|
|
|
15
15
|
_jsMinify = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(file, opts, cb) {
|
|
16
16
|
var terser, extname, code, content, result, error;
|
|
17
17
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
18
|
-
while (1) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
_context.next = 21;
|
|
25
|
-
break;
|
|
26
|
-
}
|
|
27
|
-
code = {};
|
|
28
|
-
content = file.contents.toString();
|
|
29
|
-
code[path.basename(file.path)] = content;
|
|
30
|
-
_context.prev = 6;
|
|
31
|
-
_context.next = 9;
|
|
32
|
-
return terser.minify(code, opts);
|
|
33
|
-
case 9:
|
|
34
|
-
result = _context.sent;
|
|
35
|
-
content = result.code;
|
|
36
|
-
file.contents = Buffer.from(content);
|
|
37
|
-
cb(null, file);
|
|
38
|
-
_context.next = 19;
|
|
18
|
+
while (1) switch (_context.prev = _context.next) {
|
|
19
|
+
case 0:
|
|
20
|
+
terser = require('terser');
|
|
21
|
+
extname = path.extname(file.path);
|
|
22
|
+
if (!(extname === '.js')) {
|
|
23
|
+
_context.next = 21;
|
|
39
24
|
break;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
25
|
+
}
|
|
26
|
+
code = {};
|
|
27
|
+
content = file.contents.toString();
|
|
28
|
+
code[path.basename(file.path)] = content;
|
|
29
|
+
_context.prev = 6;
|
|
30
|
+
_context.next = 9;
|
|
31
|
+
return terser.minify(code, opts);
|
|
32
|
+
case 9:
|
|
33
|
+
result = _context.sent;
|
|
34
|
+
content = result.code;
|
|
35
|
+
file.contents = Buffer.from(content);
|
|
36
|
+
cb(null, file);
|
|
37
|
+
_context.next = 19;
|
|
38
|
+
break;
|
|
39
|
+
case 15:
|
|
40
|
+
_context.prev = 15;
|
|
41
|
+
_context.t0 = _context["catch"](6);
|
|
42
|
+
error = new PluginError(PLUGIN_NAME, _context.t0);
|
|
43
|
+
cb(error);
|
|
44
|
+
case 19:
|
|
45
|
+
_context.next = 22;
|
|
46
|
+
break;
|
|
47
|
+
case 21:
|
|
48
|
+
BalmJS.logger.error(PLUGIN_NAME, 'Invalid JS file');
|
|
49
|
+
case 22:
|
|
50
|
+
return _context.abrupt("return", file);
|
|
51
|
+
case 23:
|
|
52
|
+
case "end":
|
|
53
|
+
return _context.stop();
|
|
56
54
|
}
|
|
57
55
|
}, _callee, null, [[6, 15]]);
|
|
58
56
|
}));
|
|
@@ -54,35 +54,33 @@ var CleanTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
|
54
54
|
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(callback) {
|
|
55
55
|
var taskName, directories, deletedPaths;
|
|
56
56
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
57
|
-
while (1) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return _context.stop();
|
|
85
|
-
}
|
|
57
|
+
while (1) switch (_context.prev = _context.next) {
|
|
58
|
+
case 0:
|
|
59
|
+
taskName = "".concat(_this.name, " task");
|
|
60
|
+
directories = BalmJS.config.inFrontend ? _this.dirInFrontend : _this.dirInBackend;
|
|
61
|
+
if (BalmJS.config.env.isProd && !BalmJS.config.assets.root) {
|
|
62
|
+
BalmJS.logger.warn(taskName, 'Remote root path is empty');
|
|
63
|
+
}
|
|
64
|
+
BalmJS.logger.debug(taskName, {
|
|
65
|
+
directories: directories
|
|
66
|
+
}, {
|
|
67
|
+
pre: true
|
|
68
|
+
});
|
|
69
|
+
_context.next = 6;
|
|
70
|
+
return require('del')(directories, {
|
|
71
|
+
force: true
|
|
72
|
+
});
|
|
73
|
+
case 6:
|
|
74
|
+
deletedPaths = _context.sent;
|
|
75
|
+
BalmJS.logger.warn(taskName, {
|
|
76
|
+
deletedPaths: deletedPaths
|
|
77
|
+
}, {
|
|
78
|
+
pre: true
|
|
79
|
+
});
|
|
80
|
+
callback();
|
|
81
|
+
case 9:
|
|
82
|
+
case "end":
|
|
83
|
+
return _context.stop();
|
|
86
84
|
}
|
|
87
85
|
}, _callee);
|
|
88
86
|
}));
|
package/lib/tasks/private/end.js
CHANGED
|
@@ -26,23 +26,21 @@ var EndTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
|
26
26
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "fn", /*#__PURE__*/function () {
|
|
27
27
|
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(callback) {
|
|
28
28
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
29
|
-
while (1) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (!BalmJS.utils.isFunction(BalmJS.afterTask)) {
|
|
33
|
-
_context.next = 3;
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
29
|
+
while (1) switch (_context.prev = _context.next) {
|
|
30
|
+
case 0:
|
|
31
|
+
if (!BalmJS.utils.isFunction(BalmJS.afterTask)) {
|
|
36
32
|
_context.next = 3;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
_context.next = 3;
|
|
36
|
+
return BalmJS.afterTask();
|
|
37
|
+
case 3:
|
|
38
|
+
_this.time();
|
|
39
|
+
BalmJS.emitter.emit('exit');
|
|
40
|
+
callback();
|
|
41
|
+
case 6:
|
|
42
|
+
case "end":
|
|
43
|
+
return _context.stop();
|
|
46
44
|
}
|
|
47
45
|
}, _callee);
|
|
48
46
|
}));
|
|
@@ -14,7 +14,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
15
|
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
16
|
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
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
17
|
+
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; }
|
|
18
18
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
19
19
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
20
20
|
var ExtraTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
@@ -15,7 +15,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
15
15
|
var _imagemin = require("../../plugins/imagemin");
|
|
16
16
|
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; } } }; }
|
|
17
17
|
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
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
18
|
+
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
19
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
20
20
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
21
21
|
var ImageTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
@@ -72,35 +72,33 @@ var ModernizrTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
|
72
72
|
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(callback) {
|
|
73
73
|
var _yield$Promise$all, _yield$Promise$all2, config;
|
|
74
74
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
75
|
-
while (1) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
_context.next = 11;
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
_context.next = 4;
|
|
84
|
-
return Promise.all([(0, _classPrivateFieldGet2["default"])((0, _assertThisInitialized2["default"])(_this), _readConfig).call((0, _assertThisInitialized2["default"])(_this)), (0, _classPrivateFieldGet2["default"])((0, _assertThisInitialized2["default"])(_this), _createDir).call((0, _assertThisInitialized2["default"])(_this))]);
|
|
85
|
-
case 4:
|
|
86
|
-
_yield$Promise$all = _context.sent;
|
|
87
|
-
_yield$Promise$all2 = (0, _slicedToArray2["default"])(_yield$Promise$all, 1);
|
|
88
|
-
config = _yield$Promise$all2[0];
|
|
89
|
-
_context.next = 9;
|
|
90
|
-
return (0, _classPrivateFieldGet2["default"])((0, _assertThisInitialized2["default"])(_this), _generateScript).call((0, _assertThisInitialized2["default"])(_this), config);
|
|
91
|
-
case 9:
|
|
92
|
-
_context.next = 12;
|
|
75
|
+
while (1) switch (_context.prev = _context.next) {
|
|
76
|
+
case 0:
|
|
77
|
+
_this.init();
|
|
78
|
+
if (!_fs["default"].existsSync(_this.input)) {
|
|
79
|
+
_context.next = 11;
|
|
93
80
|
break;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
81
|
+
}
|
|
82
|
+
_context.next = 4;
|
|
83
|
+
return Promise.all([(0, _classPrivateFieldGet2["default"])((0, _assertThisInitialized2["default"])(_this), _readConfig).call((0, _assertThisInitialized2["default"])(_this)), (0, _classPrivateFieldGet2["default"])((0, _assertThisInitialized2["default"])(_this), _createDir).call((0, _assertThisInitialized2["default"])(_this))]);
|
|
84
|
+
case 4:
|
|
85
|
+
_yield$Promise$all = _context.sent;
|
|
86
|
+
_yield$Promise$all2 = (0, _slicedToArray2["default"])(_yield$Promise$all, 1);
|
|
87
|
+
config = _yield$Promise$all2[0];
|
|
88
|
+
_context.next = 9;
|
|
89
|
+
return (0, _classPrivateFieldGet2["default"])((0, _assertThisInitialized2["default"])(_this), _generateScript).call((0, _assertThisInitialized2["default"])(_this), config);
|
|
90
|
+
case 9:
|
|
91
|
+
_context.next = 12;
|
|
92
|
+
break;
|
|
93
|
+
case 11:
|
|
94
|
+
BalmJS.logger.warn("".concat(_this.name, " task"), "The '".concat(_this.input, "' does not exist"), {
|
|
95
|
+
logLevel: BalmJS.LogLevel.Info
|
|
96
|
+
});
|
|
97
|
+
case 12:
|
|
98
|
+
callback();
|
|
99
|
+
case 13:
|
|
100
|
+
case "end":
|
|
101
|
+
return _context.stop();
|
|
104
102
|
}
|
|
105
103
|
}, _callee);
|
|
106
104
|
}));
|
|
@@ -100,7 +100,7 @@ var SpriteTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
|
100
100
|
folderName: spriteName
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
-
var _loop = function _loop(
|
|
103
|
+
var _loop = function _loop() {
|
|
104
104
|
var spriteItem = spriteList[key];
|
|
105
105
|
var spriteTaskName = "".concat(_this2.name, ":").concat(spriteItem.folderName); // E.g. 'sprite:awesome'
|
|
106
106
|
var spriteConfig = {
|
|
@@ -124,7 +124,7 @@ var SpriteTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
|
124
124
|
(0, _classPrivateFieldGet2["default"])(_this2, _tasks).push(spriteTaskName);
|
|
125
125
|
};
|
|
126
126
|
for (var key = 0, len = spriteList.length; key < len; key++) {
|
|
127
|
-
_loop(
|
|
127
|
+
_loop();
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
}, {
|
|
@@ -26,22 +26,20 @@ var StartTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
|
26
26
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "fn", /*#__PURE__*/function () {
|
|
27
27
|
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(callback) {
|
|
28
28
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
29
|
-
while (1) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (!BalmJS.utils.isFunction(BalmJS.beforeTask)) {
|
|
34
|
-
_context.next = 4;
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
29
|
+
while (1) switch (_context.prev = _context.next) {
|
|
30
|
+
case 0:
|
|
31
|
+
BalmJS.start = process.hrtime();
|
|
32
|
+
if (!BalmJS.utils.isFunction(BalmJS.beforeTask)) {
|
|
37
33
|
_context.next = 4;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
_context.next = 4;
|
|
37
|
+
return BalmJS.beforeTask();
|
|
38
|
+
case 4:
|
|
39
|
+
callback();
|
|
40
|
+
case 5:
|
|
41
|
+
case "end":
|
|
42
|
+
return _context.stop();
|
|
45
43
|
}
|
|
46
44
|
}, _callee);
|
|
47
45
|
}));
|
package/lib/tasks/public/pwa.js
CHANGED
|
@@ -41,62 +41,60 @@ var PwaTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
|
41
41
|
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(callback) {
|
|
42
42
|
var mode, options, globDirectory, swDest, swSrc, valid;
|
|
43
43
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
44
|
-
while (1) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
while (1) switch (_context.prev = _context.next) {
|
|
45
|
+
case 0:
|
|
46
|
+
mode = customMode || BalmJS.config.pwa.mode;
|
|
47
|
+
options = {};
|
|
48
|
+
globDirectory = BalmJS.config.dest.base;
|
|
49
|
+
swDest = BalmJS.file.absPath("".concat(globDirectory, "/").concat(BalmJS.config.pwa.swDestFilename));
|
|
50
|
+
swSrc = BalmJS.file.absPath("".concat(BalmJS.config.src.base, "/").concat(BalmJS.config.pwa.swSrcFilename));
|
|
51
|
+
valid = true;
|
|
52
|
+
_context.t0 = mode;
|
|
53
|
+
_context.next = _context.t0 === 'generateSW' ? 9 : _context.t0 === 'injectManifest' ? 11 : 13;
|
|
54
|
+
break;
|
|
55
|
+
case 9:
|
|
56
|
+
options = Object.assign({
|
|
57
|
+
globDirectory: globDirectory,
|
|
58
|
+
swDest: swDest
|
|
59
|
+
}, BalmJS.config.pwa.options, customOptions);
|
|
60
|
+
return _context.abrupt("break", 14);
|
|
61
|
+
case 11:
|
|
62
|
+
options = Object.assign({
|
|
63
|
+
globDirectory: globDirectory,
|
|
64
|
+
swDest: swDest,
|
|
65
|
+
swSrc: swSrc
|
|
66
|
+
}, BalmJS.config.pwa.options, customOptions);
|
|
67
|
+
return _context.abrupt("break", 14);
|
|
68
|
+
case 13:
|
|
69
|
+
valid = false;
|
|
70
|
+
case 14:
|
|
71
|
+
if (!valid) {
|
|
72
|
+
_context.next = 22;
|
|
55
73
|
break;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
_context.next = 19;
|
|
81
|
-
return require('workbox-build')[mode](options).then(function (_ref2) {
|
|
82
|
-
var count = _ref2.count,
|
|
83
|
-
size = _ref2.size;
|
|
84
|
-
BalmJS.logger.info("pwa - ".concat(mode), "Generated '".concat(swDest, "', which will precache ").concat(count, " files, totaling ").concat(size, " bytes"));
|
|
85
|
-
gulp.parallel(BalmJS.toNamespace('pwa-cache'))();
|
|
86
|
-
})["catch"](function (err) {
|
|
87
|
-
BalmJS.logger.warn("pwa - ".concat(mode), "Service worker generation failed: ".concat(err));
|
|
88
|
-
});
|
|
89
|
-
case 19:
|
|
90
|
-
callback();
|
|
91
|
-
_context.next = 24;
|
|
92
|
-
break;
|
|
93
|
-
case 22:
|
|
94
|
-
BalmJS.logger.warn('pwa task', 'Invalid PWA mode');
|
|
95
|
-
callback();
|
|
96
|
-
case 24:
|
|
97
|
-
case "end":
|
|
98
|
-
return _context.stop();
|
|
99
|
-
}
|
|
74
|
+
}
|
|
75
|
+
options = _this.setIgnores(options);
|
|
76
|
+
BalmJS.logger.debug("pwa - ".concat(mode), options, {
|
|
77
|
+
pre: true
|
|
78
|
+
});
|
|
79
|
+
_context.next = 19;
|
|
80
|
+
return require('workbox-build')[mode](options).then(function (_ref2) {
|
|
81
|
+
var count = _ref2.count,
|
|
82
|
+
size = _ref2.size;
|
|
83
|
+
BalmJS.logger.info("pwa - ".concat(mode), "Generated '".concat(swDest, "', which will precache ").concat(count, " files, totaling ").concat(size, " bytes"));
|
|
84
|
+
gulp.parallel(BalmJS.toNamespace('pwa-cache'))();
|
|
85
|
+
})["catch"](function (err) {
|
|
86
|
+
BalmJS.logger.warn("pwa - ".concat(mode), "Service worker generation failed: ".concat(err));
|
|
87
|
+
});
|
|
88
|
+
case 19:
|
|
89
|
+
callback();
|
|
90
|
+
_context.next = 24;
|
|
91
|
+
break;
|
|
92
|
+
case 22:
|
|
93
|
+
BalmJS.logger.warn('pwa task', 'Invalid PWA mode');
|
|
94
|
+
callback();
|
|
95
|
+
case 24:
|
|
96
|
+
case "end":
|
|
97
|
+
return _context.stop();
|
|
100
98
|
}
|
|
101
99
|
}, _callee);
|
|
102
100
|
}));
|
|
@@ -47,41 +47,39 @@ var RemoveTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
|
47
47
|
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(callback) {
|
|
48
48
|
var canDel, files, deletedPaths;
|
|
49
49
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
50
|
-
while (1) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
_context.next = 10;
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
files = (0, _classPrivateFieldGet2["default"])(_this2, _getFiles).call(_this2, input);
|
|
59
|
-
BalmJS.logger.debug("".concat(_this2.name, " task"), {
|
|
60
|
-
files: files
|
|
61
|
-
}, {
|
|
62
|
-
pre: true
|
|
63
|
-
});
|
|
64
|
-
_context.next = 6;
|
|
65
|
-
return require('del')(files, {
|
|
66
|
-
force: true
|
|
67
|
-
});
|
|
68
|
-
case 6:
|
|
69
|
-
deletedPaths = _context.sent;
|
|
70
|
-
BalmJS.logger.warn("".concat(_this2.name, " task"), {
|
|
71
|
-
deletedPaths: deletedPaths
|
|
72
|
-
}, {
|
|
73
|
-
pre: true
|
|
74
|
-
});
|
|
75
|
-
_context.next = 11;
|
|
50
|
+
while (1) switch (_context.prev = _context.next) {
|
|
51
|
+
case 0:
|
|
52
|
+
canDel = !!(BalmJS.utils.isString(input) && input.trim() || BalmJS.utils.isArray(input) && input.length);
|
|
53
|
+
if (!canDel) {
|
|
54
|
+
_context.next = 10;
|
|
76
55
|
break;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
56
|
+
}
|
|
57
|
+
files = (0, _classPrivateFieldGet2["default"])(_this2, _getFiles).call(_this2, input);
|
|
58
|
+
BalmJS.logger.debug("".concat(_this2.name, " task"), {
|
|
59
|
+
files: files
|
|
60
|
+
}, {
|
|
61
|
+
pre: true
|
|
62
|
+
});
|
|
63
|
+
_context.next = 6;
|
|
64
|
+
return require('del')(files, {
|
|
65
|
+
force: true
|
|
66
|
+
});
|
|
67
|
+
case 6:
|
|
68
|
+
deletedPaths = _context.sent;
|
|
69
|
+
BalmJS.logger.warn("".concat(_this2.name, " task"), {
|
|
70
|
+
deletedPaths: deletedPaths
|
|
71
|
+
}, {
|
|
72
|
+
pre: true
|
|
73
|
+
});
|
|
74
|
+
_context.next = 11;
|
|
75
|
+
break;
|
|
76
|
+
case 10:
|
|
77
|
+
BalmJS.logger.error("".concat(_this2.name, " task"), 'Invalid input');
|
|
78
|
+
case 11:
|
|
79
|
+
callback();
|
|
80
|
+
case 12:
|
|
81
|
+
case "end":
|
|
82
|
+
return _context.stop();
|
|
85
83
|
}
|
|
86
84
|
}, _callee);
|
|
87
85
|
}));
|
|
@@ -28,17 +28,15 @@ var RollupTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
|
|
|
28
28
|
var balmBundler = /*#__PURE__*/function () {
|
|
29
29
|
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(callback) {
|
|
30
30
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
31
|
-
while (1) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return _context.stop();
|
|
41
|
-
}
|
|
31
|
+
while (1) switch (_context.prev = _context.next) {
|
|
32
|
+
case 0:
|
|
33
|
+
_context.next = 2;
|
|
34
|
+
return (0, _rollup["default"])(input, output);
|
|
35
|
+
case 2:
|
|
36
|
+
callback();
|
|
37
|
+
case 3:
|
|
38
|
+
case "end":
|
|
39
|
+
return _context.stop();
|
|
42
40
|
}
|
|
43
41
|
}, _callee);
|
|
44
42
|
}));
|
package/lib/utilities/file.js
CHANGED
|
@@ -13,7 +13,7 @@ var _publicUrl = _interopRequireDefault(require("./public-url"));
|
|
|
13
13
|
var _constants = require("../config/constants");
|
|
14
14
|
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
15
|
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); }
|
|
16
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
16
|
+
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; }
|
|
17
17
|
// Make sure any symlinks in the project folder are resolved
|
|
18
18
|
var appDirectory = _fs["default"].realpathSync(process.cwd());
|
|
19
19
|
var resolveApp = function resolveApp(relativePath) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "balm-core",
|
|
3
|
-
"version": "3.30.
|
|
3
|
+
"version": "3.30.1",
|
|
4
4
|
"description": "BalmJS compiler core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"balm",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"async": "^3.2.4",
|
|
45
45
|
"autoprefixer": "9",
|
|
46
46
|
"babel-loader": "8",
|
|
47
|
-
"browser-sync": "^2.
|
|
47
|
+
"browser-sync": "^2.29.0",
|
|
48
48
|
"connect-history-api-fallback": "^2.0.0",
|
|
49
49
|
"css-loader": "5",
|
|
50
50
|
"cssnano": "4",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"ssh2": "0.8.9",
|
|
90
90
|
"strip-ansi": "6",
|
|
91
91
|
"style-loader": "2",
|
|
92
|
-
"terser": "^5.16.
|
|
92
|
+
"terser": "^5.16.6",
|
|
93
93
|
"terser-webpack-plugin": "4",
|
|
94
94
|
"through2": "^4.0.2",
|
|
95
95
|
"through2-concurrent": "^2.0.0",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"url-loader": "^4.1.1",
|
|
98
98
|
"vinyl-sourcemaps-apply": "^0.2.1",
|
|
99
99
|
"webpack": "4",
|
|
100
|
-
"webpack-bundle-analyzer": "^4.
|
|
100
|
+
"webpack-bundle-analyzer": "^4.8.0",
|
|
101
101
|
"webpack-dev-middleware": "3",
|
|
102
102
|
"webpack-hot-middleware": "^2.25.3",
|
|
103
103
|
"webpack-merge": "^5.8.0",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"engines": {
|
|
118
118
|
"node": ">=10.13.0"
|
|
119
119
|
},
|
|
120
|
-
"gitHead": "
|
|
120
|
+
"gitHead": "fd25a9b3407f40c3ca76d56b0f58c2b6f1b18b7b"
|
|
121
121
|
}
|