weapp-vite 2.0.1 → 2.0.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.
@@ -140,9 +140,11 @@ declare class ScanService {
140
140
  entries: Entry[];
141
141
  appEntry?: AppEntry;
142
142
  pagesSet: Set<string>;
143
+ componentEntrySet: Set<string>;
143
144
  constructor(configService: ConfigService, jsonService: JsonService, subPackageService: SubPackageService, autoImportService: AutoImportService, wxmlService: WxmlService);
144
145
  initPagesSet(): Set<string>;
145
146
  /**
147
+ * 扫描 usingComponents 字段进行解析
146
148
  * @deps [this.scanComponentEntry]
147
149
  * @param entry
148
150
  * @param relDir
@@ -140,9 +140,11 @@ declare class ScanService {
140
140
  entries: Entry[];
141
141
  appEntry?: AppEntry;
142
142
  pagesSet: Set<string>;
143
+ componentEntrySet: Set<string>;
143
144
  constructor(configService: ConfigService, jsonService: JsonService, subPackageService: SubPackageService, autoImportService: AutoImportService, wxmlService: WxmlService);
144
145
  initPagesSet(): Set<string>;
145
146
  /**
147
+ * 扫描 usingComponents 字段进行解析
146
148
  * @deps [this.scanComponentEntry]
147
149
  * @param entry
148
150
  * @param relDir
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __name,
3
3
  init_esm_shims
4
- } from "../chunk-OCZOGFU3.mjs";
4
+ } from "../chunk-ZRLZHOL5.mjs";
5
5
 
6
6
  // src/auto-import-components/resolvers/index.ts
7
7
  init_esm_shims();
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __name,
3
3
  init_esm_shims
4
- } from "./chunk-OCZOGFU3.mjs";
4
+ } from "./chunk-ZRLZHOL5.mjs";
5
5
 
6
6
  // src/config.ts
7
7
  init_esm_shims();
@@ -3,7 +3,7 @@ import {
3
3
  __name,
4
4
  __toESM,
5
5
  init_esm_shims
6
- } from "./chunk-OCZOGFU3.mjs";
6
+ } from "./chunk-ZRLZHOL5.mjs";
7
7
 
8
8
  // ../../node_modules/.pnpm/reflect-metadata@0.2.2/node_modules/reflect-metadata/Reflect.js
9
9
  var require_Reflect = __commonJS({
@@ -13987,7 +13987,7 @@ function scanWxml(wxml, options) {
13987
13987
  });
13988
13988
  const ms = wxml.toString();
13989
13989
  const deps = [];
13990
- let currentTagName = "";
13990
+ let currentTagName;
13991
13991
  let importAttrs;
13992
13992
  let attrs = {};
13993
13993
  const components2 = {};
@@ -13999,15 +13999,17 @@ function scanWxml(wxml, options) {
13999
13999
  const wxsImportNormalizeTokens = [];
14000
14000
  const removeWxsLangAttrTokens = [];
14001
14001
  const eventTokens = [];
14002
+ const tagStack = [];
14002
14003
  const parser = new Parser({
14003
14004
  onopentagname(name) {
14005
+ tagStack.push(name);
14004
14006
  currentTagName = name;
14005
14007
  importAttrs = srcImportTagsMap[currentTagName];
14006
14008
  tagStartIndex = parser.startIndex;
14007
14009
  },
14008
14010
  onattribute(name, value, quote) {
14009
14011
  attrs[name] = value;
14010
- if (importAttrs) {
14012
+ if (importAttrs && currentTagName) {
14011
14013
  for (const attrName of importAttrs) {
14012
14014
  if (attrName === name) {
14013
14015
  deps.push({
@@ -14074,6 +14076,7 @@ function scanWxml(wxml, options) {
14074
14076
  }
14075
14077
  },
14076
14078
  onclosetag() {
14079
+ currentTagName = tagStack.pop();
14077
14080
  if (currentTagName && !opts.excludeComponent(currentTagName)) {
14078
14081
  if (Array.isArray(components2[currentTagName])) {
14079
14082
  components2[currentTagName].push({
@@ -14611,6 +14614,8 @@ async function loadConfig(opts) {
14611
14614
  assetsDir: ".",
14612
14615
  commonjsOptions: {
14613
14616
  transformMixedEsModules: true,
14617
+ // include:[/(?:)/]
14618
+ // const regex = /(?:)/; // 单次匹配
14614
14619
  include: void 0
14615
14620
  }
14616
14621
  },
@@ -15271,9 +15276,9 @@ init_esm_shims();
15271
15276
  import { defu as defu5, isObject as isObject4, objectHash } from "@weapp-core/shared";
15272
15277
  import fs10 from "fs-extra";
15273
15278
 
15274
- // ../../node_modules/.pnpm/local-pkg@0.5.1/node_modules/local-pkg/dist/index.mjs
15279
+ // ../../node_modules/.pnpm/local-pkg@1.0.0/node_modules/local-pkg/dist/index.mjs
15275
15280
  init_esm_shims();
15276
- import fs9, { promises as promises2 } from "node:fs";
15281
+ import fs9 from "node:fs";
15277
15282
  import { createRequire as createRequire4 } from "node:module";
15278
15283
  import path11, { dirname as dirname2, win32, join } from "node:path";
15279
15284
  import process4 from "node:process";
@@ -22299,8 +22304,7 @@ function resolvePathSync(id, options) {
22299
22304
  }
22300
22305
  __name(resolvePathSync, "resolvePathSync");
22301
22306
 
22302
- // ../../node_modules/.pnpm/local-pkg@0.5.1/node_modules/local-pkg/dist/index.mjs
22303
- var findUpStop = Symbol("findUpStop");
22307
+ // ../../node_modules/.pnpm/local-pkg@1.0.0/node_modules/local-pkg/dist/index.mjs
22304
22308
  function _resolve2(path15, options = {}) {
22305
22309
  if (options.platform === "auto" || !options.platform)
22306
22310
  options.platform = process4.platform === "win32" ? "win32" : "posix";
@@ -22574,6 +22578,8 @@ var ScanService2 = class {
22574
22578
  entries;
22575
22579
  appEntry;
22576
22580
  pagesSet;
22581
+ // 处理循环依赖
22582
+ componentEntrySet;
22577
22583
  constructor(configService, jsonService, subPackageService, autoImportService, wxmlService) {
22578
22584
  this.configService = configService;
22579
22585
  this.jsonService = jsonService;
@@ -22582,6 +22588,7 @@ var ScanService2 = class {
22582
22588
  this.wxmlService = wxmlService;
22583
22589
  this.entries = [];
22584
22590
  this.entriesSet = /* @__PURE__ */ new Set();
22591
+ this.componentEntrySet = /* @__PURE__ */ new Set();
22585
22592
  }
