weapp-vite 6.7.0 → 6.7.2

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,6 +1,6 @@
1
1
  import {
2
2
  init_esm_shims
3
- } from "../chunk-GTITIIY3.mjs";
3
+ } from "../chunk-QBSVUTNO.mjs";
4
4
 
5
5
  // src/auto-import-components/resolvers/index.ts
6
6
  init_esm_shims();
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  getCompilerContext
3
- } from "./chunk-EH3FR4SH.mjs";
4
- import "./chunk-ZVO7KLQN.mjs";
5
- import "./chunk-BHF4WHJX.mjs";
6
- import "./chunk-O2ZCPWFG.mjs";
7
- import "./chunk-WFHC5POL.mjs";
3
+ } from "./chunk-FVM35BZA.mjs";
4
+ import "./chunk-W5TTICYZ.mjs";
5
+ import "./chunk-O4WHKAL4.mjs";
6
+ import "./chunk-IWKOTXCO.mjs";
7
+ import "./chunk-3STNMT72.mjs";
8
8
  import {
9
9
  init_esm_shims
10
- } from "./chunk-GTITIIY3.mjs";
10
+ } from "./chunk-QBSVUTNO.mjs";
11
11
 
12
12
  // src/auto-routes.ts
13
13
  init_esm_shims();
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  init_esm_shims
3
- } from "./chunk-GTITIIY3.mjs";
3
+ } from "./chunk-QBSVUTNO.mjs";
4
4
 
5
5
  // src/types/external.ts
6
6
  init_esm_shims();
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  init_esm_shims
3
- } from "./chunk-GTITIIY3.mjs";
3
+ } from "./chunk-QBSVUTNO.mjs";
4
4
 
5
5
  // src/logger.ts
6
6
  init_esm_shims();
@@ -2,10 +2,10 @@ import {
2
2
  getCompilerContext,
3
3
  resetCompilerContext,
4
4
  setActiveCompilerContextKey
5
- } from "./chunk-EH3FR4SH.mjs";
5
+ } from "./chunk-FVM35BZA.mjs";
6
6
  import {
7
7
  init_esm_shims
8
- } from "./chunk-GTITIIY3.mjs";
8
+ } from "./chunk-QBSVUTNO.mjs";
9
9
 
10
10
  // src/createContext.ts
11
11
  init_esm_shims();
@@ -14,16 +14,16 @@ import {
14
14
  templateExtensions,
15
15
  touch,
16
16
  vueExtensions
17
- } from "./chunk-ZVO7KLQN.mjs";
17
+ } from "./chunk-W5TTICYZ.mjs";
18
18
  import {
19
19
  configureLogger,
20
20
  default as default2
21
- } from "./chunk-WFHC5POL.mjs";
21
+ } from "./chunk-3STNMT72.mjs";
22
22
  import {
23
23
  __commonJS,
24
24
  __toESM,
25
25
  init_esm_shims
26
- } from "./chunk-GTITIIY3.mjs";
26
+ } from "./chunk-QBSVUTNO.mjs";
27
27
 
28
28
  // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/debug.js
