weapp-vite 6.15.15 → 6.15.16

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 { d as getRouteRuntimeGlobalKeys, i as getCompilerContext } from "./createContext-Bwdmz5ML.mjs";
1
+ import { d as getRouteRuntimeGlobalKeys, i as getCompilerContext } from "./createContext-xOVHRF1m.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,6 +1,6 @@
1
- import { C as isPathInside, S as shouldPassPlatformArgToIdeOpen, _ as createCjsConfigLoadError, b as normalizeMiniPlatform, c as createSharedBuildConfig, f as resolveWeappConfigFile, g as parseCommentJson, h as loadViteConfigFile, l as SHARED_CHUNK_VIRTUAL_PREFIX, m as getProjectConfigFileName, n as syncProjectSupportFiles, p as checkRuntime, r as syncManagedTsconfigBootstrapFiles, s as formatBytes, t as createCompilerContext, u as resolveHmrProfileJsonPath, v as DEFAULT_MP_PLATFORM, x as resolveMiniPlatform, y as getDefaultIdeProjectRoot } from "./createContext-Bwdmz5ML.mjs";
1
+ import { C as isPathInside, S as shouldPassPlatformArgToIdeOpen, _ as createCjsConfigLoadError, b as normalizeMiniPlatform, c as createSharedBuildConfig, f as resolveWeappConfigFile, g as parseCommentJson, h as loadViteConfigFile, l as SHARED_CHUNK_VIRTUAL_PREFIX, m as getProjectConfigFileName, n as syncProjectSupportFiles, p as checkRuntime, r as syncManagedTsconfigBootstrapFiles, s as formatBytes, t as createCompilerContext, u as resolveHmrProfileJsonPath, v as DEFAULT_MP_PLATFORM, x as resolveMiniPlatform, y as getDefaultIdeProjectRoot } from "./createContext-xOVHRF1m.mjs";
2
2
  import { r as logger_default, t as colors } from "./logger-CgxdNjvb.mjs";
3
- import { h as VERSION } from "./file-fMqSV4Z9.mjs";
3
+ import { h as VERSION } from "./file-DEHK6p9s.mjs";
4
4
  import { a as resolveWeappMcpConfig, o as startWeappViteMcpServer } from "./mcp-DRlj32v4.mjs";
5
5
  import { createRequire } from "node:module";
6
6
  import path, { posix } from "pathe";
@@ -2784,7 +2784,7 @@ function resolveRunnableHotkeyDefinition(input) {
2784
2784
  }
2785
2785
  //#endregion
2786
2786
  //#region package.json
2787
- var version = "6.15.15";
2787
+ var version = "6.15.16";
2788
2788
  //#endregion
2789
2789
  //#region src/cli/devHotkeys/format.ts
2790
2790
  const FULLWIDTH_ASCII_START = 65281;
@@ -1,6 +1,6 @@
1
1
  import { n as applyWeappViteHostMeta } from "./pluginHost-SJdl15d3.mjs";
2
2
  import { n as configureLogger, r as logger_default } from "./logger-CgxdNjvb.mjs";
3
- import { _ as jsExtensions, a as findJsonEntry, b as vueExtensions, c as isJsOrTs, d as touch, g as configExtensions, i as findJsEntry, l as isTemplate, n as changeFileExtension, o as findTemplateEntry, p as inlineAutoRoutesImports, r as findCssEntry, s as findVueEntry, t as extractConfigFromVue, v as supportedCssLangs, y as templateExtensions } from "./file-fMqSV4Z9.mjs";
3
+ import { _ as jsExtensions, a as findJsonEntry, b as vueExtensions, c as isJsOrTs, d as touch, g as configExtensions, i as findJsEntry, l as isTemplate, n as changeFileExtension, o as findTemplateEntry, p as inlineAutoRoutesImports, r as findCssEntry, s as findVueEntry, t as extractConfigFromVue, v as supportedCssLangs, y as templateExtensions } from "./file-DEHK6p9s.mjs";
4
4
  import { createRequire, isBuiltin } from "node:module";
5
5
  import path, { posix } from "pathe";
6
6
  import path$1, { normalize, relative, win32 } from "node:path";
@@ -10589,8 +10589,44 @@ function createBuildService(ctx) {
10589
10589
  };
10590
10590
  delete snapshotBuildOptions.build?.watch;
10591
10591
  const snapshotWatcherRoot = `${configService.absoluteSrcRoot}::dev-snapshot`;
10592
- let snapshotBuildChain = Promise.resolve();
10592
+ let snapshotBuildChain = Promise.resolve(void 0);
10593
10593
  let devWatcherClosed = false;
