balm-core 6.0.0-alpha.2 → 6.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/index.cjs +395 -111
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -3
- package/dist/index.d.ts +21 -3
- package/dist/index.js +381 -97
- package/dist/index.js.map +1 -1
- package/package.json +38 -1
- package/src/balm.ts +0 -107
- package/src/bundler/esbuild.ts +0 -48
- package/src/bundler/index.ts +0 -3
- package/src/bundler/rollup.ts +0 -46
- package/src/bundler/webpack.ts +0 -125
- package/src/config/constants.ts +0 -12
- package/src/config/defaults.ts +0 -212
- package/src/config/index.ts +0 -112
- package/src/hooks/index.ts +0 -224
- package/src/index.ts +0 -16
- package/src/pipeline/file.ts +0 -69
- package/src/pipeline/index.ts +0 -10
- package/src/pipeline/pipeline.ts +0 -135
- package/src/pipeline/transforms/cache.ts +0 -147
- package/src/pipeline/transforms/htmlmin.ts +0 -18
- package/src/pipeline/transforms/less.ts +0 -75
- package/src/pipeline/transforms/postcss.ts +0 -43
- package/src/pipeline/transforms/rename.ts +0 -38
- package/src/pipeline/transforms/replace.ts +0 -30
- package/src/pipeline/transforms/sass.ts +0 -106
- package/src/pipeline/transforms/terser.ts +0 -20
- package/src/runner/dag.ts +0 -77
- package/src/runner/task.ts +0 -38
- package/src/shims.d.ts +0 -5
- package/src/tasks/cache.ts +0 -84
- package/src/tasks/clean.ts +0 -21
- package/src/tasks/copy.ts +0 -36
- package/src/tasks/ftp.ts +0 -90
- package/src/tasks/html.ts +0 -290
- package/src/tasks/index.ts +0 -14
- package/src/tasks/publish.ts +0 -71
- package/src/tasks/pwa.ts +0 -86
- package/src/tasks/remove.ts +0 -24
- package/src/tasks/replace.ts +0 -34
- package/src/tasks/script.ts +0 -28
- package/src/tasks/server.ts +0 -218
- package/src/tasks/static.ts +0 -77
- package/src/tasks/style.ts +0 -57
- package/src/tasks/zip.ts +0 -77
- package/src/types/index.ts +0 -225
- package/src/utilities/file.ts +0 -140
- package/src/utilities/logger.ts +0 -63
- package/src/utilities/utils.ts +0 -46
- package/src/utilities/workspace.ts +0 -38
- package/src/watcher/index.ts +0 -100
- package/tsconfig.json +0 -8
- package/tsup.config.ts +0 -12
package/dist/index.js
CHANGED
|
@@ -83,6 +83,19 @@ function createDefaultConfig(workspace = process.cwd()) {
|
|
|
83
83
|
js: true,
|
|
84
84
|
url: true
|
|
85
85
|
},
|
|
86
|
+
includeJsResource: [],
|
|
87
|
+
excludeUrlResource: [],
|
|
88
|
+
useEsModule: true,
|
|
89
|
+
urlLoaderOptions: {},
|
|
90
|
+
babelLoaderOptions: {},
|
|
91
|
+
htmlLoaderOptions: {},
|
|
92
|
+
postcssLoaderOptions: {},
|
|
93
|
+
sourceMap: false,
|
|
94
|
+
stats: void 0,
|
|
95
|
+
optimization: {},
|
|
96
|
+
extractAllVendors: false,
|
|
97
|
+
vendorName: "vendor",
|
|
98
|
+
extractCss: false,
|
|
86
99
|
options: {},
|
|
87
100
|
esbuildOptions: {},
|
|
88
101
|
rollupOptions: {},
|
|
@@ -121,6 +134,10 @@ function createDefaultConfig(workspace = process.cwd()) {
|
|
|
121
134
|
includes: [],
|
|
122
135
|
excludes: []
|
|
123
136
|
};
|
|
137
|
+
const extras = {
|
|
138
|
+
includes: [],
|
|
139
|
+
excludes: []
|
|
140
|
+
};
|
|
124
141
|
const server = {
|
|
125
142
|
host: null,
|
|
126
143
|
port: 3e3,
|
|
@@ -194,6 +211,7 @@ function createDefaultConfig(workspace = process.cwd()) {
|
|
|
194
211
|
scripts,
|
|
195
212
|
html,
|
|
196
213
|
assets,
|
|
214
|
+
extras,
|
|
197
215
|
server,
|
|
198
216
|
pwa,
|
|
199
217
|
ftp,
|
|
@@ -222,13 +240,18 @@ function isFunction(val) {
|
|
|
222
240
|
function isBoolean(val) {
|
|
223
241
|
return typeof val === "boolean";
|
|
224
242
|
}
|
|
243
|
+
function isPlainObject(val) {
|
|
244
|
+
if (val === null || typeof val !== "object") return false;
|
|
245
|
+
const proto = Object.getPrototypeOf(val);
|
|
246
|
+
return proto === Object.prototype || proto === null;
|
|
247
|
+
}
|
|
225
248
|
function deepMerge(target, ...sources) {
|
|
226
249
|
if (!sources.length) return target;
|
|
227
250
|
const source = sources.shift();
|
|
228
|
-
if (
|
|
251
|
+
if (isPlainObject(target) && isPlainObject(source)) {
|
|
229
252
|
for (const key in source) {
|
|
230
|
-
if (
|
|
231
|
-
if (!target[key]) Object.assign(target, { [key]: {} });
|
|
253
|
+
if (isPlainObject(source[key])) {
|
|
254
|
+
if (!isPlainObject(target[key])) Object.assign(target, { [key]: {} });
|
|
232
255
|
deepMerge(target[key], source[key]);
|
|
233
256
|
} else if (isArray(source[key])) {
|
|
234
257
|
target[key] = [...source[key]];
|
|
@@ -1024,6 +1047,172 @@ var StyleTask = class extends BaseTask {
|
|
|
1024
1047
|
// src/bundler/webpack.ts
|
|
1025
1048
|
import webpack from "webpack";
|
|
1026
1049
|
import path11 from "path";
|
|
1050
|
+
import { existsSync as existsSync2, readFileSync } from "fs";
|
|
1051
|
+
import { createRequire } from "module";
|
|
1052
|
+
import autoprefixer2 from "autoprefixer";
|
|
1053
|
+
import postcssPresetEnv2 from "postcss-preset-env";
|
|
1054
|
+
var coreRequire = createRequire(import.meta.url);
|
|
1055
|
+
var BABEL_CONFIG_FILES = [
|
|
1056
|
+
"babel.config.js",
|
|
1057
|
+
"babel.config.cjs",
|
|
1058
|
+
"babel.config.mjs",
|
|
1059
|
+
"babel.config.json",
|
|
1060
|
+
".babelrc",
|
|
1061
|
+
".babelrc.js",
|
|
1062
|
+
".babelrc.cjs",
|
|
1063
|
+
".babelrc.json"
|
|
1064
|
+
];
|
|
1065
|
+
function resolveModule(pkgName, workspace) {
|
|
1066
|
+
try {
|
|
1067
|
+
const workspaceRequire = createRequire(path11.join(workspace, "package.json"));
|
|
1068
|
+
return workspaceRequire.resolve(pkgName);
|
|
1069
|
+
} catch {
|
|
1070
|
+
return coreRequire.resolve(pkgName);
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
function resolveWorkspacePaths(paths, workspace) {
|
|
1074
|
+
if (!paths || !paths.length) return [];
|
|
1075
|
+
return paths.map((p) => path11.isAbsolute(p) ? p : path11.resolve(workspace, p));
|
|
1076
|
+
}
|
|
1077
|
+
function hasBabelConfig(config) {
|
|
1078
|
+
if (config.scripts.babelLoaderOptions && Object.keys(config.scripts.babelLoaderOptions).length > 0) {
|
|
1079
|
+
return true;
|
|
1080
|
+
}
|
|
1081
|
+
for (const filename of BABEL_CONFIG_FILES) {
|
|
1082
|
+
if (existsSync2(path11.join(config.workspace, filename))) {
|
|
1083
|
+
return true;
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
const pkgPath = path11.join(config.workspace, "package.json");
|
|
1087
|
+
if (existsSync2(pkgPath)) {
|
|
1088
|
+
try {
|
|
1089
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
1090
|
+
if (pkg && pkg.babel) {
|
|
1091
|
+
return true;
|
|
1092
|
+
}
|
|
1093
|
+
} catch {
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
return false;
|
|
1097
|
+
}
|
|
1098
|
+
function buildDefaultRules(config, dirs, devtool) {
|
|
1099
|
+
const isProd = config.env.isProd;
|
|
1100
|
+
const scripts = config.scripts;
|
|
1101
|
+
const esModule = scripts.useEsModule ?? true;
|
|
1102
|
+
const defaults = {
|
|
1103
|
+
html: true,
|
|
1104
|
+
css: true,
|
|
1105
|
+
js: true,
|
|
1106
|
+
url: true,
|
|
1107
|
+
...scripts.defaultLoaders || {}
|
|
1108
|
+
};
|
|
1109
|
+
const rules = [];
|
|
1110
|
+
if (defaults.html) {
|
|
1111
|
+
rules.push({
|
|
1112
|
+
test: /\.html$/i,
|
|
1113
|
+
exclude: /\.vue\.html$/i,
|
|
1114
|
+
loader: resolveModule("html-loader", config.workspace),
|
|
1115
|
+
options: {
|
|
1116
|
+
minimize: {
|
|
1117
|
+
removeAttributeQuotes: false
|
|
1118
|
+
},
|
|
1119
|
+
esModule,
|
|
1120
|
+
...scripts.htmlLoaderOptions || {}
|
|
1121
|
+
}
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
if (defaults.css) {
|
|
1125
|
+
const cssSourceMap = Boolean(devtool);
|
|
1126
|
+
const MiniCssExtractPlugin = coreRequire("mini-css-extract-plugin");
|
|
1127
|
+
const styleLoader = isProd && scripts.extractCss ? {
|
|
1128
|
+
loader: MiniCssExtractPlugin.loader,
|
|
1129
|
+
options: { esModule }
|
|
1130
|
+
} : {
|
|
1131
|
+
loader: resolveModule("style-loader", config.workspace),
|
|
1132
|
+
options: { esModule }
|
|
1133
|
+
};
|
|
1134
|
+
const postcssPlugins = [
|
|
1135
|
+
...config.styles.postcssPlugins || [],
|
|
1136
|
+
autoprefixer2(),
|
|
1137
|
+
postcssPresetEnv2()
|
|
1138
|
+
];
|
|
1139
|
+
const createCssUse = (isModule) => [
|
|
1140
|
+
styleLoader,
|
|
1141
|
+
{
|
|
1142
|
+
loader: resolveModule("css-loader", config.workspace),
|
|
1143
|
+
options: {
|
|
1144
|
+
importLoaders: 1,
|
|
1145
|
+
sourceMap: cssSourceMap,
|
|
1146
|
+
modules: isModule ? { auto: true } : { mode: "icss" },
|
|
1147
|
+
esModule
|
|
1148
|
+
}
|
|
1149
|
+
},
|
|
1150
|
+
{
|
|
1151
|
+
loader: resolveModule("postcss-loader", config.workspace),
|
|
1152
|
+
options: {
|
|
1153
|
+
postcssOptions: {
|
|
1154
|
+
plugins: postcssPlugins
|
|
1155
|
+
},
|
|
1156
|
+
sourceMap: cssSourceMap,
|
|
1157
|
+
...scripts.postcssLoaderOptions || {}
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
];
|
|
1161
|
+
rules.push(
|
|
1162
|
+
{
|
|
1163
|
+
test: /\.css$/,
|
|
1164
|
+
exclude: /\.module\.css$/,
|
|
1165
|
+
use: createCssUse(false),
|
|
1166
|
+
sideEffects: true
|
|
1167
|
+
},
|
|
1168
|
+
{
|
|
1169
|
+
test: /\.module\.css$/,
|
|
1170
|
+
use: createCssUse(true)
|
|
1171
|
+
}
|
|
1172
|
+
);
|
|
1173
|
+
}
|
|
1174
|
+
if (defaults.js && hasBabelConfig(config)) {
|
|
1175
|
+
const jsIncludes = [
|
|
1176
|
+
config.src.js,
|
|
1177
|
+
...resolveWorkspacePaths(scripts.includeJsResource, config.workspace)
|
|
1178
|
+
];
|
|
1179
|
+
rules.push({
|
|
1180
|
+
test: /\.(js|mjs|jsx|ts|tsx)$/,
|
|
1181
|
+
include: jsIncludes,
|
|
1182
|
+
loader: resolveModule("babel-loader", config.workspace),
|
|
1183
|
+
options: {
|
|
1184
|
+
cwd: config.workspace,
|
|
1185
|
+
...scripts.babelLoaderOptions || {}
|
|
1186
|
+
}
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
if (defaults.url) {
|
|
1190
|
+
const rawLimit = scripts.urlLoaderOptions?.limit ?? (process.env.IMAGE_INLINE_SIZE_LIMIT ? parseInt(process.env.IMAGE_INLINE_SIZE_LIMIT, 10) : 1e4);
|
|
1191
|
+
const maxSize = typeof rawLimit === "number" && rawLimit > 0 ? rawLimit : 0;
|
|
1192
|
+
const excludeUrl = resolveWorkspacePaths(scripts.excludeUrlResource, config.workspace);
|
|
1193
|
+
const createAssetRule = (test, targetDir, exclude) => ({
|
|
1194
|
+
test,
|
|
1195
|
+
...exclude && exclude.length ? { exclude } : {},
|
|
1196
|
+
type: maxSize > 0 ? "asset" : "asset/resource",
|
|
1197
|
+
...maxSize > 0 ? {
|
|
1198
|
+
parser: {
|
|
1199
|
+
dataUrlCondition: {
|
|
1200
|
+
maxSize
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
} : {},
|
|
1204
|
+
generator: {
|
|
1205
|
+
filename: `${targetDir}/[name].[hash:8][ext]`
|
|
1206
|
+
}
|
|
1207
|
+
});
|
|
1208
|
+
rules.push(
|
|
1209
|
+
createAssetRule(/\.(bmp|gif|jpe?g|png|svg|webp)(\?.*)?$/i, dirs.imgDir, excludeUrl),
|
|
1210
|
+
createAssetRule(/\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/i, dirs.mediaDir),
|
|
1211
|
+
createAssetRule(/\.(woff2?|eot|ttf|otf)(\?.*)?$/i, dirs.fontDir)
|
|
1212
|
+
);
|
|
1213
|
+
}
|
|
1214
|
+
return rules;
|
|
1215
|
+
}
|
|
1027
1216
|
async function runWebpack(config, customOptions = {}) {
|
|
1028
1217
|
const isProd = config.env.isProd;
|
|
1029
1218
|
let entry = customOptions.entry || config.scripts.entry;
|
|
@@ -1036,6 +1225,45 @@ async function runWebpack(config, customOptions = {}) {
|
|
|
1036
1225
|
const jsDir = isCustomOutput ? "" : isProd ? config.paths.target.js : config.paths.tmp.js;
|
|
1037
1226
|
const imgDir = isProd ? config.paths.target.img : config.paths.tmp.img;
|
|
1038
1227
|
const fontDir = isProd ? config.paths.target.font : config.paths.tmp.font;
|
|
1228
|
+
const mediaDir = isProd ? config.paths.target.media : config.paths.tmp.media;
|
|
1229
|
+
const devtool = config.scripts.sourceMap ? config.scripts.sourceMap === true ? isProd ? "source-map" : "eval-cheap-module-source-map" : config.scripts.sourceMap : isProd ? false : "eval-cheap-module-source-map";
|
|
1230
|
+
const libraryConfig = config.scripts.library ? typeof config.scripts.library === "string" && config.scripts.libraryTarget && config.scripts.libraryTarget !== "var" ? { name: config.scripts.library, type: config.scripts.libraryTarget } : config.scripts.library : void 0;
|
|
1231
|
+
const defaultRules = buildDefaultRules(config, { imgDir, fontDir, mediaDir }, devtool);
|
|
1232
|
+
const plugins = [...config.scripts.plugins || []];
|
|
1233
|
+
if (isProd && config.scripts.extractCss) {
|
|
1234
|
+
const MiniCssExtractPlugin = coreRequire("mini-css-extract-plugin");
|
|
1235
|
+
const cssDir = config.paths.target.css;
|
|
1236
|
+
const cssFilename = config.assets.cache ? `${cssDir}/async/[name].[contenthash:8].css` : `${cssDir}/async/[name].css`;
|
|
1237
|
+
plugins.push(
|
|
1238
|
+
new MiniCssExtractPlugin({
|
|
1239
|
+
filename: cssFilename,
|
|
1240
|
+
chunkFilename: cssFilename
|
|
1241
|
+
})
|
|
1242
|
+
);
|
|
1243
|
+
}
|
|
1244
|
+
const vendorName = config.scripts.vendorName || "vendor";
|
|
1245
|
+
const defaultOptimization = {
|
|
1246
|
+
minimize: isProd || config.scripts.minify
|
|
1247
|
+
};
|
|
1248
|
+
if (config.scripts.extractAllVendors) {
|
|
1249
|
+
const vendorFilename = isCustomOutput ? `${vendorName}.js` : isProd && config.assets.cache ? `${jsDir}/${vendorName}.[contenthash:8].js` : `${jsDir}/${vendorName}.js`;
|
|
1250
|
+
defaultOptimization.splitChunks = {
|
|
1251
|
+
cacheGroups: {
|
|
1252
|
+
vendors: {
|
|
1253
|
+
name: vendorName,
|
|
1254
|
+
chunks: "initial",
|
|
1255
|
+
test: /[\\/](node_modules|bower_components)[\\/]/,
|
|
1256
|
+
filename: vendorFilename
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
};
|
|
1260
|
+
}
|
|
1261
|
+
const optimization = deepMerge(
|
|
1262
|
+
{},
|
|
1263
|
+
defaultOptimization,
|
|
1264
|
+
config.scripts.optimization || {}
|
|
1265
|
+
);
|
|
1266
|
+
const externals = config.scripts.externals && (typeof config.scripts.externals !== "string" || config.scripts.externals.length > 0) ? config.scripts.externals : void 0;
|
|
1039
1267
|
const defaultWebpackConfig = {
|
|
1040
1268
|
mode: isProd ? "production" : "development",
|
|
1041
1269
|
context: config.workspace,
|
|
@@ -1045,14 +1273,13 @@ async function runWebpack(config, customOptions = {}) {
|
|
|
1045
1273
|
filename: isCustomOutput ? "[name].js" : isProd && config.assets.cache ? `${jsDir}/[name].[contenthash:8].js` : `${jsDir}/[name].js`,
|
|
1046
1274
|
chunkFilename: isCustomOutput ? "chunk/[name].js" : isProd && config.assets.cache ? `${jsDir}/chunk/[name].[chunkhash:8].js` : `${jsDir}/chunk/[name].js`,
|
|
1047
1275
|
publicPath: config.assets.virtualDir ? `/${config.assets.virtualDir}/` : "/",
|
|
1048
|
-
...
|
|
1276
|
+
...libraryConfig ? { library: libraryConfig } : {}
|
|
1049
1277
|
},
|
|
1050
1278
|
target: config.scripts.target || "web",
|
|
1051
|
-
externals:
|
|
1052
|
-
plugins
|
|
1053
|
-
...config.scripts.plugins || []
|
|
1054
|
-
],
|
|
1279
|
+
...externals !== void 0 ? { externals } : {},
|
|
1280
|
+
plugins,
|
|
1055
1281
|
resolve: {
|
|
1282
|
+
modules: ["node_modules", config.src.base],
|
|
1056
1283
|
extensions: [
|
|
1057
1284
|
".wasm",
|
|
1058
1285
|
".mjs",
|
|
@@ -1070,28 +1297,11 @@ async function runWebpack(config, customOptions = {}) {
|
|
|
1070
1297
|
}
|
|
1071
1298
|
},
|
|
1072
1299
|
module: {
|
|
1073
|
-
rules: [
|
|
1074
|
-
...config.scripts.loaders || [],
|
|
1075
|
-
{
|
|
1076
|
-
test: /\.(png|jpe?g|gif|svg|webp)$/i,
|
|
1077
|
-
type: "asset/resource",
|
|
1078
|
-
generator: {
|
|
1079
|
-
filename: `${imgDir}/[name].[hash:8][ext]`
|
|
1080
|
-
}
|
|
1081
|
-
},
|
|
1082
|
-
{
|
|
1083
|
-
test: /\.(woff2?|eot|ttf|otf)$/i,
|
|
1084
|
-
type: "asset/resource",
|
|
1085
|
-
generator: {
|
|
1086
|
-
filename: `${fontDir}/[name].[hash:8][ext]`
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
]
|
|
1090
|
-
},
|
|
1091
|
-
optimization: {
|
|
1092
|
-
minimize: isProd || config.scripts.minify
|
|
1300
|
+
rules: [...defaultRules, ...config.scripts.loaders || []]
|
|
1093
1301
|
},
|
|
1094
|
-
|
|
1302
|
+
optimization,
|
|
1303
|
+
...config.scripts.stats !== void 0 ? { stats: config.scripts.stats } : {},
|
|
1304
|
+
devtool
|
|
1095
1305
|
};
|
|
1096
1306
|
const webpackConfig = {
|
|
1097
1307
|
...defaultWebpackConfig,
|
|
@@ -1109,14 +1319,21 @@ async function runWebpack(config, customOptions = {}) {
|
|
|
1109
1319
|
compiler.run((err, stats) => {
|
|
1110
1320
|
if (err) {
|
|
1111
1321
|
logger.error("webpack", err.stack || err);
|
|
1112
|
-
|
|
1322
|
+
compiler.close(() => reject(err));
|
|
1323
|
+
return;
|
|
1113
1324
|
}
|
|
1114
1325
|
if (stats?.hasErrors()) {
|
|
1115
1326
|
const info = stats.toJson();
|
|
1116
1327
|
logger.error("webpack", info.errors?.map((e) => e.message).join("\n"));
|
|
1117
|
-
|
|
1328
|
+
compiler.close(() => reject(new Error("Webpack compilation errors")));
|
|
1329
|
+
return;
|
|
1118
1330
|
}
|
|
1119
|
-
|
|
1331
|
+
compiler.close((closeErr) => {
|
|
1332
|
+
if (closeErr) {
|
|
1333
|
+
return reject(closeErr);
|
|
1334
|
+
}
|
|
1335
|
+
resolve(stats);
|
|
1336
|
+
});
|
|
1120
1337
|
});
|
|
1121
1338
|
});
|
|
1122
1339
|
}
|
|
@@ -1210,7 +1427,7 @@ var ScriptTask = class extends BaseTask {
|
|
|
1210
1427
|
|
|
1211
1428
|
// src/tasks/html.ts
|
|
1212
1429
|
import path12 from "path";
|
|
1213
|
-
import { existsSync as
|
|
1430
|
+
import { existsSync as existsSync3 } from "fs";
|
|
1214
1431
|
import fg3 from "fast-glob";
|
|
1215
1432
|
|
|
1216
1433
|
// src/pipeline/transforms/htmlmin.ts
|
|
@@ -1242,10 +1459,18 @@ function transformReplace(options, replacement) {
|
|
|
1242
1459
|
return async (file2) => {
|
|
1243
1460
|
let content = file2.toString();
|
|
1244
1461
|
for (const rule of rules) {
|
|
1245
|
-
if (typeof rule.
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1462
|
+
if (typeof rule.substr === "string") {
|
|
1463
|
+
if (typeof rule.replacement === "function") {
|
|
1464
|
+
content = content.replaceAll(rule.substr, rule.replacement);
|
|
1465
|
+
} else {
|
|
1466
|
+
content = content.replaceAll(rule.substr, rule.replacement);
|
|
1467
|
+
}
|
|
1468
|
+
} else if (rule.substr instanceof RegExp) {
|
|
1469
|
+
if (typeof rule.replacement === "function") {
|
|
1470
|
+
content = content.replace(rule.substr, rule.replacement);
|
|
1471
|
+
} else {
|
|
1472
|
+
content = content.replace(rule.substr, rule.replacement);
|
|
1473
|
+
}
|
|
1249
1474
|
}
|
|
1250
1475
|
}
|
|
1251
1476
|
file2.contents = Buffer.from(content);
|
|
@@ -1301,7 +1526,7 @@ var HtmlTask = class extends BaseTask {
|
|
|
1301
1526
|
const patterns = [path12.join(templateDir, "*.html")];
|
|
1302
1527
|
if (config.pwa.manifest) {
|
|
1303
1528
|
const manifestPattern = path12.join(templateDir, config.pwa.manifest);
|
|
1304
|
-
if (
|
|
1529
|
+
if (existsSync3(path12.isAbsolute(manifestPattern) ? manifestPattern : path12.join(config.workspace, manifestPattern))) {
|
|
1305
1530
|
patterns.push(manifestPattern);
|
|
1306
1531
|
}
|
|
1307
1532
|
}
|
|
@@ -1387,7 +1612,9 @@ var HtmlTask = class extends BaseTask {
|
|
|
1387
1612
|
pipeline.pipe(async (file2) => {
|
|
1388
1613
|
if (/\.html$/i.test(file2.extname)) {
|
|
1389
1614
|
let content = file2.toString();
|
|
1390
|
-
const
|
|
1615
|
+
const entryNames = typeof config.scripts.entry === "object" && !Array.isArray(config.scripts.entry) ? Object.keys(config.scripts.entry) : ["main"];
|
|
1616
|
+
const vendorName = config.scripts.vendorName || "vendor";
|
|
1617
|
+
const entries = config.scripts.extractAllVendors ? [vendorName, ...entryNames] : entryNames;
|
|
1391
1618
|
const jsDir = config.env.isProd ? config.paths.target.js : config.paths.tmp.js;
|
|
1392
1619
|
const jsPathPrefix = config.assets.virtualDir ? `/${config.assets.virtualDir}/${jsDir}` : `/${jsDir}`;
|
|
1393
1620
|
const destJsFolder = config.dest.js;
|
|
@@ -1397,18 +1624,24 @@ var HtmlTask = class extends BaseTask {
|
|
|
1397
1624
|
)
|
|
1398
1625
|
).map((entryName) => {
|
|
1399
1626
|
let actualFilename = `${entryName}.js`;
|
|
1627
|
+
const hasUnhashed = existsSync3(path12.join(destJsFolder, actualFilename));
|
|
1628
|
+
let found = hasUnhashed;
|
|
1400
1629
|
try {
|
|
1401
1630
|
const matched = fg3.sync(`${entryName}.*.js`, { cwd: destJsFolder });
|
|
1402
1631
|
if (matched.length) {
|
|
1403
1632
|
const valid = matched.find((f) => !f.endsWith(".map") && !f.endsWith(".txt"));
|
|
1404
1633
|
if (valid) {
|
|
1405
1634
|
actualFilename = valid;
|
|
1635
|
+
found = true;
|
|
1406
1636
|
}
|
|
1407
1637
|
}
|
|
1408
1638
|
} catch {
|
|
1409
1639
|
}
|
|
1640
|
+
if (entryName === vendorName && config.scripts.extractAllVendors && !found) {
|
|
1641
|
+
return "";
|
|
1642
|
+
}
|
|
1410
1643
|
return `<script defer src="${jsPathPrefix}/${actualFilename}"></script>`;
|
|
1411
|
-
}).join("\n");
|
|
1644
|
+
}).filter(Boolean).join("\n");
|
|
1412
1645
|
if (scriptTags) {
|
|
1413
1646
|
if (content.includes("</body>")) {
|
|
1414
1647
|
content = content.replace("</body>", `${scriptTags}
|
|
@@ -1796,8 +2029,8 @@ var PublishTask = class extends BaseTask {
|
|
|
1796
2029
|
// src/tasks/pwa.ts
|
|
1797
2030
|
import path19 from "path";
|
|
1798
2031
|
import fs5 from "fs/promises";
|
|
1799
|
-
import { existsSync as
|
|
1800
|
-
import { createRequire } from "module";
|
|
2032
|
+
import { existsSync as existsSync4 } from "fs";
|
|
2033
|
+
import { createRequire as createRequire2 } from "module";
|
|
1801
2034
|
import { generateSW, injectManifest } from "workbox-build";
|
|
1802
2035
|
var PwaTask = class extends BaseTask {
|
|
1803
2036
|
options;
|
|
@@ -1809,7 +2042,7 @@ var PwaTask = class extends BaseTask {
|
|
|
1809
2042
|
const globDirectory = config.dest.base;
|
|
1810
2043
|
const swDest = path19.join(globDirectory, config.pwa.swDestFilename);
|
|
1811
2044
|
const swSrc = path19.join(config.src.base, config.pwa.swSrcFilename);
|
|
1812
|
-
const require2 =
|
|
2045
|
+
const require2 = createRequire2(import.meta.url);
|
|
1813
2046
|
const candidatePaths = [
|
|
1814
2047
|
path19.join(config.workspace, "node_modules/workbox-sw/build/workbox-sw.js"),
|
|
1815
2048
|
path19.join(config.workspace, "node_modules/workbox-sw/controllers/WorkboxSW.mjs")
|
|
@@ -1825,7 +2058,7 @@ var PwaTask = class extends BaseTask {
|
|
|
1825
2058
|
} catch {
|
|
1826
2059
|
}
|
|
1827
2060
|
for (const p of candidatePaths) {
|
|
1828
|
-
if (
|
|
2061
|
+
if (existsSync4(p)) {
|
|
1829
2062
|
const destFile = path19.join(globDirectory, "workbox-sw.js");
|
|
1830
2063
|
await fs5.copyFile(p, destFile);
|
|
1831
2064
|
break;
|
|
@@ -1849,7 +2082,7 @@ var PwaTask = class extends BaseTask {
|
|
|
1849
2082
|
const { count, size } = await injectManifest(mergedOptions);
|
|
1850
2083
|
logger.info("pwa", `Injected manifest into '${swDest}', precaching ${count} files (${size} bytes)`);
|
|
1851
2084
|
}
|
|
1852
|
-
if (
|
|
2085
|
+
if (existsSync4(swDest) && config.pwa.version) {
|
|
1853
2086
|
let swContent = await fs5.readFile(swDest, "utf-8");
|
|
1854
2087
|
swContent = swContent.replaceAll("{{ version }}", config.pwa.version).replaceAll("{{version}}", config.pwa.version);
|
|
1855
2088
|
await fs5.writeFile(swDest, swContent, "utf-8");
|
|
@@ -1983,7 +2216,7 @@ var FtpTask = class extends BaseTask {
|
|
|
1983
2216
|
// src/tasks/server.ts
|
|
1984
2217
|
import http from "http";
|
|
1985
2218
|
import fs8 from "fs";
|
|
1986
|
-
import
|
|
2219
|
+
import path23 from "path";
|
|
1987
2220
|
import connect from "connect";
|
|
1988
2221
|
import serveStatic from "serve-static";
|
|
1989
2222
|
import { WebSocketServer, WebSocket } from "ws";
|
|
@@ -1991,6 +2224,7 @@ import { createProxyMiddleware } from "http-proxy-middleware";
|
|
|
1991
2224
|
|
|
1992
2225
|
// src/watcher/index.ts
|
|
1993
2226
|
import fs7 from "fs";
|
|
2227
|
+
import path22 from "path";
|
|
1994
2228
|
import pc3 from "picocolors";
|
|
1995
2229
|
var FileWatcher = class {
|
|
1996
2230
|
config;
|
|
@@ -2000,7 +2234,8 @@ var FileWatcher = class {
|
|
|
2000
2234
|
styleTask;
|
|
2001
2235
|
scriptTask;
|
|
2002
2236
|
htmlTask;
|
|
2003
|
-
|
|
2237
|
+
watchers = [];
|
|
2238
|
+
isRebuilding = false;
|
|
2004
2239
|
constructor(config, broadcast) {
|
|
2005
2240
|
this.config = config;
|
|
2006
2241
|
this.broadcast = broadcast;
|
|
@@ -2008,29 +2243,56 @@ var FileWatcher = class {
|
|
|
2008
2243
|
this.scriptTask = new ScriptTask();
|
|
2009
2244
|
this.htmlTask = new HtmlTask();
|
|
2010
2245
|
}
|
|
2246
|
+
getWatchDirs() {
|
|
2247
|
+
const candidates = [
|
|
2248
|
+
this.config.src.base,
|
|
2249
|
+
...this.config.scripts.includeJsResource || [],
|
|
2250
|
+
...this.config.styles.atImportPaths || []
|
|
2251
|
+
];
|
|
2252
|
+
const resolved = candidates.filter(Boolean).map((dir) => path22.isAbsolute(dir) ? dir : path22.resolve(this.config.workspace, dir)).filter((dir) => fs7.existsSync(dir) && !dir.includes(`${path22.sep}node_modules`));
|
|
2253
|
+
const unique = Array.from(new Set(resolved)).sort((a, b) => a.length - b.length);
|
|
2254
|
+
return unique.filter(
|
|
2255
|
+
(dir, index) => !unique.slice(0, index).some((parent) => dir.startsWith(`${parent}${path22.sep}`))
|
|
2256
|
+
);
|
|
2257
|
+
}
|
|
2011
2258
|
start() {
|
|
2012
|
-
const
|
|
2013
|
-
if (!
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2259
|
+
const watchDirs = this.getWatchDirs();
|
|
2260
|
+
if (!watchDirs.length) return;
|
|
2261
|
+
for (const watchDir of watchDirs) {
|
|
2262
|
+
logger.info("watch", `Watching for file changes in ${pc3.cyan(watchDir)}`);
|
|
2263
|
+
try {
|
|
2264
|
+
const watcher = fs7.watch(watchDir, { recursive: true }, (_eventType, filename) => {
|
|
2265
|
+
if (!filename) return;
|
|
2266
|
+
const normalized = filename.replace(/\\/g, "/");
|
|
2267
|
+
if (normalized.includes("node_modules/") || normalized.startsWith(".git/")) {
|
|
2268
|
+
return;
|
|
2269
|
+
}
|
|
2270
|
+
this.pendingFiles.add(filename);
|
|
2271
|
+
if (this.debounceTimer) clearTimeout(this.debounceTimer);
|
|
2272
|
+
this.debounceTimer = setTimeout(() => {
|
|
2273
|
+
this.handleChanges();
|
|
2274
|
+
}, 50);
|
|
2275
|
+
});
|
|
2276
|
+
this.watchers.push(watcher);
|
|
2277
|
+
} catch (err) {
|
|
2278
|
+
logger.warn("watch", `Native recursive watch failed for ${watchDir}: ${err.message}`);
|
|
2279
|
+
}
|
|
2026
2280
|
}
|
|
2027
2281
|
}
|
|
2028
2282
|
async handleChanges() {
|
|
2283
|
+
if (this.isRebuilding) {
|
|
2284
|
+
this.debounceTimer = setTimeout(() => this.handleChanges(), 50);
|
|
2285
|
+
return;
|
|
2286
|
+
}
|
|
2029
2287
|
const changed = Array.from(this.pendingFiles);
|
|
2030
2288
|
this.pendingFiles.clear();
|
|
2289
|
+
if (!changed.length) return;
|
|
2031
2290
|
const hasStyle = changed.some((f) => /\.(scss|sass|less|css)$/i.test(f));
|
|
2032
|
-
const hasScript = changed.some(
|
|
2291
|
+
const hasScript = changed.some(
|
|
2292
|
+
(f) => /\.(js|mjs|cjs|ts|jsx|tsx|vue|md|json)$/i.test(f)
|
|
2293
|
+
);
|
|
2033
2294
|
const hasHtml = changed.some((f) => /\.html$/i.test(f));
|
|
2295
|
+
this.isRebuilding = true;
|
|
2034
2296
|
try {
|
|
2035
2297
|
if (hasStyle) {
|
|
2036
2298
|
const start = performance.now();
|
|
@@ -2058,13 +2320,19 @@ var FileWatcher = class {
|
|
|
2058
2320
|
}
|
|
2059
2321
|
} catch (err) {
|
|
2060
2322
|
logger.error("watch", `Incremental rebuild failed: ${err?.message || err}`);
|
|
2323
|
+
} finally {
|
|
2324
|
+
this.isRebuilding = false;
|
|
2061
2325
|
}
|
|
2062
2326
|
}
|
|
2063
2327
|
stop() {
|
|
2064
|
-
if (this.
|
|
2065
|
-
this.
|
|
2066
|
-
this.
|
|
2328
|
+
if (this.debounceTimer) {
|
|
2329
|
+
clearTimeout(this.debounceTimer);
|
|
2330
|
+
this.debounceTimer = null;
|
|
2331
|
+
}
|
|
2332
|
+
for (const watcher of this.watchers) {
|
|
2333
|
+
watcher.close();
|
|
2067
2334
|
}
|
|
2335
|
+
this.watchers = [];
|
|
2068
2336
|
}
|
|
2069
2337
|
};
|
|
2070
2338
|
|
|
@@ -2102,9 +2370,9 @@ var ServerTask = class extends BaseTask {
|
|
|
2102
2370
|
app.use((req, res, next) => {
|
|
2103
2371
|
if (req.url === "/manifest.json" || req.url?.endsWith("/manifest.json")) {
|
|
2104
2372
|
const candidates = [
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2373
|
+
path23.join(config.dest.base, "manifest.json"),
|
|
2374
|
+
path23.join(config.src.base, "manifest.json"),
|
|
2375
|
+
path23.join(config.workspace, "manifest.json")
|
|
2108
2376
|
];
|
|
2109
2377
|
const file2 = candidates.find((f) => fs8.existsSync(f));
|
|
2110
2378
|
if (file2) {
|
|
@@ -2129,37 +2397,37 @@ var ServerTask = class extends BaseTask {
|
|
|
2129
2397
|
if (config.paths.tmp.js && config.paths.tmp.js !== config.paths.source.js) {
|
|
2130
2398
|
app.use("/" + config.paths.tmp.js, serveStatic(config.dest.js));
|
|
2131
2399
|
}
|
|
2132
|
-
app.use("/chunk", serveStatic(
|
|
2133
|
-
app.use("/chunk", serveStatic(
|
|
2400
|
+
app.use("/chunk", serveStatic(path23.join(config.dest.js, "chunk")));
|
|
2401
|
+
app.use("/chunk", serveStatic(path23.join(config.dest.base, "chunk")));
|
|
2134
2402
|
if (config.paths.source.img) {
|
|
2135
2403
|
app.use(
|
|
2136
2404
|
"/" + config.paths.source.img,
|
|
2137
|
-
serveStatic(
|
|
2405
|
+
serveStatic(path23.join(config.src.base, config.paths.source.img))
|
|
2138
2406
|
);
|
|
2139
2407
|
}
|
|
2140
2408
|
if (config.paths.tmp.img) {
|
|
2141
2409
|
app.use("/" + config.paths.tmp.img, serveStatic(config.dest.img));
|
|
2142
2410
|
}
|
|
2143
|
-
app.use("/img", serveStatic(
|
|
2144
|
-
app.use("/img", serveStatic(
|
|
2411
|
+
app.use("/img", serveStatic(path23.join(config.dest.base, "img")));
|
|
2412
|
+
app.use("/img", serveStatic(path23.join(config.dest.js, "img")));
|
|
2145
2413
|
if (config.paths.source.font) {
|
|
2146
2414
|
app.use(
|
|
2147
2415
|
"/" + config.paths.source.font,
|
|
2148
|
-
serveStatic(
|
|
2416
|
+
serveStatic(path23.join(config.src.base, config.paths.source.font))
|
|
2149
2417
|
);
|
|
2150
2418
|
}
|
|
2151
2419
|
if (config.paths.tmp.font) {
|
|
2152
2420
|
app.use("/" + config.paths.tmp.font, serveStatic(config.dest.font));
|
|
2153
2421
|
}
|
|
2154
|
-
app.use("/font", serveStatic(
|
|
2155
|
-
app.use("/font", serveStatic(
|
|
2156
|
-
app.use("/fonts", serveStatic(
|
|
2157
|
-
app.use("/fonts", serveStatic(
|
|
2422
|
+
app.use("/font", serveStatic(path23.join(config.dest.base, "font")));
|
|
2423
|
+
app.use("/font", serveStatic(path23.join(config.dest.js, "font")));
|
|
2424
|
+
app.use("/fonts", serveStatic(path23.join(config.src.base, "fonts")));
|
|
2425
|
+
app.use("/fonts", serveStatic(path23.join(config.dest.base, "fonts")));
|
|
2158
2426
|
if (config.server.serveStatic) {
|
|
2159
2427
|
const staticEntries = Array.isArray(config.server.serveStatic) ? config.server.serveStatic : [config.server.serveStatic];
|
|
2160
2428
|
for (const entry of staticEntries) {
|
|
2161
2429
|
if (typeof entry === "string") {
|
|
2162
|
-
const absoluteDir =
|
|
2430
|
+
const absoluteDir = path23.isAbsolute(entry) ? entry : path23.join(config.workspace, entry);
|
|
2163
2431
|
if (fs8.existsSync(absoluteDir)) {
|
|
2164
2432
|
app.use(serveStatic(absoluteDir));
|
|
2165
2433
|
}
|
|
@@ -2167,7 +2435,7 @@ var ServerTask = class extends BaseTask {
|
|
|
2167
2435
|
const route = entry.route ? entry.route.startsWith("/") ? entry.route : `/${entry.route}` : "";
|
|
2168
2436
|
const dirs = Array.isArray(entry.dir) ? entry.dir : [entry.dir];
|
|
2169
2437
|
for (const dir of dirs) {
|
|
2170
|
-
const absoluteDir =
|
|
2438
|
+
const absoluteDir = path23.isAbsolute(dir) ? dir : path23.join(config.workspace, dir);
|
|
2171
2439
|
if (fs8.existsSync(absoluteDir)) {
|
|
2172
2440
|
if (route) {
|
|
2173
2441
|
app.use(route, serveStatic(absoluteDir));
|
|
@@ -2187,8 +2455,8 @@ var ServerTask = class extends BaseTask {
|
|
|
2187
2455
|
const isGetOrHead = req.method === "GET" || req.method === "HEAD";
|
|
2188
2456
|
const isHtmlNav = !req.url?.includes(".") || req.headers.accept?.includes("text/html");
|
|
2189
2457
|
if (isGetOrHead && isHtmlNav) {
|
|
2190
|
-
const indexPath =
|
|
2191
|
-
const srcIndexPath =
|
|
2458
|
+
const indexPath = path23.join(config.dest.html, "index.html");
|
|
2459
|
+
const srcIndexPath = path23.join(config.src.base, "index.html");
|
|
2192
2460
|
const fileToServe = fs8.existsSync(indexPath) ? indexPath : srcIndexPath;
|
|
2193
2461
|
if (fs8.existsSync(fileToServe)) {
|
|
2194
2462
|
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
@@ -2238,8 +2506,8 @@ var ServerTask = class extends BaseTask {
|
|
|
2238
2506
|
};
|
|
2239
2507
|
|
|
2240
2508
|
// src/tasks/static.ts
|
|
2241
|
-
import
|
|
2242
|
-
import { existsSync as
|
|
2509
|
+
import path24 from "path";
|
|
2510
|
+
import { existsSync as existsSync5 } from "fs";
|
|
2243
2511
|
var StaticTask = class extends BaseTask {
|
|
2244
2512
|
constructor() {
|
|
2245
2513
|
super({ name: "static", description: "Copy static assets, images, fonts, and manifest" });
|
|
@@ -2248,9 +2516,25 @@ var StaticTask = class extends BaseTask {
|
|
|
2248
2516
|
const srcBase = config.src.base;
|
|
2249
2517
|
const destBase = config.dest.base;
|
|
2250
2518
|
const staticPatterns = [
|
|
2251
|
-
|
|
2252
|
-
`!${
|
|
2519
|
+
path24.join(srcBase, "*.{ico,png,svg,json,txt,xml,webmanifest}"),
|
|
2520
|
+
`!${path24.join(srcBase, "*.html")}`
|
|
2521
|
+
];
|
|
2522
|
+
const extraIncludes = [
|
|
2523
|
+
...config.extras?.includes || [],
|
|
2524
|
+
...config.assets?.includes || []
|
|
2253
2525
|
];
|
|
2526
|
+
const extraExcludes = [
|
|
2527
|
+
...config.extras?.excludes || [],
|
|
2528
|
+
...config.assets?.excludes || []
|
|
2529
|
+
];
|
|
2530
|
+
for (const inc of extraIncludes) {
|
|
2531
|
+
const pattern = path24.isAbsolute(inc) ? inc : path24.join(srcBase, inc);
|
|
2532
|
+
staticPatterns.push(pattern);
|
|
2533
|
+
}
|
|
2534
|
+
for (const exc of extraExcludes) {
|
|
2535
|
+
const pattern = path24.isAbsolute(exc) ? exc : path24.join(srcBase, exc);
|
|
2536
|
+
staticPatterns.push(`!${pattern}`);
|
|
2537
|
+
}
|
|
2254
2538
|
const pipeline = Pipeline.from(staticPatterns, {
|
|
2255
2539
|
cwd: config.workspace,
|
|
2256
2540
|
base: srcBase
|
|
@@ -2265,30 +2549,30 @@ var StaticTask = class extends BaseTask {
|
|
|
2265
2549
|
return file2;
|
|
2266
2550
|
});
|
|
2267
2551
|
await pipeline.dest(destBase);
|
|
2268
|
-
if (config.src.img &&
|
|
2269
|
-
const imgPipeline = Pipeline.from(
|
|
2552
|
+
if (config.src.img && existsSync5(config.src.img)) {
|
|
2553
|
+
const imgPipeline = Pipeline.from(path24.join(config.src.img, "**/*"), {
|
|
2270
2554
|
cwd: config.workspace,
|
|
2271
2555
|
base: config.src.img
|
|
2272
2556
|
});
|
|
2273
2557
|
await imgPipeline.dest(config.dest.img);
|
|
2274
2558
|
}
|
|
2275
|
-
if (config.src.font &&
|
|
2276
|
-
const fontPipeline = Pipeline.from(
|
|
2559
|
+
if (config.src.font && existsSync5(config.src.font)) {
|
|
2560
|
+
const fontPipeline = Pipeline.from(path24.join(config.src.font, "**/*"), {
|
|
2277
2561
|
cwd: config.workspace,
|
|
2278
2562
|
base: config.src.font
|
|
2279
2563
|
});
|
|
2280
2564
|
await fontPipeline.dest(config.dest.font);
|
|
2281
2565
|
}
|
|
2282
|
-
if (config.src.media &&
|
|
2283
|
-
const mediaPipeline = Pipeline.from(
|
|
2566
|
+
if (config.src.media && existsSync5(config.src.media)) {
|
|
2567
|
+
const mediaPipeline = Pipeline.from(path24.join(config.src.media, "**/*"), {
|
|
2284
2568
|
cwd: config.workspace,
|
|
2285
2569
|
base: config.src.media
|
|
2286
2570
|
});
|
|
2287
2571
|
await mediaPipeline.dest(config.dest.media);
|
|
2288
2572
|
}
|
|
2289
|
-
const publicDir =
|
|
2290
|
-
if (
|
|
2291
|
-
const pubPipeline = Pipeline.from(
|
|
2573
|
+
const publicDir = path24.join(config.workspace, "public");
|
|
2574
|
+
if (existsSync5(publicDir)) {
|
|
2575
|
+
const pubPipeline = Pipeline.from(path24.join(publicDir, "**/*"), {
|
|
2292
2576
|
cwd: config.workspace,
|
|
2293
2577
|
base: publicDir
|
|
2294
2578
|
});
|
|
@@ -2487,7 +2771,7 @@ var Balm = class {
|
|
|
2487
2771
|
}
|
|
2488
2772
|
try {
|
|
2489
2773
|
if (this.beforeTask) {
|
|
2490
|
-
await this.beforeTask();
|
|
2774
|
+
await this.beforeTask(this._config);
|
|
2491
2775
|
}
|
|
2492
2776
|
if (this._config.useDefaults) {
|
|
2493
2777
|
await this.dag.runSeries(
|
|
@@ -2512,7 +2796,7 @@ var Balm = class {
|
|
|
2512
2796
|
await this.dag.executeTask("serve", this._config);
|
|
2513
2797
|
}
|
|
2514
2798
|
if (this.afterTask) {
|
|
2515
|
-
await this.afterTask();
|
|
2799
|
+
await this.afterTask(this._config);
|
|
2516
2800
|
}
|
|
2517
2801
|
endTimer();
|
|
2518
2802
|
} catch (err) {
|