weapp-vite 6.16.29 → 6.16.31

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, i as getCompilerContext } from "./createContext-wBxmdc_3.mjs";
1
+ import { g as getRouteRuntimeGlobalKeys, i as getCompilerContext } from "./createContext-DvtQaPg3.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, b as getProjectConfigFileName, f as resolveWeappViteTarget, h as resolveHmrProfileJsonPath, m as SHARED_CHUNK_VIRTUAL_PREFIX, n as syncProjectSupportFiles, p as createSharedBuildConfig, r as syncManagedTsconfigBootstrapFiles, s as formatBytes, t as createCompilerContext, v as resolveWeappConfigFile, w as getDefaultIdeProjectRoot, x as loadViteConfigFile, y as checkRuntime } from "./createContext-wBxmdc_3.mjs";
1
+ import { C as createCjsConfigLoadError, E as isPathInside, S as parseCommentJson, T as shouldPassPlatformArgToIdeOpen, _ as createBuildScopeConfigFromCli, b as getProjectConfigFileName, f as resolveWeappViteTarget, h as resolveHmrProfileJsonPath, m as SHARED_CHUNK_VIRTUAL_PREFIX, n as syncProjectSupportFiles, p as createSharedBuildConfig, r as syncManagedTsconfigBootstrapFiles, s as formatBytes, t as createCompilerContext, v as resolveWeappConfigFile, w as getDefaultIdeProjectRoot, x as loadViteConfigFile, y as checkRuntime } from "./createContext-DvtQaPg3.mjs";
2
2
  import { r as logger_default, t as colors } from "./logger-mt4mSTqV.mjs";
3
- import { h as VERSION } from "./file-DgdYQ44n.mjs";
3
+ import { h as VERSION } from "./file-ULixDCLO.mjs";
4
4
  import { o as resolveWeappMcpConfig, s as startWeappViteMcpServer } from "./mcp-qmDOTH07.mjs";
5
5
  import { createRequire } from "node:module";
6
6
  import path, { posix } from "pathe";
@@ -3708,7 +3708,7 @@ function resolveRunnableHotkeyDefinition(input) {
3708
3708
  }
3709
3709
  //#endregion
3710
3710
  //#region package.json
3711
- var version = "6.16.29";
3711
+ var version = "6.16.31";
3712
3712
  //#endregion
3713
3713
  //#region src/cli/devHotkeys/format.ts
3714
3714
  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-DgdYQ44n.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-ULixDCLO.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";
@@ -5324,7 +5324,8 @@ function createRegistryHelpers(state) {
5324
5324
  },
5325
5325
  value: {
5326
5326
  name: componentName,
5327
- from
5327
+ from,
5328
+ resolvedId: resolvedJsEntry
5328
5329
  }
5329
5330
  });
5330
5331
  state.scheduleManifestWrite(true);
@@ -13329,10 +13330,18 @@ function ensureScriptlessComponentAsset(pluginCtx, bundle, relativeBase, scriptE
13329
13330
  }
13330
13331
  //#endregion
13331
13332
  //#region src/plugins/vue/transform/emitAssets.ts
13332
- const emittedAssetSourceCache = /* @__PURE__ */ new Map();
13333
+ let emittedAssetSourceCacheByBundle = /* @__PURE__ */ new WeakMap();
13333
13334
  function hasOwn$4(source, key) {
13334
13335
  return Object.prototype.hasOwnProperty.call(source, key);
13335
13336
  }
13337
+ function getEmittedAssetSourceCache(bundle) {
13338
+ let cache = emittedAssetSourceCacheByBundle.get(bundle);
13339
+ if (!cache) {
13340
+ cache = /* @__PURE__ */ new Map();
13341
+ emittedAssetSourceCacheByBundle.set(bundle, cache);
13342
+ }
13343
+ return cache;
13344
+ }
13336
13345
  /**
13337
13346
  * 统一拼接 SFC 相关产物文件名。
13338
13347
  */
