balm-core 3.26.2 → 3.27.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 +9 -9
- package/tslib/bundler/esbuild/transform.js +26 -19
- package/tslib/bundler/rollup/index.js +12 -5
|
@@ -1,31 +1,24 @@
|
|
|
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 _net = _interopRequireDefault(require("net"));
|
|
11
|
-
|
|
12
9
|
var _address = _interopRequireDefault(require("./address"));
|
|
13
|
-
|
|
14
10
|
var UTIL_NAME = 'detect port';
|
|
15
11
|
var MAX_PORT = 65535;
|
|
16
|
-
|
|
17
12
|
function listen(port, host, callback) {
|
|
18
13
|
var server = new _net["default"].Server();
|
|
19
14
|
server.on('error', function (error) {
|
|
20
15
|
server.close();
|
|
21
|
-
|
|
22
16
|
if (error.code === 'ENOTFOUND') {
|
|
23
17
|
BalmJS.logger.error(UTIL_NAME, "ignore dns ENOTFOUND error, get free ".concat(host, ":").concat(port), {
|
|
24
18
|
logLevel: BalmJS.LogLevel.Debug
|
|
25
19
|
});
|
|
26
20
|
return callback(null, port);
|
|
27
21
|
}
|
|
28
|
-
|
|
29
22
|
return callback(error);
|
|
30
23
|
});
|
|
31
24
|
server.listen(port, host, function () {
|
|
@@ -35,7 +28,6 @@ function listen(port, host, callback) {
|
|
|
35
28
|
return callback(null, port);
|
|
36
29
|
});
|
|
37
30
|
}
|
|
38
|
-
|
|
39
31
|
function tryListen(port, maxPort, host, callback) {
|
|
40
32
|
function handleError(err) {
|
|
41
33
|
if (err) {
|
|
@@ -43,9 +35,7 @@ function tryListen(port, maxPort, host, callback) {
|
|
|
43
35
|
logLevel: BalmJS.LogLevel.Debug
|
|
44
36
|
});
|
|
45
37
|
}
|
|
46
|
-
|
|
47
38
|
port++;
|
|
48
|
-
|
|
49
39
|
if (port >= maxPort) {
|
|
50
40
|
BalmJS.logger.warn(UTIL_NAME, "port: ".concat(port, " >= maxPort: ").concat(maxPort, ", give up and use random port"), {
|
|
51
41
|
logLevel: BalmJS.LogLevel.Debug
|
|
@@ -53,20 +43,16 @@ function tryListen(port, maxPort, host, callback) {
|
|
|
53
43
|
port = 0;
|
|
54
44
|
maxPort = 0;
|
|
55
45
|
}
|
|
56
|
-
|
|
57
46
|
tryListen(port, maxPort, host, callback);
|
|
58
47
|
}
|
|
59
|
-
|
|
60
48
|
if (host) {
|
|
61
49
|
listen(port, host, function (error, realPort) {
|
|
62
50
|
if (error) {
|
|
63
51
|
if (error.code === 'EADDRNOTAVAIL') {
|
|
64
52
|
return callback(new Error('the ip that is not unkonwn on the machine'));
|
|
65
53
|
}
|
|
66
|
-
|
|
67
54
|
return handleError();
|
|
68
55
|
}
|
|
69
|
-
|
|
70
56
|
callback(null, realPort);
|
|
71
57
|
});
|
|
72
58
|
} else {
|
|
@@ -76,31 +62,29 @@ function tryListen(port, maxPort, host, callback) {
|
|
|
76
62
|
if (port === 0) {
|
|
77
63
|
return callback(error, realPort);
|
|
78
64
|
}
|
|
79
|
-
|
|
80
65
|
if (error) {
|
|
81
66
|
return handleError(error);
|
|
82
|
-
}
|
|
83
|
-
|
|
67
|
+
}
|
|
84
68
|
|
|
69
|
+
// 2. check 0.0.0.0
|
|
85
70
|
listen(port, '0.0.0.0', function (error) {
|
|
86
71
|
if (error) {
|
|
87
72
|
return handleError(error);
|
|
88
|
-
}
|
|
89
|
-
|
|
73
|
+
}
|
|
90
74
|
|
|
75
|
+
// 3. check localhost
|
|
91
76
|
listen(port, 'localhost', function (error) {
|
|
92
77
|
// if localhost refer to the ip that is not unkonwn on the machine, you will see the error EADDRNOTAVAIL
|
|
93
78
|
// https://stackoverflow.com/questions/10809740/listen-eaddrnotavail-error-in-node-js
|
|
94
79
|
if (error && error.code !== 'EADDRNOTAVAIL') {
|
|
95
80
|
return handleError(error);
|
|
96
|
-
}
|
|
97
|
-
|
|
81
|
+
}
|
|
98
82
|
|
|
83
|
+
// 4. check current ip
|
|
99
84
|
listen(port, _address["default"].ip(), function (error, realPort) {
|
|
100
85
|
if (error) {
|
|
101
86
|
return handleError(error);
|
|
102
87
|
}
|
|
103
|
-
|
|
104
88
|
callback(null, realPort);
|
|
105
89
|
});
|
|
106
90
|
});
|
|
@@ -108,14 +92,11 @@ function tryListen(port, maxPort, host, callback) {
|
|
|
108
92
|
});
|
|
109
93
|
}
|
|
110
94
|
}
|
|
111
|
-
|
|
112
95
|
function detectPort(port, host) {
|
|
113
96
|
var maxPort = port + 10;
|
|
114
|
-
|
|
115
97
|
if (maxPort > MAX_PORT) {
|
|
116
98
|
maxPort = MAX_PORT;
|
|
117
99
|
}
|
|
118
|
-
|
|
119
100
|
BalmJS.logger.debug(UTIL_NAME, "detect free port between [".concat(port, ", ").concat(maxPort, "]"));
|
|
120
101
|
return new Promise(function (resolve) {
|
|
121
102
|
tryListen(port, maxPort, host, function (error, realPort) {
|
|
@@ -123,6 +104,5 @@ function detectPort(port, host) {
|
|
|
123
104
|
});
|
|
124
105
|
});
|
|
125
106
|
}
|
|
126
|
-
|
|
127
107
|
var _default = detectPort;
|
|
128
108
|
exports["default"] = _default;
|
|
@@ -4,16 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var escapeStringRegexp = function escapeStringRegexp(str) {
|
|
9
8
|
if (typeof str !== 'string') {
|
|
10
9
|
throw new TypeError('Expected a string');
|
|
11
|
-
}
|
|
12
|
-
// Use a simple backslash escape when it’s always valid, and a \unnnn escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
|
|
13
|
-
|
|
10
|
+
}
|
|
14
11
|
|
|
12
|
+
// Escape characters with special meaning either inside or outside character sets.
|
|
13
|
+
// Use a simple backslash escape when it’s always valid, and a \unnnn escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
|
|
15
14
|
return str.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d');
|
|
16
15
|
};
|
|
17
|
-
|
|
18
16
|
var _default = escapeStringRegexp;
|
|
19
17
|
exports["default"] = _default;
|
package/lib/utilities/file.js
CHANGED
|
@@ -1,42 +1,28 @@
|
|
|
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 _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
-
|
|
12
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
-
|
|
14
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
-
|
|
16
11
|
var _fs = _interopRequireDefault(require("fs"));
|
|
17
|
-
|
|
18
12
|
var _publicUrl = _interopRequireDefault(require("./public-url"));
|
|
19
|
-
|
|
20
13
|
var _constants = require("../config/constants");
|
|
21
|
-
|
|
22
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; } } }; }
|
|
23
|
-
|
|
24
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); }
|
|
25
|
-
|
|
26
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; }
|
|
27
|
-
|
|
28
17
|
// Make sure any symlinks in the project folder are resolved
|
|
29
18
|
var appDirectory = _fs["default"].realpathSync(process.cwd());
|
|
30
|
-
|
|
31
19
|
var resolveApp = function resolveApp(relativePath) {
|
|
32
20
|
return path.resolve(appDirectory, relativePath);
|
|
33
21
|
};
|
|
34
|
-
|
|
35
22
|
var File = /*#__PURE__*/function () {
|
|
36
23
|
function File() {
|
|
37
24
|
(0, _classCallCheck2["default"])(this, File);
|
|
38
25
|
}
|
|
39
|
-
|
|
40
26
|
(0, _createClass2["default"])(File, [{
|
|
41
27
|
key: "publicUrlOrPath",
|
|
42
28
|
get: function get() {
|
|
@@ -46,7 +32,8 @@ var File = /*#__PURE__*/function () {
|
|
|
46
32
|
// single-page apps that may serve index.html for nested URLs like /todos/42.
|
|
47
33
|
// We can't use a relative path in HTML because we don't want to load something
|
|
48
34
|
// like /todos/42/static/js/bundle.7289d.js. We have to know the root.
|
|
49
|
-
return (0, _publicUrl["default"])(
|
|
35
|
+
return (0, _publicUrl["default"])(
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
50
37
|
require(resolveApp('package.json')).homepage, process.env.PUBLIC_URL);
|
|
51
38
|
}
|
|
52
39
|
}, {
|
|
@@ -79,18 +66,14 @@ var File = /*#__PURE__*/function () {
|
|
|
79
66
|
key: "absPaths",
|
|
80
67
|
value: function absPaths(_paths) {
|
|
81
68
|
var paths;
|
|
82
|
-
|
|
83
69
|
if (BalmJS.utils.isArray(_paths)) {
|
|
84
70
|
paths = [];
|
|
85
|
-
|
|
86
71
|
var _iterator = _createForOfIteratorHelper(_paths),
|
|
87
|
-
|
|
88
|
-
|
|
72
|
+
_step;
|
|
89
73
|
try {
|
|
90
74
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
91
75
|
var _path = _step.value;
|
|
92
76
|
var result = /^!(.+)$/.exec(_path);
|
|
93
|
-
|
|
94
77
|
if (result) {
|
|
95
78
|
paths.push('!' + this.absPath(result[1]));
|
|
96
79
|
} else {
|
|
@@ -105,7 +88,6 @@ var File = /*#__PURE__*/function () {
|
|
|
105
88
|
} else {
|
|
106
89
|
paths = this.absPath(_paths);
|
|
107
90
|
}
|
|
108
|
-
|
|
109
91
|
return paths;
|
|
110
92
|
}
|
|
111
93
|
}, {
|
|
@@ -134,7 +116,5 @@ var File = /*#__PURE__*/function () {
|
|
|
134
116
|
}]);
|
|
135
117
|
return File;
|
|
136
118
|
}();
|
|
137
|
-
|
|
138
119
|
var _default = new File();
|
|
139
|
-
|
|
140
120
|
exports["default"] = _default;
|
package/lib/utilities/index.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _utils = _interopRequireDefault(require("./utils"));
|
|
6
|
-
|
|
7
5
|
var _logger = _interopRequireDefault(require("./logger"));
|
|
8
|
-
|
|
9
6
|
var _file = _interopRequireDefault(require("./file"));
|
|
10
|
-
|
|
11
7
|
var _namespace = _interopRequireDefault(require("./namespace"));
|
|
12
|
-
|
|
13
8
|
BalmJS.utils = _utils["default"];
|
|
14
9
|
BalmJS.logger = _logger["default"];
|
|
15
10
|
BalmJS.file = _file["default"];
|
package/lib/utilities/loading.js
CHANGED
|
@@ -1,63 +1,43 @@
|
|
|
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 _classPrivateFieldSet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldSet"));
|
|
15
|
-
|
|
16
11
|
var _classPrivateFieldGet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldGet"));
|
|
17
|
-
|
|
18
12
|
var _readline = _interopRequireDefault(require("readline"));
|
|
19
|
-
|
|
20
13
|
var _spinner = _interopRequireDefault(require("../config/spinner"));
|
|
21
|
-
|
|
22
14
|
var _version = _interopRequireDefault(require("../config/version"));
|
|
23
|
-
|
|
24
15
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
25
|
-
|
|
26
16
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
27
|
-
|
|
28
17
|
var _stream = /*#__PURE__*/new WeakMap();
|
|
29
|
-
|
|
30
18
|
var _frameIndex = /*#__PURE__*/new WeakMap();
|
|
31
|
-
|
|
32
19
|
var _frameCount = /*#__PURE__*/new WeakMap();
|
|
33
|
-
|
|
34
20
|
var BalmLoading = /*#__PURE__*/function () {
|
|
35
21
|
function BalmLoading() {
|
|
36
22
|
(0, _classCallCheck2["default"])(this, BalmLoading);
|
|
37
|
-
|
|
38
23
|
_classPrivateFieldInitSpec(this, _stream, {
|
|
39
24
|
writable: true,
|
|
40
25
|
value: process.stderr
|
|
41
26
|
});
|
|
42
|
-
|
|
43
27
|
_classPrivateFieldInitSpec(this, _frameIndex, {
|
|
44
28
|
writable: true,
|
|
45
29
|
value: 0
|
|
46
30
|
});
|
|
47
|
-
|
|
48
31
|
_classPrivateFieldInitSpec(this, _frameCount, {
|
|
49
32
|
writable: true,
|
|
50
33
|
value: _spinner["default"].frames.length
|
|
51
34
|
});
|
|
52
35
|
}
|
|
53
|
-
|
|
54
36
|
(0, _createClass2["default"])(BalmLoading, [{
|
|
55
37
|
key: "frame",
|
|
56
38
|
get: function get() {
|
|
57
39
|
var _this$frameIndex;
|
|
58
|
-
|
|
59
40
|
var currentFrame = _spinner["default"].frames[(0, _classPrivateFieldGet2["default"])(this, _frameIndex)];
|
|
60
|
-
|
|
61
41
|
(0, _classPrivateFieldSet2["default"])(this, _frameIndex, (0, _classPrivateFieldSet2["default"])(this, _frameIndex, (_this$frameIndex = (0, _classPrivateFieldGet2["default"])(this, _frameIndex), ++_this$frameIndex)) % (0, _classPrivateFieldGet2["default"])(this, _frameCount));
|
|
62
42
|
return currentFrame;
|
|
63
43
|
}
|
|
@@ -66,7 +46,6 @@ var BalmLoading = /*#__PURE__*/function () {
|
|
|
66
46
|
value: function clear() {
|
|
67
47
|
// Compatibility on Windows
|
|
68
48
|
_readline["default"].clearLine((0, _classPrivateFieldGet2["default"])(this, _stream), 0);
|
|
69
|
-
|
|
70
49
|
_readline["default"].cursorTo((0, _classPrivateFieldGet2["default"])(this, _stream), 0);
|
|
71
50
|
}
|
|
72
51
|
}, {
|
|
@@ -85,7 +64,5 @@ var BalmLoading = /*#__PURE__*/function () {
|
|
|
85
64
|
}]);
|
|
86
65
|
return BalmLoading;
|
|
87
66
|
}();
|
|
88
|
-
|
|
89
67
|
var _default = new BalmLoading();
|
|
90
|
-
|
|
91
68
|
exports["default"] = _default;
|
package/lib/utilities/logger.js
CHANGED
|
@@ -1,28 +1,18 @@
|
|
|
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 _util = _interopRequireDefault(require("util"));
|
|
17
|
-
|
|
18
12
|
var _fancyLog = _interopRequireDefault(require("fancy-log"));
|
|
19
|
-
|
|
20
13
|
var _color = _interopRequireDefault(require("./color"));
|
|
21
|
-
|
|
22
14
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
23
|
-
|
|
24
15
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
25
|
-
|
|
26
16
|
var LOG = {
|
|
27
17
|
FORMAT: '%s %s %s',
|
|
28
18
|
PREFIX: (0, _color["default"])('BalmJS', {
|
|
@@ -58,13 +48,10 @@ var LOG = {
|
|
|
58
48
|
beginning: '$'.padStart(36, '*'),
|
|
59
49
|
end: '^'.padEnd(36, '.')
|
|
60
50
|
};
|
|
61
|
-
|
|
62
51
|
var _log = /*#__PURE__*/new WeakMap();
|
|
63
|
-
|
|
64
52
|
var Logger = /*#__PURE__*/function () {
|
|
65
53
|
function Logger() {
|
|
66
54
|
(0, _classCallCheck2["default"])(this, Logger);
|
|
67
|
-
|
|
68
55
|
_classPrivateFieldInitSpec(this, _log, {
|
|
69
56
|
writable: true,
|
|
70
57
|
value: function value(obj) {
|
|
@@ -78,7 +65,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
78
65
|
}
|
|
79
66
|
});
|
|
80
67
|
}
|
|
81
|
-
|
|
82
68
|
(0, _createClass2["default"])(Logger, [{
|
|
83
69
|
key: "success",
|
|
84
70
|
value: function success(label, message) {
|
|
@@ -86,7 +72,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
86
72
|
var logOptions = Object.assign({
|
|
87
73
|
logLevel: BalmJS.LogLevel.Trace
|
|
88
74
|
}, options);
|
|
89
|
-
|
|
90
75
|
if (BalmJS.config.logs.level <= logOptions.logLevel) {
|
|
91
76
|
console.log(LOG.beginning);
|
|
92
77
|
(0, _fancyLog["default"])(LOG.FORMAT, LOG.PREFIX, (0, _color["default"])("<".concat(label, ">"), LOG.OK), (0, _classPrivateFieldGet2["default"])(this, _log).call(this, message, logOptions.pre));
|
|
@@ -100,7 +85,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
100
85
|
var logOptions = Object.assign({
|
|
101
86
|
logLevel: BalmJS.LogLevel.Debug
|
|
102
87
|
}, options);
|
|
103
|
-
|
|
104
88
|
if (BalmJS.config.logs.level <= logOptions.logLevel) {
|
|
105
89
|
_fancyLog["default"].info(LOG.FORMAT, LOG.PREFIX, (0, _color["default"])("<".concat(label, ">"), LOG.DEBUG), (0, _classPrivateFieldGet2["default"])(this, _log).call(this, message, logOptions.pre));
|
|
106
90
|
}
|
|
@@ -112,7 +96,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
112
96
|
var logOptions = Object.assign({
|
|
113
97
|
logLevel: BalmJS.LogLevel.Info
|
|
114
98
|
}, options);
|
|
115
|
-
|
|
116
99
|
if (BalmJS.config.logs.level <= logOptions.logLevel) {
|
|
117
100
|
_fancyLog["default"].info(LOG.FORMAT, LOG.PREFIX, (0, _color["default"])("<".concat(label, ">"), LOG.INFO), (0, _classPrivateFieldGet2["default"])(this, _log).call(this, message, logOptions.pre));
|
|
118
101
|
}
|
|
@@ -124,7 +107,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
124
107
|
var logOptions = Object.assign({
|
|
125
108
|
logLevel: BalmJS.LogLevel.Warn
|
|
126
109
|
}, options);
|
|
127
|
-
|
|
128
110
|
if (BalmJS.config.logs.level <= logOptions.logLevel) {
|
|
129
111
|
_fancyLog["default"].warn(LOG.FORMAT, LOG.PREFIX, (0, _color["default"])("<".concat(label, ">"), LOG.WARN), (0, _classPrivateFieldGet2["default"])(this, _log).call(this, message, logOptions.pre));
|
|
130
112
|
}
|
|
@@ -137,7 +119,6 @@ var Logger = /*#__PURE__*/function () {
|
|
|
137
119
|
logLevel: BalmJS.LogLevel.Error,
|
|
138
120
|
pre: false
|
|
139
121
|
}, options);
|
|
140
|
-
|
|
141
122
|
if (BalmJS.config.logs.level <= logOptions.logLevel) {
|
|
142
123
|
_fancyLog["default"].error(LOG.FORMAT, LOG.PREFIX, (0, _color["default"])("<".concat(label, ">"), LOG.ERROR), (0, _classPrivateFieldGet2["default"])(this, _log).call(this, message, logOptions.pre));
|
|
143
124
|
}
|
|
@@ -145,7 +126,5 @@ var Logger = /*#__PURE__*/function () {
|
|
|
145
126
|
}]);
|
|
146
127
|
return Logger;
|
|
147
128
|
}();
|
|
148
|
-
|
|
149
129
|
var _default = new Logger();
|
|
150
|
-
|
|
151
130
|
exports["default"] = _default;
|
|
@@ -4,32 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _stream = require("stream");
|
|
9
|
-
|
|
10
8
|
function mergeStream() {
|
|
11
9
|
var sources = [];
|
|
12
10
|
var output = new _stream.PassThrough({
|
|
13
11
|
objectMode: true
|
|
14
12
|
});
|
|
15
13
|
output.setMaxListeners(0);
|
|
16
|
-
|
|
17
14
|
function remove(source) {
|
|
18
15
|
sources = sources.filter(function (it) {
|
|
19
16
|
return it !== source;
|
|
20
17
|
});
|
|
21
|
-
|
|
22
18
|
if (!sources.length && output.readable) {
|
|
23
19
|
output.end();
|
|
24
20
|
}
|
|
25
21
|
}
|
|
26
|
-
|
|
27
22
|
function add(source) {
|
|
28
23
|
if (Array.isArray(source)) {
|
|
29
24
|
source.forEach(add);
|
|
30
25
|
return this;
|
|
31
26
|
}
|
|
32
|
-
|
|
33
27
|
sources.push(source);
|
|
34
28
|
source.once('end', remove.bind(null, source));
|
|
35
29
|
source.once('error', output.emit.bind(output, 'error'));
|
|
@@ -38,22 +32,17 @@ function mergeStream() {
|
|
|
38
32
|
});
|
|
39
33
|
return this;
|
|
40
34
|
}
|
|
41
|
-
|
|
42
35
|
function isEmpty() {
|
|
43
36
|
return sources.length == 0;
|
|
44
37
|
}
|
|
45
|
-
|
|
46
38
|
output.add = add;
|
|
47
39
|
output.isEmpty = isEmpty;
|
|
48
40
|
output.on('unpipe', remove);
|
|
49
|
-
|
|
50
41
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
51
42
|
args[_key] = arguments[_key];
|
|
52
43
|
}
|
|
53
|
-
|
|
54
44
|
[].concat(args).slice().forEach(add);
|
|
55
45
|
return output;
|
|
56
46
|
}
|
|
57
|
-
|
|
58
47
|
var _default = mergeStream;
|
|
59
48
|
exports["default"] = _default;
|
|
@@ -5,10 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var NAMESPACE = 'balm';
|
|
8
|
-
|
|
9
8
|
function toNamespace(taskName) {
|
|
10
9
|
var result = 'unknown';
|
|
11
|
-
|
|
12
10
|
if (BalmJS.utils.isArray(taskName)) {
|
|
13
11
|
result = taskName.map(function (name) {
|
|
14
12
|
return "".concat(NAMESPACE, ":").concat(name);
|
|
@@ -16,9 +14,7 @@ function toNamespace(taskName) {
|
|
|
16
14
|
} else {
|
|
17
15
|
result = "".concat(NAMESPACE, ":").concat(taskName);
|
|
18
16
|
}
|
|
19
|
-
|
|
20
17
|
return result;
|
|
21
18
|
}
|
|
22
|
-
|
|
23
19
|
var _default = toNamespace;
|
|
24
20
|
exports["default"] = _default;
|
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _url = require("url");
|
|
9
|
-
|
|
10
8
|
var _constants = require("../config/constants");
|
|
11
|
-
|
|
12
9
|
/**
|
|
13
10
|
* Returns a URL or a path with slash at the end
|
|
14
11
|
* In production can be URL, absolute path, relative path
|
|
@@ -17,30 +14,30 @@ var _constants = require("../config/constants");
|
|
|
17
14
|
*/
|
|
18
15
|
function getPublicUrlOrPath(homepage, envPublicUrl) {
|
|
19
16
|
var stubDomain = _constants.DOMAIN;
|
|
20
|
-
|
|
21
17
|
if (envPublicUrl) {
|
|
22
18
|
// ensure last slash exists
|
|
23
|
-
envPublicUrl = envPublicUrl.endsWith('/') ? envPublicUrl : envPublicUrl + '/';
|
|
24
|
-
// `stubDomain` is ignored if `envPublicUrl` contains a domain
|
|
19
|
+
envPublicUrl = envPublicUrl.endsWith('/') ? envPublicUrl : envPublicUrl + '/';
|
|
25
20
|
|
|
21
|
+
// validate if `envPublicUrl` is a URL or path like
|
|
22
|
+
// `stubDomain` is ignored if `envPublicUrl` contains a domain
|
|
26
23
|
var validPublicUrl = new _url.URL(envPublicUrl, stubDomain);
|
|
27
|
-
return BalmJS.config.env.isDev ? envPublicUrl.startsWith('.') ? '/' : validPublicUrl.pathname :
|
|
24
|
+
return BalmJS.config.env.isDev ? envPublicUrl.startsWith('.') ? '/' : validPublicUrl.pathname :
|
|
25
|
+
// Some apps do not use client-side routing with pushState.
|
|
28
26
|
// For these, "homepage" can be set to "." to enable relative asset paths.
|
|
29
27
|
envPublicUrl;
|
|
30
28
|
}
|
|
31
|
-
|
|
32
29
|
if (homepage) {
|
|
33
30
|
// strip last slash if exists
|
|
34
|
-
homepage = homepage.endsWith('/') ? homepage : homepage + '/';
|
|
31
|
+
homepage = homepage.endsWith('/') ? homepage : homepage + '/';
|
|
35
32
|
|
|
33
|
+
// validate if `homepage` is a URL or path like and use just pathname
|
|
36
34
|
var validHomepagePathname = new _url.URL(homepage, stubDomain).pathname;
|
|
37
|
-
return BalmJS.config.env.isDev ? homepage.startsWith('.') ? '/' : validHomepagePathname :
|
|
35
|
+
return BalmJS.config.env.isDev ? homepage.startsWith('.') ? '/' : validHomepagePathname :
|
|
36
|
+
// Some apps do not use client-side routing with pushState.
|
|
38
37
|
// For these, "homepage" can be set to "." to enable relative asset paths.
|
|
39
38
|
homepage.startsWith('.') ? homepage : validHomepagePathname;
|
|
40
39
|
}
|
|
41
|
-
|
|
42
40
|
return '/';
|
|
43
41
|
}
|
|
44
|
-
|
|
45
42
|
var _default = getPublicUrlOrPath;
|
|
46
43
|
exports["default"] = _default;
|