weapp-vite 6.6.7 → 6.6.8

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-ETXM3KLV.mjs";
3
+ } from "../chunk-BP6KVMYT.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-ECNPEEIT.mjs";
4
- import "./chunk-I67A7GMF.mjs";
5
- import "./chunk-YMOUMJD2.mjs";
6
- import "./chunk-5UFWZAGA.mjs";
3
+ } from "./chunk-EE6XJ7ZZ.mjs";
4
+ import "./chunk-DA5NTDY2.mjs";
5
+ import "./chunk-XJH7ESO6.mjs";
6
+ import "./chunk-DLO6COLF.mjs";
7
7
  import {
8
8
  init_esm_shims
9
- } from "./chunk-ETXM3KLV.mjs";
9
+ } from "./chunk-BP6KVMYT.mjs";
10
10
 
11
11
  // src/auto-routes.ts
12
12
  init_esm_shims();
@@ -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.57.0_@types+node@25.3.0__@swc+core@1.15.11_jiti@2_ee117b2be04db444f30b0ec20d97298a/node_modules/tsup/assets/esm_shims.js
30
+ // ../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.57.1_@types+node@25.3.0__@swc+core@1.15.11_jiti@2_33bef0f7763aad222c45b2d476f01059/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.57.0_@types+node@25.3.0__@swc+core@1.15.11_jiti@2_ee117b2be04db444f30b0ec20d97298a/node_modules/tsup/assets/esm_shims.js"() {
34
+ "../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.57.1_@types+node@25.3.0__@swc+core@1.15.11_jiti@2_33bef0f7763aad222c45b2d476f01059/node_modules/tsup/assets/esm_shims.js"() {
35
35
  "use strict";
36
36
  }
37
37
  });
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  init_esm_shims
3
- } from "./chunk-ETXM3KLV.mjs";
3
+ } from "./chunk-BP6KVMYT.mjs";
4
4
 
5
5
  // src/plugins/vue/runtime.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-ETXM3KLV.mjs";
5
+ } from "./chunk-BP6KVMYT.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({
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  init_esm_shims
3
- } from "./chunk-ETXM3KLV.mjs";
3
+ } from "./chunk-BP6KVMYT.mjs";
4
4
 
5
5
  // src/json.ts
6
6
  init_esm_shims();
@@ -14,12 +14,12 @@ import {
14
14
  templateExtensions,
15
15
  touch,
16
16
  vueExtensions
17
- } from "./chunk-I67A7GMF.mjs";
17
+ } from "./chunk-DA5NTDY2.mjs";
18
18
  import {
19
19
  __commonJS,
20
20
  __toESM,
21
21
  init_esm_shims
22
- } from "./chunk-ETXM3KLV.mjs";
22
+ } from "./chunk-BP6KVMYT.mjs";
23
23
 
24
24
  // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/debug.js
