@kubb/react-fabric 0.1.7 → 0.2.0

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/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  const require_react$1 = require('./react-Bq0UOw6S.cjs');
2
2
  require('./globals-8sJ940pg.cjs');
3
- const require_Runtime = require('./Runtime-JI640uK4.cjs');
3
+ const require_Runtime = require('./Runtime-DJ4dWT9w.cjs');
4
4
  const require_jsx_runtime$1 = require('./jsx-runtime-d2dmYscH.cjs');
5
5
  let dedent = require("dedent");
6
6
  dedent = require_react$1.__toESM(dedent);
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as Import, c as Source, n as Export, o as Path, t as BaseName } from "./KubbFile-FGXV713i.cjs";
2
- import { n as AppOptions, r as FileManager, t as App$1 } from "./App-sZvw_4U6.cjs";
2
+ import { n as AppOptions, r as FileManager, t as App$1 } from "./App-CbT7rbmH.cjs";
3
3
  import { a as JSDoc, f as createFunctionParams, l as FunctionParams, o as Key, s as KubbNode } from "./types-C3p0Ljxf.cjs";
4
4
  import "./globals-BRG2DOJd.cjs";
5
5
  import * as react1 from "react";
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as Import, c as Source, n as Export, o as Path, t as BaseName } from "./KubbFile-D4gyyfL-.js";
2
- import { n as AppOptions, r as FileManager, t as App$1 } from "./App-CFyJOzZ_.js";
2
+ import { n as AppOptions, r as FileManager, t as App$1 } from "./App-D7ehObix.js";
3
3
  import { a as JSDoc, f as createFunctionParams, l as FunctionParams, o as Key, s as KubbNode } from "./types-Brnyan9B.js";
4
4
  import "./globals-D_1Lfe9-.js";
5
5
  import * as react1 from "react";
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { r as __toESM, t as require_react } from "./react-BBkwFtZV.js";
2
2
  import "./globals-Df5klKjG.js";
3
- import { a as Root, i as _classPrivateFieldInitSpec, n as _classPrivateFieldGet2, o as RootContext, r as _classPrivateFieldSet2, t as Runtime } from "./Runtime-DWlDUeLZ.js";
3
+ import { a as Root, i as _classPrivateFieldInitSpec, n as _classPrivateFieldGet2, o as RootContext, r as _classPrivateFieldSet2, t as Runtime } from "./Runtime-CatKeybQ.js";
4
4
  import { t as require_jsx_runtime } from "./jsx-runtime-Dg-pJBHd.js";
5
5
  import dedent from "dedent";
6
6
  import { createApp } from "@kubb/fabric-core";
@@ -1,5 +1,5 @@
1
1
  import "./KubbFile-FGXV713i.cjs";
2
- import { a as UserParser, i as Parser } from "./App-sZvw_4U6.cjs";
2
+ import { a as UserParser, i as Parser } from "./App-CbT7rbmH.cjs";
3
3
 
4
4
  //#region ../fabric-core/src/parsers/createParser.d.ts
5
5
  declare function createParser<TOptions = unknown, TMeta extends object = any>(parser: UserParser<TOptions, TMeta>): Parser<TOptions, TMeta>;
package/dist/parsers.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./KubbFile-D4gyyfL-.js";
2
- import { a as UserParser, i as Parser } from "./App-CFyJOzZ_.js";
2
+ import { a as UserParser, i as Parser } from "./App-D7ehObix.js";
3
3
 
4
4
  //#region ../fabric-core/src/parsers/createParser.d.ts
5
5
  declare function createParser<TOptions = unknown, TMeta extends object = any>(parser: UserParser<TOptions, TMeta>): Parser<TOptions, TMeta>;
package/dist/plugins.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  const require_react$1 = require('./react-Bq0UOw6S.cjs');
2
- const require_Runtime = require('./Runtime-JI640uK4.cjs');
2
+ const require_Runtime = require('./Runtime-DJ4dWT9w.cjs');
3
3
  require('./jsx-runtime-d2dmYscH.cjs');
