balm-core 4.27.1 → 4.28.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 +16 -10
- package/lib/balm.js +8 -13
- package/lib/tasks/private/clean.js +6 -10
- package/lib/tasks/private/modernizr.js +25 -35
- package/lib/tasks/private/sprite.js +39 -46
- 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/tasks/public/zip.js +2 -1
- package/lib/utilities/compiling.js +7 -12
- package/lib/utilities/loading.js +11 -22
- package/lib/utilities/logger.js +14 -18
- package/package.json +15 -15
- package/tslib/tasks/public/zip.js +2 -1
package/README.md
CHANGED
|
@@ -68,7 +68,7 @@ You need to set up your development environment before you can do anything.
|
|
|
68
68
|
|
|
69
69
|
Install [Node.js® and npm](https://nodejs.org/en/download/) if they are not already on your machine.
|
|
70
70
|
|
|
71
|
-
> **Verify that you are running at least node `
|
|
71
|
+
> **Verify that you are running at least node `18.12.0`** by running `node -v` in a terminal/console window. Older versions maybe produce errors, but newer versions are fine.
|
|
72
72
|
|
|
73
73
|
You develop apps in the context of an [Balm workspace](https://balm.js.org/docs/guide/structure.html).
|
|
74
74
|
|
|
@@ -152,15 +152,17 @@ To download [example](https://balm.js.org/balm-example.zip) and try it, visit [b
|
|
|
152
152
|
|
|
153
153
|
## Ecosystem
|
|
154
154
|
|
|
155
|
-
| Project
|
|
156
|
-
|
|
|
157
|
-
| **[balm-core](https://github.com/balmjs/balm)**
|
|
158
|
-
| **[balm](https://github.com/balmjs/balm)**
|
|
159
|
-
| **[balm-cli](https://github.com/balmjs/balm-cli)**
|
|
160
|
-
| [balm-gui](https://github.com/balmjs/balm-gui)
|
|
161
|
-
| [balm-ui-lite](https://github.com/balmjs/ui-vue-lite)
|
|
162
|
-
| **[balm-ui](https://github.com/balmjs/ui-vue)**
|
|
163
|
-
| [balm-scroll](https://github.com/balmjs/balm-scroll)
|
|
155
|
+
| Project | Status | Description |
|
|
156
|
+
| ---------------------------------------------------------- | -------------------------------------------------------- | ------------------------------------------------------------------ |
|
|
157
|
+
| **[balm-core](https://github.com/balmjs/balm)** | [![NPM version][balm-core-image]][balm-core-url] | :black_joker: BalmJS compiler core (required for `balm 3.0+`) |
|
|
158
|
+
| **[balm](https://github.com/balmjs/balm)** | [![NPM version][balm-image]][balm-url] | :black_joker: BalmJS runtime core |
|
|
159
|
+
| **[balm-cli](https://github.com/balmjs/balm-cli)** | [![NPM version][balm-cli-image]][balm-cli-url] | :spades: BalmJS scaffolding tool |
|
|
160
|
+
| [balm-gui](https://github.com/balmjs/balm-gui) | N/A | :clubs: GUI for BalmJS |
|
|
161
|
+
| [balm-ui-lite](https://github.com/balmjs/ui-vue-lite) | [![NPM version][balm-ui-lite-image]][balm-ui-lite-url] | :hearts: Material Design Lite + Vue |
|
|
162
|
+
| **[balm-ui](https://github.com/balmjs/ui-vue)** | [![NPM version][balm-ui-image]][balm-ui-url] | :diamonds: Next Generation Material UI for Vue.js |
|
|
163
|
+
| [balm-scroll](https://github.com/balmjs/balm-scroll) | [![NPM version][balm-scroll-image]][balm-scroll-url] | :scroll: Smooth scrolling for Vue.js |
|
|
164
|
+
| **[balm-ui-pro](https://github.com/balmjs/balm-ui-pro)** | [![NPM version][balm-ui-pro-image]][balm-ui-pro-url] | More configuration definition, less code implementation for Vue.js |
|
|
165
|
+
| **[balm-git-flow](https://github.com/balmjs/balm-ui-pro)** | [![NPM version][balm-git-flow-image]][balm-git-flow-url] | The best practices for front-end git flow |
|
|
164
166
|
|
|
165
167
|
## Contributing
|
|
166
168
|
|
|
@@ -188,3 +190,7 @@ We'd love for you to contribute and make BalmJS even better than it is today! Pl
|
|
|
188
190
|
[balm-ui-url]: https://npmjs.org/package/balm-ui
|
|
189
191
|
[balm-scroll-image]: https://img.shields.io/npm/v/balm-scroll.svg
|
|
190
192
|
[balm-scroll-url]: https://npmjs.org/package/balm-scroll
|
|
193
|
+
[balm-ui-pro-image]: https://badge.fury.io/js/balm-ui-pro.svg
|
|
194
|
+
[balm-ui-pro-url]: https://npmjs.org/package/balm-ui-pro
|
|
195
|
+
[balm-git-flow-image]: https://badge.fury.io/js/balm-git-flow.svg
|
|
196
|
+
[balm-git-flow-url]: https://npmjs.org/package/balm-git-flow
|
package/lib/balm.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 _classPrivateFieldGet(
|
|
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 _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
|
3
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
4
|
+
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
|
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 './config/index.js';
|
|
9
7
|
import './utilities/index.js';
|
|
10
8
|
import './plugins/index.js';
|
|
@@ -14,20 +12,17 @@ import loading from './utilities/loading.js';
|
|
|
14
12
|
var _config = /*#__PURE__*/new WeakMap();
|
|
15
13
|
class Balm {
|
|
16
14
|
constructor() {
|
|
17
|
-
_classPrivateFieldInitSpec(this, _config,
|
|
18
|
-
writable: true,
|
|
19
|
-
value: void 0
|
|
20
|
-
});
|
|
15
|
+
_classPrivateFieldInitSpec(this, _config, void 0);
|
|
21
16
|
BalmJS.loading = false;
|
|
22
17
|
loading.succeed();
|
|
23
|
-
_classPrivateFieldSet(
|
|
18
|
+
_classPrivateFieldSet(_config, this, setConfig({}));
|
|
24
19
|
}
|
|
25
20
|
get config() {
|
|
26
|
-
return _classPrivateFieldGet(
|
|
21
|
+
return _classPrivateFieldGet(_config, this);
|
|
27
22
|
}
|
|
28
23
|
set config(value) {
|
|
29
|
-
_classPrivateFieldSet(
|
|
30
|
-
BalmJS.config = _classPrivateFieldGet(
|
|
24
|
+
_classPrivateFieldSet(_config, this, setConfig(value));
|
|
25
|
+
BalmJS.config = _classPrivateFieldGet(_config, this);
|
|
31
26
|
}
|
|
32
27
|
set beforeTask(name) {
|
|
33
28
|
BalmJS.beforeTask = setTask(name);
|
|
@@ -3,9 +3,8 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
3
3
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
4
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
5
5
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
6
|
-
function _classPrivateFieldGet(
|
|
7
|
-
function
|
|
8
|
-
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
|
6
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
7
|
+
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"); }
|
|
9
8
|
import { deleteAsync } from 'del';
|
|
10
9
|
import { ASSETS_TYPES } from '../../config/constants.js';
|
|
11
10
|
function unique(arr) {
|
|
@@ -23,11 +22,8 @@ var _getAssetsDir = /*#__PURE__*/new WeakMap();
|
|
|
23
22
|
class CleanTask extends BalmJS.BalmTask {
|
|
24
23
|
constructor() {
|
|
25
24
|
super('clean');
|
|
26
|
-
_classPrivateFieldInitSpec(this, _getAssetsDir, {
|
|
27
|
-
|
|
28
|
-
value: (rootKey = 'assets') => {
|
|
29
|
-
return unique(ASSETS_TYPES.map(assetType => BalmJS.config[rootKey][assetType]));
|
|
30
|
-
}
|
|
25
|
+
_classPrivateFieldInitSpec(this, _getAssetsDir, (rootKey = 'assets') => {
|
|
26
|
+
return unique(ASSETS_TYPES.map(assetType => BalmJS.config[rootKey][assetType]));
|
|
31
27
|
});
|
|
32
28
|
_defineProperty(this, "fn", async callback => {
|
|
33
29
|
const taskName = `${this.name} task`;
|
|
@@ -55,7 +51,7 @@ class CleanTask extends BalmJS.BalmTask {
|
|
|
55
51
|
return BalmJS.config.assets.root.trim().length ? [BalmJS.config.assets.root] : [];
|
|
56
52
|
}
|
|
57
53
|
get remoteAppDir() {
|
|
58
|
-
return BalmJS.config.assets.subDir ? [BalmJS.config.assets.static] : _classPrivateFieldGet(
|
|
54
|
+
return BalmJS.config.assets.subDir ? [BalmJS.config.assets.static] : _classPrivateFieldGet(_getAssetsDir, this).call(this);
|
|
59
55
|
}
|
|
60
56
|
get dirInFrontend() {
|
|
61
57
|
const isLocal = !node.path.isAbsolute(BalmJS.config.assets.root);
|
|
@@ -67,7 +63,7 @@ class CleanTask extends BalmJS.BalmTask {
|
|
|
67
63
|
const buildDirInProd = hasBuildDir ? [BalmJS.config.dest.static] : [];
|
|
68
64
|
const buildDirInDev = hasBuildDir ? [node.path.join(BalmJS.config.dest.static, BalmJS.config.assets.buildDir)] // NOTE: fix for `BalmJS.file.assetsSuffixPath` in development
|
|
69
65
|
: [];
|
|
70
|
-
return [...(BalmJS.config.env.isProd && hasBuildDir ? buildDirInProd : [...buildDirInDev, ..._classPrivateFieldGet(
|
|
66
|
+
return [...(BalmJS.config.env.isProd && hasBuildDir ? buildDirInProd : [...buildDirInDev, ..._classPrivateFieldGet(_getAssetsDir, this).call(this, 'dest')])];
|
|
71
67
|
}
|
|
72
68
|
}
|
|
73
69
|
export default CleanTask;
|
|
@@ -3,9 +3,8 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
3
3
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
4
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
5
5
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
6
|
-
function _classPrivateFieldGet(
|
|
7
|
-
function
|
|
8
|
-
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
|
6
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
7
|
+
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"); }
|
|
9
8
|
import { build } from 'modernizr';
|
|
10
9
|
var _readConfig = /*#__PURE__*/new WeakMap();
|
|
11
10
|
var _createDir = /*#__PURE__*/new WeakMap();
|
|
@@ -13,48 +12,39 @@ var _generateScript = /*#__PURE__*/new WeakMap();
|
|
|
13
12
|
class ModernizrTask extends BalmJS.BalmTask {
|
|
14
13
|
constructor() {
|
|
15
14
|
super('modernizr');
|
|
16
|
-
_classPrivateFieldInitSpec(this, _readConfig, {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (err) reject(err);
|
|
22
|
-
resolve(JSON.parse(data));
|
|
23
|
-
});
|
|
15
|
+
_classPrivateFieldInitSpec(this, _readConfig, () => {
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
node.fs.readFile(this.input, 'utf8', (err, data) => {
|
|
18
|
+
if (err) reject(err);
|
|
19
|
+
resolve(JSON.parse(data));
|
|
24
20
|
});
|
|
25
|
-
}
|
|
21
|
+
});
|
|
26
22
|
});
|
|
27
|
-
_classPrivateFieldInitSpec(this, _createDir, {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (err) reject(err);
|
|
35
|
-
resolve();
|
|
36
|
-
});
|
|
23
|
+
_classPrivateFieldInitSpec(this, _createDir, () => {
|
|
24
|
+
return new Promise((resolve, reject) => {
|
|
25
|
+
node.fs.mkdir(BalmJS.file.absPath(BalmJS.config.dest.js), {
|
|
26
|
+
recursive: true
|
|
27
|
+
}, err => {
|
|
28
|
+
if (err) reject(err);
|
|
29
|
+
resolve();
|
|
37
30
|
});
|
|
38
|
-
}
|
|
31
|
+
});
|
|
39
32
|
});
|
|
40
|
-
_classPrivateFieldInitSpec(this, _generateScript, {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (err) reject(err);
|
|
47
|
-
resolve(content);
|
|
48
|
-
});
|
|
33
|
+
_classPrivateFieldInitSpec(this, _generateScript, config => {
|
|
34
|
+
return new Promise((resolve, reject) => {
|
|
35
|
+
build(config, content => {
|
|
36
|
+
node.fs.writeFile(this.output, content, err => {
|
|
37
|
+
if (err) reject(err);
|
|
38
|
+
resolve(content);
|
|
49
39
|
});
|
|
50
40
|
});
|
|
51
|
-
}
|
|
41
|
+
});
|
|
52
42
|
});
|
|
53
43
|
_defineProperty(this, "fn", async callback => {
|
|
54
44
|
this.init();
|
|
55
45
|
if (node.fs.existsSync(this.input)) {
|
|
56
|
-
const [config] = await Promise.all([_classPrivateFieldGet(
|
|
57
|
-
await _classPrivateFieldGet(
|
|
46
|
+
const [config] = await Promise.all([_classPrivateFieldGet(_readConfig, this).call(this), _classPrivateFieldGet(_createDir, this).call(this)]);
|
|
47
|
+
await _classPrivateFieldGet(_generateScript, this).call(this, config);
|
|
58
48
|
} else {
|
|
59
49
|
BalmJS.logger.warn(`${this.name} task`, `The '${this.input}' does not exist`, {
|
|
60
50
|
logLevel: BalmJS.LogLevel.Info
|
|
@@ -1,59 +1,52 @@
|
|
|
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 _tasks = /*#__PURE__*/new WeakMap();
|
|
8
7
|
var _getParams = /*#__PURE__*/new WeakMap();
|
|
9
8
|
class SpriteTask extends BalmJS.BalmTask {
|
|
10
9
|
constructor() {
|
|
11
10
|
super('sprite');
|
|
12
|
-
_classPrivateFieldInitSpec(this, _tasks,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
11
|
+
_classPrivateFieldInitSpec(this, _tasks, []);
|
|
12
|
+
_classPrivateFieldInitSpec(this, _getParams, (spriteItem, spriteOptions) => {
|
|
13
|
+
const stylesConfig = Object.assign(spriteOptions, BalmJS.config.styles);
|
|
14
|
+
const spriteName = `${spriteItem.folderName}-${this.name}s`;
|
|
15
|
+
const imageTarget = stylesConfig.imageTarget || BalmJS.config.paths.target.img;
|
|
16
|
+
let defaultParams = Object.assign({
|
|
17
|
+
padding: 1
|
|
18
|
+
}, {
|
|
19
|
+
imgName: `${spriteName}.png`,
|
|
20
|
+
// E.g. 'awesome-sprites.png'
|
|
21
|
+
cssName: `_${spriteItem.folderName}.${stylesConfig.extname}`,
|
|
22
|
+
// E.g. "_awesome.{css,sass,scss,less}"
|
|
23
|
+
imgPath: `${stylesConfig.imageBasePath}${imageTarget}/${spriteName}.png`,
|
|
24
|
+
// E.g. "../img/awesome-sprites.png"
|
|
25
|
+
cssVarMap: sprite => {
|
|
26
|
+
sprite.name = `${spriteItem.folderName}-${sprite.name}`; // E.g. "awesome-icon-name"
|
|
27
|
+
},
|
|
28
|
+
cssSpritesheetName: `${spriteItem.folderName}-spritesheet`,
|
|
29
|
+
// E.g. "awesome-spritesheet"
|
|
30
|
+
cssOpts: {
|
|
31
|
+
cssSelector: sprite => `.${sprite.name}` // className in css file: '.icon-awesome'
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
if (stylesConfig.spriteRetina) {
|
|
35
|
+
defaultParams = Object.assign(defaultParams, {
|
|
36
|
+
retinaSrcFilter: `${spriteItem.retinaSrc}`,
|
|
37
|
+
retinaImgName: `${spriteName}@2x.png`,
|
|
38
|
+
// E.g. 'awesome-sprites@2x.png'
|
|
39
|
+
retinaImgPath: `${stylesConfig.imageBasePath}${imageTarget}/${spriteName}@2x.png`,
|
|
40
|
+
// E.g. "../img/awesome-sprites@2x.png"
|
|
31
41
|
cssVarMap: sprite => {
|
|
32
42
|
sprite.name = `${spriteItem.folderName}-${sprite.name}`; // E.g. "awesome-icon-name"
|
|
33
43
|
},
|
|
34
|
-
|
|
35
|
-
// E.g. "awesome-spritesheet"
|
|
36
|
-
|
|
37
|
-
cssSelector: sprite => `.${sprite.name}` // className in css file: '.icon-awesome'
|
|
38
|
-
}
|
|
44
|
+
cssRetinaSpritesheetName: `${spriteItem.folderName}-spritesheet-2x`,
|
|
45
|
+
// E.g. "awesome-spritesheet-2x"
|
|
46
|
+
cssRetinaGroupsName: `${spriteItem.folderName}-retina-groups` // E.g. "awesome-retina-groups"
|
|
39
47
|
});
|
|
40
|
-
if (stylesConfig.spriteRetina) {
|
|
41
|
-
defaultParams = Object.assign(defaultParams, {
|
|
42
|
-
retinaSrcFilter: `${spriteItem.retinaSrc}`,
|
|
43
|
-
retinaImgName: `${spriteName}@2x.png`,
|
|
44
|
-
// E.g. 'awesome-sprites@2x.png'
|
|
45
|
-
retinaImgPath: `${stylesConfig.imageBasePath}${imageTarget}/${spriteName}@2x.png`,
|
|
46
|
-
// E.g. "../img/awesome-sprites@2x.png"
|
|
47
|
-
cssVarMap: sprite => {
|
|
48
|
-
sprite.name = `${spriteItem.folderName}-${sprite.name}`; // E.g. "awesome-icon-name"
|
|
49
|
-
},
|
|
50
|
-
cssRetinaSpritesheetName: `${spriteItem.folderName}-spritesheet-2x`,
|
|
51
|
-
// E.g. "awesome-spritesheet-2x"
|
|
52
|
-
cssRetinaGroupsName: `${spriteItem.folderName}-retina-groups` // E.g. "awesome-retina-groups"
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
return Object.assign(defaultParams, stylesConfig.spriteParams);
|
|
56
48
|
}
|
|
49
|
+
return Object.assign(defaultParams, stylesConfig.spriteParams);
|
|
57
50
|
});
|
|
58
51
|
this.defaultInput = BalmJS.config.styles.sprites;
|
|
59
52
|
this.defaultOutput = BalmJS.config.dest.img;
|
|
@@ -82,7 +75,7 @@ class SpriteTask extends BalmJS.BalmTask {
|
|
|
82
75
|
BalmJS.logger.debug(`${this.name} task`, spriteConfig, {
|
|
83
76
|
pre: true
|
|
84
77
|
});
|
|
85
|
-
spriteConfig.params = _classPrivateFieldGet(
|
|
78
|
+
spriteConfig.params = _classPrivateFieldGet(_getParams, this).call(this, spriteItem, spriteOptions);
|
|
86
79
|
gulp.task(BalmJS.toNamespace(spriteTaskName), () => {
|
|
87
80
|
const spriteData = gulp.src(spriteConfig.input).pipe(BalmJS.plugins.plumber(error => {
|
|
88
81
|
BalmJS.logger.error(`${this.name} task`, error.message);
|
|
@@ -91,7 +84,7 @@ class SpriteTask extends BalmJS.BalmTask {
|
|
|
91
84
|
const cssStream = spriteData.css.pipe(gulp.dest(spriteConfig.cssOutput));
|
|
92
85
|
return mergeStream(imgStream, cssStream);
|
|
93
86
|
});
|
|
94
|
-
_classPrivateFieldGet(
|
|
87
|
+
_classPrivateFieldGet(_tasks, this).push(spriteTaskName);
|
|
95
88
|
}
|
|
96
89
|
}
|
|
97
90
|
recipe(input, output, spriteOptions = {}) {
|
|
@@ -104,7 +97,7 @@ class SpriteTask extends BalmJS.BalmTask {
|
|
|
104
97
|
}
|
|
105
98
|
}
|
|
106
99
|
get deps() {
|
|
107
|
-
return _classPrivateFieldGet(
|
|
100
|
+
return _classPrivateFieldGet(_tasks, this);
|
|
108
101
|
}
|
|
109
102
|
}
|
|
110
103
|
export default SpriteTask;
|
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
|
}
|
package/lib/tasks/public/zip.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import zip from 'gulp-zip';
|
|
1
2
|
class ZipTask extends BalmJS.BalmTask {
|
|
2
3
|
constructor() {
|
|
3
4
|
super('zip');
|
|
@@ -7,7 +8,7 @@ class ZipTask extends BalmJS.BalmTask {
|
|
|
7
8
|
recipe(input, output, filename = 'archive.zip') {
|
|
8
9
|
const balmZip = () => {
|
|
9
10
|
this.init(input, output);
|
|
10
|
-
return this.src.pipe(
|
|
11
|
+
return this.src.pipe(zip(filename)).pipe(gulp.dest(this.output));
|
|
11
12
|
};
|
|
12
13
|
return balmZip;
|
|
13
14
|
}
|
|
@@ -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.28.0",
|
|
4
4
|
"description": "BalmJS compiler core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"balm",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"connect-history-api-fallback": "^2.0.0",
|
|
51
51
|
"css-loader": "^6.10.0",
|
|
52
52
|
"css-minimizer-webpack-plugin": "^6.0.0",
|
|
53
|
-
"cssnano": "^6.0.
|
|
53
|
+
"cssnano": "^6.0.5",
|
|
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",
|
|
@@ -72,34 +72,34 @@
|
|
|
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
79
|
"postcss": "^8.4.35",
|
|
80
80
|
"postcss-flexbugs-fixes": "^5.0.2",
|
|
81
|
-
"postcss-import": "^16.0.
|
|
82
|
-
"postcss-load-config": "^5.0.
|
|
83
|
-
"postcss-loader": "^8.1.
|
|
84
|
-
"postcss-preset-env": "
|
|
81
|
+
"postcss-import": "^16.0.1",
|
|
82
|
+
"postcss-load-config": "^5.0.3",
|
|
83
|
+
"postcss-loader": "^8.1.1",
|
|
84
|
+
"postcss-preset-env": "^9.4.0",
|
|
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.12.0",
|
|
89
|
+
"sass": "^1.71.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
95
|
"tailwindcss": "^3.4.1",
|
|
96
|
-
"terser": "^5.
|
|
96
|
+
"terser": "^5.28.1",
|
|
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.90.
|
|
102
|
+
"webpack": "^5.90.3",
|
|
103
103
|
"webpack-bundle-analyzer": "^4.10.1",
|
|
104
104
|
"webpack-dev-middleware": "^7.0.0",
|
|
105
105
|
"webpack-hot-middleware": "^2.26.1",
|
|
@@ -130,5 +130,5 @@
|
|
|
130
130
|
"engines": {
|
|
131
131
|
"node": ">=18.12.0"
|
|
132
132
|
},
|
|
133
|
-
"gitHead": "
|
|
133
|
+
"gitHead": "aaa9a36f620bcc9e22ba44d9abb3f730349f78dd"
|
|
134
134
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import zip from 'gulp-zip';
|
|
1
2
|
class ZipTask extends BalmJS.BalmTask {
|
|
2
3
|
constructor() {
|
|
3
4
|
super('zip');
|
|
@@ -7,7 +8,7 @@ class ZipTask extends BalmJS.BalmTask {
|
|
|
7
8
|
recipe(input, output, filename = 'archive.zip') {
|
|
8
9
|
const balmZip = () => {
|
|
9
10
|
this.init(input, output);
|
|
10
|
-
return this.src.pipe(
|
|
11
|
+
return this.src.pipe(zip(filename)).pipe(gulp.dest(this.output));
|
|
11
12
|
};
|
|
12
13
|
return balmZip;
|
|
13
14
|
}
|