@kubb/react-fabric 0.2.0 → 0.2.1

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.
Files changed (76) hide show
  1. package/README.md +49 -78
  2. package/dist/{App-D7ehObix.d.ts → Fabric-nxgJyzWH.d.cts} +27 -27
  3. package/dist/{App-CbT7rbmH.d.cts → Fabric-tVWTpMR5.d.ts} +27 -27
  4. package/dist/{KubbFile-D4gyyfL-.d.ts → KubbFile-DFnA3mmn.d.ts} +1 -1
  5. package/dist/{KubbFile-FGXV713i.d.cts → KubbFile-DHCtBOpy.d.cts} +1 -1
  6. package/dist/chunk-CVmoYqME.js +27 -0
  7. package/dist/chunk-DWy1uDak.cjs +39 -0
  8. package/dist/devtools-DPye8o33.js +11448 -0
  9. package/dist/devtools-DPye8o33.js.map +1 -0
  10. package/dist/devtools-DnQsy6Us.cjs +11456 -0
  11. package/dist/devtools-DnQsy6Us.cjs.map +1 -0
  12. package/dist/devtools.cjs +2 -10885
  13. package/dist/devtools.d.cts +11 -1
  14. package/dist/devtools.d.ts +11 -1
  15. package/dist/devtools.js +2 -10885
  16. package/dist/{globals-BRG2DOJd.d.cts → globals-C7dPa-nz.d.cts} +3 -3
  17. package/dist/{globals-D_1Lfe9-.d.ts → globals-CxZEi_Pn.d.ts} +3 -3
  18. package/dist/globals.d.cts +3 -3
  19. package/dist/globals.d.ts +3 -3
  20. package/dist/index.cjs +34 -23
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +16 -9
  23. package/dist/index.d.ts +16 -9
  24. package/dist/index.js +15 -5
  25. package/dist/index.js.map +1 -1
  26. package/dist/jsx-dev-runtime.cjs +8 -0
  27. package/dist/jsx-dev-runtime.js +5 -0
  28. package/dist/jsx-runtime-9ohe6OS2.cjs +36 -0
  29. package/dist/jsx-runtime-9ohe6OS2.cjs.map +1 -0
  30. package/dist/{react-BBkwFtZV.js → jsx-runtime-BOrVcbIT.cjs} +253 -42
  31. package/dist/jsx-runtime-BOrVcbIT.cjs.map +1 -0
  32. package/dist/{react-Bq0UOw6S.cjs → jsx-runtime-CFd_ktZn.js} +239 -57
  33. package/dist/jsx-runtime-CFd_ktZn.js.map +1 -0
  34. package/dist/jsx-runtime-CvGZkcTo.js +13 -0
  35. package/dist/jsx-runtime-CvGZkcTo.js.map +1 -0
  36. package/dist/jsx-runtime.cjs +6 -15
  37. package/dist/jsx-runtime.d.cts +3 -3
  38. package/dist/jsx-runtime.d.ts +3 -3
  39. package/dist/jsx-runtime.js +3 -12
  40. package/dist/parsers.d.cts +2 -2
  41. package/dist/parsers.d.ts +2 -2
  42. package/dist/{Runtime-DJ4dWT9w.cjs → plugins-CEGJdkpj.cjs} +110 -76
  43. package/dist/plugins-CEGJdkpj.cjs.map +1 -0
  44. package/dist/{Runtime-CatKeybQ.js → plugins-aZCNhIC8.js} +85 -58
  45. package/dist/plugins-aZCNhIC8.js.map +1 -0
  46. package/dist/plugins.cjs +4 -36
  47. package/dist/plugins.d.cts +16 -49
  48. package/dist/plugins.d.ts +16 -49
  49. package/dist/plugins.js +3 -34
  50. package/dist/reactPlugin-B47Guoya.d.ts +38 -0
  51. package/dist/reactPlugin-CLgWWifj.d.cts +38 -0
  52. package/dist/{types-C3p0Ljxf.d.cts → types-DoYRYV1C.d.cts} +1 -1
  53. package/dist/{types-Brnyan9B.d.ts → types-u_NEi07i.d.ts} +1 -1
  54. package/dist/types.d.cts +1 -1
  55. package/dist/types.d.ts +1 -1
  56. package/package.json +10 -6
  57. package/src/Renderer.ts +26 -22
  58. package/src/Runtime.tsx +2 -2
  59. package/src/createReactFabric.ts +17 -0
  60. package/src/devtools.ts +106 -111
  61. package/src/index.ts +2 -1
  62. package/src/plugins/reactPlugin.ts +3 -3
  63. package/dist/Runtime-CatKeybQ.js.map +0 -1
  64. package/dist/Runtime-DJ4dWT9w.cjs.map +0 -1
  65. package/dist/devtools.cjs.map +0 -1
  66. package/dist/devtools.js.map +0 -1
  67. package/dist/jsx-runtime-Dg-pJBHd.js +0 -228
  68. package/dist/jsx-runtime-Dg-pJBHd.js.map +0 -1
  69. package/dist/jsx-runtime-d2dmYscH.cjs +0 -233
  70. package/dist/jsx-runtime-d2dmYscH.cjs.map +0 -1
  71. package/dist/jsx-runtime.cjs.map +0 -1
  72. package/dist/jsx-runtime.js.map +0 -1
  73. package/dist/plugins.cjs.map +0 -1
  74. package/dist/plugins.js.map +0 -1
  75. package/dist/react-BBkwFtZV.js.map +0 -1
  76. package/dist/react-Bq0UOw6S.cjs.map +0 -1
