weapp-vite 6.20.3 → 6.20.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, v as getRouteRuntimeGlobalKeys } from "./createContext-DavT7XIA.mjs";
1
+ import { n as getCompilerContext, v as getRouteRuntimeGlobalKeys } from "./createContext-DoH-W4mj.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 parseCommentJson, D as isPathInside, E as shouldPassPlatformArgToIdeOpen, S as loadViteConfigFile, T as getDefaultIdeProjectRoot, _ as resolveHmrProfileJsonPath, a as formatBytes, b as checkRuntime, d as getBackendForCapability, f as resolveBackendExecution, g as SHARED_CHUNK_VIRTUAL_PREFIX, h as createSharedBuildConfig, m as syncManagedTsconfigBootstrapFiles, p as syncProjectSupportFiles, t as createCompilerContext, w as createCjsConfigLoadError, x as getProjectConfigFileName, y as resolveWeappConfigFile } from "./createContext-DavT7XIA.mjs";
1
+ import { C as parseCommentJson, D as isPathInside, E as shouldPassPlatformArgToIdeOpen, S as loadViteConfigFile, T as getDefaultIdeProjectRoot, _ as resolveHmrProfileJsonPath, a as formatBytes, b as checkRuntime, d as getBackendForCapability, f as resolveBackendExecution, g as SHARED_CHUNK_VIRTUAL_PREFIX, h as createSharedBuildConfig, m as syncManagedTsconfigBootstrapFiles, p as syncProjectSupportFiles, t as createCompilerContext, w as createCjsConfigLoadError, x as getProjectConfigFileName, y as resolveWeappConfigFile } from "./createContext-DoH-W4mj.mjs";
2
2
  import { r as logger_default, t as colors } from "./logger-mt4mSTqV.mjs";
3
- import { h as VERSION } from "./file-AiMZtyLe.mjs";
3
+ import { h as VERSION } from "./file-DnVj_L9_.mjs";
4
4
  import { c as startWeappViteMcpServer, l as detectAiDevelopmentEnvironment, s as resolveWeappMcpConfig } from "./mcp-BG6TliEg.mjs";
5
5
  import { createRequire } from "node:module";
6
6
  import fs from "node:fs";
