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/dist/index.d.cts
ADDED
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
import { AcceptedPlugin } from 'postcss';
|
|
2
|
+
import { MinifyOptions } from 'terser';
|
|
3
|
+
import webpack, { Configuration } from 'webpack';
|
|
4
|
+
import { RollupOptions, OutputOptions } from 'rollup';
|
|
5
|
+
import * as esbuild from 'esbuild';
|
|
6
|
+
import fg from 'fast-glob';
|
|
7
|
+
|
|
8
|
+
type LooseObject = Record<string, any>;
|
|
9
|
+
type DeepPartial<T> = {
|
|
10
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
11
|
+
};
|
|
12
|
+
type BalmEntry = string | string[] | Record<string, string | string[]>;
|
|
13
|
+
interface BalmRoots {
|
|
14
|
+
source: string;
|
|
15
|
+
tmp: string;
|
|
16
|
+
target: string;
|
|
17
|
+
}
|
|
18
|
+
interface BalmPathMap {
|
|
19
|
+
base: string;
|
|
20
|
+
html: string;
|
|
21
|
+
css: string;
|
|
22
|
+
js: string;
|
|
23
|
+
img: string;
|
|
24
|
+
font: string;
|
|
25
|
+
media: string;
|
|
26
|
+
}
|
|
27
|
+
interface BalmPaths {
|
|
28
|
+
source: BalmPathMap;
|
|
29
|
+
tmp: Omit<BalmPathMap, 'html'>;
|
|
30
|
+
target: Omit<BalmPathMap, 'html'>;
|
|
31
|
+
}
|
|
32
|
+
interface BalmStyles {
|
|
33
|
+
extname: string;
|
|
34
|
+
minify: boolean;
|
|
35
|
+
atImportPaths: string[];
|
|
36
|
+
alias: Record<string, string>;
|
|
37
|
+
options: Record<string, any>;
|
|
38
|
+
sassOptions: Record<string, any>;
|
|
39
|
+
lessOptions: Record<string, any>;
|
|
40
|
+
postcssLoaderOptions: Record<string, any>;
|
|
41
|
+
postcssPlugins: any[];
|
|
42
|
+
sprites: string[];
|
|
43
|
+
spriteOptions: Record<string, any>;
|
|
44
|
+
}
|
|
45
|
+
declare enum BundlerType {
|
|
46
|
+
webpack = "webpack",
|
|
47
|
+
rollup = "rollup",
|
|
48
|
+
esbuild = "esbuild"
|
|
49
|
+
}
|
|
50
|
+
interface BalmScripts {
|
|
51
|
+
bundler: BundlerType | 'webpack' | 'rollup' | 'esbuild';
|
|
52
|
+
minify: boolean;
|
|
53
|
+
minifyOptions: Record<string, any>;
|
|
54
|
+
entry: BalmEntry;
|
|
55
|
+
target: string | string[];
|
|
56
|
+
library: string | Record<string, any>;
|
|
57
|
+
libraryTarget: string;
|
|
58
|
+
externals: string | string[] | Record<string, any> | RegExp | Function;
|
|
59
|
+
injectHtml: boolean;
|
|
60
|
+
htmlName: string;
|
|
61
|
+
alias: Record<string, string>;
|
|
62
|
+
plugins: any[];
|
|
63
|
+
loaders: any[];
|
|
64
|
+
defaultLoaders: {
|
|
65
|
+
html?: boolean;
|
|
66
|
+
css?: boolean;
|
|
67
|
+
js?: boolean;
|
|
68
|
+
url?: boolean;
|
|
69
|
+
};
|
|
70
|
+
options: Record<string, any>;
|
|
71
|
+
esbuildOptions: Record<string, any>;
|
|
72
|
+
rollupOptions: Record<string, any>;
|
|
73
|
+
webpackOptions: Record<string, any>;
|
|
74
|
+
useCache: boolean;
|
|
75
|
+
}
|
|
76
|
+
interface BalmHtml {
|
|
77
|
+
options: Record<string, any>;
|
|
78
|
+
}
|
|
79
|
+
interface BalmAssets {
|
|
80
|
+
root: string;
|
|
81
|
+
mainDir: string;
|
|
82
|
+
subDir: string;
|
|
83
|
+
buildDir: string;
|
|
84
|
+
virtualDir: string;
|
|
85
|
+
cache: boolean;
|
|
86
|
+
options: {
|
|
87
|
+
fileNameManifest?: string;
|
|
88
|
+
dontRenameFile?: (string | RegExp)[];
|
|
89
|
+
dontUpdateReference?: (string | RegExp)[];
|
|
90
|
+
hashLength?: number;
|
|
91
|
+
[key: string]: any;
|
|
92
|
+
};
|
|
93
|
+
includes: string[];
|
|
94
|
+
excludes: string[];
|
|
95
|
+
static?: string;
|
|
96
|
+
[key: string]: any;
|
|
97
|
+
}
|
|
98
|
+
interface BalmServer {
|
|
99
|
+
host: string | null;
|
|
100
|
+
port: number;
|
|
101
|
+
open: boolean | string;
|
|
102
|
+
proxy: boolean | Record<string, any> | Array<Record<string, any>>;
|
|
103
|
+
proxyOptions: boolean | Record<string, any> | Array<Record<string, any>>;
|
|
104
|
+
historyOptions: boolean | Record<string, any>;
|
|
105
|
+
useHMR: boolean;
|
|
106
|
+
options: Record<string, any>;
|
|
107
|
+
}
|
|
108
|
+
interface BalmPwa {
|
|
109
|
+
enabled: boolean;
|
|
110
|
+
mode: 'generateSW' | 'injectManifest';
|
|
111
|
+
version: string;
|
|
112
|
+
manifest: string;
|
|
113
|
+
swSrcFilename: string;
|
|
114
|
+
swDestFilename: string;
|
|
115
|
+
options: Record<string, any>;
|
|
116
|
+
}
|
|
117
|
+
interface BalmFtp {
|
|
118
|
+
options: Record<string, any>;
|
|
119
|
+
watchFiles: string[];
|
|
120
|
+
}
|
|
121
|
+
interface BalmImages {
|
|
122
|
+
plugins: any[];
|
|
123
|
+
}
|
|
124
|
+
interface BalmEnv {
|
|
125
|
+
isProd: boolean;
|
|
126
|
+
isDev: boolean;
|
|
127
|
+
isTest: boolean;
|
|
128
|
+
inFrontend: boolean;
|
|
129
|
+
inSSR: boolean;
|
|
130
|
+
inDesktopApp: boolean;
|
|
131
|
+
isMP: boolean;
|
|
132
|
+
}
|
|
133
|
+
interface BalmWorkspaces {
|
|
134
|
+
local: string;
|
|
135
|
+
global: string;
|
|
136
|
+
}
|
|
137
|
+
type BalmWorkspaceConfig = string | {
|
|
138
|
+
local?: string;
|
|
139
|
+
global?: string;
|
|
140
|
+
};
|
|
141
|
+
interface BalmConfig {
|
|
142
|
+
workspace: string;
|
|
143
|
+
workspaces: BalmWorkspaces;
|
|
144
|
+
alias: Record<string, string>;
|
|
145
|
+
env: BalmEnv;
|
|
146
|
+
inFrontend: boolean;
|
|
147
|
+
useDefaults: boolean;
|
|
148
|
+
roots: BalmRoots;
|
|
149
|
+
paths: BalmPaths;
|
|
150
|
+
styles: BalmStyles;
|
|
151
|
+
scripts: BalmScripts;
|
|
152
|
+
html: BalmHtml;
|
|
153
|
+
assets: BalmAssets;
|
|
154
|
+
server: BalmServer;
|
|
155
|
+
pwa: BalmPwa;
|
|
156
|
+
ftp: BalmFtp;
|
|
157
|
+
images: BalmImages;
|
|
158
|
+
logs: {
|
|
159
|
+
level: number;
|
|
160
|
+
};
|
|
161
|
+
src: BalmPathMap;
|
|
162
|
+
dest: BalmPathMap & {
|
|
163
|
+
static: string;
|
|
164
|
+
};
|
|
165
|
+
[key: string]: any;
|
|
166
|
+
}
|
|
167
|
+
type BalmCustomConfig = Omit<DeepPartial<BalmConfig>, 'workspace'> & {
|
|
168
|
+
workspace?: BalmWorkspaceConfig;
|
|
169
|
+
};
|
|
170
|
+
interface RenameOptions {
|
|
171
|
+
dirname?: string;
|
|
172
|
+
prefix?: string;
|
|
173
|
+
basename?: string;
|
|
174
|
+
suffix?: string;
|
|
175
|
+
extname?: string;
|
|
176
|
+
}
|
|
177
|
+
interface ReplaceOptions {
|
|
178
|
+
substr: string | RegExp;
|
|
179
|
+
replacement: string | ((substring: string, ...args: any[]) => string);
|
|
180
|
+
}
|
|
181
|
+
interface TemplateOption {
|
|
182
|
+
input: string;
|
|
183
|
+
output: string;
|
|
184
|
+
renameOptions?: string | Function | RenameOptions;
|
|
185
|
+
}
|
|
186
|
+
interface TaskContext {
|
|
187
|
+
config: BalmConfig;
|
|
188
|
+
}
|
|
189
|
+
type TaskFn = (context: TaskContext) => Promise<any> | any;
|
|
190
|
+
|
|
191
|
+
interface TaskOptions {
|
|
192
|
+
name: string;
|
|
193
|
+
deps?: string[];
|
|
194
|
+
description?: string;
|
|
195
|
+
hidden?: boolean;
|
|
196
|
+
}
|
|
197
|
+
declare abstract class BaseTask {
|
|
198
|
+
name: string;
|
|
199
|
+
deps: string[];
|
|
200
|
+
description?: string;
|
|
201
|
+
hidden: boolean;
|
|
202
|
+
constructor(options: TaskOptions);
|
|
203
|
+
abstract run(config: BalmConfig): Promise<void> | void;
|
|
204
|
+
}
|
|
205
|
+
declare class FunctionTask extends BaseTask {
|
|
206
|
+
private fn;
|
|
207
|
+
constructor(name: string, fn: (config: BalmConfig) => Promise<void> | void, deps?: string[]);
|
|
208
|
+
run(config: BalmConfig): Promise<void>;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
declare class TaskDAG {
|
|
212
|
+
private tasks;
|
|
213
|
+
registerTask(task: BaseTask): void;
|
|
214
|
+
getTask(name: string): BaseTask | undefined;
|
|
215
|
+
hasTask(name: string): boolean;
|
|
216
|
+
clear(): void;
|
|
217
|
+
/**
|
|
218
|
+
* Run a list of tasks in strict series
|
|
219
|
+
*/
|
|
220
|
+
runSeries(taskNames: string[], config: BalmConfig): Promise<void>;
|
|
221
|
+
/**
|
|
222
|
+
* Run a list of tasks in parallel
|
|
223
|
+
*/
|
|
224
|
+
runParallel(taskNames: string[], config: BalmConfig): Promise<void>;
|
|
225
|
+
/**
|
|
226
|
+
* Execute a single task resolving its dependencies first
|
|
227
|
+
*/
|
|
228
|
+
executeTask(taskName: string, config: BalmConfig, executed?: Set<string>): Promise<void>;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
declare class BalmHooks {
|
|
232
|
+
private dag;
|
|
233
|
+
private recipeIndex;
|
|
234
|
+
constructor(dag: TaskDAG);
|
|
235
|
+
private addRecipeTask;
|
|
236
|
+
copy(input: string | string[], output: string, options?: {
|
|
237
|
+
rename?: RenameOptions | string | Function;
|
|
238
|
+
}): this;
|
|
239
|
+
remove(target: string | string[]): this;
|
|
240
|
+
replace(input: string | string[], output: string, options: ReplaceOptions | ReplaceOptions[]): this;
|
|
241
|
+
sass(input: string | string[], output: string, options?: {}): this;
|
|
242
|
+
less(input: string | string[], output: string, options?: {}): this;
|
|
243
|
+
css(input: string | string[], output: string, options?: {}): this;
|
|
244
|
+
webpack(entry?: any, output?: string, customOptions?: {}): this;
|
|
245
|
+
rollup(input?: any, output?: any, customInputOptions?: {}, customOutputOptions?: {}): this;
|
|
246
|
+
esbuild(entryPoints?: any, outdir?: string, customOptions?: {}): this;
|
|
247
|
+
js(input?: any, output?: any, options?: {}): this;
|
|
248
|
+
publish(input?: string | TemplateOption[], output?: string, renameOptions?: string | Function | RenameOptions): this;
|
|
249
|
+
generateSW(options?: {}): this;
|
|
250
|
+
injectManifest(options?: {}): this;
|
|
251
|
+
ftp(localFiles?: string | string[], options?: {}): this;
|
|
252
|
+
zip(input?: string | string[], output?: string, filename?: string): this;
|
|
253
|
+
serve(): this;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
declare class Balm {
|
|
257
|
+
private _config;
|
|
258
|
+
private dag;
|
|
259
|
+
beforeTask?: () => Promise<void> | void;
|
|
260
|
+
afterTask?: () => Promise<void> | void;
|
|
261
|
+
readonly Bundler: typeof BundlerType;
|
|
262
|
+
constructor();
|
|
263
|
+
get config(): BalmConfig;
|
|
264
|
+
set config(customConfig: BalmCustomConfig);
|
|
265
|
+
go(recipe?: (mix: BalmHooks) => void): Promise<void>;
|
|
266
|
+
reset(): void;
|
|
267
|
+
}
|
|
268
|
+
declare const balm: Balm;
|
|
269
|
+
|
|
270
|
+
declare const ASSETS_TYPES: string[];
|
|
271
|
+
declare const PUBLIC_URL = "%PUBLIC_URL%";
|
|
272
|
+
declare const CHUNK: {
|
|
273
|
+
dir: string;
|
|
274
|
+
};
|
|
275
|
+
declare const ASSET: {
|
|
276
|
+
dir: string;
|
|
277
|
+
};
|
|
278
|
+
declare const ASSET_EXT: {
|
|
279
|
+
styles: string[];
|
|
280
|
+
scripts: string[];
|
|
281
|
+
images: string[];
|
|
282
|
+
fonts: string[];
|
|
283
|
+
media: string[];
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
declare function createDefaultConfig(workspace?: string): BalmConfig;
|
|
287
|
+
|
|
288
|
+
declare function resolveConfig(customConfig?: BalmCustomConfig, defaultWorkspace?: string): BalmConfig;
|
|
289
|
+
|
|
290
|
+
interface VirtualFileOptions {
|
|
291
|
+
cwd: string;
|
|
292
|
+
base: string;
|
|
293
|
+
path: string;
|
|
294
|
+
contents: Buffer | string;
|
|
295
|
+
}
|
|
296
|
+
declare class VirtualFile {
|
|
297
|
+
cwd: string;
|
|
298
|
+
base: string;
|
|
299
|
+
path: string;
|
|
300
|
+
contents: Buffer;
|
|
301
|
+
revPathOriginal?: string;
|
|
302
|
+
constructor(options: VirtualFileOptions);
|
|
303
|
+
get relative(): string;
|
|
304
|
+
get extname(): string;
|
|
305
|
+
set extname(val: string);
|
|
306
|
+
get basename(): string;
|
|
307
|
+
set basename(val: string);
|
|
308
|
+
get stem(): string;
|
|
309
|
+
set stem(val: string);
|
|
310
|
+
toString(encoding?: BufferEncoding): string;
|
|
311
|
+
clone(): VirtualFile;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
type TransformFn = (file: VirtualFile) => Promise<VirtualFile | VirtualFile[] | null | void> | VirtualFile | VirtualFile[] | null | void;
|
|
315
|
+
interface PipelineOptions {
|
|
316
|
+
cwd?: string;
|
|
317
|
+
base?: string;
|
|
318
|
+
allowEmpty?: boolean;
|
|
319
|
+
}
|
|
320
|
+
declare class Pipeline {
|
|
321
|
+
private cwd;
|
|
322
|
+
private base?;
|
|
323
|
+
private allowEmpty;
|
|
324
|
+
private files;
|
|
325
|
+
private transforms;
|
|
326
|
+
constructor(options?: PipelineOptions);
|
|
327
|
+
static from(patterns: string | string[], options?: PipelineOptions): Pipeline;
|
|
328
|
+
src(patterns: string | string[], options?: PipelineOptions): this;
|
|
329
|
+
pipe(transform: TransformFn): this;
|
|
330
|
+
process(): Promise<VirtualFile[]>;
|
|
331
|
+
dest(outDir: string): Promise<string[]>;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
interface SassTransformOptions {
|
|
335
|
+
includePaths?: string[];
|
|
336
|
+
alias?: Record<string, string>;
|
|
337
|
+
style?: 'expanded' | 'compressed';
|
|
338
|
+
sourceMap?: boolean;
|
|
339
|
+
[key: string]: any;
|
|
340
|
+
}
|
|
341
|
+
declare function transformSass(options?: SassTransformOptions): TransformFn;
|
|
342
|
+
|
|
343
|
+
interface LessTransformOptions {
|
|
344
|
+
paths?: string[];
|
|
345
|
+
alias?: Record<string, string>;
|
|
346
|
+
[key: string]: any;
|
|
347
|
+
}
|
|
348
|
+
declare function transformLess(options?: LessTransformOptions): TransformFn;
|
|
349
|
+
|
|
350
|
+
interface PostcssTransformOptions {
|
|
351
|
+
plugins?: AcceptedPlugin[];
|
|
352
|
+
minify?: boolean;
|
|
353
|
+
[key: string]: any;
|
|
354
|
+
}
|
|
355
|
+
declare function transformPostcss(options?: PostcssTransformOptions): TransformFn;
|
|
356
|
+
|
|
357
|
+
declare function transformHtmlmin(options?: Record<string, any>): TransformFn;
|
|
358
|
+
|
|
359
|
+
declare function transformTerser(options?: MinifyOptions): TransformFn;
|
|
360
|
+
|
|
361
|
+
declare function transformReplace(options: ReplaceOptions | ReplaceOptions[] | string | RegExp, replacement?: string | ((substring: string, ...args: any[]) => string)): TransformFn;
|
|
362
|
+
|
|
363
|
+
declare function transformRename(options?: string | Function | RenameOptions): TransformFn;
|
|
364
|
+
|
|
365
|
+
interface CacheTransformOptions {
|
|
366
|
+
fileNameManifest?: string;
|
|
367
|
+
dontRenameFile?: (string | RegExp)[];
|
|
368
|
+
dontUpdateReference?: (string | RegExp)[];
|
|
369
|
+
hashLength?: number;
|
|
370
|
+
[key: string]: any;
|
|
371
|
+
}
|
|
372
|
+
declare class AssetRevisioner {
|
|
373
|
+
private options;
|
|
374
|
+
private manifest;
|
|
375
|
+
constructor(options?: CacheTransformOptions);
|
|
376
|
+
process(files: VirtualFile[]): VirtualFile[];
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
declare function runWebpack(config: BalmConfig, customOptions?: Configuration): Promise<webpack.Stats | undefined>;
|
|
380
|
+
|
|
381
|
+
declare function runRollup(config: BalmConfig, customInputOptions?: RollupOptions, customOutputOptions?: OutputOptions): Promise<void>;
|
|
382
|
+
|
|
383
|
+
declare function runEsbuild(config: BalmConfig, customOptions?: esbuild.BuildOptions): Promise<esbuild.BuildResult>;
|
|
384
|
+
|
|
385
|
+
declare class CleanTask extends BaseTask {
|
|
386
|
+
constructor();
|
|
387
|
+
run(config: BalmConfig): Promise<void>;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
declare class StyleTask extends BaseTask {
|
|
391
|
+
constructor();
|
|
392
|
+
run(config: BalmConfig): Promise<void>;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
declare class ScriptTask extends BaseTask {
|
|
396
|
+
constructor();
|
|
397
|
+
run(config: BalmConfig): Promise<void>;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
declare class HtmlTask extends BaseTask {
|
|
401
|
+
constructor();
|
|
402
|
+
run(config: BalmConfig): Promise<void>;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
interface CopyTaskOptions {
|
|
406
|
+
input: string | string[];
|
|
407
|
+
output: string;
|
|
408
|
+
rename?: RenameOptions | string | Function;
|
|
409
|
+
}
|
|
410
|
+
declare class CopyTask extends BaseTask {
|
|
411
|
+
private options;
|
|
412
|
+
constructor(options: CopyTaskOptions);
|
|
413
|
+
run(config: BalmConfig): Promise<void>;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
declare class RemoveTask extends BaseTask {
|
|
417
|
+
private target;
|
|
418
|
+
constructor(target: string | string[]);
|
|
419
|
+
run(config: BalmConfig): Promise<void>;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
interface ReplaceTaskOptions {
|
|
423
|
+
input: string | string[];
|
|
424
|
+
output: string;
|
|
425
|
+
options: ReplaceOptions | ReplaceOptions[];
|
|
426
|
+
}
|
|
427
|
+
declare class ReplaceTask extends BaseTask {
|
|
428
|
+
private taskOptions;
|
|
429
|
+
constructor(taskOptions: ReplaceTaskOptions);
|
|
430
|
+
run(config: BalmConfig): Promise<void>;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
declare class CacheTask extends BaseTask {
|
|
434
|
+
constructor();
|
|
435
|
+
run(config: BalmConfig): Promise<void>;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
interface PublishTaskOptions {
|
|
439
|
+
input?: string | TemplateOption[];
|
|
440
|
+
output?: string;
|
|
441
|
+
renameOptions?: string | Function | RenameOptions;
|
|
442
|
+
}
|
|
443
|
+
declare class PublishTask extends BaseTask {
|
|
444
|
+
private options;
|
|
445
|
+
constructor(options?: PublishTaskOptions);
|
|
446
|
+
run(config: BalmConfig): Promise<void>;
|
|
447
|
+
private publishItem;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
interface PwaTaskOptions {
|
|
451
|
+
mode?: 'generateSW' | 'injectManifest';
|
|
452
|
+
options?: Record<string, any>;
|
|
453
|
+
}
|
|
454
|
+
declare class PwaTask extends BaseTask {
|
|
455
|
+
private options;
|
|
456
|
+
constructor(options?: PwaTaskOptions);
|
|
457
|
+
run(config: BalmConfig): Promise<void>;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
interface ZipTaskOptions {
|
|
461
|
+
input?: string | string[];
|
|
462
|
+
output?: string;
|
|
463
|
+
filename?: string;
|
|
464
|
+
}
|
|
465
|
+
declare class ZipTask extends BaseTask {
|
|
466
|
+
private options;
|
|
467
|
+
constructor(options?: ZipTaskOptions);
|
|
468
|
+
run(config: BalmConfig): Promise<void>;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
interface FtpTaskOptions {
|
|
472
|
+
localFiles?: string | string[];
|
|
473
|
+
options?: {
|
|
474
|
+
host?: string;
|
|
475
|
+
port?: number;
|
|
476
|
+
username?: string;
|
|
477
|
+
password?: string;
|
|
478
|
+
privateKey?: string;
|
|
479
|
+
remotePath?: string;
|
|
480
|
+
[key: string]: any;
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
declare class FtpTask extends BaseTask {
|
|
484
|
+
private ftpOptions;
|
|
485
|
+
constructor(ftpOptions?: FtpTaskOptions);
|
|
486
|
+
run(config: BalmConfig): Promise<void>;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
declare class ServerTask extends BaseTask {
|
|
490
|
+
private watcher;
|
|
491
|
+
private wsServer;
|
|
492
|
+
private clients;
|
|
493
|
+
constructor();
|
|
494
|
+
broadcast(data: {
|
|
495
|
+
type: 'reload' | 'reload-css';
|
|
496
|
+
file?: string;
|
|
497
|
+
}): void;
|
|
498
|
+
run(config: BalmConfig): Promise<void>;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
declare enum LogLevel {
|
|
502
|
+
Debug = 0,
|
|
503
|
+
Info = 1,
|
|
504
|
+
Warn = 2,
|
|
505
|
+
Error = 3,
|
|
506
|
+
Silent = 4
|
|
507
|
+
}
|
|
508
|
+
declare class Logger {
|
|
509
|
+
level: LogLevel;
|
|
510
|
+
private formatTag;
|
|
511
|
+
private timestamp;
|
|
512
|
+
debug(tag: string, message: any, ...args: any[]): void;
|
|
513
|
+
info(tag: string, message: any, ...args: any[]): void;
|
|
514
|
+
success(tag: string, message: any, ...args: any[]): void;
|
|
515
|
+
warn(tag: string, message: any, ...args: any[]): void;
|
|
516
|
+
error(tag: string, message: any, ...args: any[]): void;
|
|
517
|
+
time(label: string): () => void;
|
|
518
|
+
}
|
|
519
|
+
declare const logger: Logger;
|
|
520
|
+
|
|
521
|
+
declare class FileSystem {
|
|
522
|
+
workspace: string;
|
|
523
|
+
resolveApp(...paths: string[]): string;
|
|
524
|
+
absPath(filePath: string): string;
|
|
525
|
+
absPaths(filePaths: string | string[]): string | string[];
|
|
526
|
+
exists(targetPath: string): Promise<boolean>;
|
|
527
|
+
existsSync(targetPath: string): boolean;
|
|
528
|
+
ensureDir(dirPath: string): Promise<void>;
|
|
529
|
+
readFile(filePath: string, encoding?: BufferEncoding): Promise<string>;
|
|
530
|
+
readBuffer(filePath: string): Promise<Buffer>;
|
|
531
|
+
writeFile(filePath: string, data: string | Buffer): Promise<void>;
|
|
532
|
+
remove(targetPath: string | string[]): Promise<string[]>;
|
|
533
|
+
copyFile(src: string, dest: string): Promise<void>;
|
|
534
|
+
copyDir(srcDir: string, destDir: string): Promise<void>;
|
|
535
|
+
matchFiles(patterns: string | string[], options?: fg.Options): Promise<string[]>;
|
|
536
|
+
hash(content: string | Buffer, length?: number): string;
|
|
537
|
+
}
|
|
538
|
+
declare const file: FileSystem;
|
|
539
|
+
|
|
540
|
+
declare function isObject(val: any): val is Record<string, any>;
|
|
541
|
+
declare function isArray(val: any): val is any[];
|
|
542
|
+
declare function isString(val: any): val is string;
|
|
543
|
+
declare function isFunction(val: any): val is Function;
|
|
544
|
+
declare function isBoolean(val: any): val is boolean;
|
|
545
|
+
declare function deepMerge<T extends Record<string, any>>(target: T, ...sources: any[]): T;
|
|
546
|
+
declare function toNamespace(name: string | string[], namespace?: string): string | string[];
|
|
547
|
+
|
|
548
|
+
interface WorkspacePaths {
|
|
549
|
+
local: string;
|
|
550
|
+
global: string;
|
|
551
|
+
}
|
|
552
|
+
declare function setWorkspaces(local?: string, global?: string): void;
|
|
553
|
+
declare function getWorkspaces(): WorkspacePaths;
|
|
554
|
+
declare function localWorkspace(subPath?: string): string;
|
|
555
|
+
declare function globalWorkspace(subPath?: string): string;
|
|
556
|
+
declare const localResolve: typeof localWorkspace;
|
|
557
|
+
declare const globalResolve: typeof globalWorkspace;
|
|
558
|
+
|
|
559
|
+
export { ASSET, ASSETS_TYPES, ASSET_EXT, AssetRevisioner, Balm, type BalmAssets, type BalmConfig, type BalmCustomConfig, type BalmEntry, type BalmEnv, type BalmFtp, BalmHooks, type BalmHtml, type BalmImages, type BalmPathMap, type BalmPaths, type BalmPwa, type BalmRoots, type BalmScripts, type BalmServer, type BalmStyles, type BalmWorkspaceConfig, type BalmWorkspaces, BaseTask, BundlerType, CHUNK, CacheTask, type CacheTransformOptions, CleanTask, CopyTask, type CopyTaskOptions, type DeepPartial, FileSystem, FtpTask, type FtpTaskOptions, FunctionTask, HtmlTask, type LessTransformOptions, LogLevel, type LooseObject, PUBLIC_URL, Pipeline, type PipelineOptions, type PostcssTransformOptions, PublishTask, type PublishTaskOptions, PwaTask, type PwaTaskOptions, RemoveTask, type RenameOptions, type ReplaceOptions, ReplaceTask, type ReplaceTaskOptions, type SassTransformOptions, ScriptTask, ServerTask, StyleTask, type TaskContext, TaskDAG, type TaskFn, type TaskOptions, type TemplateOption, type TransformFn, VirtualFile, type VirtualFileOptions, type WorkspacePaths, ZipTask, type ZipTaskOptions, balm, createDefaultConfig, deepMerge, balm as default, file, getWorkspaces, globalResolve, globalWorkspace, isArray, isBoolean, isFunction, isObject, isString, localResolve, localWorkspace, logger, resolveConfig, runEsbuild, runRollup, runWebpack, setWorkspaces, toNamespace, transformHtmlmin, transformLess, transformPostcss, transformRename, transformReplace, transformSass, transformTerser };
|