25
25
  var require_debug = __commonJS({
@@ -33460,6 +33460,18 @@ function normalizeVueTemplateForPlatform(template, options) {
33460
33460
  return template;
33461
33461
  }
33462
33462
  }
33463
+ function registerVueTemplateToken(ctx, filename, template) {
33464
+ const wxmlService = ctx.wxmlService;
33465
+ if (!wxmlService) {
33466
+ return;
33467
+ }
33468
+ try {
33469
+ const token = wxmlService.analyze(template);
33470
+ wxmlService.tokenMap.set(filename, token);
33471
+ wxmlService.setWxmlComponentsMap(filename, token.components);
33472
+ } catch {
33473
+ }
33474
+ }
33463
33475
  function emitAlipayGenericPlaceholderAssets(ctx, bundle, relativeBase, configSource, outputExtensions, platform) {
33464
33476
  if (platform !== "alipay" || !configSource) {
33465
33477
  return;
@@ -33571,11 +33583,13 @@ async function emitVueBundleAssets(bundle, state) {
33571
33583
  const jsonConfig = configService.weappViteConfig?.json;
33572
33584
  const jsonKind = isAppVue ? "app" : cached.isPage ? "page" : "component";
33573
33585
  if (result.template) {
33574
- emitSfcTemplateIfMissing(pluginCtx, bundle, relativeBase, normalizeVueTemplateForPlatform(result.template, {
33586
+ const normalizedTemplate = normalizeVueTemplateForPlatform(result.template, {
33575
33587
  platform: configService.platform,
33576
33588
  templateExtension,
33577
33589
  scriptModuleExtension: configService.outputExtensions?.wxs
33578
- }), templateExtension);
33590
+ });
33591
+ registerVueTemplateToken(ctx, filename, normalizedTemplate);
33592
+ emitSfcTemplateIfMissing(pluginCtx, bundle, relativeBase, normalizedTemplate, templateExtension);
33579
33593
  }
33580
33594
  const wxsExtension = configService.outputExtensions?.wxs;
33581
33595
  const needsClassStyleWxs = Boolean(result.classStyleWxs) || Boolean(result.scopedSlotComponents?.some((slot) => slot.classStyleWxs));
@@ -33661,11 +33675,13 @@ async function emitVueBundleAssets(bundle, state) {
33661
33675
  }
33662
33676
  }
33663
33677
  if (result.template) {
33664
- emitSfcTemplateIfMissing(pluginCtx, bundle, relativeBase, normalizeVueTemplateForPlatform(result.template, {
33678
+ const normalizedTemplate = normalizeVueTemplateForPlatform(result.template, {
33665
33679
  platform: configService.platform,
33666
33680
  templateExtension,
33667
33681
  scriptModuleExtension: configService.outputExtensions?.wxs
33668
- }), templateExtension);
33682
+ });
33683
+ registerVueTemplateToken(ctx, entryFilePath, normalizedTemplate);
33684
+ emitSfcTemplateIfMissing(pluginCtx, bundle, relativeBase, normalizedTemplate, templateExtension);
33669
33685
  }
33670
33686
  const wxsExtension = configService.outputExtensions?.wxs;
33671
33687
  const needsClassStyleWxs = Boolean(result.classStyleWxs) || Boolean(result.scopedSlotComponents?.some((slot) => slot.classStyleWxs));
@@ -33714,6 +33730,21 @@ async function emitVueBundleAssets(bundle, state) {
33714
33730
  }
33715
33731
 
33716
33732
  // src/plugins/vue/transform/plugin.ts
33733
+ function registerVueTemplateToken2(ctx, filename, template) {
33734
+ if (!template) {
33735
+ return;
33736
+ }
33737
+ const wxmlService = ctx.wxmlService;
33738
+ if (!wxmlService) {
33739
+ return;
33740
+ }
33741
+ try {
33742
+ const token = wxmlService.analyze(template);
33743
+ wxmlService.tokenMap.set(filename, token);
33744
+ wxmlService.setWxmlComponentsMap(filename, token.components);
33745
+ } catch {
33746
+ }
33747
+ }
33717
33748
  function createVueTransformPlugin(ctx) {
33718
33749
  const compilationCache = /* @__PURE__ */ new Map();
33719
33750
  let pageMatcher = null;
@@ -33858,6 +33889,7 @@ function createVueTransformPlugin(ctx) {
33858
33889
  filename,
33859
33890
  compileOptions
33860
33891
  );
33892
+ registerVueTemplateToken2(ctx, filename, result.template);
33861
33893
  if (Array.isArray(result.meta?.sfcSrcDeps) && typeof this.addWatchFile === "function") {
33862
33894
  for (const dep of result.meta.sfcSrcDeps) {
33863
33895
  ;
@@ -34129,7 +34161,7 @@ async function transformWxsFile(state, wxsPath) {
34129
34161
  }
34130
34162
  async function handleWxsDeps(state, deps, absPath) {
34131
34163
  await Promise.all(
34132
- deps.filter((dep) => dep.tagName === "wxs" || dep.tagName === "sjs").map(async (dep) => {
34164
+ deps.filter((dep) => dep.tagName === "wxs" || dep.tagName === "sjs" || dep.tagName === "import-sjs").map(async (dep) => {
34133
34165
  const arr = dep.value.match(/\.(?:wxs|sjs)(\.[jt]s)?$/);
34134
34166
  if (!jsExtensions.includes(dep.attrs.lang) && !arr) {
34135
34167
  return;
@@ -34139,16 +34171,39 @@ async function handleWxsDeps(state, deps, absPath) {
34139
34171
  })
34140
34172
  );
34141
34173
  }
34174
+ async function handleWxsDepsFromBundle(state, bundle) {
34175
+ const templateExtension = state.ctx.configService.outputExtensions?.wxml ?? "wxml";
34176
+ const platform = state.ctx.configService.platform;
34177
+ await Promise.all(
34178
+ Object.entries(bundle).filter(([fileName, output]) => {
34179
+ return fileName.endsWith(`.${templateExtension}`) && output?.type === "asset";
34180
+ }).map(async ([fileName, output]) => {
34181
+ const source = output.source?.toString?.();
34182
+ if (!source) {
34183
+ return;
34184
+ }
34185
+ let deps = [];
34186
+ try {
34187
+ deps = scanWxml(source, { platform }).deps;
34188
+ } catch {
34189
+ return;
34190
+ }
34191
+ const absPath = path68.resolve(state.ctx.configService.absoluteSrcRoot, fileName);
34192
+ await handleWxsDeps.call(this, state, deps, absPath);
34193
+ })
34194
+ );
34195
+ }
34142
34196
  function createWxsPlugin(state) {
34143
34197
  const { ctx } = state;
34144
34198
  const { wxmlService } = ctx;
34145
34199
  return {
34146
34200
  name: "weapp-vite:wxs",
34147
- enforce: "pre",
34201
+ enforce: "post",
34148
34202
  buildStart() {
34149
34203
  state.wxsMap.clear();
34150
34204
  },
34151
- async buildEnd() {
34205
+ async generateBundle(_options, bundle) {
34206
+ state.wxsMap.clear();
34152
34207
  await Promise.all(
34153
34208
  Array.from(wxmlService.tokenMap.entries()).map(([id, token]) => {
34154
34209
  return handleWxsDeps.call(
@@ -34160,6 +34215,7 @@ function createWxsPlugin(state) {
34160
34215
  );
34161
34216
  })
34162
34217
  );
34218
+ await handleWxsDepsFromBundle.call(this, state, bundle);
34163
34219
  for (const { emittedFile } of state.wxsMap.values()) {
34164
34220
  this.emitFile(emittedFile);
34165
34221
  }
@@ -37192,7 +37248,7 @@ function createScanService(ctx) {
37192
37248
  vueAppPath = await findVueEntry(appBasename);
37193
37249
  }
37194
37250
  if (!appConfigFile && vueAppPath) {
37195
- const { extractConfigFromVue: extractConfigFromVue2 } = await import("./file-XPGAVEE7.mjs");
37251
+ const { extractConfigFromVue: extractConfigFromVue2 } = await import("./file-QH43FAOQ.mjs");
37196
37252
  configFromVue = await extractConfigFromVue2(vueAppPath);
37197
37253
  if (configFromVue) {
37198
37254
  appConfigFile = vueAppPath;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  init_esm_shims
3
- } from "./chunk-ETXM3KLV.mjs";
3
+ } from "./chunk-BP6KVMYT.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-ETXM3KLV.mjs";
3
+ } from "./chunk-BP6KVMYT.mjs";
4
4
 
5
5
  // src/config.ts
6
6
  init_esm_shims();
@@ -2,10 +2,10 @@ import {
2
2
  getCompilerContext,
3
3
  resetCompilerContext,
4
4
  setActiveCompilerContextKey
5
- } from "./chunk-ECNPEEIT.mjs";
5
+ } from "./chunk-EE6XJ7ZZ.mjs";
6
6
  import {
7
7
  init_esm_shims
8
- } from "./chunk-ETXM3KLV.mjs";
8
+ } from "./chunk-BP6KVMYT.mjs";
9
9
 
10
10
  // src/createContext.ts
11
11
  init_esm_shims();
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createCompilerContext
3
- } from "./chunk-ULW7I4ZT.mjs";
3
+ } from "./chunk-ZYRAVDNC.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-ECNPEEIT.mjs";
17
+ } from "./chunk-EE6XJ7ZZ.mjs";
18
18
  import {
19
19
  VERSION
20
- } from "./chunk-I67A7GMF.mjs";
20
+ } from "./chunk-DA5NTDY2.mjs";
21
21
  import {
22
22
  init_esm_shims
23
- } from "./chunk-ETXM3KLV.mjs";
23
+ } from "./chunk-BP6KVMYT.mjs";
24
24
 
25
25
  // src/cli.ts
26
26
  init_esm_shims();
package/dist/config.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  defineConfig
3
- } from "./chunk-YMOUMJD2.mjs";
3
+ } from "./chunk-XJH7ESO6.mjs";
4
4
  import {
5
5
  defineAppJson,
6
6
  defineComponentJson,
7
7
  definePageJson,
8
8
  defineSitemapJson,
9
9
  defineThemeJson
10
- } from "./chunk-5UFWZAGA.mjs";
11
- import "./chunk-ETXM3KLV.mjs";
10
+ } from "./chunk-DLO6COLF.mjs";
11
+ import "./chunk-BP6KVMYT.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-I67A7GMF.mjs";
15
- import "./chunk-ETXM3KLV.mjs";
14
+ } from "./chunk-DA5NTDY2.mjs";
15
+ import "./chunk-BP6KVMYT.mjs";
16
16
  export {
17
17
  changeFileExtension,
18
18
  extractConfigFromVue,
package/dist/index.mjs CHANGED
@@ -1,26 +1,26 @@
1
- import "./chunk-UGN67KSR.mjs";
1
+ import "./chunk-GBMX636X.mjs";
2
2
  import {
3
3
  createCompilerContext
4
- } from "./chunk-ULW7I4ZT.mjs";
4
+ } from "./chunk-ZYRAVDNC.mjs";
5
5
  import {
6
6
  defineEmits,
7
7
  defineProps
8
- } from "./chunk-JW6WZBSG.mjs";
9
- import "./chunk-ECNPEEIT.mjs";
10
- import "./chunk-I67A7GMF.mjs";
8
+ } from "./chunk-BSEMCBBG.mjs";
9
+ import "./chunk-EE6XJ7ZZ.mjs";
10
+ import "./chunk-DA5NTDY2.mjs";
11
11
  import {
12
12
  defineConfig
13
- } from "./chunk-YMOUMJD2.mjs";
13
+ } from "./chunk-XJH7ESO6.mjs";
14
14
  import {
15
15
  defineAppJson,
16
16
  defineComponentJson,
17
17
  definePageJson,
18
18
  defineSitemapJson,
19
19
  defineThemeJson
20
- } from "./chunk-5UFWZAGA.mjs";
20
+ } from "./chunk-DLO6COLF.mjs";
21
21
  import {
22
22
  init_esm_shims
23
- } from "./chunk-ETXM3KLV.mjs";
23
+ } from "./chunk-BP6KVMYT.mjs";
24
24
 
