weapp-vite 7.1.3 → 7.1.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,4 +1,4 @@
1
- import { n as getCompilerContext, y as getRouteRuntimeGlobalKeys } from "./createContext-2OomMtxv.mjs";
1
+ import { n as getCompilerContext, y as getRouteRuntimeGlobalKeys } from "./createContext-CsYIo9DO.mjs";
2
2
  //#region src/auto-routes.ts
3
3
  const ROUTE_RUNTIME_OVERRIDE_KEY = Symbol.for("weapp-vite.route-runtime");
4
4
  function createGetter(resolver) {
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { A as getDefaultIdeProjectRoot, C as collectPreloadPages, D as loadViteConfigFile, E as suggestPreloadRules, M as isPathInside, O as createCjsConfigLoadError, S as getProjectConfigFileName, T as resolvePreloadPackageIdentifier, _ as SHARED_CHUNK_VIRTUAL_PREFIX, a as createGlassEaselAnalyzeResult, b as resolveWeappConfigFile, f as getBackendForCapability, g as createSharedBuildConfig, h as syncManagedTsconfigBootstrapFiles, j as shouldPassPlatformArgToIdeOpen, k as parseCommentJson, m as syncProjectSupportFiles, o as formatBytes, p as resolveBackendExecution, t as createCompilerContext, v as resolveHmrProfileJsonPath, w as findPreloadRuleKey, x as checkRuntime } from "./createContext-2OomMtxv.mjs";
2
- import { f as VERSION, i as findJsEntry, o as findTemplateEntry, s as findVueEntry } from "./file-CD9gXASh.mjs";
1
+ import { A as getDefaultIdeProjectRoot, C as collectPreloadPages, D as loadViteConfigFile, E as suggestPreloadRules, M as isPathInside, O as createCjsConfigLoadError, S as getProjectConfigFileName, T as resolvePreloadPackageIdentifier, _ as SHARED_CHUNK_VIRTUAL_PREFIX, a as createGlassEaselAnalyzeResult, b as resolveWeappConfigFile, f as getBackendForCapability, g as createSharedBuildConfig, h as syncManagedTsconfigBootstrapFiles, j as shouldPassPlatformArgToIdeOpen, k as parseCommentJson, m as syncProjectSupportFiles, o as formatBytes, p as resolveBackendExecution, t as createCompilerContext, v as resolveHmrProfileJsonPath, w as findPreloadRuleKey, x as checkRuntime } from "./createContext-CsYIo9DO.mjs";
2
+ import { f as VERSION, i as findJsEntry, o as findTemplateEntry, s as findVueEntry } from "./file-CHisoC18.mjs";
3
3
  import { r as logger_default, t as colors } from "./logger-mt4mSTqV.mjs";
4
4
  import { c as startWeappViteMcpServer, l as detectAiDevelopmentEnvironment, s as resolveWeappMcpConfig } from "./mcp-BG6TliEg.mjs";
5
5
  import { createRequire } from "node:module";
@@ -5062,7 +5062,7 @@ function resolveRunnableHotkeyDefinition(input) {
5062
5062
  }
5063
5063
  //#endregion
5064
5064
  //#region package.json
5065
- var version = "7.1.3";
5065
+ var version = "7.1.4";
5066
5066
  //#endregion
5067
5067
  //#region src/cli/devHotkeys/format.ts
5068
5068
  const FULLWIDTH_ASCII_START = 65281;
@@ -805,7 +805,7 @@ interface WeappViteConfig {
805
805
  /**
806
806
  * 开发态是否在启动构建前清空输出目录。
807
807
  * 开发态默认 `true`,设置为 `false` 可跳过每次 dev 启动前的全量输出目录清理。
808
- * 生产构建始终会清空输出目录。
808
+ * 生产构建默认清空输出目录;显式 `build.emptyOutDir: false` 对开发和生产均禁用全量清理。
809
809
  */
810
810
  cleanOutputsInDev?: boolean;
811
811
  /**
package/dist/config.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { $n as applyWeappViteHostMeta, Qn as WeappViteHostMeta, Zn as WEAPP_VITE_HOST_NAME, _ as definePageJson, a as UserConfigFnNoEnvPlain, c as UserConfigFnPromise, d as Component, er as createWeappViteHostMeta, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, l as defineConfig, m as Theme, n as UserConfigExport, nr as resolveWeappViteHostMeta, o as UserConfigFnObject, ot as WeappViteConfig, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, sr as WeappViteRuntime, t as UserConfig, tr as isWeappViteHost, u as App, v as defineSitemapJson, y as defineThemeJson } from "./config-D9e7hCm1.mjs";
1
+ import { $n as applyWeappViteHostMeta, Qn as WeappViteHostMeta, Zn as WEAPP_VITE_HOST_NAME, _ as definePageJson, a as UserConfigFnNoEnvPlain, c as UserConfigFnPromise, d as Component, er as createWeappViteHostMeta, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, l as defineConfig, m as Theme, n as UserConfigExport, nr as resolveWeappViteHostMeta, o as UserConfigFnObject, ot as WeappViteConfig, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, sr as WeappViteRuntime, t as UserConfig, tr as isWeappViteHost, u as App, v as defineSitemapJson, y as defineThemeJson } from "./config-CDlfnbbb.mjs";
2
2
  import { t as WeappI18nConfig } from "./types-CgZn5X6j.mjs";
3
3
  export { type App, type Component, type Page, type Sitemap, type Theme, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnNoEnv, UserConfigFnNoEnvPlain, UserConfigFnObject, UserConfigFnObjectPlain, UserConfigFnPromise, WEAPP_VITE_HOST_NAME, type WeappI18nConfig, type WeappViteConfig, WeappViteHostMeta, type WeappViteRuntime, applyWeappViteHostMeta, createWeappViteHostMeta, defineAppJson, defineComponentJson, defineConfig, definePageJson, defineSitemapJson, defineThemeJson, isWeappViteHost, resolveWeappViteHostMeta };
@@ -1,5 +1,5 @@
1
1
  import { n as applyWeappViteHostMeta } from "./pluginHost--CaeyWpA.mjs";
2
- import { E as MINI_PROGRAM_PLATFORM_ADAPTERS, _ as templateExtensions, a as findJsonEntry, b as isNativeTemplateSource, c as isJsOrTs, d as touch, g as supportedCssLangs, h as scriptExtensions, i as findJsEntry, l as isTemplate, m as jsExtensions, n as changeFileExtension, o as findTemplateEntry, p as configExtensions, r as findCssEntry, s as findVueEntry, t as extractConfigFromVue, v as vueExtensions, w as inlineAutoRoutesImports, x as isSourceStyleExtension, y as ALL_NATIVE_STYLE_RESOLVER_EXTENSIONS } from "./file-CD9gXASh.mjs";
2
+ import { E as MINI_PROGRAM_PLATFORM_ADAPTERS, _ as templateExtensions, a as findJsonEntry, b as isNativeTemplateSource, c as isJsOrTs, d as touch, g as supportedCssLangs, h as scriptExtensions, i as findJsEntry, l as isTemplate, m as jsExtensions, n as changeFileExtension, o as findTemplateEntry, p as configExtensions, r as findCssEntry, s as findVueEntry, t as extractConfigFromVue, v as vueExtensions, w as inlineAutoRoutesImports, x as isSourceStyleExtension, y as ALL_NATIVE_STYLE_RESOLVER_EXTENSIONS } from "./file-CHisoC18.mjs";
3
3
  import { n as configureLogger, r as logger_default } from "./logger-mt4mSTqV.mjs";
4
4
  import { createRequire, isBuiltin } from "node:module";
5
5
  import { createDebug } from "obug";
@@ -10199,6 +10199,7 @@ function createProviderPlugin(ctx, config, onChange) {
10199
10199
  async function createDevModuleGraphProvider(ctx, buildConfig, onChange) {
10200
10200
  const configService = ctx.configService;
10201
10201
  const userWatch = buildConfig.server?.watch;
10202
+ const pollingWatchOptions = resolvePollingWatchOptions({ inlineConfig: configService?.inlineConfig ?? {} });
10202
10203
  const ignored = configService?.outDir ? createViteWatchIgnored(buildConfig.root ?? configService.cwd, configService.outDir, userWatch?.ignored) : userWatch?.ignored;
10203
10204
  const server = await createServer({
10204
10205
  ...buildConfig,
@@ -10213,6 +10214,7 @@ async function createDevModuleGraphProvider(ctx, buildConfig, onChange) {
10213
10214
  middlewareMode: true,
10214
10215
  watch: {
10215
10216
  ...userWatch ?? {},
10217
+ ...Object.fromEntries(Object.entries(pollingWatchOptions).filter(([, value]) => value !== void 0)),
10216
10218
  ...ignored !== void 0 ? { ignored } : {}
10217
10219
  }
10218
10220
  },
@@ -10478,6 +10480,9 @@ function resolveHmrRuntimeDecision(options) {
10478
10480
  runtime: "classic"
10479
10481
  };
10480
10482
  }
10483
+ function resolveHmrRuntime(options) {
10484
+ return resolveHmrRuntimeDecision(options).runtime;
10485
+ }
10481
10486
  function findSkylineRendererFiles(output) {
10482
10487
  const jsonConfigs = /* @__PURE__ */ new Map();
10483
10488
  for (const item of output) {
@@ -13184,6 +13189,29 @@ function createPreserveModulesGroup(configService, getSubPackageRoots) {
13184
13189
  };
13185
13190
  }
13186
13191
  //#endregion
13192
+ //#region src/runtime/sharedBuildConfig/virtualChunk.ts
13193
+ /** 虚拟模块的完整路径只作为标识参与散列,避免泄漏到文件名并超过文件系统长度限制。 */
13194
+ function resolveVirtualChunkFileName(chunk, root) {
13195
+ const ids = chunk.facadeModuleId ? [chunk.facadeModuleId] : chunk.moduleIds ?? [];
13196
+ if (ids.length !== 1) return;
13197
+ const id = ids[0];
13198
+ const entry = parseLogicalEntryId(id);
13199
+ const sidecar = parseSidecarModuleId(id);
13200
+ const identity = entry ? [
13201
+ "entry",
13202
+ entry.type,
13203
+ path.relative(root, entry.sourceId)
13204
+ ] : sidecar ? [
13205
+ "sidecar",
13206
+ sidecar.kind,
13207
+ path.relative(root, sidecar.ownerId),
13208
+ path.relative(root, sidecar.sourceId)
13209
+ ] : void 0;
13210
+ if (!identity) return;
13211
+ const hash = createHash("sha256").update(JSON.stringify(identity)).digest("hex").slice(0, 16);
13212
+ return `weapp-${identity[0]}-${identity[1]}-${hash}.js`;
13213
+ }
13214
+ //#endregion
13187
13215
  //#region src/runtime/wevuModules.ts
13188
13216
  const WEVU_RUNTIME_MODULE_IDS = [
13189
13217
  "wevu",
@@ -13519,7 +13547,7 @@ function createSharedBuildOutput(configService, getSubPackageRoots, options = {}
13519
13547
  const stableHashedDistChunkFileName = resolveStableHashedDistChunkFileName(chunk);
13520
13548
  if (stableHashedDistChunkFileName) return stableHashedDistChunkFileName;
13521
13549
  }
13522
- return "[name].js";
13550
+ return resolveVirtualChunkFileName(chunk, configService.absoluteSrcRoot) ?? "[name].js";
13523
13551
  }
13524
13552
  };
13525
13553
  }
