@kubb/react-fabric 0.1.8 → 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/README.md +276 -0
- package/dist/{Runtime-DWlDUeLZ.js → Runtime-CatKeybQ.js} +6 -6
- package/dist/{Runtime-DWlDUeLZ.js.map → Runtime-CatKeybQ.js.map} +1 -1
- package/dist/{Runtime-JI640uK4.cjs → Runtime-DJ4dWT9w.cjs} +6 -6
- package/dist/{Runtime-JI640uK4.cjs.map → Runtime-DJ4dWT9w.cjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/plugins.cjs +2 -1
- package/dist/plugins.cjs.map +1 -1
- package/dist/plugins.js +2 -1
- package/dist/plugins.js.map +1 -1
- package/package.json +3 -3
- package/src/Runtime.tsx +6 -5
- package/src/plugins/reactPlugin.ts +1 -0
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-
|
|
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.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-
|
|
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";
|
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-
|
|
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() {
|
package/dist/plugins.cjs.map
CHANGED
|
@@ -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"}
|
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-
|
|
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() {
|
package/dist/plugins.js.map
CHANGED
|
@@ -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.
|
|
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.
|
|
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
|
|
49
|
+
if (message?.match(/Encountered two children with the same key/gi)) {
|
|
50
50
|
return
|
|
51
51
|
}
|
|
52
|
-
if (message
|
|
52
|
+
if (message?.match(/React will try to recreat/gi)) {
|
|
53
53
|
return
|
|
54
54
|
}
|
|
55
|
-
if (message
|
|
55
|
+
if (message?.match(/Each child in a list should have a unique/gi)) {
|
|
56
56
|
return
|
|
57
57
|
}
|
|
58
|
-
if (message
|
|
58
|
+
if (message?.match(/The above error occurred in the <KubbErrorBoundary/gi)) {
|
|
59
59
|
return
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
if (message
|
|
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() {
|