weapp-vite 7.5.0 → 7.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 +14 -6
- package/THIRD_PARTY_NOTICES.md +60 -0
- package/bin/bootstrap.js +9 -4
- package/bin/bootstrap.test.ts +82 -1
- package/bin/nodeVersionWarning.js +17 -0
- package/bin/nodeVersionWarning.test.ts +30 -0
- package/dist/action-BD56SQh4.mjs +254 -0
- package/dist/action-CPtgEl6p.mjs +94 -0
- package/dist/action-le0bNff_.mjs +1102 -0
- package/dist/action-ytG5oFAw.mjs +138 -0
- package/dist/action-zmJrU8PC.mjs +245 -0
- package/dist/{analyze-ZJUvEdaY.mjs → analyze-DCZo-sJd.mjs} +4 -71
- package/dist/artifacts-TrTX9_jj.mjs +104 -0
- package/dist/assets-XyhpYtGl.mjs +630 -0
- package/dist/auto-import-components/resolvers.d.mts +1 -1
- package/dist/auto-import-components/resolvers.mjs +1 -1
- package/dist/auto-import-presets/wevu-router.d.mts +1 -1
- package/dist/auto-import-presets/wevu-router.mjs +1 -1
- package/dist/auto-import-presets/wevu.d.mts +1 -1
- package/dist/auto-import-presets/wevu.mjs +1 -1
- package/dist/auto-import-presets.d.mts +2 -2
- package/dist/auto-import-presets.mjs +2 -2
- package/dist/auto-routes.d.mts +1 -3
- package/dist/auto-routes.mjs +3 -4
- package/dist/{budget-BD7VqLCl.d.mts → budget-DTPngJU0.d.mts} +1 -10
- package/dist/budget-_Mu-4GKn.mjs +63 -0
- package/dist/builtProject-B145uOt5.mjs +534 -0
- package/dist/{package-7swhyLmf.mjs → classifier-CNTJOYQL.mjs} +5 -9
- package/dist/cli-acceptance.mjs +3 -4
- package/dist/cli.mjs +142 -4569
- package/dist/{config-DRGcCi3h.mjs → config-59ZWhCIf.mjs} +1 -2
- package/dist/{config-V0L-IAJf.d.mts → config-BNx2BODw.d.mts} +145 -150
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +3 -3
- package/dist/{constants-DEZdcsMn.mjs → constants-BOe8mgqL.mjs} +2 -4
- package/dist/{createCompilerContextInstance-DJH_P_nZ.mjs → createCompilerContextInstance-BXSdH2E8.mjs} +19930 -14019
- package/dist/{createContext-BqYzHhY9.mjs → createContext-W0TeXxbo.mjs} +7 -5
- package/dist/dashboard/analyze.d.mts +1 -7
- package/dist/dashboard/analyze.mjs +3 -1
- package/dist/dashboard/vite.d.mts +2 -4
- package/dist/dashboard/vite.mjs +1 -2
- package/dist/dashboard.d.mts +2 -2
- package/dist/dashboard.mjs +1733 -1
- package/dist/dashboardTransport-C9290QgS.mjs +15 -0
- package/dist/{dashboardViteBridge-Dy3nAD4m.mjs → dashboardViteBridge-B7QgQo94.mjs} +11 -11
- package/dist/{dev-fR5GiJRO.mjs → dev-D1QSExwk.mjs} +6 -3
- package/dist/devProvider-Bcvz5nu4.mjs +4966 -0
- package/dist/docs/README.md +14 -6
- package/dist/docs/ai-workflows.md +2 -0
- package/dist/docs/mcp.md +11 -1
- package/dist/docs/troubleshooting.md +16 -0
- package/dist/docs/vue-sfc.md +25 -2
- package/dist/docs/weapp-config.md +29 -0
- package/dist/docs/wevu-authoring.md +2 -0
- package/dist/doctor-worker.mjs +5 -5
- package/dist/doctor.d.mts +2 -8
- package/dist/doctor.mjs +24 -31
- package/dist/engine-Mnnm_ALP.mjs +53 -0
- package/dist/file-5eEfbK60.mjs +1 -0
- package/dist/{file-sC3jD7Fh.mjs → file-D8mp5GmB.mjs} +50 -26
- package/dist/{files-BqxFIPRp.mjs → files-Cy9jURJu.mjs} +1 -2
- package/dist/forwardConsole-D2Q0RIqc.mjs +509 -0
- package/dist/getInstance-BXNVH7sU.mjs +1 -0
- package/dist/{getInstance-DiGSzBNI.mjs → getInstance-DfNlbr-X.mjs} +2 -3
- package/dist/history-dKxzoHmN.mjs +774 -0
- package/dist/i18n.d.mts +1 -3
- package/dist/i18n.mjs +1 -2
- package/dist/{index-C9HjUX5c.d.mts → index-DIZJRrvK.d.mts} +1 -24
- package/dist/{index-CaXAtb9e.d.mts → index-SnaW3cvA.d.mts} +0 -12
- package/dist/index.d.mts +3 -7
- package/dist/index.mjs +6 -6
- package/dist/{json-BL8Dhhk6.mjs → json-Cvon2mw5.mjs} +1 -2
- package/dist/json.d.mts +1 -1
- package/dist/json.mjs +1 -1
- package/dist/lib-CJyMBzoe.mjs +140 -0
- package/dist/{lifecycle-BROTlwSL.mjs → lifecycle-CUo8PMQc.mjs} +123 -33
- package/dist/{loadConfig-C3BQhz7F.mjs → loadConfig-CKIdfW4o.mjs} +2 -3
- package/dist/loadConfig-D4WGJcYp.mjs +1 -0
- package/dist/logBuildAppFinish-DOBoof6S.mjs +54 -0
- package/dist/mcp-D88QvQgG.mjs +84 -0
- package/dist/{mcp-Cj8Maqo6.mjs → mcp-ovJgl1N9.mjs} +2 -4
- package/dist/mcp.d.mts +1 -3
- package/dist/mcp.mjs +1 -1
- package/dist/mcpClient-C8JzVZ46.mjs +283 -0
- package/dist/{processCleanup-B6KA30Zc.mjs → metadata-HlDKtlsu.mjs} +2 -21
- package/dist/nodeEnv-zq1EymWj.mjs +6 -0
- package/dist/openIde-QoYKhuuM.mjs +643 -0
- package/dist/options-Cz8vZ-0w.mjs +33 -0
- package/dist/{chunkStrategy-DRA5WpB-.mjs → package-DR62fAzP.mjs} +32 -31
- package/dist/path-E1OjBJAl.mjs +43 -0
- package/dist/{platform-CnkySBKz.mjs → platform-BiMpsZIb.mjs} +1 -2
- package/dist/{pluginHost--CaeyWpA.mjs → pluginHost-vn8Vty1J.mjs} +1 -2
- package/dist/processCleanup-DzB64WI8.mjs +18 -0
- package/dist/{protocol-vg8HGJ4n.mjs → protocol-HiSJRrSO.mjs} +43 -41
- package/dist/reader-wzPH_W8A.mjs +92 -0
- package/dist/realpathScope-DwlLaCk3.mjs +22 -0
- package/dist/report-PJVyo-UZ.mjs +105 -0
- package/dist/{path-doV773b7.mjs → resolvedId-DaxPh_yV.mjs} +5 -50
- package/dist/{resolvers-Dod-euqX.mjs → resolvers-CKYqmRD_.mjs} +10 -20
- package/dist/resolvers.d.mts +1 -1
- package/dist/resolvers.mjs +1 -1
- package/dist/{routes-C7fCmf92.d.mts → routes-DvAFX29h.d.mts} +0 -2
- package/dist/{runtime-Ee2HY6gR.d.mts → runtime-BL4RjBRa.d.mts} +1 -9
- package/dist/runtime-CKtMVERT.mjs +42 -0
- package/dist/{runtime-D6VCNhNY.mjs → runtime-DDUCb7pP.mjs} +4 -8
- package/dist/runtime.d.mts +1 -1
- package/dist/runtime.mjs +1 -1
- package/dist/schematics-DikfOjMD.mjs +90 -0
- package/dist/{session-PskhD-nZ.mjs → session-COrQJYif.mjs} +81 -21
- package/dist/test.d.mts +1 -3
- package/dist/test.mjs +54 -30
- package/dist/types-BK2EQ3Jm.d.mts +37 -0
- package/dist/{types-CgZn5X6j.d.mts → types-e2BMP9NU.d.mts} +1 -4
- package/dist/types.d.mts +4 -4
- package/dist/{upload-D4msblBf.mjs → upload-Chal5b3w.mjs} +118 -24
- package/dist/upload-worker.mjs +3 -5
- package/dist/{utils-CJSCgEj6.mjs → utils-CTGSZp4j.mjs} +72 -146
- package/dist/vite.d.mts +2 -4
- package/dist/vite.mjs +55 -21
- package/dist/volar.mjs +1 -2
- package/dist/{wevu-BQWUU7br.mjs → wevu-BaihCXO9.mjs} +1 -2
- package/dist/wevu-DTtSOyxB.d.mts +3 -0
- package/dist/{wevu-router-Dg1LnBlg.mjs → wevu-router-BIoxDbnu.mjs} +1 -2
- package/dist/wevu-router-CdWurGQ4.d.mts +3 -0
- package/dist/wxs-7V7MPzeW.mjs +1 -0
- package/dist/wxs-BdHHXltv.mjs +110 -0
- package/package.json +62 -53
- package/dist/dashboard-DvqF3Key.mjs +0 -1842
- package/dist/devProvider-BGBkw28J.mjs +0 -1050
- package/dist/file-DRb4eWqw.mjs +0 -1
- package/dist/getInstance-SiE6WZRh.mjs +0 -1
- package/dist/loadConfig-VGtBF4qm.mjs +0 -1
- package/dist/mcp-D3Yh24Cj.mjs +0 -529
- package/dist/wevu-C4KEC5kO.d.mts +0 -5
- package/dist/wevu-router-Cg2sIkIE.d.mts +0 -5
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { n as normalizeFsResolvedId, t as isSkippableResolvedId } from "./resolvedId-DaxPh_yV.mjs";
|
|
2
|
+
import { i as normalizeRoot, s as toPosixPath } from "./path-E1OjBJAl.mjs";
|
|
3
|
+
import { S as shouldNormalizeUsingComponents, l as getProjectPlatformOptions, p as normalizePlatformNpmImportPath, v as shouldFillComponentGenericsDefault, x as shouldNormalizePlatformNpmImportPath } from "./platform-BiMpsZIb.mjs";
|
|
4
|
+
import { o as changeFileExtension } from "./file-D8mp5GmB.mjs";
|
|
5
|
+
import { i as scriptExtensions, s as vueExtensions } from "./constants-BOe8mgqL.mjs";
|
|
5
6
|
import "./logger-DGn5iEVN.mjs";
|
|
7
|
+
import { n as loadHostRolldownBuild } from "./engine-Mnnm_ALP.mjs";
|
|
6
8
|
import { createRequire } from "node:module";
|
|
7
9
|
import process from "node:process";
|
|
8
10
|
import path from "pathe";
|
|
9
11
|
import { existsSync, readFileSync } from "node:fs";
|
|
10
|
-
import { pathToFileURL } from "node:url";
|
|
11
12
|
import path$1 from "node:path";
|
|
12
13
|
import { defuOverrideArray, get, isObject, removeExtensionDeep, set } from "@weapp-core/shared";
|
|
13
14
|
import { parse, stringify } from "comment-json";
|
|
14
15
|
import { fs as fs$1 } from "@weapp-core/shared/fs";
|
|
15
16
|
import { parseJsLikeWithEngine } from "@weapp-vite/ast";
|
|
16
|
-
import { BABEL_TS_MODULE_PARSER_OPTIONS as BABEL_TS_MODULE_PARSER_OPTIONS$1, generate as generate$1, parse as parse$2, parseJsLike as parseJsLike$1, traverse as traverse$1 } from "@weapp-vite/ast/babel";
|
|
17
|
+
import { BABEL_TS_MODULE_PARSER_OPTIONS as BABEL_TS_MODULE_PARSER_OPTIONS$1, generate as generate$1, getVisitorKeys, parse as parse$2, parseJsLike as parseJsLike$1, traverse as traverse$1 } from "@weapp-vite/ast/babel";
|
|
17
18
|
import picomatch from "picomatch";
|
|
18
19
|
import { invalidateFileCache, pathExists, readFile as readFile$2 } from "wevu/compiler";
|
|
19
20
|
import fs$2, { readFile as readFile$1, readdir, realpath, unlink } from "node:fs/promises";
|
|
@@ -21,7 +22,7 @@ import { loadConfigFromFile } from "vite";
|
|
|
21
22
|
import "semver/functions/gte.js";
|
|
22
23
|
import "semver/functions/satisfies.js";
|
|
23
24
|
import "semver/functions/valid.js";
|
|
24
|
-
|
|
25
|
+
// src/utils/npmImport.ts
|
|
25
26
|
const WINDOWS_PATH_SEPARATORS_RE = /\\/g;
|
|
26
27
|
const WINDOWS_ABSOLUTE_PATH_RE = /^[a-z]:[\\/]/i;
|
|
27
28
|
const NPM_PROTOCOL_RE = /^npm:/;
|
|
@@ -148,8 +149,7 @@ function normalizeNpmImportPathByPlatform(importee, options) {
|
|
|
148
149
|
const normalized = trimmed.replace(NPM_PROTOCOL_RE, "");
|
|
149
150
|
return normalizePlatformNpmImportPath(options.platform, normalized, { alipayNpmMode: options.alipayNpmMode });
|
|
150
151
|
}
|
|
151
|
-
|
|
152
|
-
//#region src/utils/json.ts
|
|
152
|
+
// src/utils/json.ts
|
|
153
153
|
const ALIPAY_GENERIC_COMPONENT_PLACEHOLDER = "./__weapp_vite_generic_component";
|
|
154
154
|
const WEAPP_SCOPED_SLOT_GENERIC_COMPONENT_PLACEHOLDER = "./__weapp_vite_scoped_slot_generic_component";
|
|
155
155
|
const JSON_FILE_JS_EXTENSION_RE = /\.[jt]s$/;
|
|
@@ -291,8 +291,7 @@ function getPathExistsTtlMs(config) {
|
|
|
291
291
|
function getReadFileCheckMtime(config) {
|
|
292
292
|
return Boolean(config?.isDev);
|
|
293
293
|
}
|
|
294
|
-
|
|
295
|
-
//#region src/utils/configErrors.ts
|
|
294
|
+
// src/utils/configErrors.ts
|
|
296
295
|
const CJS_ERROR_PATTERNS = [
|
|
297
296
|
"__dirname is not defined",
|
|
298
297
|
"__filename is not defined",
|
|
@@ -330,8 +329,7 @@ function createCjsConfigLoadError(options) {
|
|
|
330
329
|
if (options.error instanceof Error) error.cause = options.error;
|
|
331
330
|
return error;
|
|
332
331
|
}
|
|
333
|
-
|
|
334
|
-
//#region src/utils/entryResolve.ts
|
|
332
|
+
// src/utils/entryResolve.ts
|
|
335
333
|
function buildCandidates(base, extensions) {
|
|
336
334
|
return extensions.map((ext) => changeFileExtension(base, ext));
|
|
337
335
|
}
|
|
@@ -372,8 +370,7 @@ async function resolveEntryPath(input, options) {
|
|
|
372
370
|
const extensions = resolveEntryExtensions(kind, isDir);
|
|
373
371
|
for (const candidate of buildCandidates(base, extensions)) if (await exists(candidate)) return candidate;
|
|
374
372
|
}
|
|
375
|
-
|
|
376
|
-
//#region src/utils/loadViteConfigFile.ts
|
|
373
|
+
// src/utils/loadViteConfigFile.ts
|
|
377
374
|
const DEFAULT_VITE_CONFIG_FILES = [
|
|
378
375
|
"vite.config.ts",
|
|
379
376
|
"vite.config.mts",
|
|
@@ -423,8 +420,7 @@ async function loadViteConfigFile(configEnv, configFile, configRoot, configFileD
|
|
|
423
420
|
const resolvedConfigLoader = configLoader ?? "bundle";
|
|
424
421
|
return withSuppressedWarningCodes(suppressedWarningCodes, () => loadConfigFromFile(configEnv, resolvedConfigFile, configRoot, logLevel, void 0, resolvedConfigLoader));
|
|
425
422
|
}
|
|
426
|
-
|
|
427
|
-
//#region src/utils/preloadScan.ts
|
|
423
|
+
// src/utils/preloadScan.ts
|
|
428
424
|
const HOST_ROUTER_METHODS = /* @__PURE__ */ new Set([
|
|
429
425
|
"navigateTo",
|
|
430
426
|
"redirectTo",
|
|
@@ -555,8 +551,7 @@ function collectTemplateTargets(source, sourcePage) {
|
|
|
555
551
|
function collectStaticRouteTargets(source, kind, sourcePage) {
|
|
556
552
|
return kind === "template" ? collectTemplateTargets(source, sourcePage) : collectScriptTargets(source, sourcePage);
|
|
557
553
|
}
|
|
558
|
-
|
|
559
|
-
//#region src/utils/preloadRule.ts
|
|
554
|
+
// src/utils/preloadRule.ts
|
|
560
555
|
const PRELOAD_RULE_GLOB_RE = /[*?[\]{}()!+@]/g;
|
|
561
556
|
function normalizePagePath(value) {
|
|
562
557
|
return normalizeRoot(value).replace(/^\/+/, "");
|
|
@@ -714,8 +709,7 @@ function suggestPreloadRules(appJson, pageSources) {
|
|
|
714
709
|
uncovered: [...uncovered]
|
|
715
710
|
};
|
|
716
711
|
}
|
|
717
|
-
|
|
718
|
-
//#region src/plugins/asset/prune.ts
|
|
712
|
+
// src/plugins/asset/prune.ts
|
|
719
713
|
/** 成功写出后仅撤销上一轮持有的文件,不清空目录,也不越过输出根内的符号链接。 */
|
|
720
714
|
async function pruneOwnedAssetFiles(outDir, fileNames) {
|
|
721
715
|
const root = path$1.resolve(outDir);
|
|
@@ -743,58 +737,7 @@ async function pruneOwnedAssetFiles(outDir, fileNames) {
|
|
|
743
737
|
if (error.code !== "ENOENT") throw error;
|
|
744
738
|
}
|
|
745
739
|
}
|
|
746
|
-
|
|
747
|
-
//#region src/runtime/viteHost/engine.ts
|
|
748
|
-
function readIdentity(file) {
|
|
749
|
-
const value = JSON.parse(readFileSync(file, "utf8"));
|
|
750
|
-
if (!value || typeof value !== "object" || !("name" in value) || typeof value.name !== "string" || !("version" in value) || typeof value.version !== "string") throw new Error("[weapp-vite] Vite 宿主 package.json 缺少 name/version。");
|
|
751
|
-
return {
|
|
752
|
-
name: value.name,
|
|
753
|
-
version: value.version
|
|
754
|
-
};
|
|
755
|
-
}
|
|
756
|
-
/** 按宿主的真实导出解析引擎,不依赖扁平 node_modules 布局或版本号相等。 */
|
|
757
|
-
function resolveViteHost(importer = import.meta.url) {
|
|
758
|
-
const packagePath = createRequire(importer).resolve("vite/package.json");
|
|
759
|
-
const identity = readIdentity(packagePath);
|
|
760
|
-
const hostRequire = createRequire(packagePath);
|
|
761
|
-
if (identity.name === "@voidzero-dev/vite-plus-core") return {
|
|
762
|
-
kind: "vite-plus",
|
|
763
|
-
packagePath,
|
|
764
|
-
packageVersion: identity.version,
|
|
765
|
-
experimentalPath: hostRequire.resolve("@voidzero-dev/vite-plus-core/rolldown/experimental")
|
|
766
|
-
};
|
|
767
|
-
if (identity.name !== "vite") throw new Error(`[weapp-vite] 不支持的 Vite 宿主:${identity.name}@${identity.version}。`);
|
|
768
|
-
return {
|
|
769
|
-
kind: "vite",
|
|
770
|
-
packagePath,
|
|
771
|
-
packageVersion: identity.version,
|
|
772
|
-
experimentalPath: hostRequire.resolve("rolldown/experimental")
|
|
773
|
-
};
|
|
774
|
-
}
|
|
775
|
-
/** 加载与宿主绑定的引擎;缺失能力时保留原始错误,禁止回退到另一套引擎。 */
|
|
776
|
-
async function loadHostRolldown(importer) {
|
|
777
|
-
let identity;
|
|
778
|
-
try {
|
|
779
|
-
identity = resolveViteHost(importer);
|
|
780
|
-
const runtime = await import(pathToFileURL(identity.experimentalPath).href);
|
|
781
|
-
if (typeof runtime.dev !== "function" || typeof runtime.scan !== "function") throw new TypeError("Rolldown 缺少 dev/scan 能力");
|
|
782
|
-
return runtime;
|
|
783
|
-
} catch (cause) {
|
|
784
|
-
const host = identity ? `${identity.kind}@${identity.packageVersion}` : "vite";
|
|
785
|
-
throw new Error(`[weapp-vite] 无法加载 ${host} 配套的 Rolldown;请检查宿主依赖和 Vite+ alias 配置。`, { cause });
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
/** 原生输出写出也绑定宿主引擎,避免 Vite+ 额外加载包内另一套 Rolldown。 */
|
|
789
|
-
async function loadHostRolldownBuild(importer) {
|
|
790
|
-
const identity = resolveViteHost(importer);
|
|
791
|
-
const entry = createRequire(identity.packagePath).resolve(identity.kind === "vite-plus" ? "@voidzero-dev/vite-plus-core/rolldown" : "rolldown");
|
|
792
|
-
const runtime = await import(pathToFileURL(entry).href);
|
|
793
|
-
if (typeof runtime.rolldown !== "function") throw new TypeError(`[weapp-vite] ${identity.kind}@${identity.packageVersion} 缺少 Rolldown 原生写出能力。`);
|
|
794
|
-
return runtime;
|
|
795
|
-
}
|
|
796
|
-
//#endregion
|
|
797
|
-
//#region src/utils/projectConfigOutput.ts
|
|
740
|
+
// src/utils/projectConfigOutput.ts
|
|
798
741
|
/** 平台项目目录独立发布,禁止覆盖由主编译持有的小程序目录。 */
|
|
799
742
|
async function collectProjectConfigAssets(sourceDir, outputRoot, outDir, watch) {
|
|
800
743
|
const assets = [];
|
|
@@ -852,15 +795,14 @@ async function publishProjectConfigAssets(outputRoot, assets, previous = /* @__P
|
|
|
852
795
|
}
|
|
853
796
|
return current;
|
|
854
797
|
}
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
async function readProjectConfigFile(filePath, required) {
|
|
798
|
+
// src/utils/projectConfig.ts
|
|
799
|
+
async function readProjectConfigFile(filePath, required, readFile) {
|
|
858
800
|
if (!await fs$1.pathExists(filePath)) {
|
|
859
801
|
if (required) throw new Error(`找不到项目配置文件:${filePath}`);
|
|
860
802
|
return {};
|
|
861
803
|
}
|
|
862
804
|
try {
|
|
863
|
-
return await fs$1.readJson(filePath) || {};
|
|
805
|
+
return readFile ? JSON.parse((await readFile(filePath)).replace(/^\uFEFF/, "")) || {} : await fs$1.readJson(filePath) || {};
|
|
864
806
|
} catch {
|
|
865
807
|
throw new Error(`解析 json 格式失败, ${filePath} 为非法的 json 格式`);
|
|
866
808
|
}
|
|
@@ -885,23 +827,12 @@ function resolveProjectConfigRoot(projectConfig, platform) {
|
|
|
885
827
|
async function getProjectConfig(root, options) {
|
|
886
828
|
const baseJsonPath = path.resolve(root, options?.basePath ?? "project.config.json");
|
|
887
829
|
const privateJsonPath = path.resolve(root, options?.privatePath ?? "project.private.config.json");
|
|
888
|
-
const baseJson = await readProjectConfigFile(baseJsonPath, true);
|
|
889
|
-
const privateJson = options?.ignorePrivate ? {} : await readProjectConfigFile(privateJsonPath, false);
|
|
830
|
+
const baseJson = await readProjectConfigFile(baseJsonPath, true, options?.readFile);
|
|
831
|
+
const privateJson = options?.ignorePrivate ? {} : await readProjectConfigFile(privateJsonPath, false, options?.readFile);
|
|
890
832
|
return defuOverrideArray(privateJson, baseJson);
|
|
891
833
|
}
|
|
892
834
|
async function getProjectPrivateConfig(root, options) {
|
|
893
|
-
return await readProjectConfigFile(path.resolve(root, options?.privatePath ?? "project.private.config.json"), false);
|
|
894
|
-
}
|
|
895
|
-
async function disableProjectPrivateConfigHotReload(filePath) {
|
|
896
|
-
const config = await readProjectConfigFile(filePath, true);
|
|
897
|
-
const setting = config.setting && typeof config.setting === "object" && !Array.isArray(config.setting) ? config.setting : {};
|
|
898
|
-
if (setting.compileHotReLoad === false) return false;
|
|
899
|
-
config.setting = {
|
|
900
|
-
...setting,
|
|
901
|
-
compileHotReLoad: false
|
|
902
|
-
};
|
|
903
|
-
await fs$1.writeFile(filePath, `${JSON.stringify(config, null, 2)}\n`, "utf8");
|
|
904
|
-
return true;
|
|
835
|
+
return await readProjectConfigFile(path.resolve(root, options?.privatePath ?? "project.private.config.json"), false, options?.readFile);
|
|
905
836
|
}
|
|
906
837
|
function resolveProjectConfigSyncDirs(options) {
|
|
907
838
|
const outputRoot = path.dirname(options.outDir);
|
|
@@ -928,13 +859,10 @@ async function syncProjectConfigToOutput(options) {
|
|
|
928
859
|
const assets = await collectProjectConfigAssets(syncDirs.sourceDir, syncDirs.outputRoot, options.outDir);
|
|
929
860
|
await publishProjectConfigAssets(syncDirs.outputRoot, assets);
|
|
930
861
|
}
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
if (!exported) return;
|
|
936
|
-
if (exported.type === "Identifier") return exported.name;
|
|
937
|
-
if (exported.type === "StringLiteral") return exported.value;
|
|
862
|
+
// src/utils/reExport.ts
|
|
863
|
+
function getSpecifierName(name) {
|
|
864
|
+
if (name?.type === "Identifier") return name.name;
|
|
865
|
+
if (name?.type === "StringLiteral" || name?.type === "Literal") return name.value;
|
|
938
866
|
}
|
|
939
867
|
function getSourceValue(node) {
|
|
940
868
|
const source = node?.source;
|
|
@@ -951,68 +879,69 @@ function parseModuleForReExport(code, astEngine) {
|
|
|
951
879
|
});
|
|
952
880
|
return parse$2(code, BABEL_TS_MODULE_PARSER_OPTIONS$1).program;
|
|
953
881
|
}
|
|
954
|
-
async function
|
|
955
|
-
if (depth <= 0) return;
|
|
956
|
-
if (visited.has(exporterFile)) return;
|
|
957
|
-
visited.add(exporterFile);
|
|
882
|
+
async function readReExportFacts(exporterFile, options) {
|
|
958
883
|
const cacheKey = getReExportCacheKey(exporterFile, options.astEngine);
|
|
959
|
-
let
|
|
960
|
-
if (!entry) {
|
|
961
|
-
entry = /* @__PURE__ */ new Map();
|
|
962
|
-
options.cache.set(cacheKey, entry);
|
|
963
|
-
}
|
|
964
|
-
if (entry.has(exportName)) return entry.get(exportName);
|
|
965
|
-
let code;
|
|
884
|
+
let source;
|
|
966
885
|
try {
|
|
967
|
-
|
|
886
|
+
source = await options.readFile(exporterFile);
|
|
968
887
|
} catch {
|
|
969
|
-
|
|
888
|
+
options.cache.delete(cacheKey);
|
|
970
889
|
return;
|
|
971
890
|
}
|
|
972
|
-
|
|
891
|
+
const cached = options.cache.get(cacheKey);
|
|
892
|
+
if (cached?.source === source) return cached;
|
|
893
|
+
const facts = {
|
|
894
|
+
source,
|
|
895
|
+
named: /* @__PURE__ */ new Map(),
|
|
896
|
+
exportAll: []
|
|
897
|
+
};
|
|
973
898
|
try {
|
|
974
|
-
ast = parseModuleForReExport(
|
|
975
|
-
|
|
976
|
-
entry.set(exportName, void 0);
|
|
977
|
-
return;
|
|
978
|
-
}
|
|
979
|
-
const exportAllSources = [];
|
|
980
|
-
for (const node of ast.body ?? []) {
|
|
981
|
-
if (node?.type === "ExportNamedDeclaration") {
|
|
899
|
+
const ast = parseModuleForReExport(source, options.astEngine);
|
|
900
|
+
for (const node of ast.body) {
|
|
982
901
|
const source = getSourceValue(node);
|
|
983
902
|
if (!source) continue;
|
|
984
|
-
for (const spec of node.specifiers ?? []) {
|
|
903
|
+
if (node?.type === "ExportNamedDeclaration") for (const spec of node.specifiers ?? []) {
|
|
985
904
|
if (spec?.type !== "ExportSpecifier") continue;
|
|
986
|
-
const
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
}
|
|
905
|
+
const name = getSpecifierName(spec.exported);
|
|
906
|
+
const imported = getSpecifierName(spec.local);
|
|
907
|
+
if (name && imported) facts.named.set(name, {
|
|
908
|
+
source,
|
|
909
|
+
imported
|
|
910
|
+
});
|
|
993
911
|
}
|
|
912
|
+
else if (node?.type === "ExportAllDeclaration") facts.exportAll.push(source);
|
|
994
913
|
}
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
914
|
+
} catch {}
|
|
915
|
+
options.cache.set(cacheKey, facts);
|
|
916
|
+
return facts;
|
|
917
|
+
}
|
|
918
|
+
async function resolveReExportedInternal(exporterFile, exportName, depth, visited, options) {
|
|
919
|
+
const key = `${exporterFile}\0${exportName}`;
|
|
920
|
+
if (depth <= 0 || (visited.get(key) ?? 0) >= depth) return;
|
|
921
|
+
visited.set(key, depth);
|
|
922
|
+
const facts = await readReExportFacts(exporterFile, options);
|
|
923
|
+
if (!facts) return;
|
|
924
|
+
const binding = facts.named.get(exportName);
|
|
925
|
+
if (binding) {
|
|
926
|
+
const resolved = await options.resolveId(binding.source, exporterFile);
|
|
927
|
+
if (!resolved) return;
|
|
928
|
+
if (binding.imported !== "default") return resolveReExportedInternal(resolved, binding.imported, depth - 1, visited, options);
|
|
929
|
+
if (/\.(?:[cm]?ts|[cm]?js)$/.test(resolved)) {
|
|
930
|
+
if ((await readReExportFacts(resolved, options))?.named.has("default")) return resolveReExportedInternal(resolved, "default", depth - 1, visited, options);
|
|
998
931
|
}
|
|
932
|
+
return resolved;
|
|
999
933
|
}
|
|
1000
|
-
for (const source of
|
|
934
|
+
for (const source of facts.exportAll) {
|
|
1001
935
|
const hopId = await options.resolveId(source, exporterFile);
|
|
1002
936
|
if (!hopId) continue;
|
|
1003
937
|
const nested = await resolveReExportedInternal(hopId, exportName, depth - 1, visited, options);
|
|
1004
|
-
if (nested)
|
|
1005
|
-
entry.set(exportName, nested);
|
|
1006
|
-
return nested;
|
|
1007
|
-
}
|
|
938
|
+
if (nested) return nested;
|
|
1008
939
|
}
|
|
1009
|
-
entry.set(exportName, void 0);
|
|
1010
940
|
}
|
|
1011
941
|
async function resolveReExportedName(exporterFile, exportName, options) {
|
|
1012
|
-
return resolveReExportedInternal(exporterFile, exportName, options.maxDepth ?? 4, /* @__PURE__ */ new
|
|
942
|
+
return resolveReExportedInternal(exporterFile, exportName, options.maxDepth ?? 4, /* @__PURE__ */ new Map(), options);
|
|
1013
943
|
}
|
|
1014
|
-
|
|
1015
|
-
//#region src/utils/toAbsoluteId.ts
|
|
944
|
+
// src/utils/toAbsoluteId.ts
|
|
1016
945
|
function resolveAbsoluteIdBaseDir(configService, importer, options) {
|
|
1017
946
|
const cleanImporter = importer ? normalizeFsResolvedId(importer) : void 0;
|
|
1018
947
|
if (cleanImporter && !isSkippableResolvedId(cleanImporter) && path.isAbsolute(cleanImporter)) return path.dirname(cleanImporter);
|
|
@@ -1035,8 +964,7 @@ function toAbsoluteId(id, configService, importer, options) {
|
|
|
1035
964
|
const baseDir = resolveAbsoluteIdBaseDir(configService, importer, options);
|
|
1036
965
|
return path.resolve(baseDir, cleanId);
|
|
1037
966
|
}
|
|
1038
|
-
|
|
1039
|
-
//#region src/utils/usingComponentFrom.ts
|
|
967
|
+
// src/utils/usingComponentFrom.ts
|
|
1040
968
|
function shouldResolveUsingComponentFrom(normalizedResolvedFile) {
|
|
1041
969
|
return Boolean(normalizedResolvedFile && !isSkippableResolvedId(normalizedResolvedFile) && path.isAbsolute(normalizedResolvedFile));
|
|
1042
970
|
}
|
|
@@ -1049,8 +977,7 @@ function usingComponentFromResolvedFile(resolvedFile, configService) {
|
|
|
1049
977
|
if (!relative || relative.startsWith("..")) return;
|
|
1050
978
|
return `/${toPosixPath(relative)}`;
|
|
1051
979
|
}
|
|
1052
|
-
|
|
1053
|
-
//#region src/utils/weappConfig.ts
|
|
980
|
+
// src/utils/weappConfig.ts
|
|
1054
981
|
const WEAPP_VITE_CONFIG_CANDIDATES = [
|
|
1055
982
|
"weapp-vite.config.ts",
|
|
1056
983
|
"weapp-vite.config.mts",
|
|
@@ -1090,5 +1017,4 @@ async function resolveWeappConfigFile(options) {
|
|
|
1090
1017
|
}
|
|
1091
1018
|
return findWeappConfigInDirectory(root);
|
|
1092
1019
|
}
|
|
1093
|
-
|
|
1094
|
-
export { parseNpmPackageSpecifier as $, pathExists as A, ALIPAY_GENERIC_COMPONENT_PLACEHOLDER as B, resolvePreloadPackageIdentifier as C, createCachedEntryResolveOptions as D, loadViteConfigFile as E, BABEL_TS_MODULE_PARSER_OPTIONS$1 as F, normalizeAppJson as G, getAliasEntries as H, generate$1 as I, resolveJson as J, parseCommentJson as K, parse$2 as L, createCjsConfigLoadError as M, getPathExistsTtlMs as N, resolveEntryPath as O, getReadFileCheckMtime as P, normalizeNpmImportPathByPlatform as Q, parseJsLike$1 as R, findPreloadRuleKey as S, TYPELESS_PACKAGE_JSON_WARNING_CODE as T, jsonFileRemoveJsExtension as U, WEAPP_SCOPED_SLOT_GENERIC_COMPONENT_PLACEHOLDER as V, matches as W, hasNpmDependencyPrefix as X, toKebabCaseComponentName as Y, normalizeNpmImportLookupPath as Z, loadHostRolldown as _, resolveReExportedName as a, applyPreloadRulesToAppJson as b, getProjectConfigFileName as c, getProjectPrivateConfigFileName as d, resolveNpmDependencyId as et, resolveProjectConfigRoot as f, publishProjectConfigAssets as g, collectProjectConfigAssets as h, toAbsoluteId as i, readFile$2 as j, invalidateFileCache as k, getProjectConfigRootKeys as l, syncProjectConfigToOutput as m, shouldResolveUsingComponentFrom as n, disableProjectPrivateConfigHotReload as o, resolveProjectConfigSyncDirs as p, resolveImportee as q, usingComponentFromResolvedFile as r, getProjectConfig as s, resolveWeappConfigFile as t, getProjectPrivateConfig as u, loadHostRolldownBuild as v, suggestPreloadRules as w, collectPreloadPages as x, pruneOwnedAssetFiles as y, traverse$1 as z };
|
|
1020
|
+
export { resolveNpmDependencyId as $, createCjsConfigLoadError as A, WEAPP_SCOPED_SLOT_GENERIC_COMPONENT_PLACEHOLDER as B, loadViteConfigFile as C, invalidateFileCache as D, resolveEntryPath as E, getVisitorKeys as F, parseCommentJson as G, jsonFileRemoveJsExtension as H, parse$2 as I, toKebabCaseComponentName as J, resolveImportee as K, parseJsLike$1 as L, getReadFileCheckMtime as M, BABEL_TS_MODULE_PARSER_OPTIONS$1 as N, pathExists as O, generate$1 as P, parseNpmPackageSpecifier as Q, traverse$1 as R, TYPELESS_PACKAGE_JSON_WARNING_CODE as S, resolveEntryExtensions as T, matches as U, getAliasEntries as V, normalizeAppJson as W, normalizeNpmImportLookupPath as X, hasNpmDependencyPrefix as Y, normalizeNpmImportPathByPlatform as Z, applyPreloadRulesToAppJson as _, resolveReExportedName as a, resolvePreloadPackageIdentifier as b, getProjectConfigRootKeys as c, resolveProjectConfigRoot as d, resolveProjectConfigSyncDirs as f, pruneOwnedAssetFiles as g, publishProjectConfigAssets as h, toAbsoluteId as i, getPathExistsTtlMs as j, readFile$2 as k, getProjectPrivateConfig as l, collectProjectConfigAssets as m, shouldResolveUsingComponentFrom as n, getProjectConfig as o, syncProjectConfigToOutput as p, resolveJson as q, usingComponentFromResolvedFile as r, getProjectConfigFileName as s, resolveWeappConfigFile as t, getProjectPrivateConfigFileName as u, collectPreloadPages as v, createCachedEntryResolveOptions as w, suggestPreloadRules as x, findPreloadRuleKey as y, ALIPAY_GENERIC_COMPONENT_PLACEHOLDER as z };
|
package/dist/vite.d.mts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import "./config-
|
|
1
|
+
import "./config-BNx2BODw.mjs";
|
|
2
2
|
import { ConfigEnv, Plugin } from "vite";
|
|
3
|
-
//#region src/vite/index.d.ts
|
|
4
3
|
/** 通过顶层 weapp 配置激活标准 Vite 小程序编译。 */
|
|
5
4
|
export declare function weapp(): Plugin[];
|
|
6
5
|
declare module 'vite' {
|
|
7
6
|
function defineConfig<T extends (env: ConfigEnv) => UserConfig | Promise<UserConfig>>(config: T): T;
|
|
8
|
-
}
|
|
9
|
-
//#endregion
|
|
7
|
+
}
|
package/dist/vite.mjs
CHANGED
|
@@ -1,8 +1,32 @@
|
|
|
1
|
-
import { i as isWeappViteHost } from "./pluginHost
|
|
2
|
-
import { t as bindHostLifecycle } from "./lifecycle-
|
|
1
|
+
import { i as isWeappViteHost } from "./pluginHost-vn8Vty1J.mjs";
|
|
2
|
+
import { i as takeHostLifecycle, n as setHostRestartData, r as takeHostConfigRestartData, t as bindHostLifecycle } from "./lifecycle-CUo8PMQc.mjs";
|
|
3
3
|
import process from "node:process";
|
|
4
|
+
import { WEAPP_VITE_HMR_RUNTIME_SESSION_HANDOFF_KEY } from "@weapp-core/constants";
|
|
4
5
|
import path from "pathe";
|
|
5
|
-
|
|
6
|
+
// src/vite/classicFallback.ts
|
|
7
|
+
/** 停止失败的宿主时同时保留原始错误与清理错误。 */
|
|
8
|
+
async function rethrowAfterHostCleanup(error, cleanup) {
|
|
9
|
+
try {
|
|
10
|
+
await cleanup();
|
|
11
|
+
} catch (cleanupError) {
|
|
12
|
+
if (cleanupError === error) throw error;
|
|
13
|
+
throw new AggregateError([error, cleanupError], "Host operation and cleanup failed", { cause: error });
|
|
14
|
+
}
|
|
15
|
+
throw error;
|
|
16
|
+
}
|
|
17
|
+
/** 通过公共宿主重启交接到 classic,当前构建只发布请求,不等待关闭自己。 */
|
|
18
|
+
function bindClassicFallback(server, runtime) {
|
|
19
|
+
return runtime.bindRequest(async () => {
|
|
20
|
+
try {
|
|
21
|
+
await server.restart();
|
|
22
|
+
} catch (error) {
|
|
23
|
+
const failure = error instanceof Error ? error : new Error(String(error));
|
|
24
|
+
server.config.logger.error("[weapp-vite] classic 回退失败,开发会话已停止。", { error: failure });
|
|
25
|
+
await rethrowAfterHostCleanup(failure, () => server.close());
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
// src/vite/environment.ts
|
|
6
30
|
/** 环境钩子捕获本轮会话,旧环境关闭不能清理重启后的新会话。 */
|
|
7
31
|
function createSessionEnvironmentPlugin(session, serve) {
|
|
8
32
|
return {
|
|
@@ -53,12 +77,12 @@ function createSessionEnvironmentPlugin(session, serve) {
|
|
|
53
77
|
}
|
|
54
78
|
},
|
|
55
79
|
async closeWatcher() {
|
|
56
|
-
await session.close
|
|
80
|
+
if (serve) await session.closeHostGeneration("close");
|
|
81
|
+
else await session.close();
|
|
57
82
|
}
|
|
58
83
|
};
|
|
59
84
|
}
|
|
60
|
-
|
|
61
|
-
//#region src/vite/options.ts
|
|
85
|
+
// src/vite/options.ts
|
|
62
86
|
async function resolvePlugins(options) {
|
|
63
87
|
const result = [];
|
|
64
88
|
for (const option of options ?? []) {
|
|
@@ -68,8 +92,7 @@ async function resolvePlugins(options) {
|
|
|
68
92
|
}
|
|
69
93
|
return result;
|
|
70
94
|
}
|
|
71
|
-
|
|
72
|
-
//#region src/vite/slots.ts
|
|
95
|
+
// src/vite/slots.ts
|
|
73
96
|
const descriptors = [
|
|
74
97
|
["weapp-vite:runtime-provider:web-runtime", "pre"],
|
|
75
98
|
["@weapp-vite/web", "pre"],
|
|
@@ -164,15 +187,16 @@ function createPluginSlots(apply) {
|
|
|
164
187
|
}
|
|
165
188
|
};
|
|
166
189
|
}
|
|
167
|
-
|
|
168
|
-
//#region src/vite/index.ts
|
|
190
|
+
// src/vite/index.ts
|
|
169
191
|
const PLUGIN_NAME = "weapp-vite:host";
|
|
192
|
+
const hmrRuntimeSessionKey = Symbol.for(WEAPP_VITE_HMR_RUNTIME_SESSION_HANDOFF_KEY);
|
|
170
193
|
/** 通过顶层 weapp 配置激活标准 Vite 小程序编译。 */
|
|
171
194
|
function weapp() {
|
|
172
195
|
let session;
|
|
173
196
|
let initializing = false;
|
|
174
197
|
let inactive = false;
|
|
175
198
|
let serveRequested = false;
|
|
199
|
+
let inheritedLifecycle;
|
|
176
200
|
const apply = (config) => !isWeappViteHost(config);
|
|
177
201
|
const slots = createPluginSlots(apply);
|
|
178
202
|
const coordinator = {
|
|
@@ -185,6 +209,7 @@ function weapp() {
|
|
|
185
209
|
if (initializing || session && session.state !== "closed") throw new Error("[weapp-vite] 同一插件实例不能被多个活动宿主复用,请为每个宿主调用 weapp()。");
|
|
186
210
|
initializing = true;
|
|
187
211
|
try {
|
|
212
|
+
inheritedLifecycle = takeHostLifecycle(config);
|
|
188
213
|
session = void 0;
|
|
189
214
|
serveRequested = false;
|
|
190
215
|
slots.bind([]);
|
|
@@ -200,10 +225,17 @@ function weapp() {
|
|
|
200
225
|
...config,
|
|
201
226
|
plugins: serveRequested ? userPlugins : []
|
|
202
227
|
};
|
|
203
|
-
const { WeappBuildSession } = await import("./session-
|
|
204
|
-
session = new WeappBuildSession();
|
|
228
|
+
const { WeappBuildSession } = await import("./session-COrQJYif.mjs");
|
|
229
|
+
session = new WeappBuildSession(takeHostConfigRestartData(inheritedLifecycle, hmrRuntimeSessionKey));
|
|
205
230
|
try {
|
|
206
|
-
const
|
|
231
|
+
const fallbackBeforePrepare = session.hmrRuntimeSession.fallback;
|
|
232
|
+
let merged = await session.prepare(hostConfig, path.resolve(config.root ?? process.cwd()), env.mode, serveRequested);
|
|
233
|
+
if (session.hmrRuntimeSession.phase === "switching" && session.hmrRuntimeSession.fallback !== fallbackBeforePrepare) {
|
|
234
|
+
const runtime = session.hmrRuntimeSession;
|
|
235
|
+
await session.close("restart");
|
|
236
|
+
session = new WeappBuildSession(runtime);
|
|
237
|
+
merged = await session.prepare(hostConfig, path.resolve(config.root ?? process.cwd()), env.mode, serveRequested);
|
|
238
|
+
}
|
|
207
239
|
session.context.configService.options.sourceConfig = {
|
|
208
240
|
...hostConfig,
|
|
209
241
|
root: session.context.configService.cwd,
|
|
@@ -216,8 +248,8 @@ function weapp() {
|
|
|
216
248
|
return normalized;
|
|
217
249
|
}
|
|
218
250
|
if (serveRequested) {
|
|
219
|
-
const { prepareDevHostConfig } = await import("./dev-
|
|
220
|
-
if (!session.statefulController && config.experimental?.bundledDev) throw new Error("[weapp-vite] classic 开发模式暂不支持 experimental.bundledDev,请关闭此选项。");
|
|
251
|
+
const { prepareDevHostConfig } = await import("./dev-D1QSExwk.mjs");
|
|
252
|
+
if (!session.statefulController && config.experimental?.bundledDev && !session.hmrRuntimeSession.fallback) throw new Error("[weapp-vite] classic 开发模式暂不支持 experimental.bundledDev,请关闭此选项。");
|
|
221
253
|
const host = prepareDevHostConfig(session, merged, config);
|
|
222
254
|
slots.bind((await resolvePlugins(host.plugins)).filter((plugin) => !configuredPlugins.includes(plugin)));
|
|
223
255
|
return host.config;
|
|
@@ -228,8 +260,7 @@ function weapp() {
|
|
|
228
260
|
if (normalized.build) normalized.build.emptyOutDir = config.build?.emptyOutDir;
|
|
229
261
|
return normalized;
|
|
230
262
|
} catch (error) {
|
|
231
|
-
await
|
|
232
|
-
throw error;
|
|
263
|
+
return await rethrowAfterHostCleanup(error, () => session.close(inheritedLifecycle ? "restart" : "close"));
|
|
233
264
|
}
|
|
234
265
|
} finally {
|
|
235
266
|
initializing = false;
|
|
@@ -247,13 +278,17 @@ function weapp() {
|
|
|
247
278
|
return result;
|
|
248
279
|
};
|
|
249
280
|
}
|
|
250
|
-
bindHostLifecycle(server, () => active.
|
|
281
|
+
bindHostLifecycle(server, (reason) => active.closeHostGeneration(reason), inheritedLifecycle, () => active.hmrRuntimeSession.phase === "switching", () => active.releaseHostClassicIdeConfig());
|
|
282
|
+
inheritedLifecycle = void 0;
|
|
251
283
|
try {
|
|
284
|
+
await setHostRestartData(server, hmrRuntimeSessionKey, active.hmrRuntimeSession);
|
|
252
285
|
await active.startDev(server);
|
|
253
286
|
} catch (error) {
|
|
254
|
-
await
|
|
255
|
-
throw error;
|
|
287
|
+
return await rethrowAfterHostCleanup(error, () => server.close());
|
|
256
288
|
}
|
|
289
|
+
return () => {
|
|
290
|
+
if (!active.isClosing) active.onClose(bindClassicFallback(server, active.hmrRuntimeSession));
|
|
291
|
+
};
|
|
257
292
|
},
|
|
258
293
|
configResolved(config) {
|
|
259
294
|
if (inactive || !session) return;
|
|
@@ -266,5 +301,4 @@ function weapp() {
|
|
|
266
301
|
};
|
|
267
302
|
return [coordinator, ...slots.plugins];
|
|
268
303
|
}
|
|
269
|
-
//#endregion
|
|
270
304
|
export { weapp };
|
package/dist/volar.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WEVU_DEFINE_PAGE_MACRO, WEVU_ROUTER_MODULE_ID } from "@weapp-core/constants";
|
|
2
|
-
|
|
2
|
+
// src/auto-import-presets/wevu.ts
|
|
3
3
|
const wevu = {
|
|
4
4
|
wevu: [
|
|
5
5
|
"createApp",
|
|
@@ -138,5 +138,4 @@ const wevu = {
|
|
|
138
138
|
],
|
|
139
139
|
[WEVU_ROUTER_MODULE_ID]: [WEVU_DEFINE_PAGE_MACRO]
|
|
140
140
|
};
|
|
141
|
-
//#endregion
|
|
142
141
|
export { wevu as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WEVU_DEFINE_PAGE_MACRO, WEVU_ROUTER_MODULE_ID } from "@weapp-core/constants";
|
|
2
|
-
|
|
2
|
+
// src/auto-import-presets/wevu-router.ts
|
|
3
3
|
const wevuRouter = { [WEVU_ROUTER_MODULE_ID]: [
|
|
4
4
|
WEVU_DEFINE_PAGE_MACRO,
|
|
5
5
|
"createRouter",
|
|
@@ -13,5 +13,4 @@ const wevuRouter = { [WEVU_ROUTER_MODULE_ID]: [
|
|
|
13
13
|
"createNavigationFailure",
|
|
14
14
|
"isNavigationFailure"
|
|
15
15
|
] };
|
|
16
|
-
//#endregion
|
|
17
16
|
export { wevuRouter as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as transformWxsCode } from "./wxs-BdHHXltv.mjs";
|