@kubb/react-fabric 0.2.19 → 0.3.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/dist/{Fabric-DX0joaWR.d.cts → Fabric-D1uNzkRd.d.cts} +4 -4
- package/dist/{Fabric-7g9iQC3E.d.ts → Fabric-OfeFgFB2.d.ts} +4 -4
- package/dist/{devtools-CLhxB1Hr.cjs → devtools-BajE-eCd.cjs} +1 -3
- package/dist/{devtools-CLhxB1Hr.cjs.map → devtools-BajE-eCd.cjs.map} +1 -1
- package/dist/devtools.cjs +1 -1
- package/dist/globals.d.cts +2 -2
- package/dist/globals.d.ts +2 -2
- package/dist/index.cjs +18 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +16 -17
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.cjs +0 -1
- package/dist/jsx-dev-runtime.d.cts +3 -3
- package/dist/jsx-dev-runtime.d.ts +3 -3
- package/dist/{jsx-namespace-ChOBBWsr.d.ts → jsx-namespace-BEUVmgyn.d.ts} +2 -2
- package/dist/{jsx-namespace-BrIMxQyM.d.cts → jsx-namespace-kapEWb5o.d.cts} +2 -2
- package/dist/jsx-runtime-BhbaU98p.cjs +2 -0
- package/dist/jsx-runtime.cjs +1 -3
- package/dist/jsx-runtime.d.cts +3 -3
- package/dist/jsx-runtime.d.ts +3 -3
- package/dist/parsers.d.cts +1 -2
- package/dist/parsers.d.ts +1 -2
- package/dist/plugins.cjs +2 -2
- package/dist/plugins.d.cts +2 -2
- package/dist/plugins.d.ts +2 -2
- package/dist/plugins.js +1 -1
- package/dist/{reactPlugin-BKFEDZfC.js → reactPlugin-B7zzvM5n.js} +136 -115
- package/dist/reactPlugin-B7zzvM5n.js.map +1 -0
- package/dist/{reactPlugin-CiFqRD0J.cjs → reactPlugin-B9OmXm5F.cjs} +136 -121
- package/dist/reactPlugin-B9OmXm5F.cjs.map +1 -0
- package/dist/{reactPlugin-CNdpw8pN.d.ts → reactPlugin-DVGn6gSn.d.ts} +2 -2
- package/dist/{reactPlugin-DvAUyVTQ.d.cts → reactPlugin-heqDYGKi.d.cts} +2 -2
- package/dist/{types-CGgYj2pZ.d.ts → types-34ycUiHt.d.ts} +3 -3
- package/dist/{types-Xd33VuKS.d.cts → types-zrCju594.d.cts} +3 -3
- package/dist/types.d.cts +2 -2
- package/dist/types.d.ts +2 -2
- package/package.json +2 -2
- package/src/Runtime.tsx +38 -58
- package/src/components/Indent.tsx +3 -3
- package/src/composables/useLifecycle.tsx +3 -1
- package/src/dom.ts +3 -3
- package/src/types.ts +1 -1
- package/src/utils/createJSDoc.ts +3 -4
- package/src/utils/processFiles.ts +15 -19
- package/src/utils/squashExportNodes.ts +21 -11
- package/src/utils/squashImportNodes.ts +22 -11
- package/src/utils/squashSourceNodes.ts +32 -28
- package/src/utils/squashTextNodes.ts +65 -56
- package/dist/jsx-runtime-CywUjp4I.cjs +0 -5
- package/dist/reactPlugin-BKFEDZfC.js.map +0 -1
- package/dist/reactPlugin-CiFqRD0J.cjs.map +0 -1
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
2
|
let react = require("react");
|
|
3
|
-
react = require_chunk.__toESM(react);
|
|
4
3
|
let signal_exit = require("signal-exit");
|
|
5
|
-
signal_exit = require_chunk.__toESM(signal_exit);
|
|
6
4
|
let __kubb_fabric_core_plugins = require("@kubb/fabric-core/plugins");
|
|
7
|
-
__kubb_fabric_core_plugins = require_chunk.__toESM(__kubb_fabric_core_plugins);
|
|
8
5
|
let node_process = require("node:process");
|
|
9
6
|
node_process = require_chunk.__toESM(node_process);
|
|
10
7
|
let react_reconciler_constants_js = require("react-reconciler/constants.js");
|
|
11
|
-
react_reconciler_constants_js = require_chunk.__toESM(react_reconciler_constants_js);
|
|
12
8
|
let react_reconciler = require("react-reconciler");
|
|
13
9
|
react_reconciler = require_chunk.__toESM(react_reconciler);
|
|
14
10
|
let __kubb_fabric_core_parsers_typescript = require("@kubb/fabric-core/parsers/typescript");
|
|
15
|
-
__kubb_fabric_core_parsers_typescript = require_chunk.__toESM(__kubb_fabric_core_parsers_typescript);
|
|
16
11
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
17
|
-
react_jsx_runtime = require_chunk.__toESM(react_jsx_runtime);
|
|
18
12
|
|
|
19
|
-
//#region \0@oxc-project+runtime@0.
|
|
13
|
+
//#region \0@oxc-project+runtime@0.96.0/helpers/typeof.js
|
|
20
14
|
function _typeof(o) {
|
|
21
15
|
"@babel/helpers - typeof";
|
|
22
16
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
@@ -27,7 +21,7 @@ function _typeof(o) {
|
|
|
27
21
|
}
|
|
28
22
|
|
|
29
23
|
//#endregion
|
|
30
|
-
//#region \0@oxc-project+runtime@0.
|
|
24
|
+
//#region \0@oxc-project+runtime@0.96.0/helpers/toPrimitive.js
|
|
31
25
|
function toPrimitive(t, r) {
|
|
32
26
|
if ("object" != _typeof(t) || !t) return t;
|
|
33
27
|
var e = t[Symbol.toPrimitive];
|
|
@@ -40,14 +34,14 @@ function toPrimitive(t, r) {
|
|
|
40
34
|
}
|
|
41
35
|
|
|
42
36
|
//#endregion
|
|
43
|
-
//#region \0@oxc-project+runtime@0.
|
|
37
|
+
//#region \0@oxc-project+runtime@0.96.0/helpers/toPropertyKey.js
|
|
44
38
|
function toPropertyKey(t) {
|
|
45
39
|
var i = toPrimitive(t, "string");
|
|
46
40
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
47
41
|
}
|
|
48
42
|
|
|
49
43
|
//#endregion
|
|
50
|
-
//#region \0@oxc-project+runtime@0.
|
|
44
|
+
//#region \0@oxc-project+runtime@0.96.0/helpers/defineProperty.js
|
|
51
45
|
function _defineProperty(e, r, t) {
|
|
52
46
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
53
47
|
value: t,
|
|
@@ -100,7 +94,7 @@ Root.displayName = "KubbRoot";
|
|
|
100
94
|
const createNode = (nodeName) => {
|
|
101
95
|
return {
|
|
102
96
|
nodeName,
|
|
103
|
-
attributes:
|
|
97
|
+
attributes: /* @__PURE__ */ new Map(),
|
|
104
98
|
childNodes: [],
|
|
105
99
|
parentNode: void 0
|
|
106
100
|
};
|
|
@@ -128,7 +122,7 @@ const removeChildNode = (node, removeNode) => {
|
|
|
128
122
|
if (index >= 0) node.childNodes.splice(index, 1);
|
|
129
123
|
};
|
|
130
124
|
const setAttribute = (node, key, value) => {
|
|
131
|
-
node.attributes
|
|
125
|
+
node.attributes.set(key, value);
|
|
132
126
|
};
|
|
133
127
|
const createTextNode = (text) => {
|
|
134
128
|
const node = {
|
|
@@ -143,13 +137,16 @@ const setTextNodeValue = (node, text) => {
|
|
|
143
137
|
if (typeof text !== "string") text = String(text);
|
|
144
138
|
node.nodeValue = text;
|
|
145
139
|
};
|
|
146
|
-
const nodeNames = [
|
|
140
|
+
const nodeNames = new Set([
|
|
147
141
|
"kubb-export",
|
|
148
142
|
"kubb-file",
|
|
149
143
|
"kubb-source",
|
|
150
144
|
"kubb-import",
|
|
151
|
-
"kubb-text"
|
|
152
|
-
|
|
145
|
+
"kubb-text",
|
|
146
|
+
"kubb-root",
|
|
147
|
+
"kubb-app",
|
|
148
|
+
"br"
|
|
149
|
+
]);
|
|
153
150
|
|
|
154
151
|
//#endregion
|
|
155
152
|
//#region src/Renderer.ts
|
|
@@ -278,28 +275,47 @@ const Renderer = (0, react_reconciler.default)({
|
|
|
278
275
|
//#endregion
|
|
279
276
|
//#region src/utils/squashExportNodes.ts
|
|
280
277
|
function squashExportNodes(node) {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
278
|
+
const exports$1 = /* @__PURE__ */ new Set();
|
|
279
|
+
const walk = (current) => {
|
|
280
|
+
for (const child of current.childNodes) {
|
|
281
|
+
if (!child) continue;
|
|
282
|
+
if (child.nodeName !== "#text" && nodeNames.has(child.nodeName)) walk(child);
|
|
283
|
+
if (child.nodeName === "kubb-export") {
|
|
284
|
+
var _child$attributes$get, _child$attributes$get2;
|
|
285
|
+
exports$1.add({
|
|
286
|
+
name: child.attributes.get("name"),
|
|
287
|
+
path: child.attributes.get("path"),
|
|
288
|
+
isTypeOnly: (_child$attributes$get = child.attributes.get("isTypeOnly")) !== null && _child$attributes$get !== void 0 ? _child$attributes$get : false,
|
|
289
|
+
asAlias: (_child$attributes$get2 = child.attributes.get("asAlias")) !== null && _child$attributes$get2 !== void 0 ? _child$attributes$get2 : false
|
|
290
|
+
});
|
|
291
|
+
}
|
|
287
292
|
}
|
|
288
|
-
}
|
|
293
|
+
};
|
|
294
|
+
walk(node);
|
|
289
295
|
return exports$1;
|
|
290
296
|
}
|
|
291
297
|
|
|
292
298
|
//#endregion
|
|
293
299
|
//#region src/utils/squashImportNodes.ts
|
|
294
300
|
function squashImportNodes(node) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
+
const imports = /* @__PURE__ */ new Set();
|
|
302
|
+
const walk = (current) => {
|
|
303
|
+
for (const child of current.childNodes) {
|
|
304
|
+
if (!child) continue;
|
|
305
|
+
if (child.nodeName !== "#text" && nodeNames.has(child.nodeName)) walk(child);
|
|
306
|
+
if (child.nodeName === "kubb-import") {
|
|
307
|
+
var _child$attributes$get, _child$attributes$get2;
|
|
308
|
+
imports.add({
|
|
309
|
+
name: child.attributes.get("name"),
|
|
310
|
+
path: child.attributes.get("path"),
|
|
311
|
+
root: child.attributes.get("root"),
|
|
312
|
+
isTypeOnly: (_child$attributes$get = child.attributes.get("isTypeOnly")) !== null && _child$attributes$get !== void 0 ? _child$attributes$get : false,
|
|
313
|
+
isNameSpace: (_child$attributes$get2 = child.attributes.get("isNameSpace")) !== null && _child$attributes$get2 !== void 0 ? _child$attributes$get2 : false
|
|
314
|
+
});
|
|
315
|
+
}
|
|
301
316
|
}
|
|
302
|
-
}
|
|
317
|
+
};
|
|
318
|
+
walk(node);
|
|
303
319
|
return imports;
|
|
304
320
|
}
|
|
305
321
|
|
|
@@ -307,71 +323,79 @@ function squashImportNodes(node) {
|
|
|
307
323
|
//#region src/utils/squashTextNodes.ts
|
|
308
324
|
function squashTextNodes(node) {
|
|
309
325
|
let text = "";
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
"kubb-text"
|
|
339
|
-
|
|
340
|
-
"
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
if (
|
|
347
|
-
|
|
348
|
-
}
|
|
349
|
-
nodeText = `<${childNode.nodeName}${attributes}>${squashTextNodes(childNode)}</${childNode.nodeName}>`;
|
|
326
|
+
const walk = (current) => {
|
|
327
|
+
let content = "";
|
|
328
|
+
for (const child of current.childNodes) {
|
|
329
|
+
if (!child) continue;
|
|
330
|
+
let nodeText = "";
|
|
331
|
+
const getPrintText = (text$1) => {
|
|
332
|
+
switch (child.nodeName) {
|
|
333
|
+
case "kubb-import": return (0, __kubb_fabric_core_parsers_typescript.print)((0, __kubb_fabric_core_parsers_typescript.createImport)({
|
|
334
|
+
name: child.attributes.get("name"),
|
|
335
|
+
path: child.attributes.get("path"),
|
|
336
|
+
root: child.attributes.get("root"),
|
|
337
|
+
isTypeOnly: child.attributes.get("isTypeOnly"),
|
|
338
|
+
isNameSpace: child.attributes.get("isNameSpace")
|
|
339
|
+
}));
|
|
340
|
+
case "kubb-export":
|
|
341
|
+
if (child.attributes.has("path")) return (0, __kubb_fabric_core_parsers_typescript.print)((0, __kubb_fabric_core_parsers_typescript.createExport)({
|
|
342
|
+
name: child.attributes.get("name"),
|
|
343
|
+
path: child.attributes.get("path"),
|
|
344
|
+
isTypeOnly: child.attributes.get("isTypeOnly"),
|
|
345
|
+
asAlias: child.attributes.get("asAlias")
|
|
346
|
+
}));
|
|
347
|
+
return "";
|
|
348
|
+
case "kubb-source": return text$1;
|
|
349
|
+
default: return text$1;
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
if (child.nodeName === "#text") nodeText = child.nodeValue;
|
|
353
|
+
else {
|
|
354
|
+
if (child.nodeName === "kubb-text" || child.nodeName === "kubb-file" || child.nodeName === "kubb-source") nodeText = walk(child);
|
|
355
|
+
nodeText = getPrintText(nodeText);
|
|
356
|
+
if (child.nodeName === "br") nodeText = "\n";
|
|
357
|
+
if (!nodeNames.has(child.nodeName)) {
|
|
358
|
+
const attributes = child.attributes;
|
|
359
|
+
let attrString = "";
|
|
360
|
+
const hasAttributes = attributes.size > 0;
|
|
361
|
+
for (const [key, value] of attributes) attrString += typeof value === "string" ? ` ${key}="${value}"` : ` ${key}={${String(value)}}`;
|
|
362
|
+
if (hasAttributes) nodeText = `<${child.nodeName}${attrString}>${walk(child)}</${child.nodeName}>`;
|
|
363
|
+
else nodeText = `<${child.nodeName}>${walk(child)}</${child.nodeName}>`;
|
|
364
|
+
}
|
|
350
365
|
}
|
|
366
|
+
content += nodeText;
|
|
351
367
|
}
|
|
352
|
-
|
|
353
|
-
}
|
|
368
|
+
return content;
|
|
369
|
+
};
|
|
370
|
+
text = walk(node);
|
|
354
371
|
return text;
|
|
355
372
|
}
|
|
356
373
|
|
|
357
374
|
//#endregion
|
|
358
375
|
//#region src/utils/squashSourceNodes.ts
|
|
359
376
|
function squashSourceNodes(node, ignores) {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
377
|
+
const ignoreSet = new Set(ignores);
|
|
378
|
+
const sources = /* @__PURE__ */ new Set();
|
|
379
|
+
const walk = (current) => {
|
|
380
|
+
for (const child of current.childNodes) {
|
|
381
|
+
if (!child) continue;
|
|
382
|
+
if (child.nodeName !== "#text" && ignoreSet.has(child.nodeName)) continue;
|
|
383
|
+
if (child.nodeName === "kubb-source") {
|
|
384
|
+
var _child$attributes$get, _child$attributes$get2, _child$attributes$get3;
|
|
385
|
+
const value = squashTextNodes(child);
|
|
386
|
+
sources.add({
|
|
387
|
+
name: child.attributes.get("name"),
|
|
388
|
+
isTypeOnly: (_child$attributes$get = child.attributes.get("isTypeOnly")) !== null && _child$attributes$get !== void 0 ? _child$attributes$get : false,
|
|
389
|
+
isExportable: (_child$attributes$get2 = child.attributes.get("isExportable")) !== null && _child$attributes$get2 !== void 0 ? _child$attributes$get2 : false,
|
|
390
|
+
isIndexable: (_child$attributes$get3 = child.attributes.get("isIndexable")) !== null && _child$attributes$get3 !== void 0 ? _child$attributes$get3 : false,
|
|
391
|
+
value: value.trim().replace(/^\s+|\s+$/g, "")
|
|
392
|
+
});
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
395
|
+
if (child.nodeName !== "#text" && nodeNames.has(child.nodeName)) walk(child);
|
|
372
396
|
}
|
|
373
|
-
|
|
374
|
-
|
|
397
|
+
};
|
|
398
|
+
walk(node);
|
|
375
399
|
return sources;
|
|
376
400
|
}
|
|
377
401
|
|
|
@@ -380,22 +404,21 @@ function squashSourceNodes(node, ignores) {
|
|
|
380
404
|
async function processFiles(node) {
|
|
381
405
|
const collected = [];
|
|
382
406
|
async function walk(current) {
|
|
383
|
-
for (const
|
|
384
|
-
if (!
|
|
385
|
-
if (
|
|
386
|
-
if (
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
const sources = squashSourceNodes(childNode, ["kubb-export", "kubb-import"]);
|
|
407
|
+
for (const child of current.childNodes) {
|
|
408
|
+
if (!child) continue;
|
|
409
|
+
if (child.nodeName !== "#text" && child.nodeName !== "kubb-file" && nodeNames.has(child.nodeName)) await walk(child);
|
|
410
|
+
if (child.nodeName === "kubb-file") {
|
|
411
|
+
if (child.attributes.has("baseName") && child.attributes.has("path")) {
|
|
412
|
+
const sources = squashSourceNodes(child, ["kubb-export", "kubb-import"]);
|
|
390
413
|
collected.push({
|
|
391
|
-
baseName: attributes.baseName,
|
|
392
|
-
path: attributes.path,
|
|
414
|
+
baseName: child.attributes.get("baseName"),
|
|
415
|
+
path: child.attributes.get("path"),
|
|
416
|
+
meta: child.attributes.get("meta") || {},
|
|
417
|
+
footer: child.attributes.get("footer"),
|
|
418
|
+
banner: child.attributes.get("banner"),
|
|
393
419
|
sources: [...sources],
|
|
394
|
-
exports: [...squashExportNodes(
|
|
395
|
-
imports: [...squashImportNodes(
|
|
396
|
-
meta: attributes.meta || {},
|
|
397
|
-
footer: attributes.footer,
|
|
398
|
-
banner: attributes.banner
|
|
420
|
+
exports: [...squashExportNodes(child)],
|
|
421
|
+
imports: [...squashImportNodes(child)]
|
|
399
422
|
});
|
|
400
423
|
}
|
|
401
424
|
}
|
|
@@ -406,38 +429,38 @@ async function processFiles(node) {
|
|
|
406
429
|
}
|
|
407
430
|
|
|
408
431
|
//#endregion
|
|
409
|
-
//#region \0@oxc-project+runtime@0.
|
|
432
|
+
//#region \0@oxc-project+runtime@0.96.0/helpers/checkPrivateRedeclaration.js
|
|
410
433
|
function _checkPrivateRedeclaration(e, t) {
|
|
411
434
|
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
412
435
|
}
|
|
413
436
|
|
|
414
437
|
//#endregion
|
|
415
|
-
//#region \0@oxc-project+runtime@0.
|
|
438
|
+
//#region \0@oxc-project+runtime@0.96.0/helpers/classPrivateMethodInitSpec.js
|
|
416
439
|
function _classPrivateMethodInitSpec(e, a) {
|
|
417
440
|
_checkPrivateRedeclaration(e, a), a.add(e);
|
|
418
441
|
}
|
|
419
442
|
|
|
420
443
|
//#endregion
|
|
421
|
-
//#region \0@oxc-project+runtime@0.
|
|
444
|
+
//#region \0@oxc-project+runtime@0.96.0/helpers/classPrivateFieldInitSpec.js
|
|
422
445
|
function _classPrivateFieldInitSpec(e, t, a) {
|
|
423
446
|
_checkPrivateRedeclaration(e, t), t.set(e, a);
|
|
424
447
|
}
|
|
425
448
|
|
|
426
449
|
//#endregion
|
|
427
|
-
//#region \0@oxc-project+runtime@0.
|
|
450
|
+
//#region \0@oxc-project+runtime@0.96.0/helpers/assertClassBrand.js
|
|
428
451
|
function _assertClassBrand(e, t, n) {
|
|
429
452
|
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
430
453
|
throw new TypeError("Private element is not present on this object");
|
|
431
454
|
}
|
|
432
455
|
|
|
433
456
|
//#endregion
|
|
434
|
-
//#region \0@oxc-project+runtime@0.
|
|
457
|
+
//#region \0@oxc-project+runtime@0.96.0/helpers/classPrivateFieldGet2.js
|
|
435
458
|
function _classPrivateFieldGet2(s, a) {
|
|
436
459
|
return s.get(_assertClassBrand(s, a));
|
|
437
460
|
}
|
|
438
461
|
|
|
439
462
|
//#endregion
|
|
440
|
-
//#region \0@oxc-project+runtime@0.
|
|
463
|
+
//#region \0@oxc-project+runtime@0.96.0/helpers/classPrivateFieldSet2.js
|
|
441
464
|
function _classPrivateFieldSet2(s, a, r) {
|
|
442
465
|
return s.set(_assertClassBrand(s, a), r), r;
|
|
443
466
|
}
|
|
@@ -471,7 +494,7 @@ var Runtime = class {
|
|
|
471
494
|
if (!((_classPrivateFieldGet2$1 = _classPrivateFieldGet2(_options, this)) === null || _classPrivateFieldGet2$1 === void 0 ? void 0 : _classPrivateFieldGet2$1.debug) && !((_classPrivateFieldGet3 = _classPrivateFieldGet2(_options, this)) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.stdout)) return;
|
|
472
495
|
const output = await _assertClassBrand(_Runtime_brand, this, _getOutput).call(this, _classPrivateFieldGet2(_rootNode, this));
|
|
473
496
|
if ((_classPrivateFieldGet4 = _classPrivateFieldGet2(_options, this)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.debug) {
|
|
474
|
-
console.log("Rendering
|
|
497
|
+
console.log("Rendering:\n");
|
|
475
498
|
console.log(output);
|
|
476
499
|
}
|
|
477
500
|
if (((_classPrivateFieldGet5 = _classPrivateFieldGet2(_options, this)) === null || _classPrivateFieldGet5 === void 0 ? void 0 : _classPrivateFieldGet5.stdout) && node_process.default.env.NODE_ENV !== "test") {
|
|
@@ -495,23 +518,12 @@ var Runtime = class {
|
|
|
495
518
|
const originalError = console.error;
|
|
496
519
|
console.error = (data) => {
|
|
497
520
|
const message = typeof data === "string" ? data : data === null || data === void 0 ? void 0 : data.message;
|
|
498
|
-
if (message === null || message === void 0 ? void 0 : message.match(/Encountered two children with the same key/gi)) return;
|
|
499
|
-
if (message === null || message === void 0 ? void 0 : message.match(/React will try to recreat/gi)) return;
|
|
500
|
-
if (message === null || message === void 0 ? void 0 : message.match(/Each child in a list should have a unique/gi)) return;
|
|
501
|
-
if (message === null || message === void 0 ? void 0 : message.match(/The above error occurred in the <KubbErrorBoundary/gi)) return;
|
|
502
|
-
if (message === null || message === void 0 ? void 0 : message.match(/A React Element from an older version of React was render/gi)) return;
|
|
521
|
+
if ((message === null || message === void 0 ? void 0 : message.match(/Encountered two children with the same key/gi)) || (message === null || message === void 0 ? void 0 : message.match(/React will try to recreat/gi)) || (message === null || message === void 0 ? void 0 : message.match(/Each child in a list should have a unique/gi)) || (message === null || message === void 0 ? void 0 : message.match(/The above error occurred in the <KubbErrorBoundary/gi)) || (message === null || message === void 0 ? void 0 : message.match(/A React Element from an older version of React was render/gi))) return;
|
|
503
522
|
originalError(data);
|
|
504
523
|
};
|
|
505
524
|
const logRecoverableError = typeof reportError === "function" ? reportError : console.error;
|
|
506
525
|
const rootTag = react_reconciler_constants_js.ConcurrentRoot;
|
|
507
|
-
|
|
508
|
-
const isStrictMode = false;
|
|
509
|
-
const concurrentUpdatesByDefaultOverride = false;
|
|
510
|
-
const identifierPrefix = "id";
|
|
511
|
-
const onUncaughtError = logRecoverableError;
|
|
512
|
-
const onCaughtError = logRecoverableError;
|
|
513
|
-
const onRecoverableError = logRecoverableError;
|
|
514
|
-
_classPrivateFieldSet2(_container, this, Renderer.createContainer(_classPrivateFieldGet2(_rootNode, this), rootTag, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, null));
|
|
526
|
+
_classPrivateFieldSet2(_container, this, Renderer.createContainer(_classPrivateFieldGet2(_rootNode, this), rootTag, null, false, false, "id", logRecoverableError, logRecoverableError, logRecoverableError, null));
|
|
515
527
|
this.unsubscribeExit = (0, signal_exit.onExit)((code) => {
|
|
516
528
|
this.unmount(code);
|
|
517
529
|
}, { alwaysLast: false }).bind(this);
|
|
@@ -578,7 +590,10 @@ var Runtime = class {
|
|
|
578
590
|
async function _getOutput(node) {
|
|
579
591
|
const text = squashTextNodes(node);
|
|
580
592
|
const files = this.fileManager.files;
|
|
581
|
-
|
|
593
|
+
if (!files.length) return text;
|
|
594
|
+
const values = /* @__PURE__ */ new Set();
|
|
595
|
+
for (const file of files) for (const source of file.sources) if (source === null || source === void 0 ? void 0 : source.value) values.add(source.value);
|
|
596
|
+
return [...values].join("\n\n");
|
|
582
597
|
}
|
|
583
598
|
|
|
584
599
|
//#endregion
|
|
@@ -651,4 +666,4 @@ Object.defineProperty(exports, 'reactPlugin', {
|
|
|
651
666
|
return reactPlugin;
|
|
652
667
|
}
|
|
653
668
|
});
|
|
654
|
-
//# sourceMappingURL=reactPlugin-
|
|
669
|
+
//# sourceMappingURL=reactPlugin-B9OmXm5F.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactPlugin-B9OmXm5F.cjs","names":["Component","onExit","node: TextNode","NoEventPriority","DefaultEventPriority","exports","text","collected: Array<KubbFile.File>","process","ConcurrentRoot"],"sources":["../src/components/Root.tsx","../src/dom.ts","../src/Renderer.ts","../src/utils/squashExportNodes.ts","../src/utils/squashImportNodes.ts","../src/utils/squashTextNodes.ts","../src/utils/squashSourceNodes.ts","../src/utils/processFiles.ts","../src/Runtime.tsx","../src/plugins/reactPlugin.ts"],"sourcesContent":["import { Component, createContext } from 'react'\n\nimport type { KubbNode } from '../types.ts'\n\ntype ErrorBoundaryProps = {\n onError: (error: Error) => void\n children?: KubbNode\n}\n\nclass ErrorBoundary extends Component<{\n onError: ErrorBoundaryProps['onError']\n children?: KubbNode\n}> {\n state = { hasError: false }\n\n static displayName = 'KubbErrorBoundary'\n static getDerivedStateFromError(_error: Error) {\n return { hasError: true }\n }\n\n componentDidCatch(error: Error) {\n if (error) {\n this.props.onError(error)\n }\n }\n\n render() {\n if (this.state.hasError) {\n return null\n }\n return this.props.children\n }\n}\n\nexport type RootContextProps = {\n /**\n * Exit (unmount) the whole Ink app.\n */\n readonly exit: (error?: Error) => void\n}\n\nexport const RootContext = createContext<RootContextProps>({\n exit: () => {},\n})\n\ntype RootProps = {\n /**\n * Exit (unmount) hook\n */\n readonly onExit: (error?: Error) => void\n /**\n * Error hook\n */\n readonly onError: (error: Error) => void\n readonly children?: KubbNode\n}\n\nexport function Root({ onError, onExit, children }: RootProps) {\n try {\n return (\n <ErrorBoundary\n onError={(error) => {\n onError(error)\n }}\n >\n <RootContext.Provider value={{ exit: onExit }}>{children}</RootContext.Provider>\n </ErrorBoundary>\n )\n } catch (_e) {\n return null\n }\n}\n\nRoot.Context = RootContext\nRoot.displayName = 'KubbRoot'\n","import type { DOMElement, DOMNode, DOMNodeAttribute, ElementNames, TextNode } from './types.ts'\n\nexport const createNode = (nodeName: string): DOMElement => {\n const node: DOMElement = {\n nodeName: nodeName as DOMElement['nodeName'],\n attributes: new Map(),\n childNodes: [],\n parentNode: undefined,\n }\n\n return node\n}\n\nexport const appendChildNode = (node: DOMNode, childNode: DOMElement | DOMNode): void => {\n if (childNode.parentNode) {\n removeChildNode(childNode.parentNode, childNode)\n }\n\n if (node.nodeName !== '#text') {\n childNode.parentNode = node\n node.childNodes.push(childNode)\n }\n}\n\nexport const insertBeforeNode = (node: DOMElement, newChildNode: DOMNode, beforeChildNode: DOMNode): void => {\n if (newChildNode.parentNode) {\n removeChildNode(newChildNode.parentNode, newChildNode)\n }\n\n newChildNode.parentNode = node\n\n const index = node.childNodes.indexOf(beforeChildNode)\n if (index >= 0) {\n node.childNodes.splice(index, 0, newChildNode)\n\n return\n }\n\n node.childNodes.push(newChildNode)\n}\n\nexport const removeChildNode = (node: DOMElement, removeNode: DOMNode): void => {\n removeNode.parentNode = undefined\n\n const index = node.childNodes.indexOf(removeNode)\n if (index >= 0) {\n node.childNodes.splice(index, 1)\n }\n}\n\nexport const setAttribute = (node: DOMElement, key: string, value: DOMNodeAttribute): void => {\n node.attributes.set(key, value)\n}\n\nexport const createTextNode = (text: string): TextNode => {\n const node: TextNode = {\n nodeName: '#text',\n nodeValue: text,\n parentNode: undefined,\n }\n\n setTextNodeValue(node, text)\n\n return node\n}\n\nexport const setTextNodeValue = (node: TextNode, text: string): void => {\n if (typeof text !== 'string') {\n text = String(text)\n }\n\n node.nodeValue = text\n}\n\nexport const nodeNames = new Set<ElementNames>(['kubb-export', 'kubb-file', 'kubb-source', 'kubb-import', 'kubb-text', 'kubb-root', 'kubb-app', 'br'])\n","import { createContext } from 'react'\nimport Reconciler, { type ReactContext } from 'react-reconciler'\nimport { DefaultEventPriority, NoEventPriority } from 'react-reconciler/constants.js'\nimport { appendChildNode, createNode, createTextNode, insertBeforeNode, removeChildNode, setAttribute, setTextNodeValue } from './dom.ts'\nimport type { KubbNode } from './types'\nimport type { DOMElement, DOMNodeAttribute, ElementNames, TextNode } from './types.ts'\n\ndeclare module 'react-reconciler' {\n // @ts-expect-error custom override\n interface Reconciler {\n updateContainerSync(element: KubbNode, container: unknown, parentComponent: any, callback?: null | (() => void)): void\n flushSyncWork(): void\n createContainer(\n containerInfo: unknown,\n tag: Reconciler.RootTag,\n hydrationCallbacks: null | Reconciler.SuspenseHydrationCallbacks<any>,\n isStrictMode: boolean,\n concurrentUpdatesByDefaultOverride: null | boolean,\n identifierPrefix: string,\n onUncaughtError: (error: Error) => void,\n onCaughtError: (error: Error) => void,\n onRecoverableError: (error: Error) => void,\n transitionCallbacks: null | Reconciler.TransitionTracingCallbacks,\n ): Reconciler.OpaqueRoot\n }\n}\n\ntype Props = Record<string, unknown>\n\ntype HostContext = {\n type: ElementNames\n isFile: boolean\n isSource: boolean\n}\n\nlet currentUpdatePriority = NoEventPriority\n\n/**\n * @link https://www.npmjs.com/package/react-devtools-inline\n * @link https://github.com/nitin42/Making-a-custom-React-renderer/blob/master/part-one.md\n * @link https://github.com/facebook/react/tree/main/packages/react-reconciler#practical-examples\n * @link https://github.com/vadimdemedes/ink\n * @link https://github.com/pixijs/pixi-react/tree/main/packages\n * @link https://github.com/diegomura/react-pdf/blob/master/packages/reconciler/src/reconciler-31.ts\n */\nexport const Renderer = Reconciler({\n getRootHostContext: () => ({\n type: 'kubb-root',\n isFile: false,\n isSource: false,\n }),\n prepareForCommit: () => {\n return null\n },\n preparePortalMount: () => null,\n clearContainer: () => false,\n resetAfterCommit(rootNode: DOMElement) {\n if (typeof rootNode.onRender === 'function') {\n rootNode.onRender()\n }\n },\n getChildHostContext(parentHostContext: HostContext, type: ElementNames) {\n const isInsideText = type === 'kubb-text'\n const isFile = type === 'kubb-file' || parentHostContext.isFile\n const isSource = type === 'kubb-source' || parentHostContext.isSource\n\n return { isInsideText, isFile, isSource, type }\n },\n shouldSetTextContent: () => false,\n createInstance(originalType: ElementNames, newProps: Props, _root: DOMElement) {\n const node = createNode(originalType)\n\n for (const [key, value] of Object.entries(newProps)) {\n if (key === 'children') {\n continue\n }\n\n setAttribute(node, key, value as DOMNodeAttribute)\n }\n\n return node\n },\n createTextInstance(text: string, _root: DOMElement, hostContext: HostContext) {\n if (hostContext.isFile && !hostContext.isSource) {\n throw new Error(`[react] '${text}' should be part of <File.Source> component when using the <File/> component`)\n }\n\n return createTextNode(text)\n },\n resetTextContent() {},\n hideTextInstance(node: TextNode) {\n setTextNodeValue(node, '')\n },\n unhideTextInstance(node: TextNode, text: string) {\n setTextNodeValue(node, text)\n },\n getPublicInstance: (instance) => instance,\n appendInitialChild: appendChildNode,\n appendChild: appendChildNode,\n insertBefore: insertBeforeNode,\n finalizeInitialChildren(_node, _type, _props, _rootNode) {\n return false\n },\n supportsMutation: true,\n isPrimaryRenderer: true,\n supportsPersistence: false,\n supportsHydration: false,\n scheduleTimeout: setTimeout,\n cancelTimeout: clearTimeout,\n noTimeout: -1,\n beforeActiveInstanceBlur() {},\n afterActiveInstanceBlur() {},\n detachDeletedInstance() {},\n getInstanceFromNode: () => null,\n prepareScopeUpdate() {},\n getInstanceFromScope: () => null,\n appendChildToContainer: appendChildNode,\n insertInContainerBefore: insertBeforeNode,\n removeChildFromContainer(node: DOMElement, removeNode: TextNode) {\n removeChildNode(node, removeNode)\n },\n commitMount() {},\n commitUpdate(node: DOMElement, _payload, _type, _oldProps: Props, newProps: Props) {\n const { props } = newProps\n\n if (props) {\n for (const [key, value] of Object.entries(props)) {\n setAttribute(node, key, value as DOMNodeAttribute)\n }\n }\n },\n commitTextUpdate(node: TextNode, _oldText, newText) {\n setTextNodeValue(node, newText)\n },\n removeChild(node: DOMElement, removeNode: TextNode) {\n removeChildNode(node, removeNode)\n },\n setCurrentUpdatePriority: (newPriority: number) => {\n currentUpdatePriority = newPriority\n },\n getCurrentUpdatePriority: () => currentUpdatePriority,\n resolveUpdatePriority() {\n if (currentUpdatePriority !== NoEventPriority) {\n return currentUpdatePriority\n }\n\n return DefaultEventPriority\n },\n maySuspendCommit() {\n return false\n },\n // eslint-disable-next-line @typescript-eslint/naming-convention\n NotPendingTransition: undefined,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n HostTransitionContext: createContext(null) as unknown as ReactContext<unknown>,\n resetFormInstance() {},\n requestPostPaintCallback() {},\n shouldAttemptEagerTransition() {\n return false\n },\n trackSchedulerEvent() {},\n resolveEventType() {\n return null\n },\n resolveEventTimeStamp() {\n return -1.1\n },\n preloadInstance() {\n return true\n },\n startSuspendingCommit() {},\n suspendInstance() {},\n waitForCommitToBeReady() {\n return null\n },\n})\n\nexport type { FiberRoot } from 'react-reconciler'\n","import type { KubbFile } from '@kubb/fabric-core/types'\n\nimport { nodeNames } from '../dom.ts'\nimport type { DOMElement } from '../types.ts'\n\nexport function squashExportNodes(node: DOMElement): Set<KubbFile.ResolvedExport> {\n const exports = new Set<KubbFile.ResolvedExport>()\n\n const walk = (current: DOMElement): void => {\n for (const child of current.childNodes) {\n if (!child) {\n continue\n }\n\n if (child.nodeName !== '#text' && nodeNames.has(child.nodeName)) {\n walk(child)\n }\n\n if (child.nodeName === 'kubb-export') {\n exports.add({\n name: child.attributes.get('name'),\n path: child.attributes.get('path'),\n isTypeOnly: child.attributes.get('isTypeOnly') ?? false,\n asAlias: child.attributes.get('asAlias') ?? false,\n } as KubbFile.Export)\n }\n }\n }\n\n walk(node)\n return exports\n}\n","import type { KubbFile } from '@kubb/fabric-core/types'\n\nimport { nodeNames } from '../dom.ts'\nimport type { DOMElement } from '../types.ts'\n\nexport function squashImportNodes(node: DOMElement): Set<KubbFile.Import> {\n const imports = new Set<KubbFile.Import>()\n\n const walk = (current: DOMElement): void => {\n for (const child of current.childNodes) {\n if (!child) {\n continue\n }\n\n if (child.nodeName !== '#text' && nodeNames.has(child.nodeName)) {\n walk(child)\n }\n\n if (child.nodeName === 'kubb-import') {\n imports.add({\n name: child.attributes.get('name'),\n path: child.attributes.get('path'),\n root: child.attributes.get('root'),\n isTypeOnly: child.attributes.get('isTypeOnly') ?? false,\n isNameSpace: child.attributes.get('isNameSpace') ?? false,\n } as KubbFile.Import)\n }\n }\n }\n\n walk(node)\n return imports\n}\n","import { createExport, createImport, print } from '@kubb/fabric-core/parsers/typescript'\n\nimport { nodeNames } from '../dom.ts'\nimport type { DOMElement, KubbFile } from '../types.ts'\n\nexport function squashTextNodes(node: DOMElement): string {\n let text = ''\n\n const walk = (current: DOMElement): string => {\n let content = ''\n\n for (const child of current.childNodes) {\n if (!child) {\n continue\n }\n\n let nodeText = ''\n\n const getPrintText = (text: string): string => {\n switch (child.nodeName) {\n case 'kubb-import': {\n return print(\n createImport({\n name: child.attributes.get('name'),\n path: child.attributes.get('path'),\n root: child.attributes.get('root'),\n isTypeOnly: child.attributes.get('isTypeOnly'),\n isNameSpace: child.attributes.get('isNameSpace'),\n } as KubbFile.Import),\n )\n }\n case 'kubb-export': {\n if (child.attributes.has('path')) {\n return print(\n createExport({\n name: child.attributes.get('name'),\n path: child.attributes.get('path'),\n isTypeOnly: child.attributes.get('isTypeOnly'),\n asAlias: child.attributes.get('asAlias'),\n } as KubbFile.Export),\n )\n }\n return ''\n }\n case 'kubb-source':\n return text\n default:\n return text\n }\n }\n\n if (child.nodeName === '#text') {\n nodeText = child.nodeValue\n } else {\n if (child.nodeName === 'kubb-text' || child.nodeName === 'kubb-file' || child.nodeName === 'kubb-source') {\n nodeText = walk(child)\n }\n\n nodeText = getPrintText(nodeText)\n\n if (child.nodeName === 'br') {\n nodeText = '\\n'\n }\n\n if (!nodeNames.has(child.nodeName)) {\n const attributes = child.attributes\n let attrString = ''\n const hasAttributes = attributes.size > 0\n\n for (const [key, value] of attributes) {\n attrString += typeof value === 'string' ? ` ${key}=\"${value}\"` : ` ${key}={${String(value)}}`\n }\n\n if (hasAttributes) {\n nodeText = `<${child.nodeName}${attrString}>${walk(child)}</${child.nodeName}>`\n } else {\n nodeText = `<${child.nodeName}>${walk(child)}</${child.nodeName}>`\n }\n }\n }\n\n content += nodeText\n }\n\n return content\n }\n\n text = walk(node)\n\n return text\n}\n","import type { KubbFile } from '@kubb/fabric-core/types'\n\nimport { nodeNames } from '../dom.ts'\nimport type { DOMElement, ElementNames } from '../types.ts'\nimport { squashTextNodes } from './squashTextNodes.ts'\n\nexport function squashSourceNodes(node: DOMElement, ignores: Array<ElementNames>): Set<KubbFile.Source> {\n const ignoreSet = new Set(ignores)\n const sources = new Set<KubbFile.Source>()\n\n const walk = (current: DOMElement): void => {\n for (const child of current.childNodes) {\n if (!child) {\n continue\n }\n\n if (child.nodeName !== '#text' && ignoreSet.has(child.nodeName)) {\n continue\n }\n\n if (child.nodeName === 'kubb-source') {\n const value = squashTextNodes(child)\n\n sources.add({\n name: child.attributes.get('name'),\n isTypeOnly: child.attributes.get('isTypeOnly') ?? false,\n isExportable: child.attributes.get('isExportable') ?? false,\n isIndexable: child.attributes.get('isIndexable') ?? false,\n // trim whitespace/newlines\n value: value.trim().replace(/^\\s+|\\s+$/g, ''),\n } as KubbFile.Source)\n continue\n }\n\n if (child.nodeName !== '#text' && nodeNames.has(child.nodeName)) {\n walk(child)\n }\n }\n }\n\n walk(node)\n return sources\n}\n","import type { KubbFile } from '@kubb/fabric-core/types'\nimport { nodeNames } from '../dom.ts'\nimport type { DOMElement } from '../types.ts'\nimport { squashExportNodes } from './squashExportNodes.ts'\nimport { squashImportNodes } from './squashImportNodes.ts'\nimport { squashSourceNodes } from './squashSourceNodes.ts'\n\nexport async function processFiles(node: DOMElement): Promise<Array<KubbFile.File>> {\n const collected: Array<KubbFile.File> = []\n\n async function walk(current: DOMElement) {\n for (const child of current.childNodes) {\n if (!child) {\n continue\n }\n\n if (child.nodeName !== '#text' && child.nodeName !== 'kubb-file' && nodeNames.has(child.nodeName)) {\n await walk(child)\n }\n\n if (child.nodeName === 'kubb-file') {\n if (child.attributes.has('baseName') && child.attributes.has('path')) {\n const sources = squashSourceNodes(child, ['kubb-export', 'kubb-import'])\n\n collected.push({\n baseName: child.attributes.get('baseName'),\n path: child.attributes.get('path'),\n meta: child.attributes.get('meta') || {},\n footer: child.attributes.get('footer'),\n banner: child.attributes.get('banner'),\n sources: [...sources],\n exports: [...squashExportNodes(child)],\n imports: [...squashImportNodes(child)],\n } as KubbFile.File)\n }\n }\n }\n }\n\n await walk(node)\n\n return collected\n}\n","import process from 'node:process'\nimport type { FileManager } from '@kubb/fabric-core'\nimport type { ReactNode } from 'react'\nimport { ConcurrentRoot } from 'react-reconciler/constants.js'\nimport { onExit } from 'signal-exit'\nimport { Root } from './components/Root.tsx'\nimport { createNode } from './dom.ts'\nimport type { FiberRoot } from './Renderer.ts'\nimport { Renderer } from './Renderer.ts'\nimport type { DOMElement } from './types.ts'\nimport { processFiles } from './utils/processFiles.ts'\nimport { squashTextNodes } from './utils/squashTextNodes.ts'\n\ntype Options = {\n fileManager: FileManager\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\nexport class Runtime {\n readonly #options: Options\n #isUnmounted: boolean\n\n exitPromise?: Promise<void>\n readonly #container: FiberRoot\n readonly #rootNode: DOMElement\n\n constructor(options: Options) {\n this.#options = options\n this.#rootNode = createNode('kubb-root')\n this.#rootNode.onRender = this.onRender\n this.#rootNode.onImmediateRender = this.onRender\n this.#isUnmounted = false\n this.unmount.bind(this)\n\n // Intercept noisy React errors\n const originalError = console.error\n console.error = (data: string | Error) => {\n const message = typeof data === 'string' ? data : data?.message\n if (\n message?.match(/Encountered two children with the same key/gi) ||\n message?.match(/React will try to recreat/gi) ||\n message?.match(/Each child in a list should have a unique/gi) ||\n message?.match(/The above error occurred in the <KubbErrorBoundary/gi) ||\n message?.match(/A React Element from an older version of React was render/gi)\n ) {\n return\n }\n originalError(data)\n }\n\n const logRecoverableError = typeof reportError === 'function' ? reportError : console.error\n\n const rootTag = ConcurrentRoot\n this.#container = Renderer.createContainer(\n this.#rootNode,\n rootTag,\n null,\n false,\n false,\n 'id',\n logRecoverableError,\n logRecoverableError,\n logRecoverableError,\n null,\n )\n\n // Unmount when process exits\n this.unsubscribeExit = onExit(\n (code) => {\n this.unmount(code)\n },\n { alwaysLast: false },\n ).bind(this)\n\n Renderer.injectIntoDevTools({\n bundleType: 1,\n version: '19.1.0',\n rendererPackageName: 'kubb',\n })\n }\n\n get fileManager() {\n return this.#options.fileManager\n }\n\n #renderPromise: Promise<void> = Promise.resolve()\n resolveExitPromise: () => void = () => {}\n rejectExitPromise: (reason?: Error) => void = () => {}\n unsubscribeExit: () => void = () => {}\n\n onRender: () => Promise<void> = () => {\n const previous = this.#renderPromise\n\n const task = previous\n .catch(() => {})\n .then(async () => {\n if (this.#isUnmounted) {\n return\n }\n\n const files = await processFiles(this.#rootNode)\n\n await this.fileManager.add(...files)\n\n if (!this.#options?.debug && !this.#options?.stdout) {\n return\n }\n\n const output = await this.#getOutput(this.#rootNode)\n\n if (this.#options?.debug) {\n console.log('Rendering:\\n')\n console.log(output)\n }\n\n if (this.#options?.stdout && process.env.NODE_ENV !== 'test') {\n this.#options.stdout.clearLine(0)\n this.#options.stdout.cursorTo(0)\n this.#options.stdout.write(output)\n }\n })\n\n this.#renderPromise = task.catch((error) => {\n this.onError(error as Error)\n throw error\n })\n\n return this.#renderPromise\n }\n\n onError(error: Error): void {\n if (process.env.NODE_ENV === 'test') {\n console.warn(error)\n }\n\n throw error\n }\n\n onExit(error?: Error): void {\n this.unmount(error)\n }\n\n async #getOutput(node: DOMElement): Promise<string> {\n const text = squashTextNodes(node)\n const files = this.fileManager.files\n\n if (!files.length) {\n return text\n }\n\n const values = new Set<string>()\n for (const file of files) {\n for (const source of file.sources) {\n if (source?.value) {\n values.add(source.value)\n }\n }\n }\n\n return [...values].join('\\n\\n')\n }\n\n async render(node: ReactNode): Promise<void> {\n const element = (\n <Root onExit={this.onExit.bind(this)} onError={this.onError.bind(this)}>\n {node}\n </Root>\n )\n\n Renderer.updateContainerSync(element, this.#container, null, null)\n Renderer.flushSyncWork()\n await this.#renderPromise\n }\n\n async renderToString(node: ReactNode): Promise<string> {\n const element = (\n <Root onExit={this.onExit.bind(this)} onError={this.onError.bind(this)}>\n {node}\n </Root>\n )\n\n Renderer.updateContainerSync(element, this.#container, null, null)\n Renderer.flushSyncWork()\n\n await this.#renderPromise\n this.fileManager.clear()\n\n return this.#getOutput(this.#rootNode)\n }\n\n unmount(error?: Error | number | null): void {\n if (this.#isUnmounted) {\n return\n }\n\n if (this.#options?.debug) {\n console.log('Unmount', error)\n }\n\n this.onRender()\n this.unsubscribeExit()\n\n this.#isUnmounted = true\n\n Renderer.updateContainerSync(null, this.#container, null, null)\n\n if (error instanceof Error) {\n this.rejectExitPromise(error)\n return\n }\n\n this.resolveExitPromise()\n }\n\n async waitUntilExit(): Promise<void> {\n if (!this.exitPromise) {\n this.exitPromise = new Promise((resolve, reject) => {\n this.resolveExitPromise = resolve\n this.rejectExitPromise = reject\n })\n }\n\n return this.exitPromise\n }\n}\n","import { createPlugin } from '@kubb/fabric-core/plugins'\nimport { createElement, type ElementType } from 'react'\nimport { Runtime } from '../Runtime.tsx'\n\nexport type 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>\n renderToString(App: ElementType): Promise<string>\n waitUntilExit(): Promise<void>\n}\n\ndeclare global {\n namespace Kubb {\n interface Fabric {\n render(App: ElementType): Promise<void>\n renderToString(App: ElementType): Promise<string>\n waitUntilExit(): Promise<void>\n }\n }\n}\n\nexport const reactPlugin = createPlugin<Options, ExtendOptions>({\n name: 'react',\n install() {},\n inject(ctx, options = {}) {\n const runtime = new Runtime({ fileManager: ctx.fileManager, ...options })\n\n return {\n async render(App) {\n await runtime.render(createElement(App))\n await ctx.emit('start')\n },\n async renderToString(App) {\n await ctx.emit('start')\n return runtime.renderToString(createElement(App))\n },\n async waitUntilExit() {\n await runtime.waitUntilExit()\n\n await ctx.emit('end')\n },\n }\n },\n})\n"],"mappings":";;;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,CAAC;;GAEnD,MAAM,gBAAgB;AACpB,UAAM,QAAQ,eAAe;AAE7B,UAAM,IAAI,KAAK,MAAM;;GAExB;;CAEJ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as Plugin } from "./Fabric-
|
|
1
|
+
import { o as Plugin } from "./Fabric-OfeFgFB2.js";
|
|
2
2
|
import { ElementType } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/reactPlugin.d.ts
|
|
@@ -28,4 +28,4 @@ declare global {
|
|
|
28
28
|
declare const reactPlugin: Plugin<Options, ExtendOptions>;
|
|
29
29
|
//#endregion
|
|
30
30
|
export { reactPlugin as n, Options as t };
|
|
31
|
-
//# sourceMappingURL=reactPlugin-
|
|
31
|
+
//# sourceMappingURL=reactPlugin-DVGn6gSn.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as Plugin } from "./Fabric-
|
|
1
|
+
import { o as Plugin } from "./Fabric-D1uNzkRd.cjs";
|
|
2
2
|
import { ElementType } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/reactPlugin.d.ts
|
|
@@ -28,4 +28,4 @@ declare global {
|
|
|
28
28
|
declare const reactPlugin: Plugin<Options, ExtendOptions>;
|
|
29
29
|
//#endregion
|
|
30
30
|
export { reactPlugin as n, Options as t };
|
|
31
|
-
//# sourceMappingURL=reactPlugin-
|
|
31
|
+
//# sourceMappingURL=reactPlugin-heqDYGKi.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as Source, g as Import, h as File, p as Export } from "./Fabric-
|
|
1
|
+
import { b as Source, g as Import, h as File, p as Export } from "./Fabric-OfeFgFB2.js";
|
|
2
2
|
import React, { JSX, Key, ReactNode } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/getFunctionParams.d.ts
|
|
@@ -67,7 +67,7 @@ type DOMNode<T = {
|
|
|
67
67
|
type OutputTransformer = (s: string, index: number) => string;
|
|
68
68
|
type DOMElement = {
|
|
69
69
|
nodeName: ElementNames;
|
|
70
|
-
attributes:
|
|
70
|
+
attributes: Map<string, DOMNodeAttribute>;
|
|
71
71
|
childNodes: DOMNode[];
|
|
72
72
|
internal_transform?: OutputTransformer;
|
|
73
73
|
isStaticDirty?: boolean;
|
|
@@ -101,4 +101,4 @@ type KubbExportProps = Export;
|
|
|
101
101
|
type LineBreakProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
|
|
102
102
|
//#endregion
|
|
103
103
|
export { Param as _, JSDoc as a, KubbExportProps as c, KubbNode as d, KubbSourceProps as f, FunctionParams as g, TextNode as h, ElementNames as i, KubbFileProps as l, LineBreakProps as m, DOMNode as n, Key as o, KubbTextProps as p, DOMNodeAttribute as r, KubbElement as s, DOMElement as t, KubbImportProps as u, Params as v, createFunctionParams as y };
|
|
104
|
-
//# sourceMappingURL=types-
|
|
104
|
+
//# sourceMappingURL=types-34ycUiHt.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as Source, g as Import, h as File, p as Export } from "./Fabric-
|
|
1
|
+
import { b as Source, g as Import, h as File, p as Export } from "./Fabric-D1uNzkRd.cjs";
|
|
2
2
|
import React, { JSX, Key, ReactNode } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/getFunctionParams.d.ts
|
|
@@ -67,7 +67,7 @@ type DOMNode<T = {
|
|
|
67
67
|
type OutputTransformer = (s: string, index: number) => string;
|
|
68
68
|
type DOMElement = {
|
|
69
69
|
nodeName: ElementNames;
|
|
70
|
-
attributes:
|
|
70
|
+
attributes: Map<string, DOMNodeAttribute>;
|
|
71
71
|
childNodes: DOMNode[];
|
|
72
72
|
internal_transform?: OutputTransformer;
|
|
73
73
|
isStaticDirty?: boolean;
|
|
@@ -101,4 +101,4 @@ type KubbExportProps = Export;
|
|
|
101
101
|
type LineBreakProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
|
|
102
102
|
//#endregion
|
|
103
103
|
export { Param as _, JSDoc as a, KubbExportProps as c, KubbNode as d, KubbSourceProps as f, FunctionParams as g, TextNode as h, ElementNames as i, KubbFileProps as l, LineBreakProps as m, DOMNode as n, Key as o, KubbTextProps as p, DOMNodeAttribute as r, KubbElement as s, DOMElement as t, KubbImportProps as u, Params as v, createFunctionParams as y };
|
|
104
|
-
//# sourceMappingURL=types-
|
|
104
|
+
//# sourceMappingURL=types-zrCju594.d.cts.map
|
package/dist/types.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { _ as KubbFile_d_exports, a as FabricOptions, i as FabricMode, n as FabricConfig, r as FabricContext } from "./Fabric-
|
|
2
|
-
import { _ as Param, a as JSDoc, c as KubbExportProps, d as KubbNode, f as KubbSourceProps, h as TextNode, i as ElementNames, l as KubbFileProps, m as LineBreakProps, n as DOMNode, o as Key, p as KubbTextProps, r as DOMNodeAttribute, s as KubbElement, t as DOMElement, u as KubbImportProps, v as Params } from "./types-
|
|
1
|
+
import { _ as KubbFile_d_exports, a as FabricOptions, i as FabricMode, n as FabricConfig, r as FabricContext } from "./Fabric-D1uNzkRd.cjs";
|
|
2
|
+
import { _ as Param, a as JSDoc, c as KubbExportProps, d as KubbNode, f as KubbSourceProps, h as TextNode, i as ElementNames, l as KubbFileProps, m as LineBreakProps, n as DOMNode, o as Key, p as KubbTextProps, r as DOMNodeAttribute, s as KubbElement, t as DOMElement, u as KubbImportProps, v as Params } from "./types-zrCju594.cjs";
|
|
3
3
|
export { DOMElement, DOMNode, DOMNodeAttribute, ElementNames, FabricConfig, FabricContext, FabricMode, FabricOptions, JSDoc, Key, KubbElement, KubbExportProps, KubbFile_d_exports as KubbFile, KubbFileProps, KubbImportProps, KubbNode, KubbSourceProps, KubbTextProps, LineBreakProps, Param, Params, TextNode };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { _ as KubbFile_d_exports, a as FabricOptions, i as FabricMode, n as FabricConfig, r as FabricContext } from "./Fabric-
|
|
2
|
-
import { _ as Param, a as JSDoc, c as KubbExportProps, d as KubbNode, f as KubbSourceProps, h as TextNode, i as ElementNames, l as KubbFileProps, m as LineBreakProps, n as DOMNode, o as Key, p as KubbTextProps, r as DOMNodeAttribute, s as KubbElement, t as DOMElement, u as KubbImportProps, v as Params } from "./types-
|
|
1
|
+
import { _ as KubbFile_d_exports, a as FabricOptions, i as FabricMode, n as FabricConfig, r as FabricContext } from "./Fabric-OfeFgFB2.js";
|
|
2
|
+
import { _ as Param, a as JSDoc, c as KubbExportProps, d as KubbNode, f as KubbSourceProps, h as TextNode, i as ElementNames, l as KubbFileProps, m as LineBreakProps, n as DOMNode, o as Key, p as KubbTextProps, r as DOMNodeAttribute, s as KubbElement, t as DOMElement, u as KubbImportProps, v as Params } from "./types-34ycUiHt.js";
|
|
3
3
|
export { DOMElement, DOMNode, DOMNodeAttribute, ElementNames, FabricConfig, FabricContext, FabricMode, FabricOptions, JSDoc, Key, KubbElement, KubbExportProps, KubbFile_d_exports as KubbFile, KubbFileProps, KubbImportProps, KubbNode, KubbSourceProps, KubbTextProps, LineBreakProps, Param, Params, TextNode };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/react-fabric",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.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",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"react-reconciler": "0.32.0",
|
|
114
114
|
"signal-exit": "^4.1.0",
|
|
115
115
|
"ws": "8.18.0",
|
|
116
|
-
"@kubb/fabric-core": "0.
|
|
116
|
+
"@kubb/fabric-core": "0.3.1"
|
|
117
117
|
},
|
|
118
118
|
"devDependencies": {
|
|
119
119
|
"@types/react": "^19.2.2",
|