weapp-vite 7.0.4 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auto-routes.mjs +1 -1
- package/dist/cli.mjs +48 -18
- package/dist/{config-CauTwk-D.d.mts → config-CgTp6kSh.d.mts} +12 -4
- package/dist/config.d.mts +1 -1
- package/dist/{createContext-yEgPVvkx.mjs → createContext-CjNVaqAp.mjs} +12216 -9045
- package/dist/docs/weapp-config.md +8 -2
- package/dist/{file-Wzy2lXLu.mjs → file-9RDnJeq9.mjs} +10 -5
- package/dist/file-BS_wmEe4.mjs +2 -0
- package/dist/getInstance-wlc8j1Bg.mjs +2 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/json.d.mts +1 -1
- package/dist/mcp.d.mts +1 -1
- package/dist/test.mjs +1 -1
- package/dist/types.d.mts +1 -1
- package/package.json +19 -18
- package/dist/file-DvrWhjGO.mjs +0 -2
- package/dist/getInstance-BkbjqprX.mjs +0 -2
package/dist/auto-routes.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as getCompilerContext, y as getRouteRuntimeGlobalKeys } from "./createContext-
|
|
1
|
+
import { n as getCompilerContext, y as getRouteRuntimeGlobalKeys } from "./createContext-CjNVaqAp.mjs";
|
|
2
2
|
//#region src/auto-routes.ts
|
|
3
3
|
const ROUTE_RUNTIME_OVERRIDE_KEY = Symbol.for("weapp-vite.route-runtime");
|
|
4
4
|
function createGetter(resolver) {
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as getDefaultIdeProjectRoot, C as collectPreloadPages, D as loadViteConfigFile, E as suggestPreloadRules, M as isPathInside, O as createCjsConfigLoadError, S as getProjectConfigFileName, T as resolvePreloadPackageIdentifier, _ as SHARED_CHUNK_VIRTUAL_PREFIX, a as createGlassEaselAnalyzeResult, b as resolveWeappConfigFile, f as getBackendForCapability, g as createSharedBuildConfig, h as syncManagedTsconfigBootstrapFiles, j as shouldPassPlatformArgToIdeOpen, k as parseCommentJson, m as syncProjectSupportFiles, o as formatBytes, p as resolveBackendExecution, t as createCompilerContext, v as resolveHmrProfileJsonPath, w as findPreloadRuleKey, x as checkRuntime } from "./createContext-
|
|
2
|
-
import { f as VERSION, i as findJsEntry, o as findTemplateEntry, s as findVueEntry } from "./file-
|
|
1
|
+
import { A as getDefaultIdeProjectRoot, C as collectPreloadPages, D as loadViteConfigFile, E as suggestPreloadRules, M as isPathInside, O as createCjsConfigLoadError, S as getProjectConfigFileName, T as resolvePreloadPackageIdentifier, _ as SHARED_CHUNK_VIRTUAL_PREFIX, a as createGlassEaselAnalyzeResult, b as resolveWeappConfigFile, f as getBackendForCapability, g as createSharedBuildConfig, h as syncManagedTsconfigBootstrapFiles, j as shouldPassPlatformArgToIdeOpen, k as parseCommentJson, m as syncProjectSupportFiles, o as formatBytes, p as resolveBackendExecution, t as createCompilerContext, v as resolveHmrProfileJsonPath, w as findPreloadRuleKey, x as checkRuntime } from "./createContext-CjNVaqAp.mjs";
|
|
2
|
+
import { f as VERSION, i as findJsEntry, o as findTemplateEntry, s as findVueEntry } from "./file-9RDnJeq9.mjs";
|
|
3
3
|
import { r as logger_default, t as colors } from "./logger-mt4mSTqV.mjs";
|
|
4
4
|
import { c as startWeappViteMcpServer, l as detectAiDevelopmentEnvironment, s as resolveWeappMcpConfig } from "./mcp-BG6TliEg.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
@@ -3623,6 +3623,9 @@ async function startForwardConsoleBridge(options) {
|
|
|
3623
3623
|
* @description 暂停当前 DevTools 日志桥,并返回恢复函数。
|
|
3624
3624
|
*/
|
|
3625
3625
|
async function pauseActiveForwardConsole() {
|
|
3626
|
+
const lifecycle = forwardConsoleLifecycle;
|
|
3627
|
+
await activeForwardConsoleStart;
|
|
3628
|
+
if (lifecycle !== forwardConsoleLifecycle) return;
|
|
3626
3629
|
const session = activeForwardConsoleSession;
|
|
3627
3630
|
const bridgeOptions = activeForwardConsoleBridgeOptions;
|
|
3628
3631
|
if (!session || !bridgeOptions) return;
|
|
@@ -3630,17 +3633,32 @@ async function pauseActiveForwardConsole() {
|
|
|
3630
3633
|
activeForwardConsoleBridgeOptions = void 0;
|
|
3631
3634
|
await session.close();
|
|
3632
3635
|
return async () => {
|
|
3636
|
+
if (lifecycle !== forwardConsoleLifecycle) return false;
|
|
3637
|
+
if (activeForwardConsoleStart) return await activeForwardConsoleStart;
|
|
3633
3638
|
if (activeForwardConsoleSession) return true;
|
|
3639
|
+
const startTask = (async () => {
|
|
3640
|
+
try {
|
|
3641
|
+
const resumedSession = await startForwardConsoleBridge(bridgeOptions);
|
|
3642
|
+
if (lifecycle !== forwardConsoleLifecycle) {
|
|
3643
|
+
await resumedSession.close();
|
|
3644
|
+
return false;
|
|
3645
|
+
}
|
|
3646
|
+
activeForwardConsoleSession = resumedSession;
|
|
3647
|
+
activeForwardConsoleBridgeOptions = bridgeOptions;
|
|
3648
|
+
return true;
|
|
3649
|
+
} catch (error) {
|
|
3650
|
+
if (lifecycle === forwardConsoleLifecycle) {
|
|
3651
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
3652
|
+
logger_default.warn(`[forwardConsole] 恢复失败:${message}`);
|
|
3653
|
+
}
|
|
3654
|
+
return false;
|
|
3655
|
+
}
|
|
3656
|
+
})();
|
|
3657
|
+
activeForwardConsoleStart = startTask;
|
|
3634
3658
|
try {
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
} catch (error) {
|
|
3639
|
-
activeForwardConsoleSession = void 0;
|
|
3640
|
-
activeForwardConsoleBridgeOptions = void 0;
|
|
3641
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
3642
|
-
logger_default.warn(`[forwardConsole] 恢复失败:${message}`);
|
|
3643
|
-
return false;
|
|
3659
|
+
return await startTask;
|
|
3660
|
+
} finally {
|
|
3661
|
+
if (activeForwardConsoleStart === startTask) activeForwardConsoleStart = void 0;
|
|
3644
3662
|
}
|
|
3645
3663
|
};
|
|
3646
3664
|
}
|
|
@@ -5044,7 +5062,7 @@ function resolveRunnableHotkeyDefinition(input) {
|
|
|
5044
5062
|
}
|
|
5045
5063
|
//#endregion
|
|
5046
5064
|
//#region package.json
|
|
5047
|
-
var version = "7.0
|
|
5065
|
+
var version = "7.1.0";
|
|
5048
5066
|
//#endregion
|
|
5049
5067
|
//#region src/cli/devHotkeys/format.ts
|
|
5050
5068
|
const FULLWIDTH_ASCII_START = 65281;
|
|
@@ -5667,10 +5685,10 @@ function createAnalyzeController(options) {
|
|
|
5667
5685
|
}
|
|
5668
5686
|
//#endregion
|
|
5669
5687
|
//#region src/cli/commands/serve/shared.ts
|
|
5670
|
-
function startBackgroundForwardConsole(startForwardConsole) {
|
|
5688
|
+
function startBackgroundForwardConsole(startForwardConsole, options) {
|
|
5671
5689
|
if (!startForwardConsole) return;
|
|
5672
5690
|
try {
|
|
5673
|
-
startForwardConsole().catch((error) => {
|
|
5691
|
+
startForwardConsole(options).catch((error) => {
|
|
5674
5692
|
const message = error instanceof Error ? error.message : String(error);
|
|
5675
5693
|
logger_default.warn(`[forwardConsole] 后台启动失败:${message}`);
|
|
5676
5694
|
});
|
|
@@ -5679,6 +5697,9 @@ function startBackgroundForwardConsole(startForwardConsole) {
|
|
|
5679
5697
|
logger_default.warn(`[forwardConsole] 后台启动失败:${message}`);
|
|
5680
5698
|
}
|
|
5681
5699
|
}
|
|
5700
|
+
function resolveServeIdeOpenStrategy(options = {}, fallback = "cli") {
|
|
5701
|
+
return options.openStrategy ?? (options.useAutomatorOpen ? "automator" : fallback);
|
|
5702
|
+
}
|
|
5682
5703
|
function resolveWebHost(host) {
|
|
5683
5704
|
if (host === void 0) return;
|
|
5684
5705
|
if (typeof host === "boolean") return host;
|
|
@@ -5695,7 +5716,7 @@ function createServeMiniProgramDevActions(options) {
|
|
|
5695
5716
|
openIde: async (openOptions = {}) => {
|
|
5696
5717
|
if (!openOptions.forceOpen && await options.tryReuseForwardConsole?.()) return "已通过控制台转发复用当前开发者工具会话";
|
|
5697
5718
|
await options.openIde(projectPath, openOptions);
|
|
5698
|
-
startBackgroundForwardConsole(options.startForwardConsole);
|
|
5719
|
+
startBackgroundForwardConsole(options.startForwardConsole, openOptions);
|
|
5699
5720
|
return openOptions.forceReopen ? "已重新打开微信开发者工具项目" : "已打开或复用微信开发者工具项目";
|
|
5700
5721
|
},
|
|
5701
5722
|
rebuild: async () => {
|
|
@@ -5758,7 +5779,8 @@ function registerServeCommand(cli) {
|
|
|
5758
5779
|
fallbackProjectPath: configService.cwd,
|
|
5759
5780
|
openIde: async (projectPath, openOptions) => {
|
|
5760
5781
|
const forceReopen = openOptions?.forceReopen === true;
|
|
5761
|
-
const
|
|
5782
|
+
const openStrategy = resolveServeIdeOpenStrategy(openOptions, options.ideOpenStrategy);
|
|
5783
|
+
const useAutomatorOpen = openStrategy === "automator";
|
|
5762
5784
|
await openIde(configService.platform, projectPath, {
|
|
5763
5785
|
loginRetry: options.loginRetry,
|
|
5764
5786
|
loginRetryTimeout: options.loginRetryTimeout,
|
|
@@ -5769,13 +5791,21 @@ function registerServeCommand(cli) {
|
|
|
5769
5791
|
skipAutomatorCompile: !forceReopen,
|
|
5770
5792
|
skipPostOpenHealthCheck: true,
|
|
5771
5793
|
trustProject: options.trustProject,
|
|
5772
|
-
openStrategy
|
|
5794
|
+
openStrategy,
|
|
5773
5795
|
useAutomatorOpen
|
|
5774
5796
|
});
|
|
5775
5797
|
writePostOpenSeparator();
|
|
5776
5798
|
},
|
|
5777
5799
|
projectPath: resolveIdeProjectRoot(configService.mpDistRoot, configService.cwd),
|
|
5778
|
-
startForwardConsole: async () => {
|
|
5800
|
+
startForwardConsole: async (openOptions) => {
|
|
5801
|
+
if (resolveServeIdeOpenStrategy(openOptions, options.ideOpenStrategy) === "automator") return await maybeStartForwardConsole({
|
|
5802
|
+
openedOnly: true,
|
|
5803
|
+
preferOpenedSession: true,
|
|
5804
|
+
platform: configService.platform,
|
|
5805
|
+
mpDistRoot: configService.mpDistRoot,
|
|
5806
|
+
cwd: configService.cwd,
|
|
5807
|
+
weappViteConfig: configService.weappViteConfig
|
|
5808
|
+
});
|
|
5779
5809
|
return await maybeStartForwardConsole({
|
|
5780
5810
|
platform: configService.platform,
|
|
5781
5811
|
mpDistRoot: configService.mpDistRoot,
|
|
@@ -4,10 +4,9 @@ import { t as WeappI18nConfig } from "./types-CgZn5X6j.mjs";
|
|
|
4
4
|
import { MpPlatform, OutputExtensions } from "@weapp-core/shared";
|
|
5
5
|
import { WeappAstConfig } from "@weapp-vite/ast";
|
|
6
6
|
import "@weapp-vite/ast/operations/onPageScroll";
|
|
7
|
-
import "@weapp-vite/ast/operations/setDataPick";
|
|
8
7
|
import { LoggerConfig } from "@weapp-core/logger";
|
|
9
8
|
import "@weapp-vite/ast/babel";
|
|
10
|
-
import { VueSfcBlockSignatures } from "wevu/compiler";
|
|
9
|
+
import { ComponentStyleOptions, VueSfcBlockSignatures } from "wevu/compiler";
|
|
11
10
|
import { ConfigEnv, ConfigEnv as ConfigEnv$1, InlineConfig, InlineConfig as InlineConfig$1, Plugin as Plugin$1, PluginOption, ResolvedConfig, UserConfig, ViteDevServer, ViteDevServer as ViteDevServer$1, build } from "vite";
|
|
12
11
|
import { LRUCache } from "lru-cache";
|
|
13
12
|
import { fdir } from "fdir";
|
|
@@ -596,6 +595,9 @@ interface WeappHmrConfig {
|
|
|
596
595
|
*/
|
|
597
596
|
runtime?: 'auto' | 'classic' | 'stateful-experimental';
|
|
598
597
|
sharedChunks?: 'full' | 'auto' | 'off';
|
|
598
|
+
/**
|
|
599
|
+
* @description 额外刷新已存在的全局样式;auto 仅用于非内置 Tailwind 的实际内容失效,内置集成由原生输出刷新。false 不影响样式编译。
|
|
600
|
+
*/
|
|
599
601
|
touchAppWxss?: boolean | 'auto';
|
|
600
602
|
/**
|
|
601
603
|
* @description HMR 终端日志档位:默认仅输出总耗时,显式开启 concise/verbose 后再展示阶段诊断。
|
|
@@ -1022,6 +1024,11 @@ interface DevModuleGraph {
|
|
|
1022
1024
|
invalidateModule(module: DevModuleNode): void;
|
|
1023
1025
|
}
|
|
1024
1026
|
interface DevServerGraphHost {
|
|
1027
|
+
environments?: {
|
|
1028
|
+
client?: {
|
|
1029
|
+
bundledDev?: unknown;
|
|
1030
|
+
};
|
|
1031
|
+
};
|
|
1025
1032
|
moduleGraph: DevModuleGraph;
|
|
1026
1033
|
transformRequest?: (url: string) => Promise<unknown>;
|
|
1027
1034
|
}
|
|
@@ -1077,7 +1084,7 @@ interface BuildService {
|
|
|
1077
1084
|
invalidateIndependentOutput: (root: string) => void;
|
|
1078
1085
|
}
|
|
1079
1086
|
//#endregion
|
|
1080
|
-
//#region ../../node_modules/.pnpm/pkg-types@2.3.
|
|
1087
|
+
//#region ../../node_modules/.pnpm/pkg-types@2.3.3/node_modules/pkg-types/dist/index.d.mts
|
|
1081
1088
|
interface PackageJson {
|
|
1082
1089
|
/**
|
|
1083
1090
|
* The name is what your thing is called.
|
|
@@ -1719,6 +1726,7 @@ interface RuntimeState {
|
|
|
1719
1726
|
wevuInternalRuntimeFileNames?: Map<string, string>;
|
|
1720
1727
|
};
|
|
1721
1728
|
hmr: {
|
|
1729
|
+
componentPageStyleOptions: Map<string, ComponentStyleOptions>;
|
|
1722
1730
|
loadedEntrySet: Set<string>;
|
|
1723
1731
|
dirtyEntrySet: Set<string>;
|
|
1724
1732
|
dirtyEntryReasons: Map<string, 'direct' | 'dependency' | 'metadata'>;
|
|
@@ -1942,7 +1950,7 @@ interface WatcherService {
|
|
|
1942
1950
|
getRollupWatcher: (root?: string) => WatcherInstance | undefined;
|
|
1943
1951
|
setRollupWatcher: (watcher: WatcherInstance, root?: string) => void;
|
|
1944
1952
|
close: (root?: string) => void;
|
|
1945
|
-
closeAll: () => void
|
|
1953
|
+
closeAll: () => void | Promise<void>;
|
|
1946
1954
|
}
|
|
1947
1955
|
//#endregion
|
|
1948
1956
|
//#region src/runtime/webPlugin.d.ts
|
package/dist/config.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $n as applyWeappViteHostMeta, Qn as WeappViteHostMeta, Zn as WEAPP_VITE_HOST_NAME, _ as definePageJson, a as UserConfigFnNoEnvPlain, c as UserConfigFnPromise, d as Component, er as createWeappViteHostMeta, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, l as defineConfig, m as Theme, n as UserConfigExport, nr as resolveWeappViteHostMeta, o as UserConfigFnObject, ot as WeappViteConfig, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, sr as WeappViteRuntime, t as UserConfig, tr as isWeappViteHost, u as App, v as defineSitemapJson, y as defineThemeJson } from "./config-
|
|
1
|
+
import { $n as applyWeappViteHostMeta, Qn as WeappViteHostMeta, Zn as WEAPP_VITE_HOST_NAME, _ as definePageJson, a as UserConfigFnNoEnvPlain, c as UserConfigFnPromise, d as Component, er as createWeappViteHostMeta, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, l as defineConfig, m as Theme, n as UserConfigExport, nr as resolveWeappViteHostMeta, o as UserConfigFnObject, ot as WeappViteConfig, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, sr as WeappViteRuntime, t as UserConfig, tr as isWeappViteHost, u as App, v as defineSitemapJson, y as defineThemeJson } from "./config-CgTp6kSh.mjs";
|
|
2
2
|
import { t as WeappI18nConfig } from "./types-CgZn5X6j.mjs";
|
|
3
3
|
export { type App, type Component, type Page, type Sitemap, type Theme, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnNoEnv, UserConfigFnNoEnvPlain, UserConfigFnObject, UserConfigFnObjectPlain, UserConfigFnPromise, WEAPP_VITE_HOST_NAME, type WeappI18nConfig, type WeappViteConfig, WeappViteHostMeta, type WeappViteRuntime, applyWeappViteHostMeta, createWeappViteHostMeta, defineAppJson, defineComponentJson, defineConfig, definePageJson, defineSitemapJson, defineThemeJson, isWeappViteHost, resolveWeappViteHostMeta };
|