@kubb/react-fabric 0.5.3 → 0.5.5

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 (52) hide show
  1. package/README.md +21 -24
  2. package/dist/{Fabric-C7RMr4BK.d.ts → Fabric-D-A981Bs.d.ts} +24 -25
  3. package/dist/{Fabric-CStIaz99.d.cts → Fabric-xy241PKd.d.cts} +24 -25
  4. package/dist/{chunk-BHcwYQRN.js → chunk-B1nHLT4p.js} +2 -7
  5. package/dist/{chunk-DSlc6foC.cjs → chunk-BrXtsOCC.cjs} +3 -5
  6. package/dist/{devtools-DRXCsX9I.cjs → devtools-CRkwwngz.cjs} +2 -2
  7. package/dist/{devtools-DRXCsX9I.cjs.map → devtools-CRkwwngz.cjs.map} +1 -1
  8. package/dist/devtools.cjs +1 -1
  9. package/dist/globals.d.cts +2 -2
  10. package/dist/globals.d.ts +2 -2
  11. package/dist/index.cjs +5 -5
  12. package/dist/index.d.cts +31 -45
  13. package/dist/index.d.ts +10 -24
  14. package/dist/index.js +4 -4
  15. package/dist/jsx-dev-runtime.cjs +11 -11
  16. package/dist/jsx-dev-runtime.cjs.map +1 -1
  17. package/dist/jsx-dev-runtime.d.cts +5 -5
  18. package/dist/jsx-dev-runtime.d.ts +5 -5
  19. package/dist/jsx-dev-runtime.js +11 -11
  20. package/dist/jsx-dev-runtime.js.map +1 -1
  21. package/dist/{jsx-namespace-BLxjMbms.d.ts → jsx-namespace-CEeBVrTq.d.ts} +2 -2
  22. package/dist/{jsx-namespace-DLxNuglH.d.cts → jsx-namespace-DawWRiRq.d.cts} +2 -2
  23. package/dist/{jsx-runtime-cR2hscK9.cjs → jsx-runtime-DqTOrEsT.cjs} +12 -12
  24. package/dist/{jsx-runtime-cR2hscK9.cjs.map → jsx-runtime-DqTOrEsT.cjs.map} +1 -1
  25. package/dist/{jsx-runtime-DT7hOgNn.js → jsx-runtime-zJCtyvtC.js} +12 -12
  26. package/dist/{jsx-runtime-DT7hOgNn.js.map → jsx-runtime-zJCtyvtC.js.map} +1 -1
  27. package/dist/jsx-runtime.cjs +2 -2
  28. package/dist/jsx-runtime.d.cts +5 -5
  29. package/dist/jsx-runtime.d.ts +5 -5
  30. package/dist/jsx-runtime.js +2 -2
  31. package/dist/parsers.d.cts +5 -5
  32. package/dist/parsers.d.ts +5 -5
  33. package/dist/plugins.cjs +3 -3
  34. package/dist/plugins.d.cts +5 -5
  35. package/dist/plugins.d.ts +5 -5
  36. package/dist/plugins.js +3 -3
  37. package/dist/{react-Czh2e85z.js → react-B97TdWcV.js} +17 -17
  38. package/dist/{react-Czh2e85z.js.map → react-B97TdWcV.js.map} +1 -1
  39. package/dist/{react-DNGR2CL5.cjs → react-D_EYlsv-.cjs} +17 -17
  40. package/dist/{react-DNGR2CL5.cjs.map → react-D_EYlsv-.cjs.map} +1 -1
  41. package/dist/{reactPlugin-Ct0yCk0a.cjs → reactPlugin-CpRWhf6R.cjs} +46 -46
  42. package/dist/{reactPlugin-Ct0yCk0a.cjs.map → reactPlugin-CpRWhf6R.cjs.map} +1 -1
  43. package/dist/{reactPlugin-DajNNKBt.d.cts → reactPlugin-CrCzxP4y.d.cts} +2 -2
  44. package/dist/{reactPlugin-TmG3R6xY.d.ts → reactPlugin-Iyi8Falf.d.ts} +2 -2
  45. package/dist/{reactPlugin-CjsXM659.js → reactPlugin-PG1kqZRe.js} +47 -47
  46. package/dist/{reactPlugin-CjsXM659.js.map → reactPlugin-PG1kqZRe.js.map} +1 -1
  47. package/dist/{types-KXnjAqUg.d.ts → types-BjJ5OLXP.d.ts} +2 -2
  48. package/dist/{types-BZlZnQLJ.d.cts → types-WtAhPPHc.d.cts} +2 -2
  49. package/dist/types.d.cts +2 -2
  50. package/dist/types.d.ts +2 -2
  51. package/package.json +4 -4
  52. package/src/plugins/reactPlugin.ts +5 -5
package/README.md CHANGED
@@ -82,26 +82,23 @@ Returns a Fabric instance with:
82
82
  - `fabric.files` — getter with all queued files.
83
83
  - `fabric.context` — internal context holding events, options, FileManager, installed plugins/parsers.
84
84
 
85
- ### `defineFabric(instance?): () => Fabric`
86
- Factory to create your own `createFabric` with an optional bootstrap `instance(fabric)` called on creation.
87
-
88
85
  ### Events (emitted by the core during processing)
