weapp-vite 6.6.0 → 6.6.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.
package/README.md CHANGED
@@ -33,21 +33,19 @@
33
33
  ### Vue 项目
34
34
 
35
35
  ```typescript
36
- import weappVite from '@weapp-vite/vite'
37
36
  // vite.config.ts
38
- import { defineConfig } from 'vite'
37
+ import { defineConfig } from 'weapp-vite/config'
39
38
 
40
39
  export default defineConfig({
41
- plugins: [
42
- weappVite({
43
- vue: {
44
- enable: true,
45
- template: {
46
- removeComments: true,
47
- },
40
+ weapp: {
41
+ srcRoot: 'src',
42
+ vue: {
43
+ enable: true,
44
+ template: {
45
+ removeComments: true,
48
46
  },
49
- }),
50
- ],
47
+ },
48
+ },
51
49
  })
52
50
  ```
53
51
 
@@ -81,6 +79,9 @@ function handleClick() {
81
79
 
82
80
  📚 **完整文档**: [Vue 支持文档](./test/vue/README.md)
83
81
 
82
+ - 配置智能提示文档:[docs/volar.md](./docs/volar.md)
83
+ - defineConfig 重载说明:[docs/define-config-overloads.md](./docs/define-config-overloads.md)
84
+
84
85
  ## Contribute
85
86
 
86
87
  我们邀请你来贡献和帮助改进 `weapp-vite` 💚💚💚
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  init_esm_shims
3
- } from "../chunk-Y65UZS34.mjs";
3
+ } from "../chunk-ZGQLKXB2.mjs";
4
4
 
5
5
  // src/auto-import-components/resolvers/index.ts
6
6
  init_esm_shims();
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  getCompilerContext
3
- } from "./chunk-U7IHZTAF.mjs";
4
- import "./chunk-NNRWURB7.mjs";
5
- import "./chunk-I3YP4FKH.mjs";
6
- import "./chunk-5ZA2JYP2.mjs";
3
+ } from "./chunk-TVBYEUMB.mjs";
4
+ import "./chunk-YFWVPDVD.mjs";
5
+ import "./chunk-5A55HSTZ.mjs";
6
+ import "./chunk-DMFFRMD5.mjs";
7
7
  import {
8
8
  init_esm_shims
9
- } from "./chunk-Y65UZS34.mjs";
9
+ } from "./chunk-ZGQLKXB2.mjs";
10
10
 
11
11
  // src/auto-routes.ts
12
12
  init_esm_shims();
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  init_esm_shims
3
- } from "./chunk-Y65UZS34.mjs";
3
+ } from "./chunk-ZGQLKXB2.mjs";
4
4
 
5
5
  // src/plugins/vue/runtime.ts
6
6
  init_esm_shims();
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  init_esm_shims
3
- } from "./chunk-Y65UZS34.mjs";
3
+ } from "./chunk-ZGQLKXB2.mjs";
4
4
 
5
5
  // src/config.ts
6
6
  init_esm_shims();
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  init_esm_shims
3
- } from "./chunk-Y65UZS34.mjs";
3
+ } from "./chunk-ZGQLKXB2.mjs";
4
4
 
5
5
  // src/json.ts
6
6
  init_esm_shims();
@@ -2,10 +2,10 @@ import {
2
2
  getCompilerContext,
3
3
  resetCompilerContext,
4
4
  setActiveCompilerContextKey
5
- } from "./chunk-U7IHZTAF.mjs";
5
+ } from "./chunk-TVBYEUMB.mjs";
6
6
  import {
7
7
  init_esm_shims
8
- } from "./chunk-Y65UZS34.mjs";
8
+ } from "./chunk-ZGQLKXB2.mjs";
9
9
 
10
10
  // src/createContext.ts
11
11
  init_esm_shims();
@@ -14,12 +14,12 @@ import {
14
14
  templateExtensions,
15
15
  touch,
16
16
  vueExtensions
17
- } from "./chunk-NNRWURB7.mjs";
17
+ } from "./chunk-YFWVPDVD.mjs";
18
18
  import {
19
19
  __commonJS,
20
20
  __toESM,
21
21
  init_esm_shims
22
- } from "./chunk-Y65UZS34.mjs";
22
+ } from "./chunk-ZGQLKXB2.mjs";
23
23
 
24
24
  // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/debug.js