29
29
  var require_debug = __commonJS({
@@ -6512,6 +6512,7 @@ async function syncVueComponentsDefinition(settings, options) {
6512
6512
  }
6513
6513
  options.syncResolverComponentProps();
6514
6514
  options.preloadResolverComponentMetadata();
6515
+ const outputPath = settings.outputPath;
6515
6516
  const componentNames = collectAllComponentNames(options);
6516
6517
  const nextDefinition = createVueComponentsDefinition(componentNames, options.getComponentMetadata, {
6517
6518
  useTypedComponents: getTypedComponentsSettings(ctx).enabled,
@@ -6522,7 +6523,7 @@ async function syncVueComponentsDefinition(settings, options) {
6522
6523
  const sourcePath = local.entry?.path || local.entry?.jsonPath || local.entry?.templatePath;
6523
6524
  if (sourcePath) {
6524
6525
  return toRelativeImportSpecifier(
6525
- settings.outputPath,
6526
+ outputPath,
6526
6527
  normalizeLocalNavigationSource(sourcePath)
6527
6528
  );
6528
6529
  }
@@ -6534,19 +6535,19 @@ async function syncVueComponentsDefinition(settings, options) {
6534
6535
  return resolveNavigationImport(from);
6535
6536
  }
6536
6537
  });
6537
- if (nextDefinition === outputsState.lastWrittenVueComponentsDefinition && settings.outputPath === outputsState.lastVueComponentsOutputPath) {
6538
+ if (nextDefinition === outputsState.lastWrittenVueComponentsDefinition && outputPath === outputsState.lastVueComponentsOutputPath) {
6538
6539
  return;
6539
6540
  }
6540
6541
  try {
6541
- if (outputsState.lastVueComponentsOutputPath && outputsState.lastVueComponentsOutputPath !== settings.outputPath) {
6542
+ if (outputsState.lastVueComponentsOutputPath && outputsState.lastVueComponentsOutputPath !== outputPath) {
6542
6543
  try {
6543
6544
  await fs4.remove(outputsState.lastVueComponentsOutputPath);
6544
6545
  } catch {
6545
6546
  }
6546
6547
  }
6547
- await fs4.outputFile(settings.outputPath, nextDefinition, "utf8");
6548
+ await fs4.outputFile(outputPath, nextDefinition, "utf8");
6548
6549
  outputsState.lastWrittenVueComponentsDefinition = nextDefinition;
6549
- outputsState.lastVueComponentsOutputPath = settings.outputPath;
6550
+ outputsState.lastVueComponentsOutputPath = outputPath;
6550
6551
  } catch (error) {
6551
6552
  const message = error instanceof Error ? error.message : String(error);
6552
6553
  default2.error(`\u5199\u5165 components.d.ts \u5931\u8D25: ${message}`);
@@ -16847,6 +16848,9 @@ function createRelativeImport(fromFile, toFile) {
16847
16848
  function findChunkImporters(bundle, target) {
16848
16849
  const importers = /* @__PURE__ */ new Set();
16849
16850
  for (const [fileName, output] of Object.entries(bundle)) {
16851
+ if (fileName === target) {
16852
+ continue;
16853
+ }
16850
16854
  if (output?.type !== "chunk") {
16851
16855
  continue;
16852
16856
  }
@@ -16869,7 +16873,7 @@ function findChunkImporters(bundle, target) {
16869
16873
  }
16870
16874
  }
16871
16875
  const potentialImport = createRelativeImport(fileName, target);
16872
- if (potentialImport && containsImportSpecifier(chunk.code ?? "", potentialImport)) {
16876
+ if (potentialImport && potentialImport !== "./" && containsImportSpecifier(chunk.code ?? "", potentialImport)) {
16873
16877
  importers.add(fileName);
16874
16878
  }
16875
16879
  }
@@ -17271,6 +17275,13 @@ function applySharedChunkStrategy(bundle, options) {
17271
17275
  let finalFileName = chunk.fileName;
17272
17276
  if (fileName.startsWith(`${SHARED_CHUNK_VIRTUAL_PREFIX}/`)) {
17273
17277
  const newFileName = fileName.slice(SHARED_CHUNK_VIRTUAL_PREFIX.length + 1);
17278
+ chunk.code = rewriteChunkImportSpecifiersInCode(chunk.code ?? "", {
17279
+ sourceFileNames: createChunkSourceFileNameCandidates(fileName),
17280
+ targetFileName: newFileName,
17281
+ imports: chunk.imports,
17282
+ dynamicImports: chunk.dynamicImports,
17283
+ runtimeFileName: ROLLDOWN_RUNTIME_FILE_NAME
17284
+ });
17274
17285
  chunk.fileName = newFileName;
17275
17286
  if (typeof chunk.sourcemapFileName === "string" && chunk.sourcemapFileName) {
17276
17287
  chunk.sourcemapFileName = `${newFileName}.map`;
@@ -17304,6 +17315,13 @@ function applySharedChunkStrategy(bundle, options) {
17304
17315
  }
17305
17316
  if (shouldRetainOriginalChunk && fileName.startsWith(`${SHARED_CHUNK_VIRTUAL_PREFIX}/`)) {
17306
17317
  const newFileName = fileName.slice(SHARED_CHUNK_VIRTUAL_PREFIX.length + 1);
17318
+ chunk.code = rewriteChunkImportSpecifiersInCode(chunk.code ?? "", {
17319
+ sourceFileNames: createChunkSourceFileNameCandidates(fileName),
17320
+ targetFileName: newFileName,
17321
+ imports: chunk.imports,
17322
+ dynamicImports: chunk.dynamicImports,
17323
+ runtimeFileName: ROLLDOWN_RUNTIME_FILE_NAME
17324
+ });
17307
17325
  chunk.fileName = newFileName;
17308
17326
  if (typeof chunk.sourcemapFileName === "string" && chunk.sourcemapFileName) {
17309
17327
  chunk.sourcemapFileName = `${newFileName}.map`;
@@ -17334,8 +17352,11 @@ function applySharedChunkStrategy(bundle, options) {
17334
17352
  }
17335
17353
  for (const [root, { newFileName, importers: importerFiles }] of importerMap.entries()) {
17336
17354
  const runtimeFileName = path28.join(root, ROLLDOWN_RUNTIME_FILE_NAME);
17337
- const duplicatedSource = rewriteRuntimeImportInCode(originalCode, {
17338
- fromFileName: newFileName,
17355
+ const duplicatedSource = rewriteChunkImportSpecifiersInCode(originalCode, {
17356
+ sourceFileNames: createChunkSourceFileNameCandidates(fileName),
17357
+ targetFileName: newFileName,
17358
+ imports: chunk.imports,
17359
+ dynamicImports: chunk.dynamicImports,
17339
17360
  runtimeFileName
17340
17361
  });
17341
17362
  this.emitFile({
@@ -17370,10 +17391,16 @@ function applySharedChunkStrategy(bundle, options) {
17370
17391
  }
17371
17392
  const chunkBytes = typeof originalCode === "string" ? Buffer3.byteLength(originalCode, "utf8") : void 0;
17372
17393
  const redundantBytes = typeof chunkBytes === "number" ? chunkBytes * Math.max(duplicates.length - 1, 0) : void 0;
17394
+ const requiresRuntimeLocalization = chunkReferencesRuntime(
17395
+ chunk,
17396
+ ROLLDOWN_RUNTIME_FILE_NAME,
17397
+ /* @__PURE__ */ new Set([ROLLDOWN_RUNTIME_FILE_NAME])
17398
+ );
17373
17399
  options.onDuplicate?.({
17374
17400
  sharedFileName: originalSharedFileName,
17375
17401
  duplicates,
17376
17402
  ignoredMainImporters: diagnostics?.ignoredMainImporters,
17403
+ requiresRuntimeLocalization,
17377
17404
  chunkBytes,
17378
17405
  redundantBytes,
17379
17406
  retainedInMain: shouldRetainOriginalChunk
@@ -17483,6 +17510,20 @@ function createCrossSubPackageDuplicateBaseName(sourceRoot, fileName) {
17483
17510
  const rootTag = sourceRoot.replace(/[\\/]+/g, "_");
17484
17511
  return `${rootTag}.${path28.basename(fileName)}`;
17485
17512
  }
17513
+ function createChunkSourceFileNameCandidates(fileName) {
17514
+ const candidates = [fileName];
17515
+ const normalized = resolveChunkSourceFileNameForRewrite(fileName);
17516
+ if (normalized !== fileName) {
17517
+ candidates.push(normalized);
17518
+ }
17519
+ return candidates;
17520
+ }
17521
+ function resolveChunkSourceFileNameForRewrite(fileName) {
17522
+ if (!fileName.startsWith(`${SHARED_CHUNK_VIRTUAL_PREFIX}/`)) {
17523
+ return fileName;
17524
+ }
17525
+ return fileName.slice(SHARED_CHUNK_VIRTUAL_PREFIX.length + 1);
17526
+ }
17486
17527
  function reserveUniqueFileName(reservedFileNames, fileName) {
17487
17528
  if (!reservedFileNames.has(fileName)) {
17488
17529
  reservedFileNames.add(fileName);
@@ -17537,6 +17578,15 @@ function applyRuntimeChunkLocalization(bundle, options) {
17537
17578
  rootToImporters.set(root, [fileName]);
17538
17579
  }
17539
17580
  }
17581
+ const forceRoots = Array.from(options.forceRoots ?? []).filter(Boolean);
17582
+ for (const root of forceRoots) {
17583
+ if (!subPackageRoots.includes(root)) {
17584
+ continue;
17585
+ }
17586
+ if (!rootToImporters.has(root)) {
17587
+ rootToImporters.set(root, []);
17588
+ }
17589
+ }
17540
17590
  if (!rootToImporters.size) {
17541
17591
  return;
17542
17592
  }
@@ -17658,38 +17708,37 @@ function dedupeLookupKeys(values) {
17658
17708
  function isRuntimeBundleOutput(output) {
17659
17709
  return output?.type === "chunk" || output?.type === "asset";
17660
17710
  }
17661
- function rewriteRuntimeImportInCode(sourceCode, options) {
17662
- const { fromFileName, runtimeFileName } = options;
17663
- if (!sourceCode.includes(ROLLDOWN_RUNTIME_FILE_NAME)) {
17664
- return sourceCode;
17665
- }
17666
- const importPath = createRelativeImportPath(fromFileName, runtimeFileName);
17667
- if (!importPath) {
17668
- return sourceCode;
17669
- }
17670
- return sourceCode.replace(
17671
- /(['"`])([^'"`]*rolldown-runtime\.js)\1/g,
17672
- (_match, quote) => `${quote}${importPath}${quote}`
17673
- );
17674
- }
17675
17711
  function rewriteChunkImportSpecifiersInCode(sourceCode, options) {
17676
- const { sourceFileName, targetFileName, imports, dynamicImports, runtimeFileName } = options;
17712
+ const { sourceFileName, sourceFileNames, targetFileName, imports, dynamicImports, runtimeFileName } = options;
17713
+ const sourceFileNameCandidates = (sourceFileNames ?? [sourceFileName ?? ""]).filter(Boolean);
17677
17714
  const specifiers = new Set([...imports, ...dynamicImports].filter(Boolean));
17678
17715
  let rewrittenCode = sourceCode;
17679
17716
  for (const specifier of specifiers) {
17680
- const sourceImportPath = createRelativeImportPath(sourceFileName, specifier);
17681
- if (!sourceImportPath) {
17682
- continue;
17683
- }
17684
17717
  const resolvedTargetSpecifier = path28.basename(specifier) === ROLLDOWN_RUNTIME_FILE_NAME ? runtimeFileName : specifier;
17685
17718
  const targetImportPath = createRelativeImportPath(targetFileName, resolvedTargetSpecifier);
17686
- if (!targetImportPath || sourceImportPath === targetImportPath) {
17719
+ if (!targetImportPath) {
17687
17720
  continue;
17688
17721
  }
17689
- rewrittenCode = replaceAll(rewrittenCode, sourceImportPath, targetImportPath);
17722
+ for (const sourceCandidate of sourceFileNameCandidates) {
17723
+ const sourceImportPath = createRelativeImportPath(sourceCandidate, specifier);
17724
+ if (!sourceImportPath || sourceImportPath === targetImportPath) {
17725
+ continue;
17726
+ }
17727
+ rewrittenCode = replaceQuotedImportLiteralValue(rewrittenCode, sourceImportPath, targetImportPath);
17728
+ }
17690
17729
  }
17691
17730
  return rewrittenCode;
17692
17731
  }
17732
+ function replaceQuotedImportLiteralValue(sourceCode, sourcePath, targetPath) {
17733
+ const escapedSourcePath = escapeRegExpForPattern(sourcePath);
17734
+ return sourceCode.replace(
17735
+ new RegExp(`(['"\`])${escapedSourcePath}\\1`, "g"),
17736
+ (_match, quote) => `${quote}${targetPath}${quote}`
17737
+ );
17738
+ }
17739
+ function escapeRegExpForPattern(value) {
17740
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
17741
+ }
17693
17742
  function createRelativeImportPath(fromFileName, toFileName) {
17694
17743
  const relativePath = path28.relative(path28.dirname(fromFileName), toFileName);
17695
17744
  if (!relativePath || relativePath.startsWith(".")) {
@@ -25738,7 +25787,7 @@ function createAutoRoutesPlugin(ctx) {
25738
25787
  if (!isPagesRelatedPath(id)) {
25739
25788
  return;
25740
25789
  }
25741
- if (event === "create" || event === "delete" || event === "rename" || event === "update") {
25790
+ if (event === "create" || event === "delete" || event === "update") {
25742
25791
  await service.handleFileChange(id, "rename");
25743
25792
  }
25744
25793
  },
@@ -26648,8 +26697,6 @@ function createEntryLoader(options) {
26648
26697
  }
26649
26698
  if (shouldTreatAsComponent) {
26650
26699
  entryTypeOverride = "component";
26651
- } else {
26652
- entryTypeOverride = "lib";
26653
26700
  }
26654
26701
  }
26655
26702
  if (vueEntryPath) {
@@ -27923,30 +27970,48 @@ function createGenerateBundleHook(state, isPluginBuild) {
27923
27970
  const suffix = remaining > 0 ? ` \u7B49 ${moduleLabels.length} \u4E2A\u6A21\u5757` : "";
27924
27971
  return `${preview.join("\u3001")}${suffix}`;
27925
27972
  };
27926
- const handleDuplicate = shouldLogChunks || shouldWarnOnDuplicate ? ({ duplicates, ignoredMainImporters, chunkBytes, redundantBytes, retainedInMain, sharedFileName }) => {
27973
+ const runtimeLocalizationRoots = /* @__PURE__ */ new Set();
27974
+ const handleDuplicate = ({
27975
+ duplicates,
27976
+ ignoredMainImporters,
27977
+ chunkBytes,
27978
+ redundantBytes,
27979
+ retainedInMain,
27980
+ sharedFileName,
27981
+ requiresRuntimeLocalization
27982
+ }) => {
27927
27983
  if (shouldWarnOnDuplicate) {
27928
27984
  const duplicateCount = duplicates.length;
27929
27985
  const computedRedundant = typeof redundantBytes === "number" ? redundantBytes : typeof chunkBytes === "number" ? chunkBytes * Math.max(duplicateCount - 1, 0) : 0;
27930
27986
  redundantBytesTotal += computedRedundant;
27931
27987
  }
27932
- if (shouldLogChunks) {
27933
- const subPackageSet = /* @__PURE__ */ new Set();
27934
- let totalReferences = 0;
27935
- for (const { fileName, importers } of duplicates) {
27936
- totalReferences += importers.length;
27988
+ if (requiresRuntimeLocalization) {
27989
+ for (const { fileName } of duplicates) {
27937
27990
  const match = matchSubPackage2(fileName);
27938
27991
  if (match) {
27939
- subPackageSet.add(match);
27992
+ runtimeLocalizationRoots.add(match);
27940
27993
  }
27941
27994
  }
27942
- const subPackageList = Array.from(subPackageSet).join("\u3001") || "\u76F8\u5173\u5206\u5305";
27943
- const ignoredHint = ignoredMainImporters?.length ? `\uFF0C\u5FFD\u7565\u4E3B\u5305\u5F15\u7528\uFF1A${ignoredMainImporters.join("\u3001")}` : "";
27944
- default2.info(`[\u5206\u5305] \u5206\u5305 ${subPackageList} \u5171\u4EAB\u6A21\u5757\u5DF2\u590D\u5236\u5230\u5404\u81EA weapp-shared/common.js\uFF08${totalReferences} \u5904\u5F15\u7528${ignoredHint}\uFF09`);
27945
- if (retainedInMain) {
27946
- default2.warn(`[\u5206\u5305] \u6A21\u5757 ${sharedFileName} \u540C\u65F6\u88AB\u4E3B\u5305\u5F15\u7528\uFF0C\u56E0\u6B64\u4ECD\u4FDD\u7559\u5728\u4E3B\u5305 common.js\uFF0C\u5E76\u590D\u5236\u5230 ${subPackageList}\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u9700\u8981\u5C06\u6E90\u4EE3\u7801\u79FB\u52A8\u5230\u4E3B\u5305\u6216\u516C\u5171\u76EE\u5F55\u3002`);
27995
+ }
27996
+ if (!shouldLogChunks) {
27997
+ return;
27998
+ }
27999
+ const subPackageSet = /* @__PURE__ */ new Set();
28000
+ let totalReferences = 0;
28001
+ for (const { fileName, importers } of duplicates) {
28002
+ totalReferences += importers.length;
28003
+ const match = matchSubPackage2(fileName);
28004
+ if (match) {
28005
+ subPackageSet.add(match);
27947
28006
  }
27948
28007
  }
27949
- } : void 0;
28008
+ const subPackageList = Array.from(subPackageSet).join("\u3001") || "\u76F8\u5173\u5206\u5305";
28009
+ const ignoredHint = ignoredMainImporters?.length ? `\uFF0C\u5FFD\u7565\u4E3B\u5305\u5F15\u7528\uFF1A${ignoredMainImporters.join("\u3001")}` : "";
28010
+ default2.info(`[\u5206\u5305] \u5206\u5305 ${subPackageList} \u5171\u4EAB\u6A21\u5757\u5DF2\u590D\u5236\u5230\u5404\u81EA weapp-shared/common.js\uFF08${totalReferences} \u5904\u5F15\u7528${ignoredHint}\uFF09`);
28011
+ if (retainedInMain) {
28012
+ default2.warn(`[\u5206\u5305] \u6A21\u5757 ${sharedFileName} \u540C\u65F6\u88AB\u4E3B\u5305\u5F15\u7528\uFF0C\u56E0\u6B64\u4ECD\u4FDD\u7559\u5728\u4E3B\u5305 common.js\uFF0C\u5E76\u590D\u5236\u5230 ${subPackageList}\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u9700\u8981\u5C06\u6E90\u4EE3\u7801\u79FB\u52A8\u5230\u4E3B\u5305\u6216\u516C\u5171\u76EE\u5F55\u3002`);
28013
+ }
28014
+ };
27950
28015
  applySharedChunkStrategy.call(this, rolldownBundle, {
27951
28016
  strategy: sharedStrategy,
27952
28017
  subPackageRoots,
@@ -27980,6 +28045,7 @@ function createGenerateBundleHook(state, isPluginBuild) {
27980
28045
  });
27981
28046
  applyRuntimeChunkLocalization.call(this, rolldownBundle, {
27982
28047
  subPackageRoots,
28048
+ forceRoots: runtimeLocalizationRoots,
27983
28049
  onDuplicate: shouldLogChunks ? ({ duplicates, runtimeFileName }) => {
27984
28050
  const subPackageSet = /* @__PURE__ */ new Set();
27985
28051
  for (const { fileName } of duplicates) {
@@ -33290,7 +33356,11 @@ function parseJsonSafely2(source) {
33290
33356
  }
33291
33357
  }
33292
33358
  function normalizeJsonConfigForPlatform(json, compilerCtx) {
33293
- const platform = compilerCtx?.configService?.platform;
33359
+ const configService = compilerCtx?.configService;
33360
+ if (!configService) {
33361
+ return json;
33362
+ }
33363
+ const platform = configService?.platform;
33294
33364
  if (platform !== "alipay") {
33295
33365
  return json;
33296
33366
  }
@@ -33300,8 +33370,8 @@ function normalizeJsonConfigForPlatform(json, compilerCtx) {
33300
33370
  void 0,
33301
33371
  platform,
33302
33372
  {
33303
- dependencies: compilerCtx.configService.packageJson?.dependencies,
33304
- alipayNpmMode: compilerCtx.configService.weappViteConfig?.npm?.alipayNpmMode
33373
+ dependencies: configService.packageJson?.dependencies,
33374
+ alipayNpmMode: configService.weappViteConfig?.npm?.alipayNpmMode
33305
33375
  }
33306
33376
  );
33307
33377
  if (!source) {
@@ -35241,6 +35311,9 @@ function createRequireMemberExpression(base, name) {
35241
35311
  !t2.isValidIdentifier(name)
35242
35312
  );
35243
35313
  }
35314
+ function getModuleExportName(name) {
35315
+ return t2.isIdentifier(name) ? name.name : name.value;
35316
+ }
35244
35317
  async function transformJsModuleToCjsForAlipay(source) {
35245
35318
  if (!hasEsmSyntax(source)) {
35246
35319
  return source;
@@ -35315,13 +35388,12 @@ async function transformJsModuleToCjsForAlipay(source) {
35315
35388
  ExportDefaultDeclaration(path81) {
35316
35389
  const declaration = path81.node.declaration;
35317
35390
  if (t2.isFunctionDeclaration(declaration) || t2.isClassDeclaration(declaration)) {
35318
- let targetId2 = declaration.id;
35319
- if (!targetId2) {
35320
- targetId2 = path81.scope.generateUidIdentifier("defaultExport");
35321
- declaration.id = targetId2;
35391
+ const exportId = declaration.id ?? path81.scope.generateUidIdentifier("defaultExport");
35392
+ if (!declaration.id) {
35393
+ declaration.id = exportId;
35322
35394
  }
35323
35395
  path81.replaceWith(declaration);
35324
- exportAssignments.push(createExportsAssignment("default", targetId2));
35396
+ exportAssignments.push(createExportsAssignment("default", exportId));
35325
35397
  transformed = true;
35326
35398
  return;
35327
35399
  }
@@ -35365,8 +35437,8 @@ async function transformJsModuleToCjsForAlipay(source) {
35365
35437
  if (!t2.isExportSpecifier(specifier)) {
35366
35438
  continue;
35367
35439
  }
35368
- const localName = t2.isIdentifier(specifier.local) ? specifier.local.name : specifier.local.value;
35369
- const exportedName = t2.isIdentifier(specifier.exported) ? specifier.exported.name : specifier.exported.value;
35440
+ const localName = specifier.local.name;
35441
+ const exportedName = getModuleExportName(specifier.exported);
35370
35442
  statements2.push(createExportsAssignment(exportedName, createRequireMemberExpression(requireId, localName)));
35371
35443
  }
35372
35444
  path81.replaceWithMultiple(statements2);
@@ -35378,8 +35450,8 @@ async function transformJsModuleToCjsForAlipay(source) {
35378
35450
  if (!t2.isExportSpecifier(specifier)) {
35379
35451
  continue;
35380
35452
  }
35381
- const localName = t2.isIdentifier(specifier.local) ? specifier.local.name : specifier.local.value;
35382
- const exportedName = t2.isIdentifier(specifier.exported) ? specifier.exported.name : specifier.exported.value;
35453
+ const localName = specifier.local.name;
35454
+ const exportedName = getModuleExportName(specifier.exported);
35383
35455
  statements.push(createExportsAssignment(exportedName, t2.identifier(localName)));
35384
35456
  }
35385
35457
  path81.replaceWithMultiple(statements);
@@ -35499,7 +35571,7 @@ function createPackageBuilder(ctx, oxcVitePlugin) {
35499
35571
  outDir,
35500
35572
  emptyOutDir: true,
35501
35573
  sourcemap: false,
35502
- minify: true,
35574
+ minify: false,
35503
35575
  target: "es6",
35504
35576
  rolldownOptions: {
35505
35577
  external: [],
@@ -35554,6 +35626,7 @@ function createPackageBuilder(ctx, oxcVitePlugin) {
35554
35626
  to
35555
35627
  );
35556
35628
  }
35629
+ let buildPackage;
35557
35630
  async function runBuildPackage({ dep, outDir, options, isDependenciesCacheOutdate }) {
35558
35631
  const packageInfo = await getPackageInfo(dep);
35559
35632
  if (!packageInfo || !ctx.configService) {
@@ -35639,7 +35712,7 @@ function createPackageBuilder(ctx, oxcVitePlugin) {
35639
35712
  }
35640
35713
  npmLogger.success(`[npm] \`${dep}\` \u4F9D\u8D56\u5904\u7406\u5B8C\u6210!`);
35641
35714
  }
35642
- async function buildPackage({ dep, outDir, options, isDependenciesCacheOutdate }) {
35715
+ buildPackage = async ({ dep, outDir, options, isDependenciesCacheOutdate }) => {
35643
35716
  const taskKey = `${path72.resolve(outDir)}::${dep}`;
35644
35717
  const pending = packageBuildInFlight.get(taskKey);
35645
35718
  if (pending) {
@@ -35657,7 +35730,7 @@ function createPackageBuilder(ctx, oxcVitePlugin) {
35657
35730
  });
35658
35731
  packageBuildInFlight.set(taskKey, task);
35659
35732
  return task;
35660
- }
35733
+ };
35661
35734
  return {
35662
35735
  isMiniprogramPackage,
35663
35736
  shouldSkipBuild,
@@ -37321,7 +37394,7 @@ function createScanService(ctx) {
37321
37394
  vueAppPath = await findVueEntry(appBasename);
37322
37395
  }
37323
37396
  if (!appConfigFile && vueAppPath) {
37324
- const { extractConfigFromVue: extractConfigFromVue2 } = await import("./file-X2RHLBMQ.mjs");
37397
+ const { extractConfigFromVue: extractConfigFromVue2 } = await import("./file-X4XT4UCA.mjs");
37325
37398
  configFromVue = await extractConfigFromVue2(vueAppPath);
37326
37399
  if (configFromVue) {
37327
37400
  appConfigFile = vueAppPath;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  init_esm_shims
3
- } from "./chunk-GTITIIY3.mjs";
3
+ } from "./chunk-QBSVUTNO.mjs";
4
4
 
5
5
  // src/json.ts
6
6
  init_esm_shims();
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  default as default2
3
- } from "./chunk-WFHC5POL.mjs";
3
+ } from "./chunk-3STNMT72.mjs";
4
4
  import {
5
5
  __export,
6
6
  init_esm_shims
7
- } from "./chunk-GTITIIY3.mjs";
7
+ } from "./chunk-QBSVUTNO.mjs";
8
8
 
9
9
  // src/mcp.ts
10
10
  init_esm_shims();
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  init_esm_shims
3
- } from "./chunk-GTITIIY3.mjs";
3
+ } from "./chunk-QBSVUTNO.mjs";
4
4
 
5
5
  // src/config.ts
6
6
  init_esm_shims();
@@ -31,11 +31,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
31
  mod
32
32
  ));
33
33
 
34
- // ../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.57.6_@types+node@25.3.3__@swc+core@1.15.18_jiti@2_32f1cf8abfc79a928ff84be2ee9fbc37/node_modules/tsup/assets/esm_shims.js
34
+ // ../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.57.6_@types+node@25.3.3__@swc+core@1.15.18_jiti@2_39d789450ee28bb5a56b1257ed860af4/node_modules/tsup/assets/esm_shims.js
35
35
  import path from "path";
36
36
  import { fileURLToPath } from "url";
37
37
  var init_esm_shims = __esm({
38
- "../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.57.6_@types+node@25.3.3__@swc+core@1.15.18_jiti@2_32f1cf8abfc79a928ff84be2ee9fbc37/node_modules/tsup/assets/esm_shims.js"() {
38
+ "../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.57.6_@types+node@25.3.3__@swc+core@1.15.18_jiti@2_39d789450ee28bb5a56b1257ed860af4/node_modules/tsup/assets/esm_shims.js"() {
39
39
  "use strict";
40
40
  }
41
41
  });
@@ -2,7 +2,7 @@ import {
2
2
  __commonJS,
3
3
  __toESM,
4
4
  init_esm_shims
5
- } from "./chunk-GTITIIY3.mjs";
5
+ } from "./chunk-QBSVUTNO.mjs";
6
6
 
7
7
  // ../../node_modules/.pnpm/merge@2.1.1/node_modules/merge/lib/src/index.js
8
8
  var require_src = __commonJS({
@@ -145,7 +145,7 @@ function resolveAutoRoutesMacroImportPath() {
145
145
  }
146
146
  async function resolveAutoRoutesInlineSnapshot() {
147
147
  try {
148
- const { getCompilerContext } = await import("./getInstance-LGESJJFX.mjs");
148
+ const { getCompilerContext } = await import("./getInstance-FVRAZQTP.mjs");
149
149
  const service = getCompilerContext().autoRoutesService;
150
150
  await service?.ensureFresh?.();
151
151
  const reference = service?.getReference?.();
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  init_esm_shims
3
- } from "./chunk-GTITIIY3.mjs";
3
+ } from "./chunk-QBSVUTNO.mjs";
4
4
 
5
5
  // src/plugins/vue/runtime.ts
6
6
  init_esm_shims();
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createCompilerContext
3
- } from "./chunk-6BLAPZPG.mjs";
3
+ } from "./chunk-7JSOF7N2.mjs";
4
4
  import {
5
5
  DEFAULT_MP_PLATFORM,
6
6
  SHARED_CHUNK_VIRTUAL_PREFIX,
@@ -12,21 +12,21 @@ import {
12
12
  normalizeMiniPlatform,
13
13
  resolveMiniPlatform,
14
14
  resolveWeappConfigFile
15
- } from "./chunk-EH3FR4SH.mjs";
15
+ } from "./chunk-FVM35BZA.mjs";
16
16
  import {
17
17
  VERSION
18
- } from "./chunk-ZVO7KLQN.mjs";
18
+ } from "./chunk-W5TTICYZ.mjs";
19
19
  import {
20
20
  resolveWeappMcpConfig,
21
21
  startWeappViteMcpServer
22
- } from "./chunk-6Y4CQBGL.mjs";
22
+ } from "./chunk-LVU2OZUF.mjs";
23
23
  import {
24
24
  colors,
25
25
  default as default2
26
- } from "./chunk-WFHC5POL.mjs";
26
+ } from "./chunk-3STNMT72.mjs";
27
27
  import {
28
28
  init_esm_shims
29
- } from "./chunk-GTITIIY3.mjs";
29
+ } from "./chunk-QBSVUTNO.mjs";
30
30
 
31
31
  // src/cli.ts
32
32
  init_esm_shims();
@@ -2349,13 +2349,23 @@ var SKIP_COMMANDS = /* @__PURE__ */ new Set([
2349
2349
  "ide",
2350
2350
  "mcp"
2351
2351
  ]);
2352
+ var DEV_COMMANDS = /* @__PURE__ */ new Set([
2353
+ "dev",
2354
+ "serve"
2355
+ ]);
2352
2356
  var started = false;
2353
2357
  function shouldAutoStartMcp(argv) {
2354
2358
  const command = argv[0];
2355
2359
  if (!command || command.startsWith("-")) {
2356
2360
  return true;
2357
2361
  }
2358
- return !SKIP_COMMANDS.has(command);
2362
+ if (SKIP_COMMANDS.has(command)) {
2363
+ return false;
2364
+ }
2365
+ if (DEV_COMMANDS.has(command)) {
2366
+ return true;
2367
+ }
2368
+ return command.includes("/") || command.includes("\\") || command.startsWith(".");
2359
2369
  }
2360
2370
  async function maybeAutoStartMcpServer(argv, cliOptions) {
2361
2371
  if (started || !shouldAutoStartMcp(argv)) {
@@ -2385,7 +2395,9 @@ async function maybeAutoStartMcpServer(argv, cliOptions) {
2385
2395
  workspaceRoot: process9.cwd()
2386
2396
  });
2387
2397
  started = true;
2388
- default2.info(`[mcp] \u5DF2\u81EA\u52A8\u542F\u52A8\uFF1Ahttp://${resolvedMcp.host}:${resolvedMcp.port}${resolvedMcp.endpoint}`);
2398
+ const mcpUrl = `http://${resolvedMcp.host}:${resolvedMcp.port}${resolvedMcp.endpoint}`;
2399
+ default2.success("MCP \u670D\u52A1\u5DF2\u81EA\u52A8\u542F\u52A8\uFF1A");
2400
+ default2.info(` \u279C ${colors.cyan(mcpUrl)}`);
2389
2401
  } catch (error) {
2390
2402
  const message = error instanceof Error ? error.message : String(error);
2391
2403
  if (/EADDRINUSE/.test(message)) {
package/dist/config.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  defineConfig
3
- } from "./chunk-BHF4WHJX.mjs";
3
+ } from "./chunk-O4WHKAL4.mjs";
4
4
  import {
5
5
  defineAppJson,
6
6
  defineComponentJson,
7
7
  definePageJson,
8
8
  defineSitemapJson,
9
9
  defineThemeJson
10
- } from "./chunk-O2ZCPWFG.mjs";
11
- import "./chunk-GTITIIY3.mjs";
10
+ } from "./chunk-IWKOTXCO.mjs";
11
+ import "./chunk-QBSVUTNO.mjs";
12
12
  export {
13
13
  defineAppJson,
14
14
  defineComponentJson,
@@ -11,8 +11,8 @@ import {
11
11
  isTemplateRequest,
12
12
  touch,
13
13
  touchSync
14
- } from "./chunk-ZVO7KLQN.mjs";
15
- import "./chunk-GTITIIY3.mjs";
14
+ } from "./chunk-W5TTICYZ.mjs";
15
+ import "./chunk-QBSVUTNO.mjs";
16
16
  export {
17
17
  changeFileExtension,
18
18
  extractConfigFromVue,
@@ -4,10 +4,10 @@ import {
4
4
  getCompilerContext,
5
5
  resetCompilerContext,
6
6
  setActiveCompilerContextKey
7
- } from "./chunk-EH3FR4SH.mjs";
8
- import "./chunk-ZVO7KLQN.mjs";
9
- import "./chunk-WFHC5POL.mjs";
10
- import "./chunk-GTITIIY3.mjs";
7
+ } from "./chunk-FVM35BZA.mjs";
8
+ import "./chunk-W5TTICYZ.mjs";
9
+ import "./chunk-3STNMT72.mjs";
10
+ import "./chunk-QBSVUTNO.mjs";
11
11
  export {
12
12
  createCompilerContext,
13
13
  getActiveCompilerContextKey,
package/dist/index.mjs CHANGED
@@ -1,27 +1,27 @@
1
- import "./chunk-KLC6AUWO.mjs";
1
+ import "./chunk-2Q4QRCG5.mjs";
2
2
  import {
3
3
  createCompilerContext
4
- } from "./chunk-6BLAPZPG.mjs";
5
- import "./chunk-EH3FR4SH.mjs";
6
- import "./chunk-ZVO7KLQN.mjs";
4
+ } from "./chunk-7JSOF7N2.mjs";
5
+ import "./chunk-FVM35BZA.mjs";
6
+ import "./chunk-W5TTICYZ.mjs";
7
7
  import {
8
8
  defineConfig
9
- } from "./chunk-BHF4WHJX.mjs";
9
+ } from "./chunk-O4WHKAL4.mjs";
10
10
  import {
11
11
  defineAppJson,
12
12
  defineComponentJson,
13
13
  definePageJson,
14
14
  defineSitemapJson,
15
15
  defineThemeJson
16
- } from "./chunk-O2ZCPWFG.mjs";
16
+ } from "./chunk-IWKOTXCO.mjs";
17
17
  import {
18
18
  defineEmits,
19
19
  defineProps
20
- } from "./chunk-V4HJMXPN.mjs";
21
- import "./chunk-WFHC5POL.mjs";
20
+ } from "./chunk-XEK4R57H.mjs";
21
+ import "./chunk-3STNMT72.mjs";
22
22
  import {
23
23
  init_esm_shims
24
- } from "./chunk-GTITIIY3.mjs";
24
+ } from "./chunk-QBSVUTNO.mjs";
25
25
 
26
26
  // src/index.ts
27
27
  init_esm_shims();
package/dist/json.mjs CHANGED
@@ -4,8 +4,8 @@ import {
4
4
  definePageJson,
5
5
  defineSitemapJson,
6
6
  defineThemeJson
7
- } from "./chunk-O2ZCPWFG.mjs";
8
- import "./chunk-GTITIIY3.mjs";
7
+ } from "./chunk-IWKOTXCO.mjs";
8
+ import "./chunk-QBSVUTNO.mjs";
9
9
  export {
10
10
  defineAppJson,
11
11
  defineComponentJson,
package/dist/mcp.mjs CHANGED
@@ -5,9 +5,9 @@ import {
5
5
  createWeappViteMcpServer,
6
6
  resolveWeappMcpConfig,
7
7
  startWeappViteMcpServer
8
- } from "./chunk-6Y4CQBGL.mjs";
9
- import "./chunk-WFHC5POL.mjs";
10
- import "./chunk-GTITIIY3.mjs";
8
+ } from "./chunk-LVU2OZUF.mjs";
9
+ import "./chunk-3STNMT72.mjs";
10
+ import "./chunk-QBSVUTNO.mjs";
11
11
  export {
12
12
  DEFAULT_MCP_ENDPOINT,
13
13
  DEFAULT_MCP_HOST,
package/dist/runtime.mjs CHANGED
@@ -2,8 +2,8 @@ import {
2
2
  createWevuComponent,
3
3
  defineEmits,
4
4
  defineProps
5
- } from "./chunk-V4HJMXPN.mjs";
6
- import "./chunk-GTITIIY3.mjs";
5
+ } from "./chunk-XEK4R57H.mjs";
6
+ import "./chunk-QBSVUTNO.mjs";
7
7
  export {
8
8
  createWevuComponent,
9
9
  defineEmits,
package/dist/types.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import "./chunk-KLC6AUWO.mjs";
1
+ import "./chunk-2Q4QRCG5.mjs";
2
2
  import {
3
3
  init_esm_shims
4
- } from "./chunk-GTITIIY3.mjs";
4
+ } from "./chunk-QBSVUTNO.mjs";
5
5
 
6
6
  // src/types/index.ts
7
7
  init_esm_shims();
package/dist/volar.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  init_esm_shims
3
- } from "./chunk-GTITIIY3.mjs";
3
+ } from "./chunk-QBSVUTNO.mjs";
4
4
 
5
5
  // src/volar.ts
6
6
  init_esm_shims();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-vite",
3
3
  "type": "module",
4
- "version": "6.7.0",
4
+ "version": "6.7.2",
5
5
  "description": "weapp-vite 一个现代化的小程序打包工具",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -94,42 +94,42 @@
94
94
  "@volar/typescript": "^2.4.28",
95
95
  "@vue/compiler-core": "^3.5.29",
96
96
  "@vue/language-core": "^3.2.5",
97
- "comment-json": "^4.5.1",
97
+ "comment-json": "^4.6.2",
98
98
  "debug": "^4.4.3",
99
99
  "fdir": "^6.5.0",
100
- "fs-extra": "^11.3.3",
100
+ "fs-extra": "^11.3.4",
101
101
  "magic-string": "^0.30.21",
102
- "oxc-parser": "^0.115.0",
102
+ "oxc-parser": "^0.116.0",
103
103
  "oxc-walker": "^0.7.0",
104
104
  "pathe": "^2.0.3",
105
105
  "picomatch": "^4.0.3",
106
- "postcss": "^8.5.6",
106
+ "postcss": "^8.5.8",
107
107
  "rolldown": "1.0.0-rc.6",
108
- "rolldown-plugin-dts": "0.22.2",
108
+ "rolldown-plugin-dts": "0.22.3",
109
109
  "typescript": "^5.9.3",
110
110
  "vite": "8.0.0-beta.16",
111
111
  "vite-tsconfig-paths": "^6.1.1",
112
112
  "vue": "^3.5.29",
113
113
  "vue-tsc": "^3.2.5",
114
114
  "@weapp-core/init": "6.0.1",
115
- "@weapp-core/logger": "3.1.0",
116
115
  "@weapp-core/schematics": "6.0.2",
116
+ "@weapp-core/logger": "3.1.0",
117
+ "@weapp-vite/volar": "2.0.4",
117
118
  "@weapp-core/shared": "3.0.1",
118
119
  "@weapp-vite/mcp": "1.1.0",
119
- "@weapp-vite/volar": "2.0.4",
120
120
  "@weapp-vite/web": "1.3.0",
121
121
  "@wevu/api": "0.1.1",
122
122
  "rolldown-require": "2.0.6",
123
123
  "vite-plugin-performance": "2.0.1",
124
124
  "weapp-ide-cli": "5.1.0",
125
- "wevu": "6.7.0"
125
+ "wevu": "6.7.2"
126
126
  },
127
127
  "publishConfig": {
128
128
  "access": "public",
129
129
  "registry": "https://registry.npmjs.org"
130
130
  },
131
131
  "devDependencies": {
132
- "@oxc-project/types": "^0.115.0",
132
+ "@oxc-project/types": "^0.116.0",
133
133
  "@tailwindcss/vite": "^4.2.1",
134
134
  "@types/semver": "^7.7.1",
135
135
  "@vitejs/plugin-vue": "^6.0.4",