weapp-vite 6.6.16 → 6.7.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/README.md +34 -0
- package/dist/auto-import-components/resolvers.mjs +1 -1
- package/dist/auto-routes.mjs +6 -5
- package/dist/{chunk-B72N3LPV.mjs → chunk-6BLAPZPG.mjs} +2 -2
- package/dist/chunk-6Y4CQBGL.mjs +9911 -0
- package/dist/{chunk-ZK6BEHJG.mjs → chunk-BHF4WHJX.mjs} +1 -1
- package/dist/{chunk-V5CB4KLU.mjs → chunk-EH3FR4SH.mjs} +43 -21
- package/dist/{chunk-YITJ3DB4.mjs → chunk-GTITIIY3.mjs} +7 -2
- package/dist/{chunk-2UZR3XO5.mjs → chunk-KLC6AUWO.mjs} +1 -1
- package/dist/{chunk-IUSUEHMM.mjs → chunk-O2ZCPWFG.mjs} +1 -1
- package/dist/{chunk-LG2VJAAT.mjs → chunk-V4HJMXPN.mjs} +1 -1
- package/dist/chunk-WFHC5POL.mjs +14 -0
- package/dist/{chunk-TJSTTJPE.mjs → chunk-ZVO7KLQN.mjs} +2 -2
- package/dist/cli.mjs +108 -12
- package/dist/{config-CdeM_u7y.d.ts → config-D2DJI97q.d.ts} +42 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.mjs +3 -3
- package/dist/{file-PYPD7TKF.mjs → file-X2RHLBMQ.mjs} +2 -2
- package/dist/{getInstance-FERU3SZV.mjs → getInstance-LGESJJFX.mjs} +4 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +12 -11
- package/dist/json.d.ts +1 -1
- package/dist/json.mjs +2 -2
- package/dist/mcp.d.ts +47 -0
- package/dist/mcp.mjs +18 -0
- package/dist/runtime.mjs +2 -2
- package/dist/types.d.ts +1 -1
- package/dist/types.mjs +2 -2
- package/dist/volar.mjs +1 -1
- package/package.json +9 -4
|
@@ -14,12 +14,16 @@ import {
|
|
|
14
14
|
templateExtensions,
|
|
15
15
|
touch,
|
|
16
16
|
vueExtensions
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-ZVO7KLQN.mjs";
|
|
18
|
+
import {
|
|
19
|
+
configureLogger,
|
|
20
|
+
default as default2
|
|
21
|
+
} from "./chunk-WFHC5POL.mjs";
|
|
18
22
|
import {
|
|
19
23
|
__commonJS,
|
|
20
24
|
__toESM,
|
|
21
25
|
init_esm_shims
|
|
22
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-GTITIIY3.mjs";
|
|
23
27
|
|
|
24
28
|
// ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/debug.js
|
|
25
29
|
var require_debug = __commonJS({
|
|
@@ -1928,11 +1932,6 @@ function createDebugger(namespace) {
|
|
|
1928
1932
|
}
|
|
1929
1933
|
}
|
|
1930
1934
|
|
|
1931
|
-
// src/logger.ts
|
|
1932
|
-
init_esm_shims();
|
|
1933
|
-
import { default as default2 } from "@weapp-core/logger";
|
|
1934
|
-
import { colors, configureLogger } from "@weapp-core/logger";
|
|
1935
|
-
|
|
1936
1935
|
// src/context/shared.ts
|
|
1937
1936
|
var debug = createDebugger("weapp-vite:context");
|
|
1938
1937
|
function resolvedComponentName(entry) {
|
|
@@ -24460,16 +24459,6 @@ function resolveBuiltinPackageAliases() {
|
|
|
24460
24459
|
replacement: resolvedEntry
|
|
24461
24460
|
});
|
|
24462
24461
|
}
|
|
24463
|
-
const weappViteInfo = getPackageInfoSync("weapp-vite");
|
|
24464
|
-
if (weappViteInfo) {
|
|
24465
|
-
const autoRoutesSource = path37.resolve(weappViteInfo.rootPath, "src/auto-routes.ts");
|
|
24466
|
-
if (existsSync(autoRoutesSource)) {
|
|
24467
|
-
aliases.push({
|
|
24468
|
-
find: "weapp-vite/auto-routes",
|
|
24469
|
-
replacement: autoRoutesSource
|
|
24470
|
-
});
|
|
24471
|
-
}
|
|
24472
|
-
}
|
|
24473
24462
|
return aliases;
|
|
24474
24463
|
}
|
|
24475
24464
|
|
|
@@ -24562,6 +24551,13 @@ function getWeappViteConfig() {
|
|
|
24562
24551
|
sharedChunks: "auto",
|
|
24563
24552
|
touchAppWxss: "auto"
|
|
24564
24553
|
},
|
|
24554
|
+
mcp: {
|
|
24555
|
+
enabled: true,
|
|
24556
|
+
autoStart: false,
|
|
24557
|
+
host: "127.0.0.1",
|
|
24558
|
+
port: 3088,
|
|
24559
|
+
endpoint: "/mcp"
|
|
24560
|
+
},
|
|
24565
24561
|
chunks: {
|
|
24566
24562
|
sharedStrategy: "duplicate",
|
|
24567
24563
|
sharedMode: "common",
|
|
@@ -25642,6 +25638,29 @@ var RESOLVED_VIRTUAL_ID = "\0weapp-vite:auto-routes";
|
|
|
25642
25638
|
function createAutoRoutesPlugin(ctx) {
|
|
25643
25639
|
const service = ctx.autoRoutesService;
|
|
25644
25640
|
let resolvedConfig;
|
|
25641
|
+
const autoRoutesAliasTargets = /* @__PURE__ */ new Set();
|
|
25642
|
+
const normalizeTargetId = (id) => {
|
|
25643
|
+
return path43.normalize(normalizeFsResolvedId(id));
|
|
25644
|
+
};
|
|
25645
|
+
const refreshAutoRoutesAliasTargets = () => {
|
|
25646
|
+
autoRoutesAliasTargets.clear();
|
|
25647
|
+
const packageRoot = ctx.configService?.packageInfo?.rootPath;
|
|
25648
|
+
if (!packageRoot) {
|
|
25649
|
+
return;
|
|
25650
|
+
}
|
|
25651
|
+
const candidates = [
|
|
25652
|
+
path43.resolve(packageRoot, "src/auto-routes.ts"),
|
|
25653
|
+
path43.resolve(packageRoot, "auto-routes.ts"),
|
|
25654
|
+
path43.resolve(packageRoot, "dist/auto-routes.mjs"),
|
|
25655
|
+
path43.resolve(packageRoot, "dist/auto-routes.js")
|
|
25656
|
+
];
|
|
25657
|
+
for (const candidate of candidates) {
|
|
25658
|
+
autoRoutesAliasTargets.add(path43.normalize(candidate));
|
|
25659
|
+
}
|
|
25660
|
+
};
|
|
25661
|
+
const isAliasedAutoRoutesId = (id) => {
|
|
25662
|
+
return autoRoutesAliasTargets.has(normalizeTargetId(id));
|
|
25663
|
+
};
|
|
25645
25664
|
const addWatchTargets = (pluginCtx) => {
|
|
25646
25665
|
for (const file of service.getWatchFiles()) {
|
|
25647
25666
|
try {
|
|
@@ -25680,9 +25699,11 @@ function createAutoRoutesPlugin(ctx) {
|
|
|
25680
25699
|
enforce: "pre",
|
|
25681
25700
|
configResolved(config) {
|
|
25682
25701
|
resolvedConfig = config;
|
|
25702
|
+
refreshAutoRoutesAliasTargets();
|
|
25683
25703
|
},
|
|
25684
25704
|
async buildStart() {
|
|
25685
25705
|
await service.ensureFresh();
|
|
25706
|
+
refreshAutoRoutesAliasTargets();
|
|
25686
25707
|
addWatchTargets(this);
|
|
25687
25708
|
},
|
|
25688
25709
|
resolveId(id) {
|
|
@@ -25692,10 +25713,13 @@ function createAutoRoutesPlugin(ctx) {
|
|
|
25692
25713
|
if (id === RESOLVED_VIRTUAL_ID) {
|
|
25693
25714
|
return RESOLVED_VIRTUAL_ID;
|
|
25694
25715
|
}
|
|
25716
|
+
if (isAliasedAutoRoutesId(id)) {
|
|
25717
|
+
return RESOLVED_VIRTUAL_ID;
|
|
25718
|
+
}
|
|
25695
25719
|
return null;
|
|
25696
25720
|
},
|
|
25697
25721
|
async load(id) {
|
|
25698
|
-
if (id !== RESOLVED_VIRTUAL_ID) {
|
|
25722
|
+
if (id !== RESOLVED_VIRTUAL_ID && !isAliasedAutoRoutesId(id)) {
|
|
25699
25723
|
return null;
|
|
25700
25724
|
}
|
|
25701
25725
|
await service.ensureFresh();
|
|
@@ -37297,7 +37321,7 @@ function createScanService(ctx) {
|
|
|
37297
37321
|
vueAppPath = await findVueEntry(appBasename);
|
|
37298
37322
|
}
|
|
37299
37323
|
if (!appConfigFile && vueAppPath) {
|
|
37300
|
-
const { extractConfigFromVue: extractConfigFromVue2 } = await import("./file-
|
|
37324
|
+
const { extractConfigFromVue: extractConfigFromVue2 } = await import("./file-X2RHLBMQ.mjs");
|
|
37301
37325
|
configFromVue = await extractConfigFromVue2(vueAppPath);
|
|
37302
37326
|
if (configFromVue) {
|
|
37303
37327
|
appConfigFile = vueAppPath;
|
|
@@ -37843,8 +37867,6 @@ function resetCompilerContext(key) {
|
|
|
37843
37867
|
}
|
|
37844
37868
|
|
|
37845
37869
|
export {
|
|
37846
|
-
default2 as default,
|
|
37847
|
-
colors,
|
|
37848
37870
|
isPathInside,
|
|
37849
37871
|
createCjsConfigLoadError,
|
|
37850
37872
|
getProjectConfigFileName,
|
|
@@ -10,6 +10,10 @@ var __esm = (fn, res) => function __init() {
|
|
|
10
10
|
var __commonJS = (cb, mod) => function __require() {
|
|
11
11
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
12
|
};
|
|
13
|
+
var __export = (target, all) => {
|
|
14
|
+
for (var name in all)
|
|
15
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
|
+
};
|
|
13
17
|
var __copyProps = (to, from, except, desc) => {
|
|
14
18
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
19
|
for (let key of __getOwnPropNames(from))
|
|
@@ -27,17 +31,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
31
|
mod
|
|
28
32
|
));
|
|
29
33
|
|
|
30
|
-
// ../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.57.6_@types+node@25.3.
|
|
34
|
+
// ../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.57.6_@types+node@25.3.3__@swc+core@1.15.18_jiti@2_32f1cf8abfc79a928ff84be2ee9fbc37/node_modules/tsup/assets/esm_shims.js
|
|
31
35
|
import path from "path";
|
|
32
36
|
import { fileURLToPath } from "url";
|
|
33
37
|
var init_esm_shims = __esm({
|
|
34
|
-
"../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.57.6_@types+node@25.3.
|
|
38
|
+
"../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.57.6_@types+node@25.3.3__@swc+core@1.15.18_jiti@2_32f1cf8abfc79a928ff84be2ee9fbc37/node_modules/tsup/assets/esm_shims.js"() {
|
|
35
39
|
"use strict";
|
|
36
40
|
}
|
|
37
41
|
});
|
|
38
42
|
|
|
39
43
|
export {
|
|
40
44
|
__commonJS,
|
|
45
|
+
__export,
|
|
41
46
|
__toESM,
|
|
42
47
|
init_esm_shims
|
|
43
48
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_esm_shims
|
|
3
|
+
} from "./chunk-GTITIIY3.mjs";
|
|
4
|
+
|
|
5
|
+
// src/logger.ts
|
|
6
|
+
init_esm_shims();
|
|
7
|
+
import { default as default2 } from "@weapp-core/logger";
|
|
8
|
+
import { colors, configureLogger } from "@weapp-core/logger";
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
default2 as default,
|
|
12
|
+
colors,
|
|
13
|
+
configureLogger
|
|
14
|
+
};
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
__commonJS,
|
|
3
3
|
__toESM,
|
|
4
4
|
init_esm_shims
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-GTITIIY3.mjs";
|
|
6
6
|
|
|
7
7
|
// ../../node_modules/.pnpm/merge@2.1.1/node_modules/merge/lib/src/index.js
|
|
8
8
|
var require_src = __commonJS({
|
|
@@ -145,7 +145,7 @@ function resolveAutoRoutesMacroImportPath() {
|
|
|
145
145
|
}
|
|
146
146
|
async function resolveAutoRoutesInlineSnapshot() {
|
|
147
147
|
try {
|
|
148
|
-
const { getCompilerContext } = await import("./getInstance-
|
|
148
|
+
const { getCompilerContext } = await import("./getInstance-LGESJJFX.mjs");
|
|
149
149
|
const service = getCompilerContext().autoRoutesService;
|
|
150
150
|
await service?.ensureFresh?.();
|
|
151
151
|
const reference = service?.getReference?.();
|
package/dist/cli.mjs
CHANGED
|
@@ -1,30 +1,36 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCompilerContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6BLAPZPG.mjs";
|
|
4
4
|
import {
|
|
5
5
|
DEFAULT_MP_PLATFORM,
|
|
6
6
|
SHARED_CHUNK_VIRTUAL_PREFIX,
|
|
7
7
|
checkRuntime,
|
|
8
|
-
colors,
|
|
9
8
|
createCjsConfigLoadError,
|
|
10
9
|
createSharedBuildConfig,
|
|
11
|
-
default as default2,
|
|
12
10
|
getProjectConfigFileName,
|
|
13
11
|
isPathInside,
|
|
14
12
|
normalizeMiniPlatform,
|
|
15
13
|
resolveMiniPlatform,
|
|
16
14
|
resolveWeappConfigFile
|
|
17
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-EH3FR4SH.mjs";
|
|
18
16
|
import {
|
|
19
17
|
VERSION
|
|
20
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-ZVO7KLQN.mjs";
|
|
19
|
+
import {
|
|
20
|
+
resolveWeappMcpConfig,
|
|
21
|
+
startWeappViteMcpServer
|
|
22
|
+
} from "./chunk-6Y4CQBGL.mjs";
|
|
23
|
+
import {
|
|
24
|
+
colors,
|
|
25
|
+
default as default2
|
|
26
|
+
} from "./chunk-WFHC5POL.mjs";
|
|
21
27
|
import {
|
|
22
28
|
init_esm_shims
|
|
23
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-GTITIIY3.mjs";
|
|
24
30
|
|
|
25
31
|
// src/cli.ts
|
|
26
32
|
init_esm_shims();
|
|
27
|
-
import
|
|
33
|
+
import process10 from "process";
|
|
28
34
|
|
|
29
35
|
// ../../node_modules/.pnpm/cac@6.7.14/node_modules/cac/dist/index.mjs
|
|
30
36
|
init_esm_shims();
|
|
@@ -2065,6 +2071,33 @@ function registerInitCommand(cli2) {
|
|
|
2065
2071
|
});
|
|
2066
2072
|
}
|
|
2067
2073
|
|
|
2074
|
+
// src/cli/commands/mcp.ts
|
|
2075
|
+
init_esm_shims();
|
|
2076
|
+
function resolvePort(port) {
|
|
2077
|
+
if (typeof port === "number" && Number.isInteger(port)) {
|
|
2078
|
+
return port;
|
|
2079
|
+
}
|
|
2080
|
+
if (typeof port === "string" && port.trim()) {
|
|
2081
|
+
const parsed = Number.parseInt(port, 10);
|
|
2082
|
+
if (Number.isInteger(parsed)) {
|
|
2083
|
+
return parsed;
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
}
|
|
2087
|
+
function registerMcpCommand(cli2) {
|
|
2088
|
+
cli2.command("mcp", "start weapp-vite MCP server").option("--transport <type>", "[string] stdio | streamable-http", { default: "stdio" }).option("--host <host>", "[string] streamable-http host").option("--port <port>", "[number] streamable-http port").option("--endpoint <path>", "[string] streamable-http endpoint path").option("--unref", "[boolean] unref HTTP server to not block process exit").option("--workspace-root <path>", "[string] workspace root path, defaults to auto detect from cwd").action(async (options) => {
|
|
2089
|
+
const { startWeappViteMcpServer: startWeappViteMcpServer2 } = await import("./mcp.mjs");
|
|
2090
|
+
await startWeappViteMcpServer2({
|
|
2091
|
+
endpoint: options.endpoint,
|
|
2092
|
+
host: options.host,
|
|
2093
|
+
port: resolvePort(options.port),
|
|
2094
|
+
transport: options.transport,
|
|
2095
|
+
unref: options.unref,
|
|
2096
|
+
workspaceRoot: options.workspaceRoot
|
|
2097
|
+
});
|
|
2098
|
+
});
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2068
2101
|
// src/cli/commands/npm.ts
|
|
2069
2102
|
init_esm_shims();
|
|
2070
2103
|
import { parse as parse2 } from "weapp-ide-cli";
|
|
@@ -2274,7 +2307,8 @@ var WEAPP_VITE_NATIVE_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
2274
2307
|
"build:npm",
|
|
2275
2308
|
"build-npm",
|
|
2276
2309
|
"generate",
|
|
2277
|
-
"g"
|
|
2310
|
+
"g",
|
|
2311
|
+
"mcp"
|
|
2278
2312
|
]);
|
|
2279
2313
|
async function tryRunIdeCommand(argv) {
|
|
2280
2314
|
const command = argv[0];
|
|
@@ -2303,6 +2337,66 @@ async function tryRunIdeCommand(argv) {
|
|
|
2303
2337
|
return true;
|
|
2304
2338
|
}
|
|
2305
2339
|
|
|
2340
|
+
// src/cli/mcpAutoStart.ts
|
|
2341
|
+
init_esm_shims();
|
|
2342
|
+
import process9 from "process";
|
|
2343
|
+
var SKIP_COMMANDS = /* @__PURE__ */ new Set([
|
|
2344
|
+
"--help",
|
|
2345
|
+
"--version",
|
|
2346
|
+
"-h",
|
|
2347
|
+
"-v",
|
|
2348
|
+
"help",
|
|
2349
|
+
"ide",
|
|
2350
|
+
"mcp"
|
|
2351
|
+
]);
|
|
2352
|
+
var started = false;
|
|
2353
|
+
function shouldAutoStartMcp(argv) {
|
|
2354
|
+
const command = argv[0];
|
|
2355
|
+
if (!command || command.startsWith("-")) {
|
|
2356
|
+
return true;
|
|
2357
|
+
}
|
|
2358
|
+
return !SKIP_COMMANDS.has(command);
|
|
2359
|
+
}
|
|
2360
|
+
async function maybeAutoStartMcpServer(argv, cliOptions) {
|
|
2361
|
+
if (started || !shouldAutoStartMcp(argv)) {
|
|
2362
|
+
return;
|
|
2363
|
+
}
|
|
2364
|
+
const configFile = resolveConfigFile(cliOptions);
|
|
2365
|
+
let rawMcpConfig;
|
|
2366
|
+
try {
|
|
2367
|
+
const loaded = await loadConfig(configFile);
|
|
2368
|
+
rawMcpConfig = loaded?.config?.weapp?.mcp;
|
|
2369
|
+
} catch (error) {
|
|
2370
|
+
default2.warn(`[mcp] \u8BFB\u53D6\u914D\u7F6E\u5931\u8D25\uFF0C\u4F7F\u7528\u9ED8\u8BA4 MCP \u914D\u7F6E\u81EA\u52A8\u542F\u52A8\uFF1A${error instanceof Error ? error.message : String(error)}`);
|
|
2371
|
+
}
|
|
2372
|
+
const maybeMcpConfig = rawMcpConfig;
|
|
2373
|
+
const resolvedMcp = resolveWeappMcpConfig(maybeMcpConfig);
|
|
2374
|
+
if (!resolvedMcp.enabled || !resolvedMcp.autoStart) {
|
|
2375
|
+
return;
|
|
2376
|
+
}
|
|
2377
|
+
try {
|
|
2378
|
+
await startWeappViteMcpServer({
|
|
2379
|
+
endpoint: resolvedMcp.endpoint,
|
|
2380
|
+
host: resolvedMcp.host,
|
|
2381
|
+
port: resolvedMcp.port,
|
|
2382
|
+
quiet: true,
|
|
2383
|
+
transport: "streamable-http",
|
|
2384
|
+
unref: true,
|
|
2385
|
+
workspaceRoot: process9.cwd()
|
|
2386
|
+
});
|
|
2387
|
+
started = true;
|
|
2388
|
+
default2.info(`[mcp] \u5DF2\u81EA\u52A8\u542F\u52A8\uFF1Ahttp://${resolvedMcp.host}:${resolvedMcp.port}${resolvedMcp.endpoint}`);
|
|
2389
|
+
} catch (error) {
|
|
2390
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
2391
|
+
if (/EADDRINUSE/.test(message)) {
|
|
2392
|
+
default2.info(`[mcp] \u7AEF\u53E3 ${resolvedMcp.port} \u5DF2\u88AB\u5360\u7528\uFF0C\u8DF3\u8FC7\u81EA\u52A8\u542F\u52A8\u3002`);
|
|
2393
|
+
started = true;
|
|
2394
|
+
return;
|
|
2395
|
+
}
|
|
2396
|
+
default2.warn(`[mcp] \u81EA\u52A8\u542F\u52A8\u5931\u8D25\uFF1A${message}`);
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
|
|
2306
2400
|
// src/cli.ts
|
|
2307
2401
|
var cli = cac("weapp-vite");
|
|
2308
2402
|
try {
|
|
@@ -2323,21 +2417,23 @@ registerInitCommand(cli);
|
|
|
2323
2417
|
registerOpenCommand(cli);
|
|
2324
2418
|
registerNpmCommand(cli);
|
|
2325
2419
|
registerGenerateCommand(cli);
|
|
2420
|
+
registerMcpCommand(cli);
|
|
2326
2421
|
cli.help();
|
|
2327
2422
|
cli.version(VERSION);
|
|
2328
2423
|
try {
|
|
2329
2424
|
Promise.resolve().then(async () => {
|
|
2330
|
-
const forwarded = await tryRunIdeCommand(
|
|
2425
|
+
const forwarded = await tryRunIdeCommand(process10.argv.slice(2));
|
|
2331
2426
|
if (forwarded) {
|
|
2332
2427
|
return;
|
|
2333
2428
|
}
|
|
2334
|
-
cli.parse(
|
|
2429
|
+
cli.parse(process10.argv, { run: false });
|
|
2430
|
+
await maybeAutoStartMcpServer(process10.argv.slice(2), cli.options);
|
|
2335
2431
|
await cli.runMatchedCommand();
|
|
2336
2432
|
}).catch((error) => {
|
|
2337
2433
|
handleCLIError(error);
|
|
2338
|
-
|
|
2434
|
+
process10.exitCode = 1;
|
|
2339
2435
|
});
|
|
2340
2436
|
} catch (error) {
|
|
2341
2437
|
handleCLIError(error);
|
|
2342
|
-
|
|
2438
|
+
process10.exitCode = 1;
|
|
2343
2439
|
}
|
|
@@ -497,6 +497,33 @@ interface MultiPlatformConfig {
|
|
|
497
497
|
*/
|
|
498
498
|
projectConfigRoot?: string;
|
|
499
499
|
}
|
|
500
|
+
interface WeappMcpConfig {
|
|
501
|
+
/**
|
|
502
|
+
* @description 是否启用 MCP 能力
|
|
503
|
+
* @default true
|
|
504
|
+
*/
|
|
505
|
+
enabled?: boolean;
|
|
506
|
+
/**
|
|
507
|
+
* @description 是否在 weapp-vite CLI 启动时自动拉起 MCP HTTP 服务
|
|
508
|
+
* @default false
|
|
509
|
+
*/
|
|
510
|
+
autoStart?: boolean;
|
|
511
|
+
/**
|
|
512
|
+
* @description MCP HTTP 服务监听主机
|
|
513
|
+
* @default '127.0.0.1'
|
|
514
|
+
*/
|
|
515
|
+
host?: string;
|
|
516
|
+
/**
|
|
517
|
+
* @description MCP HTTP 服务监听端口
|
|
518
|
+
* @default 3088
|
|
519
|
+
*/
|
|
520
|
+
port?: number;
|
|
521
|
+
/**
|
|
522
|
+
* @description MCP HTTP 接口路径
|
|
523
|
+
* @default '/mcp'
|
|
524
|
+
*/
|
|
525
|
+
endpoint?: string;
|
|
526
|
+
}
|
|
500
527
|
interface WeappViteConfig {
|
|
501
528
|
/**
|
|
502
529
|
* 应用入口目录(`app.json` 所在目录)。
|
|
@@ -829,6 +856,20 @@ interface WeappViteConfig {
|
|
|
829
856
|
*/
|
|
830
857
|
globalName?: string;
|
|
831
858
|
};
|
|
859
|
+
/**
|
|
860
|
+
* @description MCP 服务配置
|
|
861
|
+
* - `false`:完全关闭 MCP(包含自动启动)
|
|
862
|
+
* - `true`:启用默认 MCP 配置
|
|
863
|
+
* - `object`:细粒度配置
|
|
864
|
+
* @default { enabled: true, autoStart: false, host: '127.0.0.1', port: 3088, endpoint: '/mcp' }
|
|
865
|
+
* @example
|
|
866
|
+
* mcp: false
|
|
867
|
+
* @example
|
|
868
|
+
* mcp: { enabled: true, autoStart: false }
|
|
869
|
+
* @example
|
|
870
|
+
* mcp: { host: '127.0.0.1', port: 3199, endpoint: '/mcp' }
|
|
871
|
+
*/
|
|
872
|
+
mcp?: boolean | WeappMcpConfig;
|
|
832
873
|
/**
|
|
833
874
|
* @description 共享代码拆分策略配置
|
|
834
875
|
*/
|
|
@@ -1372,4 +1413,4 @@ declare function defineConfig(config: UserConfigFnPromise): UserConfigFnPromise;
|
|
|
1372
1413
|
declare function defineConfig(config: UserConfigFn): UserConfigFn;
|
|
1373
1414
|
declare function defineConfig(config: UserConfigLoose): UserConfigLoose;
|
|
1374
1415
|
|
|
1375
|
-
export { type
|
|
1416
|
+
export { type JsonMergeFunction as $, type Alias as A, type BaseEntry as B, type CompilerContext as C, type EnhanceWxmlOptions as D, type EnhanceOptions as E, type Entry as F, type EntryJsonFragment as G, type GenerateDirsOptions as H, type GenerateExtensionsOptions as I, type GenerateFileType as J, type GenerateFilenamesOptions as K, type LoadConfigOptions as L, type GenerateOptions as M, type GenerateTemplate as N, type GenerateTemplateContext as O, type GenerateTemplateEntry as P, type GenerateTemplateFactory as Q, type GenerateTemplateFileSource as R, type GenerateTemplateInlineSource as S, type GenerateTemplateScope as T, type UserConfig as U, type GenerateTemplatesConfig as V, type WeappViteConfig as W, type HandleWxmlOptions as X, type JsFormat as Y, type JsonConfig as Z, type JsonMergeContext as _, type UserConfigExport as a, type JsonMergeStage as a0, type JsonMergeStrategy as a1, type MpPlatform as a2, type MultiPlatformConfig as a3, type NpmBuildOptions as a4, type PageEntry as a5, type ProjectConfig as a6, type ResolvedAlias as a7, type ScanComponentItem as a8, type ScanWxmlOptions as a9, type SharedChunkDynamicImports as aa, type SharedChunkMode as ab, type SharedChunkOverride as ac, type SharedChunkStrategy as ad, type SubPackage as ae, type SubPackageMetaValue as af, type SubPackageStyleConfigEntry as ag, type SubPackageStyleConfigObject as ah, type SubPackageStyleEntry as ai, type SubPackageStyleScope as aj, type UserConfig$1 as ak, type WeappLibComponentJson as al, type WeappLibConfig as am, type WeappLibDtsOptions as an, type WeappLibEntryContext as ao, type WeappLibFileName as ap, type WeappLibInternalDtsOptions as aq, type WeappLibVueTscOptions as ar, type WeappVitePluginApi as as, type WeappWebConfig as at, type WxmlDep as au, type UserConfigFn as b, type UserConfigFnNoEnv as c, type UserConfigFnNoEnvPlain as d, type UserConfigFnObject as e, type UserConfigFnObjectPlain as f, type UserConfigFnPromise as g, defineAppJson as h, defineComponentJson as i, defineConfig as j, definePageJson as k, defineSitemapJson as l, defineThemeJson as m, type WeappMcpConfig as n, type AliasOptions as o, type AlipayNpmMode as p, type AppEntry as q, type AutoImportComponents as r, type AutoImportComponentsOption as s, type BuildNpmPackageMeta as t, type ChangeEvent as u, type ChunksConfig as v, type ComponentEntry as w, type ComponentsMap as x, type CopyGlobs as y, type CopyOptions as z };
|
package/dist/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'vite';
|
|
2
|
-
export { U as UserConfig, a as UserConfigExport, b as UserConfigFn, c as UserConfigFnNoEnv, d as UserConfigFnNoEnvPlain, e as UserConfigFnObject, f as UserConfigFnObjectPlain, g as UserConfigFnPromise, W as WeappViteConfig, h as defineAppJson, i as defineComponentJson, j as defineConfig, k as definePageJson, l as defineSitemapJson, m as defineThemeJson } from './config-
|
|
2
|
+
export { U as UserConfig, a as UserConfigExport, b as UserConfigFn, c as UserConfigFnNoEnv, d as UserConfigFnNoEnvPlain, e as UserConfigFnObject, f as UserConfigFnObjectPlain, g as UserConfigFnPromise, W as WeappViteConfig, h as defineAppJson, i as defineComponentJson, j as defineConfig, k as definePageJson, l as defineSitemapJson, m as defineThemeJson } from './config-D2DJI97q.js';
|
|
3
3
|
export { App, Component, Page, Sitemap, Theme } from '@weapp-core/schematics';
|
|
4
4
|
import '@weapp-vite/web';
|
|
5
5
|
import 'rolldown';
|
package/dist/config.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BHF4WHJX.mjs";
|
|
4
4
|
import {
|
|
5
5
|
defineAppJson,
|
|
6
6
|
defineComponentJson,
|
|
7
7
|
definePageJson,
|
|
8
8
|
defineSitemapJson,
|
|
9
9
|
defineThemeJson
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-O2ZCPWFG.mjs";
|
|
11
|
+
import "./chunk-GTITIIY3.mjs";
|
|
12
12
|
export {
|
|
13
13
|
defineAppJson,
|
|
14
14
|
defineComponentJson,
|
|
@@ -4,9 +4,10 @@ import {
|
|
|
4
4
|
getCompilerContext,
|
|
5
5
|
resetCompilerContext,
|
|
6
6
|
setActiveCompilerContextKey
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-EH3FR4SH.mjs";
|
|
8
|
+
import "./chunk-ZVO7KLQN.mjs";
|
|
9
|
+
import "./chunk-WFHC5POL.mjs";
|
|
10
|
+
import "./chunk-GTITIIY3.mjs";
|
|
10
11
|
export {
|
|
11
12
|
createCompilerContext,
|
|
12
13
|
getActiveCompilerContextKey,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LoadConfigOptions, C as CompilerContext } from './config-
|
|
2
|
-
export { U as UserConfig, a as UserConfigExport, b as UserConfigFn, c as UserConfigFnNoEnv, d as UserConfigFnNoEnvPlain, e as UserConfigFnObject, f as UserConfigFnObjectPlain, g as UserConfigFnPromise, W as WeappViteConfig, h as defineAppJson, i as defineComponentJson, j as defineConfig, k as definePageJson, l as defineSitemapJson, m as defineThemeJson } from './config-
|
|
1
|
+
import { L as LoadConfigOptions, C as CompilerContext } from './config-D2DJI97q.js';
|
|
2
|
+
export { U as UserConfig, a as UserConfigExport, b as UserConfigFn, c as UserConfigFnNoEnv, d as UserConfigFnNoEnvPlain, e as UserConfigFnObject, f as UserConfigFnObjectPlain, g as UserConfigFnPromise, W as WeappViteConfig, h as defineAppJson, i as defineComponentJson, j as defineConfig, k as definePageJson, l as defineSitemapJson, m as defineThemeJson } from './config-D2DJI97q.js';
|
|
3
3
|
export { WevuComponentOptions, defineEmits, defineProps } from './runtime.js';
|
|
4
4
|
export { RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, WatchOptions as RolldownWatchOptions, RolldownWatcher } from 'rolldown';
|
|
5
5
|
export { ConfigEnv, InlineConfig, Plugin, PluginOption, ResolvedConfig, ViteDevServer } from 'vite';
|
package/dist/index.mjs
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-KLC6AUWO.mjs";
|
|
2
2
|
import {
|
|
3
3
|
createCompilerContext
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
defineProps
|
|
8
|
-
} from "./chunk-LG2VJAAT.mjs";
|
|
9
|
-
import "./chunk-V5CB4KLU.mjs";
|
|
10
|
-
import "./chunk-TJSTTJPE.mjs";
|
|
4
|
+
} from "./chunk-6BLAPZPG.mjs";
|
|
5
|
+
import "./chunk-EH3FR4SH.mjs";
|
|
6
|
+
import "./chunk-ZVO7KLQN.mjs";
|
|
11
7
|
import {
|
|
12
8
|
defineConfig
|
|
13
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-BHF4WHJX.mjs";
|
|
14
10
|
import {
|
|
15
11
|
defineAppJson,
|
|
16
12
|
defineComponentJson,
|
|
17
13
|
definePageJson,
|
|
18
14
|
defineSitemapJson,
|
|
19
15
|
defineThemeJson
|
|
20
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-O2ZCPWFG.mjs";
|
|
17
|
+
import {
|
|
18
|
+
defineEmits,
|
|
19
|
+
defineProps
|
|
20
|
+
} from "./chunk-V4HJMXPN.mjs";
|
|
21
|
+
import "./chunk-WFHC5POL.mjs";
|
|
21
22
|
import {
|
|
22
23
|
init_esm_shims
|
|
23
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-GTITIIY3.mjs";
|
|
24
25
|
|
|
25
26
|
// src/index.ts
|
|
26
27
|
init_esm_shims();
|
package/dist/json.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { App, Component, Page, Sitemap, Theme } from '@weapp-core/schematics';
|
|
2
|
-
export { h as defineAppJson, i as defineComponentJson, k as definePageJson, l as defineSitemapJson, m as defineThemeJson } from './config-
|
|
2
|
+
export { h as defineAppJson, i as defineComponentJson, k as definePageJson, l as defineSitemapJson, m as defineThemeJson } from './config-D2DJI97q.js';
|
|
3
3
|
import 'vite';
|
|
4
4
|
import '@weapp-vite/web';
|
|
5
5
|
import 'rolldown';
|
package/dist/json.mjs
CHANGED
package/dist/mcp.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CreateServerOptions } from '@weapp-vite/mcp';
|
|
2
|
+
export { CreateServerOptions, createWeappViteMcpServer } from '@weapp-vite/mcp';
|
|
3
|
+
import { n as WeappMcpConfig } from './config-D2DJI97q.js';
|
|
4
|
+
import 'vite';
|
|
5
|
+
import '@weapp-core/schematics';
|
|
6
|
+
import '@weapp-vite/web';
|
|
7
|
+
import 'rolldown';
|
|
8
|
+
import 'rolldown-plugin-dts';
|
|
9
|
+
import 'typescript';
|
|
10
|
+
import 'vite-plugin-performance';
|
|
11
|
+
import 'vite-tsconfig-paths';
|
|
12
|
+
import 'wevu';
|
|
13
|
+
import './types-B6irZnLM.js';
|
|
14
|
+
import '@weapp-core/logger';
|
|
15
|
+
import 'p-queue';
|
|
16
|
+
import 'package-manager-detector';
|
|
17
|
+
import 'pkg-types';
|
|
18
|
+
import 'node:buffer';
|
|
19
|
+
import 'lru-cache';
|
|
20
|
+
import './routes-C9hKJjXs.js';
|
|
21
|
+
|
|
22
|
+
declare const DEFAULT_MCP_HOST = "127.0.0.1";
|
|
23
|
+
declare const DEFAULT_MCP_PORT = 3088;
|
|
24
|
+
declare const DEFAULT_MCP_ENDPOINT = "/mcp";
|
|
25
|
+
interface ResolvedWeappMcpConfig {
|
|
26
|
+
enabled: boolean;
|
|
27
|
+
autoStart: boolean;
|
|
28
|
+
host: string;
|
|
29
|
+
port: number;
|
|
30
|
+
endpoint: string;
|
|
31
|
+
}
|
|
32
|
+
interface WeappViteMcpServerOptions extends CreateServerOptions {
|
|
33
|
+
transport?: 'stdio' | 'streamable-http';
|
|
34
|
+
host?: string;
|
|
35
|
+
port?: number;
|
|
36
|
+
endpoint?: string;
|
|
37
|
+
unref?: boolean;
|
|
38
|
+
quiet?: boolean;
|
|
39
|
+
}
|
|
40
|
+
interface WeappViteMcpServerHandle {
|
|
41
|
+
transport: 'stdio' | 'streamable-http';
|
|
42
|
+
close?: () => Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
declare function resolveWeappMcpConfig(config?: boolean | WeappMcpConfig): ResolvedWeappMcpConfig;
|
|
45
|
+
declare function startWeappViteMcpServer(options?: WeappViteMcpServerOptions): Promise<WeappViteMcpServerHandle>;
|
|
46
|
+
|
|
47
|
+
export { DEFAULT_MCP_ENDPOINT, DEFAULT_MCP_HOST, DEFAULT_MCP_PORT, type ResolvedWeappMcpConfig, type WeappViteMcpServerHandle, type WeappViteMcpServerOptions, resolveWeappMcpConfig, startWeappViteMcpServer };
|