weapp-vite 6.11.3 → 6.11.4

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.
@@ -1,6 +1,6 @@
1
- import { i as getCompilerContext } from "./createContext-DzgL8nmB.mjs";
1
+ import { i as getCompilerContext } from "./createContext-D2PataOA.mjs";
2
2
  import "./logger-gutcwWKE.mjs";
3
- import "./file-D6dnM58g.mjs";
3
+ import "./file-hsZ3VxaT.mjs";
4
4
  //#region src/auto-routes.ts
5
5
  const ROUTE_RUNTIME_OVERRIDE_KEY = Symbol.for("weapp-vite.route-runtime");
6
6
  function createGetter(resolver) {
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { c as normalizeMiniPlatform, d as SHARED_CHUNK_VIRTUAL_PREFIX, f as resolveWeappConfigFile, g as isPathInside, h as createCjsConfigLoadError, l as resolveMiniPlatform, m as getProjectConfigFileName, n as syncProjectSupportFiles, o as formatBytes, p as checkRuntime, r as syncManagedTsconfigBootstrapFiles, s as DEFAULT_MP_PLATFORM, t as createCompilerContext, u as createSharedBuildConfig } from "./createContext-DzgL8nmB.mjs";
1
+ import { c as normalizeMiniPlatform, d as SHARED_CHUNK_VIRTUAL_PREFIX, f as resolveWeappConfigFile, g as isPathInside, h as createCjsConfigLoadError, l as resolveMiniPlatform, m as getProjectConfigFileName, n as syncProjectSupportFiles, o as formatBytes, p as checkRuntime, r as syncManagedTsconfigBootstrapFiles, s as DEFAULT_MP_PLATFORM, t as createCompilerContext, u as createSharedBuildConfig } from "./createContext-D2PataOA.mjs";
2
2
  import { r as logger_default, t as colors } from "./logger-gutcwWKE.mjs";
3
- import { f as VERSION } from "./file-D6dnM58g.mjs";
3
+ import { f as VERSION } from "./file-hsZ3VxaT.mjs";
4
4
  import { resolveWeappMcpConfig, startWeappViteMcpServer } from "./mcp.mjs";
5
5
  import { defu } from "@weapp-core/shared";
6
6
  import path, { posix } from "pathe";
@@ -500,12 +500,24 @@ interface WeappDebugConfig {
500
500
  watchFiles?: (watchFiles: string[], subPackageMeta?: SubPackageMetaValue) => void;
501
501
  resolveId?: (id: string, subPackageMeta?: SubPackageMetaValue) => void;
502
502
  load?: (id: string, subPackageMeta?: SubPackageMetaValue) => void;
503
+ vueTransformTiming?: (timing: {
504
+ id: string;
505
+ isPage: boolean;
506
+ totalMs: number;
507
+ stages: Record<string, number>;
508
+ }) => void;
503
509
  inspect?: WrapPluginOptions;
504
510
  }
505
511
  /**
506
512
  * @description weapp-vite 主配置
507
513
  */
508
514
  interface WeappViteConfig {
515
+ /**
516
+ * 开发态是否在启动构建前清空输出目录。
517
+ * 开发态默认 `true`,设置为 `false` 可跳过每次 dev 启动前的全量输出目录清理。
518
+ * 生产构建始终会清空输出目录。
519
+ */
520
+ cleanOutputsInDev?: boolean;
509
521
  /**
510
522
  * 应用入口目录(`app.json` 所在目录)。
511
523
  */
package/dist/config.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { Cn as WeappViteHostMeta, Dn as isWeappViteHost, En as createWeappViteHostMeta, On as resolveWeappViteHostMeta, Sn as WEAPP_VITE_HOST_NAME, Tn as applyWeappViteHostMeta, _ as definePageJson, a as UserConfigFnNoEnvPlain, c as UserConfigFnPromise, d as Component, et as WeappViteConfig, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, l as defineConfig, m as Theme, n as UserConfigExport, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, wn as WeappViteRuntime, y as defineThemeJson } from "./config-mYISi4CS.mjs";
1
+ import { Cn as WeappViteHostMeta, Dn as isWeappViteHost, En as createWeappViteHostMeta, On as resolveWeappViteHostMeta, Sn as WEAPP_VITE_HOST_NAME, Tn as applyWeappViteHostMeta, _ as definePageJson, a as UserConfigFnNoEnvPlain, c as UserConfigFnPromise, d as Component, et as WeappViteConfig, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, l as defineConfig, m as Theme, n as UserConfigExport, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, wn as WeappViteRuntime, y as defineThemeJson } from "./config-DFy0eHs2.mjs";
2
2
  export { App, Component, Page, Sitemap, Theme, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnNoEnv, UserConfigFnNoEnvPlain, UserConfigFnObject, UserConfigFnObjectPlain, UserConfigFnPromise, WEAPP_VITE_HOST_NAME, WeappViteConfig, WeappViteHostMeta, WeappViteRuntime, applyWeappViteHostMeta, createWeappViteHostMeta, defineAppJson, defineComponentJson, defineConfig, definePageJson, defineSitemapJson, defineThemeJson, isWeappViteHost, resolveWeappViteHostMeta };
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-twds-ZHy.mjs";
2
2
  import { n as applyWeappViteHostMeta } from "./pluginHost-SJdl15d3.mjs";
3
3
  import { n as configureLogger, r as logger_default } from "./logger-gutcwWKE.mjs";
4
- import { _ as vueExtensions, a as findJsEntry, c as findVueEntry, d as touch, g as templateExtensions, h as supportedCssLangs, i as findCssEntry, l as isJsOrTs, m as jsExtensions, n as extractConfigFromVue, o as findJsonEntry, p as configExtensions, s as findTemplateEntry, t as changeFileExtension, u as isTemplate } from "./file-D6dnM58g.mjs";
4
+ import { _ as vueExtensions, a as findJsEntry, c as findVueEntry, d as touch, g as templateExtensions, h as supportedCssLangs, i as findCssEntry, l as isJsOrTs, m as jsExtensions, n as extractConfigFromVue, o as findJsonEntry, p as configExtensions, s as findTemplateEntry, t as changeFileExtension, u as isTemplate } from "./file-hsZ3VxaT.mjs";
5
5
  import { createRequire, isBuiltin } from "node:module";
6
6
  import { addExtension, defu, get, isEmptyObject, isObject, objectHash, removeExtension, removeExtensionDeep, set } from "@weapp-core/shared";
7
7
  import { LRUCache } from "lru-cache";
@@ -30,8 +30,7 @@ import os from "node:os";
30
30
  import { getPackageInfo, getPackageInfoSync, resolveModule } from "local-pkg";
31
31
  import { spawn } from "node:child_process";
32
32
  import { Buffer } from "node:buffer";
33
- import fs$1, { readFile } from "node:fs/promises";
34
- import { rimraf } from "rimraf";
33
+ import fs$1, { readFile, readdir, rm } from "node:fs/promises";
35
34
  import fs$2, { existsSync } from "node:fs";
36
35
  import chokidar from "chokidar";
37
36
  import { detect } from "package-manager-detector/detect";
@@ -7833,16 +7832,27 @@ function resolvePreservedNpmDirNames(configService) {
7833
7832
  if (configService.platform === "alipay") return new Set([getAlipayNpmDistDirName(configService.weappViteConfig?.npm?.alipayNpmMode)]);
7834
7833
  return new Set(["miniprogram_npm"]);
7835
7834
  }
7835
+ async function removeDirectoryEntries(root, options = {}) {
7836
+ const entries = await readdir(root, { withFileTypes: true }).catch((error) => {
7837
+ if (error?.code === "ENOENT") return [];
7838
+ throw error;
7839
+ });
7840
+ const deletedPaths = [];
7841
+ await Promise.all(entries.map(async (entry) => {
7842
+ if (options.preserveDirNames?.has(entry.name)) return;
7843
+ const absolutePath = path.resolve(root, entry.name);
7844
+ await rm(absolutePath, {
7845
+ recursive: true,
7846
+ force: true
7847
+ });
7848
+ deletedPaths.push(absolutePath);
7849
+ }));
7850
+ return deletedPaths.sort();
7851
+ }
7836
7852
  async function cleanOutputs(configService) {
7837
7853
  if (configService.mpDistRoot) {
7838
7854
  const preservedNpmDirNames = resolvePreservedNpmDirNames(configService);
7839
- const deletedFilePaths = await rimraf([path.resolve(configService.outDir, "*"), path.resolve(configService.outDir, ".*")], {
7840
- glob: true,
7841
- filter: (filePath) => {
7842
- for (const dirName of preservedNpmDirNames) if (filePath.includes(`${path.sep}${dirName}`)) return false;
7843
- return true;
7844
- }
7845
- });
7855
+ const deletedFilePaths = await removeDirectoryEntries(configService.outDir, { preserveDirNames: preservedNpmDirNames });
7846
7856
  debug$2?.("deletedFilePaths", deletedFilePaths);
7847
7857
  logger_default.success(`已清空 ${configService.mpDistRoot} 目录`);
7848
7858
  }
@@ -7850,7 +7860,7 @@ async function cleanOutputs(configService) {
7850
7860
  if (pluginOutputRoot) {
7851
7861
  const relativeToOutDir = path.relative(configService.outDir, pluginOutputRoot);
7852
7862
  if (!(relativeToOutDir === "" || !relativeToOutDir.startsWith("..") && !path.isAbsolute(relativeToOutDir))) {
7853
- const deletedPluginFiles = await rimraf([path.resolve(pluginOutputRoot, "*"), path.resolve(pluginOutputRoot, ".*")], { glob: true });
7863
+ const deletedPluginFiles = await removeDirectoryEntries(pluginOutputRoot);
7854
7864
  debug$2?.("deletedPluginOutput", deletedPluginFiles);
7855
7865
  logger_default.success(`已清空 ${configService.relativeCwd(pluginOutputRoot)} 目录`);
7856
7866
  }
@@ -8069,7 +8079,7 @@ function createBuildService(ctx) {
8069
8079
  return await runProd(target);
8070
8080
  }
8071
8081
  async function buildEntry(options) {
8072
- await cleanOutputs(configService);
8082
+ if (!configService.isDev || configService.weappViteConfig.cleanOutputsInDev !== false) await cleanOutputs(configService);
8073
8083
  const pluginOnly = configService.pluginOnly;
8074
8084
  const multiPlatformConfig = configService.weappViteConfig.multiPlatform;
8075
8085
  const isMultiPlatformEnabled = Boolean(multiPlatformConfig && (typeof multiPlatformConfig !== "object" || multiPlatformConfig.enabled !== false));
@@ -9094,6 +9104,7 @@ const LEADING_DOT_SLASH_RE$1 = /^\.\//;
9094
9104
  const LEADING_SLASHES_RE$2 = /^\/+/;
9095
9105
  const GLOB_WILDCARD_RE = /[*?[{]/;
9096
9106
  const TRAILING_SLASHES_RE$1 = /\/+$/;
9107
+ const AUTO_IMPORT_WATCHER_KEY = "__auto-import-vue-watcher__";
9097
9108
  function isEnabledOutputOption(option) {
9098
9109
  if (option === true) return true;
9099
9110
  if (typeof option === "string") return option.trim().length > 0;
@@ -9148,22 +9159,53 @@ async function findAutoImportCandidates(state, globs) {
9148
9159
  pathSeparator: "/"
9149
9160
  }).withFullPaths().globWithOptions(globs.map((pattern) => path.resolve(configService.absoluteSrcRoot, pattern)), { ignore }).crawl(configService.absoluteSrcRoot).withPromise();
9150
9161
  }
9151
- function registerAutoImportWatchTargets(state, globs, registrar) {
9152
- if (!globs?.length || typeof registrar?.addWatchFile !== "function") return;
9162
+ function registerAutoImportWatchTargets(state, globs, registrar, options = {}) {
9153
9163
  const { configService } = state.ctx;
9154
- const watchTargets = new Set([configService.absoluteSrcRoot]);
9155
- for (const pattern of globs) {
9164
+ if (!configService) return /* @__PURE__ */ new Set();
9165
+ const watchTargets = /* @__PURE__ */ new Set();
9166
+ if (options.includeSrcRoot !== false) watchTargets.add(configService.absoluteSrcRoot);
9167
+ for (const pattern of globs ?? []) {
9156
9168
  const normalizedPattern = toPosixPath(pattern).replace(LEADING_DOT_SLASH_RE$1, "").replace(LEADING_SLASHES_RE$2, "");
9157
9169
  const wildcardIndex = normalizedPattern.search(GLOB_WILDCARD_RE);
9158
9170
  const cleanedBase = (wildcardIndex >= 0 ? normalizedPattern.slice(0, wildcardIndex) : normalizedPattern).replace(TRAILING_SLASHES_RE$1, "");
9159
9171
  if (!cleanedBase) continue;
9160
9172
  watchTargets.add(path.resolve(configService.absoluteSrcRoot, cleanedBase));
9161
9173
  }
9174
+ if (typeof registrar?.addWatchFile !== "function") return watchTargets;
9162
9175
  for (const target of watchTargets) registrar.addWatchFile(target);
9176
+ return watchTargets;
9163
9177
  }
9164
9178
  function createAutoImportPlugin(state) {
9165
9179
  const { ctx } = state;
9166
9180
  const { configService, autoImportService } = ctx;
9181
+ let fileWatcherStarted = false;
9182
+ function startAutoImportFileWatcher(globs) {
9183
+ if (fileWatcherStarted || !configService?.isDev || !globs?.length) return;
9184
+ const watchTargets = registerAutoImportWatchTargets(state, globs, void 0, { includeSrcRoot: false });
9185
+ if (!watchTargets?.size) return;
9186
+ const watcher = chokidar.watch([...watchTargets], {
9187
+ ignoreInitial: true,
9188
+ persistent: true,
9189
+ awaitWriteFinish: {
9190
+ stabilityThreshold: 80,
9191
+ pollInterval: 20
9192
+ }
9193
+ });
9194
+ watcher.on("add", (filePath) => {
9195
+ if (!matchesAutoImportGlobs(ctx, filePath)) return;
9196
+ logger_default.info(`[auto-import:watch] 新增组件文件 ${configService.relativeCwd(filePath)}`);
9197
+ autoImportService.registerPotentialComponent(filePath);
9198
+ });
9199
+ watcher.on("unlink", (filePath) => {
9200
+ if (!matchesAutoImportGlobs(ctx, filePath)) return;
9201
+ logger_default.info(`[auto-import:watch] 删除组件文件 ${configService.relativeCwd(filePath)}`);
9202
+ autoImportService.removePotentialComponent(filePath);
9203
+ });
9204
+ const sidecarWatcherMap = ctx.runtimeState?.watcher?.sidecarWatcherMap;
9205
+ if (!sidecarWatcherMap) return;
9206
+ sidecarWatcherMap.set(AUTO_IMPORT_WATCHER_KEY, { close: () => void watcher.close() });
9207
+ fileWatcherStarted = true;
9208
+ }
9167
9209
  return {
9168
9210
  name: "weapp-vite:auto-import",
9169
9211
  enforce: "pre",
@@ -9175,6 +9217,7 @@ function createAutoImportPlugin(state) {
9175
9217
  const autoImportConfig = getAutoImportConfig(configService);
9176
9218
  const globs = autoImportConfig?.globs;
9177
9219
  registerAutoImportWatchTargets(state, globs, this);
9220
+ startAutoImportFileWatcher(globs);
9178
9221
  const globsKey = globs?.join("\0") ?? "";
9179
9222
  if (globsKey !== state.lastGlobsKey) {
9180
9223
  state.initialScanDone = false;
@@ -9187,13 +9230,7 @@ function createAutoImportPlugin(state) {
9187
9230
  }
9188
9231
  return;
9189
9232
  }
9190
- if (state.initialScanDone) {
9191
- if (configService?.isDev) {
9192
- const files = await findAutoImportCandidates(state, globs);
9193
- await Promise.all(files.map((file) => autoImportService.registerPotentialComponent(file)));
9194
- }
9195
- return;
9196
- }
9233
+ if (state.initialScanDone) return;
9197
9234
  autoImportService.reset();
9198
9235
  const files = await findAutoImportCandidates(state, globs);
9199
9236
  await Promise.all(files.map((file) => autoImportService.registerPotentialComponent(file)));
@@ -9366,11 +9403,10 @@ function createAutoRoutesPlugin(ctx) {
9366
9403
  return;
9367
9404
  }
9368
9405
  if (!isPagesRelatedPath(id)) return;
9369
- if (event === "create" || event === "delete" || event === "update") await service.handleFileChange(id, "rename");
9406
+ if (event === "create" || event === "delete") await service.handleFileChange(id, "rename");
9370
9407
  },
9371
9408
  async handleHotUpdate(context) {
9372
9409
  if (resolvedConfig?.command === "serve") if (service.isRouteFile(context.file)) await service.handleFileChange(context.file, "update");
9373
- else if (isPagesRelatedPath(context.file)) await service.handleFileChange(context.file, "rename");
9374
9410
  else return;
9375
9411
  else if (!service.isRouteFile(context.file) && !isPagesRelatedPath(context.file)) return;
9376
9412
  const virtualModule = context.server.moduleGraph.getModuleById(RESOLVED_VIRTUAL_ID);
@@ -9726,6 +9762,14 @@ function mergeLayoutUsingComponents(config, layouts) {
9726
9762
  for (const layout of layouts) next = mergeLayoutUsingComponent(next, layout.tagName, layout.importPath);
9727
9763
  return next;
9728
9764
  }
9765
+ function hasDynamicLayoutTemplateWrapper(template, plan) {
9766
+ if (!plan.layouts.length || !template.startsWith("<block wx:if=")) return false;
9767
+ return plan.layouts.every((layout, index) => {
9768
+ const condition = plan.currentLayout?.layoutName === layout.layoutName ? `{{!__wv_page_layout_name || __wv_page_layout_name === '${layout.layoutName}'}}` : `{{__wv_page_layout_name === '${layout.layoutName}'}}`;
9769
+ const directive = index === 0 ? "wx:if" : "wx:elif";
9770
+ return template.includes(`<block ${directive}="${condition}"><${layout.tagName}`);
9771
+ }) && template.includes("<block wx:else>");
9772
+ }
9729
9773
  function applyPageLayout(result, _filename, layout) {
9730
9774
  if (!layout || !result.template) return result;
9731
9775
  const serializedProps = serializeLayoutProps(layout.props);
@@ -9743,6 +9787,11 @@ function applyPageLayout(result, _filename, layout) {
9743
9787
  function applyPageLayoutPlan(result, filename, plan) {
9744
9788
  if (!plan || !result.template) return result;
9745
9789
  if (!plan.dynamicSwitch) return applyPageLayout(result, filename, plan.currentLayout);
9790
+ if (hasDynamicLayoutTemplateWrapper(result.template, plan)) {
9791
+ result.script = injectLayoutBindingComputed(result.script, plan.currentLayout?.props);
9792
+ result.config = mergeLayoutUsingComponents(result.config, plan.layouts);
9793
+ return result;
9794
+ }
9746
9795
  result.template = buildDynamicLayoutTemplate(result.template, plan.currentLayout, plan.layouts, plan.dynamicPropKeys);
9747
9796
  result.script = injectLayoutBindingComputed(result.script, plan.currentLayout?.props);
9748
9797
  result.config = mergeLayoutUsingComponents(result.config, plan.layouts);
@@ -9937,6 +9986,9 @@ const PATH_SEGMENT_RE = /[\\/]/;
9937
9986
  const TRAILING_INDEX_RE = /\/index$/;
9938
9987
  const LEADING_SLASHES_RE$1 = /^\/+/;
9939
9988
  const ROUTE_RULE_GLOB_TOKEN_RE = /[*?[\]{}()!+@]/g;
9989
+ const resolvedLayoutsCache = /* @__PURE__ */ new Map();
9990
+ const PAGE_META_HINT = "definePageMeta";
9991
+ const SET_PAGE_LAYOUT_HINT = "setPageLayout";
9940
9992
  function normalizePageRouteCandidates(filename, configService) {
9941
9993
  const fullPath = `/${toPosixPath(configService.relativeOutputPath(removeFileExtension(filename))).replace(LEADING_SLASHES_RE$1, "")}`;
9942
9994
  const shorthand = (() => {
@@ -10048,21 +10100,42 @@ async function collectLayoutFiles(root) {
10048
10100
  return layoutMap;
10049
10101
  }
10050
10102
  async function resolveAllLayouts(configService) {
10051
- const layoutFiles = await collectLayoutFiles(path.join(configService.absoluteSrcRoot, "layouts"));
10052
- const resolvedLayouts = [];
10053
- for (const layoutFile of layoutFiles.values()) {
10054
- const importPath = usingComponentFromResolvedFile(layoutFile.file, configService);
10055
- if (!importPath) continue;
10056
- resolvedLayouts.push({
10057
- ...layoutFile,
10058
- importPath
10059
- });
10103
+ const cacheKey = normalizeComparablePath(configService.absoluteSrcRoot);
10104
+ const cached = resolvedLayoutsCache.get(cacheKey);
10105
+ if (cached) return await cached;
10106
+ const task = (async () => {
10107
+ const layoutFiles = await collectLayoutFiles(path.join(configService.absoluteSrcRoot, "layouts"));
10108
+ const resolvedLayouts = [];
10109
+ for (const layoutFile of layoutFiles.values()) {
10110
+ const importPath = usingComponentFromResolvedFile(layoutFile.file, configService);
10111
+ if (!importPath) continue;
10112
+ resolvedLayouts.push({
10113
+ ...layoutFile,
10114
+ importPath
10115
+ });
10116
+ }
10117
+ return resolvedLayouts;
10118
+ })();
10119
+ resolvedLayoutsCache.set(cacheKey, task);
10120
+ try {
10121
+ return await task;
10122
+ } catch (error) {
10123
+ resolvedLayoutsCache.delete(cacheKey);
10124
+ throw error;
10125
+ }
10126
+ }
10127
+ function invalidateResolvedPageLayoutsCache(absoluteSrcRoot) {
10128
+ if (!absoluteSrcRoot) {
10129
+ resolvedLayoutsCache.clear();
10130
+ return;
10060
10131
  }
10061
- return resolvedLayouts;
10132
+ resolvedLayoutsCache.delete(normalizeComparablePath(absoluteSrcRoot));
10062
10133
  }
10063
10134
  async function resolvePageLayoutPlan(source, filename, configService) {
10064
- const layoutMeta = extractPageLayoutMeta(source, filename) ?? resolveRouteRuleLayoutMeta(filename, configService);
10065
- const dynamicSwitch = hasSetPageLayoutUsage(source, filename);
10135
+ const hasPageMetaHint = source.includes(PAGE_META_HINT);
10136
+ const hasDynamicLayoutHint = source.includes(SET_PAGE_LAYOUT_HINT);
10137
+ const layoutMeta = (hasPageMetaHint ? extractPageLayoutMeta(source, filename) : void 0) ?? resolveRouteRuleLayoutMeta(filename, configService);
10138
+ const dynamicSwitch = hasDynamicLayoutHint ? hasSetPageLayoutUsage(source, filename) : false;
10066
10139
  if (layoutMeta?.disabled && !dynamicSwitch) return;
10067
10140
  const layouts = await resolveAllLayouts(configService);
10068
10141
  const layoutMap = new Map(layouts.map((layout) => [layout.layoutName, layout]));
@@ -10535,6 +10608,10 @@ function isDefineComponentJsonOnlyScript(content) {
10535
10608
  }
10536
10609
  return hasDefineComponentJson;
10537
10610
  }
10611
+ const WEVU_TEMPLATE_RUNTIME_BINDING_ATTR_RE = /(?:^|[\s<])(?:ref|:ref|v-bind:ref|layout-host|:layout-host|v-bind:layout-host)\s*=/;
10612
+ function hasWevuTemplateRuntimeBindings(template) {
10613
+ return typeof template === "string" && WEVU_TEMPLATE_RUNTIME_BINDING_ATTR_RE.test(template);
10614
+ }
10538
10615
  function createEntryLoader(options) {
10539
10616
  const { ctx, entriesMap, loadedEntrySet, dirtyEntrySet, resolvedEntryMap, replaceLayoutDependencies, normalizeEntry, registerJsonAsset, scanTemplateEntry: scanTemplateEntryFn, emitEntriesChunks, applyAutoImports, extendedLibManager, debug } = options;
10540
10617
  const isPluginBuild = (options.buildTarget ?? "app") === "plugin";
@@ -10546,12 +10623,25 @@ function createEntryLoader(options) {
10546
10623
  const appEntriesCache = {};
10547
10624
  const appEntryOutputCache = {};
10548
10625
  const emittedScriptlessVueLayoutJs = /* @__PURE__ */ new Set();
10626
+ const scriptlessVueLayoutDecisionCache = /* @__PURE__ */ new Map();
10549
10627
  let resolveCacheVersion = 0;
10550
10628
  const shouldEmitScriptlessVueLayoutJs = async (layoutFile) => {
10551
- const { descriptor } = parse(await fs.readFile(layoutFile, "utf-8"), { filename: layoutFile });
10552
- const blocks = [descriptor.script?.content, descriptor.scriptSetup?.content].filter((content) => typeof content === "string" && content.trim().length > 0);
10553
- if (blocks.length === 0) return true;
10554
- return blocks.every(isDefineComponentJsonOnlyScript);
10629
+ const cached = scriptlessVueLayoutDecisionCache.get(layoutFile);
10630
+ if (cached) return await cached;
10631
+ const task = (async () => {
10632
+ const { descriptor } = parse(await fs.readFile(layoutFile, "utf-8"), { filename: layoutFile });
10633
+ if (hasWevuTemplateRuntimeBindings(descriptor.template?.content)) return false;
10634
+ const blocks = [descriptor.script?.content, descriptor.scriptSetup?.content].filter((content) => typeof content === "string" && content.trim().length > 0);
10635
+ if (blocks.length === 0) return true;
10636
+ return blocks.every(isDefineComponentJsonOnlyScript);
10637
+ })();
10638
+ scriptlessVueLayoutDecisionCache.set(layoutFile, task);
10639
+ try {
10640
+ return await task;
10641
+ } catch (error) {
10642
+ scriptlessVueLayoutDecisionCache.delete(layoutFile);
10643
+ throw error;
10644
+ }
10555
10645
  };
10556
10646
  return Object.assign(async function loadEntry(id, type) {
10557
10647
  existsCache.clear();
@@ -10743,6 +10833,7 @@ function createEntryLoader(options) {
10743
10833
  return result;
10744
10834
  }, { invalidateResolveCache() {
10745
10835
  entryResolver.invalidate();
10836
+ scriptlessVueLayoutDecisionCache.clear();
10746
10837
  resolveCacheVersion += 1;
10747
10838
  appEntryOutputCache.current = void 0;
10748
10839
  } });
@@ -12681,6 +12772,9 @@ function createSidecarIgnoredMatcher(ctx, rootDir) {
12681
12772
  //#region src/plugins/core/lifecycle/watch.ts
12682
12773
  const configSuffixes = configExtensions.map((ext) => `.${ext}`);
12683
12774
  const styleSuffixes = supportedCssLangs.map((ext) => `.${ext}`);
12775
+ function isLayoutSourcePath(relativeSrc) {
12776
+ return relativeSrc === "layouts" || relativeSrc.startsWith("layouts/");
12777
+ }
12684
12778
  function createBuildStartHook(state) {
12685
12779
  const { ctx, subPackageMeta, emitDirtyEntries, buildTarget } = state;
12686
12780
  const { configService } = ctx;
@@ -12697,11 +12791,12 @@ function createBuildStartHook(state) {
12697
12791
  };
12698
12792
  }
12699
12793
  function createWatchChangeHook(state) {
12700
- const { ctx, subPackageMeta, loadEntry, loadedEntrySet, markEntryDirty } = state;
12794
+ const { ctx, subPackageMeta, loadEntry, loadedEntrySet, markEntryDirty, resolvedEntryMap } = state;
12701
12795
  const { scanService, configService, buildService } = ctx;
12702
12796
  return async function watchChange(id, change) {
12703
12797
  const normalizedId = normalizeFsResolvedId(id);
12704
12798
  if (isSkippableResolvedId(normalizedId)) return;
12799
+ const relativeSrc = configService.relativeAbsoluteSrcRoot(normalizedId);
12705
12800
  invalidateFileCache(normalizedId);
12706
12801
  if (change.event === "update") {
12707
12802
  const isTemplateFile = isTemplate(normalizedId);
@@ -12716,18 +12811,21 @@ function createWatchChangeHook(state) {
12716
12811
  const ext = path.extname(normalizedId);
12717
12812
  return ext ? normalizedId.slice(0, -ext.length) : normalizedId;
12718
12813
  })());
12719
- if (primaryScript.path) markEntryDirty(normalizeFsResolvedId(primaryScript.path), "direct");
12814
+ if (primaryScript.path) {
12815
+ const primaryScriptId = normalizeFsResolvedId(primaryScript.path);
12816
+ markEntryDirty(primaryScriptId, isLayoutSourcePath(configService.relativeAbsoluteSrcRoot(primaryScriptId)) ? "dependency" : "direct");
12817
+ }
12720
12818
  }
12721
12819
  }
12722
- if (loadedEntrySet.has(normalizedId)) markEntryDirty(normalizedId, "direct");
12820
+ if (change.event === "update" && isLayoutSourcePath(relativeSrc) && resolvedEntryMap.size > 0) for (const entryId of resolvedEntryMap.keys()) markEntryDirty(entryId, "dependency");
12821
+ else if (loadedEntrySet.has(normalizedId)) markEntryDirty(normalizedId, "direct");
12723
12822
  else if (state.layoutEntryDependents.size && state.layoutEntryDependents.get(normalizedId)?.size) {
12724
12823
  const affectedEntries = state.layoutEntryDependents.get(normalizedId);
12725
- for (const entryId of affectedEntries) markEntryDirty(entryId, "direct");
12824
+ for (const entryId of affectedEntries) markEntryDirty(entryId, "dependency");
12726
12825
  } else if (state.moduleImporters.size && state.entryModuleIds.size) {
12727
12826
  const affected = collectAffectedEntries(state, normalizedId);
12728
12827
  if (affected.size) for (const entryId of affected) markEntryDirty(entryId, "dependency");
12729
12828
  }
12730
- const relativeSrc = configService.relativeAbsoluteSrcRoot(normalizedId);
12731
12829
  const relativeCwd = configService.relativeCwd(normalizedId);
12732
12830
  let handledByIndependentWatcher = false;
12733
12831
  let independentMeta;
@@ -14898,29 +14996,64 @@ const wevu = wevuPlugin;
14898
14996
  //#region src/plugins/vue/transform/plugin/transformFile.ts
14899
14997
  const AUTO_ROUTES_DEFAULT_IMPORT_RE = /import\s+([A-Za-z_$][\w$]*)\s+from\s+['"](?:weapp-vite\/auto-routes|virtual:weapp-vite-auto-routes)['"];?/g;
14900
14998
  const AUTO_ROUTES_DYNAMIC_IMPORT_RE = /import\(\s*['"](?:weapp-vite\/auto-routes|virtual:weapp-vite-auto-routes)['"]\s*\)/g;
14999
+ const TEMPLATE_DYNAMIC_HINT_RE = /\{\{|wx:|bind[A-Za-z:_-]+=|catch[A-Za-z:_-]+=/;
15000
+ const PAGE_FEATURE_HOOK_HINTS = [
15001
+ "onPageScroll",
15002
+ "onPullDownRefresh",
15003
+ "onReachBottom",
15004
+ "onRouteDone",
15005
+ "onTabItemTap",
15006
+ "onResize",
15007
+ "onShareAppMessage",
15008
+ "onShareTimeline",
15009
+ "onAddToFavorites",
15010
+ "onSaveExitState"
15011
+ ];
15012
+ const PAGE_SCROLL_HOOK_HINT = "onPageScroll";
15013
+ function mayNeedSetDataPick(template) {
15014
+ return TEMPLATE_DYNAMIC_HINT_RE.test(template);
15015
+ }
15016
+ function mayNeedPageFeatureInjection(script) {
15017
+ return PAGE_FEATURE_HOOK_HINTS.some((hint) => script.includes(hint));
15018
+ }
15019
+ function mayNeedPageScrollDiagnostics(script) {
15020
+ return script.includes(PAGE_SCROLL_HOOK_HINT);
15021
+ }
14901
15022
  async function transformVueLikeFile(options) {
14902
15023
  const { ctx, pluginCtx, code, id, compilationCache, pageMatcher, setPageMatcher, reExportResolutionCache, styleBlocksCache, scopedSlotModules, emittedScopedSlotChunks, classStyleRuntimeWarned, resolveSfcSrc } = options;
15024
+ const vueTransformTiming = ctx.configService?.weappViteConfig?.debug?.vueTransformTiming;
15025
+ const stageTimings = {};
15026
+ const totalStart = vueTransformTiming ? performance$1.now() : 0;
15027
+ const measureStage = async (label, task) => {
15028
+ if (!vueTransformTiming) return await task();
15029
+ const start = performance$1.now();
15030
+ const result = await task();
15031
+ stageTimings[label] = Number((performance$1.now() - start).toFixed(2));
15032
+ return result;
15033
+ };
14903
15034
  const configService = ctx.configService;
14904
15035
  if (!configService) return null;
14905
15036
  const filename = toAbsoluteId(getSourceFromVirtualId(id), configService, void 0, { base: "cwd" });
14906
15037
  if (!filename || !path.isAbsolute(filename)) return null;
14907
15038
  if (typeof pluginCtx.addWatchFile === "function") pluginCtx.addWatchFile(normalizeWatchPath(filename));
14908
15039
  try {
14909
- const source = typeof code === "string" ? code : configService.isDev ? await readFile$1(filename, {
15040
+ const source = await measureStage("readSource", async () => typeof code === "string" ? code : configService.isDev ? await readFile$1(filename, {
14910
15041
  checkMtime: true,
14911
15042
  encoding: "utf8"
14912
- }) : await fs.readFile(filename, "utf-8");
14913
- if (filename.endsWith(".vue")) try {
14914
- const parsedSfc = await readAndParseSfc(filename, {
14915
- source,
14916
- checkMtime: false,
14917
- resolveSrc: {
14918
- resolveId: (src, importer) => resolveSfcSrc(pluginCtx, src, importer),
14919
- checkMtime: getSfcCheckMtime(ctx.configService)
14920
- }
14921
- });
14922
- styleBlocksCache.set(filename, parsedSfc.descriptor.styles);
14923
- } catch {}
15043
+ }) : await fs.readFile(filename, "utf-8"));
15044
+ if (filename.endsWith(".vue") && source.includes("<style")) await measureStage("preParseSfc", async () => {
15045
+ try {
15046
+ const parsedSfc = await readAndParseSfc(filename, {
15047
+ source,
15048
+ checkMtime: false,
15049
+ resolveSrc: {
15050
+ resolveId: (src, importer) => resolveSfcSrc(pluginCtx, src, importer),
15051
+ checkMtime: getSfcCheckMtime(ctx.configService)
15052
+ }
15053
+ });
15054
+ styleBlocksCache.set(filename, parsedSfc.descriptor.styles);
15055
+ } catch {}
15056
+ });
14924
15057
  const libModeEnabled = configService.weappLibConfig?.enabled;
14925
15058
  let isPage = false;
14926
15059
  let isApp = false;
@@ -14950,14 +15083,16 @@ async function transformVueLikeFile(options) {
14950
15083
  });
14951
15084
  setPageMatcher(currentPageMatcher);
14952
15085
  if (ctx.runtimeState.scan.isDirty) currentPageMatcher.markDirty();
14953
- isPage = await currentPageMatcher.isPageFile(filename);
15086
+ isPage = await measureStage("matchPageEntry", async () => await currentPageMatcher.isPageFile(filename));
14954
15087
  isApp = isAppEntry(filename);
14955
15088
  }
14956
15089
  let transformedSource = source;
14957
15090
  if (isApp && (AUTO_ROUTES_DEFAULT_IMPORT_RE.test(transformedSource) || AUTO_ROUTES_DYNAMIC_IMPORT_RE.test(transformedSource))) {
14958
15091
  AUTO_ROUTES_DEFAULT_IMPORT_RE.lastIndex = 0;
14959
15092
  AUTO_ROUTES_DYNAMIC_IMPORT_RE.lastIndex = 0;
14960
- await ctx.autoRoutesService?.ensureFresh?.();
15093
+ await measureStage("ensureAutoRoutes", async () => {
15094
+ await ctx.autoRoutesService?.ensureFresh?.();
15095
+ });
14961
15096
  const routesRef = ctx.autoRoutesService?.getReference?.();
14962
15097
  const inlineRoutes = {
14963
15098
  pages: routesRef?.pages ?? [],
@@ -14970,42 +15105,54 @@ async function transformVueLikeFile(options) {
14970
15105
  reExportResolutionCache,
14971
15106
  classStyleRuntimeWarned
14972
15107
  });
14973
- const result = filename.endsWith(".vue") ? await compileVueFile(transformedSource, filename, compileOptions) : await compileJsxFile(transformedSource, filename, compileOptions);
14974
- if (isPage && result.template) {
15108
+ const result = await measureStage("compile", async () => filename.endsWith(".vue") ? await compileVueFile(transformedSource, filename, compileOptions) : await compileJsxFile(transformedSource, filename, compileOptions));
15109
+ if (isPage && result.template) await measureStage("pagePostProcess", async () => {
14975
15110
  const resolvedLayoutPlan = await resolvePageLayoutPlan(transformedSource, filename, configService);
14976
15111
  if (resolvedLayoutPlan) applyPageLayoutPlan(result, filename, resolvedLayoutPlan);
14977
15112
  await registerNativeLayoutChunksForEntry(pluginCtx, ctx, filename, transformedSource);
14978
- }
15113
+ });
14979
15114
  registerVueTemplateToken(ctx, filename, result.template);
14980
15115
  if (Array.isArray(result.meta?.sfcSrcDeps) && typeof pluginCtx.addWatchFile === "function") for (const dep of result.meta.sfcSrcDeps) pluginCtx.addWatchFile(normalizeWatchPath(dep));
14981
15116
  if (isPage && result.script) {
14982
- for (const warning of collectOnPageScrollPerformanceWarnings(result.script, filename, { engine: resolveAstEngine(configService.weappViteConfig) })) logger_default.warn(warning);
14983
- const injected = await injectWevuPageFeaturesInJsWithViteResolver(pluginCtx, result.script, filename, { checkMtime: configService.isDev });
14984
- if (injected.transformed) result.script = injected.code;
15117
+ if (mayNeedPageScrollDiagnostics(result.script)) for (const warning of collectOnPageScrollPerformanceWarnings(result.script, filename, { engine: resolveAstEngine(configService.weappViteConfig) })) logger_default.warn(warning);
15118
+ if (mayNeedPageFeatureInjection(result.script)) await measureStage("injectPageFeatures", async () => {
15119
+ const injected = await injectWevuPageFeaturesInJsWithViteResolver(pluginCtx, result.script, filename, { checkMtime: configService.isDev });
15120
+ if (injected.transformed) result.script = injected.code;
15121
+ });
14985
15122
  }
14986
- if (!isApp && result.script && result.template && isAutoSetDataPickEnabled(configService.weappViteConfig)) {
15123
+ if (!isApp && result.script && result.template && isAutoSetDataPickEnabled(configService.weappViteConfig) && mayNeedSetDataPick(result.template)) await measureStage("injectSetDataPick", async () => {
14987
15124
  const keys = collectSetDataPickKeysFromTemplate(result.template, { astEngine: resolveAstEngine(configService.weappViteConfig) });
14988
15125
  const injectedPick = injectSetDataPickInJs(result.script, keys);
14989
15126
  if (injectedPick.transformed) result.script = injectedPick.code;
14990
- }
15127
+ });
14991
15128
  compilationCache.set(filename, {
14992
15129
  result,
14993
15130
  source,
14994
15131
  isPage
14995
15132
  });
14996
15133
  const relativeBase = configService.relativeOutputPath(filename.endsWith(".vue") || filename.endsWith(".jsx") || filename.endsWith(".tsx") ? filename.slice(0, filename.lastIndexOf(".")) : filename);
14997
- if (relativeBase) emitScopedSlotChunks(pluginCtx, relativeBase, result, scopedSlotModules, emittedScopedSlotChunks, configService.outputExtensions);
15134
+ if (relativeBase) await measureStage("emitScopedSlots", async () => {
15135
+ emitScopedSlotChunks(pluginCtx, relativeBase, result, scopedSlotModules, emittedScopedSlotChunks, configService.outputExtensions);
15136
+ });
14998
15137
  let returnedCode = result.script ?? "";
14999
15138
  const styleBlocks = styleBlocksCache.get(filename);
15000
- if (styleBlocks?.length) returnedCode = styleBlocks.map((styleBlock, index) => {
15001
- const request = buildWeappVueStyleRequest(filename, styleBlock, index);
15002
- return `import ${JSON.stringify(request)};\n`;
15003
- }).join("") + returnedCode;
15139
+ if (styleBlocks?.length) returnedCode = await measureStage("injectStyleImports", async () => {
15140
+ return styleBlocks.map((styleBlock, index) => {
15141
+ const request = buildWeappVueStyleRequest(filename, styleBlock, index);
15142
+ return `import ${JSON.stringify(request)};\n`;
15143
+ }).join("") + returnedCode;
15144
+ });
15004
15145
  if (!isApp && !result.script?.trim()) returnedCode += resolveScriptlessVueEntryStub(isPage);
15005
15146
  const macroHash = result.meta?.jsonMacroHash;
15006
15147
  if (macroHash && configService.isDev) returnedCode += `\n;Object.defineProperty({}, '__weappViteJsonMacroHash', { value: ${JSON.stringify(macroHash)} })\n`;
15007
15148
  const defineOptionsHash = result.meta?.defineOptionsHash;
15008
15149
  if (defineOptionsHash && configService.isDev) returnedCode += `\n;Object.defineProperty({}, '__weappViteDefineOptionsHash', { value: ${JSON.stringify(defineOptionsHash)} })\n`;
15150
+ if (vueTransformTiming) vueTransformTiming({
15151
+ id: filename,
15152
+ isPage,
15153
+ totalMs: Number((performance$1.now() - totalStart).toFixed(2)),
15154
+ stages: stageTimings
15155
+ });
15009
15156
  return {
15010
15157
  code: returnedCode,
15011
15158
  map: null
@@ -15114,9 +15261,12 @@ function createVueTransformPlugin(ctx) {
15114
15261
  },
15115
15262
  watchChange(id) {
15116
15263
  const normalizedId = normalizeFsResolvedId(id);
15117
- if (ctx.configService && isLayoutFile(normalizedId, ctx.configService)) for (const [cachedId, cached] of compilationCache.entries()) {
15118
- if (cached.isPage) cached.source = void 0;
15119
- styleBlocksCache.delete(cachedId);
15264
+ if (ctx.configService && isLayoutFile(normalizedId, ctx.configService)) {
15265
+ invalidateResolvedPageLayoutsCache(ctx.configService.absoluteSrcRoot);
15266
+ for (const [cachedId, cached] of compilationCache.entries()) {
15267
+ if (cached.isPage) cached.source = void 0;
15268
+ styleBlocksCache.delete(cachedId);
15269
+ }
15120
15270
  }
15121
15271
  if (!isVueLikeId(normalizedId)) return;
15122
15272
  if (!fs.existsSync(normalizedId)) compilationCache.delete(normalizedId);
@@ -15128,6 +15278,7 @@ function createVueTransformPlugin(ctx) {
15128
15278
  },
15129
15279
  async handleHotUpdate({ file }) {
15130
15280
  if (ctx.configService && isLayoutFile(file, ctx.configService)) {
15281
+ invalidateResolvedPageLayoutsCache(ctx.configService.absoluteSrcRoot);
15131
15282
  for (const [cachedId, cached] of compilationCache.entries()) {
15132
15283
  if (cached.isPage) cached.source = void 0;
15133
15284
  styleBlocksCache.delete(cachedId);
@@ -17306,7 +17457,7 @@ function createScanService(ctx) {
17306
17457
  let vueAppPath;
17307
17458
  if (!appEntryPath) vueAppPath = await findVueEntry(appBasename);
17308
17459
  if (!appConfigFile && vueAppPath) {
17309
- const { extractConfigFromVue } = await import("./file-D6dnM58g.mjs").then((n) => n.r);
17460
+ const { extractConfigFromVue } = await import("./file-hsZ3VxaT.mjs").then((n) => n.r);
17310
17461
  configFromVue = await extractConfigFromVue(vueAppPath);
17311
17462
  if (configFromVue) appConfigFile = vueAppPath;
17312
17463
  }
@@ -78,7 +78,7 @@ function resolveAutoRoutesMacroImportPath() {
78
78
  }
79
79
  async function resolveAutoRoutesInlineSnapshot() {
80
80
  try {
81
- const { getCompilerContext } = await import("./createContext-DzgL8nmB.mjs").then((n) => n.a);
81
+ const { getCompilerContext } = await import("./createContext-D2PataOA.mjs").then((n) => n.a);
82
82
  const compilerContext = getCompilerContext();
83
83
  const service = compilerContext.autoRoutesService;
84
84
  const reference = service?.getReference?.();
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as Ref, C as LoadConfigOptions, Cn as WeappViteHostMeta, D as MethodDefinitions, Dn as isWeappViteHost, E as InlineConfig, En as createWeappViteHostMeta, F as RolldownPlugin, I as RolldownPluginOption, L as RolldownWatchOptions, M as RolldownBuild, N as RolldownOptions, O as Plugin, On as resolveWeappViteHostMeta, P as RolldownOutput, R as RolldownWatcher, S as CompilerContext, Sn as WEAPP_VITE_HOST_NAME, T as ConfigEnv, Tn as applyWeappViteHostMeta, _ as definePageJson, a as UserConfigFnNoEnvPlain, c as UserConfigFnPromise, d as Component, et as WeappViteConfig, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, j as ResolvedConfig, k as PluginOption, l as defineConfig, m as Theme, n as UserConfigExport, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, w as ComputedDefinitions, wn as WeappViteRuntime, y as defineThemeJson, z as ViteDevServer } from "./config-mYISi4CS.mjs";
1
+ import { A as Ref, C as LoadConfigOptions, Cn as WeappViteHostMeta, D as MethodDefinitions, Dn as isWeappViteHost, E as InlineConfig, En as createWeappViteHostMeta, F as RolldownPlugin, I as RolldownPluginOption, L as RolldownWatchOptions, M as RolldownBuild, N as RolldownOptions, O as Plugin, On as resolveWeappViteHostMeta, P as RolldownOutput, R as RolldownWatcher, S as CompilerContext, Sn as WEAPP_VITE_HOST_NAME, T as ConfigEnv, Tn as applyWeappViteHostMeta, _ as definePageJson, a as UserConfigFnNoEnvPlain, c as UserConfigFnPromise, d as Component, et as WeappViteConfig, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, j as ResolvedConfig, k as PluginOption, l as defineConfig, m as Theme, n as UserConfigExport, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, w as ComputedDefinitions, wn as WeappViteRuntime, y as defineThemeJson, z as ViteDevServer } from "./config-DFy0eHs2.mjs";
2
2
  import { WevuComponentOptions, defineEmits, defineProps } from "./runtime.mjs";
3
3
  import { createWevuComponent, setPageLayout } from "wevu";
4
4
 
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import { defineAppJson, defineComponentJson, definePageJson, defineSitemapJson, defineThemeJson } from "./json.mjs";
2
2
  import { a as resolveWeappViteHostMeta, i as isWeappViteHost, n as applyWeappViteHostMeta, r as createWeappViteHostMeta, t as WEAPP_VITE_HOST_NAME } from "./pluginHost-SJdl15d3.mjs";
3
3
  import { defineConfig } from "./config.mjs";
4
- import { t as createCompilerContext } from "./createContext-DzgL8nmB.mjs";
4
+ import { t as createCompilerContext } from "./createContext-D2PataOA.mjs";
5
5
  import "./logger-gutcwWKE.mjs";
6
- import "./file-D6dnM58g.mjs";
6
+ import "./file-hsZ3VxaT.mjs";
7
7
  import { defineEmits, defineProps } from "./runtime.mjs";
8
8
  import { createWevuComponent, setPageLayout } from "wevu";
9
9
  export { WEAPP_VITE_HOST_NAME, applyWeappViteHostMeta, createCompilerContext, createWeappViteHostMeta, createWevuComponent, defineAppJson, defineComponentJson, defineConfig, defineEmits, definePageJson, defineProps, defineSitemapJson, defineThemeJson, isWeappViteHost, resolveWeappViteHostMeta, setPageLayout };
package/dist/json.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as definePageJson, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, m as Theme, p as Sitemap, u as App, v as defineSitemapJson, y as defineThemeJson } from "./config-mYISi4CS.mjs";
1
+ import { _ as definePageJson, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, m as Theme, p as Sitemap, u as App, v as defineSitemapJson, y as defineThemeJson } from "./config-DFy0eHs2.mjs";
2
2
  export { App, Component, Page, Sitemap, Theme, defineAppJson, defineComponentJson, definePageJson, defineSitemapJson, defineThemeJson };
package/dist/mcp.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { pt as WeappMcpConfig } from "./config-mYISi4CS.mjs";
1
+ import { pt as WeappMcpConfig } from "./config-DFy0eHs2.mjs";
2
2
  import { CreateServerOptions, DEFAULT_MCP_ENDPOINT, DEFAULT_MCP_HOST, DEFAULT_MCP_PORT, McpServerHandle, StartMcpServerOptions, createWeappViteMcpServer } from "@weapp-vite/mcp";
3
3
 
4
4
  //#region src/mcp.d.ts
package/dist/types.d.mts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { c as Resolver } from "./index-BQqQ_BLM.mjs";
2
2
  import { n as AutoRoutesSubPackage, t as AutoRoutes } from "./routes-DUBjYF43.mjs";
3
- import { $ as WeappDebugConfig, $t as ResolvedAlias, A as Ref, At as GenerateExtensionsOptions, B as BindingErrorLike, Bt as GenerateTemplateScope, Cn as WeappViteHostMeta, Ct as AliasOptions, D as MethodDefinitions, Dt as CopyGlobs, E as InlineConfig, Et as ChunksConfig, F as RolldownPlugin, Ft as GenerateTemplateContext, G as EntryJsonFragment, Gt as JsonMergeFunction, H as BaseEntry, Ht as JsFormat, I as RolldownPluginOption, It as GenerateTemplateEntry, J as ScanComponentItem, Jt as MpPlatform, K as PageEntry, Kt as JsonMergeStage, L as RolldownWatchOptions, Lt as GenerateTemplateFactory, M as RolldownBuild, Mt as GenerateFilenamesOptions, N as RolldownOptions, Nt as GenerateOptions, O as Plugin, Ot as CopyOptions, P as RolldownOutput, Pt as GenerateTemplate, Q as UserConfig, Qt as NpmSubPackageConfig, R as RolldownWatcher, Rt as GenerateTemplateFileSource, St as Alias, T as ConfigEnv, Tt as BuildNpmPackageMeta, U as ComponentEntry, Ut as JsonConfig, V as AppEntry, Vt as GenerateTemplatesConfig, W as Entry, Wt as JsonMergeContext, X as ProjectConfig, Xt as NpmMainPackageConfig, Y as WxmlDep, Yt as NpmBuildOptions, Z as SubPackageMetaValue, Zt as NpmPluginPackageConfig, _n as WeappManagedNodeTsconfigConfig, _t as WeappSubPackageConfig, an as SubPackageStyleConfigEntry, at as HandleWxmlOptions, b as ChangeEvent, bn as WeappManagedTypeScriptConfig, bt as WeappWevuConfig, cn as SubPackageStyleScope, ct as WeappAutoRoutesConfig, dn as WeappLibDtsOptions, dt as WeappHmrConfig, en as SharedChunkDynamicImports, et as WeappViteConfig, fn as WeappLibEntryContext, ft as WeappInjectWeapiConfig, gn as WeappManagedAppTsconfigConfig, gt as WeappRouteRules, hn as WeappLibVueTscOptions, ht as WeappRouteRule, in as SubPackage, it as EnhanceWxmlOptions, j as ResolvedConfig, jt as GenerateFileType, k as PluginOption, kt as GenerateDirsOptions, ln as WeappLibComponentJson, lt as WeappAutoRoutesInclude, mn as WeappLibInternalDtsOptions, mt as WeappNpmConfig, nn as SharedChunkOverride, nt as AutoImportComponentsOption, on as SubPackageStyleConfigObject, ot as MultiPlatformConfig, pn as WeappLibFileName, pt as WeappMcpConfig, q as ComponentsMap, qt as JsonMergeStrategy, rn as SharedChunkStrategy, rt as EnhanceOptions, sn as SubPackageStyleEntry, st as ScanWxmlOptions, tn as SharedChunkMode, tt as AutoImportComponents, un as WeappLibConfig, ut as WeappAutoRoutesIncludePattern, vn as WeappManagedServerTsconfigConfig, vt as WeappVueConfig, w as ComputedDefinitions, wn as WeappViteRuntime, wt as AlipayNpmMode, x as WeappVitePluginApi, xn as WeappWebConfig, xt as WeappWorkerConfig, yn as WeappManagedSharedTsconfigConfig, yt as WeappVueTemplateConfig, z as ViteDevServer, zt as GenerateTemplateInlineSource } from "./config-mYISi4CS.mjs";
3
+ import { $ as WeappDebugConfig, $t as ResolvedAlias, A as Ref, At as GenerateExtensionsOptions, B as BindingErrorLike, Bt as GenerateTemplateScope, Cn as WeappViteHostMeta, Ct as AliasOptions, D as MethodDefinitions, Dt as CopyGlobs, E as InlineConfig, Et as ChunksConfig, F as RolldownPlugin, Ft as GenerateTemplateContext, G as EntryJsonFragment, Gt as JsonMergeFunction, H as BaseEntry, Ht as JsFormat, I as RolldownPluginOption, It as GenerateTemplateEntry, J as ScanComponentItem, Jt as MpPlatform, K as PageEntry, Kt as JsonMergeStage, L as RolldownWatchOptions, Lt as GenerateTemplateFactory, M as RolldownBuild, Mt as GenerateFilenamesOptions, N as RolldownOptions, Nt as GenerateOptions, O as Plugin, Ot as CopyOptions, P as RolldownOutput, Pt as GenerateTemplate, Q as UserConfig, Qt as NpmSubPackageConfig, R as RolldownWatcher, Rt as GenerateTemplateFileSource, St as Alias, T as ConfigEnv, Tt as BuildNpmPackageMeta, U as ComponentEntry, Ut as JsonConfig, V as AppEntry, Vt as GenerateTemplatesConfig, W as Entry, Wt as JsonMergeContext, X as ProjectConfig, Xt as NpmMainPackageConfig, Y as WxmlDep, Yt as NpmBuildOptions, Z as SubPackageMetaValue, Zt as NpmPluginPackageConfig, _n as WeappManagedNodeTsconfigConfig, _t as WeappSubPackageConfig, an as SubPackageStyleConfigEntry, at as HandleWxmlOptions, b as ChangeEvent, bn as WeappManagedTypeScriptConfig, bt as WeappWevuConfig, cn as SubPackageStyleScope, ct as WeappAutoRoutesConfig, dn as WeappLibDtsOptions, dt as WeappHmrConfig, en as SharedChunkDynamicImports, et as WeappViteConfig, fn as WeappLibEntryContext, ft as WeappInjectWeapiConfig, gn as WeappManagedAppTsconfigConfig, gt as WeappRouteRules, hn as WeappLibVueTscOptions, ht as WeappRouteRule, in as SubPackage, it as EnhanceWxmlOptions, j as ResolvedConfig, jt as GenerateFileType, k as PluginOption, kt as GenerateDirsOptions, ln as WeappLibComponentJson, lt as WeappAutoRoutesInclude, mn as WeappLibInternalDtsOptions, mt as WeappNpmConfig, nn as SharedChunkOverride, nt as AutoImportComponentsOption, on as SubPackageStyleConfigObject, ot as MultiPlatformConfig, pn as WeappLibFileName, pt as WeappMcpConfig, q as ComponentsMap, qt as JsonMergeStrategy, rn as SharedChunkStrategy, rt as EnhanceOptions, sn as SubPackageStyleEntry, st as ScanWxmlOptions, tn as SharedChunkMode, tt as AutoImportComponents, un as WeappLibConfig, ut as WeappAutoRoutesIncludePattern, vn as WeappManagedServerTsconfigConfig, vt as WeappVueConfig, w as ComputedDefinitions, wn as WeappViteRuntime, wt as AlipayNpmMode, x as WeappVitePluginApi, xn as WeappWebConfig, xt as WeappWorkerConfig, yn as WeappManagedSharedTsconfigConfig, yt as WeappVueTemplateConfig, z as ViteDevServer, zt as GenerateTemplateInlineSource } from "./config-DFy0eHs2.mjs";
4
4
  export { Alias, AliasOptions, AlipayNpmMode, AppEntry, AutoImportComponents, AutoImportComponentsOption, AutoRoutes, AutoRoutesSubPackage, BaseEntry, BindingErrorLike, BuildNpmPackageMeta, ChangeEvent, ChunksConfig, ComponentEntry, ComponentsMap, ComputedDefinitions, ConfigEnv, CopyGlobs, CopyOptions, EnhanceOptions, EnhanceWxmlOptions, Entry, EntryJsonFragment, GenerateDirsOptions, GenerateExtensionsOptions, GenerateFileType, GenerateFilenamesOptions, GenerateOptions, GenerateTemplate, GenerateTemplateContext, GenerateTemplateEntry, GenerateTemplateFactory, GenerateTemplateFileSource, GenerateTemplateInlineSource, GenerateTemplateScope, GenerateTemplatesConfig, HandleWxmlOptions, InlineConfig, JsFormat, JsonConfig, JsonMergeContext, JsonMergeFunction, JsonMergeStage, JsonMergeStrategy, MethodDefinitions, MpPlatform, MultiPlatformConfig, NpmBuildOptions, NpmMainPackageConfig, NpmPluginPackageConfig, NpmSubPackageConfig, PageEntry, Plugin, PluginOption, ProjectConfig, Ref, ResolvedAlias, ResolvedConfig, Resolver, RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatchOptions, RolldownWatcher, ScanComponentItem, ScanWxmlOptions, SharedChunkDynamicImports, SharedChunkMode, SharedChunkOverride, SharedChunkStrategy, SubPackage, SubPackageMetaValue, SubPackageStyleConfigEntry, SubPackageStyleConfigObject, SubPackageStyleEntry, SubPackageStyleScope, UserConfig, ViteDevServer, WeappAutoRoutesConfig, WeappAutoRoutesInclude, WeappAutoRoutesIncludePattern, WeappDebugConfig, WeappHmrConfig, WeappInjectWeapiConfig, WeappLibComponentJson, WeappLibConfig, WeappLibDtsOptions, WeappLibEntryContext, WeappLibFileName, WeappLibInternalDtsOptions, WeappLibVueTscOptions, WeappManagedAppTsconfigConfig, WeappManagedNodeTsconfigConfig, WeappManagedServerTsconfigConfig, WeappManagedSharedTsconfigConfig, WeappManagedTypeScriptConfig, WeappMcpConfig, WeappNpmConfig, WeappRouteRule, WeappRouteRules, WeappSubPackageConfig, WeappViteConfig, WeappViteHostMeta, WeappVitePluginApi, WeappViteRuntime, WeappVueConfig, WeappVueTemplateConfig, WeappWebConfig, WeappWevuConfig, WeappWorkerConfig, WxmlDep };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-vite",
3
3
  "type": "module",
4
- "version": "6.11.3",
4
+ "version": "6.11.4",
5
5
  "description": "weapp-vite 一个现代化的小程序打包工具",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -104,7 +104,6 @@
104
104
  "pathe": "^2.0.3",
105
105
  "picomatch": "^4.0.3",
106
106
  "postcss": "^8.5.8",
107
- "rimraf": "6.1.3",
108
107
  "rolldown": "1.0.0-rc.9",
109
108
  "rolldown-plugin-dts": "0.22.5",
110
109
  "semver": "^7.7.4",
@@ -117,15 +116,15 @@
117
116
  "@weapp-core/logger": "3.1.1",
118
117
  "@weapp-core/schematics": "6.0.4",
119
118
  "@weapp-core/shared": "3.0.2",
120
- "@weapp-vite/ast": "6.11.3",
119
+ "@weapp-vite/ast": "6.11.4",
121
120
  "@weapp-vite/mcp": "1.1.1",
122
121
  "@weapp-vite/volar": "2.0.8",
123
- "@weapp-vite/web": "1.3.6",
122
+ "@weapp-vite/web": "1.3.7",
124
123
  "@wevu/api": "0.2.2",
125
- "rolldown-require": "2.0.8",
124
+ "rolldown-require": "2.0.9",
126
125
  "vite-plugin-performance": "2.0.1",
127
126
  "weapp-ide-cli": "5.1.1",
128
- "wevu": "6.11.3"
127
+ "wevu": "6.11.4"
129
128
  },
130
129
  "publishConfig": {
131
130
  "access": "public",