10594
+ async function resolveSnapshotSidecarEntryId(reason) {
10595
+ if (reason?.event !== "update" || !reason.file) return;
10596
+ const normalizedFile = normalizeFsResolvedId(reason.file);
10597
+ const configSuffix = configSuffixes$1.find((suffix) => normalizedFile.endsWith(suffix));
10598
+ const ext = path.extname(normalizedFile);
10599
+ if (!configSuffix && !(ext && (watchedCssExts.has(ext) || watchedTemplateExts.has(ext)))) return;
10600
+ const primaryScript = await findJsEntry(configSuffix ? normalizedFile.slice(0, -configSuffix.length) : ext ? normalizedFile.slice(0, -ext.length) : normalizedFile);
10601
+ if (!primaryScript.path) return;
10602
+ const entryId = normalizeFsResolvedId(primaryScript.path);
10603
+ if (!ctx.runtimeState.build.hmr.resolvedEntryMap.has(entryId)) return;
10604
+ const relativeSrc = configService.relativeAbsoluteSrcRoot(entryId);
10605
+ if (relativeSrc === "layouts" || relativeSrc.startsWith("layouts/")) return;
10606
+ return entryId;
10607
+ }
10608
+ function markSnapshotEntriesFullDirty() {
10609
+ for (const entryId of ctx.runtimeState.build.hmr.resolvedEntryMap.keys()) {
10610
+ ctx.runtimeState.build.hmr.dirtyEntrySet.add(entryId);
10611
+ ctx.runtimeState.build.hmr.dirtyEntryReasons.set(entryId, "direct");
10612
+ ctx.runtimeState.build.hmr.loadedEntrySet.delete(entryId);
10613
+ }
10614
+ ctx.runtimeState.build.hmr.profile = {
10615
+ ...ctx.runtimeState.build.hmr.profile,
10616
+ dirtyCount: ctx.runtimeState.build.hmr.dirtyEntrySet.size,
10617
+ dirtyReasonSummary: [`snapshot-full:${ctx.runtimeState.build.hmr.resolvedEntryMap.size}`]
10618
+ };
10619
+ }
10620
+ function markSnapshotEntryDirty(entryId) {
10621
+ ctx.runtimeState.build.hmr.dirtyEntrySet.add(entryId);
10622
+ ctx.runtimeState.build.hmr.dirtyEntryReasons.set(entryId, "direct");
10623
+ ctx.runtimeState.build.hmr.loadedEntrySet.delete(entryId);
10624
+ ctx.runtimeState.build.hmr.profile = {
10625
+ ...ctx.runtimeState.build.hmr.profile,
10626
+ dirtyCount: ctx.runtimeState.build.hmr.dirtyEntrySet.size,
10627
+ dirtyReasonSummary: ["sidecar-direct:1"]
10628
+ };
10629
+ }
10594
10630
  const runSnapshotBuild = (reason) => {
10595
10631
  if (devWatcherClosed) return snapshotBuildChain;
10596
10632
  const startedAt = reason ? performance.now() : 0;
@@ -10602,14 +10638,17 @@ function createBuildService(ctx) {
10602
10638
  file: reason.file,
10603
10639
  watchToDirtyMs: performance.now() - startedAt
10604
10640
  };
10605
- for (const entryId of ctx.runtimeState.build.hmr.resolvedEntryMap.keys()) {
10606
- ctx.runtimeState.build.hmr.dirtyEntrySet.add(entryId);
10607
- ctx.runtimeState.build.hmr.dirtyEntryReasons.set(entryId, "direct");
10608
- ctx.runtimeState.build.hmr.loadedEntrySet.delete(entryId);
10641
+ const sidecarEntryId = await resolveSnapshotSidecarEntryId(reason);
10642
+ if (sidecarEntryId) {
10643
+ markSnapshotEntryDirty(sidecarEntryId);
10644
+ await touch(sidecarEntryId);
10645
+ return "forwarded";
10609
10646
  }
10647
+ markSnapshotEntriesFullDirty();
10610
10648
  process.env.WEAPP_VITE_FORCE_FULL_HMR_SHARED_CHUNKS = "1";
10611
10649
  try {
10612
10650
  await build(snapshotBuildOptions);
10651
+ return "snapshot";
10613
10652
  } finally {
10614
10653
  delete process.env.WEAPP_VITE_FORCE_FULL_HMR_SHARED_CHUNKS;
10615
10654
  }
@@ -10639,7 +10678,6 @@ function createBuildService(ctx) {
10639
10678
  else if (e.code === "END") {
10640
10679
  const durationMs = performance.now() - startTime;
10641
10680
  (async () => {
10642
- await runSnapshotBuild();
10643
10681
  if (firstBuildCompleted) {
10644
10682
  finalizeHmrProfile(durationMs);
10645
10683
  recordHmrProfile(durationMs);
@@ -10675,7 +10713,8 @@ function createBuildService(ctx) {
10675
10713
  runSnapshotBuild({
10676
10714
  event: event.startsWith("unlink") ? "delete" : event.startsWith("add") ? "create" : "update",
10677
10715
  file: id
10678
- }).then(() => {
10716
+ }).then((result) => {
10717
+ if (result !== "snapshot") return;
10679
10718
  const durationMs = performance.now() - sidecarStartedAt;
10680
10719
  finalizeHmrProfile(durationMs);
10681
10720
  recordHmrProfile(durationMs);
@@ -22181,7 +22220,7 @@ async function loadAppEntry(ctx, scanState) {
22181
22220
  const vueAppPath = await findVueEntry(appBasename);
22182
22221
  let configFromVue;
22183
22222
  if (!appConfigFile && vueAppPath) {
22184
- const { extractConfigFromVue } = await import("./file-C7J-GBEl.mjs");
22223
+ const { extractConfigFromVue } = await import("./file-CNC4V9ax.mjs");
22185
22224
  configFromVue = await extractConfigFromVue(vueAppPath);
22186
22225
  if (configFromVue) appConfigFile = vueAppPath;
22187
22226
  }
@@ -0,0 +1,2 @@
1
+ import { t as extractConfigFromVue } from "./file-DEHK6p9s.mjs";
2
+ export { extractConfigFromVue };
@@ -84,7 +84,7 @@ function resolveAutoRoutesMacroImportPath() {
84
84
  }
85
85
  async function resolveAutoRoutesInlineSnapshot() {
86
86
  try {
87
- const { getCompilerContext } = await import("./getInstance-C_LndkCo.mjs");
87
+ const { getCompilerContext } = await import("./getInstance-DP821mDU.mjs");
88
88
  const compilerContext = getCompilerContext();
89
89
  const service = compilerContext.autoRoutesService;
90
90
  const reference = service?.getReference?.();
@@ -0,0 +1,2 @@
1
+ import { i as getCompilerContext } from "./createContext-xOVHRF1m.mjs";
2
+ export { getCompilerContext };
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-D0HkutE0.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 { t as defineConfig } from "./config-DJjSbpNX.mjs";
4
- import { t as createCompilerContext } from "./createContext-Bwdmz5ML.mjs";
4
+ import { t as createCompilerContext } from "./createContext-xOVHRF1m.mjs";
5
5
  import { i as createWevuComponent, n as defineProps, r as setPageLayout, t as defineEmits } from "./runtime-DN3lxU9s.mjs";
6
6
  export { WEAPP_VITE_HOST_NAME, applyWeappViteHostMeta, createCompilerContext, createWeappViteHostMeta, createWevuComponent, defineAppJson, defineComponentJson, defineConfig, defineEmits, definePageJson, defineProps, defineSitemapJson, defineThemeJson, isWeappViteHost, resolveWeappViteHostMeta, setPageLayout };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-vite",
3
3
  "type": "module",
4
- "version": "6.15.15",
4
+ "version": "6.15.16",
5
5
  "description": "weapp-vite 一个现代化的小程序打包工具",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -122,7 +122,7 @@
122
122
  "@weapp-core/logger": "3.1.1",
123
123
  "@weapp-core/schematics": "6.0.4",
124
124
  "@weapp-core/shared": "3.0.4",
125
- "@weapp-vite/ast": "6.15.15",
125
+ "@weapp-vite/ast": "6.15.16",
126
126
  "@weapp-vite/mcp": "1.2.1",
127
127
  "@weapp-vite/miniprogram-automator": "1.0.4",
128
128
  "@weapp-vite/volar": "2.1.0",
@@ -132,7 +132,7 @@
132
132
  "rolldown-require": "2.0.15",
133
133
  "vite-plugin-performance": "2.0.1",
134
134
  "weapp-ide-cli": "5.2.6",
135
- "wevu": "6.15.15"
135
+ "wevu": "6.15.16"
136
136
  },
137
137
  "publishConfig": {
138
138
  "access": "public",
@@ -1,2 +0,0 @@
1
- import { t as extractConfigFromVue } from "./file-fMqSV4Z9.mjs";
2
- export { extractConfigFromVue };
@@ -1,2 +0,0 @@
1
- import { i as getCompilerContext } from "./createContext-Bwdmz5ML.mjs";
2
- export { getCompilerContext };