89
- - `start`
90
- - `end`
91
- - `render { fabric }`
92
- - `file:add { files }`
93
- - `write:start { files }`
94
- - `write:end { files }`
95
- - `file:start { file, index, total }`
96
- - `file:end { file, index, total }`
97
- - `process:start { files }`
98
- - `process:progress { file, source, processed, percentage, total }`
99
- - `process:end { files }`
86
+ - `lifecycle:start`
87
+ - `lifecycle:end`
88
+ - `lifecycle:render { fabric }`
89
+ - `files:added { files }`
90
+ - `files:writing:start { files }`
91
+ - `files:writing:end { files }`
92
+ - `file:processing:start { file, index, total }`
93
+ - `file:processing:end { file, index, total }`
94
+ - `files:processing:start { files }`
95
+ - `files:processing:update { file, source, processed, percentage, total }`
96
+ - `files:processing:end { files }`
100
97
 
101
98
 
102
99
  ## Plugins
103
100
  #### `fsPlugin`
104
- Writes files to disk on `process:progress`, supports dry runs and cleaning an output folder before writing.
101
+ Writes files to disk on `files:processing:update`, supports dry runs and cleaning an output folder before writing.
105
102
 
106
103
  ```
107
104
  import { fsPlugin } from '@kubb/fabric-core/plugins'
@@ -110,7 +107,7 @@ import { fsPlugin } from '@kubb/fabric-core/plugins'
110
107
  | Option | Type | Default | Description |
111
108
  |---|----------------------------------------------------------------------|---|-----------------------------------------------------------------------|
112
109
  | dryRun | `boolean` | `false` | If true, do not write files to disk. |
113
- | onBeforeWrite | `(path: string, data: string \| undefined) => void \| Promise<void>` | — | Called right before each file write on `process:progress`. |
110
+ | onBeforeWrite | `(path: string, data: string \| undefined) => void \| Promise<void>` | — | Called right before each file write on `files:processing:update`. |
114
111
  | clean | `{ path: string }` | — | If provided, removes the directory at `path` before writing any files. |
115
112
 
116
113
  Injected `fabric.write` options (via `fsPlugin`):
@@ -120,7 +117,7 @@ Injected `fabric.write` options (via `fsPlugin`):
120
117
  | extension | `Record<Extname, Extname \| ''>` | — | Maps input file extensions to output extensions. When set, the matching parser (by extNames) is used. |
121
118
 
122
119
  #### `barrelPlugin`
123
- Generates `index.ts` barrel files per folder at `process:end`. `writeEntry` creates a single entry barrel at `root`.
120
+ Generates `index.ts` barrel files per folder when `files:writing:start` is triggered. `writeEntry` creates a single entry barrel at `root`.
124
121
 
125
122
  ```
126
123
  import { barrelPlugin } from '@kubb/fabric-core/plugins'
@@ -190,7 +187,7 @@ Injected methods (via `reactPlugin`):
190
187
  | `renderToString` | `(App: React.ElementType) => Promise<string> \| string` | Render a React component tree and return the final output as a string (without writing to stdout). |
191
188
  | `waitUntilExit` | `() => Promise<void>` | Wait until the rendered app exits, resolves when unmounted and emits the core `end` event. |
192
189
 
193
- #### `createPlugin`
190
+ #### `definePlugin`
194
191
 
195
192
  Factory to declare a plugin that can be registered via `fabric.use`.
196
193
 
@@ -204,12 +201,12 @@ Example:
204
201
 
205
202
  ```ts
206
203
  import { createFabric } from '@kubb/fabric-core'
207
- import { createPlugin } from '@kubb/fabric-core/plugins'
204
+ import { definePlugin } from '@kubb/fabric-core/plugins'
208
205
 
209
- const helloPlugin = createPlugin<{ name?: string }, { sayHello: (msg?: string) => void }>({
206
+ const helloPlugin = definePlugin<{ name?: string }, { sayHello: (msg?: string) => void }>({
210
207
  name: 'helloPlugin',
211
208
  install(fabric, options) {
212
- fabric.context.events.on('start', () => {
209
+ fabric.context.events.on('lifecycle:start', () => {
213
210
  console.log('Fabric started')
214
211
  })
215
212
  },
@@ -266,7 +263,7 @@ import { defaultParser } @kubb/fabric-core/parsers`
266
263
  |---|---|---|--------------------------------------------------------------------------|
267
264
  | file | `KubbFile.File` | -| File that will be used to be parsed. |
268
265
 
269
- #### `createParser`
266
+ #### `defineParser`
270
267
  Factory to declare a parser that can be registered via `fabric.use` and selected by `extNames` during `fabirc.write`.
271
268
 
272
269
  | Field | Required | Description |
@@ -280,9 +277,9 @@ Example:
280
277
 
