import { d as ResolvedValue, f as Resolver } from "./index-CaXAtb9e.mjs"; import { t as AutoRoutes } from "./routes-C7fCmf92.mjs"; import { t as WeappI18nConfig } from "./types-D-kfuyVa.mjs"; import { r as GlassEaselTemplateFinding, t as GlassEaselAnalysisFact } from "./types-D0FFexRF.mjs"; import { MpPlatform, OutputExtensions } from "@weapp-core/shared"; import { WeappAstConfig } from "@weapp-vite/ast"; import "@weapp-vite/ast/operations/onPageScroll"; import { LoggerConfig } from "@weapp-core/logger"; import "@weapp-vite/ast/babel"; import { ComponentStyleOptions, JsonConfig, JsonMergeContext, JsonMergeFunction, JsonMergeStage, JsonMergeStrategy, ResolveSfcBlockSrcOptions, StaticRouteValue, VueSfcBlockSignatures } from "wevu/compiler"; import { ConfigEnv, ConfigEnv as ConfigEnv$1, InlineConfig, InlineConfig as InlineConfig$1, Plugin, Plugin as Plugin$2, PluginOption, ResolvedConfig, ResolvedConfig as ResolvedConfig$1, UserConfig, ViteDevServer, ViteDevServer as ViteDevServer$1, build } from "vite"; import { LRUCache } from "lru-cache"; import { fdir } from "fdir"; import { Buffer } from "node:buffer"; import { HmrCompilerAsset as WeappCompilerHmrAsset, HmrCompilerPreparation, HmrCompilerPreparation as WeappCompilerHmrPreparation, HmrCompilerRequest, HmrCompilerRequest as WeappCompilerHmrRequest } from "@weapp-vite/hmr"; import PQueue from "p-queue"; import "get-tsconfig"; import { WrapPluginOptions } from "vite-plugin-performance"; import { Options } from "rolldown-plugin-dts"; import { App, App as App$1, Component, Component as Component$1, GenerateType, Page, Page as Page$1, Plugin as Plugin$1, Sitemap, Sitemap as Sitemap$1, Theme, Theme as Theme$1 } from "@weapp-core/schematics"; import { InputOption, OutputBundle, OutputChunk, ResolvedId, RolldownBuild, RolldownOptions, RolldownOutput, RolldownOutput as RolldownOutput$1, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcher as RolldownWatcher$1, WatchOptions as RolldownWatchOptions } from "rolldown"; import { MiniProgramNetworkDefaults } from "@wevu/web-apis/network-defaults"; import { PageLayoutMeta, WevuConfigDefaults } from "wevu/config"; import { WeappWebPluginOptions } from "@weapp-vite/web/plugin"; import { CompilerOptions } from "typescript"; import { CreateCompilerOptions } from "weapp-tailwindcss/core"; import { UserDefinedOptions } from "weapp-tailwindcss/types"; import { ComputedDefinitions as ComputedDefinitions$1, MethodDefinitions as MethodDefinitions$1, Ref } from "wevu/types"; import { DetectResult } from "package-manager-detector"; //#region src/runtimeTarget.d.ts type WebPlatform = 'web'; type WeappViteRuntime = 'miniprogram' | 'web'; type WeappVitePlatform = MpPlatform$1 | WebPlatform; type WeappViteTargetInput = WeappVitePlatform | 'h5' | 'all' | 'both' | (string & {}); type WeappViteTargetKind = WeappViteRuntime | 'all'; interface ResolvedWeappViteTarget { kind: WeappViteTargetKind; runMini: boolean; runWeb: boolean; platform?: WeappVitePlatform; label: string; raw?: string; } interface ResolveWeappViteTargetOptions { fallbackMiniPlatform?: MpPlatform$1; warn?: (message: string) => void; } interface WeappViteTargetDescriptor { platform: WeappVitePlatform; runtime: WeappViteRuntime; aliases: readonly string[]; label: string; } declare const WEB_PLATFORM_ALIASES: readonly string[]; declare function isWebPlatform(input?: string | null): boolean; declare function getSupportedWeappViteTargetDescriptors(): readonly WeappViteTargetDescriptor[]; declare function getSupportedWeappVitePlatforms(): readonly WeappVitePlatform[]; declare function resolveWeappViteTarget(input?: WeappViteTargetInput | null, options?: ResolveWeappViteTargetOptions): ResolvedWeappViteTarget; //#endregion //#region src/pluginHost.d.ts declare const WEAPP_VITE_HOST_NAME = "weapp-vite"; interface WeappViteHostMeta { name: typeof WEAPP_VITE_HOST_NAME; runtime: WeappViteRuntime; platform?: WeappVitePlatform; } declare function createWeappViteHostMeta(runtime: WeappViteRuntime, platform?: WeappVitePlatform): WeappViteHostMeta; declare function applyWeappViteHostMeta(config: InlineConfig, runtime: WeappViteRuntime, platform?: WeappVitePlatform): InlineConfig; declare function resolveWeappViteHostMeta(config: Pick | undefined): WeappViteHostMeta | undefined; declare function isWeappViteHost(config: Pick | undefined): boolean; declare module 'vite' { interface UserConfig { weappVite?: WeappViteHostMeta; } interface ResolvedConfig { weappVite?: WeappViteHostMeta; } } //#endregion //#region src/utils/importMeta.d.ts interface ImportMetaDefineRegistry { defineEntries: Record; envObject: Record; envMemberAccess: Record; } //#endregion //#region src/types/config/foundation.d.ts type NpmBuildOptions = InlineConfig; type MpPlatform$1 = MpPlatform; /** * @description 支付宝平台本地 npm 输出模式 */ type AlipayNpmMode = 'miniprogram_npm' | 'node_modules'; interface Alias { /** * @description 被匹配的原始路径或正则 */ find: string | RegExp; /** * @description 命中后的替换路径 */ replacement: string; } interface ResolvedAlias { /** * @description 解析后的匹配条件 */ find: string | RegExp; /** * @description 解析后的替换路径 */ replacement: string; } interface AliasOptions { /** * @example * ```ts * entries: [ * { * find: '@', * replacement: path.resolve(import.meta.dirname, 'components'), * }, * ] * ``` */ entries?: readonly Alias[] | { [find: string]: string; }; } interface SubPackage { /** * @description 分包内页面列表,路径相对于分包 root */ pages: string[]; /** * @description 分包根目录 */ root: string; /** * @description 是否为独立分包 */ independent?: boolean; /** * @description 分包入口文件,也基于 root 解析 */ entry?: string; /** * @description 分包名称 */ name?: string; /** * @description 分包依赖范围控制 */ dependencies?: (string | RegExp)[]; /** * @description 分包级额外 inline Vite 配置 */ inlineConfig?: Partial; } type StyleScope = 'all' | 'pages' | 'components'; interface StyleConfigObject { /** 样式文件路径,可以是相对当前包 root、相对 `srcRoot` 或绝对路径 */ source: string; /** * @description 作用范围快捷配置 */ scope?: StyleScope; /** 自定义包含路径,支持传入单个 glob 或数组;主包默认不包含 app,需显式匹配 `app.vue` 等应用入口 */ include?: string | string[]; /** 自定义排除路径,支持传入单个 glob 或数组 */ exclude?: string | string[]; /** 是否自动向命中的页面或组件样式注入 `@import`,关闭后只生成独立样式文件 */ inject?: boolean; } type StyleConfigEntry = string | StyleConfigObject; interface StyleEntry { source: string; absolutePath: string; outputRelativePath: string; inputExtension: string; scope: StyleScope; include: string[]; exclude: string[]; inject?: boolean; } type SubPackageStyleScope = StyleScope; type SubPackageStyleConfigObject = StyleConfigObject; type SubPackageStyleConfigEntry = StyleConfigEntry; type SubPackageStyleEntry = StyleEntry; type GenerateExtensionsOptions = Partial<{ js: 'js' | 'ts' | (string & {}); json: 'js' | 'ts' | 'json' | (string & {}); wxml: 'wxml' | (string & {}); wxss: 'wxss' | 'scss' | 'less' | 'css' | (string & {}); }>; type GenerateDirsOptions = Partial<{ app: string; page: string; component: string; }>; type GenerateFilenamesOptions = Partial<{ app: string; page: string; component: string; }>; type GenerateFileType = 'js' | 'json' | 'wxml' | 'wxss'; interface GenerateTemplateContext { type: GenerateType; fileType: GenerateFileType; fileName: string; outDir: string; extension: string; cwd: string; defaultCode?: string; } interface GenerateTemplateFileSource { path: string; } interface GenerateTemplateInlineSource { content: string; } type GenerateTemplateFactory = (context: GenerateTemplateContext) => string | Promise | undefined; type GenerateTemplate = string | GenerateTemplateFileSource | GenerateTemplateInlineSource | GenerateTemplateFactory; type GenerateTemplateEntry = Partial>; type GenerateTemplateScope = GenerateType | 'shared'; type GenerateTemplatesConfig = Partial>; interface GenerateOptions { extensions?: GenerateExtensionsOptions; dirs?: GenerateDirsOptions; filenames?: GenerateFilenamesOptions; templates?: GenerateTemplatesConfig; } interface CopyOptions { include?: CopyGlobs; exclude?: CopyGlobs; filter?: (filePath: string, index: number, array: string[]) => boolean; } /** * @description 资源复制使用的 glob 列表 */ type CopyGlobs = string[]; interface WeappWebConfig { enable?: boolean; root?: string; srcDir?: string; outDir?: string; pluginOptions?: Partial>; vite?: InlineConfig; } interface WeappManagedSharedTsconfigConfig { compilerOptions?: CompilerOptions; } interface WeappManagedAppTsconfigConfig { compilerOptions?: CompilerOptions; vueCompilerOptions?: Record; include?: string[]; exclude?: string[]; files?: string[]; } interface WeappManagedNodeTsconfigConfig { compilerOptions?: CompilerOptions; include?: string[]; exclude?: string[]; files?: string[]; } interface WeappManagedServerTsconfigConfig { compilerOptions?: CompilerOptions; include?: string[]; exclude?: string[]; files?: string[]; } interface WeappManagedTypeScriptConfig { shared?: WeappManagedSharedTsconfigConfig; app?: WeappManagedAppTsconfigConfig; node?: WeappManagedNodeTsconfigConfig; server?: WeappManagedServerTsconfigConfig; } interface WeappLibEntryContext { name: string; input: string; } type WeappLibFileName = string | ((context: WeappLibEntryContext) => string); type WeappLibComponentJson = boolean | 'auto' | ((context: WeappLibEntryContext) => Record); interface WeappLibInternalDtsOptions { tsconfig?: string | false; compilerOptions?: CompilerOptions; vueCompilerOptions?: Record; } interface WeappLibVueTscOptions { tsconfig?: Record; compilerOptions?: CompilerOptions; vueCompilerOptions?: Record; } interface WeappLibDtsOptions { enabled?: boolean; mode?: 'internal' | 'vue-tsc'; internal?: WeappLibInternalDtsOptions; rolldown?: Options; vueTsc?: WeappLibVueTscOptions; } interface WeappLibConfig { entry: string | string[] | Record; root?: string; outDir?: string; preservePath?: boolean; fileName?: WeappLibFileName; componentJson?: WeappLibComponentJson; dts?: boolean | WeappLibDtsOptions; } interface BuildNpmPackageMeta { name: string; entry: InputOption; } type NpmDependencyPattern = string | RegExp; type NpmStrategy = 'explicit' | 'legacy'; interface NpmSubPackageConfig { dependencies?: NpmDependencyPattern[]; } interface NpmMainPackageConfig { dependencies?: false | NpmDependencyPattern[]; } interface NpmPluginPackageConfig { dependencies?: false | NpmDependencyPattern[]; } interface NpmPackageFilesConfig { /** 包内需要复制的文件 glob,默认包含全部文件 */ include?: string[]; /** 包内需要排除的文件 glob */ exclude?: string[]; } type JsFormat = 'cjs' | 'esm'; type SharedChunkStrategy = 'hoist' | 'duplicate'; type SharedChunkMode = 'common' | 'path' | 'inline'; /** * @deprecated `inline` 当前会回退为 `preserve`,请改用 `preserve` 或 `native`。 */ type DeprecatedInlineDynamicImports = 'inline'; type SharedChunkDynamicImports = 'preserve' | 'native' | DeprecatedInlineDynamicImports; interface SharedChunkOverride { test: string | RegExp; mode: SharedChunkMode; } interface ChunksConfig { sharedStrategy?: SharedChunkStrategy; sharedMode?: SharedChunkMode; sharedOverrides?: SharedChunkOverride[]; sharedPathRoot?: string; /** * @description 按 srcRoot 相对路径保留匹配源码模块的独立输出边界 */ preserveModules?: (string | RegExp)[]; dynamicImports?: SharedChunkDynamicImports; logOptimization?: boolean; forceDuplicatePatterns?: (string | RegExp)[]; duplicateWarningBytes?: number; } //#endregion //#region src/types/config/projectConfig.d.ts /** 保留原生工具新增字段,已声明字段仍提供类型检查与补全。 */ interface NativeOptions { [key: string]: unknown; } /** 内联配置的公共入口;平台字段由 `MultiPlatformProjectConfigs` 按平台提供。 */ interface MultiPlatformProjectConfig extends NativeOptions { appid?: string; appId?: string; /** 代码输出目录由构建器管理,请使用 `build.outDir`。 */ miniprogramRoot?: never; srcMiniprogramRoot?: never; smartProgramRoot?: never; } interface PackRule extends NativeOptions { type?: 'file' | 'folder' | 'suffix' | 'prefix' | 'regexp' | ExtraType | (string & {}); value?: string; } interface PackOptions extends NativeOptions { ignore?: PackRule[]; include?: PackRule[]; } /** * 微信开发者工具配置;不替代 Vite 的构建设置。 * @see https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html */ interface WeappProjectConfig extends MultiPlatformProjectConfig { projectname?: string; description?: string; compileType?: 'miniprogram' | 'plugin' | (string & {}); libVersion?: 'latest' | 'trial' | 'widelyUsed' | (string & {}); packOptions?: PackOptions; setting?: NativeOptions & { es6?: boolean; enhance?: boolean; postcss?: boolean; minified?: boolean; minifyWXSS?: boolean; minifyWXML?: boolean; urlCheck?: boolean; compileHotReLoad?: boolean; ignoreUploadUnusedFiles?: boolean; packNpmManually?: boolean; uploadWithSourceMap?: boolean; useCompilerPlugins?: string[] | false; babelSetting?: NativeOptions & { ignore?: string[]; outputPath?: string; }; }; } /** * 支付宝 format 2 项目配置;编译选项属于 `compileOptions`,而非微信的 `setting`。 * @see https://opendocs.alipay.com/mini/03dbc3 */ interface AlipayProjectConfig extends MultiPlatformProjectConfig { format?: number; compileType?: 'mini' | 'plugin' | (string & {}); uploadExclude?: string[]; assetsInclude?: string[]; compileOptions?: NativeOptions & { component2?: boolean; typescript?: boolean; less?: boolean; treeShaking?: boolean; resolveAlias?: Record; globalObjectMode?: 'legacy' | 'enable' | 'fake' | (string & {}); transpile?: NativeOptions & { script?: NativeOptions & { ignore?: string[]; }; }; }; developOptions?: NativeOptions & { hotReload?: boolean; parallel?: boolean; sourcemap?: boolean; minify?: boolean; skipTranspile?: boolean; lazyCompile?: boolean; }; scripts?: NativeOptions & { watch?: string; beforeCompile?: string; beforePreview?: string; beforeUpload?: string; }; } /** * 抖音开发者工具配置,保留平台自己的字段名称和类型。 * @see https://developer.open-douyin.com/docs/resource/zh-CN/mini-app/develop/framework/general-configuration */ interface TtProjectConfig extends MultiPlatformProjectConfig { projectname?: string; disablePrivate?: boolean; packOptions?: PackOptions<'glob'>; setting?: NativeOptions & { es6?: boolean; urlCheck?: boolean; autoCompile?: boolean; mockUpdate?: boolean; scripts?: boolean; mockLogin?: boolean; compileHotReLoad?: boolean; nativeCompile?: boolean; IDEPreviewHotRestartCache?: boolean; bigPackageSizeSupport?: boolean; webDetect?: boolean; useCompilerPlugins?: string[]; }; } /** * 小红书公开 SDK 默认配置中的稳定字段;未列出的原生字段仍可透传。 * @see https://unpkg.com/xhs-mp-project@2.1.6/dist/index.js */ interface XhsProjectConfig extends MultiPlatformProjectConfig { projectname?: string; description?: string; compileType?: 'miniprogram' | (string & {}); libVersion?: 'latest' | (string & {}); setting?: NativeOptions & { minified?: boolean; urlCheck?: boolean; }; } /** * 百度智能小程序配置;编译参数属于 `compilation-args.common`。 * @see https://unpkg.com/swan-toolkit@3.23.1-beta.1/sdk/program/sdk-impl/compile-impl.js */ interface SwanProjectConfig extends MultiPlatformProjectConfig { 'compileType'?: string; 'developType'?: string; 'setting'?: NativeOptions & { urlCheck?: boolean; }; 'compilation-args'?: NativeOptions & { common?: NativeOptions & { ignoreTransJs?: boolean; ignorePrefixCss?: boolean; }; }; } /** 六端内联配置映射;按平台补全原生字段,同时允许原生扩展字段。 */ interface MultiPlatformProjectConfigs { /** 微信:生成 `project.config.json`。 */ weapp?: WeappProjectConfig; /** 支付宝:生成 `mini.project.json`。 */ alipay?: AlipayProjectConfig; /** 抖音:生成 `project.config.json`。 */ tt?: TtProjectConfig; /** 小红书:生成 `project.config.json`。 */ xhs?: XhsProjectConfig; /** 京东:生成 `project.config.json`;未建立原生设置 schema 的字段保持透传。 */ jd?: MultiPlatformProjectConfig; /** 百度:生成 `project.swan.json`。 */ swan?: SwanProjectConfig; } //#endregion //#region src/types/config/wxmlTransform.d.ts /** 模板属性的新值;字符串为字面量,表达式只生成绑定而不在构建端求值。 */ type WxmlAttributeValue = string | number | boolean | { expression: string; }; /** 源码位置使用从零开始的偏移及从一开始的行列。 */ interface WxmlSourceLocation { readonly offset: number; readonly line: number; readonly column: number; } /** 原始属性内容不解码、不求值;无值属性的 rawValue 为 null。 */ interface WxmlAttribute { readonly name: string; readonly rawValue: string | null; readonly quote: string | undefined; } /** 父节点只提供观察接口,不允许通过子节点改写父树。 */ interface WxmlElementInfo { /** 当前未删除的直接子标签;不包含文本、注释或脚本模块内容。 */ readonly children: readonly WxmlElementInfo[]; readonly tagName: string; readonly attributes: readonly WxmlAttribute[]; readonly parent: WxmlElementInfo | undefined; readonly location: WxmlSourceLocation; hasAttribute: (name: string) => boolean; getAttribute: (name: string) => WxmlAttribute | undefined; } /** 当前节点的编辑句柄仅在本次 edit 调用中有效。 */ interface WxmlTransformNode extends WxmlElementInfo { readonly children: readonly WxmlTransformNode[]; /** 按源码深度优先顺序遍历后代,不含自身;必须等待完成。 */ walk: (visitor: WxmlTransformVisitor) => Promise; /** 只跳过当前回调所属遍历的后代,不改变其他遍历。 */ skipChildren: () => void; setAttribute: (name: string, value: WxmlAttributeValue) => void; setBooleanAttribute: (name: string) => void; renameAttribute: (from: string, to: string) => void; removeAttribute: (name: string) => void; renameTag: (name: string) => void; remove: () => void; } type WxmlTransformVisitor = (node: WxmlTransformNode) => void | Promise; type WxmlTransformResult = string | null | void; /** 函数接收当前平台的输出模板;源码阶段依赖由原有组件配置负责。 */ interface WxmlTransformContext { readonly fileName: string; readonly root: string; readonly platform: MpPlatform$1; readonly mode: string; readonly isDev: boolean; readonly subPackageRoot: string | undefined; edit: (code: string, visitor: WxmlTransformVisitor) => Promise; addWatchFile: (file: string) => void; warn: (message: string) => void; error: (message: string) => never; } type WxmlTransform = (code: string, context: WxmlTransformContext) => WxmlTransformResult | Promise; //#endregion //#region src/types/config/wxmlValidate.d.ts /** 诊断位置对应最终输出模板;不映射回 Vue 等源文件。 */ interface WxmlValidationDiagnostic { severity: 'warning' | 'error'; code?: string; message: string; location?: WxmlSourceLocation; } /** 校验只观察模板,不能通过节点改写产物。 */ type WxmlValidationVisitor = (node: WxmlElementInfo) => void | Promise; /** 所有回调观察同一份完成输出转换的模板。 */ interface WxmlValidationContext extends Pick { walk: (visitor: WxmlValidationVisitor) => Promise; report: (diagnostic: WxmlValidationDiagnostic) => void; } /** 返回值不用于转换;非 undefined 返回值会作为配置错误报告。 */ type WxmlValidate = (code: string, context: WxmlValidationContext) => void | Promise; //#endregion //#region src/types/config/features.d.ts /** * @description 自动导入组件配置 */ interface AutoImportComponents { /** * @description 组件扫描范围 */ globs?: string[]; /** * @description 组件解析器列表 */ resolvers?: Resolver[]; /** * @description 组件清单输出路径 */ output?: string | boolean; /** * @description WXML 组件 props 类型声明输出路径 */ typedComponents?: boolean | string; /** * @description VS Code HTML customData 输出路径 */ htmlCustomData?: boolean | string; /** * @description Vue SFC 组件声明输出路径 */ vueComponents?: boolean | string; /** * @description 生成 `components.d.ts` 时使用的运行时模块名 */ vueComponentsModule?: string; } type AutoImportComponentsOption = AutoImportComponents | boolean; /** * @description 实验性的 uni-app 源码兼容配置。 */ interface WeappUniAppConfig { /** * @description 允许参与兼容转换的 npm 包名。项目源码始终参与转换。 */ include: string[]; } /** 最终模板中的标签限定属性删除规则,名称区分大小写并支持 `*`。 */ interface WxmlRemoveAttrRule { tag: string | string[]; name: string | string[]; } /** 最终模板的可选清理;对象形式只执行显式配置,不叠加预设。 */ interface WxmlRemoveOptions { attr?: Array; tag?: string[]; comment?: boolean; } type EnhanceWxmlOptions = ScanWxmlOptions & Omit & { /** @deprecated 仅保留类型兼容,未接入编译流程;请使用 `weapp.wxml.remove.comment`。 */ removeComment?: boolean; /** `true` 删除四种测试属性及普通注释;环境由用户配置控制。 */ remove?: boolean | WxmlRemoveOptions; /** 在最终模板清理前按顺序执行同步或异步转换。 */ transform?: WxmlTransform | WxmlTransform[]; /** 在输出插件处理后、HMR 比较及发布前检查最终模板。 */ validate?: WxmlValidate | WxmlValidate[]; }; /** * @description WXML 扫描阶段配置 */ interface ScanWxmlOptions { excludeComponent?: (tagName: string) => boolean; platform?: MpPlatform$1; } /** * @description WXML 处理阶段配置 */ interface HandleWxmlOptions { defineImportMetaEnv?: Record; importMetaDefineRegistry?: ImportMetaDefineRegistry; importMetaRelativePath?: string; importMetaExtension?: string; removeComment?: boolean; transformEvent?: boolean; transformPlatformSyntax?: boolean; scriptModuleExtension?: string; scriptModuleTag?: string; templateExtension?: string; } interface EnhanceOptions { wxml?: boolean | Partial>; wxs?: boolean; autoImportComponents?: AutoImportComponentsOption; } /** * @description 多平台 project.config 配置 */ interface MultiPlatformConfig { enabled?: boolean; projectConfigRoot?: string; /** * @description 各平台的原生项目配置;不可与 `projectConfigRoot` 同时设置。 */ projectConfigs?: MultiPlatformProjectConfigs; /** * @description 多平台模式下允许参与构建/开发的目标平台集合;省略时从 `projectConfigs` 的平台键推断。 */ targets?: 'all' | readonly MpPlatform$1[]; } /** * @description MCP 服务配置 */ interface WeappMcpConfig { enabled?: boolean; autoStart?: boolean | 'ai'; host?: string; port?: number | 'auto'; endpoint?: string; /** * @description streamable-http 模式下的 DevTools runtime REST 入口;设为 false 可关闭。 */ restEndpoint?: string | false; } /** * @description 自动路由配置 */ type WeappAutoRoutesIncludePattern = string | RegExp; /** * @description 自动路由包含规则 */ type WeappAutoRoutesInclude = WeappAutoRoutesIncludePattern | WeappAutoRoutesIncludePattern[]; /** * @description 自动路由配置 */ interface WeappAutoRoutesConfig { enabled?: boolean; typedRouter?: boolean; /** * @description 自动路由扫描规则,支持字符串 glob、正则以及它们的数组 * @remarks 默认会扫描主包 `pages/**`,以及已声明分包 root 下的 `pages/**` */ include?: WeappAutoRoutesInclude; /** 页面入口扩展名(可带前导点);未设置或为空时沿用默认解析。 */ extensions?: string[]; /** * @description 是否启用自动路由持久化缓存,或指定自定义缓存文件路径 * @default false */ persistentCache?: boolean | string; watch?: boolean; } /** * @description 局部构建范围配置。 */ interface WeappBuildScopeObjectConfig { /** * @description 是否包含主包页面。 */ includeMainPackage?: boolean; /** * @description 参与构建的分包 root 列表。`main` 表示主包。 */ include?: string[]; /** * @internal * @description CLI 注入来源标记。 */ __weappViteBuildScopeSource?: boolean; } type WeappBuildScopeConfig = string | string[] | WeappBuildScopeObjectConfig; /** * @description `@wevu/api` 注入配置 */ interface WeappInjectWeapiConfig { enabled?: boolean; replaceWx?: boolean; globalName?: string; } type WeappInjectWebRuntimeGlobalsTarget = 'fetch' | 'Headers' | 'Request' | 'Response' | 'TextEncoder' | 'TextDecoder' | 'AbortController' | 'AbortSignal' | 'XMLHttpRequest' | 'WebSocket' | 'atob' | 'btoa' | 'queueMicrotask' | 'performance' | 'crypto' | 'Event' | 'CustomEvent'; type WeappInjectRequestGlobalsTarget = WeappInjectWebRuntimeGlobalsTarget; /** * @description Web Runtime 全局对象注入配置 */ interface WeappInjectWebRuntimeGlobalsConfig { enabled?: boolean; targets?: WeappInjectWebRuntimeGlobalsTarget[]; dependencies?: (string | RegExp)[]; prelude?: boolean; /** * @description Web Runtime 网络兼容层的宿主默认参数。 * @description 会透传给 `fetch` / `XMLHttpRequest` / `WebSocket` 对应的小程序底层能力。 * @description 显式调用时传入的 `miniProgram` / `miniprogram` 参数优先级更高。 */ networkDefaults?: MiniProgramNetworkDefaults; } /** * @description 已废弃,请迁移到 `WeappInjectWebRuntimeGlobalsConfig` */ interface WeappInjectRequestGlobalsConfig extends WeappInjectWebRuntimeGlobalsConfig {} /** * @description `app.prelude` 中的 Web Runtime 安装配置 */ interface WeappWebRuntimeConfig extends Omit {} /** * @description 已废弃,请迁移到 `WeappWebRuntimeConfig` */ interface WeappRequestRuntimeConfig extends WeappWebRuntimeConfig {} type WeappAppPreludeMode = 'inline' | 'entry' | 'require'; /** * @description `app.prelude` 前置注入配置 */ interface WeappAppPreludeConfig { enabled?: boolean; mode?: WeappAppPreludeMode; webRuntime?: boolean | WeappWebRuntimeConfig; /** * @deprecated 已废弃,请迁移到 `weapp.appPrelude.webRuntime`。 */ requestRuntime?: boolean | WeappRequestRuntimeConfig; } /** * @description 本地 npm 构建配置 */ interface WeappNpmConfig { enable?: boolean; cache?: boolean; strategy?: NpmStrategy; include?: NpmDependencyPattern[]; mainPackage?: NpmMainPackageConfig; pluginPackage?: NpmPluginPackageConfig; subPackages?: Record; /** 按包名限制原生小程序 npm 包复制到产物中的文件 */ packageFiles?: Record; buildOptions?: (options: NpmBuildOptions, pkgMeta: BuildNpmPackageMeta) => NpmBuildOptions | false | undefined; alipayNpmMode?: AlipayNpmMode; } /** * @description 分包级额外配置 */ interface WeappSubPackageConfig { independent?: boolean; inlineConfig?: Partial; autoImportComponents?: AutoImportComponentsOption; watchSharedStyles?: boolean; styles?: StyleConfigEntry | StyleConfigEntry[]; } /** * @description HMR 配置 */ interface WeappHmrConfig { /** * @description 微信开发者工具热更新运行时。stateful-experimental 使用实验性的状态保持协议。 */ runtime?: 'auto' | 'classic' | 'stateful-experimental'; sharedChunks?: 'full' | 'auto' | 'off'; /** * @description 额外刷新已存在的全局样式;auto 仅用于非内置 Tailwind 的实际内容失效,内置集成由原生输出刷新。false 不影响样式编译。 */ touchAppWxss?: boolean | 'auto'; /** * @description HMR 终端日志档位:默认仅输出总耗时,显式开启 concise/verbose 后再展示阶段诊断。 */ logLevel?: 'default' | 'concise' | 'verbose'; /** * @description 是否输出 HMR 结构化 profile,或指定自定义 JSONL 输出路径 */ profileJson?: boolean | string; } /** * @description worker 构建配置 */ interface WeappWorkerConfig { entry?: string | string[]; } /** * @description Vue 模板编译配置 */ interface WeappVueTemplateConfig { /** @deprecated 仅保留类型兼容,未接入编译流程;请使用 `weapp.wxml.remove.comment`。 */ removeComments?: boolean; simplifyWhitespace?: boolean; formatWxml?: boolean | 'auto'; htmlTagToWxml?: boolean | Record; htmlTagToWxmlTagClass?: boolean; scopedSlotsCompiler?: 'auto' | 'augmented' | 'off'; scopedSlotsRequireProps?: boolean; /** 是否启用微信原生插槽的 provide/inject 上下文协议,默认关闭;需同时开启 scopedSlotsRequireProps。 */ nativeSlotContext?: boolean; slotSingleRootNoWrapper?: boolean; slotFallbackWrapperStrategy?: 'view' | 'virtual-host'; slotFallbackWrapper?: string | { tag?: string; attrs?: Record; singleRootNoWrapper?: boolean; rules?: Array<{ component?: string | RegExp | Array; componentName?: string | RegExp | Array; slot?: string | RegExp | Array; tag?: string; attrs?: Record; singleRootNoWrapper?: boolean; }>; }; slotMultipleInstance?: boolean; classStyleRuntime?: 'auto' | 'wxs' | 'js'; objectLiteralBindMode?: 'runtime' | 'inline'; mustacheInterpolation?: 'compact' | 'spaced'; classStyleWxsShared?: boolean; functionPropNames?: Array; } /** * @description Vue 支持配置 */ interface WeappVueConfig { enable?: boolean; template?: WeappVueTemplateConfig; autoImport?: boolean; } /** * @description wevu 编译期默认值配置 */ interface WeappWevuConfig { preset?: 'performance'; defaults?: WevuConfigDefaults; autoSetDataPick?: boolean; /** * @description 是否压缩 wevu 相关脚本输出。 * @description 默认保持当前可读输出行为,开启后仅影响 wevu 编译生成的脚本代码。 */ minify?: boolean; /** * @description wevu 运行时入口版本。`auto` 表示开发模式使用 `dist/dev`,构建模式使用 `dist`。 */ runtime?: 'auto' | 'dev' | 'build'; } interface WeappReactCompilerConfig { compilationMode?: 'infer' | 'syntax' | 'annotation' | 'all'; engine?: 'swc'; } interface WeappReactConfig { compiler?: boolean | WeappReactCompilerConfig; renderMode?: 'auto' | 'dynamic' | 'static'; devWarnings?: boolean; } type WeappPreloadNetwork = 'all' | 'wifi'; /** * @description 页面进入后的分包预下载规则。 */ interface WeappPreloadRule { packages: string[]; network?: WeappPreloadNetwork; } interface WeappRouteRule { appLayout?: PageLayoutMeta; preload?: WeappPreloadRule; } type WeappRouteRules = Record; //#endregion //#region ../../node_modules/.pnpm/vite-tsconfig-paths@7.0.0-alpha.3_supports-color@10.2.2_vite@8.3.4/node_modules/vite-tsconfig-paths/dist/types.d.ts interface PluginOptions { /** * The directory to crawl for `tsconfig.json` files. * * When the `projects` option is set, crawling is skipped, so this is * used to resolve `projects` paths into absolute paths instead. * * @default * // The config root is used for resolving project paths, and the * // workspace root is used for crawling. * options.projects ? viteConfig.root : vite.searchForWorkspaceRoot(viteConfig.root) */ root?: string; /** * An array of `.json` files and/or directories that contain a * `tsconfig.json` file. These JSON files must adhere to the * {@link https://www.typescriptlang.org/tsconfig TypeScript config interface}. * The `extends` property is supported. * * This disables crawling for `tsconfig.json` files when defined. * * **Note:** When using `projectDiscovery: "lazy"`, this option is perfect * for ensuring your * {@link https://www.typescriptlang.org/docs/handbook/project-references.html project references} * are discovered. */ projects?: string[]; /** * Disable strictness that limits path resolution to TypeScript and * JavaScript modules. * * Useful if you want asset URLs in Vue templates to be resolved, or when * `"allowJs": true` in your tsconfig isn't good enough. */ loose?: boolean; /** * Fine-grained control over which files should have their imports * resolved by this plugin. This has no effect when `loose` is true. */ importerFilter?: (importer: string) => boolean; /** * Silence the warning about malformed `tsconfig.json` files. */ ignoreConfigErrors?: boolean; /** * An array of `tsconfig.json` file names to search for. * * @default ["tsconfig.json", "jsconfig.json"] */ configNames?: string[]; /** * A function that determines which directories to skip when searching * for tsconfig.json files. While `.git` and `node_modules` directories * are always skipped, this option allows you to skip additional * directories, which is useful in large monorepos to improve * performance. * * **Note:** This is not used when the `projects` option is set, unless * `projectDiscovery` is set to `lazy`. */ skip?: (dir: string) => boolean; /** * With the "lazy" strategy, the `tsconfig.json` files are parsed when an * import is encountered in a module with a supported file extension that * exists in the same directory as the `tsconfig.json` file (or one of * its subdirectories). * * **Note 1:** If your `tsconfig.json` files have `../*` paths in their * `include` or `files` array, the "lazy" strategy is not recommended, * since the tsconfig file won't be discovered for those cases. * * **Note 2:** You can combine the `projects` option with "lazy" to * ensure your project references are discovered. Alternatively, the * `configNames` option allows for custom-named tsconfig files to be * discovered. * * With the "eager" strategy, all `tsconfig.json` files are loaded and * parsed when the plugin is initialized. This means they won't be * reloaded if their file is edited. This was the only parsing strategy * prior to v5.2.0 and may be deprecated in a future version. * * @default "eager" */ projectDiscovery?: "eager" | "lazy"; /** * A file to write detailed logs of the resolver process. */ logFile?: string | boolean; } //#endregion //#region src/types/config/tsconfigPaths.d.ts /** 高级路径适配选项,保留旧配置的类型兼容。 */ interface TsconfigPathsOptions extends PluginOptions { /** @deprecated 解析器已统一处理继承和路径,此选项仅兼容旧配置,不再加载 TypeScript 编译器。 */ parseNative?: boolean; } //#endregion //#region src/types/config/main.d.ts type WeappTailwindcssOptions = UserDefinedOptions & Pick; /** * @description 分包元信息 */ interface SubPackageMetaValue { entries: string[]; subPackage: SubPackage; autoImportComponents?: AutoImportComponentsOption; styleEntries?: StyleEntry[]; watchSharedStyles?: boolean; } /** * @description 调试输出配置 */ interface WeappDebugConfig { watchFiles?: (watchFiles: string[], subPackageMeta?: SubPackageMetaValue) => void; resolveId?: (id: string, subPackageMeta?: SubPackageMetaValue) => void; load?: (id: string, subPackageMeta?: SubPackageMetaValue) => void; vueTransformTiming?: (timing: { id: string; isPage: boolean; totalMs: number; stages: Record; }) => void; inspect?: WrapPluginOptions; } type WeappForwardConsoleLogLevel = 'debug' | 'log' | 'info' | 'warn' | 'error'; /** * @description 微信开发者工具日志转发配置。 */ interface WeappForwardConsoleConfig { /** * 是否启用日志转发。 * - `true`: 始终开启 * - `false`: 始终关闭 * - `'auto'`: 仅在检测到 AI 终端时开启 */ enabled?: boolean | 'auto'; /** * 允许转发的日志级别。 */ logLevels?: WeappForwardConsoleLogLevel[]; /** * 是否同时转发未捕获异常。 */ unhandledErrors?: boolean; } /** * @description analyze 包体预算配置。 */ interface WeappAnalyzeBudgetConfig { /** * 总包预算阈值(字节)。 */ totalBytes?: number; /** * 主包预算阈值(字节)。 */ mainBytes?: number; /** * 普通分包预算阈值(字节)。 */ subPackageBytes?: number; /** * 独立分包预算阈值(字节)。 */ independentBytes?: number; /** 包含已识别 runtime 模块的文件字节上界预算,包含混合 chunk 的业务部分。 */ runtimeBytes?: number; /** 按分包 root 覆盖单包预算;主包使用 __main__。 */ packageBytes?: Record; /** * 预算预警比例,默认 0.85。 */ warningRatio?: number; } /** * @description analyze 历史快照配置。 */ interface WeappAnalyzeHistoryConfig { /** * 是否写入历史快照。 */ enabled?: boolean; /** * 历史快照目录,默认 `.weapp-vite/analyze-history`。 */ dir?: string; /** * 保留快照数量,默认 20。 */ limit?: number; } /** * @description analyze 配置。 */ interface WeappAnalyzeConfig { /** * dashboard 与 Markdown 报告使用的包体预算。 */ budgets?: WeappAnalyzeBudgetConfig; /** * CLI 侧历史快照。设置为 `false` 可关闭。 */ history?: boolean | WeappAnalyzeHistoryConfig; } /** * @description 显式执行 build --upload 或 upload 命令时使用的默认参数,不会触发自动上传。 */ interface WeappUploadConfig { /** * 上传版本;CLI --uv 优先,未配置时读取 package.json.version。 */ version?: string; /** * 上传说明;CLI --desc 优先,未配置时使用项目名称与版本。 */ desc?: string; } /** * @description weapp-vite 主配置 */ interface WeappViteConfig { /** * 开发态是否在启动构建前清空输出目录。 * 开发态默认 `true`,设置为 `false` 可跳过每次 dev 启动前的全量输出目录清理。 * 生产构建默认清空输出目录;显式 `build.emptyOutDir: false` 对开发和生产均禁用全量清理。 */ cleanOutputsInDev?: boolean; /** * 内置 weapp-tailwindcss 集成。显式配置优先;未配置时,Tailwind CSS v4 且实际引入 `@import "tailwindcss"` 会自动启用。 * - `true`: 使用默认配置和 `srcRoot/app.css` 入口 * - `object`: 启用并传入 weapp-tailwindcss core options */ tailwindcss?: boolean | WeappTailwindcssOptions; /** * 可扩展的底层编译插件。插件负责声明源码所有权,并可参与 CSS、WXML、JavaScript、bundle 和 HMR 生命周期。 */ compilerPlugins?: WeappCompilerPluginOption | WeappCompilerPluginOption[]; /** * 应用入口目录(`app.json` 所在目录)。 */ srcRoot?: string; /** * 自动路由模块配置。 * - `undefined` / `false`: 默认关闭 * - `true`: 启用默认自动路由配置 * - `object`: 启用自动路由并允许细粒度控制 */ autoRoutes?: boolean | WeappAutoRoutesConfig; /** * 小程序 i18n 构建与运行时配置。 */ i18n?: WeappI18nConfig; /** * 插件入口目录(`plugin.json` 所在目录)。 */ pluginRoot?: string; /** * 日志输出配置。 */ logger?: LoggerConfig; /** * AST 引擎配置。 */ ast?: WeappAstConfig; /** * 主包/分包体积告警阈值(字节)。 */ packageSizeWarningBytes?: number; /** * analyze 报告配置。 */ analyze?: WeappAnalyzeConfig; /** * 上传默认参数。仅在显式执行 build --upload 或 upload 且构建与产物校验成功后上传; * 普通 build、dev/HMR、preview 和上传 dry-run 不触发上传。 */ upload?: WeappUploadConfig; /** * 局部构建范围。默认不启用,启用后只构建主包和指定分包。 */ buildScope?: WeappBuildScopeConfig; jsonAlias?: AliasOptions | false; npm?: WeappNpmConfig; generate?: GenerateOptions; tsconfigPaths?: boolean | TsconfigPathsOptions; /** * 主包共享样式入口。生成独立样式文件,并按配置注入主包与普通分包页面或组件。 */ styles?: StyleConfigEntry | StyleConfigEntry[]; subPackages?: Record; copy?: CopyOptions; web?: WeappWebConfig; typescript?: WeappManagedTypeScriptConfig; lib?: WeappLibConfig; isAdditionalWxml?: (wxmlFilePath: string) => boolean; platform?: MpPlatform$1 | 'web'; multiPlatform?: boolean | MultiPlatformConfig; jsFormat?: JsFormat; /** * @deprecated 已废弃,不建议继续使用。请改为保持 `build.target >= es2020`,并在开发者工具中开启“将 JS 编译成 ES5”功能。 * 该选项依赖 `@swc/core` 做额外 ES5 降级,后续版本将移除。 */ es5?: boolean; wxml?: EnhanceOptions['wxml']; wxs?: EnhanceOptions['wxs']; autoImportComponents?: AutoImportComponentsOption; /** * 实验性的 uni-app 源码兼容层。默认关闭。 */ uniApp?: false | WeappUniAppConfig; enhance?: EnhanceOptions; debug?: WeappDebugConfig; hmr?: WeappHmrConfig; worker?: WeappWorkerConfig; vue?: WeappVueConfig; wevu?: WeappWevuConfig; react?: boolean | WeappReactConfig; routeRules?: WeappRouteRules; appPrelude?: boolean | WeappAppPreludeConfig; injectWeapi?: boolean | WeappInjectWeapiConfig; injectWebRuntimeGlobals?: boolean | WeappInjectWebRuntimeGlobalsConfig; /** * @deprecated 已废弃,请迁移到 `weapp.appPrelude.webRuntime`。 */ injectRequestGlobals?: boolean | WeappInjectRequestGlobalsConfig; mcp?: boolean | WeappMcpConfig; forwardConsole?: boolean | WeappForwardConsoleConfig; chunks?: ChunksConfig; json?: JsonConfig; } type UserConfig$2 = UserConfig & { weapp?: WeappViteConfig; }; /** * @description 小程序 project.config 结构 */ interface ProjectConfig { miniprogramRoot?: string; srcMiniprogramRoot?: string; smartProgramRoot?: string; setting?: { packNpmManually?: boolean; packNpmRelationList?: { packageJsonPath: string; miniprogramNpmDistDir: string; }[]; }; } //#endregion //#region src/types/compilerPlugin.d.ts type WeappCompilerPluginPhase = 'source' | 'output'; type WeappCompilerResourceKind = 'style' | 'template' | 'script'; interface WeappCompilerPluginCapabilities { bundle?: boolean; style?: boolean; template?: boolean; script?: boolean; content?: boolean; hmr?: boolean; } interface WeappCompilerPluginContext { root: string; srcRoot: string; platform: MpPlatform$1; outputExtensions: OutputExtensions; isDev: boolean; resolvedConfig?: ResolvedConfig; readFile: (id: string) => Promise; resolve: (source: string, importer?: string, options?: { skipSelf?: boolean; }) => Promise<{ id: string; } | null>; addWatchFile: (id: string) => void; invalidate: (id: string) => void; warn: (message: string) => void; error: (message: string) => never; claimSource: (id: string, owner: string) => void; getSourceOwner: (id: string) => string | undefined; } interface WeappCompilerSourceRequest { id: string; code: string; kind: WeappCompilerResourceKind; } interface WeappCompilerTransformResult { code: string; /** 与产物关联的稳定入口标识;未提供时由 host 使用源码 id。 */ entryId?: string; map?: unknown; dependencies?: string[]; /** provider 需要 host 重新处理的文件集合。 */ invalidated?: string[]; handled?: boolean; state?: unknown; } interface WeappCompilerSourceClaim { id?: string; entryId?: string; dependencies?: string[]; } interface WeappCompilerOutputRequest { fileName: string; code: string; entryId?: string; state?: unknown; } interface WeappCompilerPluginController { /** 同批次资产与脚本必须使用此调用持有的固定状态。 */ prepareHmr?: (request: HmrCompilerRequest) => HmrCompilerPreparation | Promise; buildStart?: () => void | Promise; claimSource?: (request: WeappCompilerSourceRequest) => boolean | WeappCompilerSourceClaim | Promise | null; transformSource?: (request: WeappCompilerSourceRequest) => WeappCompilerTransformResult | null | Promise; generateBundle?: (bundle: OutputBundle, context: WeappCompilerPluginContext) => void | Promise; transformCss?: (request: WeappCompilerOutputRequest) => WeappCompilerTransformResult | null | Promise; transformTemplate?: (request: WeappCompilerOutputRequest) => WeappCompilerTransformResult | null | Promise; transformJavaScript?: (request: WeappCompilerOutputRequest) => WeappCompilerTransformResult | null | Promise; watchChange?: (id: string, change: { event: 'create' | 'update' | 'delete'; }) => void | Promise; handleHotUpdate?: (file: string) => string[] | void | Promise; buildEnd?: (error?: Error) => void | Promise; closeWatcher?: () => void | Promise; closeBundle?: () => void | Promise; dispose?: () => void | Promise; } interface WeappCompilerPlugin { name: string; phase?: WeappCompilerPluginPhase; capabilities?: WeappCompilerPluginCapabilities; create: (context: WeappCompilerPluginContext) => WeappCompilerPluginController | Promise; } type WeappCompilerPluginFactory = (context: WeappCompilerPluginContext) => WeappCompilerPlugin | Promise; type WeappCompilerPluginOption = WeappCompilerPlugin | WeappCompilerPluginFactory; //#endregion //#region src/types/context.d.ts interface WxmlDep { tagName: string; start: number; end: number; quote: string | null | undefined; name: string; value: string; attrs: Record; } interface ScanComponentItem { start: number; end: number; } type ComponentsMap = Record; //#endregion //#region src/types/entry.d.ts interface BaseEntry { path: string; jsonPath?: string; json?: object; /** 自动导入增强前的入口声明,供逻辑入口建立稳定的配置依赖。 */ declaredJson?: object; type: 'app' | 'page' | 'component' | (string & {}); } type Entry = AppEntry | PageEntry | ComponentEntry; /** * 应用入口 js + json */ interface AppEntry extends BaseEntry { type: 'app'; preludePath?: string; themeJsonPath?: string; themeJson?: Theme; sitemapJsonPath?: string; sitemapJson?: Sitemap; json: App; jsonPath: string; } /** * 页面入口 js + wxml */ interface PageEntry extends BaseEntry { type: 'page'; templatePath: string; json?: Page; } /** * 组件入口 js + wxml + json + json.component === true */ interface ComponentEntry extends BaseEntry { type: 'component'; templatePath: string; json: Component; jsonPath: string; } type EntryJsonFragment = Omit; //#endregion //#region src/types/errors.d.ts interface BindingErrorLike { message?: string; code?: string; plugin?: string; id?: string; frame?: string; stack?: string; } //#endregion //#region src/moduleGraph/protocol.d.ts type SidecarModuleKind = 'json' | 'jsx' | 'layout' | 'script' | 'style' | 'template' | 'using-component' | 'wxs'; //#endregion //#region src/moduleGraph/types.d.ts interface BuildModuleInfo { dynamicImporters?: readonly string[]; exports?: readonly string[]; importers?: readonly string[]; isEntry?: boolean; } interface BuildGraphContext { getModuleIds?: () => Iterable; getModuleInfo?: (id: string) => BuildModuleInfo | null | undefined; load?: (options: { id: string; resolveDependencies?: boolean; }) => Promise; resolve?: (source: string, importer?: string, options?: { skipSelf?: boolean; }) => Promise<{ id: string; } | null>; } interface DevModuleNode { file?: string | null; id?: string | null; importedModules?: Set; importers?: Set; url?: string; } interface DevModuleGraph { getModuleById: (id: string) => DevModuleNode | undefined; getModulesByFile: (file: string) => Set | undefined; idToModuleMap?: Map; invalidateModule(module: DevModuleNode): void; } interface DevResolverContainer { resolveId: (source: string, importer?: string) => Promise<{ id: string; } | null>; } interface DevServerGraphHost { environments?: { client?: { bundledDev?: unknown; pluginContainer?: DevResolverContainer; }; }; pluginContainer?: DevResolverContainer; moduleGraph: DevModuleGraph; transformRequest?: (url: string) => Promise; } interface TopologyRescanRequest { files: Set; reasons: Set; } //#endregion //#region src/moduleGraph/service.d.ts interface ModuleGraphService { /** 只替换指定 scope;返回仅对应本次绑定的释放器。 */ bindBuildContext: (scope: object, context: BuildGraphContext) => () => void; /** 撤销 scope 的图和插件上下文;传入 context 时仅释放仍归该 context 所有的绑定。 */ unbindBuildContext: (scope: object, context?: BuildGraphContext) => void; /** 返回仅对应本次绑定的释放器,避免旧 server 的异步关闭解绑新 server。 */ bindDevServer: (server: DevServerGraphHost | undefined) => () => void; bindPluginContext: (scope: object, context: BuildGraphContext) => void; /** 仅用于整个会话关闭或替换,不用于普通增量构建或临时 snapshot。 */ resetSession: () => void; /** 指定 kind 时仅查询该类声明依赖,不展开构建引擎的模块图。 */ collectAffectedEntries: (file: string, kind?: SidecarModuleKind) => Set; getPendingChanges: () => Array<{ event: string; file: string; }>; consumeTopologyRescan: () => TopologyRescanRequest | undefined; hasModule: (file: string) => boolean; invalidate: (file: string) => Set; isLogicalLayoutEntry: (file: string) => boolean; load: (options: { id: string; resolveDependencies?: boolean; }) => Promise; replaceEntryDependencies: (ownerId: string, kind: SidecarModuleKind, sourceIds: Iterable, resolveSourceId?: (id: string) => string) => void; /** 释放 owner 自己的依赖声明;实际 import graph 的更新仍由构建引擎负责。 */ removeEntryDependencies: (ownerId: string) => void; recordChangedFile: (file: string, event: string) => void; clearPendingChanges: () => void; requestTopologyRescan: (reason: string, file: string) => void; resolve: (source: string, importer?: string, options?: { skipSelf?: boolean; }) => Promise<{ id: string; } | null>; syncDevGraph: (context: BuildGraphContext) => Promise; getTransformDependencies: (sourceId: string) => readonly string[]; replaceTransformDependencies: (sourceId: string, dependencies: Iterable) => void; getEntryDependencies: (ownerId: string, options?: { preserveAliases: boolean; }) => Array<{ kind: SidecarModuleKind; sourceId: string; }>; } //#endregion //#region src/runtime/buildPlugin/service.d.ts interface BuildOptions { skipNpm?: boolean; } interface BuildService { queue: PQueue; build: (options?: BuildOptions) => Promise; requestConfigRestart: (target?: BuildTarget) => void; buildIndependentBundle: (root: string, meta: SubPackageMetaValue) => Promise; getIndependentOutput: (root: string) => RolldownOutput | undefined; invalidateIndependentOutput: (root: string) => void; } //#endregion //#region ../../node_modules/.pnpm/pkg-types@2.3.3/node_modules/pkg-types/dist/index.d.mts interface PackageJson { /** * The name is what your thing is called. * Some rules: * - The name must be less than or equal to 214 characters. This includes the scope for scoped packages. * - The name can’t start with a dot or an underscore. * - New packages must not have uppercase letters in the name. * - The name ends up being part of a URL, an argument on the command line, and a folder name. Therefore, the name can’t contain any non-URL-safe characters. */ name?: string; /** * Version must be parseable by `node-semver`, which is bundled with npm as a dependency. (`npm install semver` to use it yourself.) */ version?: string; /** * Put a description in it. It’s a string. This helps people discover your package, as it’s listed in `npm search`. */ description?: string; /** * Put keywords in it. It’s an array of strings. This helps people discover your package as it’s listed in `npm search`. */ keywords?: string[]; /** * The url to the project homepage. */ homepage?: string; /** * The url to your project’s issue tracker and / or the email address to which issues should be reported. These are helpful for people who encounter issues with your package. */ bugs?: string | { url?: string; email?: string; }; /** * You should specify a license for your package so that people know how they are permitted to use it, and any restrictions you’re placing on it. */ license?: string; /** * Specify the place where your code lives. This is helpful for people who want to contribute. If the git repo is on GitHub, then the `npm docs` command will be able to find you. * For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the same shortcut syntax you use for npm install: */ repository?: string | { type: string; url: string; /** * If the `package.json` for your package is not in the root directory (for example if it is part of a monorepo), you can specify the directory in which it lives: */ directory?: string; }; /** * The `scripts` field is a dictionary containing script commands that are run at various times in the lifecycle of your package. */ scripts?: PackageJsonScripts; /** * If you set `"private": true` in your package.json, then npm will refuse to publish it. */ private?: boolean; /** * The “author” is one person. */ author?: PackageJsonPerson; /** * “contributors” is an array of people. */ contributors?: PackageJsonPerson[]; /** * An object containing a URL that provides up-to-date information * about ways to help fund development of your package, * a string URL, or an array of objects and string URLs */ funding?: PackageJsonFunding | PackageJsonFunding[]; /** * The optional `files` field is an array of file patterns that describes the entries to be included when your package is installed as a dependency. File patterns follow a similar syntax to `.gitignore`, but reversed: including a file, directory, or glob pattern (`*`, `**\/*`, and such) will make it so that file is included in the tarball when it’s packed. Omitting the field will make it default to `["*"]`, which means it will include all files. */ files?: string[]; /** * The main field is a module ID that is the primary entry point to your program. That is, if your package is named `foo`, and a user installs it, and then does `require("foo")`, then your main module’s exports object will be returned. * This should be a module ID relative to the root of your package folder. * For most modules, it makes the most sense to have a main script and often not much else. */ main?: string; /** * If your module is meant to be used client-side the browser field should be used instead of the main field. This is helpful to hint users that it might rely on primitives that aren’t available in Node.js modules. (e.g. window) */ browser?: string | Record; /** * The `unpkg` field is used to specify the URL to a UMD module for your package. This is used by default in the unpkg.com CDN service. */ unpkg?: string; /** * A map of command name to local file name. On install, npm will symlink that file into `prefix/bin` for global installs, or `./node_modules/.bin/` for local installs. */ bin?: string | Record; /** * Specify either a single file or an array of filenames to put in place for the `man` program to find. */ man?: string | string[]; /** * Dependencies are specified in a simple object that maps a package name to a version range. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or git URL. */ dependencies?: Record; /** * If someone is planning on downloading and using your module in their program, then they probably don’t want or need to download and build the external test or documentation framework that you use. * In this case, it’s best to map these additional items in a `devDependencies` object. */ devDependencies?: Record; /** * If a dependency can be used, but you would like npm to proceed if it cannot be found or fails to install, then you may put it in the `optionalDependencies` object. This is a map of package name to version or url, just like the `dependencies` object. The difference is that build failures do not cause installation to fail. */ optionalDependencies?: Record; /** * In some cases, you want to express the compatibility of your package with a host tool or library, while not necessarily doing a `require` of this host. This is usually referred to as a plugin. Notably, your module may be exposing a specific interface, expected and specified by the host documentation. */ peerDependencies?: Record; /** * TypeScript typings, typically ending by `.d.ts`. */ types?: string; /** * This field is synonymous with `types`. */ typings?: string; /** * Non-Standard Node.js alternate entry-point to main. * An initial implementation for supporting CJS packages (from main), and use module for ESM modules. */ module?: string; /** * Make main entry-point be loaded as an ESM module, support "export" syntax instead of "require" * * Docs: * - https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_package_json_type_field * * @default 'commonjs' * @since Node.js v14 */ type?: "module" | "commonjs"; /** * Alternate and extensible alternative to "main" entry point. * * When using `{type: "module"}`, any ESM module file MUST end with `.mjs` extension. * * Docs: * - https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_exports_sugar * * @since Node.js v12.7 */ exports?: PackageJsonExports; /** * Docs: * - https://nodejs.org/api/packages.html#imports */ imports?: Record>; /** * The field is used to define a set of sub-packages (or workspaces) within a monorepo. * * This field is an array of glob patterns or an object with specific configurations for managing * multiple packages in a single repository. */ workspaces?: string[] | { /** * Workspace package paths. Glob patterns are supported. */ packages?: string[]; /** * Packages to block from hoisting to the workspace root. * Uses glob patterns to match module paths in the dependency tree. * * Docs: * - https://classic.yarnpkg.com/blog/2018/02/15/nohoist/ */ nohoist?: string[]; }; /** * The field is used to specify different TypeScript declaration files for * different versions of TypeScript, allowing for version-specific type definitions. */ typesVersions?: Record>; /** * You can specify which operating systems your module will run on: * ```json * { * "os": ["darwin", "linux"] * } * ``` * You can also block instead of allowing operating systems, just prepend the blocked os with a '!': * ```json * { * "os": ["!win32"] * } * ``` * The host operating system is determined by `process.platform` * It is allowed to both block and allow an item, although there isn't any good reason to do this. */ os?: string[]; /** * If your code only runs on certain cpu architectures, you can specify which ones. * ```json * { * "cpu": ["x64", "ia32"] * } * ``` * Like the `os` option, you can also block architectures: * ```json * { * "cpu": ["!arm", "!mips"] * } * ``` * The host architecture is determined by `process.arch` */ cpu?: string[]; /** * This is a set of config values that will be used at publish-time. */ publishConfig?: { /** * The registry that will be used if the package is published. */ registry?: string; /** * The tag that will be used if the package is published. */ tag?: string; /** * The access level that will be used if the package is published. */ access?: "public" | "restricted"; /** * **pnpm-only** * * By default, for portability reasons, no files except those listed in * the bin field will be marked as executable in the resulting package * archive. The executableFiles field lets you declare additional fields * that must have the executable flag (+x) set even if * they aren't directly accessible through the bin field. */ executableFiles?: string[]; /** * **pnpm-only** * * You also can use the field `publishConfig.directory` to customize * the published subdirectory relative to the current `package.json`. * * It is expected to have a modified version of the current package in * the specified directory (usually using third party build tools). */ directory?: string; /** * **pnpm-only** * * When set to `true`, the project will be symlinked from the * `publishConfig.directory` location during local development. * @default true */ linkDirectory?: boolean; } & Pick; /** * See: https://nodejs.org/api/packages.html#packagemanager * This field defines which package manager is expected to be used when working on the current project. * Should be of the format: `@[#hash]` */ packageManager?: string; [key: string]: any; } /** * See: https://docs.npmjs.com/cli/v11/using-npm/scripts#pre--post-scripts */ type PackageJsonScriptWithPreAndPost = S | `${"pre" | "post"}${S}`; /** * See: https://docs.npmjs.com/cli/v11/using-npm/scripts#life-cycle-operation-order */ type PackageJsonNpmLifeCycleScripts = "dependencies" | "prepublishOnly" | PackageJsonScriptWithPreAndPost<"install" | "pack" | "prepare" | "publish" | "restart" | "start" | "stop" | "test" | "version">; /** * See: https://pnpm.io/scripts#lifecycle-scripts */ type PackageJsonPnpmLifeCycleScripts = "pnpm:devPreinstall"; type PackageJsonCommonScripts = "build" | "coverage" | "deploy" | "dev" | "format" | "lint" | "preview" | "release" | "typecheck" | "watch"; type PackageJsonScriptName = PackageJsonCommonScripts | PackageJsonNpmLifeCycleScripts | PackageJsonPnpmLifeCycleScripts | (string & {}); type PackageJsonScripts = { [P in PackageJsonScriptName]?: string; }; /** * A “person” is an object with a “name” field and optionally “url” and “email”. Or you can shorten that all into a single string, and npm will parse it for you. */ type PackageJsonPerson = string | { name: string; email?: string; url?: string; }; type PackageJsonFunding = string | { url: string; type?: string; }; type PackageJsonExportKey = "." | "import" | "require" | "types" | "node" | "browser" | "default" | (string & {}); type PackageJsonExportsObject = { [P in PackageJsonExportKey]?: string | PackageJsonExportsObject | Array; }; type PackageJsonExports = string | PackageJsonExportsObject | Array; //#endregion //#region src/multiPlatform.d.ts interface ResolvedMultiPlatformConfig { enabled: boolean; projectConfigRoot: string; targets: readonly MpPlatform$1[]; projectConfigs?: MultiPlatformProjectConfigs; } //#endregion //#region src/utils/json.d.ts interface JsonResolvableEntry { json?: any; jsonPath?: string; type?: 'app' | 'page' | 'component' | 'plugin'; } //#endregion //#region src/utils/loadViteConfigFile.d.ts type ViteConfigLoader = 'bundle' | 'runner' | 'native'; //#endregion //#region src/runtime/config/types.d.ts interface LoadConfigOptions { cwd: string; isDev: boolean; mode: string; emitDefaultAutoImportOutputs?: boolean; outputRoot?: string; pluginOnly?: boolean; /** 宿主已执行的配置;存在时跳过 vite/weapp-vite 配置文件发现与加载。 */ hostConfig?: { config: InlineConfig; path?: string; dependencies?: string[]; }; inlineConfig?: InlineConfig; configFile?: string; configLoader?: ViteConfigLoader; cliPlatform?: string; projectConfigPath?: string; } interface LoadConfigResult { loadOptions: LoadConfigOptions; /** 本次加载的用户配置,供隔离子会话重新归一化,避免重复执行配置文件。 */ sourceConfig?: InlineConfig; config: InlineConfig; aliasEntries: ResolvedAlias[]; outputExtensions: OutputExtensions; packageJson: PackageJson; relativeSrcRoot: (p: string) => string; cwd: string; isDev: boolean; mode: string; emitDefaultAutoImportOutputs: boolean; chunksConfigured?: boolean; projectConfig: Record; projectPrivateConfig: Record; projectConfigPath?: string; projectPrivateConfigPath?: string; mpDistRoot: string; multiPlatform: ResolvedMultiPlatformConfig; weappLib?: ResolvedWeappLibConfig; weappLibOutputMap?: Map; packageJsonPath: string; platform: MpPlatform$1; srcRoot: string; pluginOnly?: boolean; configFilePath?: string; configFileDependencies: string[]; currentSubPackageRoot?: string; weappWeb?: ResolvedWeappWebConfig; configMergeInfo?: ResolvedConfigMergeInfo; } interface ResolvedConfigMergeInfo { merged: boolean; viteConfigPath?: string; weappConfigPath?: string; } interface ResolvedWeappLibConfig { enabled: boolean; entry: WeappLibConfig['entry']; root: string; outDir?: string; preservePath: boolean; fileName?: WeappLibFileName; componentJson: WeappLibComponentJson; dts: WeappLibDtsOptions; source?: WeappLibConfig; } interface PackageInfo { name: string; version: string | undefined; rootPath: string; packageJsonPath: string; packageJson: PackageJson; } interface ConfigService { options: LoadConfigResult; readonly loadOptions: LoadConfigOptions; outputExtensions: OutputExtensions; defineEnv: Record; packageManager: DetectResult; packageInfo: PackageInfo; setDefineEnv: (key: string, value: any) => void; setImportMetaEnvDefineOverride: (define?: Record) => void; load: (options?: Partial) => Promise; mergeWorkers: (...configs: Partial[]) => InlineConfig; merge: (subPackageMeta?: SubPackageMetaValue, ...configs: Partial[]) => InlineConfig; mergeWeb: (...configs: Partial[]) => InlineConfig | undefined; mergeInlineConfig: (...configs: Partial[]) => InlineConfig; readonly importMetaDefineEntries: Record; readonly defineImportMetaEnv: Record; readonly importMetaEnvDefineOverride?: Record; readonly importMetaDefineRegistry: ImportMetaDefineRegistry; readonly cwd: string; readonly isDev: boolean; readonly emitDefaultAutoImportOutputs: boolean; readonly mpDistRoot: string; readonly outDir: string; readonly multiPlatform: ResolvedMultiPlatformConfig; readonly inlineConfig: InlineConfig; readonly weappViteConfig: NonNullable; readonly packageJson: PackageJson; readonly projectConfig: Record; readonly projectPrivateConfig: Record; readonly projectConfigPath?: string; readonly projectPrivateConfigPath?: string; readonly srcRoot: string; readonly pluginOnly: boolean; readonly pluginRoot: string | undefined; readonly absolutePluginRoot: string | undefined; readonly absolutePluginOutputRoot: string | undefined; readonly absoluteSrcRoot: string; readonly mode: string; readonly aliasEntries: ResolvedAlias[]; readonly platform: MpPlatform$1; readonly configFilePath?: string; readonly configFileDependencies: string[]; readonly weappWebConfig?: ResolvedWeappWebConfig; readonly weappLibConfig?: ResolvedWeappLibConfig; readonly weappLibOutputMap?: Map; relativeCwd: (p: string) => string; relativeSrcRoot: (p: string) => string; relativeAbsoluteSrcRoot: (p: string) => string; relativeOutputPath: (p: string) => string; readonly currentSubPackageRoot?: string; } interface ResolvedWeappWebConfig { enabled: boolean; root: string; srcDir: string; outDir: string; pluginOptions: Omit & { srcDir: string; }; userConfig?: InlineConfig; source?: WeappWebConfig; } //#endregion //#region src/cache/file.d.ts type HashInput = string | Buffer; declare class FileCache { cache: LRUCache; mtimeMap: Map; signatureMap: Map; constructor(max?: number); get(id: string): T | undefined; set(id: string, content: T): LRUCache; delete(id: string): boolean; isInvalidate(id: string, options?: { content?: HashInput; checkMtime?: boolean; mtimeMs?: number; signature?: string; }): Promise; } //#endregion //#region src/runtime/jsonPlugin.d.ts interface JsonService { read: (filepath: string) => Promise; resolve: (entry: JsonResolvableEntry) => string | undefined; cache: FileCache; } //#endregion //#region src/runtime/npmPlugin/builder/packageBuilder.d.ts interface PackageBuilder { isMiniprogramPackage: (pkg: PackageJson) => boolean; shouldSkipBuild: (outDir: string, isOutdated: boolean) => Promise; bundleBuild: (args: { entry: InputOption; name: string; options?: NpmBuildOptions; outDir: string; }) => Promise; copyBuild: (args: { from: string; to: string; name: string; }) => Promise; buildPackage: (args: BuildPackageArgs) => Promise; } interface BuildPackageArgs { dep: string; outDir: string; resolveFrom?: string; options?: NpmBuildOptions; isDependenciesCacheOutdate: boolean; } //#endregion //#region src/runtime/npmPlugin/service/types.d.ts interface NpmService { getDependenciesCacheFilePath: (key?: string) => string; readonly dependenciesCacheHash: string; isMiniprogramPackage: (pkg: PackageJson) => boolean; shouldSkipBuild: (outDir: string, isOutdated: boolean) => Promise; writeDependenciesCache: (root?: string) => Promise; readDependenciesCache: (root?: string) => Promise; checkDependenciesCacheOutdate: (root?: string) => Promise; bundleBuild: (args: { entry: InputOption; name: string; options?: NpmBuildOptions; outDir: string; }) => Promise; copyBuild: (args: { from: string; to: string; name: string; }) => Promise; buildPackage: PackageBuilder['buildPackage']; getPackNpmRelationList: () => { packageJsonPath: string; miniprogramNpmDistDir: string; }[]; build: (options?: NpmBuildOptions) => Promise; } //#endregion //#region src/utils/hmrProfile/provenance.d.ts interface HmrProfileSourceEvent { eventId: string; event?: ChangeEvent; file?: string; receivedAtMs: number; } interface HmrProfileProvenance { buildId?: string; batchId?: string; sourceEvents?: HmrProfileSourceEvent[]; batchWaitMs?: number; queueWaitMs?: number; } //#endregion //#region src/wxml/shared.d.ts interface Token { start: number; end: number; value: string; } //#endregion //#region src/wxml/scan/types.d.ts interface RemovalRange { start: number; end: number; } interface WxmlToken { /** * @description 参与常规组件分析的标签集合。 * 会应用 `excludeComponent` 过滤,通常会排除宿主内置组件, * 供原有的 `usingComponents` 推断与模板依赖聚合使用。 */ components: ComponentsMap; /** * @description 供自动导入使用的完整标签集合。 * 不会因为“这是宿主内置组件名”而被提前过滤, * 用来支持“本地组件与内置组件重名时仍优先命中用户组件”的场景。 */ autoImportComponents?: ComponentsMap; deps: WxmlDep[]; removalRanges: RemovalRange[]; commentTokens: Token[]; inlineWxsTokens: Token[]; scriptModules?: Array<{ attrs: Record; tagName: string; }>; templateTokens?: Token[]; wxsImportNormalizeTokens: Token[]; removeWxsLangAttrTokens: Token[]; templateImportNormalizeTokens: Token[]; scriptModuleTagTokens: Token[]; eventTokens: Token[]; directiveTokens?: Token[]; tagNameTokens?: Token[]; glassEaselFindings?: GlassEaselTemplateFinding[]; code: string; } //#endregion //#region src/wxml/scan/index.d.ts declare function scanWxml(wxml: string | Buffer, options?: ScanWxmlOptions): WxmlToken; type ScanWxmlResult = ReturnType; //#endregion //#region src/wxml/processing/registry.d.ts type TemplateDependencies = Map>; type ProcessingStage = 'transform' | 'validate'; interface WxmlDependencyRegistry { dependencies: Map; pending: Map; failed: Map; references: Map; listeners: Set<(files: string[]) => void>; } //#endregion //#region src/runtime/autoImport/types.d.ts interface LocalAutoImportMatch { kind: 'local'; entry: ComponentEntry; value: ResolvedValue; } //#endregion //#region src/runtime/autoRoutesPlugin/types.d.ts interface NamedAutoRoute { name: string; path: string; meta: Record; } //#endregion //#region src/runtime/watcher/types.d.ts interface WatcherInstance { close: () => void | Promise; } interface SidecarWatcher { close: () => void | Promise; } //#endregion //#region src/runtime/runtimeState.d.ts interface AutoRoutesCandidateState { base: string; files: Set; hasScript: boolean; hasTemplate: boolean; jsonPath?: string; } interface VueEntryStyleBindings { sources: string[]; expressions?: string[]; } interface LibEntryState { name: string; input: string; outputBase: string; relativeBase: string; } interface RuntimeState { wxmlProcessing: WxmlDependencyRegistry; glassEasel: { analysisByOwner: Map; warnedDiagnostics: Set; silent: boolean; }; autoRoutes: { routes: AutoRoutes; namedRoutes: NamedAutoRoute[]; serialized: string; moduleCode: string; namedModuleCode: string; signature: string; topologyKey: string; typedDefinition: string; pageDeclarationDependencies: Map>; pageDeclarationFingerprints: Map; usesOpaquePageDeclarationResolver: boolean; pageSourceFiles: Set; namedRouteSourceFiles: Set; watchFiles: Set; watchDirs: Set; dirty: boolean; initialized: boolean; candidates: Map; needsFullRescan: boolean; loadingAppConfig: boolean; }; autoImport: { registry: Map; normalizedLocalComponents: Map; resolvedResolverComponents: Map; matcher?: (input: string) => boolean; matcherKey: string; preparedGlobsKey?: string; version: number; pendingEntriesByImporter: Map>; }; build: { queue: PQueue; npmBuilt: boolean; independent: { outputs: Map; watchFiles: Map>; watchListeners: Set<(files: string[]) => void>; pendingOutputs: Promise[]; }; output: { emittedSource: Map; /** 仅 analyze 启用,保留转为 asset 的 chunk 模块来源。 */ analysisChunks?: Map; wevuInternalRuntimeFileName?: string; wevuInternalRuntimeFileNames?: Map; }; hmr: { componentPageStyleOptions: Map; loadedEntrySet: Set; dirtyEntrySet: Set; dirtyEntryReasons: Map; resolvedEntryMap: Map; externalComponentEntryMap: Map; entriesMap: Map; vueEntryHasTemplate: Map; vueEntrySfcSignatures: Map; /** 当前编译 generation 的模板注册签名,只随成功快照交付为基线。 */ templateRegistrationSignatures?: Map; vueEntryStyleBindings: Map; /** 编译 provider 内容签名;key 为入口,value 的 key 为 provider 名称。 */ vueEntryContentSignatures?: Map>>; vueEntryTemplateContentSignatures?: Map>>; vueEntryScriptContentSignatures?: Map>>; vueEntryTailwindContentSignatures: Map; vueEntryTailwindTemplateContentSignatures: Map; vueEntryTailwindScriptContentSignatures: Map; appEntryAutoRoutesSignature?: string; dirtyVueEntryIds: Set; /** 当前构建是否为已有输出的后续发布,不依赖单文件诊断事件。 */ isRebuild: boolean; /** 当前快照从根入口重建可达图;完整发布后才撤销旧产物。 */ fullEntryScan?: boolean; /** 当前快照已清空输出缓存并重发全部资源,不要求重新扫描入口拓扑。 */ fullSnapshotOutput: boolean; didEmitAllEntries: boolean; lastHmrEntryIds: Set; lastEmittedEntryIds: Set; lastEmittedChunkFileNames: Set; forceEmitUnchangedChunks: boolean; forceFullSharedChunkRefresh: boolean; sharedChunkSourceModuleIds: Set; recentProfiles: Array<{ timestamp?: string; totalMs: number; eventId?: string; event?: string; file?: string; relativeFile?: string; sourceRootFile?: string; buildCoreMs?: number; buildStartMs?: number; pluginResolveMs?: number; transformMs?: number; coreTransformMs?: number; wevuTransformMs?: number; vueTransformMs?: number; vueReadSourceMs?: number; vueCompileMs?: number; vueFinalizeCompiledMs?: number; vueFinalizeCodeMs?: number; coreLoadMs?: number; entryLoadMs?: number; entryCodeReadMs?: number; entrySidecarResolveMs?: number; entryJsonReadMs?: number; entryVueConfigMs?: number; entryTemplateScanMs?: number; entryScriptSetupMs?: number; entryVueSignatureMs?: number; entryAutoImportMs?: number; entryPrepareMs?: number; entryEmitOutputMs?: number; entryStyleScanMs?: number; entryStyleReadMs?: number; entryResolveMs?: number; entryChunkEmitMs?: number; entryChunkLoadMs?: number; entryChunkEmitFileMs?: number; entryLayoutMs?: number; requestGlobalsMs?: number; weapiResolveMs?: number; bundlerMs?: number; renderStartMs?: number; generateBundleMs?: number; generateSharedMs?: number; generateRewriteMs?: number; generateModuleGraphMs?: number; snapshotResolveMs?: number; snapshotBuildMs?: number; writeMs?: number; /** Tailwind 六个连续输出阶段均包含在 writeMs 中,不能与 writeMs 再次相加。 */ tailwindPrepareMs?: number; tailwindGenerateMs?: number; tailwindCssMs?: number; tailwindTemplateMs?: number; tailwindJavaScriptMs?: number; tailwindFinalizeMs?: number; /** 来源解析与磁盘生成是 tailwindGenerateMs 的累计子项,多 root 可重叠,不能当作连续阶段相加。 */ tailwindSourceResolveMs?: number; tailwindDiskGenerateMs?: number; finalizePrepareMs?: number; finalizeTemplateMs?: number; finalizePublishMs?: number; publicationValidateMs?: number; publicationIndependentMs?: number; publicationPruneMs?: number; watchToDirtyMs?: number; emitMs?: number; sharedChunkResolveMs?: number; chunkEmitCount?: number; loadCount?: number; resolveCount?: number; skippedLoadedCount?: number; dirtyCount?: number; pendingCount?: number; emittedCount?: number; dirtyReasonSummary?: string[]; pendingReasonSummary?: string[]; }>; profile: HmrProfileProvenance & { eventId?: string; event?: ChangeEvent; file?: string; buildCoreMs?: number; buildStartMs?: number; pluginResolveMs?: number; transformMs?: number; coreTransformMs?: number; wevuTransformMs?: number; vueTransformMs?: number; vueReadSourceMs?: number; vueCompileMs?: number; vueFinalizeCompiledMs?: number; vueFinalizeCodeMs?: number; coreLoadMs?: number; entryLoadMs?: number; entryCodeReadMs?: number; entrySidecarResolveMs?: number; entryJsonReadMs?: number; entryVueConfigMs?: number; entryTemplateScanMs?: number; entryScriptSetupMs?: number; entryVueSignatureMs?: number; entryAutoImportMs?: number; entryPrepareMs?: number; entryEmitOutputMs?: number; entryStyleScanMs?: number; entryStyleReadMs?: number; entryResolveMs?: number; entryChunkEmitMs?: number; entryChunkLoadMs?: number; entryChunkEmitFileMs?: number; entryLayoutMs?: number; requestGlobalsMs?: number; weapiResolveMs?: number; bundlerMs?: number; renderStartMs?: number; generateBundleMs?: number; generateSharedMs?: number; generateRewriteMs?: number; generateModuleGraphMs?: number; snapshotResolveMs?: number; snapshotBuildMs?: number; writeMs?: number; /** Tailwind 六个连续输出阶段均包含在 writeMs 中,不能与 writeMs 再次相加。 */ tailwindPrepareMs?: number; tailwindGenerateMs?: number; tailwindCssMs?: number; tailwindTemplateMs?: number; tailwindJavaScriptMs?: number; tailwindFinalizeMs?: number; /** 来源解析与磁盘生成是 tailwindGenerateMs 的累计子项,多 root 可重叠,不能当作连续阶段相加。 */ tailwindSourceResolveMs?: number; tailwindDiskGenerateMs?: number; finalizePrepareMs?: number; finalizeTemplateMs?: number; finalizePublishMs?: number; publicationValidateMs?: number; publicationIndependentMs?: number; publicationPruneMs?: number; watchToDirtyMs?: number; emitMs?: number; sharedChunkResolveMs?: number; chunkEmitCount?: number; loadCount?: number; resolveCount?: number; skippedLoadedCount?: number; dirtyCount?: number; pendingCount?: number; emittedCount?: number; dirtyReasonSummary?: string[]; pendingReasonSummary?: string[]; }; }; }; json: { cache: FileCache; emittedSource: Map; }; asset: { emittedBuffer: Map; scopedSlotGenerics: Map>; }; css: { importerToDependencies: Map>; dependencyToImporters: Map>; transformedSidecarSource: Map; emittedSource: Map; sidecarImports: Set; sidecarImportsByOwner: Map>; }; watcher: { rollupWatcherMap: Map; sidecarWatcherMap: Map; sidecarDirtyFiles: Map; }; wxml: { depsMap: Map>; importerMap: Map>; depKindMap: Map>>; tokenMap: Map; componentsMap: Map; aggregatedComponentsMap: Map; templatePathMap: Map; cache: FileCache; emittedCode: Map; }; scan: { mainPackageStyleEntries?: StyleEntry[]; subPackageMap: Map; independentSubPackageMap: Map; warnedMessages: Set; appEntry?: AppEntry; pluginJson?: Plugin$1; pluginJsonPath?: string; isDirty: boolean; independentDirtyRoots: Set; }; lib: { enabled: boolean; entries: Map; }; config: { packageInfo: PackageInfo; defineEnv: Record; importMetaEnvDefineOverride?: Record; packageManager: DetectResult; options: LoadConfigResult; }; } //#endregion //#region src/runtime/scanPlugin/service/index.d.ts interface ScanService { appEntry?: AppEntry; pluginJson?: Plugin$1; pluginJsonPath?: string; readonly mainPackageStyleEntries: StyleEntry[] | undefined; subPackageMap: Map; independentSubPackageMap: Map; loadAppEntry: () => Promise; loadSubPackages: () => SubPackageMetaValue[]; isMainPackageFileName: (fileName: string) => boolean; readonly workersOptions: App['workers'] | undefined; readonly workersDir: string | undefined; markDirty: () => void; markIndependentDirty: (root: string) => void; drainIndependentDirtyRoots: () => string[]; } //#endregion //#region src/runtime/watcherPlugin.d.ts interface WatcherService { rollupWatcherMap: Map; sidecarWatcherMap: Map; getRollupWatcher: (root?: string) => WatcherInstance | undefined; setRollupWatcher: (watcher: WatcherInstance, root?: string) => void; close: (root?: string) => void; closeAll: () => void | Promise; } //#endregion //#region src/runtime/webPlugin.d.ts interface WebService { readonly devServer?: ViteDevServer; isEnabled: () => boolean; startDevServer: () => Promise; build: () => Promise> | undefined>; close: () => Promise; } //#endregion //#region src/runtime/wxmlPlugin/service/shared.d.ts type WxmlDependencyKind = 'template-import' | 'template-include' | 'script-module' | 'unknown'; type WxmlImporterDependencyKind = WxmlDependencyKind | 'mixed'; //#endregion //#region src/runtime/wxmlPlugin/types.d.ts interface WxmlService { depsMap: Map>; importerMap: Map>; depKindMap: Map>>; tokenMap: Map; /** * @description 常规组件索引缓存。 * 这里沿用历史行为,只保留“应参与 usingComponents 推断”的组件标签。 */ wxmlComponentsMap: Map; /** * @description 常规组件聚合缓存。 * 会递归合并 import/include 进来的模板组件,但仍遵循内置组件过滤规则。 */ aggregatedComponentsMap: Map; addDeps: (filepath: string, deps?: string[]) => Promise; setDeps: (filepath: string, deps?: string[]) => Promise; setTokenDeps: (filepath: string, deps?: ScanWxmlResult['deps']) => Promise; collectDepsFromToken: (filepath: string, deps?: ScanWxmlResult['deps']) => string[]; getImporters: (filepath: string) => Set; getImporterDependencyKind: (dep: string, importer: string) => WxmlImporterDependencyKind | undefined; getAllDeps: () => Set; getAggregatedComponents: (filepathOrBaseName: string) => ComponentsMap | undefined; getAggregatedAutoImportComponents: (filepathOrBaseName: string) => ComponentsMap | undefined; clearAll: (options?: { clearEmittedCode?: boolean; }) => void; analyze: (wxml: string) => ScanWxmlResult; scan: (filepath: string) => Promise; setWxmlComponentsMap: (absPath: string, components: ComponentsMap) => void; } //#endregion //#region src/runtime/autoImport/service/types.d.ts interface ResolverAutoImportMatch { kind: 'resolver'; value: ResolvedValue; } type AutoImportMatch = LocalAutoImportMatch | ResolverAutoImportMatch; interface AutoImportService { reset: () => void; getVersion: () => number; runInBatch: (task: () => T | Promise) => Promise; runWithoutOutputWrites: (task: () => T | Promise) => Promise; registerPotentialComponent: (filePath: string) => Promise; removePotentialComponent: (filePath: string) => void; resolve: (componentName: string, importerBaseName?: string) => AutoImportMatch | undefined; setSupportFileResolverComponents: (components: Record) => void; clearSupportFileResolverComponents: () => void; syncSupportFileResolverComponents: () => Promise; collectStaticResolverComponentsForSupportFiles: () => Record; filter: (id: string, meta?: SubPackageMetaValue) => boolean; getRegisteredLocalComponents: () => LocalAutoImportMatch[]; hasPendingRegistrations?: () => boolean; awaitPendingRegistrations?: () => Promise; awaitManifestWrites: () => Promise; } //#endregion //#region src/runtime/autoRoutesPlugin/routes/scan.d.ts interface ScanRoutesOptions { resolvePageDeclarationSource?: ResolveSfcBlockSrcOptions['resolveId']; } //#endregion //#region src/runtime/autoRoutesPlugin/watch.d.ts type AutoRoutesFileEvent = ChangeEvent | 'rename'; //#endregion //#region src/runtime/autoRoutesPlugin/service.d.ts type PageDeclarationSourceResolver = NonNullable; interface AutoRoutesService { /** 活动构建解析器只参与本次刷新,不替换服务持有的长期解析器。 */ ensureFresh: (resolve?: PageDeclarationSourceResolver) => Promise; markDirty: () => void; getSnapshot: () => AutoRoutes; getReference: () => AutoRoutes; getSignature: () => string; /** 返回最近完整扫描中的源码指纹;未知源码不能作为已发布的去重凭据。 */ getSourceFingerprint: (filePath: string) => string | undefined; getModuleCode: () => string; getNamedModuleCode: () => string; getWatchFiles: () => Iterable; getWatchDirectories: () => Iterable; /** 返回声明源对应的全部逻辑页面源文件。 */ getPageDeclarationOwners: (filePath: string) => Iterable; isRouteFile: (filePath: string) => boolean; isPageSource: (filePath: string) => boolean; /** 判断文件是否属于逻辑页面声明或其外部脚本依赖。 */ isPageDeclarationSource: (filePath: string) => boolean; /** 注册服务持有的长期解析器;构建钩子通过 ensureFresh 参数提供临时解析器。 */ setPageDeclarationSourceResolver: (resolve?: PageDeclarationSourceResolver) => void; handleFileChange: (filePath: string, event?: AutoRoutesFileEvent) => Promise; isInitialized: () => boolean; isEnabled: () => boolean; } //#endregion //#region src/context/CompilerContext.d.ts type BuildTarget = 'app' | 'plugin'; interface CompilerContext { runtimeState: RuntimeState; configService: ConfigService; npmService: NpmService; wxmlService: WxmlService; jsonService: JsonService; moduleGraphService: ModuleGraphService; watcherService: WatcherService; webService: WebService; autoImportService: AutoImportService; autoRoutesService: AutoRoutesService; buildService: BuildService; scanService: ScanService; currentBuildTarget?: BuildTarget; onStatefulHmrSourceChange?: (file: string, dirtyReasonSummary: string[], sourceEvent?: HmrProfileSourceEvent) => void; } //#endregion //#region src/types/plugin.d.ts interface WeappVitePluginApi { ctx: CompilerContext; } type ChangeEvent = 'create' | 'update' | 'delete'; //#endregion //#region src/json.d.ts type ReturnSelf = (config: T) => T; type ConfigFn = T | ((ctx: CompilerContext) => T); type DefineJsonFn = ReturnSelf>; /** * @description 定义 app.json(支持直接对象或函数形式) */ declare const defineAppJson: DefineJsonFn; /** * @description 定义 page.json(支持直接对象或函数形式) */ declare const definePageJson: DefineJsonFn; /** * @description 定义 component.json(支持直接对象或函数形式) */ declare const defineComponentJson: DefineJsonFn; /** * @description 定义 sitemap.json(支持直接对象或函数形式) */ declare const defineSitemapJson: DefineJsonFn; /** * @description 定义 theme.json(支持直接对象或函数形式) */ declare const defineThemeJson: DefineJsonFn; //#endregion //#region src/config.d.ts /** * @description weapp-vite 的用户配置(扩展 Vite UserConfig) */ type UserConfig$1 = UserConfig & { weapp?: WeappViteConfig; }; type UserConfigFnNoEnvPlain = () => T; type UserConfigFnNoEnv = () => T | Promise; type UserConfigFnObjectPlain = (env: ConfigEnv) => T; type UserConfigFnObject = (env: ConfigEnv) => T; type UserConfigFnPromise = (env: ConfigEnv) => Promise; type UserConfigFn = (env: ConfigEnv) => T | Promise; type UserConfigExport = T | Promise | UserConfigFnObject | UserConfigFnPromise | UserConfigFn; declare module 'vite' { interface UserConfig { weapp?: WeappViteConfig; } } /** * @description 为 weapp-vite 配置提供类型提示与推断 * @description 注意:这里不能继续使用对象/Promise/函数的多重重载; * @description 否则 `() => ({})` 这类函数式配置里的对象字面量会丢失上下文类型, * @description 导致 `platform` 等联合字面量字段被宽化为 `string`。 */ declare function defineConfig(config: T): T; //#endregion export { WeappCompilerOutputRequest as $, NpmPackageFilesConfig as $n, WeappUniAppConfig as $t, Ref as A, GenerateDirsOptions as An, WEAPP_VITE_HOST_NAME as Ar, WeappAppPreludeConfig as At, BindingErrorLike as B, GenerateTemplateInlineSource as Bn, WeappViteRuntime as Br, WeappInjectWeapiConfig as Bt, LoadConfigOptions as C, AliasOptions as Cn, WeappLibVueTscOptions as Cr, AutoImportComponents as Ct, MethodDefinitions$1 as D, CopyGlobs as Dn, WeappManagedSharedTsconfigConfig as Dr, HandleWxmlOptions as Dt, InlineConfig$1 as E, ChunksConfig as En, WeappManagedServerTsconfigConfig as Er, EnhanceWxmlOptions as Et, RolldownPlugin as F, GenerateTemplate as Fn, resolveWeappViteHostMeta as Fr, WeappBuildScopeConfig as Ft, EntryJsonFragment as G, JsonMergeContext as Gn, getSupportedWeappVitePlatforms as Gr, WeappPreloadNetwork as Gt, BaseEntry as H, GenerateTemplatesConfig as Hn, WeappViteTargetInput as Hr, WeappInjectWebRuntimeGlobalsTarget as Ht, RolldownPluginOption as I, GenerateTemplateContext as In, ResolveWeappViteTargetOptions as Ir, WeappBuildScopeObjectConfig as It, ScanComponentItem as J, JsonMergeStrategy as Jn, resolveWeappViteTarget as Jr, WeappReactConfig as Jt, PageEntry as K, JsonMergeFunction as Kn, getSupportedWeappViteTargetDescriptors as Kr, WeappPreloadRule as Kt, RolldownWatchOptions as L, GenerateTemplateEntry as Ln, ResolvedWeappViteTarget as Lr, WeappHmrConfig as Lt, RolldownBuild as M, GenerateFileType as Mn, applyWeappViteHostMeta as Mr, WeappAutoRoutesConfig as Mt, RolldownOptions as N, GenerateFilenamesOptions as Nn, createWeappViteHostMeta as Nr, WeappAutoRoutesInclude as Nt, Plugin$2 as O, CopyOptions as On, WeappManagedTypeScriptConfig as Or, MultiPlatformConfig as Ot, RolldownOutput$1 as P, GenerateOptions as Pn, isWeappViteHost as Pr, WeappAutoRoutesIncludePattern as Pt, WeappCompilerHmrRequest as Q, NpmMainPackageConfig as Qn, WeappSubPackageConfig as Qt, RolldownWatcher$1 as R, GenerateTemplateFactory as Rn, WEB_PLATFORM_ALIASES as Rr, WeappInjectRequestGlobalsConfig as Rt, CompilerContext as S, Alias as Sn, WeappLibInternalDtsOptions as Sr, WeappViteConfig as St, ConfigEnv$1 as T, BuildNpmPackageMeta as Tn, WeappManagedNodeTsconfigConfig as Tr, EnhanceOptions as Tt, ComponentEntry as U, JsFormat as Un, WeappViteTargetKind as Ur, WeappMcpConfig as Ut, AppEntry as V, GenerateTemplateScope as Vn, WeappViteTargetDescriptor as Vr, WeappInjectWebRuntimeGlobalsConfig as Vt, Entry as W, JsonConfig as Wn, WebPlatform as Wr, WeappNpmConfig as Wt, WeappCompilerHmrAsset as X, NpmBuildOptions as Xn, WeappRouteRule as Xt, WxmlDep as Y, MpPlatform$1 as Yn, WeappRequestRuntimeConfig as Yt, WeappCompilerHmrPreparation as Z, NpmDependencyPattern as Zn, WeappRouteRules as Zt, definePageJson as _, WxmlTransformNode as _n, WeappLibComponentJson as _r, WeappDebugConfig as _t, UserConfigFnNoEnvPlain as a, WxmlRemoveAttrRule as an, SharedChunkMode as ar, WeappCompilerPluginOption as at, ChangeEvent as b, MultiPlatformProjectConfig as bn, WeappLibEntryContext as br, WeappTailwindcssOptions as bt, UserConfigFnPromise as c, WxmlValidationContext as cn, StyleConfigEntry as cr, WeappCompilerSourceClaim as ct, Component$1 as d, WxmlAttribute as dn, StyleScope as dr, ProjectConfig as dt, WeappVueConfig as en, NpmPluginPackageConfig as er, WeappCompilerPlugin as et, Page$1 as f, WxmlAttributeValue as fn, SubPackage as fr, SubPackageMetaValue as ft, defineComponentJson as g, WxmlTransformContext as gn, SubPackageStyleScope as gr, WeappAnalyzeHistoryConfig as gt, defineAppJson as h, WxmlTransform as hn, SubPackageStyleEntry as hr, WeappAnalyzeConfig as ht, UserConfigFnNoEnv as i, WeappWorkerConfig as in, SharedChunkDynamicImports as ir, WeappCompilerPluginFactory as it, ResolvedConfig$1 as j, GenerateExtensionsOptions as jn, WeappViteHostMeta as jr, WeappAppPreludeMode as jt, PluginOption as k, DeprecatedInlineDynamicImports as kn, WeappWebConfig as kr, ScanWxmlOptions as kt, defineConfig as l, WxmlValidationDiagnostic as ln, StyleConfigObject as lr, WeappCompilerSourceRequest as lt, Theme$1 as m, WxmlSourceLocation as mn, SubPackageStyleConfigObject as mr, WeappAnalyzeBudgetConfig as mt, UserConfigExport as n, WeappWebRuntimeConfig as nn, NpmSubPackageConfig as nr, WeappCompilerPluginContext as nt, UserConfigFnObject as o, WxmlRemoveOptions as on, SharedChunkOverride as or, WeappCompilerPluginPhase as ot, Sitemap$1 as p, WxmlElementInfo as pn, SubPackageStyleConfigEntry as pr, UserConfig$2 as pt, ComponentsMap as q, JsonMergeStage as qn, isWebPlatform as qr, WeappReactCompilerConfig as qt, UserConfigFn as r, WeappWevuConfig as rn, ResolvedAlias as rr, WeappCompilerPluginController as rt, UserConfigFnObjectPlain as s, WxmlValidate as sn, SharedChunkStrategy as sr, WeappCompilerResourceKind as st, UserConfig$1 as t, WeappVueTemplateConfig as tn, NpmStrategy as tr, WeappCompilerPluginCapabilities as tt, App$1 as u, WxmlValidationVisitor as un, StyleEntry as ur, WeappCompilerTransformResult as ut, defineSitemapJson as v, WxmlTransformResult as vn, WeappLibConfig as vr, WeappForwardConsoleConfig as vt, ComputedDefinitions$1 as w, AlipayNpmMode as wn, WeappManagedAppTsconfigConfig as wr, AutoImportComponentsOption as wt, WeappVitePluginApi as x, MultiPlatformProjectConfigs as xn, WeappLibFileName as xr, WeappUploadConfig as xt, defineThemeJson as y, WxmlTransformVisitor as yn, WeappLibDtsOptions as yr, WeappForwardConsoleLogLevel as yt, ViteDevServer$1 as z, GenerateTemplateFileSource as zn, WeappVitePlatform as zr, WeappInjectRequestGlobalsTarget as zt };