25
25
  // src/index.ts
26
26
  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-5UFWZAGA.mjs";
8
- import "./chunk-ETXM3KLV.mjs";
7
+ } from "./chunk-DLO6COLF.mjs";
8
+ import "./chunk-BP6KVMYT.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-JW6WZBSG.mjs";
6
- import "./chunk-ETXM3KLV.mjs";
5
+ } from "./chunk-BSEMCBBG.mjs";
6
+ import "./chunk-BP6KVMYT.mjs";
7
7
  export {
8
8
  createWevuComponent,
9
9
  defineEmits,
package/dist/types.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import "./chunk-UGN67KSR.mjs";
1
+ import "./chunk-GBMX636X.mjs";
2
2
  import {
3
3
  init_esm_shims
4
- } from "./chunk-ETXM3KLV.mjs";
4
+ } from "./chunk-BP6KVMYT.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-ETXM3KLV.mjs";
3
+ } from "./chunk-BP6KVMYT.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.7",
4
+ "version": "6.6.8",
5
5
  "description": "weapp-vite 一个现代化的小程序打包工具",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -110,14 +110,14 @@
110
110
  "@weapp-core/init": "6.0.1",
111
111
  "@weapp-core/logger": "3.1.0",
112
112
  "@weapp-core/schematics": "6.0.2",
113
- "@weapp-core/shared": "3.0.1",
114
113
  "@weapp-vite/volar": "2.0.4",
114
+ "@weapp-core/shared": "3.0.1",
115
115
  "@weapp-vite/web": "1.3.0",
116
116
  "rolldown-require": "2.0.6",
117
+ "@wevu/api": "0.1.1",
117
118
  "vite-plugin-performance": "2.0.1",
118
119
  "weapp-ide-cli": "5.0.4",
119
- "wevu": "6.6.7",
120
- "@wevu/api": "0.1.1"
120
+ "wevu": "6.6.8"
121
121
  },
122
122
  "publishConfig": {
123
123
  "access": "public",