22586
22593
  // https://github.com/vitejs/vite/blob/192d555f88bba7576e8a40cc027e8a11e006079c/packages/vite/src/node/plugins/define.ts#L41
22587
22594
  initPagesSet() {
@@ -22603,6 +22610,7 @@ var ScanService2 = class {
22603
22610
  return set3;
22604
22611
  }
22605
22612
  /**
22613
+ * 扫描 usingComponents 字段进行解析
22606
22614
  * @deps [this.scanComponentEntry]
22607
22615
  * @param entry
22608
22616
  * @param relDir
@@ -22628,6 +22636,7 @@ var ScanService2 = class {
22628
22636
  }
22629
22637
  resetEntries() {
22630
22638
  this.entriesSet.clear();
22639
+ this.componentEntrySet.clear();
22631
22640
  this.wxmlService.clear();
22632
22641
  this.entries.length = 0;
22633
22642
  this.subPackageService.metaMap = {};
@@ -22744,6 +22753,10 @@ var ScanService2 = class {
22744
22753
  * 同时处理引入组件的情况,自动注入 usingComponents。
22745
22754
  */
22746
22755
  async scanComponentEntry(componentEntry, dirname3, subPackageMeta) {
22756
+ if (this.componentEntrySet.has(componentEntry)) {
22757
+ debug?.(`${componentEntry} \u5DF2\u7ECF\u88AB\u626B\u63CF\u8FC7`);
22758
+ return;
22759
+ }
22747
22760
  const meta = subPackageMeta ?? {
22748
22761
  entriesSet: this.entriesSet,
22749
22762
  entries: this.entries
@@ -22823,6 +22836,7 @@ var ScanService2 = class {
22823
22836
  }
22824
22837
  }
22825
22838
  }
22839
+ this.componentEntrySet.add(componentEntry);
22826
22840
  if (isObject5(config)) {
22827
22841
  await this.usingComponentsHandler(jsonFragment, path13.dirname(baseName), subPackageMeta);
22828
22842
  }
@@ -28,9 +28,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  mod
29
29
  ));