package/README.md CHANGED
@@ -27,6 +27,7 @@ It offers a lightweight layer for file generation while orchestrating the overal
27
27
  > [!WARNING]
28
28
  > Fabric is under active development. Until a stable 1.0 release, minor versions may occasionally include breaking changes. Please check release notes and PR titles for breaking changes.
29
29
 
30
+
30
31
  # Features
31
32
 
32
33
  - 🎨 Declarative file generation — Create files effortlessly using JSX or JavaScript syntax.
@@ -36,16 +37,16 @@ It offers a lightweight layer for file generation while orchestrating the overal
36
37
 
37
38
  ## Write a TypeScript file
38
39
 
39
- Below is a minimal example showing how `createApp` works together with plugins and parsers via `app.use`.
40
+ Below is a minimal example showing how `createFabric` works together with plugins and parsers via `fabric.use`.
40
41
 
41
42
  ```ts
42
- import { createApp } from '@kubb/fabric-core'
43
+ import { createFabric } from '@kubb/fabric-core'
43
44
  import { fsPlugin } from '@kubb/fabric-core/plugins'
44
45
  import { typescriptParser, createParser } from '@kubb/fabric-core/parsers'
45
46
 
46
- const app = createApp()
47
+ const fabric = createFabric()
47
48
 
48
- app.use(fsPlugin, {
49
+ fabric.use(fsPlugin, {
49
50
  dryRun: false,
50
51
  onBeforeWrite: (path, data) => {
51
52
  console.log('About to write:', path)
@@ -53,9 +54,9 @@ app.use(fsPlugin, {
53
54
  clean: { path: './generated' },
54
55
  })
55
56
 
56
- app.use(typescriptParser)
57
+ fabric.use(typescriptParser)
57
58
 
58
- await app.addFile({
59
+ await fabric.addFile({
59
60
  baseName: 'index.ts',
60
61
  path: './generated/index.ts',
61
62
  sources: [
@@ -63,27 +64,27 @@ await app.addFile({
63
64
  ],
64
65
  })
65
66
 
66
- await app.write()
67
+ await fabric.write()
67
68
 
68
69
  ```
69
70
 
70
71
  # API Reference
71
72
 
72
73
  ## Core
73
- ### `createApp(options?): App`
74
- Returns an app instance with:
75
- - `app.use(pluginOrParser, ...options) => App` — register plugins and parsers.
76
- - `app.addFile(...files)` — queue in-memory files to generate.
77
- - `app.files` — getter with all queued files.
78
- - `app.context` — internal context holding events, options, FileManager, installed plugins/parsers.
74
+ ### `createFabric(options?): Fabric`
75
+ Returns a Fabric instance with:
76
+ - `fabric.use(pluginOrParser, ...options) => Fabric` — register plugins and parsers.
77
+ - `fabric.addFile(...files)` — queue in-memory files to generate.
78
+ - `fabric.files` — getter with all queued files.
79
+ - `fabric.context` — internal context holding events, options, FileManager, installed plugins/parsers.
79
80
 
80
- ### `defineApp(instance?): () => App`
81
- Factory to create your own `createApp` with an optional bootstrap `instance(app)` called on creation.
81
+ ### `defineFabric(instance?): () => Fabric`
82
+ Factory to create your own `createFabric` with an optional bootstrap `instance(fabric)` called on creation.
82
83
 
83
- ### App events (emitted by the core during processing)
84
+ ### Events (emitted by the core during processing)
84
85
  - `start`
85
86
  - `end`
86
- - `render { app }`
87
+ - `render { fabric }`
87
88
  - `file:add { files }`
88
89
  - `write:start { files }`
89
90
  - `write:end { files }`
@@ -108,7 +109,7 @@ import { fsPlugin } from '@kubb/fabric-core/plugins'
108
109
  | onBeforeWrite | `(path: string, data: string \| undefined) => void \| Promise<void>` | — | Called right before each file write on `process:progress`. |
109
110
  | clean | `{ path: string }` | — | If provided, removes the directory at `path` before writing any files. |
110
111
 
111
- Injected `app.write` options (via `fsPlugin`):
112
+ Injected `fabric.write` options (via `fsPlugin`):
112
113
 
