weapp-vite 6.10.2 → 6.11.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/bin/bootstrap.js +97 -0
- package/bin/bootstrap.test.ts +63 -0
- package/bin/weapp-vite.js +8 -1
- package/client.d.ts +2 -0
- package/dist/auto-routes.mjs +2 -2
- package/dist/cli.mjs +90 -5
- package/dist/{config-BGf7mIXW.d.mts → config-mYISi4CS.d.mts} +43 -2
- package/dist/config.d.mts +1 -1
- package/dist/{createContext-Dzy3vlIP.mjs → createContext-B55TlVaK.mjs} +1563 -101
- package/dist/{file-DLpJ9tlX.mjs → file-UVjSUNS_.mjs} +2 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +4 -4
- package/dist/json.d.mts +1 -1
- package/dist/mcp.d.mts +1 -1
- package/dist/runtime.d.mts +2 -2
- package/dist/runtime.mjs +2 -2
- package/dist/types.d.mts +2 -2
- package/package.json +10 -9
package/bin/bootstrap.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
export function isPrepareCommand(argv) {
|
|
2
|
+
return Array.isArray(argv) && argv[0] === 'prepare'
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
function getGlobalProcess() {
|
|
6
|
+
return Reflect.get(globalThis, 'process')
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function formatPrepareSkipMessage(error) {
|
|
10
|
+
const message = error instanceof Error ? error.message : String(error)
|
|
11
|
+
return `[prepare] 跳过 .weapp-vite 支持文件预生成:${message}`
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function guardPrepareProcessExit(argv) {
|
|
15
|
+
if (!isPrepareCommand(argv)) {
|
|
16
|
+
return () => {}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const currentProcess = getGlobalProcess()
|
|
20
|
+
const originalExit = currentProcess.exit.bind(currentProcess)
|
|
21
|
+
const originalGlobalProcessDescriptor = Object.getOwnPropertyDescriptor(globalThis, 'process')
|
|
22
|
+
const forceSuccessExitCode = () => {
|
|
23
|
+
if (currentProcess.exitCode != null && Number(currentProcess.exitCode) !== 0) {
|
|
24
|
+
currentProcess.exitCode = 0
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const onBeforeExit = () => {
|
|
29
|
+
forceSuccessExitCode()
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
currentProcess.exit = () => {
|
|
33
|
+
currentProcess.exitCode = 0
|
|
34
|
+
return undefined
|
|
35
|
+
}
|
|
36
|
+
Object.defineProperty(globalThis, 'process', {
|
|
37
|
+
configurable: true,
|
|
38
|
+
enumerable: originalGlobalProcessDescriptor?.enumerable ?? false,
|
|
39
|
+
get() {
|
|
40
|
+
return new Proxy(currentProcess, {
|
|
41
|
+
get(target, property, receiver) {
|
|
42
|
+
if (property === 'exit') {
|
|
43
|
+
return target.exit
|
|
44
|
+
}
|
|
45
|
+
return Reflect.get(target, property, receiver)
|
|
46
|
+
},
|
|
47
|
+
set(target, property, value, receiver) {
|
|
48
|
+
if (property === 'exitCode') {
|
|
49
|
+
Reflect.set(target, property, value == null || Number(value) === 0 ? 0 : 0, receiver)
|
|
50
|
+
return true
|
|
51
|
+
}
|
|
52
|
+
return Reflect.set(target, property, value, receiver)
|
|
53
|
+
},
|
|
54
|
+
})
|
|
55
|
+
},
|
|
56
|
+
set(value) {
|
|
57
|
+
if (originalGlobalProcessDescriptor?.set) {
|
|
58
|
+
originalGlobalProcessDescriptor.set.call(globalThis, value)
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
})
|
|
62
|
+
currentProcess.on('beforeExit', onBeforeExit)
|
|
63
|
+
|
|
64
|
+
return () => {
|
|
65
|
+
currentProcess.exit = originalExit
|
|
66
|
+
currentProcess.off('beforeExit', onBeforeExit)
|
|
67
|
+
if (originalGlobalProcessDescriptor) {
|
|
68
|
+
Object.defineProperty(globalThis, 'process', originalGlobalProcessDescriptor)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export async function runWeappViteCLI(options = {}) {
|
|
74
|
+
const {
|
|
75
|
+
argv = getGlobalProcess().argv.slice(2),
|
|
76
|
+
importer = () => import('../dist/cli.mjs'),
|
|
77
|
+
write = message => getGlobalProcess().stderr.write(`\n WARN ${message}\n\n`),
|
|
78
|
+
} = options
|
|
79
|
+
const restorePrepareGuard = guardPrepareProcessExit(argv)
|
|
80
|
+
|
|
81
|
+
try {
|
|
82
|
+
await importer()
|
|
83
|
+
return true
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
if (isPrepareCommand(argv)) {
|
|
87
|
+
write(formatPrepareSkipMessage(error))
|
|
88
|
+
return false
|
|
89
|
+
}
|
|
90
|
+
throw error
|
|
91
|
+
}
|
|
92
|
+
finally {
|
|
93
|
+
if (!isPrepareCommand(argv)) {
|
|
94
|
+
restorePrepareGuard()
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest'
|
|
2
|
+
import { formatPrepareSkipMessage, guardPrepareProcessExit, runWeappViteCLI } from './bootstrap.js'
|
|
3
|
+
|
|
4
|
+
describe('bin bootstrap', () => {
|
|
5
|
+
it('guards process exit state for prepare at bin level', () => {
|
|
6
|
+
process.exitCode = 1
|
|
7
|
+
const restore = guardPrepareProcessExit(['prepare'])
|
|
8
|
+
|
|
9
|
+
process.exitCode = 2
|
|
10
|
+
expect(process.exitCode).toBe(0)
|
|
11
|
+
|
|
12
|
+
process.exit(3)
|
|
13
|
+
expect(process.exitCode).toBe(0)
|
|
14
|
+
|
|
15
|
+
// prepare keeps the guard for the current process lifetime
|
|
16
|
+
restore()
|
|
17
|
+
expect(process.exitCode).toBe(0)
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
it('swallows bootstrap failures for prepare', async () => {
|
|
21
|
+
const write = vi.fn()
|
|
22
|
+
const importer = vi.fn().mockRejectedValue(new Error('Cannot find module ../dist/cli.mjs'))
|
|
23
|
+
|
|
24
|
+
await expect(runWeappViteCLI({
|
|
25
|
+
argv: ['prepare'],
|
|
26
|
+
importer,
|
|
27
|
+
write,
|
|
28
|
+
})).resolves.toBe(false)
|
|
29
|
+
|
|
30
|
+
expect(write).toHaveBeenCalledWith(
|
|
31
|
+
'[prepare] 跳过 .weapp-vite 支持文件预生成:Cannot find module ../dist/cli.mjs',
|
|
32
|
+
)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it('keeps other commands failing during bootstrap', async () => {
|
|
36
|
+
const importer = vi.fn().mockRejectedValue(new Error('boom'))
|
|
37
|
+
|
|
38
|
+
await expect(runWeappViteCLI({
|
|
39
|
+
argv: ['build'],
|
|
40
|
+
importer,
|
|
41
|
+
})).rejects.toThrow('boom')
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
it('formats non-error values', () => {
|
|
45
|
+
expect(formatPrepareSkipMessage('boom')).toBe(
|
|
46
|
+
'[prepare] 跳过 .weapp-vite 支持文件预生成:boom',
|
|
47
|
+
)
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it('prevents async prepare importers from leaving a failure exit code behind', async () => {
|
|
51
|
+
process.exitCode = undefined
|
|
52
|
+
const importer = vi.fn().mockImplementation(async () => {
|
|
53
|
+
process.exitCode = 1
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
await expect(runWeappViteCLI({
|
|
57
|
+
argv: ['prepare'],
|
|
58
|
+
importer,
|
|
59
|
+
})).resolves.toBe(true)
|
|
60
|
+
|
|
61
|
+
expect(process.exitCode).toBe(0)
|
|
62
|
+
})
|
|
63
|
+
})
|
package/bin/weapp-vite.js
CHANGED
package/client.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ declare global {
|
|
|
42
42
|
type __WEAPP_APP_JSON__ = import('@weapp-core/schematics').App
|
|
43
43
|
type __WEAPP_PAGE_JSON__ = import('@weapp-core/schematics').Page
|
|
44
44
|
type __WEAPP_COMPONENT_JSON__ = import('@weapp-core/schematics').Component
|
|
45
|
+
type __WEAPP_PAGE_META__ = import('wevu').PageMeta
|
|
45
46
|
|
|
46
47
|
function defineAppJson(config: () => __WEAPP_APP_JSON__): () => __WEAPP_APP_JSON__
|
|
47
48
|
function defineAppJson(config: () => Promise<__WEAPP_APP_JSON__>): () => Promise<__WEAPP_APP_JSON__>
|
|
@@ -50,6 +51,7 @@ declare global {
|
|
|
50
51
|
function definePageJson(config: () => __WEAPP_PAGE_JSON__): () => __WEAPP_PAGE_JSON__
|
|
51
52
|
function definePageJson(config: () => Promise<__WEAPP_PAGE_JSON__>): () => Promise<__WEAPP_PAGE_JSON__>
|
|
52
53
|
function definePageJson(config: __WEAPP_PAGE_JSON__): __WEAPP_PAGE_JSON__
|
|
54
|
+
function definePageMeta(meta: __WEAPP_PAGE_META__): void
|
|
53
55
|
|
|
54
56
|
function defineComponentJson(config: () => __WEAPP_COMPONENT_JSON__): () => __WEAPP_COMPONENT_JSON__
|
|
55
57
|
function defineComponentJson(config: () => Promise<__WEAPP_COMPONENT_JSON__>): () => Promise<__WEAPP_COMPONENT_JSON__>
|
package/dist/auto-routes.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as getCompilerContext } from "./createContext-B55TlVaK.mjs";
|
|
2
2
|
import "./logger-gutcwWKE.mjs";
|
|
3
|
-
import "./file-
|
|
3
|
+
import "./file-UVjSUNS_.mjs";
|
|
4
4
|
//#region src/auto-routes.ts
|
|
5
5
|
const ROUTE_RUNTIME_OVERRIDE_KEY = Symbol.for("weapp-vite.route-runtime");
|
|
6
6
|
function createGetter(resolver) {
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as createCjsConfigLoadError, c as shouldBootstrapAutoImportWithoutGlobs, d as resolveMiniPlatform, f as createSharedBuildConfig, g as getProjectConfigFileName, h as checkRuntime, l as DEFAULT_MP_PLATFORM, m as resolveWeappConfigFile, n as syncManagedTsconfigBootstrapFiles, o as formatBytes, p as SHARED_CHUNK_VIRTUAL_PREFIX, r as syncManagedTsconfigFiles, s as findAutoImportCandidates, t as createCompilerContext, u as normalizeMiniPlatform, v as getAutoImportConfig, y as isPathInside } from "./createContext-B55TlVaK.mjs";
|
|
2
2
|
import { r as logger_default, t as colors } from "./logger-gutcwWKE.mjs";
|
|
3
|
-
import { f as VERSION } from "./file-
|
|
3
|
+
import { f as VERSION } from "./file-UVjSUNS_.mjs";
|
|
4
4
|
import { resolveWeappMcpConfig, startWeappViteMcpServer } from "./mcp.mjs";
|
|
5
5
|
import { defu } from "@weapp-core/shared";
|
|
6
6
|
import path, { posix } from "pathe";
|
|
@@ -429,7 +429,7 @@ async function startAnalyzeDashboard(result, options) {
|
|
|
429
429
|
//#endregion
|
|
430
430
|
//#region src/cli/options.ts
|
|
431
431
|
function filterDuplicateOptions(options) {
|
|
432
|
-
for (const [key, value] of Object.entries(options)) if (Array.isArray(value)) options[key] = value
|
|
432
|
+
for (const [key, value] of Object.entries(options)) if (Array.isArray(value)) options[key] = value.at(-1);
|
|
433
433
|
}
|
|
434
434
|
function resolveConfigFile(options) {
|
|
435
435
|
if (typeof options.config === "string") return options.config;
|
|
@@ -1094,6 +1094,47 @@ function registerOpenCommand(cli) {
|
|
|
1094
1094
|
});
|
|
1095
1095
|
}
|
|
1096
1096
|
//#endregion
|
|
1097
|
+
//#region src/cli/commands/prepare.ts
|
|
1098
|
+
function resolvePrepareRoot(input) {
|
|
1099
|
+
const values = Array.isArray(input) ? input.filter((item) => typeof item === "string" && item.length > 0) : [];
|
|
1100
|
+
if (values.length === 0) return ".";
|
|
1101
|
+
return (values[0] === "prepare" ? values.slice(1) : values)[0] ?? ".";
|
|
1102
|
+
}
|
|
1103
|
+
function formatPrepareSkipMessage$1(error) {
|
|
1104
|
+
return `跳过 .weapp-vite 支持文件预生成:${error instanceof Error ? error.message : String(error)}`;
|
|
1105
|
+
}
|
|
1106
|
+
function registerPrepareCommand(cli) {
|
|
1107
|
+
cli.command("prepare [...input]", "generate .weapp-vite support files").action(async (input, options) => {
|
|
1108
|
+
try {
|
|
1109
|
+
filterDuplicateOptions(options);
|
|
1110
|
+
const ctx = await createCompilerContext({
|
|
1111
|
+
cwd: path.resolve(resolvePrepareRoot(input)),
|
|
1112
|
+
isDev: false,
|
|
1113
|
+
mode: typeof options.mode === "string" ? options.mode : "development",
|
|
1114
|
+
configFile: resolveConfigFile(options)
|
|
1115
|
+
});
|
|
1116
|
+
await syncManagedTsconfigFiles(ctx);
|
|
1117
|
+
if (ctx.autoRoutesService.isEnabled()) await ctx.autoRoutesService.ensureFresh();
|
|
1118
|
+
const autoImportConfig = getAutoImportConfig(ctx.configService);
|
|
1119
|
+
if (autoImportConfig) {
|
|
1120
|
+
ctx.autoImportService.reset();
|
|
1121
|
+
const globs = autoImportConfig.globs;
|
|
1122
|
+
if (Array.isArray(globs) && globs.length > 0) {
|
|
1123
|
+
const files = await findAutoImportCandidates({
|
|
1124
|
+
ctx,
|
|
1125
|
+
resolvedConfig: { build: { outDir: ctx.configService.outDir } }
|
|
1126
|
+
}, globs);
|
|
1127
|
+
await Promise.all(files.map((file) => ctx.autoImportService.registerPotentialComponent(file)));
|
|
1128
|
+
} else if (!shouldBootstrapAutoImportWithoutGlobs(autoImportConfig)) logger_default.info("未检测到可预生成的 auto import 输出。");
|
|
1129
|
+
await ctx.autoImportService.awaitManifestWrites();
|
|
1130
|
+
}
|
|
1131
|
+
logger_default.info("已生成 .weapp-vite 支持文件。");
|
|
1132
|
+
} catch (error) {
|
|
1133
|
+
logger_default.warn(`[prepare] ${formatPrepareSkipMessage$1(error)}`);
|
|
1134
|
+
}
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
//#endregion
|
|
1097
1138
|
//#region src/cli/commands/serve.ts
|
|
1098
1139
|
function registerServeCommand(cli) {
|
|
1099
1140
|
cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--skipNpm", `[boolean] if skip npm build`).option("-o, --open", `[boolean] open ide`).option("-p, --platform <platform>", `[string] target platform (weapp | h5)`).option("--project-config <path>", `[string] project config path (miniprogram only)`).option("--host [host]", `[string] web dev server host`).option("--analyze", `[boolean] 启动分包分析仪表盘 (实验特性)`, { default: false }).action(async (root, options) => {
|
|
@@ -1298,6 +1339,20 @@ async function maybeAutoStartMcpServer(argv, cliOptions) {
|
|
|
1298
1339
|
}
|
|
1299
1340
|
}
|
|
1300
1341
|
//#endregion
|
|
1342
|
+
//#region src/cli/prepareGuard.ts
|
|
1343
|
+
function isPrepareCommandArgs(args) {
|
|
1344
|
+
return Array.isArray(args) && args[0] === "prepare";
|
|
1345
|
+
}
|
|
1346
|
+
function formatPrepareSkipMessage(error) {
|
|
1347
|
+
return `[prepare] 跳过 .weapp-vite 支持文件预生成:${error instanceof Error ? error.message : String(error)}`;
|
|
1348
|
+
}
|
|
1349
|
+
function handlePrepareLifecycleError(args, error) {
|
|
1350
|
+
if (!isPrepareCommandArgs(args)) return false;
|
|
1351
|
+
logger_default.warn(formatPrepareSkipMessage(error));
|
|
1352
|
+
process.exitCode = 0;
|
|
1353
|
+
return true;
|
|
1354
|
+
}
|
|
1355
|
+
//#endregion
|
|
1301
1356
|
//#region src/cli.ts
|
|
1302
1357
|
const cli = cac("weapp-vite");
|
|
1303
1358
|
try {
|
|
@@ -1313,18 +1368,48 @@ registerBuildCommand(cli);
|
|
|
1313
1368
|
registerAnalyzeCommand(cli);
|
|
1314
1369
|
registerInitCommand(cli);
|
|
1315
1370
|
registerOpenCommand(cli);
|
|
1371
|
+
registerPrepareCommand(cli);
|
|
1316
1372
|
registerNpmCommand(cli);
|
|
1317
1373
|
registerGenerateCommand(cli);
|
|
1318
1374
|
registerMcpCommand(cli);
|
|
1319
1375
|
cli.help();
|
|
1320
1376
|
cli.version(VERSION);
|
|
1377
|
+
const skipManagedTsconfigBootstrapCommands = new Set([
|
|
1378
|
+
"g",
|
|
1379
|
+
"generate",
|
|
1380
|
+
"init",
|
|
1381
|
+
"mcp",
|
|
1382
|
+
"npm"
|
|
1383
|
+
]);
|
|
1384
|
+
function resolveManagedTsconfigBootstrapRoot(args) {
|
|
1385
|
+
const [firstArg, secondArg] = args;
|
|
1386
|
+
if (!firstArg || firstArg === "--help" || firstArg === "-h" || firstArg === "--version" || firstArg === "-v") return;
|
|
1387
|
+
if (firstArg.startsWith("-")) return process.cwd();
|
|
1388
|
+
if (skipManagedTsconfigBootstrapCommands.has(firstArg)) return;
|
|
1389
|
+
if ([
|
|
1390
|
+
"analyze",
|
|
1391
|
+
"build",
|
|
1392
|
+
"dev",
|
|
1393
|
+
"open",
|
|
1394
|
+
"prepare",
|
|
1395
|
+
"serve"
|
|
1396
|
+
].includes(firstArg)) {
|
|
1397
|
+
if (secondArg && !secondArg.startsWith("-")) return path.resolve(secondArg);
|
|
1398
|
+
return process.cwd();
|
|
1399
|
+
}
|
|
1400
|
+
return path.resolve(firstArg);
|
|
1401
|
+
}
|
|
1321
1402
|
try {
|
|
1322
1403
|
Promise.resolve().then(async () => {
|
|
1323
|
-
|
|
1404
|
+
const args = process.argv.slice(2);
|
|
1405
|
+
if (await tryRunIdeCommand(args)) return;
|
|
1406
|
+
const managedTsconfigBootstrapRoot = resolveManagedTsconfigBootstrapRoot(args);
|
|
1407
|
+
if (managedTsconfigBootstrapRoot) await syncManagedTsconfigBootstrapFiles(managedTsconfigBootstrapRoot);
|
|
1324
1408
|
cli.parse(process.argv, { run: false });
|
|
1325
|
-
await maybeAutoStartMcpServer(
|
|
1409
|
+
await maybeAutoStartMcpServer(args, cli.options);
|
|
1326
1410
|
await cli.runMatchedCommand();
|
|
1327
1411
|
}).catch((error) => {
|
|
1412
|
+
if (handlePrepareLifecycleError(process.argv.slice(2), error)) return;
|
|
1328
1413
|
handleCLIError(error);
|
|
1329
1414
|
process.exitCode = 1;
|
|
1330
1415
|
});
|
|
@@ -10,7 +10,7 @@ import { Buffer } from "node:buffer";
|
|
|
10
10
|
import { PluginOptions } from "vite-tsconfig-paths";
|
|
11
11
|
import { WrapPluginOptions } from "vite-plugin-performance";
|
|
12
12
|
import PQueue from "p-queue";
|
|
13
|
-
import { ComputedDefinitions as ComputedDefinitions$1, MethodDefinitions as MethodDefinitions$1, Ref, WevuDefaults } from "wevu";
|
|
13
|
+
import { ComputedDefinitions as ComputedDefinitions$1, MethodDefinitions as MethodDefinitions$1, PageLayoutMeta, Ref, WevuDefaults } from "wevu";
|
|
14
14
|
import { App, App as App$1, Component, Component as Component$1, GenerateType, Page, Page as Page$1, Plugin, Sitemap, Sitemap as Sitemap$1, Theme, Theme as Theme$1 } from "@weapp-core/schematics";
|
|
15
15
|
import { CompilerOptions } from "typescript";
|
|
16
16
|
import { WeappWebPluginOptions } from "@weapp-vite/web/plugin";
|
|
@@ -192,6 +192,37 @@ interface WeappWebConfig {
|
|
|
192
192
|
pluginOptions?: Partial<Omit<WeappWebPluginOptions, 'srcDir'>>;
|
|
193
193
|
vite?: InlineConfig;
|
|
194
194
|
}
|
|
195
|
+
interface WeappManagedSharedTsconfigConfig {
|
|
196
|
+
compilerOptions?: CompilerOptions;
|
|
197
|
+
include?: string[];
|
|
198
|
+
exclude?: string[];
|
|
199
|
+
files?: string[];
|
|
200
|
+
}
|
|
201
|
+
interface WeappManagedAppTsconfigConfig {
|
|
202
|
+
compilerOptions?: CompilerOptions;
|
|
203
|
+
vueCompilerOptions?: Record<string, any>;
|
|
204
|
+
include?: string[];
|
|
205
|
+
exclude?: string[];
|
|
206
|
+
files?: string[];
|
|
207
|
+
}
|
|
208
|
+
interface WeappManagedNodeTsconfigConfig {
|
|
209
|
+
compilerOptions?: CompilerOptions;
|
|
210
|
+
include?: string[];
|
|
211
|
+
exclude?: string[];
|
|
212
|
+
files?: string[];
|
|
213
|
+
}
|
|
214
|
+
interface WeappManagedServerTsconfigConfig {
|
|
215
|
+
compilerOptions?: CompilerOptions;
|
|
216
|
+
include?: string[];
|
|
217
|
+
exclude?: string[];
|
|
218
|
+
files?: string[];
|
|
219
|
+
}
|
|
220
|
+
interface WeappManagedTypeScriptConfig {
|
|
221
|
+
shared?: WeappManagedSharedTsconfigConfig;
|
|
222
|
+
app?: WeappManagedAppTsconfigConfig;
|
|
223
|
+
node?: WeappManagedNodeTsconfigConfig;
|
|
224
|
+
server?: WeappManagedServerTsconfigConfig;
|
|
225
|
+
}
|
|
195
226
|
interface WeappLibEntryContext {
|
|
196
227
|
name: string;
|
|
197
228
|
input: string;
|
|
@@ -234,6 +265,9 @@ interface NpmSubPackageConfig {
|
|
|
234
265
|
interface NpmMainPackageConfig {
|
|
235
266
|
dependencies?: false | (string | RegExp)[];
|
|
236
267
|
}
|
|
268
|
+
interface NpmPluginPackageConfig {
|
|
269
|
+
dependencies?: false | (string | RegExp)[];
|
|
270
|
+
}
|
|
237
271
|
type JsFormat = 'cjs' | 'esm';
|
|
238
272
|
type SharedChunkStrategy = 'hoist' | 'duplicate';
|
|
239
273
|
type SharedChunkMode = 'common' | 'path' | 'inline';
|
|
@@ -385,6 +419,7 @@ interface WeappNpmConfig {
|
|
|
385
419
|
enable?: boolean;
|
|
386
420
|
cache?: boolean;
|
|
387
421
|
mainPackage?: NpmMainPackageConfig;
|
|
422
|
+
pluginPackage?: NpmPluginPackageConfig;
|
|
388
423
|
subPackages?: Record<string, NpmSubPackageConfig>;
|
|
389
424
|
buildOptions?: (options: NpmBuildOptions, pkgMeta: BuildNpmPackageMeta) => NpmBuildOptions | undefined;
|
|
390
425
|
alipayNpmMode?: AlipayNpmMode;
|
|
@@ -442,6 +477,10 @@ interface WeappWevuConfig {
|
|
|
442
477
|
defaults?: WevuDefaults;
|
|
443
478
|
autoSetDataPick?: boolean;
|
|
444
479
|
}
|
|
480
|
+
interface WeappRouteRule {
|
|
481
|
+
appLayout?: PageLayoutMeta;
|
|
482
|
+
}
|
|
483
|
+
type WeappRouteRules = Record<string, WeappRouteRule>;
|
|
445
484
|
//#endregion
|
|
446
485
|
//#region src/types/config/main.d.ts
|
|
447
486
|
/**
|
|
@@ -501,6 +540,7 @@ interface WeappViteConfig {
|
|
|
501
540
|
subPackages?: Record<string, WeappSubPackageConfig>;
|
|
502
541
|
copy?: CopyOptions;
|
|
503
542
|
web?: WeappWebConfig;
|
|
543
|
+
typescript?: WeappManagedTypeScriptConfig;
|
|
504
544
|
lib?: WeappLibConfig;
|
|
505
545
|
isAdditionalWxml?: (wxmlFilePath: string) => boolean;
|
|
506
546
|
platform?: MpPlatform;
|
|
@@ -520,6 +560,7 @@ interface WeappViteConfig {
|
|
|
520
560
|
worker?: WeappWorkerConfig;
|
|
521
561
|
vue?: WeappVueConfig;
|
|
522
562
|
wevu?: WeappWevuConfig;
|
|
563
|
+
routeRules?: WeappRouteRules;
|
|
523
564
|
injectWeapi?: boolean | WeappInjectWeapiConfig;
|
|
524
565
|
mcp?: boolean | WeappMcpConfig;
|
|
525
566
|
chunks?: ChunksConfig;
|
|
@@ -1397,4 +1438,4 @@ declare function defineConfig(config: UserConfigFnPromise): UserConfigFnPromise;
|
|
|
1397
1438
|
declare function defineConfig(config: UserConfigFn): UserConfigFn;
|
|
1398
1439
|
declare function defineConfig(config: UserConfigLoose): UserConfigLoose;
|
|
1399
1440
|
//#endregion
|
|
1400
|
-
export { WeappDebugConfig as $,
|
|
1441
|
+
export { WeappDebugConfig as $, ResolvedAlias as $t, Ref as A, GenerateExtensionsOptions as At, BindingErrorLike as B, GenerateTemplateScope as Bt, LoadConfigOptions as C, WeappViteHostMeta as Cn, AliasOptions as Ct, MethodDefinitions$1 as D, isWeappViteHost as Dn, CopyGlobs as Dt, InlineConfig$1 as E, createWeappViteHostMeta as En, ChunksConfig as Et, RolldownPlugin as F, GenerateTemplateContext as Ft, EntryJsonFragment as G, JsonMergeFunction as Gt, BaseEntry as H, JsFormat as Ht, RolldownPluginOption as I, GenerateTemplateEntry as It, ScanComponentItem as J, MpPlatform as Jt, PageEntry as K, JsonMergeStage as Kt, RolldownWatchOptions as L, GenerateTemplateFactory as Lt, RolldownBuild as M, GenerateFilenamesOptions as Mt, RolldownOptions as N, GenerateOptions as Nt, Plugin$1 as O, resolveWeappViteHostMeta as On, CopyOptions as Ot, RolldownOutput$1 as P, GenerateTemplate as Pt, UserConfig$2 as Q, NpmSubPackageConfig as Qt, RolldownWatcher$1 as R, GenerateTemplateFileSource as Rt, CompilerContext as S, WEAPP_VITE_HOST_NAME as Sn, Alias as St, ConfigEnv$1 as T, applyWeappViteHostMeta as Tn, BuildNpmPackageMeta as Tt, ComponentEntry as U, JsonConfig as Ut, AppEntry as V, GenerateTemplatesConfig as Vt, Entry as W, JsonMergeContext as Wt, ProjectConfig as X, NpmMainPackageConfig as Xt, WxmlDep as Y, NpmBuildOptions as Yt, SubPackageMetaValue as Z, NpmPluginPackageConfig as Zt, definePageJson as _, WeappManagedNodeTsconfigConfig as _n, WeappSubPackageConfig as _t, UserConfigFnNoEnvPlain as a, SubPackageStyleConfigEntry as an, HandleWxmlOptions as at, ChangeEvent as b, WeappManagedTypeScriptConfig as bn, WeappWevuConfig as bt, UserConfigFnPromise as c, SubPackageStyleScope as cn, WeappAutoRoutesConfig as ct, Component$1 as d, WeappLibDtsOptions as dn, WeappHmrConfig as dt, SharedChunkDynamicImports as en, WeappViteConfig as et, Page$1 as f, WeappLibEntryContext as fn, WeappInjectWeapiConfig as ft, defineComponentJson as g, WeappManagedAppTsconfigConfig as gn, WeappRouteRules as gt, defineAppJson as h, WeappLibVueTscOptions as hn, WeappRouteRule as ht, UserConfigFnNoEnv as i, SubPackage as in, EnhanceWxmlOptions as it, ResolvedConfig as j, GenerateFileType as jt, PluginOption as k, GenerateDirsOptions as kt, defineConfig as l, WeappLibComponentJson as ln, WeappAutoRoutesInclude as lt, Theme$1 as m, WeappLibInternalDtsOptions as mn, WeappNpmConfig as mt, UserConfigExport as n, SharedChunkOverride as nn, AutoImportComponentsOption as nt, UserConfigFnObject as o, SubPackageStyleConfigObject as on, MultiPlatformConfig as ot, Sitemap$1 as p, WeappLibFileName as pn, WeappMcpConfig as pt, ComponentsMap as q, JsonMergeStrategy as qt, UserConfigFn as r, SharedChunkStrategy as rn, EnhanceOptions as rt, UserConfigFnObjectPlain as s, SubPackageStyleEntry as sn, ScanWxmlOptions as st, UserConfig$1 as t, SharedChunkMode as tn, AutoImportComponents as tt, App$1 as u, WeappLibConfig as un, WeappAutoRoutesIncludePattern as ut, defineSitemapJson as v, WeappManagedServerTsconfigConfig as vn, WeappVueConfig as vt, ComputedDefinitions$1 as w, WeappViteRuntime as wn, AlipayNpmMode as wt, WeappVitePluginApi as x, WeappWebConfig as xn, WeappWorkerConfig as xt, defineThemeJson as y, WeappManagedSharedTsconfigConfig as yn, WeappVueTemplateConfig as yt, ViteDevServer$1 as z, GenerateTemplateInlineSource as zt };
|
package/dist/config.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Cn as WeappViteHostMeta, Dn as isWeappViteHost, En as createWeappViteHostMeta, On as resolveWeappViteHostMeta, Sn as WEAPP_VITE_HOST_NAME, Tn as applyWeappViteHostMeta, _ as definePageJson, a as UserConfigFnNoEnvPlain, c as UserConfigFnPromise, d as Component, et as WeappViteConfig, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, l as defineConfig, m as Theme, n as UserConfigExport, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, wn as WeappViteRuntime, y as defineThemeJson } from "./config-mYISi4CS.mjs";
|
|
2
2
|
export { App, Component, Page, Sitemap, Theme, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnNoEnv, UserConfigFnNoEnvPlain, UserConfigFnObject, UserConfigFnObjectPlain, UserConfigFnPromise, WEAPP_VITE_HOST_NAME, WeappViteConfig, WeappViteHostMeta, WeappViteRuntime, applyWeappViteHostMeta, createWeappViteHostMeta, defineAppJson, defineComponentJson, defineConfig, definePageJson, defineSitemapJson, defineThemeJson, isWeappViteHost, resolveWeappViteHostMeta };
|