weapp-vite 5.0.2 → 5.0.4

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
@@ -1,6 +1,6 @@
1
1
  <div align="center">
2
- <a href="https://ice-vite.netlify.app">
3
- <img width="200" height="200" hspace="10" src="https://ice-vite.netlify.app/logo.png" alt="vite logo" />
2
+ <a href="https://vite.icebreaker.top">
3
+ <img width="200" height="200" hspace="10" src="https://vite.icebreaker.top/logo.png" alt="vite logo" />
4
4
  </a>
5
5
  <h1>Weapp Vite</h1>
6
6
  <p>
@@ -14,7 +14,7 @@
14
14
 
15
15
  <p>&nbsp;</p>
16
16
 
17
- ## 使用文档地址: [ice-vite.netlify.app](https://ice-vite.netlify.app)
17
+ ## 使用文档地址: [vite.icebreaker.top](https://vite.icebreaker.top)
18
18
 
19
19
  ## Features
20
20
 
@@ -1,13 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunk5OGRUAWTcjs = require('../chunk-5OGRUAWT.cjs');
4
+ var _chunkE3WQLTW5cjs = require('../chunk-E3WQLTW5.cjs');
5
5
 
6
6
  // src/auto-import-components/resolvers/index.ts
7
- _chunk5OGRUAWTcjs.init_cjs_shims.call(void 0, );
7
+ _chunkE3WQLTW5cjs.init_cjs_shims.call(void 0, );
8
8
 
9
9
  // src/auto-import-components/resolvers/tdesign.ts
10
- _chunk5OGRUAWTcjs.init_cjs_shims.call(void 0, );
10
+ _chunkE3WQLTW5cjs.init_cjs_shims.call(void 0, );
11
11
  var _shared = require('@weapp-core/shared');
12
12
 
13
13
  // src/auto-import-components/resolvers/json/tdesign.json