@@ -3654,7 +3654,10 @@ async function readLatestHmrProfileSummary(options) {
3654
3654
  //#region src/cli/commands/ide.ts
3655
3655
  async function runIdeDoctor(projectPath, options) {
3656
3656
  const resolvedCli = await resolveCliPath();
3657
- const servicePort = await detectWechatDevtoolsServicePort().catch((error) => ({
3657
+ const servicePort = await detectWechatDevtoolsServicePort().then((result) => ({
3658
+ ...result,
3659
+ error: void 0
3660
+ })).catch((error) => ({
3658
3661
  servicePortEnabled: void 0,
3659
3662
  servicePort: void 0,
3660
3663
  error
@@ -3810,50 +3813,51 @@ async function runIdeCommand(action, root, options) {
3810
3813
  cliPlatform: targets.rawPlatform
3811
3814
  });
3812
3815
  if (action !== "doctor" && resolved.platform !== "weapp") throw new Error("`weapp-vite ide logs` 当前仅支持微信小程序平台。");
3813
- if (action !== "doctor" && !resolved.projectPath) throw new Error("无法解析微信开发者工具项目目录,请显式传入 root 或检查 project.config.json。");
3814
3816
  if (action === "doctor") {
3815
3817
  await runIdeDoctor(resolved.projectPath, options);
3816
3818
  return;
3817
3819
  }
3820
+ const projectPath = resolved.projectPath;
3821
+ if (!projectPath) throw new Error("无法解析微信开发者工具项目目录,请显式传入 root 或检查 project.config.json。");
3818
3822
  if (action === "setup") {
3819
3823
  const result = await bootstrapWechatDevtoolsSettings({
3820
- projectPath: resolved.projectPath,
3824
+ projectPath,
3821
3825
  trustProject: options.trustProject
3822
3826
  });
3823
3827
  logger_default.info(`已完成微信开发者工具配置预热:扫描实例 ${result.touchedInstanceCount} 个,检测服务端口配置 ${result.detectedSecurityCount} 处,写入项目信任 ${result.trustedProjectCount} 处。`);
3824
3828
  return;
3825
3829
  }
3826
- if (options.open) await openIde(resolved.platform, resolved.projectPath, {
3830
+ if (options.open) await openIde(resolved.platform, projectPath, {
3827
3831
  openRecovery: options.openRecovery,
3828
3832
  trustProject: options.trustProject,
3829
3833
  openStrategy: options.ideOpenStrategy
3830
3834
  });
3831
3835
  if (action === "info") {
3832
- const result = await getWechatIdeToolInfo({ projectPath: resolved.projectPath });
3836
+ const result = await getWechatIdeToolInfo({ projectPath });
3833
3837
  logger_default.info(formatIdeOutput(result, options));
3834
3838
  return;
3835
3839
  }
3836
3840
  if (action === "test-accounts") {
3837
- const result = await getWechatIdeTestAccounts({ projectPath: resolved.projectPath });
3841
+ const result = await getWechatIdeTestAccounts({ projectPath });
3838
3842
  logger_default.info(formatIdeOutput(result, options));
3839
3843
  return;
3840
3844
  }
3841
3845
  if (action === "ticket") {
3842
- const result = await getWechatIdeTicket({ projectPath: resolved.projectPath });
3846
+ const result = await getWechatIdeTicket({ projectPath });
3843
3847
  logger_default.info(formatIdeOutput(result, options));
3844
3848
  return;
3845
3849
  }
3846
3850
  if (action === "ticket:set") {
3847
3851
  if (!options.ticket) throw new Error("`weapp-vite ide ticket:set` 需要提供 --ticket。");
3848
3852
  await setWechatIdeTicket({
3849
- projectPath: resolved.projectPath,
3853
+ projectPath,
3850
3854
  ticket: options.ticket
3851
3855
  });
3852
3856
  logger_default.info(`已设置微信开发者工具 ticket:${options.ticket}`);
3853
3857
  return;
3854
3858
  }
3855
3859
  if (action === "ticket:refresh") {
3856
- await refreshWechatIdeTicket({ projectPath: resolved.projectPath });
3860
+ await refreshWechatIdeTicket({ projectPath });
3857
3861
  logger_default.info("已刷新微信开发者工具 ticket。");
3858
3862
  return;
3859
3863
  }
@@ -3871,8 +3875,8 @@ async function runIdeCommand(action, root, options) {
3871
3875
  });
3872
3876
  if (latestHmrSummary) logger_default.info(latestHmrSummary.line);
3873
3877
  const session = await startForwardConsoleBridge({
3874
- projectPath: resolved.projectPath,
3875
- port: resolveProjectAutomatorPort(resolved.projectPath),
3878
+ projectPath,
3879
+ port: resolveProjectAutomatorPort(projectPath),
3876
3880
  agentName: void 0,
3877
3881
  logLevels: forwardConsoleOptions.logLevels,
3878
3882
  unhandledErrors: forwardConsoleOptions.unhandledErrors,
@@ -4727,7 +4731,7 @@ function resolveRunnableHotkeyDefinition(input) {
4727
4731
  }
4728
4732
  //#endregion
4729
4733
  //#region package.json
4730
- var version = "6.20.3";
4734
+ var version = "6.20.4";
4731
4735
  //#endregion
4732
4736
  //#region src/cli/devHotkeys/format.ts
4733
4737
  const FULLWIDTH_ASCII_START = 65281;
@@ -1,6 +1,6 @@
1
1
  import { n as applyWeappViteHostMeta } from "./pluginHost--CaeyWpA.mjs";
2
2
  import { n as configureLogger, r as logger_default } from "./logger-mt4mSTqV.mjs";
3
- import { C as isNativeTemplateSource, S as ALL_NATIVE_STYLE_RESOLVER_EXTENSIONS, T as MINI_PROGRAM_PLATFORM_ADAPTERS, _ as jsExtensions, a as findJsonEntry, b as templateExtensions, 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 scriptExtensions, w as isSourceStyleExtension, x as vueExtensions, y as supportedCssLangs } from "./file-AiMZtyLe.mjs";
3
+ import { C as isNativeTemplateSource, S as ALL_NATIVE_STYLE_RESOLVER_EXTENSIONS, T as MINI_PROGRAM_PLATFORM_ADAPTERS, _ as jsExtensions, a as findJsonEntry, b as templateExtensions, 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 scriptExtensions, w as isSourceStyleExtension, x as vueExtensions, y as supportedCssLangs } from "./file-DnVj_L9_.mjs";
4
4
  import { createRequire, isBuiltin } from "node:module";
5
5
  import { createDebug } from "obug";
6
6
  import fs, { existsSync, readFileSync, realpathSync } from "node:fs";
@@ -263,6 +263,11 @@ function createModuleGraphService() {
263
263
  let topologyRescan;
264
264
  const entryDependencies = /* @__PURE__ */ new Map();
265
265
  const pendingChanges = /* @__PURE__ */ new Map();
266
+ const hasRegisteredEntryDependency = (file) => {
267
+ if (entryDependencies.has(file)) return true;
268
+ for (const dependenciesByKind of entryDependencies.values()) for (const sourceIds of dependenciesByKind.values()) if (sourceIds.has(file)) return true;
269
+ return false;
270
+ };
266
271
  const collectFromBuildGraph = (file, affected) => {
267
272
  for (const buildContext of buildContexts.values()) {
268
273
  if (typeof buildContext.getModuleInfo !== "function") continue;
@@ -368,6 +373,7 @@ function createModuleGraphService() {
368
373
  },
369
374
  hasModule(rawFile) {
370
375
  const file = normalizeSourceId(rawFile);
376
+ if (hasRegisteredEntryDependency(file)) return true;
371
377
  if (devServer) return collectDevStartNodes(devServer, file).size > 0;
372
378
  return Array.from(buildContexts.values()).some((context) => collectBuildStartIds(context, file).size > 0);
373
379
  },
@@ -19806,14 +19812,15 @@ function withScopedSlotHostAsset(ctx, fileName, buffer) {
19806
19812
  }
19807
19813
  function patchScopedSlotHostAssetForBundle(ctx, fileName, output) {
19808
19814
  if (output.type === "chunk") {
19809
- const current = output.code;
19815
+ const chunk = output;
19816
+ const current = chunk.code;
19810
19817
  if (typeof current !== "string") return false;
19811
19818
  if (!getScopedSlotGenericKeys(ctx, fileName)?.size || ctx.configService.platform !== "weapp" || current.includes(WEVU_SLOT_OWNER_ID_PROP)) return false;
19812
- const transformCode = resolveOutputChunkTransformCode(output);
19813
- const injected = injectScopedSlotHostPropertiesInJs(transformCode, { sourceMap: Boolean(normalizeEncodedSourceMapLike(output.map)) || transformCode !== current });
19814
- if (injected.transformed) return applyOutputChunkTransform(output, injected.code, injected.map);
19819
+ const transformCode = resolveOutputChunkTransformCode(chunk);
19820
+ const injected = injectScopedSlotHostPropertiesInJs(transformCode, { sourceMap: Boolean(normalizeEncodedSourceMapLike(chunk.map)) || transformCode !== current });
19821
+ if (injected.transformed) return applyOutputChunkTransform(chunk, injected.code, injected.map);
19815
19822
  const propertySource = createScopedSlotHostPropertiesSource();
19816
- return replaceOutputChunkCode(output, /Component\(\s*\{/, (match) => `${match[0]} properties: { ${propertySource} },`);
19823
+ return replaceOutputChunkCode(chunk, /Component\(\s*\{/, (match) => `${match[0]} properties: { ${propertySource} },`);
19817
19824
  }
19818
19825
  const current = output.source;
19819
19826
  if (typeof current !== "string" && !Buffer.isBuffer(current) && !(current instanceof Uint8Array)) return false;
@@ -33524,7 +33531,7 @@ async function loadAppEntry(ctx, scanState) {
33524
33531
  const { path: appEntryPath } = appEntry;
33525
33532
  let configFromVue;
33526
33533
  if (!appConfigFile && vueAppPath) {
33527
- const { extractConfigFromVue } = await import("./file-D0RifY1q.mjs");
33534
+ const { extractConfigFromVue } = await import("./file-BPMjkByK.mjs");
33528
33535
  configFromVue = await extractConfigFromVue(vueAppPath);
33529
33536
  if (configFromVue) appConfigFile = vueAppPath;
33530
33537
  }
@@ -0,0 +1,2 @@
1
+ import { t as extractConfigFromVue } from "./file-DnVj_L9_.mjs";
2
+ export { extractConfigFromVue };
@@ -134,7 +134,7 @@ function resolveAutoRoutesMacroImportPath() {
134
134
  }
135
135
  async function resolveAutoRoutesInlineSnapshot() {
136
136
  try {
137
- const { getCompilerContext } = await import("./getInstance-Czvi9cUi.mjs");
137
+ const { getCompilerContext } = await import("./getInstance-BPs9XIGi.mjs");
138
138
  const compilerContext = getCompilerContext();
139
139
  const service = compilerContext.autoRoutesService;
140
140
  const reference = service?.getReference?.();
@@ -0,0 +1,2 @@
1
+ import { n as getCompilerContext } from "./createContext-DoH-W4mj.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-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 getSupportedWeappViteTargetDescriptors, l as isWebPlatform, o as WEB_PLATFORM_ALIASES, s as getSupportedWeappVitePlatforms, t as createCompilerContext, u as resolveWeappViteTarget } from "./createContext-DavT7XIA.mjs";
4
+ import { c as getSupportedWeappViteTargetDescriptors, l as isWebPlatform, o as WEB_PLATFORM_ALIASES, s as getSupportedWeappVitePlatforms, t as createCompilerContext, u as resolveWeappViteTarget } from "./createContext-DoH-W4mj.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/test.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as createCompilerContext } from "./createContext-DavT7XIA.mjs";
1
+ import { t as createCompilerContext } from "./createContext-DoH-W4mj.mjs";
2
2
  import path from "node:path";
3
3
  import process from "node:process";
4
4
  import chokidar from "chokidar";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-vite",
3
3
  "type": "module",
4
- "version": "6.20.3",
4
+ "version": "6.20.4",
5
5
  "description": "weapp-vite 一个现代化的小程序打包工具",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -128,21 +128,21 @@
128
128
  "vue": "^3.5.41",
129
129
  "vue-tsc": "^3.3.9",
130
130
  "@weapp-core/constants": "0.1.17",
131
- "@weapp-core/init": "6.0.14",
132
- "@weapp-core/logger": "3.1.1",
133
131
  "@weapp-core/schematics": "6.1.0",
132
+ "@weapp-core/logger": "3.1.1",
133
+ "@weapp-core/init": "6.0.14",
134
134
  "@weapp-core/shared": "3.1.1",
135
- "@weapp-vite/ast": "6.20.3",
135
+ "@weapp-vite/ast": "6.20.4",
136
136
  "@weapp-vite/mcp": "1.4.14",
137
137
  "@weapp-vite/miniprogram-automator": "1.2.13",
138
- "@weapp-vite/volar": "2.1.3",
139
- "@weapp-vite/web": "1.4.8",
138
+ "@weapp-vite/web": "1.4.9",
140
139
  "@wevu/api": "0.2.16",
140
+ "@weapp-vite/volar": "2.1.3",
141
141
  "@wevu/web-apis": "1.2.34",
142
142
  "rolldown-require": "2.0.25",
143
143
  "vite-plugin-performance": "2.0.1",
144
144
  "weapp-ide-cli": "6.0.6",
145
- "wevu": "6.20.3"
145
+ "wevu": "6.20.4"
146
146
  },
147
147
  "publishConfig": {
148
148
  "access": "public",
@@ -1,2 +0,0 @@
1
- import { t as extractConfigFromVue } from "./file-AiMZtyLe.mjs";
2
- export { extractConfigFromVue };
@@ -1,2 +0,0 @@
1
- import { n as getCompilerContext } from "./createContext-DavT7XIA.mjs";
2
- export { getCompilerContext };