weapp-vite 6.15.11 → 6.15.12
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 +5 -4
- package/dist/{config-BDvKS_M_.d.mts → config-DzoHnvv-.d.mts} +20 -9
- package/dist/config.d.mts +1 -1
- package/dist/{createContext-BUQCMG_t.mjs → createContext-CySjzbQy.mjs} +261 -106
- package/dist/{file-DDTK6ARt.mjs → file-pbdfOAKg.mjs} +1 -1
- package/dist/file-slN_aOEg.mjs +2 -0
- package/dist/getInstance-BGGhJCLI.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/types.d.mts +1 -1
- package/package.json +5 -5
- package/dist/file-Cf2kMTOQ.mjs +0 -2
- package/dist/getInstance-Rhivhw3y.mjs +0 -2
package/dist/auto-routes.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as getCompilerContext, u as getRouteRuntimeGlobalKeys } from "./createContext-
|
|
1
|
+
import { i as getCompilerContext, u as getRouteRuntimeGlobalKeys } from "./createContext-CySjzbQy.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,6 +1,6 @@
|
|
|
1
|
-
import { S as isPathInside, _ as DEFAULT_MP_PLATFORM, b as resolveMiniPlatform, c as createSharedBuildConfig, d as resolveWeappConfigFile, f as checkRuntime, g as createCjsConfigLoadError, h as parseCommentJson, l as SHARED_CHUNK_VIRTUAL_PREFIX, m as loadViteConfigFile, n as syncProjectSupportFiles, p as getProjectConfigFileName, r as syncManagedTsconfigBootstrapFiles, s as formatBytes, t as createCompilerContext, v as getDefaultIdeProjectRoot, x as shouldPassPlatformArgToIdeOpen, y as normalizeMiniPlatform } from "./createContext-
|
|
1
|
+
import { S as isPathInside, _ as DEFAULT_MP_PLATFORM, b as resolveMiniPlatform, c as createSharedBuildConfig, d as resolveWeappConfigFile, f as checkRuntime, g as createCjsConfigLoadError, h as parseCommentJson, l as SHARED_CHUNK_VIRTUAL_PREFIX, m as loadViteConfigFile, n as syncProjectSupportFiles, p as getProjectConfigFileName, r as syncManagedTsconfigBootstrapFiles, s as formatBytes, t as createCompilerContext, v as getDefaultIdeProjectRoot, x as shouldPassPlatformArgToIdeOpen, y as normalizeMiniPlatform } from "./createContext-CySjzbQy.mjs";
|
|
2
2
|
import { r as logger_default, t as colors } from "./logger-CgxdNjvb.mjs";
|
|
3
|
-
import { h as VERSION } from "./file-
|
|
3
|
+
import { h as VERSION } from "./file-pbdfOAKg.mjs";
|
|
4
4
|
import { a as resolveWeappMcpConfig, o as startWeappViteMcpServer } from "./mcp-DRlj32v4.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import path, { posix } from "pathe";
|
|
@@ -2114,7 +2114,8 @@ function registerPrepareCommand(cli) {
|
|
|
2114
2114
|
isDev: false,
|
|
2115
2115
|
mode: typeof options.mode === "string" ? options.mode : "development",
|
|
2116
2116
|
configFile: resolveConfigFile(options),
|
|
2117
|
-
syncSupportFiles: false
|
|
2117
|
+
syncSupportFiles: false,
|
|
2118
|
+
preloadAppEntry: false
|
|
2118
2119
|
}));
|
|
2119
2120
|
logger_default.info("已生成 .weapp-vite 支持文件。");
|
|
2120
2121
|
} catch (error) {
|
|
@@ -2124,7 +2125,7 @@ function registerPrepareCommand(cli) {
|
|
|
2124
2125
|
}
|
|
2125
2126
|
//#endregion
|
|
2126
2127
|
//#region package.json
|
|
2127
|
-
var version = "6.15.
|
|
2128
|
+
var version = "6.15.12";
|
|
2128
2129
|
//#endregion
|
|
2129
2130
|
//#region src/cli/devHotkeys/format.ts
|
|
2130
2131
|
const FULLWIDTH_ASCII_START = 65281;
|
|
@@ -39,6 +39,13 @@ declare module 'vite' {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
//#endregion
|
|
42
|
+
//#region src/utils/importMeta.d.ts
|
|
43
|
+
interface ImportMetaDefineRegistry {
|
|
44
|
+
defineEntries: Record<string, any>;
|
|
45
|
+
envObject: Record<string, any>;
|
|
46
|
+
envMemberAccess: Record<string, any>;
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
42
49
|
//#region src/types/config/foundation.d.ts
|
|
43
50
|
type NpmBuildOptions = InlineConfig;
|
|
44
51
|
type MpPlatform$1 = MpPlatform;
|
|
@@ -356,6 +363,9 @@ interface ScanWxmlOptions {
|
|
|
356
363
|
*/
|
|
357
364
|
interface HandleWxmlOptions {
|
|
358
365
|
defineImportMetaEnv?: Record<string, any>;
|
|
366
|
+
importMetaDefineRegistry?: ImportMetaDefineRegistry;
|
|
367
|
+
importMetaRelativePath?: string;
|
|
368
|
+
importMetaExtension?: string;
|
|
359
369
|
removeComment?: boolean;
|
|
360
370
|
transformEvent?: boolean;
|
|
361
371
|
scriptModuleExtension?: string;
|
|
@@ -1136,12 +1146,16 @@ interface ConfigService {
|
|
|
1136
1146
|
packageManager: DetectResult;
|
|
1137
1147
|
packageInfo: PackageInfo;
|
|
1138
1148
|
setDefineEnv: (key: string, value: any) => void;
|
|
1149
|
+
setImportMetaEnvDefineOverride: (define?: Record<string, any>) => void;
|
|
1139
1150
|
load: (options?: Partial<LoadConfigOptions>) => Promise<LoadConfigResult>;
|
|
1140
1151
|
mergeWorkers: (...configs: Partial<InlineConfig>[]) => InlineConfig;
|
|
1141
1152
|
merge: (subPackageMeta?: SubPackageMetaValue, ...configs: Partial<InlineConfig | undefined>[]) => InlineConfig;
|
|
1142
1153
|
mergeWeb: (...configs: Partial<InlineConfig | undefined>[]) => InlineConfig | undefined;
|
|
1143
1154
|
mergeInlineConfig: (...configs: Partial<InlineConfig>[]) => InlineConfig;
|
|
1155
|
+
readonly importMetaDefineEntries: Record<string, any>;
|
|
1144
1156
|
readonly defineImportMetaEnv: Record<string, any>;
|
|
1157
|
+
readonly importMetaEnvDefineOverride?: Record<string, any>;
|
|
1158
|
+
readonly importMetaDefineRegistry: ImportMetaDefineRegistry;
|
|
1145
1159
|
readonly cwd: string;
|
|
1146
1160
|
readonly isDev: boolean;
|
|
1147
1161
|
readonly emitDefaultAutoImportOutputs: boolean;
|
|
@@ -1394,6 +1408,7 @@ interface RuntimeState {
|
|
|
1394
1408
|
config: {
|
|
1395
1409
|
packageInfo: PackageInfo;
|
|
1396
1410
|
defineEnv: Record<string, any>;
|
|
1411
|
+
importMetaEnvDefineOverride?: Record<string, any>;
|
|
1397
1412
|
packageManager: DetectResult;
|
|
1398
1413
|
options: LoadConfigResult;
|
|
1399
1414
|
};
|
|
@@ -1567,7 +1582,7 @@ type UserConfigFnObjectPlain<T extends UserConfig$1 = UserConfig$1> = (env: Conf
|
|
|
1567
1582
|
type UserConfigFnObject<T extends UserConfig$1 = UserConfig$1> = (env: ConfigEnv) => T;
|
|
1568
1583
|
type UserConfigFnPromise<T extends UserConfig$1 = UserConfig$1> = (env: ConfigEnv) => Promise<T>;
|
|
1569
1584
|
type UserConfigFn<T extends UserConfig$1 = UserConfig$1> = (env: ConfigEnv) => T | Promise<T>;
|
|
1570
|
-
type UserConfigExport<T extends UserConfig$1 = UserConfig$1> = T | Promise<T> |
|
|
1585
|
+
type UserConfigExport<T extends UserConfig$1 = UserConfig$1> = T | Promise<T> | UserConfigFnObject<T> | UserConfigFnPromise<T> | UserConfigFn<T>;
|
|
1571
1586
|
declare module 'vite' {
|
|
1572
1587
|
interface UserConfig {
|
|
1573
1588
|
weapp?: WeappViteConfig;
|
|
@@ -1575,14 +1590,10 @@ declare module 'vite' {
|
|
|
1575
1590
|
}
|
|
1576
1591
|
/**
|
|
1577
1592
|
* @description 为 weapp-vite 配置提供类型提示与推断
|
|
1578
|
-
* @description
|
|
1579
|
-
*
|
|
1580
|
-
*
|
|
1593
|
+
* @description 注意:这里不能继续使用对象/Promise/函数的多重重载;
|
|
1594
|
+
* @description 否则 `() => ({})` 这类函数式配置里的对象字面量会丢失上下文类型,
|
|
1595
|
+
* @description 导致 `platform` 等联合字面量字段被宽化为 `string`。
|
|
1581
1596
|
*/
|
|
1582
|
-
declare function defineConfig(config:
|
|
1583
|
-
declare function defineConfig(config: Promise<UserConfig$1>): Promise<UserConfig$1>;
|
|
1584
|
-
declare function defineConfig(config: UserConfigFnObjectPlain): UserConfigFnObjectPlain;
|
|
1585
|
-
declare function defineConfig(config: UserConfigFn): UserConfigFn;
|
|
1586
|
-
declare function defineConfig(config: UserConfigFnPromise): UserConfigFnPromise;
|
|
1597
|
+
declare function defineConfig<T extends UserConfigExport>(config: T): T;
|
|
1587
1598
|
//#endregion
|
|
1588
1599
|
export { WeappDebugConfig as $, JsonConfig as $t, Ref as A, WeappManagedServerTsconfigConfig as An, WeappWevuConfig as At, BindingErrorLike as B, resolveWeappViteHostMeta as Bn, GenerateExtensionsOptions as Bt, LoadConfigOptions as C, WeappLibDtsOptions as Cn, WeappRequestRuntimeConfig as Ct, MethodDefinitions$1 as D, WeappLibVueTscOptions as Dn, WeappVueConfig as Dt, InlineConfig$1 as E, WeappLibInternalDtsOptions as En, WeappSubPackageConfig as Et, RolldownPlugin as F, WeappViteHostMeta as Fn, BuildNpmPackageMeta as Ft, EntryJsonFragment as G, GenerateTemplateContext as Gt, BaseEntry as H, GenerateFilenamesOptions as Ht, RolldownPluginOption as I, WeappViteRuntime as In, ChunksConfig as It, ScanComponentItem as J, GenerateTemplateFileSource as Jt, PageEntry as K, GenerateTemplateEntry as Kt, RolldownWatchOptions as L, applyWeappViteHostMeta as Ln, CopyGlobs as Lt, RolldownBuild as M, WeappManagedTypeScriptConfig as Mn, Alias as Mt, RolldownOptions as N, WeappWebConfig as Nn, AliasOptions as Nt, Plugin$1 as O, WeappManagedAppTsconfigConfig as On, WeappVueTemplateConfig as Ot, RolldownOutput$1 as P, WEAPP_VITE_HOST_NAME as Pn, AlipayNpmMode as Pt, UserConfig$2 as Q, JsFormat as Qt, RolldownWatcher$1 as R, createWeappViteHostMeta as Rn, CopyOptions as Rt, CompilerContext as S, WeappLibConfig as Sn, WeappNpmConfig as St, ConfigEnv$1 as T, WeappLibFileName as Tn, WeappRouteRules as Tt, ComponentEntry as U, GenerateOptions as Ut, AppEntry as V, GenerateFileType as Vt, Entry as W, GenerateTemplate as Wt, ProjectConfig as X, GenerateTemplateScope as Xt, WxmlDep as Y, GenerateTemplateInlineSource as Yt, SubPackageMetaValue as Z, GenerateTemplatesConfig as Zt, definePageJson as _, SubPackageStyleConfigEntry as _n, WeappInjectRequestGlobalsTarget as _t, UserConfigFnNoEnvPlain as a, NpmBuildOptions as an, EnhanceOptions as at, ChangeEvent as b, SubPackageStyleScope as bn, WeappInjectWebRuntimeGlobalsTarget as bt, UserConfigFnPromise as c, NpmPluginPackageConfig as cn, MultiPlatformConfig as ct, Component$1 as d, ResolvedAlias as dn, WeappAppPreludeMode as dt, JsonMergeContext as en, WeappForwardConsoleConfig as et, Page$1 as f, SharedChunkDynamicImports as fn, WeappAutoRoutesConfig as ft, defineComponentJson as g, SubPackage as gn, WeappInjectRequestGlobalsConfig as gt, defineAppJson as h, SharedChunkStrategy as hn, WeappHmrConfig as ht, UserConfigFnNoEnv as i, MpPlatform$1 as in, AutoImportComponentsOption as it, ResolvedConfig as j, WeappManagedSharedTsconfigConfig as jn, WeappWorkerConfig as jt, PluginOption as k, WeappManagedNodeTsconfigConfig as kn, WeappWebRuntimeConfig as kt, defineConfig as l, NpmStrategy as ln, ScanWxmlOptions as lt, Theme$1 as m, SharedChunkOverride as mn, WeappAutoRoutesIncludePattern as mt, UserConfigExport as n, JsonMergeStage as nn, WeappViteConfig as nt, UserConfigFnObject as o, NpmDependencyPattern as on, EnhanceWxmlOptions as ot, Sitemap$1 as p, SharedChunkMode as pn, WeappAutoRoutesInclude as pt, ComponentsMap as q, GenerateTemplateFactory as qt, UserConfigFn as r, JsonMergeStrategy as rn, AutoImportComponents as rt, UserConfigFnObjectPlain as s, NpmMainPackageConfig as sn, HandleWxmlOptions as st, UserConfig$1 as t, JsonMergeFunction as tn, WeappForwardConsoleLogLevel as tt, App$1 as u, NpmSubPackageConfig as un, WeappAppPreludeConfig as ut, defineSitemapJson as v, SubPackageStyleConfigObject as vn, WeappInjectWeapiConfig as vt, ComputedDefinitions$1 as w, WeappLibEntryContext as wn, WeappRouteRule as wt, WeappVitePluginApi as x, WeappLibComponentJson as xn, WeappMcpConfig as xt, defineThemeJson as y, SubPackageStyleEntry as yn, WeappInjectWebRuntimeGlobalsConfig as yt, ViteDevServer$1 as z, isWeappViteHost as zn, GenerateDirsOptions as zt };
|
package/dist/config.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Bn as resolveWeappViteHostMeta, Fn as WeappViteHostMeta, In as WeappViteRuntime, Ln as applyWeappViteHostMeta, Pn as WEAPP_VITE_HOST_NAME, Rn as createWeappViteHostMeta, _ as definePageJson, a as UserConfigFnNoEnvPlain, c as UserConfigFnPromise, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, l as defineConfig, m as Theme, n as UserConfigExport, nt as WeappViteConfig, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, y as defineThemeJson, zn as isWeappViteHost } from "./config-
|
|
1
|
+
import { Bn as resolveWeappViteHostMeta, Fn as WeappViteHostMeta, In as WeappViteRuntime, Ln as applyWeappViteHostMeta, Pn as WEAPP_VITE_HOST_NAME, Rn as createWeappViteHostMeta, _ as definePageJson, a as UserConfigFnNoEnvPlain, c as UserConfigFnPromise, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, l as defineConfig, m as Theme, n as UserConfigExport, nt as WeappViteConfig, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, y as defineThemeJson, zn as isWeappViteHost } from "./config-DzoHnvv-.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 };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as applyWeappViteHostMeta } from "./pluginHost-BzPJL4F-.mjs";
|
|
2
2
|
import { n as configureLogger, r as logger_default } from "./logger-CgxdNjvb.mjs";
|
|
3
|
-
import { _ as jsExtensions, a as findJsonEntry, b as vueExtensions, c as isJsOrTs, d as touch, g as configExtensions, i as findJsEntry, l as isTemplate, n as changeFileExtension, o as findTemplateEntry, p as inlineAutoRoutesImports, r as findCssEntry, s as findVueEntry, t as extractConfigFromVue, v as supportedCssLangs, y as templateExtensions } from "./file-
|
|
3
|
+
import { _ as jsExtensions, a as findJsonEntry, b as vueExtensions, c as isJsOrTs, d as touch, g as configExtensions, i as findJsEntry, l as isTemplate, n as changeFileExtension, o as findTemplateEntry, p as inlineAutoRoutesImports, r as findCssEntry, s as findVueEntry, t as extractConfigFromVue, v as supportedCssLangs, y as templateExtensions } from "./file-pbdfOAKg.mjs";
|
|
4
4
|
import { createRequire, isBuiltin } from "node:module";
|
|
5
5
|
import path, { posix } from "pathe";
|
|
6
6
|
import path$1, { normalize, relative, win32 } from "node:path";
|
|
@@ -8015,14 +8015,14 @@ function createPackageBuilder(ctx, oxcVitePlugin) {
|
|
|
8015
8015
|
return path.resolve(root, rawOutDir);
|
|
8016
8016
|
}
|
|
8017
8017
|
function resolvePackageBuildTarget({ entry, name, options, outDir }) {
|
|
8018
|
-
const
|
|
8018
|
+
const importMetaDefineEntries = ctx.configService?.importMetaDefineEntries ?? {};
|
|
8019
8019
|
const mergedOptions = defu(options, {
|
|
8020
8020
|
configFile: false,
|
|
8021
8021
|
publicDir: false,
|
|
8022
8022
|
logLevel: "silent",
|
|
8023
8023
|
root: ctx.configService?.cwd ?? process$1.cwd(),
|
|
8024
8024
|
define: {
|
|
8025
|
-
...
|
|
8025
|
+
...importMetaDefineEntries,
|
|
8026
8026
|
"process.env.NODE_ENV": JSON.stringify("production")
|
|
8027
8027
|
},
|
|
8028
8028
|
plugins: [],
|
|
@@ -8253,6 +8253,19 @@ function resolvePlatformProjectRoot(configService) {
|
|
|
8253
8253
|
if (!configService) return "dist";
|
|
8254
8254
|
return normalizeRelativeDir(resolveProjectConfigRoot(configService.projectConfig, configService.platform) ?? "dist");
|
|
8255
8255
|
}
|
|
8256
|
+
function resolveDefaultNpmDistDir(configService) {
|
|
8257
|
+
if (!configService) return ".";
|
|
8258
|
+
if (typeof configService.outDir === "string" && configService.outDir) {
|
|
8259
|
+
if (path.isAbsolute(configService.outDir)) {
|
|
8260
|
+
const relativeOutDir = path.relative(configService.cwd, configService.outDir);
|
|
8261
|
+
if (relativeOutDir && !relativeOutDir.startsWith("..") && !path.isAbsolute(relativeOutDir)) return normalizeRelativeDir(relativeOutDir);
|
|
8262
|
+
return configService.outDir;
|
|
8263
|
+
}
|
|
8264
|
+
return normalizeRelativeDir(configService.outDir);
|
|
8265
|
+
}
|
|
8266
|
+
if (shouldUseProjectRootNpmDir(configService.platform)) return resolvePlatformProjectRoot(configService);
|
|
8267
|
+
return ".";
|
|
8268
|
+
}
|
|
8256
8269
|
function getPackNpmRelationList(ctx) {
|
|
8257
8270
|
const configService = requireConfigService(ctx, "解析 npm 关联列表前必须初始化 configService。");
|
|
8258
8271
|
const isMultiPlatformEnabled = configService.multiPlatform.enabled;
|
|
@@ -8271,9 +8284,9 @@ function getPackNpmRelationList(ctx) {
|
|
|
8271
8284
|
}];
|
|
8272
8285
|
}
|
|
8273
8286
|
if (!isMultiPlatformEnabled) {
|
|
8274
|
-
if (!hasManualRelations
|
|
8287
|
+
if (!hasManualRelations) return [{
|
|
8275
8288
|
...packNpmRelationList[0],
|
|
8276
|
-
miniprogramNpmDistDir: resolvePlatformProjectRoot(configService)
|
|
8289
|
+
miniprogramNpmDistDir: shouldUseProjectRootNpmDir(configService.platform) ? resolvePlatformProjectRoot(configService) : resolveDefaultNpmDistDir(configService)
|
|
8277
8290
|
}];
|
|
8278
8291
|
return packNpmRelationList;
|
|
8279
8292
|
}
|
|
@@ -9780,6 +9793,78 @@ function createSharedBuildConfig(configService, scanService) {
|
|
|
9780
9793
|
return { build: { rolldownOptions: { output: createSharedBuildOutput(configService, () => scanService.subPackageMap.keys()) } } };
|
|
9781
9794
|
}
|
|
9782
9795
|
//#endregion
|
|
9796
|
+
//#region src/utils/importMeta.ts
|
|
9797
|
+
const IMPORT_META_ENV_PREFIX = "import.meta.env.";
|
|
9798
|
+
function parseImportMetaDefineValue(value) {
|
|
9799
|
+
if (typeof value !== "string") return value;
|
|
9800
|
+
try {
|
|
9801
|
+
return JSON.parse(value);
|
|
9802
|
+
} catch {
|
|
9803
|
+
return value;
|
|
9804
|
+
}
|
|
9805
|
+
}
|
|
9806
|
+
function pickImportMetaEnvDefineEntries(define) {
|
|
9807
|
+
if (!define) return {};
|
|
9808
|
+
return Object.fromEntries(Object.entries(define).filter(([key]) => {
|
|
9809
|
+
return key === "import.meta.env" || key.startsWith(IMPORT_META_ENV_PREFIX);
|
|
9810
|
+
}));
|
|
9811
|
+
}
|
|
9812
|
+
function resolveImportMetaEnvObject(defineImportMetaEnv, fallbackEnv = {}) {
|
|
9813
|
+
const rawEnv = defineImportMetaEnv?.["import.meta.env"];
|
|
9814
|
+
const parsed = parseImportMetaDefineValue(rawEnv);
|
|
9815
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return fallbackEnv;
|
|
9816
|
+
return parsed;
|
|
9817
|
+
}
|
|
9818
|
+
function resolveImportMetaEnvMemberValues(defineImportMetaEnv, fallbackEnv = {}) {
|
|
9819
|
+
const values = { ...resolveImportMetaEnvObject(defineImportMetaEnv, fallbackEnv) };
|
|
9820
|
+
for (const [key, value] of Object.entries(defineImportMetaEnv ?? {})) {
|
|
9821
|
+
if (key === "import.meta.env" || !key.startsWith(IMPORT_META_ENV_PREFIX)) continue;
|
|
9822
|
+
values[key.slice(16)] = parseImportMetaDefineValue(value);
|
|
9823
|
+
}
|
|
9824
|
+
return values;
|
|
9825
|
+
}
|
|
9826
|
+
function createImportMetaDefineRegistry(options) {
|
|
9827
|
+
const baseEnv = { ...options?.baseEnv ?? {} };
|
|
9828
|
+
const explicitDefineEntries = pickImportMetaEnvDefineEntries(options?.defineEntries);
|
|
9829
|
+
const defaultDefineEntries = {};
|
|
9830
|
+
for (const [key, value] of Object.entries(baseEnv)) defaultDefineEntries[`${IMPORT_META_ENV_PREFIX}${key}`] = JSON.stringify(value);
|
|
9831
|
+
defaultDefineEntries["import.meta.env"] = JSON.stringify(baseEnv);
|
|
9832
|
+
const defineEntries = {
|
|
9833
|
+
...defaultDefineEntries,
|
|
9834
|
+
...explicitDefineEntries
|
|
9835
|
+
};
|
|
9836
|
+
return {
|
|
9837
|
+
defineEntries,
|
|
9838
|
+
envObject: resolveImportMetaEnvObject(defineEntries, baseEnv),
|
|
9839
|
+
envMemberAccess: resolveImportMetaEnvMemberValues(defineEntries, baseEnv)
|
|
9840
|
+
};
|
|
9841
|
+
}
|
|
9842
|
+
function createStaticImportMetaValues(options) {
|
|
9843
|
+
const normalizedRelativePath = normalizeRelativePath(path.extname(options.relativePath) ? options.relativePath.slice(0, -path.extname(options.relativePath).length) : options.relativePath);
|
|
9844
|
+
const normalizedExtension = options.extension.startsWith(".") ? options.extension.slice(1) : options.extension;
|
|
9845
|
+
const url = `/${normalizedRelativePath}${normalizedExtension ? `.${normalizedExtension}` : ""}`;
|
|
9846
|
+
const dirname = normalizeRelativePath(path.dirname(url)) || "/";
|
|
9847
|
+
return {
|
|
9848
|
+
filename: url,
|
|
9849
|
+
url,
|
|
9850
|
+
dirname: dirname === "." ? "/" : dirname,
|
|
9851
|
+
env: options.importMetaDefineRegistry?.envObject ?? {},
|
|
9852
|
+
envAccess: options.importMetaDefineRegistry?.envMemberAccess ?? {}
|
|
9853
|
+
};
|
|
9854
|
+
}
|
|
9855
|
+
function createStaticImportMetaReplacementMap(options) {
|
|
9856
|
+
const values = createStaticImportMetaValues(options);
|
|
9857
|
+
const defineEntries = options.importMetaDefineRegistry?.defineEntries ?? {};
|
|
9858
|
+
const envJson = typeof defineEntries["import.meta.env"] === "string" ? defineEntries["import.meta.env"] : JSON.stringify(values.env);
|
|
9859
|
+
return {
|
|
9860
|
+
...defineEntries,
|
|
9861
|
+
"import.meta.filename": JSON.stringify(values.filename),
|
|
9862
|
+
"import.meta.url": JSON.stringify(values.url),
|
|
9863
|
+
"import.meta.dirname": JSON.stringify(values.dirname),
|
|
9864
|
+
"import.meta": `{"filename":${JSON.stringify(values.filename)},"url":${JSON.stringify(values.url)},"dirname":${JSON.stringify(values.dirname)},"env":${envJson}}`
|
|
9865
|
+
};
|
|
9866
|
+
}
|
|
9867
|
+
//#endregion
|
|
9783
9868
|
//#region src/runtime/independentError.ts
|
|
9784
9869
|
const ANSI_ESCAPE_PATTERN = /\u001B\[[0-9;]*m/g;
|
|
9785
9870
|
function stripAnsi(value) {
|
|
@@ -9871,30 +9956,12 @@ function createIndependentBuildError(root, cause) {
|
|
|
9871
9956
|
}
|
|
9872
9957
|
//#endregion
|
|
9873
9958
|
//#region src/runtime/buildPlugin/independent.ts
|
|
9874
|
-
function
|
|
9875
|
-
const previous =
|
|
9876
|
-
|
|
9877
|
-
|
|
9878
|
-
};
|
|
9879
|
-
const importMetaEnvPrefix = "import.meta.env.";
|
|
9880
|
-
for (const [key, value] of Object.entries(define)) {
|
|
9881
|
-
if (key === "import.meta.env") {
|
|
9882
|
-
try {
|
|
9883
|
-
const parsed = typeof value === "string" ? JSON.parse(value) : value;
|
|
9884
|
-
if (parsed && typeof parsed === "object") for (const [envKey, envValue] of Object.entries(parsed)) configService.setDefineEnv(envKey, envValue);
|
|
9885
|
-
} catch {}
|
|
9886
|
-
continue;
|
|
9887
|
-
}
|
|
9888
|
-
if (!key.startsWith(importMetaEnvPrefix)) continue;
|
|
9889
|
-
const envKey = key.slice(16);
|
|
9890
|
-
try {
|
|
9891
|
-
configService.setDefineEnv(envKey, typeof value === "string" ? JSON.parse(value) : value);
|
|
9892
|
-
} catch {
|
|
9893
|
-
configService.setDefineEnv(envKey, value);
|
|
9894
|
-
}
|
|
9895
|
-
}
|
|
9959
|
+
function syncImportMetaEnvDefineOverride(configService, define) {
|
|
9960
|
+
const previous = configService.importMetaEnvDefineOverride;
|
|
9961
|
+
const next = pickImportMetaEnvDefineEntries(define);
|
|
9962
|
+
configService.setImportMetaEnvDefineOverride(next);
|
|
9896
9963
|
return () => {
|
|
9897
|
-
configService.
|
|
9964
|
+
configService.setImportMetaEnvDefineOverride(previous);
|
|
9898
9965
|
};
|
|
9899
9966
|
}
|
|
9900
9967
|
function createIndependentBuilder(configService, buildState) {
|
|
@@ -9922,7 +9989,7 @@ function createIndependentBuilder(configService, buildState) {
|
|
|
9922
9989
|
return `${chunkRoot}/[name].js`;
|
|
9923
9990
|
} } }
|
|
9924
9991
|
} });
|
|
9925
|
-
const restoreDefineEnv =
|
|
9992
|
+
const restoreDefineEnv = syncImportMetaEnvDefineOverride(configService, inlineConfig.define);
|
|
9926
9993
|
let result;
|
|
9927
9994
|
try {
|
|
9928
9995
|
result = await build(inlineConfig);
|
|
@@ -11079,6 +11146,33 @@ function injectResolvedAliases(config, aliases) {
|
|
|
11079
11146
|
}
|
|
11080
11147
|
resolve.alias = aliasArray;
|
|
11081
11148
|
}
|
|
11149
|
+
function normalizeManagedPathAliasKey(key) {
|
|
11150
|
+
if (!key || key.includes("*") && !key.endsWith("/*")) return;
|
|
11151
|
+
return key.endsWith("/*") ? key.slice(0, -2) : key;
|
|
11152
|
+
}
|
|
11153
|
+
function normalizeManagedPathAliasTarget(target) {
|
|
11154
|
+
if (!target || target.includes("*") && !target.endsWith("/*")) return;
|
|
11155
|
+
return target.endsWith("/*") ? target.slice(0, -2) : target;
|
|
11156
|
+
}
|
|
11157
|
+
function collectManagedTsconfigAliases(config, cwd) {
|
|
11158
|
+
const weappTypeScript = config.weapp?.typescript;
|
|
11159
|
+
const pathSources = [weappTypeScript?.shared?.compilerOptions?.paths, weappTypeScript?.app?.compilerOptions?.paths];
|
|
11160
|
+
const aliasMap = /* @__PURE__ */ new Map();
|
|
11161
|
+
for (const pathsConfig of pathSources) {
|
|
11162
|
+
if (!pathsConfig || typeof pathsConfig !== "object") continue;
|
|
11163
|
+
for (const [key, value] of Object.entries(pathsConfig)) {
|
|
11164
|
+
const find = normalizeManagedPathAliasKey(key);
|
|
11165
|
+
const target = Array.isArray(value) ? value.find((item) => typeof item === "string") : void 0;
|
|
11166
|
+
const normalizedTarget = typeof target === "string" ? normalizeManagedPathAliasTarget(target) : void 0;
|
|
11167
|
+
if (!find || !normalizedTarget) continue;
|
|
11168
|
+
aliasMap.set(find, path.resolve(cwd, normalizedTarget));
|
|
11169
|
+
}
|
|
11170
|
+
}
|
|
11171
|
+
return Array.from(aliasMap, ([find, replacement]) => ({
|
|
11172
|
+
find,
|
|
11173
|
+
replacement
|
|
11174
|
+
}));
|
|
11175
|
+
}
|
|
11082
11176
|
function createLoadConfig(options) {
|
|
11083
11177
|
const { injectBuiltinAliases, oxcRolldownPlugin, oxcVitePlugin } = options;
|
|
11084
11178
|
return async function loadConfig(opts) {
|
|
@@ -11173,6 +11267,7 @@ function createLoadConfig(options) {
|
|
|
11173
11267
|
srcRoot: rawLibConfig.root
|
|
11174
11268
|
};
|
|
11175
11269
|
const srcRoot = config.weapp?.srcRoot ?? "";
|
|
11270
|
+
injectResolvedAliases(config, collectManagedTsconfigAliases(config, cwd));
|
|
11176
11271
|
const tsconfigPathsUsage = await inspectTsconfigPathsUsage(cwd);
|
|
11177
11272
|
if (!tsconfigPathsUsage.enabled) injectDefaultSrcAlias(config, cwd, srcRoot);
|
|
11178
11273
|
else if (tsconfigPathsUsage.references && !tsconfigPathsUsage.root) {
|
|
@@ -12992,41 +13087,6 @@ function emitNativeLayoutScriptChunkIfNeeded$1(options) {
|
|
|
12992
13087
|
return true;
|
|
12993
13088
|
}
|
|
12994
13089
|
//#endregion
|
|
12995
|
-
//#region src/utils/importMeta.ts
|
|
12996
|
-
function resolveImportMetaEnvObject(defineImportMetaEnv) {
|
|
12997
|
-
const rawEnv = defineImportMetaEnv?.["import.meta.env"];
|
|
12998
|
-
if (typeof rawEnv !== "string") return {};
|
|
12999
|
-
try {
|
|
13000
|
-
const parsed = JSON.parse(rawEnv);
|
|
13001
|
-
return parsed && typeof parsed === "object" ? parsed : {};
|
|
13002
|
-
} catch {
|
|
13003
|
-
return {};
|
|
13004
|
-
}
|
|
13005
|
-
}
|
|
13006
|
-
function createStaticImportMetaValues(options) {
|
|
13007
|
-
const normalizedRelativePath = normalizeRelativePath(path.extname(options.relativePath) ? options.relativePath.slice(0, -path.extname(options.relativePath).length) : options.relativePath);
|
|
13008
|
-
const normalizedExtension = options.extension.startsWith(".") ? options.extension.slice(1) : options.extension;
|
|
13009
|
-
const url = `/${normalizedRelativePath}${normalizedExtension ? `.${normalizedExtension}` : ""}`;
|
|
13010
|
-
const dirname = normalizeRelativePath(path.dirname(url)) || "/";
|
|
13011
|
-
return {
|
|
13012
|
-
filename: url,
|
|
13013
|
-
url,
|
|
13014
|
-
dirname: dirname === "." ? "/" : dirname,
|
|
13015
|
-
env: resolveImportMetaEnvObject(options.defineImportMetaEnv)
|
|
13016
|
-
};
|
|
13017
|
-
}
|
|
13018
|
-
function createStaticImportMetaReplacementMap(options) {
|
|
13019
|
-
const values = createStaticImportMetaValues(options);
|
|
13020
|
-
const envJson = typeof options.defineImportMetaEnv?.["import.meta.env"] === "string" ? options.defineImportMetaEnv["import.meta.env"] : JSON.stringify(values.env);
|
|
13021
|
-
return {
|
|
13022
|
-
...options.defineImportMetaEnv ?? {},
|
|
13023
|
-
"import.meta.filename": JSON.stringify(values.filename),
|
|
13024
|
-
"import.meta.url": JSON.stringify(values.url),
|
|
13025
|
-
"import.meta.dirname": JSON.stringify(values.dirname),
|
|
13026
|
-
"import.meta": `{"filename":${JSON.stringify(values.filename)},"url":${JSON.stringify(values.url)},"dirname":${JSON.stringify(values.dirname)},"env":${envJson}}`
|
|
13027
|
-
};
|
|
13028
|
-
}
|
|
13029
|
-
//#endregion
|
|
13030
13090
|
//#region src/wxs/utils.ts
|
|
13031
13091
|
function normalizeWxsFilename(value, extension = "wxs") {
|
|
13032
13092
|
const normalized = extension.startsWith(".") ? extension.slice(1) : extension;
|
|
@@ -13198,12 +13258,23 @@ function replaceDefineImportMetaEnv(code, defineImportMetaEnv) {
|
|
|
13198
13258
|
for (const range of replacementRanges.sort((left, right) => left.start - right.start)) ms.update(range.start, range.end, range.value);
|
|
13199
13259
|
return ms.toString();
|
|
13200
13260
|
}
|
|
13261
|
+
function resolveDefineImportMetaEnv(options) {
|
|
13262
|
+
if (options.importMetaDefineRegistry && options.importMetaRelativePath) return createStaticImportMetaReplacementMap({
|
|
13263
|
+
importMetaDefineRegistry: options.importMetaDefineRegistry,
|
|
13264
|
+
extension: options.importMetaExtension ?? options.templateExtension ?? "",
|
|
13265
|
+
relativePath: options.importMetaRelativePath
|
|
13266
|
+
});
|
|
13267
|
+
return options.defineImportMetaEnv;
|
|
13268
|
+
}
|
|
13201
13269
|
function createCacheKey$1(options) {
|
|
13202
13270
|
const extension = options.scriptModuleExtension ?? "";
|
|
13203
13271
|
const tag = options.scriptModuleTag ?? "";
|
|
13204
13272
|
const templateExt = options.templateExtension ?? "";
|
|
13205
|
-
const
|
|
13206
|
-
|
|
13273
|
+
const importMetaRelativePath = options.importMetaRelativePath ?? "";
|
|
13274
|
+
const importMetaExtension = options.importMetaExtension ?? "";
|
|
13275
|
+
const resolvedDefineImportMetaEnv = resolveDefineImportMetaEnv(options);
|
|
13276
|
+
const defineKeys = resolvedDefineImportMetaEnv ? Object.keys(resolvedDefineImportMetaEnv).sort().map((key) => `${key}:${String(resolvedDefineImportMetaEnv[key])}`).join(",") : "";
|
|
13277
|
+
return `${options.removeComment ? 1 : 0}|${options.transformEvent ? 1 : 0}|${extension}|${tag}|${templateExt}|${importMetaExtension}|${importMetaRelativePath}|${defineKeys}`;
|
|
13207
13278
|
}
|
|
13208
13279
|
function getCachedResult(data, cacheKey) {
|
|
13209
13280
|
return handleCache.get(data)?.get(cacheKey);
|
|
@@ -13236,6 +13307,9 @@ function getCachedInlineWxsTransform(code, extension) {
|
|
|
13236
13307
|
function handleWxml(data, options) {
|
|
13237
13308
|
const opts = defu(options, {
|
|
13238
13309
|
defineImportMetaEnv: void 0,
|
|
13310
|
+
importMetaDefineRegistry: void 0,
|
|
13311
|
+
importMetaRelativePath: void 0,
|
|
13312
|
+
importMetaExtension: void 0,
|
|
13239
13313
|
removeComment: true,
|
|
13240
13314
|
transformEvent: true,
|
|
13241
13315
|
scriptModuleExtension: void 0,
|
|
@@ -13262,7 +13336,8 @@ function handleWxml(data, options) {
|
|
|
13262
13336
|
const shouldTransformScriptModuleTags = resolvedScriptTag !== "wxs" && scriptModuleTagTokens.length > 0;
|
|
13263
13337
|
const shouldRemoveConditionals = removalRanges.length > 0;
|
|
13264
13338
|
const shouldRemoveComments = opts.removeComment && commentTokens.length > 0;
|
|
13265
|
-
const
|
|
13339
|
+
const resolvedDefineImportMetaEnv = resolveDefineImportMetaEnv(opts);
|
|
13340
|
+
const shouldReplaceDefineImportMetaEnv = !!resolvedDefineImportMetaEnv && Object.keys(resolvedDefineImportMetaEnv).length > 0;
|
|
13266
13341
|
if (!shouldNormalizeImports && !shouldNormalizeTemplateImports && !shouldRemoveLang && !shouldTransformInlineWxs && !shouldTransformEvents && !shouldTransformDirectives && !shouldTransformTagNames && !shouldTransformScriptModuleTags && !shouldRemoveConditionals && !shouldRemoveComments && !shouldReplaceDefineImportMetaEnv) return setCachedResult(data, cacheKey, {
|
|
13267
13342
|
code,
|
|
13268
13343
|
components,
|
|
@@ -13297,7 +13372,7 @@ function handleWxml(data, options) {
|
|
|
13297
13372
|
}
|
|
13298
13373
|
if (shouldRemoveComments) for (const { end, start } of commentTokens) ms.remove(start, end);
|
|
13299
13374
|
return setCachedResult(data, cacheKey, {
|
|
13300
|
-
code: replaceDefineImportMetaEnv(shouldNormalizeScriptModuleAttributes(resolvedScriptTag) ? normalizeImportSjsAttributes(ms.toString()) : ms.toString(),
|
|
13375
|
+
code: replaceDefineImportMetaEnv(shouldNormalizeScriptModuleAttributes(resolvedScriptTag) ? normalizeImportSjsAttributes(ms.toString()) : ms.toString(), resolvedDefineImportMetaEnv),
|
|
13301
13376
|
components,
|
|
13302
13377
|
deps
|
|
13303
13378
|
});
|
|
@@ -13340,15 +13415,13 @@ function resolveWxmlEmitTargets(options) {
|
|
|
13340
13415
|
});
|
|
13341
13416
|
}
|
|
13342
13417
|
function emitWxmlAssetFile(options) {
|
|
13343
|
-
const { runtime, id, fileName, token, deps, emittedCodeCache,
|
|
13418
|
+
const { runtime, id, fileName, token, deps, emittedCodeCache, importMetaDefineRegistry, scriptModuleExtension, scriptModuleTag, templateExtension } = options;
|
|
13344
13419
|
runtime.addWatchFile?.(normalizeWatchPath(id));
|
|
13345
13420
|
if (deps) for (const dep of deps) runtime.addWatchFile?.(normalizeWatchPath(dep));
|
|
13346
13421
|
const result = handleWxml(token, {
|
|
13347
|
-
|
|
13348
|
-
|
|
13349
|
-
|
|
13350
|
-
relativePath: fileName
|
|
13351
|
-
}),
|
|
13422
|
+
importMetaDefineRegistry,
|
|
13423
|
+
importMetaExtension: templateExtension,
|
|
13424
|
+
importMetaRelativePath: fileName,
|
|
13352
13425
|
scriptModuleExtension,
|
|
13353
13426
|
scriptModuleTag,
|
|
13354
13427
|
templateExtension
|
|
@@ -13380,7 +13453,7 @@ function emitWxmlAssetsWithCache(options) {
|
|
|
13380
13453
|
token,
|
|
13381
13454
|
deps: wxmlService.depsMap.get(id),
|
|
13382
13455
|
emittedCodeCache,
|
|
13383
|
-
|
|
13456
|
+
importMetaDefineRegistry: configService.importMetaDefineRegistry,
|
|
13384
13457
|
scriptModuleExtension,
|
|
13385
13458
|
scriptModuleTag,
|
|
13386
13459
|
templateExtension
|
|
@@ -28894,7 +28967,7 @@ function replaceImportMetaAccess(code, options) {
|
|
|
28894
28967
|
MemberExpression(path) {
|
|
28895
28968
|
const envPropertyName = getImportMetaEnvPropertyName(path.node);
|
|
28896
28969
|
if (envPropertyName) {
|
|
28897
|
-
const envValue = Object.hasOwn(values.
|
|
28970
|
+
const envValue = Object.hasOwn(values.envAccess, envPropertyName) ? values.envAccess[envPropertyName] : void 0;
|
|
28898
28971
|
path.replaceWith(import_lib.valueToNode(envValue));
|
|
28899
28972
|
mutated = true;
|
|
28900
28973
|
return;
|
|
@@ -28922,7 +28995,7 @@ function replaceImportMetaAccess(code, options) {
|
|
|
28922
28995
|
OptionalMemberExpression(path) {
|
|
28923
28996
|
const envPropertyName = getImportMetaEnvPropertyName(path.node);
|
|
28924
28997
|
if (envPropertyName) {
|
|
28925
|
-
const envValue = Object.hasOwn(values.
|
|
28998
|
+
const envValue = Object.hasOwn(values.envAccess, envPropertyName) ? values.envAccess[envPropertyName] : void 0;
|
|
28926
28999
|
path.replaceWith(import_lib.valueToNode(envValue));
|
|
28927
29000
|
mutated = true;
|
|
28928
29001
|
return;
|
|
@@ -28981,10 +29054,44 @@ function replaceImportMetaAccessInSfc(source, options) {
|
|
|
28981
29054
|
}
|
|
28982
29055
|
//#endregion
|
|
28983
29056
|
//#region src/plugins/core/lifecycle/emit/rewrite/literals.ts
|
|
28984
|
-
|
|
29057
|
+
const SCRIPT_ENTRY_CANDIDATES = [
|
|
29058
|
+
"index.js",
|
|
29059
|
+
"index.mjs",
|
|
29060
|
+
"index.cjs"
|
|
29061
|
+
];
|
|
29062
|
+
const SCRIPT_FILE_EXTENSIONS = [
|
|
29063
|
+
".js",
|
|
29064
|
+
".mjs",
|
|
29065
|
+
".cjs"
|
|
29066
|
+
];
|
|
29067
|
+
const SCRIPT_FILE_RE = /\.[cm]?js$/i;
|
|
29068
|
+
const resolvePackageJson = createRequire(import.meta.url);
|
|
29069
|
+
function resolveInstalledPackageEntryRoot(importee, basedir) {
|
|
29070
|
+
const parsed = parseNpmPackageSpecifier(importee);
|
|
29071
|
+
if (!parsed) return;
|
|
29072
|
+
try {
|
|
29073
|
+
const packageJsonPath = resolvePackageJson.resolve(`${parsed.packageName}/package.json`, { paths: basedir ? [basedir] : void 0 });
|
|
29074
|
+
const packageRoot = path.dirname(packageJsonPath);
|
|
29075
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
29076
|
+
const miniprogramRoot = typeof packageJson.miniprogram === "string" && packageJson.miniprogram ? packageJson.miniprogram : void 0;
|
|
29077
|
+
return {
|
|
29078
|
+
...parsed,
|
|
29079
|
+
entryRoot: miniprogramRoot ? path.resolve(packageRoot, miniprogramRoot) : packageRoot
|
|
29080
|
+
};
|
|
29081
|
+
} catch {
|
|
29082
|
+
return;
|
|
29083
|
+
}
|
|
29084
|
+
}
|
|
29085
|
+
function normalizeWeappLocalNpmImport(importee, basedir) {
|
|
28985
29086
|
const normalized = normalizeNpmImportLookupPath(importee);
|
|
28986
29087
|
const segments = normalized.split("/").filter(Boolean);
|
|
28987
29088
|
if (segments.length === 1 || segments.length === 2 && normalized.startsWith("@")) return `${normalized}/index`;
|
|
29089
|
+
if (SCRIPT_FILE_RE.test(normalized)) return normalized;
|
|
29090
|
+
const resolved = resolveInstalledPackageEntryRoot(normalized, basedir);
|
|
29091
|
+
if (!resolved?.subPath) return normalized;
|
|
29092
|
+
const targetPath = path.resolve(resolved.entryRoot, resolved.subPath);
|
|
29093
|
+
if (SCRIPT_FILE_EXTENSIONS.some((ext) => existsSync(`${targetPath}${ext}`))) return normalized;
|
|
29094
|
+
if (SCRIPT_ENTRY_CANDIDATES.some((candidate) => existsSync(path.resolve(targetPath, candidate)))) return `${normalized}/index`;
|
|
28988
29095
|
return normalized;
|
|
28989
29096
|
}
|
|
28990
29097
|
function getRequireImportLiteral(node) {
|
|
@@ -29158,8 +29265,8 @@ function matchesSubPackageDependency(dependencies, importee, fallbackDependencie
|
|
|
29158
29265
|
}
|
|
29159
29266
|
//#endregion
|
|
29160
29267
|
//#region src/plugins/core/lifecycle/emit/rewrite/localRoot.ts
|
|
29161
|
-
function toRelativeRuntimeNpmImport(fileName, root, importee) {
|
|
29162
|
-
const normalized = normalizeWeappLocalNpmImport(importee);
|
|
29268
|
+
function toRelativeRuntimeNpmImport(fileName, root, importee, basedir) {
|
|
29269
|
+
const normalized = normalizeWeappLocalNpmImport(importee, basedir);
|
|
29163
29270
|
const target = root ? `${root}/miniprogram_npm/${normalized}` : `miniprogram_npm/${normalized}`;
|
|
29164
29271
|
const relative = toPosixPath(path.relative(path.dirname(fileName), target));
|
|
29165
29272
|
return relative.startsWith(".") ? relative : `./${relative}`;
|
|
@@ -29178,7 +29285,7 @@ function rewriteChunkNpmImportsToLocalRoot(chunk, root, dependencyPatterns, depe
|
|
|
29178
29285
|
const firstArg = args[0];
|
|
29179
29286
|
const currentValue = getRequireImportLiteral(firstArg);
|
|
29180
29287
|
if (typeof currentValue !== "string" || !matchesSubPackageDependency(dependencyPatterns, currentValue, dependencies)) return;
|
|
29181
|
-
const nextValue = toRelativeRuntimeNpmImport(chunk.fileName, root, currentValue);
|
|
29288
|
+
const nextValue = toRelativeRuntimeNpmImport(chunk.fileName, root, currentValue, options?.basedir);
|
|
29182
29289
|
if (nextValue === currentValue) return;
|
|
29183
29290
|
setRequireImportLiteral(firstArg, nextValue);
|
|
29184
29291
|
mutated = true;
|
|
@@ -29186,9 +29293,10 @@ function rewriteChunkNpmImportsToLocalRoot(chunk, root, dependencyPatterns, depe
|
|
|
29186
29293
|
if (mutated) chunk.code = generate(ast).code;
|
|
29187
29294
|
} catch {}
|
|
29188
29295
|
}
|
|
29189
|
-
function rewriteJsonNpmImportsToLocalRoot(bundle, root, dependencyPatterns, dependencies) {
|
|
29296
|
+
function rewriteJsonNpmImportsToLocalRoot(bundle, root, dependencyPatterns, dependencies, basedir, options) {
|
|
29190
29297
|
for (const output of Object.values(bundle)) {
|
|
29191
29298
|
if (output?.type !== "asset" || typeof output.fileName !== "string" || !output.fileName.endsWith(".json")) continue;
|
|
29299
|
+
if (options?.excludeRoots?.some((excludeRoot) => output.fileName === excludeRoot || output.fileName.startsWith(`${excludeRoot}/`))) continue;
|
|
29192
29300
|
if (root && (output.fileName === `${root}.json` || !output.fileName.startsWith(`${root}/`))) continue;
|
|
29193
29301
|
const source = typeof output.source === "string" ? output.source : output.source?.toString();
|
|
29194
29302
|
if (!source) continue;
|
|
@@ -29198,7 +29306,7 @@ function rewriteJsonNpmImportsToLocalRoot(bundle, root, dependencyPatterns, depe
|
|
|
29198
29306
|
let mutated = false;
|
|
29199
29307
|
for (const [componentName, importee] of Object.entries(parsed.usingComponents)) {
|
|
29200
29308
|
if (typeof importee !== "string" || !matchesSubPackageDependency(dependencyPatterns, importee, dependencies)) continue;
|
|
29201
|
-
parsed.usingComponents[componentName] = toRelativeRuntimeNpmImport(output.fileName, root, importee);
|
|
29309
|
+
parsed.usingComponents[componentName] = toRelativeRuntimeNpmImport(output.fileName, root, importee, basedir);
|
|
29202
29310
|
mutated = true;
|
|
29203
29311
|
}
|
|
29204
29312
|
if (mutated) output.source = `${JSON.stringify(parsed, null, 2)}\n`;
|
|
@@ -29521,7 +29629,7 @@ async function resolveAppPreludeCode(preludePath, options) {
|
|
|
29521
29629
|
if (hasModuleSyntax) throw new Error("[app.prelude] 当前仅支持无 import/export 的自包含脚本。");
|
|
29522
29630
|
const transformed = await transformWithOxc(source, preludePath);
|
|
29523
29631
|
const normalizedCode = (options?.relativePath ? replaceImportMetaAccess(transformed.code, {
|
|
29524
|
-
|
|
29632
|
+
importMetaDefineRegistry: options.importMetaDefineRegistry,
|
|
29525
29633
|
extension: path.extname(preludePath),
|
|
29526
29634
|
relativePath: options.relativePath
|
|
29527
29635
|
}) : transformed.code).replace(USE_STRICT_PREFIX_RE, "").trim();
|
|
@@ -29609,8 +29717,11 @@ function createGenerateBundleHook(state, isPluginBuild) {
|
|
|
29609
29717
|
if (isPluginBuild) {
|
|
29610
29718
|
filterPluginBundleOutputs(rolldownBundle, configService);
|
|
29611
29719
|
if (!shouldRewriteBundleNpmImports(configService.platform)) {
|
|
29612
|
-
for (const output of Object.values(rolldownBundle)) if (output?.type === "chunk") rewriteChunkNpmImportsToLocalRoot(output, "", void 0, npmBuildCandidateDependencies, {
|
|
29613
|
-
|
|
29720
|
+
for (const output of Object.values(rolldownBundle)) if (output?.type === "chunk") rewriteChunkNpmImportsToLocalRoot(output, "", void 0, npmBuildCandidateDependencies, {
|
|
29721
|
+
astEngine,
|
|
29722
|
+
basedir: configService.cwd
|
|
29723
|
+
});
|
|
29724
|
+
rewriteJsonNpmImportsToLocalRoot(rolldownBundle, "", void 0, npmBuildCandidateDependencies, configService.cwd);
|
|
29614
29725
|
}
|
|
29615
29726
|
return;
|
|
29616
29727
|
}
|
|
@@ -29718,14 +29829,27 @@ function createGenerateBundleHook(state, isPluginBuild) {
|
|
|
29718
29829
|
if (shouldRewriteBundleNpmImports(configService.platform)) rewriteBundleNpmImportsByPlatform(configService.platform, rolldownBundle, npmBuildCandidateDependencies, configService.weappViteConfig?.npm?.alipayNpmMode, { astEngine });
|
|
29719
29830
|
else {
|
|
29720
29831
|
const localSubPackageMetas = [...(scanService.subPackageMap ?? /* @__PURE__ */ new Map()).values()].filter((meta) => Array.isArray(meta?.subPackage?.dependencies) && meta.subPackage.dependencies.length > 0);
|
|
29832
|
+
const localSubPackageRoots = localSubPackageMetas.map((meta) => meta.subPackage.root).filter(Boolean);
|
|
29833
|
+
for (const output of Object.values(rolldownBundle)) {
|
|
29834
|
+
if (output?.type !== "chunk") continue;
|
|
29835
|
+
if (localSubPackageRoots.some((root) => output.fileName === root || output.fileName.startsWith(`${root}/`))) continue;
|
|
29836
|
+
rewriteChunkNpmImportsToLocalRoot(output, "", void 0, npmBuildCandidateDependencies, {
|
|
29837
|
+
astEngine,
|
|
29838
|
+
basedir: configService.cwd
|
|
29839
|
+
});
|
|
29840
|
+
}
|
|
29841
|
+
rewriteJsonNpmImportsToLocalRoot(rolldownBundle, "", void 0, npmBuildCandidateDependencies, configService.cwd, { excludeRoots: localSubPackageRoots });
|
|
29721
29842
|
for (const meta of localSubPackageMetas) {
|
|
29722
29843
|
for (const output of Object.values(rolldownBundle)) {
|
|
29723
29844
|
if (output?.type !== "chunk") continue;
|
|
29724
29845
|
const chunk = output;
|
|
29725
29846
|
if (chunk.fileName === meta.subPackage.root || !chunk.fileName.startsWith(`${meta.subPackage.root}/`)) continue;
|
|
29726
|
-
rewriteChunkNpmImportsToLocalRoot(chunk, meta.subPackage.root, meta.subPackage.dependencies, npmBuildCandidateDependencies, {
|
|
29847
|
+
rewriteChunkNpmImportsToLocalRoot(chunk, meta.subPackage.root, meta.subPackage.dependencies, npmBuildCandidateDependencies, {
|
|
29848
|
+
astEngine,
|
|
29849
|
+
basedir: configService.cwd
|
|
29850
|
+
});
|
|
29727
29851
|
}
|
|
29728
|
-
rewriteJsonNpmImportsToLocalRoot(rolldownBundle, meta.subPackage.root, meta.subPackage.dependencies, npmBuildCandidateDependencies);
|
|
29852
|
+
rewriteJsonNpmImportsToLocalRoot(rolldownBundle, meta.subPackage.root, meta.subPackage.dependencies, npmBuildCandidateDependencies, configService.cwd);
|
|
29729
29853
|
}
|
|
29730
29854
|
}
|
|
29731
29855
|
const injectWeapiGlobalName = resolveInjectWeapiGlobalName(state);
|
|
@@ -29739,7 +29863,7 @@ function createGenerateBundleHook(state, isPluginBuild) {
|
|
|
29739
29863
|
}
|
|
29740
29864
|
const appPreludeOptions = resolveAppPreludeOptions(state);
|
|
29741
29865
|
injectAppPreludeCode(rolldownBundle, await resolveAppPreludeCode(scanService.appEntry?.preludePath, {
|
|
29742
|
-
|
|
29866
|
+
importMetaDefineRegistry: configService.importMetaDefineRegistry,
|
|
29743
29867
|
relativePath: scanService.appEntry?.preludePath ? configService.relativeAbsoluteSrcRoot(scanService.appEntry.preludePath) : void 0
|
|
29744
29868
|
}), {
|
|
29745
29869
|
...appPreludeOptions,
|
|
@@ -30176,7 +30300,7 @@ function createTransformHook(state) {
|
|
|
30176
30300
|
const sourceId = normalizeFsResolvedId(id);
|
|
30177
30301
|
const relativeOutputPath = sourceId ? configService.relativeOutputPath?.(sourceId) ?? configService.relativeAbsoluteSrcRoot?.(sourceId) : void 0;
|
|
30178
30302
|
const importMetaTransformOptions = relativeOutputPath ? {
|
|
30179
|
-
|
|
30303
|
+
importMetaDefineRegistry: configService.importMetaDefineRegistry,
|
|
30180
30304
|
extension: "js",
|
|
30181
30305
|
relativePath: relativeOutputPath
|
|
30182
30306
|
} : void 0;
|
|
@@ -34519,18 +34643,33 @@ function createConfigService(ctx) {
|
|
|
34519
34643
|
function setDefineEnv(key, value) {
|
|
34520
34644
|
defineEnv[key] = value;
|
|
34521
34645
|
}
|
|
34522
|
-
function
|
|
34646
|
+
function setImportMetaEnvDefineOverride(define) {
|
|
34647
|
+
configState.importMetaEnvDefineOverride = define ? pickImportMetaEnvDefineEntries(define) : void 0;
|
|
34648
|
+
}
|
|
34649
|
+
function getUserDefinedImportMetaEnv() {
|
|
34650
|
+
const userDefine = options?.config?.define;
|
|
34651
|
+
return pickImportMetaEnvDefineEntries(userDefine);
|
|
34652
|
+
}
|
|
34653
|
+
function getCurrentImportMetaExplicitDefine() {
|
|
34654
|
+
return configState.importMetaEnvDefineOverride ?? getUserDefinedImportMetaEnv();
|
|
34655
|
+
}
|
|
34656
|
+
function getImportMetaBaseEnv() {
|
|
34523
34657
|
const mpPlatform = options?.platform ?? DEFAULT_MP_PLATFORM;
|
|
34524
34658
|
const resolvedPlatform = defineEnv.PLATFORM ?? mpPlatform;
|
|
34525
|
-
|
|
34659
|
+
return {
|
|
34526
34660
|
PLATFORM: resolvedPlatform,
|
|
34527
34661
|
MP_PLATFORM: resolvedPlatform,
|
|
34528
34662
|
...defineEnv
|
|
34529
34663
|
};
|
|
34530
|
-
|
|
34531
|
-
|
|
34532
|
-
|
|
34533
|
-
|
|
34664
|
+
}
|
|
34665
|
+
function getImportMetaDefineRegistry() {
|
|
34666
|
+
return createImportMetaDefineRegistry({
|
|
34667
|
+
baseEnv: getImportMetaBaseEnv(),
|
|
34668
|
+
defineEntries: getCurrentImportMetaExplicitDefine()
|
|
34669
|
+
});
|
|
34670
|
+
}
|
|
34671
|
+
function getDefineImportMetaEnv() {
|
|
34672
|
+
return getImportMetaDefineRegistry().defineEntries;
|
|
34534
34673
|
}
|
|
34535
34674
|
function applyRuntimePlatform(runtime) {
|
|
34536
34675
|
const isWeb = runtime === "web";
|
|
@@ -34618,14 +34757,24 @@ function createConfigService(ctx) {
|
|
|
34618
34757
|
return configState.packageInfo;
|
|
34619
34758
|
},
|
|
34620
34759
|
setDefineEnv,
|
|
34760
|
+
setImportMetaEnvDefineOverride,
|
|
34621
34761
|
load,
|
|
34622
34762
|
mergeWorkers,
|
|
34623
34763
|
merge,
|
|
34624
34764
|
mergeWeb,
|
|
34625
34765
|
mergeInlineConfig,
|
|
34766
|
+
get importMetaDefineEntries() {
|
|
34767
|
+
return getDefineImportMetaEnv();
|
|
34768
|
+
},
|
|
34626
34769
|
get defineImportMetaEnv() {
|
|
34627
34770
|
return getDefineImportMetaEnv();
|
|
34628
34771
|
},
|
|
34772
|
+
get importMetaEnvDefineOverride() {
|
|
34773
|
+
return configState.importMetaEnvDefineOverride;
|
|
34774
|
+
},
|
|
34775
|
+
get importMetaDefineRegistry() {
|
|
34776
|
+
return getImportMetaDefineRegistry();
|
|
34777
|
+
},
|
|
34629
34778
|
get cwd() {
|
|
34630
34779
|
return options.cwd;
|
|
34631
34780
|
},
|
|
@@ -34782,7 +34931,7 @@ function createJsonService(ctx) {
|
|
|
34782
34931
|
cwd: configService.options.cwd,
|
|
34783
34932
|
preserveTemporaryFile: true,
|
|
34784
34933
|
rolldownOptions: {
|
|
34785
|
-
input: { define: configService.
|
|
34934
|
+
input: { define: configService.importMetaDefineEntries },
|
|
34786
34935
|
output: { exports: "named" }
|
|
34787
34936
|
}
|
|
34788
34937
|
});
|
|
@@ -35031,6 +35180,7 @@ function createRuntimeState() {
|
|
|
35031
35180
|
config: {
|
|
35032
35181
|
packageInfo: createDefaultPackageInfo(),
|
|
35033
35182
|
defineEnv: {},
|
|
35183
|
+
importMetaEnvDefineOverride: void 0,
|
|
35034
35184
|
packageManager: createDefaultPackageManager(),
|
|
35035
35185
|
options: createDefaultLoadConfigResult()
|
|
35036
35186
|
}
|
|
@@ -35161,7 +35311,7 @@ async function loadAppEntry(ctx, scanState) {
|
|
|
35161
35311
|
const vueAppPath = await findVueEntry(appBasename);
|
|
35162
35312
|
let configFromVue;
|
|
35163
35313
|
if (!appConfigFile && vueAppPath) {
|
|
35164
|
-
const { extractConfigFromVue } = await import("./file-
|
|
35314
|
+
const { extractConfigFromVue } = await import("./file-slN_aOEg.mjs");
|
|
35165
35315
|
configFromVue = await extractConfigFromVue(vueAppPath);
|
|
35166
35316
|
if (configFromVue) appConfigFile = vueAppPath;
|
|
35167
35317
|
}
|
|
@@ -36141,6 +36291,11 @@ function normalizeSrcRoot(srcRoot) {
|
|
|
36141
36291
|
}
|
|
36142
36292
|
//#endregion
|
|
36143
36293
|
//#region src/runtime/tsconfigSupport/configs.ts
|
|
36294
|
+
function omitDeprecatedCompilerOptions(compilerOptions) {
|
|
36295
|
+
if (!compilerOptions || !("baseUrl" in compilerOptions)) return compilerOptions;
|
|
36296
|
+
const { baseUrl: _baseUrl, ...rest } = compilerOptions;
|
|
36297
|
+
return rest;
|
|
36298
|
+
}
|
|
36144
36299
|
function getAppTypes(ctx, legacyConfig) {
|
|
36145
36300
|
const configService = requireConfigService(ctx, "生成 app tsconfig 前必须初始化 configService。");
|
|
36146
36301
|
const packageJson = configService.packageJson;
|
|
@@ -36181,8 +36336,8 @@ function createSharedTsconfig(ctx, legacyConfig) {
|
|
|
36181
36336
|
noUncheckedSideEffectImports: true,
|
|
36182
36337
|
erasableSyntaxOnly: true,
|
|
36183
36338
|
skipLibCheck: true,
|
|
36184
|
-
...legacyConfig?.shared?.compilerOptions ?? {},
|
|
36185
|
-
...userConfig?.shared?.compilerOptions ?? {}
|
|
36339
|
+
...omitDeprecatedCompilerOptions(legacyConfig?.shared?.compilerOptions) ?? {},
|
|
36340
|
+
...omitDeprecatedCompilerOptions(userConfig?.shared?.compilerOptions) ?? {}
|
|
36186
36341
|
} };
|
|
36187
36342
|
const exclude = unique([...legacyConfig?.shared?.exclude ?? [], ...userConfig?.shared?.exclude ?? []]);
|
|
36188
36343
|
const files = unique([...legacyConfig?.shared?.files ?? [], ...userConfig?.shared?.files ?? []]);
|
|
@@ -36196,8 +36351,8 @@ function createSharedTsconfig(ctx, legacyConfig) {
|
|
|
36196
36351
|
}
|
|
36197
36352
|
function createAppTsconfig(ctx, legacyConfig) {
|
|
36198
36353
|
const userConfig = getManagedTypeScriptConfig(ctx);
|
|
36199
|
-
const legacyAppCompilerOptions = legacyConfig?.app?.compilerOptions ?? {};
|
|
36200
|
-
const userAppCompilerOptions = userConfig?.app?.compilerOptions ?? {};
|
|
36354
|
+
const legacyAppCompilerOptions = omitDeprecatedCompilerOptions(legacyConfig?.app?.compilerOptions) ?? {};
|
|
36355
|
+
const userAppCompilerOptions = omitDeprecatedCompilerOptions(userConfig?.app?.compilerOptions) ?? {};
|
|
36201
36356
|
const compilerOptions = {
|
|
36202
36357
|
tsBuildInfoFile: "../node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
36203
36358
|
target: "ES2023",
|
|
@@ -36242,8 +36397,8 @@ function createNodeTsconfig(ctx, legacyConfig) {
|
|
|
36242
36397
|
target: "ES2023",
|
|
36243
36398
|
lib: ["ES2023"],
|
|
36244
36399
|
types: ["node"],
|
|
36245
|
-
...legacyConfig?.node?.compilerOptions ?? {},
|
|
36246
|
-
...userConfig?.node?.compilerOptions ?? {}
|
|
36400
|
+
...omitDeprecatedCompilerOptions(legacyConfig?.node?.compilerOptions) ?? {},
|
|
36401
|
+
...omitDeprecatedCompilerOptions(userConfig?.node?.compilerOptions) ?? {}
|
|
36247
36402
|
};
|
|
36248
36403
|
const include = unique([
|
|
36249
36404
|
...DEFAULT_NODE_INCLUDE,
|
|
@@ -36267,8 +36422,8 @@ function createServerTsconfig(ctx, legacyConfig) {
|
|
|
36267
36422
|
target: "ES2023",
|
|
36268
36423
|
lib: ["ES2023"],
|
|
36269
36424
|
types: ["node"],
|
|
36270
|
-
...legacyConfig?.server?.compilerOptions ?? {},
|
|
36271
|
-
...userConfig?.server?.compilerOptions ?? {}
|
|
36425
|
+
...omitDeprecatedCompilerOptions(legacyConfig?.server?.compilerOptions) ?? {},
|
|
36426
|
+
...omitDeprecatedCompilerOptions(userConfig?.server?.compilerOptions) ?? {}
|
|
36272
36427
|
};
|
|
36273
36428
|
const files = unique([...legacyConfig?.server?.files ?? [], ...userConfig?.server?.files ?? []]);
|
|
36274
36429
|
const include = unique([...legacyConfig?.server?.include ?? [], ...userConfig?.server?.include ?? []]);
|
|
@@ -84,7 +84,7 @@ function resolveAutoRoutesMacroImportPath() {
|
|
|
84
84
|
}
|
|
85
85
|
async function resolveAutoRoutesInlineSnapshot() {
|
|
86
86
|
try {
|
|
87
|
-
const { getCompilerContext } = await import("./getInstance-
|
|
87
|
+
const { getCompilerContext } = await import("./getInstance-BGGhJCLI.mjs");
|
|
88
88
|
const compilerContext = getCompilerContext();
|
|
89
89
|
const service = compilerContext.autoRoutesService;
|
|
90
90
|
const reference = service?.getReference?.();
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as Ref, Bn as resolveWeappViteHostMeta, C as LoadConfigOptions, D as MethodDefinitions, E as InlineConfig, F as RolldownPlugin, Fn as WeappViteHostMeta, I as RolldownPluginOption, In as WeappViteRuntime, L as RolldownWatchOptions, Ln as applyWeappViteHostMeta, M as RolldownBuild, N as RolldownOptions, O as Plugin, P as RolldownOutput, Pn as WEAPP_VITE_HOST_NAME, R as RolldownWatcher, Rn as createWeappViteHostMeta, S as CompilerContext, T as ConfigEnv, _ as definePageJson, a as UserConfigFnNoEnvPlain, c as UserConfigFnPromise, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, j as ResolvedConfig, k as PluginOption, l as defineConfig, m as Theme, n as UserConfigExport, nt as WeappViteConfig, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, w as ComputedDefinitions, y as defineThemeJson, z as ViteDevServer, zn as isWeappViteHost } from "./config-
|
|
1
|
+
import { A as Ref, Bn as resolveWeappViteHostMeta, C as LoadConfigOptions, D as MethodDefinitions, E as InlineConfig, F as RolldownPlugin, Fn as WeappViteHostMeta, I as RolldownPluginOption, In as WeappViteRuntime, L as RolldownWatchOptions, Ln as applyWeappViteHostMeta, M as RolldownBuild, N as RolldownOptions, O as Plugin, P as RolldownOutput, Pn as WEAPP_VITE_HOST_NAME, R as RolldownWatcher, Rn as createWeappViteHostMeta, S as CompilerContext, T as ConfigEnv, _ as definePageJson, a as UserConfigFnNoEnvPlain, c as UserConfigFnPromise, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, j as ResolvedConfig, k as PluginOption, l as defineConfig, m as Theme, n as UserConfigExport, nt as WeappViteConfig, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, w as ComputedDefinitions, y as defineThemeJson, z as ViteDevServer, zn as isWeappViteHost } from "./config-DzoHnvv-.mjs";
|
|
2
2
|
import { a as createWevuComponent, i as WevuComponentOptions, n as defineProps, r as setPageLayout, t as defineEmits } from "./runtime-DSLk7kWi.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/createContext.d.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createCompilerContext } from "./createContext-
|
|
1
|
+
import { t as createCompilerContext } from "./createContext-CySjzbQy.mjs";
|
|
2
2
|
import { a as defineThemeJson, i as defineSitemapJson, n as defineComponentJson, r as definePageJson, t as defineAppJson } from "./json-wnfVS9jE.mjs";
|
|
3
3
|
import { a as resolveWeappViteHostMeta, i as isWeappViteHost, n as applyWeappViteHostMeta, r as createWeappViteHostMeta, t as WEAPP_VITE_HOST_NAME } from "./pluginHost-BzPJL4F-.mjs";
|
|
4
4
|
import { t as defineConfig } from "./config-B2xtjEug.mjs";
|
package/dist/json.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as definePageJson, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, m as Theme, p as Sitemap, u as App, v as defineSitemapJson, y as defineThemeJson } from "./config-
|
|
1
|
+
import { _ as definePageJson, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, m as Theme, p as Sitemap, u as App, v as defineSitemapJson, y as defineThemeJson } from "./config-DzoHnvv-.mjs";
|
|
2
2
|
export { App, Component, Page, Sitemap, Theme, defineAppJson, defineComponentJson, definePageJson, defineSitemapJson, defineThemeJson };
|
package/dist/mcp.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { xt as WeappMcpConfig } from "./config-
|
|
1
|
+
import { xt as WeappMcpConfig } from "./config-DzoHnvv-.mjs";
|
|
2
2
|
import { CreateServerOptions, DEFAULT_MCP_ENDPOINT, DEFAULT_MCP_HOST, DEFAULT_MCP_PORT, McpServerHandle, StartMcpServerOptions, createWeappViteMcpServer } from "@weapp-vite/mcp";
|
|
3
3
|
|
|
4
4
|
//#region src/mcp.d.ts
|
package/dist/types.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { c as Resolver } from "./index-6QUk3Zbc.mjs";
|
|
2
2
|
import { n as AutoRoutesSubPackage, t as AutoRoutes } from "./routes-DiEBrMtj.mjs";
|
|
3
|
-
import { $ as WeappDebugConfig, $t as JsonConfig, A as Ref, An as WeappManagedServerTsconfigConfig, At as WeappWevuConfig, B as BindingErrorLike, Bt as GenerateExtensionsOptions, Cn as WeappLibDtsOptions, Ct as WeappRequestRuntimeConfig, D as MethodDefinitions, Dn as WeappLibVueTscOptions, Dt as WeappVueConfig, E as InlineConfig, En as WeappLibInternalDtsOptions, Et as WeappSubPackageConfig, F as RolldownPlugin, Fn as WeappViteHostMeta, Ft as BuildNpmPackageMeta, G as EntryJsonFragment, Gt as GenerateTemplateContext, H as BaseEntry, Ht as GenerateFilenamesOptions, I as RolldownPluginOption, In as WeappViteRuntime, It as ChunksConfig, J as ScanComponentItem, Jt as GenerateTemplateFileSource, K as PageEntry, Kt as GenerateTemplateEntry, L as RolldownWatchOptions, Lt as CopyGlobs, M as RolldownBuild, Mn as WeappManagedTypeScriptConfig, Mt as Alias, N as RolldownOptions, Nn as WeappWebConfig, Nt as AliasOptions, O as Plugin, On as WeappManagedAppTsconfigConfig, Ot as WeappVueTemplateConfig, P as RolldownOutput, Pt as AlipayNpmMode, Q as UserConfig, Qt as JsFormat, R as RolldownWatcher, Rt as CopyOptions, Sn as WeappLibConfig, St as WeappNpmConfig, T as ConfigEnv, Tn as WeappLibFileName, Tt as WeappRouteRules, U as ComponentEntry, Ut as GenerateOptions, V as AppEntry, Vt as GenerateFileType, W as Entry, Wt as GenerateTemplate, X as ProjectConfig, Xt as GenerateTemplateScope, Y as WxmlDep, Yt as GenerateTemplateInlineSource, Z as SubPackageMetaValue, Zt as GenerateTemplatesConfig, _n as SubPackageStyleConfigEntry, _t as WeappInjectRequestGlobalsTarget, an as NpmBuildOptions, at as EnhanceOptions, b as ChangeEvent, bn as SubPackageStyleScope, bt as WeappInjectWebRuntimeGlobalsTarget, cn as NpmPluginPackageConfig, ct as MultiPlatformConfig, dn as ResolvedAlias, dt as WeappAppPreludeMode, en as JsonMergeContext, et as WeappForwardConsoleConfig, fn as SharedChunkDynamicImports, ft as WeappAutoRoutesConfig, gn as SubPackage, gt as WeappInjectRequestGlobalsConfig, hn as SharedChunkStrategy, ht as WeappHmrConfig, in as MpPlatform, it as AutoImportComponentsOption, j as ResolvedConfig, jn as WeappManagedSharedTsconfigConfig, jt as WeappWorkerConfig, k as PluginOption, kn as WeappManagedNodeTsconfigConfig, kt as WeappWebRuntimeConfig, ln as NpmStrategy, lt as ScanWxmlOptions, mn as SharedChunkOverride, mt as WeappAutoRoutesIncludePattern, nn as JsonMergeStage, nt as WeappViteConfig, on as NpmDependencyPattern, ot as EnhanceWxmlOptions, pn as SharedChunkMode, pt as WeappAutoRoutesInclude, q as ComponentsMap, qt as GenerateTemplateFactory, rn as JsonMergeStrategy, rt as AutoImportComponents, sn as NpmMainPackageConfig, st as HandleWxmlOptions, tn as JsonMergeFunction, tt as WeappForwardConsoleLogLevel, un as NpmSubPackageConfig, ut as WeappAppPreludeConfig, vn as SubPackageStyleConfigObject, vt as WeappInjectWeapiConfig, w as ComputedDefinitions, wn as WeappLibEntryContext, wt as WeappRouteRule, x as WeappVitePluginApi, xn as WeappLibComponentJson, xt as WeappMcpConfig, yn as SubPackageStyleEntry, yt as WeappInjectWebRuntimeGlobalsConfig, z as ViteDevServer, zt as GenerateDirsOptions } from "./config-
|
|
3
|
+
import { $ as WeappDebugConfig, $t as JsonConfig, A as Ref, An as WeappManagedServerTsconfigConfig, At as WeappWevuConfig, B as BindingErrorLike, Bt as GenerateExtensionsOptions, Cn as WeappLibDtsOptions, Ct as WeappRequestRuntimeConfig, D as MethodDefinitions, Dn as WeappLibVueTscOptions, Dt as WeappVueConfig, E as InlineConfig, En as WeappLibInternalDtsOptions, Et as WeappSubPackageConfig, F as RolldownPlugin, Fn as WeappViteHostMeta, Ft as BuildNpmPackageMeta, G as EntryJsonFragment, Gt as GenerateTemplateContext, H as BaseEntry, Ht as GenerateFilenamesOptions, I as RolldownPluginOption, In as WeappViteRuntime, It as ChunksConfig, J as ScanComponentItem, Jt as GenerateTemplateFileSource, K as PageEntry, Kt as GenerateTemplateEntry, L as RolldownWatchOptions, Lt as CopyGlobs, M as RolldownBuild, Mn as WeappManagedTypeScriptConfig, Mt as Alias, N as RolldownOptions, Nn as WeappWebConfig, Nt as AliasOptions, O as Plugin, On as WeappManagedAppTsconfigConfig, Ot as WeappVueTemplateConfig, P as RolldownOutput, Pt as AlipayNpmMode, Q as UserConfig, Qt as JsFormat, R as RolldownWatcher, Rt as CopyOptions, Sn as WeappLibConfig, St as WeappNpmConfig, T as ConfigEnv, Tn as WeappLibFileName, Tt as WeappRouteRules, U as ComponentEntry, Ut as GenerateOptions, V as AppEntry, Vt as GenerateFileType, W as Entry, Wt as GenerateTemplate, X as ProjectConfig, Xt as GenerateTemplateScope, Y as WxmlDep, Yt as GenerateTemplateInlineSource, Z as SubPackageMetaValue, Zt as GenerateTemplatesConfig, _n as SubPackageStyleConfigEntry, _t as WeappInjectRequestGlobalsTarget, an as NpmBuildOptions, at as EnhanceOptions, b as ChangeEvent, bn as SubPackageStyleScope, bt as WeappInjectWebRuntimeGlobalsTarget, cn as NpmPluginPackageConfig, ct as MultiPlatformConfig, dn as ResolvedAlias, dt as WeappAppPreludeMode, en as JsonMergeContext, et as WeappForwardConsoleConfig, fn as SharedChunkDynamicImports, ft as WeappAutoRoutesConfig, gn as SubPackage, gt as WeappInjectRequestGlobalsConfig, hn as SharedChunkStrategy, ht as WeappHmrConfig, in as MpPlatform, it as AutoImportComponentsOption, j as ResolvedConfig, jn as WeappManagedSharedTsconfigConfig, jt as WeappWorkerConfig, k as PluginOption, kn as WeappManagedNodeTsconfigConfig, kt as WeappWebRuntimeConfig, ln as NpmStrategy, lt as ScanWxmlOptions, mn as SharedChunkOverride, mt as WeappAutoRoutesIncludePattern, nn as JsonMergeStage, nt as WeappViteConfig, on as NpmDependencyPattern, ot as EnhanceWxmlOptions, pn as SharedChunkMode, pt as WeappAutoRoutesInclude, q as ComponentsMap, qt as GenerateTemplateFactory, rn as JsonMergeStrategy, rt as AutoImportComponents, sn as NpmMainPackageConfig, st as HandleWxmlOptions, tn as JsonMergeFunction, tt as WeappForwardConsoleLogLevel, un as NpmSubPackageConfig, ut as WeappAppPreludeConfig, vn as SubPackageStyleConfigObject, vt as WeappInjectWeapiConfig, w as ComputedDefinitions, wn as WeappLibEntryContext, wt as WeappRouteRule, x as WeappVitePluginApi, xn as WeappLibComponentJson, xt as WeappMcpConfig, yn as SubPackageStyleEntry, yt as WeappInjectWebRuntimeGlobalsConfig, z as ViteDevServer, zt as GenerateDirsOptions } from "./config-DzoHnvv-.mjs";
|
|
4
4
|
export { Alias, AliasOptions, AlipayNpmMode, AppEntry, AutoImportComponents, AutoImportComponentsOption, AutoRoutes, AutoRoutesSubPackage, BaseEntry, BindingErrorLike, BuildNpmPackageMeta, ChangeEvent, ChunksConfig, ComponentEntry, ComponentsMap, ComputedDefinitions, ConfigEnv, CopyGlobs, CopyOptions, EnhanceOptions, EnhanceWxmlOptions, Entry, EntryJsonFragment, GenerateDirsOptions, GenerateExtensionsOptions, GenerateFileType, GenerateFilenamesOptions, GenerateOptions, GenerateTemplate, GenerateTemplateContext, GenerateTemplateEntry, GenerateTemplateFactory, GenerateTemplateFileSource, GenerateTemplateInlineSource, GenerateTemplateScope, GenerateTemplatesConfig, HandleWxmlOptions, InlineConfig, JsFormat, JsonConfig, JsonMergeContext, JsonMergeFunction, JsonMergeStage, JsonMergeStrategy, MethodDefinitions, MpPlatform, MultiPlatformConfig, NpmBuildOptions, NpmDependencyPattern, NpmMainPackageConfig, NpmPluginPackageConfig, NpmStrategy, NpmSubPackageConfig, PageEntry, Plugin, PluginOption, ProjectConfig, Ref, ResolvedAlias, ResolvedConfig, Resolver, RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatchOptions, RolldownWatcher, ScanComponentItem, ScanWxmlOptions, SharedChunkDynamicImports, SharedChunkMode, SharedChunkOverride, SharedChunkStrategy, SubPackage, SubPackageMetaValue, SubPackageStyleConfigEntry, SubPackageStyleConfigObject, SubPackageStyleEntry, SubPackageStyleScope, UserConfig, ViteDevServer, WeappAppPreludeConfig, WeappAppPreludeMode, WeappAutoRoutesConfig, WeappAutoRoutesInclude, WeappAutoRoutesIncludePattern, WeappDebugConfig, WeappForwardConsoleConfig, WeappForwardConsoleLogLevel, WeappHmrConfig, WeappInjectRequestGlobalsConfig, WeappInjectRequestGlobalsTarget, WeappInjectWeapiConfig, WeappInjectWebRuntimeGlobalsConfig, WeappInjectWebRuntimeGlobalsTarget, WeappLibComponentJson, WeappLibConfig, WeappLibDtsOptions, WeappLibEntryContext, WeappLibFileName, WeappLibInternalDtsOptions, WeappLibVueTscOptions, WeappManagedAppTsconfigConfig, WeappManagedNodeTsconfigConfig, WeappManagedServerTsconfigConfig, WeappManagedSharedTsconfigConfig, WeappManagedTypeScriptConfig, WeappMcpConfig, WeappNpmConfig, WeappRequestRuntimeConfig, WeappRouteRule, WeappRouteRules, WeappSubPackageConfig, WeappViteConfig, WeappViteHostMeta, WeappVitePluginApi, WeappViteRuntime, WeappVueConfig, WeappVueTemplateConfig, WeappWebConfig, WeappWebRuntimeConfig, WeappWevuConfig, WeappWorkerConfig, WxmlDep };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-vite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "6.15.
|
|
4
|
+
"version": "6.15.12",
|
|
5
5
|
"description": "weapp-vite 一个现代化的小程序打包工具",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"@weapp-core/logger": "3.1.1",
|
|
123
123
|
"@weapp-core/schematics": "6.0.4",
|
|
124
124
|
"@weapp-core/shared": "3.0.4",
|
|
125
|
-
"@weapp-vite/ast": "6.15.
|
|
125
|
+
"@weapp-vite/ast": "6.15.12",
|
|
126
126
|
"@weapp-vite/mcp": "1.2.1",
|
|
127
127
|
"@weapp-vite/miniprogram-automator": "1.0.3",
|
|
128
128
|
"@weapp-vite/volar": "2.1.0",
|
|
@@ -132,16 +132,16 @@
|
|
|
132
132
|
"rolldown-require": "2.0.14",
|
|
133
133
|
"vite-plugin-performance": "2.0.1",
|
|
134
134
|
"weapp-ide-cli": "5.2.4",
|
|
135
|
-
"wevu": "6.15.
|
|
135
|
+
"wevu": "6.15.12"
|
|
136
136
|
},
|
|
137
137
|
"publishConfig": {
|
|
138
138
|
"access": "public",
|
|
139
139
|
"registry": "https://registry.npmjs.org"
|
|
140
140
|
},
|
|
141
141
|
"devDependencies": {
|
|
142
|
-
"oxc-parser": "^0.
|
|
142
|
+
"oxc-parser": "^0.127.0",
|
|
143
143
|
"oxc-walker": "^0.7.0",
|
|
144
|
-
"tailwindcss": "^4.2.
|
|
144
|
+
"tailwindcss": "^4.2.4",
|
|
145
145
|
"ts-morph": "^28.0.0"
|
|
146
146
|
},
|
|
147
147
|
"scripts": {
|
package/dist/file-Cf2kMTOQ.mjs
DELETED