@@ -92,7 +92,7 @@ var tdesign_default = [
92
92
 
93
93
  // src/auto-import-components/resolvers/tdesign.ts
94
94
  var defaultPrefix = "t-";
95
- var TDesignResolver = /* @__PURE__ */ _chunk5OGRUAWTcjs.__name.call(void 0, (opts) => {
95
+ var TDesignResolver = /* @__PURE__ */ _chunkE3WQLTW5cjs.__name.call(void 0, (opts) => {
96
96
  const { prefix, resolve } = _shared.defu.call(void 0, opts, {
97
97
  prefix: defaultPrefix,
98
98
  resolve({ name, prefix: prefix2 }) {
@@ -123,10 +123,10 @@ var TDesignResolver = /* @__PURE__ */ _chunk5OGRUAWTcjs.__name.call(void 0, (opt
123
123
  }, "TDesignResolver");
124
124
 
125
125
  // src/auto-import-components/resolvers/types.ts
126
- _chunk5OGRUAWTcjs.init_cjs_shims.call(void 0, );
126
+ _chunkE3WQLTW5cjs.init_cjs_shims.call(void 0, );
127
127
 
128
128
  // src/auto-import-components/resolvers/vant.ts
129
- _chunk5OGRUAWTcjs.init_cjs_shims.call(void 0, );
129
+ _chunkE3WQLTW5cjs.init_cjs_shims.call(void 0, );
130
130
 
131
131
 
132
132
  // src/auto-import-components/resolvers/json/vant.json
@@ -204,7 +204,7 @@ var vant_default = [
204
204
 
205
205
  // src/auto-import-components/resolvers/vant.ts
206
206
  var defaultPrefix2 = "van-";
207
- var VantResolver = /* @__PURE__ */ _chunk5OGRUAWTcjs.__name.call(void 0, (opts) => {
207
+ var VantResolver = /* @__PURE__ */ _chunkE3WQLTW5cjs.__name.call(void 0, (opts) => {
208
208
  const { prefix, resolve } = _shared.defu.call(void 0, opts, {
209
209
  prefix: defaultPrefix2,
210
210
  resolve({ name, prefix: prefix2 }) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __name,
3
3
  init_esm_shims
4
- } from "../chunk-XO7RY5WN.mjs";
4
+ } from "../chunk-4OXMVCTX.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-XO7RY5WN.mjs";
4
+ } from "./chunk-4OXMVCTX.mjs";
5
5
 
6
6
  // src/json.ts
7
7
  init_esm_shims();
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __name,
3
3
  init_esm_shims
4
- } from "./chunk-XO7RY5WN.mjs";
4
+ } from "./chunk-4OXMVCTX.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-XO7RY5WN.mjs";
6
+ } from "./chunk-4OXMVCTX.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({
@@ -5764,11 +5764,12 @@ var AutoImportService2 = class {
5764
5764
  logWarnOnce(`\u53D1\u73B0 \`${componentName}\` \u7EC4\u4EF6\u91CD\u540D! \u8DF3\u8FC7\u7EC4\u4EF6 \`${this.configService.relativeCwd(baseName)}\` \u7684\u81EA\u52A8\u5F15\u5165`);
5765
5765
  return;
5766
5766
  }
5767
+ const from = `/${this.configService.relativeSrcRoot(this.configService.relativeCwd(removeExtensionDeep(partialEntry.jsonPath)))}`;
5767
5768
  this.potentialComponentMap.set(componentName, {
5768
5769
  entry: partialEntry,
5769
5770
  value: {
5770
5771
  name: componentName,
5771
- from: `/${this.configService.relativeSrcRoot(this.configService.relativeCwd(removeExtensionDeep(partialEntry.jsonPath)))}`
5772
+ from
5772
5773
  }
5773
5774
  });
5774
5775
  }
@@ -14125,12 +14126,7 @@ var BuildService2 = class {
14125
14126
  let npmBuildTask = Promise.resolve();
14126
14127
  if (!options?.skipNpm) {
14127
14128
  npmBuildTask = this.queue.add(() => {
14128
- return Promise.all([
14129
- this.npmService.build(),
14130
- ...Array.from(this.scanService.subPackageMap.values()).map((x3) => {
14131
- return this.npmService.build(x3.subPackage);
14132
- })
14133
- ]);
14129
+ return this.npmService.build();
14134
14130
  });
14135
14131
  }
14136
14132
  let result;
@@ -24461,10 +24457,10 @@ var NpmService2 = class {
24461
24457
  __name(this, "NpmService");
24462
24458
  }
24463
24459
  configService;
24464
- // 分包的情况也要考虑
24465
- builtDepSetMap = /* @__PURE__ */ new Map();
24466
- constructor(configService) {
24460
+ scanService;
24461
+ constructor(configService, scanService) {
24467
24462
  this.configService = configService;
24463
+ this.scanService = scanService;
24468
24464
  }
24469
24465
  getDependenciesCacheFilePath(key = "/") {
24470
24466
  return path17.resolve(this.configService.cwd, `node_modules/weapp-vite/.cache/${key.replaceAll("/", "-")}.json`);
@@ -24478,24 +24474,24 @@ var NpmService2 = class {
24478
24474
  async shouldSkipBuild(outDir, isOutdated) {
24479
24475
  return !isOutdated && await fs14.exists(outDir);
24480
24476
  }
24481
- writeDependenciesCache(subPackage) {
24482
- if (this.configService.inlineConfig.weapp?.npm?.cache) {
24483
- return fs14.outputJSON(this.getDependenciesCacheFilePath(subPackage?.root), {
24477
+ writeDependenciesCache(root) {
24478
+ if (this.configService.weappViteConfig?.npm?.cache) {
24479
+ return fs14.outputJSON(this.getDependenciesCacheFilePath(root), {
24484
24480
  hash: this.dependenciesCacheHash
24485
24481
  });
24486
24482
  }
24487
24483
  }
24488
- async readDependenciesCache(subPackage) {
24489
- const cachePath = this.getDependenciesCacheFilePath(subPackage?.root);
24484
+ async readDependenciesCache(root) {
24485
+ const cachePath = this.getDependenciesCacheFilePath(root);
24490
24486
  if (await fs14.exists(cachePath)) {
24491
24487
  return await fs14.readJson(cachePath, {
24492
24488
  throws: false
24493
24489
  });
24494
24490
  }
24495
24491
  }
24496
- async checkDependenciesCacheOutdate(subPackage) {
24497
- if (this.configService.inlineConfig.weapp?.npm?.cache) {
24498
- const json = await this.readDependenciesCache(subPackage);
24492
+ async checkDependenciesCacheOutdate(root) {
24493
+ if (this.configService.weappViteConfig?.npm?.cache) {
24494
+ const json = await this.readDependenciesCache(root);
24499
24495
  if (isObject7(json)) {
24500
24496
  return this.dependenciesCacheHash !== json.hash;
24501
24497
  }
@@ -24503,16 +24499,10 @@ var NpmService2 = class {
24503
24499
  }
24504
24500
  return true;
24505
24501
  }
24506
- async bundleBuild({ index, name, options, outDir, subPackage }) {
24507
- const builtSet = this.builtDepSetMap.get(subPackage?.root ?? Symbols.NpmMainPackageBuiltDepToken) ?? /* @__PURE__ */ new Set();
24508
- if (builtSet.has(name)) {
24509
- return;
24510
- }
24511
- const { build: tsupBuild } = await import("tsdown");
24502
+ async bundleBuild({ entry, name, options, outDir }) {
24503
+ const { build: tsdownBuild } = await import("tsdown");
24512
24504
  const mergedOptions = defu4(options, {
24513
- entry: {
24514
- index
24515
- },
24505
+ entry,
24516
24506
  format: [
24517
24507
  "cjs"
24518
24508
  ],
@@ -24527,21 +24517,6 @@ var NpmService2 = class {
24527
24517
  outputOptions: {
24528
24518
  exports: "named"
24529
24519
  },
24530
- // https://github.com/egoist/tsup/blob/769aa49cae16cc1713992970db966d6514878e06/src/rollup/ts-resolve.ts#L3
24531
- // esbuildOptions(options) {
24532
- // options.plugins?.unshift(
24533
- // nodeModulesPolyfillPlugin(
24534
- // {
24535
- // fallback: 'empty',
24536
- // // modules: {
24537
- // // crypto: true,
24538
- // // path: true,
24539
- // // buffer: true,
24540
- // // },
24541
- // },
24542
- // ),
24543
- // )
24544
- // },
24545
24520
  sourcemap: false,
24546
24521
  config: false,
24547
24522
  // https://tsup.egoist.dev/#compile-time-environment-variables
@@ -24553,8 +24528,8 @@ var NpmService2 = class {
24553
24528
  external: []
24554
24529
  });
24555
24530
  const resolvedOptions = this.configService.weappViteConfig?.npm?.buildOptions?.(mergedOptions, {
24556
- entry: index,
24557
- name
24531
+ name,
24532
+ entry
24558
24533
  });
24559
24534
  let finalOptions;
24560
24535
  if (resolvedOptions === void 0) {
@@ -24563,19 +24538,13 @@ var NpmService2 = class {
24563
24538
  finalOptions = resolvedOptions;
24564
24539
  }
24565
24540
  if (finalOptions) {
24566
- await tsupBuild(finalOptions);
24567
- builtSet.add(name);
24541
+ await tsdownBuild(finalOptions);
24568
24542
  }
24569
24543
  }
24570
- async copyBuild({ from, to, name, subPackage }) {
24571
- const builtSet = this.builtDepSetMap.get(subPackage?.root ?? Symbols.NpmMainPackageBuiltDepToken) ?? /* @__PURE__ */ new Set();
24572
- if (builtSet.has(name)) {
24573
- return;
24574
- }
24544
+ async copyBuild({ from, to }) {
24575
24545
  await fs14.copy(from, to);
24576
- builtSet.add(name);
24577
24546
  }
24578
- async buildPackage({ dep, outDir, options, isDependenciesCacheOutdate, heading = "", subPackage }) {
24547
+ async buildPackage({ dep, outDir, options, isDependenciesCacheOutdate }) {
24579
24548
  const packageInfo = await getPackageInfo(dep);
24580
24549
  if (!packageInfo) {
24581
24550
  return;
@@ -24583,17 +24552,16 @@ var NpmService2 = class {
24583
24552
  const { packageJson: targetJson, rootPath } = packageInfo;
24584
24553
  const dependencies = targetJson.dependencies ?? {};
24585
24554
  const keys = Object.keys(dependencies);
24555
+ const destOutDir = path17.resolve(outDir, dep);
24556
+ if (await this.shouldSkipBuild(destOutDir, isDependenciesCacheOutdate)) {
24557
+ logger_default.info(`[npm] \u4F9D\u8D56 \`${dep}\` \u672A\u53D1\u751F\u53D8\u5316\uFF0C\u8DF3\u8FC7\u5904\u7406!`);
24558
+ return;
24559
+ }
24586
24560
  if (this.isMiniprogramPackage(targetJson)) {
24587
- const destOutDir = path17.resolve(outDir, dep);
24588
- if (await this.shouldSkipBuild(destOutDir, isDependenciesCacheOutdate)) {
24589
- logger_default.info(`[npm] ${heading}\u4F9D\u8D56 \`${dep}\` \u672A\u53D1\u751F\u53D8\u5316\uFF0C\u8DF3\u8FC7\u5904\u7406!`);
24590
- return;
24591
- }
24592
24561
  await this.copyBuild({
24593
24562
  from: path17.resolve(rootPath, targetJson.miniprogram),
24594
24563
  to: destOutDir,
24595
- name: dep,
24596
- subPackage
24564
+ name: dep
24597
24565
  });
24598
24566
  if (keys.length > 0) {
24599
24567
  await Promise.all(keys.map((x3) => {
@@ -24602,32 +24570,23 @@ var NpmService2 = class {
24602
24570
  // 这里需要打包到 miniprogram_npm 平级目录
24603
24571
  outDir,
24604
24572
  options,
24605
- isDependenciesCacheOutdate,
24606
- heading,
24607
- subPackage
24573
+ isDependenciesCacheOutdate
24608
24574
  });
24609
24575
  }));
24610
24576
  }
24611
24577
  } else {
24612
- const destOutDir = path17.resolve(outDir, dep);
24613
- if (await this.shouldSkipBuild(destOutDir, isDependenciesCacheOutdate)) {
24614
- logger_default.info(`[npm] ${heading}\u4F9D\u8D56 \`${dep}\` \u672A\u53D1\u751F\u53D8\u5316\uFF0C\u8DF3\u8FC7\u5904\u7406!`);
24615
- return;
24616
- }
24617
24578
  const index = resolveModule(dep);
24618
24579
  if (!index) {
24619
24580
  logger_default.warn(`[npm] \u65E0\u6CD5\u89E3\u6790\u6A21\u5757 \`${dep}\`\uFF0C\u8DF3\u8FC7\u5904\u7406!`);
24620
24581
  return;
24621
24582
  }
24622
24583
  await this.bundleBuild({
24623
- index,
24584
+ entry: {
24585
+ index
24586
+ },
24624
24587
  name: dep,
24625
24588
  options,
24626
- // : defu<TsupOptions, (TsupOptions | undefined)[]>({
24627
- // external: keys,
24628
- // }, options),
24629
- outDir: destOutDir,
24630
- subPackage
24589
+ outDir: destOutDir
24631
24590
  });
24632
24591
  if (keys.length > 0) {
24633
24592
  await Promise.all(keys.filter((x3) => isBuiltin(x3)).map((x3) => {
@@ -24636,14 +24595,12 @@ var NpmService2 = class {
24636
24595
  // 这里需要打包到 miniprogram_npm 平级目录
24637
24596
  outDir,
24638
24597
  options,
24639
- isDependenciesCacheOutdate,
24640
- heading,
24641
- subPackage
24598
+ isDependenciesCacheOutdate
24642
24599
  });
24643
24600
  }));
24644
24601
  }
24645
24602
  }
24646
- logger_default.success(`[npm] ${heading ? `${heading} ` : ""}\`${dep}\` \u4F9D\u8D56\u5904\u7406\u5B8C\u6210!`);
24603
+ logger_default.success(`[npm] \`${dep}\` \u4F9D\u8D56\u5904\u7406\u5B8C\u6210!`);
24647
24604
  }
24648
24605
  getPackNpmRelationList() {
24649
24606
  let packNpmRelationList = [];
@@ -24659,56 +24616,96 @@ var NpmService2 = class {
24659
24616
  }
24660
24617
  return packNpmRelationList;
24661
24618
  }
24662
- async build(subPackage, options) {
24663
- if (!this.configService.inlineConfig.weapp?.npm?.enable) {
24619
+ async build(options) {
24620
+ if (!this.configService.weappViteConfig?.npm?.enable) {
24664
24621
  return;
24665
24622
  }
24666
24623
  debug?.("buildNpm start");
24667
- const isDependenciesCacheOutdate = await this.checkDependenciesCacheOutdate(subPackage);
24668
24624
  const packNpmRelationList = this.getPackNpmRelationList();
24669
- const heading = subPackage?.root ? `\u5206\u5305[${subPackage.root}]` : "";
24670
- if (subPackage && subPackage.root) {
24671
- this.builtDepSetMap.set(subPackage.root, /* @__PURE__ */ new Set());
24672
- } else {
24673
- this.builtDepSetMap.set(Symbols.NpmMainPackageBuiltDepToken, /* @__PURE__ */ new Set());
24674
- }
24675
- for (const relation of packNpmRelationList) {
24676
- const packageJsonPath = path17.resolve(this.configService.cwd, relation.packageJsonPath);
24677
- if (await fs14.exists(packageJsonPath)) {
24678
- const pkgJson = await fs14.readJson(packageJsonPath);
24679
- const outDir = path17.resolve(this.configService.cwd, relation.miniprogramNpmDistDir, subPackage?.root ?? "", "miniprogram_npm");
24680
- if (pkgJson.dependencies) {
24681
- const dependencies = Object.keys(pkgJson.dependencies);
24682
- if (dependencies.length > 0) {
24683
- for (const dep of dependencies) {
24684
- if (Array.isArray(subPackage?.dependencies)) {
24685
- if (!regExpTest(subPackage.dependencies, dep)) {
24686
- continue;
24687
- }
24625
+ const [mainRelation, ...subRelations] = packNpmRelationList;
24626
+ const packageJsonPath = path17.resolve(this.configService.cwd, mainRelation.packageJsonPath);
24627
+ if (await fs14.exists(packageJsonPath)) {
24628
+ const pkgJson = await fs14.readJson(packageJsonPath);
24629
+ const outDir = path17.resolve(this.configService.cwd, mainRelation.miniprogramNpmDistDir, "miniprogram_npm");
24630
+ if (pkgJson.dependencies) {
24631
+ const dependencies = Object.keys(pkgJson.dependencies);
24632
+ if (dependencies.length > 0) {
24633
+ const isDependenciesCacheOutdate = await this.checkDependenciesCacheOutdate();
24634
+ await Promise.all(dependencies.map((dep) => {
24635
+ return this.buildPackage({
24636
+ dep,
24637
+ outDir,
24638
+ options,
24639
+ isDependenciesCacheOutdate
24640
+ });
24641
+ }));
24642
+ await this.writeDependenciesCache();
24643
+ const targetDirs = [
24644
+ ...subRelations.map((x3) => {
24645
+ return {
24646
+ npmDistDir: path17.resolve(this.configService.cwd, x3.miniprogramNpmDistDir, "miniprogram_npm")
24647
+ };
24648
+ }),
24649
+ ...[
24650
+ ...this.scanService.subPackageMap.values()
24651
+ ].map((x3) => {
24652
+ const dependencies2 = x3.subPackage.dependencies;
24653
+ return {
24654
+ root: x3.subPackage.root,
24655
+ dependencies: dependencies2,
24656
+ npmDistDir: path17.resolve(this.configService.cwd, mainRelation.miniprogramNpmDistDir, x3.subPackage.root, "miniprogram_npm")
24657
+ };
24658
+ })
24659
+ ];
24660
+ await Promise.all(targetDirs.map(async (x3) => {
24661
+ if (x3.root) {
24662
+ const isDependenciesCacheOutdate2 = await this.checkDependenciesCacheOutdate(x3.root);
24663
+ if (isDependenciesCacheOutdate2 || !await fs14.exists(x3.npmDistDir)) {
24664
+ await fs14.copy(outDir, x3.npmDistDir, {
24665
+ overwrite: true,
24666
+ filter: /* @__PURE__ */ __name((src) => {
24667
+ if (Array.isArray(x3.dependencies)) {
24668
+ const relPath = path17.relative(outDir, src);
24669
+ if (relPath === "") {
24670
+ return true;
24671
+ }
24672
+ return regExpTest(x3.dependencies, relPath);
24673
+ }
24674
+ return true;
24675
+ }, "filter")
24676
+ });
24688
24677
  }
24689
- await this.buildPackage({
24690
- dep,
24691
- outDir,
24692
- options,
24693
- isDependenciesCacheOutdate,
24694
- heading,
24695
- subPackage
24678
+ await this.writeDependenciesCache(x3.root);
24679
+ } else {
24680
+ await fs14.copy(outDir, x3.npmDistDir, {
24681
+ overwrite: true,
24682
+ filter: /* @__PURE__ */ __name((src) => {
24683
+ if (Array.isArray(x3.dependencies)) {
24684
+ const relPath = path17.relative(outDir, src);
24685
+ if (relPath === "") {
24686
+ return true;
24687
+ }
24688
+ return regExpTest(x3.dependencies, relPath);
24689
+ }
24690
+ return true;
24691
+ }, "filter")
24696
24692
  });
24697
24693
  }
24698
- }
24694
+ }));
24699
24695
  }
24700
24696
  }
24701
24697
  }
24702
- await this.writeDependenciesCache(subPackage);
24703
24698
  debug?.("buildNpm end");
24704
24699
  }
24705
24700
  };
24706
24701
  NpmService2 = _ts_decorate6([
24707
24702
  L(),
24708
24703
  _ts_param5(0, _(Symbols.ConfigService)),
24704
+ _ts_param5(1, _(Symbols.ScanService)),
24709
24705
  _ts_metadata6("design:type", Function),
24710
24706
  _ts_metadata6("design:paramtypes", [
24711
- typeof ConfigService === "undefined" ? Object : ConfigService
24707
+ typeof ConfigService === "undefined" ? Object : ConfigService,
24708
+ typeof ScanService === "undefined" ? Object : ScanService
24712
24709
  ])
24713
24710
  ], NpmService2);
24714
24711
 
@@ -24739,41 +24736,14 @@ var ScanService2 = class {
24739
24736
  }
24740
24737
  configService;
24741
24738
  jsonService;
24742
- autoImportService;
24743
- wxmlService;
24744
24739
  appEntry;
24745
24740
  subPackageMap;
24746
24741
  pluginJson;
24747
- constructor(configService, jsonService, autoImportService, wxmlService) {
24742
+ constructor(configService, jsonService) {
24748
24743
  this.configService = configService;
24749
24744
  this.jsonService = jsonService;
24750
- this.autoImportService = autoImportService;
24751
- this.wxmlService = wxmlService;
24752
24745
  this.subPackageMap = /* @__PURE__ */ new Map();
24753
24746
  }
24754
- // https://github.com/vitejs/vite/blob/192d555f88bba7576e8a40cc027e8a11e006079c/packages/vite/src/node/plugins/define.ts#L41
24755
- initPagesSet() {
24756
- const set3 = /* @__PURE__ */ new Set();
24757
- const pages = this.appEntry?.json?.pages;
24758
- pages?.forEach((x3) => {
24759
- set3.add(x3);
24760
- });
24761
- this.appEntry?.json?.subPackages?.forEach((subPkg) => {
24762
- subPkg.pages?.forEach((page) => {
24763
- set3.add(`${subPkg.root}/${page}`);
24764
- });
24765
- });
24766
- this.appEntry?.json?.subpackages?.forEach((subPkg) => {
24767
- subPkg.pages?.forEach((page) => {
24768
- set3.add(`${subPkg.root}/${page}`);
24769
- });
24770
- });
24771
- return set3;
24772
- }
24773
- resetEntries() {
24774
- this.wxmlService.clearAll();
24775
- this.autoImportService.potentialComponentMap.clear();
24776
- }
24777
24747
  async loadAppEntry() {
24778
24748
  const appDirname = this.configService.absoluteSrcRoot;
24779
24749
  const appBasename = path18.resolve(appDirname, "app");
@@ -24824,10 +24794,11 @@ var ScanService2 = class {
24824
24794
  const metas = [];
24825
24795
  const json = this.appEntry?.json;
24826
24796
  if (json) {
24827
- for (const subPackage of [
24797
+ const independentSubPackages = [
24828
24798
  ...json.subPackages ?? [],
24829
24799
  ...json.subpackages ?? []
24830
- ].filter((x3) => x3.independent)) {
24800
+ ].filter((x3) => x3.independent);
24801
+ for (const subPackage of independentSubPackages) {
24831
24802
  const entries = [];
24832
24803
  entries.push(...(subPackage.pages ?? []).map((x3) => `${subPackage.root}/${x3}`));
24833
24804
  if (subPackage.entry) {
@@ -24837,6 +24808,7 @@ var ScanService2 = class {
24837
24808
  subPackage,
24838
24809
  entries
24839
24810
  };
24811
+ meta.subPackage.dependencies = this.configService.weappViteConfig?.subPackages?.[subPackage.root]?.dependencies;
24840
24812
  metas.push(meta);
24841
24813
  this.subPackageMap.set(subPackage.root, meta);
24842
24814
  }
@@ -24845,13 +24817,6 @@ var ScanService2 = class {
24845
24817
  throw new Error(`\u5728 ${this.configService.absoluteSrcRoot} \u76EE\u5F55\u4E0B\u6CA1\u6709\u627E\u5230 \`app.json\`, \u8BF7\u786E\u4FDD\u4F60\u521D\u59CB\u5316\u4E86\u5C0F\u7A0B\u5E8F\u9879\u76EE\uFF0C\u6216\u8005\u5728 \`vite.config.ts\` \u4E2D\u8BBE\u7F6E\u7684\u6B63\u786E\u7684 \`weapp.srcRoot\` \u914D\u7F6E\u8DEF\u5F84 `);
24846
24818
  }
24847
24819
  }
24848
- // isSubPackagePath(p: string, root: string = '') {
24849
- // const subPackageMeta = this.subPackageMap.get(root)
24850
- // if (subPackageMeta) {
24851
- // return p.startsWith(subPackageMeta.subPackage.root)
24852
- // }
24853
- // return false
24854
- // }
24855
24820
  isMainPackageFileName(fileName) {
24856
24821
  return Array.from(this.subPackageMap.keys()).every((root) => {
24857
24822
  return !fileName.startsWith(root);
@@ -24869,14 +24834,10 @@ ScanService2 = _ts_decorate7([
24869
24834
  L(),
24870
24835
  _ts_param6(0, _(Symbols.ConfigService)),
24871
24836
  _ts_param6(1, _(Symbols.JsonService)),
24872
- _ts_param6(2, _(Symbols.AutoImportService)),
24873
- _ts_param6(3, _(Symbols.WxmlService)),
24874
24837
  _ts_metadata7("design:type", Function),
24875
24838
  _ts_metadata7("design:paramtypes", [
24876
24839
  typeof ConfigService === "undefined" ? Object : ConfigService,
24877
- typeof JsonService === "undefined" ? Object : JsonService,
24878
- typeof AutoImportService === "undefined" ? Object : AutoImportService,
24879
- typeof WxmlService === "undefined" ? Object : WxmlService
24840
+ typeof JsonService === "undefined" ? Object : JsonService
24880
24841
  ])
24881
24842
  ], ScanService2);
24882
24843
 
@@ -28,11 +28,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  mod
29
29
  ));
30
30
 
31
- // ../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.12.0_jiti@2.4.2_postcss@8.5.4_tsx@4.20.1_typescript@5.8.3_yaml@2.8.0/node_modules/tsup/assets/esm_shims.js
31
+ // ../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.12.1_jiti@2.4.2_postcss@8.5.6_tsx@4.20.3_typescript@5.8.3_yaml@2.8.0/node_modules/tsup/assets/esm_shims.js
32
32
  import path from "path";
33
33
  import { fileURLToPath } from "url";
34
34
  var init_esm_shims = __esm({
35
- "../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.12.0_jiti@2.4.2_postcss@8.5.4_tsx@4.20.1_typescript@5.8.3_yaml@2.8.0/node_modules/tsup/assets/esm_shims.js"() {
35
+ "../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.12.1_jiti@2.4.2_postcss@8.5.6_tsx@4.20.3_typescript@5.8.3_yaml@2.8.0/node_modules/tsup/assets/esm_shims.js"() {
36
36
  "use strict";
37
37
  }
38
38
  });
@@ -1,14 +1,14 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunk5OGRUAWTcjs = require('./chunk-5OGRUAWT.cjs');
4
+ var _chunkE3WQLTW5cjs = require('./chunk-E3WQLTW5.cjs');
5
5
 
6
6
  // src/config.ts
7
- _chunk5OGRUAWTcjs.init_cjs_shims.call(void 0, );
7
+ _chunkE3WQLTW5cjs.init_cjs_shims.call(void 0, );
8
8
  function defineConfig(config) {
9
9
  return config;
10
10
  }
11
- _chunk5OGRUAWTcjs.__name.call(void 0, defineConfig, "defineConfig");
11
+ _chunkE3WQLTW5cjs.__name.call(void 0, defineConfig, "defineConfig");
12
12
 
13
13
 
14
14
 
@@ -28,10 +28,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  mod
29
29
  ));
30
30
 
31
- // ../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.12.0_jiti@2.4.2_postcss@8.5.4_tsx@4.20.1_typescript@5.8.3_yaml@2.8.0/node_modules/tsup/assets/cjs_shims.js
31
+ // ../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.12.1_jiti@2.4.2_postcss@8.5.6_tsx@4.20.3_typescript@5.8.3_yaml@2.8.0/node_modules/tsup/assets/cjs_shims.js
32
32
  var getImportMetaUrl, importMetaUrl;
33
33
  var init_cjs_shims = __esm({
34
- "../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.12.0_jiti@2.4.2_postcss@8.5.4_tsx@4.20.1_typescript@5.8.3_yaml@2.8.0/node_modules/tsup/assets/cjs_shims.js"() {
34
+ "../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.12.1_jiti@2.4.2_postcss@8.5.6_tsx@4.20.3_typescript@5.8.3_yaml@2.8.0/node_modules/tsup/assets/cjs_shims.js"() {
35
35
  "use strict";
36
36
  getImportMetaUrl = /* @__PURE__ */ __name(() => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href, "getImportMetaUrl");
37
37
  importMetaUrl = exports.importMetaUrl = /* @__PURE__ */ getImportMetaUrl();