25
25
  var require_debug = __commonJS({
@@ -32608,8 +32608,12 @@ function buildWeappVueStyleRequest(filename, styleBlock, index) {
32608
32608
  // src/plugins/vue/resolver.ts
32609
32609
  var VUE_VIRTUAL_MODULE_PREFIX2 = "\0vue:";
32610
32610
  var LEGACY_WEAPP_VUE_STYLE_VIRTUAL_PREFIX = "weapp-vite:vue-style:";
32611
+ var VUE_LIKE_EXTENSIONS = [".vue", ".tsx", ".jsx"];
32611
32612
  var warnedMissingWevu = false;
32612
32613
  var wevuInstallState = "unknown";
32614
+ function isVueLikeFile(id) {
32615
+ return VUE_LIKE_EXTENSIONS.some((ext2) => id.endsWith(ext2));
32616
+ }
32613
32617
  function hasWevuDependency(ctx) {
32614
32618
  const packageJson = ctx.configService?.packageJson;
32615
32619
  if (!packageJson) {
@@ -32665,7 +32669,7 @@ function createVueResolverPlugin(ctx) {
32665
32669
  }
32666
32670
  return query ? `${absoluteId2}?${query}` : absoluteId2;
32667
32671
  }
32668
- if (id.endsWith(".vue")) {
32672
+ if (isVueLikeFile(id)) {
32669
32673
  ensureWevuInstalled(ctx);
32670
32674
  const absoluteId2 = toAbsoluteId(id, configService, importer, { base: "srcRoot" });
32671
32675
  if (!absoluteId2) {
@@ -32680,10 +32684,12 @@ function createVueResolverPlugin(ctx) {
32680
32684
  if (!absoluteId) {
32681
32685
  return null;
32682
32686
  }
32683
- const vuePath = `${absoluteId}.vue`;
32684
- if (await pathExists2(vuePath, { ttlMs: getPathExistsTtlMs(configService) })) {
32685
- ensureWevuInstalled(ctx);
32686
- return vuePath;
32687
+ for (const ext2 of VUE_LIKE_EXTENSIONS) {
32688
+ const vueLikePath = `${absoluteId}${ext2}`;
32689
+ if (await pathExists2(vueLikePath, { ttlMs: getPathExistsTtlMs(configService) })) {
32690
+ ensureWevuInstalled(ctx);
32691
+ return vueLikePath;
32692
+ }
32687
32693
  }
32688
32694
  return null;
32689
32695
  },
@@ -32721,7 +32727,7 @@ init_esm_shims();
32721
32727
  init_esm_shims();
32722
32728
  import fs32 from "fs-extra";
32723
32729
  import path67 from "pathe";
32724
- import { compileVueFile as compileVueFile2 } from "wevu/compiler";
32730
+ import { compileJsxFile as compileJsxFile2, compileVueFile as compileVueFile2 } from "wevu/compiler";
32725
32731
 
32726
32732
  // src/plugins/wevu.ts
32727
32733
  init_esm_shims();
@@ -32841,7 +32847,7 @@ var wevu = wevuPlugin;
32841
32847
  // src/plugins/vue/transform/bundle.ts
32842
32848
  init_esm_shims();
32843
32849
  import fs31 from "fs-extra";
32844
- import { compileVueFile, getClassStyleWxsSource as getClassStyleWxsSource2 } from "wevu/compiler";
32850
+ import { compileJsxFile, compileVueFile, getClassStyleWxsSource as getClassStyleWxsSource2 } from "wevu/compiler";
32845
32851
 
32846
32852
  // src/wxml/index.ts
32847
32853
  init_esm_shims();
@@ -35851,6 +35857,18 @@ import path66 from "pathe";
35851
35857
  init_esm_shims();
35852
35858
  import fs29 from "fs-extra";
35853
35859
  import path65 from "pathe";
35860
+ var VUE_LIKE_EXTENSIONS2 = [".vue", ".tsx", ".jsx"];
35861
+ function isVueLikeFile2(file) {
35862
+ return VUE_LIKE_EXTENSIONS2.some((ext2) => file.endsWith(ext2));
35863
+ }
35864
+ function stripVueLikeExtension(file) {
35865
+ for (const ext2 of VUE_LIKE_EXTENSIONS2) {
35866
+ if (file.endsWith(ext2)) {
35867
+ return file.slice(0, -ext2.length);
35868
+ }
35869
+ }
35870
+ return file;
35871
+ }
35854
35872
  async function collectVuePages(root) {
35855
35873
  const results = [];
35856
35874
  try {
@@ -35861,8 +35879,8 @@ async function collectVuePages(root) {
35861
35879
  if (stat5.isDirectory()) {
35862
35880
  const nested = await collectVuePages(full);
35863
35881
  results.push(...nested);
35864
- } else if (full.endsWith(".vue")) {
35865
- results.push(full);
35882
+ } else if (isVueLikeFile2(full)) {
35883
+ results.push(stripVueLikeExtension(full));
35866
35884
  }
35867
35885
  }
35868
35886
  } catch {
@@ -35923,7 +35941,7 @@ function buildInlineExpressionMapCode(inlineExpressions) {
35923
35941
  function buildScopedSlotComponentModule(options) {
35924
35942
  const computedCode = options?.computedCode;
35925
35943
  const inlineMapCode = options?.inlineMapCode;
35926
- const importSpecifiers = computedCode ? `${WE_VU_RUNTIME_APIS.createWevuScopedSlotComponent} as _createWevuScopedSlotComponent, normalizeClass as __wevuNormalizeClass, normalizeStyle as __wevuNormalizeStyle` : `${WE_VU_RUNTIME_APIS.createWevuScopedSlotComponent} as _createWevuScopedSlotComponent`;
35944
+ const importSpecifiers = computedCode ? `${WE_VU_RUNTIME_APIS.createWevuScopedSlotComponent} as _createWevuScopedSlotComponent, normalizeClass as __wevuNormalizeClass, normalizeStyle as __wevuNormalizeStyle, unref as __wevuUnref` : `${WE_VU_RUNTIME_APIS.createWevuScopedSlotComponent} as _createWevuScopedSlotComponent`;
35927
35945
  const lines = [
35928
35946
  `import { ${importSpecifiers} } from '${WE_VU_MODULE_ID}';`,
35929
35947
  "const globalObject = typeof globalThis !== 'undefined' ? globalThis : undefined;",
@@ -36090,7 +36108,8 @@ function emitScopedSlotChunks(ctx, relativeBase, result, scopedSlotModules, emit
36090
36108
  if (!scopedSlotModules.has(virtualId)) {
36091
36109
  const computedCode = scopedSlot.classStyleBindings?.length ? buildClassStyleComputedCode(scopedSlot.classStyleBindings, {
36092
36110
  normalizeClassName: "__wevuNormalizeClass",
36093
- normalizeStyleName: "__wevuNormalizeStyle"
36111
+ normalizeStyleName: "__wevuNormalizeStyle",
36112
+ unrefName: "__wevuUnref"
36094
36113
  }) : null;
36095
36114
  const inlineMapCode = buildInlineExpressionMapCode(scopedSlot.inlineExpressions);
36096
36115
  scopedSlotModules.set(
@@ -36128,6 +36147,33 @@ function loadScopedSlotModule(id, scopedSlotModules) {
36128
36147
  }
36129
36148
 
36130
36149
  // src/plugins/vue/transform/bundle.ts
36150
+ function getEntryBaseName(filename) {
36151
+ const extIndex = filename.lastIndexOf(".");
36152
+ if (extIndex < 0) {
36153
+ return filename;
36154
+ }
36155
+ return filename.slice(0, extIndex);
36156
+ }
36157
+ function isAppVueLikeFile(filename) {
36158
+ return /[\\/]app\.(?:vue|jsx|tsx)$/.test(filename);
36159
+ }
36160
+ async function compileVueLikeFile(options) {
36161
+ const {
36162
+ source,
36163
+ filename,
36164
+ ctx,
36165
+ pluginCtx,
36166
+ isPage,
36167
+ isApp,
36168
+ configService,
36169
+ compileOptionsState
36170
+ } = options;
36171
+ const compileOptions = createCompileVueFileOptions(ctx, pluginCtx, filename, isPage, isApp, configService, compileOptionsState);
36172
+ if (filename.endsWith(".vue")) {
36173
+ return await compileVueFile(source, filename, compileOptions);
36174
+ }
36175
+ return await compileJsxFile(source, filename, compileOptions);
36176
+ }
36131
36177
  function normalizeVueConfigForPlatform(config, options) {
36132
36178
  if (!config || options.platform !== "alipay") {
36133
36179
  return config;
@@ -36240,12 +36286,17 @@ async function emitVueBundleAssets(bundle, state) {
36240
36286
  try {
36241
36287
  const source = await fs31.readFile(filename, "utf-8");
36242
36288
  if (source !== cached.source) {
36243
- const isApp = /[\\/]app\.vue$/.test(filename);
36244
- const compiled = await compileVueFile(
36289
+ const isApp = isAppVueLikeFile(filename);
36290
+ const compiled = await compileVueLikeFile({
36245
36291
  source,
36246
36292
  filename,
36247
- createCompileVueFileOptions(ctx, pluginCtx, filename, cached.isPage, isApp, configService, compileOptionsState)
36248
- );
36293
+ ctx,
36294
+ pluginCtx,
36295
+ isPage: cached.isPage,
36296
+ isApp,
36297
+ configService,
36298
+ compileOptionsState
36299
+ });
36249
36300
  if (cached.isPage && compiled.script) {
36250
36301
  const injected = await injectWevuPageFeaturesInJsWithViteResolver(pluginCtx, compiled.script, filename, {
36251
36302
  checkMtime: configService.isDev
@@ -36261,12 +36312,12 @@ async function emitVueBundleAssets(bundle, state) {
36261
36312
  } catch {
36262
36313
  }
36263
36314
  }
36264
- const baseName = filename.slice(0, -4);
36315
+ const baseName = getEntryBaseName(filename);
36265
36316
  const relativeBase = configService.relativeOutputPath(baseName);
36266
36317
  if (!relativeBase) {
36267
36318
  continue;
36268
36319
  }
36269
- const isAppVue = /[\\/]app\.vue$/.test(filename);
36320
+ const isAppVue = isAppVueLikeFile(filename);
36270
36321
  const shouldEmitComponentJson = !isAppVue && !cached.isPage;
36271
36322
  const shouldMergeJsonAsset = isAppVue;
36272
36323
  const jsonConfig = configService.weappViteConfig?.json;
@@ -36323,25 +36374,38 @@ async function emitVueBundleAssets(bundle, state) {
36323
36374
  if (!relativeBase) {
36324
36375
  continue;
36325
36376
  }
36326
- const vuePath = `${entryId}.vue`;
36327
- if (compilationCache.has(vuePath)) {
36377
+ const candidatePaths = [`${entryId}.vue`, `${entryId}.tsx`, `${entryId}.jsx`];
36378
+ const existingPath = candidatePaths.find((candidate) => compilationCache.has(candidate));
36379
+ if (existingPath) {
36328
36380
  continue;
36329
36381
  }
36330
- if (typeof pluginCtx.addWatchFile === "function") {
36331
- pluginCtx.addWatchFile(normalizeWatchPath(vuePath));
36382
+ let entryFilePath;
36383
+ for (const candidate of candidatePaths) {
36384
+ if (await pathExists2(candidate, { ttlMs: getPathExistsTtlMs(configService) })) {
36385
+ entryFilePath = candidate;
36386
+ break;
36387
+ }
36332
36388
  }
36333
- if (!await pathExists2(vuePath, { ttlMs: getPathExistsTtlMs(configService) })) {
36389
+ if (!entryFilePath) {
36334
36390
  continue;
36335
36391
  }
36392
+ if (typeof pluginCtx.addWatchFile === "function") {
36393
+ pluginCtx.addWatchFile(normalizeWatchPath(entryFilePath));
36394
+ }
36336
36395
  try {
36337
- const source = await fs31.readFile(vuePath, "utf-8");
36338
- const result = await compileVueFile(
36396
+ const source = await fs31.readFile(entryFilePath, "utf-8");
36397
+ const result = await compileVueLikeFile({
36339
36398
  source,
36340
- vuePath,
36341
- createCompileVueFileOptions(ctx, pluginCtx, vuePath, true, false, configService, compileOptionsState)
36342
- );
36399
+ filename: entryFilePath,
36400
+ ctx,
36401
+ pluginCtx,
36402
+ isPage: true,
36403
+ isApp: false,
36404
+ configService,
36405
+ compileOptionsState
36406
+ });
36343
36407
  if (result.script) {
36344
- const injected = await injectWevuPageFeaturesInJsWithViteResolver(pluginCtx, result.script, vuePath, {
36408
+ const injected = await injectWevuPageFeaturesInJsWithViteResolver(pluginCtx, result.script, entryFilePath, {
36345
36409
  checkMtime: configService.isDev
36346
36410
  });
36347
36411
  if (injected.transformed) {
@@ -36396,7 +36460,7 @@ async function emitVueBundleAssets(bundle, state) {
36396
36460
  });
36397
36461
  } catch (error) {
36398
36462
  const message = error instanceof Error ? error.message : String(error);
36399
- logger_default.error(`[Vue \u7F16\u8BD1] \u7F16\u8BD1 ${vuePath} \u5931\u8D25\uFF1A${message}`);
36463
+ logger_default.error(`[Vue \u7F16\u8BD1] \u7F16\u8BD1 ${entryFilePath} \u5931\u8D25\uFF1A${message}`);
36400
36464
  }
36401
36465
  }
36402
36466
  }
@@ -36417,6 +36481,14 @@ function createVueTransformPlugin(ctx) {
36417
36481
  const resolved = await pluginCtx.resolve(source, importer);
36418
36482
  return resolved?.id;
36419
36483
  };
36484
+ const isVueLikeId = (id) => id.endsWith(".vue") || id.endsWith(".jsx") || id.endsWith(".tsx");
36485
+ const getEntryBasePath = (filename) => {
36486
+ if (filename.endsWith(".vue") || filename.endsWith(".jsx") || filename.endsWith(".tsx")) {
36487
+ return filename.slice(0, filename.lastIndexOf("."));
36488
+ }
36489
+ return filename;
36490
+ };
36491
+ const isAppEntry = (filename) => /[\\/]app\.(?:vue|jsx|tsx)$/.test(filename);
36420
36492
  return {
36421
36493
  name: `${VUE_PLUGIN_NAME}:transform`,
36422
36494
  buildStart() {
@@ -36462,7 +36534,7 @@ function createVueTransformPlugin(ctx) {
36462
36534
  };
36463
36535
  },
36464
36536
  async transform(code, id) {
36465
- if (!id.endsWith(".vue")) {
36537
+ if (!isVueLikeId(id)) {
36466
36538
  return null;
36467
36539
  }
36468
36540
  const configService = ctx.configService;
@@ -36480,17 +36552,19 @@ function createVueTransformPlugin(ctx) {
36480
36552
  }
36481
36553
  try {
36482
36554
  const source = typeof code === "string" ? code : configService.isDev ? await readFile2(filename, { checkMtime: true, encoding: "utf8" }) : await fs32.readFile(filename, "utf-8");
36483
- try {
36484
- const parsedSfc = await readAndParseSfc(filename, {
36485
- source,
36486
- checkMtime: false,
36487
- resolveSrc: {
36488
- resolveId: (src, importer) => resolveSfcSrc(this, src, importer),
36489
- checkMtime: getSfcCheckMtime(ctx.configService)
36490
- }
36491
- });
36492
- styleBlocksCache.set(filename, parsedSfc.descriptor.styles);
36493
- } catch {
36555
+ if (filename.endsWith(".vue")) {
36556
+ try {
36557
+ const parsedSfc = await readAndParseSfc(filename, {
36558
+ source,
36559
+ checkMtime: false,
36560
+ resolveSrc: {
36561
+ resolveId: (src, importer) => resolveSfcSrc(this, src, importer),
36562
+ checkMtime: getSfcCheckMtime(ctx.configService)
36563
+ }
36564
+ });
36565
+ styleBlocksCache.set(filename, parsedSfc.descriptor.styles);
36566
+ } catch {
36567
+ }
36494
36568
  }
36495
36569
  const libModeEnabled = configService.weappLibConfig?.enabled;
36496
36570
  let isPage = false;
@@ -36521,15 +36595,20 @@ function createVueTransformPlugin(ctx) {
36521
36595
  currentPageMatcher.markDirty();
36522
36596
  }
36523
36597
  isPage = await currentPageMatcher.isPageFile(filename);
36524
- isApp = /[\\/]app\.vue$/.test(filename);
36598
+ isApp = isAppEntry(filename);
36525
36599
  }
36526
- const result = await compileVueFile2(
36600
+ const compileOptions = createCompileVueFileOptions(ctx, this, filename, isPage, isApp, configService, {
36601
+ reExportResolutionCache,
36602
+ classStyleRuntimeWarned
36603
+ });
36604
+ const result = filename.endsWith(".vue") ? await compileVueFile2(
36527
36605
  source,
36528
36606
  filename,
36529
- createCompileVueFileOptions(ctx, this, filename, isPage, isApp, configService, {
36530
- reExportResolutionCache,
36531
- classStyleRuntimeWarned
36532
- })
36607
+ compileOptions
36608
+ ) : await compileJsxFile2(
36609
+ source,
36610
+ filename,
36611
+ compileOptions
36533
36612
  );
36534
36613
  if (Array.isArray(result.meta?.sfcSrcDeps) && typeof this.addWatchFile === "function") {
36535
36614
  for (const dep of result.meta.sfcSrcDeps) {
@@ -36546,7 +36625,7 @@ function createVueTransformPlugin(ctx) {
36546
36625
  }
36547
36626
  }
36548
36627
  compilationCache.set(filename, { result, source, isPage });
36549
- const relativeBase = configService.relativeOutputPath(filename.slice(0, -4));
36628
+ const relativeBase = configService.relativeOutputPath(getEntryBasePath(filename));
36550
36629
  if (relativeBase) {
36551
36630
  emitScopedSlotChunks(this, relativeBase, result, scopedSlotModules, emittedScopedSlotChunks, configService.outputExtensions);
36552
36631
  }
@@ -36594,7 +36673,7 @@ function createVueTransformPlugin(ctx) {
36594
36673
  },
36595
36674
  watchChange(id) {
36596
36675
  const normalizedId = normalizeFsResolvedId(id);
36597
- if (!normalizedId.endsWith(".vue")) {
36676
+ if (!isVueLikeId(normalizedId)) {
36598
36677
  return;
36599
36678
  }
36600
36679
  if (!fs32.existsSync(normalizedId)) {
@@ -36609,7 +36688,7 @@ function createVueTransformPlugin(ctx) {
36609
36688
  },
36610
36689
  // 处理模板和样式作为额外文件
36611
36690
  async handleHotUpdate({ file }) {
36612
- if (!file.endsWith(".vue")) {
36691
+ if (!isVueLikeId(file)) {
36613
36692
  return;
36614
36693
  }
36615
36694
  if (!fs32.existsSync(file)) {
@@ -36634,13 +36713,17 @@ import { transformScript } from "wevu/compiler";
36634
36713
 
36635
36714
  // src/plugins/vue/watch.ts
36636
36715
  init_esm_shims();
36716
+ var VUE_LIKE_EXTENSIONS3 = [".vue", ".tsx", ".jsx"];
36717
+ function isVueLikeFile3(id) {
36718
+ return VUE_LIKE_EXTENSIONS3.some((ext2) => id.endsWith(ext2));
36719
+ }
36637
36720
  function createVueWatchPlugin(_ctx) {
36638
36721
  return {
36639
36722
  name: `${VUE_PLUGIN_NAME}:watch`,
36640
36723
  configureServer(server) {
36641
36724
  const watcher = server.watcher;
36642
36725
  watcher.on("change", (id) => {
36643
- if (id.endsWith(".vue")) {
36726
+ if (isVueLikeFile3(id)) {
36644
36727
  const module = server.moduleGraph.getModuleById(id);
36645
36728
  if (module) {
36646
36729
  server.ws.send({
@@ -36652,7 +36735,7 @@ function createVueWatchPlugin(_ctx) {
36652
36735
  });
36653
36736
  },
36654
36737
  async handleHotUpdate({ file }) {
36655
- if (!file.endsWith(".vue")) {
36738
+ if (!isVueLikeFile3(file)) {
36656
36739
  return;
36657
36740
  }
36658
36741
  return [];
@@ -39836,7 +39919,7 @@ function createScanService(ctx) {
39836
39919
  vueAppPath = await findVueEntry(appBasename);
39837
39920
  }
39838
39921
  if (!appConfigFile && vueAppPath) {
39839
- const { extractConfigFromVue: extractConfigFromVue2 } = await import("./file-FNBYPDGC.mjs");
39922
+ const { extractConfigFromVue: extractConfigFromVue2 } = await import("./file-ZMTTGW5Q.mjs");
39840
39923
  configFromVue = await extractConfigFromVue2(vueAppPath);
39841
39924
  if (configFromVue) {
39842
39925
  appConfigFile = vueAppPath;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  init_esm_shims
3
- } from "./chunk-Y65UZS34.mjs";
3
+ } from "./chunk-ZGQLKXB2.mjs";
4
4
 
5
5
  // src/types/external.ts
6
6
  init_esm_shims();
@@ -2,7 +2,7 @@ import {
2
2
  __commonJS,
3
3
  __toESM,
4
4
  init_esm_shims
5
- } from "./chunk-Y65UZS34.mjs";
5
+ } from "./chunk-ZGQLKXB2.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({
@@ -27,11 +27,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  mod
28
28
  ));
29
29
 
30
- // ../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.56.3_@types+node@25.2.2__@swc+core@1.15.11_jiti@2_14353378903d839f88b8ca4300cd6169/node_modules/tsup/assets/esm_shims.js
30
+ // ../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.56.3_@types+node@25.2.3__@swc+core@1.15.11_jiti@2_825ae237bd52417136b93bbcbabddc06/node_modules/tsup/assets/esm_shims.js
31
31
  import path from "path";
32
32
  import { fileURLToPath } from "url";
33
33
  var init_esm_shims = __esm({
34
- "../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.56.3_@types+node@25.2.2__@swc+core@1.15.11_jiti@2_14353378903d839f88b8ca4300cd6169/node_modules/tsup/assets/esm_shims.js"() {
34
+ "../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.56.3_@types+node@25.2.3__@swc+core@1.15.11_jiti@2_825ae237bd52417136b93bbcbabddc06/node_modules/tsup/assets/esm_shims.js"() {
35
35
  "use strict";
36
36
  }
37
37
  });
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createCompilerContext
3
- } from "./chunk-ZUWHDDGF.mjs";
3
+ } from "./chunk-EABLNB7B.mjs";
4
4
  import {
5
5
  DEFAULT_MP_PLATFORM,
6
6
  SHARED_CHUNK_VIRTUAL_PREFIX,
@@ -14,13 +14,13 @@ import {
14
14
  normalizeMiniPlatform,
15
15
  resolveMiniPlatform,
16
16
  resolveWeappConfigFile
17
- } from "./chunk-U7IHZTAF.mjs";
17
+ } from "./chunk-TVBYEUMB.mjs";
18
18
  import {
19
19
  VERSION
20
- } from "./chunk-NNRWURB7.mjs";
20
+ } from "./chunk-YFWVPDVD.mjs";
21
21
  import {
22
22
  init_esm_shims
23
- } from "./chunk-Y65UZS34.mjs";
23
+ } from "./chunk-ZGQLKXB2.mjs";
24
24
 
25
25
  // src/cli.ts
26
26
  init_esm_shims();
@@ -499,8 +499,9 @@ interface MultiPlatformConfig {
499
499
  }
500
500
  interface WeappViteConfig {
501
501
  /**
502
- * @description 应用入口目录 (app.json 所在的目录)
503
- * 默认 js 模板在根目录 `.`,ts 模板在 `miniprogram` 目录,当然你可以把所有代码放在 `src` 目录下,并设置此选项为 `src`
502
+ * 应用入口目录(`app.json` 所在目录)。
503
+ * 默认 js 模板在根目录 `.`,ts 模板在 `miniprogram` 目录;
504
+ * 你也可以把所有代码放在 `src` 目录下,并设置此选项为 `src`。
504
505
  * @default '.'
505
506
  * @example
506
507
  * srcRoot: 'src'
@@ -1344,22 +1345,17 @@ declare module 'vite' {
1344
1345
  }
1345
1346
  /**
1346
1347
  * @description 为 weapp-vite 配置提供类型提示与推断
1348
+ * @description 注意:同步回调重载需要放在 Promise/联合返回前面,
1349
+ * 这样 `vite.config.ts` 里对象字面量属性(如 `weapp.srcRoot`)才能保留上下文类型,
1350
+ * 才能在编辑器中正确显示 JSDoc 与支持跳转。
1347
1351
  */
1348
- declare function defineConfig(config: UserConfigFnNoEnv): UserConfigFnNoEnv;
1352
+ declare function defineConfig(config: UserConfig): UserConfig;
1353
+ declare function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>;
1349
1354
  declare function defineConfig(config: UserConfigFnNoEnvPlain): UserConfigFnNoEnvPlain;
1350
- declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
1355
+ declare function defineConfig(config: UserConfigFnNoEnv): UserConfigFnNoEnv;
1351
1356
  declare function defineConfig(config: UserConfigFnObjectPlain): UserConfigFnObjectPlain;
1352
1357
  declare function defineConfig(config: UserConfigFnPromise): UserConfigFnPromise;
1353
1358
  declare function defineConfig(config: UserConfigFn): UserConfigFn;
1354
1359
  declare function defineConfig(config: UserConfigLoose): UserConfigLoose;
1355
- declare function defineConfig<const T extends UserConfig>(config: UserConfigFnNoEnv<T>): UserConfigFnNoEnv<T>;
1356
- declare function defineConfig<const T extends UserConfig>(config: UserConfigFnNoEnvPlain<T>): UserConfigFnNoEnvPlain<T>;
1357
- declare function defineConfig<const T extends UserConfig>(config: UserConfigFnObject<T>): UserConfigFnObject<T>;
1358
- declare function defineConfig<const T extends UserConfig>(config: UserConfigFnObjectPlain<T>): UserConfigFnObjectPlain<T>;
1359
- declare function defineConfig<const T extends UserConfig>(config: UserConfigFnPromise<T>): UserConfigFnPromise<T>;
1360
- declare function defineConfig<const T extends UserConfig>(config: UserConfigFn<T>): UserConfigFn<T>;
1361
- declare function defineConfig<const T extends UserConfig>(config: T): T;
1362
- declare function defineConfig<const T extends UserConfig>(config: Promise<T>): Promise<T>;
1363
- declare function defineConfig<const T extends UserConfig>(config: UserConfigExport<T>): UserConfigExport<T>;
1364
1360
 
1365
1361
  export { type JsonMergeStage as $, type Alias as A, type BaseEntry as B, type CompilerContext as C, type Entry as D, type EnhanceOptions as E, type EntryJsonFragment as F, type GenerateDirsOptions as G, type GenerateExtensionsOptions as H, type GenerateFileType as I, type GenerateFilenamesOptions as J, type GenerateOptions as K, type LoadConfigOptions as L, type GenerateTemplate as M, type GenerateTemplateContext as N, type GenerateTemplateEntry as O, type GenerateTemplateFactory as P, type GenerateTemplateFileSource as Q, type GenerateTemplateInlineSource as R, type GenerateTemplateScope as S, type GenerateTemplatesConfig as T, type UserConfig as U, type HandleWxmlOptions as V, type WeappViteConfig as W, type JsFormat as X, type JsonConfig as Y, type JsonMergeContext as Z, type JsonMergeFunction as _, type UserConfigExport as a, type JsonMergeStrategy as a0, type MpPlatform as a1, type MultiPlatformConfig as a2, type NpmBuildOptions as a3, type PageEntry as a4, type ProjectConfig as a5, type ResolvedAlias as a6, type ScanComponentItem as a7, type ScanWxmlOptions as a8, type SharedChunkDynamicImports as a9, type SharedChunkMode as aa, type SharedChunkOverride as ab, type SharedChunkStrategy as ac, type SubPackage as ad, type SubPackageMetaValue as ae, type SubPackageStyleConfigEntry as af, type SubPackageStyleConfigObject as ag, type SubPackageStyleEntry as ah, type SubPackageStyleScope as ai, type UserConfig$1 as aj, type WeappLibComponentJson as ak, type WeappLibConfig as al, type WeappLibDtsOptions as am, type WeappLibEntryContext as an, type WeappLibFileName as ao, type WeappLibInternalDtsOptions as ap, type WeappLibVueTscOptions as aq, type WeappVitePluginApi as ar, type WeappWebConfig as as, type WxmlDep as at, type UserConfigFn as b, type UserConfigFnNoEnv as c, type UserConfigFnNoEnvPlain as d, type UserConfigFnObject as e, type UserConfigFnObjectPlain as f, type UserConfigFnPromise as g, defineAppJson as h, defineComponentJson as i, defineConfig as j, definePageJson as k, defineSitemapJson as l, defineThemeJson as m, type AliasOptions as n, type AlipayNpmMode as o, type AppEntry as p, type AutoImportComponents as q, type AutoImportComponentsOption as r, type BuildNpmPackageMeta as s, type ChangeEvent as t, type ChunksConfig as u, type ComponentEntry as v, type ComponentsMap as w, type CopyGlobs as x, type CopyOptions as y, type EnhanceWxmlOptions as z };
package/dist/config.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import 'vite';
2
- export { U as UserConfig, a as UserConfigExport, b as UserConfigFn, c as UserConfigFnNoEnv, d as UserConfigFnNoEnvPlain, e as UserConfigFnObject, f as UserConfigFnObjectPlain, g as UserConfigFnPromise, W as WeappViteConfig, h as defineAppJson, i as defineComponentJson, j as defineConfig, k as definePageJson, l as defineSitemapJson, m as defineThemeJson } from './config-BdunEY-6.js';
2
+ export { U as UserConfig, a as UserConfigExport, b as UserConfigFn, c as UserConfigFnNoEnv, d as UserConfigFnNoEnvPlain, e as UserConfigFnObject, f as UserConfigFnObjectPlain, g as UserConfigFnPromise, W as WeappViteConfig, h as defineAppJson, i as defineComponentJson, j as defineConfig, k as definePageJson, l as defineSitemapJson, m as defineThemeJson } from './config-BzT9eoff.js';
3
3
  export { App, Component, Page, Sitemap, Theme } from '@weapp-core/schematics';
4
4
  import '@weapp-vite/web';
5
5
  import 'rolldown';
package/dist/config.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  defineConfig
3
- } from "./chunk-I3YP4FKH.mjs";
3
+ } from "./chunk-5A55HSTZ.mjs";
4
4
  import {
5
5
  defineAppJson,
6
6
  defineComponentJson,
7
7
  definePageJson,
8
8
  defineSitemapJson,
9
9
  defineThemeJson
10
- } from "./chunk-5ZA2JYP2.mjs";
11
- import "./chunk-Y65UZS34.mjs";
10
+ } from "./chunk-DMFFRMD5.mjs";
11
+ import "./chunk-ZGQLKXB2.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-NNRWURB7.mjs";
15
- import "./chunk-Y65UZS34.mjs";
14
+ } from "./chunk-YFWVPDVD.mjs";
15
+ import "./chunk-ZGQLKXB2.mjs";
16
16
  export {
17
17
  changeFileExtension,
18
18
  extractConfigFromVue,
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { L as LoadConfigOptions, C as CompilerContext } from './config-BdunEY-6.js';
2
- export { U as UserConfig, a as UserConfigExport, b as UserConfigFn, c as UserConfigFnNoEnv, d as UserConfigFnNoEnvPlain, e as UserConfigFnObject, f as UserConfigFnObjectPlain, g as UserConfigFnPromise, W as WeappViteConfig, h as defineAppJson, i as defineComponentJson, j as defineConfig, k as definePageJson, l as defineSitemapJson, m as defineThemeJson } from './config-BdunEY-6.js';
1
+ import { L as LoadConfigOptions, C as CompilerContext } from './config-BzT9eoff.js';
2
+ export { U as UserConfig, a as UserConfigExport, b as UserConfigFn, c as UserConfigFnNoEnv, d as UserConfigFnNoEnvPlain, e as UserConfigFnObject, f as UserConfigFnObjectPlain, g as UserConfigFnPromise, W as WeappViteConfig, h as defineAppJson, i as defineComponentJson, j as defineConfig, k as definePageJson, l as defineSitemapJson, m as defineThemeJson } from './config-BzT9eoff.js';
3
3
  export { WevuComponentOptions, defineEmits, defineProps } from './runtime.js';
4
4
  export { RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, WatchOptions as RolldownWatchOptions, RolldownWatcher } from 'rolldown';
5
5
  export { ConfigEnv, InlineConfig, Plugin, PluginOption, ResolvedConfig, ViteDevServer } from 'vite';
package/dist/index.mjs CHANGED
@@ -1,26 +1,26 @@
1
- import "./chunk-EQ2UFBKP.mjs";
1
+ import "./chunk-XPH5IUSV.mjs";
2
2
  import {
3
3
  createCompilerContext
4
- } from "./chunk-ZUWHDDGF.mjs";
4
+ } from "./chunk-EABLNB7B.mjs";
5
5
  import {
6
6
  defineEmits,
7
7
  defineProps
8
- } from "./chunk-JCYPKYYP.mjs";
9
- import "./chunk-U7IHZTAF.mjs";
10
- import "./chunk-NNRWURB7.mjs";
8
+ } from "./chunk-4UCXO3GV.mjs";
9
+ import "./chunk-TVBYEUMB.mjs";
10
+ import "./chunk-YFWVPDVD.mjs";
11
11
  import {
12
12
  defineConfig
13
- } from "./chunk-I3YP4FKH.mjs";
13
+ } from "./chunk-5A55HSTZ.mjs";
14
14
  import {
15
15
  defineAppJson,
16
16
  defineComponentJson,
17
17
  definePageJson,
18
18
  defineSitemapJson,
19
19
  defineThemeJson
20
- } from "./chunk-5ZA2JYP2.mjs";
20
+ } from "./chunk-DMFFRMD5.mjs";
21
21
  import {
22
22
  init_esm_shims
23
- } from "./chunk-Y65UZS34.mjs";
23
+ } from "./chunk-ZGQLKXB2.mjs";
24
24
 
25
25
  // src/index.ts
26
26
  init_esm_shims();
package/dist/json.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { App, Component, Page, Sitemap, Theme } from '@weapp-core/schematics';
2
- export { h as defineAppJson, i as defineComponentJson, k as definePageJson, l as defineSitemapJson, m as defineThemeJson } from './config-BdunEY-6.js';
2
+ export { h as defineAppJson, i as defineComponentJson, k as definePageJson, l as defineSitemapJson, m as defineThemeJson } from './config-BzT9eoff.js';
3
3
  import 'vite';
4
4
  import '@weapp-vite/web';
5
5
  import 'rolldown';
package/dist/json.mjs CHANGED
@@ -4,8 +4,8 @@ import {
4
4
  definePageJson,
5
5
  defineSitemapJson,
6
6
  defineThemeJson
7
- } from "./chunk-5ZA2JYP2.mjs";
8
- import "./chunk-Y65UZS34.mjs";
7
+ } from "./chunk-DMFFRMD5.mjs";
8
+ import "./chunk-ZGQLKXB2.mjs";
9
9
  export {
10
10
  defineAppJson,
11
11
  defineComponentJson,
package/dist/runtime.mjs CHANGED
@@ -2,8 +2,8 @@ import {
2
2
  createWevuComponent,
3
3
  defineEmits,
4
4
  defineProps
5
- } from "./chunk-JCYPKYYP.mjs";
6
- import "./chunk-Y65UZS34.mjs";
5
+ } from "./chunk-4UCXO3GV.mjs";
6
+ import "./chunk-ZGQLKXB2.mjs";
7
7
  export {
8
8
  createWevuComponent,
9
9
  defineEmits,
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as Alias, n as AliasOptions, o as AlipayNpmMode, p as AppEntry, q as AutoImportComponents, r as AutoImportComponentsOption, B as BaseEntry, s as BuildNpmPackageMeta, t as ChangeEvent, u as ChunksConfig, v as ComponentEntry, w as ComponentsMap, x as CopyGlobs, y as CopyOptions, E as EnhanceOptions, z as EnhanceWxmlOptions, D as Entry, F as EntryJsonFragment, G as GenerateDirsOptions, H as GenerateExtensionsOptions, I as GenerateFileType, J as GenerateFilenamesOptions, K as GenerateOptions, M as GenerateTemplate, N as GenerateTemplateContext, O as GenerateTemplateEntry, P as GenerateTemplateFactory, Q as GenerateTemplateFileSource, R as GenerateTemplateInlineSource, S as GenerateTemplateScope, T as GenerateTemplatesConfig, V as HandleWxmlOptions, X as JsFormat, Y as JsonConfig, Z as JsonMergeContext, _ as JsonMergeFunction, $ as JsonMergeStage, a0 as JsonMergeStrategy, a1 as MpPlatform, a2 as MultiPlatformConfig, a3 as NpmBuildOptions, a4 as PageEntry, a5 as ProjectConfig, a6 as ResolvedAlias, a7 as ScanComponentItem, a8 as ScanWxmlOptions, a9 as SharedChunkDynamicImports, aa as SharedChunkMode, ab as SharedChunkOverride, ac as SharedChunkStrategy, ad as SubPackage, ae as SubPackageMetaValue, af as SubPackageStyleConfigEntry, ag as SubPackageStyleConfigObject, ah as SubPackageStyleEntry, ai as SubPackageStyleScope, aj as UserConfig, ak as WeappLibComponentJson, al as WeappLibConfig, am as WeappLibDtsOptions, an as WeappLibEntryContext, ao as WeappLibFileName, ap as WeappLibInternalDtsOptions, aq as WeappLibVueTscOptions, W as WeappViteConfig, ar as WeappVitePluginApi, as as WeappWebConfig, at as WxmlDep } from './config-BdunEY-6.js';
1
+ export { A as Alias, n as AliasOptions, o as AlipayNpmMode, p as AppEntry, q as AutoImportComponents, r as AutoImportComponentsOption, B as BaseEntry, s as BuildNpmPackageMeta, t as ChangeEvent, u as ChunksConfig, v as ComponentEntry, w as ComponentsMap, x as CopyGlobs, y as CopyOptions, E as EnhanceOptions, z as EnhanceWxmlOptions, D as Entry, F as EntryJsonFragment, G as GenerateDirsOptions, H as GenerateExtensionsOptions, I as GenerateFileType, J as GenerateFilenamesOptions, K as GenerateOptions, M as GenerateTemplate, N as GenerateTemplateContext, O as GenerateTemplateEntry, P as GenerateTemplateFactory, Q as GenerateTemplateFileSource, R as GenerateTemplateInlineSource, S as GenerateTemplateScope, T as GenerateTemplatesConfig, V as HandleWxmlOptions, X as JsFormat, Y as JsonConfig, Z as JsonMergeContext, _ as JsonMergeFunction, $ as JsonMergeStage, a0 as JsonMergeStrategy, a1 as MpPlatform, a2 as MultiPlatformConfig, a3 as NpmBuildOptions, a4 as PageEntry, a5 as ProjectConfig, a6 as ResolvedAlias, a7 as ScanComponentItem, a8 as ScanWxmlOptions, a9 as SharedChunkDynamicImports, aa as SharedChunkMode, ab as SharedChunkOverride, ac as SharedChunkStrategy, ad as SubPackage, ae as SubPackageMetaValue, af as SubPackageStyleConfigEntry, ag as SubPackageStyleConfigObject, ah as SubPackageStyleEntry, ai as SubPackageStyleScope, aj as UserConfig, ak as WeappLibComponentJson, al as WeappLibConfig, am as WeappLibDtsOptions, an as WeappLibEntryContext, ao as WeappLibFileName, ap as WeappLibInternalDtsOptions, aq as WeappLibVueTscOptions, W as WeappViteConfig, ar as WeappVitePluginApi, as as WeappWebConfig, at as WxmlDep } from './config-BzT9eoff.js';
2
2
  export { RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, WatchOptions as RolldownWatchOptions, RolldownWatcher } from 'rolldown';
3
3
  export { ConfigEnv, InlineConfig, Plugin, PluginOption, ResolvedConfig, ViteDevServer } from 'vite';
4
4
  export { ComputedDefinitions, MethodDefinitions, Ref } from 'wevu';
package/dist/types.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import "./chunk-EQ2UFBKP.mjs";
1
+ import "./chunk-XPH5IUSV.mjs";
2
2
  import {
3
3
  init_esm_shims
4
- } from "./chunk-Y65UZS34.mjs";
4
+ } from "./chunk-ZGQLKXB2.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-Y65UZS34.mjs";
3
+ } from "./chunk-ZGQLKXB2.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.6.0",
4
+ "version": "6.6.2",
5
5
  "description": "weapp-vite 一个现代化的小程序打包工具",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -107,24 +107,24 @@
107
107
  "vite-tsconfig-paths": "^6.1.0",
108
108
  "vue": "^3.5.28",
109
109
  "vue-tsc": "^3.2.4",
110
- "@weapp-core/init": "6.0.1",
111
- "@weapp-core/logger": "3.1.0",
112
110
  "@weapp-core/schematics": "6.0.2",
113
- "@weapp-core/shared": "3.0.1",
114
111
  "@weapp-vite/volar": "2.0.4",
112
+ "@weapp-core/shared": "3.0.1",
115
113
  "@weapp-vite/web": "1.2.4",
116
114
  "@wevu/api": "0.1.1",
117
115
  "rolldown-require": "2.0.6",
118
116
  "vite-plugin-performance": "2.0.1",
119
117
  "weapp-ide-cli": "5.0.3",
120
- "wevu": "2.1.9"
118
+ "@weapp-core/init": "6.0.1",
119
+ "wevu": "2.1.11",
120
+ "@weapp-core/logger": "3.1.0"
121
121
  },
122
122
  "publishConfig": {
123
123
  "access": "public",
124
124
  "registry": "https://registry.npmjs.org"
125
125
  },
126
126
  "devDependencies": {
127
- "@oxc-project/types": "^0.112.0",
127
+ "@oxc-project/types": "^0.113.0",
128
128
  "@tailwindcss/vite": "^4.1.18",
129
129
  "@types/semver": "^7.7.1",
130
130
  "@vitejs/plugin-vue": "^6.0.4",