@@ -14275,37 +14303,6 @@ function isStatefulHmrRuntimeCompatibilityError(error) {
14275
14303
  return error instanceof StatefulHmrRuntimeCompatibilityError || typeof error === "object" && error !== null && Reflect.get(error, "code") === "WEAPP_VITE_STATEFUL_HMR_RUNTIME_INCOMPATIBLE";
14276
14304
  }
14277
14305
  //#endregion
14278
- //#region src/runtime/statefulHmr/componentPageStyles.ts
14279
- /** 以完整产物中的最终 JSON 覆盖注册选项,只接纳已确认的 Component 页面。 */
14280
- function resolveComponentPageGlobalStyleRoutes(output, pageOptions) {
14281
- const assets = new Map(output.flatMap((item) => item.type === "asset" ? [[item.fileName, item]] : []));
14282
- const appAsset = assets.get("app.json");
14283
- const appConfig = appAsset ? JSON.parse(Buffer.from(appAsset.source).toString("utf8")) : void 0;
14284
- const independentRoots = [];
14285
- if (appConfig && typeof appConfig === "object" && !Array.isArray(appConfig)) {
14286
- const config = appConfig;
14287
- for (const key of ["subPackages", "subpackages"]) {
14288
- const packages = config[key];
14289
- if (!Array.isArray(packages)) continue;
14290
- for (const entry of packages) if (entry && typeof entry === "object" && "independent" in entry && entry.independent === true && "root" in entry && typeof entry.root === "string") independentRoots.push(path.normalize(entry.root).replace(/^\/+|\/+$/g, ""));
14291
- }
14292
- }
14293
- const routes = [];
14294
- for (const [sourceRoute, options] of pageOptions) {
14295
- const route = path.normalize(sourceRoute);
14296
- if (independentRoots.some((root) => route === root || route.startsWith(`${root}/`))) continue;
14297
- const jsonAsset = assets.get(`${route}.json`);
14298
- let isolation = options.styleIsolation.kind === "known" ? options.styleIsolation.value : void 0;
14299
- if (jsonAsset) {
14300
- const config = JSON.parse(Buffer.from(jsonAsset.source).toString("utf8"));
14301
- if (config === null || typeof config !== "object" || Array.isArray(config)) throw new Error(`Invalid Component page JSON: ${route}.json`);
14302
- if ("styleIsolation" in config && config.styleIsolation !== void 0) isolation = config.styleIsolation;
14303
- }
14304
- if (isolation === "apply-shared") routes.push(route);
14305
- }
14306
- return routes.sort();
14307
- }
14308
- //#endregion
14309
14306
  //#region src/plugins/hooks/useLoadEntry/entryChunkLifecycle.ts
14310
14307
  const ENTRY_GRAPH_CHANGE_REASON = "entry-graph-changed";
14311
14308
  /** 入口注册属于完整扫描;局部扫描只能复用已注册入口或请求重建入口图。 */
