weapp-vite 6.17.4 → 6.17.5

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 { g as getRouteRuntimeGlobalKeys, n as getCompilerContext } from "./createContext-NJm1STBE.mjs";
1
+ import { g as getRouteRuntimeGlobalKeys, n as getCompilerContext } from "./createContext-9Js_PRb0.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 createCjsConfigLoadError, E as isPathInside, S as parseCommentJson, T as shouldPassPlatformArgToIdeOpen, _ as createBuildScopeConfigFromCli, a as formatBytes, b as getProjectConfigFileName, d as syncProjectSupportFiles, f as syncManagedTsconfigBootstrapFiles, h as resolveHmrProfileJsonPath, m as SHARED_CHUNK_VIRTUAL_PREFIX, p as createSharedBuildConfig, t as createCompilerContext, u as resolveWeappViteTarget, v as resolveWeappConfigFile, w as getDefaultIdeProjectRoot, x as loadViteConfigFile, y as checkRuntime } from "./createContext-NJm1STBE.mjs";
1
+ import { C as createCjsConfigLoadError, E as isPathInside, S as parseCommentJson, T as shouldPassPlatformArgToIdeOpen, _ as createBuildScopeConfigFromCli, a as formatBytes, b as getProjectConfigFileName, d as syncProjectSupportFiles, f as syncManagedTsconfigBootstrapFiles, h as resolveHmrProfileJsonPath, m as SHARED_CHUNK_VIRTUAL_PREFIX, p as createSharedBuildConfig, t as createCompilerContext, u as resolveWeappViteTarget, v as resolveWeappConfigFile, w as getDefaultIdeProjectRoot, x as loadViteConfigFile, y as checkRuntime } from "./createContext-9Js_PRb0.mjs";
2
2
  import { r as logger_default, t as colors } from "./logger-mt4mSTqV.mjs";
3
- import { h as VERSION } from "./file-CACV6Tje.mjs";
3
+ import { h as VERSION } from "./file-C2QH0iM5.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 path, { posix } from "pathe";
@@ -4122,7 +4122,7 @@ function resolveRunnableHotkeyDefinition(input) {
4122
4122
  }
4123
4123
  //#endregion
4124
4124
  //#region package.json
4125
- var version = "6.17.4";
4125
+ var version = "6.17.5";
4126
4126
  //#endregion
4127
4127
  //#region src/cli/devHotkeys/format.ts
