weapp-vite 6.9.1 → 6.10.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/auto-import-components/resolvers.d.mts +1 -1
- package/dist/auto-routes.d.mts +1 -1
- package/dist/auto-routes.mjs +5 -2
- package/dist/cli.mjs +33 -25
- package/dist/{config-CZVIK2bS.d.mts → config-BGf7mIXW.d.mts} +6 -2
- package/dist/config.d.mts +1 -1
- package/dist/{getInstance-CQOUmSp7.mjs → createContext-DUM1udUE.mjs} +246 -87
- package/dist/{file-DDOGj0wV.mjs → file-DT8nNo0D.mjs} +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +2 -3
- package/dist/json.d.mts +1 -1
- package/dist/mcp.d.mts +1 -1
- package/dist/types.d.mts +3 -3
- package/package.json +7 -21
- package/dist/createContext-BXXqwq78.mjs +0 -19
- package/modules/analyze-dashboard/assets/echarts.js +0 -17
- package/modules/analyze-dashboard/assets/index.css +0 -2
- package/modules/analyze-dashboard/assets/index.js +0 -1
- package/modules/analyze-dashboard/assets/rolldown-runtime.js +0 -1
- package/modules/analyze-dashboard/assets/vue.js +0 -1
- package/modules/analyze-dashboard/index.html +0 -13
- /package/dist/{index-B5wBsuYI.d.mts → index-BQqQ_BLM.d.mts} +0 -0
- /package/dist/{routes-o20IHwXa.d.mts → routes-DUBjYF43.d.mts} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ExternalMetadataFileCandidates, c as Resolver, d as ResolverObject, i as CreateResolver, l as ResolverFn, n as VantResolver, o as Options, r as TDesignResolver, s as ResolvedValue, t as WeuiResolver, u as ResolverMeta } from "../index-
|
|
1
|
+
import { a as ExternalMetadataFileCandidates, c as Resolver, d as ResolverObject, i as CreateResolver, l as ResolverFn, n as VantResolver, o as Options, r as TDesignResolver, s as ResolvedValue, t as WeuiResolver, u as ResolverMeta } from "../index-BQqQ_BLM.mjs";
|
|
2
2
|
export { CreateResolver, ExternalMetadataFileCandidates, Options, ResolvedValue, Resolver, ResolverFn, ResolverMeta, ResolverObject, TDesignResolver, VantResolver, WeuiResolver };
|
package/dist/auto-routes.d.mts
CHANGED
package/dist/auto-routes.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as getCompilerContext } from "./createContext-DUM1udUE.mjs";
|
|
2
2
|
import "./logger-gutcwWKE.mjs";
|
|
3
|
-
import "./file-
|
|
3
|
+
import "./file-DT8nNo0D.mjs";
|
|
4
4
|
//#region src/auto-routes.ts
|
|
5
|
+
const ROUTE_RUNTIME_OVERRIDE_KEY = Symbol.for("weapp-vite.route-runtime");
|
|
5
6
|
function createGetter(resolver) {
|
|
6
7
|
return {
|
|
7
8
|
configurable: false,
|
|
@@ -27,6 +28,8 @@ const entries = routes.entries;
|
|
|
27
28
|
const subPackages = routes.subPackages;
|
|
28
29
|
function resolveMiniProgramGlobal() {
|
|
29
30
|
const runtime = globalThis;
|
|
31
|
+
const overrideRuntime = runtime[ROUTE_RUNTIME_OVERRIDE_KEY];
|
|
32
|
+
if (overrideRuntime) return overrideRuntime;
|
|
30
33
|
return runtime.wx ?? runtime.tt ?? runtime.my;
|
|
31
34
|
}
|
|
32
35
|
function callRouteMethod(methodName, option) {
|
package/dist/cli.mjs
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as DEFAULT_MP_PLATFORM, c as createSharedBuildConfig, d as checkRuntime, f as getProjectConfigFileName, i as formatBytes, l as SHARED_CHUNK_VIRTUAL_PREFIX, m as isPathInside, o as normalizeMiniPlatform, p as createCjsConfigLoadError, s as resolveMiniPlatform, t as createCompilerContext, u as resolveWeappConfigFile } from "./createContext-DUM1udUE.mjs";
|
|
2
2
|
import { r as logger_default, t as colors } from "./logger-gutcwWKE.mjs";
|
|
3
|
-
import { f as VERSION } from "./file-
|
|
4
|
-
import { t as createCompilerContext } from "./createContext-BXXqwq78.mjs";
|
|
3
|
+
import { f as VERSION } from "./file-DT8nNo0D.mjs";
|
|
5
4
|
import { resolveWeappMcpConfig, startWeappViteMcpServer } from "./mcp.mjs";
|
|
6
5
|
import { defu } from "@weapp-core/shared";
|
|
7
6
|
import path, { posix } from "pathe";
|
|
8
|
-
import { dirname, join } from "node:path";
|
|
9
7
|
import fs from "fs-extra";
|
|
10
8
|
import process from "node:process";
|
|
11
|
-
import { fileURLToPath } from "node:url";
|
|
12
9
|
import { build, createServer, loadConfigFromFile } from "vite";
|
|
10
|
+
import { getPackageInfoSync } from "local-pkg";
|
|
13
11
|
import { Buffer } from "node:buffer";
|
|
12
|
+
import fs$1 from "node:fs";
|
|
14
13
|
import { cac } from "cac";
|
|
15
14
|
import { resolveCommand } from "package-manager-detector/commands";
|
|
16
15
|
import { formatRetryHotkeyPrompt, formatWechatIdeLoginRequiredError, isWeappIdeTopLevelCommand, isWechatIdeLoginRequiredError, parse, waitForRetryKeypress } from "weapp-ide-cli";
|
|
@@ -310,24 +309,20 @@ async function analyzeSubpackages(ctx) {
|
|
|
310
309
|
};
|
|
311
310
|
}
|
|
312
311
|
//#endregion
|
|
313
|
-
//#region src/packagePaths.ts
|
|
314
|
-
function findPackageRoot(from) {
|
|
315
|
-
let current = from;
|
|
316
|
-
while (true) {
|
|
317
|
-
if (fs.existsSync(join(current, "package.json"))) return current;
|
|
318
|
-
const parent = dirname(current);
|
|
319
|
-
if (parent === current) break;
|
|
320
|
-
current = parent;
|
|
321
|
-
}
|
|
322
|
-
throw new Error("无法定位 weapp-vite 包根目录,请检查安装路径。");
|
|
323
|
-
}
|
|
324
|
-
const ANALYZE_DASHBOARD_ROOT = join(findPackageRoot(dirname(fileURLToPath(import.meta.url))), "modules/analyze-dashboard");
|
|
325
|
-
//#endregion
|
|
326
312
|
//#region src/cli/analyze/dashboard.ts
|
|
327
313
|
const ANALYZE_GLOBAL_KEY = "__WEAPP_VITE_ANALYZE_RESULT__";
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
314
|
+
const ANALYZE_DASHBOARD_PACKAGE_NAME = "@weapp-vite/dashboard";
|
|
315
|
+
function createInstallCommand(agent) {
|
|
316
|
+
const resolved = resolveCommand(agent ?? "npm", "install", [ANALYZE_DASHBOARD_PACKAGE_NAME]);
|
|
317
|
+
if (!resolved) return `npm install ${ANALYZE_DASHBOARD_PACKAGE_NAME}`;
|
|
318
|
+
return `${resolved.command} ${resolved.args.join(" ")}`;
|
|
319
|
+
}
|
|
320
|
+
function resolveDashboardRoot(options) {
|
|
321
|
+
const packageInfo = getPackageInfoSync(ANALYZE_DASHBOARD_PACKAGE_NAME, { paths: options?.cwd ? [options.cwd] : void 0 });
|
|
322
|
+
const dashboardRoot = packageInfo ? path.resolve(packageInfo.rootPath, "dist") : void 0;
|
|
323
|
+
if (dashboardRoot && fs$1.existsSync(dashboardRoot)) return { root: dashboardRoot };
|
|
324
|
+
logger_default.warn(`[weapp-vite analyze] 未安装可选仪表盘包 ${colors.bold(colors.green(ANALYZE_DASHBOARD_PACKAGE_NAME))},已自动降级关闭 dashboard 能力。`);
|
|
325
|
+
logger_default.info(`如需启用,请执行 ${colors.bold(colors.green(createInstallCommand(options?.packageManagerAgent)))}`);
|
|
331
326
|
}
|
|
332
327
|
function createAnalyzeHtmlPlugin(state, onServerInstance) {
|
|
333
328
|
return {
|
|
@@ -374,7 +369,9 @@ async function waitForServerExit(server) {
|
|
|
374
369
|
});
|
|
375
370
|
}
|
|
376
371
|
async function startAnalyzeDashboard(result, options) {
|
|
377
|
-
const
|
|
372
|
+
const resolved = resolveDashboardRoot(options);
|
|
373
|
+
if (!resolved) return;
|
|
374
|
+
const { root } = resolved;
|
|
378
375
|
const state = { current: result };
|
|
379
376
|
let serverRef;
|
|
380
377
|
const server = await createServer({
|
|
@@ -662,7 +659,10 @@ function registerAnalyzeCommand(cli) {
|
|
|
662
659
|
if (!writtenPath) process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
663
660
|
} else {
|
|
664
661
|
printAnalysisSummary(result);
|
|
665
|
-
await startAnalyzeDashboard(result
|
|
662
|
+
await startAnalyzeDashboard(result, {
|
|
663
|
+
cwd: ctx.configService.cwd,
|
|
664
|
+
packageManagerAgent: ctx.configService.packageManager.agent
|
|
665
|
+
});
|
|
666
666
|
}
|
|
667
667
|
} catch (error) {
|
|
668
668
|
logger_default.error(error);
|
|
@@ -825,7 +825,11 @@ function registerBuildCommand(cli) {
|
|
|
825
825
|
subPackageMap: ctx.scanService?.subPackageMap,
|
|
826
826
|
warningBytes: configService.weappViteConfig.packageSizeWarningBytes
|
|
827
827
|
});
|
|
828
|
-
if (enableAnalyze) analyzeHandle = await startAnalyzeDashboard(await analyzeSubpackages(ctx), {
|
|
828
|
+
if (enableAnalyze) analyzeHandle = await startAnalyzeDashboard(await analyzeSubpackages(ctx), {
|
|
829
|
+
watch: true,
|
|
830
|
+
cwd: configService.cwd,
|
|
831
|
+
packageManagerAgent: configService.packageManager.agent
|
|
832
|
+
}) ?? void 0;
|
|
829
833
|
}
|
|
830
834
|
const webConfig = configService.weappWebConfig;
|
|
831
835
|
if (targets.runWeb && webConfig?.enabled) try {
|
|
@@ -1128,7 +1132,11 @@ function registerServeCommand(cli) {
|
|
|
1128
1132
|
if (targets.runMini) {
|
|
1129
1133
|
const buildResult = await buildService.build(options);
|
|
1130
1134
|
if (enableAnalyze) {
|
|
1131
|
-
analyzeHandle = await startAnalyzeDashboard(await analyzeSubpackages(ctx), {
|
|
1135
|
+
analyzeHandle = await startAnalyzeDashboard(await analyzeSubpackages(ctx), {
|
|
1136
|
+
watch: true,
|
|
1137
|
+
cwd: configService.cwd,
|
|
1138
|
+
packageManagerAgent: configService.packageManager.agent
|
|
1139
|
+
}) ?? void 0;
|
|
1132
1140
|
if (analyzeHandle && buildResult && typeof buildResult.on === "function") {
|
|
1133
1141
|
const watcher = buildResult;
|
|
1134
1142
|
let updating = false;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as Resolver, s as ResolvedValue } from "./index-
|
|
2
|
-
import { t as AutoRoutes } from "./routes-
|
|
1
|
+
import { c as Resolver, s as ResolvedValue } from "./index-BQqQ_BLM.mjs";
|
|
2
|
+
import { t as AutoRoutes } from "./routes-DUBjYF43.mjs";
|
|
3
3
|
import { LRUCache } from "lru-cache";
|
|
4
4
|
import { LoggerConfig } from "@weapp-core/logger";
|
|
5
5
|
import { WeappAstConfig } from "@weapp-vite/ast";
|
|
@@ -936,6 +936,7 @@ interface LoadConfigOptions {
|
|
|
936
936
|
cwd: string;
|
|
937
937
|
isDev: boolean;
|
|
938
938
|
mode: string;
|
|
939
|
+
pluginOnly?: boolean;
|
|
939
940
|
inlineConfig?: InlineConfig;
|
|
940
941
|
configFile?: string;
|
|
941
942
|
cliPlatform?: string;
|
|
@@ -960,6 +961,7 @@ interface LoadConfigResult {
|
|
|
960
961
|
packageJsonPath: string;
|
|
961
962
|
platform: MpPlatform;
|
|
962
963
|
srcRoot: string;
|
|
964
|
+
pluginOnly?: boolean;
|
|
963
965
|
configFilePath?: string;
|
|
964
966
|
currentSubPackageRoot?: string;
|
|
965
967
|
weappWeb?: ResolvedWeappWebConfig;
|
|
@@ -1006,6 +1008,7 @@ interface ConfigService {
|
|
|
1006
1008
|
readonly projectConfigPath?: string;
|
|
1007
1009
|
readonly projectPrivateConfigPath?: string;
|
|
1008
1010
|
readonly srcRoot: string;
|
|
1011
|
+
readonly pluginOnly: boolean;
|
|
1009
1012
|
readonly pluginRoot: string | undefined;
|
|
1010
1013
|
readonly absolutePluginRoot: string | undefined;
|
|
1011
1014
|
readonly absolutePluginOutputRoot: string | undefined;
|
|
@@ -1288,6 +1291,7 @@ interface AutoImportService {
|
|
|
1288
1291
|
resolve: (componentName: string, importerBaseName?: string) => AutoImportMatch | undefined;
|
|
1289
1292
|
filter: (id: string, meta?: SubPackageMetaValue) => boolean;
|
|
1290
1293
|
getRegisteredLocalComponents: () => LocalAutoImportMatch[];
|
|
1294
|
+
awaitPendingRegistrations?: () => Promise<void>;
|
|
1291
1295
|
awaitManifestWrites: () => Promise<void>;
|
|
1292
1296
|
}
|
|
1293
1297
|
//#endregion
|
package/dist/config.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as definePageJson, _n as applyWeappViteHostMeta, a as UserConfigFnNoEnvPlain, bn as resolveWeappViteHostMeta, c as UserConfigFnPromise, d as Component, et as WeappViteConfig, f as Page, g as defineComponentJson, gn as WeappViteRuntime, h as defineAppJson, hn as WeappViteHostMeta, i as UserConfigFnNoEnv, l as defineConfig, m as Theme, mn as WEAPP_VITE_HOST_NAME, n as UserConfigExport, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, vn as createWeappViteHostMeta, y as defineThemeJson, yn as isWeappViteHost } from "./config-
|
|
1
|
+
import { _ as definePageJson, _n as applyWeappViteHostMeta, a as UserConfigFnNoEnvPlain, bn as resolveWeappViteHostMeta, c as UserConfigFnPromise, d as Component, et as WeappViteConfig, f as Page, g as defineComponentJson, gn as WeappViteRuntime, h as defineAppJson, hn as WeappViteHostMeta, i as UserConfigFnNoEnv, l as defineConfig, m as Theme, mn as WEAPP_VITE_HOST_NAME, n as UserConfigExport, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, vn as createWeappViteHostMeta, y as defineThemeJson, yn as isWeappViteHost } from "./config-BGf7mIXW.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 };
|