weapp-vite 5.6.1 → 5.6.2
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/auto-routes.cjs +2 -2
- package/dist/auto-routes.mjs +1 -1
- package/dist/{chunk-3FNAS3G7.mjs → chunk-3OJIAYQT.mjs} +1 -1
- package/dist/{chunk-BJJOLDPK.cjs → chunk-634Q6FYA.cjs} +4 -4
- package/dist/{chunk-LWQW2GQC.mjs → chunk-S4QPBSDQ.mjs} +257 -208
- package/dist/{chunk-6JB3ELRA.cjs → chunk-XMRIIXBJ.cjs} +277 -228
- package/dist/cli.cjs +65 -65
- package/dist/cli.mjs +32 -32
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +2 -2
- package/package.json +3 -3
|
@@ -4484,11 +4484,12 @@ function createAutoRoutesServicePlugin(ctx) {
|
|
|
4484
4484
|
|
|
4485
4485
|
// src/runtime/buildPlugin.ts
|
|
4486
4486
|
_chunkWWFEREWVcjs.init_cjs_shims.call(void 0, );
|
|
4487
|
+
var _fs = require('fs'); var actualFS = _interopRequireWildcard(_fs);
|
|
4487
4488
|
|
|
4488
4489
|
|
|
4489
4490
|
// ../../node_modules/.pnpm/chokidar@4.0.3/node_modules/chokidar/esm/index.js
|
|
4490
4491
|
_chunkWWFEREWVcjs.init_cjs_shims.call(void 0, );
|
|
4491
|
-
|
|
4492
|
+
|
|
4492
4493
|
var _promises = require('fs/promises'); var _promises2 = _interopRequireDefault(_promises);
|
|
4493
4494
|
var _events2 = require('events');
|
|
4494
4495
|
var _path = require('path'); var sysPath2 = _interopRequireWildcard(_path); var sysPath = _interopRequireWildcard(_path);
|
|
@@ -9537,8 +9538,8 @@ var PathScurryBase = class {
|
|
|
9537
9538
|
*
|
|
9538
9539
|
* @internal
|
|
9539
9540
|
*/
|
|
9540
|
-
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs:
|
|
9541
|
-
this.#fs = fsFromOption(
|
|
9541
|
+
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs26 = defaultFS } = {}) {
|
|
9542
|
+
this.#fs = fsFromOption(fs26);
|
|
9542
9543
|
if (cwd instanceof URL || cwd.startsWith("file://")) {
|
|
9543
9544
|
cwd = _url.fileURLToPath.call(void 0, cwd);
|
|
9544
9545
|
}
|
|
@@ -10096,8 +10097,8 @@ var PathScurryWin32 = (_class9 = class extends PathScurryBase {
|
|
|
10096
10097
|
/**
|
|
10097
10098
|
* @internal
|
|
10098
10099
|
*/
|
|
10099
|
-
newRoot(
|
|
10100
|
-
return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
10100
|
+
newRoot(fs26) {
|
|
10101
|
+
return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs26 });
|
|
10101
10102
|
}
|
|
10102
10103
|
/**
|
|
10103
10104
|
* Return true if the provided path string is an absolute path
|
|
@@ -10125,8 +10126,8 @@ var PathScurryPosix = (_class10 = class extends PathScurryBase {
|
|
|
10125
10126
|
/**
|
|
10126
10127
|
* @internal
|
|
10127
10128
|
*/
|
|
10128
|
-
newRoot(
|
|
10129
|
-
return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
10129
|
+
newRoot(fs26) {
|
|
10130
|
+
return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs26 });
|
|
10130
10131
|
}
|
|
10131
10132
|
/**
|
|
10132
10133
|
* Return true if the provided path string is an absolute path
|
|
@@ -12538,11 +12539,45 @@ function createBuildService(ctx) {
|
|
|
12538
12539
|
ignoreInitial: true
|
|
12539
12540
|
}
|
|
12540
12541
|
);
|
|
12542
|
+
const logWorkerEvent = (type, target, level = "info") => {
|
|
12543
|
+
if (!target) {
|
|
12544
|
+
return;
|
|
12545
|
+
}
|
|
12546
|
+
const relative3 = configService.relativeCwd(target);
|
|
12547
|
+
const message = `[workers:${type}] ${relative3}`;
|
|
12548
|
+
if (level === "success") {
|
|
12549
|
+
logger_default.success(message);
|
|
12550
|
+
} else {
|
|
12551
|
+
logger_default.info(message);
|
|
12552
|
+
}
|
|
12553
|
+
};
|
|
12541
12554
|
watcher2.on("all", (event, id) => {
|
|
12555
|
+
if (!id) {
|
|
12556
|
+
return;
|
|
12557
|
+
}
|
|
12542
12558
|
if (event === "add") {
|
|
12543
|
-
|
|
12559
|
+
logWorkerEvent(event, id, "success");
|
|
12544
12560
|
void devWorkers(workersDir);
|
|
12561
|
+
return;
|
|
12562
|
+
}
|
|
12563
|
+
logWorkerEvent(event, id);
|
|
12564
|
+
});
|
|
12565
|
+
watcher2.on("raw", (eventName, rawPath, details) => {
|
|
12566
|
+
if (eventName !== "rename") {
|
|
12567
|
+
return;
|
|
12568
|
+
}
|
|
12569
|
+
const candidate = typeof rawPath === "string" ? rawPath : rawPath && typeof rawPath.toString === "function" ? rawPath.toString() : "";
|
|
12570
|
+
if (!candidate) {
|
|
12571
|
+
return;
|
|
12572
|
+
}
|
|
12573
|
+
const baseDir = typeof details === "object" && details && "watchedPath" in details ? _nullishCoalesce(details.watchedPath, () => ( absWorkerRoot)) : absWorkerRoot;
|
|
12574
|
+
const resolved = _pathe2.default.isAbsolute(candidate) ? candidate : _pathe2.default.resolve(baseDir, candidate);
|
|
12575
|
+
const exists = actualFS.default.existsSync(resolved);
|
|
12576
|
+
if (exists) {
|
|
12577
|
+
logWorkerEvent("rename->add", resolved);
|
|
12578
|
+
return;
|
|
12545
12579
|
}
|
|
12580
|
+
logWorkerEvent("rename->unlink", resolved);
|
|
12546
12581
|
});
|
|
12547
12582
|
watcherService.sidecarWatcherMap.set(absWorkerRoot, {
|
|
12548
12583
|
close: () => watcher2.close()
|
|
@@ -20208,7 +20243,7 @@ function createOxcRuntimeSupport() {
|
|
|
20208
20243
|
if (helperName) {
|
|
20209
20244
|
const helperPath = id.startsWith(NULL_BYTE) ? _pathe2.default.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`) : id;
|
|
20210
20245
|
if (await _fsextra2.default.pathExists(helperPath)) {
|
|
20211
|
-
|
|
20246
|
+
logger_default.warn(`[weapp-vite] resolving oxc helper via Rolldown plugin: ${helperName}`);
|
|
20212
20247
|
return _fsextra2.default.readFile(helperPath, "utf8");
|
|
20213
20248
|
}
|
|
20214
20249
|
const fallback = fallbackHelpers[helperName];
|
|
@@ -20227,7 +20262,7 @@ function createOxcRuntimeSupport() {
|
|
|
20227
20262
|
return null;
|
|
20228
20263
|
}
|
|
20229
20264
|
if (source.includes("@oxc-project/runtime/helpers")) {
|
|
20230
|
-
|
|
20265
|
+
logger_default.warn(`[weapp-vite] resolveId intercepted: ${source}`);
|
|
20231
20266
|
}
|
|
20232
20267
|
const helperName = getOxcHelperName(source);
|
|
20233
20268
|
if (helperName) {
|
|
@@ -20244,7 +20279,7 @@ function createOxcRuntimeSupport() {
|
|
|
20244
20279
|
return null;
|
|
20245
20280
|
}
|
|
20246
20281
|
const helperPath = _pathe2.default.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`);
|
|
20247
|
-
|
|
20282
|
+
logger_default.warn(`[weapp-vite] resolving oxc helper via Vite plugin: ${helperName}`);
|
|
20248
20283
|
return _fsextra2.default.readFile(helperPath, "utf8");
|
|
20249
20284
|
}
|
|
20250
20285
|
};
|
|
@@ -20837,46 +20872,14 @@ _chunkWWFEREWVcjs.init_cjs_shims.call(void 0, );
|
|
|
20837
20872
|
|
|
20838
20873
|
|
|
20839
20874
|
|
|
20840
|
-
function
|
|
20841
|
-
|
|
20842
|
-
return [createAssetCollector(state)];
|
|
20843
|
-
}
|
|
20844
|
-
function createAssetCollector(state) {
|
|
20845
|
-
const { ctx } = state;
|
|
20846
|
-
const { configService } = ctx;
|
|
20847
|
-
return {
|
|
20848
|
-
name: "weapp-vite:asset",
|
|
20849
|
-
enforce: "pre",
|
|
20850
|
-
configResolved(config) {
|
|
20851
|
-
state.resolvedConfig = config;
|
|
20852
|
-
},
|
|
20853
|
-
buildStart() {
|
|
20854
|
-
if (!state.resolvedConfig) {
|
|
20855
|
-
state.pendingAssets = Promise.resolve([]);
|
|
20856
|
-
return;
|
|
20857
|
-
}
|
|
20858
|
-
state.pendingAssets = scanAssetFiles(configService, state.resolvedConfig);
|
|
20859
|
-
},
|
|
20860
|
-
async buildEnd() {
|
|
20861
|
-
const assets = await state.pendingAssets;
|
|
20862
|
-
if (!_optionalChain([assets, 'optionalAccess', _324 => _324.length])) {
|
|
20863
|
-
return;
|
|
20864
|
-
}
|
|
20865
|
-
for (const candidate of assets) {
|
|
20866
|
-
this.emitFile({
|
|
20867
|
-
type: "asset",
|
|
20868
|
-
fileName: configService.relativeAbsoluteSrcRoot(candidate.file),
|
|
20869
|
-
source: candidate.buffer
|
|
20870
|
-
});
|
|
20871
|
-
}
|
|
20872
|
-
}
|
|
20873
|
-
};
|
|
20875
|
+
function normalizeCopyGlobs(globs) {
|
|
20876
|
+
return Array.isArray(globs) ? globs : [];
|
|
20874
20877
|
}
|
|
20875
20878
|
function scanAssetFiles(configService, config) {
|
|
20876
20879
|
const weappViteConfig = configService.weappViteConfig;
|
|
20877
|
-
const include = normalizeCopyGlobs(_optionalChain([weappViteConfig, 'optionalAccess',
|
|
20878
|
-
const exclude = normalizeCopyGlobs(_optionalChain([weappViteConfig, 'optionalAccess',
|
|
20879
|
-
const filter3 = _nullishCoalesce(_optionalChain([weappViteConfig, 'optionalAccess',
|
|
20880
|
+
const include = normalizeCopyGlobs(_optionalChain([weappViteConfig, 'optionalAccess', _324 => _324.copy, 'optionalAccess', _325 => _325.include]));
|
|
20881
|
+
const exclude = normalizeCopyGlobs(_optionalChain([weappViteConfig, 'optionalAccess', _326 => _326.copy, 'optionalAccess', _327 => _327.exclude]));
|
|
20882
|
+
const filter3 = _nullishCoalesce(_optionalChain([weappViteConfig, 'optionalAccess', _328 => _328.copy, 'optionalAccess', _329 => _329.filter]), () => ( (() => true)));
|
|
20880
20883
|
const ignore = [
|
|
20881
20884
|
...defaultExcluded,
|
|
20882
20885
|
_pathe2.default.resolve(configService.cwd, `${config.build.outDir}/**/*`),
|
|
@@ -20916,8 +20919,40 @@ function scanAssetFiles(configService, config) {
|
|
|
20916
20919
|
);
|
|
20917
20920
|
});
|
|
20918
20921
|
}
|
|
20919
|
-
function
|
|
20920
|
-
|
|
20922
|
+
function createAssetCollector(state) {
|
|
20923
|
+
const { ctx } = state;
|
|
20924
|
+
const { configService } = ctx;
|
|
20925
|
+
return {
|
|
20926
|
+
name: "weapp-vite:asset",
|
|
20927
|
+
enforce: "pre",
|
|
20928
|
+
configResolved(config) {
|
|
20929
|
+
state.resolvedConfig = config;
|
|
20930
|
+
},
|
|
20931
|
+
buildStart() {
|
|
20932
|
+
if (!state.resolvedConfig) {
|
|
20933
|
+
state.pendingAssets = Promise.resolve([]);
|
|
20934
|
+
return;
|
|
20935
|
+
}
|
|
20936
|
+
state.pendingAssets = scanAssetFiles(configService, state.resolvedConfig);
|
|
20937
|
+
},
|
|
20938
|
+
async buildEnd() {
|
|
20939
|
+
const assets = await state.pendingAssets;
|
|
20940
|
+
if (!_optionalChain([assets, 'optionalAccess', _330 => _330.length])) {
|
|
20941
|
+
return;
|
|
20942
|
+
}
|
|
20943
|
+
for (const candidate of assets) {
|
|
20944
|
+
this.emitFile({
|
|
20945
|
+
type: "asset",
|
|
20946
|
+
fileName: configService.relativeAbsoluteSrcRoot(candidate.file),
|
|
20947
|
+
source: candidate.buffer
|
|
20948
|
+
});
|
|
20949
|
+
}
|
|
20950
|
+
}
|
|
20951
|
+
};
|
|
20952
|
+
}
|
|
20953
|
+
function asset(ctx) {
|
|
20954
|
+
const state = { ctx };
|
|
20955
|
+
return [createAssetCollector(state)];
|
|
20921
20956
|
}
|
|
20922
20957
|
|
|
20923
20958
|
// src/plugins/autoImport.ts
|
|
@@ -22843,22 +22878,6 @@ function createEntryLoader(options) {
|
|
|
22843
22878
|
_chunkWWFEREWVcjs.init_cjs_shims.call(void 0, );
|
|
22844
22879
|
|
|
22845
22880
|
|
|
22846
|
-
function createEntryNormalizer(configService) {
|
|
22847
|
-
return function normalizeEntry(entry, jsonPath) {
|
|
22848
|
-
if (/plugin:\/\//.test(entry)) {
|
|
22849
|
-
return entry;
|
|
22850
|
-
}
|
|
22851
|
-
const tokens = entry.split("/");
|
|
22852
|
-
if (tokens[0] && _shared.isObject.call(void 0, configService.packageJson.dependencies) && hasDependencyPrefix(configService.packageJson.dependencies, tokens)) {
|
|
22853
|
-
return `npm:${entry}`;
|
|
22854
|
-
}
|
|
22855
|
-
if (tokens[0] === "") {
|
|
22856
|
-
return entry.substring(1);
|
|
22857
|
-
}
|
|
22858
|
-
const normalized = resolveImportee2(entry, jsonPath, configService);
|
|
22859
|
-
return configService.relativeAbsoluteSrcRoot(normalized);
|
|
22860
|
-
};
|
|
22861
|
-
}
|
|
22862
22881
|
function resolveImportee2(importee, jsonPath, configService) {
|
|
22863
22882
|
let updated = importee;
|
|
22864
22883
|
if (jsonPath && Array.isArray(configService.aliasEntries)) {
|
|
@@ -22881,6 +22900,22 @@ function hasDependencyPrefix(dependencies, tokens) {
|
|
|
22881
22900
|
return true;
|
|
22882
22901
|
});
|
|
22883
22902
|
}
|
|
22903
|
+
function createEntryNormalizer(configService) {
|
|
22904
|
+
return function normalizeEntry(entry, jsonPath) {
|
|
22905
|
+
if (/plugin:\/\//.test(entry)) {
|
|
22906
|
+
return entry;
|
|
22907
|
+
}
|
|
22908
|
+
const tokens = entry.split("/");
|
|
22909
|
+
if (tokens[0] && _shared.isObject.call(void 0, configService.packageJson.dependencies) && hasDependencyPrefix(configService.packageJson.dependencies, tokens)) {
|
|
22910
|
+
return `npm:${entry}`;
|
|
22911
|
+
}
|
|
22912
|
+
if (tokens[0] === "") {
|
|
22913
|
+
return entry.substring(1);
|
|
22914
|
+
}
|
|
22915
|
+
const normalized = resolveImportee2(entry, jsonPath, configService);
|
|
22916
|
+
return configService.relativeAbsoluteSrcRoot(normalized);
|
|
22917
|
+
};
|
|
22918
|
+
}
|
|
22884
22919
|
|
|
22885
22920
|
// src/plugins/hooks/useLoadEntry/template.ts
|
|
22886
22921
|
_chunkWWFEREWVcjs.init_cjs_shims.call(void 0, );
|
|
@@ -22961,11 +22996,15 @@ _chunkWWFEREWVcjs.init_cjs_shims.call(void 0, );
|
|
|
22961
22996
|
|
|
22962
22997
|
|
|
22963
22998
|
var watchedCssExts = new Set(supportedCssLangs.map((ext2) => `.${ext2}`));
|
|
22999
|
+
var watchedTemplateExts = new Set(templateExtensions.map((ext2) => `.${ext2}`));
|
|
22964
23000
|
var configSuffixes = configExtensions.map((ext2) => `.${ext2}`);
|
|
22965
|
-
var sidecarSuffixes = [...configSuffixes, ...watchedCssExts];
|
|
23001
|
+
var sidecarSuffixes = [...configSuffixes, ...watchedCssExts, ...watchedTemplateExts];
|
|
22966
23002
|
var watchLimitErrorCodes = /* @__PURE__ */ new Set(["EMFILE", "ENOSPC"]);
|
|
22967
23003
|
var importProtocols = /^(?:https?:|data:|blob:|\/)/i;
|
|
22968
|
-
var cssImportRE = /@(import|wv-keep-import)\s+(?:url\()?['"]?([^'")\s]+)['"]?\)?/gi;
|
|
23004
|
+
var cssImportRE = /@(?:import|wv-keep-import)\s+(?:url\()?['"]?([^'")\s]+)['"]?\)?/gi;
|
|
23005
|
+
function isSidecarFile(filePath) {
|
|
23006
|
+
return sidecarSuffixes.some((suffix) => filePath.endsWith(suffix));
|
|
23007
|
+
}
|
|
22969
23008
|
function isWatchLimitError(error) {
|
|
22970
23009
|
if (!error || typeof error !== "object") {
|
|
22971
23010
|
return false;
|
|
@@ -23063,7 +23102,7 @@ async function extractCssImportDependencies(ctx, importer) {
|
|
|
23063
23102
|
if (!match2) {
|
|
23064
23103
|
break;
|
|
23065
23104
|
}
|
|
23066
|
-
const rawSpecifier = _optionalChain([match2, 'access', _362 => _362[
|
|
23105
|
+
const rawSpecifier = _optionalChain([match2, 'access', _362 => _362[1], 'optionalAccess', _363 => _363.trim, 'call', _364 => _364()]);
|
|
23067
23106
|
if (!rawSpecifier) {
|
|
23068
23107
|
continue;
|
|
23069
23108
|
}
|
|
@@ -23173,6 +23212,8 @@ async function invalidateEntryForSidecar(ctx, filePath, event = "update") {
|
|
|
23173
23212
|
scriptBasePath = filePath.slice(0, -configSuffix.length);
|
|
23174
23213
|
} else if (ext2 && watchedCssExts.has(ext2)) {
|
|
23175
23214
|
scriptBasePath = filePath.slice(0, -ext2.length);
|
|
23215
|
+
} else if (ext2 && watchedTemplateExts.has(ext2)) {
|
|
23216
|
+
scriptBasePath = filePath.slice(0, -ext2.length);
|
|
23176
23217
|
}
|
|
23177
23218
|
if (!scriptBasePath) {
|
|
23178
23219
|
return;
|
|
@@ -23193,6 +23234,7 @@ async function invalidateEntryForSidecar(ctx, filePath, event = "update") {
|
|
|
23193
23234
|
}
|
|
23194
23235
|
}
|
|
23195
23236
|
const isCssSidecar = Boolean(ext2 && watchedCssExts.has(ext2));
|
|
23237
|
+
const isTemplateSidecar = Boolean(ext2 && watchedTemplateExts.has(ext2));
|
|
23196
23238
|
const configService = ctx.configService;
|
|
23197
23239
|
const relativeSource = configService.relativeCwd(normalizedPath);
|
|
23198
23240
|
for (const target of touchedTargets) {
|
|
@@ -23208,7 +23250,7 @@ async function invalidateEntryForSidecar(ctx, filePath, event = "update") {
|
|
|
23208
23250
|
}
|
|
23209
23251
|
}
|
|
23210
23252
|
if (!touchedTargets.size && !touchedScripts.size) {
|
|
23211
|
-
if (event === "create" && isCssSidecar) {
|
|
23253
|
+
if (event === "create" && (isCssSidecar || isTemplateSidecar)) {
|
|
23212
23254
|
logger_default.info(`[sidecar:${event}] ${relativeSource} \u65B0\u589E\uFF0C\u4F46\u672A\u627E\u5230\u5F15\u7528\u65B9\uFF0C\u7B49\u5F85\u540E\u7EED\u5173\u8054`);
|
|
23213
23255
|
}
|
|
23214
23256
|
return;
|
|
@@ -23245,23 +23287,25 @@ function ensureSidecarWatcher(ctx, rootDir) {
|
|
|
23245
23287
|
if (isCssFile && (event === "create" || event === "update")) {
|
|
23246
23288
|
void extractCssImportDependencies(ctx, filePath);
|
|
23247
23289
|
}
|
|
23248
|
-
const
|
|
23290
|
+
const isDeleteEvent = event === "delete";
|
|
23291
|
+
const shouldInvalidate = event === "create" && ready || isDeleteEvent;
|
|
23249
23292
|
if (shouldInvalidate) {
|
|
23250
23293
|
void (async () => {
|
|
23251
23294
|
await invalidateEntryForSidecar(ctx, filePath, event);
|
|
23252
|
-
if (isCssFile &&
|
|
23295
|
+
if (isCssFile && isDeleteEvent) {
|
|
23253
23296
|
cleanupImporterGraph(ctx, filePath);
|
|
23254
23297
|
}
|
|
23255
23298
|
})();
|
|
23256
23299
|
return;
|
|
23257
23300
|
}
|
|
23258
|
-
if (isCssFile &&
|
|
23301
|
+
if (isCssFile && isDeleteEvent) {
|
|
23259
23302
|
cleanupImporterGraph(ctx, filePath);
|
|
23260
23303
|
}
|
|
23261
23304
|
};
|
|
23262
23305
|
const patterns = [
|
|
23263
23306
|
...configExtensions.map((ext2) => _pathe2.default.join(absRoot, `**/*.${ext2}`)),
|
|
23264
|
-
...supportedCssLangs.map((ext2) => _pathe2.default.join(absRoot, `**/*.${ext2}`))
|
|
23307
|
+
...supportedCssLangs.map((ext2) => _pathe2.default.join(absRoot, `**/*.${ext2}`)),
|
|
23308
|
+
...templateExtensions.map((ext2) => _pathe2.default.join(absRoot, `**/*.${ext2}`))
|
|
23265
23309
|
];
|
|
23266
23310
|
const watcher = esm_default.watch(patterns, {
|
|
23267
23311
|
ignoreInitial: false,
|
|
@@ -23271,11 +23315,15 @@ function ensureSidecarWatcher(ctx, rootDir) {
|
|
|
23271
23315
|
pollInterval: 20
|
|
23272
23316
|
}
|
|
23273
23317
|
});
|
|
23274
|
-
const forwardChange = (event, input) => {
|
|
23318
|
+
const forwardChange = (event, input, options) => {
|
|
23275
23319
|
if (!input) {
|
|
23276
23320
|
return;
|
|
23277
23321
|
}
|
|
23278
|
-
|
|
23322
|
+
const normalizedPath = _pathe2.default.normalize(input);
|
|
23323
|
+
if (!_optionalChain([options, 'optionalAccess', _365 => _365.silent])) {
|
|
23324
|
+
logger_default.info(`[watch:${event}] ${ctx.configService.relativeCwd(normalizedPath)}`);
|
|
23325
|
+
}
|
|
23326
|
+
handleSidecarChange(event, normalizedPath, isReady);
|
|
23279
23327
|
};
|
|
23280
23328
|
watcher.on("add", (path36) => forwardChange("create", path36));
|
|
23281
23329
|
watcher.on("change", (path36) => forwardChange("update", path36));
|
|
@@ -23290,7 +23338,11 @@ function ensureSidecarWatcher(ctx, rootDir) {
|
|
|
23290
23338
|
}
|
|
23291
23339
|
const baseDir = typeof details === "object" && details && "watchedPath" in details ? _nullishCoalesce(details.watchedPath, () => ( absRoot)) : absRoot;
|
|
23292
23340
|
const resolved = _pathe2.default.isAbsolute(candidate) ? candidate : _pathe2.default.resolve(baseDir, candidate);
|
|
23293
|
-
|
|
23341
|
+
const exists = actualFS.default.existsSync(resolved);
|
|
23342
|
+
const derivedEvent = exists ? "create" : "delete";
|
|
23343
|
+
const relativeResolved = ctx.configService.relativeCwd(resolved);
|
|
23344
|
+
logger_default.info(`[watch:rename->${derivedEvent}] ${relativeResolved}`);
|
|
23345
|
+
forwardChange(derivedEvent, resolved, { silent: true });
|
|
23294
23346
|
});
|
|
23295
23347
|
watcher.on("ready", () => {
|
|
23296
23348
|
isReady = true;
|
|
@@ -23300,16 +23352,13 @@ function ensureSidecarWatcher(ctx, rootDir) {
|
|
|
23300
23352
|
return;
|
|
23301
23353
|
}
|
|
23302
23354
|
const relativeRoot = ctx.configService.relativeCwd(absRoot);
|
|
23303
|
-
const code = _nullishCoalesce(_optionalChain([error, 'optionalAccess',
|
|
23355
|
+
const code = _nullishCoalesce(_optionalChain([error, 'optionalAccess', _366 => _366.code]), () => ( "UNKNOWN"));
|
|
23304
23356
|
logger_default.warn(`[watch] ${relativeRoot} \u76D1\u542C\u6570\u91CF\u8FBE\u5230\u4E0A\u9650 (${code})\uFF0C\u4FA7\u8F66\u6587\u4EF6\u76D1\u542C\u5DF2\u505C\u7528`);
|
|
23305
23357
|
});
|
|
23306
23358
|
sidecarWatcherMap.set(absRoot, {
|
|
23307
23359
|
close: () => void watcher.close()
|
|
23308
23360
|
});
|
|
23309
23361
|
}
|
|
23310
|
-
function isSidecarFile(filePath) {
|
|
23311
|
-
return sidecarSuffixes.some((suffix) => filePath.endsWith(suffix));
|
|
23312
|
-
}
|
|
23313
23362
|
|
|
23314
23363
|
// src/plugins/utils/parse.ts
|
|
23315
23364
|
_chunkWWFEREWVcjs.init_cjs_shims.call(void 0, );
|
|
@@ -23467,7 +23516,7 @@ function createCacheKey(options) {
|
|
|
23467
23516
|
return `${options.removeComment ? 1 : 0}|${options.transformEvent ? 1 : 0}`;
|
|
23468
23517
|
}
|
|
23469
23518
|
function getCachedResult(data2, cacheKey) {
|
|
23470
|
-
return _optionalChain([handleCache, 'access',
|
|
23519
|
+
return _optionalChain([handleCache, 'access', _367 => _367.get, 'call', _368 => _368(data2), 'optionalAccess', _369 => _369.get, 'call', _370 => _370(cacheKey)]);
|
|
23471
23520
|
}
|
|
23472
23521
|
function setCachedResult(data2, cacheKey, result) {
|
|
23473
23522
|
let cacheForToken = handleCache.get(data2);
|
|
@@ -23543,7 +23592,7 @@ function handleWxml(data2, options) {
|
|
|
23543
23592
|
if (shouldTransformInlineWxs) {
|
|
23544
23593
|
for (const { end, start, value } of inlineWxsTokens) {
|
|
23545
23594
|
const { result } = getCachedInlineWxsTransform(value);
|
|
23546
|
-
if (_optionalChain([result, 'optionalAccess',
|
|
23595
|
+
if (_optionalChain([result, 'optionalAccess', _371 => _371.code])) {
|
|
23547
23596
|
ms.update(start, end, `
|
|
23548
23597
|
${result.code}`);
|
|
23549
23598
|
}
|
|
@@ -23594,11 +23643,11 @@ function emitWxmlAssetsWithCache(options) {
|
|
|
23594
23643
|
});
|
|
23595
23644
|
const emittedFiles = [];
|
|
23596
23645
|
for (const { id, fileName, token } of currentPackageWxmls) {
|
|
23597
|
-
_optionalChain([runtime, 'access',
|
|
23646
|
+
_optionalChain([runtime, 'access', _372 => _372.addWatchFile, 'optionalCall', _373 => _373(id)]);
|
|
23598
23647
|
const deps = wxmlService.depsMap.get(id);
|
|
23599
23648
|
if (deps) {
|
|
23600
23649
|
for (const dep of deps) {
|
|
23601
|
-
_optionalChain([runtime, 'access',
|
|
23650
|
+
_optionalChain([runtime, 'access', _374 => _374.addWatchFile, 'optionalCall', _375 => _375(dep)]);
|
|
23602
23651
|
}
|
|
23603
23652
|
}
|
|
23604
23653
|
emittedFiles.push(fileName);
|
|
@@ -23694,7 +23743,7 @@ function createCoreLifecyclePlugin(state) {
|
|
|
23694
23743
|
buildService.invalidateIndependentOutput(independentRoot);
|
|
23695
23744
|
scanService.markIndependentDirty(independentRoot);
|
|
23696
23745
|
handledByIndependentWatcher = true;
|
|
23697
|
-
if (_optionalChain([independentMeta, 'optionalAccess',
|
|
23746
|
+
if (_optionalChain([independentMeta, 'optionalAccess', _376 => _376.watchSharedStyles]) !== false) {
|
|
23698
23747
|
invalidateSharedStyleCache();
|
|
23699
23748
|
}
|
|
23700
23749
|
}
|
|
@@ -23742,7 +23791,7 @@ function createCoreLifecyclePlugin(state) {
|
|
|
23742
23791
|
options.input = scannedInput;
|
|
23743
23792
|
},
|
|
23744
23793
|
async load(id) {
|
|
23745
|
-
_optionalChain([configService, 'access',
|
|
23794
|
+
_optionalChain([configService, 'access', _377 => _377.weappViteConfig, 'optionalAccess', _378 => _378.debug, 'optionalAccess', _379 => _379.load, 'optionalCall', _380 => _380(id, subPackageMeta)]);
|
|
23746
23795
|
const relativeBasename = _shared.removeExtensionDeep.call(void 0, configService.relativeAbsoluteSrcRoot(id));
|
|
23747
23796
|
if (isCSSRequest(id)) {
|
|
23748
23797
|
const parsed = parseRequest(id);
|
|
@@ -23756,7 +23805,7 @@ function createCoreLifecyclePlugin(state) {
|
|
|
23756
23805
|
}
|
|
23757
23806
|
return null;
|
|
23758
23807
|
}
|
|
23759
|
-
if (loadedEntrySet.has(id) || _optionalChain([subPackageMeta, 'optionalAccess',
|
|
23808
|
+
if (loadedEntrySet.has(id) || _optionalChain([subPackageMeta, 'optionalAccess', _381 => _381.entries, 'access', _382 => _382.includes, 'call', _383 => _383(relativeBasename)])) {
|
|
23760
23809
|
return await loadEntry.call(this, id, "component");
|
|
23761
23810
|
}
|
|
23762
23811
|
if (relativeBasename === "app") {
|
|
@@ -23787,8 +23836,8 @@ function createCoreLifecyclePlugin(state) {
|
|
|
23787
23836
|
return subPackageRoots.find((root) => filePath === root || filePath.startsWith(`${root}/`));
|
|
23788
23837
|
};
|
|
23789
23838
|
var matchSubPackage = matchSubPackage2;
|
|
23790
|
-
const sharedStrategy = _nullishCoalesce(_optionalChain([configService, 'access',
|
|
23791
|
-
const shouldLogChunks = _nullishCoalesce(_optionalChain([configService, 'access',
|
|
23839
|
+
const sharedStrategy = _nullishCoalesce(_optionalChain([configService, 'access', _384 => _384.weappViteConfig, 'optionalAccess', _385 => _385.chunks, 'optionalAccess', _386 => _386.sharedStrategy]), () => ( DEFAULT_SHARED_CHUNK_STRATEGY));
|
|
23840
|
+
const shouldLogChunks = _nullishCoalesce(_optionalChain([configService, 'access', _387 => _387.weappViteConfig, 'optionalAccess', _388 => _388.chunks, 'optionalAccess', _389 => _389.logOptimization]), () => ( true));
|
|
23792
23841
|
const subPackageRoots = Array.from(scanService.subPackageMap.keys()).filter(Boolean);
|
|
23793
23842
|
applySharedChunkStrategy.call(this, bundle, {
|
|
23794
23843
|
strategy: sharedStrategy,
|
|
@@ -23833,10 +23882,10 @@ function createCoreLifecyclePlugin(state) {
|
|
|
23833
23882
|
} : void 0
|
|
23834
23883
|
});
|
|
23835
23884
|
}
|
|
23836
|
-
if (_optionalChain([configService, 'access',
|
|
23885
|
+
if (_optionalChain([configService, 'access', _390 => _390.weappViteConfig, 'optionalAccess', _391 => _391.debug, 'optionalAccess', _392 => _392.watchFiles])) {
|
|
23837
23886
|
const watcherService = ctx.watcherService;
|
|
23838
|
-
const watcherRoot = _nullishCoalesce(_optionalChain([subPackageMeta, 'optionalAccess',
|
|
23839
|
-
const watcher = _optionalChain([watcherService, 'optionalAccess',
|
|
23887
|
+
const watcherRoot = _nullishCoalesce(_optionalChain([subPackageMeta, 'optionalAccess', _393 => _393.subPackage, 'access', _394 => _394.root]), () => ( "/"));
|
|
23888
|
+
const watcher = _optionalChain([watcherService, 'optionalAccess', _395 => _395.getRollupWatcher, 'call', _396 => _396(watcherRoot)]);
|
|
23840
23889
|
let watchFiles;
|
|
23841
23890
|
if (watcher && typeof watcher.getWatchFiles === "function") {
|
|
23842
23891
|
watchFiles = await watcher.getWatchFiles();
|
|
@@ -23850,7 +23899,7 @@ function createCoreLifecyclePlugin(state) {
|
|
|
23850
23899
|
}
|
|
23851
23900
|
},
|
|
23852
23901
|
buildEnd() {
|
|
23853
|
-
_optionalChain([debug2, 'optionalCall',
|
|
23902
|
+
_optionalChain([debug2, 'optionalCall', _397 => _397(`${subPackageMeta ? `\u72EC\u7ACB\u5206\u5305 ${subPackageMeta.subPackage.root}` : "\u4E3B\u5305"} ${Array.from(this.getModuleIds()).length} \u4E2A\u6A21\u5757\u88AB\u7F16\u8BD1`)]);
|
|
23854
23903
|
}
|
|
23855
23904
|
};
|
|
23856
23905
|
}
|
|
@@ -23934,7 +23983,7 @@ async function flushIndependentBuilds(state) {
|
|
|
23934
23983
|
}
|
|
23935
23984
|
const outputs = await Promise.all(pendingIndependentBuilds);
|
|
23936
23985
|
for (const { rollup } of outputs) {
|
|
23937
|
-
const bundleOutputs = Array.isArray(_optionalChain([rollup, 'optionalAccess',
|
|
23986
|
+
const bundleOutputs = Array.isArray(_optionalChain([rollup, 'optionalAccess', _398 => _398.output])) ? rollup.output : [];
|
|
23938
23987
|
for (const output of bundleOutputs) {
|
|
23939
23988
|
if (output.type === "chunk") {
|
|
23940
23989
|
this.emitFile({
|
|
@@ -23971,13 +24020,13 @@ function toPosixPath(value) {
|
|
|
23971
24020
|
var styleMatcherCache = /* @__PURE__ */ new WeakMap();
|
|
23972
24021
|
function collectSharedStyleEntries(ctx, configService) {
|
|
23973
24022
|
const map = /* @__PURE__ */ new Map();
|
|
23974
|
-
const registry = _optionalChain([ctx, 'access',
|
|
23975
|
-
if (!_optionalChain([registry, 'optionalAccess',
|
|
24023
|
+
const registry = _optionalChain([ctx, 'access', _399 => _399.scanService, 'optionalAccess', _400 => _400.subPackageMap]);
|
|
24024
|
+
if (!_optionalChain([registry, 'optionalAccess', _401 => _401.size])) {
|
|
23976
24025
|
return map;
|
|
23977
24026
|
}
|
|
23978
24027
|
const currentRoot = configService.currentSubPackageRoot;
|
|
23979
24028
|
for (const [root, meta] of registry.entries()) {
|
|
23980
|
-
if (!_optionalChain([meta, 'access',
|
|
24029
|
+
if (!_optionalChain([meta, 'access', _402 => _402.styleEntries, 'optionalAccess', _403 => _403.length])) {
|
|
23981
24030
|
continue;
|
|
23982
24031
|
}
|
|
23983
24032
|
if (currentRoot && root !== currentRoot) {
|
|
@@ -24022,12 +24071,12 @@ function getStyleMatcher(entry) {
|
|
|
24022
24071
|
if (cached) {
|
|
24023
24072
|
return cached;
|
|
24024
24073
|
}
|
|
24025
|
-
const includePatterns = _optionalChain([entry, 'access',
|
|
24026
|
-
const excludePatterns = _optionalChain([entry, 'access',
|
|
24074
|
+
const includePatterns = _optionalChain([entry, 'access', _404 => _404.include, 'optionalAccess', _405 => _405.length]) ? entry.include : ["**/*"];
|
|
24075
|
+
const excludePatterns = _optionalChain([entry, 'access', _406 => _406.exclude, 'optionalAccess', _407 => _407.length]) ? entry.exclude : void 0;
|
|
24027
24076
|
const matcher = {
|
|
24028
24077
|
include: _picomatch2.default.call(void 0, includePatterns, { dot: true })
|
|
24029
24078
|
};
|
|
24030
|
-
if (_optionalChain([excludePatterns, 'optionalAccess',
|
|
24079
|
+
if (_optionalChain([excludePatterns, 'optionalAccess', _408 => _408.length])) {
|
|
24031
24080
|
matcher.exclude = _picomatch2.default.call(void 0, excludePatterns, { dot: true });
|
|
24032
24081
|
}
|
|
24033
24082
|
styleMatcherCache.set(entry, matcher);
|
|
@@ -24132,7 +24181,7 @@ function injectSharedStyleImports(css2, modulePath, fileName, sharedStyles, conf
|
|
|
24132
24181
|
}
|
|
24133
24182
|
const normalizedFileName = toPosixPath(fileName);
|
|
24134
24183
|
const entries = findSharedStylesForModule(normalizedModule, normalizedFileName, sharedStyles);
|
|
24135
|
-
if (!_optionalChain([entries, 'optionalAccess',
|
|
24184
|
+
if (!_optionalChain([entries, 'optionalAccess', _409 => _409.length])) {
|
|
24136
24185
|
return css2;
|
|
24137
24186
|
}
|
|
24138
24187
|
const specifiers = resolveImportSpecifiers(fileName, entries);
|
|
@@ -24339,22 +24388,19 @@ _chunkWWFEREWVcjs.init_cjs_shims.call(void 0, );
|
|
|
24339
24388
|
|
|
24340
24389
|
var debug3 = createDebugger("weapp-vite:preflight");
|
|
24341
24390
|
var removePlugins = ["vite:build-import-analysis"];
|
|
24342
|
-
function preflight(ctx) {
|
|
24343
|
-
return [createPluginPruner(), createEnvSynchronizer(ctx)];
|
|
24344
|
-
}
|
|
24345
24391
|
function createPluginPruner() {
|
|
24346
24392
|
return {
|
|
24347
24393
|
name: "weapp-vite:preflight",
|
|
24348
24394
|
enforce: "pre",
|
|
24349
24395
|
configResolved(config) {
|
|
24350
|
-
if (!_optionalChain([config, 'access',
|
|
24396
|
+
if (!_optionalChain([config, 'access', _410 => _410.plugins, 'optionalAccess', _411 => _411.length])) {
|
|
24351
24397
|
return;
|
|
24352
24398
|
}
|
|
24353
24399
|
for (const removePlugin of removePlugins) {
|
|
24354
24400
|
const idx = config.plugins.findIndex((plugin) => plugin.name === removePlugin);
|
|
24355
24401
|
if (idx > -1) {
|
|
24356
24402
|
const [plugin] = config.plugins.splice(idx, 1);
|
|
24357
|
-
plugin && _optionalChain([debug3, 'optionalCall',
|
|
24403
|
+
plugin && _optionalChain([debug3, 'optionalCall', _412 => _412("remove plugin", plugin.name)]);
|
|
24358
24404
|
}
|
|
24359
24405
|
}
|
|
24360
24406
|
}
|
|
@@ -24374,6 +24420,9 @@ function createEnvSynchronizer({ configService }) {
|
|
|
24374
24420
|
}
|
|
24375
24421
|
};
|
|
24376
24422
|
}
|
|
24423
|
+
function preflight(ctx) {
|
|
24424
|
+
return [createPluginPruner(), createEnvSynchronizer(ctx)];
|
|
24425
|
+
}
|
|
24377
24426
|
|
|
24378
24427
|
// src/plugins/workers.ts
|
|
24379
24428
|
_chunkWWFEREWVcjs.init_cjs_shims.call(void 0, );
|
|
@@ -24381,11 +24430,25 @@ _chunkWWFEREWVcjs.init_cjs_shims.call(void 0, );
|
|
|
24381
24430
|
|
|
24382
24431
|
|
|
24383
24432
|
|
|
24384
|
-
function
|
|
24385
|
-
|
|
24386
|
-
|
|
24433
|
+
async function resolveWorkerEntry(ctx, entry) {
|
|
24434
|
+
const { configService, scanService } = ctx;
|
|
24435
|
+
const relativeEntryPath = _pathe2.default.join(scanService.workersDir, entry);
|
|
24436
|
+
const key = _shared.removeExtension.call(void 0, relativeEntryPath);
|
|
24437
|
+
const absoluteEntry = _pathe2.default.resolve(configService.absoluteSrcRoot, relativeEntryPath);
|
|
24438
|
+
if (isJsOrTs(entry)) {
|
|
24439
|
+
const exists = await _fsextra2.default.exists(absoluteEntry);
|
|
24440
|
+
if (!exists) {
|
|
24441
|
+
logger_default.warn(`\u5F15\u7528 worker: \`${configService.relativeCwd(relativeEntryPath)}\` \u4E0D\u5B58\u5728!`);
|
|
24442
|
+
return { key };
|
|
24443
|
+
}
|
|
24444
|
+
return { key, value: absoluteEntry };
|
|
24387
24445
|
}
|
|
24388
|
-
|
|
24446
|
+
const { path: discovered } = await findJsEntry(absoluteEntry);
|
|
24447
|
+
if (!discovered) {
|
|
24448
|
+
logger_default.warn(`\u5F15\u7528 worker: \`${configService.relativeCwd(relativeEntryPath)}\` \u4E0D\u5B58\u5728!`);
|
|
24449
|
+
return { key };
|
|
24450
|
+
}
|
|
24451
|
+
return { key, value: discovered };
|
|
24389
24452
|
}
|
|
24390
24453
|
function createWorkerBuildPlugin(ctx) {
|
|
24391
24454
|
const { configService, scanService } = ctx;
|
|
@@ -24393,8 +24456,8 @@ function createWorkerBuildPlugin(ctx) {
|
|
|
24393
24456
|
name: "weapp-vite:workers",
|
|
24394
24457
|
enforce: "pre",
|
|
24395
24458
|
async options(options) {
|
|
24396
|
-
const workerConfig = _optionalChain([configService, 'access',
|
|
24397
|
-
const entries = Array.isArray(_optionalChain([workerConfig, 'optionalAccess',
|
|
24459
|
+
const workerConfig = _optionalChain([configService, 'access', _413 => _413.weappViteConfig, 'optionalAccess', _414 => _414.worker]);
|
|
24460
|
+
const entries = Array.isArray(_optionalChain([workerConfig, 'optionalAccess', _415 => _415.entry])) ? workerConfig.entry : [_optionalChain([workerConfig, 'optionalAccess', _416 => _416.entry])];
|
|
24398
24461
|
const normalized = (await Promise.all(entries.filter(Boolean).map((entry) => resolveWorkerEntry(ctx, entry)))).filter((result) => Boolean(result.value)).reduce((acc, cur) => {
|
|
24399
24462
|
acc[cur.key] = cur.value;
|
|
24400
24463
|
return acc;
|
|
@@ -24418,25 +24481,11 @@ function createWorkerBuildPlugin(ctx) {
|
|
|
24418
24481
|
}
|
|
24419
24482
|
};
|
|
24420
24483
|
}
|
|
24421
|
-
|
|
24422
|
-
|
|
24423
|
-
|
|
24424
|
-
const key = _shared.removeExtension.call(void 0, relativeEntryPath);
|
|
24425
|
-
const absoluteEntry = _pathe2.default.resolve(configService.absoluteSrcRoot, relativeEntryPath);
|
|
24426
|
-
if (isJsOrTs(entry)) {
|
|
24427
|
-
const exists = await _fsextra2.default.exists(absoluteEntry);
|
|
24428
|
-
if (!exists) {
|
|
24429
|
-
logger_default.warn(`\u5F15\u7528 worker: \`${configService.relativeCwd(relativeEntryPath)}\` \u4E0D\u5B58\u5728!`);
|
|
24430
|
-
return { key };
|
|
24431
|
-
}
|
|
24432
|
-
return { key, value: absoluteEntry };
|
|
24433
|
-
}
|
|
24434
|
-
const { path: discovered } = await findJsEntry(absoluteEntry);
|
|
24435
|
-
if (!discovered) {
|
|
24436
|
-
logger_default.warn(`\u5F15\u7528 worker: \`${configService.relativeCwd(relativeEntryPath)}\` \u4E0D\u5B58\u5728!`);
|
|
24437
|
-
return { key };
|
|
24484
|
+
function workers(ctx) {
|
|
24485
|
+
if (!ctx.scanService.workersDir) {
|
|
24486
|
+
return [];
|
|
24438
24487
|
}
|
|
24439
|
-
return
|
|
24488
|
+
return [createWorkerBuildPlugin(ctx)];
|
|
24440
24489
|
}
|
|
24441
24490
|
|
|
24442
24491
|
// src/plugins/wxs.ts
|
|
@@ -24447,52 +24496,6 @@ _chunkWWFEREWVcjs.init_cjs_shims.call(void 0, );
|
|
|
24447
24496
|
var wxsCodeCache = new LRUCache({
|
|
24448
24497
|
max: 512
|
|
24449
24498
|
});
|
|
24450
|
-
function wxs(ctx) {
|
|
24451
|
-
const state = {
|
|
24452
|
-
ctx,
|
|
24453
|
-
wxsMap: /* @__PURE__ */ new Map()
|
|
24454
|
-
};
|
|
24455
|
-
return [createWxsPlugin(state)];
|
|
24456
|
-
}
|
|
24457
|
-
function createWxsPlugin(state) {
|
|
24458
|
-
const { ctx } = state;
|
|
24459
|
-
const { wxmlService } = ctx;
|
|
24460
|
-
return {
|
|
24461
|
-
name: "weapp-vite:wxs",
|
|
24462
|
-
enforce: "pre",
|
|
24463
|
-
buildStart() {
|
|
24464
|
-
state.wxsMap.clear();
|
|
24465
|
-
},
|
|
24466
|
-
async buildEnd() {
|
|
24467
|
-
await Promise.all(
|
|
24468
|
-
Array.from(wxmlService.tokenMap.entries()).map(([id, token]) => {
|
|
24469
|
-
return handleWxsDeps.call(
|
|
24470
|
-
// @ts-ignore rolldown context
|
|
24471
|
-
this,
|
|
24472
|
-
state,
|
|
24473
|
-
token.deps,
|
|
24474
|
-
id
|
|
24475
|
-
);
|
|
24476
|
-
})
|
|
24477
|
-
);
|
|
24478
|
-
for (const { emittedFile } of state.wxsMap.values()) {
|
|
24479
|
-
this.emitFile(emittedFile);
|
|
24480
|
-
}
|
|
24481
|
-
}
|
|
24482
|
-
};
|
|
24483
|
-
}
|
|
24484
|
-
async function handleWxsDeps(state, deps, absPath) {
|
|
24485
|
-
await Promise.all(
|
|
24486
|
-
deps.filter((dep) => dep.tagName === "wxs").map(async (dep) => {
|
|
24487
|
-
const arr = dep.value.match(/\.wxs(\.[jt]s)?$/);
|
|
24488
|
-
if (!jsExtensions.includes(dep.attrs.lang) && !arr) {
|
|
24489
|
-
return;
|
|
24490
|
-
}
|
|
24491
|
-
const wxsPath = _pathe2.default.resolve(_pathe2.default.dirname(absPath), dep.value);
|
|
24492
|
-
await transformWxsFile.call(this, state, wxsPath);
|
|
24493
|
-
})
|
|
24494
|
-
);
|
|
24495
|
-
}
|
|
24496
24499
|
async function transformWxsFile(state, wxsPath) {
|
|
24497
24500
|
const { ctx } = state;
|
|
24498
24501
|
const { configService } = ctx;
|
|
@@ -24511,7 +24514,7 @@ async function transformWxsFile(state, wxsPath) {
|
|
|
24511
24514
|
const { result, importees } = transformWxsCode(rawCode, {
|
|
24512
24515
|
filename: wxsPath
|
|
24513
24516
|
});
|
|
24514
|
-
if (typeof _optionalChain([result, 'optionalAccess',
|
|
24517
|
+
if (typeof _optionalChain([result, 'optionalAccess', _417 => _417.code]) === "string") {
|
|
24515
24518
|
code = result.code;
|
|
24516
24519
|
}
|
|
24517
24520
|
const dirname5 = _pathe2.default.dirname(wxsPath);
|
|
@@ -24539,18 +24542,64 @@ async function transformWxsFile(state, wxsPath) {
|
|
|
24539
24542
|
});
|
|
24540
24543
|
wxsCodeCache.set(rawCode, code);
|
|
24541
24544
|
}
|
|
24545
|
+
async function handleWxsDeps(state, deps, absPath) {
|
|
24546
|
+
await Promise.all(
|
|
24547
|
+
deps.filter((dep) => dep.tagName === "wxs").map(async (dep) => {
|
|
24548
|
+
const arr = dep.value.match(/\.wxs(\.[jt]s)?$/);
|
|
24549
|
+
if (!jsExtensions.includes(dep.attrs.lang) && !arr) {
|
|
24550
|
+
return;
|
|
24551
|
+
}
|
|
24552
|
+
const wxsPath = _pathe2.default.resolve(_pathe2.default.dirname(absPath), dep.value);
|
|
24553
|
+
await transformWxsFile.call(this, state, wxsPath);
|
|
24554
|
+
})
|
|
24555
|
+
);
|
|
24556
|
+
}
|
|
24557
|
+
function createWxsPlugin(state) {
|
|
24558
|
+
const { ctx } = state;
|
|
24559
|
+
const { wxmlService } = ctx;
|
|
24560
|
+
return {
|
|
24561
|
+
name: "weapp-vite:wxs",
|
|
24562
|
+
enforce: "pre",
|
|
24563
|
+
buildStart() {
|
|
24564
|
+
state.wxsMap.clear();
|
|
24565
|
+
},
|
|
24566
|
+
async buildEnd() {
|
|
24567
|
+
await Promise.all(
|
|
24568
|
+
Array.from(wxmlService.tokenMap.entries()).map(([id, token]) => {
|
|
24569
|
+
return handleWxsDeps.call(
|
|
24570
|
+
// @ts-ignore rolldown context
|
|
24571
|
+
this,
|
|
24572
|
+
state,
|
|
24573
|
+
token.deps,
|
|
24574
|
+
id
|
|
24575
|
+
);
|
|
24576
|
+
})
|
|
24577
|
+
);
|
|
24578
|
+
for (const { emittedFile } of state.wxsMap.values()) {
|
|
24579
|
+
this.emitFile(emittedFile);
|
|
24580
|
+
}
|
|
24581
|
+
}
|
|
24582
|
+
};
|
|
24583
|
+
}
|
|
24584
|
+
function wxs(ctx) {
|
|
24585
|
+
const state = {
|
|
24586
|
+
ctx,
|
|
24587
|
+
wxsMap: /* @__PURE__ */ new Map()
|
|
24588
|
+
};
|
|
24589
|
+
return [createWxsPlugin(state)];
|
|
24590
|
+
}
|
|
24542
24591
|
|
|
24543
24592
|
// src/plugins/index.ts
|
|
24544
24593
|
var RUNTIME_PLUGINS_SYMBOL = Symbol.for("weapp-runtime:plugins");
|
|
24545
24594
|
function attachRuntimePlugins(ctx, plugins) {
|
|
24546
24595
|
const runtimePlugins = ctx[RUNTIME_PLUGINS_SYMBOL];
|
|
24547
|
-
if (!_optionalChain([runtimePlugins, 'optionalAccess',
|
|
24596
|
+
if (!_optionalChain([runtimePlugins, 'optionalAccess', _418 => _418.length])) {
|
|
24548
24597
|
return plugins;
|
|
24549
24598
|
}
|
|
24550
24599
|
return [...runtimePlugins, ...plugins];
|
|
24551
24600
|
}
|
|
24552
24601
|
function applyInspect(ctx, plugins) {
|
|
24553
|
-
const inspectOptions = _optionalChain([ctx, 'access',
|
|
24602
|
+
const inspectOptions = _optionalChain([ctx, 'access', _419 => _419.configService, 'access', _420 => _420.weappViteConfig, 'optionalAccess', _421 => _421.debug, 'optionalAccess', _422 => _422.inspect]);
|
|
24554
24603
|
if (!inspectOptions) {
|
|
24555
24604
|
return plugins;
|
|
24556
24605
|
}
|
|
@@ -24641,7 +24690,7 @@ function createMergeFactories(options) {
|
|
|
24641
24690
|
const currentOptions = getOptions2();
|
|
24642
24691
|
applyRuntimePlatform("miniprogram");
|
|
24643
24692
|
const external = [];
|
|
24644
|
-
if (_optionalChain([currentOptions, 'access',
|
|
24693
|
+
if (_optionalChain([currentOptions, 'access', _423 => _423.packageJson, 'optionalAccess', _424 => _424.dependencies])) {
|
|
24645
24694
|
external.push(
|
|
24646
24695
|
...Object.keys(currentOptions.packageJson.dependencies).map((pkg) => {
|
|
24647
24696
|
return new RegExp(`^${pkg.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")}(\\/|$)`);
|
|
@@ -24656,7 +24705,7 @@ function createMergeFactories(options) {
|
|
|
24656
24705
|
const watchInclude = [
|
|
24657
24706
|
_pathe2.default.join(currentOptions.cwd, currentOptions.srcRoot, "**")
|
|
24658
24707
|
];
|
|
24659
|
-
const pluginRootConfig = _optionalChain([currentOptions, 'access',
|
|
24708
|
+
const pluginRootConfig = _optionalChain([currentOptions, 'access', _425 => _425.config, 'access', _426 => _426.weapp, 'optionalAccess', _427 => _427.pluginRoot]);
|
|
24660
24709
|
if (pluginRootConfig) {
|
|
24661
24710
|
const absolutePluginRoot = _pathe2.default.resolve(currentOptions.cwd, pluginRootConfig);
|
|
24662
24711
|
const relativeToSrc = _pathe2.default.relative(
|
|
@@ -24716,7 +24765,7 @@ function createMergeFactories(options) {
|
|
|
24716
24765
|
);
|
|
24717
24766
|
inlineConfig.logLevel = "info";
|
|
24718
24767
|
injectBuiltinAliases(inlineConfig);
|
|
24719
|
-
const currentRoot = _optionalChain([subPackageMeta, 'optionalAccess',
|
|
24768
|
+
const currentRoot = _optionalChain([subPackageMeta, 'optionalAccess', _428 => _428.subPackage, 'access', _429 => _429.root]);
|
|
24720
24769
|
setOptions({
|
|
24721
24770
|
...currentOptions,
|
|
24722
24771
|
currentSubPackageRoot: currentRoot
|
|
@@ -24727,7 +24776,7 @@ function createMergeFactories(options) {
|
|
|
24727
24776
|
ensureConfigService();
|
|
24728
24777
|
const currentOptions = getOptions2();
|
|
24729
24778
|
const web = currentOptions.weappWeb;
|
|
24730
|
-
if (!_optionalChain([web, 'optionalAccess',
|
|
24779
|
+
if (!_optionalChain([web, 'optionalAccess', _430 => _430.enabled])) {
|
|
24731
24780
|
return void 0;
|
|
24732
24781
|
}
|
|
24733
24782
|
applyRuntimePlatform("web");
|
|
@@ -24818,7 +24867,7 @@ function createConfigService(ctx) {
|
|
|
24818
24867
|
defineEnv[key] = value;
|
|
24819
24868
|
}
|
|
24820
24869
|
function getDefineImportMetaEnv() {
|
|
24821
|
-
const mpPlatform = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
24870
|
+
const mpPlatform = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _431 => _431.platform]), () => ( DEFAULT_MP_PLATFORM));
|
|
24822
24871
|
const resolvedPlatform = _nullishCoalesce(defineEnv.PLATFORM, () => ( mpPlatform));
|
|
24823
24872
|
const env = {
|
|
24824
24873
|
PLATFORM: resolvedPlatform,
|
|
@@ -24834,7 +24883,7 @@ function createConfigService(ctx) {
|
|
|
24834
24883
|
}
|
|
24835
24884
|
function applyRuntimePlatform(runtime) {
|
|
24836
24885
|
const isWeb = runtime === "web";
|
|
24837
|
-
const mpPlatform = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
24886
|
+
const mpPlatform = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _432 => _432.platform]), () => ( DEFAULT_MP_PLATFORM));
|
|
24838
24887
|
const resolvedPlatform = isWeb ? "web" : mpPlatform;
|
|
24839
24888
|
setDefineEnv("PLATFORM", resolvedPlatform);
|
|
24840
24889
|
setDefineEnv("IS_WEB", isWeb);
|
|
@@ -24945,10 +24994,10 @@ function createConfigService(ctx) {
|
|
|
24945
24994
|
return options.srcRoot;
|
|
24946
24995
|
},
|
|
24947
24996
|
get pluginRoot() {
|
|
24948
|
-
return _optionalChain([options, 'access',
|
|
24997
|
+
return _optionalChain([options, 'access', _433 => _433.config, 'access', _434 => _434.weapp, 'optionalAccess', _435 => _435.pluginRoot]);
|
|
24949
24998
|
},
|
|
24950
24999
|
get absolutePluginRoot() {
|
|
24951
|
-
if (_optionalChain([options, 'access',
|
|
25000
|
+
if (_optionalChain([options, 'access', _436 => _436.config, 'access', _437 => _437.weapp, 'optionalAccess', _438 => _438.pluginRoot])) {
|
|
24952
25001
|
return _pathe2.default.resolve(options.cwd, options.config.weapp.pluginRoot);
|
|
24953
25002
|
}
|
|
24954
25003
|
},
|
|
@@ -24978,7 +25027,7 @@ function createConfigService(ctx) {
|
|
|
24978
25027
|
},
|
|
24979
25028
|
relativeAbsoluteSrcRoot(p) {
|
|
24980
25029
|
const absoluteSrcRoot = _pathe2.default.resolve(options.cwd, options.srcRoot);
|
|
24981
|
-
const pluginRootConfig = _optionalChain([options, 'access',
|
|
25030
|
+
const pluginRootConfig = _optionalChain([options, 'access', _439 => _439.config, 'access', _440 => _440.weapp, 'optionalAccess', _441 => _441.pluginRoot]);
|
|
24982
25031
|
if (pluginRootConfig) {
|
|
24983
25032
|
const absolutePluginRoot = _pathe2.default.resolve(options.cwd, pluginRootConfig);
|
|
24984
25033
|
const relativeToPlugin = _pathe2.default.relative(absolutePluginRoot, p);
|
|
@@ -25030,10 +25079,10 @@ function createJsonService(ctx) {
|
|
|
25030
25079
|
}
|
|
25031
25080
|
let resultJson;
|
|
25032
25081
|
if (/app\.json(?:\.[jt]s)?$/.test(filepath)) {
|
|
25033
|
-
await _optionalChain([ctx, 'access',
|
|
25082
|
+
await _optionalChain([ctx, 'access', _442 => _442.autoRoutesService, 'optionalAccess', _443 => _443.ensureFresh, 'call', _444 => _444()]);
|
|
25034
25083
|
}
|
|
25035
25084
|
if (/\.json\.[jt]s$/.test(filepath)) {
|
|
25036
|
-
const routesReference = _optionalChain([ctx, 'access',
|
|
25085
|
+
const routesReference = _optionalChain([ctx, 'access', _445 => _445.autoRoutesService, 'optionalAccess', _446 => _446.getReference, 'call', _447 => _447()]);
|
|
25037
25086
|
const fallbackRoutes = _nullishCoalesce(routesReference, () => ( { pages: [], entries: [], subPackages: [] }));
|
|
25038
25087
|
const routesModule = {
|
|
25039
25088
|
routes: fallbackRoutes,
|
|
@@ -25082,7 +25131,7 @@ function createJsonService(ctx) {
|
|
|
25082
25131
|
return resultJson;
|
|
25083
25132
|
} catch (error) {
|
|
25084
25133
|
logger_default.error(`\u6B8B\u7834\u7684JSON\u6587\u4EF6: ${filepath}`);
|
|
25085
|
-
_optionalChain([debug, 'optionalCall',
|
|
25134
|
+
_optionalChain([debug, 'optionalCall', _448 => _448(error)]);
|
|
25086
25135
|
}
|
|
25087
25136
|
}
|
|
25088
25137
|
function resolve8(entry) {
|
|
@@ -25137,7 +25186,7 @@ function createNpmService(ctx) {
|
|
|
25137
25186
|
if (!ctx.configService) {
|
|
25138
25187
|
throw new Error("configService must be initialized before writing npm cache");
|
|
25139
25188
|
}
|
|
25140
|
-
if (_optionalChain([ctx, 'access',
|
|
25189
|
+
if (_optionalChain([ctx, 'access', _449 => _449.configService, 'access', _450 => _450.weappViteConfig, 'optionalAccess', _451 => _451.npm, 'optionalAccess', _452 => _452.cache])) {
|
|
25141
25190
|
await _fsextra2.default.outputJSON(getDependenciesCacheFilePath(root), {
|
|
25142
25191
|
hash: dependenciesCacheHash()
|
|
25143
25192
|
});
|
|
@@ -25150,7 +25199,7 @@ function createNpmService(ctx) {
|
|
|
25150
25199
|
}
|
|
25151
25200
|
}
|
|
25152
25201
|
async function checkDependenciesCacheOutdate(root) {
|
|
25153
|
-
if (_optionalChain([ctx, 'access',
|
|
25202
|
+
if (_optionalChain([ctx, 'access', _453 => _453.configService, 'optionalAccess', _454 => _454.weappViteConfig, 'optionalAccess', _455 => _455.npm, 'optionalAccess', _456 => _456.cache])) {
|
|
25154
25203
|
const json = await readDependenciesCache(root);
|
|
25155
25204
|
if (_shared.isObject.call(void 0, json)) {
|
|
25156
25205
|
return dependenciesCacheHash() !== json.hash;
|
|
@@ -25183,7 +25232,7 @@ function createNpmService(ctx) {
|
|
|
25183
25232
|
target: "es6",
|
|
25184
25233
|
external: []
|
|
25185
25234
|
});
|
|
25186
|
-
const resolvedOptions = _optionalChain([ctx, 'access',
|
|
25235
|
+
const resolvedOptions = _optionalChain([ctx, 'access', _457 => _457.configService, 'optionalAccess', _458 => _458.weappViteConfig, 'optionalAccess', _459 => _459.npm, 'optionalAccess', _460 => _460.buildOptions, 'optionalCall', _461 => _461(
|
|
25187
25236
|
mergedOptions,
|
|
25188
25237
|
{ name, entry }
|
|
25189
25238
|
)]);
|
|
@@ -25283,7 +25332,7 @@ function createNpmService(ctx) {
|
|
|
25283
25332
|
throw new Error("configService must be initialized before resolving npm relation list");
|
|
25284
25333
|
}
|
|
25285
25334
|
let packNpmRelationList = [];
|
|
25286
|
-
if (_optionalChain([ctx, 'access',
|
|
25335
|
+
if (_optionalChain([ctx, 'access', _462 => _462.configService, 'access', _463 => _463.projectConfig, 'access', _464 => _464.setting, 'optionalAccess', _465 => _465.packNpmManually]) && Array.isArray(ctx.configService.projectConfig.setting.packNpmRelationList)) {
|
|
25287
25336
|
packNpmRelationList = ctx.configService.projectConfig.setting.packNpmRelationList;
|
|
25288
25337
|
} else {
|
|
25289
25338
|
packNpmRelationList = [
|
|
@@ -25296,10 +25345,10 @@ function createNpmService(ctx) {
|
|
|
25296
25345
|
return packNpmRelationList;
|
|
25297
25346
|
}
|
|
25298
25347
|
async function build3(options) {
|
|
25299
|
-
if (!_optionalChain([ctx, 'access',
|
|
25348
|
+
if (!_optionalChain([ctx, 'access', _466 => _466.configService, 'optionalAccess', _467 => _467.weappViteConfig, 'optionalAccess', _468 => _468.npm, 'optionalAccess', _469 => _469.enable])) {
|
|
25300
25349
|
return;
|
|
25301
25350
|
}
|
|
25302
|
-
_optionalChain([debug, 'optionalCall',
|
|
25351
|
+
_optionalChain([debug, 'optionalCall', _470 => _470("buildNpm start")]);
|
|
25303
25352
|
const packNpmRelationList = getPackNpmRelationList();
|
|
25304
25353
|
const [mainRelation, ...subRelations] = packNpmRelationList;
|
|
25305
25354
|
const packageJsonPath = _pathe2.default.resolve(ctx.configService.cwd, mainRelation.packageJsonPath);
|
|
@@ -25374,7 +25423,7 @@ function createNpmService(ctx) {
|
|
|
25374
25423
|
}
|
|
25375
25424
|
}
|
|
25376
25425
|
}
|
|
25377
|
-
_optionalChain([debug, 'optionalCall',
|
|
25426
|
+
_optionalChain([debug, 'optionalCall', _471 => _471("buildNpm end")]);
|
|
25378
25427
|
}
|
|
25379
25428
|
return {
|
|
25380
25429
|
getDependenciesCacheFilePath,
|
|
@@ -25418,7 +25467,7 @@ var TimeoutError = (_class16 = class _TimeoutError extends Error {
|
|
|
25418
25467
|
__init36() {this.name = "TimeoutError"}
|
|
25419
25468
|
constructor(message, options) {
|
|
25420
25469
|
super(message, options);_class16.prototype.__init36.call(this);;
|
|
25421
|
-
_optionalChain([Error, 'access',
|
|
25470
|
+
_optionalChain([Error, 'access', _472 => _472.captureStackTrace, 'optionalCall', _473 => _473(this, _TimeoutError)]);
|
|
25422
25471
|
}
|
|
25423
25472
|
}, _class16);
|
|
25424
25473
|
var getAbortedReason = (signal) => _nullishCoalesce(signal.reason, () => ( new DOMException("This operation was aborted.", "AbortError")));
|
|
@@ -25436,7 +25485,7 @@ function pTimeout(promise, options) {
|
|
|
25436
25485
|
if (typeof milliseconds !== "number" || Math.sign(milliseconds) !== 1) {
|
|
25437
25486
|
throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${milliseconds}\``);
|
|
25438
25487
|
}
|
|
25439
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
25488
|
+
if (_optionalChain([signal, 'optionalAccess', _474 => _474.aborted])) {
|
|
25440
25489
|
reject(getAbortedReason(signal));
|
|
25441
25490
|
return;
|
|
25442
25491
|
}
|
|
@@ -25534,7 +25583,7 @@ var PriorityQueue = class {
|
|
|
25534
25583
|
}
|
|
25535
25584
|
dequeue() {
|
|
25536
25585
|
const item = this.#queue.shift();
|
|
25537
|
-
return _optionalChain([item, 'optionalAccess',
|
|
25586
|
+
return _optionalChain([item, 'optionalAccess', _475 => _475.run]);
|
|
25538
25587
|
}
|
|
25539
25588
|
filter(options) {
|
|
25540
25589
|
return this.#queue.filter((element) => element.priority === options.priority).map((element) => element.run);
|
|
@@ -25595,10 +25644,10 @@ var PQueue = class extends import_index2.default {
|
|
|
25595
25644
|
...options
|
|
25596
25645
|
};
|
|
25597
25646
|
if (!(typeof options.intervalCap === "number" && options.intervalCap >= 1)) {
|
|
25598
|
-
throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${_nullishCoalesce(_optionalChain([options, 'access',
|
|
25647
|
+
throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${_nullishCoalesce(_optionalChain([options, 'access', _476 => _476.intervalCap, 'optionalAccess', _477 => _477.toString, 'call', _478 => _478()]), () => ( ""))}\` (${typeof options.intervalCap})`);
|
|
25599
25648
|
}
|
|
25600
25649
|
if (options.interval === void 0 || !(Number.isFinite(options.interval) && options.interval >= 0)) {
|
|
25601
|
-
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${_nullishCoalesce(_optionalChain([options, 'access',
|
|
25650
|
+
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${_nullishCoalesce(_optionalChain([options, 'access', _479 => _479.interval, 'optionalAccess', _480 => _480.toString, 'call', _481 => _481()]), () => ( ""))}\` (${typeof options.interval})`);
|
|
25602
25651
|
}
|
|
25603
25652
|
this.#carryoverIntervalCount = _nullishCoalesce(_nullishCoalesce(options.carryoverIntervalCount, () => ( options.carryoverConcurrencyCount)), () => ( false));
|
|
25604
25653
|
this.#isIntervalIgnored = options.intervalCap === Number.POSITIVE_INFINITY || options.interval === 0;
|
|
@@ -25805,7 +25854,7 @@ var PQueue = class extends import_index2.default {
|
|
|
25805
25854
|
});
|
|
25806
25855
|
try {
|
|
25807
25856
|
try {
|
|
25808
|
-
_optionalChain([options, 'access',
|
|
25857
|
+
_optionalChain([options, 'access', _482 => _482.signal, 'optionalAccess', _483 => _483.throwIfAborted, 'call', _484 => _484()]);
|
|
25809
25858
|
} catch (error) {
|
|
25810
25859
|
if (!this.#isIntervalIgnored) {
|
|
25811
25860
|
this.#intervalCount--;
|
|
@@ -26178,7 +26227,7 @@ var FileCache = class {
|
|
|
26178
26227
|
return true;
|
|
26179
26228
|
}
|
|
26180
26229
|
const cachedMtime = this.mtimeMap.get(id);
|
|
26181
|
-
const nextSignature = _optionalChain([options, 'optionalAccess',
|
|
26230
|
+
const nextSignature = _optionalChain([options, 'optionalAccess', _485 => _485.content]) !== void 0 ? createSignature(options.content) : void 0;
|
|
26182
26231
|
const updateSignature = () => {
|
|
26183
26232
|
if (nextSignature !== void 0) {
|
|
26184
26233
|
this.signatureMap.set(id, nextSignature);
|
|
@@ -26413,7 +26462,7 @@ function coerceStyleConfig(entry) {
|
|
|
26413
26462
|
if (!entry || typeof entry !== "object") {
|
|
26414
26463
|
return void 0;
|
|
26415
26464
|
}
|
|
26416
|
-
const source = _optionalChain([entry, 'access',
|
|
26465
|
+
const source = _optionalChain([entry, 'access', _486 => _486.source, 'optionalAccess', _487 => _487.toString, 'call', _488 => _488(), 'access', _489 => _489.trim, 'call', _490 => _490()]);
|
|
26417
26466
|
if (!source) {
|
|
26418
26467
|
return void 0;
|
|
26419
26468
|
}
|
|
@@ -26589,7 +26638,7 @@ function normalizeSubPackageStyleEntries(styles, subPackage, configService) {
|
|
|
26589
26638
|
if (!service) {
|
|
26590
26639
|
return void 0;
|
|
26591
26640
|
}
|
|
26592
|
-
const root = _optionalChain([subPackage, 'access',
|
|
26641
|
+
const root = _optionalChain([subPackage, 'access', _491 => _491.root, 'optionalAccess', _492 => _492.trim, 'call', _493 => _493()]);
|
|
26593
26642
|
if (!root) {
|
|
26594
26643
|
return void 0;
|
|
26595
26644
|
}
|
|
@@ -26697,7 +26746,7 @@ function createScanService(ctx) {
|
|
|
26697
26746
|
if (!ctx.configService) {
|
|
26698
26747
|
throw new Error("configService must be initialized before scanning subpackages");
|
|
26699
26748
|
}
|
|
26700
|
-
const json = _optionalChain([scanState, 'access',
|
|
26749
|
+
const json = _optionalChain([scanState, 'access', _494 => _494.appEntry, 'optionalAccess', _495 => _495.json]);
|
|
26701
26750
|
if (scanState.isDirty || subPackageMap.size === 0) {
|
|
26702
26751
|
subPackageMap.clear();
|
|
26703
26752
|
independentSubPackageMap.clear();
|
|
@@ -26715,15 +26764,15 @@ function createScanService(ctx) {
|
|
|
26715
26764
|
subPackage,
|
|
26716
26765
|
entries: resolveSubPackageEntries(subPackage)
|
|
26717
26766
|
};
|
|
26718
|
-
const subPackageConfig = _optionalChain([ctx, 'access',
|
|
26719
|
-
meta.subPackage.dependencies = _optionalChain([subPackageConfig, 'optionalAccess',
|
|
26720
|
-
meta.subPackage.inlineConfig = _optionalChain([subPackageConfig, 'optionalAccess',
|
|
26767
|
+
const subPackageConfig = _optionalChain([ctx, 'access', _496 => _496.configService, 'access', _497 => _497.weappViteConfig, 'optionalAccess', _498 => _498.subPackages, 'optionalAccess', _499 => _499[subPackage.root]]);
|
|
26768
|
+
meta.subPackage.dependencies = _optionalChain([subPackageConfig, 'optionalAccess', _500 => _500.dependencies]);
|
|
26769
|
+
meta.subPackage.inlineConfig = _optionalChain([subPackageConfig, 'optionalAccess', _501 => _501.inlineConfig]);
|
|
26721
26770
|
meta.styleEntries = normalizeSubPackageStyleEntries(
|
|
26722
|
-
_optionalChain([subPackageConfig, 'optionalAccess',
|
|
26771
|
+
_optionalChain([subPackageConfig, 'optionalAccess', _502 => _502.styles]),
|
|
26723
26772
|
subPackage,
|
|
26724
26773
|
ctx.configService
|
|
26725
26774
|
);
|
|
26726
|
-
meta.watchSharedStyles = _nullishCoalesce(_optionalChain([subPackageConfig, 'optionalAccess',
|
|
26775
|
+
meta.watchSharedStyles = _nullishCoalesce(_optionalChain([subPackageConfig, 'optionalAccess', _503 => _503.watchSharedStyles]), () => ( true));
|
|
26727
26776
|
metas.push(meta);
|
|
26728
26777
|
if (subPackage.root) {
|
|
26729
26778
|
subPackageMap.set(subPackage.root, meta);
|
|
@@ -26779,11 +26828,11 @@ function createScanService(ctx) {
|
|
|
26779
26828
|
loadSubPackages,
|
|
26780
26829
|
isMainPackageFileName,
|
|
26781
26830
|
get workersOptions() {
|
|
26782
|
-
return _optionalChain([scanState, 'access',
|
|
26831
|
+
return _optionalChain([scanState, 'access', _504 => _504.appEntry, 'optionalAccess', _505 => _505.json, 'optionalAccess', _506 => _506.workers]);
|
|
26783
26832
|
},
|
|
26784
26833
|
get workersDir() {
|
|
26785
|
-
const workersOptions = _optionalChain([scanState, 'access',
|
|
26786
|
-
return typeof workersOptions === "object" ? _optionalChain([workersOptions, 'optionalAccess',
|
|
26834
|
+
const workersOptions = _optionalChain([scanState, 'access', _507 => _507.appEntry, 'optionalAccess', _508 => _508.json, 'optionalAccess', _509 => _509.workers]);
|
|
26835
|
+
return typeof workersOptions === "object" ? _optionalChain([workersOptions, 'optionalAccess', _510 => _510.path]) : workersOptions;
|
|
26787
26836
|
},
|
|
26788
26837
|
markDirty() {
|
|
26789
26838
|
scanState.isDirty = true;
|
|
@@ -26830,7 +26879,7 @@ function createWatcherService(ctx) {
|
|
|
26830
26879
|
},
|
|
26831
26880
|
setRollupWatcher(watcher, root = "/") {
|
|
26832
26881
|
const oldWatcher = rollupWatcherMap.get(root);
|
|
26833
|
-
_optionalChain([oldWatcher, 'optionalAccess',
|
|
26882
|
+
_optionalChain([oldWatcher, 'optionalAccess', _511 => _511.close, 'call', _512 => _512()]);
|
|
26834
26883
|
rollupWatcherMap.set(root, watcher);
|
|
26835
26884
|
},
|
|
26836
26885
|
closeAll() {
|
|
@@ -26843,7 +26892,7 @@ function createWatcherService(ctx) {
|
|
|
26843
26892
|
});
|
|
26844
26893
|
});
|
|
26845
26894
|
sidecarWatcherMap.clear();
|
|
26846
|
-
void _optionalChain([ctx, 'access',
|
|
26895
|
+
void _optionalChain([ctx, 'access', _513 => _513.webService, 'optionalAccess', _514 => _514.close, 'call', _515 => _515(), 'access', _516 => _516.catch, 'call', _517 => _517(() => {
|
|
26847
26896
|
})]);
|
|
26848
26897
|
},
|
|
26849
26898
|
close(root = "/") {
|
|
@@ -26859,7 +26908,7 @@ function createWatcherService(ctx) {
|
|
|
26859
26908
|
sidecarWatcherMap.delete(root);
|
|
26860
26909
|
}
|
|
26861
26910
|
if (rollupWatcherMap.size === 0 && sidecarWatcherMap.size === 0) {
|
|
26862
|
-
void _optionalChain([ctx, 'access',
|
|
26911
|
+
void _optionalChain([ctx, 'access', _518 => _518.webService, 'optionalAccess', _519 => _519.close, 'call', _520 => _520(), 'access', _521 => _521.catch, 'call', _522 => _522(() => {
|
|
26863
26912
|
})]);
|
|
26864
26913
|
}
|
|
26865
26914
|
}
|
|
@@ -26872,7 +26921,7 @@ function createWatcherServicePlugin(ctx) {
|
|
|
26872
26921
|
name: "weapp-runtime:watcher-service",
|
|
26873
26922
|
closeBundle() {
|
|
26874
26923
|
const configService = ctx.configService;
|
|
26875
|
-
const isWatchMode = _optionalChain([configService, 'optionalAccess',
|
|
26924
|
+
const isWatchMode = _optionalChain([configService, 'optionalAccess', _523 => _523.isDev]) || Boolean(_optionalChain([configService, 'optionalAccess', _524 => _524.inlineConfig, 'optionalAccess', _525 => _525.build, 'optionalAccess', _526 => _526.watch]));
|
|
26876
26925
|
if (!isWatchMode) {
|
|
26877
26926
|
service.closeAll();
|
|
26878
26927
|
}
|
|
@@ -26889,10 +26938,10 @@ function createWebService(ctx) {
|
|
|
26889
26938
|
}
|
|
26890
26939
|
let devServer;
|
|
26891
26940
|
function isEnabled() {
|
|
26892
|
-
return Boolean(_optionalChain([ctx, 'access',
|
|
26941
|
+
return Boolean(_optionalChain([ctx, 'access', _527 => _527.configService, 'optionalAccess', _528 => _528.weappWebConfig, 'optionalAccess', _529 => _529.enabled]));
|
|
26893
26942
|
}
|
|
26894
26943
|
async function startDevServer() {
|
|
26895
|
-
if (!_optionalChain([ctx, 'access',
|
|
26944
|
+
if (!_optionalChain([ctx, 'access', _530 => _530.configService, 'optionalAccess', _531 => _531.isDev])) {
|
|
26896
26945
|
return void 0;
|
|
26897
26946
|
}
|
|
26898
26947
|
if (!isEnabled()) {
|
|
@@ -26901,7 +26950,7 @@ function createWebService(ctx) {
|
|
|
26901
26950
|
if (devServer) {
|
|
26902
26951
|
return devServer;
|
|
26903
26952
|
}
|
|
26904
|
-
const inlineConfig = _optionalChain([ctx, 'access',
|
|
26953
|
+
const inlineConfig = _optionalChain([ctx, 'access', _532 => _532.configService, 'optionalAccess', _533 => _533.mergeWeb, 'call', _534 => _534()]);
|
|
26905
26954
|
if (!inlineConfig) {
|
|
26906
26955
|
return void 0;
|
|
26907
26956
|
}
|
|
@@ -26914,7 +26963,7 @@ function createWebService(ctx) {
|
|
|
26914
26963
|
if (!isEnabled()) {
|
|
26915
26964
|
return void 0;
|
|
26916
26965
|
}
|
|
26917
|
-
const inlineConfig = _optionalChain([ctx, 'access',
|
|
26966
|
+
const inlineConfig = _optionalChain([ctx, 'access', _535 => _535.configService, 'optionalAccess', _536 => _536.mergeWeb, 'call', _537 => _537()]);
|
|
26918
26967
|
if (!inlineConfig) {
|
|
26919
26968
|
return void 0;
|
|
26920
26969
|
}
|
|
@@ -26944,7 +26993,7 @@ function createWebServicePlugin(ctx) {
|
|
|
26944
26993
|
return {
|
|
26945
26994
|
name: "weapp-runtime:web-service",
|
|
26946
26995
|
async closeBundle() {
|
|
26947
|
-
if (!_optionalChain([ctx, 'access',
|
|
26996
|
+
if (!_optionalChain([ctx, 'access', _538 => _538.configService, 'optionalAccess', _539 => _539.isDev])) {
|
|
26948
26997
|
await service.close();
|
|
26949
26998
|
}
|
|
26950
26999
|
}
|
|
@@ -29593,7 +29642,7 @@ function createWxmlService(ctx) {
|
|
|
29593
29642
|
return set3;
|
|
29594
29643
|
}
|
|
29595
29644
|
function clearAll() {
|
|
29596
|
-
const currentRoot = _optionalChain([ctx, 'access',
|
|
29645
|
+
const currentRoot = _optionalChain([ctx, 'access', _540 => _540.configService, 'optionalAccess', _541 => _541.currentSubPackageRoot]);
|
|
29597
29646
|
if (!currentRoot) {
|
|
29598
29647
|
depsMap.clear();
|
|
29599
29648
|
tokenMap.clear();
|
|
@@ -29652,7 +29701,7 @@ function createWxmlService(ctx) {
|
|
|
29652
29701
|
if (!ctx.configService) {
|
|
29653
29702
|
throw new Error("configService must be initialized before scanning wxml");
|
|
29654
29703
|
}
|
|
29655
|
-
const wxmlConfig = _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
29704
|
+
const wxmlConfig = _nullishCoalesce(_optionalChain([ctx, 'access', _542 => _542.configService, 'access', _543 => _543.weappViteConfig, 'optionalAccess', _544 => _544.wxml]), () => ( _optionalChain([ctx, 'access', _545 => _545.configService, 'access', _546 => _546.weappViteConfig, 'optionalAccess', _547 => _547.enhance, 'optionalAccess', _548 => _548.wxml])));
|
|
29656
29705
|
return scanWxml(wxml, {
|
|
29657
29706
|
platform: ctx.configService.platform,
|
|
29658
29707
|
...wxmlConfig === true ? {} : wxmlConfig
|