balm-core 4.11.0 → 4.12.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 -20
- package/lib/bootstrap/check_config.js +6 -9
- package/lib/bootstrap/index.js +16 -22
- package/lib/bundler/esbuild/build.js +0 -2
- package/lib/bundler/esbuild/index.js +0 -2
- package/lib/bundler/esbuild/transform.js +0 -4
- package/lib/bundler/rollup/build.js +2 -4
- package/lib/bundler/rollup/entry.js +2 -5
- package/lib/bundler/rollup/index.js +0 -3
- package/lib/bundler/rollup/output.js +0 -5
- package/lib/bundler/rollup/plugins.js +0 -10
- package/lib/bundler/webpack/config/common.js +4 -15
- package/lib/bundler/webpack/config/dev.js +2 -3
- package/lib/bundler/webpack/config/env.js +12 -14
- package/lib/bundler/webpack/config/index.js +0 -2
- package/lib/bundler/webpack/config/prod.js +4 -7
- package/lib/bundler/webpack/entry.js +8 -12
- package/lib/bundler/webpack/index.js +2 -5
- package/lib/bundler/webpack/loaders.js +0 -6
- package/lib/bundler/webpack/output.js +0 -5
- package/lib/bundler/webpack/rules/asset.js +2 -3
- package/lib/bundler/webpack/rules/babel.js +3 -4
- package/lib/bundler/webpack/rules/css.js +4 -10
- package/lib/bundler/webpack/rules/html.js +0 -2
- package/lib/config/assets.js +0 -5
- package/lib/config/env.js +0 -2
- package/lib/config/globals.js +2 -5
- package/lib/config/index.js +0 -5
- package/lib/config/logs.js +0 -1
- package/lib/config/paths.js +3 -3
- package/lib/config/pwa.js +0 -3
- package/lib/config/roots.js +0 -2
- package/lib/config/scripts.js +20 -28
- package/lib/config/server.js +4 -10
- package/lib/config/styles.js +2 -10
- package/lib/hello.js +0 -2
- package/lib/hooks/index.js +18 -35
- package/lib/hooks/maker.js +0 -14
- package/lib/middlewares/history.js +0 -2
- package/lib/middlewares/index.js +0 -4
- package/lib/middlewares/proxy.js +0 -6
- package/lib/middlewares/webpack.js +0 -5
- package/lib/plugins/htmlmin.js +1 -7
- package/lib/plugins/imagemin.js +1 -18
- package/lib/plugins/jsmin.js +0 -10
- package/lib/plugins/less.js +7 -14
- package/lib/plugins/plumber.js +4 -21
- package/lib/plugins/postcss-plugins.js +0 -2
- package/lib/plugins/postcss.js +8 -21
- package/lib/plugins/rename.js +2 -13
- package/lib/plugins/replace.js +4 -22
- package/lib/plugins/sass.js +30 -39
- package/lib/plugins/sftp.js +33 -62
- package/lib/tasks/default.js +10 -19
- package/lib/tasks/foundation/balm.js +0 -25
- package/lib/tasks/foundation/balm_style.js +2 -15
- package/lib/tasks/foundation/index.js +0 -2
- package/lib/tasks/index.js +8 -7
- package/lib/tasks/private/build.js +0 -5
- package/lib/tasks/private/cache.js +0 -6
- package/lib/tasks/private/clean.js +0 -20
- package/lib/tasks/private/end.js +0 -6
- package/lib/tasks/private/extra.js +4 -11
- package/lib/tasks/private/font.js +0 -5
- package/lib/tasks/private/image.js +0 -11
- package/lib/tasks/private/lint.js +0 -5
- package/lib/tasks/private/media.js +0 -5
- package/lib/tasks/private/modernizr.js +0 -19
- package/lib/tasks/private/pwa-cache.js +0 -7
- package/lib/tasks/private/script.js +0 -3
- package/lib/tasks/private/sprite.js +3 -25
- package/lib/tasks/private/start.js +0 -6
- package/lib/tasks/private/style.js +0 -3
- package/lib/tasks/private/workbox-sw.js +0 -5
- package/lib/tasks/public/copy.js +0 -5
- package/lib/tasks/public/esbuild.js +0 -6
- package/lib/tasks/public/ftp.js +0 -11
- package/lib/tasks/public/html.js +0 -20
- package/lib/tasks/public/jsmin.js +0 -6
- package/lib/tasks/public/less.js +0 -6
- package/lib/tasks/public/postcss.js +0 -5
- package/lib/tasks/public/publish.js +3 -15
- package/lib/tasks/public/pwa.js +0 -13
- package/lib/tasks/public/remove.js +2 -18
- package/lib/tasks/public/replace.js +0 -7
- package/lib/tasks/public/rollup.js +0 -6
- package/lib/tasks/public/sass.js +0 -6
- package/lib/tasks/public/server.js +4 -32
- package/lib/tasks/public/url.js +0 -13
- package/lib/tasks/public/version.js +0 -6
- package/lib/tasks/public/webpack.js +2 -12
- package/lib/tasks/public/zip.js +0 -5
- package/lib/utilities/address.js +5 -16
- package/lib/utilities/cache-core.js +5 -13
- package/lib/utilities/color.js +0 -5
- package/lib/utilities/compiling.js +0 -14
- package/lib/utilities/detect-port.js +6 -22
- package/lib/utilities/escape-string-regexp.js +3 -4
- package/lib/utilities/file.js +2 -18
- package/lib/utilities/loading.js +0 -23
- package/lib/utilities/logger.js +0 -19
- package/lib/utilities/merge-stream.js +0 -8
- package/lib/utilities/namespace.js +0 -4
- package/lib/utilities/public-url.js +10 -10
- package/lib/utilities/replacestream.js +5 -27
- package/lib/utilities/typeof.js +0 -2
- package/lib/utilities/utils.js +2 -9
- package/package.json +24 -24
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
2
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
4
|
-
|
|
5
3
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
6
|
-
|
|
7
4
|
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
|
8
|
-
|
|
9
5
|
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
|
10
|
-
|
|
11
6
|
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
|
12
|
-
|
|
13
7
|
import { deleteAsync } from 'del';
|
|
14
8
|
import { ASSETS_TYPES } from '../../config/constants.js';
|
|
15
|
-
|
|
16
9
|
function unique(arr) {
|
|
17
10
|
const obj = {};
|
|
18
11
|
const result = [];
|
|
19
|
-
|
|
20
12
|
for (let i = 0, len = arr.length; i < len; i++) {
|
|
21
13
|
if (!obj[arr[i]]) {
|
|
22
14
|
obj[arr[i]] = true;
|
|
@@ -26,28 +18,22 @@ function unique(arr) {
|
|
|
26
18
|
|
|
27
19
|
return result;
|
|
28
20
|
}
|
|
29
|
-
|
|
30
21
|
var _getAssetsDir = /*#__PURE__*/new WeakMap();
|
|
31
|
-
|
|
32
22
|
class CleanTask extends BalmJS.BalmTask {
|
|
33
23
|
constructor() {
|
|
34
24
|
super('clean');
|
|
35
|
-
|
|
36
25
|
_classPrivateFieldInitSpec(this, _getAssetsDir, {
|
|
37
26
|
writable: true,
|
|
38
27
|
value: (rootKey = 'assets') => {
|
|
39
28
|
return unique(ASSETS_TYPES.map(assetType => BalmJS.config[rootKey][assetType]));
|
|
40
29
|
}
|
|
41
30
|
});
|
|
42
|
-
|
|
43
31
|
_defineProperty(this, "fn", async callback => {
|
|
44
32
|
const taskName = `${this.name} task`;
|
|
45
33
|
const directories = BalmJS.config.inFrontend ? this.dirInFrontend : this.dirInBackend;
|
|
46
|
-
|
|
47
34
|
if (BalmJS.config.env.isProd && !BalmJS.config.assets.root) {
|
|
48
35
|
BalmJS.logger.warn(taskName, 'Remote root path is empty');
|
|
49
36
|
}
|
|
50
|
-
|
|
51
37
|
BalmJS.logger.debug(taskName, {
|
|
52
38
|
directories
|
|
53
39
|
}, {
|
|
@@ -64,21 +50,17 @@ class CleanTask extends BalmJS.BalmTask {
|
|
|
64
50
|
callback();
|
|
65
51
|
});
|
|
66
52
|
}
|
|
67
|
-
|
|
68
53
|
get remoteRootDir() {
|
|
69
54
|
return BalmJS.config.assets.root.trim().length ? [BalmJS.config.assets.root] : [];
|
|
70
55
|
}
|
|
71
|
-
|
|
72
56
|
get remoteAppDir() {
|
|
73
57
|
return BalmJS.config.assets.subDir ? [BalmJS.config.assets.static] : _classPrivateFieldGet(this, _getAssetsDir).call(this);
|
|
74
58
|
}
|
|
75
|
-
|
|
76
59
|
get dirInFrontend() {
|
|
77
60
|
const isLocal = !node.path.isAbsolute(BalmJS.config.assets.root);
|
|
78
61
|
BalmJS.logger.info(`${this.name} task`, `'${BalmJS.config.assets.root}' is local directory: ${isLocal}`);
|
|
79
62
|
return BalmJS.config.env.isProd ? [BalmJS.file.absPath(BalmJS.config.roots.target), ...(isLocal ? this.remoteRootDir : this.remoteAppDir)] : [BalmJS.file.absPath(BalmJS.config.roots.tmp)];
|
|
80
63
|
}
|
|
81
|
-
|
|
82
64
|
get dirInBackend() {
|
|
83
65
|
const hasBuildDir = BalmJS.config.assets.cache && !!(BalmJS.config.assets.buildDir || BalmJS.config.assets.subDir);
|
|
84
66
|
const buildDirInProd = hasBuildDir ? [BalmJS.config.dest.static] : [];
|
|
@@ -86,7 +68,5 @@ class CleanTask extends BalmJS.BalmTask {
|
|
|
86
68
|
: [];
|
|
87
69
|
return [...(BalmJS.config.env.isProd && hasBuildDir ? buildDirInProd : [...buildDirInDev, ..._classPrivateFieldGet(this, _getAssetsDir).call(this, 'dest')])];
|
|
88
70
|
}
|
|
89
|
-
|
|
90
71
|
}
|
|
91
|
-
|
|
92
72
|
export default CleanTask;
|
package/lib/tasks/private/end.js
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
2
|
class EndTask extends BalmJS.BalmTask {
|
|
4
3
|
constructor() {
|
|
5
4
|
super('end');
|
|
6
|
-
|
|
7
5
|
_defineProperty(this, "fn", async callback => {
|
|
8
6
|
if (BalmJS.utils.isFunction(BalmJS.afterTask)) {
|
|
9
7
|
await BalmJS.afterTask();
|
|
10
8
|
}
|
|
11
|
-
|
|
12
9
|
this.time();
|
|
13
10
|
BalmJS.emitter.emit('exit');
|
|
14
11
|
callback();
|
|
15
12
|
});
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
time() {
|
|
19
15
|
const end = process.hrtime(BalmJS.start);
|
|
20
16
|
const timeInMs = Math.ceil((end[0] * 1000000000 + end[1]) / 1000000);
|
|
@@ -22,7 +18,5 @@ class EndTask extends BalmJS.BalmTask {
|
|
|
22
18
|
logLevel: BalmJS.LogLevel.Error
|
|
23
19
|
});
|
|
24
20
|
}
|
|
25
|
-
|
|
26
21
|
}
|
|
27
|
-
|
|
28
22
|
export default EndTask;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
2
|
class ExtraTask extends BalmJS.BalmTask {
|
|
4
3
|
constructor() {
|
|
5
4
|
super('extra');
|
|
6
|
-
|
|
7
5
|
_defineProperty(this, "fn", () => {
|
|
8
6
|
this.init();
|
|
9
7
|
this.gulpSrcOptions = {
|
|
@@ -11,30 +9,25 @@ class ExtraTask extends BalmJS.BalmTask {
|
|
|
11
9
|
};
|
|
12
10
|
return this.src.pipe(gulp.dest(this.output));
|
|
13
11
|
});
|
|
14
|
-
|
|
15
12
|
const includeGlobs = [];
|
|
16
|
-
|
|
17
13
|
if (BalmJS.config.extras.includes.length) {
|
|
18
14
|
for (const filename of BalmJS.config.extras.includes) {
|
|
19
15
|
includeGlobs.push(node.path.join(BalmJS.config.src.base, filename));
|
|
20
16
|
}
|
|
21
17
|
}
|
|
22
|
-
|
|
23
18
|
const excludeGlobs = [];
|
|
24
|
-
|
|
25
19
|
if (BalmJS.config.extras.excludes.length) {
|
|
26
20
|
for (const filename of BalmJS.config.extras.excludes) {
|
|
27
21
|
excludeGlobs.push(node.path.join(`!${BalmJS.config.src.base}`, filename));
|
|
28
22
|
}
|
|
29
23
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
node.path.join(`!${BalmJS.config.src.base}`, '*.html'), node.path.join(`!${BalmJS.config.src.base}`, BalmJS.config.pwa.manifest), ...includeGlobs,
|
|
24
|
+
const defaultGlobs = [node.path.join(BalmJS.config.src.base, '*.*'),
|
|
25
|
+
// All files but ignore all folders in the app root directory
|
|
26
|
+
node.path.join(`!${BalmJS.config.src.base}`, '*.html'), node.path.join(`!${BalmJS.config.src.base}`, BalmJS.config.pwa.manifest), ...includeGlobs,
|
|
27
|
+
// e.g. CNAME
|
|
33
28
|
...excludeGlobs];
|
|
34
29
|
this.defaultInput = defaultGlobs;
|
|
35
30
|
this.defaultOutput = BalmJS.config.dest.base;
|
|
36
31
|
}
|
|
37
|
-
|
|
38
32
|
}
|
|
39
|
-
|
|
40
33
|
export default ExtraTask;
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
2
|
class FontTask extends BalmJS.BalmTask {
|
|
4
3
|
constructor() {
|
|
5
4
|
super('font');
|
|
6
|
-
|
|
7
5
|
_defineProperty(this, "fn", () => {
|
|
8
6
|
this.init();
|
|
9
7
|
return this.src.pipe(gulp.dest(this.output));
|
|
10
8
|
});
|
|
11
|
-
|
|
12
9
|
this.defaultInput = BalmJS.file.matchAllFiles(BalmJS.config.src.font, '*.{eot,svg,ttf,woff,woff2}');
|
|
13
10
|
this.defaultOutput = BalmJS.config.dest.font;
|
|
14
11
|
}
|
|
15
|
-
|
|
16
12
|
}
|
|
17
|
-
|
|
18
13
|
export default FontTask;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
2
|
import { getDefaultImagePlugins } from '../../plugins/imagemin.js';
|
|
4
|
-
|
|
5
3
|
class ImageTask extends BalmJS.BalmTask {
|
|
6
4
|
constructor() {
|
|
7
5
|
super('image');
|
|
8
|
-
|
|
9
6
|
_defineProperty(this, "fn", () => {
|
|
10
7
|
this.init();
|
|
11
|
-
|
|
12
8
|
const balmImage = () => {
|
|
13
9
|
return gulp.src(BalmJS.file.absPaths(this.input), {
|
|
14
10
|
since: gulp.lastRun(balmImage)
|
|
@@ -16,20 +12,15 @@ class ImageTask extends BalmJS.BalmTask {
|
|
|
16
12
|
BalmJS.logger.error(`${this.name} task`, error);
|
|
17
13
|
})).pipe(BalmJS.plugins.imagemin(this.plugins)).pipe(gulp.dest(this.output));
|
|
18
14
|
};
|
|
19
|
-
|
|
20
15
|
return balmImage();
|
|
21
16
|
});
|
|
22
|
-
|
|
23
17
|
const excludeGlobs = [];
|
|
24
|
-
|
|
25
18
|
for (const imageFolder of BalmJS.config.styles.sprites) {
|
|
26
19
|
excludeGlobs.push(node.path.join(`!${BalmJS.config.src.img}`, imageFolder));
|
|
27
20
|
excludeGlobs.push(node.path.join(`!${BalmJS.config.src.img}`, imageFolder, '*.png'));
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
this.defaultInput = [BalmJS.file.matchAllFiles(BalmJS.config.src.img), ...excludeGlobs];
|
|
31
23
|
this.defaultOutput = BalmJS.config.dest.img;
|
|
32
|
-
|
|
33
24
|
if (BalmJS.utils.isArray(BalmJS.config.images.plugins)) {
|
|
34
25
|
this.plugins = BalmJS.config.images.plugins; // Using custom imagemin plugins
|
|
35
26
|
} else {
|
|
@@ -39,7 +30,5 @@ class ImageTask extends BalmJS.BalmTask {
|
|
|
39
30
|
BalmJS.logger.debug(`${this.name} task - plugins`, enablePlugins);
|
|
40
31
|
}
|
|
41
32
|
}
|
|
42
|
-
|
|
43
33
|
}
|
|
44
|
-
|
|
45
34
|
export default ImageTask;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
2
|
class LintTask extends BalmJS.BalmTask {
|
|
4
3
|
constructor() {
|
|
5
4
|
super('lint');
|
|
6
|
-
|
|
7
5
|
_defineProperty(this, "fn", () => {
|
|
8
6
|
this.init();
|
|
9
7
|
return this.src.pipe($.eslint({
|
|
@@ -13,11 +11,8 @@ class LintTask extends BalmJS.BalmTask {
|
|
|
13
11
|
once: true
|
|
14
12
|
})).pipe($.eslint.format()).pipe($.if(!server.active, $.eslint.failAfterError())).pipe(gulp.dest(this.output));
|
|
15
13
|
});
|
|
16
|
-
|
|
17
14
|
this.defaultOutput = BalmJS.config.src.js;
|
|
18
15
|
this.defaultInput = BalmJS.file.matchAllFiles(this.defaultOutput, '*.js');
|
|
19
16
|
}
|
|
20
|
-
|
|
21
17
|
}
|
|
22
|
-
|
|
23
18
|
export default LintTask;
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
2
|
class MediaTask extends BalmJS.BalmTask {
|
|
4
3
|
constructor() {
|
|
5
4
|
super('media');
|
|
6
|
-
|
|
7
5
|
_defineProperty(this, "fn", () => {
|
|
8
6
|
this.init();
|
|
9
7
|
return this.src.pipe(gulp.dest(this.output));
|
|
10
8
|
});
|
|
11
|
-
|
|
12
9
|
this.defaultInput = BalmJS.file.matchAllFiles(BalmJS.config.src.media);
|
|
13
10
|
this.defaultOutput = BalmJS.config.dest.media;
|
|
14
11
|
}
|
|
15
|
-
|
|
16
12
|
}
|
|
17
|
-
|
|
18
13
|
export default MediaTask;
|
|
@@ -1,27 +1,16 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
2
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
4
|
-
|
|
5
3
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
6
|
-
|
|
7
4
|
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
|
8
|
-
|
|
9
5
|
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
|
10
|
-
|
|
11
6
|
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
|
12
|
-
|
|
13
7
|
import { build } from 'modernizr';
|
|
14
|
-
|
|
15
8
|
var _readConfig = /*#__PURE__*/new WeakMap();
|
|
16
|
-
|
|
17
9
|
var _createDir = /*#__PURE__*/new WeakMap();
|
|
18
|
-
|
|
19
10
|
var _generateScript = /*#__PURE__*/new WeakMap();
|
|
20
|
-
|
|
21
11
|
class ModernizrTask extends BalmJS.BalmTask {
|
|
22
12
|
constructor() {
|
|
23
13
|
super('modernizr');
|
|
24
|
-
|
|
25
14
|
_classPrivateFieldInitSpec(this, _readConfig, {
|
|
26
15
|
writable: true,
|
|
27
16
|
value: () => {
|
|
@@ -33,7 +22,6 @@ class ModernizrTask extends BalmJS.BalmTask {
|
|
|
33
22
|
});
|
|
34
23
|
}
|
|
35
24
|
});
|
|
36
|
-
|
|
37
25
|
_classPrivateFieldInitSpec(this, _createDir, {
|
|
38
26
|
writable: true,
|
|
39
27
|
value: () => {
|
|
@@ -47,7 +35,6 @@ class ModernizrTask extends BalmJS.BalmTask {
|
|
|
47
35
|
});
|
|
48
36
|
}
|
|
49
37
|
});
|
|
50
|
-
|
|
51
38
|
_classPrivateFieldInitSpec(this, _generateScript, {
|
|
52
39
|
writable: true,
|
|
53
40
|
value: config => {
|
|
@@ -61,10 +48,8 @@ class ModernizrTask extends BalmJS.BalmTask {
|
|
|
61
48
|
});
|
|
62
49
|
}
|
|
63
50
|
});
|
|
64
|
-
|
|
65
51
|
_defineProperty(this, "fn", async callback => {
|
|
66
52
|
this.init();
|
|
67
|
-
|
|
68
53
|
if (node.fs.existsSync(this.input)) {
|
|
69
54
|
const [config] = await Promise.all([_classPrivateFieldGet(this, _readConfig).call(this), _classPrivateFieldGet(this, _createDir).call(this)]);
|
|
70
55
|
await _classPrivateFieldGet(this, _generateScript).call(this, config);
|
|
@@ -73,14 +58,10 @@ class ModernizrTask extends BalmJS.BalmTask {
|
|
|
73
58
|
logLevel: BalmJS.LogLevel.Info
|
|
74
59
|
});
|
|
75
60
|
}
|
|
76
|
-
|
|
77
61
|
callback();
|
|
78
62
|
});
|
|
79
|
-
|
|
80
63
|
this.defaultInput = `${this.name}.json`;
|
|
81
64
|
this.defaultOutput = node.path.join(BalmJS.config.dest.js, `${this.name}.js`);
|
|
82
65
|
}
|
|
83
|
-
|
|
84
66
|
}
|
|
85
|
-
|
|
86
67
|
export default ModernizrTask;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
2
|
import { deleteAsync } from 'del';
|
|
4
|
-
|
|
5
3
|
class PwaCacheTask extends BalmJS.BalmTask {
|
|
6
4
|
constructor() {
|
|
7
5
|
super('pwa-cache');
|
|
8
|
-
|
|
9
6
|
_defineProperty(this, "fn", () => {
|
|
10
7
|
this.init();
|
|
11
8
|
const newVersion = BalmJS.config.pwa.version || Date.now().toString();
|
|
@@ -14,18 +11,14 @@ class PwaCacheTask extends BalmJS.BalmTask {
|
|
|
14
11
|
this.clear();
|
|
15
12
|
return stream;
|
|
16
13
|
});
|
|
17
|
-
|
|
18
14
|
this.defaultOutput = BalmJS.config.dest.base;
|
|
19
15
|
this.defaultInput = node.path.join(this.defaultOutput, BalmJS.config.pwa.swDestFilename);
|
|
20
16
|
}
|
|
21
|
-
|
|
22
17
|
clear() {
|
|
23
18
|
const swOrigin = BalmJS.file.absPath(node.path.join(BalmJS.config.dest.base, BalmJS.config.pwa.swSrcFilename));
|
|
24
19
|
deleteAsync(swOrigin, {
|
|
25
20
|
force: true
|
|
26
21
|
});
|
|
27
22
|
}
|
|
28
|
-
|
|
29
23
|
}
|
|
30
|
-
|
|
31
24
|
export default PwaCacheTask;
|
|
@@ -1,28 +1,18 @@
|
|
|
1
1
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
2
|
-
|
|
3
2
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
4
|
-
|
|
5
3
|
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
|
6
|
-
|
|
7
4
|
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
|
8
|
-
|
|
9
5
|
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
|
10
|
-
|
|
11
6
|
import mergeStream from '../../utilities/merge-stream.js';
|
|
12
|
-
|
|
13
7
|
var _tasks = /*#__PURE__*/new WeakMap();
|
|
14
|
-
|
|
15
8
|
var _getParams = /*#__PURE__*/new WeakMap();
|
|
16
|
-
|
|
17
9
|
class SpriteTask extends BalmJS.BalmTask {
|
|
18
10
|
constructor() {
|
|
19
11
|
super('sprite');
|
|
20
|
-
|
|
21
12
|
_classPrivateFieldInitSpec(this, _tasks, {
|
|
22
13
|
writable: true,
|
|
23
14
|
value: []
|
|
24
15
|
});
|
|
25
|
-
|
|
26
16
|
_classPrivateFieldInitSpec(this, _getParams, {
|
|
27
17
|
writable: true,
|
|
28
18
|
value: (spriteItem, spriteOptions) => {
|
|
@@ -41,11 +31,11 @@ class SpriteTask extends BalmJS.BalmTask {
|
|
|
41
31
|
cssVarMap: sprite => {
|
|
42
32
|
sprite.name = `${spriteItem.folderName}-${sprite.name}`; // E.g. "awesome-icon-name"
|
|
43
33
|
},
|
|
34
|
+
|
|
44
35
|
cssSpritesheetName: `${spriteItem.folderName}-spritesheet`,
|
|
45
36
|
// E.g. "awesome-spritesheet"
|
|
46
37
|
cssOpts: {
|
|
47
38
|
cssSelector: sprite => `.${sprite.name}` // className in css file: '.icon-awesome'
|
|
48
|
-
|
|
49
39
|
}
|
|
50
40
|
});
|
|
51
41
|
|
|
@@ -59,29 +49,25 @@ class SpriteTask extends BalmJS.BalmTask {
|
|
|
59
49
|
cssVarMap: sprite => {
|
|
60
50
|
sprite.name = `${spriteItem.folderName}-${sprite.name}`; // E.g. "awesome-icon-name"
|
|
61
51
|
},
|
|
52
|
+
|
|
62
53
|
cssRetinaSpritesheetName: `${spriteItem.folderName}-spritesheet-2x`,
|
|
63
54
|
// E.g. "awesome-spritesheet-2x"
|
|
64
55
|
cssRetinaGroupsName: `${spriteItem.folderName}-retina-groups` // E.g. "awesome-retina-groups"
|
|
65
|
-
|
|
66
56
|
});
|
|
67
57
|
}
|
|
68
58
|
|
|
69
59
|
return Object.assign(defaultParams, stylesConfig.spriteParams);
|
|
70
60
|
}
|
|
71
61
|
});
|
|
72
|
-
|
|
73
62
|
this.defaultInput = BalmJS.config.styles.sprites;
|
|
74
63
|
this.defaultOutput = BalmJS.config.dest.img;
|
|
75
|
-
|
|
76
64
|
if (this.defaultInput.length) {
|
|
77
65
|
this.init();
|
|
78
66
|
this.collect();
|
|
79
67
|
}
|
|
80
68
|
}
|
|
81
|
-
|
|
82
69
|
collect(spriteOptions = {}) {
|
|
83
70
|
const spriteList = [];
|
|
84
|
-
|
|
85
71
|
for (const spriteName of this.input) {
|
|
86
72
|
spriteList.push({
|
|
87
73
|
src: `${BalmJS.config.src.img}/${spriteName}/*.png`,
|
|
@@ -89,17 +75,15 @@ class SpriteTask extends BalmJS.BalmTask {
|
|
|
89
75
|
folderName: spriteName
|
|
90
76
|
});
|
|
91
77
|
}
|
|
92
|
-
|
|
93
78
|
for (let key = 0, len = spriteList.length; key < len; key++) {
|
|
94
79
|
const spriteItem = spriteList[key];
|
|
95
80
|
const spriteTaskName = `${this.name}:${spriteItem.folderName}`; // E.g. 'sprite:awesome'
|
|
96
|
-
|
|
97
81
|
const spriteConfig = {
|
|
98
82
|
input: BalmJS.file.absPath(spriteItem.src),
|
|
99
83
|
imgOutput: BalmJS.file.absPath(this.output),
|
|
100
84
|
cssOutput: BalmJS.file.absPath(`${BalmJS.config.src.css}/${this.name}s`) // E.g. 'path/to/css/sprites'
|
|
101
|
-
|
|
102
85
|
};
|
|
86
|
+
|
|
103
87
|
BalmJS.logger.debug(`${this.name} task`, spriteConfig, {
|
|
104
88
|
pre: true
|
|
105
89
|
});
|
|
@@ -112,26 +96,20 @@ class SpriteTask extends BalmJS.BalmTask {
|
|
|
112
96
|
const cssStream = spriteData.css.pipe(gulp.dest(spriteConfig.cssOutput));
|
|
113
97
|
return mergeStream(imgStream, cssStream);
|
|
114
98
|
});
|
|
115
|
-
|
|
116
99
|
_classPrivateFieldGet(this, _tasks).push(spriteTaskName);
|
|
117
100
|
}
|
|
118
101
|
}
|
|
119
|
-
|
|
120
102
|
recipe(input, output, spriteOptions = {}) {
|
|
121
103
|
if (input.length) {
|
|
122
104
|
if (output && !spriteOptions.imageTarget) {
|
|
123
105
|
spriteOptions.imageTarget = output.split('/').pop();
|
|
124
106
|
}
|
|
125
|
-
|
|
126
107
|
this.init(input, output);
|
|
127
108
|
this.collect(spriteOptions);
|
|
128
109
|
}
|
|
129
110
|
}
|
|
130
|
-
|
|
131
111
|
get deps() {
|
|
132
112
|
return _classPrivateFieldGet(this, _tasks);
|
|
133
113
|
}
|
|
134
|
-
|
|
135
114
|
}
|
|
136
|
-
|
|
137
115
|
export default SpriteTask;
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
2
|
class StartTask extends BalmJS.BalmTask {
|
|
4
3
|
constructor() {
|
|
5
4
|
super('start');
|
|
6
|
-
|
|
7
5
|
_defineProperty(this, "fn", async callback => {
|
|
8
6
|
BalmJS.start = process.hrtime();
|
|
9
|
-
|
|
10
7
|
if (BalmJS.utils.isFunction(BalmJS.beforeTask)) {
|
|
11
8
|
await BalmJS.beforeTask();
|
|
12
9
|
}
|
|
13
|
-
|
|
14
10
|
callback();
|
|
15
11
|
});
|
|
16
12
|
}
|
|
17
|
-
|
|
18
13
|
}
|
|
19
|
-
|
|
20
14
|
export default StartTask;
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
2
|
class WorkboxSwTask extends BalmJS.BalmTask {
|
|
4
3
|
constructor() {
|
|
5
4
|
super('workbox-sw');
|
|
6
|
-
|
|
7
5
|
_defineProperty(this, "fn", () => {
|
|
8
6
|
this.init();
|
|
9
7
|
return this.src.pipe(gulp.dest(this.output));
|
|
10
8
|
});
|
|
11
|
-
|
|
12
9
|
this.defaultInput = [BalmJS.config.pwa.workboxSw, `${BalmJS.config.pwa.workboxSw}.map`];
|
|
13
10
|
this.defaultOutput = BalmJS.config.dest.base;
|
|
14
11
|
}
|
|
15
|
-
|
|
16
12
|
}
|
|
17
|
-
|
|
18
13
|
export default WorkboxSwTask;
|
package/lib/tasks/public/copy.js
CHANGED
|
@@ -2,20 +2,15 @@ class CopyTask extends BalmJS.BalmTask {
|
|
|
2
2
|
constructor() {
|
|
3
3
|
super('copy');
|
|
4
4
|
}
|
|
5
|
-
|
|
6
5
|
recipe(input, output, options = {}) {
|
|
7
6
|
const balmCopy = () => {
|
|
8
7
|
this.init(input, output, options);
|
|
9
8
|
return this.src.pipe(BalmJS.plugins.rename(this.customOptions)).pipe(gulp.dest(this.output));
|
|
10
9
|
};
|
|
11
|
-
|
|
12
10
|
return balmCopy;
|
|
13
11
|
}
|
|
14
|
-
|
|
15
12
|
fn(callback) {
|
|
16
13
|
callback();
|
|
17
14
|
}
|
|
18
|
-
|
|
19
15
|
}
|
|
20
|
-
|
|
21
16
|
export default CopyTask;
|
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
import esbuild from '../../bundler/esbuild/index.js';
|
|
2
|
-
|
|
3
2
|
class EsbuildTask extends BalmJS.BalmTask {
|
|
4
3
|
constructor() {
|
|
5
4
|
super('esbuild');
|
|
6
5
|
this.defaultOutput = BalmJS.config.dest.js;
|
|
7
6
|
}
|
|
8
|
-
|
|
9
7
|
recipe(input, output, customOptions = {}) {
|
|
10
8
|
const balmBundler = callback => {
|
|
11
9
|
this.init(input || BalmJS.config.scripts.entry, output);
|
|
12
10
|
esbuild(this.input || BalmJS.file.defaultEntry, this.output, customOptions, callback);
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return balmBundler;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
get fn() {
|
|
19
15
|
return this.recipe();
|
|
20
16
|
}
|
|
21
|
-
|
|
22
17
|
}
|
|
23
|
-
|
|
24
18
|
export default EsbuildTask;
|
package/lib/tasks/public/ftp.js
CHANGED
|
@@ -2,27 +2,21 @@ class FtpTask extends BalmJS.BalmTask {
|
|
|
2
2
|
constructor() {
|
|
3
3
|
super('ftp');
|
|
4
4
|
}
|
|
5
|
-
|
|
6
5
|
get options() {
|
|
7
6
|
return Object.assign({}, BalmJS.config.ftp.options, this.customOptions);
|
|
8
7
|
}
|
|
9
|
-
|
|
10
8
|
recipe(localFiles, options = {}) {
|
|
11
9
|
const balmFtp = () => {
|
|
12
10
|
const taskName = `${this.name} task`;
|
|
13
11
|
const input = localFiles || BalmJS.watchFtpFile;
|
|
14
|
-
|
|
15
12
|
if (input) {
|
|
16
13
|
this.init(input, null, options);
|
|
17
|
-
|
|
18
14
|
if (!options.src) {
|
|
19
15
|
this.gulpSrcOptions = {
|
|
20
16
|
base: '.'
|
|
21
17
|
};
|
|
22
18
|
}
|
|
23
|
-
|
|
24
19
|
let stream = this.src;
|
|
25
|
-
|
|
26
20
|
try {
|
|
27
21
|
stream = stream.pipe(BalmJS.plugins.sftp(this.options));
|
|
28
22
|
} catch (error) {
|
|
@@ -31,20 +25,15 @@ class FtpTask extends BalmJS.BalmTask {
|
|
|
31
25
|
} = error;
|
|
32
26
|
BalmJS.logger.error(taskName, message);
|
|
33
27
|
}
|
|
34
|
-
|
|
35
28
|
return stream;
|
|
36
29
|
} else {
|
|
37
30
|
BalmJS.logger.warn(taskName, 'Invalid local files');
|
|
38
31
|
}
|
|
39
32
|
};
|
|
40
|
-
|
|
41
33
|
return balmFtp;
|
|
42
34
|
}
|
|
43
|
-
|
|
44
35
|
get fn() {
|
|
45
36
|
return this.recipe();
|
|
46
37
|
}
|
|
47
|
-
|
|
48
38
|
}
|
|
49
|
-
|
|
50
39
|
export default FtpTask;
|