weapp-vite 5.0.3 → 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 +3 -3
- package/dist/auto-import-components/resolvers.cjs +7 -7
- package/dist/auto-import-components/resolvers.mjs +1 -1
- package/dist/{chunk-33SRKM6F.mjs → chunk-33KWENNX.mjs} +1 -1
- package/dist/{chunk-7NY4REZ2.mjs → chunk-362ZXG3M.mjs} +1 -1
- package/dist/{chunk-ECE7XXPM.mjs → chunk-43ODWXZ2.mjs} +112 -152
- package/dist/{chunk-AJ5T4GX6.mjs → chunk-4OXMVCTX.mjs} +2 -2
- package/dist/{chunk-VMNFKPUG.cjs → chunk-BJQFV7H5.cjs} +3 -3
- package/dist/{chunk-5ZC54VFE.cjs → chunk-E3WQLTW5.cjs} +2 -2
- package/dist/{chunk-L53KIQY5.cjs → chunk-L6NYJB7Y.cjs} +1033 -1073
- package/dist/{chunk-C4TP4QXH.cjs → chunk-PLZ3VCMI.cjs} +7 -7
- package/dist/cli.cjs +53 -53
- package/dist/cli.mjs +5 -5
- package/dist/{config-B9mDx5lQ.d.ts → config-B02oLfaG.d.ts} +36 -43
- package/dist/{config-DDWasEBN.d.cts → config-CWaTnaaV.d.cts} +36 -43
- package/dist/config.cjs +4 -4
- package/dist/config.d.cts +4 -4
- package/dist/config.d.ts +4 -4
- package/dist/config.mjs +3 -3
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.mjs +4 -4
- package/dist/json.cjs +3 -3
- package/dist/json.d.cts +4 -4
- package/dist/json.d.ts +4 -4
- package/dist/json.mjs +2 -2
- package/dist/types.cjs +6 -6
- package/dist/types.d.cts +5 -5
- package/dist/types.d.ts +5 -5
- package/dist/types.mjs +1 -1
- package/dist/volar.cjs +2 -2
- package/dist/volar.mjs +1 -1
- package/package.json +11 -10
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<a href="https://
|
|
3
|
-
<img width="200" height="200" hspace="10" src="https://
|
|
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> </p>
|
|
16
16
|
|
|
17
|
-
## 使用文档地址: [
|
|
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
|
|
4
|
+
var _chunkE3WQLTW5cjs = require('../chunk-E3WQLTW5.cjs');
|
|
5
5
|
|
|
6
6
|
// src/auto-import-components/resolvers/index.ts
|
|
7
|
-
|
|
7
|
+
_chunkE3WQLTW5cjs.init_cjs_shims.call(void 0, );
|
|
8
8
|
|
|
9
9
|
// src/auto-import-components/resolvers/tdesign.ts
|
|
10
|
-
|
|
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__ */
|
|
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__ */ _chunk5ZC54VFEcjs.__name.call(void 0, (opt
|
|
|
123
123
|
}, "TDesignResolver");
|
|
124
124
|
|
|
125
125
|
// src/auto-import-components/resolvers/types.ts
|
|
126
|
-
|
|
126
|
+
_chunkE3WQLTW5cjs.init_cjs_shims.call(void 0, );
|
|
127
127
|
|
|
128
128
|
// src/auto-import-components/resolvers/vant.ts
|
|
129
|
-
|
|
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__ */
|
|
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 }) {
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
__name,
|
|
4
4
|
__toESM,
|
|
5
5
|
init_esm_shims
|
|
6
|
-
} from "./chunk-
|
|
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({
|
|
@@ -14126,12 +14126,7 @@ var BuildService2 = class {
|
|
|
14126
14126
|
let npmBuildTask = Promise.resolve();
|
|
14127
14127
|
if (!options?.skipNpm) {
|
|
14128
14128
|
npmBuildTask = this.queue.add(() => {
|
|
14129
|
-
return
|
|
14130
|
-
this.npmService.build(),
|
|
14131
|
-
...Array.from(this.scanService.subPackageMap.values()).map((x3) => {
|
|
14132
|
-
return this.npmService.build(x3.subPackage);
|
|
14133
|
-
})
|
|
14134
|
-
]);
|
|
14129
|
+
return this.npmService.build();
|
|
14135
14130
|
});
|
|
14136
14131
|
}
|
|
14137
14132
|
let result;
|
|
@@ -24462,10 +24457,10 @@ var NpmService2 = class {
|
|
|
24462
24457
|
__name(this, "NpmService");
|
|
24463
24458
|
}
|
|
24464
24459
|
configService;
|
|
24465
|
-
|
|
24466
|
-
|
|
24467
|
-
constructor(configService) {
|
|
24460
|
+
scanService;
|
|
24461
|
+
constructor(configService, scanService) {
|
|
24468
24462
|
this.configService = configService;
|
|
24463
|
+
this.scanService = scanService;
|
|
24469
24464
|
}
|
|
24470
24465
|
getDependenciesCacheFilePath(key = "/") {
|
|
24471
24466
|
return path17.resolve(this.configService.cwd, `node_modules/weapp-vite/.cache/${key.replaceAll("/", "-")}.json`);
|
|
@@ -24479,24 +24474,24 @@ var NpmService2 = class {
|
|
|
24479
24474
|
async shouldSkipBuild(outDir, isOutdated) {
|
|
24480
24475
|
return !isOutdated && await fs14.exists(outDir);
|
|
24481
24476
|
}
|
|
24482
|
-
writeDependenciesCache(
|
|
24483
|
-
if (this.configService.
|
|
24484
|
-
return fs14.outputJSON(this.getDependenciesCacheFilePath(
|
|
24477
|
+
writeDependenciesCache(root) {
|
|
24478
|
+
if (this.configService.weappViteConfig?.npm?.cache) {
|
|
24479
|
+
return fs14.outputJSON(this.getDependenciesCacheFilePath(root), {
|
|
24485
24480
|
hash: this.dependenciesCacheHash
|
|
24486
24481
|
});
|
|
24487
24482
|
}
|
|
24488
24483
|
}
|
|
24489
|
-
async readDependenciesCache(
|
|
24490
|
-
const cachePath = this.getDependenciesCacheFilePath(
|
|
24484
|
+
async readDependenciesCache(root) {
|
|
24485
|
+
const cachePath = this.getDependenciesCacheFilePath(root);
|
|
24491
24486
|
if (await fs14.exists(cachePath)) {
|
|
24492
24487
|
return await fs14.readJson(cachePath, {
|
|
24493
24488
|
throws: false
|
|
24494
24489
|
});
|
|
24495
24490
|
}
|
|
24496
24491
|
}
|
|
24497
|
-
async checkDependenciesCacheOutdate(
|
|
24498
|
-
if (this.configService.
|
|
24499
|
-
const json = await this.readDependenciesCache(
|
|
24492
|
+
async checkDependenciesCacheOutdate(root) {
|
|
24493
|
+
if (this.configService.weappViteConfig?.npm?.cache) {
|
|
24494
|
+
const json = await this.readDependenciesCache(root);
|
|
24500
24495
|
if (isObject7(json)) {
|
|
24501
24496
|
return this.dependenciesCacheHash !== json.hash;
|
|
24502
24497
|
}
|
|
@@ -24504,16 +24499,10 @@ var NpmService2 = class {
|
|
|
24504
24499
|
}
|
|
24505
24500
|
return true;
|
|
24506
24501
|
}
|
|
24507
|
-
async bundleBuild({
|
|
24508
|
-
const
|
|
24509
|
-
if (builtSet.has(name)) {
|
|
24510
|
-
return;
|
|
24511
|
-
}
|
|
24512
|
-
const { build: tsupBuild } = await import("tsdown");
|
|
24502
|
+
async bundleBuild({ entry, name, options, outDir }) {
|
|
24503
|
+
const { build: tsdownBuild } = await import("tsdown");
|
|
24513
24504
|
const mergedOptions = defu4(options, {
|
|
24514
|
-
entry
|
|
24515
|
-
index
|
|
24516
|
-
},
|
|
24505
|
+
entry,
|
|
24517
24506
|
format: [
|
|
24518
24507
|
"cjs"
|
|
24519
24508
|
],
|
|
@@ -24528,21 +24517,6 @@ var NpmService2 = class {
|
|
|
24528
24517
|
outputOptions: {
|
|
24529
24518
|
exports: "named"
|
|
24530
24519
|
},
|
|
24531
|
-
// https://github.com/egoist/tsup/blob/769aa49cae16cc1713992970db966d6514878e06/src/rollup/ts-resolve.ts#L3
|
|
24532
|
-
// esbuildOptions(options) {
|
|
24533
|
-
// options.plugins?.unshift(
|
|
24534
|
-
// nodeModulesPolyfillPlugin(
|
|
24535
|
-
// {
|
|
24536
|
-
// fallback: 'empty',
|
|
24537
|
-
// // modules: {
|
|
24538
|
-
// // crypto: true,
|
|
24539
|
-
// // path: true,
|
|
24540
|
-
// // buffer: true,
|
|
24541
|
-
// // },
|
|
24542
|
-
// },
|
|
24543
|
-
// ),
|
|
24544
|
-
// )
|
|
24545
|
-
// },
|
|
24546
24520
|
sourcemap: false,
|
|
24547
24521
|
config: false,
|
|
24548
24522
|
// https://tsup.egoist.dev/#compile-time-environment-variables
|
|
@@ -24554,8 +24528,8 @@ var NpmService2 = class {
|
|
|
24554
24528
|
external: []
|
|
24555
24529
|
});
|
|
24556
24530
|
const resolvedOptions = this.configService.weappViteConfig?.npm?.buildOptions?.(mergedOptions, {
|
|
24557
|
-
|
|
24558
|
-
|
|
24531
|
+
name,
|
|
24532
|
+
entry
|
|
24559
24533
|
});
|
|
24560
24534
|
let finalOptions;
|
|
24561
24535
|
if (resolvedOptions === void 0) {
|
|
@@ -24564,19 +24538,13 @@ var NpmService2 = class {
|
|
|
24564
24538
|
finalOptions = resolvedOptions;
|
|
24565
24539
|
}
|
|
24566
24540
|
if (finalOptions) {
|
|
24567
|
-
await
|
|
24568
|
-
builtSet.add(name);
|
|
24541
|
+
await tsdownBuild(finalOptions);
|
|
24569
24542
|
}
|
|
24570
24543
|
}
|
|
24571
|
-
async copyBuild({ from, to
|
|
24572
|
-
const builtSet = this.builtDepSetMap.get(subPackage?.root ?? Symbols.NpmMainPackageBuiltDepToken) ?? /* @__PURE__ */ new Set();
|
|
24573
|
-
if (builtSet.has(name)) {
|
|
24574
|
-
return;
|
|
24575
|
-
}
|
|
24544
|
+
async copyBuild({ from, to }) {
|
|
24576
24545
|
await fs14.copy(from, to);
|
|
24577
|
-
builtSet.add(name);
|
|
24578
24546
|
}
|
|
24579
|
-
async buildPackage({ dep, outDir, options, isDependenciesCacheOutdate
|
|
24547
|
+
async buildPackage({ dep, outDir, options, isDependenciesCacheOutdate }) {
|
|
24580
24548
|
const packageInfo = await getPackageInfo(dep);
|
|
24581
24549
|
if (!packageInfo) {
|
|
24582
24550
|
return;
|
|
@@ -24584,17 +24552,16 @@ var NpmService2 = class {
|
|
|
24584
24552
|
const { packageJson: targetJson, rootPath } = packageInfo;
|
|
24585
24553
|
const dependencies = targetJson.dependencies ?? {};
|
|
24586
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
|
+
}
|
|
24587
24560
|
if (this.isMiniprogramPackage(targetJson)) {
|
|
24588
|
-
const destOutDir = path17.resolve(outDir, dep);
|
|
24589
|
-
if (await this.shouldSkipBuild(destOutDir, isDependenciesCacheOutdate)) {
|
|
24590
|
-
logger_default.info(`[npm] ${heading}\u4F9D\u8D56 \`${dep}\` \u672A\u53D1\u751F\u53D8\u5316\uFF0C\u8DF3\u8FC7\u5904\u7406!`);
|
|
24591
|
-
return;
|
|
24592
|
-
}
|
|
24593
24561
|
await this.copyBuild({
|
|
24594
24562
|
from: path17.resolve(rootPath, targetJson.miniprogram),
|
|
24595
24563
|
to: destOutDir,
|
|
24596
|
-
name: dep
|
|
24597
|
-
subPackage
|
|
24564
|
+
name: dep
|
|
24598
24565
|
});
|
|
24599
24566
|
if (keys.length > 0) {
|
|
24600
24567
|
await Promise.all(keys.map((x3) => {
|
|
@@ -24603,32 +24570,23 @@ var NpmService2 = class {
|
|
|
24603
24570
|
// 这里需要打包到 miniprogram_npm 平级目录
|
|
24604
24571
|
outDir,
|
|
24605
24572
|
options,
|
|
24606
|
-
isDependenciesCacheOutdate
|
|
24607
|
-
heading,
|
|
24608
|
-
subPackage
|
|
24573
|
+
isDependenciesCacheOutdate
|
|
24609
24574
|
});
|
|
24610
24575
|
}));
|
|
24611
24576
|
}
|
|
24612
24577
|
} else {
|
|
24613
|
-
const destOutDir = path17.resolve(outDir, dep);
|
|
24614
|
-
if (await this.shouldSkipBuild(destOutDir, isDependenciesCacheOutdate)) {
|
|
24615
|
-
logger_default.info(`[npm] ${heading}\u4F9D\u8D56 \`${dep}\` \u672A\u53D1\u751F\u53D8\u5316\uFF0C\u8DF3\u8FC7\u5904\u7406!`);
|
|
24616
|
-
return;
|
|
24617
|
-
}
|
|
24618
24578
|
const index = resolveModule(dep);
|
|
24619
24579
|
if (!index) {
|
|
24620
24580
|
logger_default.warn(`[npm] \u65E0\u6CD5\u89E3\u6790\u6A21\u5757 \`${dep}\`\uFF0C\u8DF3\u8FC7\u5904\u7406!`);
|
|
24621
24581
|
return;
|
|
24622
24582
|
}
|
|
24623
24583
|
await this.bundleBuild({
|
|
24624
|
-
|
|
24584
|
+
entry: {
|
|
24585
|
+
index
|
|
24586
|
+
},
|
|
24625
24587
|
name: dep,
|
|
24626
24588
|
options,
|
|
24627
|
-
|
|
24628
|
-
// external: keys,
|
|
24629
|
-
// }, options),
|
|
24630
|
-
outDir: destOutDir,
|
|
24631
|
-
subPackage
|
|
24589
|
+
outDir: destOutDir
|
|
24632
24590
|
});
|
|
24633
24591
|
if (keys.length > 0) {
|
|
24634
24592
|
await Promise.all(keys.filter((x3) => isBuiltin(x3)).map((x3) => {
|
|
@@ -24637,14 +24595,12 @@ var NpmService2 = class {
|
|
|
24637
24595
|
// 这里需要打包到 miniprogram_npm 平级目录
|
|
24638
24596
|
outDir,
|
|
24639
24597
|
options,
|
|
24640
|
-
isDependenciesCacheOutdate
|
|
24641
|
-
heading,
|
|
24642
|
-
subPackage
|
|
24598
|
+
isDependenciesCacheOutdate
|
|
24643
24599
|
});
|
|
24644
24600
|
}));
|
|
24645
24601
|
}
|
|
24646
24602
|
}
|
|
24647
|
-
logger_default.success(`[npm]
|
|
24603
|
+
logger_default.success(`[npm] \`${dep}\` \u4F9D\u8D56\u5904\u7406\u5B8C\u6210!`);
|
|
24648
24604
|
}
|
|
24649
24605
|
getPackNpmRelationList() {
|
|
24650
24606
|
let packNpmRelationList = [];
|
|
@@ -24660,56 +24616,96 @@ var NpmService2 = class {
|
|
|
24660
24616
|
}
|
|
24661
24617
|
return packNpmRelationList;
|
|
24662
24618
|
}
|
|
24663
|
-
async build(
|
|
24664
|
-
if (!this.configService.
|
|
24619
|
+
async build(options) {
|
|
24620
|
+
if (!this.configService.weappViteConfig?.npm?.enable) {
|
|
24665
24621
|
return;
|
|
24666
24622
|
}
|
|
24667
24623
|
debug?.("buildNpm start");
|
|
24668
|
-
const isDependenciesCacheOutdate = await this.checkDependenciesCacheOutdate(subPackage);
|
|
24669
24624
|
const packNpmRelationList = this.getPackNpmRelationList();
|
|
24670
|
-
const
|
|
24671
|
-
|
|
24672
|
-
|
|
24673
|
-
|
|
24674
|
-
this.
|
|
24675
|
-
|
|
24676
|
-
|
|
24677
|
-
|
|
24678
|
-
|
|
24679
|
-
|
|
24680
|
-
|
|
24681
|
-
|
|
24682
|
-
|
|
24683
|
-
|
|
24684
|
-
|
|
24685
|
-
|
|
24686
|
-
|
|
24687
|
-
|
|
24688
|
-
|
|
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
|
+
});
|
|
24689
24677
|
}
|
|
24690
|
-
await this.
|
|
24691
|
-
|
|
24692
|
-
|
|
24693
|
-
|
|
24694
|
-
|
|
24695
|
-
|
|
24696
|
-
|
|
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")
|
|
24697
24692
|
});
|
|
24698
24693
|
}
|
|
24699
|
-
}
|
|
24694
|
+
}));
|
|
24700
24695
|
}
|
|
24701
24696
|
}
|
|
24702
24697
|
}
|
|
24703
|
-
await this.writeDependenciesCache(subPackage);
|
|
24704
24698
|
debug?.("buildNpm end");
|
|
24705
24699
|
}
|
|
24706
24700
|
};
|
|
24707
24701
|
NpmService2 = _ts_decorate6([
|
|
24708
24702
|
L(),
|
|
24709
24703
|
_ts_param5(0, _(Symbols.ConfigService)),
|
|
24704
|
+
_ts_param5(1, _(Symbols.ScanService)),
|
|
24710
24705
|
_ts_metadata6("design:type", Function),
|
|
24711
24706
|
_ts_metadata6("design:paramtypes", [
|
|
24712
|
-
typeof ConfigService === "undefined" ? Object : ConfigService
|
|
24707
|
+
typeof ConfigService === "undefined" ? Object : ConfigService,
|
|
24708
|
+
typeof ScanService === "undefined" ? Object : ScanService
|
|
24713
24709
|
])
|
|
24714
24710
|
], NpmService2);
|
|
24715
24711
|
|
|
@@ -24740,41 +24736,14 @@ var ScanService2 = class {
|
|
|
24740
24736
|
}
|
|
24741
24737
|
configService;
|
|
24742
24738
|
jsonService;
|
|
24743
|
-
autoImportService;
|
|
24744
|
-
wxmlService;
|
|
24745
24739
|
appEntry;
|
|
24746
24740
|
subPackageMap;
|
|
24747
24741
|
pluginJson;
|
|
24748
|
-
constructor(configService, jsonService
|
|
24742
|
+
constructor(configService, jsonService) {
|
|
24749
24743
|
this.configService = configService;
|
|
24750
24744
|
this.jsonService = jsonService;
|
|
24751
|
-
this.autoImportService = autoImportService;
|
|
24752
|
-
this.wxmlService = wxmlService;
|
|
24753
24745
|
this.subPackageMap = /* @__PURE__ */ new Map();
|
|
24754
24746
|
}
|
|
24755
|
-
// https://github.com/vitejs/vite/blob/192d555f88bba7576e8a40cc027e8a11e006079c/packages/vite/src/node/plugins/define.ts#L41
|
|
24756
|
-
initPagesSet() {
|
|
24757
|
-
const set3 = /* @__PURE__ */ new Set();
|
|
24758
|
-
const pages = this.appEntry?.json?.pages;
|
|
24759
|
-
pages?.forEach((x3) => {
|
|
24760
|
-
set3.add(x3);
|
|
24761
|
-
});
|
|
24762
|
-
this.appEntry?.json?.subPackages?.forEach((subPkg) => {
|
|
24763
|
-
subPkg.pages?.forEach((page) => {
|
|
24764
|
-
set3.add(`${subPkg.root}/${page}`);
|
|
24765
|
-
});
|
|
24766
|
-
});
|
|
24767
|
-
this.appEntry?.json?.subpackages?.forEach((subPkg) => {
|
|
24768
|
-
subPkg.pages?.forEach((page) => {
|
|
24769
|
-
set3.add(`${subPkg.root}/${page}`);
|
|
24770
|
-
});
|
|
24771
|
-
});
|
|
24772
|
-
return set3;
|
|
24773
|
-
}
|
|
24774
|
-
resetEntries() {
|
|
24775
|
-
this.wxmlService.clearAll();
|
|
24776
|
-
this.autoImportService.potentialComponentMap.clear();
|
|
24777
|
-
}
|
|
24778
24747
|
async loadAppEntry() {
|
|
24779
24748
|
const appDirname = this.configService.absoluteSrcRoot;
|
|
24780
24749
|
const appBasename = path18.resolve(appDirname, "app");
|
|
@@ -24825,10 +24794,11 @@ var ScanService2 = class {
|
|
|
24825
24794
|
const metas = [];
|
|
24826
24795
|
const json = this.appEntry?.json;
|
|
24827
24796
|
if (json) {
|
|
24828
|
-
|
|
24797
|
+
const independentSubPackages = [
|
|
24829
24798
|
...json.subPackages ?? [],
|
|
24830
24799
|
...json.subpackages ?? []
|
|
24831
|
-
].filter((x3) => x3.independent)
|
|
24800
|
+
].filter((x3) => x3.independent);
|
|
24801
|
+
for (const subPackage of independentSubPackages) {
|
|
24832
24802
|
const entries = [];
|
|
24833
24803
|
entries.push(...(subPackage.pages ?? []).map((x3) => `${subPackage.root}/${x3}`));
|
|
24834
24804
|
if (subPackage.entry) {
|
|
@@ -24838,6 +24808,7 @@ var ScanService2 = class {
|
|
|
24838
24808
|
subPackage,
|
|
24839
24809
|
entries
|
|
24840
24810
|
};
|
|
24811
|
+
meta.subPackage.dependencies = this.configService.weappViteConfig?.subPackages?.[subPackage.root]?.dependencies;
|
|
24841
24812
|
metas.push(meta);
|
|
24842
24813
|
this.subPackageMap.set(subPackage.root, meta);
|
|
24843
24814
|
}
|
|
@@ -24846,13 +24817,6 @@ var ScanService2 = class {
|
|
|
24846
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 `);
|
|
24847
24818
|
}
|
|
24848
24819
|
}
|
|
24849
|
-
// isSubPackagePath(p: string, root: string = '') {
|
|
24850
|
-
// const subPackageMeta = this.subPackageMap.get(root)
|
|
24851
|
-
// if (subPackageMeta) {
|
|
24852
|
-
// return p.startsWith(subPackageMeta.subPackage.root)
|
|
24853
|
-
// }
|
|
24854
|
-
// return false
|
|
24855
|
-
// }
|
|
24856
24820
|
isMainPackageFileName(fileName) {
|
|
24857
24821
|
return Array.from(this.subPackageMap.keys()).every((root) => {
|
|
24858
24822
|
return !fileName.startsWith(root);
|
|
@@ -24870,14 +24834,10 @@ ScanService2 = _ts_decorate7([
|
|
|
24870
24834
|
L(),
|
|
24871
24835
|
_ts_param6(0, _(Symbols.ConfigService)),
|
|
24872
24836
|
_ts_param6(1, _(Symbols.JsonService)),
|
|
24873
|
-
_ts_param6(2, _(Symbols.AutoImportService)),
|
|
24874
|
-
_ts_param6(3, _(Symbols.WxmlService)),
|
|
24875
24837
|
_ts_metadata7("design:type", Function),
|
|
24876
24838
|
_ts_metadata7("design:paramtypes", [
|
|
24877
24839
|
typeof ConfigService === "undefined" ? Object : ConfigService,
|
|
24878
|
-
typeof JsonService === "undefined" ? Object : JsonService
|
|
24879
|
-
typeof AutoImportService === "undefined" ? Object : AutoImportService,
|
|
24880
|
-
typeof WxmlService === "undefined" ? Object : WxmlService
|
|
24840
|
+
typeof JsonService === "undefined" ? Object : JsonService
|
|
24881
24841
|
])
|
|
24882
24842
|
], ScanService2);
|
|
24883
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.1_jiti@2.4.2_postcss@8.5.
|
|
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.1_jiti@2.4.2_postcss@8.5.
|
|
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
|
|
4
|
+
var _chunkE3WQLTW5cjs = require('./chunk-E3WQLTW5.cjs');
|
|
5
5
|
|
|
6
6
|
// src/config.ts
|
|
7
|
-
|
|
7
|
+
_chunkE3WQLTW5cjs.init_cjs_shims.call(void 0, );
|
|
8
8
|
function defineConfig(config) {
|
|
9
9
|
return config;
|
|
10
10
|
}
|
|
11
|
-
|
|
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.1_jiti@2.4.2_postcss@8.5.
|
|
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.1_jiti@2.4.2_postcss@8.5.
|
|
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();
|