balm-core 5.2.0 → 6.0.0-alpha.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/dist/index.cjs +2191 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +559 -0
- package/dist/index.d.ts +559 -0
- package/dist/index.js +2098 -0
- package/dist/index.js.map +1 -0
- package/package.json +48 -123
- package/src/balm.ts +103 -0
- package/src/bundler/esbuild.ts +47 -0
- package/src/bundler/index.ts +3 -0
- package/src/bundler/rollup.ts +39 -0
- package/src/bundler/webpack.ts +82 -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 +192 -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 +132 -0
- package/src/pipeline/transforms/cache.ts +96 -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 +58 -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 +78 -0
- package/src/tasks/index.ts +13 -0
- package/src/tasks/publish.ts +71 -0
- package/src/tasks/pwa.ts +49 -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 +89 -0
- package/src/tasks/style.ts +57 -0
- package/src/tasks/zip.ts +65 -0
- package/src/types/index.ts +200 -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
package/tslib/tasks/index.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import './foundation/index.js';
|
|
2
|
-
import PRIVATE_TASKS from './private/index.js';
|
|
3
|
-
import PUBLIC_TASKS from './public/index.js';
|
|
4
|
-
import DefaultTask from './default.js';
|
|
5
|
-
import BalmHooks from '../hooks/index.js';
|
|
6
|
-
function registerTasks(recipe) {
|
|
7
|
-
const AwesomeTasks = BalmJS.utils.deepMerge(PRIVATE_TASKS, PUBLIC_TASKS);
|
|
8
|
-
const depsTasks = [];
|
|
9
|
-
const nonDepsTasks = [];
|
|
10
|
-
Object.values(AwesomeTasks).forEach((AwesomeTask) => {
|
|
11
|
-
const awesomeTask = new AwesomeTask();
|
|
12
|
-
awesomeTask.deps
|
|
13
|
-
? depsTasks.push(awesomeTask)
|
|
14
|
-
: nonDepsTasks.push(awesomeTask);
|
|
15
|
-
});
|
|
16
|
-
nonDepsTasks.forEach((task) => {
|
|
17
|
-
const taskName = task.taskName;
|
|
18
|
-
const taskFunction = task.fn;
|
|
19
|
-
gulp.task(taskName, taskFunction);
|
|
20
|
-
BalmJS.tasks.set(task.name, task);
|
|
21
|
-
});
|
|
22
|
-
depsTasks.forEach((task) => {
|
|
23
|
-
const taskName = task.taskName;
|
|
24
|
-
const taskFunction = task.deps.length
|
|
25
|
-
? gulp.series(...BalmJS.toNamespace(task.deps))
|
|
26
|
-
: (callback) => {
|
|
27
|
-
callback();
|
|
28
|
-
};
|
|
29
|
-
gulp.task(taskName, taskFunction);
|
|
30
|
-
BalmJS.tasks.set(task.name, task);
|
|
31
|
-
});
|
|
32
|
-
try {
|
|
33
|
-
recipe(new BalmHooks());
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
const { message } = error;
|
|
37
|
-
BalmJS.logger.error('balm hook', message);
|
|
38
|
-
}
|
|
39
|
-
const defaultTask = new DefaultTask();
|
|
40
|
-
gulp.task(defaultTask.taskName, gulp.series(...defaultTask.startTask, ...defaultTask.mainTasks, ...defaultTask.subTasks, ...defaultTask.endTask));
|
|
41
|
-
gulp.parallel('balm:default')();
|
|
42
|
-
}
|
|
43
|
-
export default registerTasks;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import gulpSize from 'gulp-size';
|
|
2
|
-
class BuildTask extends BalmJS.BalmTask {
|
|
3
|
-
constructor() {
|
|
4
|
-
super('build');
|
|
5
|
-
this.defaultInput = BalmJS.file.matchAllFiles(BalmJS.config.dest.base);
|
|
6
|
-
}
|
|
7
|
-
fn = () => {
|
|
8
|
-
this.init();
|
|
9
|
-
return this.src.pipe(gulpSize({
|
|
10
|
-
title: this.name,
|
|
11
|
-
gzip: true
|
|
12
|
-
}));
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export default BuildTask;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import revAll from 'gulp-rev-all';
|
|
2
|
-
import { ASSETS_TYPES, CHUNK, ASSET } from '../../config/constants.js';
|
|
3
|
-
class CacheTask extends BalmJS.BalmTask {
|
|
4
|
-
constructor() {
|
|
5
|
-
super('cache');
|
|
6
|
-
const defaultIncludes = BalmJS.config.scripts.useCache
|
|
7
|
-
? ASSETS_TYPES.filter((assetType) => assetType !== 'js').map((assetType) => BalmJS.file.matchAllFiles(BalmJS.config.dest[assetType]))
|
|
8
|
-
: ASSETS_TYPES.map((assetType) => BalmJS.file.matchAllFiles(BalmJS.config.dest[assetType]));
|
|
9
|
-
const defaultExcludes = [
|
|
10
|
-
node.path.join(`!${BalmJS.config.dest.js}`, CHUNK.dir, '*'),
|
|
11
|
-
node.path.join(`!${BalmJS.config.dest.js}`, ASSET.dir, '*'),
|
|
12
|
-
node.path.join(`!${BalmJS.config.dest.base}`, BalmJS.config.pwa.manifest)
|
|
13
|
-
];
|
|
14
|
-
const customIncludes = BalmJS.config.assets.includes;
|
|
15
|
-
const customExcludes = BalmJS.config.assets.excludes.map((filename) => {
|
|
16
|
-
return `!${filename}`;
|
|
17
|
-
});
|
|
18
|
-
this.defaultInput = [
|
|
19
|
-
...defaultIncludes,
|
|
20
|
-
...defaultExcludes,
|
|
21
|
-
...(BalmJS.config.inFrontend
|
|
22
|
-
? [node.path.join(BalmJS.config.dest.base, '*.html')]
|
|
23
|
-
: []),
|
|
24
|
-
...customIncludes,
|
|
25
|
-
...customExcludes
|
|
26
|
-
];
|
|
27
|
-
this.defaultOutput = BalmJS.config.inFrontend
|
|
28
|
-
? BalmJS.config.dest.base
|
|
29
|
-
: BalmJS.config.dest.static;
|
|
30
|
-
this.gulpSrcOptions = {
|
|
31
|
-
base: this.defaultOutput
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
fn = () => {
|
|
35
|
-
this.init();
|
|
36
|
-
this.gulpSrcOptions = {
|
|
37
|
-
base: this.output
|
|
38
|
-
};
|
|
39
|
-
return this.src
|
|
40
|
-
.pipe(revAll.revision(BalmJS.config.assets.options))
|
|
41
|
-
.pipe($.if(/\.html$/, BalmJS.file.setPublicPath()))
|
|
42
|
-
.pipe(gulp.dest(this.output))
|
|
43
|
-
.pipe($.revDeleteOriginal({ exclude: /\.html$/ }))
|
|
44
|
-
.pipe(revAll.manifestFile())
|
|
45
|
-
.pipe(gulp.dest(this.output));
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
export default CacheTask;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { deleteAsync } from 'del';
|
|
2
|
-
import { ASSETS_TYPES } from '../../config/constants.js';
|
|
3
|
-
function unique(arr) {
|
|
4
|
-
const obj = {};
|
|
5
|
-
const result = [];
|
|
6
|
-
for (let i = 0, len = arr.length; i < len; i++) {
|
|
7
|
-
if (!obj[arr[i]]) {
|
|
8
|
-
obj[arr[i]] = true;
|
|
9
|
-
result.push(arr[i].replace(/\\/g, '/'));
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
return result;
|
|
13
|
-
}
|
|
14
|
-
class CleanTask extends BalmJS.BalmTask {
|
|
15
|
-
constructor() {
|
|
16
|
-
super('clean');
|
|
17
|
-
}
|
|
18
|
-
#getAssetsDir = (rootKey = 'assets') => {
|
|
19
|
-
return unique(ASSETS_TYPES.map((assetType) => BalmJS.config[rootKey][assetType]));
|
|
20
|
-
};
|
|
21
|
-
get remoteRootDir() {
|
|
22
|
-
return BalmJS.config.assets.root.trim().length
|
|
23
|
-
? [BalmJS.config.assets.root]
|
|
24
|
-
: [];
|
|
25
|
-
}
|
|
26
|
-
get remoteAppDir() {
|
|
27
|
-
return BalmJS.config.assets.subDir
|
|
28
|
-
? [BalmJS.config.assets.static]
|
|
29
|
-
: this.#getAssetsDir();
|
|
30
|
-
}
|
|
31
|
-
get dirInFrontend() {
|
|
32
|
-
const isLocal = !node.path.isAbsolute(BalmJS.config.assets.root);
|
|
33
|
-
BalmJS.logger.info(`${this.name} task`, `'${BalmJS.config.assets.root}' is local directory: ${isLocal}`);
|
|
34
|
-
return BalmJS.config.env.isProd
|
|
35
|
-
? [
|
|
36
|
-
BalmJS.file.absPath(BalmJS.config.roots.target),
|
|
37
|
-
...(isLocal ? this.remoteRootDir : this.remoteAppDir)
|
|
38
|
-
]
|
|
39
|
-
: [BalmJS.file.absPath(BalmJS.config.roots.tmp)];
|
|
40
|
-
}
|
|
41
|
-
get dirInBackend() {
|
|
42
|
-
const hasBuildDir = BalmJS.config.assets.cache &&
|
|
43
|
-
!!(BalmJS.config.assets.buildDir || BalmJS.config.assets.subDir);
|
|
44
|
-
const buildDirInProd = hasBuildDir
|
|
45
|
-
? [BalmJS.config.dest.static]
|
|
46
|
-
: [];
|
|
47
|
-
const buildDirInDev = hasBuildDir
|
|
48
|
-
? [
|
|
49
|
-
node.path.join(BalmJS.config.dest.static, BalmJS.config.assets.buildDir)
|
|
50
|
-
]
|
|
51
|
-
: [];
|
|
52
|
-
return [
|
|
53
|
-
...(BalmJS.config.env.isProd && hasBuildDir
|
|
54
|
-
? buildDirInProd
|
|
55
|
-
: [...buildDirInDev, ...this.#getAssetsDir('dest')])
|
|
56
|
-
];
|
|
57
|
-
}
|
|
58
|
-
fn = async (callback) => {
|
|
59
|
-
const taskName = `${this.name} task`;
|
|
60
|
-
const directories = BalmJS.config.inFrontend
|
|
61
|
-
? this.dirInFrontend
|
|
62
|
-
: this.dirInBackend;
|
|
63
|
-
if (BalmJS.config.env.isProd && !BalmJS.config.assets.root) {
|
|
64
|
-
BalmJS.logger.warn(taskName, 'Remote root path is empty');
|
|
65
|
-
}
|
|
66
|
-
BalmJS.logger.debug(taskName, {
|
|
67
|
-
directories
|
|
68
|
-
}, {
|
|
69
|
-
pre: true
|
|
70
|
-
});
|
|
71
|
-
const deletedPaths = await deleteAsync(directories, {
|
|
72
|
-
force: true
|
|
73
|
-
});
|
|
74
|
-
BalmJS.logger.warn(taskName, {
|
|
75
|
-
deletedPaths
|
|
76
|
-
}, {
|
|
77
|
-
pre: true
|
|
78
|
-
});
|
|
79
|
-
callback();
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
export default CleanTask;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
class EndTask extends BalmJS.BalmTask {
|
|
2
|
-
constructor() {
|
|
3
|
-
super('end');
|
|
4
|
-
}
|
|
5
|
-
time() {
|
|
6
|
-
const end = process.hrtime(BalmJS.start);
|
|
7
|
-
const timeInMs = Math.ceil((end[0] * 1000000000 + end[1]) / 1000000);
|
|
8
|
-
BalmJS.logger.info('execution time', `${timeInMs}ms`, {
|
|
9
|
-
logLevel: BalmJS.LogLevel.Error
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
fn = async (callback) => {
|
|
13
|
-
if (BalmJS.utils.isFunction(BalmJS.afterTask)) {
|
|
14
|
-
await BalmJS.afterTask();
|
|
15
|
-
}
|
|
16
|
-
this.time();
|
|
17
|
-
BalmJS.emitter.emit('exit');
|
|
18
|
-
callback();
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export default EndTask;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
class ExtraTask extends BalmJS.BalmTask {
|
|
2
|
-
constructor() {
|
|
3
|
-
super('extra');
|
|
4
|
-
const includeGlobs = [];
|
|
5
|
-
if (BalmJS.config.extras.includes.length) {
|
|
6
|
-
for (const filename of BalmJS.config.extras.includes) {
|
|
7
|
-
includeGlobs.push(node.path.join(BalmJS.config.src.base, filename));
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
const excludeGlobs = [];
|
|
11
|
-
if (BalmJS.config.extras.excludes.length) {
|
|
12
|
-
for (const filename of BalmJS.config.extras.excludes) {
|
|
13
|
-
excludeGlobs.push(node.path.join(`!${BalmJS.config.src.base}`, filename));
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
const defaultGlobs = [
|
|
17
|
-
node.path.join(BalmJS.config.src.base, '*.*'),
|
|
18
|
-
node.path.join(`!${BalmJS.config.src.base}`, '*.html'),
|
|
19
|
-
node.path.join(`!${BalmJS.config.src.base}`, BalmJS.config.pwa.manifest),
|
|
20
|
-
...includeGlobs,
|
|
21
|
-
...excludeGlobs
|
|
22
|
-
];
|
|
23
|
-
this.defaultInput = defaultGlobs;
|
|
24
|
-
this.defaultOutput = BalmJS.config.dest.base;
|
|
25
|
-
}
|
|
26
|
-
fn = () => {
|
|
27
|
-
this.init();
|
|
28
|
-
this.gulpSrcOptions = {
|
|
29
|
-
dot: true
|
|
30
|
-
};
|
|
31
|
-
return this.src.pipe(gulp.dest(this.output));
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
export default ExtraTask;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
class FontTask extends BalmJS.BalmTask {
|
|
2
|
-
constructor() {
|
|
3
|
-
super('font');
|
|
4
|
-
this.defaultInput = BalmJS.file.matchAllFiles(BalmJS.config.src.font, '*.{eot,svg,ttf,woff,woff2}');
|
|
5
|
-
this.defaultOutput = BalmJS.config.dest.font;
|
|
6
|
-
}
|
|
7
|
-
fn = () => {
|
|
8
|
-
this.init();
|
|
9
|
-
return this.src.pipe(gulp.dest(this.output));
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export default FontTask;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { getDefaultImagePlugins } from '../../plugins/imagemin.js';
|
|
2
|
-
class ImageTask extends BalmJS.BalmTask {
|
|
3
|
-
constructor() {
|
|
4
|
-
super('image');
|
|
5
|
-
const excludeGlobs = [];
|
|
6
|
-
for (const imageFolder of BalmJS.config.styles.sprites) {
|
|
7
|
-
excludeGlobs.push(node.path.join(`!${BalmJS.config.src.img}`, imageFolder));
|
|
8
|
-
excludeGlobs.push(node.path.join(`!${BalmJS.config.src.img}`, imageFolder, '*.png'));
|
|
9
|
-
}
|
|
10
|
-
this.defaultInput = [
|
|
11
|
-
BalmJS.file.matchAllFiles(BalmJS.config.src.img),
|
|
12
|
-
...excludeGlobs
|
|
13
|
-
];
|
|
14
|
-
this.defaultOutput = BalmJS.config.dest.img;
|
|
15
|
-
if (BalmJS.utils.isArray(BalmJS.config.images.plugins)) {
|
|
16
|
-
this.plugins = BalmJS.config.images.plugins;
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
const defaultPlugins = Object.assign(getDefaultImagePlugins(), BalmJS.config.images.plugins);
|
|
20
|
-
const enablePlugins = Object.keys(defaultPlugins).filter((key) => defaultPlugins[key]);
|
|
21
|
-
this.plugins = enablePlugins.map((key) => defaultPlugins[key]);
|
|
22
|
-
BalmJS.logger.debug(`${this.name} task - plugins`, enablePlugins);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
fn = () => {
|
|
26
|
-
this.init();
|
|
27
|
-
const balmImage = () => {
|
|
28
|
-
return gulp
|
|
29
|
-
.src(BalmJS.file.absPaths(this.input), {
|
|
30
|
-
since: gulp.lastRun(balmImage),
|
|
31
|
-
encoding: false
|
|
32
|
-
})
|
|
33
|
-
.pipe(BalmJS.plugins.plumber((error) => {
|
|
34
|
-
BalmJS.logger.error(`${this.name} task`, error);
|
|
35
|
-
}))
|
|
36
|
-
.pipe(BalmJS.plugins.imagemin(this.plugins))
|
|
37
|
-
.pipe(gulp.dest(this.output));
|
|
38
|
-
};
|
|
39
|
-
return balmImage();
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
export default ImageTask;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import StartTask from './start.js';
|
|
2
|
-
import CleanTask from './clean.js';
|
|
3
|
-
import SpriteTask from './sprite.js';
|
|
4
|
-
import StyleTask from './style.js';
|
|
5
|
-
import LintTask from './lint.js';
|
|
6
|
-
import ScriptTask from './script.js';
|
|
7
|
-
import ImageTask from './image.js';
|
|
8
|
-
import FontTask from './font.js';
|
|
9
|
-
import MediaTask from './media.js';
|
|
10
|
-
import ModernizrTask from './modernizr.js';
|
|
11
|
-
import ExtraTask from './extra.js';
|
|
12
|
-
import BuildTask from './build.js';
|
|
13
|
-
import CacheTask from './cache.js';
|
|
14
|
-
import WorkboxSwTask from './workbox-sw.js';
|
|
15
|
-
import PwaCacheTask from './pwa-cache.js';
|
|
16
|
-
import EndTask from './end.js';
|
|
17
|
-
export default {
|
|
18
|
-
StartTask,
|
|
19
|
-
CleanTask,
|
|
20
|
-
SpriteTask,
|
|
21
|
-
StyleTask,
|
|
22
|
-
LintTask,
|
|
23
|
-
ScriptTask,
|
|
24
|
-
ImageTask,
|
|
25
|
-
FontTask,
|
|
26
|
-
MediaTask,
|
|
27
|
-
ModernizrTask,
|
|
28
|
-
ExtraTask,
|
|
29
|
-
BuildTask,
|
|
30
|
-
CacheTask,
|
|
31
|
-
WorkboxSwTask,
|
|
32
|
-
PwaCacheTask,
|
|
33
|
-
EndTask
|
|
34
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
class LintTask extends BalmJS.BalmTask {
|
|
2
|
-
constructor() {
|
|
3
|
-
super('lint');
|
|
4
|
-
this.defaultOutput = BalmJS.config.src.js;
|
|
5
|
-
this.defaultInput = BalmJS.file.matchAllFiles(this.defaultOutput, '*.js');
|
|
6
|
-
}
|
|
7
|
-
fn = () => {
|
|
8
|
-
this.init();
|
|
9
|
-
return this.src
|
|
10
|
-
.pipe($.eslint({ fix: true }))
|
|
11
|
-
.pipe(server.reload({ stream: true, once: true }))
|
|
12
|
-
.pipe($.eslint.format())
|
|
13
|
-
.pipe($.if(!server.active, $.eslint.failAfterError()))
|
|
14
|
-
.pipe(gulp.dest(this.output));
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export default LintTask;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
class MediaTask extends BalmJS.BalmTask {
|
|
2
|
-
constructor() {
|
|
3
|
-
super('media');
|
|
4
|
-
this.defaultInput = BalmJS.file.matchAllFiles(BalmJS.config.src.media);
|
|
5
|
-
this.defaultOutput = BalmJS.config.dest.media;
|
|
6
|
-
}
|
|
7
|
-
fn = () => {
|
|
8
|
-
this.init();
|
|
9
|
-
return this.src.pipe(gulp.dest(this.output));
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export default MediaTask;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { build } from 'modernizr';
|
|
2
|
-
class ModernizrTask extends BalmJS.BalmTask {
|
|
3
|
-
constructor() {
|
|
4
|
-
super('modernizr');
|
|
5
|
-
this.defaultInput = `${this.name}.json`;
|
|
6
|
-
this.defaultOutput = node.path.join(BalmJS.config.dest.js, `${this.name}.js`);
|
|
7
|
-
}
|
|
8
|
-
#readConfig = () => {
|
|
9
|
-
return new Promise((resolve, reject) => {
|
|
10
|
-
node.fs.readFile(this.input, 'utf8', (err, data) => {
|
|
11
|
-
if (err)
|
|
12
|
-
reject(err);
|
|
13
|
-
resolve(JSON.parse(data));
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
#createDir = () => {
|
|
18
|
-
return new Promise((resolve, reject) => {
|
|
19
|
-
node.fs.mkdir(BalmJS.file.absPath(BalmJS.config.dest.js), { recursive: true }, (err) => {
|
|
20
|
-
if (err)
|
|
21
|
-
reject(err);
|
|
22
|
-
resolve();
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
#generateScript = (config) => {
|
|
27
|
-
return new Promise((resolve, reject) => {
|
|
28
|
-
build(config, (content) => {
|
|
29
|
-
node.fs.writeFile(this.output, content, (err) => {
|
|
30
|
-
if (err)
|
|
31
|
-
reject(err);
|
|
32
|
-
resolve(content);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
fn = async (callback) => {
|
|
38
|
-
this.init();
|
|
39
|
-
if (node.fs.existsSync(this.input)) {
|
|
40
|
-
const [config] = await Promise.all([
|
|
41
|
-
this.#readConfig(),
|
|
42
|
-
this.#createDir()
|
|
43
|
-
]);
|
|
44
|
-
await this.#generateScript(config);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
BalmJS.logger.warn(`${this.name} task`, `The '${this.input}' does not exist`, {
|
|
48
|
-
logLevel: BalmJS.LogLevel.Info
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
callback();
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
export default ModernizrTask;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { deleteAsync } from 'del';
|
|
2
|
-
class PwaCacheTask extends BalmJS.BalmTask {
|
|
3
|
-
constructor() {
|
|
4
|
-
super('pwa-cache');
|
|
5
|
-
this.defaultOutput = BalmJS.config.dest.base;
|
|
6
|
-
this.defaultInput = node.path.join(this.defaultOutput, BalmJS.config.pwa.swDestFilename);
|
|
7
|
-
}
|
|
8
|
-
clear() {
|
|
9
|
-
if (BalmJS.config.pwa.swSrcFilename !== BalmJS.config.pwa.swDestFilename) {
|
|
10
|
-
const swOrigin = BalmJS.file.absPath(node.path.join(BalmJS.config.dest.base, BalmJS.config.pwa.swSrcFilename));
|
|
11
|
-
deleteAsync(swOrigin, { force: true });
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
fn = () => {
|
|
15
|
-
this.init();
|
|
16
|
-
const swDest = typeof this.input === 'string' && this.input
|
|
17
|
-
? BalmJS.file.absPath(this.input)
|
|
18
|
-
: '';
|
|
19
|
-
if (!swDest || !node.fs.existsSync(swDest)) {
|
|
20
|
-
return Promise.resolve();
|
|
21
|
-
}
|
|
22
|
-
const newVersion = BalmJS.config.pwa.version || Date.now().toString();
|
|
23
|
-
BalmJS.logger.info('pwa - version', newVersion);
|
|
24
|
-
const stream = this.src
|
|
25
|
-
.pipe(BalmJS.plugins.replace('{{ version }}', newVersion))
|
|
26
|
-
.pipe($.if(BalmJS.config.env.isProd, BalmJS.plugins.jsmin(BalmJS.config.scripts.minifyOptions)))
|
|
27
|
-
.pipe(gulp.dest(this.output));
|
|
28
|
-
this.clear();
|
|
29
|
-
return stream;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
export default PwaCacheTask;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import mergeStream from '../../utilities/merge-stream.js';
|
|
2
|
-
class SpriteTask extends BalmJS.BalmTask {
|
|
3
|
-
#tasks = [];
|
|
4
|
-
constructor() {
|
|
5
|
-
super('sprite');
|
|
6
|
-
this.defaultInput = BalmJS.config.styles.sprites;
|
|
7
|
-
this.defaultOutput = BalmJS.config.dest.img;
|
|
8
|
-
if (this.defaultInput.length) {
|
|
9
|
-
this.init();
|
|
10
|
-
this.collect();
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
#getParams = (spriteItem, spriteOptions) => {
|
|
14
|
-
const stylesConfig = Object.assign(spriteOptions, BalmJS.config.styles);
|
|
15
|
-
const spriteName = `${spriteItem.folderName}-${this.name}s`;
|
|
16
|
-
const imageTarget = stylesConfig.imageTarget || BalmJS.config.paths.target.img;
|
|
17
|
-
let defaultParams = Object.assign({
|
|
18
|
-
padding: 1
|
|
19
|
-
}, {
|
|
20
|
-
imgName: `${spriteName}.png`,
|
|
21
|
-
cssName: `_${spriteItem.folderName}.${stylesConfig.extname}`,
|
|
22
|
-
imgPath: `${stylesConfig.imageBasePath}${imageTarget}/${spriteName}.png`,
|
|
23
|
-
cssVarMap: (sprite) => {
|
|
24
|
-
sprite.name = `${spriteItem.folderName}-${sprite.name}`;
|
|
25
|
-
},
|
|
26
|
-
cssSpritesheetName: `${spriteItem.folderName}-spritesheet`,
|
|
27
|
-
cssOpts: {
|
|
28
|
-
cssSelector: (sprite) => `.${sprite.name}`
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
if (stylesConfig.spriteRetina) {
|
|
32
|
-
defaultParams = Object.assign(defaultParams, {
|
|
33
|
-
retinaSrcFilter: `${spriteItem.retinaSrc}`,
|
|
34
|
-
retinaImgName: `${spriteName}@2x.png`,
|
|
35
|
-
retinaImgPath: `${stylesConfig.imageBasePath}${imageTarget}/${spriteName}@2x.png`,
|
|
36
|
-
cssVarMap: (sprite) => {
|
|
37
|
-
sprite.name = `${spriteItem.folderName}-${sprite.name}`;
|
|
38
|
-
},
|
|
39
|
-
cssRetinaSpritesheetName: `${spriteItem.folderName}-spritesheet-2x`,
|
|
40
|
-
cssRetinaGroupsName: `${spriteItem.folderName}-retina-groups`
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
return Object.assign(defaultParams, stylesConfig.spriteParams);
|
|
44
|
-
};
|
|
45
|
-
collect(spriteOptions = {}) {
|
|
46
|
-
const spriteList = [];
|
|
47
|
-
for (const spriteName of this.input) {
|
|
48
|
-
spriteList.push({
|
|
49
|
-
src: `${BalmJS.config.src.img}/${spriteName}/*.png`,
|
|
50
|
-
retinaSrc: `${BalmJS.config.src.img}/${spriteName}/*@2x.png`,
|
|
51
|
-
folderName: spriteName
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
for (let key = 0, len = spriteList.length; key < len; key++) {
|
|
55
|
-
const spriteItem = spriteList[key];
|
|
56
|
-
const spriteTaskName = `${this.name}:${spriteItem.folderName}`;
|
|
57
|
-
const spriteConfig = {
|
|
58
|
-
input: BalmJS.file.absPath(spriteItem.src),
|
|
59
|
-
imgOutput: BalmJS.file.absPath(this.output),
|
|
60
|
-
cssOutput: BalmJS.file.absPath(`${BalmJS.config.src.css}/${this.name}s`)
|
|
61
|
-
};
|
|
62
|
-
BalmJS.logger.debug(`${this.name} task`, spriteConfig, {
|
|
63
|
-
pre: true
|
|
64
|
-
});
|
|
65
|
-
spriteConfig.params = this.#getParams(spriteItem, spriteOptions);
|
|
66
|
-
gulp.task(BalmJS.toNamespace(spriteTaskName), () => {
|
|
67
|
-
const spriteData = gulp
|
|
68
|
-
.src(spriteConfig.input, { encoding: false })
|
|
69
|
-
.pipe(BalmJS.plugins.plumber((error) => {
|
|
70
|
-
BalmJS.logger.error(`${this.name} task`, error.message);
|
|
71
|
-
}))
|
|
72
|
-
.pipe($.spritesmith(spriteConfig.params));
|
|
73
|
-
const imgStream = spriteData.img.pipe(gulp.dest(spriteConfig.imgOutput));
|
|
74
|
-
const cssStream = spriteData.css.pipe(gulp.dest(spriteConfig.cssOutput));
|
|
75
|
-
return mergeStream(imgStream, cssStream);
|
|
76
|
-
});
|
|
77
|
-
this.#tasks.push(spriteTaskName);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
recipe(input, output, spriteOptions = {}) {
|
|
81
|
-
if (input.length) {
|
|
82
|
-
if (output && !spriteOptions.imageTarget) {
|
|
83
|
-
spriteOptions.imageTarget = output.split('/').pop();
|
|
84
|
-
}
|
|
85
|
-
this.init(input, output);
|
|
86
|
-
this.collect(spriteOptions);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
get deps() {
|
|
90
|
-
return this.#tasks;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
export default SpriteTask;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
class StartTask extends BalmJS.BalmTask {
|
|
2
|
-
constructor() {
|
|
3
|
-
super('start');
|
|
4
|
-
}
|
|
5
|
-
fn = async (callback) => {
|
|
6
|
-
BalmJS.start = process.hrtime();
|
|
7
|
-
if (BalmJS.utils.isFunction(BalmJS.beforeTask)) {
|
|
8
|
-
await BalmJS.beforeTask();
|
|
9
|
-
}
|
|
10
|
-
callback();
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
export default StartTask;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
class WorkboxSwTask extends BalmJS.BalmTask {
|
|
2
|
-
constructor() {
|
|
3
|
-
super('workbox-sw');
|
|
4
|
-
this.defaultInput = [
|
|
5
|
-
BalmJS.config.pwa.workboxSw,
|
|
6
|
-
`${BalmJS.config.pwa.workboxSw}.map`
|
|
7
|
-
];
|
|
8
|
-
this.defaultOutput = BalmJS.config.dest.base;
|
|
9
|
-
}
|
|
10
|
-
fn = () => {
|
|
11
|
-
this.init();
|
|
12
|
-
return this.src.pipe(gulp.dest(this.output));
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export default WorkboxSwTask;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
class CopyTask extends BalmJS.BalmTask {
|
|
2
|
-
constructor() {
|
|
3
|
-
super('copy');
|
|
4
|
-
}
|
|
5
|
-
recipe(input, output, options = {}) {
|
|
6
|
-
const balmCopy = () => {
|
|
7
|
-
this.init(input, output, options);
|
|
8
|
-
return this.src
|
|
9
|
-
.pipe(BalmJS.plugins.rename(this.customOptions))
|
|
10
|
-
.pipe(gulp.dest(this.output));
|
|
11
|
-
};
|
|
12
|
-
return balmCopy;
|
|
13
|
-
}
|
|
14
|
-
fn(callback) {
|
|
15
|
-
callback();
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
export default CopyTask;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import esbuild from '../../bundler/esbuild/index.js';
|
|
2
|
-
class EsbuildTask extends BalmJS.BalmTask {
|
|
3
|
-
constructor() {
|
|
4
|
-
super('esbuild');
|
|
5
|
-
this.defaultOutput = BalmJS.config.dest.js;
|
|
6
|
-
}
|
|
7
|
-
recipe(input, output, customOptions = {}) {
|
|
8
|
-
const balmBundler = (callback) => {
|
|
9
|
-
this.init(input || BalmJS.config.scripts.entry, output);
|
|
10
|
-
esbuild(this.input || BalmJS.file.defaultEntry, this.output, customOptions, callback);
|
|
11
|
-
};
|
|
12
|
-
return balmBundler;
|
|
13
|
-
}
|
|
14
|
-
get fn() {
|
|
15
|
-
return this.recipe();
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
export default EsbuildTask;
|