import { v as RootNode } from './types-DlGtUPo9.js'; import '@lytjs/common-error'; interface SFCDescriptor { filename: string; template: SFCTemplateBlock | null; script: SFCScriptBlock | null; scriptSetup: SFCScriptBlock | null; styles: SFCStyleBlock[]; customBlocks: SFCCustomBlock[]; } interface SFCTemplateBlock { type: 'template'; content: string; start: number; end: number; attrs: Record; ast: RootNode | null; } interface SFCScriptBlock { type: 'script'; content: string; start: number; end: number; attrs: Record; setup?: boolean; } interface SFCStyleBlock { type: 'style'; content: string; start: number; end: number; attrs: Record; scoped?: boolean; lang?: string; } interface SFCCustomBlock { type: string; content: string; start: number; end: number; attrs: Record; } interface SFCParseOptions { filename?: string; /** If true, parse the template block into an AST */ parseTemplate?: boolean; } /** * Parse a .lyt single file component source string into a structured descriptor. * * @param source - The raw source code of the .lyt file * @param options - Parse options (filename, etc.) * @returns SFCDescriptor containing all parsed blocks */ declare function parseSFC(source: string, options?: SFCParseOptions): SFCDescriptor; interface SFCCompileOptions { id?: string; filename?: string; scoped?: boolean; ssr?: boolean; rendererMode?: 'vnode' | 'signal' | 'vapor'; } interface SFCCompileResult { code: string; css?: string; scopedId?: string; sourceMap?: object; /** 模块热替换 ID */ hmrId?: string; /** 是否为 HMR 增量更新 */ isHmrUpdate?: boolean; } /** * 将 SFCDescriptor 编译为 JavaScript 模块字符串(和可选的 CSS)。 * * @param descriptor - The parsed SFC descriptor * @param options - Compilation options * @returns SFCCompileResult with JS code and optional CSS */ declare function compileSFC(descriptor: SFCDescriptor, options?: SFCCompileOptions): SFCCompileResult; interface CustomBlockProcessor { name: string; transform: (source: string, attrs: Record) => { code: string; map?: object; }; } /** * LytJS SFC 中常用的预定义自定义块类型。 * 这些被工具(IDE、linter 等)识别但没有 * built-in processors unless registered. */ declare const KNOWN_CUSTOM_BLOCKS: readonly string[]; /** * 注册自定义块处理器。 * * @param processor - The processor to register * @throws Error if a processor with the same name is already registered */ declare function registerCustomBlockProcessor(processor: CustomBlockProcessor): void; /** * 按名称获取已注册的自定义块处理器。 * * @param name - The block type name * @returns The processor if registered, undefined otherwise */ declare function getCustomBlockProcessor(name: string): CustomBlockProcessor | undefined; /** * 移除已注册的自定义块处理器。 * * @param name - The block type name to unregister * @returns true if the processor was found and removed */ declare function unregisterCustomBlockProcessor(name: string): boolean; /** * 获取所有已注册自定义块处理器的名称。 * * @returns Array of registered processor names */ declare function getRegisteredCustomBlockProcessors(): string[]; interface ComponentTypeInfo { name: string; props: PropDeclaration[]; emits: EmitDeclaration[]; exposed: string[]; slots: string[]; } interface PropDeclaration { name: string; type: string; required: boolean; default?: string; } interface EmitDeclaration { name: string; payload?: string; } /** * 从 SFC 描述符生成 TypeScript 类型声明(.d.ts 内容)。 * * 这是一个使用基于正则表达式提取的简化实现。 * A production version would use a proper TypeScript AST parser. * * @param descriptor - The parsed SFC descriptor * @returns Generated .d.ts file content as a string */ declare function generateComponentTypes(descriptor: SFCDescriptor): string; export { type ComponentTypeInfo, type CustomBlockProcessor, type EmitDeclaration, KNOWN_CUSTOM_BLOCKS, type PropDeclaration, type SFCCompileOptions, type SFCCompileResult, type SFCCustomBlock, type SFCDescriptor, type SFCParseOptions, type SFCScriptBlock, type SFCStyleBlock, type SFCTemplateBlock, compileSFC, generateComponentTypes, getCustomBlockProcessor, getRegisteredCustomBlockProcessors, parseSFC, registerCustomBlockProcessor, unregisterCustomBlockProcessor };