weapp-vite 2.0.2 → 2.1.1
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-6ZIOYCGJ.mjs} +148 -69
- package/dist/{chunk-ZRLZHOL5.mjs → chunk-PEN3BLSY.mjs} +2 -2
- package/dist/{chunk-4ZIYVTHH.mjs → chunk-RSPHXR3C.mjs} +1 -1
- package/dist/cli.cjs +150 -73
- package/dist/cli.mjs +4 -6
- 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 +149 -70
- 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 +5 -4
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(),
|
|
@@ -23165,9 +23200,11 @@ var NpmService2 = class {
|
|
|
23165
23200
|
// https://tsup.egoist.dev/#compile-time-environment-variables
|
|
23166
23201
|
env: {
|
|
23167
23202
|
NODE_ENV: "production"
|
|
23168
|
-
}
|
|
23203
|
+
},
|
|
23204
|
+
minify: true,
|
|
23205
|
+
target: "es6"
|
|
23169
23206
|
});
|
|
23170
|
-
const resolvedOptions = this.configService.
|
|
23207
|
+
const resolvedOptions = this.configService.weappViteConfig?.npm?.tsup?.(mergedOptions, {
|
|
23171
23208
|
entry: index,
|
|
23172
23209
|
name: dep
|
|
23173
23210
|
});
|
|
@@ -23203,6 +23240,7 @@ init_cjs_shims();
|
|
|
23203
23240
|
var import_shared16 = require("@weapp-core/shared");
|
|
23204
23241
|
var import_fs_extra7 = __toESM(require("fs-extra"), 1);
|
|
23205
23242
|
var import_pathe10 = __toESM(require("pathe"), 1);
|
|
23243
|
+
var import_ts_morph = require("ts-morph");
|
|
23206
23244
|
function _ts_decorate7(decorators, target, key, desc) {
|
|
23207
23245
|
var c3 = arguments.length, r5 = c3 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3;
|
|
23208
23246
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r5 = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -23300,9 +23338,7 @@ var ScanService2 = class {
|
|
|
23300
23338
|
this.autoImportService.potentialComponentMap.clear();
|
|
23301
23339
|
this.wxmlService.wxmlComponentsMap.clear();
|
|
23302
23340
|
}
|
|
23303
|
-
async
|
|
23304
|
-
debug?.("scanAppEntry start");
|
|
23305
|
-
this.resetEntries();
|
|
23341
|
+
async loadAppEntry() {
|
|
23306
23342
|
const appDirname = import_pathe10.default.resolve(this.configService.cwd, this.configService.srcRoot);
|
|
23307
23343
|
const appBasename = import_pathe10.default.resolve(appDirname, "app");
|
|
23308
23344
|
const appConfigFile = await findJsonEntry(appBasename);
|
|
@@ -23310,20 +23346,14 @@ var ScanService2 = class {
|
|
|
23310
23346
|
if (appEntryPath && appConfigFile) {
|
|
23311
23347
|
const config = await this.jsonService.read(appConfigFile);
|
|
23312
23348
|
if ((0, import_shared16.isObject)(config)) {
|
|
23313
|
-
if (this.entriesSet.has(appEntryPath)) {
|
|
23314
|
-
return;
|
|
23315
|
-
}
|
|
23316
|
-
this.entriesSet.add(appEntryPath);
|
|
23317
23349
|
const appEntry = {
|
|
23318
23350
|
path: appEntryPath,
|
|
23319
23351
|
json: config,
|
|
23320
23352
|
jsonPath: appConfigFile,
|
|
23321
23353
|
type: "app"
|
|
23322
23354
|
};
|
|
23323
|
-
this.entries.push(appEntry);
|
|
23324
23355
|
this.appEntry = appEntry;
|
|
23325
|
-
|
|
23326
|
-
const { pages, subpackages = [], subPackages = [], sitemapLocation = "sitemap.json", themeLocation = "theme.json" } = config;
|
|
23356
|
+
const { sitemapLocation = "sitemap.json", themeLocation = "theme.json" } = config;
|
|
23327
23357
|
if (sitemapLocation) {
|
|
23328
23358
|
const sitemapJsonPath = await findJsonEntry(import_pathe10.default.resolve(appDirname, sitemapLocation));
|
|
23329
23359
|
if (sitemapJsonPath) {
|
|
@@ -23338,58 +23368,75 @@ var ScanService2 = class {
|
|
|
23338
23368
|
appEntry.themeJson = await this.jsonService.read(themeJsonPath);
|
|
23339
23369
|
}
|
|
23340
23370
|
}
|
|
23341
|
-
|
|
23342
|
-
|
|
23343
|
-
|
|
23344
|
-
|
|
23345
|
-
|
|
23346
|
-
|
|
23347
|
-
|
|
23348
|
-
|
|
23349
|
-
|
|
23371
|
+
return appEntry;
|
|
23372
|
+
}
|
|
23373
|
+
} else {
|
|
23374
|
+
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 `);
|
|
23375
|
+
}
|
|
23376
|
+
}
|
|
23377
|
+
async scanAppEntry() {
|
|
23378
|
+
debug?.("scanAppEntry start");
|
|
23379
|
+
this.resetEntries();
|
|
23380
|
+
const appDirname = import_pathe10.default.resolve(this.configService.cwd, this.configService.srcRoot);
|
|
23381
|
+
if (this.appEntry) {
|
|
23382
|
+
const { path: appEntryPath, json: config } = this.appEntry;
|
|
23383
|
+
if (this.entriesSet.has(appEntryPath)) {
|
|
23384
|
+
return;
|
|
23385
|
+
}
|
|
23386
|
+
this.entriesSet.add(appEntryPath);
|
|
23387
|
+
this.entries.push(this.appEntry);
|
|
23388
|
+
this.pagesSet = this.initPagesSet();
|
|
23389
|
+
const { pages, subpackages = [], subPackages = [] } = config;
|
|
23390
|
+
const subs = [
|
|
23391
|
+
...subpackages,
|
|
23392
|
+
...subPackages
|
|
23393
|
+
];
|
|
23394
|
+
await this.usingComponentsHandler(this.appEntry, appDirname);
|
|
23395
|
+
if (Array.isArray(pages)) {
|
|
23396
|
+
for (const page of pages) {
|
|
23397
|
+
await this.scanComponentEntry(page, appDirname);
|
|
23350
23398
|
}
|
|
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);
|
|
23399
|
+
}
|
|
23400
|
+
for (const sub of subs) {
|
|
23401
|
+
if (sub.independent || this.configService.weappViteConfig?.subPackages?.[sub.root]?.independent) {
|
|
23402
|
+
const meta = {
|
|
23403
|
+
entries: [],
|
|
23404
|
+
entriesSet: /* @__PURE__ */ new Set(),
|
|
23405
|
+
// 合并选项
|
|
23406
|
+
subPackage: {
|
|
23407
|
+
...sub,
|
|
23408
|
+
dependencies: this.configService.weappViteConfig?.subPackages?.[sub.root].dependencies
|
|
23369
23409
|
}
|
|
23370
|
-
|
|
23371
|
-
|
|
23372
|
-
|
|
23373
|
-
|
|
23374
|
-
await this.scanComponentEntry(import_pathe10.default.join(sub.root, page), appDirname);
|
|
23375
|
-
}
|
|
23410
|
+
};
|
|
23411
|
+
if (Array.isArray(sub.pages)) {
|
|
23412
|
+
for (const page of sub.pages) {
|
|
23413
|
+
await this.scanComponentEntry(import_pathe10.default.join(sub.root, page), appDirname, meta);
|
|
23376
23414
|
}
|
|
23377
|
-
|
|
23378
|
-
|
|
23415
|
+
}
|
|
23416
|
+
if (sub.entry) {
|
|
23417
|
+
await this.scanComponentEntry(import_pathe10.default.join(sub.root, sub.entry), appDirname, meta);
|
|
23418
|
+
}
|
|
23419
|
+
this.subPackageService.metaMap[sub.root] = meta;
|
|
23420
|
+
} else {
|
|
23421
|
+
if (Array.isArray(sub.pages)) {
|
|
23422
|
+
for (const page of sub.pages) {
|
|
23423
|
+
await this.scanComponentEntry(import_pathe10.default.join(sub.root, page), appDirname);
|
|
23379
23424
|
}
|
|
23380
23425
|
}
|
|
23426
|
+
if (sub.entry) {
|
|
23427
|
+
await this.scanComponentEntry(import_pathe10.default.join(sub.root, sub.entry), appDirname);
|
|
23428
|
+
}
|
|
23381
23429
|
}
|
|
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
23430
|
}
|
|
23431
|
+
if ((0, import_shared16.get)(this.appEntry, "json.tabBar.custom")) {
|
|
23432
|
+
await this.scanComponentEntry("custom-tab-bar/index", appDirname);
|
|
23433
|
+
}
|
|
23434
|
+
if ((0, import_shared16.get)(this.appEntry, "json.appBar")) {
|
|
23435
|
+
await this.scanComponentEntry("app-bar/index", appDirname);
|
|
23436
|
+
}
|
|
23437
|
+
debug?.("scanAppEntry end");
|
|
23391
23438
|
} else {
|
|
23392
|
-
throw new Error(`\
|
|
23439
|
+
throw new Error(`\u6CA1\u6709\u5148\u6267\u884C loadAppEntry \u65B9\u6CD5\u52A0\u8F7D\u5168\u5C40 app.json \u914D\u7F6E`);
|
|
23393
23440
|
}
|
|
23394
23441
|
}
|
|
23395
23442
|
// usingComponents
|
|
@@ -23479,8 +23526,8 @@ var ScanService2 = class {
|
|
|
23479
23526
|
}
|
|
23480
23527
|
(0, import_shared16.set)(jsonFragment.json, `usingComponents.${value.name}`, value.from);
|
|
23481
23528
|
}
|
|
23482
|
-
} else if (Array.isArray(this.configService.
|
|
23483
|
-
for (const resolver of this.configService.
|
|
23529
|
+
} else if (Array.isArray(this.configService.weappViteConfig?.enhance?.autoImportComponents?.resolvers)) {
|
|
23530
|
+
for (const resolver of this.configService.weappViteConfig.enhance.autoImportComponents.resolvers) {
|
|
23484
23531
|
const value = resolver(depComponentName, baseName);
|
|
23485
23532
|
if (value) {
|
|
23486
23533
|
if (!((0, import_shared16.isObject)(jsonFragment.json.usingComponents) && Reflect.has(jsonFragment.json.usingComponents, value.name))) {
|
|
@@ -23497,6 +23544,38 @@ var ScanService2 = class {
|
|
|
23497
23544
|
}
|
|
23498
23545
|
debug?.("scanComponentEntry end", componentEntry, partialEntry);
|
|
23499
23546
|
}
|
|
23547
|
+
// https://developers.weixin.qq.com/miniprogram/dev/framework/workers.html
|
|
23548
|
+
get workersOptions() {
|
|
23549
|
+
return this.appEntry?.json?.workers;
|
|
23550
|
+
}
|
|
23551
|
+
get workersDir() {
|
|
23552
|
+
return typeof this.workersOptions === "object" ? this.workersOptions.path : this.workersOptions;
|
|
23553
|
+
}
|
|
23554
|
+
// https://cn.vitejs.dev/guide/build.html#library-mode
|
|
23555
|
+
// miniprogram_dist
|
|
23556
|
+
// miniprogram
|
|
23557
|
+
// 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
|
|
23558
|
+
// #endregion
|
|
23559
|
+
workersBuild(files) {
|
|
23560
|
+
if (this.workersDir && files.length) {
|
|
23561
|
+
const project = new import_ts_morph.Project({
|
|
23562
|
+
compilerOptions: {
|
|
23563
|
+
target: import_ts_morph.ScriptTarget.ES5,
|
|
23564
|
+
module: import_ts_morph.ModuleKind.CommonJS,
|
|
23565
|
+
outDir: import_pathe10.default.resolve(this.configService.outDir, this.workersDir),
|
|
23566
|
+
strict: true,
|
|
23567
|
+
allowJs: true
|
|
23568
|
+
},
|
|
23569
|
+
skipAddingFilesFromTsConfig: true
|
|
23570
|
+
});
|
|
23571
|
+
for (const file of files) {
|
|
23572
|
+
project.addSourceFileAtPath(file);
|
|
23573
|
+
}
|
|
23574
|
+
const result = project.emitToMemory();
|
|
23575
|
+
const sourceFiles = result.getFiles();
|
|
23576
|
+
return sourceFiles;
|
|
23577
|
+
}
|
|
23578
|
+
}
|
|
23500
23579
|
};
|
|
23501
23580
|
ScanService2 = _ts_decorate7([
|
|
23502
23581
|
Kt(),
|
|
@@ -23706,7 +23785,7 @@ var WxmlService2 = class {
|
|
|
23706
23785
|
const wxml = await import_fs_extra8.default.readFile(filepath, "utf8");
|
|
23707
23786
|
const res = scanWxml(wxml, {
|
|
23708
23787
|
platform: this.configService.platform,
|
|
23709
|
-
...this.configService.
|
|
23788
|
+
...this.configService.weappViteConfig?.enhance?.wxml === true ? {} : this.configService.weappViteConfig?.enhance?.wxml
|
|
23710
23789
|
});
|
|
23711
23790
|
this.tokenMap.set(filepath, res);
|
|
23712
23791
|
await this.addDeps(filepath, res.deps.filter((x4) => isImportTag(x4.tagName) && isTemplate(x4.value)).map((x4) => import_pathe11.default.resolve(dirname3, x4.value)));
|
|
@@ -23882,9 +23961,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
|
|
|
23882
23961
|
});
|
|
23883
23962
|
await buildService.build();
|
|
23884
23963
|
if (!options.skipNpm) {
|
|
23885
|
-
await npmService.build(
|
|
23886
|
-
sourcemap: true
|
|
23887
|
-
});
|
|
23964
|
+
await npmService.build();
|
|
23888
23965
|
}
|
|
23889
23966
|
logBuildAppFinish();
|
|
23890
23967
|
if (options.open) {
|
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-6ZIOYCGJ.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();
|
|
@@ -756,9 +756,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
|
|
|
756
756
|
});
|
|
757
757
|
await buildService.build();
|
|
758
758
|
if (!options.skipNpm) {
|
|
759
|
-
await npmService.build(
|
|
760
|
-
sourcemap: true
|
|
761
|
-
});
|
|
759
|
+
await npmService.build();
|
|
762
760
|
}
|
|
763
761
|
logBuildAppFinish();
|
|
764
762
|
if (options.open) {
|
|
@@ -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';
|