weapp-vite 6.16.5 → 6.16.6

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.
@@ -125,7 +125,7 @@ const TDesignResolver = (opts) => {
125
125
  if (!from.startsWith("tdesign-miniprogram/")) return;
126
126
  const segments = from.slice(20).split("/").filter(Boolean);
127
127
  const componentDir = segments[0];
128
- const fileBase = segments.at(-1);
128
+ const fileBase = segments[segments.length - 1];
129
129
  if (!componentDir || !fileBase) return;
130
130
  const baseDir = `miniprogram_dist/${componentDir}`;
131
131
  const base = `${baseDir}/${fileBase}`;
@@ -1,4 +1,4 @@
1
- import { g as getRouteRuntimeGlobalKeys, i as getCompilerContext } from "./createContext-CnilYzXS.mjs";
1
+ import { g as getRouteRuntimeGlobalKeys, i as getCompilerContext } from "./createContext-BEnghhM9.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 getDefaultIdeProjectRoot, S as createCjsConfigLoadError, T as isPathInside, _ as resolveWeappConfigFile, b as loadViteConfigFile, 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 checkRuntime, w as shouldPassPlatformArgToIdeOpen, x as parseCommentJson, y as getProjectConfigFileName } from "./createContext-CnilYzXS.mjs";
1
+ import { C as getDefaultIdeProjectRoot, S as createCjsConfigLoadError, T as isPathInside, _ as resolveWeappConfigFile, b as loadViteConfigFile, 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 checkRuntime, w as shouldPassPlatformArgToIdeOpen, x as parseCommentJson, y as getProjectConfigFileName } from "./createContext-BEnghhM9.mjs";
2
2
  import { r as logger_default, t as colors } from "./logger-CgxdNjvb.mjs";
3
- import { h as VERSION } from "./file-D_s683Q5.mjs";
3
+ import { h as VERSION } from "./file-CR2wVRDX.mjs";
4
4
  import { o as resolveWeappMcpConfig, s as startWeappViteMcpServer } from "./mcp-DV3K2AVD.mjs";
5
5
  import { createRequire } from "node:module";
6
6
  import path, { posix } from "pathe";
@@ -240,11 +240,14 @@ async function closeIde$1() {
240
240
  function formatReuseOpenedWechatIdePrompt() {
241
241
  return `目标项目已在微信开发者工具中打开,已跳过重复打开。按 ${colors.bold(colors.green("r"))} 关闭当前窗口后重新打开。`;
242
242
  }
243
+ function disconnectMiniProgram(miniProgram) {
244
+ miniProgram.disconnect();
245
+ }
243
246
  async function openWechatIdeByAutomator(projectPath) {
244
- (await launchAutomator({
247
+ disconnectMiniProgram(await launchAutomator({
245
248
  projectPath,
246
249
  trustProject: true
247
- })).disconnect();
250
+ }));
248
251
  }
249
252
  async function connectOpenedProject(projectPath) {
250
253
  try {
@@ -262,7 +265,7 @@ async function connectOpenedProject(projectPath) {
262
265
  async function tryReuseOpenedWechatIde(projectPath, closeIde) {
263
266
  const miniProgram = await connectOpenedProject(projectPath);
264
267
  if (!miniProgram) return null;
265
- miniProgram.disconnect();
268
+ disconnectMiniProgram(miniProgram);
266
269
  logger_default.info(formatReuseOpenedWechatIdePrompt());
267
270
  if (await promptRetryKeypress({ logger: logger_default }) !== "retry") return {
268
271
  reopened: false,
@@ -282,7 +285,7 @@ async function tryReuseOpenedWechatIde(projectPath, closeIde) {
282
285
  async function reopenOpenedWechatIde(projectPath, closeIde) {
283
286
  const miniProgram = await connectOpenedProject(projectPath);
284
287
  if (!miniProgram) return false;
285
- miniProgram.disconnect();
288
+ disconnectMiniProgram(miniProgram);
286
289
  logger_default.info("目标项目已在微信开发者工具中打开,当前命令将主动重开以刷新最新构建产物。");
287
290
  if (!await closeIde()) logger_default.warn("关闭当前微信开发者工具失败,仍继续尝试重新打开目标项目。");
288
291
  await openWechatIdeByAutomator(projectPath);
@@ -449,7 +452,7 @@ async function resolveIdeCommandContext(options) {
449
452
  //#endregion
450
453
  //#region src/cli/options.ts
451
454
  function filterDuplicateOptions(options) {
452
- for (const [key, value] of Object.entries(options)) if (Array.isArray(value)) options[key] = value.at(-1);
455
+ for (const [key, value] of Object.entries(options)) if (Array.isArray(value)) options[key] = value[value.length - 1];
453
456
  }
454
457
  function resolveConfigFile(options) {
455
458
  if (typeof options.config === "string") return options.config;
@@ -644,7 +647,7 @@ async function analyzeHmrProfile(options) {
644
647
  sampleCount: samples.length,
645
648
  skippedLineCount,
646
649
  firstTimestamp: orderedByTime[0]?.timestamp,
647
- lastTimestamp: orderedByTime.at(-1)?.timestamp,
650
+ lastTimestamp: orderedByTime[orderedByTime.length - 1]?.timestamp,
648
651
  metrics: {
649
652
  totalMs: createMetricSummary(totalValues),
650
653
  buildCoreMs: createMetricSummary(buildCoreValues),
@@ -3701,7 +3704,7 @@ function resolveRunnableHotkeyDefinition(input) {
3701
3704
  }
3702
3705
  //#endregion
3703
3706
  //#region package.json
3704
- var version = "6.16.5";
3707
+ var version = "6.16.6";
3705
3708
  //#endregion
3706
3709
  //#region src/cli/devHotkeys/format.ts
3707
3710
  const FULLWIDTH_ASCII_START = 65281;
@@ -4191,7 +4194,8 @@ function createAnalyzeController(options) {
4191
4194
  let updating = false;
4192
4195
  if (analyzeHandle && buildResult && typeof buildResult.on === "function") buildResult.on("event", (event) => {
4193
4196
  if (event.code !== "END" || updating) return;
4194
- const hmrEvent = createHmrProfileEvent(ctx.runtimeState.build.hmr.recentProfiles.at(-1));
4197
+ const recentProfiles = ctx.runtimeState.build.hmr.recentProfiles;
4198
+ const hmrEvent = createHmrProfileEvent(recentProfiles[recentProfiles.length - 1]);
4195
4199
  if (hmrEvent) emitDashboardEvents(analyzeHandle, [hmrEvent]);
4196
4200
  updating = true;
4197
4201
  triggerAnalyzeUpdate("watch").finally(() => {
@@ -1,6 +1,6 @@
1
1
  import { n as applyWeappViteHostMeta } from "./pluginHost-BEnGeaSo.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-D_s683Q5.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-CR2wVRDX.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";
@@ -464,6 +464,9 @@ function createDebugger(namespace) {
464
464
  //#endregion
465
465
  //#region src/context/shared.ts
466
466
  const debug$2 = createDebugger("weapp-vite:context");
467
+ function hasOwn$6(source, key) {
468
+ return Object.prototype.hasOwnProperty.call(source, key);
469
+ }
467
470
  function resolvedComponentName(entry) {
468
471
  const base = path.basename(entry);
469
472
  if (base === "index") {
@@ -480,7 +483,7 @@ function resolvedComponentName(entry) {
480
483
  };
481
484
  }
482
485
  function isEmptyObject$1(obj) {
483
- for (const key in obj) if (Object.hasOwn(obj, key)) return false;
486
+ for (const key in obj) if (hasOwn$6(obj, key)) return false;
484
487
  return true;
485
488
  }
486
489
  //#endregion
@@ -792,6 +795,11 @@ function extractComponentProps(code, options) {
792
795
  return collectComponentPropsFromCode(code, options);
793
796
  }
794
797
  //#endregion
798
+ //#region src/runtime/utils/object.ts
799
+ function hasOwn$5(source, key) {
800
+ return Object.prototype.hasOwnProperty.call(source, key);
801
+ }
802
+ //#endregion
795
803
  //#region src/runtime/utils/constructorType.ts
796
804
  const CONSTRUCTOR_TYPE_MAP = {
797
805
  String: "string",
@@ -809,7 +817,7 @@ const CONSTRUCTOR_TYPE_MAP = {
809
817
  NullConstructor: "any"
810
818
  };
811
819
  function mapConstructorName(name) {
812
- if (Object.hasOwn(CONSTRUCTOR_TYPE_MAP, name)) return CONSTRUCTOR_TYPE_MAP[name];
820
+ if (hasOwn$5(CONSTRUCTOR_TYPE_MAP, name)) return CONSTRUCTOR_TYPE_MAP[name];
813
821
  return CONSTRUCTOR_TYPE_MAP[name.endsWith("Constructor") ? name.slice(0, -11) : name] ?? "any";
814
822
  }
815
823
  //#endregion
@@ -7545,8 +7553,8 @@ async function generateLibDts(configService) {
7545
7553
  const tsconfigPath = path.resolve(configService.cwd, "tsconfig.json");
7546
7554
  const hasTsconfig = await fs.pathExists(tsconfigPath);
7547
7555
  const userRolldownOptions = dtsOptions?.rolldown ?? {};
7548
- const hasUserTsconfig = Object.hasOwn(userRolldownOptions, "tsconfig");
7549
- const hasUserBuild = Object.hasOwn(userRolldownOptions, "build");
7556
+ const hasUserTsconfig = hasOwn$5(userRolldownOptions, "tsconfig");
7557
+ const hasUserBuild = hasOwn$5(userRolldownOptions, "build");
7550
7558
  const userTsconfig = userRolldownOptions.tsconfig;
7551
7559
  const resolvedTsconfig = hasUserTsconfig ? typeof userTsconfig === "string" || userTsconfig === false ? userTsconfig : hasTsconfig ? tsconfigPath : false : hasTsconfig ? tsconfigPath : false;
7552
7560
  const shouldUseBuildMode = !hasUserBuild && await tsconfigHasProjectReferences(resolvedTsconfig);
@@ -10551,7 +10559,7 @@ function createBuildService(ctx) {
10551
10559
  const recentProfiles = ctx.runtimeState.build.hmr.recentProfiles;
10552
10560
  if (recentProfiles.length < 4) return false;
10553
10561
  if (recentProfiles.length - lastHmrSlowTipProfileCount < 3) return false;
10554
- const currentProfile = recentProfiles.at(-1);
10562
+ const currentProfile = recentProfiles[recentProfiles.length - 1];
10555
10563
  if (!currentProfile) return false;
10556
10564
  const previousProfiles = recentProfiles.slice(0, -1);
10557
10565
  const previousAverage = previousProfiles.reduce((sum, item) => sum + item.totalMs, 0) / previousProfiles.length;
@@ -11214,7 +11222,7 @@ const enhanceKeys = [
11214
11222
  let hasLoggedEnhanceDeprecation = false;
11215
11223
  function hasDeprecatedEnhanceUsage(enhance) {
11216
11224
  if (!enhance || typeof enhance !== "object") return false;
11217
- return enhanceKeys.some((key) => Object.hasOwn(enhance, key));
11225
+ return enhanceKeys.some((key) => hasOwn$5(enhance, key));
11218
11226
  }
11219
11227
  function migrateEnhanceOptions(target, options) {
11220
11228
  if (!target) return;
@@ -12183,6 +12191,9 @@ const AUTO_IMPORT_CONFIG_SUFFIXES = configExtensions.map((ext) => `.${ext}`);
12183
12191
  const AUTO_IMPORT_JS_SUFFIXES = new Set(jsExtensions.map((ext) => `.${ext}`));
12184
12192
  const AUTO_IMPORT_TEMPLATE_SUFFIXES = new Set(templateExtensions.map((ext) => `.${ext}`));
12185
12193
  const AUTO_IMPORT_VUE_SUFFIXES = new Set(vueExtensions.map((ext) => `.${ext}`));
12194
+ function hasOwn$4(source, key) {
12195
+ return Object.prototype.hasOwnProperty.call(source, key);
12196
+ }
12186
12197
  function isEnabledOutputOption(option) {
12187
12198
  if (option === true) return true;
12188
12199
  if (typeof option === "string") return option.trim().length > 0;
@@ -12299,7 +12310,7 @@ async function refreshAutoImportImporters(ctx, filePath) {
12299
12310
  const touchedImporters = /* @__PURE__ */ new Set();
12300
12311
  const entries = Array.from(wxmlService.wxmlComponentsMap.entries());
12301
12312
  for (const [baseName, components] of entries) {
12302
- if (!Object.hasOwn(components, componentName)) continue;
12313
+ if (!hasOwn$4(components, componentName)) continue;
12303
12314
  const pendingEntriesByImporter = ctx.runtimeState?.autoImport?.pendingEntriesByImporter;
12304
12315
  const pendingEntry = (autoImportService?.resolve(componentName, baseName))?.value.from;
12305
12316
  if (pendingEntriesByImporter && pendingEntry) {
@@ -13444,7 +13455,7 @@ async function collectLayoutFiles(root) {
13444
13455
  const base = full.slice(0, -path.extname(full).length);
13445
13456
  if (!(await findJsonEntry(base)).path) continue;
13446
13457
  const parts = path.relative(comparableRoot, normalizeComparablePath(base)).split(PATH_SEGMENT_RE).filter(Boolean);
13447
- if (parts.at(-1) === "index") parts.pop();
13458
+ if (parts[parts.length - 1] === "index") parts.pop();
13448
13459
  const layoutName = normalizeLayoutName(parts.join("/"));
13449
13460
  if (!layoutName) continue;
13450
13461
  const duplicated = layoutMap.get(layoutName);
@@ -13460,7 +13471,7 @@ async function collectLayoutFiles(root) {
13460
13471
  const relativePath = path.relative(comparableRoot, normalizeComparablePath(full));
13461
13472
  const ext = path.extname(relativePath);
13462
13473
  const parts = relativePath.slice(0, -ext.length).split(PATH_SEGMENT_RE).filter(Boolean);
13463
- if (parts.at(-1) === "index") parts.pop();
13474
+ if (parts[parts.length - 1] === "index") parts.pop();
13464
13475
  const layoutName = normalizeLayoutName(parts.join("/"));
13465
13476
  if (!layoutName) continue;
13466
13477
  const duplicated = layoutMap.get(layoutName);
@@ -14924,7 +14935,10 @@ function resolvePendingEntryIds(options) {
14924
14935
  }
14925
14936
  }
14926
14937
  if (expandedImporters.size > 0) {
14927
- const chunkPreview = [...relatedChunkIds].slice(0, 2).map((chunkId) => chunkId.split("/").at(-1)).join(",");
14938
+ const chunkPreview = [...relatedChunkIds].slice(0, 2).map((chunkId) => {
14939
+ const segments = chunkId.split("/");
14940
+ return segments[segments.length - 1];
14941
+ }).join(",");
14928
14942
  const overflow = relatedChunkIds.size > 2 ? "+" : "";
14929
14943
  const mode = expansionMode ? `:${expansionMode}` : "";
14930
14944
  pendingReasonSummary.push(`shared-chunk(${chunkPreview}${overflow})+${expandedImporters.size}${mode}`);
@@ -15095,7 +15109,7 @@ function emitJsonAssets(state) {
15095
15109
  function stripQuotes(value) {
15096
15110
  if (!value) return value;
15097
15111
  const first = value[0];
15098
- const last = value.at(-1);
15112
+ const last = value[value.length - 1];
15099
15113
  if (first === last && (first === "\"" || first === "'") || first === "`" && last === "`") return value.slice(1, -1);
15100
15114
  return value;
15101
15115
  }
@@ -15532,7 +15546,7 @@ function hasCustomAutoRuleConfig(config) {
15532
15546
  return Boolean(Array.isArray(config.dependencies) && config.dependencies.length > 0 || Array.isArray(config.targets) && config.targets.length > 0);
15533
15547
  }
15534
15548
  function hasConfiguredNetworkDefaults(config) {
15535
- return Boolean(config && typeof config === "object" && Object.hasOwn(config, "networkDefaults"));
15549
+ return Boolean(config && typeof config === "object" && hasOwn$5(config, "networkDefaults"));
15536
15550
  }
15537
15551
  function resolveAutoRules(config) {
15538
15552
  if (hasCustomAutoRuleConfig(config)) return [{
@@ -15819,6 +15833,9 @@ function injectRequestGlobalsIntoSfc(source, targets, options) {
15819
15833
  }
15820
15834
  //#endregion
15821
15835
  //#region src/plugins/core/lifecycle/transform/importMeta.ts
15836
+ function hasOwn$3(source, key) {
15837
+ return Object.prototype.hasOwnProperty.call(source, key);
15838
+ }
15822
15839
  function isImportMetaNode(node) {
15823
15840
  return node?.type === "MetaProperty" && node.meta?.type === "Identifier" && node.meta.name === "import" && node.property?.type === "Identifier" && node.property.name === "meta";
15824
15841
  }
@@ -15884,7 +15901,7 @@ function replaceImportMetaAccess(code, options) {
15884
15901
  MemberExpression(path) {
15885
15902
  const envPropertyName = getImportMetaEnvPropertyName(path.node);
15886
15903
  if (envPropertyName) {
15887
- const envValue = Object.hasOwn(values.envAccess, envPropertyName) ? values.envAccess[envPropertyName] : void 0;
15904
+ const envValue = hasOwn$3(values.envAccess, envPropertyName) ? values.envAccess[envPropertyName] : void 0;
15888
15905
  addReplacement(path.node, toInlineLiteral(envValue));
15889
15906
  return;
15890
15907
  }
@@ -15905,7 +15922,7 @@ function replaceImportMetaAccess(code, options) {
15905
15922
  OptionalMemberExpression(path) {
15906
15923
  const envPropertyName = getImportMetaEnvPropertyName(path.node);
15907
15924
  if (envPropertyName) {
15908
- const envValue = Object.hasOwn(values.envAccess, envPropertyName) ? values.envAccess[envPropertyName] : void 0;
15925
+ const envValue = hasOwn$3(values.envAccess, envPropertyName) ? values.envAccess[envPropertyName] : void 0;
15909
15926
  addReplacement(path.node, toInlineLiteral(envValue));
15910
15927
  return;
15911
15928
  }
@@ -17142,6 +17159,9 @@ function createBuildEndHook(state) {
17142
17159
  }
17143
17160
  //#endregion
17144
17161
  //#region src/plugins/utils/parse.ts
17162
+ function hasOwn$2(source, key) {
17163
+ return Object.prototype.hasOwnProperty.call(source, key);
17164
+ }
17145
17165
  /**
17146
17166
  * 参考:https://github.com/tailwindlabs/tailwindcss/blob/main/packages/%40tailwindcss-vite/src/index.ts
17147
17167
  * 解析请求ID,返回包含文件名和查询参数的对象。
@@ -17155,7 +17175,7 @@ function parseRequest(id) {
17155
17175
  if (rawQuery) {
17156
17176
  const params = new URLSearchParams(rawQuery);
17157
17177
  for (const [key, value] of params.entries()) query[key] = value;
17158
- if (Object.hasOwn(query, "wxss")) query.wxss = true;
17178
+ if (hasOwn$2(query, "wxss")) query.wxss = true;
17159
17179
  }
17160
17180
  return {
17161
17181
  filename,
@@ -18900,6 +18920,9 @@ function getSourceFromVirtualId(id) {
18900
18920
  //#endregion
18901
18921
  //#region src/plugins/vue/transform/emitAssets.ts
18902
18922
  const emittedAssetSourceCache = /* @__PURE__ */ new Map();
18923
+ function hasOwn$1(source, key) {
18924
+ return Object.prototype.hasOwnProperty.call(source, key);
18925
+ }
18903
18926
  /**
18904
18927
  * 统一拼接 SFC 相关产物文件名。
18905
18928
  */
@@ -18961,7 +18984,7 @@ function emitSfcJsonAsset(ctx, bundle, relativeBase, result, options) {
18961
18984
  if (!nextConfig && options.defaults) nextConfig = mergeJson({}, options.defaults, "defaults");
18962
18985
  if (defaultConfig) nextConfig = mergeJson(defaultConfig, nextConfig ?? {}, "emit");
18963
18986
  if (defaultConfig && nextConfig) {
18964
- if (Object.hasOwn(defaultConfig, "component") && !Object.hasOwn(nextConfig, "component")) nextConfig.component = true;
18987
+ if (hasOwn$1(defaultConfig, "component") && !hasOwn$1(nextConfig, "component")) nextConfig.component = true;
18965
18988
  }
18966
18989
  if (!nextConfig && defaultConfig) nextConfig = defaultConfig;
18967
18990
  if (!nextConfig) return;
@@ -19062,6 +19085,9 @@ function resolveVueTransformJsonPlatformOptions(configService) {
19062
19085
  }
19063
19086
  //#endregion
19064
19087
  //#region src/plugins/vue/transform/scopedSlot/assets.ts
19088
+ function hasOwn(source, key) {
19089
+ return Object.prototype.hasOwnProperty.call(source, key);
19090
+ }
19065
19091
  function parseJsonSafely(source) {
19066
19092
  if (!source) return;
19067
19093
  try {
@@ -19093,14 +19119,14 @@ function resolveScopedSlotAutoImports(compilerCtx, baseUsingComponents, componen
19093
19119
  const token = wxmlService.analyze(template);
19094
19120
  const depComponentNames = Object.keys(token.components ?? {});
19095
19121
  for (const depComponentName of depComponentNames) {
19096
- if (Object.hasOwn(baseUsingComponents, depComponentName)) {
19122
+ if (hasOwn(baseUsingComponents, depComponentName)) {
19097
19123
  usingComponents[depComponentName] = baseUsingComponents[depComponentName];
19098
19124
  continue;
19099
19125
  }
19100
19126
  const match = autoImportService.resolve(depComponentName, componentBase);
19101
19127
  if (!match) continue;
19102
19128
  const { value } = match;
19103
- if (Object.hasOwn(usingComponents, value.name)) continue;
19129
+ if (hasOwn(usingComponents, value.name)) continue;
19104
19130
  usingComponents[value.name] = value.from;
19105
19131
  }
19106
19132
  } catch {
@@ -19108,6 +19134,15 @@ function resolveScopedSlotAutoImports(compilerCtx, baseUsingComponents, componen
19108
19134
  }
19109
19135
  return usingComponents;
19110
19136
  }
19137
+ function resolveNestedScopedSlotUsingComponents(scopedSlots, currentComponentName, relativeBase, template) {
19138
+ const usingComponents = {};
19139
+ for (const scopedSlot of scopedSlots) {
19140
+ if (scopedSlot.componentName === currentComponentName) continue;
19141
+ if (!template.includes(scopedSlot.componentName)) continue;
19142
+ usingComponents[scopedSlot.componentName] = `/${toPosixPath(`${relativeBase}.__scoped-slot-${scopedSlot.id}`)}`;
19143
+ }
19144
+ return usingComponents;
19145
+ }
19111
19146
  function emitScopedSlotAssets(ctx, bundle, relativeBase, result, compilerCtx, classStyleWxs, outputExtensions, jsonOptions) {
19112
19147
  const scopedSlots = result.scopedSlotComponents;
19113
19148
  if (!scopedSlots?.length) return;
@@ -19122,6 +19157,7 @@ function emitScopedSlotAssets(ctx, bundle, relativeBase, result, compilerCtx, cl
19122
19157
  const wxmlFile = `${componentBase}.${templateExtension}`;
19123
19158
  const jsonFile = `${componentBase}.${jsonExtension}`;
19124
19159
  const scopedUsingComponents = resolveScopedSlotAutoImports(compilerCtx, baseUsingComponents, componentBase, scopedSlot.template);
19160
+ Object.assign(scopedUsingComponents, resolveNestedScopedSlotUsingComponents(scopedSlots, scopedSlot.componentName, relativeBase, scopedSlot.template));
19125
19161
  if (!bundle[wxmlFile]) ctx.emitFile({
19126
19162
  type: "asset",
19127
19163
  fileName: wxmlFile,
@@ -19133,13 +19169,14 @@ function emitScopedSlotAssets(ctx, bundle, relativeBase, result, compilerCtx, cl
19133
19169
  kind: "component"
19134
19170
  });
19135
19171
  let json = mergeJson({}, { usingComponents: scopedUsingComponents }, "auto-using-components");
19172
+ if (scopedSlot.componentGenerics && Object.keys(scopedSlot.componentGenerics).length > 0) json = mergeJson(json, { componentGenerics: scopedSlot.componentGenerics }, "component-generics");
19136
19173
  if (jsonOptions?.defaults && Object.keys(jsonOptions.defaults).length > 0) json = mergeJson(json, jsonOptions.defaults, "defaults");
19137
19174
  const defaultConfig = {
19138
19175
  component: true,
19139
19176
  styleIsolation: "apply-shared"
19140
19177
  };
19141
19178
  json = mergeJson(defaultConfig, json, "emit");
19142
- if (Object.hasOwn(defaultConfig, "component")) json.component = true;
19179
+ if (hasOwn(defaultConfig, "component")) json.component = true;
19143
19180
  const normalizedJson = normalizeJsonConfigForPlatform(json, compilerCtx);
19144
19181
  ctx.emitFile({
19145
19182
  type: "asset",
@@ -22486,7 +22523,7 @@ function createJsonService(ctx) {
22486
22523
  output: { exports: "named" }
22487
22524
  }
22488
22525
  });
22489
- const exportedConfig = Object.hasOwn(mod, "default") ? mod.default : mod;
22526
+ const exportedConfig = hasOwn$5(mod, "default") ? mod.default : mod;
22490
22527
  resultJson = typeof exportedConfig === "function" ? await exportedConfig(ctx) : exportedConfig;
22491
22528
  } finally {
22492
22529
  if (tempFilepath !== filepath) await fs.remove(tempFilepath);
@@ -22884,7 +22921,7 @@ async function loadAppEntry(ctx, scanState) {
22884
22921
  const vueAppPath = await findVueEntry(appBasename);
22885
22922
  let configFromVue;
22886
22923
  if (!appConfigFile && vueAppPath) {
22887
- const { extractConfigFromVue } = await import("./file-DJL8Grbf.mjs");
22924
+ const { extractConfigFromVue } = await import("./file-DcukQfQc.mjs");
22888
22925
  configFromVue = await extractConfigFromVue(vueAppPath);
22889
22926
  if (configFromVue) appConfigFile = vueAppPath;
22890
22927
  }
@@ -22992,7 +23029,7 @@ function coerceStyleConfig(entry) {
22992
23029
  if (!entry || typeof entry !== "object") return;
22993
23030
  const source = entry.source?.toString().trim();
22994
23031
  if (!source) return;
22995
- const hasExplicitScope = Object.hasOwn(entry, "scope") && entry.scope != null;
23032
+ const hasExplicitScope = hasOwn$5(entry, "scope") && entry.scope != null;
22996
23033
  return {
22997
23034
  source,
22998
23035
  scope: hasExplicitScope ? coerceScope(entry.scope) : "all",
@@ -84,7 +84,7 @@ function resolveAutoRoutesMacroImportPath() {
84
84
  }
85
85
  async function resolveAutoRoutesInlineSnapshot() {
86
86
  try {
87
- const { getCompilerContext } = await import("./getInstance-DDog7ywe.mjs");
87
+ const { getCompilerContext } = await import("./getInstance-BAXgOqBQ.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-CR2wVRDX.mjs";
2
+ export { extractConfigFromVue };
@@ -0,0 +1,2 @@
1
+ import { i as getCompilerContext } from "./createContext-BEnghhM9.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-BEnGeaSo.mjs";
3
3
  import { t as defineConfig } from "./config-DJjSbpNX.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-CnilYzXS.mjs";
5
- import { i as createWevuComponent, n as defineProps, r as setPageLayout, t as defineEmits } from "./runtime-DN3lxU9s.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-BEnghhM9.mjs";
5
+ import { i as createWevuComponent, n as defineProps, r as setPageLayout, t as defineEmits } from "./runtime-spnjzaP2.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 };
@@ -25,7 +25,8 @@ function resolveCurrentPageInstance() {
25
25
  const getCurrentPagesFn = globalThis.getCurrentPages;
26
26
  if (typeof getCurrentPagesFn !== "function") return;
27
27
  try {
28
- return getCurrentPagesFn().at(-1);
28
+ const pages = getCurrentPagesFn();
29
+ return pages[pages.length - 1];
29
30
  } catch {
30
31
  return;
31
32
  }
package/dist/runtime.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { i as createWevuComponent, n as defineProps, r as setPageLayout, t as defineEmits } from "./runtime-DN3lxU9s.mjs";
1
+ import { i as createWevuComponent, n as defineProps, r as setPageLayout, t as defineEmits } from "./runtime-spnjzaP2.mjs";
2
2
  export { createWevuComponent, defineEmits, defineProps, setPageLayout };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-vite",
3
3
  "type": "module",
4
- "version": "6.16.5",
4
+ "version": "6.16.6",
5
5
  "description": "weapp-vite 一个现代化的小程序打包工具",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -109,30 +109,30 @@
109
109
  "pathe": "^2.0.3",
110
110
  "picomatch": "^4.0.4",
111
111
  "postcss": "^8.5.14",
112
- "rolldown": "1.0.0-rc.17",
113
- "rolldown-plugin-dts": "0.23.2",
112
+ "rolldown": "1.0.0-rc.18",
113
+ "rolldown-plugin-dts": "0.24.1",
114
114
  "semver": "^7.7.4",
115
115
  "typescript": "^6.0.3",
116
- "vite": "8.0.10",
116
+ "vite": "8.0.11",
117
117
  "vite-tsconfig-paths": "^6.1.1",
118
118
  "vue": "^3.5.34",
119
119
  "vue-tsc": "^3.2.8",
120
120
  "@weapp-core/constants": "^0.1.4",
121
121
  "@weapp-core/init": "6.0.8",
122
122
  "@weapp-core/logger": "3.1.1",
123
- "@weapp-core/schematics": "6.0.4",
124
123
  "@weapp-core/shared": "3.0.4",
125
- "@weapp-vite/ast": "6.16.5",
126
- "@weapp-vite/mcp": "1.3.1",
127
- "@weapp-vite/miniprogram-automator": "1.0.5",
124
+ "@weapp-vite/ast": "6.16.6",
125
+ "@weapp-core/schematics": "6.0.4",
126
+ "@weapp-vite/mcp": "1.3.2",
127
+ "@weapp-vite/miniprogram-automator": "1.1.0",
128
+ "@weapp-vite/web": "1.3.20",
129
+ "@wevu/api": "0.2.8",
130
+ "@wevu/web-apis": "1.2.12",
128
131
  "@weapp-vite/volar": "2.1.0",
129
- "@weapp-vite/web": "1.3.19",
130
- "@wevu/api": "0.2.7",
131
- "@wevu/web-apis": "1.2.11",
132
132
  "rolldown-require": "2.0.15",
133
133
  "vite-plugin-performance": "2.0.1",
134
- "weapp-ide-cli": "5.2.8",
135
- "wevu": "6.16.5"
134
+ "weapp-ide-cli": "5.2.9",
135
+ "wevu": "6.16.6"
136
136
  },
137
137
  "publishConfig": {
138
138
  "access": "public",
@@ -1,2 +0,0 @@
1
- import { t as extractConfigFromVue } from "./file-D_s683Q5.mjs";
2
- export { extractConfigFromVue };
@@ -1,2 +0,0 @@
1
- import { i as getCompilerContext } from "./createContext-CnilYzXS.mjs";
2
- export { getCompilerContext };