balm-core 5.0.2 → 5.2.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 +9 -0
- package/lib/config/globals.js +14 -1
- package/lib/plugins/htmlmin.js +4 -3
- package/lib/plugins/imagemin.js +15 -10
- package/lib/plugins/index.js +2 -0
- package/lib/plugins/postcss.js +2 -2
- package/lib/plugins/rename.js +1 -3
- package/lib/plugins/replace.js +3 -1
- package/lib/plugins/sass-legacy.js +131 -0
- package/lib/plugins/sass.js +66 -125
- package/lib/plugins/sftp.js +7 -5
- package/lib/tasks/foundation/balm.js +4 -4
- package/lib/tasks/foundation/balm_style.js +1 -2
- package/lib/tasks/private/cache.js +7 -4
- package/lib/tasks/private/image.js +2 -2
- package/lib/tasks/private/pwa-cache.js +10 -4
- package/lib/tasks/public/publish.js +9 -3
- package/lib/tasks/public/pwa.js +22 -7
- package/lib/tasks/public/sass.js +1 -2
- package/package.json +48 -49
- package/tslib/balm.js +5 -8
- package/tslib/config/globals.js +21 -1
- package/tslib/plugins/htmlmin.js +4 -3
- package/tslib/plugins/imagemin.js +15 -10
- package/tslib/plugins/index.js +2 -0
- package/tslib/plugins/rename.js +1 -1
- package/tslib/plugins/replace.js +2 -1
- package/tslib/plugins/sass-legacy.js +95 -0
- package/tslib/plugins/sass.js +62 -124
- package/tslib/plugins/sftp.js +7 -4
- package/tslib/tasks/foundation/balm.js +12 -10
- package/tslib/tasks/foundation/balm_style.js +3 -2
- package/tslib/tasks/private/build.js +7 -7
- package/tslib/tasks/private/cache.js +14 -11
- package/tslib/tasks/private/clean.js +28 -31
- package/tslib/tasks/private/end.js +8 -8
- package/tslib/tasks/private/extra.js +7 -7
- package/tslib/tasks/private/font.js +4 -4
- package/tslib/tasks/private/image.js +16 -16
- package/tslib/tasks/private/lint.js +9 -9
- package/tslib/tasks/private/media.js +4 -4
- package/tslib/tasks/private/modernizr.js +40 -43
- package/tslib/tasks/private/pwa-cache.js +21 -13
- package/tslib/tasks/private/sprite.js +36 -39
- package/tslib/tasks/private/start.js +7 -7
- package/tslib/tasks/private/workbox-sw.js +4 -4
- package/tslib/tasks/public/html.js +23 -26
- package/tslib/tasks/public/publish.js +19 -16
- package/tslib/tasks/public/pwa.js +23 -6
- package/tslib/tasks/public/remove.js +8 -11
- package/tslib/tasks/public/sass.js +1 -2
- package/tslib/tasks/public/server.js +34 -37
- package/tslib/tasks/public/url.js +16 -19
- package/tslib/utilities/compiling.js +4 -9
- package/tslib/utilities/loading.js +8 -14
- package/tslib/utilities/logger.js +13 -18
|
@@ -1,31 +1,29 @@
|
|
|
1
|
-
var _UrlTask_urlProcessing;
|
|
2
|
-
import { __classPrivateFieldGet } from "tslib";
|
|
3
1
|
class UrlTask extends BalmJS.BalmTask {
|
|
4
2
|
constructor() {
|
|
5
3
|
super('url');
|
|
6
|
-
_UrlTask_urlProcessing.set(this, (type) => {
|
|
7
|
-
const pattern = BalmJS.config.paths.source[type]
|
|
8
|
-
.split('/')
|
|
9
|
-
.pop();
|
|
10
|
-
const pathSrc = new RegExp(`\\.{2}/${pattern}/`, 'g');
|
|
11
|
-
const pathDest = `../${BalmJS.config.paths.target[type]}/`;
|
|
12
|
-
BalmJS.logger.debug(`${this.name} task`, {
|
|
13
|
-
regex: pathSrc,
|
|
14
|
-
replacement: pathDest
|
|
15
|
-
}, {
|
|
16
|
-
pre: true
|
|
17
|
-
});
|
|
18
|
-
return BalmJS.plugins.replace(pathSrc, pathDest);
|
|
19
|
-
});
|
|
20
4
|
this.defaultOutput = BalmJS.config.dest.css;
|
|
21
5
|
this.defaultInput = BalmJS.file.matchAllFiles(this.defaultOutput, '*.css');
|
|
22
6
|
}
|
|
7
|
+
#urlProcessing = (type) => {
|
|
8
|
+
const pattern = BalmJS.config.paths.source[type]
|
|
9
|
+
.split('/')
|
|
10
|
+
.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);
|
|
20
|
+
};
|
|
23
21
|
recipe(input, output) {
|
|
24
22
|
const balmUrl = () => {
|
|
25
23
|
this.init(input, output);
|
|
26
24
|
return this.src
|
|
27
|
-
.pipe(
|
|
28
|
-
.pipe(
|
|
25
|
+
.pipe(this.#urlProcessing('img'))
|
|
26
|
+
.pipe(this.#urlProcessing('font'))
|
|
29
27
|
.pipe(gulp.dest(this.output));
|
|
30
28
|
};
|
|
31
29
|
return balmUrl;
|
|
@@ -34,5 +32,4 @@ class UrlTask extends BalmJS.BalmTask {
|
|
|
34
32
|
return this.recipe();
|
|
35
33
|
}
|
|
36
34
|
}
|
|
37
|
-
_UrlTask_urlProcessing = new WeakMap();
|
|
38
35
|
export default UrlTask;
|
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
var _BalmCompiling_firstCompile;
|
|
2
|
-
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
1
|
import loading from './loading.js';
|
|
4
2
|
class BalmCompiling {
|
|
5
|
-
|
|
6
|
-
_BalmCompiling_firstCompile.set(this, true);
|
|
7
|
-
}
|
|
3
|
+
#firstCompile = true;
|
|
8
4
|
start() {
|
|
9
|
-
if (!BalmJS.useCacache &&
|
|
5
|
+
if (!BalmJS.useCacache && this.#firstCompile) {
|
|
10
6
|
loading.render('Compiling to JS...');
|
|
11
7
|
}
|
|
12
8
|
}
|
|
13
9
|
stop() {
|
|
14
|
-
if (!BalmJS.useCacache &&
|
|
15
|
-
|
|
10
|
+
if (!BalmJS.useCacache && this.#firstCompile) {
|
|
11
|
+
this.#firstCompile = false;
|
|
16
12
|
loading.clear();
|
|
17
13
|
}
|
|
18
14
|
}
|
|
19
15
|
}
|
|
20
|
-
_BalmCompiling_firstCompile = new WeakMap();
|
|
21
16
|
export default new BalmCompiling();
|
|
@@ -1,31 +1,25 @@
|
|
|
1
|
-
var _BalmLoading_stream, _BalmLoading_frameIndex, _BalmLoading_frameCount;
|
|
2
|
-
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
1
|
import readline from 'readline';
|
|
4
2
|
import spinner from '../config/spinner.js';
|
|
5
3
|
class BalmLoading {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
_BalmLoading_frameCount.set(this, spinner.frames.length);
|
|
10
|
-
}
|
|
4
|
+
#stream = process.stderr;
|
|
5
|
+
#frameIndex = 0;
|
|
6
|
+
#frameCount = spinner.frames.length;
|
|
11
7
|
get frame() {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
__classPrivateFieldSet(this, _BalmLoading_frameIndex, __classPrivateFieldSet(this, _BalmLoading_frameIndex, (_a = __classPrivateFieldGet(this, _BalmLoading_frameIndex, "f"), ++_a), "f") % __classPrivateFieldGet(this, _BalmLoading_frameCount, "f"), "f");
|
|
8
|
+
const currentFrame = spinner.frames[this.#frameIndex];
|
|
9
|
+
this.#frameIndex = ++this.#frameIndex % this.#frameCount;
|
|
15
10
|
return currentFrame;
|
|
16
11
|
}
|
|
17
12
|
clear() {
|
|
18
|
-
readline.clearLine(
|
|
19
|
-
readline.cursorTo(
|
|
13
|
+
readline.clearLine(this.#stream, 0);
|
|
14
|
+
readline.cursorTo(this.#stream, 0);
|
|
20
15
|
}
|
|
21
16
|
render(text = `${this.frame} BalmJS is initializing...`) {
|
|
22
17
|
this.clear();
|
|
23
|
-
|
|
18
|
+
this.#stream.write(text);
|
|
24
19
|
}
|
|
25
20
|
succeed() {
|
|
26
21
|
this.clear();
|
|
27
22
|
console.log(`BalmJS core version: ${BalmJS.version}`);
|
|
28
23
|
}
|
|
29
24
|
}
|
|
30
|
-
_BalmLoading_stream = new WeakMap(), _BalmLoading_frameIndex = new WeakMap(), _BalmLoading_frameCount = new WeakMap();
|
|
31
25
|
export default new BalmLoading();
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
var _Logger_log;
|
|
2
|
-
import { __classPrivateFieldGet } from "tslib";
|
|
3
1
|
import util from 'node:util';
|
|
4
2
|
import fancyLog from 'fancy-log';
|
|
5
3
|
import color from './color.js';
|
|
@@ -39,23 +37,21 @@ const LOG = {
|
|
|
39
37
|
end: '^'.padEnd(36, '.')
|
|
40
38
|
};
|
|
41
39
|
class Logger {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
});
|
|
51
|
-
}
|
|
40
|
+
#log = (obj, pre = false) => {
|
|
41
|
+
const options = Object.assign({
|
|
42
|
+
showHidden: false,
|
|
43
|
+
depth: 2,
|
|
44
|
+
colors: true
|
|
45
|
+
}, BalmJS.config.logs.formatOptions);
|
|
46
|
+
return pre ? util.inspect(obj, options) : obj;
|
|
47
|
+
};
|
|
52
48
|
success(label, message, options = {}) {
|
|
53
49
|
const logOptions = Object.assign({
|
|
54
50
|
logLevel: BalmJS.LogLevel.Trace
|
|
55
51
|
}, options);
|
|
56
52
|
if (BalmJS.config.logs.level <= logOptions.logLevel) {
|
|
57
53
|
console.log(LOG.beginning);
|
|
58
|
-
fancyLog(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.OK),
|
|
54
|
+
fancyLog(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.OK), this.#log(message, logOptions.pre));
|
|
59
55
|
console.log(LOG.end);
|
|
60
56
|
}
|
|
61
57
|
}
|
|
@@ -64,7 +60,7 @@ class Logger {
|
|
|
64
60
|
logLevel: BalmJS.LogLevel.Debug
|
|
65
61
|
}, options);
|
|
66
62
|
if (BalmJS.config.logs.level <= logOptions.logLevel) {
|
|
67
|
-
fancyLog.info(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.DEBUG),
|
|
63
|
+
fancyLog.info(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.DEBUG), this.#log(message, logOptions.pre));
|
|
68
64
|
}
|
|
69
65
|
}
|
|
70
66
|
info(label, message, options = {}) {
|
|
@@ -72,7 +68,7 @@ class Logger {
|
|
|
72
68
|
logLevel: BalmJS.LogLevel.Info
|
|
73
69
|
}, options);
|
|
74
70
|
if (BalmJS.config.logs.level <= logOptions.logLevel) {
|
|
75
|
-
fancyLog.info(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.INFO),
|
|
71
|
+
fancyLog.info(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.INFO), this.#log(message, logOptions.pre));
|
|
76
72
|
}
|
|
77
73
|
}
|
|
78
74
|
warn(label, message, options = {}) {
|
|
@@ -80,7 +76,7 @@ class Logger {
|
|
|
80
76
|
logLevel: BalmJS.LogLevel.Warn
|
|
81
77
|
}, options);
|
|
82
78
|
if (BalmJS.config.logs.level <= logOptions.logLevel) {
|
|
83
|
-
fancyLog.warn(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.WARN),
|
|
79
|
+
fancyLog.warn(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.WARN), this.#log(message, logOptions.pre));
|
|
84
80
|
}
|
|
85
81
|
}
|
|
86
82
|
error(label, message, options = {}) {
|
|
@@ -89,9 +85,8 @@ class Logger {
|
|
|
89
85
|
pre: false
|
|
90
86
|
}, options);
|
|
91
87
|
if (BalmJS.config.logs.level <= logOptions.logLevel) {
|
|
92
|
-
fancyLog.error(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.ERROR),
|
|
88
|
+
fancyLog.error(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.ERROR), this.#log(message, logOptions.pre));
|
|
93
89
|
}
|
|
94
90
|
}
|
|
95
91
|
}
|
|
96
|
-
_Logger_log = new WeakMap();
|
|
97
92
|
export default new Logger();
|