@@ -15079,7 +15076,7 @@ function createStatefulHmrGlobalStyleAssets(output, styleExtension, options = {}
15079
15076
  const globalStyle = result.find((item) => item.type === "asset" && item.fileName === styleFile);
15080
15077
  const marker = pageStyleRefreshMarker(styleRefreshToken(globalStyle?.type === "asset" ? globalStyle.source : ""));
15081
15078
  for (const [index, item] of result.entries()) {
15082
- if (item.type !== "asset" || path.extname(item.fileName) !== path.extname(styleFile) || item.fileName === entryFile || item.fileName === styleFile) continue;
15079
+ if (item.type !== "asset" || path.extname(item.fileName) !== path.extname(styleFile) || !routes.has(item.fileName.slice(0, -path.extname(styleFile).length))) continue;
15083
15080
  const original = Buffer.from(item.source).toString("utf8");
15084
15081
  const source = stripPageStyleRefreshMarker(original);
15085
15082
  if (!source) continue;
@@ -17808,6 +17805,7 @@ async function runStatefulHmrDev(ctx, buildOptions, restart, snapshots) {
17808
17805
  port: 0,
17809
17806
  watch: {
17810
17807
  ...buildOptions.server?.watch ?? {},
17808
+ ...Object.fromEntries(Object.entries(pollingWatchOptions).filter(([, value]) => value !== void 0)),
17811
17809
  ignored: createViteWatchIgnored(buildOptions.root ?? configService.cwd, configService.outDir, buildOptions.server?.watch?.ignored)
17812
17810
  }
17813
17811
  },
@@ -18278,6 +18276,65 @@ function formatStatefulHmrError(error) {
18278
18276
  return String(error);
18279
18277
  }
18280
18278
  //#endregion
18279
+ //#region src/runtime/statefulHmr/componentPageStyles.ts
18280
+ function hasNativePageRegistration(code) {
18281
+ if (!code.includes("Page")) return false;
18282
+ let found = false;
18283
+ traverse(parseJsLike(code), { CallExpression(callPath) {
18284
+ const callee = callPath.node.callee;
18285
+ if (callee.type === "Identifier" && callee.name === "Page" && !callPath.scope.hasBinding("Page")) {
18286
+ found = true;
18287
+ callPath.stop();
18288
+ }
18289
+ } });
18290
+ return found;
18291
+ }
18292
+ /** 以最终 JSON 和注册方式确认继承全局样式的页面,保留独立分包与隔离边界。 */
18293
+ function resolveComponentPageGlobalStyleRoutes(output, pageOptions) {
18294
+ const assets = new Map(output.flatMap((item) => item.type === "asset" ? [[item.fileName, item]] : []));
18295
+ const appAsset = assets.get("app.json");
18296
+ const appConfig = appAsset ? JSON.parse(Buffer.from(appAsset.source).toString("utf8")) : void 0;
18297
+ const independentRoots = [];
18298
+ const nativeCandidates = [];
18299
+ if (appConfig && typeof appConfig === "object" && !Array.isArray(appConfig)) {
18300
+ const config = appConfig;
18301
+ if (Array.isArray(config.pages)) nativeCandidates.push(...config.pages.filter((route) => typeof route === "string"));
18302
+ for (const key of ["subPackages", "subpackages"]) {
18303
+ const packages = config[key];
18304
+ if (!Array.isArray(packages)) continue;
18305
+ for (const entry of packages) if (entry && typeof entry === "object" && "independent" in entry && entry.independent === true && "root" in entry && typeof entry.root === "string") independentRoots.push(path.normalize(entry.root).replace(/^\/+|\/+$/g, ""));
18306
+ else if (entry && typeof entry === "object" && "root" in entry && typeof entry.root === "string" && "pages" in entry && Array.isArray(entry.pages)) nativeCandidates.push(...entry.pages.filter((route) => typeof route === "string").map((route) => path.join(entry.root, route)));
18307
+ }
18308
+ }
18309
+ const routes = [];
18310
+ const componentRoutes = new Set(Array.from(pageOptions.keys(), (route) => path.normalize(route)));
18311
+ for (const [sourceRoute, options] of pageOptions) {
18312
+ const route = path.normalize(sourceRoute);
18313
+ if (independentRoots.some((root) => route === root || route.startsWith(`${root}/`))) continue;
18314
+ const jsonAsset = assets.get(`${route}.json`);
18315
+ let isolation = options.styleIsolation.kind === "known" ? options.styleIsolation.value : void 0;
18316
+ if (jsonAsset) {
18317
+ const config = JSON.parse(Buffer.from(jsonAsset.source).toString("utf8"));
18318
+ if (config === null || typeof config !== "object" || Array.isArray(config)) throw new Error(`Invalid Component page JSON: ${route}.json`);
18319
+ if ("styleIsolation" in config && config.styleIsolation !== void 0) isolation = config.styleIsolation;
18320
+ }
18321
+ if (isolation === "apply-shared") routes.push(route);
18322
+ }
18323
+ const chunks = new Map(output.flatMap((item) => item.type === "chunk" ? [[item.fileName, item]] : []));
18324
+ for (const sourceRoute of nativeCandidates) {
18325
+ const route = path.normalize(sourceRoute);
18326
+ if (componentRoutes.has(route) || independentRoots.some((root) => route === root || route.startsWith(`${root}/`))) continue;
18327
+ const chunk = chunks.get(`${route}.js`);
18328
+ if (!chunk || !hasNativePageRegistration(chunk.code)) continue;
18329
+ const json = assets.get(`${route}.json`);
18330
+ const config = json ? JSON.parse(Buffer.from(json.source).toString("utf8")) : {};
18331
+ if (!config || typeof config !== "object" || Array.isArray(config)) throw new Error(`Invalid native page JSON: ${route}.json`);
18332
+ if ("component" in config && config.component === true) continue;
18333
+ routes.push(route);
18334
+ }
18335
+ return [...new Set(routes)].sort();
18336
+ }
18337
+ //#endregion
18281
18338
  //#region src/runtime/statefulHmr/snapshotBuild.ts
18282
18339
  /** 快照独立编译;初始化到构建收尾均不写支持文件,由活动 DevEngine 统一维护。 */
18283
18340
  async function buildStatefulHmrSnapshot(loadOptions, configure = (options) => options) {
@@ -18287,7 +18344,16 @@ async function buildStatefulHmrSnapshot(loadOptions, configure = (options) => op
18287
18344
  await ctx.configService.load(loadOptions);
18288
18345
  await ctx.scanService.loadAppEntry();
18289
18346
  ctx.scanService.loadSubPackages();
18290
- const options = configure(ctx.configService.merge(void 0, createSharedBuildConfig(ctx.configService, ctx.scanService)));
18347
+ let globalStyleRoutes = [];
18348
+ const baseOptions = ctx.configService.merge(void 0, createSharedBuildConfig(ctx.configService, ctx.scanService));
18349
+ baseOptions.plugins = [...baseOptions.plugins ?? [], {
18350
+ name: "weapp-vite:stateful-hmr-page-style-metadata",
18351
+ enforce: "post",
18352
+ generateBundle(_options, bundle) {
18353
+ globalStyleRoutes = resolveComponentPageGlobalStyleRoutes(Object.values(bundle), ctx.runtimeState.build.hmr.componentPageStyleOptions);
18354
+ }
18355
+ }];
18356
+ const options = configure(baseOptions);
18291
18357
  options.build = {
18292
18358
  ...options.build,
18293
18359
  watch: void 0,
@@ -18297,7 +18363,7 @@ async function buildStatefulHmrSnapshot(loadOptions, configure = (options) => op
18297
18363
  output: await build(options),
18298
18364
  getEntryIds: () => ctx.runtimeState.build.hmr.resolvedEntryMap.keys(),
18299
18365
  getDelegatedComponentEntryIds: () => Array.from(ctx.runtimeState.build.hmr.resolvedEntryMap.keys()).filter((id) => /\.(?:vue|jsx|tsx)$/.test(id) && ctx.runtimeState.build.hmr.entriesMap.get(ctx.configService.relativeAbsoluteSrcRoot(removeExtensionDeep(id)))?.type === "component"),
18300
- getComponentPageStyleOptions: () => ctx.runtimeState.build.hmr.componentPageStyleOptions
18366
+ getGlobalStyleRoutes: () => globalStyleRoutes
18301
18367
  };
18302
18368
  });
18303
18369
  }
@@ -20551,6 +20617,10 @@ function resetEmittedOutputCaches(runtimeState) {
20551
20617
  runtimeState.css.transformedSidecarSource.clear();
20552
20618
  runtimeState.wxml.emittedCode.clear();
20553
20619
  }
20620
+ function shouldCleanOutputs(configService, phase) {
20621
+ if (configService.inlineConfig.build?.emptyOutDir === false) return false;
20622
+ return phase === "rebuild" || !configService.isDev || configService.weappViteConfig.cleanOutputsInDev !== false;
20623
+ }
20554
20624
  async function cleanOutputs(configService) {
20555
20625
  if (configService.mpDistRoot) {
20556
20626
  const preservedNpmDirNames = resolvePreservedNpmDirNames(configService);
@@ -21415,7 +21485,7 @@ function createBuildService(ctx) {
21415
21485
  if (target === "app" && hmrDecision.runtime === "stateful-experimental") try {
21416
21486
  const snapshot = await buildStatefulHmrSnapshot(configService.loadOptions, appendHmrMetricsPlugin);
21417
21487
  const initialSnapshot = toStatefulHmrOutput(snapshot.output);
21418
- const initialGlobalStyleRoutes = resolveComponentPageGlobalStyleRoutes(initialSnapshot, snapshot.getComponentPageStyleOptions());
21488
+ const initialGlobalStyleRoutes = snapshot.getGlobalStyleRoutes();
21419
21489
  const initialEntryIds = collectStatefulHmrEntryIds(snapshot.getEntryIds());
21420
21490
  const skylineFiles = findSkylineRendererFiles(initialSnapshot);
21421
21491
  if (skylineFiles.length > 0) await applySkylineHmrFallback({
@@ -21475,12 +21545,11 @@ function createBuildService(ctx) {
21475
21545
  }];
21476
21546
  return snapshotOptions;
21477
21547
  });
21478
- const output = toStatefulHmrOutput(snapshot.output);
21479
21548
  return {
21480
- output,
21549
+ output: toStatefulHmrOutput(snapshot.output),
21481
21550
  entryIds: [...collectStatefulHmrEntryIds(snapshot.getEntryIds())],
21482
21551
  delegatedComponentEntryIds: snapshot.getDelegatedComponentEntryIds(),
21483
- componentPageGlobalStyleRoutes: resolveComponentPageGlobalStyleRoutes(output, snapshot.getComponentPageStyleOptions())
21552
+ componentPageGlobalStyleRoutes: snapshot.getGlobalStyleRoutes()
21484
21553
  };
21485
21554
  }
21486
21555
  }), workerPromise]);
