@kubb/react-fabric 0.1.8 → 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.
- package/README.md +273 -26
- package/dist/{App-D7ehObix.d.ts → Fabric-nxgJyzWH.d.cts} +27 -27
- package/dist/{App-CbT7rbmH.d.cts → Fabric-tVWTpMR5.d.ts} +27 -27
- package/dist/{KubbFile-D4gyyfL-.d.ts → KubbFile-DFnA3mmn.d.ts} +1 -1
- package/dist/{KubbFile-FGXV713i.d.cts → KubbFile-DHCtBOpy.d.cts} +1 -1
- package/dist/chunk-CVmoYqME.js +27 -0
- package/dist/chunk-DWy1uDak.cjs +39 -0
- package/dist/devtools-DPye8o33.js +11448 -0
- package/dist/devtools-DPye8o33.js.map +1 -0
- package/dist/devtools-DnQsy6Us.cjs +11456 -0
- package/dist/devtools-DnQsy6Us.cjs.map +1 -0
- package/dist/devtools.cjs +2 -10885
- package/dist/devtools.d.cts +11 -1
- package/dist/devtools.d.ts +11 -1
- package/dist/devtools.js +2 -10885
- package/dist/{globals-BRG2DOJd.d.cts → globals-C7dPa-nz.d.cts} +3 -3
- package/dist/{globals-D_1Lfe9-.d.ts → globals-CxZEi_Pn.d.ts} +3 -3
- package/dist/globals.d.cts +3 -3
- package/dist/globals.d.ts +3 -3
- package/dist/index.cjs +34 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -9
- package/dist/index.d.ts +16 -9
- package/dist/index.js +15 -5
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.cjs +8 -0
- package/dist/jsx-dev-runtime.js +5 -0
- package/dist/jsx-runtime-9ohe6OS2.cjs +36 -0
- package/dist/jsx-runtime-9ohe6OS2.cjs.map +1 -0
- package/dist/{react-BBkwFtZV.js → jsx-runtime-BOrVcbIT.cjs} +253 -42
- package/dist/jsx-runtime-BOrVcbIT.cjs.map +1 -0
- package/dist/{react-Bq0UOw6S.cjs → jsx-runtime-CFd_ktZn.js} +239 -57
- package/dist/jsx-runtime-CFd_ktZn.js.map +1 -0
- package/dist/jsx-runtime-CvGZkcTo.js +13 -0
- package/dist/jsx-runtime-CvGZkcTo.js.map +1 -0
- package/dist/jsx-runtime.cjs +6 -15
- package/dist/jsx-runtime.d.cts +3 -3
- package/dist/jsx-runtime.d.ts +3 -3
- package/dist/jsx-runtime.js +3 -12
- package/dist/parsers.d.cts +2 -2
- package/dist/parsers.d.ts +2 -2
- package/dist/{Runtime-JI640uK4.cjs → plugins-CEGJdkpj.cjs} +115 -81
- package/dist/plugins-CEGJdkpj.cjs.map +1 -0
- package/dist/{Runtime-DWlDUeLZ.js → plugins-aZCNhIC8.js} +90 -63
- package/dist/plugins-aZCNhIC8.js.map +1 -0
- package/dist/plugins.cjs +4 -35
- package/dist/plugins.d.cts +16 -49
- package/dist/plugins.d.ts +16 -49
- package/dist/plugins.js +3 -33
- package/dist/reactPlugin-B47Guoya.d.ts +38 -0
- package/dist/reactPlugin-CLgWWifj.d.cts +38 -0
- package/dist/{types-C3p0Ljxf.d.cts → types-DoYRYV1C.d.cts} +1 -1
- package/dist/{types-Brnyan9B.d.ts → types-u_NEi07i.d.ts} +1 -1
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +11 -7
- package/src/Renderer.ts +26 -22
- package/src/Runtime.tsx +8 -7
- package/src/createReactFabric.ts +17 -0
- package/src/devtools.ts +106 -111
- package/src/index.ts +2 -1
- package/src/plugins/reactPlugin.ts +4 -3
- package/dist/Runtime-DWlDUeLZ.js.map +0 -1
- package/dist/Runtime-JI640uK4.cjs.map +0 -1
- package/dist/devtools.cjs.map +0 -1
- package/dist/devtools.js.map +0 -1
- package/dist/jsx-runtime-Dg-pJBHd.js +0 -228
- package/dist/jsx-runtime-Dg-pJBHd.js.map +0 -1
- package/dist/jsx-runtime-d2dmYscH.cjs +0 -233
- package/dist/jsx-runtime-d2dmYscH.cjs.map +0 -1
- package/dist/jsx-runtime.cjs.map +0 -1
- package/dist/jsx-runtime.js.map +0 -1
- package/dist/plugins.cjs.map +0 -1
- package/dist/plugins.js.map +0 -1
- package/dist/react-BBkwFtZV.js.map +0 -1
- package/dist/react-Bq0UOw6S.cjs.map +0 -1
package/dist/plugins.cjs
CHANGED
|
@@ -1,42 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
require('./jsx-runtime-d2dmYscH.cjs');
|
|
4
|
-
let __kubb_fabric_core_plugins = require("@kubb/fabric-core/plugins");
|
|
5
|
-
__kubb_fabric_core_plugins = require_react$1.__toESM(__kubb_fabric_core_plugins);
|
|
1
|
+
require('./jsx-runtime-BOrVcbIT.cjs');
|
|
2
|
+
const require_plugins = require('./plugins-CEGJdkpj.cjs');
|
|
6
3
|
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
const reactPlugin = (0, __kubb_fabric_core_plugins.createPlugin)({
|
|
10
|
-
name: "react",
|
|
11
|
-
install() {},
|
|
12
|
-
inject(app, options = {}) {
|
|
13
|
-
const runtime = new require_Runtime.Runtime({
|
|
14
|
-
fileManager: app.context.fileManager,
|
|
15
|
-
...options
|
|
16
|
-
});
|
|
17
|
-
return {
|
|
18
|
-
async render(App) {
|
|
19
|
-
runtime.render((0, import_react.createElement)(App));
|
|
20
|
-
await app.context.events.emit("start");
|
|
21
|
-
},
|
|
22
|
-
async renderToString(App) {
|
|
23
|
-
return runtime.renderToString((0, import_react.createElement)(App));
|
|
24
|
-
},
|
|
25
|
-
async waitUntilExit() {
|
|
26
|
-
await runtime.waitUntilExit();
|
|
27
|
-
await app.context.events.emit("end");
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
//#endregion
|
|
34
|
-
exports.reactPlugin = reactPlugin;
|
|
4
|
+
exports.reactPlugin = require_plugins.reactPlugin;
|
|
5
|
+
var __kubb_fabric_core_plugins = require("@kubb/fabric-core/plugins");
|
|
35
6
|
Object.keys(__kubb_fabric_core_plugins).forEach(function (k) {
|
|
36
7
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
37
8
|
enumerable: true,
|
|
38
9
|
get: function () { return __kubb_fabric_core_plugins[k]; }
|
|
39
10
|
});
|
|
40
11
|
});
|
|
41
|
-
|
|
42
|
-
//# sourceMappingURL=plugins.cjs.map
|
package/dist/plugins.d.cts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { r as Extname } from "./KubbFile-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { r as Extname } from "./KubbFile-DHCtBOpy.cjs";
|
|
2
|
+
import { c as UserPlugin, s as Plugin } from "./Fabric-nxgJyzWH.cjs";
|
|
3
|
+
import { n as reactPlugin } from "./reactPlugin-CLgWWifj.cjs";
|
|
4
4
|
|
|
5
5
|
//#region ../fabric-core/src/plugins/createPlugin.d.ts
|
|
6
|
-
declare function createPlugin<Options$
|
|
6
|
+
declare function createPlugin<Options$3 = unknown, TAppExtension extends Record<string, any> = {}>(plugin: UserPlugin<Options$3, TAppExtension>): Plugin<Options$3, TAppExtension>;
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region ../fabric-core/src/plugins/fsPlugin.d.ts
|
|
9
9
|
type WriteOptions = {
|
|
10
10
|
extension?: Record<Extname, Extname | ''>;
|
|
11
11
|
};
|
|
12
|
-
type Options$
|
|
12
|
+
type Options$2 = {
|
|
13
13
|
dryRun?: boolean;
|
|
14
14
|
/**
|
|
15
15
|
* Optional callback that is invoked whenever a file is written by the plugin.
|
|
@@ -20,26 +20,26 @@ type Options$3 = {
|
|
|
20
20
|
path: string;
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
|
-
type ExtendOptions$
|
|
23
|
+
type ExtendOptions$1 = {
|
|
24
24
|
write(options?: WriteOptions): Promise<void>;
|
|
25
25
|
};
|
|
26
26
|
declare module '@kubb/fabric-core' {
|
|
27
|
-
interface
|
|
27
|
+
interface Fabric {
|
|
28
28
|
write(options?: WriteOptions): Promise<void>;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
declare global {
|
|
32
32
|
namespace Kubb {
|
|
33
|
-
interface
|
|
33
|
+
interface Fabric {
|
|
34
34
|
write(options?: WriteOptions): Promise<void>;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
declare const fsPlugin: Plugin<Options$
|
|
38
|
+
declare const fsPlugin: Plugin<Options$2, ExtendOptions$1>;
|
|
39
39
|
//#endregion
|
|
40
40
|
//#region ../fabric-core/src/plugins/barrelPlugin.d.ts
|
|
41
41
|
type Mode = 'all' | 'named' | 'propagate' | false;
|
|
42
|
-
type Options$
|
|
42
|
+
type Options$1 = {
|
|
43
43
|
root: string;
|
|
44
44
|
mode: Mode;
|
|
45
45
|
dryRun?: boolean;
|
|
@@ -48,68 +48,35 @@ type WriteEntryOptions = {
|
|
|
48
48
|
root: string;
|
|
49
49
|
mode: Mode;
|
|
50
50
|
};
|
|
51
|
-
type ExtendOptions
|
|
51
|
+
type ExtendOptions = {
|
|
52
52
|
writeEntry(options: WriteEntryOptions): Promise<void>;
|
|
53
53
|
};
|
|
54
54
|
declare module '@kubb/fabric-core' {
|
|
55
|
-
interface
|
|
55
|
+
interface Fabric {
|
|
56
56
|
writeEntry(options: WriteEntryOptions): Promise<void>;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
declare global {
|
|
60
60
|
namespace Kubb {
|
|
61
|
-
interface
|
|
61
|
+
interface Fabric {
|
|
62
62
|
writeEntry(options: WriteEntryOptions): Promise<void>;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
declare const barrelPlugin: Plugin<Options$
|
|
66
|
+
declare const barrelPlugin: Plugin<Options$1, ExtendOptions>;
|
|
67
67
|
//#endregion
|
|
68
68
|
//#region ../fabric-core/src/plugins/progressPlugin.d.ts
|
|
69
69
|
declare const progressPlugin: Plugin<[], {}>;
|
|
70
70
|
//#endregion
|
|
71
71
|
//#region ../fabric-core/src/plugins/graphPlugin.d.ts
|
|
72
|
-
type Options
|
|
72
|
+
type Options = {
|
|
73
73
|
root: string;
|
|
74
74
|
/**
|
|
75
75
|
* @default false
|
|
76
76
|
*/
|
|
77
77
|
open?: boolean;
|
|
78
78
|
};
|
|
79
|
-
declare const graphPlugin: Plugin<Options
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region src/plugins/reactPlugin.d.ts
|
|
82
|
-
type Options = {
|
|
83
|
-
stdout?: NodeJS.WriteStream;
|
|
84
|
-
stdin?: NodeJS.ReadStream;
|
|
85
|
-
stderr?: NodeJS.WriteStream;
|
|
86
|
-
/**
|
|
87
|
-
* Set this to true to always see the result of the render in the console(line per render)
|
|
88
|
-
*/
|
|
89
|
-
debug?: boolean;
|
|
90
|
-
};
|
|
91
|
-
type ExtendOptions = {
|
|
92
|
-
render(App: ElementType): Promise<void> | void;
|
|
93
|
-
renderToString(App: ElementType): Promise<string> | string;
|
|
94
|
-
waitUntilExit(): Promise<void>;
|
|
95
|
-
};
|
|
96
|
-
declare module '@kubb/fabric-core' {
|
|
97
|
-
interface App {
|
|
98
|
-
render(App: ElementType): Promise<void> | void;
|
|
99
|
-
renderToString(App: ElementType): Promise<string> | string;
|
|
100
|
-
waitUntilExit(): Promise<void>;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
declare global {
|
|
104
|
-
namespace Kubb {
|
|
105
|
-
interface App {
|
|
106
|
-
render(App: ElementType): Promise<void> | void;
|
|
107
|
-
renderToString(App: ElementType): Promise<string> | string;
|
|
108
|
-
waitUntilExit(): Promise<void>;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
declare const reactPlugin: Plugin<Options, ExtendOptions>;
|
|
79
|
+
declare const graphPlugin: Plugin<Options, {}>;
|
|
113
80
|
//#endregion
|
|
114
81
|
export { barrelPlugin, createPlugin, fsPlugin, graphPlugin, progressPlugin, reactPlugin };
|
|
115
82
|
//# sourceMappingURL=plugins.d.cts.map
|
package/dist/plugins.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { r as Extname } from "./KubbFile-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { r as Extname } from "./KubbFile-DFnA3mmn.js";
|
|
2
|
+
import { c as UserPlugin, s as Plugin } from "./Fabric-tVWTpMR5.js";
|
|
3
|
+
import { n as reactPlugin } from "./reactPlugin-B47Guoya.js";
|
|
4
4
|
|
|
5
5
|
//#region ../fabric-core/src/plugins/createPlugin.d.ts
|
|
6
|
-
declare function createPlugin<Options$
|
|
6
|
+
declare function createPlugin<Options$3 = unknown, TAppExtension extends Record<string, any> = {}>(plugin: UserPlugin<Options$3, TAppExtension>): Plugin<Options$3, TAppExtension>;
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region ../fabric-core/src/plugins/fsPlugin.d.ts
|
|
9
9
|
type WriteOptions = {
|
|
10
10
|
extension?: Record<Extname, Extname | ''>;
|
|
11
11
|
};
|
|
12
|
-
type Options$
|
|
12
|
+
type Options$2 = {
|
|
13
13
|
dryRun?: boolean;
|
|
14
14
|
/**
|
|
15
15
|
* Optional callback that is invoked whenever a file is written by the plugin.
|
|
@@ -20,26 +20,26 @@ type Options$3 = {
|
|
|
20
20
|
path: string;
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
|
-
type ExtendOptions$
|
|
23
|
+
type ExtendOptions$1 = {
|
|
24
24
|
write(options?: WriteOptions): Promise<void>;
|
|
25
25
|
};
|
|
26
26
|
declare module '@kubb/fabric-core' {
|
|
27
|
-
interface
|
|
27
|
+
interface Fabric {
|
|
28
28
|
write(options?: WriteOptions): Promise<void>;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
declare global {
|
|
32
32
|
namespace Kubb {
|
|
33
|
-
interface
|
|
33
|
+
interface Fabric {
|
|
34
34
|
write(options?: WriteOptions): Promise<void>;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
declare const fsPlugin: Plugin<Options$
|
|
38
|
+
declare const fsPlugin: Plugin<Options$2, ExtendOptions$1>;
|
|
39
39
|
//#endregion
|
|
40
40
|
//#region ../fabric-core/src/plugins/barrelPlugin.d.ts
|
|
41
41
|
type Mode = 'all' | 'named' | 'propagate' | false;
|
|
42
|
-
type Options$
|
|
42
|
+
type Options$1 = {
|
|
43
43
|
root: string;
|
|
44
44
|
mode: Mode;
|
|
45
45
|
dryRun?: boolean;
|
|
@@ -48,68 +48,35 @@ type WriteEntryOptions = {
|
|
|
48
48
|
root: string;
|
|
49
49
|
mode: Mode;
|
|
50
50
|
};
|
|
51
|
-
type ExtendOptions
|
|
51
|
+
type ExtendOptions = {
|
|
52
52
|
writeEntry(options: WriteEntryOptions): Promise<void>;
|
|
53
53
|
};
|
|
54
54
|
declare module '@kubb/fabric-core' {
|
|
55
|
-
interface
|
|
55
|
+
interface Fabric {
|
|
56
56
|
writeEntry(options: WriteEntryOptions): Promise<void>;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
declare global {
|
|
60
60
|
namespace Kubb {
|
|
61
|
-
interface
|
|
61
|
+
interface Fabric {
|
|
62
62
|
writeEntry(options: WriteEntryOptions): Promise<void>;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
declare const barrelPlugin: Plugin<Options$
|
|
66
|
+
declare const barrelPlugin: Plugin<Options$1, ExtendOptions>;
|
|
67
67
|
//#endregion
|
|
68
68
|
//#region ../fabric-core/src/plugins/progressPlugin.d.ts
|
|
69
69
|
declare const progressPlugin: Plugin<[], {}>;
|
|
70
70
|
//#endregion
|
|
71
71
|
//#region ../fabric-core/src/plugins/graphPlugin.d.ts
|
|
72
|
-
type Options
|
|
72
|
+
type Options = {
|
|
73
73
|
root: string;
|
|
74
74
|
/**
|
|
75
75
|
* @default false
|
|
76
76
|
*/
|
|
77
77
|
open?: boolean;
|
|
78
78
|
};
|
|
79
|
-
declare const graphPlugin: Plugin<Options
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region src/plugins/reactPlugin.d.ts
|
|
82
|
-
type Options = {
|
|
83
|
-
stdout?: NodeJS.WriteStream;
|
|
84
|
-
stdin?: NodeJS.ReadStream;
|
|
85
|
-
stderr?: NodeJS.WriteStream;
|
|
86
|
-
/**
|
|
87
|
-
* Set this to true to always see the result of the render in the console(line per render)
|
|
88
|
-
*/
|
|
89
|
-
debug?: boolean;
|
|
90
|
-
};
|
|
91
|
-
type ExtendOptions = {
|
|
92
|
-
render(App: ElementType): Promise<void> | void;
|
|
93
|
-
renderToString(App: ElementType): Promise<string> | string;
|
|
94
|
-
waitUntilExit(): Promise<void>;
|
|
95
|
-
};
|
|
96
|
-
declare module '@kubb/fabric-core' {
|
|
97
|
-
interface App {
|
|
98
|
-
render(App: ElementType): Promise<void> | void;
|
|
99
|
-
renderToString(App: ElementType): Promise<string> | string;
|
|
100
|
-
waitUntilExit(): Promise<void>;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
declare global {
|
|
104
|
-
namespace Kubb {
|
|
105
|
-
interface App {
|
|
106
|
-
render(App: ElementType): Promise<void> | void;
|
|
107
|
-
renderToString(App: ElementType): Promise<string> | string;
|
|
108
|
-
waitUntilExit(): Promise<void>;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
declare const reactPlugin: Plugin<Options, ExtendOptions>;
|
|
79
|
+
declare const graphPlugin: Plugin<Options, {}>;
|
|
113
80
|
//#endregion
|
|
114
81
|
export { barrelPlugin, createPlugin, fsPlugin, graphPlugin, progressPlugin, reactPlugin };
|
|
115
82
|
//# sourceMappingURL=plugins.d.ts.map
|
package/dist/plugins.js
CHANGED
|
@@ -1,36 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { t as
|
|
3
|
-
import "./jsx-runtime-Dg-pJBHd.js";
|
|
4
|
-
import { createPlugin } from "@kubb/fabric-core/plugins";
|
|
1
|
+
import "./jsx-runtime-CFd_ktZn.js";
|
|
2
|
+
import { t as reactPlugin } from "./plugins-aZCNhIC8.js";
|
|
5
3
|
|
|
6
4
|
export * from "@kubb/fabric-core/plugins"
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
10
|
-
const reactPlugin = createPlugin({
|
|
11
|
-
name: "react",
|
|
12
|
-
install() {},
|
|
13
|
-
inject(app, options = {}) {
|
|
14
|
-
const runtime = new Runtime({
|
|
15
|
-
fileManager: app.context.fileManager,
|
|
16
|
-
...options
|
|
17
|
-
});
|
|
18
|
-
return {
|
|
19
|
-
async render(App) {
|
|
20
|
-
runtime.render((0, import_react.createElement)(App));
|
|
21
|
-
await app.context.events.emit("start");
|
|
22
|
-
},
|
|
23
|
-
async renderToString(App) {
|
|
24
|
-
return runtime.renderToString((0, import_react.createElement)(App));
|
|
25
|
-
},
|
|
26
|
-
async waitUntilExit() {
|
|
27
|
-
await runtime.waitUntilExit();
|
|
28
|
-
await app.context.events.emit("end");
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
//#endregion
|
|
35
|
-
export { reactPlugin };
|
|
36
|
-
//# sourceMappingURL=plugins.js.map
|
|
6
|
+
export { reactPlugin };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { s as Plugin } from "./Fabric-tVWTpMR5.js";
|
|
2
|
+
import { ElementType } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/plugins/reactPlugin.d.ts
|
|
5
|
+
type Options = {
|
|
6
|
+
stdout?: NodeJS.WriteStream;
|
|
7
|
+
stdin?: NodeJS.ReadStream;
|
|
8
|
+
stderr?: NodeJS.WriteStream;
|
|
9
|
+
/**
|
|
10
|
+
* Set this to true to always see the result of the render in the console(line per render)
|
|
11
|
+
*/
|
|
12
|
+
debug?: boolean;
|
|
13
|
+
};
|
|
14
|
+
type ExtendOptions = {
|
|
15
|
+
render(App: ElementType): Promise<void> | void;
|
|
16
|
+
renderToString(App: ElementType): Promise<string> | string;
|
|
17
|
+
waitUntilExit(): Promise<void>;
|
|
18
|
+
};
|
|
19
|
+
declare module '@kubb/fabric-core' {
|
|
20
|
+
interface Fabric {
|
|
21
|
+
render(App: ElementType): Promise<void> | void;
|
|
22
|
+
renderToString(App: ElementType): Promise<string> | string;
|
|
23
|
+
waitUntilExit(): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
declare global {
|
|
27
|
+
namespace Kubb {
|
|
28
|
+
interface Fabric {
|
|
29
|
+
render(App: ElementType): Promise<void> | void;
|
|
30
|
+
renderToString(App: ElementType): Promise<string> | string;
|
|
31
|
+
waitUntilExit(): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
declare const reactPlugin: Plugin<Options, ExtendOptions>;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { reactPlugin as n, Options as t };
|
|
38
|
+
//# sourceMappingURL=reactPlugin-B47Guoya.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { s as Plugin } from "./Fabric-nxgJyzWH.cjs";
|
|
2
|
+
import { ElementType } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/plugins/reactPlugin.d.ts
|
|
5
|
+
type Options = {
|
|
6
|
+
stdout?: NodeJS.WriteStream;
|
|
7
|
+
stdin?: NodeJS.ReadStream;
|
|
8
|
+
stderr?: NodeJS.WriteStream;
|
|
9
|
+
/**
|
|
10
|
+
* Set this to true to always see the result of the render in the console(line per render)
|
|
11
|
+
*/
|
|
12
|
+
debug?: boolean;
|
|
13
|
+
};
|
|
14
|
+
type ExtendOptions = {
|
|
15
|
+
render(App: ElementType): Promise<void> | void;
|
|
16
|
+
renderToString(App: ElementType): Promise<string> | string;
|
|
17
|
+
waitUntilExit(): Promise<void>;
|
|
18
|
+
};
|
|
19
|
+
declare module '@kubb/fabric-core' {
|
|
20
|
+
interface Fabric {
|
|
21
|
+
render(App: ElementType): Promise<void> | void;
|
|
22
|
+
renderToString(App: ElementType): Promise<string> | string;
|
|
23
|
+
waitUntilExit(): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
declare global {
|
|
27
|
+
namespace Kubb {
|
|
28
|
+
interface Fabric {
|
|
29
|
+
render(App: ElementType): Promise<void> | void;
|
|
30
|
+
renderToString(App: ElementType): Promise<string> | string;
|
|
31
|
+
waitUntilExit(): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
declare const reactPlugin: Plugin<Options, ExtendOptions>;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { reactPlugin as n, Options as t };
|
|
38
|
+
//# sourceMappingURL=reactPlugin-CLgWWifj.d.cts.map
|
|
@@ -82,4 +82,4 @@ type JSDoc = {
|
|
|
82
82
|
};
|
|
83
83
|
//#endregion
|
|
84
84
|
export { JSDoc as a, TextNode as c, Params as d, createFunctionParams as f, ElementNames as i, FunctionParams as l, DOMNode as n, Key as o, DOMNodeAttribute as r, KubbNode as s, DOMElement as t, Param as u };
|
|
85
|
-
//# sourceMappingURL=types-
|
|
85
|
+
//# sourceMappingURL=types-DoYRYV1C.d.cts.map
|
|
@@ -82,4 +82,4 @@ type JSDoc = {
|
|
|
82
82
|
};
|
|
83
83
|
//#endregion
|
|
84
84
|
export { JSDoc as a, TextNode as c, Params as d, createFunctionParams as f, ElementNames as i, FunctionParams as l, DOMNode as n, Key as o, DOMNodeAttribute as r, KubbNode as s, DOMElement as t, Param as u };
|
|
85
|
-
//# sourceMappingURL=types-
|
|
85
|
+
//# sourceMappingURL=types-u_NEi07i.d.ts.map
|
package/dist/types.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as JSDoc, c as TextNode, d as Params, i as ElementNames, n as DOMNode, o as Key, r as DOMNodeAttribute, s as KubbNode, t as DOMElement, u as Param } from "./types-
|
|
1
|
+
import { a as JSDoc, c as TextNode, d as Params, i as ElementNames, n as DOMNode, o as Key, r as DOMNodeAttribute, s as KubbNode, t as DOMElement, u as Param } from "./types-DoYRYV1C.cjs";
|
|
2
2
|
export { DOMElement, DOMNode, DOMNodeAttribute, ElementNames, JSDoc, Key, KubbNode, Param, Params, TextNode };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as JSDoc, c as TextNode, d as Params, i as ElementNames, n as DOMNode, o as Key, r as DOMNodeAttribute, s as KubbNode, t as DOMElement, u as Param } from "./types-
|
|
1
|
+
import { a as JSDoc, c as TextNode, d as Params, i as ElementNames, n as DOMNode, o as Key, r as DOMNodeAttribute, s as KubbNode, t as DOMElement, u as Param } from "./types-u_NEi07i.js";
|
|
2
2
|
export { DOMElement, DOMNode, DOMNodeAttribute, ElementNames, JSDoc, Key, KubbNode, Param, Params, TextNode };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/react-fabric",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
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",
|
|
@@ -37,6 +37,10 @@
|
|
|
37
37
|
"import": "./dist/globals.js",
|
|
38
38
|
"require": "./dist/globals.cjs"
|
|
39
39
|
},
|
|
40
|
+
"./jsx-dev-runtime": {
|
|
41
|
+
"import": "./dist/jsx-dev-runtime.js",
|
|
42
|
+
"require": "./dist/jsx-dev-runtime.cjs"
|
|
43
|
+
},
|
|
40
44
|
"./jsx-runtime": {
|
|
41
45
|
"import": "./dist/jsx-runtime.js",
|
|
42
46
|
"require": "./dist/jsx-runtime.cjs"
|
|
@@ -94,18 +98,18 @@
|
|
|
94
98
|
"execa": "^9.6.0",
|
|
95
99
|
"indent-string": "^5.0.0",
|
|
96
100
|
"natural-orderby": "^5.0.0",
|
|
97
|
-
"react": "
|
|
98
|
-
"react-devtools-inline": "^7.0.1",
|
|
101
|
+
"react-devtools-core": "6.1.2",
|
|
99
102
|
"react-reconciler": "0.32.0",
|
|
100
103
|
"signal-exit": "^4.1.0",
|
|
101
|
-
"ws": "
|
|
102
|
-
"@kubb/fabric-core": "0.1
|
|
104
|
+
"ws": "8.18.0",
|
|
105
|
+
"@kubb/fabric-core": "0.2.1"
|
|
103
106
|
},
|
|
104
107
|
"devDependencies": {
|
|
108
|
+
"react": "^19.2.0",
|
|
105
109
|
"@types/react": "^19.2.2",
|
|
106
110
|
"@types/react-reconciler": "0.32.0",
|
|
107
111
|
"@types/ws": "^8.18.1",
|
|
108
|
-
"tsdown": "^0.15.
|
|
112
|
+
"tsdown": "^0.15.10",
|
|
109
113
|
"typescript": "^5.9.3"
|
|
110
114
|
},
|
|
111
115
|
"engines": {
|
|
@@ -117,12 +121,12 @@
|
|
|
117
121
|
},
|
|
118
122
|
"scripts": {
|
|
119
123
|
"build": "tsdown",
|
|
124
|
+
"start": "tsdown --watch ./src",
|
|
120
125
|
"clean": "npx rimraf ./dist",
|
|
121
126
|
"lint": "bun biome lint .",
|
|
122
127
|
"lint:fix": "bun biome lint --fix --unsafe .",
|
|
123
128
|
"release": "pnpm publish --no-git-check",
|
|
124
129
|
"release:canary": "bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check -tag canary",
|
|
125
|
-
"start": "tsdown --watch",
|
|
126
130
|
"start:devtools": "npx react-devtools",
|
|
127
131
|
"test": "vitest --passWithNoTests",
|
|
128
132
|
"test:devtools": "node ./dist/runner.cjs",
|
package/src/Renderer.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import Reconciler from 'react-reconciler'
|
|
1
|
+
import Reconciler, { type ReactContext } from 'react-reconciler'
|
|
2
2
|
import { DefaultEventPriority, NoEventPriority } from 'react-reconciler/constants'
|
|
3
3
|
|
|
4
4
|
import { appendChildNode, createNode, createTextNode, insertBeforeNode, removeChildNode, setAttribute, setTextNodeValue } from './dom.ts'
|
|
5
5
|
import type { KubbNode } from './types'
|
|
6
6
|
import type { DOMElement, DOMNodeAttribute, ElementNames, TextNode } from './types.ts'
|
|
7
|
+
import { createContext } from 'react'
|
|
7
8
|
|
|
8
9
|
declare module 'react-reconciler' {
|
|
9
10
|
// @ts-expect-error custom override
|
|
@@ -119,7 +120,6 @@ export const Renderer = Reconciler({
|
|
|
119
120
|
removeChildFromContainer(node: DOMElement, removeNode: TextNode) {
|
|
120
121
|
removeChildNode(node, removeNode)
|
|
121
122
|
},
|
|
122
|
-
resetFormInstance() {},
|
|
123
123
|
commitMount() {},
|
|
124
124
|
commitUpdate(node: DOMElement, _payload, _type, _oldProps: Props, newProps: Props) {
|
|
125
125
|
const { props } = newProps
|
|
@@ -140,36 +140,40 @@ export const Renderer = Reconciler({
|
|
|
140
140
|
currentUpdatePriority = newPriority
|
|
141
141
|
},
|
|
142
142
|
getCurrentUpdatePriority: () => currentUpdatePriority,
|
|
143
|
-
resolveUpdatePriority
|
|
143
|
+
resolveUpdatePriority() {
|
|
144
|
+
if (currentUpdatePriority !== NoEventPriority) {
|
|
145
|
+
return currentUpdatePriority
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return DefaultEventPriority
|
|
149
|
+
},
|
|
144
150
|
maySuspendCommit() {
|
|
145
151
|
return false
|
|
146
152
|
},
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
return true
|
|
154
|
-
},
|
|
155
|
-
suspendInstance() {},
|
|
153
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
154
|
+
NotPendingTransition: undefined,
|
|
155
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
156
|
+
HostTransitionContext: createContext(null) as unknown as ReactContext<unknown>,
|
|
157
|
+
resetFormInstance() {},
|
|
158
|
+
requestPostPaintCallback() {},
|
|
156
159
|
shouldAttemptEagerTransition() {
|
|
157
160
|
return false
|
|
158
161
|
},
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
+
trackSchedulerEvent() {},
|
|
163
|
+
resolveEventType() {
|
|
164
|
+
return null
|
|
162
165
|
},
|
|
163
|
-
|
|
164
|
-
|
|
166
|
+
resolveEventTimeStamp() {
|
|
167
|
+
return -1.1
|
|
165
168
|
},
|
|
166
|
-
|
|
167
|
-
|
|
169
|
+
preloadInstance() {
|
|
170
|
+
return true
|
|
168
171
|
},
|
|
169
|
-
|
|
170
|
-
|
|
172
|
+
startSuspendingCommit() {},
|
|
173
|
+
suspendInstance() {},
|
|
174
|
+
waitForCommitToBeReady() {
|
|
175
|
+
return null
|
|
171
176
|
},
|
|
172
|
-
HostTransitionContext: undefined as any,
|
|
173
177
|
})
|
|
174
178
|
|
|
175
179
|
export type { FiberRoot } from 'react-reconciler'
|
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
|
|
|
@@ -108,8 +108,8 @@ export class Runtime {
|
|
|
108
108
|
).bind(this)
|
|
109
109
|
|
|
110
110
|
Renderer.injectIntoDevTools({
|
|
111
|
-
bundleType:
|
|
112
|
-
version: '19.1.
|
|
111
|
+
bundleType: 1, // 0 for PROD, 1 for DEV
|
|
112
|
+
version: '19.1.0', // should be React version and not Kubb's custom version
|
|
113
113
|
rendererPackageName: 'kubb', // package name
|
|
114
114
|
})
|
|
115
115
|
}
|
|
@@ -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)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createFabric } from '@kubb/fabric-core'
|
|
2
|
+
import { reactPlugin } from '@kubb/react-fabric/plugins'
|
|
3
|
+
import type { Options } from './plugins/reactPlugin.ts'
|
|
4
|
+
import type { FabricMode } from '@kubb/fabric-core/types'
|
|
5
|
+
import { open } from './devtools.ts'
|
|
6
|
+
|
|
7
|
+
export function createReactFabric(options?: Options & { mode?: FabricMode; devtools?: boolean }) {
|
|
8
|
+
const fabric = createFabric({ mode: options?.mode })
|
|
9
|
+
|
|
10
|
+
if (options?.devtools) {
|
|
11
|
+
open()
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
fabric.use(reactPlugin, options)
|
|
15
|
+
|
|
16
|
+
return fabric
|
|
17
|
+
}
|