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
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as esbuild from 'esbuild';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { BalmConfig } from '../types/index.js';
|
|
4
|
+
import { logger } from '../utilities/logger.js';
|
|
5
|
+
|
|
6
|
+
export async function runEsbuild(
|
|
7
|
+
config: BalmConfig,
|
|
8
|
+
customOptions: esbuild.BuildOptions = {}
|
|
9
|
+
): Promise<esbuild.BuildResult> {
|
|
10
|
+
const isProd = config.env.isProd;
|
|
11
|
+
|
|
12
|
+
let entryPoints = customOptions.entryPoints || config.scripts.entry;
|
|
13
|
+
if (!entryPoints) {
|
|
14
|
+
entryPoints = [path.join(config.src.js, 'main.js')];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const defaultOptions: esbuild.BuildOptions = {
|
|
18
|
+
entryPoints: (Array.isArray(entryPoints)
|
|
19
|
+
? entryPoints
|
|
20
|
+
: typeof entryPoints === 'string'
|
|
21
|
+
? [entryPoints]
|
|
22
|
+
: entryPoints) as any,
|
|
23
|
+
absWorkingDir: config.workspace,
|
|
24
|
+
bundle: true,
|
|
25
|
+
outdir: config.dest.js,
|
|
26
|
+
alias: {
|
|
27
|
+
...config.alias,
|
|
28
|
+
...config.scripts.alias
|
|
29
|
+
},
|
|
30
|
+
minify: isProd || config.scripts.minify,
|
|
31
|
+
sourcemap: !isProd,
|
|
32
|
+
target:
|
|
33
|
+
config.scripts.target && config.scripts.target !== 'web'
|
|
34
|
+
? (config.scripts.target as string)
|
|
35
|
+
: 'es2020',
|
|
36
|
+
format: 'esm',
|
|
37
|
+
...config.scripts.esbuildOptions,
|
|
38
|
+
...customOptions
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
return await esbuild.build(defaultOptions);
|
|
43
|
+
} catch (err: any) {
|
|
44
|
+
logger.error('esbuild', err.message || err);
|
|
45
|
+
throw err;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { rollup, RollupOptions, OutputOptions } from 'rollup';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { BalmConfig } from '../types/index.js';
|
|
4
|
+
import { logger } from '../utilities/logger.js';
|
|
5
|
+
|
|
6
|
+
export async function runRollup(
|
|
7
|
+
config: BalmConfig,
|
|
8
|
+
customInputOptions: RollupOptions = {},
|
|
9
|
+
customOutputOptions: OutputOptions = {}
|
|
10
|
+
): Promise<void> {
|
|
11
|
+
const isProd = config.env.isProd;
|
|
12
|
+
|
|
13
|
+
let input = customInputOptions.input || config.scripts.entry;
|
|
14
|
+
if (!input) {
|
|
15
|
+
input = path.join(config.src.js, 'main.js');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const inputOptions: RollupOptions = {
|
|
19
|
+
input: input as any,
|
|
20
|
+
...config.scripts.rollupOptions,
|
|
21
|
+
...customInputOptions
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const outputOptions: OutputOptions = {
|
|
25
|
+
dir: config.dest.js,
|
|
26
|
+
format: 'es',
|
|
27
|
+
sourcemap: !isProd,
|
|
28
|
+
...customOutputOptions
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
const bundle = await rollup(inputOptions);
|
|
33
|
+
await bundle.write(outputOptions);
|
|
34
|
+
await bundle.close();
|
|
35
|
+
} catch (err: any) {
|
|
36
|
+
logger.error('rollup', err.message || err);
|
|
37
|
+
throw err;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import webpack, { Configuration } from 'webpack';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { BalmConfig } from '../types/index.js';
|
|
4
|
+
import { logger } from '../utilities/logger.js';
|
|
5
|
+
|
|
6
|
+
export async function runWebpack(
|
|
7
|
+
config: BalmConfig,
|
|
8
|
+
customOptions: Configuration = {}
|
|
9
|
+
): Promise<webpack.Stats | undefined> {
|
|
10
|
+
const isProd = config.env.isProd;
|
|
11
|
+
|
|
12
|
+
let entry = customOptions.entry || config.scripts.entry;
|
|
13
|
+
if (!entry) {
|
|
14
|
+
entry = path.join(config.src.js, 'main.js');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const defaultWebpackConfig: Configuration = {
|
|
18
|
+
mode: isProd ? 'production' : 'development',
|
|
19
|
+
context: config.workspace,
|
|
20
|
+
entry,
|
|
21
|
+
output: {
|
|
22
|
+
path: config.dest.js,
|
|
23
|
+
filename: isProd && config.assets.cache ? '[name].[contenthash:8].js' : '[name].js',
|
|
24
|
+
chunkFilename: isProd && config.assets.cache ? 'chunk/[name].[contenthash:8].js' : 'chunk/[name].js',
|
|
25
|
+
publicPath: config.assets.virtualDir ? `/${config.assets.virtualDir}/` : '/'
|
|
26
|
+
},
|
|
27
|
+
resolve: {
|
|
28
|
+
extensions: ['.wasm', '.mjs', '.js', '.jsx', '.ts', '.tsx', '.json'],
|
|
29
|
+
alias: {
|
|
30
|
+
...config.alias,
|
|
31
|
+
...config.scripts.alias
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
module: {
|
|
35
|
+
rules: [
|
|
36
|
+
{
|
|
37
|
+
test: /\.(png|jpe?g|gif|svg|webp)$/i,
|
|
38
|
+
type: 'asset/resource',
|
|
39
|
+
generator: {
|
|
40
|
+
filename: 'img/[name].[hash:8][ext]'
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
test: /\.(woff2?|eot|ttf|otf)$/i,
|
|
45
|
+
type: 'asset/resource',
|
|
46
|
+
generator: {
|
|
47
|
+
filename: 'font/[name].[hash:8][ext]'
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
optimization: {
|
|
53
|
+
minimize: isProd || config.scripts.minify
|
|
54
|
+
},
|
|
55
|
+
devtool: isProd ? false : 'eval-cheap-module-source-map'
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const webpackConfig = Object.assign(
|
|
59
|
+
{},
|
|
60
|
+
defaultWebpackConfig,
|
|
61
|
+
config.scripts.webpackOptions,
|
|
62
|
+
customOptions
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
return new Promise((resolve, reject) => {
|
|
66
|
+
const compiler = webpack(webpackConfig);
|
|
67
|
+
compiler.run((err, stats) => {
|
|
68
|
+
if (err) {
|
|
69
|
+
logger.error('webpack', err.stack || err);
|
|
70
|
+
return reject(err);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (stats?.hasErrors()) {
|
|
74
|
+
const info = stats.toJson();
|
|
75
|
+
logger.error('webpack', info.errors?.map((e) => e.message).join('\n'));
|
|
76
|
+
return reject(new Error('Webpack compilation errors'));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
resolve(stats);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const ASSETS_TYPES = ['css', 'js', 'img', 'font', 'media'];
|
|
2
|
+
export const PUBLIC_URL = '%PUBLIC_URL%';
|
|
3
|
+
export const CHUNK = { dir: 'chunk' };
|
|
4
|
+
export const ASSET = { dir: 'asset' };
|
|
5
|
+
|
|
6
|
+
export const ASSET_EXT = {
|
|
7
|
+
styles: ['css', 'scss', 'sass', 'less'],
|
|
8
|
+
scripts: ['js', 'mjs', 'cjs', 'ts', 'mts', 'cts', 'jsx', 'tsx'],
|
|
9
|
+
images: ['png', 'jpg', 'jpeg', 'gif', 'svg', 'webp', 'ico'],
|
|
10
|
+
fonts: ['woff', 'woff2', 'ttf', 'eot', 'otf'],
|
|
11
|
+
media: ['mp4', 'webm', 'ogg', 'mp3', 'wav', 'flac', 'aac']
|
|
12
|
+
};
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { BalmConfig, BundlerType } from '../types/index.js';
|
|
3
|
+
|
|
4
|
+
export function createDefaultConfig(workspace = process.cwd()): BalmConfig {
|
|
5
|
+
const isProd = process.env.NODE_ENV === 'production';
|
|
6
|
+
const isDev = !isProd;
|
|
7
|
+
const isTest = process.env.NODE_ENV === 'test';
|
|
8
|
+
|
|
9
|
+
const roots = {
|
|
10
|
+
source: 'src',
|
|
11
|
+
tmp: '.tmp',
|
|
12
|
+
target: 'dist'
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const paths = {
|
|
16
|
+
source: {
|
|
17
|
+
base: '',
|
|
18
|
+
html: '',
|
|
19
|
+
css: 'styles',
|
|
20
|
+
js: 'scripts',
|
|
21
|
+
img: 'images',
|
|
22
|
+
font: 'fonts',
|
|
23
|
+
media: 'media'
|
|
24
|
+
},
|
|
25
|
+
tmp: {
|
|
26
|
+
base: '',
|
|
27
|
+
css: 'css',
|
|
28
|
+
js: 'js',
|
|
29
|
+
img: 'img',
|
|
30
|
+
font: 'fonts',
|
|
31
|
+
media: 'media'
|
|
32
|
+
},
|
|
33
|
+
target: {
|
|
34
|
+
base: '',
|
|
35
|
+
css: 'css',
|
|
36
|
+
js: 'js',
|
|
37
|
+
img: 'img',
|
|
38
|
+
font: 'font',
|
|
39
|
+
media: 'media'
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const alias: Record<string, string> = {
|
|
44
|
+
'@': path.join(workspace, roots.source)
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const styles = {
|
|
48
|
+
extname: 'scss',
|
|
49
|
+
minify: false,
|
|
50
|
+
atImportPaths: [],
|
|
51
|
+
alias: {},
|
|
52
|
+
options: {},
|
|
53
|
+
sassOptions: {},
|
|
54
|
+
lessOptions: {},
|
|
55
|
+
postcssLoaderOptions: {},
|
|
56
|
+
postcssPlugins: [],
|
|
57
|
+
sprites: [],
|
|
58
|
+
spriteOptions: {}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const scripts = {
|
|
62
|
+
bundler: BundlerType.webpack,
|
|
63
|
+
minify: false,
|
|
64
|
+
minifyOptions: {},
|
|
65
|
+
entry: '',
|
|
66
|
+
target: 'web',
|
|
67
|
+
library: '',
|
|
68
|
+
libraryTarget: 'var',
|
|
69
|
+
externals: {},
|
|
70
|
+
injectHtml: false,
|
|
71
|
+
htmlName: 'index.html',
|
|
72
|
+
alias: {},
|
|
73
|
+
plugins: [],
|
|
74
|
+
loaders: [],
|
|
75
|
+
defaultLoaders: {
|
|
76
|
+
html: true,
|
|
77
|
+
css: true,
|
|
78
|
+
js: true,
|
|
79
|
+
url: true
|
|
80
|
+
},
|
|
81
|
+
options: {},
|
|
82
|
+
esbuildOptions: {},
|
|
83
|
+
rollupOptions: {},
|
|
84
|
+
webpackOptions: {},
|
|
85
|
+
useCache: false
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const html = {
|
|
89
|
+
options: {
|
|
90
|
+
collapseWhitespace: true,
|
|
91
|
+
minifyCSS: true,
|
|
92
|
+
minifyJS: {
|
|
93
|
+
compress: {
|
|
94
|
+
drop_console: true
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
processConditionalComments: true,
|
|
98
|
+
removeComments: true,
|
|
99
|
+
removeEmptyAttributes: true,
|
|
100
|
+
removeScriptTypeAttributes: true,
|
|
101
|
+
removeStyleLinkTypeAttributes: true
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const assets = {
|
|
106
|
+
root: 'assets',
|
|
107
|
+
mainDir: 'public',
|
|
108
|
+
subDir: '',
|
|
109
|
+
buildDir: 'build',
|
|
110
|
+
virtualDir: '',
|
|
111
|
+
cache: false,
|
|
112
|
+
options: {
|
|
113
|
+
fileNameManifest: 'rev-manifest.json',
|
|
114
|
+
dontRenameFile: ['.html'],
|
|
115
|
+
dontUpdateReference: []
|
|
116
|
+
},
|
|
117
|
+
includes: [],
|
|
118
|
+
excludes: []
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const server = {
|
|
122
|
+
host: null,
|
|
123
|
+
port: 3000,
|
|
124
|
+
open: true,
|
|
125
|
+
proxy: false,
|
|
126
|
+
proxyOptions: false,
|
|
127
|
+
historyOptions: false,
|
|
128
|
+
useHMR: false,
|
|
129
|
+
options: {}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const pwa = {
|
|
133
|
+
enabled: false,
|
|
134
|
+
mode: 'generateSW' as const,
|
|
135
|
+
version: '',
|
|
136
|
+
manifest: 'manifest.json',
|
|
137
|
+
swSrcFilename: 'service-worker.js',
|
|
138
|
+
swDestFilename: 'sw.js',
|
|
139
|
+
options: {}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const ftp = {
|
|
143
|
+
options: {},
|
|
144
|
+
watchFiles: []
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const images = {
|
|
148
|
+
plugins: []
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const env = {
|
|
152
|
+
isProd,
|
|
153
|
+
isDev,
|
|
154
|
+
isTest,
|
|
155
|
+
inFrontend: true,
|
|
156
|
+
inSSR: false,
|
|
157
|
+
inDesktopApp: false,
|
|
158
|
+
isMP: false
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const src = {
|
|
162
|
+
base: path.join(workspace, roots.source),
|
|
163
|
+
html: path.join(workspace, roots.source, paths.source.html),
|
|
164
|
+
css: path.join(workspace, roots.source, paths.source.css),
|
|
165
|
+
js: path.join(workspace, roots.source, paths.source.js),
|
|
166
|
+
img: path.join(workspace, roots.source, paths.source.img),
|
|
167
|
+
font: path.join(workspace, roots.source, paths.source.font),
|
|
168
|
+
media: path.join(workspace, roots.source, paths.source.media)
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const targetBase = path.join(workspace, isProd ? roots.target : roots.tmp);
|
|
172
|
+
const dest = {
|
|
173
|
+
base: targetBase,
|
|
174
|
+
html: targetBase,
|
|
175
|
+
css: path.join(targetBase, isProd ? paths.target.css : paths.tmp.css),
|
|
176
|
+
js: path.join(targetBase, isProd ? paths.target.js : paths.tmp.js),
|
|
177
|
+
img: path.join(targetBase, isProd ? paths.target.img : paths.tmp.img),
|
|
178
|
+
font: path.join(targetBase, isProd ? paths.target.font : paths.tmp.font),
|
|
179
|
+
media: path.join(targetBase, isProd ? paths.target.media : paths.tmp.media),
|
|
180
|
+
static: path.join(targetBase, assets.virtualDir, assets.subDir)
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
return {
|
|
184
|
+
workspace,
|
|
185
|
+
workspaces: {
|
|
186
|
+
local: workspace,
|
|
187
|
+
global: path.resolve(workspace, '..')
|
|
188
|
+
},
|
|
189
|
+
alias,
|
|
190
|
+
env,
|
|
191
|
+
inFrontend: true,
|
|
192
|
+
useDefaults: true,
|
|
193
|
+
roots,
|
|
194
|
+
paths,
|
|
195
|
+
styles,
|
|
196
|
+
scripts,
|
|
197
|
+
html,
|
|
198
|
+
assets,
|
|
199
|
+
server,
|
|
200
|
+
pwa,
|
|
201
|
+
ftp,
|
|
202
|
+
images,
|
|
203
|
+
logs: {
|
|
204
|
+
level: 1
|
|
205
|
+
},
|
|
206
|
+
src,
|
|
207
|
+
dest
|
|
208
|
+
};
|
|
209
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { BalmConfig, BalmCustomConfig } from '../types/index.js';
|
|
3
|
+
import { createDefaultConfig } from './defaults.js';
|
|
4
|
+
import { deepMerge } from '../utilities/utils.js';
|
|
5
|
+
import { ASSETS_TYPES } from './constants.js';
|
|
6
|
+
import { setWorkspaces } from '../utilities/workspace.js';
|
|
7
|
+
|
|
8
|
+
export function resolveConfig(
|
|
9
|
+
customConfig: BalmCustomConfig = {},
|
|
10
|
+
defaultWorkspace = process.cwd()
|
|
11
|
+
): BalmConfig {
|
|
12
|
+
let localWorkspace = defaultWorkspace;
|
|
13
|
+
let globalWorkspace = path.resolve(defaultWorkspace, '..');
|
|
14
|
+
|
|
15
|
+
if (customConfig.workspace) {
|
|
16
|
+
if (typeof customConfig.workspace === 'string') {
|
|
17
|
+
localWorkspace = path.resolve(customConfig.workspace);
|
|
18
|
+
globalWorkspace = path.resolve(localWorkspace, '..');
|
|
19
|
+
} else if (typeof customConfig.workspace === 'object') {
|
|
20
|
+
localWorkspace = path.resolve(customConfig.workspace.local || defaultWorkspace);
|
|
21
|
+
globalWorkspace = path.resolve(
|
|
22
|
+
customConfig.workspace.global || path.resolve(localWorkspace, '..')
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
setWorkspaces(localWorkspace, globalWorkspace);
|
|
28
|
+
|
|
29
|
+
const defaultConfig = createDefaultConfig(localWorkspace);
|
|
30
|
+
const config = deepMerge(defaultConfig, customConfig) as BalmConfig;
|
|
31
|
+
|
|
32
|
+
// Set normalized workspace path
|
|
33
|
+
config.workspace = localWorkspace;
|
|
34
|
+
config.workspaces = {
|
|
35
|
+
local: localWorkspace,
|
|
36
|
+
global: globalWorkspace
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// Update src quick directories
|
|
40
|
+
config.src = {
|
|
41
|
+
base: path.join(config.workspace, config.roots.source),
|
|
42
|
+
html: path.join(config.workspace, config.roots.source, config.paths.source.html),
|
|
43
|
+
css: path.join(config.workspace, config.roots.source, config.paths.source.css),
|
|
44
|
+
js: path.join(config.workspace, config.roots.source, config.paths.source.js),
|
|
45
|
+
img: path.join(config.workspace, config.roots.source, config.paths.source.img),
|
|
46
|
+
font: path.join(config.workspace, config.roots.source, config.paths.source.font),
|
|
47
|
+
media: path.join(config.workspace, config.roots.source, config.paths.source.media)
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// Update dest quick directories
|
|
51
|
+
const targetBase = path.join(
|
|
52
|
+
config.workspace,
|
|
53
|
+
config.env.isProd || !config.inFrontend ? config.roots.target : config.roots.tmp
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const isProd = config.env.isProd || !config.inFrontend;
|
|
57
|
+
const pathMap = isProd ? config.paths.target : config.paths.tmp;
|
|
58
|
+
|
|
59
|
+
const destStatic = path.join(
|
|
60
|
+
targetBase,
|
|
61
|
+
config.assets.virtualDir,
|
|
62
|
+
config.assets.subDir
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
config.dest = {
|
|
66
|
+
base: targetBase,
|
|
67
|
+
html: targetBase,
|
|
68
|
+
css: path.join(targetBase, pathMap.css),
|
|
69
|
+
js: path.join(targetBase, pathMap.js),
|
|
70
|
+
img: path.join(targetBase, pathMap.img),
|
|
71
|
+
font: path.join(targetBase, pathMap.font),
|
|
72
|
+
media: path.join(targetBase, pathMap.media),
|
|
73
|
+
static: destStatic
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// Set assets.static
|
|
77
|
+
config.assets.static = path.join(
|
|
78
|
+
config.assets.root,
|
|
79
|
+
config.assets.mainDir,
|
|
80
|
+
config.assets.subDir
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
for (const assetType of ASSETS_TYPES) {
|
|
84
|
+
(config.assets as any)[assetType] = path.join(
|
|
85
|
+
config.assets.static,
|
|
86
|
+
(config.paths.target as any)[assetType]
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Set HMR flag
|
|
91
|
+
const hmrEnv =
|
|
92
|
+
config.useDefaults &&
|
|
93
|
+
config.env.isDev &&
|
|
94
|
+
!config.env.inSSR &&
|
|
95
|
+
!config.env.isMP;
|
|
96
|
+
const hmrEnabling = config.scripts.bundler === 'webpack';
|
|
97
|
+
config.server.useHMR = hmrEnv && hmrEnabling;
|
|
98
|
+
|
|
99
|
+
// Set desktop app
|
|
100
|
+
if (/^electron-.*/.test(config.scripts.target as string)) {
|
|
101
|
+
config.env.inDesktopApp = true;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Set use cache for webpack
|
|
105
|
+
config.scripts.useCache =
|
|
106
|
+
config.env.isProd && config.assets.cache && config.scripts.injectHtml;
|
|
107
|
+
|
|
108
|
+
return config;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export * from './constants.js';
|
|
112
|
+
export * from './defaults.js';
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CopyTask,
|
|
3
|
+
RemoveTask,
|
|
4
|
+
ReplaceTask,
|
|
5
|
+
PublishTask,
|
|
6
|
+
PwaTask,
|
|
7
|
+
ZipTask,
|
|
8
|
+
FtpTask,
|
|
9
|
+
ServerTask
|
|
10
|
+
} from '../tasks/index.js';
|
|
11
|
+
import { FunctionTask } from '../runner/task.js';
|
|
12
|
+
import { Pipeline } from '../pipeline/pipeline.js';
|
|
13
|
+
import { transformSass } from '../pipeline/transforms/sass.js';
|
|
14
|
+
import { transformLess } from '../pipeline/transforms/less.js';
|
|
15
|
+
import { transformPostcss } from '../pipeline/transforms/postcss.js';
|
|
16
|
+
import { runWebpack } from '../bundler/webpack.js';
|
|
17
|
+
import { runRollup } from '../bundler/rollup.js';
|
|
18
|
+
import { runEsbuild } from '../bundler/esbuild.js';
|
|
19
|
+
import { TaskDAG } from '../runner/dag.js';
|
|
20
|
+
import {
|
|
21
|
+
RenameOptions,
|
|
22
|
+
ReplaceOptions,
|
|
23
|
+
TemplateOption,
|
|
24
|
+
BalmConfig
|
|
25
|
+
} from '../types/index.js';
|
|
26
|
+
import { logger } from '../utilities/logger.js';
|
|
27
|
+
|
|
28
|
+
export class BalmHooks {
|
|
29
|
+
private dag: TaskDAG;
|
|
30
|
+
private recipeIndex = 0;
|
|
31
|
+
|
|
32
|
+
constructor(dag: TaskDAG) {
|
|
33
|
+
this.dag = dag;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
private addRecipeTask(fn: (config: BalmConfig) => Promise<void> | void): void {
|
|
37
|
+
this.recipeIndex++;
|
|
38
|
+
const taskName = `recipe:${this.recipeIndex}`;
|
|
39
|
+
this.dag.registerTask(new FunctionTask(taskName, fn));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
copy(
|
|
43
|
+
input: string | string[],
|
|
44
|
+
output: string,
|
|
45
|
+
options: { rename?: RenameOptions | string | Function } = {}
|
|
46
|
+
): this {
|
|
47
|
+
this.addRecipeTask(async (config) => {
|
|
48
|
+
const task = new CopyTask({ input, output, rename: options.rename });
|
|
49
|
+
await task.run(config);
|
|
50
|
+
});
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
remove(target: string | string[]): this {
|
|
55
|
+
this.addRecipeTask(async (config) => {
|
|
56
|
+
const task = new RemoveTask(target);
|
|
57
|
+
await task.run(config);
|
|
58
|
+
});
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
replace(
|
|
63
|
+
input: string | string[],
|
|
64
|
+
output: string,
|
|
65
|
+
options: ReplaceOptions | ReplaceOptions[]
|
|
66
|
+
): this {
|
|
67
|
+
this.addRecipeTask(async (config) => {
|
|
68
|
+
const task = new ReplaceTask({ input, output, options });
|
|
69
|
+
await task.run(config);
|
|
70
|
+
});
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
sass(input: string | string[], output: string, options = {}): this {
|
|
75
|
+
this.addRecipeTask(async (config) => {
|
|
76
|
+
const pipeline = Pipeline.from(input, { cwd: config.workspace });
|
|
77
|
+
pipeline.pipe(transformSass(options));
|
|
78
|
+
pipeline.pipe(transformPostcss({ minify: config.env.isProd }));
|
|
79
|
+
await pipeline.dest(output);
|
|
80
|
+
});
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
less(input: string | string[], output: string, options = {}): this {
|
|
85
|
+
this.addRecipeTask(async (config) => {
|
|
86
|
+
const pipeline = Pipeline.from(input, { cwd: config.workspace });
|
|
87
|
+
pipeline.pipe(transformLess(options));
|
|
88
|
+
pipeline.pipe(transformPostcss({ minify: config.env.isProd }));
|
|
89
|
+
await pipeline.dest(output);
|
|
90
|
+
});
|
|
91
|
+
return this;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
css(input: string | string[], output: string, options = {}): this {
|
|
95
|
+
this.addRecipeTask(async (config) => {
|
|
96
|
+
const pipeline = Pipeline.from(input, { cwd: config.workspace });
|
|
97
|
+
pipeline.pipe(transformPostcss({ minify: config.env.isProd, ...options }));
|
|
98
|
+
await pipeline.dest(output);
|
|
99
|
+
});
|
|
100
|
+
return this;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
webpack(entry?: any, output?: string, customOptions = {}): this {
|
|
104
|
+
this.addRecipeTask(async (config) => {
|
|
105
|
+
await runWebpack(config, {
|
|
106
|
+
...(entry ? { entry } : {}),
|
|
107
|
+
...(output ? { output: { path: output } } : {}),
|
|
108
|
+
...customOptions
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
return this;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
rollup(input?: any, output?: any, customInputOptions = {}, customOutputOptions = {}): this {
|
|
115
|
+
this.addRecipeTask(async (config) => {
|
|
116
|
+
await runRollup(
|
|
117
|
+
config,
|
|
118
|
+
{ ...(input ? { input } : {}), ...customInputOptions },
|
|
119
|
+
{ ...(output ? { dir: output } : {}), ...customOutputOptions }
|
|
120
|
+
);
|
|
121
|
+
});
|
|
122
|
+
return this;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
esbuild(entryPoints?: any, outdir?: string, customOptions = {}): this {
|
|
126
|
+
this.addRecipeTask(async (config) => {
|
|
127
|
+
await runEsbuild(config, {
|
|
128
|
+
...(entryPoints ? { entryPoints } : {}),
|
|
129
|
+
...(outdir ? { outdir } : {}),
|
|
130
|
+
...customOptions
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
return this;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
js(input?: any, output?: any, options = {}): this {
|
|
137
|
+
logger.warn('balm api', '`mix.js` is deprecated, please use `mix.webpack`/`mix.rollup`/`mix.esbuild` instead.');
|
|
138
|
+
return this.webpack(input, output, options);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
publish(
|
|
142
|
+
input?: string | TemplateOption[],
|
|
143
|
+
output?: string,
|
|
144
|
+
renameOptions?: string | Function | RenameOptions
|
|
145
|
+
): this {
|
|
146
|
+
this.addRecipeTask(async (config) => {
|
|
147
|
+
const task = new PublishTask({ input, output, renameOptions });
|
|
148
|
+
await task.run(config);
|
|
149
|
+
});
|
|
150
|
+
return this;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
generateSW(options = {}): this {
|
|
154
|
+
this.addRecipeTask(async (config) => {
|
|
155
|
+
const task = new PwaTask({ mode: 'generateSW', options });
|
|
156
|
+
await task.run(config);
|
|
157
|
+
});
|
|
158
|
+
return this;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
injectManifest(options = {}): this {
|
|
162
|
+
this.addRecipeTask(async (config) => {
|
|
163
|
+
const task = new PwaTask({ mode: 'injectManifest', options });
|
|
164
|
+
await task.run(config);
|
|
165
|
+
});
|
|
166
|
+
return this;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
ftp(localFiles?: string | string[], options = {}): this {
|
|
170
|
+
this.addRecipeTask(async (config) => {
|
|
171
|
+
const task = new FtpTask({ localFiles, options });
|
|
172
|
+
await task.run(config);
|
|
173
|
+
});
|
|
174
|
+
return this;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
zip(input?: string | string[], output?: string, filename?: string): this {
|
|
178
|
+
this.addRecipeTask(async (config) => {
|
|
179
|
+
const task = new ZipTask({ input, output, filename });
|
|
180
|
+
await task.run(config);
|
|
181
|
+
});
|
|
182
|
+
return this;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
serve(): this {
|
|
186
|
+
this.addRecipeTask(async (config) => {
|
|
187
|
+
const task = new ServerTask();
|
|
188
|
+
await task.run(config);
|
|
189
|
+
});
|
|
190
|
+
return this;
|
|
191
|
+
}
|
|
192
|
+
}
|