@kubb/fabric-core 0.13.0 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Fabric-CrRJykMN.d.ts → Fabric-BOjvMvNC.d.ts} +6 -9
- package/dist/{Fabric-DMmgrLto.d.cts → Fabric-w9Y9duM6.d.ts} +7 -7
- package/dist/{RootContext-Cf7WJM7r.d.cts → RootContext-BQHfIhhC.d.ts} +3 -3
- package/dist/{RootContext-CvaGJ-4g.d.ts → RootContext-Cbs-UQXM.d.ts} +3 -4
- package/dist/{chunk-BVHe6Par.js → chunk-BYypO7fO.js} +1 -5
- package/dist/{chunk-DVipidnM.cjs → chunk-uaV2rQ02.cjs} +0 -10
- package/dist/{defaultParser-BK-zOanQ.cjs → defaultParser-BAgmtMo_.cjs} +2 -3
- package/dist/{defaultParser-BK-zOanQ.cjs.map → defaultParser-BAgmtMo_.cjs.map} +1 -1
- package/dist/{defaultParser-BD_N68Bo.js → defaultParser-C1atU7yU.js} +2 -3
- package/dist/{defaultParser-BD_N68Bo.js.map → defaultParser-C1atU7yU.js.map} +1 -1
- package/dist/{getRelativePath-C4Au07ON.js → getRelativePath-BcieQL5M.js} +1 -2
- package/dist/{getRelativePath-C4Au07ON.js.map → getRelativePath-BcieQL5M.js.map} +1 -1
- package/dist/{getRelativePath-DpbA6qm5.cjs → getRelativePath-DVG8dIzW.cjs} +2 -2
- package/dist/{getRelativePath-DpbA6qm5.cjs.map → getRelativePath-DVG8dIzW.cjs.map} +1 -1
- package/dist/index.cjs +13 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.js +12 -10
- package/dist/index.js.map +1 -1
- package/dist/{onProcessExit-7fgW-UTF.js → onProcessExit-B0rJqX4s.js} +80 -182
- package/dist/onProcessExit-B0rJqX4s.js.map +1 -0
- package/dist/{onProcessExit-C7dVg0S0.cjs → onProcessExit-DENCUkMz.cjs} +80 -205
- package/dist/onProcessExit-DENCUkMz.cjs.map +1 -0
- package/dist/parsers/typescript.cjs +4 -4
- package/dist/parsers/typescript.cjs.map +1 -1
- package/dist/parsers/typescript.d.ts +1 -2
- package/dist/parsers/typescript.js +3 -4
- package/dist/parsers/typescript.js.map +1 -1
- package/dist/parsers.cjs +2 -3
- package/dist/parsers.cjs.map +1 -1
- package/dist/parsers.d.ts +1 -2
- package/dist/parsers.js +2 -3
- package/dist/parsers.js.map +1 -1
- package/dist/plugins.cjs +31 -41
- package/dist/plugins.cjs.map +1 -1
- package/dist/plugins.d.ts +2 -3
- package/dist/plugins.js +30 -41
- package/dist/plugins.js.map +1 -1
- package/dist/types.cjs +1 -1
- package/dist/types.d.ts +3 -4
- package/dist/types.js +1 -1
- package/dist/{useNodeTree-CgEKFUV-.d.cts → useNodeTree-6ZhDpI13.d.ts} +2 -2
- package/dist/{useNodeTree-CamNuFQP.d.ts → useNodeTree-Brj-fAVZ.d.ts} +2 -3
- package/package.json +3 -3
- package/src/Fabric.ts +5 -6
- package/src/createFabric.ts +5 -2
- package/src/utils/onProcessExit.ts +9 -0
- package/dist/index.d.cts +0 -602
- package/dist/onProcessExit-7fgW-UTF.js.map +0 -1
- package/dist/onProcessExit-C7dVg0S0.cjs.map +0 -1
- package/dist/parsers/typescript.d.cts +0 -45
- package/dist/parsers.d.cts +0 -37
- package/dist/plugins.d.cts +0 -119
- package/dist/types.d.cts +0 -11
package/dist/index.d.cts
DELETED
|
@@ -1,602 +0,0 @@
|
|
|
1
|
-
import { A as Path, D as File$1, M as Source, N as __name, O as Import, T as Export, _ as inject, b as FileManager, c as FabricOptions, d as renderIndent, f as renderIntrinsic, g as createContext, h as Context, j as ResolvedFile, n as FabricComponent, p as RenderContext, r as FabricConfig, s as FabricNode, t as Fabric, v as provide, w as BaseName, x as FileProcessor, y as unprovide } from "./Fabric-DMmgrLto.cjs";
|
|
2
|
-
import { n as useNodeTree, r as TreeNode, t as ComponentNode } from "./useNodeTree-CgEKFUV-.cjs";
|
|
3
|
-
import { t as RootContext } from "./RootContext-Cf7WJM7r.cjs";
|
|
4
|
-
import { JSDoc } from "./types.cjs";
|
|
5
|
-
|
|
6
|
-
//#region src/createComponent.d.ts
|
|
7
|
-
type MakeChildrenOptional<T extends object> = T extends {
|
|
8
|
-
children?: any;
|
|
9
|
-
} ? Omit<T, 'children'> & Partial<Pick<T, 'children'>> : T;
|
|
10
|
-
type ComponentBuilder<T extends object> = {
|
|
11
|
-
(...args: unknown extends T ? [] : {} extends Omit<T, 'children'> ? [props?: MakeChildrenOptional<T>] : [props: MakeChildrenOptional<T>]): FabricComponent<T>;
|
|
12
|
-
displayName?: string | undefined;
|
|
13
|
-
};
|
|
14
|
-
declare function createComponent<TProps extends object>(type: string, Component: (props: TProps) => FabricNode): ComponentBuilder<TProps>;
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region src/components/App.d.ts
|
|
17
|
-
type AppProps<TMeta extends Object = Object> = {
|
|
18
|
-
/**
|
|
19
|
-
* Metadata attached to the App context.
|
|
20
|
-
*
|
|
21
|
-
* Use this to pass custom data to child components via useApp.
|
|
22
|
-
*/
|
|
23
|
-
meta?: TMeta;
|
|
24
|
-
/**
|
|
25
|
-
* Child components.
|
|
26
|
-
*/
|
|
27
|
-
children?: FabricNode;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Container component providing App context with metadata and lifecycle.
|
|
31
|
-
*
|
|
32
|
-
* Use this component to wrap your application and provide shared metadata
|
|
33
|
-
* that can be accessed by child components using the useApp composable.
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* ```tsx
|
|
37
|
-
* <App meta={{ version: '1.0.0', author: 'John Doe' }}>
|
|
38
|
-
* <File baseName="user.ts" path="./user.ts">
|
|
39
|
-
* <File.Source>export type User = {}</File.Source>
|
|
40
|
-
* </File>
|
|
41
|
-
* </App>
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
declare const App: ComponentBuilder<AppProps<Object>>;
|
|
45
|
-
//#endregion
|
|
46
|
-
//#region src/components/Br.d.ts
|
|
47
|
-
/**
|
|
48
|
-
* Generates a line break in the output.
|
|
49
|
-
*
|
|
50
|
-
* Use this component to add newlines in generated code.
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```tsx
|
|
54
|
-
* <>
|
|
55
|
-
* const x = 1
|
|
56
|
-
* <Br />
|
|
57
|
-
* const y = 2
|
|
58
|
-
* </>
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
declare const Br: ComponentBuilder<object>;
|
|
62
|
-
//#endregion
|
|
63
|
-
//#region src/components/Const.d.ts
|
|
64
|
-
type ConstProps = {
|
|
65
|
-
/**
|
|
66
|
-
* Name of the constant.
|
|
67
|
-
*/
|
|
68
|
-
name: string;
|
|
69
|
-
/**
|
|
70
|
-
* Export this constant.
|
|
71
|
-
* - `true` generates `export const`
|
|
72
|
-
* - `false` generates internal const
|
|
73
|
-
* @default false
|
|
74
|
-
*/
|
|
75
|
-
export?: boolean;
|
|
76
|
-
/**
|
|
77
|
-
* TypeScript type annotation.
|
|
78
|
-
*
|
|
79
|
-
* @example 'string' or 'User[]'
|
|
80
|
-
*/
|
|
81
|
-
type?: string;
|
|
82
|
-
/**
|
|
83
|
-
* JSDoc comments for the constant.
|
|
84
|
-
*/
|
|
85
|
-
JSDoc?: JSDoc;
|
|
86
|
-
/**
|
|
87
|
-
* Use const assertion.
|
|
88
|
-
* - `true` adds `as const` for deep readonly
|
|
89
|
-
* - `false` uses inferred or explicit type
|
|
90
|
-
* @default false
|
|
91
|
-
*/
|
|
92
|
-
asConst?: boolean;
|
|
93
|
-
/**
|
|
94
|
-
* Constant value.
|
|
95
|
-
*/
|
|
96
|
-
children?: FabricNode;
|
|
97
|
-
};
|
|
98
|
-
/**
|
|
99
|
-
* Generates a TypeScript constant declaration.
|
|
100
|
-
*
|
|
101
|
-
* @example
|
|
102
|
-
* ```tsx
|
|
103
|
-
* <Const name="API_URL" export type="string">
|
|
104
|
-
* 'https://api.example.com'
|
|
105
|
-
* </Const>
|
|
106
|
-
* ```
|
|
107
|
-
*/
|
|
108
|
-
declare const Const: ComponentBuilder<ConstProps>;
|
|
109
|
-
//#endregion
|
|
110
|
-
//#region src/components/Dedent.d.ts
|
|
111
|
-
/**
|
|
112
|
-
* Decreases indentation level in the output.
|
|
113
|
-
*
|
|
114
|
-
* Use this component to reduce indentation after an indented code block.
|
|
115
|
-
* Typically paired with Indent to control indentation levels.
|
|
116
|
-
*
|
|
117
|
-
* @example
|
|
118
|
-
* ```tsx
|
|
119
|
-
* <>
|
|
120
|
-
* function example() {'{'}<Br />
|
|
121
|
-
* <Indent />
|
|
122
|
-
* return true<Br />
|
|
123
|
-
* <Dedent />
|
|
124
|
-
* {'}'}
|
|
125
|
-
* </>
|
|
126
|
-
* ```
|
|
127
|
-
*/
|
|
128
|
-
declare const Dedent: ComponentBuilder<object>;
|
|
129
|
-
//#endregion
|
|
130
|
-
//#region src/components/File.d.ts
|
|
131
|
-
type FileProps<TMeta extends object = object> = {
|
|
132
|
-
/**
|
|
133
|
-
* File name with extension.
|
|
134
|
-
*
|
|
135
|
-
* @example 'user.ts'
|
|
136
|
-
*/
|
|
137
|
-
baseName: BaseName;
|
|
138
|
-
/**
|
|
139
|
-
* Full path to the file including directory and file name.
|
|
140
|
-
*
|
|
141
|
-
* The path must include the baseName at the end.
|
|
142
|
-
*
|
|
143
|
-
* @example './generated/types/user.ts'
|
|
144
|
-
*/
|
|
145
|
-
path: Path;
|
|
146
|
-
/**
|
|
147
|
-
* Optional metadata attached to the file.
|
|
148
|
-
*
|
|
149
|
-
* Use this to store custom information about the file.
|
|
150
|
-
*/
|
|
151
|
-
meta?: TMeta;
|
|
152
|
-
/**
|
|
153
|
-
* Optional banner text added at the top of the file.
|
|
154
|
-
*/
|
|
155
|
-
banner?: string;
|
|
156
|
-
/**
|
|
157
|
-
* Optional footer text added at the bottom of the file.
|
|
158
|
-
*/
|
|
159
|
-
footer?: string;
|
|
160
|
-
/**
|
|
161
|
-
* Child components (File.Source, File.Import, File.Export).
|
|
162
|
-
*/
|
|
163
|
-
children?: FabricNode;
|
|
164
|
-
};
|
|
165
|
-
/**
|
|
166
|
-
* Component for generating files with sources, imports, and exports.
|
|
167
|
-
*
|
|
168
|
-
* Creates files in the FileManager that can be written to disk.
|
|
169
|
-
*
|
|
170
|
-
* @example
|
|
171
|
-
* ```tsx
|
|
172
|
-
* <File baseName="user.ts" path="./generated/user.ts">
|
|
173
|
-
* <File.Source isExportable>
|
|
174
|
-
* export type User = {{ '{' }} id: number {{ '}' }}
|
|
175
|
-
* </File.Source>
|
|
176
|
-
* </File>
|
|
177
|
-
* ```
|
|
178
|
-
*/
|
|
179
|
-
declare const File: ComponentBuilder<FileProps<object>> & {
|
|
180
|
-
Source: typeof FileSource;
|
|
181
|
-
Import: typeof FileImport;
|
|
182
|
-
Export: typeof FileExport;
|
|
183
|
-
};
|
|
184
|
-
type FileSourceProps = Omit<Source, 'value'> & {
|
|
185
|
-
/**
|
|
186
|
-
* Source code content.
|
|
187
|
-
*/
|
|
188
|
-
children?: FabricNode;
|
|
189
|
-
};
|
|
190
|
-
/**
|
|
191
|
-
* Adds source code to a file.
|
|
192
|
-
*
|
|
193
|
-
* Use this component inside a File component to add code blocks.
|
|
194
|
-
*
|
|
195
|
-
* @example
|
|
196
|
-
* ```tsx
|
|
197
|
-
* <File.Source isExportable name="User">
|
|
198
|
-
* export type User = {{ '{' }} id: number {{ '}' }}
|
|
199
|
-
* </File.Source>
|
|
200
|
-
* ```
|
|
201
|
-
*/
|
|
202
|
-
declare const FileSource: ComponentBuilder<FileSourceProps>;
|
|
203
|
-
/**
|
|
204
|
-
* Adds export statements to a file.
|
|
205
|
-
*
|
|
206
|
-
* Use this component to create re-exports from other files.
|
|
207
|
-
*
|
|
208
|
-
* @example
|
|
209
|
-
* ```tsx
|
|
210
|
-
* <File.Export name="User" path="./types/user" isTypeOnly />
|
|
211
|
-
* ```
|
|
212
|
-
*/
|
|
213
|
-
declare const FileExport: ComponentBuilder<Export>;
|
|
214
|
-
/**
|
|
215
|
-
* Adds import statements to a file.
|
|
216
|
-
*
|
|
217
|
-
* Use this component to import types or values from other files.
|
|
218
|
-
*
|
|
219
|
-
* @example
|
|
220
|
-
* ```tsx
|
|
221
|
-
* <File.Import name="User" path="./types/user" isTypeOnly />
|
|
222
|
-
* ```
|
|
223
|
-
*/
|
|
224
|
-
declare const FileImport: ComponentBuilder<Import>;
|
|
225
|
-
//#endregion
|
|
226
|
-
//#region src/components/Function.d.ts
|
|
227
|
-
type FunctionProps = {
|
|
228
|
-
/**
|
|
229
|
-
* Name of the function.
|
|
230
|
-
*/
|
|
231
|
-
name: string;
|
|
232
|
-
/**
|
|
233
|
-
* Export with default keyword.
|
|
234
|
-
* - `true` generates `export default function`
|
|
235
|
-
* - `false` generates named export or no export
|
|
236
|
-
* @default false
|
|
237
|
-
*/
|
|
238
|
-
default?: boolean;
|
|
239
|
-
/**
|
|
240
|
-
* Function parameters.
|
|
241
|
-
*
|
|
242
|
-
* @example 'id: number, name: string'
|
|
243
|
-
*/
|
|
244
|
-
params?: string;
|
|
245
|
-
/**
|
|
246
|
-
* Export this function.
|
|
247
|
-
* - `true` generates `export function`
|
|
248
|
-
* - `false` generates internal function
|
|
249
|
-
* @default false
|
|
250
|
-
*/
|
|
251
|
-
export?: boolean;
|
|
252
|
-
/**
|
|
253
|
-
* Make the function async.
|
|
254
|
-
* - `true` adds async keyword and wraps return type in Promise
|
|
255
|
-
* - `false` generates synchronous function
|
|
256
|
-
* @default false
|
|
257
|
-
*/
|
|
258
|
-
async?: boolean;
|
|
259
|
-
/**
|
|
260
|
-
* TypeScript generics.
|
|
261
|
-
*
|
|
262
|
-
* @example 'T' or ['T', 'U']
|
|
263
|
-
*/
|
|
264
|
-
generics?: string | string[];
|
|
265
|
-
/**
|
|
266
|
-
* Return type of the function.
|
|
267
|
-
*
|
|
268
|
-
* When async is true, this is automatically wrapped in Promise.
|
|
269
|
-
*/
|
|
270
|
-
returnType?: string;
|
|
271
|
-
/**
|
|
272
|
-
* JSDoc comments for the function.
|
|
273
|
-
*/
|
|
274
|
-
JSDoc?: JSDoc;
|
|
275
|
-
/**
|
|
276
|
-
* Function body.
|
|
277
|
-
*/
|
|
278
|
-
children?: FabricNode;
|
|
279
|
-
};
|
|
280
|
-
/**
|
|
281
|
-
* Generates a TypeScript function declaration.
|
|
282
|
-
*
|
|
283
|
-
* @example
|
|
284
|
-
* ```tsx
|
|
285
|
-
* <Function
|
|
286
|
-
* name="getUser"
|
|
287
|
-
* export
|
|
288
|
-
* async
|
|
289
|
-
* params="id: number"
|
|
290
|
-
* returnType="User"
|
|
291
|
-
* >
|
|
292
|
-
* return fetch(`/users/${id}`).then(r => r.json())
|
|
293
|
-
* </Function>
|
|
294
|
-
* ```
|
|
295
|
-
*/
|
|
296
|
-
declare const Function: ComponentBuilder<FunctionProps> & {
|
|
297
|
-
Arrow: typeof ArrowFunction;
|
|
298
|
-
};
|
|
299
|
-
type ArrowFunctionProps = FunctionProps & {
|
|
300
|
-
/**
|
|
301
|
-
* Create Arrow function in one line
|
|
302
|
-
*/
|
|
303
|
-
singleLine?: boolean;
|
|
304
|
-
};
|
|
305
|
-
/**
|
|
306
|
-
* ArrowFunction
|
|
307
|
-
*
|
|
308
|
-
* Builds an arrow function declaration string for the fsx renderer. Supports
|
|
309
|
-
* the same options as `Function`. Use `singleLine` to produce a one-line
|
|
310
|
-
* arrow expression.
|
|
311
|
-
*/
|
|
312
|
-
declare const ArrowFunction: ComponentBuilder<ArrowFunctionProps>;
|
|
313
|
-
//#endregion
|
|
314
|
-
//#region src/components/Indent.d.ts
|
|
315
|
-
/**
|
|
316
|
-
* Increases indentation level in the output.
|
|
317
|
-
*
|
|
318
|
-
* Use this component to add indentation for nested code blocks.
|
|
319
|
-
* Typically paired with Dedent to control indentation levels.
|
|
320
|
-
*
|
|
321
|
-
* @example
|
|
322
|
-
* ```tsx
|
|
323
|
-
* <>
|
|
324
|
-
* function example() {'{'}<Br />
|
|
325
|
-
* <Indent />
|
|
326
|
-
* return true<Br />
|
|
327
|
-
* <Dedent />
|
|
328
|
-
* {'}'}
|
|
329
|
-
* </>
|
|
330
|
-
* ```
|
|
331
|
-
*/
|
|
332
|
-
declare const Indent: ComponentBuilder<object>;
|
|
333
|
-
//#endregion
|
|
334
|
-
//#region src/components/Root.d.ts
|
|
335
|
-
type RootProps = {
|
|
336
|
-
/**
|
|
337
|
-
* Callback to exit the Fabric application.
|
|
338
|
-
*
|
|
339
|
-
* Call this to stop rendering and clean up resources.
|
|
340
|
-
*/
|
|
341
|
-
onExit: (error?: Error) => void;
|
|
342
|
-
/**
|
|
343
|
-
* Error handler for runtime exceptions.
|
|
344
|
-
*
|
|
345
|
-
* Receives errors thrown during component rendering.
|
|
346
|
-
*/
|
|
347
|
-
onError: (error: Error) => void;
|
|
348
|
-
/**
|
|
349
|
-
* Tree structure representing the component hierarchy.
|
|
350
|
-
*
|
|
351
|
-
* Used internally for tracking component relationships.
|
|
352
|
-
*/
|
|
353
|
-
treeNode: TreeNode<ComponentNode>;
|
|
354
|
-
/**
|
|
355
|
-
* FileManager instance for file operations.
|
|
356
|
-
*
|
|
357
|
-
* Manages all files created during rendering.
|
|
358
|
-
*/
|
|
359
|
-
fileManager: FileManager;
|
|
360
|
-
/**
|
|
361
|
-
* Child components.
|
|
362
|
-
*/
|
|
363
|
-
children?: FabricNode;
|
|
364
|
-
};
|
|
365
|
-
/**
|
|
366
|
-
* Root component providing core Fabric runtime context.
|
|
367
|
-
*
|
|
368
|
-
* This component is typically used internally by the Fabric renderer.
|
|
369
|
-
* It provides the root context including FileManager, error handling,
|
|
370
|
-
* and lifecycle management.
|
|
371
|
-
*
|
|
372
|
-
* @example
|
|
373
|
-
* ```tsx
|
|
374
|
-
* <Root
|
|
375
|
-
* onExit={(error) => process.exit(error ? 1 : 0)}
|
|
376
|
-
* onError={(error) => console.error(error)}
|
|
377
|
-
* treeNode={treeNode}
|
|
378
|
-
* fileManager={fileManager}
|
|
379
|
-
* >
|
|
380
|
-
* <App>
|
|
381
|
-
* Your components here
|
|
382
|
-
* </App>
|
|
383
|
-
* </Root>
|
|
384
|
-
* ```
|
|
385
|
-
*/
|
|
386
|
-
declare const Root: ComponentBuilder<RootProps>;
|
|
387
|
-
//#endregion
|
|
388
|
-
//#region src/components/Type.d.ts
|
|
389
|
-
type TypeProps = {
|
|
390
|
-
/**
|
|
391
|
-
* Name of the type (must start with a capital letter).
|
|
392
|
-
*/
|
|
393
|
-
name: string;
|
|
394
|
-
/**
|
|
395
|
-
* Export this type.
|
|
396
|
-
* - `true` generates `export type`
|
|
397
|
-
* - `false` generates internal type
|
|
398
|
-
* @default false
|
|
399
|
-
*/
|
|
400
|
-
export?: boolean;
|
|
401
|
-
/**
|
|
402
|
-
* JSDoc comments for the type.
|
|
403
|
-
*/
|
|
404
|
-
JSDoc?: JSDoc;
|
|
405
|
-
/**
|
|
406
|
-
* Type definition.
|
|
407
|
-
*/
|
|
408
|
-
children?: FabricNode;
|
|
409
|
-
};
|
|
410
|
-
/**
|
|
411
|
-
* Generates a TypeScript type declaration.
|
|
412
|
-
*
|
|
413
|
-
* @example
|
|
414
|
-
* ```tsx
|
|
415
|
-
* <Type name="User" export>
|
|
416
|
-
* {'{'} id: number; name: string {'}'}
|
|
417
|
-
* </Type>
|
|
418
|
-
* ```
|
|
419
|
-
*/
|
|
420
|
-
declare const Type: ComponentBuilder<TypeProps>;
|
|
421
|
-
//#endregion
|
|
422
|
-
//#region src/contexts/AppContext.d.ts
|
|
423
|
-
type AppContextProps<TMeta extends object = object> = {
|
|
424
|
-
/**
|
|
425
|
-
* Exit (unmount)
|
|
426
|
-
*/
|
|
427
|
-
exit: (error?: Error) => void;
|
|
428
|
-
meta: TMeta;
|
|
429
|
-
};
|
|
430
|
-
/**
|
|
431
|
-
* Provides app-level metadata and lifecycle hooks (like `exit`) to
|
|
432
|
-
* components and composables within a Fabric runtime.
|
|
433
|
-
*/
|
|
434
|
-
declare const AppContext: Context<AppContextProps<object>>;
|
|
435
|
-
//#endregion
|
|
436
|
-
//#region src/composables/useApp.d.ts
|
|
437
|
-
/**
|
|
438
|
-
* Accesses the App context with metadata and exit function.
|
|
439
|
-
*
|
|
440
|
-
* Use this composable to access metadata defined in the App component
|
|
441
|
-
* or to exit the rendering process early.
|
|
442
|
-
*
|
|
443
|
-
* @throws Error when no AppContext is available
|
|
444
|
-
*
|
|
445
|
-
* @example
|
|
446
|
-
* ```ts
|
|
447
|
-
* const { meta, exit } = useApp<{ version: string }>()
|
|
448
|
-
* console.log(meta.version)
|
|
449
|
-
* ```
|
|
450
|
-
*/
|
|
451
|
-
declare function useApp<TMeta extends object = object>(): AppContextProps<TMeta>;
|
|
452
|
-
//#endregion
|
|
453
|
-
//#region src/composables/useContext.d.ts
|
|
454
|
-
/**
|
|
455
|
-
* React-style alias for inject
|
|
456
|
-
*
|
|
457
|
-
* @example
|
|
458
|
-
* ```ts
|
|
459
|
-
* const theme = useContext(ThemeContext) // type is inferred from ThemeContext
|
|
460
|
-
* ```
|
|
461
|
-
*/
|
|
462
|
-
declare function useContext<T>(key: Context<T>): T;
|
|
463
|
-
declare function useContext<T, TValue = T>(key: Context<T>, defaultValue: TValue): NonNullable<T> | TValue;
|
|
464
|
-
//#endregion
|
|
465
|
-
//#region src/composables/useFile.d.ts
|
|
466
|
-
/**
|
|
467
|
-
* Accesses the current File context.
|
|
468
|
-
*
|
|
469
|
-
* Use this composable to access or modify the current file's properties,
|
|
470
|
-
* sources, imports, or exports.
|
|
471
|
-
*
|
|
472
|
-
* @returns The current file object or null if not within a File component
|
|
473
|
-
*
|
|
474
|
-
* @example
|
|
475
|
-
* ```ts
|
|
476
|
-
* const file = useFile()
|
|
477
|
-
* if (file) {
|
|
478
|
-
* console.log(file.path)
|
|
479
|
-
* file.sources.push({ value: 'export const x = 1', isExportable: true })
|
|
480
|
-
* }
|
|
481
|
-
* ```
|
|
482
|
-
*/
|
|
483
|
-
declare function useFile(): ResolvedFile | null;
|
|
484
|
-
//#endregion
|
|
485
|
-
//#region src/composables/useFileManager.d.ts
|
|
486
|
-
/**
|
|
487
|
-
* Accesses the FileManager from the Root context.
|
|
488
|
-
*
|
|
489
|
-
* Use this composable to interact with the FileManager directly,
|
|
490
|
-
* such as adding, retrieving, or managing files.
|
|
491
|
-
*
|
|
492
|
-
* @returns The current FileManager instance
|
|
493
|
-
*
|
|
494
|
-
* @example
|
|
495
|
-
* ```ts
|
|
496
|
-
* const fileManager = useFileManager()
|
|
497
|
-
* fileManager.add({
|
|
498
|
-
* baseName: 'user.ts',
|
|
499
|
-
* path: './generated/user.ts',
|
|
500
|
-
* sources: []
|
|
501
|
-
* })
|
|
502
|
-
* ```
|
|
503
|
-
*/
|
|
504
|
-
declare function useFileManager(): FileManager;
|
|
505
|
-
//#endregion
|
|
506
|
-
//#region src/composables/useLifecycle.d.ts
|
|
507
|
-
/**
|
|
508
|
-
* Accesses lifecycle helpers for controlling generation flow.
|
|
509
|
-
*
|
|
510
|
-
* Use this composable to exit the rendering process early or perform
|
|
511
|
-
* cleanup operations.
|
|
512
|
-
*
|
|
513
|
-
* @returns Object with lifecycle methods (exit)
|
|
514
|
-
*
|
|
515
|
-
* @example
|
|
516
|
-
* ```ts
|
|
517
|
-
* const { exit } = useLifecycle()
|
|
518
|
-
*
|
|
519
|
-
* // Stop generation on error
|
|
520
|
-
* if (invalidData) {
|
|
521
|
-
* exit(new Error('Invalid data'))
|
|
522
|
-
* }
|
|
523
|
-
* ```
|
|
524
|
-
*/
|
|
525
|
-
declare function useLifecycle(): {
|
|
526
|
-
exit: (error?: Error) => void;
|
|
527
|
-
};
|
|
528
|
-
//#endregion
|
|
529
|
-
//#region src/contexts/FileContext.d.ts
|
|
530
|
-
/**
|
|
531
|
-
* Provides app-level metadata and lifecycle hooks (like `exit`) to
|
|
532
|
-
* components and composables within a Fabric runtime.
|
|
533
|
-
*/
|
|
534
|
-
declare const FileContext: Context<ResolvedFile<object> | null>;
|
|
535
|
-
//#endregion
|
|
536
|
-
//#region src/contexts/NodeTreeContext.d.ts
|
|
537
|
-
/**
|
|
538
|
-
* Context for having the current NodeTree
|
|
539
|
-
*/
|
|
540
|
-
declare const NodeTreeContext: Context<TreeNode<ComponentNode> | null>;
|
|
541
|
-
//#endregion
|
|
542
|
-
//#region src/createFabric.d.ts
|
|
543
|
-
/**
|
|
544
|
-
* Creates a new Fabric instance for file generation.
|
|
545
|
-
*
|
|
546
|
-
* The Fabric instance provides methods for registering plugins,
|
|
547
|
-
* adding files, and triggering file generation.
|
|
548
|
-
*
|
|
549
|
-
* @param config - Optional configuration object
|
|
550
|
-
* @returns A new Fabric instance
|
|
551
|
-
*
|
|
552
|
-
* @example
|
|
553
|
-
* ```ts
|
|
554
|
-
* import { createFabric } from '@kubb/fabric-core'
|
|
555
|
-
* import { fsPlugin } from '@kubb/fabric-core/plugins'
|
|
556
|
-
* import { typescriptParser } from '@kubb/fabric-core/parsers'
|
|
557
|
-
*
|
|
558
|
-
* const fabric = createFabric()
|
|
559
|
-
* fabric.use(fsPlugin)
|
|
560
|
-
* fabric.use(typescriptParser)
|
|
561
|
-
*
|
|
562
|
-
* await fabric.addFile({
|
|
563
|
-
* baseName: 'user.ts',
|
|
564
|
-
* path: './generated/user.ts',
|
|
565
|
-
* sources: [{ value: 'export type User = {}', isExportable: true }],
|
|
566
|
-
* imports: [],
|
|
567
|
-
* exports: [],
|
|
568
|
-
* })
|
|
569
|
-
*
|
|
570
|
-
* await fabric.write({ extension: { '.ts': '.ts' } })
|
|
571
|
-
* ```
|
|
572
|
-
*/
|
|
573
|
-
declare function createFabric<T extends FabricOptions>(config?: FabricConfig<T>): Fabric<T>;
|
|
574
|
-
//#endregion
|
|
575
|
-
//#region src/createFile.d.ts
|
|
576
|
-
/**
|
|
577
|
-
* Helper to create a file with name and id set
|
|
578
|
-
*/
|
|
579
|
-
declare function createFile<TMeta extends object = object>(file: File$1<TMeta>): ResolvedFile<TMeta>;
|
|
580
|
-
//#endregion
|
|
581
|
-
//#region src/utils/createJSDoc.d.ts
|
|
582
|
-
/**
|
|
583
|
-
* Create JSDoc comment block from comments array
|
|
584
|
-
*/
|
|
585
|
-
declare function createJSDoc({
|
|
586
|
-
comments
|
|
587
|
-
}: {
|
|
588
|
-
comments: string[];
|
|
589
|
-
}): string;
|
|
590
|
-
//#endregion
|
|
591
|
-
//#region src/utils/getRelativePath.d.ts
|
|
592
|
-
declare function getRelativePath(rootDir?: string | null, filePath?: string | null, platform?: 'windows' | 'mac' | 'linux'): string;
|
|
593
|
-
//#endregion
|
|
594
|
-
//#region src/utils/onProcessExit.d.ts
|
|
595
|
-
/**
|
|
596
|
-
* Register a callback to run when the process exits (via exit event or common signals).
|
|
597
|
-
* Returns an unsubscribe function.
|
|
598
|
-
*/
|
|
599
|
-
declare function onProcessExit(callback: (code: number | null) => void): () => void;
|
|
600
|
-
//#endregion
|
|
601
|
-
export { App, AppContext, Br, Const, Dedent, type Fabric, File, FileContext, FileManager, FileProcessor, Function, Indent, NodeTreeContext, RenderContext, Root, RootContext, TreeNode, Type, createComponent, createContext, createFabric, createFile, createJSDoc, getRelativePath, inject, onProcessExit, provide, renderIndent, renderIntrinsic, unprovide, useApp, useContext, useFile, useFileManager, useLifecycle, useNodeTree };
|
|
602
|
-
//# sourceMappingURL=index.d.cts.map
|