balm-core 5.2.0 → 6.0.0-alpha.1
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/CHANGELOG.md +16 -0
- package/dist/index.cjs +2625 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +569 -0
- package/dist/index.d.ts +569 -0
- package/dist/index.js +2527 -0
- package/dist/index.js.map +1 -0
- package/package.json +49 -123
- package/src/balm.ts +108 -0
- package/src/bundler/esbuild.ts +47 -0
- package/src/bundler/index.ts +3 -0
- package/src/bundler/rollup.ts +45 -0
- package/src/bundler/webpack.ts +124 -0
- package/src/config/constants.ts +12 -0
- package/src/config/defaults.ts +209 -0
- package/src/config/index.ts +112 -0
- package/src/hooks/index.ts +224 -0
- package/src/index.ts +16 -0
- package/src/pipeline/file.ts +69 -0
- package/src/pipeline/index.ts +10 -0
- package/src/pipeline/pipeline.ts +135 -0
- package/src/pipeline/transforms/cache.ts +146 -0
- package/src/pipeline/transforms/htmlmin.ts +18 -0
- package/src/pipeline/transforms/less.ts +75 -0
- package/src/pipeline/transforms/postcss.ts +43 -0
- package/src/pipeline/transforms/rename.ts +37 -0
- package/src/pipeline/transforms/replace.ts +30 -0
- package/src/pipeline/transforms/sass.ts +106 -0
- package/src/pipeline/transforms/terser.ts +20 -0
- package/src/runner/dag.ts +77 -0
- package/src/runner/task.ts +38 -0
- package/src/shims.d.ts +5 -0
- package/src/tasks/cache.ts +72 -0
- package/src/tasks/clean.ts +21 -0
- package/src/tasks/copy.ts +36 -0
- package/src/tasks/ftp.ts +90 -0
- package/src/tasks/html.ts +232 -0
- package/src/tasks/index.ts +14 -0
- package/src/tasks/publish.ts +71 -0
- package/src/tasks/pwa.ts +99 -0
- package/src/tasks/remove.ts +24 -0
- package/src/tasks/replace.ts +34 -0
- package/src/tasks/script.ts +28 -0
- package/src/tasks/server.ts +183 -0
- package/src/tasks/static.ts +104 -0
- package/src/tasks/style.ts +57 -0
- package/src/tasks/zip.ts +65 -0
- package/src/types/index.ts +202 -0
- package/src/utilities/file.ts +120 -0
- package/src/utilities/logger.ts +63 -0
- package/src/utilities/utils.ts +46 -0
- package/src/utilities/workspace.ts +38 -0
- package/src/watcher/index.ts +100 -0
- package/tsconfig.json +8 -0
- package/tsup.config.ts +12 -0
- package/README.md +0 -196
- package/index.d.ts +0 -360
- package/lib/balm.js +0 -49
- package/lib/bootstrap/check_config.js +0 -43
- package/lib/bootstrap/index.js +0 -87
- package/lib/bundler/esbuild/build.js +0 -26
- package/lib/bundler/esbuild/index.js +0 -7
- package/lib/bundler/esbuild/options.js +0 -7
- package/lib/bundler/esbuild/transform.js +0 -36
- package/lib/bundler/rollup/build.js +0 -52
- package/lib/bundler/rollup/entry.js +0 -28
- package/lib/bundler/rollup/index.js +0 -20
- package/lib/bundler/rollup/output.js +0 -20
- package/lib/bundler/rollup/plugins.js +0 -31
- package/lib/bundler/webpack/config/common.js +0 -135
- package/lib/bundler/webpack/config/dev.js +0 -12
- package/lib/bundler/webpack/config/env.js +0 -67
- package/lib/bundler/webpack/config/index.js +0 -6
- package/lib/bundler/webpack/config/prod.js +0 -39
- package/lib/bundler/webpack/config/regex.js +0 -10
- package/lib/bundler/webpack/entry.js +0 -65
- package/lib/bundler/webpack/index.js +0 -32
- package/lib/bundler/webpack/loaders.js +0 -50
- package/lib/bundler/webpack/output.js +0 -41
- package/lib/bundler/webpack/rules/asset.js +0 -33
- package/lib/bundler/webpack/rules/babel.js +0 -19
- package/lib/bundler/webpack/rules/css.js +0 -109
- package/lib/bundler/webpack/rules/html.js +0 -15
- package/lib/bundler/webpack/rules/index.js +0 -10
- package/lib/config/assets.js +0 -30
- package/lib/config/constants.js +0 -14
- package/lib/config/env.js +0 -35
- package/lib/config/extras.js +0 -6
- package/lib/config/ftp.js +0 -6
- package/lib/config/globals.js +0 -43
- package/lib/config/html.js +0 -22
- package/lib/config/images.js +0 -4
- package/lib/config/index.js +0 -63
- package/lib/config/logs.js +0 -11
- package/lib/config/paths.js +0 -46
- package/lib/config/pwa.js +0 -24
- package/lib/config/roots.js +0 -9
- package/lib/config/scripts.js +0 -162
- package/lib/config/server.js +0 -84
- package/lib/config/spinner.js +0 -9
- package/lib/config/styles.js +0 -67
- package/lib/hello.js +0 -19
- package/lib/hooks/index.js +0 -94
- package/lib/hooks/maker.js +0 -59
- package/lib/index.js +0 -5
- package/lib/middlewares/history.js +0 -6
- package/lib/middlewares/index.js +0 -11
- package/lib/middlewares/proxy.js +0 -28
- package/lib/middlewares/webpack.js +0 -26
- package/lib/plugins/htmlmin.js +0 -39
- package/lib/plugins/imagemin.js +0 -95
- package/lib/plugins/index.js +0 -27
- package/lib/plugins/jsmin.js +0 -37
- package/lib/plugins/less.js +0 -97
- package/lib/plugins/plumber.js +0 -87
- package/lib/plugins/postcss-plugins.js +0 -13
- package/lib/plugins/postcss.js +0 -117
- package/lib/plugins/rename.js +0 -51
- package/lib/plugins/replace.js +0 -91
- package/lib/plugins/sass-legacy.js +0 -131
- package/lib/plugins/sass.js +0 -134
- package/lib/plugins/sftp.js +0 -288
- package/lib/tasks/default.js +0 -46
- package/lib/tasks/foundation/balm.js +0 -72
- package/lib/tasks/foundation/balm_style.js +0 -65
- package/lib/tasks/foundation/index.js +0 -10
- package/lib/tasks/index.js +0 -48
- package/lib/tasks/private/build.js +0 -18
- package/lib/tasks/private/cache.js +0 -31
- package/lib/tasks/private/clean.js +0 -69
- package/lib/tasks/private/end.js +0 -24
- package/lib/tasks/private/extra.js +0 -35
- package/lib/tasks/private/font.js +0 -15
- package/lib/tasks/private/image.js +0 -37
- package/lib/tasks/private/index.js +0 -34
- package/lib/tasks/private/lint.js +0 -20
- package/lib/tasks/private/media.js +0 -15
- package/lib/tasks/private/modernizr.js +0 -59
- package/lib/tasks/private/pwa-cache.js +0 -32
- package/lib/tasks/private/script.js +0 -9
- package/lib/tasks/private/sprite.js +0 -105
- package/lib/tasks/private/start.js +0 -16
- package/lib/tasks/private/style.js +0 -9
- package/lib/tasks/private/workbox-sw.js +0 -15
- package/lib/tasks/public/copy.js +0 -16
- package/lib/tasks/public/esbuild.js +0 -18
- package/lib/tasks/public/ftp.js +0 -39
- package/lib/tasks/public/html.js +0 -65
- package/lib/tasks/public/index.js +0 -38
- package/lib/tasks/public/jsmin.js +0 -23
- package/lib/tasks/public/less.js +0 -21
- package/lib/tasks/public/postcss.js +0 -16
- package/lib/tasks/public/publish.js +0 -51
- package/lib/tasks/public/pwa.js +0 -84
- package/lib/tasks/public/remove.js +0 -46
- package/lib/tasks/public/replace.js +0 -26
- package/lib/tasks/public/rollup.js +0 -17
- package/lib/tasks/public/sass.js +0 -27
- package/lib/tasks/public/server.js +0 -130
- package/lib/tasks/public/url.js +0 -35
- package/lib/tasks/public/version.js +0 -23
- package/lib/tasks/public/webpack.js +0 -39
- package/lib/tasks/public/zip.js +0 -19
- package/lib/utilities/address.js +0 -55
- package/lib/utilities/cache-core.js +0 -66
- package/lib/utilities/color.js +0 -27
- package/lib/utilities/compiling.js +0 -24
- package/lib/utilities/detect-port.js +0 -100
- package/lib/utilities/escape-string-regexp.js +0 -10
- package/lib/utilities/file.js +0 -70
- package/lib/utilities/index.js +0 -8
- package/lib/utilities/loading.js +0 -37
- package/lib/utilities/logger.js +0 -99
- package/lib/utilities/merge-stream.js +0 -38
- package/lib/utilities/namespace.js +0 -11
- package/lib/utilities/public-url.js +0 -37
- package/lib/utilities/replacestream.js +0 -106
- package/lib/utilities/typeof.js +0 -5
- package/lib/utilities/utils.js +0 -43
- package/tslib/balm.js +0 -44
- package/tslib/bootstrap/check_config.js +0 -36
- package/tslib/bootstrap/index.js +0 -82
- package/tslib/bundler/esbuild/build.js +0 -30
- package/tslib/bundler/esbuild/index.js +0 -11
- package/tslib/bundler/esbuild/options.js +0 -7
- package/tslib/bundler/esbuild/transform.js +0 -38
- package/tslib/bundler/rollup/build.js +0 -17
- package/tslib/bundler/rollup/entry.js +0 -24
- package/tslib/bundler/rollup/index.js +0 -21
- package/tslib/bundler/rollup/output.js +0 -23
- package/tslib/bundler/rollup/plugins.js +0 -27
- package/tslib/bundler/webpack/config/common.js +0 -130
- package/tslib/bundler/webpack/config/dev.js +0 -14
- package/tslib/bundler/webpack/config/env.js +0 -44
- package/tslib/bundler/webpack/config/index.js +0 -8
- package/tslib/bundler/webpack/config/prod.js +0 -43
- package/tslib/bundler/webpack/config/regex.js +0 -10
- package/tslib/bundler/webpack/entry.js +0 -68
- package/tslib/bundler/webpack/index.js +0 -30
- package/tslib/bundler/webpack/loaders.js +0 -51
- package/tslib/bundler/webpack/output.js +0 -41
- package/tslib/bundler/webpack/rules/asset.js +0 -33
- package/tslib/bundler/webpack/rules/babel.js +0 -16
- package/tslib/bundler/webpack/rules/css.js +0 -95
- package/tslib/bundler/webpack/rules/html.js +0 -15
- package/tslib/bundler/webpack/rules/index.js +0 -10
- package/tslib/config/assets.js +0 -24
- package/tslib/config/constants.js +0 -14
- package/tslib/config/env.js +0 -43
- package/tslib/config/extras.js +0 -6
- package/tslib/config/ftp.js +0 -6
- package/tslib/config/globals.js +0 -47
- package/tslib/config/html.js +0 -17
- package/tslib/config/images.js +0 -4
- package/tslib/config/index.js +0 -56
- package/tslib/config/logs.js +0 -6
- package/tslib/config/paths.js +0 -30
- package/tslib/config/pwa.js +0 -18
- package/tslib/config/roots.js +0 -8
- package/tslib/config/scripts.js +0 -93
- package/tslib/config/server.js +0 -33
- package/tslib/config/spinner.js +0 -10
- package/tslib/config/styles.js +0 -37
- package/tslib/hello.js +0 -19
- package/tslib/hooks/index.js +0 -75
- package/tslib/hooks/maker.js +0 -66
- package/tslib/index.js +0 -5
- package/tslib/middlewares/history.js +0 -12
- package/tslib/middlewares/index.js +0 -18
- package/tslib/middlewares/proxy.js +0 -27
- package/tslib/middlewares/webpack.js +0 -29
- package/tslib/plugins/htmlmin.js +0 -38
- package/tslib/plugins/imagemin.js +0 -97
- package/tslib/plugins/index.js +0 -27
- package/tslib/plugins/jsmin.js +0 -39
- package/tslib/plugins/less.js +0 -90
- package/tslib/plugins/plumber.js +0 -81
- package/tslib/plugins/postcss-plugins.js +0 -24
- package/tslib/plugins/postcss.js +0 -111
- package/tslib/plugins/rename.js +0 -51
- package/tslib/plugins/replace.js +0 -72
- package/tslib/plugins/sass-legacy.js +0 -95
- package/tslib/plugins/sass.js +0 -109
- package/tslib/plugins/sftp.js +0 -258
- package/tslib/tasks/default.js +0 -59
- package/tslib/tasks/foundation/balm.js +0 -75
- package/tslib/tasks/foundation/balm_style.js +0 -68
- package/tslib/tasks/foundation/index.js +0 -10
- package/tslib/tasks/index.js +0 -43
- package/tslib/tasks/private/build.js +0 -15
- package/tslib/tasks/private/cache.js +0 -48
- package/tslib/tasks/private/clean.js +0 -82
- package/tslib/tasks/private/end.js +0 -21
- package/tslib/tasks/private/extra.js +0 -34
- package/tslib/tasks/private/font.js +0 -12
- package/tslib/tasks/private/image.js +0 -42
- package/tslib/tasks/private/index.js +0 -34
- package/tslib/tasks/private/lint.js +0 -17
- package/tslib/tasks/private/media.js +0 -12
- package/tslib/tasks/private/modernizr.js +0 -54
- package/tslib/tasks/private/pwa-cache.js +0 -32
- package/tslib/tasks/private/script.js +0 -9
- package/tslib/tasks/private/sprite.js +0 -93
- package/tslib/tasks/private/start.js +0 -13
- package/tslib/tasks/private/style.js +0 -12
- package/tslib/tasks/private/workbox-sw.js +0 -15
- package/tslib/tasks/public/copy.js +0 -18
- package/tslib/tasks/public/esbuild.js +0 -18
- package/tslib/tasks/public/ftp.js +0 -39
- package/tslib/tasks/public/html.js +0 -75
- package/tslib/tasks/public/index.js +0 -38
- package/tslib/tasks/public/jsmin.js +0 -24
- package/tslib/tasks/public/less.js +0 -21
- package/tslib/tasks/public/postcss.js +0 -16
- package/tslib/tasks/public/publish.js +0 -50
- package/tslib/tasks/public/pwa.js +0 -87
- package/tslib/tasks/public/remove.js +0 -44
- package/tslib/tasks/public/replace.js +0 -27
- package/tslib/tasks/public/rollup.js +0 -17
- package/tslib/tasks/public/sass.js +0 -27
- package/tslib/tasks/public/server.js +0 -129
- package/tslib/tasks/public/url.js +0 -35
- package/tslib/tasks/public/version.js +0 -27
- package/tslib/tasks/public/webpack.js +0 -41
- package/tslib/tasks/public/zip.js +0 -19
- package/tslib/utilities/address.js +0 -48
- package/tslib/utilities/cache-core.js +0 -57
- package/tslib/utilities/color.js +0 -33
- package/tslib/utilities/compiling.js +0 -16
- package/tslib/utilities/detect-port.js +0 -91
- package/tslib/utilities/escape-string-regexp.js +0 -7
- package/tslib/utilities/file.js +0 -78
- package/tslib/utilities/index.js +0 -8
- package/tslib/utilities/loading.js +0 -25
- package/tslib/utilities/logger.js +0 -92
- package/tslib/utilities/merge-stream.js +0 -34
- package/tslib/utilities/namespace.js +0 -12
- package/tslib/utilities/public-url.js +0 -31
- package/tslib/utilities/replacestream.js +0 -112
- package/tslib/utilities/typeof.js +0 -8
- package/tslib/utilities/utils.js +0 -38
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
class FtpTask extends BalmJS.BalmTask {
|
|
2
|
-
constructor() {
|
|
3
|
-
super('ftp');
|
|
4
|
-
}
|
|
5
|
-
get options() {
|
|
6
|
-
return Object.assign({}, BalmJS.config.ftp.options, this.customOptions);
|
|
7
|
-
}
|
|
8
|
-
recipe(localFiles, options = {}) {
|
|
9
|
-
const balmFtp = () => {
|
|
10
|
-
const taskName = `${this.name} task`;
|
|
11
|
-
const input = localFiles || BalmJS.watchFtpFile;
|
|
12
|
-
if (input) {
|
|
13
|
-
this.init(input, null, options);
|
|
14
|
-
if (!options.src) {
|
|
15
|
-
this.gulpSrcOptions = {
|
|
16
|
-
base: '.'
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
let stream = this.src;
|
|
20
|
-
try {
|
|
21
|
-
stream = stream.pipe(BalmJS.plugins.sftp(this.options));
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
const { message } = error;
|
|
25
|
-
BalmJS.logger.error(taskName, message);
|
|
26
|
-
}
|
|
27
|
-
return stream;
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
BalmJS.logger.warn(taskName, 'Invalid local files');
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
return balmFtp;
|
|
34
|
-
}
|
|
35
|
-
get fn() {
|
|
36
|
-
return this.recipe();
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
export default FtpTask;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { PUBLIC_URL } from '../../config/constants.js';
|
|
2
|
-
class HtmlTask extends BalmJS.BalmTask {
|
|
3
|
-
constructor() {
|
|
4
|
-
super('html');
|
|
5
|
-
this.defaultInput = [
|
|
6
|
-
node.path.join(BalmJS.file.templateBasePath, '*.html'),
|
|
7
|
-
node.path.join(BalmJS.file.templateBasePath, BalmJS.config.pwa.manifest)
|
|
8
|
-
];
|
|
9
|
-
this.defaultOutput = BalmJS.config.dest.base;
|
|
10
|
-
}
|
|
11
|
-
#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);
|
|
25
|
-
};
|
|
26
|
-
#hasSourcePath = (type) => {
|
|
27
|
-
return !!BalmJS.config.paths.source[type];
|
|
28
|
-
};
|
|
29
|
-
recipe(input, output) {
|
|
30
|
-
const balmHtml = () => {
|
|
31
|
-
this.init(input, output);
|
|
32
|
-
let stream = this.src;
|
|
33
|
-
if (BalmJS.config.env.isProd) {
|
|
34
|
-
stream = stream
|
|
35
|
-
.pipe($.useref({
|
|
36
|
-
base: BalmJS.config.workspace,
|
|
37
|
-
searchPath: [
|
|
38
|
-
BalmJS.config.roots.tmp,
|
|
39
|
-
BalmJS.config.roots.source,
|
|
40
|
-
'.'
|
|
41
|
-
]
|
|
42
|
-
}))
|
|
43
|
-
.pipe($.if(/\.html$/, BalmJS.plugins.htmlmin(BalmJS.config.html.options)));
|
|
44
|
-
['css', 'js', 'img', 'media', 'manifest'].forEach((type) => {
|
|
45
|
-
const canUpdate = type === 'manifest'
|
|
46
|
-
? BalmJS.config.pwa.enabled
|
|
47
|
-
: this.#hasSourcePath(type);
|
|
48
|
-
if (canUpdate) {
|
|
49
|
-
stream = stream.pipe(this.#updateAssetsPath(type));
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
stream = BalmJS.config.assets.cache
|
|
53
|
-
? stream.pipe($.if(BalmJS.config.pwa.manifest, BalmJS.file.setPublicPath()))
|
|
54
|
-
: stream.pipe(BalmJS.file.setPublicPath());
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
['css', 'js', 'img', 'media'].forEach((type, index) => {
|
|
58
|
-
const canUpdate = index > 1
|
|
59
|
-
? this.#hasSourcePath(type) && !BalmJS.config.inFrontend
|
|
60
|
-
: this.#hasSourcePath(type);
|
|
61
|
-
if (canUpdate) {
|
|
62
|
-
stream = stream.pipe(this.#updateAssetsPath(type));
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
stream = stream.pipe(BalmJS.file.setPublicPath());
|
|
66
|
-
}
|
|
67
|
-
return stream.pipe(gulp.dest(this.output));
|
|
68
|
-
};
|
|
69
|
-
return balmHtml;
|
|
70
|
-
}
|
|
71
|
-
get fn() {
|
|
72
|
-
return this.recipe();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
export default HtmlTask;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import SassTask from './sass.js';
|
|
2
|
-
import LessTask from './less.js';
|
|
3
|
-
import PostcssTask from './postcss.js';
|
|
4
|
-
import UrlTask from './url.js';
|
|
5
|
-
import WebpackTask from './webpack.js';
|
|
6
|
-
import EsbuildTask from './esbuild.js';
|
|
7
|
-
import RollupTask from './rollup.js';
|
|
8
|
-
import JsminTask from './jsmin.js';
|
|
9
|
-
import HtmlTask from './html.js';
|
|
10
|
-
import CopyTask from './copy.js';
|
|
11
|
-
import RemoveTask from './remove.js';
|
|
12
|
-
import ReplaceTask from './replace.js';
|
|
13
|
-
import VersionTask from './version.js';
|
|
14
|
-
import ServerTask from './server.js';
|
|
15
|
-
import PublishTask from './publish.js';
|
|
16
|
-
import ZipTask from './zip.js';
|
|
17
|
-
import FtpTask from './ftp.js';
|
|
18
|
-
import PwaTask from './pwa.js';
|
|
19
|
-
export default {
|
|
20
|
-
SassTask,
|
|
21
|
-
LessTask,
|
|
22
|
-
PostcssTask,
|
|
23
|
-
UrlTask,
|
|
24
|
-
WebpackTask,
|
|
25
|
-
EsbuildTask,
|
|
26
|
-
RollupTask,
|
|
27
|
-
JsminTask,
|
|
28
|
-
HtmlTask,
|
|
29
|
-
CopyTask,
|
|
30
|
-
RemoveTask,
|
|
31
|
-
ReplaceTask,
|
|
32
|
-
VersionTask,
|
|
33
|
-
ServerTask,
|
|
34
|
-
PublishTask,
|
|
35
|
-
ZipTask,
|
|
36
|
-
FtpTask,
|
|
37
|
-
PwaTask
|
|
38
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
class JsminTask extends BalmJS.BalmTask {
|
|
2
|
-
constructor() {
|
|
3
|
-
super('jsmin');
|
|
4
|
-
}
|
|
5
|
-
get options() {
|
|
6
|
-
const defaultOptions = Object.assign({}, BalmJS.config.scripts.minifyOptions);
|
|
7
|
-
return BalmJS.utils.deepMerge(defaultOptions, this.customOptions);
|
|
8
|
-
}
|
|
9
|
-
recipe(input, output, options = {}) {
|
|
10
|
-
const balmJsmin = () => {
|
|
11
|
-
this.init(input, output, options);
|
|
12
|
-
const renameOptions = options.rename || { suffix: '.min' };
|
|
13
|
-
return this.src
|
|
14
|
-
.pipe(BalmJS.plugins.jsmin(this.options))
|
|
15
|
-
.pipe(BalmJS.plugins.rename(renameOptions))
|
|
16
|
-
.pipe(gulp.dest(this.output));
|
|
17
|
-
};
|
|
18
|
-
return balmJsmin;
|
|
19
|
-
}
|
|
20
|
-
fn(callback) {
|
|
21
|
-
callback();
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
export default JsminTask;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
class LessTask extends BalmJS.BalmStyleTask {
|
|
2
|
-
constructor() {
|
|
3
|
-
super('less');
|
|
4
|
-
}
|
|
5
|
-
get options() {
|
|
6
|
-
return Object.assign({
|
|
7
|
-
paths: BalmJS.file.stylePaths
|
|
8
|
-
}, BalmJS.config.styles.lessOptions, this.customOptions);
|
|
9
|
-
}
|
|
10
|
-
recipe(input, output, options = {}) {
|
|
11
|
-
const balmLess = () => {
|
|
12
|
-
this.init(input, output, options);
|
|
13
|
-
return this.handleStyle(this.name, this.output, this.options);
|
|
14
|
-
};
|
|
15
|
-
return balmLess;
|
|
16
|
-
}
|
|
17
|
-
get fn() {
|
|
18
|
-
return this.recipe();
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export default LessTask;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
class PostcssTask extends BalmJS.BalmStyleTask {
|
|
2
|
-
constructor() {
|
|
3
|
-
super('postcss');
|
|
4
|
-
}
|
|
5
|
-
recipe(input, output) {
|
|
6
|
-
const balmPostcss = () => {
|
|
7
|
-
this.init(input, output);
|
|
8
|
-
return this.handleStyle(this.name, this.output);
|
|
9
|
-
};
|
|
10
|
-
return balmPostcss;
|
|
11
|
-
}
|
|
12
|
-
get fn() {
|
|
13
|
-
return this.recipe();
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
export default PostcssTask;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import mergeStream from '../../utilities/merge-stream.js';
|
|
2
|
-
class PublishTask extends BalmJS.BalmTask {
|
|
3
|
-
constructor() {
|
|
4
|
-
super('publish');
|
|
5
|
-
this.defaultInput = [
|
|
6
|
-
BalmJS.file.matchAllFiles(BalmJS.config.dest.static),
|
|
7
|
-
node.path.join(`!${BalmJS.config.dest.base}`, '*.*')
|
|
8
|
-
];
|
|
9
|
-
this.defaultOutput = BalmJS.config.assets.static;
|
|
10
|
-
}
|
|
11
|
-
#release = (input, output, renameOptions = {}) => {
|
|
12
|
-
let srcPath;
|
|
13
|
-
let destPath;
|
|
14
|
-
if (input && output) {
|
|
15
|
-
srcPath = BalmJS.file.absPaths(node.path.join(BalmJS.config.dest.base, input));
|
|
16
|
-
destPath = BalmJS.file.absPath(node.path.join(BalmJS.config.assets.root, output));
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
this.init();
|
|
20
|
-
srcPath = this.input;
|
|
21
|
-
destPath = this.output;
|
|
22
|
-
}
|
|
23
|
-
return gulp
|
|
24
|
-
.src(srcPath, { allowEmpty: true })
|
|
25
|
-
.pipe($.if(!BalmJS.utils.isArray(srcPath), BalmJS.plugins.rename(renameOptions)))
|
|
26
|
-
.pipe(gulp.dest(destPath));
|
|
27
|
-
};
|
|
28
|
-
recipe(input, output, renameOptions) {
|
|
29
|
-
const balmPublish = (callback) => {
|
|
30
|
-
if (BalmJS.config.env.isProd) {
|
|
31
|
-
if (BalmJS.utils.isArray(input)) {
|
|
32
|
-
const tasks = input.map((template) => this.#release(template.input, template.output, template.renameOptions));
|
|
33
|
-
return mergeStream(...tasks);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
return this.#release(input, output, renameOptions);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
BalmJS.logger.warn(`${this.name} task`, '`mix.publish()` is only supported for production');
|
|
41
|
-
callback();
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
return balmPublish;
|
|
45
|
-
}
|
|
46
|
-
fn(callback) {
|
|
47
|
-
callback();
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
export default PublishTask;
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { generateSW, injectManifest } from 'workbox-build';
|
|
2
|
-
class PwaTask extends BalmJS.BalmTask {
|
|
3
|
-
constructor() {
|
|
4
|
-
super('pwa');
|
|
5
|
-
}
|
|
6
|
-
setIgnores(options) {
|
|
7
|
-
const defaultIgnores = [BalmJS.config.pwa.swSrcFilename];
|
|
8
|
-
if (options.globIgnores) {
|
|
9
|
-
options.globIgnores = options.globIgnores.concat(defaultIgnores);
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
options.globIgnores = defaultIgnores;
|
|
13
|
-
}
|
|
14
|
-
return options;
|
|
15
|
-
}
|
|
16
|
-
recipe(customMode, customOptions = {}) {
|
|
17
|
-
const balmPwa = async (callback) => {
|
|
18
|
-
const mode = customMode || BalmJS.config.pwa.mode;
|
|
19
|
-
let options = {};
|
|
20
|
-
const globDirectory = BalmJS.config.dest.base;
|
|
21
|
-
const swDest = BalmJS.file.absPath(`${globDirectory}/${BalmJS.config.pwa.swDestFilename}`);
|
|
22
|
-
const swSrc = BalmJS.file.absPath(`${BalmJS.config.src.base}/${BalmJS.config.pwa.swSrcFilename}`);
|
|
23
|
-
let valid = true;
|
|
24
|
-
switch (mode) {
|
|
25
|
-
case 'generateSW':
|
|
26
|
-
options = Object.assign({
|
|
27
|
-
globDirectory,
|
|
28
|
-
swDest
|
|
29
|
-
}, BalmJS.config.pwa.options, customOptions);
|
|
30
|
-
break;
|
|
31
|
-
case 'injectManifest':
|
|
32
|
-
options = Object.assign({
|
|
33
|
-
globDirectory,
|
|
34
|
-
swDest,
|
|
35
|
-
swSrc
|
|
36
|
-
}, BalmJS.config.pwa.options, customOptions);
|
|
37
|
-
break;
|
|
38
|
-
default:
|
|
39
|
-
valid = false;
|
|
40
|
-
}
|
|
41
|
-
if (valid) {
|
|
42
|
-
options = this.setIgnores(options);
|
|
43
|
-
BalmJS.logger.debug(`pwa - ${mode}`, options, {
|
|
44
|
-
pre: true
|
|
45
|
-
});
|
|
46
|
-
const workboxBuild = mode === 'generateSW'
|
|
47
|
-
? generateSW(options)
|
|
48
|
-
: injectManifest(options);
|
|
49
|
-
try {
|
|
50
|
-
const { count, size } = await workboxBuild;
|
|
51
|
-
BalmJS.logger.info(`pwa - ${mode}`, `Generated '${swDest}', which will precache ${count} files, totaling ${size} bytes`);
|
|
52
|
-
await new Promise((resolve) => {
|
|
53
|
-
const pwaCacheTask = BalmJS.tasks.get('pwa-cache');
|
|
54
|
-
if (pwaCacheTask) {
|
|
55
|
-
const stream = pwaCacheTask.fn();
|
|
56
|
-
if (stream && typeof stream.on === 'function') {
|
|
57
|
-
stream.on('finish', resolve).on('error', () => resolve());
|
|
58
|
-
}
|
|
59
|
-
else if (stream && typeof stream.then === 'function') {
|
|
60
|
-
stream.then(resolve, resolve);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
resolve();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
resolve();
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
catch (err) {
|
|
72
|
-
BalmJS.logger.warn(`pwa - ${mode}`, `Service worker generation failed: ${err}`);
|
|
73
|
-
}
|
|
74
|
-
callback();
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
BalmJS.logger.warn('pwa task', 'Invalid PWA mode');
|
|
78
|
-
callback();
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
return balmPwa;
|
|
82
|
-
}
|
|
83
|
-
get fn() {
|
|
84
|
-
return this.recipe();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
export default PwaTask;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { deleteAsync } from 'del';
|
|
2
|
-
class RemoveTask extends BalmJS.BalmTask {
|
|
3
|
-
constructor() {
|
|
4
|
-
super('remove');
|
|
5
|
-
}
|
|
6
|
-
#getFiles = (input) => {
|
|
7
|
-
let files = BalmJS.file.absPaths(input);
|
|
8
|
-
files = BalmJS.utils.isArray(input)
|
|
9
|
-
? files.map((file) => file.replace(/\\/g, '/'))
|
|
10
|
-
: files.replace(/\\/g, '/');
|
|
11
|
-
return files;
|
|
12
|
-
};
|
|
13
|
-
recipe(input) {
|
|
14
|
-
const balmRemove = async (callback) => {
|
|
15
|
-
const canDel = !!((BalmJS.utils.isString(input) && input.trim()) ||
|
|
16
|
-
(BalmJS.utils.isArray(input) && input.length));
|
|
17
|
-
if (canDel) {
|
|
18
|
-
const files = this.#getFiles(input);
|
|
19
|
-
BalmJS.logger.debug(`${this.name} task`, {
|
|
20
|
-
files
|
|
21
|
-
}, {
|
|
22
|
-
pre: true
|
|
23
|
-
});
|
|
24
|
-
const deletedPaths = await deleteAsync(files, {
|
|
25
|
-
force: true
|
|
26
|
-
});
|
|
27
|
-
BalmJS.logger.warn(`${this.name} task`, {
|
|
28
|
-
deletedPaths
|
|
29
|
-
}, {
|
|
30
|
-
pre: true
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
BalmJS.logger.error(`${this.name} task`, 'Invalid input');
|
|
35
|
-
}
|
|
36
|
-
callback();
|
|
37
|
-
};
|
|
38
|
-
return balmRemove;
|
|
39
|
-
}
|
|
40
|
-
fn(callback) {
|
|
41
|
-
callback();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
export default RemoveTask;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
class ReplaceTask extends BalmJS.BalmTask {
|
|
2
|
-
constructor() {
|
|
3
|
-
super('replace');
|
|
4
|
-
}
|
|
5
|
-
recipe(input, output, options) {
|
|
6
|
-
const balmReplace = () => {
|
|
7
|
-
this.init(input, output);
|
|
8
|
-
let stream = this.src;
|
|
9
|
-
if (BalmJS.utils.isArray(options)) {
|
|
10
|
-
const replaceOptions = options;
|
|
11
|
-
replaceOptions.forEach((replaceOption) => {
|
|
12
|
-
stream = stream.pipe(BalmJS.plugins.replace(replaceOption.substr, replaceOption.replacement));
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
const replaceOption = options;
|
|
17
|
-
stream = stream.pipe(BalmJS.plugins.replace(replaceOption.substr, replaceOption.replacement));
|
|
18
|
-
}
|
|
19
|
-
return stream.pipe(gulp.dest(this.output));
|
|
20
|
-
};
|
|
21
|
-
return balmReplace;
|
|
22
|
-
}
|
|
23
|
-
fn(callback) {
|
|
24
|
-
callback();
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export default ReplaceTask;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import buildLibrary from '../../bundler/rollup/index.js';
|
|
2
|
-
class RollupTask extends BalmJS.BalmTask {
|
|
3
|
-
constructor() {
|
|
4
|
-
super('rollup');
|
|
5
|
-
}
|
|
6
|
-
recipe(input, output) {
|
|
7
|
-
const balmBundler = async (callback) => {
|
|
8
|
-
await buildLibrary(input, output);
|
|
9
|
-
callback();
|
|
10
|
-
};
|
|
11
|
-
return balmBundler;
|
|
12
|
-
}
|
|
13
|
-
fn(callback) {
|
|
14
|
-
callback();
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
export default RollupTask;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
class SassTask extends BalmJS.BalmStyleTask {
|
|
2
|
-
constructor() {
|
|
3
|
-
super('sass');
|
|
4
|
-
}
|
|
5
|
-
get options() {
|
|
6
|
-
return Object.assign(node.isLegacySass
|
|
7
|
-
? {
|
|
8
|
-
includePaths: BalmJS.file.stylePaths,
|
|
9
|
-
outputStyle: 'expanded'
|
|
10
|
-
}
|
|
11
|
-
: {
|
|
12
|
-
loadPaths: BalmJS.file.stylePaths,
|
|
13
|
-
sourceMap: true
|
|
14
|
-
}, { quietDeps: BalmJS.config.logs.level < BalmJS.LogLevel.Warn }, BalmJS.config.styles.sassOptions, this.customOptions);
|
|
15
|
-
}
|
|
16
|
-
recipe(input, output, options = {}) {
|
|
17
|
-
const balmSass = () => {
|
|
18
|
-
this.init(input, output, options);
|
|
19
|
-
return this.handleStyle(this.name, this.output, this.options);
|
|
20
|
-
};
|
|
21
|
-
return balmSass;
|
|
22
|
-
}
|
|
23
|
-
get fn() {
|
|
24
|
-
return this.recipe();
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export default SassTask;
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import detectPort from '../../utilities/detect-port.js';
|
|
2
|
-
import getMiddlewares from '../../middlewares/index.js';
|
|
3
|
-
class ServerTask extends BalmJS.BalmTask {
|
|
4
|
-
constructor() {
|
|
5
|
-
super('serve');
|
|
6
|
-
if (BalmJS.config.env.isDev) {
|
|
7
|
-
detectPort(BalmJS.config.server.port, BalmJS.config.server.host).then((port) => {
|
|
8
|
-
if (BalmJS.config.server.port !== port) {
|
|
9
|
-
BalmJS.logger.warn('server task', `port: ${BalmJS.config.server.port} was occupied, try port: ${port}`);
|
|
10
|
-
BalmJS.config.server.port = port;
|
|
11
|
-
}
|
|
12
|
-
}, () => { });
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
#watchTask = (taskName, serverReload = false) => {
|
|
16
|
-
const balmTask = BalmJS.tasks.get(taskName).fn;
|
|
17
|
-
const reload = (done) => {
|
|
18
|
-
server.reload();
|
|
19
|
-
done();
|
|
20
|
-
};
|
|
21
|
-
return serverReload ? gulp.series(balmTask, reload) : balmTask;
|
|
22
|
-
};
|
|
23
|
-
#onWatch = () => {
|
|
24
|
-
const { watch } = gulp;
|
|
25
|
-
const watchOptions = {
|
|
26
|
-
cwd: BalmJS.config.workspace
|
|
27
|
-
};
|
|
28
|
-
watch([
|
|
29
|
-
`${BalmJS.config.src.img}/**/*`,
|
|
30
|
-
`${BalmJS.config.dest.font}/**/*`,
|
|
31
|
-
...BalmJS.config.server.extraWatchFiles
|
|
32
|
-
], watchOptions).on('change', server.reload);
|
|
33
|
-
watch(`${BalmJS.file.templateBasePath}/*.html`, watchOptions, this.#watchTask('html', true));
|
|
34
|
-
watch(`${BalmJS.config.src.css}/**/*.${BalmJS.config.styles.extname}`, watchOptions, this.#watchTask(BalmJS.config.inFrontend ? this.styleName : 'style'));
|
|
35
|
-
if (!BalmJS.config.server.useHMR) {
|
|
36
|
-
watch(`${BalmJS.config.src.js}/**/*`, watchOptions, this.#watchTask(BalmJS.config.scripts.bundler, true));
|
|
37
|
-
}
|
|
38
|
-
watch(`${BalmJS.config.src.base}/modernizr.json`, watchOptions, this.#watchTask('modernizr'));
|
|
39
|
-
watch(`${BalmJS.config.src.font}/**/*`, watchOptions, this.#watchTask('font'));
|
|
40
|
-
if (BalmJS.config.ftp.watchFiles.length) {
|
|
41
|
-
watch(BalmJS.config.ftp.watchFiles, watchOptions).on('change', (path) => {
|
|
42
|
-
BalmJS.logger.debug(`${this.name} task`, `File ${path} was changed`);
|
|
43
|
-
BalmJS.watchFtpFile = path;
|
|
44
|
-
this.#watchTask('ftp', true)();
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
recipe(customHandler) {
|
|
49
|
-
const balmServe = (callback) => {
|
|
50
|
-
if (BalmJS.server) {
|
|
51
|
-
BalmJS.logger.warn('server task', 'Server has started');
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
const serverConfig = BalmJS.config.server;
|
|
55
|
-
let bsOptions = {
|
|
56
|
-
logPrefix: 'BalmJS',
|
|
57
|
-
notify: false,
|
|
58
|
-
port: serverConfig.port,
|
|
59
|
-
host: serverConfig.host,
|
|
60
|
-
https: serverConfig.https,
|
|
61
|
-
callbacks: {
|
|
62
|
-
ready() {
|
|
63
|
-
if (BalmJS.config.env.isMP) {
|
|
64
|
-
BalmJS.logger.info('提示', `请使用微信开发者工具打开 ${BalmJS.config.roots.tmp} 预览小程序`, { logLevel: BalmJS.LogLevel.Error });
|
|
65
|
-
}
|
|
66
|
-
serverConfig.next();
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
open: serverConfig.open,
|
|
70
|
-
localOnly: BalmJS.config.env.inDesktopApp,
|
|
71
|
-
scriptPath: BalmJS.config.scripts.ie8 ? () => '' : undefined
|
|
72
|
-
};
|
|
73
|
-
if (serverConfig.proxy) {
|
|
74
|
-
if (BalmJS.utils.isString(serverConfig.proxy)) {
|
|
75
|
-
bsOptions.proxy = {
|
|
76
|
-
target: serverConfig.proxy
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
else if (BalmJS.utils.isObject(serverConfig.proxy)) {
|
|
80
|
-
bsOptions.proxy = serverConfig.proxy;
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
BalmJS.logger.error(`${this.name} task`, '`server.proxy` must be a string or object');
|
|
84
|
-
}
|
|
85
|
-
bsOptions.serveStatic = serverConfig.serveStatic;
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
bsOptions.server = {
|
|
89
|
-
baseDir: [BalmJS.config.dest.base, BalmJS.config.src.base],
|
|
90
|
-
routes: {
|
|
91
|
-
'/bower_components': BalmJS.file.absPath('bower_components'),
|
|
92
|
-
'/node_modules': BalmJS.file.absPath('node_modules')
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
bsOptions.middleware = BalmJS.config.env.isDev
|
|
97
|
-
? getMiddlewares()
|
|
98
|
-
: false;
|
|
99
|
-
bsOptions = BalmJS.utils.deepMerge(bsOptions, serverConfig.options);
|
|
100
|
-
if (BalmJS.config.env.isDev) {
|
|
101
|
-
BalmJS.server = server.init(bsOptions);
|
|
102
|
-
if (BalmJS.config.useDefaults) {
|
|
103
|
-
this.#onWatch();
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
BalmJS.watching = true;
|
|
107
|
-
const watcher = gulp.watch([
|
|
108
|
-
`${BalmJS.config.src.base}/**/*`,
|
|
109
|
-
...serverConfig.extraWatchFiles
|
|
110
|
-
]);
|
|
111
|
-
try {
|
|
112
|
-
customHandler && customHandler(watcher, server.reload);
|
|
113
|
-
}
|
|
114
|
-
catch (error) {
|
|
115
|
-
const { message } = error;
|
|
116
|
-
BalmJS.logger.error('balm hook', message);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
callback();
|
|
122
|
-
};
|
|
123
|
-
return balmServe;
|
|
124
|
-
}
|
|
125
|
-
get fn() {
|
|
126
|
-
return this.recipe();
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
export default ServerTask;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
class UrlTask extends BalmJS.BalmTask {
|
|
2
|
-
constructor() {
|
|
3
|
-
super('url');
|
|
4
|
-
this.defaultOutput = BalmJS.config.dest.css;
|
|
5
|
-
this.defaultInput = BalmJS.file.matchAllFiles(this.defaultOutput, '*.css');
|
|
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
|
-
};
|
|
21
|
-
recipe(input, output) {
|
|
22
|
-
const balmUrl = () => {
|
|
23
|
-
this.init(input, output);
|
|
24
|
-
return this.src
|
|
25
|
-
.pipe(this.#urlProcessing('img'))
|
|
26
|
-
.pipe(this.#urlProcessing('font'))
|
|
27
|
-
.pipe(gulp.dest(this.output));
|
|
28
|
-
};
|
|
29
|
-
return balmUrl;
|
|
30
|
-
}
|
|
31
|
-
get fn() {
|
|
32
|
-
return this.recipe();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export default UrlTask;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import revAll from 'gulp-rev-all';
|
|
2
|
-
class VersionTask extends BalmJS.BalmTask {
|
|
3
|
-
constructor() {
|
|
4
|
-
super('version');
|
|
5
|
-
this.defaultOutput = BalmJS.config.dest.base;
|
|
6
|
-
}
|
|
7
|
-
get options() {
|
|
8
|
-
return Object.assign({}, BalmJS.config.assets.options, this.customOptions);
|
|
9
|
-
}
|
|
10
|
-
recipe(input, output, assetsOptions) {
|
|
11
|
-
const balmVersion = () => {
|
|
12
|
-
this.init(input, output, {
|
|
13
|
-
version: assetsOptions
|
|
14
|
-
});
|
|
15
|
-
return this.src
|
|
16
|
-
.pipe(revAll.revision(this.options))
|
|
17
|
-
.pipe(gulp.dest(this.output))
|
|
18
|
-
.pipe(revAll.versionFile())
|
|
19
|
-
.pipe(gulp.dest(this.output));
|
|
20
|
-
};
|
|
21
|
-
return balmVersion;
|
|
22
|
-
}
|
|
23
|
-
fn(callback) {
|
|
24
|
-
callback();
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export default VersionTask;
|