30
30
 
31
- // ../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.4_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/esm_shims.js
31
+ // ../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.4_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/esm_shims.js
32
32
  var init_esm_shims = __esm({
33
- "../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.4_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/esm_shims.js"() {
33
+ "../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.4_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/esm_shims.js"() {
34
34
  "use strict";
35
35
  }
36
36
  });
package/dist/cli.cjs CHANGED
@@ -29,10 +29,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
29
  mod
30
30
  ));
31
31
 
32
- // ../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.4_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/cjs_shims.js
32
+ // ../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.4_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js
33
33
  var getImportMetaUrl, importMetaUrl;
34
34
  var init_cjs_shims = __esm({
35
- "../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.4_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/cjs_shims.js"() {
35
+ "../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.4_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js"() {
36
36
  "use strict";
37
37
  getImportMetaUrl = /* @__PURE__ */ __name(() => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href, "getImportMetaUrl");
38
38
  importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
@@ -14640,7 +14640,7 @@ function scanWxml(wxml, options) {
14640
14640
  });
14641
14641
  const ms = wxml.toString();
14642
14642
  const deps = [];
14643
- let currentTagName = "";
14643
+ let currentTagName;
14644
14644
  let importAttrs;
14645
14645
  let attrs = {};
14646
14646
  const components2 = {};
@@ -14652,15 +14652,17 @@ function scanWxml(wxml, options) {
14652
14652
  const wxsImportNormalizeTokens = [];
14653
14653
  const removeWxsLangAttrTokens = [];
14654
14654
  const eventTokens = [];
14655
+ const tagStack = [];
14655
14656
  const parser = new Parser({
14656
14657
  onopentagname(name) {
14658
+ tagStack.push(name);
14657
14659
  currentTagName = name;
14658
14660
  importAttrs = srcImportTagsMap[currentTagName];
14659
14661
  tagStartIndex = parser.startIndex;
14660
14662
  },
14661
14663
  onattribute(name, value, quote) {
14662
14664
  attrs[name] = value;
14663
- if (importAttrs) {
14665
+ if (importAttrs && currentTagName) {
14664
14666
  for (const attrName of importAttrs) {
14665
14667
  if (attrName === name) {
14666
14668
  deps.push({
@@ -14727,6 +14729,7 @@ function scanWxml(wxml, options) {
14727
14729
  }
14728
14730
  },
14729
14731
  onclosetag() {
14732
+ currentTagName = tagStack.pop();
14730
14733
  if (currentTagName && !opts.excludeComponent(currentTagName)) {
14731
14734
  if (Array.isArray(components2[currentTagName])) {
14732
14735
  components2[currentTagName].push({
@@ -15264,6 +15267,8 @@ async function loadConfig(opts) {
15264
15267
  assetsDir: ".",
15265
15268
  commonjsOptions: {
15266
15269
  transformMixedEsModules: true,
15270
+ // include:[/(?:)/]
15271
+ // const regex = /(?:)/; // 单次匹配
15267
15272
  include: void 0
15268
15273
  }
15269
15274
  },
@@ -15924,7 +15929,7 @@ init_cjs_shims();
15924
15929
  var import_shared14 = require("@weapp-core/shared");
15925
15930
  var import_fs_extra6 = __toESM(require("fs-extra"), 1);
15926
15931
 
15927
- // ../../node_modules/.pnpm/local-pkg@0.5.1/node_modules/local-pkg/dist/index.mjs
15932
+ // ../../node_modules/.pnpm/local-pkg@1.0.0/node_modules/local-pkg/dist/index.mjs
15928
15933
  init_cjs_shims();
15929
15934
  var import_node_fs2 = __toESM(require("fs"), 1);
15930
15935
  var import_promises = __toESM(require("fs/promises"), 1);
@@ -22954,8 +22959,7 @@ function resolvePathSync(id, options) {
22954
22959
  }
22955
22960
  __name(resolvePathSync, "resolvePathSync");
22956
22961
 
22957
- // ../../node_modules/.pnpm/local-pkg@0.5.1/node_modules/local-pkg/dist/index.mjs
22958
- var findUpStop = Symbol("findUpStop");
22962
+ // ../../node_modules/.pnpm/local-pkg@1.0.0/node_modules/local-pkg/dist/index.mjs
22959
22963
  function _resolve2(path17, options = {}) {
22960
22964
  if (options.platform === "auto" || !options.platform)
22961
22965
  options.platform = import_node_process4.default.platform === "win32" ? "win32" : "posix";
@@ -23229,6 +23233,8 @@ var ScanService2 = class {
23229
23233
  entries;
23230
23234
  appEntry;
23231
23235
  pagesSet;
23236
+ // 处理循环依赖
23237
+ componentEntrySet;
23232
23238
  constructor(configService, jsonService, subPackageService, autoImportService, wxmlService) {
23233
23239
  this.configService = configService;
23234
23240
  this.jsonService = jsonService;
@@ -23237,6 +23243,7 @@ var ScanService2 = class {
23237
23243
  this.wxmlService = wxmlService;
23238
23244
  this.entries = [];
23239
23245
  this.entriesSet = /* @__PURE__ */ new Set();
23246
+ this.componentEntrySet = /* @__PURE__ */ new Set();
23240
23247
  }
23241
23248
  // https://github.com/vitejs/vite/blob/192d555f88bba7576e8a40cc027e8a11e006079c/packages/vite/src/node/plugins/define.ts#L41
23242
23249
  initPagesSet() {
@@ -23258,6 +23265,7 @@ var ScanService2 = class {
23258
23265
  return set3;
23259
23266
  }
23260
23267
  /**
23268
+ * 扫描 usingComponents 字段进行解析
23261
23269
  * @deps [this.scanComponentEntry]
23262
23270
  * @param entry
23263
23271
  * @param relDir
@@ -23283,6 +23291,7 @@ var ScanService2 = class {
23283
23291
  }
23284
23292
  resetEntries() {
23285
23293
  this.entriesSet.clear();
23294
+ this.componentEntrySet.clear();
23286
23295
  this.wxmlService.clear();
23287
23296
  this.entries.length = 0;
23288
23297
  this.subPackageService.metaMap = {};
@@ -23399,6 +23408,10 @@ var ScanService2 = class {
23399
23408
  * 同时处理引入组件的情况,自动注入 usingComponents。
23400
23409
  */
23401
23410
  async scanComponentEntry(componentEntry, dirname3, subPackageMeta) {
23411
+ if (this.componentEntrySet.has(componentEntry)) {
23412
+ debug?.(`${componentEntry} \u5DF2\u7ECF\u88AB\u626B\u63CF\u8FC7`);
23413
+ return;
23414
+ }
23402
23415
  const meta = subPackageMeta ?? {
23403
23416
  entriesSet: this.entriesSet,
23404
23417
  entries: this.entries
@@ -23478,6 +23491,7 @@ var ScanService2 = class {
23478
23491
  }
23479
23492
  }
23480
23493
  }
23494
+ this.componentEntrySet.add(componentEntry);
23481
23495
  if ((0, import_shared16.isObject)(config)) {
23482
23496
  await this.usingComponentsHandler(jsonFragment, import_pathe10.default.dirname(baseName), subPackageMeta);
23483
23497
  }
package/dist/cli.mjs CHANGED
@@ -3,13 +3,13 @@ import {
3
3
  createCompilerContext,
4
4
  logger_default,
5
5
  require_Reflect
6
- } from "./chunk-CV4JT2L2.mjs";
7
- import "./chunk-I5QFVJL4.mjs";
6
+ } from "./chunk-PWDBZWAF.mjs";
7
+ import "./chunk-4ZIYVTHH.mjs";
8
8
  import {
9
9
  __name,
10
10
  __toESM,
11
11
  init_esm_shims
12
- } from "./chunk-OCZOGFU3.mjs";
12
+ } from "./chunk-ZRLZHOL5.mjs";
13
13
 
14
14
  // src/cli.ts
15
15
  init_esm_shims();
package/dist/config.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  defineConfig
3
- } from "./chunk-I5QFVJL4.mjs";
4
- import "./chunk-OCZOGFU3.mjs";
3
+ } from "./chunk-4ZIYVTHH.mjs";
4
+ import "./chunk-ZRLZHOL5.mjs";
5
5
  export {
6
6
  defineConfig
7
7
  };
package/dist/index.cjs CHANGED
@@ -34,10 +34,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
34
34
  ));
35
35
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
36
 
37
- // ../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.4_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/cjs_shims.js
37
+ // ../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.4_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js
38
38
  var getImportMetaUrl, importMetaUrl;
39
39
  var init_cjs_shims = __esm({
40
- "../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.4_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/cjs_shims.js"() {
40
+ "../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.4_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js"() {
41
41
  "use strict";
42
42
  getImportMetaUrl = /* @__PURE__ */ __name(() => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href, "getImportMetaUrl");
43
43
  importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
@@ -14044,7 +14044,7 @@ function scanWxml(wxml, options) {
14044
14044
  });
14045
14045
  const ms = wxml.toString();
14046
14046
  const deps = [];
14047
- let currentTagName = "";
14047
+ let currentTagName;
14048
14048
  let importAttrs;
14049
14049
  let attrs = {};
14050
14050
  const components2 = {};
@@ -14056,15 +14056,17 @@ function scanWxml(wxml, options) {
14056
14056
  const wxsImportNormalizeTokens = [];
14057
14057
  const removeWxsLangAttrTokens = [];
14058
14058
  const eventTokens = [];
14059
+ const tagStack = [];
14059
14060
  const parser = new Parser({
14060
14061
  onopentagname(name) {
14062
+ tagStack.push(name);
14061
14063
  currentTagName = name;
14062
14064
  importAttrs = srcImportTagsMap[currentTagName];
14063
14065
  tagStartIndex = parser.startIndex;
14064
14066
  },
14065
14067
  onattribute(name, value, quote) {
14066
14068
  attrs[name] = value;
14067
- if (importAttrs) {
14069
+ if (importAttrs && currentTagName) {
14068
14070
  for (const attrName of importAttrs) {
14069
14071
  if (attrName === name) {
14070
14072
  deps.push({
@@ -14131,6 +14133,7 @@ function scanWxml(wxml, options) {
14131
14133
  }
14132
14134
  },
14133
14135
  onclosetag() {
14136
+ currentTagName = tagStack.pop();
14134
14137
  if (currentTagName && !opts.excludeComponent(currentTagName)) {
14135
14138
  if (Array.isArray(components2[currentTagName])) {
14136
14139
  components2[currentTagName].push({
@@ -14668,6 +14671,8 @@ async function loadConfig(opts) {
14668
14671
  assetsDir: ".",
14669
14672
  commonjsOptions: {
14670
14673
  transformMixedEsModules: true,
14674
+ // include:[/(?:)/]
14675
+ // const regex = /(?:)/; // 单次匹配
14671
14676
  include: void 0
14672
14677
  }
14673
14678
  },
@@ -15328,7 +15333,7 @@ init_cjs_shims();
15328
15333
  var import_shared14 = require("@weapp-core/shared");
15329
15334
  var import_fs_extra6 = __toESM(require("fs-extra"), 1);
15330
15335
 
15331
- // ../../node_modules/.pnpm/local-pkg@0.5.1/node_modules/local-pkg/dist/index.mjs
15336
+ // ../../node_modules/.pnpm/local-pkg@1.0.0/node_modules/local-pkg/dist/index.mjs
15332
15337
  init_cjs_shims();
15333
15338
  var import_node_fs2 = __toESM(require("fs"), 1);
15334
15339
  var import_promises = __toESM(require("fs/promises"), 1);
@@ -22358,8 +22363,7 @@ function resolvePathSync(id, options) {
22358
22363
  }
22359
22364
  __name(resolvePathSync, "resolvePathSync");
22360
22365
 
22361
- // ../../node_modules/.pnpm/local-pkg@0.5.1/node_modules/local-pkg/dist/index.mjs
22362
- var findUpStop = Symbol("findUpStop");
22366
+ // ../../node_modules/.pnpm/local-pkg@1.0.0/node_modules/local-pkg/dist/index.mjs
22363
22367
  function _resolve2(path15, options = {}) {
22364
22368
  if (options.platform === "auto" || !options.platform)
22365
22369
  options.platform = import_node_process4.default.platform === "win32" ? "win32" : "posix";
@@ -22633,6 +22637,8 @@ var ScanService2 = class {
22633
22637
  entries;
22634
22638
  appEntry;
22635
22639
  pagesSet;
22640
+ // 处理循环依赖
22641
+ componentEntrySet;
22636
22642
  constructor(configService, jsonService, subPackageService, autoImportService, wxmlService) {
22637
22643
  this.configService = configService;
22638
22644
  this.jsonService = jsonService;
@@ -22641,6 +22647,7 @@ var ScanService2 = class {
22641
22647
  this.wxmlService = wxmlService;
22642
22648
  this.entries = [];
22643
22649
  this.entriesSet = /* @__PURE__ */ new Set();
22650
+ this.componentEntrySet = /* @__PURE__ */ new Set();
22644
22651
  }
22645
22652
  // https://github.com/vitejs/vite/blob/192d555f88bba7576e8a40cc027e8a11e006079c/packages/vite/src/node/plugins/define.ts#L41
22646
22653
  initPagesSet() {
@@ -22662,6 +22669,7 @@ var ScanService2 = class {
22662
22669
  return set3;
22663
22670
  }
22664
22671
  /**
22672
+ * 扫描 usingComponents 字段进行解析
22665
22673
  * @deps [this.scanComponentEntry]
22666
22674
  * @param entry
22667
22675
  * @param relDir
@@ -22687,6 +22695,7 @@ var ScanService2 = class {
22687
22695
  }
22688
22696
  resetEntries() {
22689
22697
  this.entriesSet.clear();
22698
+ this.componentEntrySet.clear();
22690
22699
  this.wxmlService.clear();
22691
22700
  this.entries.length = 0;
22692
22701
  this.subPackageService.metaMap = {};
@@ -22803,6 +22812,10 @@ var ScanService2 = class {
22803
22812
  * 同时处理引入组件的情况,自动注入 usingComponents。
22804
22813
  */
22805
22814
  async scanComponentEntry(componentEntry, dirname3, subPackageMeta) {
22815
+ if (this.componentEntrySet.has(componentEntry)) {
22816
+ debug?.(`${componentEntry} \u5DF2\u7ECF\u88AB\u626B\u63CF\u8FC7`);
22817
+ return;
22818
+ }
22806
22819
  const meta = subPackageMeta ?? {
22807
22820
  entriesSet: this.entriesSet,
22808
22821
  entries: this.entries
@@ -22882,6 +22895,7 @@ var ScanService2 = class {
22882
22895
  }
22883
22896
  }
22884
22897
  }
22898
+ this.componentEntrySet.add(componentEntry);
22885
22899
  if ((0, import_shared16.isObject)(config)) {
22886
22900
  await this.usingComponentsHandler(jsonFragment, import_pathe10.default.dirname(baseName), subPackageMeta);
22887
22901
  }
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { d as defineConfig } from './config-DYSwq1ku.cjs';
2
- import { L as LoadConfigOptions, C as CompilerContext } from './CompilerContext-D9i0PEsF.cjs';
2
+ import { L as LoadConfigOptions, C as CompilerContext } from './CompilerContext-Dc4zbR7V.cjs';
3
3
  export { UserConfig, UserConfigExport, UserConfigFnObject } from 'vite';
4
4
  import './types-dS68tjL6.cjs';
5
5
  import 'tsup';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { d as defineConfig } from './config-BM_dhf8V.js';
2
- import { L as LoadConfigOptions, C as CompilerContext } from './CompilerContext-BpoRCDyM.js';
2
+ import { L as LoadConfigOptions, C as CompilerContext } from './CompilerContext-DmT_Gh0j.js';
3
3
  export { UserConfig, UserConfigExport, UserConfigFnObject } from 'vite';
4
4
  import './types-dS68tjL6.js';
5
5
  import 'tsup';
package/dist/index.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  createCompilerContext,
3
3
  require_Reflect
4
- } from "./chunk-CV4JT2L2.mjs";
4
+ } from "./chunk-PWDBZWAF.mjs";
5
5
  import {
6
6
  defineConfig
7
- } from "./chunk-I5QFVJL4.mjs";
7
+ } from "./chunk-4ZIYVTHH.mjs";
8
8
  import {
9
9
  __toESM,
10
10
  init_esm_shims
11
- } from "./chunk-OCZOGFU3.mjs";
11
+ } from "./chunk-ZRLZHOL5.mjs";
12
12
 
13
13
  // src/index.ts
14
14
  init_esm_shims();
package/dist/json.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { App, Page, Component, Sitemap, Theme } from '@weapp-core/schematics';
2
2
  export { App, Component, Page, Sitemap, Theme } from '@weapp-core/schematics';
3
- import { C as CompilerContext } from './CompilerContext-D9i0PEsF.cjs';
3
+ import { C as CompilerContext } from './CompilerContext-Dc4zbR7V.cjs';
4
4
  import './types-dS68tjL6.cjs';
5
5
  import './config-DYSwq1ku.cjs';
6
6
  import 'vite';
package/dist/json.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { App, Page, Component, Sitemap, Theme } from '@weapp-core/schematics';
2
2
  export { App, Component, Page, Sitemap, Theme } from '@weapp-core/schematics';
3
- import { C as CompilerContext } from './CompilerContext-BpoRCDyM.js';
3
+ import { C as CompilerContext } from './CompilerContext-DmT_Gh0j.js';
4
4
  import './types-dS68tjL6.js';
5
5
  import './config-BM_dhf8V.js';
6
6
  import 'vite';
package/dist/json.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __name,
3
3
  init_esm_shims
4
- } from "./chunk-OCZOGFU3.mjs";
4
+ } from "./chunk-ZRLZHOL5.mjs";
5
5
 
6
6
  // src/json.ts
7
7
  init_esm_shims();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-vite",
3
3
  "type": "module",
4
- "version": "2.0.1",
4
+ "version": "2.0.2",
5
5
  "description": "weapp-vite 一个现代化的小程序打包工具",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -90,17 +90,17 @@
90
90
  "esbuild": "^0.24.2",
91
91
  "fdir": "^6.4.2",
92
92
  "fs-extra": "^11.2.0",
93
- "pathe": "^1.1.2",
93
+ "pathe": "^2.0.1",
94
94
  "picomatch": "^4.0.2",
95
95
  "postcss": "^8.4.49",
96
96
  "tsup": "^8.3.5",
97
97
  "vite": "^5.4.11",
98
98
  "vite-tsconfig-paths": "^5.1.4",
99
99
  "@weapp-core/init": "^1.1.15",
100
- "@weapp-core/logger": "^1.0.2",
101
100
  "@weapp-core/schematics": "^1.0.7",
101
+ "@weapp-core/logger": "^1.0.2",
102
102
  "@weapp-core/shared": "^1.0.5",
103
- "weapp-ide-cli": "^2.0.8"
103
+ "weapp-ide-cli": "^2.0.9"
104
104
  },
105
105
  "publishConfig": {
106
106
  "access": "public",
@@ -111,7 +111,7 @@
111
111
  "cac": "^6.7.14",
112
112
  "htmlparser2": "^10.0.0",
113
113
  "inversify": "^6.2.1",
114
- "local-pkg": "^0.5.1",
114
+ "local-pkg": "^1.0.0",
115
115
  "magic-string": "^0.30.17",
116
116
  "reflect-metadata": "^0.2.2"
117
117
  },