281
278
  ```ts
282
279
  import { createFabric } from '@kubb/fabric-core'
283
- import { createParser } from '@kubb/fabric-core/parsers'
280
+ import { defineParser } from '@kubb/fabric-core/parsers'
284
281
 
285
- const vueParser = createParser<{ banner?: string }>({
282
+ const vueParser = defineParser<{ banner?: string }>({
286
283
  name: 'vueParser',
287
284
  extNames: ['.vue'],
288
285
  async install(fabric, options) {
@@ -254,52 +254,51 @@ type FabricMode = 'sequential' | 'parallel';
254
254
  */
255
255
  interface FabricEvents {
256
256
  /** Called at the beginning of the app lifecycle. */
257
- start: [];
257
+ 'lifecycle:start': [];
258
258
  /** Called at the end of the app lifecycle. */
259
- end: [];
260
- /** Called when Fabric is rendering. */
261
- render: [{
259
+ 'lifecycle:end': [];
260
+ /** Called when Fabric is rendering. Provides the Fabric instance. */
261
+ 'lifecycle:render': [{
262
262
  fabric: Fabric;
263
263
  }];
264
- /** Called once before any files are processed. */
265
- 'process:start': [{
264
+ /** Called once before any files are processed. Provides all files that will be processed. */
265
+ 'files:processing:start': [{
266
266
  files: ResolvedFile[];
267
267
  }];
268
- /**
269
- * Called when FileManager is adding files to its cache
270
- */
271
- 'file:add': [{
268
+ /** Called when FileManager is adding files to its cache. */
269
+ 'files:added': [{
272
270
  files: ResolvedFile[];
273
271
  }];
274
- 'file:resolve:path': [{
272
+ /** Called when resolving a file's path. Allows modification of the file path. */
273
+ 'file:path:resolving': [{
275
274
  file: File;
276
275
  }];
277
- 'file:resolve:name': [{
276
+ /** Called when resolving a file's name. Allows modification of the file name. */
277
+ 'file:name:resolving': [{
278
278
  file: File;
279
279
  }];
280
- 'write:start': [{
280
+ /** Called before writing files to disk. Provides all files that will be written. */
281
+ 'files:writing:start': [{
281
282
  files: ResolvedFile[];
282
283
  }];
283
- 'write:end': [{
284
+ /** Called after writing files to disk. Provides all files that were written. */
285
+ 'files:writing:end': [{
284
286
  files: ResolvedFile[];
285
287
  }];
286
- /** Called for each file when processing begins. */
287
- 'file:start': [{
288
+ /** Called when processing of an individual file begins. Provides file, current index, and total count. */
289
+ 'file:processing:start': [{
288
290
  file: ResolvedFile;
289
291
  index: number;
290
292
  total: number;
291
293
  }];
292
- /** Called for each file when processing completes. */
293
- 'file:end': [{
294
+ /** Called when processing of an individual file completes. Provides file, current index, and total count. */
295
+ 'file:processing:end': [{
294
296
  file: ResolvedFile;
295
297
  index: number;
296
298
  total: number;
297
299
  }];
298
- /**
299
- * Called periodically (or per file) to indicate progress.
300
- * Useful for progress bars or logging.
301
- */
302
- 'process:progress': [{
300
+ /** Called periodically to indicate processing progress. Useful for progress bars or logging. */
301
+ 'files:processing:update': [{
303
302
  processed: number;
304
303
  total: number;
305
304
  percentage: number;
@@ -307,7 +306,7 @@ interface FabricEvents {
307
306
  file: ResolvedFile;
308
307
  }];
309
308
  /** Called once all files have been processed successfully. */
310
- 'process:end': [{
309
+ 'files:processing:end': [{
311
310
  files: ResolvedFile[];
312
311
  }];
313
312
  }
@@ -372,4 +371,4 @@ interface Fabric<T extends FabricOptions = FabricOptions> extends Kubb.Fabric {
372
371
  }
373
372
  //#endregion
374
373
  export { KubbFile_d_exports as _, FabricOptions as a, Source as b, FileManager as c, UserParser as d, BaseName as f, Import as g, File as h, FabricMode as i, FileProcessor as l, Extname as m, FabricConfig as n, Plugin as o, Export as p, FabricContext as r, UserPlugin as s, Fabric as t, Parser as u, Path as v, ResolvedFile as y };
375
- //# sourceMappingURL=Fabric-C7RMr4BK.d.ts.map
374
+ //# sourceMappingURL=Fabric-D-A981Bs.d.ts.map
@@ -254,52 +254,51 @@ type FabricMode = 'sequential' | 'parallel';
254
254
  */
255
255
  interface FabricEvents {
256
256
  /** Called at the beginning of the app lifecycle. */
257
- start: [];
257
+ 'lifecycle:start': [];
258
258
  /** Called at the end of the app lifecycle. */
259
- end: [];
260
- /** Called when Fabric is rendering. */
261
- render: [{
259
+ 'lifecycle:end': [];
260
+ /** Called when Fabric is rendering. Provides the Fabric instance. */
261
+ 'lifecycle:render': [{
262
262
  fabric: Fabric;
263
263
  }];
264
- /** Called once before any files are processed. */
265
- 'process:start': [{
264
+ /** Called once before any files are processed. Provides all files that will be processed. */
265
+ 'files:processing:start': [{
266
266
  files: ResolvedFile[];
267
267
  }];
268
- /**
269
- * Called when FileManager is adding files to its cache
270
- */
271
- 'file:add': [{
268
+ /** Called when FileManager is adding files to its cache. */
269
+ 'files:added': [{
272
270
  files: ResolvedFile[];
273
271
  }];
274
- 'file:resolve:path': [{
272
+ /** Called when resolving a file's path. Allows modification of the file path. */
273
+ 'file:path:resolving': [{
275
274
  file: File;
276
275
  }];
277
- 'file:resolve:name': [{
276
+ /** Called when resolving a file's name. Allows modification of the file name. */
277
+ 'file:name:resolving': [{
278
278
  file: File;
279
279
  }];
280
- 'write:start': [{
280
+ /** Called before writing files to disk. Provides all files that will be written. */
281
+ 'files:writing:start': [{
281
282
  files: ResolvedFile[];
282
283
  }];
283
- 'write:end': [{
284
+ /** Called after writing files to disk. Provides all files that were written. */
285
+ 'files:writing:end': [{
284
286
  files: ResolvedFile[];
285
287
  }];
286
- /** Called for each file when processing begins. */
287
- 'file:start': [{
288
+ /** Called when processing of an individual file begins. Provides file, current index, and total count. */
289
+ 'file:processing:start': [{
288
290
  file: ResolvedFile;
289
291
  index: number;
290
292
  total: number;
291
293
  }];
292
- /** Called for each file when processing completes. */
293
- 'file:end': [{
294
+ /** Called when processing of an individual file completes. Provides file, current index, and total count. */
295
+ 'file:processing:end': [{
294
296
  file: ResolvedFile;
295
297
  index: number;
296
298
  total: number;
297
299
  }];
298
- /**
299
- * Called periodically (or per file) to indicate progress.
300
- * Useful for progress bars or logging.
301
- */
302
- 'process:progress': [{
300
+ /** Called periodically to indicate processing progress. Useful for progress bars or logging. */
301
+ 'files:processing:update': [{
303
302
  processed: number;
304
303
  total: number;
305
304
  percentage: number;
@@ -307,7 +306,7 @@ interface FabricEvents {
307
306
  file: ResolvedFile;
308
307
  }];
309
308
  /** Called once all files have been processed successfully. */
310
- 'process:end': [{
309
+ 'files:processing:end': [{
311
310
  files: ResolvedFile[];
312
311
  }];
313
312
  }
@@ -372,4 +371,4 @@ interface Fabric<T extends FabricOptions = FabricOptions> extends Kubb.Fabric {
372
371
  }
373
372
  //#endregion
374
373
  export { KubbFile_d_exports as _, FabricOptions as a, Source as b, FileManager as c, UserParser as d, BaseName as f, Import as g, File as h, FabricMode as i, FileProcessor as l, Extname as m, FabricConfig as n, Plugin as o, Export as p, FabricContext as r, UserPlugin as s, Fabric as t, Parser as u, Path as v, ResolvedFile as y };
375
- //# sourceMappingURL=Fabric-CStIaz99.d.cts.map
374
+ //# sourceMappingURL=Fabric-xy241PKd.d.cts.map
@@ -1,5 +1,3 @@
1
- import { createRequire } from "node:module";
2
-
3
1
  //#region rolldown:runtime
4
2
  var __create = Object.create;
5
3
  var __defProp = Object.defineProperty;
@@ -7,9 +5,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
6
  var __getProtoOf = Object.getPrototypeOf;
9
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __commonJS = (cb, mod) => function() {
11
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
- };
8
+ var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
13
9
  var __export = (all, symbols) => {
14
10
  let target = {};
15
11
  for (var name in all) {
@@ -41,7 +37,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
41
37
  value: mod,
42
38
  enumerable: true
43
39
  }) : target, mod));
44
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
45
40
 
46
41
  //#endregion
47
- export { __export as n, __toESM as r, __commonJS as t };
42
+ export { __export as n, __toESM as r, __commonJSMin as t };
@@ -5,9 +5,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
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
- };
8
+ var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
11
9
  var __copyProps = (to, from, except, desc) => {
12
10
  if (from && typeof from === "object" || typeof from === "function") {
13
11
  for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
@@ -29,10 +27,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
27
 
30
28
  //#endregion
31
29
 
32
- Object.defineProperty(exports, '__commonJS', {
30
+ Object.defineProperty(exports, '__commonJSMin', {
33
31
  enumerable: true,
34
32
  get: function () {
35
- return __commonJS;
33
+ return __commonJSMin;
36
34
  }
37
35
  });
38
36
  Object.defineProperty(exports, '__toESM', {
@@ -1,4 +1,4 @@
1
- const require_chunk = require('./chunk-DSlc6foC.cjs');
1
+ const require_chunk = require('./chunk-BrXtsOCC.cjs');
2
2
  let execa = require("execa");
3
3
  let signal_exit = require("signal-exit");
4
4
  let ws = require("ws");
@@ -97,4 +97,4 @@ Object.defineProperty(exports, 'open', {
97
97
  return open;
98
98
  }
99
99
  });
100
- //# sourceMappingURL=devtools-DRXCsX9I.cjs.map
100
+ //# sourceMappingURL=devtools-CRkwwngz.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"devtools-DRXCsX9I.cjs","names":[],"sources":["../src/devtools.ts"],"sourcesContent":["import { execa } from 'execa'\nimport { onExit } from 'signal-exit'\nimport ws from 'ws'\n\ndeclare global {\n var WebSocket: typeof WebSocket\n var self: any\n var window: any\n var isDevtoolsEnabled: any\n}\n\nexport function open() {\n // biome-ignore lint/suspicious/noTsIgnore: cannot find types\n // @ts-ignore\n import('react-devtools-core').then((devtools) => {\n // Filter out Kubbs's internal components from devtools for a cleaner view.\n // See https://github.com/facebook/react/blob/edf6eac8a181860fd8a2d076a43806f1237495a1/packages/react-devtools-shared/src/types.js#L24\n const customGlobal = global as any\n customGlobal.WebSocket ||= ws\n customGlobal.window ||= global\n customGlobal.self ||= global\n customGlobal.isDevtoolsEnabled = true\n customGlobal.window.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = [\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'Context.Provider',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'KubbRoot',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'KubbErrorBoundary',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'kubb-file',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'kubb-text',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'kubb-import',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'kubb-export',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'kubb-source',\n isEnabled: true,\n isValid: true,\n },\n ]\n\n console.info('Opening devtools')\n const controller = new AbortController()\n execa({\n stdio: 'pipe',\n preferLocal: true,\n cancelSignal: controller.signal,\n gracefulCancel: true,\n })`npx react-devtools`\n\n ;(devtools as any).initialize()\n console.info('Connecting devtools')\n\n try {\n ;(devtools as any).connectToDevTools({\n host: 'localhost',\n port: 8097,\n useHttps: false,\n isAppActive: () => true,\n })\n } catch (e) {\n console.error(e)\n console.info('Error when connecting the devtools')\n }\n\n onExit(\n () => {\n console.info('Disconnecting devtools')\n controller.abort()\n },\n { alwaysLast: false },\n )\n })\n}\n"],"mappings":";;;;;;;AAWA,SAAgB,OAAO;AAGrB,QAAO,uBAAuB,MAAM,aAAa;EAG/C,MAAM,eAAe;AACrB,eAAa,cAAb,aAAa,YAAc;AAC3B,eAAa,WAAb,aAAa,SAAW;AACxB,eAAa,SAAb,aAAa,OAAS;AACtB,eAAa,oBAAoB;AACjC,eAAa,OAAO,uCAAuC;GACzD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACF;AAED,UAAQ,KAAK,mBAAmB;EAChC,MAAM,aAAa,IAAI,iBAAiB;AACxC,mBAAM;GACJ,OAAO;GACP,aAAa;GACb,cAAc,WAAW;GACzB,gBAAgB;GACjB,CAAC;AAED,EAAC,SAAiB,YAAY;AAC/B,UAAQ,KAAK,sBAAsB;AAEnC,MAAI;AACD,GAAC,SAAiB,kBAAkB;IACnC,MAAM;IACN,MAAM;IACN,UAAU;IACV,mBAAmB;IACpB,CAAC;WACK,GAAG;AACV,WAAQ,MAAM,EAAE;AAChB,WAAQ,KAAK,qCAAqC;;AAGpD,gCACQ;AACJ,WAAQ,KAAK,yBAAyB;AACtC,cAAW,OAAO;KAEpB,EAAE,YAAY,OAAO,CACtB;GACD"}
1
+ {"version":3,"file":"devtools-CRkwwngz.cjs","names":[],"sources":["../src/devtools.ts"],"sourcesContent":["import { execa } from 'execa'\nimport { onExit } from 'signal-exit'\nimport ws from 'ws'\n\ndeclare global {\n var WebSocket: typeof WebSocket\n var self: any\n var window: any\n var isDevtoolsEnabled: any\n}\n\nexport function open() {\n // biome-ignore lint/suspicious/noTsIgnore: cannot find types\n // @ts-ignore\n import('react-devtools-core').then((devtools) => {\n // Filter out Kubbs's internal components from devtools for a cleaner view.\n // See https://github.com/facebook/react/blob/edf6eac8a181860fd8a2d076a43806f1237495a1/packages/react-devtools-shared/src/types.js#L24\n const customGlobal = global as any\n customGlobal.WebSocket ||= ws\n customGlobal.window ||= global\n customGlobal.self ||= global\n customGlobal.isDevtoolsEnabled = true\n customGlobal.window.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = [\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'Context.Provider',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'KubbRoot',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'KubbErrorBoundary',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'kubb-file',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'kubb-text',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'kubb-import',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'kubb-export',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'kubb-source',\n isEnabled: true,\n isValid: true,\n },\n ]\n\n console.info('Opening devtools')\n const controller = new AbortController()\n execa({\n stdio: 'pipe',\n preferLocal: true,\n cancelSignal: controller.signal,\n gracefulCancel: true,\n })`npx react-devtools`\n\n ;(devtools as any).initialize()\n console.info('Connecting devtools')\n\n try {\n ;(devtools as any).connectToDevTools({\n host: 'localhost',\n port: 8097,\n useHttps: false,\n isAppActive: () => true,\n })\n } catch (e) {\n console.error(e)\n console.info('Error when connecting the devtools')\n }\n\n onExit(\n () => {\n console.info('Disconnecting devtools')\n controller.abort()\n },\n { alwaysLast: false },\n )\n })\n}\n"],"mappings":";;;;;;;AAWA,SAAgB,OAAO;AAGrB,QAAO,uBAAuB,MAAM,aAAa;EAG/C,MAAM,eAAe;AACrB,eAAa,cAAb,aAAa,YAAc;AAC3B,eAAa,WAAb,aAAa,SAAW;AACxB,eAAa,SAAb,aAAa,OAAS;AACtB,eAAa,oBAAoB;AACjC,eAAa,OAAO,uCAAuC;GACzD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACF;AAED,UAAQ,KAAK,mBAAmB;EAChC,MAAM,aAAa,IAAI,iBAAiB;AACxC,mBAAM;GACJ,OAAO;GACP,aAAa;GACb,cAAc,WAAW;GACzB,gBAAgB;GACjB,CAAC;AAED,EAAC,SAAiB,YAAY;AAC/B,UAAQ,KAAK,sBAAsB;AAEnC,MAAI;AACD,GAAC,SAAiB,kBAAkB;IACnC,MAAM;IACN,MAAM;IACN,UAAU;IACV,mBAAmB;IACpB,CAAC;WACK,GAAG;AACV,WAAQ,MAAM,EAAE;AAChB,WAAQ,KAAK,qCAAqC;;AAGpD,gCACQ;AACJ,WAAQ,KAAK,yBAAyB;AACtC,cAAW,OAAO;KAEpB,EAAE,YAAY,OAAO,CACtB;GACD"}
package/dist/devtools.cjs CHANGED
@@ -1,3 +1,3 @@
1
- const require_devtools = require('./devtools-DRXCsX9I.cjs');
1
+ const require_devtools = require('./devtools-CRkwwngz.cjs');
2
2
 
3
3
  exports.open = require_devtools.open;
@@ -1,5 +1,5 @@
1
- import "./Fabric-CStIaz99.cjs";
2
- import { c as KubbExportProps, d as KubbNode, f as KubbSourceProps, l as KubbFileProps, m as LineBreakProps, p as KubbTextProps, s as KubbElement, u as KubbImportProps } from "./types-BZlZnQLJ.cjs";
1
+ import "./Fabric-xy241PKd.cjs";
2
+ import { c as KubbExportProps, d as KubbNode, f as KubbSourceProps, l as KubbFileProps, m as LineBreakProps, p as KubbTextProps, s as KubbElement, u as KubbImportProps } from "./types-WtAhPPHc.cjs";
3
3
  import React from "react";
4
4
 
5
5
  //#region src/globals.d.ts
package/dist/globals.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import "./Fabric-C7RMr4BK.js";
2
- import { c as KubbExportProps, d as KubbNode, f as KubbSourceProps, l as KubbFileProps, m as LineBreakProps, p as KubbTextProps, s as KubbElement, u as KubbImportProps } from "./types-KXnjAqUg.js";
1
+ import "./Fabric-D-A981Bs.js";
2
+ import { c as KubbExportProps, d as KubbNode, f as KubbSourceProps, l as KubbFileProps, m as LineBreakProps, p as KubbTextProps, s as KubbElement, u as KubbImportProps } from "./types-BjJ5OLXP.js";
3
3
  import React from "react";
4
4
 
5
5
  //#region src/globals.d.ts
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
- const require_chunk = require('./chunk-DSlc6foC.cjs');
2
- const require_react$1 = require('./react-DNGR2CL5.cjs');
3
- const require_reactPlugin = require('./reactPlugin-Ct0yCk0a.cjs');
4
- const require_jsx_runtime = require('./jsx-runtime-cR2hscK9.cjs');
5
- const require_devtools = require('./devtools-DRXCsX9I.cjs');
1
+ const require_chunk = require('./chunk-BrXtsOCC.cjs');
2
+ const require_react$1 = require('./react-D_EYlsv-.cjs');
3
+ const require_reactPlugin = require('./reactPlugin-CpRWhf6R.cjs');
4
+ const require_jsx_runtime = require('./jsx-runtime-DqTOrEsT.cjs');
5
+ const require_devtools = require('./devtools-CRkwwngz.cjs');
6
6
  let __kubb_fabric_core = require("@kubb/fabric-core");
7
7
  let dedent = require("dedent");
8
8
  dedent = require_chunk.__toESM(dedent);
package/dist/index.d.cts CHANGED
@@ -1,33 +1,19 @@
1
- import { a as FabricOptions, b as Source, c as FileManager, f as BaseName, g as Import, h as File$1, i as FabricMode, l as FileProcessor, n as FabricConfig, p as Export, t as Fabric, v as Path, y as ResolvedFile } from "./Fabric-CStIaz99.cjs";
2
- import { a as JSDoc, d as KubbNode, g as FunctionParams, o as Key, y as createFunctionParams } from "./types-BZlZnQLJ.cjs";
3
- import { t as Options$1 } from "./reactPlugin-DajNNKBt.cjs";
4
- import * as react8 from "react";
1
+ import { a as FabricOptions, b as Source, c as FileManager, f as BaseName, g as Import, h as File$1, i as FabricMode, l as FileProcessor, n as FabricConfig, p as Export, t as Fabric, v as Path, y as ResolvedFile } from "./Fabric-xy241PKd.cjs";
2
+ import { a as JSDoc, d as KubbNode, g as FunctionParams, o as Key, y as createFunctionParams } from "./types-WtAhPPHc.cjs";
3
+ import { t as Options$1 } from "./reactPlugin-CrCzxP4y.cjs";
4
+ import * as react3 from "react";
5
5
  import React, { ReactNode } from "react";
6
6
 
7
- //#region ../fabric-core/src/defineFabric.d.ts
8
- /**
9
- * Function that initializes the root Fabric instance.
10
- *
11
- * Used for setting up plugins, parsers, or performing side effects
12
- * once the Fabric context is ready.
13
- */
14
- type FabricInitializer<T extends FabricOptions> = (fabric: Fabric<T>) => void | Promise<void>;
15
- /**
16
- * A function returned by {@link defineFabric} that creates a Fabric instance.
17
- */
18
- type CreateFabric<T extends FabricOptions> = (config?: FabricConfig<T>) => Fabric<T>;
7
+ //#region ../fabric-core/src/createFabric.d.ts
8
+
19
9
  /**
20
- * Defines a new Fabric factory function.
10
+ * Creates a new Fabric instance
21
11
  *
22
12
  * @example
23
- * export const createFabric = defineFabric((fabric) => {
24
- * fabric.use(myPlugin())
25
- * })
13
+ * const fabric = createFabric()
14
+ * fabric.use(myPlugin())
26
15
  */
27
- declare function defineFabric<T extends FabricOptions>(init?: FabricInitializer<T>): CreateFabric<T>;
28
- //#endregion
29
- //#region ../fabric-core/src/createFabric.d.ts
30
- declare const createFabric: CreateFabric<FabricOptions>;
16
+ declare function createFabric<T extends FabricOptions>(config?: FabricConfig<T>): Fabric<T>;
31
17
  //#endregion
32
18
  //#region ../fabric-core/src/createFile.d.ts
33
19
  /**
@@ -50,9 +36,9 @@ type Props$4<TMeta = unknown> = {
50
36
  declare function App<TMeta = unknown>({
51
37
  meta,
52
38
  children
53
- }: Props$4<TMeta>): react8.JSX.Element;
39
+ }: Props$4<TMeta>): react3.JSX.Element;
54
40
  declare namespace App {
55
- var Context: react8.Context<AppContextProps<unknown> | undefined>;
41
+ var Context: react3.Context<AppContextProps<unknown> | undefined>;
56
42
  var displayName: string;
57
43
  }
58
44
  //#endregion
@@ -88,7 +74,7 @@ declare function Const({
88
74
  JSDoc,
89
75
  asConst,
90
76
  children
91
- }: Props$3): react8.JSX.Element;
77
+ }: Props$3): react3.JSX.Element;
92
78
  declare namespace Const {
93
79
  var displayName: string;
94
80
  }
@@ -137,13 +123,13 @@ type Props$2<TMeta> = BaseProps & {
137
123
  declare function File<TMeta extends object = object>({
138
124
  children,
139
125
  ...rest
140
- }: Props$2<TMeta>): react8.JSX.Element;
126
+ }: Props$2<TMeta>): react3.JSX.Element;
141
127
  declare namespace File {
142
128
  var displayName: string;
143
129
  var Export: typeof FileExport;
144
130
  var Import: typeof FileImport;
145
131
  var Source: typeof FileSource;
146
- var Context: react8.Context<FileContextProps<object>>;
132
+ var Context: react3.Context<FileContextProps<object>>;
147
133
  }
148
134
  type FileSourceProps = Omit<Source, 'value'> & {
149
135
  key?: Key;
@@ -155,7 +141,7 @@ declare function FileSource({
155
141
  isExportable,
156
142
  isIndexable,
157
143
  children
158
- }: FileSourceProps): react8.JSX.Element;
144
+ }: FileSourceProps): react3.JSX.Element;
159
145
  declare namespace FileSource {
160
146
  var displayName: string;
161
147
  }
@@ -167,7 +153,7 @@ declare function FileExport({
167
153
  path,
168
154
  isTypeOnly,
169
155
  asAlias
170
- }: FileExportProps): react8.JSX.Element;
156
+ }: FileExportProps): react3.JSX.Element;
171
157
  declare namespace FileExport {
172
158
  var displayName: string;
173
159
  }
@@ -180,7 +166,7 @@ declare function FileImport({
180
166
  path,
181
167
  isTypeOnly,
182
168
  isNameSpace
183
- }: FileImportProps): react8.JSX.Element;
169
+ }: FileImportProps): react3.JSX.Element;
184
170
  declare namespace FileImport {
185
171
  var displayName: string;
186
172
  }
@@ -233,7 +219,7 @@ declare function Function({
233
219
  returnType,
234
220
  JSDoc,
235
221
  children
236
- }: Props$1): react8.JSX.Element;
222
+ }: Props$1): react3.JSX.Element;
237
223
  declare namespace Function {
238
224
  var displayName: string;
239
225
  var Arrow: typeof ArrowFunction;
@@ -255,7 +241,7 @@ declare function ArrowFunction({
255
241
  JSDoc,
256
242
  singleLine,
257
243
  children
258
- }: ArrowFunctionProps): react8.JSX.Element;
244
+ }: ArrowFunctionProps): react3.JSX.Element;
259
245
  declare namespace ArrowFunction {
260
246
  var displayName: string;
261
247
  }
@@ -296,7 +282,7 @@ declare function Type({
296
282
  export: canExport,
297
283
  JSDoc,
298
284
  children
299
- }: Props): react8.JSX.Element;
285
+ }: Props): react3.JSX.Element;
300
286
  declare namespace Type {
301
287
  var displayName: string;
302
288
  }
@@ -359,15 +345,15 @@ declare class Runtime {
359
345
  }
360
346
  //#endregion
361
347
  //#region src/index.d.ts
362
- declare const useState: typeof react8.useState;
363
- declare const createContext: typeof react8.createContext;
364
- declare const createElement: typeof react8.createElement;
365
- declare const Fragment: react8.ExoticComponent<react8.FragmentProps>;
366
- declare const use: typeof react8.use;
367
- declare const useContext: typeof react8.useContext;
368
- declare const useEffect: typeof react8.useEffect;
369
- declare const useReducer: typeof react8.useReducer;
370
- declare const useRef: typeof react8.useRef;
348
+ declare const useState: typeof react3.useState;
349
+ declare const createContext: typeof react3.createContext;
350
+ declare const createElement: typeof react3.createElement;
351
+ declare const Fragment: react3.ExoticComponent<react3.FragmentProps>;
352
+ declare const use: typeof react3.use;
353
+ declare const useContext: typeof react3.useContext;
354
+ declare const useEffect: typeof react3.useEffect;
355
+ declare const useReducer: typeof react3.useReducer;
356
+ declare const useRef: typeof react3.useRef;
371
357
  //#endregion
372
- export { App, Const, type Fabric, File, FileManager, FileProcessor, Fragment, Function, FunctionParams, Indent, Runtime, Type, createContext, createElement, createFabric, createFile, createFunctionParams, createReactFabric, defineFabric, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
358
+ export { App, Const, type Fabric, File, FileManager, FileProcessor, Fragment, Function, FunctionParams, Indent, Runtime, Type, createContext, createElement, createFabric, createFile, createFunctionParams, createReactFabric, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
373
359
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -1,33 +1,19 @@
1
- import { a as FabricOptions, b as Source, c as FileManager, f as BaseName, g as Import, h as File$1, i as FabricMode, l as FileProcessor, n as FabricConfig, p as Export, t as Fabric, v as Path, y as ResolvedFile } from "./Fabric-C7RMr4BK.js";
2
- import { a as JSDoc, d as KubbNode, g as FunctionParams, o as Key, y as createFunctionParams } from "./types-KXnjAqUg.js";
3
- import { t as Options$1 } from "./reactPlugin-TmG3R6xY.js";
1
+ import { a as FabricOptions, b as Source, c as FileManager, f as BaseName, g as Import, h as File$1, i as FabricMode, l as FileProcessor, n as FabricConfig, p as Export, t as Fabric, v as Path, y as ResolvedFile } from "./Fabric-D-A981Bs.js";
2
+ import { a as JSDoc, d as KubbNode, g as FunctionParams, o as Key, y as createFunctionParams } from "./types-BjJ5OLXP.js";
3
+ import { t as Options$1 } from "./reactPlugin-Iyi8Falf.js";
4
4
  import * as react3 from "react";
5
5
  import React, { ReactNode } from "react";
6
6
 
7
- //#region ../fabric-core/src/defineFabric.d.ts
8
- /**
9
- * Function that initializes the root Fabric instance.
10
- *
11
- * Used for setting up plugins, parsers, or performing side effects
12
- * once the Fabric context is ready.
13
- */
14
- type FabricInitializer<T extends FabricOptions> = (fabric: Fabric<T>) => void | Promise<void>;
15
- /**
16
- * A function returned by {@link defineFabric} that creates a Fabric instance.
17
- */
18
- type CreateFabric<T extends FabricOptions> = (config?: FabricConfig<T>) => Fabric<T>;
7
+ //#region ../fabric-core/src/createFabric.d.ts
8
+
19
9
  /**
20
- * Defines a new Fabric factory function.
10
+ * Creates a new Fabric instance
21
11
  *
22
12
  * @example
23
- * export const createFabric = defineFabric((fabric) => {
24
- * fabric.use(myPlugin())
25
- * })
13
+ * const fabric = createFabric()
14
+ * fabric.use(myPlugin())
26
15
  */
27
- declare function defineFabric<T extends FabricOptions>(init?: FabricInitializer<T>): CreateFabric<T>;
28
- //#endregion
29
- //#region ../fabric-core/src/createFabric.d.ts
30
- declare const createFabric: CreateFabric<FabricOptions>;
16
+ declare function createFabric<T extends FabricOptions>(config?: FabricConfig<T>): Fabric<T>;
31
17
  //#endregion
32
18
  //#region ../fabric-core/src/createFile.d.ts
33
19
  /**
@@ -369,5 +355,5 @@ declare const useEffect: typeof react3.useEffect;
369
355
  declare const useReducer: typeof react3.useReducer;
370
356
  declare const useRef: typeof react3.useRef;
371
357
  //#endregion
372
- export { App, Const, type Fabric, File, FileManager, FileProcessor, Fragment, Function, FunctionParams, Indent, Runtime, Type, createContext, createElement, createFabric, createFile, createFunctionParams, createReactFabric, defineFabric, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
358
+ export { App, Const, type Fabric, File, FileManager, FileProcessor, Fragment, Function, FunctionParams, Indent, Runtime, Type, createContext, createElement, createFabric, createFile, createFunctionParams, createReactFabric, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
373
359
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { r as __toESM } from "./chunk-BHcwYQRN.js";
2
- import { t as require_react } from "./react-Czh2e85z.js";
3
- import { a as _classPrivateFieldInitSpec, i as _classPrivateFieldGet2, n as Runtime, o as Root, r as _classPrivateFieldSet2, s as RootContext, t as reactPlugin } from "./reactPlugin-CjsXM659.js";
4
- import { i as jsxs, n as jsx, t as Fragment$1 } from "./jsx-runtime-DT7hOgNn.js";
1
+ import { r as __toESM } from "./chunk-B1nHLT4p.js";
2
+ import { t as require_react } from "./react-B97TdWcV.js";
3
+ import { a as _classPrivateFieldInitSpec, i as _classPrivateFieldGet2, n as Runtime, o as Root, r as _classPrivateFieldSet2, s as RootContext, t as reactPlugin } from "./reactPlugin-PG1kqZRe.js";
4
+ import { i as jsxs, n as jsx, t as Fragment$1 } from "./jsx-runtime-zJCtyvtC.js";
5
5
  import { t as open } from "./devtools-D6dZodXp.js";
6
6
  import { createFabric } from "@kubb/fabric-core";
7
7
  import dedent from "dedent";