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/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.
|
|
32
|
+
// ../../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
|
|
33
33
|
var getImportMetaUrl, importMetaUrl;
|
|
34
34
|
var init_cjs_shims = __esm({
|
|
35
|
-
"../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.
|
|
35
|
+
"../../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"() {
|
|
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();
|
|
@@ -4235,8 +4235,8 @@ var AutoImportService2 = class {
|
|
|
4235
4235
|
}
|
|
4236
4236
|
}
|
|
4237
4237
|
filter(id, _meta) {
|
|
4238
|
-
if (this.configService.
|
|
4239
|
-
const isMatch = (0, import_picomatch.default)(this.configService.
|
|
4238
|
+
if (this.configService.weappViteConfig?.enhance?.autoImportComponents?.globs) {
|
|
4239
|
+
const isMatch = (0, import_picomatch.default)(this.configService.weappViteConfig.enhance.autoImportComponents.globs, {
|
|
4240
4240
|
cwd: this.configService.cwd,
|
|
4241
4241
|
windows: true,
|
|
4242
4242
|
posixSlashes: true
|
|
@@ -14840,7 +14840,7 @@ var debouncedLoggerSuccess = (0, import_debounce.default)((message) => {
|
|
|
14840
14840
|
return logger_default.success(message);
|
|
14841
14841
|
}, 25);
|
|
14842
14842
|
function vitePluginWeapp(ctx, subPackageMeta) {
|
|
14843
|
-
const { configService, subPackageService, autoImportService, scanService, wxmlService } = ctx;
|
|
14843
|
+
const { configService, subPackageService, autoImportService, scanService, wxmlService, jsonService } = ctx;
|
|
14844
14844
|
let configResolved;
|
|
14845
14845
|
function getInputOption(entries2) {
|
|
14846
14846
|
return entries2.reduce((acc, cur) => {
|
|
@@ -14853,6 +14853,7 @@ function vitePluginWeapp(ctx, subPackageMeta) {
|
|
|
14853
14853
|
let entries;
|
|
14854
14854
|
const cachedEmittedFiles = [];
|
|
14855
14855
|
const cachedWatchFiles = [];
|
|
14856
|
+
const cachedWorkerFiles = [];
|
|
14856
14857
|
async function handleWxsDeps(deps, absPath) {
|
|
14857
14858
|
for (const wxsDep of deps.filter((x4) => x4.tagName === "wxs")) {
|
|
14858
14859
|
if (jsExtensions.includes(wxsDep.attrs.lang) || /\.wxs\.[jt]s$/.test(wxsDep.value)) {
|
|
@@ -14915,8 +14916,12 @@ function vitePluginWeapp(ctx, subPackageMeta) {
|
|
|
14915
14916
|
}
|
|
14916
14917
|
},
|
|
14917
14918
|
async options(options) {
|
|
14919
|
+
if (!subPackageMeta) {
|
|
14920
|
+
await scanService.loadAppEntry();
|
|
14921
|
+
}
|
|
14918
14922
|
cachedEmittedFiles.length = 0;
|
|
14919
14923
|
cachedWatchFiles.length = 0;
|
|
14924
|
+
cachedWorkerFiles.length = 0;
|
|
14920
14925
|
scanService.resetAutoImport();
|
|
14921
14926
|
const { build: build4, weapp } = configResolved;
|
|
14922
14927
|
const ignore = [
|
|
@@ -14934,6 +14939,9 @@ function vitePluginWeapp(ctx, subPackageMeta) {
|
|
|
14934
14939
|
"**/*.{wxml,html,wxs}",
|
|
14935
14940
|
"**/*.{png,jpg,jpeg,gif,svg,webp}"
|
|
14936
14941
|
];
|
|
14942
|
+
if (scanService.workersDir) {
|
|
14943
|
+
assetGlobs.push(import_pathe6.default.join(scanService.workersDir, "**/*.{js,ts}"));
|
|
14944
|
+
}
|
|
14937
14945
|
assetGlobs.push(...resolveGlobs(weapp?.copy?.include));
|
|
14938
14946
|
const patterns = assetGlobs.map((x4) => {
|
|
14939
14947
|
return import_pathe6.default.join(targetDir, x4);
|
|
@@ -14951,6 +14959,7 @@ function vitePluginWeapp(ctx, subPackageMeta) {
|
|
|
14951
14959
|
const absPath = import_pathe6.default.resolve(configService.cwd, relPath);
|
|
14952
14960
|
cachedWatchFiles.push(absPath);
|
|
14953
14961
|
const isWxs = relPath.endsWith(".wxs");
|
|
14962
|
+
const isWorker = isJsOrTs(relPath) && scanService.workersDir && relPath.startsWith(scanService.workersDir);
|
|
14954
14963
|
const fileName = configService.relativeSrcRoot(relPath);
|
|
14955
14964
|
if (isTemplateRequest(relPath)) {
|
|
14956
14965
|
if (weapp?.enhance?.autoImportComponents && autoImportService.filter(relPath, subPackageMeta)) {
|
|
@@ -14967,6 +14976,12 @@ function vitePluginWeapp(ctx, subPackageMeta) {
|
|
|
14967
14976
|
absPath,
|
|
14968
14977
|
fileName
|
|
14969
14978
|
});
|
|
14979
|
+
} else if (isWorker) {
|
|
14980
|
+
cachedWorkerFiles.push({
|
|
14981
|
+
relPath,
|
|
14982
|
+
absPath,
|
|
14983
|
+
fileName
|
|
14984
|
+
});
|
|
14970
14985
|
} else {
|
|
14971
14986
|
mediaFiles.push({
|
|
14972
14987
|
relPath,
|
|
@@ -15005,7 +15020,7 @@ function vitePluginWeapp(ctx, subPackageMeta) {
|
|
|
15005
15020
|
return !wxmlService.tokenMap.has(x4.absPath);
|
|
15006
15021
|
});
|
|
15007
15022
|
const additionalWxmlFiles = excludedWxmlFiles.filter((x4) => {
|
|
15008
|
-
return configService.
|
|
15023
|
+
return configService.weappViteConfig?.isAdditionalWxml?.(x4.absPath);
|
|
15009
15024
|
});
|
|
15010
15025
|
debug2?.(`additionalWxmlFiles:`, additionalWxmlFiles);
|
|
15011
15026
|
await Promise.all([
|
|
@@ -15067,7 +15082,7 @@ function vitePluginWeapp(ctx, subPackageMeta) {
|
|
|
15067
15082
|
this.emitFile({
|
|
15068
15083
|
type: "asset",
|
|
15069
15084
|
fileName,
|
|
15070
|
-
source:
|
|
15085
|
+
source: jsonService.resolve(entry)
|
|
15071
15086
|
});
|
|
15072
15087
|
}
|
|
15073
15088
|
}
|
|
@@ -15081,10 +15096,10 @@ function vitePluginWeapp(ctx, subPackageMeta) {
|
|
|
15081
15096
|
this.emitFile({
|
|
15082
15097
|
type: "asset",
|
|
15083
15098
|
fileName,
|
|
15084
|
-
source:
|
|
15099
|
+
source: jsonService.resolve({
|
|
15085
15100
|
json: appEntry.sitemapJson,
|
|
15086
15101
|
jsonPath: appEntry.sitemapJsonPath
|
|
15087
|
-
}
|
|
15102
|
+
})
|
|
15088
15103
|
});
|
|
15089
15104
|
}
|
|
15090
15105
|
}
|
|
@@ -15095,16 +15110,30 @@ function vitePluginWeapp(ctx, subPackageMeta) {
|
|
|
15095
15110
|
this.emitFile({
|
|
15096
15111
|
type: "asset",
|
|
15097
15112
|
fileName,
|
|
15098
|
-
source:
|
|
15113
|
+
source: jsonService.resolve({
|
|
15099
15114
|
json: appEntry.themeJson,
|
|
15100
15115
|
jsonPath: appEntry.themeJsonPath
|
|
15101
|
-
}
|
|
15116
|
+
})
|
|
15102
15117
|
});
|
|
15103
15118
|
}
|
|
15104
15119
|
}
|
|
15105
15120
|
}
|
|
15106
15121
|
}
|
|
15107
15122
|
}
|
|
15123
|
+
if (scanService.workersDir && cachedWorkerFiles.length) {
|
|
15124
|
+
const workerFiles = scanService.workersBuild(cachedWorkerFiles.map((x4) => x4.absPath));
|
|
15125
|
+
if (workerFiles) {
|
|
15126
|
+
for (let i2 = 0; i2 < workerFiles.length; i2++) {
|
|
15127
|
+
const workerFile = workerFiles[i2];
|
|
15128
|
+
const fileName = configService.relativeSrcRoot(configService.relativeCwd(cachedWorkerFiles[i2].absPath));
|
|
15129
|
+
this.emitFile({
|
|
15130
|
+
type: "prebuilt-chunk",
|
|
15131
|
+
fileName,
|
|
15132
|
+
code: workerFile.text
|
|
15133
|
+
});
|
|
15134
|
+
}
|
|
15135
|
+
}
|
|
15136
|
+
}
|
|
15108
15137
|
debug2?.("buildEnd end");
|
|
15109
15138
|
},
|
|
15110
15139
|
resolveId(source) {
|
|
@@ -15359,6 +15388,9 @@ var ConfigService2 = class {
|
|
|
15359
15388
|
get inlineConfig() {
|
|
15360
15389
|
return this.options.config;
|
|
15361
15390
|
}
|
|
15391
|
+
get weappViteConfig() {
|
|
15392
|
+
return this.inlineConfig.weapp;
|
|
15393
|
+
}
|
|
15362
15394
|
get packageJson() {
|
|
15363
15395
|
return this.options.packageJson;
|
|
15364
15396
|
}
|
|
@@ -15914,6 +15946,9 @@ var JsonService2 = class {
|
|
|
15914
15946
|
logger_default.error(error);
|
|
15915
15947
|
}
|
|
15916
15948
|
}
|
|
15949
|
+
resolve(entry) {
|
|
15950
|
+
return resolveJson(entry, this.configService.aliasEntries);
|
|
15951
|
+
}
|
|
15917
15952
|
};
|
|
15918
15953
|
JsonService2 = _ts_decorate5([
|
|
15919
15954
|
Kt(),
|
|
@@ -23167,7 +23202,7 @@ var NpmService2 = class {
|
|
|
23167
23202
|
NODE_ENV: "production"
|
|
23168
23203
|
}
|
|
23169
23204
|
});
|
|
23170
|
-
const resolvedOptions = this.configService.
|
|
23205
|
+
const resolvedOptions = this.configService.weappViteConfig?.npm?.tsup?.(mergedOptions, {
|
|
23171
23206
|
entry: index,
|
|
23172
23207
|
name: dep
|
|
23173
23208
|
});
|
|
@@ -23203,6 +23238,7 @@ init_cjs_shims();
|
|
|
23203
23238
|
var import_shared16 = require("@weapp-core/shared");
|
|
23204
23239
|
var import_fs_extra7 = __toESM(require("fs-extra"), 1);
|
|
23205
23240
|
var import_pathe10 = __toESM(require("pathe"), 1);
|
|
23241
|
+
var import_ts_morph = require("ts-morph");
|
|
23206
23242
|
function _ts_decorate7(decorators, target, key, desc) {
|
|
23207
23243
|
var c3 = arguments.length, r5 = c3 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
|
|
23208
23244
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r5 = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -23300,9 +23336,7 @@ var ScanService2 = class {
|
|
|
23300
23336
|
this.autoImportService.potentialComponentMap.clear();
|
|
23301
23337
|
this.wxmlService.wxmlComponentsMap.clear();
|
|
23302
23338
|
}
|
|
23303
|
-
async
|
|
23304
|
-
debug?.("scanAppEntry start");
|
|
23305
|
-
this.resetEntries();
|
|
23339
|
+
async loadAppEntry() {
|
|
23306
23340
|
const appDirname = import_pathe10.default.resolve(this.configService.cwd, this.configService.srcRoot);
|
|
23307
23341
|
const appBasename = import_pathe10.default.resolve(appDirname, "app");
|
|
23308
23342
|
const appConfigFile = await findJsonEntry(appBasename);
|
|
@@ -23310,20 +23344,14 @@ var ScanService2 = class {
|
|
|
23310
23344
|
if (appEntryPath && appConfigFile) {
|
|
23311
23345
|
const config = await this.jsonService.read(appConfigFile);
|
|
23312
23346
|
if ((0, import_shared16.isObject)(config)) {
|
|
23313
|
-
if (this.entriesSet.has(appEntryPath)) {
|
|
23314
|
-
return;
|
|
23315
|
-
}
|
|
23316
|
-
this.entriesSet.add(appEntryPath);
|
|
23317
23347
|
const appEntry = {
|
|
23318
23348
|
path: appEntryPath,
|
|
23319
23349
|
json: config,
|
|
23320
23350
|
jsonPath: appConfigFile,
|
|
23321
23351
|
type: "app"
|
|
23322
23352
|
};
|
|
23323
|
-
this.entries.push(appEntry);
|
|
23324
23353
|
this.appEntry = appEntry;
|
|
23325
|
-
|
|
23326
|
-
const { pages, subpackages = [], subPackages = [], sitemapLocation = "sitemap.json", themeLocation = "theme.json" } = config;
|
|
23354
|
+
const { sitemapLocation = "sitemap.json", themeLocation = "theme.json" } = config;
|
|
23327
23355
|
if (sitemapLocation) {
|
|
23328
23356
|
const sitemapJsonPath = await findJsonEntry(import_pathe10.default.resolve(appDirname, sitemapLocation));
|
|
23329
23357
|
if (sitemapJsonPath) {
|
|
@@ -23338,58 +23366,75 @@ var ScanService2 = class {
|
|
|
23338
23366
|
appEntry.themeJson = await this.jsonService.read(themeJsonPath);
|
|
23339
23367
|
}
|
|
23340
23368
|
}
|
|
23341
|
-
|
|
23342
|
-
|
|
23343
|
-
|
|
23344
|
-
|
|
23345
|
-
|
|
23346
|
-
|
|
23347
|
-
|
|
23348
|
-
|
|
23349
|
-
|
|
23369
|
+
return appEntry;
|
|
23370
|
+
}
|
|
23371
|
+
} else {
|
|
23372
|
+
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 `);
|
|
23373
|
+
}
|
|
23374
|
+
}
|
|
23375
|
+
async scanAppEntry() {
|
|
23376
|
+
debug?.("scanAppEntry start");
|
|
23377
|
+
this.resetEntries();
|
|
23378
|
+
const appDirname = import_pathe10.default.resolve(this.configService.cwd, this.configService.srcRoot);
|
|
23379
|
+
if (this.appEntry) {
|
|
23380
|
+
const { path: appEntryPath, json: config } = this.appEntry;
|
|
23381
|
+
if (this.entriesSet.has(appEntryPath)) {
|
|
23382
|
+
return;
|
|
23383
|
+
}
|
|
23384
|
+
this.entriesSet.add(appEntryPath);
|
|
23385
|
+
this.entries.push(this.appEntry);
|
|
23386
|
+
this.pagesSet = this.initPagesSet();
|
|
23387
|
+
const { pages, subpackages = [], subPackages = [] } = config;
|
|
23388
|
+
const subs = [
|
|
23389
|
+
...subpackages,
|
|
23390
|
+
...subPackages
|
|
23391
|
+
];
|
|
23392
|
+
await this.usingComponentsHandler(this.appEntry, appDirname);
|
|
23393
|
+
if (Array.isArray(pages)) {
|
|
23394
|
+
for (const page of pages) {
|
|
23395
|
+
await this.scanComponentEntry(page, appDirname);
|
|
23350
23396
|
}
|
|
23351
|
-
|
|
23352
|
-
|
|
23353
|
-
|
|
23354
|
-
|
|
23355
|
-
|
|
23356
|
-
|
|
23357
|
-
|
|
23358
|
-
|
|
23359
|
-
|
|
23360
|
-
|
|
23361
|
-
};
|
|
23362
|
-
if (Array.isArray(sub.pages)) {
|
|
23363
|
-
for (const page of sub.pages) {
|
|
23364
|
-
await this.scanComponentEntry(import_pathe10.default.join(sub.root, page), appDirname, meta);
|
|
23365
|
-
}
|
|
23366
|
-
}
|
|
23367
|
-
if (sub.entry) {
|
|
23368
|
-
await this.scanComponentEntry(import_pathe10.default.join(sub.root, sub.entry), appDirname, meta);
|
|
23397
|
+
}
|
|
23398
|
+
for (const sub of subs) {
|
|
23399
|
+
if (sub.independent || this.configService.weappViteConfig?.subPackages?.[sub.root]?.independent) {
|
|
23400
|
+
const meta = {
|
|
23401
|
+
entries: [],
|
|
23402
|
+
entriesSet: /* @__PURE__ */ new Set(),
|
|
23403
|
+
// 合并选项
|
|
23404
|
+
subPackage: {
|
|
23405
|
+
...sub,
|
|
23406
|
+
dependencies: this.configService.weappViteConfig?.subPackages?.[sub.root].dependencies
|
|
23369
23407
|
}
|
|
23370
|
-
|
|
23371
|
-
|
|
23372
|
-
|
|
23373
|
-
|
|
23374
|
-
await this.scanComponentEntry(import_pathe10.default.join(sub.root, page), appDirname);
|
|
23375
|
-
}
|
|
23408
|
+
};
|
|
23409
|
+
if (Array.isArray(sub.pages)) {
|
|
23410
|
+
for (const page of sub.pages) {
|
|
23411
|
+
await this.scanComponentEntry(import_pathe10.default.join(sub.root, page), appDirname, meta);
|
|
23376
23412
|
}
|
|
23377
|
-
|
|
23378
|
-
|
|
23413
|
+
}
|
|
23414
|
+
if (sub.entry) {
|
|
23415
|
+
await this.scanComponentEntry(import_pathe10.default.join(sub.root, sub.entry), appDirname, meta);
|
|
23416
|
+
}
|
|
23417
|
+
this.subPackageService.metaMap[sub.root] = meta;
|
|
23418
|
+
} else {
|
|
23419
|
+
if (Array.isArray(sub.pages)) {
|
|
23420
|
+
for (const page of sub.pages) {
|
|
23421
|
+
await this.scanComponentEntry(import_pathe10.default.join(sub.root, page), appDirname);
|
|
23379
23422
|
}
|
|
23380
23423
|
}
|
|
23424
|
+
if (sub.entry) {
|
|
23425
|
+
await this.scanComponentEntry(import_pathe10.default.join(sub.root, sub.entry), appDirname);
|
|
23426
|
+
}
|
|
23381
23427
|
}
|
|
23382
|
-
if ((0, import_shared16.get)(appEntry, "json.tabBar.custom")) {
|
|
23383
|
-
await this.scanComponentEntry("custom-tab-bar/index", appDirname);
|
|
23384
|
-
}
|
|
23385
|
-
if ((0, import_shared16.get)(appEntry, "json.appBar")) {
|
|
23386
|
-
await this.scanComponentEntry("app-bar/index", appDirname);
|
|
23387
|
-
}
|
|
23388
|
-
debug?.("scanAppEntry end");
|
|
23389
|
-
return appEntry;
|
|
23390
23428
|
}
|
|
23429
|
+
if ((0, import_shared16.get)(this.appEntry, "json.tabBar.custom")) {
|
|
23430
|
+
await this.scanComponentEntry("custom-tab-bar/index", appDirname);
|
|
23431
|
+
}
|
|
23432
|
+
if ((0, import_shared16.get)(this.appEntry, "json.appBar")) {
|
|
23433
|
+
await this.scanComponentEntry("app-bar/index", appDirname);
|
|
23434
|
+
}
|
|
23435
|
+
debug?.("scanAppEntry end");
|
|
23391
23436
|
} else {
|
|
23392
|
-
throw new Error(`\
|
|
23437
|
+
throw new Error(`\u6CA1\u6709\u5148\u6267\u884C loadAppEntry \u65B9\u6CD5\u52A0\u8F7D\u5168\u5C40 app.json \u914D\u7F6E`);
|
|
23393
23438
|
}
|
|
23394
23439
|
}
|
|
23395
23440
|
// usingComponents
|
|
@@ -23479,8 +23524,8 @@ var ScanService2 = class {
|
|
|
23479
23524
|
}
|
|
23480
23525
|
(0, import_shared16.set)(jsonFragment.json, `usingComponents.${value.name}`, value.from);
|
|
23481
23526
|
}
|
|
23482
|
-
} else if (Array.isArray(this.configService.
|
|
23483
|
-
for (const resolver of this.configService.
|
|
23527
|
+
} else if (Array.isArray(this.configService.weappViteConfig?.enhance?.autoImportComponents?.resolvers)) {
|
|
23528
|
+
for (const resolver of this.configService.weappViteConfig.enhance.autoImportComponents.resolvers) {
|
|
23484
23529
|
const value = resolver(depComponentName, baseName);
|
|
23485
23530
|
if (value) {
|
|
23486
23531
|
if (!((0, import_shared16.isObject)(jsonFragment.json.usingComponents) && Reflect.has(jsonFragment.json.usingComponents, value.name))) {
|
|
@@ -23497,6 +23542,38 @@ var ScanService2 = class {
|
|
|
23497
23542
|
}
|
|
23498
23543
|
debug?.("scanComponentEntry end", componentEntry, partialEntry);
|
|
23499
23544
|
}
|
|
23545
|
+
// https://developers.weixin.qq.com/miniprogram/dev/framework/workers.html
|
|
23546
|
+
get workersOptions() {
|
|
23547
|
+
return this.appEntry?.json?.workers;
|
|
23548
|
+
}
|
|
23549
|
+
get workersDir() {
|
|
23550
|
+
return typeof this.workersOptions === "object" ? this.workersOptions.path : this.workersOptions;
|
|
23551
|
+
}
|
|
23552
|
+
// https://cn.vitejs.dev/guide/build.html#library-mode
|
|
23553
|
+
// miniprogram_dist
|
|
23554
|
+
// miniprogram
|
|
23555
|
+
// 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
|
|
23556
|
+
// #endregion
|
|
23557
|
+
workersBuild(files) {
|
|
23558
|
+
if (this.workersDir && files.length) {
|
|
23559
|
+
const project = new import_ts_morph.Project({
|
|
23560
|
+
compilerOptions: {
|
|
23561
|
+
target: import_ts_morph.ScriptTarget.ES5,
|
|
23562
|
+
module: import_ts_morph.ModuleKind.CommonJS,
|
|
23563
|
+
outDir: import_pathe10.default.resolve(this.configService.outDir, this.workersDir),
|
|
23564
|
+
strict: true,
|
|
23565
|
+
allowJs: true
|
|
23566
|
+
},
|
|
23567
|
+
skipAddingFilesFromTsConfig: true
|
|
23568
|
+
});
|
|
23569
|
+
for (const file of files) {
|
|
23570
|
+
project.addSourceFileAtPath(file);
|
|
23571
|
+
}
|
|
23572
|
+
const result = project.emitToMemory();
|
|
23573
|
+
const sourceFiles = result.getFiles();
|
|
23574
|
+
return sourceFiles;
|
|
23575
|
+
}
|
|
23576
|
+
}
|
|
23500
23577
|
};
|
|
23501
23578
|
ScanService2 = _ts_decorate7([
|
|
23502
23579
|
Kt(),
|
|
@@ -23706,7 +23783,7 @@ var WxmlService2 = class {
|
|
|
23706
23783
|
const wxml = await import_fs_extra8.default.readFile(filepath, "utf8");
|
|
23707
23784
|
const res = scanWxml(wxml, {
|
|
23708
23785
|
platform: this.configService.platform,
|
|
23709
|
-
...this.configService.
|
|
23786
|
+
...this.configService.weappViteConfig?.enhance?.wxml === true ? {} : this.configService.weappViteConfig?.enhance?.wxml
|
|
23710
23787
|
});
|
|
23711
23788
|
this.tokenMap.set(filepath, res);
|
|
23712
23789
|
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/cli.mjs
CHANGED
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
createCompilerContext,
|
|
4
4
|
logger_default,
|
|
5
5
|
require_Reflect
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-6X6X4NDH.mjs";
|
|
7
|
+
import "./chunk-RSPHXR3C.mjs";
|
|
8
8
|
import {
|
|
9
9
|
__name,
|
|
10
10
|
__toESM,
|
|
11
11
|
init_esm_shims
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-PEN3BLSY.mjs";
|
|
13
13
|
|
|
14
14
|
// src/cli.ts
|
|
15
15
|
init_esm_shims();
|
|
@@ -194,4 +194,4 @@ declare function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>;
|
|
|
194
194
|
declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
|
|
195
195
|
declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
196
196
|
|
|
197
|
-
export { type AppEntry as A, type Entry as E, type MpPlatform as M, type ProjectConfig as P, type ResolvedAlias as R, type SubPackageMetaValue as S, type SubPackage as a, type ScanWxmlOptions as b, defineConfig as d };
|
|
197
|
+
export { type AppEntry as A, type Entry as E, type MpPlatform as M, type ProjectConfig as P, type ResolvedAlias as R, type SubPackageMetaValue as S, type WeappViteConfig as W, type SubPackage as a, type ScanWxmlOptions as b, defineConfig as d };
|
|
@@ -194,4 +194,4 @@ declare function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>;
|
|
|
194
194
|
declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
|
|
195
195
|
declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
196
196
|
|
|
197
|
-
export { type AppEntry as A, type Entry as E, type MpPlatform as M, type ProjectConfig as P, type ResolvedAlias as R, type SubPackageMetaValue as S, type SubPackage as a, type ScanWxmlOptions as b, defineConfig as d };
|
|
197
|
+
export { type AppEntry as A, type Entry as E, type MpPlatform as M, type ProjectConfig as P, type ResolvedAlias as R, type SubPackageMetaValue as S, type WeappViteConfig as W, type SubPackage as a, type ScanWxmlOptions as b, defineConfig as d };
|
package/dist/config.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { UserConfig, UserConfigExport, UserConfigFnObject } from 'vite';
|
|
2
|
-
export { d as defineConfig } from './config-
|
|
2
|
+
export { d as defineConfig } from './config-Cvwqemwg.cjs';
|
|
3
3
|
import './types-dS68tjL6.cjs';
|
|
4
4
|
import 'tsup';
|
|
5
5
|
import 'vite-tsconfig-paths';
|
package/dist/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { UserConfig, UserConfigExport, UserConfigFnObject } from 'vite';
|
|
2
|
-
export { d as defineConfig } from './config-
|
|
2
|
+
export { d as defineConfig } from './config-EPV0G671.js';
|
|
3
3
|
import './types-dS68tjL6.js';
|
|
4
4
|
import 'tsup';
|
|
5
5
|
import 'vite-tsconfig-paths';
|