balm-core 4.27.2 → 4.29.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/README.md +1 -1
- package/index.d.ts +2 -5
- package/lib/balm.js +8 -13
- package/lib/bundler/webpack/config/env.js +1 -1
- package/lib/config/server.js +11 -18
- package/lib/middlewares/proxy.js +9 -21
- package/lib/plugins/replace.js +1 -1
- package/lib/tasks/foundation/balm.js +1 -1
- package/lib/tasks/private/build.js +1 -1
- package/lib/tasks/private/cache.js +1 -1
- package/lib/tasks/private/clean.js +7 -11
- package/lib/tasks/private/end.js +1 -1
- package/lib/tasks/private/extra.js +1 -1
- package/lib/tasks/private/font.js +1 -1
- package/lib/tasks/private/image.js +1 -1
- package/lib/tasks/private/lint.js +1 -1
- package/lib/tasks/private/media.js +1 -1
- package/lib/tasks/private/modernizr.js +26 -36
- package/lib/tasks/private/pwa-cache.js +1 -1
- package/lib/tasks/private/sprite.js +39 -46
- package/lib/tasks/private/start.js +1 -1
- package/lib/tasks/private/workbox-sw.js +1 -1
- package/lib/tasks/public/html.js +22 -29
- package/lib/tasks/public/publish.js +11 -15
- package/lib/tasks/public/remove.js +8 -12
- package/lib/tasks/public/server.js +33 -40
- package/lib/tasks/public/url.js +14 -18
- package/lib/utilities/compiling.js +7 -12
- package/lib/utilities/loading.js +11 -22
- package/lib/utilities/logger.js +14 -18
- package/package.json +21 -21
- package/tslib/config/server.js +2 -2
- package/tslib/middlewares/proxy.js +9 -23
package/lib/tasks/public/html.js
CHANGED
|
@@ -1,37 +1,30 @@
|
|
|
1
1
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
2
2
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
3
|
-
function _classPrivateFieldGet(
|
|
4
|
-
function
|
|
5
|
-
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
|
3
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
4
|
+
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
6
5
|
import { PUBLIC_URL } from '../../config/constants.js';
|
|
7
6
|
var _updateAssetsPath = /*#__PURE__*/new WeakMap();
|
|
8
7
|
var _hasSourcePath = /*#__PURE__*/new WeakMap();
|
|
9
8
|
class HtmlTask extends BalmJS.BalmTask {
|
|
10
9
|
constructor() {
|
|
11
10
|
super('html');
|
|
12
|
-
_classPrivateFieldInitSpec(this, _updateAssetsPath, {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
27
|
-
return BalmJS.plugins.replace(assetsPathSrc, assetsPathDest);
|
|
28
|
-
}
|
|
11
|
+
_classPrivateFieldInitSpec(this, _updateAssetsPath, type => {
|
|
12
|
+
const isManifest = type === 'manifest';
|
|
13
|
+
const assetsType = isManifest ? 'img' : type;
|
|
14
|
+
const from = BalmJS.config.paths.source[assetsType];
|
|
15
|
+
const to = BalmJS.file.assetsPath(BalmJS.config.paths.target[assetsType]);
|
|
16
|
+
const assetsPathSrc = new RegExp(isManifest ? `/?${from}` : `${PUBLIC_URL}/${from}`, 'g');
|
|
17
|
+
const assetsPathDest = `${PUBLIC_URL}/${to}`;
|
|
18
|
+
BalmJS.logger.debug(`${this.name} task - assets path`, {
|
|
19
|
+
regex: assetsPathSrc,
|
|
20
|
+
replacement: assetsPathDest
|
|
21
|
+
}, {
|
|
22
|
+
pre: true
|
|
23
|
+
});
|
|
24
|
+
return BalmJS.plugins.replace(assetsPathSrc, assetsPathDest);
|
|
29
25
|
});
|
|
30
|
-
_classPrivateFieldInitSpec(this, _hasSourcePath, {
|
|
31
|
-
|
|
32
|
-
value: type => {
|
|
33
|
-
return !!BalmJS.config.paths.source[type];
|
|
34
|
-
}
|
|
26
|
+
_classPrivateFieldInitSpec(this, _hasSourcePath, type => {
|
|
27
|
+
return !!BalmJS.config.paths.source[type];
|
|
35
28
|
});
|
|
36
29
|
this.defaultInput = [node.path.join(BalmJS.file.templateBasePath, '*.html'), node.path.join(BalmJS.file.templateBasePath, BalmJS.config.pwa.manifest)];
|
|
37
30
|
this.defaultOutput = BalmJS.config.dest.base;
|
|
@@ -46,17 +39,17 @@ class HtmlTask extends BalmJS.BalmTask {
|
|
|
46
39
|
searchPath: [BalmJS.config.roots.tmp, BalmJS.config.roots.source, '.']
|
|
47
40
|
})).pipe($.if(/\.html$/, BalmJS.plugins.htmlmin(BalmJS.config.html.options)));
|
|
48
41
|
['css', 'js', 'img', 'media', 'manifest'].forEach(type => {
|
|
49
|
-
const canUpdate = type === 'manifest' ? BalmJS.config.pwa.enabled : _classPrivateFieldGet(
|
|
42
|
+
const canUpdate = type === 'manifest' ? BalmJS.config.pwa.enabled : _classPrivateFieldGet(_hasSourcePath, this).call(this, type);
|
|
50
43
|
if (canUpdate) {
|
|
51
|
-
stream = stream.pipe(_classPrivateFieldGet(
|
|
44
|
+
stream = stream.pipe(_classPrivateFieldGet(_updateAssetsPath, this).call(this, type));
|
|
52
45
|
}
|
|
53
46
|
});
|
|
54
47
|
stream = BalmJS.config.assets.cache ? stream.pipe($.if(BalmJS.config.pwa.manifest, BalmJS.file.setPublicPath())) : stream.pipe(BalmJS.file.setPublicPath());
|
|
55
48
|
} else {
|
|
56
49
|
['css', 'js', 'img', 'media'].forEach((type, index) => {
|
|
57
|
-
const canUpdate = index > 1 ? _classPrivateFieldGet(
|
|
50
|
+
const canUpdate = index > 1 ? _classPrivateFieldGet(_hasSourcePath, this).call(this, type) && !BalmJS.config.inFrontend : _classPrivateFieldGet(_hasSourcePath, this).call(this, type);
|
|
58
51
|
if (canUpdate) {
|
|
59
|
-
stream = stream.pipe(_classPrivateFieldGet(
|
|
52
|
+
stream = stream.pipe(_classPrivateFieldGet(_updateAssetsPath, this).call(this, type));
|
|
60
53
|
}
|
|
61
54
|
});
|
|
62
55
|
stream = stream.pipe(BalmJS.file.setPublicPath());
|
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
2
2
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
3
|
-
function _classPrivateFieldGet(
|
|
4
|
-
function
|
|
5
|
-
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
|
3
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
4
|
+
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
6
5
|
import mergeStream from '../../utilities/merge-stream.js';
|
|
7
6
|
var _release = /*#__PURE__*/new WeakMap();
|
|
8
7
|
class PublishTask extends BalmJS.BalmTask {
|
|
9
8
|
constructor() {
|
|
10
9
|
super('publish');
|
|
11
|
-
_classPrivateFieldInitSpec(this, _release, {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} else {
|
|
18
|
-
this.init();
|
|
19
|
-
}
|
|
20
|
-
return this.src.pipe($.if(!BalmJS.utils.isArray(this.input), BalmJS.plugins.rename(renameOptions))).pipe(gulp.dest(this.output)); // Absolute path
|
|
10
|
+
_classPrivateFieldInitSpec(this, _release, (input, output, renameOptions = {}) => {
|
|
11
|
+
if (input && output) {
|
|
12
|
+
this.init(node.path.join(BalmJS.config.dest.base, input), node.path.join(BalmJS.config.assets.root, output) // Remote dir
|
|
13
|
+
);
|
|
14
|
+
} else {
|
|
15
|
+
this.init();
|
|
21
16
|
}
|
|
17
|
+
return this.src.pipe($.if(!BalmJS.utils.isArray(this.input), BalmJS.plugins.rename(renameOptions))).pipe(gulp.dest(this.output)); // Absolute path
|
|
22
18
|
});
|
|
23
19
|
this.defaultInput = [BalmJS.file.matchAllFiles(BalmJS.config.dest.static),
|
|
24
20
|
// Assets
|
|
@@ -30,10 +26,10 @@ class PublishTask extends BalmJS.BalmTask {
|
|
|
30
26
|
const balmPublish = callback => {
|
|
31
27
|
if (BalmJS.config.env.isProd) {
|
|
32
28
|
if (BalmJS.utils.isArray(input)) {
|
|
33
|
-
const tasks = input.map(template => _classPrivateFieldGet(
|
|
29
|
+
const tasks = input.map(template => _classPrivateFieldGet(_release, this).call(this, template.input, template.output, template.renameOptions));
|
|
34
30
|
return mergeStream(...tasks);
|
|
35
31
|
} else {
|
|
36
|
-
return _classPrivateFieldGet(
|
|
32
|
+
return _classPrivateFieldGet(_release, this).call(this, input, output, renameOptions);
|
|
37
33
|
}
|
|
38
34
|
} else {
|
|
39
35
|
BalmJS.logger.warn(`${this.name} task`, '`mix.publish()` is only supported for production');
|
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
2
2
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
3
|
-
function _classPrivateFieldGet(
|
|
4
|
-
function
|
|
5
|
-
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
|
3
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
4
|
+
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
6
5
|
import { deleteAsync } from 'del';
|
|
7
6
|
var _getFiles = /*#__PURE__*/new WeakMap();
|
|
8
7
|
class RemoveTask extends BalmJS.BalmTask {
|
|
9
8
|
constructor() {
|
|
10
9
|
super('remove');
|
|
11
|
-
_classPrivateFieldInitSpec(this, _getFiles, {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
files = BalmJS.utils.isArray(input) ? files.map(file => file.replace(/\\/g, '/')) : files.replace(/\\/g, '/');
|
|
17
|
-
return files;
|
|
18
|
-
}
|
|
10
|
+
_classPrivateFieldInitSpec(this, _getFiles, input => {
|
|
11
|
+
let files = BalmJS.file.absPaths(input);
|
|
12
|
+
// NOTE: compatible with windows for `del@5.x`
|
|
13
|
+
files = BalmJS.utils.isArray(input) ? files.map(file => file.replace(/\\/g, '/')) : files.replace(/\\/g, '/');
|
|
14
|
+
return files;
|
|
19
15
|
});
|
|
20
16
|
}
|
|
21
17
|
recipe(input) {
|
|
22
18
|
const balmRemove = async callback => {
|
|
23
19
|
const canDel = !!(BalmJS.utils.isString(input) && input.trim() || BalmJS.utils.isArray(input) && input.length);
|
|
24
20
|
if (canDel) {
|
|
25
|
-
const files = _classPrivateFieldGet(
|
|
21
|
+
const files = _classPrivateFieldGet(_getFiles, this).call(this, input);
|
|
26
22
|
BalmJS.logger.debug(`${this.name} task`, {
|
|
27
23
|
files
|
|
28
24
|
}, {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
2
2
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
3
|
-
function _classPrivateFieldGet(
|
|
4
|
-
function
|
|
5
|
-
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
|
3
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
4
|
+
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
6
5
|
import detectPort from '../../utilities/detect-port.js';
|
|
7
6
|
import getMiddlewares from '../../middlewares/index.js';
|
|
8
7
|
var _watchTask = /*#__PURE__*/new WeakMap();
|
|
@@ -10,45 +9,39 @@ var _onWatch = /*#__PURE__*/new WeakMap();
|
|
|
10
9
|
class ServerTask extends BalmJS.BalmTask {
|
|
11
10
|
constructor() {
|
|
12
11
|
super('serve');
|
|
13
|
-
_classPrivateFieldInitSpec(this, _watchTask, {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
return serverReload ? gulp.series(balmTask, reload) : balmTask;
|
|
22
|
-
}
|
|
12
|
+
_classPrivateFieldInitSpec(this, _watchTask, (taskName, serverReload = false) => {
|
|
13
|
+
const balmTask = BalmJS.tasks.get(taskName).fn;
|
|
14
|
+
const reload = done => {
|
|
15
|
+
server.reload();
|
|
16
|
+
done();
|
|
17
|
+
};
|
|
18
|
+
return serverReload ? gulp.series(balmTask, reload) : balmTask;
|
|
23
19
|
});
|
|
24
|
-
_classPrivateFieldInitSpec(this, _onWatch, {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
watch
|
|
29
|
-
} = gulp;
|
|
20
|
+
_classPrivateFieldInitSpec(this, _onWatch, () => {
|
|
21
|
+
const {
|
|
22
|
+
watch
|
|
23
|
+
} = gulp;
|
|
30
24
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
25
|
+
// NOTE: bugfix for windows - chokidar.cwd has not default
|
|
26
|
+
const watchOptions = {
|
|
27
|
+
cwd: BalmJS.config.workspace
|
|
28
|
+
};
|
|
29
|
+
watch([`${BalmJS.config.src.img}/**/*`, `${BalmJS.config.dest.font}/**/*`, ...BalmJS.config.server.extraWatchFiles], watchOptions).on('change', server.reload);
|
|
30
|
+
watch(`${BalmJS.file.templateBasePath}/*.html`, watchOptions, _classPrivateFieldGet(_watchTask, this).call(this, 'html', true));
|
|
31
|
+
watch(`${BalmJS.config.src.css}/**/*.${BalmJS.config.styles.extname}`, watchOptions, _classPrivateFieldGet(_watchTask, this).call(this, BalmJS.config.inFrontend ? this.styleName : 'style'));
|
|
32
|
+
if (!BalmJS.config.server.useHMR) {
|
|
33
|
+
watch(`${BalmJS.config.src.js}/**/*`, watchOptions, _classPrivateFieldGet(_watchTask, this).call(this, BalmJS.config.scripts.bundler, true));
|
|
34
|
+
}
|
|
35
|
+
watch(`${BalmJS.config.src.base}/modernizr.json`, watchOptions, _classPrivateFieldGet(_watchTask, this).call(this, 'modernizr'));
|
|
36
|
+
watch(`${BalmJS.config.src.font}/**/*`, watchOptions, _classPrivateFieldGet(_watchTask, this).call(this, 'font'));
|
|
43
37
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
38
|
+
// For FTP
|
|
39
|
+
if (BalmJS.config.ftp.watchFiles.length) {
|
|
40
|
+
watch(BalmJS.config.ftp.watchFiles, watchOptions).on('change', path => {
|
|
41
|
+
BalmJS.logger.debug(`${this.name} task`, `File ${path} was changed`);
|
|
42
|
+
BalmJS.watchFtpFile = path;
|
|
43
|
+
_classPrivateFieldGet(_watchTask, this).call(this, 'ftp', true)();
|
|
44
|
+
});
|
|
52
45
|
}
|
|
53
46
|
});
|
|
54
47
|
if (BalmJS.config.env.isDev) {
|
|
@@ -111,7 +104,7 @@ class ServerTask extends BalmJS.BalmTask {
|
|
|
111
104
|
if (BalmJS.config.env.isDev) {
|
|
112
105
|
BalmJS.server = server.init(bsOptions);
|
|
113
106
|
if (BalmJS.config.useDefaults) {
|
|
114
|
-
_classPrivateFieldGet(
|
|
107
|
+
_classPrivateFieldGet(_onWatch, this).call(this);
|
|
115
108
|
} else {
|
|
116
109
|
BalmJS.watching = true;
|
|
117
110
|
const watcher = gulp.watch([`${BalmJS.config.src.base}/**/*`, ...serverConfig.extraWatchFiles]);
|
package/lib/tasks/public/url.js
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
2
2
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
3
|
-
function _classPrivateFieldGet(
|
|
4
|
-
function
|
|
5
|
-
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
|
3
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
4
|
+
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
6
5
|
var _urlProcessing = /*#__PURE__*/new WeakMap();
|
|
7
6
|
class UrlTask extends BalmJS.BalmTask {
|
|
8
7
|
constructor() {
|
|
9
8
|
super('url');
|
|
10
|
-
_classPrivateFieldInitSpec(this, _urlProcessing, {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
});
|
|
22
|
-
return BalmJS.plugins.replace(pathSrc, pathDest);
|
|
23
|
-
}
|
|
9
|
+
_classPrivateFieldInitSpec(this, _urlProcessing, type => {
|
|
10
|
+
const pattern = BalmJS.config.paths.source[type].split('/').pop();
|
|
11
|
+
const pathSrc = new RegExp(`\\.{2}/${pattern}/`, 'g');
|
|
12
|
+
const pathDest = `../${BalmJS.config.paths.target[type]}/`;
|
|
13
|
+
BalmJS.logger.debug(`${this.name} task`, {
|
|
14
|
+
regex: pathSrc,
|
|
15
|
+
replacement: pathDest
|
|
16
|
+
}, {
|
|
17
|
+
pre: true
|
|
18
|
+
});
|
|
19
|
+
return BalmJS.plugins.replace(pathSrc, pathDest);
|
|
24
20
|
});
|
|
25
21
|
this.defaultOutput = BalmJS.config.dest.css;
|
|
26
22
|
this.defaultInput = BalmJS.file.matchAllFiles(this.defaultOutput, '*.css');
|
|
@@ -28,7 +24,7 @@ class UrlTask extends BalmJS.BalmTask {
|
|
|
28
24
|
recipe(input, output) {
|
|
29
25
|
const balmUrl = () => {
|
|
30
26
|
this.init(input, output);
|
|
31
|
-
return this.src.pipe(_classPrivateFieldGet(
|
|
27
|
+
return this.src.pipe(_classPrivateFieldGet(_urlProcessing, this).call(this, 'img')).pipe(_classPrivateFieldGet(_urlProcessing, this).call(this, 'font')).pipe(gulp.dest(this.output));
|
|
32
28
|
};
|
|
33
29
|
return balmUrl;
|
|
34
30
|
}
|
|
@@ -1,27 +1,22 @@
|
|
|
1
1
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
2
2
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
3
|
-
function _classPrivateFieldSet(
|
|
4
|
-
function
|
|
5
|
-
function
|
|
6
|
-
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
|
7
|
-
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
|
3
|
+
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
|
4
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
5
|
+
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
8
6
|
import loading from './loading.js';
|
|
9
7
|
var _firstCompile = /*#__PURE__*/new WeakMap();
|
|
10
8
|
class BalmCompiling {
|
|
11
9
|
constructor() {
|
|
12
|
-
_classPrivateFieldInitSpec(this, _firstCompile,
|
|
13
|
-
writable: true,
|
|
14
|
-
value: true
|
|
15
|
-
});
|
|
10
|
+
_classPrivateFieldInitSpec(this, _firstCompile, true);
|
|
16
11
|
}
|
|
17
12
|
start() {
|
|
18
|
-
if (!BalmJS.useCacache && _classPrivateFieldGet(
|
|
13
|
+
if (!BalmJS.useCacache && _classPrivateFieldGet(_firstCompile, this)) {
|
|
19
14
|
loading.render('Compiling to JS...');
|
|
20
15
|
}
|
|
21
16
|
}
|
|
22
17
|
stop() {
|
|
23
|
-
if (!BalmJS.useCacache && _classPrivateFieldGet(
|
|
24
|
-
_classPrivateFieldSet(
|
|
18
|
+
if (!BalmJS.useCacache && _classPrivateFieldGet(_firstCompile, this)) {
|
|
19
|
+
_classPrivateFieldSet(_firstCompile, this, false);
|
|
25
20
|
loading.clear();
|
|
26
21
|
}
|
|
27
22
|
}
|
package/lib/utilities/loading.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
2
2
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
3
|
-
function _classPrivateFieldSet(
|
|
4
|
-
function
|
|
5
|
-
function
|
|
6
|
-
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
|
7
|
-
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
|
3
|
+
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
|
4
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
5
|
+
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
8
6
|
import readline from 'readline';
|
|
9
7
|
import spinner from '../config/spinner.js';
|
|
10
8
|
var _stream = /*#__PURE__*/new WeakMap();
|
|
@@ -12,33 +10,24 @@ var _frameIndex = /*#__PURE__*/new WeakMap();
|
|
|
12
10
|
var _frameCount = /*#__PURE__*/new WeakMap();
|
|
13
11
|
class BalmLoading {
|
|
14
12
|
constructor() {
|
|
15
|
-
_classPrivateFieldInitSpec(this, _stream,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
19
|
-
_classPrivateFieldInitSpec(this, _frameIndex, {
|
|
20
|
-
writable: true,
|
|
21
|
-
value: 0
|
|
22
|
-
});
|
|
23
|
-
_classPrivateFieldInitSpec(this, _frameCount, {
|
|
24
|
-
writable: true,
|
|
25
|
-
value: spinner.frames.length
|
|
26
|
-
});
|
|
13
|
+
_classPrivateFieldInitSpec(this, _stream, process.stderr);
|
|
14
|
+
_classPrivateFieldInitSpec(this, _frameIndex, 0);
|
|
15
|
+
_classPrivateFieldInitSpec(this, _frameCount, spinner.frames.length);
|
|
27
16
|
}
|
|
28
17
|
get frame() {
|
|
29
18
|
var _this$frameIndex;
|
|
30
|
-
const currentFrame = spinner.frames[_classPrivateFieldGet(
|
|
31
|
-
_classPrivateFieldSet(
|
|
19
|
+
const currentFrame = spinner.frames[_classPrivateFieldGet(_frameIndex, this)];
|
|
20
|
+
_classPrivateFieldSet(_frameIndex, this, _classPrivateFieldSet(_frameIndex, this, (_this$frameIndex = _classPrivateFieldGet(_frameIndex, this), ++_this$frameIndex)) % _classPrivateFieldGet(_frameCount, this));
|
|
32
21
|
return currentFrame;
|
|
33
22
|
}
|
|
34
23
|
clear() {
|
|
35
24
|
// Compatibility on Windows
|
|
36
|
-
readline.clearLine(_classPrivateFieldGet(
|
|
37
|
-
readline.cursorTo(_classPrivateFieldGet(
|
|
25
|
+
readline.clearLine(_classPrivateFieldGet(_stream, this), 0);
|
|
26
|
+
readline.cursorTo(_classPrivateFieldGet(_stream, this), 0);
|
|
38
27
|
}
|
|
39
28
|
render(text = `${this.frame} BalmJS is initializing...`) {
|
|
40
29
|
this.clear();
|
|
41
|
-
_classPrivateFieldGet(
|
|
30
|
+
_classPrivateFieldGet(_stream, this).write(text);
|
|
42
31
|
}
|
|
43
32
|
succeed() {
|
|
44
33
|
this.clear();
|
package/lib/utilities/logger.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
2
2
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
3
|
-
function _classPrivateFieldGet(
|
|
4
|
-
function
|
|
5
|
-
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
|
3
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
4
|
+
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
6
5
|
import util from 'node:util';
|
|
7
6
|
import fancyLog from 'fancy-log';
|
|
8
7
|
import color from './color.js';
|
|
@@ -44,16 +43,13 @@ const LOG = {
|
|
|
44
43
|
var _log = /*#__PURE__*/new WeakMap();
|
|
45
44
|
class Logger {
|
|
46
45
|
constructor() {
|
|
47
|
-
_classPrivateFieldInitSpec(this, _log, {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}, BalmJS.config.logs.formatOptions);
|
|
55
|
-
return pre ? util.inspect(obj, options) : obj;
|
|
56
|
-
}
|
|
46
|
+
_classPrivateFieldInitSpec(this, _log, (obj, pre = false) => {
|
|
47
|
+
const options = Object.assign({
|
|
48
|
+
showHidden: false,
|
|
49
|
+
depth: 2,
|
|
50
|
+
colors: true
|
|
51
|
+
}, BalmJS.config.logs.formatOptions);
|
|
52
|
+
return pre ? util.inspect(obj, options) : obj;
|
|
57
53
|
});
|
|
58
54
|
}
|
|
59
55
|
success(label, message, options = {}) {
|
|
@@ -62,7 +58,7 @@ class Logger {
|
|
|
62
58
|
}, options);
|
|
63
59
|
if (BalmJS.config.logs.level <= logOptions.logLevel) {
|
|
64
60
|
console.log(LOG.beginning);
|
|
65
|
-
fancyLog(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.OK), _classPrivateFieldGet(
|
|
61
|
+
fancyLog(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.OK), _classPrivateFieldGet(_log, this).call(this, message, logOptions.pre));
|
|
66
62
|
console.log(LOG.end);
|
|
67
63
|
}
|
|
68
64
|
}
|
|
@@ -71,7 +67,7 @@ class Logger {
|
|
|
71
67
|
logLevel: BalmJS.LogLevel.Debug
|
|
72
68
|
}, options);
|
|
73
69
|
if (BalmJS.config.logs.level <= logOptions.logLevel) {
|
|
74
|
-
fancyLog.info(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.DEBUG), _classPrivateFieldGet(
|
|
70
|
+
fancyLog.info(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.DEBUG), _classPrivateFieldGet(_log, this).call(this, message, logOptions.pre));
|
|
75
71
|
}
|
|
76
72
|
}
|
|
77
73
|
info(label, message, options = {}) {
|
|
@@ -79,7 +75,7 @@ class Logger {
|
|
|
79
75
|
logLevel: BalmJS.LogLevel.Info
|
|
80
76
|
}, options);
|
|
81
77
|
if (BalmJS.config.logs.level <= logOptions.logLevel) {
|
|
82
|
-
fancyLog.info(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.INFO), _classPrivateFieldGet(
|
|
78
|
+
fancyLog.info(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.INFO), _classPrivateFieldGet(_log, this).call(this, message, logOptions.pre));
|
|
83
79
|
}
|
|
84
80
|
}
|
|
85
81
|
warn(label, message, options = {}) {
|
|
@@ -87,7 +83,7 @@ class Logger {
|
|
|
87
83
|
logLevel: BalmJS.LogLevel.Warn
|
|
88
84
|
}, options);
|
|
89
85
|
if (BalmJS.config.logs.level <= logOptions.logLevel) {
|
|
90
|
-
fancyLog.warn(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.WARN), _classPrivateFieldGet(
|
|
86
|
+
fancyLog.warn(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.WARN), _classPrivateFieldGet(_log, this).call(this, message, logOptions.pre));
|
|
91
87
|
}
|
|
92
88
|
}
|
|
93
89
|
error(label, message, options = {}) {
|
|
@@ -96,7 +92,7 @@ class Logger {
|
|
|
96
92
|
pre: false
|
|
97
93
|
}, options);
|
|
98
94
|
if (BalmJS.config.logs.level <= logOptions.logLevel) {
|
|
99
|
-
fancyLog.error(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.ERROR), _classPrivateFieldGet(
|
|
95
|
+
fancyLog.error(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.ERROR), _classPrivateFieldGet(_log, this).call(this, message, logOptions.pre));
|
|
100
96
|
}
|
|
101
97
|
}
|
|
102
98
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "balm-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.29.0",
|
|
4
4
|
"description": "BalmJS compiler core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"balm",
|
|
@@ -44,16 +44,16 @@
|
|
|
44
44
|
"@rollup/plugin-terser": "^0.4.4",
|
|
45
45
|
"ansi-colors": "^4.1.3",
|
|
46
46
|
"async": "^3.2.5",
|
|
47
|
-
"autoprefixer": "^10.4.
|
|
47
|
+
"autoprefixer": "^10.4.19",
|
|
48
48
|
"babel-loader": "^9.1.3",
|
|
49
49
|
"browser-sync": "^3.0.2",
|
|
50
50
|
"connect-history-api-fallback": "^2.0.0",
|
|
51
|
-
"css-loader": "^
|
|
51
|
+
"css-loader": "^7.0.0",
|
|
52
52
|
"css-minimizer-webpack-plugin": "^6.0.0",
|
|
53
|
-
"cssnano": "^6.
|
|
53
|
+
"cssnano": "^6.1.2",
|
|
54
54
|
"del": "^7.1.0",
|
|
55
|
-
"dotenv": "^16.4.
|
|
56
|
-
"dotenv-expand": "^
|
|
55
|
+
"dotenv": "^16.4.5",
|
|
56
|
+
"dotenv-expand": "^11.0.6",
|
|
57
57
|
"esbuild": "^0.20.0",
|
|
58
58
|
"fancy-log": "^2.0.0",
|
|
59
59
|
"gulp-eslint": "^6.0.0",
|
|
@@ -68,40 +68,40 @@
|
|
|
68
68
|
"html-loader": "^5.0.0",
|
|
69
69
|
"html-minifier": "^4.0.0",
|
|
70
70
|
"html-webpack-plugin": "^5.6.0",
|
|
71
|
-
"http-proxy-middleware": "^
|
|
71
|
+
"http-proxy-middleware": "^3.0.0",
|
|
72
72
|
"imagemin": "^8.0.1",
|
|
73
73
|
"istextorbinary": "^9.5.0",
|
|
74
74
|
"less": "^4.2.0",
|
|
75
|
-
"mini-css-extract-plugin": "^2.8.
|
|
75
|
+
"mini-css-extract-plugin": "^2.8.1",
|
|
76
76
|
"modernizr": "^3.13.0",
|
|
77
77
|
"parents": "^1.0.1",
|
|
78
78
|
"plugin-error": "^2.0.1",
|
|
79
|
-
"postcss": "^8.4.
|
|
79
|
+
"postcss": "^8.4.38",
|
|
80
80
|
"postcss-flexbugs-fixes": "^5.0.2",
|
|
81
|
-
"postcss-import": "^16.
|
|
82
|
-
"postcss-load-config": "^5.0.
|
|
83
|
-
"postcss-loader": "^8.1.
|
|
84
|
-
"postcss-preset-env": "
|
|
81
|
+
"postcss-import": "^16.1.0",
|
|
82
|
+
"postcss-load-config": "^5.0.3",
|
|
83
|
+
"postcss-loader": "^8.1.1",
|
|
84
|
+
"postcss-preset-env": "^9.5.4",
|
|
85
85
|
"pretty-bytes": "^6.1.1",
|
|
86
86
|
"readable-stream": "^4.5.2",
|
|
87
87
|
"replace-ext": "^2.0.0",
|
|
88
|
-
"rollup": "^4.
|
|
89
|
-
"sass": "^1.
|
|
90
|
-
"sass-loader": "^14.1.
|
|
88
|
+
"rollup": "^4.14.0",
|
|
89
|
+
"sass": "^1.74.1",
|
|
90
|
+
"sass-loader": "^14.1.1",
|
|
91
91
|
"semver": "^7.6.0",
|
|
92
92
|
"ssh2": "^1.15.0",
|
|
93
93
|
"strip-ansi": "^7.1.0",
|
|
94
94
|
"style-loader": "^3.3.4",
|
|
95
|
-
"tailwindcss": "^3.4.
|
|
96
|
-
"terser": "^5.
|
|
95
|
+
"tailwindcss": "^3.4.3",
|
|
96
|
+
"terser": "^5.30.3",
|
|
97
97
|
"terser-webpack-plugin": "^5.3.10",
|
|
98
98
|
"through2": "^4.0.2",
|
|
99
99
|
"through2-concurrent": "^2.0.0",
|
|
100
100
|
"tslib": "^2.6.2",
|
|
101
101
|
"vinyl-sourcemaps-apply": "^0.2.1",
|
|
102
|
-
"webpack": "^5.
|
|
102
|
+
"webpack": "^5.91.0",
|
|
103
103
|
"webpack-bundle-analyzer": "^4.10.1",
|
|
104
|
-
"webpack-dev-middleware": "^7.
|
|
104
|
+
"webpack-dev-middleware": "^7.2.1",
|
|
105
105
|
"webpack-hot-middleware": "^2.26.1",
|
|
106
106
|
"webpack-merge": "^5.10.0",
|
|
107
107
|
"workbox-build": "^7.0.0"
|
|
@@ -130,5 +130,5 @@
|
|
|
130
130
|
"engines": {
|
|
131
131
|
"node": ">=18.12.0"
|
|
132
132
|
},
|
|
133
|
-
"gitHead": "
|
|
133
|
+
"gitHead": "8cff203ffacbe64b726e713915f3b8c7ccd45405"
|
|
134
134
|
}
|
package/tslib/config/server.js
CHANGED
|
@@ -11,7 +11,7 @@ const hotOptions = {
|
|
|
11
11
|
reload: true,
|
|
12
12
|
noInfo: true
|
|
13
13
|
};
|
|
14
|
-
const
|
|
14
|
+
const proxyOptions = false;
|
|
15
15
|
const historyOptions = false;
|
|
16
16
|
const middlewares = [];
|
|
17
17
|
const extraWatchFiles = [];
|
|
@@ -26,7 +26,7 @@ export default {
|
|
|
26
26
|
next,
|
|
27
27
|
devOptions,
|
|
28
28
|
hotOptions,
|
|
29
|
-
|
|
29
|
+
proxyOptions,
|
|
30
30
|
historyOptions,
|
|
31
31
|
middlewares,
|
|
32
32
|
extraWatchFiles
|