113
114
  | Option | Type | Default | Description |
114
115
  |---|----------------------------------|---|---|
@@ -127,7 +128,7 @@ import { barrelPlugin } from '@kubb/fabric-core/plugins'
127
128
  | mode | `'all' \| 'named' \| 'propagate' \| false` | — | Controls how exports are generated: all exports, only named exports, propagate (skip barrels), or disabled. |
128
129
  | dryRun | `boolean` | `false` | If true, computes barrels but skips writing. |
129
130
 
130
- Injected `app.writeEntry` parameters (via `barrelPlugin`):
131
+ Injected `fabric.writeEntry` parameters (via `barrelPlugin`):
131
132
 
132
133
  | Param | Type | Description |
133
134
  |---|--------------------------------------------|---|
@@ -183,28 +184,28 @@ Injected methods (via `reactPlugin`):
183
184
 
184
185
  #### `createPlugin`
185
186
 
186
- Factory to declare a plugin that can be registered via `app.use`.
187
+ Factory to declare a plugin that can be registered via `fabric.use`.
187
188
 
188
- | Field | Required | Description |
189
- |---|---|---------------------------------------------------------------------------------------------------------------------------|
190
- | `name` | Yes | String identifier of your plugin. |
191
- | `install(app, options)` | Yes | Called when the plugin is registered. You can subscribe to core events and perform side effects here. |
192
- | `inject?(app, options)` | No | Return synchronously the runtime methods/properties to merge into `app` (e.g. `write`, `render`). This must not be async. |
189
+ | Field | Required | Description |
190
+ |----------------------------|---|------------------------------------------------------------------------------------------------------------------------------|
191
+ | `name` | Yes | String identifier of your plugin. |
192
+ | `install(fabric, options)` | Yes | Called when the plugin is registered. You can subscribe to core events and perform side effects here. |
193
+ | `inject?(fabric, options)` | No | Return synchronously the runtime methods/properties to merge into `fabric` (e.g. `write`, `render`). This must not be async. |
193
194
 
194
195
  Example:
195
196
 
196
197
  ```ts
197
- import { createApp } from '@kubb/fabric-core'
198
+ import { createFabric } from '@kubb/fabric-core'
198
199
  import { createPlugin } from '@kubb/fabric-core/plugins'
199
200
 
200
201
  const helloPlugin = createPlugin<{ name?: string }, { sayHello: (msg?: string) => void }>({
201
202
  name: 'helloPlugin',
202
- install(app, options) {
203
- app.context.events.on('start', () => {
204
- console.log('App started')
203
+ install(fabric, options) {
204
+ fabric.context.events.on('start', () => {
205
+ console.log('Fabric started')
205
206
  })
206
207
  },
207
- inject(app, options) {
208
+ inject(fabric, options) {
208
209
  return {
209
210
  sayHello(msg = options?.name ?? 'world') {
210
211
  console.log(`Hello ${msg}!`)
@@ -213,9 +214,9 @@ const helloPlugin = createPlugin<{ name?: string }, { sayHello: (msg?: string) =
213
214
  },
214
215
  })
215
216
 
216
- const app = createApp()
217
- await app.use(helloPlugin, { name: 'Fabric' })
218
- app.sayHello() // -> Hello Fabric!
217
+ const fabric = createFabric()
218
+ await fabric.use(helloPlugin, { name: 'Fabric' })
219
+ fabric.sayHello() // -> Hello Fabric!
219
220
  ```
220
221
 
221
222
  ## Parsers
@@ -247,7 +248,7 @@ import { tsxParser } from '@kubb/fabric-core/parsers'
247
248
 
248
249
  #### `defaultParser`
249
250
 
250
- Fallback parser used when no extension mapping is provided to `app.write`.
251
+ Fallback parser used when no extension mapping is provided to `fabric.write`.
251
252
 
252
253
  ```
253
254
  import { defaultParser } @kubb/fabric-core/parsers`
@@ -258,25 +259,25 @@ import { defaultParser } @kubb/fabric-core/parsers`
258
259
  | file | `KubbFile.File` | -| File that will be used to be parsed. |
259
260
 
260
261
  #### `createParser`
261
- Factory to declare a parser that can be registered via `app.use` and selected by `extNames` during `app.write`.
262
+ Factory to declare a parser that can be registered via `fabric.use` and selected by `extNames` during `fabirc.write`.
262
263
 
263
- | Field | Required | Description |
264
- |---|---|-----------------------------------------------------------------------------------------------------------------|
265
- | `name` | Yes | String identifier of your parser. |
266
- | `extNames` | Yes | List of file extensions this parser can handle (e.g. ['.ts']). Use `undefined` for the default parser fallback. |
267
- | `install(app, options)` | No | Optional setup when the parser is registered (subscribe to events, set state, etc.). |
264
+ | Field | Required | Description |
265
+ |----------------------------|---|-----------------------------------------------------------------------------------------------------------------|
266
+ | `name` | Yes | String identifier of your parser. |
267
+ | `extNames` | Yes | List of file extensions this parser can handle (e.g. ['.ts']). Use `undefined` for the default parser fallback. |
268
+ | `install(fabric, options)` | No | Optional setup when the parser is registered (subscribe to events, set state, etc.). |
268
269
  | `parse(file, { extname })` | Yes | Must return the final string that will be written for the given file. |
269
270
 
270
271
  Example:
271
272
 
272
273
  ```ts