@@ -21623,7 +21692,7 @@ function createBuildService(ctx) {
21623
21692
  ...snapshotBuildOptions,
21624
21693
  build: {
21625
21694
  ...snapshotBuildOptions.build ?? {},
21626
- emptyOutDir: true
21695
+ emptyOutDir: shouldCleanOutputs(configService, "rebuild")
21627
21696
  }
21628
21697
  });
21629
21698
  devBuildWatcher?.emitEvent({ code: "END" });
@@ -21875,6 +21944,8 @@ function createBuildService(ctx) {
21875
21944
  const pluginOutputRoot = configService.absolutePluginOutputRoot;
21876
21945
  if (!pluginOutputRoot) return;
21877
21946
  const inlineConfig = { build: { outDir: pluginOutputRoot } };
21947
+ const emptyOutDir = configService.inlineConfig.build?.emptyOutDir;
21948
+ if (typeof emptyOutDir === "boolean") inlineConfig.build.emptyOutDir = emptyOutDir;
21878
21949
  const isolatedCtx = await createCompilerContext({
21879
21950
  key: `plugin-build:${configService.cwd}`,
21880
21951
  cwd: configService.cwd,
@@ -21903,7 +21974,7 @@ function createBuildService(ctx) {
21903
21974
  return await runProd(target);
21904
21975
  }
21905
21976
  async function buildEntry(options) {
21906
- if (!configService.isDev || configService.weappViteConfig.cleanOutputsInDev !== false) {
21977
+ if (shouldCleanOutputs(configService, "startup")) {
21907
21978
  await cleanOutputs(configService);
21908
21979
  resetEmittedOutputCaches(ctx.runtimeState);
21909
21980
  }
@@ -33943,6 +34014,37 @@ function preflight(ctx) {
33943
34014
  return [createPluginPruner(), createEnvSynchronizer(ctx)];
33944
34015
  }
33945
34016
  //#endregion
34017
+ //#region src/plugins/tailwindcss/imports.ts
34018
+ /** 只判断样式导入链的所有权;解析、条件包装与转换仍由 Tailwind 编译器负责。 */
34019
+ async function findManagedStyleImports(code, filename, options) {
34020
+ const dependencies = /* @__PURE__ */ new Set();
34021
+ let managed = false;
34022
+ const visit = async (source, importer) => {
34023
+ if (!source.includes("@import")) return;
34024
+ const requests = [];
34025
+ postcss.parse(source, { from: importer }).walkAtRules("import", (rule) => {
34026
+ const node = valueParser(rule.params).nodes[0];
34027
+ const value = node?.type === "string" ? node.value : node?.type === "function" && node.value === "url" ? node.nodes[0]?.value : void 0;
34028
+ if (value && !/^(?:[a-z]+:|\/\/|#)/i.test(value)) requests.push(value);
34029
+ });
34030
+ for (const request of requests) {
34031
+ const resolved = await options.resolve(request, importer, { skipSelf: true });
34032
+ if (!resolved || resolved.external) continue;
34033
+ const sourcePath = getCssRealPath(parseRequest(resolved.id));
34034
+ const file = normalizeManagedTailwindcssEntryPath(path$1.resolve(path$1.dirname(importer), sourcePath));
34035
+ if (dependencies.has(file)) continue;
34036
+ dependencies.add(file);
34037
+ if (options.isManaged(file)) managed = true;
34038
+ else await visit(await fs$2.readFile(file, "utf8"), file);
34039
+ }
34040
+ };
34041
+ await visit(code, filename);
34042
+ return {
34043
+ managed,
34044
+ dependencies
34045
+ };
34046
+ }
34047
+ //#endregion
33946
34048
  //#region src/plugins/tailwindcss/vueStyle.ts
33947
34049
  /** 根据 SFC 外部样式的文件身份解析入口,避免依赖编译前后 CSS 文本一致。 */
33948
34050
  async function resolveVueStyleSource(request, resolve) {
@@ -34116,6 +34218,7 @@ function createTailwindcssPlugin(ctx) {
34116
34218
  const contextualSlots = /* @__PURE__ */ new Set();
34117
34219
  const dirtySlots = /* @__PURE__ */ new Set();
34118
34220
  const transformedSources = /* @__PURE__ */ new Map();
34221
+ const importedSources = /* @__PURE__ */ new Map();
34119
34222
  const previousEntrySources = /* @__PURE__ */ new Map();
34120
34223
  const resolvedEntryIndexes = /* @__PURE__ */ new Set();
34121
34224
  const loadedEntryIndexes = /* @__PURE__ */ new Set();
@@ -34242,8 +34345,8 @@ function createTailwindcssPlugin(ctx) {
34242
34345
  classSet: [],
34243
34346
  target: resolved.generatorTarget
34244
34347
  })];
34245
- const snapshot = compiler.mergeSnapshots(snapshots);
34246
- const seenEntries = /* @__PURE__ */ new Set();
34348
+ const snapshot = compiler.mergeSnapshots([...snapshots, ...Array.from(importedSources.values(), (source) => source.snapshot)]);
34349
+ const seenEntries = new Set(Array.from(importedSources.values()).flatMap((source) => source.entries));
34247
34350
  const styleExtension = ctx.configService.outputExtensions.wxss;
34248
34351
  const templateExtension = ctx.configService.outputExtensions.wxml;
34249
34352
  const scriptSourceMap = Boolean(resolvedConfig?.build.sourcemap);
@@ -34301,6 +34404,65 @@ function createTailwindcssPlugin(ctx) {
34301
34404
  applyOutputChunkTransform(output, transformed.code, transformed.map);
34302
34405
  }
34303
34406
  }
34407
+ function importedSourceKey(id) {
34408
+ const style = parseWeappVueStyleRequest(id);
34409
+ return style ? `${style.filename}?style=${style.index}` : id.split("?")[0];
34410
+ }
34411
+ async function transformImportedSource(code, id) {
34412
+ const style = parseWeappVueStyleRequest(id);
34413
+ const filename = requestSources.get(id) ?? style?.filename ?? normalizeFsResolvedId(id.split("?")[0], { stripLeadingNullByte: true });
34414
+ if (!style && !/\.(?:css|pcss|postcss)$/.test(filename)) return null;
34415
+ const query = new URLSearchParams(id.split("?")[1] ?? "");
34416
+ if (query.has("raw") || query.has("url")) return null;
34417
+ const imports = await findManagedStyleImports(code, filename, {
34418
+ resolve: this.resolve.bind(this),
34419
+ isManaged: (file) => isManagedTailwindcssEntry(ctx, file)
34420
+ });
34421
+ const key = importedSourceKey(id);
34422
+ if (!imports.managed) {
34423
+ const previous = importedSources.get(key);
34424
+ if (previous) {
34425
+ await (await getCompiler()).remove(previous.rootId);
34426
+ importedSources.delete(key);
34427
+ }
34428
+ return null;
34429
+ }
34430
+ const compiler = await getCompiler();
34431
+ const rootId = `${MANAGED_PLUGIN_NAME}:import:${key}`;
34432
+ const configuredSource = createTailwindV4SourceOptions(resolved, filename);
34433
+ const generated = await compiler.generate({
34434
+ id: rootId,
34435
+ target: resolved.generatorTarget,
34436
+ scanSources: true,
34437
+ sourceOptions: {
34438
+ ...configuredSource,
34439
+ cssEntries: [],
34440
+ cssSources: [...configuredSource.cssSources ?? [], {
34441
+ css: code,
34442
+ file: filename,
34443
+ base: path.dirname(filename),
34444
+ dependencies: [...imports.dependencies]
34445
+ }]
34446
+ },
34447
+ bareArbitraryValues: resolved.options.arbitraryValues?.bareArbitraryValues,
34448
+ styleOptions: typeof resolved.options.generator === "object" ? resolved.options.generator.styleOptions : void 0
34449
+ });
34450
+ importedSources.set(key, {
34451
+ rootId,
34452
+ snapshot: generated.snapshot,
34453
+ entries: [...imports.dependencies].flatMap((file) => {
34454
+ const index = parseManagedEntryIndex(file, entryIndex);
34455
+ return index === void 0 ? [] : [index];
34456
+ })
34457
+ });
34458
+ const dependencies = /* @__PURE__ */ new Set([...imports.dependencies, ...generated.dependencies]);
34459
+ for (const dependency of dependencies) this.addWatchFile(dependency);
34460
+ return {
34461
+ code: await stripResidualTailwindSourceDirectives((await compiler.transformCss(generated.rawCss, generated.snapshot, { isMainChunk: filename === path.resolve(ctx.configService.absoluteSrcRoot, "app.vue") })).css),
34462
+ map: null,
34463
+ meta: createStyleSourceMeta(dependencies)
34464
+ };
34465
+ }
34304
34466
  return [{
34305
34467
  name: MANAGED_PLUGIN_NAME,
34306
34468
  enforce: "pre",
@@ -34384,7 +34546,7 @@ function createTailwindcssPlugin(ctx) {
34384
34546
  if (resolved.options.generator === false || parseSidecarSourceRequest(id)?.dependencyOnly) return null;
34385
34547
  const sourceId = requestSources.get(id) ?? id;
34386
34548
  const entry = parseManagedEntryIndex(sourceId, entryIndex) ?? resolveAutoEntryIndex(sourceId, code);
34387
- if (entry === void 0) return null;
34549
+ if (entry === void 0) return code.includes("@import") || importedSources.has(importedSourceKey(id)) ? transformImportedSource.call(this, code, id) : null;
34388
34550
  const index = getSourceSlot(id, entry);
34389
34551
  dirtySlots.delete(index);
34390
34552
  loadedEntryIndexes.add(index);
@@ -34401,6 +34563,7 @@ function createTailwindcssPlugin(ctx) {
34401
34563
  };
34402
34564
  },
34403
34565
  shouldTransformCachedModule({ id }) {
34566
+ if (importedSources.has(importedSourceKey(id))) return true;
34404
34567
  const index = parseManagedEntryIndex(requestSources.get(id) ?? id, entryIndex);
34405
34568
  if (index !== void 0 && dirtySlots.has(getSourceSlot(id, index))) return true;
34406
34569
  },
@@ -35252,6 +35415,11 @@ function buildCompileVueFileOptions(ctx, pluginCtx, vuePath, isPage, isApp, conf
35252
35415
  const wevuMinify = isWevuMinifyEnabled(configService.weappViteConfig, configService.isDev);
35253
35416
  const jsonKind = isApp ? "app" : isPage ? "page" : "component";
35254
35417
  const sourceMap = isVueTransformSourceMapEnabled(configService);
35418
+ const stabilizeCssVarsRuntime = configService.isDev && resolveHmrRuntime({
35419
+ platform: configService.platform,
35420
+ configured: configService.weappViteConfig?.hmr?.runtime,
35421
+ compileHotReLoad: configService.projectPrivateConfig?.setting?.compileHotReLoad
35422
+ }) === "stateful-experimental";
35255
35423
  async function resolvePotentialVueSfcEntryId(candidate) {
35256
35424
  const trimmed = candidate?.trim();
35257
35425
  if (!trimmed) return;
@@ -35312,6 +35480,7 @@ function buildCompileVueFileOptions(ctx, pluginCtx, vuePath, isPage, isApp, conf
35312
35480
  isApp,
35313
35481
  skipComponentTransform: delegatesComponentRegistration,
35314
35482
  autoSetDataPick: isAutoSetDataPickEnabledWithPreset(configService.weappViteConfig),
35483
+ stabilizeCssVarsRuntime,
35315
35484
  bindingManifestSourceFile: resolveBindingManifestSourceFile(vuePath, configService),
35316
35485
  runtimeBindingManifest: configService.isDev ? "diagnostic" : "compact",
35317
35486
  pageLayout,
@@ -35386,7 +35555,7 @@ function createCompileVueFileOptions(ctx, pluginCtx, vuePath, isPage, isApp, con
35386
35555
  const appShellSignature = createCompilerAppShellSignature(isPage && !isApp ? resolvedAppShell : void 0);
35387
35556
  const cacheKey = getCompileVueFileOptionsCacheKey(vuePath, isPage, isApp, delegatesComponentRegistration, state.emitResolvedComponentEntries !== false, pageLayoutSignature, appShellSignature);
35388
35557
  const cached = state.compileOptionsCache?.get(cacheKey);
35389
- if (cached && compileOptionsOwners.get(cached) === pluginCtx) return cached;
35558
+ if (!configService.isDev && cached && compileOptionsOwners.get(cached) === pluginCtx) return cached;
35390
35559
  const created = buildCompileVueFileOptions(ctx, pluginCtx, vuePath, isPage, isApp, configService, state, delegatesComponentRegistration, pageLayout, appShell);
35391
35560
  compileOptionsOwners.set(created, pluginCtx);
35392
35561
  state.compileOptionsCache?.set(cacheKey, created);
@@ -36270,7 +36439,7 @@ function emitAppShellAssetsIfNeeded(options) {
36270
36439
  //#endregion
36271
36440
  //#region src/plugins/vue/transform/bundle/emitCompiledEntry.ts
36272
36441
  function shouldReplaceAppScriptBundleEntry(options) {
36273
- if (!isAppVueFile(options.filename) || !options.isDev || !options.hasDevHmrEvent) return false;
36442
+ if (options.isBundledDev || !isAppVueFile(options.filename) || !options.isDev || !options.hasDevHmrEvent) return false;
36274
36443
  return true;
36275
36444
  }
36276
36445
  function hasUnresolvedModuleImportDeclaration(script) {
@@ -36305,7 +36474,8 @@ async function emitResolvedCompiledVueEntryAssets(options) {
36305
36474
  const shouldReplaceAppScript = shouldReplaceAppScriptBundleEntry({
36306
36475
  filename,
36307
36476
  isDev: configService.isDev,
36308
- hasDevHmrEvent: hmrState?.profile?.event !== void 0
36477
+ hasDevHmrEvent: hmrState?.profile?.event !== void 0,
36478
+ isBundledDev: state.isBundledDev
36309
36479
  });
36310
36480
  if (isAppVueFile(filename) && hasAppShellTemplate(result)) emitAppShellAssetsIfNeeded({
36311
36481
  bundle,
@@ -37107,6 +37277,7 @@ function createVueTransformPlugin(ctx, options = {}) {
37107
37277
  let appShell;
37108
37278
  let pageMatcher = null;
37109
37279
  let scanDirtySynced = false;
37280
+ let isBundledDev = false;
37110
37281
  const reExportResolutionCache = /* @__PURE__ */ new Map();
37111
37282
  const compileOptionsCache = /* @__PURE__ */ new Map();
37112
37283
  const componentMetaCache = /* @__PURE__ */ new Map();
@@ -37122,6 +37293,9 @@ function createVueTransformPlugin(ctx, options = {}) {
37122
37293
  }
37123
37294
  return {
37124
37295
  name: `${VUE_PLUGIN_NAME}:transform`,
37296
+ configResolved(config) {
37297
+ isBundledDev = config.command === "serve" && Boolean(config.experimental.bundledDev);
37298
+ },
37125
37299
  async buildStart() {
37126
37300
  scopedSlotModules.clear();
37127
37301
  emittedScopedSlotChunks.clear();
@@ -37206,6 +37380,7 @@ function createVueTransformPlugin(ctx, options = {}) {
37206
37380
  async generateBundle(_options, bundle) {
37207
37381
  await emitVueBundleAssets(bundle, {
37208
37382
  ctx,
37383
+ isBundledDev,
37209
37384
  pluginCtx: this,
37210
37385
  compilationCache,
37211
37386
  appShell,
@@ -38560,7 +38735,7 @@ async function loadAppEntry(ctx, scanState) {
38560
38735
  const { path: appEntryPath } = appEntry;
38561
38736
  let configFromVue;
38562
38737
  if (!appConfigFile && vueAppPath) {
38563
- const { extractConfigFromVue } = await import("./file-BNDoQN7z.mjs");
38738
+ const { extractConfigFromVue } = await import("./file-DxMrh1lh.mjs");
38564
38739
  configFromVue = await extractConfigFromVue(vueAppPath);
38565
38740
  if (configFromVue) appConfigFile = vueAppPath;
38566
38741
  }
@@ -54,7 +54,7 @@ function resolveAutoRoutesMacroImportPath() {
54
54
  }
55
55
  async function resolveAutoRoutesInlineSnapshot() {
56
56
  try {
57
- const { getCompilerContext } = await import("./getInstance-ChNOSsDp.mjs");
57
+ const { getCompilerContext } = await import("./getInstance-C-3pAq1Y.mjs");
58
58
  const compilerContext = getCompilerContext();
59
59
  const service = compilerContext.autoRoutesService;
60
60
  const reference = service?.getReference?.();
@@ -0,0 +1,2 @@
1
+ import { t as extractConfigFromVue } from "./file-CHisoC18.mjs";
2
+ export { extractConfigFromVue };
@@ -0,0 +1,2 @@
1
+ import { n as getCompilerContext } from "./createContext-CsYIo9DO.mjs";
2
+ export { getCompilerContext };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { $n as applyWeappViteHostMeta, A as Ref, C as LoadConfigOptions, D as MethodDefinitions, E as InlineConfig, F as RolldownPlugin, I as RolldownPluginOption, L as RolldownWatchOptions, M as RolldownBuild, N as RolldownOptions, O as Plugin, P as RolldownOutput, Qn as WeappViteHostMeta, R as RolldownWatcher, S as CompilerContext, T as ConfigEnv, Zn as WEAPP_VITE_HOST_NAME, _ as definePageJson, a as UserConfigFnNoEnvPlain, ar as WEB_PLATFORM_ALIASES, c as UserConfigFnPromise, cr as WeappViteTargetDescriptor, d as Component, dr as WebPlatform, er as createWeappViteHostMeta, f as Page, fr as getSupportedWeappVitePlatforms, g as defineComponentJson, h as defineAppJson, hr as resolveWeappViteTarget, i as UserConfigFnNoEnv, ir as ResolvedWeappViteTarget, j as ResolvedConfig, k as PluginOption, l as defineConfig, lr as WeappViteTargetInput, m as Theme, mr as isWebPlatform, n as UserConfigExport, nr as resolveWeappViteHostMeta, o as UserConfigFnObject, or as WeappVitePlatform, ot as WeappViteConfig, p as Sitemap, pr as getSupportedWeappViteTargetDescriptors, r as UserConfigFn, rr as ResolveWeappViteTargetOptions, s as UserConfigFnObjectPlain, sr as WeappViteRuntime, t as UserConfig, tr as isWeappViteHost, u as App, ur as WeappViteTargetKind, v as defineSitemapJson, w as ComputedDefinitions, y as defineThemeJson, z as ViteDevServer } from "./config-D9e7hCm1.mjs";
1
+ import { $n as applyWeappViteHostMeta, A as Ref, C as LoadConfigOptions, D as MethodDefinitions, E as InlineConfig, F as RolldownPlugin, I as RolldownPluginOption, L as RolldownWatchOptions, M as RolldownBuild, N as RolldownOptions, O as Plugin, P as RolldownOutput, Qn as WeappViteHostMeta, R as RolldownWatcher, S as CompilerContext, T as ConfigEnv, Zn as WEAPP_VITE_HOST_NAME, _ as definePageJson, a as UserConfigFnNoEnvPlain, ar as WEB_PLATFORM_ALIASES, c as UserConfigFnPromise, cr as WeappViteTargetDescriptor, d as Component, dr as WebPlatform, er as createWeappViteHostMeta, f as Page, fr as getSupportedWeappVitePlatforms, g as defineComponentJson, h as defineAppJson, hr as resolveWeappViteTarget, i as UserConfigFnNoEnv, ir as ResolvedWeappViteTarget, j as ResolvedConfig, k as PluginOption, l as defineConfig, lr as WeappViteTargetInput, m as Theme, mr as isWebPlatform, n as UserConfigExport, nr as resolveWeappViteHostMeta, o as UserConfigFnObject, or as WeappVitePlatform, ot as WeappViteConfig, p as Sitemap, pr as getSupportedWeappViteTargetDescriptors, r as UserConfigFn, rr as ResolveWeappViteTargetOptions, s as UserConfigFnObjectPlain, sr as WeappViteRuntime, t as UserConfig, tr as isWeappViteHost, u as App, ur as WeappViteTargetKind, v as defineSitemapJson, w as ComputedDefinitions, y as defineThemeJson, z as ViteDevServer } from "./config-CDlfnbbb.mjs";
2
2
  import { t as WeappI18nConfig } from "./types-CgZn5X6j.mjs";
3
3
  import { a as LayoutHostContext, c as LayoutHostResolver, d as unregisterLayoutHosts, f as waitForLayoutHost, i as LayoutHostBridge, l as registerLayoutHosts, m as createWevuComponent, n as defineProps, o as LayoutHostEntry, p as WevuComponentOptions, r as setPageLayout, s as LayoutHostResolveOptions, t as defineEmits, u as resolveLayoutHost } from "./runtime-Ee2HY6gR.mjs";
4
4
  //#region src/createContext.d.ts
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { a as defineThemeJson, i as defineSitemapJson, n as defineComponentJson, r as definePageJson, t as defineAppJson } from "./json-BL8Dhhk6.mjs";
2
2
  import { a as resolveWeappViteHostMeta, i as isWeappViteHost, n as applyWeappViteHostMeta, r as createWeappViteHostMeta, t as WEAPP_VITE_HOST_NAME } from "./pluginHost--CaeyWpA.mjs";
3
3
  import { t as defineConfig } from "./config-DRGcCi3h.mjs";
4
- import { c as getSupportedWeappVitePlatforms, d as resolveWeappViteTarget, l as getSupportedWeappViteTargetDescriptors, s as WEB_PLATFORM_ALIASES, t as createCompilerContext, u as isWebPlatform } from "./createContext-2OomMtxv.mjs";
4
+ import { c as getSupportedWeappVitePlatforms, d as resolveWeappViteTarget, l as getSupportedWeappViteTargetDescriptors, s as WEB_PLATFORM_ALIASES, t as createCompilerContext, u as isWebPlatform } from "./createContext-CsYIo9DO.mjs";
5
5
  import { a as resolveLayoutHost, c as createWevuComponent, i as registerLayoutHosts, n as defineProps, o as unregisterLayoutHosts, r as setPageLayout, s as waitForLayoutHost, t as defineEmits } from "./runtime-D6VCNhNY.mjs";
6
6
  export { WEAPP_VITE_HOST_NAME, WEB_PLATFORM_ALIASES, applyWeappViteHostMeta, createCompilerContext, createWeappViteHostMeta, createWevuComponent, defineAppJson, defineComponentJson, defineConfig, defineEmits, definePageJson, defineProps, defineSitemapJson, defineThemeJson, getSupportedWeappVitePlatforms, getSupportedWeappViteTargetDescriptors, isWeappViteHost, isWebPlatform, registerLayoutHosts, resolveLayoutHost, resolveWeappViteHostMeta, resolveWeappViteTarget, setPageLayout, unregisterLayoutHosts, waitForLayoutHost };
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-D9e7hCm1.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-CDlfnbbb.mjs";
2
2
  export { type App, type Component, type Page, type Sitemap, type Theme, defineAppJson, defineComponentJson, definePageJson, defineSitemapJson, defineThemeJson };
package/dist/mcp.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { Dt as WeappMcpConfig } from "./config-D9e7hCm1.mjs";
1
+ import { Dt as WeappMcpConfig } from "./config-CDlfnbbb.mjs";
2
2
  import { CreateServerOptions, DEFAULT_MCP_ENDPOINT, DEFAULT_MCP_HOST, DEFAULT_MCP_PORT, DEFAULT_RUNTIME_REST_ENDPOINT, McpServerHandle, StartMcpServerOptions, createWeappViteMcpServer } from "@weapp-vite/mcp";
3
3
  //#region src/mcp.d.ts
4
4
  export interface ResolvedWeappMcpConfig {
package/dist/test.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as createCompilerContext } from "./createContext-2OomMtxv.mjs";
1
+ import { t as createCompilerContext } from "./createContext-CsYIo9DO.mjs";
2
2
  import path from "node:path";
3
3
  import process from "node:process";
4
4
  import chokidar from "chokidar";
package/dist/types.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { f as Resolver } from "./index-CaXAtb9e.mjs";
2
2
  import { n as AutoRoutesSubPackage, t as AutoRoutes } from "./routes-C7fCmf92.mjs";
3
- import { $ as WeappAnalyzeBudgetConfig, $t as GenerateFileType, A as Ref, An as StyleConfigObject, At as WeappPreloadRule, B as BindingErrorLike, Bn as WeappLibDtsOptions, Bt as WeappWebRuntimeConfig, Cn as NpmSubPackageConfig, Ct as WeappInjectRequestGlobalsTarget, D as MethodDefinitions, Dn as SharedChunkOverride, Dt as WeappMcpConfig, E as InlineConfig, En as SharedChunkMode, Et as WeappInjectWebRuntimeGlobalsTarget, F as RolldownPlugin, Fn as SubPackageStyleConfigObject, Ft as WeappRouteRules, G as EntryJsonFragment, Gn as WeappManagedAppTsconfigConfig, Gt as AlipayNpmMode, H as BaseEntry, Hn as WeappLibFileName, Ht as WeappWorkerConfig, I as RolldownPluginOption, In as SubPackageStyleEntry, It as WeappSubPackageConfig, J as ScanComponentItem, Jn as WeappManagedSharedTsconfigConfig, Jt as CopyGlobs, K as PageEntry, Kn as WeappManagedNodeTsconfigConfig, Kt as BuildNpmPackageMeta, L as RolldownWatchOptions, Ln as SubPackageStyleScope, Lt as WeappUniAppConfig, M as RolldownBuild, Mn as StyleScope, Mt as WeappReactConfig, N as RolldownOptions, Nn as SubPackage, Nt as WeappRequestRuntimeConfig, O as Plugin, On as SharedChunkStrategy, Ot as WeappNpmConfig, P as RolldownOutput, Pn as SubPackageStyleConfigEntry, Pt as WeappRouteRule, Q as UserConfig, Qn as WeappViteHostMeta, Qt as GenerateExtensionsOptions, R as RolldownWatcher, Rn as WeappLibComponentJson, Rt as WeappVueConfig, Sn as NpmStrategy, St as WeappInjectRequestGlobalsConfig, T as ConfigEnv, Tn as SharedChunkDynamicImports, Tt as WeappInjectWebRuntimeGlobalsConfig, U as ComponentEntry, Un as WeappLibInternalDtsOptions, Ut as Alias, V as AppEntry, Vn as WeappLibEntryContext, Vt as WeappWevuConfig, W as Entry, Wn as WeappLibVueTscOptions, Wt as AliasOptions, X as ProjectConfig, Xn as WeappWebConfig, Xt as DeprecatedInlineDynamicImports, Y as WxmlDep, Yn as WeappManagedTypeScriptConfig, Yt as CopyOptions, Z as SubPackageMetaValue, Zt as GenerateDirsOptions, _n as NpmBuildOptions, _t as WeappAutoRoutesInclude, an as GenerateTemplateFactory, at as WeappTailwindcssOptions, b as ChangeEvent, bn as NpmPackageFilesConfig, bt as WeappBuildScopeObjectConfig, cn as GenerateTemplateScope, ct as AutoImportComponentsOption, dn as JsonConfig, dt as HandleWxmlOptions, en as GenerateFilenamesOptions, et as WeappAnalyzeConfig, fn as JsonMergeContext, ft as MultiPlatformConfig, gn as MpPlatform, gt as WeappAutoRoutesConfig, hn as JsonMergeStrategy, ht as WeappAppPreludeMode, in as GenerateTemplateEntry, it as WeappForwardConsoleLogLevel, j as ResolvedConfig, jn as StyleEntry, jt as WeappReactCompilerConfig, k as PluginOption, kn as StyleConfigEntry, kt as WeappPreloadNetwork, ln as GenerateTemplatesConfig, lt as EnhanceOptions, mn as JsonMergeStage, mt as WeappAppPreludeConfig, nn as GenerateTemplate, nt as WeappDebugConfig, on as GenerateTemplateFileSource, ot as WeappViteConfig, pn as JsonMergeFunction, pt as ScanWxmlOptions, q as ComponentsMap, qn as WeappManagedServerTsconfigConfig, qt as ChunksConfig, rn as GenerateTemplateContext, rt as WeappForwardConsoleConfig, sn as GenerateTemplateInlineSource, sr as WeappViteRuntime, st as AutoImportComponents, tn as GenerateOptions, tt as WeappAnalyzeHistoryConfig, un as JsFormat, ut as EnhanceWxmlOptions, vn as NpmDependencyPattern, vt as WeappAutoRoutesIncludePattern, w as ComputedDefinitions, wn as ResolvedAlias, wt as WeappInjectWeapiConfig, x as WeappVitePluginApi, xn as NpmPluginPackageConfig, xt as WeappHmrConfig, yn as NpmMainPackageConfig, yt as WeappBuildScopeConfig, z as ViteDevServer, zn as WeappLibConfig, zt as WeappVueTemplateConfig } from "./config-D9e7hCm1.mjs";
3
+ import { $ as WeappAnalyzeBudgetConfig, $t as GenerateFileType, A as Ref, An as StyleConfigObject, At as WeappPreloadRule, B as BindingErrorLike, Bn as WeappLibDtsOptions, Bt as WeappWebRuntimeConfig, Cn as NpmSubPackageConfig, Ct as WeappInjectRequestGlobalsTarget, D as MethodDefinitions, Dn as SharedChunkOverride, Dt as WeappMcpConfig, E as InlineConfig, En as SharedChunkMode, Et as WeappInjectWebRuntimeGlobalsTarget, F as RolldownPlugin, Fn as SubPackageStyleConfigObject, Ft as WeappRouteRules, G as EntryJsonFragment, Gn as WeappManagedAppTsconfigConfig, Gt as AlipayNpmMode, H as BaseEntry, Hn as WeappLibFileName, Ht as WeappWorkerConfig, I as RolldownPluginOption, In as SubPackageStyleEntry, It as WeappSubPackageConfig, J as ScanComponentItem, Jn as WeappManagedSharedTsconfigConfig, Jt as CopyGlobs, K as PageEntry, Kn as WeappManagedNodeTsconfigConfig, Kt as BuildNpmPackageMeta, L as RolldownWatchOptions, Ln as SubPackageStyleScope, Lt as WeappUniAppConfig, M as RolldownBuild, Mn as StyleScope, Mt as WeappReactConfig, N as RolldownOptions, Nn as SubPackage, Nt as WeappRequestRuntimeConfig, O as Plugin, On as SharedChunkStrategy, Ot as WeappNpmConfig, P as RolldownOutput, Pn as SubPackageStyleConfigEntry, Pt as WeappRouteRule, Q as UserConfig, Qn as WeappViteHostMeta, Qt as GenerateExtensionsOptions, R as RolldownWatcher, Rn as WeappLibComponentJson, Rt as WeappVueConfig, Sn as NpmStrategy, St as WeappInjectRequestGlobalsConfig, T as ConfigEnv, Tn as SharedChunkDynamicImports, Tt as WeappInjectWebRuntimeGlobalsConfig, U as ComponentEntry, Un as WeappLibInternalDtsOptions, Ut as Alias, V as AppEntry, Vn as WeappLibEntryContext, Vt as WeappWevuConfig, W as Entry, Wn as WeappLibVueTscOptions, Wt as AliasOptions, X as ProjectConfig, Xn as WeappWebConfig, Xt as DeprecatedInlineDynamicImports, Y as WxmlDep, Yn as WeappManagedTypeScriptConfig, Yt as CopyOptions, Z as SubPackageMetaValue, Zt as GenerateDirsOptions, _n as NpmBuildOptions, _t as WeappAutoRoutesInclude, an as GenerateTemplateFactory, at as WeappTailwindcssOptions, b as ChangeEvent, bn as NpmPackageFilesConfig, bt as WeappBuildScopeObjectConfig, cn as GenerateTemplateScope, ct as AutoImportComponentsOption, dn as JsonConfig, dt as HandleWxmlOptions, en as GenerateFilenamesOptions, et as WeappAnalyzeConfig, fn as JsonMergeContext, ft as MultiPlatformConfig, gn as MpPlatform, gt as WeappAutoRoutesConfig, hn as JsonMergeStrategy, ht as WeappAppPreludeMode, in as GenerateTemplateEntry, it as WeappForwardConsoleLogLevel, j as ResolvedConfig, jn as StyleEntry, jt as WeappReactCompilerConfig, k as PluginOption, kn as StyleConfigEntry, kt as WeappPreloadNetwork, ln as GenerateTemplatesConfig, lt as EnhanceOptions, mn as JsonMergeStage, mt as WeappAppPreludeConfig, nn as GenerateTemplate, nt as WeappDebugConfig, on as GenerateTemplateFileSource, ot as WeappViteConfig, pn as JsonMergeFunction, pt as ScanWxmlOptions, q as ComponentsMap, qn as WeappManagedServerTsconfigConfig, qt as ChunksConfig, rn as GenerateTemplateContext, rt as WeappForwardConsoleConfig, sn as GenerateTemplateInlineSource, sr as WeappViteRuntime, st as AutoImportComponents, tn as GenerateOptions, tt as WeappAnalyzeHistoryConfig, un as JsFormat, ut as EnhanceWxmlOptions, vn as NpmDependencyPattern, vt as WeappAutoRoutesIncludePattern, w as ComputedDefinitions, wn as ResolvedAlias, wt as WeappInjectWeapiConfig, x as WeappVitePluginApi, xn as NpmPluginPackageConfig, xt as WeappHmrConfig, yn as NpmMainPackageConfig, yt as WeappBuildScopeConfig, z as ViteDevServer, zn as WeappLibConfig, zt as WeappVueTemplateConfig } from "./config-CDlfnbbb.mjs";
4
4
  import { t as WeappI18nConfig } from "./types-CgZn5X6j.mjs";
5
5
  export { Alias, AliasOptions, AlipayNpmMode, AppEntry, AutoImportComponents, AutoImportComponentsOption, AutoRoutes, AutoRoutesSubPackage, BaseEntry, BindingErrorLike, BuildNpmPackageMeta, ChangeEvent, ChunksConfig, ComponentEntry, ComponentsMap, type ComputedDefinitions, type ConfigEnv, CopyGlobs, CopyOptions, DeprecatedInlineDynamicImports, EnhanceOptions, EnhanceWxmlOptions, Entry, EntryJsonFragment, GenerateDirsOptions, GenerateExtensionsOptions, GenerateFileType, GenerateFilenamesOptions, GenerateOptions, GenerateTemplate, GenerateTemplateContext, GenerateTemplateEntry, GenerateTemplateFactory, GenerateTemplateFileSource, GenerateTemplateInlineSource, GenerateTemplateScope, GenerateTemplatesConfig, HandleWxmlOptions, type InlineConfig, JsFormat, JsonConfig, JsonMergeContext, JsonMergeFunction, JsonMergeStage, JsonMergeStrategy, type MethodDefinitions, MpPlatform, MultiPlatformConfig, NpmBuildOptions, NpmDependencyPattern, NpmMainPackageConfig, NpmPackageFilesConfig, NpmPluginPackageConfig, NpmStrategy, NpmSubPackageConfig, PageEntry, type Plugin, type PluginOption, ProjectConfig, type Ref, ResolvedAlias, type ResolvedConfig, type Resolver, type RolldownBuild, type RolldownOptions, type RolldownOutput, type RolldownPlugin, type RolldownPluginOption, type RolldownWatchOptions, type RolldownWatcher, ScanComponentItem, ScanWxmlOptions, SharedChunkDynamicImports, SharedChunkMode, SharedChunkOverride, SharedChunkStrategy, StyleConfigEntry, StyleConfigObject, StyleEntry, StyleScope, SubPackage, SubPackageMetaValue, SubPackageStyleConfigEntry, SubPackageStyleConfigObject, SubPackageStyleEntry, SubPackageStyleScope, UserConfig, type ViteDevServer, WeappAnalyzeBudgetConfig, WeappAnalyzeConfig, WeappAnalyzeHistoryConfig, WeappAppPreludeConfig, WeappAppPreludeMode, WeappAutoRoutesConfig, WeappAutoRoutesInclude, WeappAutoRoutesIncludePattern, WeappBuildScopeConfig, WeappBuildScopeObjectConfig, WeappDebugConfig, WeappForwardConsoleConfig, WeappForwardConsoleLogLevel, WeappHmrConfig, type WeappI18nConfig, WeappInjectRequestGlobalsConfig, WeappInjectRequestGlobalsTarget, WeappInjectWeapiConfig, WeappInjectWebRuntimeGlobalsConfig, WeappInjectWebRuntimeGlobalsTarget, WeappLibComponentJson, WeappLibConfig, WeappLibDtsOptions, WeappLibEntryContext, WeappLibFileName, WeappLibInternalDtsOptions, WeappLibVueTscOptions, WeappManagedAppTsconfigConfig, WeappManagedNodeTsconfigConfig, WeappManagedServerTsconfigConfig, WeappManagedSharedTsconfigConfig, WeappManagedTypeScriptConfig, WeappMcpConfig, WeappNpmConfig, WeappPreloadNetwork, WeappPreloadRule, WeappReactCompilerConfig, WeappReactConfig, WeappRequestRuntimeConfig, WeappRouteRule, WeappRouteRules, WeappSubPackageConfig, WeappTailwindcssOptions, WeappUniAppConfig, WeappViteConfig, type WeappViteHostMeta, WeappVitePluginApi, type WeappViteRuntime, WeappVueConfig, WeappVueTemplateConfig, WeappWebConfig, WeappWebRuntimeConfig, WeappWevuConfig, WeappWorkerConfig, WxmlDep };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-vite",
3
3
  "type": "module",
4
- "version": "7.1.3",
4
+ "version": "7.1.4",
5
5
  "description": "weapp-vite 一个现代化的小程序打包工具",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -129,33 +129,33 @@
129
129
  "registry": "https://registry.npmjs.org"
130
130
  },
131
131
  "dependencies": {
132
- "@babel/preset-env": "^8.0.5",
132
+ "@babel/preset-env": "^8.0.6",
133
133
  "@babel/preset-typescript": "^8.0.1",
134
134
  "@jridgewell/remapping": "^2.3.5",
135
135
  "@vercel/detect-agent": "^1.2.5",
136
136
  "@volar/typescript": "^2.4.28",
137
137
  "@vue/language-core": "^3.3.11",
138
- "@weapp-core/constants": "0.2.4",
139
- "@weapp-core/init": "6.0.20",
140
- "@weapp-core/logger": "3.1.4",
141
- "@weapp-core/schematics": "6.2.4",
142
- "@weapp-core/shared": "3.2.3",
143
- "@weapp-vite/ast": "7.1.3",
144
- "@weapp-vite/eslint": "0.2.5",
145
- "@weapp-vite/i18n": "0.2.4",
146
- "@weapp-vite/mcp": "1.5.4",
147
- "@weapp-vite/miniprogram-automator": "1.2.19",
148
- "@weapp-vite/volar": "2.1.8",
149
- "@weapp-vite/web": "1.5.3",
150
- "@wevu/api": "0.3.3",
151
- "@wevu/web-apis": "1.3.0",
138
+ "@weapp-core/constants": "0.2.5",
139
+ "@weapp-core/init": "6.0.21",
140
+ "@weapp-core/logger": "3.1.5",
141
+ "@weapp-core/schematics": "6.2.5",
142
+ "@weapp-core/shared": "3.2.4",
143
+ "@weapp-vite/ast": "7.1.4",
144
+ "@weapp-vite/eslint": "0.2.6",
145
+ "@weapp-vite/i18n": "0.2.5",
146
+ "@weapp-vite/mcp": "1.5.5",
147
+ "@weapp-vite/miniprogram-automator": "1.2.20",
148
+ "@weapp-vite/volar": "2.1.9",
149
+ "@weapp-vite/web": "1.5.4",
150
+ "@wevu/api": "0.3.4",
151
+ "@wevu/web-apis": "1.3.1",
152
152
  "cac": "^7.0.0",
153
153
  "chokidar": "^5.0.0",
154
154
  "comment-json": "^5.0.0",
155
155
  "fdir": "^6.5.0",
156
156
  "htmlparser2": "^12.0.0",
157
157
  "local-pkg": "^1.2.1",
158
- "lru-cache": "^11.5.2",
158
+ "lru-cache": "^11.5.3",
159
159
  "magic-string": "^1.4.1",
160
160
  "merge": "^2.1.1",
161
161
  "obug": "^3.0.0",
@@ -167,17 +167,17 @@
167
167
  "postcss-value-parser": "4.2.0",
168
168
  "rolldown": "1.2.9",
169
169
  "rolldown-plugin-dts": "0.28.6",
170
- "rolldown-require": "2.0.30",
170
+ "rolldown-require": "2.0.31",
171
171
  "semver": "^7.8.5",
172
172
  "typescript": "^6.0.3",
173
173
  "vite": "8.3.0",
174
- "vite-plugin-performance": "2.0.3",
174
+ "vite-plugin-performance": "2.0.4",
175
175
  "vite-tsconfig-paths": "^6.1.1",
176
176
  "vue": "^3.5.43",
177
177
  "vue-tsc": "^3.3.11",
178
- "weapp-ide-cli": "6.1.5",
179
- "weapp-tailwindcss": "^5.5.5",
180
- "wevu": "7.1.3"
178
+ "weapp-ide-cli": "6.1.6",
179
+ "weapp-tailwindcss": "^5.5.6",
180
+ "wevu": "7.1.4"
181
181
  },
182
182
  "optionalDependencies": {
183
183
  "@swc/core": "^1.16.2"
@@ -1,2 +0,0 @@
1
- import { t as extractConfigFromVue } from "./file-CD9gXASh.mjs";
2
- export { extractConfigFromVue };
@@ -1,2 +0,0 @@
1
- import { n as getCompilerContext } from "./createContext-2OomMtxv.mjs";
2
- export { getCompilerContext };