import { n as __name, t as __exportAll } from "./chunk-O_arW02_.js"; import ts from "typescript"; //#region src/FabricFile.d.ts declare namespace FabricFile_d_exports { export { BaseName, ConstNode, Export, Extname, File, FunctionNode, Import, Mode, Path, ResolvedFile, Source, TypeNode }; } type ImportName = string | Array; type FunctionNode = { /** * Name of the function. */ name: string; /** * Function parameters string. * @example 'id: number, name: string' */ params?: string; /** * Include export keyword. * @default false */ export?: boolean; /** * Include default keyword (for default exports). * @default false */ default?: boolean; /** * Make the function async. * @default false */ async?: boolean; /** * TypeScript generics string or array. * @example 'T' or ['T', 'U extends string'] */ generics?: string | string[]; /** * Return type string. * @example 'User' */ returnType?: string; }; type ConstNode = { /** * Name of the constant. */ name: string; /** * TypeScript type annotation string. * @example 'string' or 'User[]' */ type?: string; /** * Include export keyword. * @default false */ export?: boolean; /** * Use const assertion (`as const`). * @default false */ asConst?: boolean; }; type TypeNode = { /** * Name of the type alias (must start with a capital letter). */ name: string; /** * Include export keyword. * @default false */ export?: boolean; }; type Import = { /** * Import name to be used * @example ["useState"] * @example "React" */ name: ImportName; /** * Path for the import * @example '@kubb/core' */ path: string; /** * Add type-only import prefix. * - `true` generates `import type { Type } from './path'` * - `false` generates `import { Type } from './path'` * @default false */ isTypeOnly?: boolean; /** * Import entire module as namespace. * - `true` generates `import * as Name from './path'` * - `false` generates standard import * @default false */ isNameSpace?: boolean; /** * When root is set it will get the path with relative getRelativePath(root, path). */ root?: string; }; type Source = { name?: string; value?: string; /** * TypeScript AST nodes representing the source declarations. * Populated when source is created from Function, Const, or Type components. * Can be used as an alternative to `value` for programmatic AST manipulation. */ nodes?: Array; /** * Make this source a type-only export. * - `true` marks source as type export * - `false` marks source as value export * @default false */ isTypeOnly?: boolean; /** * Include export keyword in source. * - `true` generates exportable const or type * - `false` generates internal declaration * @default false */ isExportable?: boolean; /** * Include in barrel file generation. * - `true` adds to barrel exports * - `false` excludes from barrel exports * @default false */ isIndexable?: boolean; }; type Export = { /** * Export name to be used. * @example ["useState"] * @example "React" */ name?: string | Array; /** * Path for the import. * @example '@kubb/core' */ path: string; /** * Add type-only export prefix. * - `true` generates `export type { Type } from './path'` * - `false` generates `export { Type } from './path'` * @default false */ isTypeOnly?: boolean; /** * Export as aliased namespace. * - `true` generates `export * as aliasName from './path'` * - `false` generates standard export * @default false */ asAlias?: boolean; }; type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`; type Mode = 'single' | 'split'; /** * Name to be used to dynamically create the baseName(based on input.path) * Based on UNIX basename * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix */ type BaseName = `${string}.${string}`; /** * Path will be full qualified path to a specified file */ type Path = string; type File = { /** * Name to be used to create the path * Based on UNIX basename, `${name}.extname` * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix */ baseName: BaseName; /** * Path will be full qualified path to a specified file */ path: Path; sources: Array; imports: Array; exports: Array; /** * Use extra meta, this is getting used to generate the barrel/index files. */ meta?: TMeta; banner?: string; footer?: string; }; type ResolvedFile = File & { /** * @default hash */ id: string; /** * Contains the first part of the baseName, generated based on baseName * @link https://nodejs.org/api/path.html#pathformatpathobject */ name: string; extname: Extname; imports: Array; exports: Array; }; //#endregion //#region src/parsers/types.d.ts type PrintOptions = { extname?: Extname; }; type Parser = { name: string; type: 'parser'; /** * Undefined is being used for the defaultParser */ extNames: Array | undefined; install: Install; /** * Convert a file to string */ parse(file: ResolvedFile, options: PrintOptions): Promise | string; }; type UserParser = Omit, 'type'>; //#endregion //#region src/utils/AsyncEventEmitter.d.ts type Options$2 = { mode?: FabricMode; maxListener?: number; }; declare class AsyncEventEmitter> { #private; constructor({ maxListener, mode }?: Options$2); emit(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise; on(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void; onOnce(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void; off(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void; removeAll(): void; } //#endregion //#region src/FileProcessor.d.ts type ProcessFilesProps = { parsers?: Map; extension?: Record; dryRun?: boolean; /** * @default 'sequential' */ mode?: FabricMode; }; type GetParseOptions = { parsers?: Map; extension?: Record; }; type Options$1 = { events?: AsyncEventEmitter; }; declare class FileProcessor { #private; events: AsyncEventEmitter; constructor({ events }?: Options$1); parse(file: ResolvedFile, { parsers, extension }?: GetParseOptions): Promise; run(files: Array, { parsers, mode, dryRun, extension }?: ProcessFilesProps): Promise; } //#endregion //#region src/FileManager.d.ts type Options = { events?: AsyncEventEmitter; }; declare class FileManager { #private; events: AsyncEventEmitter; processor: FileProcessor; constructor({ events }?: Options); add(...files: Array): Array; upsert(...files: Array): Array; flush(): void; getByPath(path: Path): ResolvedFile | null; deleteByPath(path: Path): void; clear(): void; get files(): Array; write(options: ProcessFilesProps): Promise; } //#endregion //#region src/context.d.ts /** * Context type that carries type information about its value * This is a branded symbol type that enables type-safe context usage */ type Context = symbol & { readonly __type: T; }; /** * Provides a value to descendant components (Vue 3 style) * * @example * ```ts * const ThemeKey = Symbol('theme') * provide(ThemeKey, { color: 'blue' }) * ``` */ declare function provide(key: symbol | Context, value: T): void; /** * Injects a value provided by an ancestor component (Vue 3 style) * * @example * ```ts * const theme = inject(ThemeKey, { color: 'default' }) * ``` */ declare function inject(key: symbol | Context, defaultValue?: T): T; /** * Unprovides a value (for cleanup) * @internal */ declare function unprovide(key: symbol | Context): void; /** * Creates a context key with a default value (React-style compatibility) * * @example * ```ts * const ThemeContext = createContext({ color: 'blue' }) * // ThemeContext is now typed as Context<{ color: string }> * const theme = useContext(ThemeContext) // theme is { color: string } * ``` */ declare function createContext(defaultValue: T): Context; //#endregion //#region src/contexts/RenderContext.d.ts type RenderContextProps = { indentLevel: number; indentSize: number; currentLineLength: number; shouldBreak: boolean; }; /** * Provides a context for tracking rendering state such as indentation and line length. */ declare const RenderContext: Context; //#endregion //#region src/intrinsic.d.ts type IntrinsicType = 'br' | 'indent' | 'dedent'; type Intrinsic = { type: IntrinsicType; __intrinsic: true; }; /** * Helper: render a plain string while applying current indentation at the * start of each logical line. This ensures `${indent}` intrinsics affect * subsequent string content. */ declare function renderIndent(content: string, renderContext: RenderContextProps): string; declare function renderIntrinsic(children: FabricNode, context?: RenderContextProps): string; //#endregion //#region src/plugins/types.d.ts type Plugin = {}> = { name: string; type: 'plugin'; install: Install; /** * Runtime app overrides or extensions. * Merged into the app instance after install. * This cannot be async */ inject?: Inject; }; type UserPlugin = {}> = Omit, 'type'>; //#endregion //#region src/Fabric.d.ts type FabricElement = { (): FabricNode; type: string; component: (props: TProps) => FabricNode; props: TProps; }; type FabricNode = FabricElement | string | number | boolean | null | undefined | Intrinsic | Array; type FabricComponent = FabricElement & { children(...children: Array): FabricElement; }; /** * Defines core runtime options for Fabric. */ interface FabricOptions { /** * Determines how Fabric processes files. * - `sequential`: files are processed one by one * - `parallel`: files are processed concurrently * * @default 'sequential' */ mode?: FabricMode; } /** * Available modes for file processing. * @default 'sequential' */ type FabricMode = 'sequential' | 'parallel'; /** * Event definitions emitted during the Fabric lifecycle. * * These events allow plugins and external code to hook into different stages * of the file generation process. All events are asynchronous and can be * listened to using `fabric.context.on()` or `fabric.context.onOnce()`. * * @example * ```ts * fabric.context.on('lifecycle:start', async () => { * console.log('Fabric started!') * }) * ``` */ interface FabricEvents { /** * Emitted when the Fabric application lifecycle begins. * This is typically the first event fired when starting a Fabric run. * Use this to perform initial setup or logging. */ 'lifecycle:start': []; /** * Emitted when the Fabric application lifecycle completes. * This is typically the last event fired after all processing is done. * Use this for cleanup tasks or final reporting. */ 'lifecycle:end': []; /** * Emitted when Fabric starts rendering (used with reactPlugin). * Provides access to the Fabric instance for render-time operations. */ 'lifecycle:render': [fabric: Fabric]; /** * Emitted once before file processing begins. * Provides the complete list of files that will be processed. * Use this to prepare for batch operations or display initial file counts. */ 'files:processing:start': [files: Array]; /** * Emitted when files are successfully added to the FileManager's internal cache. * This happens after files pass through path and name resolution. * Use this to track which files have been registered. */ 'files:added': [files: Array]; /** * Emitted during file path resolution, before a file is cached. * Listeners can modify the file's path property to customize output location. * This is called for each file being added via `addFile()` or `upsertFile()`. */ 'file:resolve:path': [file: File]; /** * Emitted during file name resolution, before a file is cached. * Listeners can modify the file's name-related properties to customize naming. * This is called for each file being added via `addFile()` or `upsertFile()`. */ 'file:resolve:name': [file: File]; /** * Emitted just before files are written to disk. * Provides all files that will be written in this batch. * Use this to perform pre-write operations like creating directories. */ 'files:writing:start': [files: Array]; /** * Emitted after all files have been successfully written to disk. * Provides all files that were written in this batch. * Use this for post-write operations like running formatters or reporting. */ 'files:writing:end': [files: Array]; /** * Emitted when an individual file starts being processed. * This happens for each file in the queue, before parsing. * Use this for per-file setup or detailed logging. */ 'file:processing:start': [file: ResolvedFile, index: number, total: number]; /** * Emitted when an individual file completes processing. * This happens after the file has been parsed and handled. * Use this for per-file cleanup or progress tracking. */ 'file:processing:end': [file: ResolvedFile, index: number, total: number]; /** * Emitted after each file is processed, providing progress metrics. * This is the primary event for implementing progress bars or tracking. * Plugins like fsPlugin use this to write files to disk. * * @property processed - Number of files processed so far * @property total - Total number of files to process * @property percentage - Completion percentage (0-100) * @property source - Optional parsed source code of the file * @property file - The file that was just processed */ 'file:processing:update': [{ processed: number; total: number; percentage: number; source?: string; file: ResolvedFile; }]; /** * Emitted once all files have been successfully processed. * This marks the completion of the processing phase. * Use this to perform batch operations on all processed files. */ 'files:processing:end': [files: Array]; } /** * Shared context passed to all plugins, parsers, and Fabric internals. */ interface FabricContext extends AsyncEventEmitter { /** The active Fabric configuration. */ config: FabricConfig; /** The internal file manager handling file creation, merging, and writing. */ fileManager: FileManager; /** List of files currently in memory. */ files: ResolvedFile[]; /** Add new files to the file manager. */ addFile(...files: File[]): Promise; /** Track installed plugins and parsers to prevent duplicates. */ installedPlugins: Set; installedParsers: Map; } /** * Base configuration object for Fabric. */ type FabricConfig = T; /** * Utility type that checks whether all properties of `T` are optional. */ type AllOptional = {} extends T ? true : false; /** * Defines the signature of a plugin or parser's `install` function. */ type Install = TOptions extends any[] ? (context: FabricContext, ...options: TOptions) => void | Promise : AllOptional extends true ? (context: FabricContext, options?: TOptions) => void | Promise : (context: FabricContext, options: TOptions) => void | Promise; /** * Defines the signature of a plugin or parser's `inject` function. * Returns an object that extends the Fabric instance. */ type Inject = {}> = TOptions extends any[] ? (context: FabricContext, ...options: TOptions) => Partial : AllOptional extends true ? (context: FabricContext, options?: TOptions) => Partial : (context: FabricContext, options: TOptions) => Partial; /** * The main Fabric runtime interface. * Provides access to the current context, registered plugins, files, and utility methods. */ interface Fabric extends Kubb.Fabric { /** The shared context for this Fabric instance. */ context: FabricContext; /** The files managed by this Fabric instance. */ files: ResolvedFile[]; /** * Install a plugin or parser into Fabric. * * @param target - The plugin or parser to install. * @param options - Optional configuration or arguments for the target. * @returns A Fabric instance extended by the plugin (if applicable). */ use = {}>(target: Plugin | Parser, ...options: TPluginOptions extends any[] ? NoInfer : AllOptional extends true ? [NoInfer?] : [NoInfer]): (this & TExtension) | Promise; /** * Add one or more files to the Fabric file manager. */ addFile(...files: File[]): Promise; /** * Add one or more files to the Fabric file manager and merge the source, imports, exports */ upsertFile(...files: File[]): Promise; /** * Unmount the Fabric instance and remove all registered event listeners. * Plugins may extend this to perform additional cleanup (e.g. process signal listeners). */ unmount(error?: Error | number | null): void; } //#endregion export { FunctionNode as A, UserParser as C, Extname as D, Export as E, TypeNode as F, Path as M, ResolvedFile as N, FabricFile_d_exports as O, Source as P, Parser as S, ConstNode as T, inject as _, FabricElement as a, FileManager as b, FabricOptions as c, renderIndent as d, renderIntrinsic as f, createContext as g, Context as h, FabricContext as i, Import as j, File as k, Plugin as l, RenderContextProps as m, FabricComponent as n, FabricMode as o, RenderContext as p, FabricConfig as r, FabricNode as s, Fabric as t, UserPlugin as u, provide as v, BaseName as w, FileProcessor as x, unprovide as y }; //# sourceMappingURL=Fabric-DcPYjTt7.d.ts.map