273
- import { createApp } from '@kubb/fabric-core'
274
+ import { createFabric } from '@kubb/fabric-core'
274
275
  import { createParser } from '@kubb/fabric-core/parsers'
275
276
 
276
277
  const vueParser = createParser<{ banner?: string }>({
277
278
  name: 'vueParser',
278
279
  extNames: ['.vue'],
279
- async install(app, options) {
280
+ async install(fabric, options) {
280
281
  // Optional setup
281
282
  },
282
283
  async parse(file, { extname }) {
@@ -286,43 +287,13 @@ const vueParser = createParser<{ banner?: string }>({
286
287
  },
287
288
  })
288
289
 
289
- const app = createApp()
290
- app.use(vueParser)
291
- app.use(fsPlugin); // make it possible to write to the filesystem
290
+ const fabric = createFabric()
291
+ fabric.use(vueParser)
292
+ fabric.use(fsPlugin); // make it possible to write to the filesystem
292
293
 
293
- app.write({ extension: { '.vue': '.ts' } })
294
+ fabric.write({ extension: { '.vue': '.ts' } })
294
295
  ```
295
296
 
296
297
  > [!NOTE]
297
- > - `app.use` accepts both plugins and parsers. The `fsPlugin` handles I/O and adds `app.write`. Parsers decide how files are converted to strings for specific extensions.
298
- > - When extension mapping is provided to `app.write`, Fabric picks a parser whose `extNames` include the file’s extension. Otherwise, the default parser is used.
299
-
300
- ## Supporting Kubb
301
-
302
- Kubb uses an MIT-licensed open source project with its ongoing development made possible entirely by the support of Sponsors. If you would like to become a sponsor, please consider:
303
-
304
- - [Become a Sponsor on GitHub](https://github.com/sponsors/stijnvanhulle)
305
-
306
- <p align="center">
307
- <a href="https://github.com/sponsors/stijnvanhulle">
308
- <img src="https://raw.githubusercontent.com/stijnvanhulle/sponsors/main/sponsors.svg" alt="My sponsors" />
309
- </a>
310
- </p>
311
-
312
-
313
- <!-- Badges -->
314
-
315
- [npm-version-src]: https://img.shields.io/npm/v/@kubb/react-fabric?flat&colorA=18181B&colorB=f58517
316
- [npm-version-href]: https://npmjs.com/package/@kubb/react-fabric
317
- [npm-downloads-src]: https://img.shields.io/npm/dm/@kubb/react-fabric?flat&colorA=18181B&colorB=f58517
318
- [npm-downloads-href]: https://npmjs.com/package/@kubb/react-fabric
319
- [license-src]: https://img.shields.io/github/license/kubb-labs/kubb.svg?flat&colorA=18181B&colorB=f58517
320
- [license-href]: https://github.com/kubb-labs/kubb/blob/main/LICENSE
321
- [build-src]: https://img.shields.io/github/actions/workflow/status/kubb-labs/kubb/ci.yaml?style=flat&colorA=18181B&colorB=f58517
322
- [build-href]: https://www.npmjs.com/package/@kubb/react-fabric
323
- [minified-src]: https://img.shields.io/bundlephobia/min/@kubb/react-fabric?style=flat&colorA=18181B&colorB=f58517
324
- [minified-href]: https://www.npmjs.com/package/@kubb/react-fabric
325
- [coverage-src]: https://img.shields.io/codecov/c/github/kubb-labs/kubb?style=flat&colorA=18181B&colorB=f58517
326
- [coverage-href]: https://www.npmjs.com/package/@kubb/react-fabric
327
- [sponsors-src]: https://img.shields.io/github/sponsors/stijnvanhulle?style=flat&colorA=18181B&colorB=f58517
328
- [sponsors-href]: https://github.com/sponsors/stijnvanhulle/
298
+ > - `fabric.use` accepts both plugins and parsers. The `fsPlugin` handles I/O and adds `fabric.write`. Parsers decide how files are converted to strings for specific extensions.
299
+ > - When extension mapping is provided to `fabric.write`, Fabric picks a parser whose `extNames` include the file’s extension. Otherwise, the default parser is used.
@@ -1,7 +1,7 @@
1
- import { i as File, o as Path, r as Extname, s as ResolvedFile } from "./KubbFile-D4gyyfL-.js";
1
+ import { i as File, o as Path, r as Extname, s as ResolvedFile } from "./KubbFile-DHCtBOpy.cjs";
2
2
 
3
3
  //#region ../fabric-core/src/plugins/types.d.ts
4
- type Plugin<TOptions = unknown, TAppExtension$1 extends Record<string, any> = {}> = {
4
+ type Plugin<TOptions = unknown, TAppExtension extends Record<string, any> = {}> = {
5
5
  name: string;
6
6
  type: 'plugin';
7
7
  install: Install<TOptions>;
@@ -10,15 +10,15 @@ type Plugin<TOptions = unknown, TAppExtension$1 extends Record<string, any> = {}
10
10
  * Merged into the app instance after install.
11
11
  * This cannot be async
12
12
  */
13
- inject?: Inject<TOptions, TAppExtension$1>;
13
+ inject?: Inject<TOptions, TAppExtension>;
14
14
  };
15
- type UserPlugin<TOptions = unknown, TAppExtension$1 extends Record<string, any> = {}> = Omit<Plugin<TOptions, TAppExtension$1>, 'type'>;
15
+ type UserPlugin<TOptions = unknown, TAppExtension extends Record<string, any> = {}> = Omit<Plugin<TOptions, TAppExtension>, 'type'>;
16
16
  //#endregion
17
17
  //#region ../fabric-core/src/parsers/types.d.ts
18
18
  type PrintOptions = {
19
19
  extname?: Extname;
20
20
  };
21
- type Parser<TOptions = unknown, TMeta$1 extends object = any> = {
21
+ type Parser<TOptions = unknown, TMeta extends object = any> = {
22
22
  name: string;
23
23
  type: 'parser';
24
24
  /**
@@ -29,9 +29,9 @@ type Parser<TOptions = unknown, TMeta$1 extends object = any> = {
29
29
  /**
30
30
  * Convert a file to string
31
31
  */
32
- parse(file: ResolvedFile<TMeta$1>, options: PrintOptions): Promise<string>;
32
+ parse(file: ResolvedFile<TMeta>, options: PrintOptions): Promise<string>;
33
33
  };
34
- type UserParser<TOptions = unknown, TMeta$1 extends object = any> = Omit<Parser<TOptions, TMeta$1>, 'type'>;
34
+ type UserParser<TOptions = unknown, TMeta extends object = any> = Omit<Parser<TOptions, TMeta>, 'type'>;
35
35
  //#endregion
36
36
  //#region ../fabric-core/src/utils/AsyncEventEmitter.d.ts
37
37
  declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
@@ -52,18 +52,18 @@ type ProcessFilesProps = {
52
52
  /**
53
53
  * @default 'sequential'
54
54
  */
55
- mode?: AppMode;
55
+ mode?: FabricMode;
56
56
  };
57
57
  type GetParseOptions = {
58
58
  parsers?: Set<Parser>;
59
59
  extension?: Record<Extname, Extname | ''>;
60
60
  };
61
61
  type Options$1 = {
62
- events?: AsyncEventEmitter<AppEvents>;
62
+ events?: AsyncEventEmitter<FabricEvents>;
63
63
  };
64
64
  declare class FileProcessor {
65
65
  #private;
66
- events: AsyncEventEmitter<AppEvents>;
66
+ events: AsyncEventEmitter<FabricEvents>;
67
67
  constructor({
68
68
  events
69
69
  }?: Options$1);
@@ -81,11 +81,11 @@ declare class FileProcessor {
81
81
  //#endregion
82
82
  //#region ../fabric-core/src/FileManager.d.ts
83
83
  type Options = {
84
- events?: AsyncEventEmitter<AppEvents>;
84
+ events?: AsyncEventEmitter<FabricEvents>;
85
85
  };
86
86
  declare class FileManager {
87
87
  #private;
88
- events: AsyncEventEmitter<AppEvents>;
88
+ events: AsyncEventEmitter<FabricEvents>;
89
89
  processor: FileProcessor;
90
90
  constructor({
91
91
  events
@@ -99,19 +99,19 @@ declare class FileManager {
99
99
  write(options: ProcessFilesProps): Promise<ResolvedFile[]>;
100
100
  }
101
101
  //#endregion
102
- //#region ../fabric-core/src/App.d.ts
102
+ //#region ../fabric-core/src/Fabric.d.ts
103
103
  declare global {
104
104
  namespace Kubb {
105
- interface App {}
105
+ interface Fabric {}
106
106
  }
107
107
  }
108
- type AppOptions = {
108
+ type FabricOptions = {
109
109
  /**
110
110
  * @default 'sequential'
111
111
  */
112
- mode?: AppMode;
112
+ mode?: FabricMode;
113
113
  };
114
- type AppEvents = {
114
+ type FabricEvents = {
115
115
  /**
116
116
  * Called in the beginning of the app lifecycle.
117
117
  */
@@ -124,7 +124,7 @@ type AppEvents = {
124
124
  * Called when being rendered
125
125
  */
126
126
  render: [{
127
- app: App;
127
+ fabric: Fabric;
128
128
  }];
129
129
  /**
130
130
  * Called once before processing any files.
@@ -178,23 +178,23 @@ type AppEvents = {
178
178
  files: ResolvedFile[];
179
179
  }];
180
180
  };
181
- type AppContext<TOptions extends AppOptions> = {
181
+ type FabricContext<TOptions extends FabricOptions> = {
182
182
  options?: TOptions;
183
- events: AsyncEventEmitter<AppEvents>;
183
+ events: AsyncEventEmitter<FabricEvents>;
184
184
  fileManager: FileManager;
185
185
  installedPlugins: Set<Plugin>;
186
186
  installedParsers: Set<Parser>;
187
187
  };
188
- type AppMode = 'sequential' | 'parallel';
188
+ type FabricMode = 'sequential' | 'parallel';
189
189
  type AllOptional<T> = {} extends T ? true : false;
190
- type Install<TOptions = unknown> = TOptions extends any[] ? (app: App, ...options: TOptions) => void | Promise<void> : AllOptional<TOptions> extends true ? (app: App, options: TOptions | undefined) => void | Promise<void> : (app: App, options: TOptions) => void | Promise<void>;
191
- type Inject<TOptions = unknown, TAppExtension$1 extends Record<string, any> = {}> = TOptions extends any[] ? (app: App, ...options: TOptions) => Partial<TAppExtension$1> : AllOptional<TOptions> extends true ? (app: App, options: TOptions | undefined) => Partial<TAppExtension$1> : (app: App, options: TOptions) => Partial<TAppExtension$1>;
192
- interface App<TOptions extends AppOptions = AppOptions> extends Kubb.App {
193
- context: AppContext<TOptions>;
190
+ type Install<TOptions = unknown> = TOptions extends any[] ? (app: Fabric, ...options: TOptions) => void | Promise<void> : AllOptional<TOptions> extends true ? (app: Fabric, options: TOptions | undefined) => void | Promise<void> : (app: Fabric, options: TOptions) => void | Promise<void>;
191
+ type Inject<TOptions = unknown, TAppExtension extends Record<string, any> = {}> = TOptions extends any[] ? (app: Fabric, ...options: TOptions) => Partial<TAppExtension> : AllOptional<TOptions> extends true ? (app: Fabric, options: TOptions | undefined) => Partial<TAppExtension> : (app: Fabric, options: TOptions) => Partial<TAppExtension>;
192
+ interface Fabric<TOptions extends FabricOptions = FabricOptions> extends Kubb.Fabric {
193
+ context: FabricContext<TOptions>;
194
194
  files: Array<ResolvedFile>;
195
195
  use<TPluginOptions = unknown, TMeta extends object = object, TAppExtension extends Record<string, any> = {}>(pluginOrParser: Plugin<TPluginOptions, TAppExtension> | Parser<TPluginOptions, TMeta>, ...options: TPluginOptions extends any[] ? NoInfer<TPluginOptions> : AllOptional<TPluginOptions> extends true ? [NoInfer<TPluginOptions>?] : [NoInfer<TPluginOptions>]): (this & TAppExtension) | Promise<this & TAppExtension>;
196
196
  addFile(...files: Array<File>): Promise<void>;
197
197
  }
198
198
  //#endregion
199
- export { UserParser as a, Parser as i, AppOptions as n, Plugin as o, FileManager as r, UserPlugin as s, App as t };
200
- //# sourceMappingURL=App-D7ehObix.d.ts.map
199
+ export { Parser as a, UserPlugin as c, FileManager as i, FabricMode as n, UserParser as o, FabricOptions as r, Plugin as s, Fabric as t };
200
+ //# sourceMappingURL=Fabric-nxgJyzWH.d.cts.map
@@ -1,7 +1,7 @@
1
- import { i as File, o as Path, r as Extname, s as ResolvedFile } from "./KubbFile-FGXV713i.cjs";
1
+ import { i as File, o as Path, r as Extname, s as ResolvedFile } from "./KubbFile-DFnA3mmn.js";
2
2
 
3
3
  //#region ../fabric-core/src/plugins/types.d.ts
4
- type Plugin<TOptions = unknown, TAppExtension$1 extends Record<string, any> = {}> = {
4
+ type Plugin<TOptions = unknown, TAppExtension extends Record<string, any> = {}> = {
5
5
  name: string;
6
6
  type: 'plugin';
7
7
  install: Install<TOptions>;
@@ -10,15 +10,15 @@ type Plugin<TOptions = unknown, TAppExtension$1 extends Record<string, any> = {}
10
10
  * Merged into the app instance after install.
11
11
  * This cannot be async
12
12
  */
13
- inject?: Inject<TOptions, TAppExtension$1>;
13
+ inject?: Inject<TOptions, TAppExtension>;
14
14
  };
15
- type UserPlugin<TOptions = unknown, TAppExtension$1 extends Record<string, any> = {}> = Omit<Plugin<TOptions, TAppExtension$1>, 'type'>;
15
+ type UserPlugin<TOptions = unknown, TAppExtension extends Record<string, any> = {}> = Omit<Plugin<TOptions, TAppExtension>, 'type'>;
16
16
  //#endregion
17
17
  //#region ../fabric-core/src/parsers/types.d.ts
18
18
  type PrintOptions = {
19
19
  extname?: Extname;
20
20
  };
21
- type Parser<TOptions = unknown, TMeta$1 extends object = any> = {
21
+ type Parser<TOptions = unknown, TMeta extends object = any> = {
22
22
  name: string;
23
23
  type: 'parser';
24
24
  /**
@@ -29,9 +29,9 @@ type Parser<TOptions = unknown, TMeta$1 extends object = any> = {
29
29
  /**
30
30
  * Convert a file to string
31
31
  */
32
- parse(file: ResolvedFile<TMeta$1>, options: PrintOptions): Promise<string>;
32
+ parse(file: ResolvedFile<TMeta>, options: PrintOptions): Promise<string>;
33
33
  };
34
- type UserParser<TOptions = unknown, TMeta$1 extends object = any> = Omit<Parser<TOptions, TMeta$1>, 'type'>;
34
+ type UserParser<TOptions = unknown, TMeta extends object = any> = Omit<Parser<TOptions, TMeta>, 'type'>;
35
35
  //#endregion
36
36
  //#region ../fabric-core/src/utils/AsyncEventEmitter.d.ts
37
37
  declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
@@ -52,18 +52,18 @@ type ProcessFilesProps = {
52
52
  /**
53
53
  * @default 'sequential'
54
54
  */
55
- mode?: AppMode;
55
+ mode?: FabricMode;
56
56
  };
57
57
  type GetParseOptions = {
58
58
  parsers?: Set<Parser>;
59
59
  extension?: Record<Extname, Extname | ''>;
60
60
  };
61
61
  type Options$1 = {
62
- events?: AsyncEventEmitter<AppEvents>;
62
+ events?: AsyncEventEmitter<FabricEvents>;
63
63
  };
64
64
  declare class FileProcessor {
65
65
  #private;
66
- events: AsyncEventEmitter<AppEvents>;
66
+ events: AsyncEventEmitter<FabricEvents>;
67
67
  constructor({
68
68
  events
69
69
  }?: Options$1);
@@ -81,11 +81,11 @@ declare class FileProcessor {
81
81
  //#endregion
82
82
  //#region ../fabric-core/src/FileManager.d.ts
83
83
  type Options = {
84
- events?: AsyncEventEmitter<AppEvents>;
84
+ events?: AsyncEventEmitter<FabricEvents>;
85
85
  };
86
86
  declare class FileManager {
87
87
  #private;
88
- events: AsyncEventEmitter<AppEvents>;
88
+ events: AsyncEventEmitter<FabricEvents>;
89
89
  processor: FileProcessor;
90
90
  constructor({
91
91
  events
@@ -99,19 +99,19 @@ declare class FileManager {
99
99
  write(options: ProcessFilesProps): Promise<ResolvedFile[]>;
100
100
  }
101
101
  //#endregion
102
- //#region ../fabric-core/src/App.d.ts
102
+ //#region ../fabric-core/src/Fabric.d.ts
103
103
  declare global {
104
104
  namespace Kubb {
105
- interface App {}
105
+ interface Fabric {}
106
106
  }
107
107
  }
108
- type AppOptions = {
108
+ type FabricOptions = {
109
109
  /**
110
110
  * @default 'sequential'
111
111
  */
112
- mode?: AppMode;
112
+ mode?: FabricMode;
113
113
  };
114
- type AppEvents = {
114
+ type FabricEvents = {
115
115
  /**
116
116
  * Called in the beginning of the app lifecycle.
117
117
  */
@@ -124,7 +124,7 @@ type AppEvents = {
124
124
  * Called when being rendered
125
125
  */
126
126
  render: [{
127
- app: App;
127
+ fabric: Fabric;
128
128
  }];
129
129
  /**
130
130
  * Called once before processing any files.
@@ -178,23 +178,23 @@ type AppEvents = {
178
178
  files: ResolvedFile[];
179
179
  }];
180
180
  };
181
- type AppContext<TOptions extends AppOptions> = {
181
+ type FabricContext<TOptions extends FabricOptions> = {
182
182
  options?: TOptions;
183
- events: AsyncEventEmitter<AppEvents>;
183
+ events: AsyncEventEmitter<FabricEvents>;
184
184
  fileManager: FileManager;
185
185
  installedPlugins: Set<Plugin>;
186
186
  installedParsers: Set<Parser>;
187
187
  };
188
- type AppMode = 'sequential' | 'parallel';
188
+ type FabricMode = 'sequential' | 'parallel';
189
189
  type AllOptional<T> = {} extends T ? true : false;
190
- type Install<TOptions = unknown> = TOptions extends any[] ? (app: App, ...options: TOptions) => void | Promise<void> : AllOptional<TOptions> extends true ? (app: App, options: TOptions | undefined) => void | Promise<void> : (app: App, options: TOptions) => void | Promise<void>;
191
- type Inject<TOptions = unknown, TAppExtension$1 extends Record<string, any> = {}> = TOptions extends any[] ? (app: App, ...options: TOptions) => Partial<TAppExtension$1> : AllOptional<TOptions> extends true ? (app: App, options: TOptions | undefined) => Partial<TAppExtension$1> : (app: App, options: TOptions) => Partial<TAppExtension$1>;
192
- interface App<TOptions extends AppOptions = AppOptions> extends Kubb.App {
193
- context: AppContext<TOptions>;
190
+ type Install<TOptions = unknown> = TOptions extends any[] ? (app: Fabric, ...options: TOptions) => void | Promise<void> : AllOptional<TOptions> extends true ? (app: Fabric, options: TOptions | undefined) => void | Promise<void> : (app: Fabric, options: TOptions) => void | Promise<void>;
191
+ type Inject<TOptions = unknown, TAppExtension extends Record<string, any> = {}> = TOptions extends any[] ? (app: Fabric, ...options: TOptions) => Partial<TAppExtension> : AllOptional<TOptions> extends true ? (app: Fabric, options: TOptions | undefined) => Partial<TAppExtension> : (app: Fabric, options: TOptions) => Partial<TAppExtension>;
192
+ interface Fabric<TOptions extends FabricOptions = FabricOptions> extends Kubb.Fabric {
193
+ context: FabricContext<TOptions>;
194
194
  files: Array<ResolvedFile>;
195
195
  use<TPluginOptions = unknown, TMeta extends object = object, TAppExtension extends Record<string, any> = {}>(pluginOrParser: Plugin<TPluginOptions, TAppExtension> | Parser<TPluginOptions, TMeta>, ...options: TPluginOptions extends any[] ? NoInfer<TPluginOptions> : AllOptional<TPluginOptions> extends true ? [NoInfer<TPluginOptions>?] : [NoInfer<TPluginOptions>]): (this & TAppExtension) | Promise<this & TAppExtension>;
196
196
  addFile(...files: Array<File>): Promise<void>;
197
197
  }
198
198
  //#endregion
199
- export { UserParser as a, Parser as i, AppOptions as n, Plugin as o, FileManager as r, UserPlugin as s, App as t };
200
- //# sourceMappingURL=App-CbT7rbmH.d.cts.map
199
+ export { Parser as a, UserPlugin as c, FileManager as i, FabricMode as n, UserParser as o, FabricOptions as r, Plugin as s, Fabric as t };
200
+ //# sourceMappingURL=Fabric-tVWTpMR5.d.ts.map
@@ -112,4 +112,4 @@ type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
112
112
  };
113
113
  //#endregion
114
114
  export { Import as a, Source as c, File as i, Export as n, Path as o, Extname as r, ResolvedFile as s, BaseName as t };
115
- //# sourceMappingURL=KubbFile-D4gyyfL-.d.ts.map
115
+ //# sourceMappingURL=KubbFile-DFnA3mmn.d.ts.map
@@ -112,4 +112,4 @@ type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
112
112
  };
113
113
  //#endregion
114
114
  export { Import as a, Source as c, File as i, Export as n, Path as o, Extname as r, ResolvedFile as s, BaseName as t };
115
- //# sourceMappingURL=KubbFile-FGXV713i.d.cts.map
115
+ //# sourceMappingURL=KubbFile-DHCtBOpy.d.cts.map
@@ -0,0 +1,27 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
13
+ key = keys[i];
14
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
+ get: ((k) => from[k]).bind(null, key),
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
22
+ value: mod,
23
+ enumerable: true
24
+ }) : target, mod));
25
+
26
+ //#endregion
27
+ export { __toESM as n, __commonJS as t };
@@ -0,0 +1,39 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
13
+ key = keys[i];
14
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
+ get: ((k) => from[k]).bind(null, key),
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
22
+ value: mod,
23
+ enumerable: true
24
+ }) : target, mod));
25
+
26
+ //#endregion
27
+
28
+ Object.defineProperty(exports, '__commonJS', {
29
+ enumerable: true,
30
+ get: function () {
31
+ return __commonJS;
32
+ }
33
+ });
34
+ Object.defineProperty(exports, '__toESM', {
35
+ enumerable: true,
36
+ get: function () {
37
+ return __toESM;
38
+ }
39
+ });