import { MpPlatform } from "@weapp-core/shared"; import * as t from "@weapp-vite/ast/babelTypes"; import { Expression } from "@weapp-vite/ast/babelTypes"; import { LRUCache } from "lru-cache"; import { AstEngineName, AstEngineName as AstEngineName$1 } from "@weapp-vite/ast"; import { SFCBlock, SFCDescriptor, SFCParseResult, SFCStyleBlock } from "vue/compiler-sfc"; //#region src/auto-import-components/builtin.d.ts /** * 内置组件集合(来自自动生成的组件列表)。 */ declare const builtinComponentsSet: Set; /** * 判断标签是否为内置组件。 */ declare function isBuiltinComponent(tag: string): boolean; //#endregion //#region src/constants.d.ts declare const WE_VU_PAGE_HOOK_TO_FEATURE: { readonly onPageScroll: "enableOnPageScroll"; readonly onPullDownRefresh: "enableOnPullDownRefresh"; readonly onReachBottom: "enableOnReachBottom"; readonly onRouteDone: "enableOnRouteDone"; readonly onTabItemTap: "enableOnTabItemTap"; readonly onResize: "enableOnResize"; readonly onShareAppMessage: "enableOnShareAppMessage"; readonly onShareTimeline: "enableOnShareTimeline"; readonly onAddToFavorites: "enableOnAddToFavorites"; readonly onSaveExitState: "enableOnSaveExitState"; }; /** * wevu 运行时模块 ID。 */ declare const WE_VU_MODULE_ID: "wevu"; /** * wevu 编译产物内部运行时模块 ID。 */ declare const WE_VU_INTERNAL_RUNTIME_MODULE_ID: "wevu/internal-runtime"; /** * wevu 编译产物内部响应式模块 ID。 */ declare const WE_VU_INTERNAL_REACTIVITY_MODULE_ID: "wevu/internal-reactivity"; /** * wevu 编译产物内部模板工具模块 ID。 */ declare const WE_VU_INTERNAL_TEMPLATE_MODULE_ID: "wevu/internal-template"; /** * wevu 运行时模块 ID 列表。 */ declare const WE_VU_RUNTIME_MODULE_IDS: readonly ["wevu", "wevu/internal-runtime"]; /** * 判断模块 ID 是否为 wevu 运行时入口。 */ declare function isWevuRuntimeModuleId(moduleId: string): boolean; /** * wevu 运行时 API 名称映射。 */ declare const WE_VU_RUNTIME_APIS: { readonly createApp: "createApp"; readonly createWevuComponent: "createWevuComponent"; readonly createWevuScopedSlotComponent: "createWevuScopedSlotComponent"; readonly defineAppSetup: "defineAppSetup"; readonly defineComponent: "defineComponent"; readonly setWevuDefaults: "setWevuDefaults"; }; /** * wevu 运行时 API 名称类型。 */ type WevuRuntimeApiName = (typeof WE_VU_RUNTIME_APIS)[keyof typeof WE_VU_RUNTIME_APIS]; /** * wevu 内部响应式 API 名称。 */ declare const WE_VU_INTERNAL_REACTIVITY_APIS: readonly ["addMutationRecorder", "batch", "computed", "customRef", "effect", "effectScope", "endBatch", "getCurrentScope", "getDeepWatchStrategy", "getReactiveVersion", "isProxy", "isRaw", "isReactive", "isReadonly", "isRef", "isShallowReactive", "isShallowRef", "markRaw", "nextTick", "onScopeDispose", "prelinkReactiveTree", "reactive", "readonly", "ref", "removeMutationRecorder", "setDeepWatchStrategy", "shallowReactive", "shallowReadonly", "shallowRef", "startBatch", "stop", "toRaw", "toRef", "toRefs", "toValue", "touchReactive", "traverse", "triggerRef", "unref", "watch", "watchEffect", "watchPostEffect", "watchSyncEffect"]; /** * wevu 内部模板工具 API 名称。 */ declare const WE_VU_INTERNAL_TEMPLATE_APIS: readonly ["normalizeClass", "normalizeStyle", "resolvePropValue"]; /** * 根据 wevu API 名称解析编译产物内部导入入口。 */ declare function resolveWevuInternalImportModuleId(apiName: string): "wevu/internal-runtime" | "wevu/internal-reactivity" | "wevu/internal-template"; //#endregion //#region src/types/json.d.ts /** * JSON 合并阶段枚举。 */ type JsonMergeStage = 'defaults' | 'json-block' | 'auto-using-components' | 'component-generics' | 'macro' | 'emit' | 'merge-existing'; /** * JSON 合并上下文。 */ interface JsonMergeContext { filename?: string; kind?: 'app' | 'page' | 'component' | 'unknown'; stage: JsonMergeStage; } /** * JSON 合并函数。 */ type JsonMergeFunction = (target: Record, source: Record, context: JsonMergeContext) => Record | void; /** * JSON 合并策略。 */ type JsonMergeStrategy = 'deep' | 'assign' | 'replace' | JsonMergeFunction; /** * JSON 产物配置。 */ interface JsonConfig { /** * 产物 JSON 默认值(用于 app/page/component) */ defaults?: { app?: Record; page?: Record; component?: Record; }; /** * JSON 合并策略 * - `deep`: 深合并(默认) * - `assign`: 浅合并(Object.assign) * - `replace`: 直接替换 * - `function`: 自定义合并函数 */ mergeStrategy?: JsonMergeStrategy; } //#endregion //#region src/types/wevu.d.ts /** * wevu JSON 默认值配置(app/component)。 */ interface WevuDefaults { app?: Record; component?: Record; } //#endregion //#region src/utils/sourcemap.d.ts interface EncodedSourceMapLike { version: number | string; file?: string; names: string[]; sourceRoot?: string; sources: string[]; sourcesContent?: Array; mappings: string; } //#endregion //#region src/plugins/utils/vueSfcBlockSrc.d.ts /** * 解析 SFC block `src` 的配置。 */ interface ResolveSfcBlockSrcOptions { resolveId?: (source: string, importer?: string) => Promise; readFile?: (id: string, options?: { checkMtime?: boolean; }) => Promise; checkMtime?: boolean; } /** * 解析 SFC 中带 `src` 的 block,并返回依赖列表。 */ declare function resolveSfcBlockSrc(descriptor: SFCDescriptor, filename: string, options?: ResolveSfcBlockSrcOptions): Promise<{ descriptor: SFCDescriptor; deps: string[]; }>; //#endregion //#region src/plugins/utils/vueSfc.d.ts /** * 读取并解析 SFC 的配置。 */ interface ReadAndParseSfcOptions { /** * 直接传入源码以跳过文件读取。 */ source?: string; /** * 是否按 mtime+size 检查文件变更(dev 推荐开启)。 */ checkMtime?: boolean; /** * 解析