4128
4128
  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 { _ 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-CACV6Tje.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-C2QH0iM5.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";
@@ -17888,12 +17888,35 @@ const WEVU_SRC_CHUNK_RE = /(?:^|\/)wevu-src\.js$/;
17888
17888
  const WEVU_EXPORT_ALIASES = [["defineComponent", "__wevuDefineComponent"], ["createWevuComponent", "__wevuCreateWevuComponent"]];
17889
17889
  const WEVU_INTERNAL_RUNTIME_EXPORTS = ["createApp", "setWevuDefaults"];
17890
17890
  const WEVU_INTERNAL_RUNTIME_EXPORT_SET = new Set(WEVU_INTERNAL_RUNTIME_EXPORTS);
17891
- const WEVU_INTERNAL_MODULE_IDS = [
17892
- "wevu/internal-runtime",
17893
- "wevu/internal-reactivity",
17894
- "wevu/internal-template"
17891
+ const WEVU_RUNTIME_MODULE_IDS = [
17892
+ "wevu",
17893
+ "wevu/router",
17894
+ "wevu/store",
17895
+ "wevu/api",
17896
+ "wevu/fetch",
17897
+ "wevu/web-apis",
17898
+ ...[
17899
+ "wevu/internal-runtime",
17900
+ "wevu/internal-reactivity",
17901
+ "wevu/internal-template"
17902
+ ]
17895
17903
  ];
17896
- const WEVU_INTERNAL_MODULE_EXPORT_MARKERS = {
17904
+ const WEVU_RUNTIME_MODULE_EXPORT_MARKERS = {
17905
+ "wevu": WEVU_INTERNAL_RUNTIME_EXPORTS,
17906
+ "wevu/router": [
17907
+ "createRouter",
17908
+ "useRouter",
17909
+ "useRoute",
17910
+ "NavigationFailureType"
17911
+ ],
17912
+ "wevu/store": [
17913
+ "defineStore",
17914
+ "createPinia",
17915
+ "storeToRefs"
17916
+ ],
17917
+ "wevu/api": ["createApi", "defineApi"],
17918
+ "wevu/fetch": ["createFetch", "useFetch"],
17919
+ "wevu/web-apis": ["installWebApis", "createWebApis"],
17897
17920
  "wevu/internal-runtime": WEVU_INTERNAL_RUNTIME_EXPORTS,
17898
17921
  "wevu/internal-reactivity": [
17899
17922
  "ref",
@@ -18041,8 +18064,8 @@ function collectExistingExportNames(code) {
18041
18064
  function collectChunkExportNames(chunk) {
18042
18065
  return collectExistingExportNames(chunk.code);
18043
18066
  }
18044
- function isWevuInternalModuleId(value) {
18045
- return WEVU_INTERNAL_MODULE_IDS.includes(value);
18067
+ function isWevuRuntimeModuleId(value) {
18068
+ return WEVU_RUNTIME_MODULE_IDS.includes(value);
18046
18069
  }
18047
18070
  function resolveWevuInternalChunk(bundle, importNames) {
18048
18071
  const requiredNames = new Set(importNames);
@@ -18053,6 +18076,15 @@ function resolveWevuInternalChunk(bundle, importNames) {
18053
18076
  return [...requiredNames].every((name) => exports.has(name));
18054
18077
  });
18055
18078
  }
18079
+ function resolveWevuRuntimeChunkByModuleId(bundle, moduleId) {
18080
+ const chunkFileName = moduleId.replace(/\//g, "-");
18081
+ return Object.values(bundle).find((output) => {
18082
+ if (!output || output.type !== "chunk" || typeof output.code !== "string" || !output.fileName.startsWith("weapp-vendors/")) return false;
18083
+ const normalizedFileName = output.fileName.replace(/\\/g, "/");
18084
+ if (moduleId === "wevu") return normalizedFileName.endsWith(`${chunkFileName}.js`);
18085
+ return normalizedFileName.endsWith(`${chunkFileName}.js`) || normalizedFileName.includes(`/${chunkFileName}-`);
18086
+ });
18087
+ }
18056
18088
  function resolveWevuInternalChunkByExportMarkers(bundle, markers, excludedFileNames) {
18057
18089
  const markerSet = new Set(markers);
18058
18090
  if (!markerSet.size) return;
@@ -18062,16 +18094,16 @@ function resolveWevuInternalChunkByExportMarkers(bundle, markers, excludedFileNa
18062
18094
  return [...markerSet].some((name) => exports.has(name));
18063
18095
  });
18064
18096
  }
18065
- function rememberWevuInternalChunk(moduleId, chunk, options) {
18097
+ function rememberWevuRuntimeChunk(moduleId, chunk, options) {
18066
18098
  if (!chunk?.fileName) return;
18067
18099
  if (moduleId === "wevu/internal-runtime") options.onRuntimeFileName?.(chunk.fileName);
18068
18100
  options.onRuntimeModuleFileName?.(moduleId, chunk.fileName);
18069
18101
  }
18070
- function rememberCurrentWevuInternalChunks(bundle, options) {
18102
+ function rememberCurrentWevuRuntimeChunks(bundle, options) {
18071
18103
  const rememberedFileNames = /* @__PURE__ */ new Set();
18072
- for (const moduleId of WEVU_INTERNAL_MODULE_IDS) {
18073
- const chunk = resolveWevuInternalChunkByExportMarkers(bundle, WEVU_INTERNAL_MODULE_EXPORT_MARKERS[moduleId], rememberedFileNames);
18074
- rememberWevuInternalChunk(moduleId, chunk, options);
18104
+ for (const moduleId of WEVU_RUNTIME_MODULE_IDS) {
18105
+ const chunk = resolveWevuRuntimeChunkByModuleId(bundle, moduleId) ?? resolveWevuInternalChunkByExportMarkers(bundle, WEVU_RUNTIME_MODULE_EXPORT_MARKERS[moduleId], rememberedFileNames);
18106
+ rememberWevuRuntimeChunk(moduleId, chunk, options);
18075
18107
  if (chunk?.fileName) rememberedFileNames.add(chunk.fileName);
18076
18108
  }
18077
18109
  }
@@ -18094,11 +18126,11 @@ function formatNamedRequireBindings(bindings) {
18094
18126
  }).join(", ");
18095
18127
  }
18096
18128
  function rewriteWevuInternalRuntimeImports(bundle, options = {}) {
18097
- const importRe = /\bimport\s*\{([^}]*)\}\s*from\s*["'](wevu(?:\/internal-(?:runtime|reactivity|template))?)["'];?/g;
18098
- const requireRe = /\brequire\(\s*(`wevu(?:\/internal-(?:runtime|reactivity|template))?`|'wevu(?:\/internal-(?:runtime|reactivity|template))?'|"wevu(?:\/internal-(?:runtime|reactivity|template))?")\s*\)/g;
18129
+ const importRe = /\bimport\s*\{([^}]*)\}\s*from\s*["'](wevu(?:\/(?:router|store|api|fetch|web-apis|internal-(?:runtime|reactivity|template)))?)["'];?/g;
18130
+ const requireRe = /\brequire\(\s*(`wevu(?:\/(?:router|store|api|fetch|web-apis|internal-(?:runtime|reactivity|template)))?`|'wevu(?:\/(?:router|store|api|fetch|web-apis|internal-(?:runtime|reactivity|template)))?'|"wevu(?:\/(?:router|store|api|fetch|web-apis|internal-(?:runtime|reactivity|template)))?")\s*\)/g;
18099
18131
  const currentRuntimeChunk = resolveWevuInternalChunk(bundle, WEVU_INTERNAL_RUNTIME_EXPORTS);
18100
- if (currentRuntimeChunk) rememberWevuInternalChunk("wevu/internal-runtime", currentRuntimeChunk, options);
18101
- rememberCurrentWevuInternalChunks(bundle, options);
18132
+ if (currentRuntimeChunk) rememberWevuRuntimeChunk("wevu/internal-runtime", currentRuntimeChunk, options);
18133
+ rememberCurrentWevuRuntimeChunks(bundle, options);
18102
18134
  for (const output of Object.values(bundle)) {
18103
18135
  if (!output || output.type !== "chunk" && output.type !== "asset") continue;
18104
18136
  const code = resolveOutputCode(output);
@@ -18111,13 +18143,13 @@ function rewriteWevuInternalRuntimeImports(bundle, options = {}) {
18111
18143
  rewritten = rewritten.replace(importRe, (full, importClause, source) => {
18112
18144
  const bindings = parseNamedImportBindings(importClause);
18113
18145
  const importedNames = bindings.map((binding) => binding.importedName);
18114
- const runtimeChunk = resolveWevuInternalChunk(bundle, importedNames);
18115
- const resolvedInternalModuleId = isWevuInternalModuleId(source) ? source : "wevu/internal-runtime";
18146
+ const runtimeChunk = isWevuRuntimeModuleId(source) ? resolveWevuRuntimeChunkByModuleId(bundle, source) ?? resolveWevuInternalChunk(bundle, importedNames) : resolveWevuInternalChunk(bundle, importedNames);
18147
+ const resolvedInternalModuleId = isWevuRuntimeModuleId(source) ? source : "wevu/internal-runtime";
18116
18148
  const canUseRememberedRuntime = resolvedInternalModuleId === "wevu/internal-runtime" && importedNames.every((importedName) => WEVU_INTERNAL_RUNTIME_EXPORT_SET.has(importedName));
18117
18149
  const rememberedRuntimeFileName = options.runtimeFileNames?.get(resolvedInternalModuleId) ?? (canUseRememberedRuntime ? options.runtimeFileName : void 0);
18118
18150
  const runtimeFileName = runtimeChunk?.fileName ?? rememberedRuntimeFileName;
18119
18151
  if (!runtimeFileName) return full;
18120
- rememberWevuInternalChunk(resolvedInternalModuleId, runtimeChunk, options);
18152
+ rememberWevuRuntimeChunk(resolvedInternalModuleId, runtimeChunk, options);
18121
18153
  changed = true;
18122
18154
  requiredRuntimeFileNames.add(runtimeFileName);
18123
18155
  const specifier = normalizeRelativeRequireSpecifier(fileName, runtimeFileName);
@@ -18126,8 +18158,8 @@ function rewriteWevuInternalRuntimeImports(bundle, options = {}) {
18126
18158
  rewritten = rewritten.replace(requireRe, (full, rawSpecifier) => {
18127
18159
  const specifierValue = stripQuotes(rawSpecifier);
18128
18160
  const canUseRememberedRuntime = specifierValue === "wevu/internal-runtime" || specifierValue === "wevu" && WEVU_INTERNAL_RUNTIME_EXPORTS.some((exportName) => new RegExp(`\\b${exportName}\\b`).test(code));
18129
- const rememberedRuntimeFileName = isWevuInternalModuleId(specifierValue) ? options.runtimeFileNames?.get(specifierValue) : void 0;
18130
- const runtimeFileName = canUseRememberedRuntime ? currentRuntimeChunk?.fileName ?? rememberedRuntimeFileName ?? options.runtimeFileName : void 0;
18161
+ const rememberedRuntimeFileName = isWevuRuntimeModuleId(specifierValue) ? options.runtimeFileNames?.get(specifierValue) : void 0;
18162
+ const runtimeFileName = canUseRememberedRuntime ? currentRuntimeChunk?.fileName ?? rememberedRuntimeFileName ?? options.runtimeFileName : rememberedRuntimeFileName;
18131
18163
  if (!runtimeFileName) return full;
18132
18164
  changed = true;
18133
18165
  requiredRuntimeFileNames.add(runtimeFileName);
@@ -18150,7 +18182,7 @@ function rewriteWevuInternalRuntimeImports(bundle, options = {}) {
18150
18182
  }
18151
18183
  function rewriteWevuInternalRuntimeImportCode(fileName, code, runtimeFileNameOrOptions) {
18152
18184
  const options = typeof runtimeFileNameOrOptions === "string" ? { runtimeFileName: runtimeFileNameOrOptions } : runtimeFileNameOrOptions ?? {};
18153
- if (!options.runtimeFileName && !options.runtimeFileNames?.size || !code.includes("wevu/internal-runtime") && !code.includes("wevu/internal-reactivity") && !code.includes("wevu/internal-template") && !code.includes("from 'wevu'") && !code.includes("from \"wevu\"") && !code.includes("require('wevu") && !code.includes("require(\"wevu") && !code.includes("require(`wevu")) return code;
18185
+ if (!options.runtimeFileName && !options.runtimeFileNames?.size || !code.includes("wevu/internal-runtime") && !code.includes("wevu/internal-reactivity") && !code.includes("wevu/internal-template") && !code.includes("wevu/router") && !code.includes("wevu/store") && !code.includes("wevu/api") && !code.includes("wevu/fetch") && !code.includes("wevu/web-apis") && !code.includes("from 'wevu'") && !code.includes("from \"wevu\"") && !code.includes("require('wevu") && !code.includes("require(\"wevu") && !code.includes("require(`wevu")) return code;
18154
18186
  const output = {
18155
18187
  type: "asset",
18156
18188
  fileName,
@@ -26067,7 +26099,7 @@ async function loadAppEntry(ctx, scanState) {
26067
26099
  const vueAppPath = await findVueEntry(appBasename);
26068
26100
  let configFromVue;
26069
26101
  if (!appConfigFile && vueAppPath) {
26070
- const { extractConfigFromVue } = await import("./file-D2wi4SbQ.mjs");
26102
+ const { extractConfigFromVue } = await import("./file-CqYuBh-m.mjs");
26071
26103
  configFromVue = await extractConfigFromVue(vueAppPath);
26072
26104
  if (configFromVue) appConfigFile = vueAppPath;
26073
26105
  }
@@ -84,7 +84,7 @@ function resolveAutoRoutesMacroImportPath() {
84
84
  }
85
85
  async function resolveAutoRoutesInlineSnapshot() {
86
86
  try {
87
- const { getCompilerContext } = await import("./getInstance-DXiqgBgg.mjs");
87
+ const { getCompilerContext } = await import("./getInstance-Dd__T_L5.mjs");
88
88
  const compilerContext = getCompilerContext();
89
89
  const service = compilerContext.autoRoutesService;
90
90
  const reference = service?.getReference?.();
@@ -0,0 +1,2 @@
1
+ import { t as extractConfigFromVue } from "./file-C2QH0iM5.mjs";
2
+ export { extractConfigFromVue };
@@ -0,0 +1,2 @@
1
+ import { n as getCompilerContext } from "./createContext-9Js_PRb0.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-NJm1STBE.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-9Js_PRb0.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-CRoKWQZn.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-vite",
3
3
  "type": "module",
4
- "version": "6.17.4",
4
+ "version": "6.17.5",
5
5
  "description": "weapp-vite 一个现代化的小程序打包工具",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -117,14 +117,14 @@
117
117
  "typescript": "^6.0.3",
118
118
  "vite": "8.1.0",
119
119
  "vite-tsconfig-paths": "^6.1.1",
120
- "vue": "^3.5.38",
120
+ "vue": "^3.5.39",
121
121
  "vue-tsc": "^3.3.5",
122
122
  "@weapp-core/constants": "0.1.12",
123
123
  "@weapp-core/init": "6.0.11",
124
124
  "@weapp-core/logger": "3.1.1",
125
125
  "@weapp-core/schematics": "6.0.4",
126
126
  "@weapp-core/shared": "3.0.5",
127
- "@weapp-vite/ast": "6.17.4",
127
+ "@weapp-vite/ast": "6.17.5",
128
128
  "@weapp-vite/mcp": "1.4.6",
129
129
  "@weapp-vite/miniprogram-automator": "1.2.5",
130
130
  "@weapp-vite/volar": "2.1.0",
@@ -134,7 +134,7 @@
134
134
  "rolldown-require": "2.0.19",
135
135
  "vite-plugin-performance": "2.0.1",
136
136
  "weapp-ide-cli": "5.4.10",
137
- "wevu": "6.17.4"
137
+ "wevu": "6.17.5"
138
138
  },
139
139
  "publishConfig": {
140
140
  "access": "public",
@@ -1,2 +0,0 @@
1
- import { t as extractConfigFromVue } from "./file-CACV6Tje.mjs";
2
- export { extractConfigFromVue };
@@ -1,2 +0,0 @@
1
- import { n as getCompilerContext } from "./createContext-NJm1STBE.mjs";
2
- export { getCompilerContext };