@@ -13350,6 +13359,7 @@ function parseJsonSafely$2(source) {
13350
13359
  function emitSfcTemplateIfMissing(ctx, bundle, relativeBase, template, extension = "wxml") {
13351
13360
  const fileName = resolveSfcAssetFileName(relativeBase, extension);
13352
13361
  const cacheKey = `asset:${fileName}`;
13362
+ const emittedAssetSourceCache = getEmittedAssetSourceCache(bundle);
13353
13363
  const existing = bundle[fileName];
13354
13364
  if (existing && existing.type === "asset") {
13355
13365
  if ((existing.source?.toString?.() ?? "") !== template) existing.source = template;
@@ -13367,6 +13377,7 @@ function emitSfcTemplateIfMissing(ctx, bundle, relativeBase, template, extension
13367
13377
  function emitSfcStyleIfMissing(ctx, bundle, relativeBase, style, extension = "wxss", options) {
13368
13378
  const fileName = resolveSfcAssetFileName(relativeBase, extension);
13369
13379
  const cacheKey = `asset:${fileName}`;
13380
+ const emittedAssetSourceCache = getEmittedAssetSourceCache(bundle);
13370
13381
  const existing = bundle[fileName];
13371
13382
  if (existing && existing.type === "asset") {
13372
13383
  if (options?.updateExisting === false) {
@@ -13388,6 +13399,7 @@ function emitSfcStyleIfMissing(ctx, bundle, relativeBase, style, extension = "wx
13388
13399
  function emitSfcJsonAsset(ctx, bundle, relativeBase, result, options) {
13389
13400
  const jsonFileName = resolveSfcAssetFileName(relativeBase, options.extension ?? "json");
13390
13401
  const cacheKey = `asset:${jsonFileName}`;
13402
+ const emittedAssetSourceCache = getEmittedAssetSourceCache(bundle);
13391
13403
  const existing = bundle[jsonFileName];
13392
13404
  const mergeJson = createJsonMerger(options.mergeStrategy, {
13393
13405
  filename: jsonFileName,
@@ -13443,6 +13455,7 @@ function emitSfcJsonAsset(ctx, bundle, relativeBase, result, options) {
13443
13455
  function emitClassStyleWxsAssetIfMissing(ctx, bundle, fileName, source) {
13444
13456
  const existing = bundle[fileName];
13445
13457
  const cacheKey = `asset:${fileName}`;
13458
+ const emittedAssetSourceCache = getEmittedAssetSourceCache(bundle);
13446
13459
  if (existing && existing.type === "asset") {
13447
13460
  if ((existing.source?.toString?.() ?? "") !== source) existing.source = source;
13448
13461
  emittedAssetSourceCache.set(cacheKey, source);
@@ -14145,13 +14158,19 @@ function createAutoImportPlugin(state) {
14145
14158
  pollInterval: 20
14146
14159
  }
14147
14160
  }));
14148
- watcher.on("add", (filePath) => {
14161
+ const registerAndRefreshComponent = (filePath, action) => {
14149
14162
  if (!getAutoImportCandidateKind(filePath)) return;
14150
14163
  if (!matchesAutoImportGlobs(ctx, filePath)) return;
14151
- logger_default.info(`[auto-import:watch] 新增组件文件 ${configService.relativeCwd(filePath)}`);
14164
+ logger_default.info(`[auto-import:watch] ${action}组件文件 ${configService.relativeCwd(filePath)}`);
14152
14165
  autoImportService.registerPotentialComponent(filePath).then(async () => {
14153
14166
  await refreshAutoImportImporters(ctx, filePath);
14154
14167
  });
14168
+ };
14169
+ watcher.on("add", (filePath) => {
14170
+ registerAndRefreshComponent(filePath, "新增");
14171
+ });
14172
+ watcher.on("change", (filePath) => {
14173
+ registerAndRefreshComponent(filePath, "变更");
14155
14174
  });
14156
14175
  watcher.on("unlink", (filePath) => {
14157
14176
  if (!getAutoImportCandidateKind(filePath)) return;
@@ -14460,14 +14479,20 @@ function createAutoImportAugmenter(autoImportService, wxmlService, externalCompo
14460
14479
  })();
14461
14480
  const injectedEntries = [];
14462
14481
  for (const [name, resolved] of Object.entries(resolvedComponents)) {
14482
+ const trackResolvedId = () => {
14483
+ if (resolved.resolvedId) externalComponentEntryMap?.set(resolved.from.replace(/^\/+/, ""), resolved.resolvedId);
14484
+ };
14463
14485
  const usingComponents = get(json, "usingComponents");
14464
14486
  if (isObject(usingComponents) && Reflect.has(usingComponents, name)) {
14465
- if (usingComponents[name] === resolved.from) injectedEntries.push(resolved.from);
14487
+ if (usingComponents[name] === resolved.from) {
14488
+ trackResolvedId();
14489
+ injectedEntries.push(resolved.from);
14490
+ }
14466
14491
  continue;
14467
14492
  }
14468
14493
  set(json, `usingComponents.${name}`, resolved.from);
14469
14494
  injectedEntries.push(resolved.from);
14470
- if (resolved.resolvedId) externalComponentEntryMap?.set(resolved.from.replace(/^\/+/, ""), resolved.resolvedId);
14495
+ trackResolvedId();
14471
14496
  }
14472
14497
  return injectedEntries;
14473
14498
  };
@@ -15776,7 +15801,7 @@ function prepareNormalizedEntries(options) {
15776
15801
  return normalizedEntries;
15777
15802
  }
15778
15803
  async function emitEntryOutput(options) {
15779
- const { pluginCtx, id, type, json: initialJson, jsonPath, templatePath, isPluginBuild, normalizedEntries, pluginResolvedRecords, pluginJsonPathForRegistration, pluginJsonForRegistration, resolveEntriesWithCache, resolveMappedEntry, entryResolveRoot, configService, wxmlService, resolvedEntryMap, loadedEntrySet, dirtyEntrySet, forceEmitEntrySet, replaceLayoutDependencies, emitEntriesChunks, registerJsonAsset, existsCache, pathExistsTtlMs, debug, relativeCwdId, getTime, emittedWxmlCodeCache } = options;
15804
+ const { pluginCtx, id, type, json: initialJson, jsonPath, templatePath, isPluginBuild, normalizedEntries, pluginResolvedRecords, pluginJsonPathForRegistration, pluginJsonForRegistration, resolveEntriesWithCache, resolveMappedEntry, entryResolveRoot, configService, wxmlService, resolvedEntryMap, loadedEntrySet, dirtyEntrySet, forceEmitEntrySet, forceReloadEntrySet, replaceLayoutDependencies, emitEntriesChunks, registerJsonAsset, existsCache, pathExistsTtlMs, debug, relativeCwdId, getTime, emittedWxmlCodeCache } = options;
15780
15805
  let json = initialJson;
15781
15806
  async function emitNativeLayoutAssets(layoutBasePath) {
15782
15807
  if (typeof pluginCtx.emitFile !== "function") return;
@@ -15869,8 +15894,10 @@ async function emitEntryOutput(options) {
15869
15894
  if (normalizedResolvedId && !isSkippableResolvedId(normalizedResolvedId) && path.isAbsolute(normalizedResolvedId)) addNormalizedWatchFile(pluginCtx, normalizedResolvedId);
15870
15895
  if (normalizedResolvedId && !isSkippableResolvedId(normalizedResolvedId)) resolvedEntryMap.set(normalizedResolvedId, resolvedId);
15871
15896
  const isForcedEntry = forceEmitEntrySet?.has(entry) === true || forceEmitEntrySet?.has(normalizedResolvedId) === true;
15897
+ const isForcedReloadEntry = forceReloadEntrySet?.has(entry) === true || forceReloadEntrySet?.has(normalizedResolvedId) === true;
15872
15898
  const isDirtyEntry = dirtyEntrySet.has(normalizedResolvedId);
15873
15899
  if (!isDirtyEntry && !isForcedEntry && loadedEntrySet.has(normalizedResolvedId)) continue;
15900
+ if (isForcedReloadEntry) loadedEntrySet.delete(normalizedResolvedId);
15874
15901
  pendingResolvedIds.push(resolvedId);
15875
15902
  if (isDirtyEntry || isForcedEntry) dirtyEntrySet.delete(normalizedResolvedId);
15876
15903
  }
@@ -16202,6 +16229,7 @@ function createEntryLoader(options) {
16202
16229
  let appResult;
16203
16230
  let shouldSkipAppEntries = false;
16204
16231
  const forceEmitEntrySet = /* @__PURE__ */ new Set();
16232
+ const forceReloadEntrySet = /* @__PURE__ */ new Set();
16205
16233
  const nativeLayoutScriptEntries = /* @__PURE__ */ new Set();
16206
16234
  let autoRoutesSignature = configService.isDev ? ctx.autoRoutesService?.getSignature?.() : void 0;
16207
16235
  const registerPageLayoutComponentEntries = async (layoutPlan, options) => {
@@ -16344,7 +16372,9 @@ function createEntryLoader(options) {
16344
16372
  for (const componentEntry of mergedComponentEntries) {
16345
16373
  const normalizedComponentEntry = normalizeEntry(componentEntry, jsonPath);
16346
16374
  explicitEntryTypes.set(normalizedComponentEntry, "component");
16347
- if (pendingAutoImportEntries.includes(componentEntry) || injectedAutoImportEntries.includes(componentEntry)) forceEmitEntrySet.add(normalizedComponentEntry);
16375
+ const isPendingAutoImportEntry = pendingAutoImportEntries.includes(componentEntry);
16376
+ if (isPendingAutoImportEntry || injectedAutoImportEntries.includes(componentEntry)) forceEmitEntrySet.add(normalizedComponentEntry);
16377
+ if (isPendingAutoImportEntry) forceReloadEntrySet.add(normalizedComponentEntry);
16348
16378
  }
16349
16379
  }
16350
16380
  const normalizedEntries = shouldSkipAppEntries ? [] : prepareNormalizedEntries({
@@ -16383,6 +16413,7 @@ function createEntryLoader(options) {
16383
16413
  loadedEntrySet,
16384
16414
  dirtyEntrySet,
16385
16415
  forceEmitEntrySet,
16416
+ forceReloadEntrySet,
16386
16417
  replaceLayoutDependencies,
16387
16418
  emitEntriesChunks,
16388
16419
  registerJsonAsset,
@@ -24634,7 +24665,7 @@ async function loadAppEntry(ctx, scanState) {
24634
24665
  const vueAppPath = await findVueEntry(appBasename);
24635
24666
  let configFromVue;
24636
24667
  if (!appConfigFile && vueAppPath) {
24637
- const { extractConfigFromVue } = await import("./file-obpuUUBb.mjs");
24668
+ const { extractConfigFromVue } = await import("./file-DJGJe9rY.mjs");
24638
24669
  configFromVue = await extractConfigFromVue(vueAppPath);
24639
24670
  if (configFromVue) appConfigFile = vueAppPath;
24640
24671
  }
@@ -0,0 +1,2 @@
1
+ import { t as extractConfigFromVue } from "./file-ULixDCLO.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-wSKEctAH.mjs");
87
+ const { getCompilerContext } = await import("./getInstance-CSoROi2f.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-DvtQaPg3.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 WEB_PLATFORM_ALIASES, d as isWebPlatform, f as resolveWeappViteTarget, l as getSupportedWeappVitePlatforms, t as createCompilerContext, u as getSupportedWeappViteTargetDescriptors } from "./createContext-wBxmdc_3.mjs";
4
+ import { c as WEB_PLATFORM_ALIASES, d as isWebPlatform, f as resolveWeappViteTarget, l as getSupportedWeappVitePlatforms, t as createCompilerContext, u as getSupportedWeappViteTargetDescriptors } from "./createContext-DvtQaPg3.mjs";
5
5
  import { i as createWevuComponent, n as defineProps, r as setPageLayout, t as defineEmits } from "./runtime-C3z9pDQB.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, resolveWeappViteHostMeta, resolveWeappViteTarget, setPageLayout };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-vite",
3
3
  "type": "module",
4
- "version": "6.16.29",
4
+ "version": "6.16.31",
5
5
  "description": "weapp-vite 一个现代化的小程序打包工具",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -93,7 +93,7 @@
93
93
  "@jridgewell/remapping": "^2.3.5",
94
94
  "@vercel/detect-agent": "^1.2.3",
95
95
  "@volar/typescript": "^2.4.28",
96
- "@vue/language-core": "^3.3.2",
96
+ "@vue/language-core": "^3.3.3",
97
97
  "cac": "^7.0.0",
98
98
  "chokidar": "^5.0.0",
99
99
  "comment-json": "^5.0.0",
@@ -116,13 +116,13 @@
116
116
  "vite": "8.0.14",
117
117
  "vite-tsconfig-paths": "^6.1.1",
118
118
  "vue": "^3.5.35",
119
- "vue-tsc": "^3.3.2",
119
+ "vue-tsc": "^3.3.3",
120
120
  "@weapp-core/constants": "0.1.12",
121
121
  "@weapp-core/init": "6.0.9",
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.16.29",
125
+ "@weapp-vite/ast": "6.16.31",
126
126
  "@weapp-vite/mcp": "1.3.6",
127
127
  "@weapp-vite/miniprogram-automator": "1.1.3",
128
128
  "@weapp-vite/volar": "2.1.0",
@@ -132,7 +132,7 @@
132
132
  "rolldown-require": "2.0.18",
133
133
  "vite-plugin-performance": "2.0.1",
134
134
  "weapp-ide-cli": "5.3.2",
135
- "wevu": "6.16.29"
135
+ "wevu": "6.16.31"
136
136
  },
137
137
  "publishConfig": {
138
138
  "access": "public",
@@ -1,2 +0,0 @@
1
- import { t as extractConfigFromVue } from "./file-DgdYQ44n.mjs";
2
- export { extractConfigFromVue };
@@ -1,2 +0,0 @@
1
- import { i as getCompilerContext } from "./createContext-wBxmdc_3.mjs";
2
- export { getCompilerContext };