weapp-vite 2.0.2 → 2.1.0
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/dist/{CompilerContext-DmT_Gh0j.d.ts → CompilerContext-BjnJU9GL.d.ts} +13 -2
- package/dist/{CompilerContext-Dc4zbR7V.d.cts → CompilerContext-DWFbNP11.d.cts} +13 -2
- package/dist/auto-import-components/resolvers.mjs +1 -1
- package/dist/{chunk-PWDBZWAF.mjs → chunk-6X6X4NDH.mjs} +145 -68
- package/dist/{chunk-ZRLZHOL5.mjs → chunk-PEN3BLSY.mjs} +2 -2
- package/dist/{chunk-4ZIYVTHH.mjs → chunk-RSPHXR3C.mjs} +1 -1
- package/dist/cli.cjs +146 -69
- package/dist/cli.mjs +3 -3
- package/dist/{config-DYSwq1ku.d.cts → config-Cvwqemwg.d.cts} +1 -1
- package/dist/{config-BM_dhf8V.d.ts → config-EPV0G671.d.ts} +1 -1
- package/dist/config.d.cts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.mjs +2 -2
- package/dist/index.cjs +146 -69
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.mjs +3 -3
- package/dist/json.d.cts +3 -2
- package/dist/json.d.ts +3 -2
- package/dist/json.mjs +1 -1
- package/package.json +6 -5
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.
|
|
37
|
+
// ../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.7_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.
|
|
40
|
+
"../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.7_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();
|
|
@@ -3639,8 +3639,8 @@ var AutoImportService2 = class {
|
|
|
3639
3639
|
}
|
|
3640
3640
|
}
|
|
3641
3641
|
filter(id, _meta) {
|
|
3642
|
-
if (this.configService.
|
|
3643
|
-
const isMatch = (0, import_picomatch.default)(this.configService.
|
|
3642
|
+
if (this.configService.weappViteConfig?.enhance?.autoImportComponents?.globs) {
|
|
3643
|
+
const isMatch = (0, import_picomatch.default)(this.configService.weappViteConfig.enhance.autoImportComponents.globs, {
|
|
3644
3644
|
cwd: this.configService.cwd,
|
|
3645
3645
|
windows: true,
|
|
3646
3646
|
posixSlashes: true
|
|
@@ -14244,7 +14244,7 @@ var debouncedLoggerSuccess = (0, import_debounce.default)((message) => {
|
|
|
14244
14244
|
return logger_default.success(message);
|
|
14245
14245
|
}, 25);
|
|
14246
14246
|
function vitePluginWeapp(ctx, subPackageMeta) {
|
|
14247
|
-
const { configService, subPackageService, autoImportService, scanService, wxmlService } = ctx;
|
|
14247
|
+
const { configService, subPackageService, autoImportService, scanService, wxmlService, jsonService } = ctx;
|
|
14248
14248
|
let configResolved;
|
|
14249
14249
|
function getInputOption(entries2) {
|
|
14250
14250
|
return entries2.reduce((acc, cur) => {
|
|
@@ -14257,6 +14257,7 @@ function vitePluginWeapp(ctx, subPackageMeta) {
|
|
|
14257
14257
|
let entries;
|
|
14258
14258
|
const cachedEmittedFiles = [];
|
|
14259
14259
|
const cachedWatchFiles = [];
|
|
14260
|
+
const cachedWorkerFiles = [];
|
|
14260
14261
|
async function handleWxsDeps(deps, absPath) {
|
|
14261
14262
|
for (const wxsDep of deps.filter((x4) => x4.tagName === "wxs")) {
|
|
14262
14263
|
if (jsExtensions.includes(wxsDep.attrs.lang) || /\.wxs\.[jt]s$/.test(wxsDep.value)) {
|
|
@@ -14319,8 +14320,12 @@ function vitePluginWeapp(ctx, subPackageMeta) {
|
|
|
14319
14320
|
}
|
|
14320
14321
|
},
|
|
14321
14322
|
async options(options) {
|
|
14323
|
+
if (!subPackageMeta) {
|
|
14324
|
+
await scanService.loadAppEntry();
|
|
14325
|
+
}
|
|
14322
14326
|
cachedEmittedFiles.length = 0;
|
|
14323
14327
|
cachedWatchFiles.length = 0;
|
|
14328
|
+
cachedWorkerFiles.length = 0;
|
|
14324
14329
|
scanService.resetAutoImport();
|
|
14325
14330
|
const { build: build4, weapp } = configResolved;
|
|
14326
14331
|
const ignore = [
|
|
@@ -14338,6 +14343,9 @@ function vitePluginWeapp(ctx, subPackageMeta) {
|
|
|
14338
14343
|
"**/*.{wxml,html,wxs}",
|
|
14339
14344
|
"**/*.{png,jpg,jpeg,gif,svg,webp}"
|
|
14340
14345
|
];
|
|
14346
|
+
if (scanService.workersDir) {
|
|
14347
|
+
assetGlobs.push(import_pathe6.default.join(scanService.workersDir, "**/*.{js,ts}"));
|
|
14348
|
+
}
|
|
14341
14349
|
assetGlobs.push(...resolveGlobs(weapp?.copy?.include));
|
|
14342
14350
|
const patterns = assetGlobs.map((x4) => {
|
|
14343
14351
|
return import_pathe6.default.join(targetDir, x4);
|
|
@@ -14355,6 +14363,7 @@ function vitePluginWeapp(ctx, subPackageMeta) {
|
|
|
14355
14363
|
const absPath = import_pathe6.default.resolve(configService.cwd, relPath);
|
|
14356
14364
|
cachedWatchFiles.push(absPath);
|
|
14357
14365
|
const isWxs = relPath.endsWith(".wxs");
|
|
14366
|
+
const isWorker = isJsOrTs(relPath) && scanService.workersDir && relPath.startsWith(scanService.workersDir);
|
|
14358
14367
|
const fileName = configService.relativeSrcRoot(relPath);
|
|
14359
14368
|
if (isTemplateRequest(relPath)) {
|
|
14360
14369
|
if (weapp?.enhance?.autoImportComponents && autoImportService.filter(relPath, subPackageMeta)) {
|
|
@@ -14371,6 +14380,12 @@ function vitePluginWeapp(ctx, subPackageMeta) {
|
|
|
14371
14380
|
absPath,
|
|
14372
14381
|
fileName
|
|
14373
14382
|
});
|
|
14383
|
+
} else if (isWorker) {
|
|
14384
|
+
cachedWorkerFiles.push({
|
|
14385
|
+
relPath,
|
|
14386
|
+
absPath,
|
|
14387
|
+
fileName
|
|
14388
|
+
});
|
|
14374
14389
|
} else {
|
|
14375
14390
|
mediaFiles.push({
|
|
14376
14391
|
relPath,
|
|
@@ -14409,7 +14424,7 @@ function vitePluginWeapp(ctx, subPackageMeta) {
|
|
|
14409
14424
|
return !wxmlService.tokenMap.has(x4.absPath);
|
|
14410
14425
|
});
|
|
14411
14426
|
const additionalWxmlFiles = excludedWxmlFiles.filter((x4) => {
|
|
14412
|
-
return configService.
|
|
14427
|
+
return configService.weappViteConfig?.isAdditionalWxml?.(x4.absPath);
|
|
14413
14428
|
});
|
|
14414
14429
|
debug2?.(`additionalWxmlFiles:`, additionalWxmlFiles);
|
|
14415
14430
|
await Promise.all([
|
|
@@ -14471,7 +14486,7 @@ function vitePluginWeapp(ctx, subPackageMeta) {
|
|
|
14471
14486
|
this.emitFile({
|
|
14472
14487
|
type: "asset",
|
|
14473
14488
|
fileName,
|
|
14474
|
-
source:
|
|
14489
|
+
source: jsonService.resolve(entry)
|
|
14475
14490
|
});
|
|
14476
14491
|
}
|
|
14477
14492
|
}
|
|
@@ -14485,10 +14500,10 @@ function vitePluginWeapp(ctx, subPackageMeta) {
|
|
|
14485
14500
|
this.emitFile({
|
|
14486
14501
|
type: "asset",
|
|
14487
14502
|
fileName,
|
|
14488
|
-
source:
|
|
14503
|
+
source: jsonService.resolve({
|
|
14489
14504
|
json: appEntry.sitemapJson,
|
|
14490
14505
|
jsonPath: appEntry.sitemapJsonPath
|
|
14491
|
-
}
|
|
14506
|
+
})
|
|
14492
14507
|
});
|
|
14493
14508
|
}
|
|
14494
14509
|
}
|
|
@@ -14499,16 +14514,30 @@ function vitePluginWeapp(ctx, subPackageMeta) {
|
|
|
14499
14514
|
this.emitFile({
|
|
14500
14515
|
type: "asset",
|
|
14501
14516
|
fileName,
|
|
14502
|
-
source:
|
|
14517
|
+
source: jsonService.resolve({
|
|
14503
14518
|
json: appEntry.themeJson,
|
|
14504
14519
|
jsonPath: appEntry.themeJsonPath
|
|
14505
|
-
}
|
|
14520
|
+
})
|
|
14506
14521
|
});
|
|
14507
14522
|
}
|
|
14508
14523
|
}
|
|
14509
14524
|
}
|
|
14510
14525
|
}
|
|
14511
14526
|
}
|
|
14527
|
+
if (scanService.workersDir && cachedWorkerFiles.length) {
|
|
14528
|
+
const workerFiles = scanService.workersBuild(cachedWorkerFiles.map((x4) => x4.absPath));
|
|
14529
|
+
if (workerFiles) {
|
|
14530
|
+
for (let i2 = 0; i2 < workerFiles.length; i2++) {
|
|
14531
|
+
const workerFile = workerFiles[i2];
|
|
14532
|
+
const fileName = configService.relativeSrcRoot(configService.relativeCwd(cachedWorkerFiles[i2].absPath));
|
|
14533
|
+
this.emitFile({
|
|
14534
|
+
type: "prebuilt-chunk",
|
|
14535
|
+
fileName,
|
|
14536
|
+
code: workerFile.text
|
|
14537
|
+
});
|
|
14538
|
+
}
|
|
14539
|
+
}
|
|
14540
|
+
}
|
|
14512
14541
|
debug2?.("buildEnd end");
|
|
14513
14542
|
},
|
|
14514
14543
|
resolveId(source) {
|
|
@@ -14763,6 +14792,9 @@ var ConfigService2 = class {
|
|
|
14763
14792
|
get inlineConfig() {
|
|
14764
14793
|
return this.options.config;
|
|
14765
14794
|
}
|
|
14795
|
+
get weappViteConfig() {
|
|
14796
|
+
return this.inlineConfig.weapp;
|
|
14797
|
+
}
|
|
14766
14798
|
get packageJson() {
|
|
14767
14799
|
return this.options.packageJson;
|
|
14768
14800
|
}
|
|
@@ -15318,6 +15350,9 @@ var JsonService2 = class {
|
|
|
15318
15350
|
logger_default.error(error);
|
|
15319
15351
|
}
|
|
15320
15352
|
}
|
|
15353
|
+
resolve(entry) {
|
|
15354
|
+
return resolveJson(entry, this.configService.aliasEntries);
|
|
15355
|
+
}
|
|
15321
15356
|
};
|
|
15322
15357
|
JsonService2 = _ts_decorate5([
|
|
15323
15358
|
Kt(),
|
|
@@ -22571,7 +22606,7 @@ var NpmService2 = class {
|
|
|
22571
22606
|
NODE_ENV: "production"
|
|
22572
22607
|
}
|
|
22573
22608
|
});
|
|
22574
|
-
const resolvedOptions = this.configService.
|
|
22609
|
+
const resolvedOptions = this.configService.weappViteConfig?.npm?.tsup?.(mergedOptions, {
|
|
22575
22610
|
entry: index,
|
|
22576
22611
|
name: dep
|
|
22577
22612
|
});
|
|
@@ -22607,6 +22642,7 @@ init_cjs_shims();
|
|
|
22607
22642
|
var import_shared16 = require("@weapp-core/shared");
|
|
22608
22643
|
var import_fs_extra7 = __toESM(require("fs-extra"), 1);
|
|
22609
22644
|
var import_pathe10 = __toESM(require("pathe"), 1);
|
|
22645
|
+
var import_ts_morph = require("ts-morph");
|
|
22610
22646
|
function _ts_decorate7(decorators, target, key, desc) {
|
|
22611
22647
|
var c3 = arguments.length, r5 = c3 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
|
|
22612
22648
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r5 = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -22704,9 +22740,7 @@ var ScanService2 = class {
|
|
|
22704
22740
|
this.autoImportService.potentialComponentMap.clear();
|
|
22705
22741
|
this.wxmlService.wxmlComponentsMap.clear();
|
|
22706
22742
|
}
|
|
22707
|
-
async
|
|
22708
|
-
debug?.("scanAppEntry start");
|
|
22709
|
-
this.resetEntries();
|
|
22743
|
+
async loadAppEntry() {
|
|
22710
22744
|
const appDirname = import_pathe10.default.resolve(this.configService.cwd, this.configService.srcRoot);
|
|
22711
22745
|
const appBasename = import_pathe10.default.resolve(appDirname, "app");
|
|
22712
22746
|
const appConfigFile = await findJsonEntry(appBasename);
|
|
@@ -22714,20 +22748,14 @@ var ScanService2 = class {
|
|
|
22714
22748
|
if (appEntryPath && appConfigFile) {
|
|
22715
22749
|
const config = await this.jsonService.read(appConfigFile);
|
|
22716
22750
|
if ((0, import_shared16.isObject)(config)) {
|
|
22717
|
-
if (this.entriesSet.has(appEntryPath)) {
|
|
22718
|
-
return;
|
|
22719
|
-
}
|
|
22720
|
-
this.entriesSet.add(appEntryPath);
|
|
22721
22751
|
const appEntry = {
|
|
22722
22752
|
path: appEntryPath,
|
|
22723
22753
|
json: config,
|
|
22724
22754
|
jsonPath: appConfigFile,
|
|
22725
22755
|
type: "app"
|
|
22726
22756
|
};
|
|
22727
|
-
this.entries.push(appEntry);
|
|
22728
22757
|
this.appEntry = appEntry;
|
|
22729
|
-
|
|
22730
|
-
const { pages, subpackages = [], subPackages = [], sitemapLocation = "sitemap.json", themeLocation = "theme.json" } = config;
|
|
22758
|
+
const { sitemapLocation = "sitemap.json", themeLocation = "theme.json" } = config;
|
|
22731
22759
|
if (sitemapLocation) {
|
|
22732
22760
|
const sitemapJsonPath = await findJsonEntry(import_pathe10.default.resolve(appDirname, sitemapLocation));
|
|
22733
22761
|
if (sitemapJsonPath) {
|
|
@@ -22742,58 +22770,75 @@ var ScanService2 = class {
|
|
|
22742
22770
|
appEntry.themeJson = await this.jsonService.read(themeJsonPath);
|
|
22743
22771
|
}
|
|
22744
22772
|
}
|
|
22745
|
-
|
|
22746
|
-
|
|
22747
|
-
|
|
22748
|
-
|
|
22749
|
-
|
|
22750
|
-
|
|
22751
|
-
|
|
22752
|
-
|
|
22753
|
-
|
|
22773
|
+
return appEntry;
|
|
22774
|
+
}
|
|
22775
|
+
} else {
|
|
22776
|
+
throw new Error(`\u5728 ${appDirname} \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 `);
|
|
22777
|
+
}
|
|
22778
|
+
}
|
|
22779
|
+
async scanAppEntry() {
|
|
22780
|
+
debug?.("scanAppEntry start");
|
|
22781
|
+
this.resetEntries();
|
|
22782
|
+
const appDirname = import_pathe10.default.resolve(this.configService.cwd, this.configService.srcRoot);
|
|
22783
|
+
if (this.appEntry) {
|
|
22784
|
+
const { path: appEntryPath, json: config } = this.appEntry;
|
|
22785
|
+
if (this.entriesSet.has(appEntryPath)) {
|
|
22786
|
+
return;
|
|
22787
|
+
}
|
|
22788
|
+
this.entriesSet.add(appEntryPath);
|
|
22789
|
+
this.entries.push(this.appEntry);
|
|
22790
|
+
this.pagesSet = this.initPagesSet();
|
|
22791
|
+
const { pages, subpackages = [], subPackages = [] } = config;
|
|
22792
|
+
const subs = [
|
|
22793
|
+
...subpackages,
|
|
22794
|
+
...subPackages
|
|
22795
|
+
];
|
|
22796
|
+
await this.usingComponentsHandler(this.appEntry, appDirname);
|
|
22797
|
+
if (Array.isArray(pages)) {
|
|
22798
|
+
for (const page of pages) {
|
|
22799
|
+
await this.scanComponentEntry(page, appDirname);
|
|
22754
22800
|
}
|
|
22755
|
-
|
|
22756
|
-
|
|
22757
|
-
|
|
22758
|
-
|
|
22759
|
-
|
|
22760
|
-
|
|
22761
|
-
|
|
22762
|
-
|
|
22763
|
-
|
|
22764
|
-
|
|
22765
|
-
};
|
|
22766
|
-
if (Array.isArray(sub.pages)) {
|
|
22767
|
-
for (const page of sub.pages) {
|
|
22768
|
-
await this.scanComponentEntry(import_pathe10.default.join(sub.root, page), appDirname, meta);
|
|
22769
|
-
}
|
|
22770
|
-
}
|
|
22771
|
-
if (sub.entry) {
|
|
22772
|
-
await this.scanComponentEntry(import_pathe10.default.join(sub.root, sub.entry), appDirname, meta);
|
|
22801
|
+
}
|
|
22802
|
+
for (const sub of subs) {
|
|
22803
|
+
if (sub.independent || this.configService.weappViteConfig?.subPackages?.[sub.root]?.independent) {
|
|
22804
|
+
const meta = {
|
|
22805
|
+
entries: [],
|
|
22806
|
+
entriesSet: /* @__PURE__ */ new Set(),
|
|
22807
|
+
// 合并选项
|
|
22808
|
+
subPackage: {
|
|
22809
|
+
...sub,
|
|
22810
|
+
dependencies: this.configService.weappViteConfig?.subPackages?.[sub.root].dependencies
|
|
22773
22811
|
}
|
|
22774
|
-
|
|
22775
|
-
|
|
22776
|
-
|
|
22777
|
-
|
|
22778
|
-
await this.scanComponentEntry(import_pathe10.default.join(sub.root, page), appDirname);
|
|
22779
|
-
}
|
|
22812
|
+
};
|
|
22813
|
+
if (Array.isArray(sub.pages)) {
|
|
22814
|
+
for (const page of sub.pages) {
|
|
22815
|
+
await this.scanComponentEntry(import_pathe10.default.join(sub.root, page), appDirname, meta);
|
|
22780
22816
|
}
|
|
22781
|
-
|
|
22782
|
-
|
|
22817
|
+
}
|
|
22818
|
+
if (sub.entry) {
|
|
22819
|
+
await this.scanComponentEntry(import_pathe10.default.join(sub.root, sub.entry), appDirname, meta);
|
|
22820
|
+
}
|
|
22821
|
+
this.subPackageService.metaMap[sub.root] = meta;
|
|
22822
|
+
} else {
|
|
22823
|
+
if (Array.isArray(sub.pages)) {
|
|
22824
|
+
for (const page of sub.pages) {
|
|
22825
|
+
await this.scanComponentEntry(import_pathe10.default.join(sub.root, page), appDirname);
|
|
22783
22826
|
}
|
|
22784
22827
|
}
|
|
22828
|
+
if (sub.entry) {
|
|
22829
|
+
await this.scanComponentEntry(import_pathe10.default.join(sub.root, sub.entry), appDirname);
|
|
22830
|
+
}
|
|
22785
22831
|
}
|
|
22786
|
-
if ((0, import_shared16.get)(appEntry, "json.tabBar.custom")) {
|
|
22787
|
-
await this.scanComponentEntry("custom-tab-bar/index", appDirname);
|
|
22788
|
-
}
|
|
22789
|
-
if ((0, import_shared16.get)(appEntry, "json.appBar")) {
|
|
22790
|
-
await this.scanComponentEntry("app-bar/index", appDirname);
|
|
22791
|
-
}
|
|
22792
|
-
debug?.("scanAppEntry end");
|
|
22793
|
-
return appEntry;
|
|
22794
22832
|
}
|
|
22833
|
+
if ((0, import_shared16.get)(this.appEntry, "json.tabBar.custom")) {
|
|
22834
|
+
await this.scanComponentEntry("custom-tab-bar/index", appDirname);
|
|
22835
|
+
}
|
|
22836
|
+
if ((0, import_shared16.get)(this.appEntry, "json.appBar")) {
|
|
22837
|
+
await this.scanComponentEntry("app-bar/index", appDirname);
|
|
22838
|
+
}
|
|
22839
|
+
debug?.("scanAppEntry end");
|
|
22795
22840
|
} else {
|
|
22796
|
-
throw new Error(`\
|
|
22841
|
+
throw new Error(`\u6CA1\u6709\u5148\u6267\u884C loadAppEntry \u65B9\u6CD5\u52A0\u8F7D\u5168\u5C40 app.json \u914D\u7F6E`);
|
|
22797
22842
|
}
|
|
22798
22843
|
}
|
|
22799
22844
|
// usingComponents
|
|
@@ -22883,8 +22928,8 @@ var ScanService2 = class {
|
|
|
22883
22928
|
}
|
|
22884
22929
|
(0, import_shared16.set)(jsonFragment.json, `usingComponents.${value.name}`, value.from);
|
|
22885
22930
|
}
|
|
22886
|
-
} else if (Array.isArray(this.configService.
|
|
22887
|
-
for (const resolver of this.configService.
|
|
22931
|
+
} else if (Array.isArray(this.configService.weappViteConfig?.enhance?.autoImportComponents?.resolvers)) {
|
|
22932
|
+
for (const resolver of this.configService.weappViteConfig.enhance.autoImportComponents.resolvers) {
|
|
22888
22933
|
const value = resolver(depComponentName, baseName);
|
|
22889
22934
|
if (value) {
|
|
22890
22935
|
if (!((0, import_shared16.isObject)(jsonFragment.json.usingComponents) && Reflect.has(jsonFragment.json.usingComponents, value.name))) {
|
|
@@ -22901,6 +22946,38 @@ var ScanService2 = class {
|
|
|
22901
22946
|
}
|
|
22902
22947
|
debug?.("scanComponentEntry end", componentEntry, partialEntry);
|
|
22903
22948
|
}
|
|
22949
|
+
// https://developers.weixin.qq.com/miniprogram/dev/framework/workers.html
|
|
22950
|
+
get workersOptions() {
|
|
22951
|
+
return this.appEntry?.json?.workers;
|
|
22952
|
+
}
|
|
22953
|
+
get workersDir() {
|
|
22954
|
+
return typeof this.workersOptions === "object" ? this.workersOptions.path : this.workersOptions;
|
|
22955
|
+
}
|
|
22956
|
+
// https://cn.vitejs.dev/guide/build.html#library-mode
|
|
22957
|
+
// miniprogram_dist
|
|
22958
|
+
// miniprogram
|
|
22959
|
+
// https://developers.weixin.qq.com/miniprogram/dev/devtools/npm.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E7%BB%84%E4%BB%B6%E7%9B%B8%E5%85%B3%E7%A4%BA%E4%BE%8B
|
|
22960
|
+
// #endregion
|
|
22961
|
+
workersBuild(files) {
|
|
22962
|
+
if (this.workersDir && files.length) {
|
|
22963
|
+
const project = new import_ts_morph.Project({
|
|
22964
|
+
compilerOptions: {
|
|
22965
|
+
target: import_ts_morph.ScriptTarget.ES5,
|
|
22966
|
+
module: import_ts_morph.ModuleKind.CommonJS,
|
|
22967
|
+
outDir: import_pathe10.default.resolve(this.configService.outDir, this.workersDir),
|
|
22968
|
+
strict: true,
|
|
22969
|
+
allowJs: true
|
|
22970
|
+
},
|
|
22971
|
+
skipAddingFilesFromTsConfig: true
|
|
22972
|
+
});
|
|
22973
|
+
for (const file of files) {
|
|
22974
|
+
project.addSourceFileAtPath(file);
|
|
22975
|
+
}
|
|
22976
|
+
const result = project.emitToMemory();
|
|
22977
|
+
const sourceFiles = result.getFiles();
|
|
22978
|
+
return sourceFiles;
|
|
22979
|
+
}
|
|
22980
|
+
}
|
|
22904
22981
|
};
|
|
22905
22982
|
ScanService2 = _ts_decorate7([
|
|
22906
22983
|
Kt(),
|
|
@@ -23110,7 +23187,7 @@ var WxmlService2 = class {
|
|
|
23110
23187
|
const wxml = await import_fs_extra8.default.readFile(filepath, "utf8");
|
|
23111
23188
|
const res = scanWxml(wxml, {
|
|
23112
23189
|
platform: this.configService.platform,
|
|
23113
|
-
...this.configService.
|
|
23190
|
+
...this.configService.weappViteConfig?.enhance?.wxml === true ? {} : this.configService.weappViteConfig?.enhance?.wxml
|
|
23114
23191
|
});
|
|
23115
23192
|
this.tokenMap.set(filepath, res);
|
|
23116
23193
|
await this.addDeps(filepath, res.deps.filter((x4) => isImportTag(x4.tagName) && isTemplate(x4.value)).map((x4) => import_pathe11.default.resolve(dirname3, x4.value)));
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { d as defineConfig } from './config-
|
|
2
|
-
import { L as LoadConfigOptions, C as CompilerContext } from './CompilerContext-
|
|
1
|
+
export { d as defineConfig } from './config-Cvwqemwg.cjs';
|
|
2
|
+
import { L as LoadConfigOptions, C as CompilerContext } from './CompilerContext-DWFbNP11.cjs';
|
|
3
3
|
export { UserConfig, UserConfigExport, UserConfigFnObject } from 'vite';
|
|
4
4
|
import './types-dS68tjL6.cjs';
|
|
5
5
|
import 'tsup';
|
|
@@ -7,6 +7,7 @@ import 'vite-tsconfig-paths';
|
|
|
7
7
|
import '@weapp-core/schematics';
|
|
8
8
|
import 'pkg-types';
|
|
9
9
|
import 'rollup';
|
|
10
|
+
import 'ts-morph';
|
|
10
11
|
import 'node:buffer';
|
|
11
12
|
|
|
12
13
|
declare function createCompilerContext(options?: Partial<LoadConfigOptions>): Promise<CompilerContext>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { d as defineConfig } from './config-
|
|
2
|
-
import { L as LoadConfigOptions, C as CompilerContext } from './CompilerContext-
|
|
1
|
+
export { d as defineConfig } from './config-EPV0G671.js';
|
|
2
|
+
import { L as LoadConfigOptions, C as CompilerContext } from './CompilerContext-BjnJU9GL.js';
|
|
3
3
|
export { UserConfig, UserConfigExport, UserConfigFnObject } from 'vite';
|
|
4
4
|
import './types-dS68tjL6.js';
|
|
5
5
|
import 'tsup';
|
|
@@ -7,6 +7,7 @@ import 'vite-tsconfig-paths';
|
|
|
7
7
|
import '@weapp-core/schematics';
|
|
8
8
|
import 'pkg-types';
|
|
9
9
|
import 'rollup';
|
|
10
|
+
import 'ts-morph';
|
|
10
11
|
import 'node:buffer';
|
|
11
12
|
|
|
12
13
|
declare function createCompilerContext(options?: Partial<LoadConfigOptions>): Promise<CompilerContext>;
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCompilerContext,
|
|
3
3
|
require_Reflect
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6X6X4NDH.mjs";
|
|
5
5
|
import {
|
|
6
6
|
defineConfig
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RSPHXR3C.mjs";
|
|
8
8
|
import {
|
|
9
9
|
__toESM,
|
|
10
10
|
init_esm_shims
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-PEN3BLSY.mjs";
|
|
12
12
|
|
|
13
13
|
// src/index.ts
|
|
14
14
|
init_esm_shims();
|
package/dist/json.d.cts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
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-
|
|
3
|
+
import { C as CompilerContext } from './CompilerContext-DWFbNP11.cjs';
|
|
4
4
|
import './types-dS68tjL6.cjs';
|
|
5
|
-
import './config-
|
|
5
|
+
import './config-Cvwqemwg.cjs';
|
|
6
6
|
import 'vite';
|
|
7
7
|
import 'tsup';
|
|
8
8
|
import 'vite-tsconfig-paths';
|
|
9
9
|
import 'pkg-types';
|
|
10
10
|
import 'rollup';
|
|
11
|
+
import 'ts-morph';
|
|
11
12
|
import 'node:buffer';
|
|
12
13
|
|
|
13
14
|
type ReturnSelf<T> = (config: T) => T;
|
package/dist/json.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
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-
|
|
3
|
+
import { C as CompilerContext } from './CompilerContext-BjnJU9GL.js';
|
|
4
4
|
import './types-dS68tjL6.js';
|
|
5
|
-
import './config-
|
|
5
|
+
import './config-EPV0G671.js';
|
|
6
6
|
import 'vite';
|
|
7
7
|
import 'tsup';
|
|
8
8
|
import 'vite-tsconfig-paths';
|
|
9
9
|
import 'pkg-types';
|
|
10
10
|
import 'rollup';
|
|
11
|
+
import 'ts-morph';
|
|
11
12
|
import 'node:buffer';
|
|
12
13
|
|
|
13
14
|
type ReturnSelf<T> = (config: T) => T;
|
package/dist/json.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-vite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0
|
|
4
|
+
"version": "2.1.0",
|
|
5
5
|
"description": "weapp-vite 一个现代化的小程序打包工具",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"@babel/core": "^7.26.0",
|
|
84
84
|
"@babel/preset-env": "^7.26.0",
|
|
85
85
|
"@babel/preset-typescript": "^7.26.0",
|
|
86
|
-
"@babel/types": "^7.26.
|
|
86
|
+
"@babel/types": "^7.26.5",
|
|
87
87
|
"comment-json": "^4.2.5",
|
|
88
88
|
"debug": "^4.4.0",
|
|
89
89
|
"del": "^8.0.0",
|
|
@@ -93,14 +93,15 @@
|
|
|
93
93
|
"pathe": "^2.0.1",
|
|
94
94
|
"picomatch": "^4.0.2",
|
|
95
95
|
"postcss": "^8.4.49",
|
|
96
|
+
"ts-morph": "^25.0.0",
|
|
96
97
|
"tsup": "^8.3.5",
|
|
97
98
|
"vite": "^5.4.11",
|
|
98
99
|
"vite-tsconfig-paths": "^5.1.4",
|
|
99
100
|
"@weapp-core/init": "^1.1.15",
|
|
100
|
-
"@weapp-core/schematics": "^1.0.7",
|
|
101
101
|
"@weapp-core/logger": "^1.0.2",
|
|
102
|
-
"@weapp-core/
|
|
103
|
-
"weapp-ide-cli": "^2.0.9"
|
|
102
|
+
"@weapp-core/schematics": "^1.0.8",
|
|
103
|
+
"weapp-ide-cli": "^2.0.9",
|
|
104
|
+
"@weapp-core/shared": "^1.0.5"
|
|
104
105
|
},
|
|
105
106
|
"publishConfig": {
|
|
106
107
|
"access": "public",
|