4
4
  let __kubb_fabric_core_plugins = require("@kubb/fabric-core/plugins");
5
5
  __kubb_fabric_core_plugins = require_react$1.__toESM(__kubb_fabric_core_plugins);
@@ -20,6 +20,7 @@ const reactPlugin = (0, __kubb_fabric_core_plugins.createPlugin)({
20
20
  await app.context.events.emit("start");
21
21
  },
22
22
  async renderToString(App) {
23
+ await app.context.events.emit("start");
23
24
  return runtime.renderToString((0, import_react.createElement)(App));
24
25
  },
25
26
  async waitUntilExit() {
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.cjs","names":["Runtime"],"sources":["../src/plugins/reactPlugin.ts"],"sourcesContent":["import { createPlugin } from '@kubb/fabric-core/plugins'\nimport { Runtime } from '../Runtime.tsx'\nimport { createElement, type ElementType } from 'react'\n\ntype Options = {\n stdout?: NodeJS.WriteStream\n stdin?: NodeJS.ReadStream\n stderr?: NodeJS.WriteStream\n /**\n * Set this to true to always see the result of the render in the console(line per render)\n */\n debug?: boolean\n}\n\ntype ExtendOptions = {\n render(App: ElementType): Promise<void> | void\n renderToString(App: ElementType): Promise<string> | string\n waitUntilExit(): Promise<void>\n}\n\n// biome-ignore lint/suspicious/noTsIgnore: production ready\n// @ts-ignore\ndeclare module '@kubb/fabric-core' {\n interface App {\n render(App: ElementType): Promise<void> | void\n renderToString(App: ElementType): Promise<string> | string\n waitUntilExit(): Promise<void>\n }\n}\n\ndeclare global {\n namespace Kubb {\n interface App {\n render(App: ElementType): Promise<void> | void\n renderToString(App: ElementType): Promise<string> | string\n waitUntilExit(): Promise<void>\n }\n }\n}\n\nexport const reactPlugin = createPlugin<Options, ExtendOptions>({\n name: 'react',\n install() {},\n inject(app, options = {}) {\n const runtime = new Runtime({ fileManager: app.context.fileManager, ...options })\n\n return {\n async render(App) {\n runtime.render(createElement(App))\n await app.context.events.emit('start')\n },\n async renderToString(App) {\n return runtime.renderToString(createElement(App))\n },\n async waitUntilExit() {\n await runtime.waitUntilExit()\n\n await app.context.events.emit('end')\n },\n }\n },\n})\n"],"mappings":";;;;;;;;AAwCA,MAAa,2DAAmD;CAC9D,MAAM;CACN,UAAU;CACV,OAAO,KAAK,UAAU,EAAE,EAAE;EACxB,MAAM,UAAU,IAAIA,wBAAQ;GAAE,aAAa,IAAI,QAAQ;GAAa,GAAG;GAAS,CAAC;AAEjF,SAAO;GACL,MAAM,OAAO,KAAK;AAChB,YAAQ,uCAAqB,IAAI,CAAC;AAClC,UAAM,IAAI,QAAQ,OAAO,KAAK,QAAQ;;GAExC,MAAM,eAAe,KAAK;AACxB,WAAO,QAAQ,+CAA6B,IAAI,CAAC;;GAEnD,MAAM,gBAAgB;AACpB,UAAM,QAAQ,eAAe;AAE7B,UAAM,IAAI,QAAQ,OAAO,KAAK,MAAM;;GAEvC;;CAEJ,CAAC"}
1
+ {"version":3,"file":"plugins.cjs","names":["Runtime"],"sources":["../src/plugins/reactPlugin.ts"],"sourcesContent":["import { createPlugin } from '@kubb/fabric-core/plugins'\nimport { Runtime } from '../Runtime.tsx'\nimport { createElement, type ElementType } from 'react'\n\ntype Options = {\n stdout?: NodeJS.WriteStream\n stdin?: NodeJS.ReadStream\n stderr?: NodeJS.WriteStream\n /**\n * Set this to true to always see the result of the render in the console(line per render)\n */\n debug?: boolean\n}\n\ntype ExtendOptions = {\n render(App: ElementType): Promise<void> | void\n renderToString(App: ElementType): Promise<string> | string\n waitUntilExit(): Promise<void>\n}\n\n// biome-ignore lint/suspicious/noTsIgnore: production ready\n// @ts-ignore\ndeclare module '@kubb/fabric-core' {\n interface App {\n render(App: ElementType): Promise<void> | void\n renderToString(App: ElementType): Promise<string> | string\n waitUntilExit(): Promise<void>\n }\n}\n\ndeclare global {\n namespace Kubb {\n interface App {\n render(App: ElementType): Promise<void> | void\n renderToString(App: ElementType): Promise<string> | string\n waitUntilExit(): Promise<void>\n }\n }\n}\n\nexport const reactPlugin = createPlugin<Options, ExtendOptions>({\n name: 'react',\n install() {},\n inject(app, options = {}) {\n const runtime = new Runtime({ fileManager: app.context.fileManager, ...options })\n\n return {\n async render(App) {\n runtime.render(createElement(App))\n await app.context.events.emit('start')\n },\n async renderToString(App) {\n await app.context.events.emit('start')\n return runtime.renderToString(createElement(App))\n },\n async waitUntilExit() {\n await runtime.waitUntilExit()\n\n await app.context.events.emit('end')\n },\n }\n },\n})\n"],"mappings":";;;;;;;;AAwCA,MAAa,2DAAmD;CAC9D,MAAM;CACN,UAAU;CACV,OAAO,KAAK,UAAU,EAAE,EAAE;EACxB,MAAM,UAAU,IAAIA,wBAAQ;GAAE,aAAa,IAAI,QAAQ;GAAa,GAAG;GAAS,CAAC;AAEjF,SAAO;GACL,MAAM,OAAO,KAAK;AAChB,YAAQ,uCAAqB,IAAI,CAAC;AAClC,UAAM,IAAI,QAAQ,OAAO,KAAK,QAAQ;;GAExC,MAAM,eAAe,KAAK;AACxB,UAAM,IAAI,QAAQ,OAAO,KAAK,QAAQ;AACtC,WAAO,QAAQ,+CAA6B,IAAI,CAAC;;GAEnD,MAAM,gBAAgB;AACpB,UAAM,QAAQ,eAAe;AAE7B,UAAM,IAAI,QAAQ,OAAO,KAAK,MAAM;;GAEvC;;CAEJ,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { r as Extname } from "./KubbFile-FGXV713i.cjs";
2
- import { o as Plugin, s as UserPlugin } from "./App-sZvw_4U6.cjs";
2
+ import { o as Plugin, s as UserPlugin } from "./App-CbT7rbmH.cjs";
3
3
  import { ElementType } from "react";
4
4
 
5
5
  //#region ../fabric-core/src/plugins/createPlugin.d.ts
@@ -66,16 +66,17 @@ declare global {
66
66
  declare const barrelPlugin: Plugin<Options$2, ExtendOptions$1>;
67
67
  //#endregion
68
68
  //#region ../fabric-core/src/plugins/progressPlugin.d.ts
69
- type Options$1 = {};
70
- declare module '@kubb/fabric-core' {
71
- interface App {}
72
- }
73
- declare global {
74
- namespace Kubb {
75
- interface App {}
76
- }
77
- }
78
- declare const progressPlugin: Plugin<Options$1, {}>;
69
+ declare const progressPlugin: Plugin<[], {}>;
70
+ //#endregion
71
+ //#region ../fabric-core/src/plugins/graphPlugin.d.ts
72
+ type Options$1 = {
73
+ root: string;
74
+ /**
75
+ * @default false
76
+ */
77
+ open?: boolean;
78
+ };
79
+ declare const graphPlugin: Plugin<Options$1, {}>;
79
80
  //#endregion
80
81
  //#region src/plugins/reactPlugin.d.ts
81
82
  type Options = {
@@ -110,5 +111,5 @@ declare global {
110
111
  }
111
112
  declare const reactPlugin: Plugin<Options, ExtendOptions>;
112
113
  //#endregion
113
- export { barrelPlugin, createPlugin, fsPlugin, progressPlugin, reactPlugin };
114
+ export { barrelPlugin, createPlugin, fsPlugin, graphPlugin, progressPlugin, reactPlugin };
114
115
  //# sourceMappingURL=plugins.d.cts.map
package/dist/plugins.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { r as Extname } from "./KubbFile-D4gyyfL-.js";
2
- import { o as Plugin, s as UserPlugin } from "./App-CFyJOzZ_.js";
2
+ import { o as Plugin, s as UserPlugin } from "./App-D7ehObix.js";
3
3
  import { ElementType } from "react";
4
4
 
5
5
  //#region ../fabric-core/src/plugins/createPlugin.d.ts
@@ -66,16 +66,17 @@ declare global {
66
66
  declare const barrelPlugin: Plugin<Options$2, ExtendOptions$1>;
67
67
  //#endregion
68
68
  //#region ../fabric-core/src/plugins/progressPlugin.d.ts
69
- type Options$1 = {};
70
- declare module '@kubb/fabric-core' {
71
- interface App {}
72
- }
73
- declare global {
74
- namespace Kubb {
75
- interface App {}
76
- }
77
- }
78
- declare const progressPlugin: Plugin<Options$1, {}>;
69
+ declare const progressPlugin: Plugin<[], {}>;
70
+ //#endregion
71
+ //#region ../fabric-core/src/plugins/graphPlugin.d.ts
72
+ type Options$1 = {
73
+ root: string;
74
+ /**
75
+ * @default false
76
+ */
77
+ open?: boolean;
78
+ };
79
+ declare const graphPlugin: Plugin<Options$1, {}>;
79
80
  //#endregion
80
81
  //#region src/plugins/reactPlugin.d.ts
81
82
  type Options = {
@@ -110,5 +111,5 @@ declare global {
110
111
  }
111
112
  declare const reactPlugin: Plugin<Options, ExtendOptions>;
112
113
  //#endregion
113
- export { barrelPlugin, createPlugin, fsPlugin, progressPlugin, reactPlugin };
114
+ export { barrelPlugin, createPlugin, fsPlugin, graphPlugin, progressPlugin, reactPlugin };
114
115
  //# sourceMappingURL=plugins.d.ts.map
package/dist/plugins.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { r as __toESM, t as require_react } from "./react-BBkwFtZV.js";
2
- import { t as Runtime } from "./Runtime-DWlDUeLZ.js";
2
+ import { t as Runtime } from "./Runtime-CatKeybQ.js";
3
3
  import "./jsx-runtime-Dg-pJBHd.js";
4
4
  import { createPlugin } from "@kubb/fabric-core/plugins";
5
5
 
@@ -21,6 +21,7 @@ const reactPlugin = createPlugin({
21
21
  await app.context.events.emit("start");
22
22
  },
23
23
  async renderToString(App) {
24
+ await app.context.events.emit("start");
24
25
  return runtime.renderToString((0, import_react.createElement)(App));
25
26
  },
26
27
  async waitUntilExit() {
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.js","names":[],"sources":["../src/plugins/reactPlugin.ts"],"sourcesContent":["import { createPlugin } from '@kubb/fabric-core/plugins'\nimport { Runtime } from '../Runtime.tsx'\nimport { createElement, type ElementType } from 'react'\n\ntype Options = {\n stdout?: NodeJS.WriteStream\n stdin?: NodeJS.ReadStream\n stderr?: NodeJS.WriteStream\n /**\n * Set this to true to always see the result of the render in the console(line per render)\n */\n debug?: boolean\n}\n\ntype ExtendOptions = {\n render(App: ElementType): Promise<void> | void\n renderToString(App: ElementType): Promise<string> | string\n waitUntilExit(): Promise<void>\n}\n\n// biome-ignore lint/suspicious/noTsIgnore: production ready\n// @ts-ignore\ndeclare module '@kubb/fabric-core' {\n interface App {\n render(App: ElementType): Promise<void> | void\n renderToString(App: ElementType): Promise<string> | string\n waitUntilExit(): Promise<void>\n }\n}\n\ndeclare global {\n namespace Kubb {\n interface App {\n render(App: ElementType): Promise<void> | void\n renderToString(App: ElementType): Promise<string> | string\n waitUntilExit(): Promise<void>\n }\n }\n}\n\nexport const reactPlugin = createPlugin<Options, ExtendOptions>({\n name: 'react',\n install() {},\n inject(app, options = {}) {\n const runtime = new Runtime({ fileManager: app.context.fileManager, ...options })\n\n return {\n async render(App) {\n runtime.render(createElement(App))\n await app.context.events.emit('start')\n },\n async renderToString(App) {\n return runtime.renderToString(createElement(App))\n },\n async waitUntilExit() {\n await runtime.waitUntilExit()\n\n await app.context.events.emit('end')\n },\n }\n },\n})\n"],"mappings":";;;;;;;;;AAwCA,MAAa,cAAc,aAAqC;CAC9D,MAAM;CACN,UAAU;CACV,OAAO,KAAK,UAAU,EAAE,EAAE;EACxB,MAAM,UAAU,IAAI,QAAQ;GAAE,aAAa,IAAI,QAAQ;GAAa,GAAG;GAAS,CAAC;AAEjF,SAAO;GACL,MAAM,OAAO,KAAK;AAChB,YAAQ,uCAAqB,IAAI,CAAC;AAClC,UAAM,IAAI,QAAQ,OAAO,KAAK,QAAQ;;GAExC,MAAM,eAAe,KAAK;AACxB,WAAO,QAAQ,+CAA6B,IAAI,CAAC;;GAEnD,MAAM,gBAAgB;AACpB,UAAM,QAAQ,eAAe;AAE7B,UAAM,IAAI,QAAQ,OAAO,KAAK,MAAM;;GAEvC;;CAEJ,CAAC"}
1
+ {"version":3,"file":"plugins.js","names":[],"sources":["../src/plugins/reactPlugin.ts"],"sourcesContent":["import { createPlugin } from '@kubb/fabric-core/plugins'\nimport { Runtime } from '../Runtime.tsx'\nimport { createElement, type ElementType } from 'react'\n\ntype Options = {\n stdout?: NodeJS.WriteStream\n stdin?: NodeJS.ReadStream\n stderr?: NodeJS.WriteStream\n /**\n * Set this to true to always see the result of the render in the console(line per render)\n */\n debug?: boolean\n}\n\ntype ExtendOptions = {\n render(App: ElementType): Promise<void> | void\n renderToString(App: ElementType): Promise<string> | string\n waitUntilExit(): Promise<void>\n}\n\n// biome-ignore lint/suspicious/noTsIgnore: production ready\n// @ts-ignore\ndeclare module '@kubb/fabric-core' {\n interface App {\n render(App: ElementType): Promise<void> | void\n renderToString(App: ElementType): Promise<string> | string\n waitUntilExit(): Promise<void>\n }\n}\n\ndeclare global {\n namespace Kubb {\n interface App {\n render(App: ElementType): Promise<void> | void\n renderToString(App: ElementType): Promise<string> | string\n waitUntilExit(): Promise<void>\n }\n }\n}\n\nexport const reactPlugin = createPlugin<Options, ExtendOptions>({\n name: 'react',\n install() {},\n inject(app, options = {}) {\n const runtime = new Runtime({ fileManager: app.context.fileManager, ...options })\n\n return {\n async render(App) {\n runtime.render(createElement(App))\n await app.context.events.emit('start')\n },\n async renderToString(App) {\n await app.context.events.emit('start')\n return runtime.renderToString(createElement(App))\n },\n async waitUntilExit() {\n await runtime.waitUntilExit()\n\n await app.context.events.emit('end')\n },\n }\n },\n})\n"],"mappings":";;;;;;;;;AAwCA,MAAa,cAAc,aAAqC;CAC9D,MAAM;CACN,UAAU;CACV,OAAO,KAAK,UAAU,EAAE,EAAE;EACxB,MAAM,UAAU,IAAI,QAAQ;GAAE,aAAa,IAAI,QAAQ;GAAa,GAAG;GAAS,CAAC;AAEjF,SAAO;GACL,MAAM,OAAO,KAAK;AAChB,YAAQ,uCAAqB,IAAI,CAAC;AAClC,UAAM,IAAI,QAAQ,OAAO,KAAK,QAAQ;;GAExC,MAAM,eAAe,KAAK;AACxB,UAAM,IAAI,QAAQ,OAAO,KAAK,QAAQ;AACtC,WAAO,QAAQ,+CAA6B,IAAI,CAAC;;GAEnD,MAAM,gBAAgB;AACpB,UAAM,QAAQ,eAAe;AAE7B,UAAM,IAAI,QAAQ,OAAO,KAAK,MAAM;;GAEvC;;CAEJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/react-fabric",
3
- "version": "0.1.7",
3
+ "version": "0.2.0",
4
4
  "description": "React integration for Kubb, providing JSX runtime support and React component generation capabilities for code generation plugins.",
5
5
  "keywords": [
6
6
  "react",
@@ -99,7 +99,7 @@
99
99
  "react-reconciler": "0.32.0",
100
100
  "signal-exit": "^4.1.0",
101
101
  "ws": "^8.18.3",
102
- "@kubb/fabric-core": "0.1.7"
102
+ "@kubb/fabric-core": "0.2.0"
103
103
  },
104
104
  "devDependencies": {
105
105
  "@types/react": "^19.2.2",
@@ -117,12 +117,12 @@
117
117
  },
118
118
  "scripts": {
119
119
  "build": "tsdown",
120
+ "start": "tsdown --watch ./src",
120
121
  "clean": "npx rimraf ./dist",
121
122
  "lint": "bun biome lint .",
122
123
  "lint:fix": "bun biome lint --fix --unsafe .",
123
124
  "release": "pnpm publish --no-git-check",
124
125
  "release:canary": "bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check -tag canary",
125
- "start": "tsdown --watch",
126
126
  "start:devtools": "npx react-devtools",
127
127
  "test": "vitest --passWithNoTests",
128
128
  "test:devtools": "node ./dist/runner.cjs",
package/src/Runtime.tsx CHANGED
@@ -46,20 +46,20 @@ export class Runtime {
46
46
  console.error = (data: string | Error) => {
47
47
  const message = typeof data === 'string' ? data : data?.message
48
48
 
49
- if (message.match(/Encountered two children with the same key/gi)) {
49
+ if (message?.match(/Encountered two children with the same key/gi)) {
50
50
  return
51
51
  }
52
- if (message.match(/React will try to recreat/gi)) {
52
+ if (message?.match(/React will try to recreat/gi)) {
53
53
  return
54
54
  }
55
- if (message.match(/Each child in a list should have a unique/gi)) {
55
+ if (message?.match(/Each child in a list should have a unique/gi)) {
56
56
  return
57
57
  }
58
- if (message.match(/The above error occurred in the <KubbErrorBoundary/gi)) {
58
+ if (message?.match(/The above error occurred in the <KubbErrorBoundary/gi)) {
59
59
  return
60
60
  }
61
61
 
62
- if (message.match(/A React Element from an older version of React was render/gi)) {
62
+ if (message?.match(/A React Element from an older version of React was render/gi)) {
63
63
  return
64
64
  }
65
65
 
@@ -126,6 +126,7 @@ export class Runtime {
126
126
  return
127
127
  }
128
128
 
129
+ // TODO remove to allow multiple renders
129
130
  this.fileManager.clear()
130
131
 
131
132
  processFiles(this.#rootNode, this.fileManager)
@@ -50,6 +50,7 @@ export const reactPlugin = createPlugin<Options, ExtendOptions>({
50
50
  await app.context.events.emit('start')
51
51
  },
52
52
  async renderToString(App) {
53
+ await app.context.events.emit('start')
53
54
  return runtime.renderToString(createElement(App))
54
55
  },
55
56
  async waitUntilExit() {