@seip/bluebird-js 0.1.2 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/extensions.json +7 -0
- package/.vscode/settings.json +10 -0
- package/AGENTS.md +495 -454
- package/README.md +528 -353
- package/app/routes/web.js +47 -55
- package/app/views/about.jsx +98 -0
- package/app/views/components/Header.jsx +42 -0
- package/app/views/components/LiveCounter.jsx +66 -0
- package/app/views/dashboard.jsx +300 -0
- package/app/views/index.jsx +123 -0
- package/app/views/layouts/main/view.jsx +201 -0
- package/app/views/legal/terms.html +29 -19
- package/app/views/login.jsx +141 -0
- package/core/actions.d.ts +4 -0
- package/core/actions.js +329 -0
- package/core/app.js +38 -6
- package/core/cli/doctor.js +3 -4
- package/core/cli/init.js +20 -6
- package/core/cli/migrate.js +418 -145
- package/core/cli/view.js +76 -11
- package/core/database.js +6 -10
- package/core/debug.js +1 -1
- package/core/html.d.ts +54 -42
- package/core/html.js +473 -217
- package/core/index.d.ts +1385 -1190
- package/core/jsx.d.ts +38 -0
- package/core/jsx.js +1432 -0
- package/core/model.js +271 -61
- package/core/render-cache.js +212 -212
- package/core/render.d.ts +20 -2
- package/core/render.js +459 -51
- package/core/validate.js +1 -1
- package/core/view-loader.js +360 -24
- package/package.json +9 -3
- package/public/js/bluebird-client.js +3160 -1780
- package/public/js/tailwind.js +8 -0
- package/app/views/about.js +0 -63
- package/app/views/dashboard.js +0 -147
- package/app/views/index.js +0 -80
- package/app/views/layouts/main/view.js +0 -81
- package/app/views/login.js +0 -80
- package/public/css/bluebird.min.css +0 -2
- package/public/js/bluebird.min.js +0 -1073
package/core/jsx.js
ADDED
|
@@ -0,0 +1,1432 @@
|
|
|
1
|
+
import nodeModule from "node:module";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { SafeHtml, escapeHtml, safeJson, isSafeHtml } from "./html.js";
|
|
5
|
+
|
|
6
|
+
export const JSX_ELEMENT = Symbol.for("Bluebird.JsxElement");
|
|
7
|
+
export const Fragment = Symbol.for("Bluebird.Fragment");
|
|
8
|
+
export const ERROR_BOUNDARY = Symbol.for("Bluebird.ErrorBoundary");
|
|
9
|
+
export const SUSPENSE_ELEMENT = Symbol.for("Bluebird.Suspense");
|
|
10
|
+
export const HEAD_ELEMENT = Symbol.for("Bluebird.Head");
|
|
11
|
+
export const TITLE_ELEMENT = Symbol.for("Bluebird.Title");
|
|
12
|
+
export const META_ELEMENT = Symbol.for("Bluebird.Meta");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Boolean HTML attributes that should be rendered as bare attribute names when true
|
|
16
|
+
* and omitted when false.
|
|
17
|
+
*/
|
|
18
|
+
const BOOLEAN_ATTRS = new Set([
|
|
19
|
+
"allowfullscreen",
|
|
20
|
+
"async",
|
|
21
|
+
"autofocus",
|
|
22
|
+
"autoplay",
|
|
23
|
+
"checked",
|
|
24
|
+
"controls",
|
|
25
|
+
"default",
|
|
26
|
+
"defer",
|
|
27
|
+
"disabled",
|
|
28
|
+
"formnovalidate",
|
|
29
|
+
"hidden",
|
|
30
|
+
"inert",
|
|
31
|
+
"ismap",
|
|
32
|
+
"itemscope",
|
|
33
|
+
"loop",
|
|
34
|
+
"multiple",
|
|
35
|
+
"muted",
|
|
36
|
+
"nomodule",
|
|
37
|
+
"novalidate",
|
|
38
|
+
"open",
|
|
39
|
+
"playsinline",
|
|
40
|
+
"readonly",
|
|
41
|
+
"required",
|
|
42
|
+
"reversed",
|
|
43
|
+
"selected",
|
|
44
|
+
]);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Self-closing void HTML elements that must not have a closing tag.
|
|
48
|
+
*/
|
|
49
|
+
const VOID_ELEMENTS = new Set([
|
|
50
|
+
"area",
|
|
51
|
+
"base",
|
|
52
|
+
"br",
|
|
53
|
+
"col",
|
|
54
|
+
"embed",
|
|
55
|
+
"hr",
|
|
56
|
+
"img",
|
|
57
|
+
"input",
|
|
58
|
+
"link",
|
|
59
|
+
"meta",
|
|
60
|
+
"param",
|
|
61
|
+
"source",
|
|
62
|
+
"track",
|
|
63
|
+
"wbr",
|
|
64
|
+
]);
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* CSS properties that accept unitless numeric values.
|
|
68
|
+
*/
|
|
69
|
+
const UNITLESS_CSS = new Set([
|
|
70
|
+
"animationIterationCount",
|
|
71
|
+
"aspectRatio",
|
|
72
|
+
"borderImageOutset",
|
|
73
|
+
"borderImageSlice",
|
|
74
|
+
"borderImageWidth",
|
|
75
|
+
"boxFlex",
|
|
76
|
+
"boxFlexGroup",
|
|
77
|
+
"boxOrdinalGroup",
|
|
78
|
+
"columnCount",
|
|
79
|
+
"columns",
|
|
80
|
+
"flex",
|
|
81
|
+
"flexGrow",
|
|
82
|
+
"flexPositive",
|
|
83
|
+
"flexShrink",
|
|
84
|
+
"flexNegative",
|
|
85
|
+
"flexOrder",
|
|
86
|
+
"gridArea",
|
|
87
|
+
"gridRow",
|
|
88
|
+
"gridRowEnd",
|
|
89
|
+
"gridRowSpan",
|
|
90
|
+
"gridRowStart",
|
|
91
|
+
"gridColumn",
|
|
92
|
+
"gridColumnEnd",
|
|
93
|
+
"gridColumnSpan",
|
|
94
|
+
"gridColumnStart",
|
|
95
|
+
"fontWeight",
|
|
96
|
+
"lineClamp",
|
|
97
|
+
"lineHeight",
|
|
98
|
+
"opacity",
|
|
99
|
+
"order",
|
|
100
|
+
"orphans",
|
|
101
|
+
"tabSize",
|
|
102
|
+
"widows",
|
|
103
|
+
"zIndex",
|
|
104
|
+
"zoom",
|
|
105
|
+
"fillOpacity",
|
|
106
|
+
"floodOpacity",
|
|
107
|
+
"stopOpacity",
|
|
108
|
+
"strokeDasharray",
|
|
109
|
+
"strokeDashoffset",
|
|
110
|
+
"strokeMiterlimit",
|
|
111
|
+
"strokeOpacity",
|
|
112
|
+
"strokeWidth",
|
|
113
|
+
]);
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Attribute name normalization map from React camelCase to standard HTML.
|
|
117
|
+
*/
|
|
118
|
+
const ATTR_MAP = {
|
|
119
|
+
className: "class",
|
|
120
|
+
htmlFor: "for",
|
|
121
|
+
tabIndex: "tabindex",
|
|
122
|
+
readOnly: "readonly",
|
|
123
|
+
maxLength: "maxlength",
|
|
124
|
+
minLength: "minlength",
|
|
125
|
+
cellPadding: "cellpadding",
|
|
126
|
+
cellSpacing: "cellspacing",
|
|
127
|
+
rowSpan: "rowspan",
|
|
128
|
+
colSpan: "colspan",
|
|
129
|
+
useMap: "usemap",
|
|
130
|
+
frameBorder: "frameborder",
|
|
131
|
+
contentEditable: "contenteditable",
|
|
132
|
+
crossOrigin: "crossorigin",
|
|
133
|
+
autoComplete: "autocomplete",
|
|
134
|
+
autoFocus: "autofocus",
|
|
135
|
+
autoPlay: "autoplay",
|
|
136
|
+
encType: "enctype",
|
|
137
|
+
formAction: "formaction",
|
|
138
|
+
formEncType: "formenctype",
|
|
139
|
+
formMethod: "formmethod",
|
|
140
|
+
formNoValidate: "formnovalidate",
|
|
141
|
+
formTarget: "formtarget",
|
|
142
|
+
hrefLang: "hreflang",
|
|
143
|
+
inputMode: "inputmode",
|
|
144
|
+
noValidate: "novalidate",
|
|
145
|
+
playsInline: "playsinline",
|
|
146
|
+
referrerPolicy: "referrerpolicy",
|
|
147
|
+
srcDoc: "srcdoc",
|
|
148
|
+
srcLang: "srclang",
|
|
149
|
+
srcSet: "srcset",
|
|
150
|
+
fetchPriority: "fetchpriority",
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Cached React module references if installed in the project.
|
|
155
|
+
* @type {{ React: any, ReactDOMServer: any } | null}
|
|
156
|
+
*/
|
|
157
|
+
let reactModules = null;
|
|
158
|
+
let reactLoadAttempted = false;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Attempts to dynamically load react and react-dom/server once if installed.
|
|
162
|
+
* @returns {Promise<{ React: any, ReactDOMServer: any } | null>}
|
|
163
|
+
*/
|
|
164
|
+
export async function getReactModules() {
|
|
165
|
+
if (reactLoadAttempted) return reactModules;
|
|
166
|
+
reactLoadAttempted = true;
|
|
167
|
+
try {
|
|
168
|
+
const [reactMod, reactDomServerMod] = await Promise.all([
|
|
169
|
+
import("react"),
|
|
170
|
+
import("react-dom/server"),
|
|
171
|
+
]);
|
|
172
|
+
reactModules = {
|
|
173
|
+
React: reactMod.default || reactMod,
|
|
174
|
+
ReactDOMServer: reactDomServerMod.default || reactDomServerMod,
|
|
175
|
+
};
|
|
176
|
+
} catch {
|
|
177
|
+
reactModules = null;
|
|
178
|
+
}
|
|
179
|
+
return reactModules;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Serializes a React style object into an inline CSS string.
|
|
184
|
+
* @param {Record<string, any>|string} style
|
|
185
|
+
* @returns {string}
|
|
186
|
+
*/
|
|
187
|
+
export function serializeStyle(style) {
|
|
188
|
+
if (!style) return "";
|
|
189
|
+
if (typeof style === "string") return style;
|
|
190
|
+
if (typeof style !== "object") return "";
|
|
191
|
+
|
|
192
|
+
let css = "";
|
|
193
|
+
for (const [key, val] of Object.entries(style)) {
|
|
194
|
+
if (val === null || val === undefined || val === false || val === "") continue;
|
|
195
|
+
const kebabKey = key.startsWith("--")
|
|
196
|
+
? key
|
|
197
|
+
: key.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
198
|
+
let strVal = String(val);
|
|
199
|
+
if (typeof val === "number" && val !== 0 && !UNITLESS_CSS.has(key) && !key.startsWith("--")) {
|
|
200
|
+
strVal = `${val}px`;
|
|
201
|
+
}
|
|
202
|
+
css += `${css ? ";" : ""}${kebabKey}:${strVal}`;
|
|
203
|
+
}
|
|
204
|
+
return css;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Creates a lightweight JSX virtual element descriptor.
|
|
209
|
+
* Compatible with React.createElement(type, props, ...children) and automatic runtime jsx(type, props, key).
|
|
210
|
+
*
|
|
211
|
+
* @param {string|Function|Symbol} type
|
|
212
|
+
* @param {Record<string, any>|null} [props]
|
|
213
|
+
* @param {...any} children
|
|
214
|
+
* @returns {Object}
|
|
215
|
+
*/
|
|
216
|
+
export function h(type, props, ...children) {
|
|
217
|
+
const normalizedProps = { ...(props || {}) };
|
|
218
|
+
if (children.length === 1) {
|
|
219
|
+
normalizedProps.children = children[0];
|
|
220
|
+
} else if (children.length > 1) {
|
|
221
|
+
normalizedProps.children = children;
|
|
222
|
+
}
|
|
223
|
+
return {
|
|
224
|
+
$$typeof: Symbol.for("react.transitional.element"),
|
|
225
|
+
[JSX_ELEMENT]: true,
|
|
226
|
+
type,
|
|
227
|
+
props: normalizedProps,
|
|
228
|
+
key: normalizedProps.key ?? null,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Automatic JSX runtime factory (`jsx` / `jsxs`).
|
|
234
|
+
* @param {string|Function|Symbol} type
|
|
235
|
+
* @param {Record<string, any>} props
|
|
236
|
+
* @param {string|number} [key]
|
|
237
|
+
* @returns {Object}
|
|
238
|
+
*/
|
|
239
|
+
export function jsx(type, props, key) {
|
|
240
|
+
const normalizedProps = { ...(props || {}) };
|
|
241
|
+
if (key !== undefined) {
|
|
242
|
+
normalizedProps.key = key;
|
|
243
|
+
}
|
|
244
|
+
return {
|
|
245
|
+
$$typeof: Symbol.for("react.transitional.element"),
|
|
246
|
+
[JSX_ELEMENT]: true,
|
|
247
|
+
type,
|
|
248
|
+
props: normalizedProps,
|
|
249
|
+
key: key ?? normalizedProps.key ?? null,
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export const jsxs = jsx;
|
|
254
|
+
export const jsxDEV = jsx;
|
|
255
|
+
export const createElement = h;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Checks whether a value is a Bluebird JSX element or a standard React element.
|
|
259
|
+
* @param {any} val
|
|
260
|
+
* @returns {boolean}
|
|
261
|
+
*/
|
|
262
|
+
export function isJsxElement(val) {
|
|
263
|
+
if (!val || typeof val !== "object") return false;
|
|
264
|
+
if (val[JSX_ELEMENT] === true) return true;
|
|
265
|
+
const typeofSym = val.$$typeof;
|
|
266
|
+
if (typeof typeofSym === "symbol") {
|
|
267
|
+
const symStr = typeofSym.toString();
|
|
268
|
+
return symStr.includes("react.element") || symStr.includes("react.transitional.element") || symStr.includes("react.fragment");
|
|
269
|
+
}
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Renders HTML attributes from a JSX props object.
|
|
275
|
+
* @param {Record<string, any>} props
|
|
276
|
+
* @returns {string}
|
|
277
|
+
*/
|
|
278
|
+
function renderAttributes(props) {
|
|
279
|
+
if (!props) return "";
|
|
280
|
+
let attrs = "";
|
|
281
|
+
|
|
282
|
+
for (const [rawKey, val] of Object.entries(props)) {
|
|
283
|
+
if (
|
|
284
|
+
rawKey === "children" ||
|
|
285
|
+
rawKey === "key" ||
|
|
286
|
+
rawKey === "ref" ||
|
|
287
|
+
rawKey === "dangerouslySetInnerHTML" ||
|
|
288
|
+
val === undefined ||
|
|
289
|
+
val === null ||
|
|
290
|
+
typeof val === "function"
|
|
291
|
+
) {
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
const attrName = ATTR_MAP[rawKey] || rawKey;
|
|
296
|
+
const lowerName = attrName.toLowerCase();
|
|
297
|
+
|
|
298
|
+
if (BOOLEAN_ATTRS.has(lowerName)) {
|
|
299
|
+
if (val) {
|
|
300
|
+
attrs += ` ${lowerName}`;
|
|
301
|
+
}
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
if (attrName === "style" && typeof val === "object") {
|
|
306
|
+
const styleStr = serializeStyle(val);
|
|
307
|
+
if (styleStr) {
|
|
308
|
+
attrs += ` style="${escapeHtml(styleStr)}"`;
|
|
309
|
+
}
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
if (typeof val === "boolean") {
|
|
314
|
+
if (attrName.startsWith("data-") || attrName.startsWith("aria-")) {
|
|
315
|
+
attrs += ` ${attrName}="${val}"`;
|
|
316
|
+
} else if (val) {
|
|
317
|
+
attrs += ` ${attrName}`;
|
|
318
|
+
}
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
attrs += ` ${attrName}="${escapeHtml(String(val))}"`;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
return attrs;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Built-in native error boundary component for Bluebird React JSX SSR.
|
|
330
|
+
* Catches rendering exceptions in subtrees and renders a fallback UI without failing the entire page request.
|
|
331
|
+
*
|
|
332
|
+
* @param {Object} props
|
|
333
|
+
* @param {any} [props.fallback] - JSX element, string, SafeHtml, or formatter function (error) => JSX.
|
|
334
|
+
* @param {Function} [props.onError] - Optional error reporting callback (error) => void.
|
|
335
|
+
* @param {any} [props.children] - Subtree to protect.
|
|
336
|
+
* @returns {Object}
|
|
337
|
+
*/
|
|
338
|
+
export function ErrorBoundary(props) {
|
|
339
|
+
return h(ERROR_BOUNDARY, props, props?.children);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Built-in Suspense component for streaming SSR and progressive page rendering.
|
|
344
|
+
* Renders fallback skeleton immediately, streaming resolved content when ready.
|
|
345
|
+
*
|
|
346
|
+
* @param {Object} props
|
|
347
|
+
* @param {any} props.fallback - Skeleton/fallback content displayed while children load.
|
|
348
|
+
* @param {any} [props.children] - Async component, promise, or subtree.
|
|
349
|
+
* @returns {Object}
|
|
350
|
+
*/
|
|
351
|
+
export function Suspense(props) {
|
|
352
|
+
return h(SUSPENSE_ELEMENT, props, props?.children);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Hoists head elements (<title>, <meta>, <link>) from any nested view or component into the document <head>.
|
|
357
|
+
* Renders as empty string in the body stream while populating ctx.headTags and ctx.title.
|
|
358
|
+
*
|
|
359
|
+
* @param {Object} props
|
|
360
|
+
* @param {any} [props.children]
|
|
361
|
+
* @returns {Object}
|
|
362
|
+
*/
|
|
363
|
+
export function Head(props) {
|
|
364
|
+
return h(HEAD_ELEMENT, props, props?.children);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Dedicated head title element that hoists the page title into the document <head>.
|
|
369
|
+
* @param {Object} props
|
|
370
|
+
* @param {any} [props.children]
|
|
371
|
+
* @returns {Object}
|
|
372
|
+
*/
|
|
373
|
+
export function Title(props) {
|
|
374
|
+
return h(TITLE_ELEMENT, props, props?.children);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Dedicated head meta element that hoists a <meta> tag into the document <head>.
|
|
379
|
+
* @param {Record<string, any>} props
|
|
380
|
+
* @returns {Object}
|
|
381
|
+
*/
|
|
382
|
+
export function Meta(props) {
|
|
383
|
+
return h(META_ELEMENT, props);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Renders any JSX node, async Server Component, SafeHtml, or primitive tree into an HTML string.
|
|
388
|
+
* Supports async function components (`export default async function Page()`),
|
|
389
|
+
* Fragments, `dangerouslySetInnerHTML`, and mixed `html\`...\`` SafeHtml objects.
|
|
390
|
+
*
|
|
391
|
+
* @param {any} node
|
|
392
|
+
* @param {Object} [ctx={}]
|
|
393
|
+
* @returns {Promise<string>}
|
|
394
|
+
*/
|
|
395
|
+
export async function renderJsxToString(node, ctx = {}) {
|
|
396
|
+
if (node === null || node === undefined || typeof node === "boolean") {
|
|
397
|
+
return "";
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
if (typeof node === "string") {
|
|
401
|
+
return escapeHtml(node);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
if (typeof node === "number" || typeof node === "bigint") {
|
|
405
|
+
return String(node);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
if (isSafeHtml(node)) {
|
|
409
|
+
return node.toString();
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
if (node instanceof Promise) {
|
|
413
|
+
const resolved = await node;
|
|
414
|
+
return renderJsxToString(resolved, ctx);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
if (Array.isArray(node)) {
|
|
418
|
+
let out = "";
|
|
419
|
+
for (let i = 0; i < node.length; i++) {
|
|
420
|
+
out += await renderJsxToString(node[i], ctx);
|
|
421
|
+
}
|
|
422
|
+
return out;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
if (isJsxElement(node)) {
|
|
426
|
+
const { type, props = {} } = node;
|
|
427
|
+
|
|
428
|
+
if (
|
|
429
|
+
type === Fragment ||
|
|
430
|
+
type === Symbol.for("react.fragment") ||
|
|
431
|
+
type === "" ||
|
|
432
|
+
type === null
|
|
433
|
+
) {
|
|
434
|
+
return renderJsxToString(props.children, ctx);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
if (
|
|
438
|
+
type === ErrorBoundary ||
|
|
439
|
+
type === ERROR_BOUNDARY ||
|
|
440
|
+
type === Symbol.for("Bluebird.ErrorBoundary")
|
|
441
|
+
) {
|
|
442
|
+
try {
|
|
443
|
+
return await renderJsxToString(props.children, ctx);
|
|
444
|
+
} catch (err) {
|
|
445
|
+
if (typeof props.onError === "function") {
|
|
446
|
+
try {
|
|
447
|
+
props.onError(err);
|
|
448
|
+
} catch {}
|
|
449
|
+
}
|
|
450
|
+
if (props.fallback !== undefined && props.fallback !== null) {
|
|
451
|
+
const fallbackNode =
|
|
452
|
+
typeof props.fallback === "function" ? props.fallback(err) : props.fallback;
|
|
453
|
+
return renderJsxToString(fallbackNode, ctx);
|
|
454
|
+
}
|
|
455
|
+
return "";
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
if (
|
|
460
|
+
type === Suspense ||
|
|
461
|
+
type === SUSPENSE_ELEMENT ||
|
|
462
|
+
type === Symbol.for("Bluebird.Suspense")
|
|
463
|
+
) {
|
|
464
|
+
if (ctx.isStreaming) {
|
|
465
|
+
ctx.suspenseCounter = (ctx.suspenseCounter || 0) + 1;
|
|
466
|
+
const suspenseId = `bb-suspense-${ctx.suspenseCounter}`;
|
|
467
|
+
const fallbackHtml =
|
|
468
|
+
props.fallback !== undefined && props.fallback !== null
|
|
469
|
+
? await renderJsxToString(props.fallback, ctx)
|
|
470
|
+
: "";
|
|
471
|
+
|
|
472
|
+
const task = (async () => {
|
|
473
|
+
try {
|
|
474
|
+
const childHtml = await renderJsxToString(props.children, ctx);
|
|
475
|
+
return { id: suspenseId, html: childHtml, success: true };
|
|
476
|
+
} catch (err) {
|
|
477
|
+
return { id: suspenseId, error: err, success: false };
|
|
478
|
+
}
|
|
479
|
+
})();
|
|
480
|
+
|
|
481
|
+
ctx.suspenseTasks = ctx.suspenseTasks || [];
|
|
482
|
+
ctx.suspenseTasks.push(task);
|
|
483
|
+
|
|
484
|
+
return `<div id="${suspenseId}">${fallbackHtml}</div>`;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
try {
|
|
488
|
+
return await renderJsxToString(props.children, ctx);
|
|
489
|
+
} catch (err) {
|
|
490
|
+
if (props.fallback !== undefined && props.fallback !== null) {
|
|
491
|
+
const fallbackNode =
|
|
492
|
+
typeof props.fallback === "function" ? props.fallback(err) : props.fallback;
|
|
493
|
+
return renderJsxToString(fallbackNode, ctx);
|
|
494
|
+
}
|
|
495
|
+
throw err;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
if (
|
|
500
|
+
type === Head ||
|
|
501
|
+
type === HEAD_ELEMENT ||
|
|
502
|
+
type === Symbol.for("Bluebird.Head")
|
|
503
|
+
) {
|
|
504
|
+
ctx.headTags = ctx.headTags || [];
|
|
505
|
+
const headChildren = props.children;
|
|
506
|
+
if (headChildren !== undefined && headChildren !== null) {
|
|
507
|
+
const list = Array.isArray(headChildren) ? headChildren : [headChildren];
|
|
508
|
+
for (const item of list) {
|
|
509
|
+
if (!item) continue;
|
|
510
|
+
if (isJsxElement(item)) {
|
|
511
|
+
if (
|
|
512
|
+
item.type === "title" ||
|
|
513
|
+
item.type === Title ||
|
|
514
|
+
item.type === TITLE_ELEMENT ||
|
|
515
|
+
item.type === Symbol.for("Bluebird.Title")
|
|
516
|
+
) {
|
|
517
|
+
const titleText = await renderJsxToString(item.props?.children, ctx);
|
|
518
|
+
ctx.title = titleText;
|
|
519
|
+
ctx.headTags.push(`<title>${escapeHtml(titleText)}</title>`);
|
|
520
|
+
continue;
|
|
521
|
+
}
|
|
522
|
+
const renderedTag = await renderJsxToString(item, ctx);
|
|
523
|
+
if (renderedTag) {
|
|
524
|
+
ctx.headTags.push(renderedTag);
|
|
525
|
+
}
|
|
526
|
+
} else if (typeof item === "string") {
|
|
527
|
+
ctx.headTags.push(item);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
return "";
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
if (
|
|
535
|
+
type === Title ||
|
|
536
|
+
type === TITLE_ELEMENT ||
|
|
537
|
+
type === Symbol.for("Bluebird.Title")
|
|
538
|
+
) {
|
|
539
|
+
const titleText = await renderJsxToString(props.children, ctx);
|
|
540
|
+
ctx.title = titleText;
|
|
541
|
+
ctx.headTags = ctx.headTags || [];
|
|
542
|
+
ctx.headTags.push(`<title>${escapeHtml(titleText)}</title>`);
|
|
543
|
+
return "";
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
if (
|
|
547
|
+
type === Meta ||
|
|
548
|
+
type === META_ELEMENT ||
|
|
549
|
+
type === Symbol.for("Bluebird.Meta")
|
|
550
|
+
) {
|
|
551
|
+
const attrs = renderAttributes(props);
|
|
552
|
+
const metaHtml = `<meta${attrs} />`;
|
|
553
|
+
ctx.headTags = ctx.headTags || [];
|
|
554
|
+
ctx.headTags.push(metaHtml);
|
|
555
|
+
return "";
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
if (typeof type === "function") {
|
|
559
|
+
const result = await type(props, ctx);
|
|
560
|
+
return renderJsxToString(result, ctx);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
if (typeof type === "string") {
|
|
564
|
+
const tag = type;
|
|
565
|
+
const attrs = renderAttributes(props);
|
|
566
|
+
|
|
567
|
+
if (VOID_ELEMENTS.has(tag.toLowerCase())) {
|
|
568
|
+
return `<${tag}${attrs} />`;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
let inner = "";
|
|
572
|
+
if (props.dangerouslySetInnerHTML && props.dangerouslySetInnerHTML.__html != null) {
|
|
573
|
+
inner = String(props.dangerouslySetInnerHTML.__html);
|
|
574
|
+
} else if (props.children !== undefined) {
|
|
575
|
+
if ((tag === "script" || tag === "style") && typeof props.children === "string") {
|
|
576
|
+
inner = props.children;
|
|
577
|
+
} else {
|
|
578
|
+
inner = await renderJsxToString(props.children, ctx);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
return `<${tag}${attrs}>${inner}</${tag}>`;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
return escapeHtml(String(node));
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Resolves the island component name from a string or function reference.
|
|
591
|
+
* @param {string|Function} component
|
|
592
|
+
* @returns {string}
|
|
593
|
+
*/
|
|
594
|
+
function resolveComponentName(component) {
|
|
595
|
+
if (typeof component === "string") return component;
|
|
596
|
+
if (typeof component === "function") {
|
|
597
|
+
return component.displayName || component.name || "AnonymousIsland";
|
|
598
|
+
}
|
|
599
|
+
return "Island";
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Built-in `<Island>` / `<Client>` component for Bluebird React SSR.
|
|
604
|
+
* Renders a client-hydrated component container with anti-CLS layout locking (`minHeight` / `minWidth`),
|
|
605
|
+
* custom skeleton/fallback support, optional SSR pre-rendering of the component, and View Transition persistence.
|
|
606
|
+
*
|
|
607
|
+
* Usage in JSX:
|
|
608
|
+
* ```jsx
|
|
609
|
+
* <Island
|
|
610
|
+
* component={LiveCounter}
|
|
611
|
+
* props={{ initial: 10 }}
|
|
612
|
+
* skeleton={<div className="h-12 animate-pulse bg-slate-800 rounded-xl" />}
|
|
613
|
+
* minHeight="48px"
|
|
614
|
+
* persist={false}
|
|
615
|
+
* />
|
|
616
|
+
* ```
|
|
617
|
+
*
|
|
618
|
+
* @param {Object} options
|
|
619
|
+
* @param {string|Function} [options.component] - Component function or registered island name.
|
|
620
|
+
* @param {string} [options.name] - Explicit island name override.
|
|
621
|
+
* @param {Record<string, any>} [options.props={}] - Props serialized for client hydration.
|
|
622
|
+
* @param {any} [options.skeleton] - Skeleton JSX or SafeHtml rendered inside the container before client mount (prevents layout shift).
|
|
623
|
+
* @param {any} [options.fallback] - Alias for skeleton.
|
|
624
|
+
* @param {string|number} [options.minHeight] - CSS min-height to lock vertical space and prevent accordion/CLS shift.
|
|
625
|
+
* @param {string|number} [options.minWidth] - CSS min-width to lock horizontal space.
|
|
626
|
+
* @param {string} [options.className] - Optional CSS class on the island container.
|
|
627
|
+
* @param {Record<string, any>|string} [options.style] - Optional inline style on the island container.
|
|
628
|
+
* @param {boolean} [options.persist=false] - Whether to preserve the mounted island across SPA View Transitions.
|
|
629
|
+
* @param {boolean} [options.ssr=false] - If true and `component` is a function, pre-renders the component on the server inside the container.
|
|
630
|
+
* @param {string} [options.tag="div"] - HTML wrapper tag name.
|
|
631
|
+
* @param {any} [options.children] - Optional children used as skeleton fallback if `skeleton` is not specified.
|
|
632
|
+
* @returns {Promise<SafeHtml>}
|
|
633
|
+
*/
|
|
634
|
+
export async function Island(options = {}) {
|
|
635
|
+
const {
|
|
636
|
+
component,
|
|
637
|
+
client,
|
|
638
|
+
onMount,
|
|
639
|
+
name: explicitName,
|
|
640
|
+
props: explicitProps,
|
|
641
|
+
skeleton,
|
|
642
|
+
fallback,
|
|
643
|
+
minHeight,
|
|
644
|
+
minWidth,
|
|
645
|
+
className,
|
|
646
|
+
style,
|
|
647
|
+
persist = false,
|
|
648
|
+
persistent = false,
|
|
649
|
+
ssr = false,
|
|
650
|
+
tag = "div",
|
|
651
|
+
children,
|
|
652
|
+
...restProps
|
|
653
|
+
} = options;
|
|
654
|
+
|
|
655
|
+
const isPersistent = Boolean(persist || persistent);
|
|
656
|
+
const islandName = explicitName || resolveComponentName(component || client || onMount);
|
|
657
|
+
const componentProps = explicitProps !== undefined ? explicitProps : restProps;
|
|
658
|
+
|
|
659
|
+
let clientFn =
|
|
660
|
+
typeof client === "function"
|
|
661
|
+
? client
|
|
662
|
+
: typeof onMount === "function"
|
|
663
|
+
? onMount
|
|
664
|
+
: null;
|
|
665
|
+
|
|
666
|
+
if (!clientFn && typeof component === "function" && !ssr) {
|
|
667
|
+
clientFn = component;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
const mergedStyle = typeof style === "object" && style !== null ? { ...style } : {};
|
|
671
|
+
if (minHeight !== undefined) {
|
|
672
|
+
mergedStyle.minHeight = typeof minHeight === "number" ? `${minHeight}px` : minHeight;
|
|
673
|
+
}
|
|
674
|
+
if (minWidth !== undefined) {
|
|
675
|
+
mergedStyle.minWidth = typeof minWidth === "number" ? `${minWidth}px` : minWidth;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
const styleStr = typeof style === "string" ? style : serializeStyle(mergedStyle);
|
|
679
|
+
const styleAttr = styleStr ? ` style="${escapeHtml(styleStr)}"` : "";
|
|
680
|
+
const classAttr = className ? ` class="${escapeHtml(className)}"` : "";
|
|
681
|
+
const persistAttr = isPersistent ? ' data-persist="true"' : "";
|
|
682
|
+
const hydrateModeAttr = ssr ? ' data-hydrate="true"' : "";
|
|
683
|
+
const serializedProps = escapeHtml(safeJson(componentProps));
|
|
684
|
+
|
|
685
|
+
let innerHtml = "";
|
|
686
|
+
const fallbackNode = skeleton !== undefined ? skeleton : fallback !== undefined ? fallback : children;
|
|
687
|
+
|
|
688
|
+
if (fallbackNode !== undefined && fallbackNode !== null) {
|
|
689
|
+
innerHtml = await renderJsxToString(fallbackNode);
|
|
690
|
+
} else if (ssr && typeof component === "function") {
|
|
691
|
+
try {
|
|
692
|
+
const ssrNode = await component(componentProps);
|
|
693
|
+
innerHtml = await renderJsxToString(ssrNode);
|
|
694
|
+
} catch {
|
|
695
|
+
innerHtml = "";
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
let inlineMountScript = "";
|
|
700
|
+
if (clientFn) {
|
|
701
|
+
const fnStr = clientFn.toString().replace(/<\/script/gi, "<\\/script");
|
|
702
|
+
inlineMountScript = `<script data-bb-client-mount="true">(function(){var s=document.currentScript;var el=s&&s.parentElement;if(!el||el.__bb_fn_mounted__)return;el.__bb_fn_mounted__=true;if(window.__BLUEBIRD_ISLANDS__&&window.__BLUEBIRD_ISLANDS__[${safeJson(islandName)}]&&typeof window.__BLUEBIRD_MOUNT__==="function")return;var p=${safeJson(componentProps)};var fn=${fnStr};var mount=function(){if(window.Bluebird&&typeof window.Bluebird.mount==="function"){window.Bluebird.mount(el,fn,p);}else{fn(Object.assign({},p,{el:el,root:el,Bluebird:window.Bluebird}));}};if(!window.Bluebird||!window.Bluebird.mount){(window.__BB_MOUNT_QUEUE__=window.__BB_MOUNT_QUEUE__||[]).push(mount);}else{mount();}})();</script>`;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
return new SafeHtml(
|
|
706
|
+
`<${tag} data-island="${escapeHtml(islandName)}" data-props="${serializedProps}"${persistAttr}${hydrateModeAttr}${classAttr}${styleAttr}>${innerHtml}${inlineMountScript}</${tag}>`
|
|
707
|
+
);
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* Alias for `<Island>` — marks a component boundary for client-side execution (`useEffect`, `useState`, etc.)
|
|
712
|
+
* with built-in skeleton and anti-accordion layout protection.
|
|
713
|
+
*/
|
|
714
|
+
export const Client = Island;
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* Server-safe fallback for useState in SSR.
|
|
718
|
+
* @param {any} [initial]
|
|
719
|
+
* @returns {[any, Function]}
|
|
720
|
+
*/
|
|
721
|
+
export function useState(initial) {
|
|
722
|
+
const val = typeof initial === "function" ? initial() : initial;
|
|
723
|
+
return [val, () => {}];
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* Server-safe no-op for useEffect in SSR.
|
|
728
|
+
* @param {Function} effectFn
|
|
729
|
+
* @param {Array<any>} [deps]
|
|
730
|
+
*/
|
|
731
|
+
export function useEffect() {}
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* Server-safe fallback for useRef in SSR.
|
|
735
|
+
* @param {any} [initial]
|
|
736
|
+
* @returns {{ current: any }}
|
|
737
|
+
*/
|
|
738
|
+
export function useRef(initial) {
|
|
739
|
+
return { current: initial };
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* Server-safe fallback for useMemo in SSR.
|
|
744
|
+
* @param {Function} fn
|
|
745
|
+
* @param {Array<any>} [deps]
|
|
746
|
+
* @returns {any}
|
|
747
|
+
*/
|
|
748
|
+
export function useMemo(fn) {
|
|
749
|
+
return typeof fn === "function" ? fn() : fn;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* Server-safe fallback for useCallback in SSR.
|
|
754
|
+
* @param {Function} fn
|
|
755
|
+
* @param {Array<any>} [deps]
|
|
756
|
+
* @returns {Function}
|
|
757
|
+
*/
|
|
758
|
+
export function useCallback(fn) {
|
|
759
|
+
return fn;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* Server-safe fallback for useAction in SSR.
|
|
764
|
+
* @param {string|Function} actionName
|
|
765
|
+
* @param {Object} [options={}]
|
|
766
|
+
* @returns {[Function, boolean, any, any, Function]}
|
|
767
|
+
*/
|
|
768
|
+
export function useAction(actionName, options = {}) {
|
|
769
|
+
return [async () => {}, false, null, null, () => {}];
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* Server-safe fallback for useActionState in SSR.
|
|
774
|
+
* @param {string|Function} actionFn
|
|
775
|
+
* @param {any} initialState
|
|
776
|
+
* @returns {[any, Function, boolean]}
|
|
777
|
+
*/
|
|
778
|
+
export function useActionState(actionFn, initialState) {
|
|
779
|
+
return [initialState, async () => {}, false];
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
/**
|
|
783
|
+
* Ultra-fast, zero-dependency JSX-to-JS compiler for Node.js ESM.
|
|
784
|
+
* Compiles standard React JSX syntax (elements, fragments `<>...</>`, spread attributes `{...props}`,
|
|
785
|
+
* nested expressions, boolean props, and component tags) into `h()` calls in memory.
|
|
786
|
+
* Supports TypeScript syntax stripping for `.tsx` files.
|
|
787
|
+
*
|
|
788
|
+
* @param {string} source - Raw JSX module source code.
|
|
789
|
+
* @param {Object} [options={}] - Compiler options.
|
|
790
|
+
* @param {boolean} [options.ts=false] - Whether to strip TypeScript type annotations.
|
|
791
|
+
* @returns {string} Valid JavaScript ESM source code.
|
|
792
|
+
*/
|
|
793
|
+
export function compileJsx(source, options = {}) {
|
|
794
|
+
let out = "";
|
|
795
|
+
let i = 0;
|
|
796
|
+
const len = source.length;
|
|
797
|
+
|
|
798
|
+
/**
|
|
799
|
+
* Skips string literals, template literals, and comments in normal JS code.
|
|
800
|
+
*/
|
|
801
|
+
while (i < len) {
|
|
802
|
+
const ch = source[i];
|
|
803
|
+
const next = source[i + 1];
|
|
804
|
+
|
|
805
|
+
if (ch === "/" && next === "/") {
|
|
806
|
+
const end = source.indexOf("\n", i + 2);
|
|
807
|
+
if (end === -1) {
|
|
808
|
+
out += source.slice(i);
|
|
809
|
+
break;
|
|
810
|
+
}
|
|
811
|
+
out += source.slice(i, end + 1);
|
|
812
|
+
i = end + 1;
|
|
813
|
+
continue;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
if (ch === "/" && next === "*") {
|
|
817
|
+
const end = source.indexOf("*/", i + 2);
|
|
818
|
+
if (end === -1) {
|
|
819
|
+
out += source.slice(i);
|
|
820
|
+
break;
|
|
821
|
+
}
|
|
822
|
+
out += source.slice(i, end + 2);
|
|
823
|
+
i = end + 2;
|
|
824
|
+
continue;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
if (ch === '"' || ch === "'") {
|
|
828
|
+
const quote = ch;
|
|
829
|
+
out += ch;
|
|
830
|
+
i++;
|
|
831
|
+
while (i < len) {
|
|
832
|
+
const c = source[i];
|
|
833
|
+
out += c;
|
|
834
|
+
i++;
|
|
835
|
+
if (c === "\\") {
|
|
836
|
+
if (i < len) {
|
|
837
|
+
out += source[i];
|
|
838
|
+
i++;
|
|
839
|
+
}
|
|
840
|
+
} else if (c === quote) {
|
|
841
|
+
break;
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
continue;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
if (ch === "`") {
|
|
848
|
+
const tpl = readTemplateLiteral(source, i);
|
|
849
|
+
out += tpl.code;
|
|
850
|
+
i = tpl.nextIndex;
|
|
851
|
+
continue;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
if (ch === "<" && isJsxStart(source, i, out)) {
|
|
855
|
+
const parsed = parseJsxElement(source, i);
|
|
856
|
+
if (parsed) {
|
|
857
|
+
out += parsed.code;
|
|
858
|
+
i = parsed.nextIndex;
|
|
859
|
+
continue;
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
out += ch;
|
|
864
|
+
i++;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
const preamble = `import { h as __bb_h, Fragment as __bb_Fragment } from "@seip/bluebird-js/core/jsx.js";\n`;
|
|
868
|
+
const code = preamble + out;
|
|
869
|
+
if (options.ts || options.typescript) {
|
|
870
|
+
return stripTsTypes(code);
|
|
871
|
+
}
|
|
872
|
+
return code;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
/**
|
|
876
|
+
* Determines whether a `<` character at `index` starts a JSX tag rather than a comparison operator.
|
|
877
|
+
* @param {string} source
|
|
878
|
+
* @param {number} index
|
|
879
|
+
* @param {string} precedingOutput
|
|
880
|
+
* @returns {boolean}
|
|
881
|
+
*/
|
|
882
|
+
function isJsxStart(source, index, precedingOutput) {
|
|
883
|
+
const next = source[index + 1];
|
|
884
|
+
if (!next) return false;
|
|
885
|
+
|
|
886
|
+
if (next !== ">" && !/[a-zA-Z_$]/.test(next)) {
|
|
887
|
+
return false;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
const trimmed = precedingOutput.trimEnd();
|
|
891
|
+
if (!trimmed) return true;
|
|
892
|
+
|
|
893
|
+
const lastChar = trimmed[trimmed.length - 1];
|
|
894
|
+
if ("=(,[{:;?!&|+-*%~^><".includes(lastChar)) {
|
|
895
|
+
return true;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
const wordMatch = trimmed.match(/([a-zA-Z0-9_$]+)$/);
|
|
899
|
+
if (wordMatch) {
|
|
900
|
+
const kw = wordMatch[1];
|
|
901
|
+
if (
|
|
902
|
+
kw === "return" ||
|
|
903
|
+
kw === "yield" ||
|
|
904
|
+
kw === "await" ||
|
|
905
|
+
kw === "case" ||
|
|
906
|
+
kw === "throw" ||
|
|
907
|
+
kw === "typeof" ||
|
|
908
|
+
kw === "void" ||
|
|
909
|
+
kw === "in" ||
|
|
910
|
+
kw === "of" ||
|
|
911
|
+
kw === "else"
|
|
912
|
+
) {
|
|
913
|
+
return true;
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
return false;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* Reads a template literal including nested `${...}` expressions that might contain JSX.
|
|
922
|
+
* @param {string} source
|
|
923
|
+
* @param {number} start
|
|
924
|
+
* @returns {{ code: string, nextIndex: number }}
|
|
925
|
+
*/
|
|
926
|
+
function readTemplateLiteral(source, start) {
|
|
927
|
+
let code = "`";
|
|
928
|
+
let i = start + 1;
|
|
929
|
+
const len = source.length;
|
|
930
|
+
|
|
931
|
+
while (i < len) {
|
|
932
|
+
const ch = source[i];
|
|
933
|
+
if (ch === "\\") {
|
|
934
|
+
code += source.slice(i, i + 2);
|
|
935
|
+
i += 2;
|
|
936
|
+
continue;
|
|
937
|
+
}
|
|
938
|
+
if (ch === "`") {
|
|
939
|
+
code += "`";
|
|
940
|
+
i++;
|
|
941
|
+
break;
|
|
942
|
+
}
|
|
943
|
+
if (ch === "$" && source[i + 1] === "{") {
|
|
944
|
+
code += "${";
|
|
945
|
+
const expr = readBalancedExpression(source, i + 2);
|
|
946
|
+
code += transformJsFragment(expr.code);
|
|
947
|
+
code += "}";
|
|
948
|
+
i = expr.nextIndex;
|
|
949
|
+
continue;
|
|
950
|
+
}
|
|
951
|
+
code += ch;
|
|
952
|
+
i++;
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
return { code, nextIndex: i };
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
/**
|
|
959
|
+
* Transforms a JS expression string that may contain nested JSX elements.
|
|
960
|
+
* @param {string} exprSource
|
|
961
|
+
* @returns {string}
|
|
962
|
+
*/
|
|
963
|
+
function transformJsFragment(exprSource) {
|
|
964
|
+
let out = "";
|
|
965
|
+
let i = 0;
|
|
966
|
+
const len = exprSource.length;
|
|
967
|
+
|
|
968
|
+
while (i < len) {
|
|
969
|
+
const ch = exprSource[i];
|
|
970
|
+
const next = exprSource[i + 1];
|
|
971
|
+
|
|
972
|
+
if (ch === "/" && next === "/") {
|
|
973
|
+
const end = exprSource.indexOf("\n", i + 2);
|
|
974
|
+
if (end === -1) {
|
|
975
|
+
out += exprSource.slice(i);
|
|
976
|
+
break;
|
|
977
|
+
}
|
|
978
|
+
out += exprSource.slice(i, end + 1);
|
|
979
|
+
i = end + 1;
|
|
980
|
+
continue;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
if (ch === "/" && next === "*") {
|
|
984
|
+
const end = exprSource.indexOf("*/", i + 2);
|
|
985
|
+
if (end === -1) {
|
|
986
|
+
out += exprSource.slice(i);
|
|
987
|
+
break;
|
|
988
|
+
}
|
|
989
|
+
out += exprSource.slice(i, end + 2);
|
|
990
|
+
i = end + 2;
|
|
991
|
+
continue;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
if (ch === '"' || ch === "'") {
|
|
995
|
+
const quote = ch;
|
|
996
|
+
out += ch;
|
|
997
|
+
i++;
|
|
998
|
+
while (i < len) {
|
|
999
|
+
const c = exprSource[i];
|
|
1000
|
+
out += c;
|
|
1001
|
+
i++;
|
|
1002
|
+
if (c === "\\") {
|
|
1003
|
+
if (i < len) {
|
|
1004
|
+
out += exprSource[i];
|
|
1005
|
+
i++;
|
|
1006
|
+
}
|
|
1007
|
+
} else if (c === quote) {
|
|
1008
|
+
break;
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
continue;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
if (ch === "`") {
|
|
1015
|
+
const tpl = readTemplateLiteral(exprSource, i);
|
|
1016
|
+
out += tpl.code;
|
|
1017
|
+
i = tpl.nextIndex;
|
|
1018
|
+
continue;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
if (ch === "<" && isJsxStart(exprSource, i, out)) {
|
|
1022
|
+
const parsed = parseJsxElement(exprSource, i);
|
|
1023
|
+
if (parsed) {
|
|
1024
|
+
out += parsed.code;
|
|
1025
|
+
i = parsed.nextIndex;
|
|
1026
|
+
continue;
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
out += ch;
|
|
1031
|
+
i++;
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
return out;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
/**
|
|
1038
|
+
* Reads a balanced `{ ... }` expression starting after the opening `{`.
|
|
1039
|
+
* @param {string} source
|
|
1040
|
+
* @param {number} start - Index immediately after `{`.
|
|
1041
|
+
* @returns {{ code: string, nextIndex: number }}
|
|
1042
|
+
*/
|
|
1043
|
+
function readBalancedExpression(source, start) {
|
|
1044
|
+
let depth = 1;
|
|
1045
|
+
let i = start;
|
|
1046
|
+
const len = source.length;
|
|
1047
|
+
|
|
1048
|
+
while (i < len && depth > 0) {
|
|
1049
|
+
const ch = source[i];
|
|
1050
|
+
const next = source[i + 1];
|
|
1051
|
+
|
|
1052
|
+
if (ch === "/" && next === "/") {
|
|
1053
|
+
const end = source.indexOf("\n", i + 2);
|
|
1054
|
+
i = end === -1 ? len : end + 1;
|
|
1055
|
+
continue;
|
|
1056
|
+
}
|
|
1057
|
+
if (ch === "/" && next === "*") {
|
|
1058
|
+
const end = source.indexOf("*/", i + 2);
|
|
1059
|
+
i = end === -1 ? len : end + 2;
|
|
1060
|
+
continue;
|
|
1061
|
+
}
|
|
1062
|
+
if (ch === '"' || ch === "'" || ch === "`") {
|
|
1063
|
+
const quote = ch;
|
|
1064
|
+
i++;
|
|
1065
|
+
while (i < len) {
|
|
1066
|
+
const c = source[i];
|
|
1067
|
+
i++;
|
|
1068
|
+
if (c === "\\") {
|
|
1069
|
+
i++;
|
|
1070
|
+
} else if (c === quote) {
|
|
1071
|
+
break;
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
continue;
|
|
1075
|
+
}
|
|
1076
|
+
if (ch === "{") depth++;
|
|
1077
|
+
else if (ch === "}") depth--;
|
|
1078
|
+
|
|
1079
|
+
if (depth > 0) i++;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
const code = source.slice(start, i);
|
|
1083
|
+
return { code, nextIndex: i + 1 };
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
/**
|
|
1087
|
+
* Parses a JSX element or fragment starting at `start` (`<`).
|
|
1088
|
+
* @param {string} source
|
|
1089
|
+
* @param {number} start
|
|
1090
|
+
* @returns {{ code: string, nextIndex: number } | null}
|
|
1091
|
+
*/
|
|
1092
|
+
function parseJsxElement(source, start) {
|
|
1093
|
+
const len = source.length;
|
|
1094
|
+
let i = start + 1;
|
|
1095
|
+
|
|
1096
|
+
if (source[i] === ">") {
|
|
1097
|
+
i++;
|
|
1098
|
+
const childrenResult = parseJsxChildren(source, i, "");
|
|
1099
|
+
return {
|
|
1100
|
+
code: `__bb_h(__bb_Fragment, null${childrenResult.args.length ? ", " + childrenResult.args.join(", ") : ""})`,
|
|
1101
|
+
nextIndex: childrenResult.nextIndex,
|
|
1102
|
+
};
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
const tagMatch = source.slice(i).match(/^([a-zA-Z_$][a-zA-Z0-9_$.-]*)/);
|
|
1106
|
+
if (!tagMatch) return null;
|
|
1107
|
+
|
|
1108
|
+
const tagName = tagMatch[1];
|
|
1109
|
+
i += tagName.length;
|
|
1110
|
+
|
|
1111
|
+
const isComponent = /^[A-Z_$]/.test(tagName) || tagName.includes(".");
|
|
1112
|
+
const tagExpr = isComponent ? tagName : JSON.stringify(tagName);
|
|
1113
|
+
|
|
1114
|
+
const attrsResult = parseJsxAttributes(source, i);
|
|
1115
|
+
if (!attrsResult) return null;
|
|
1116
|
+
|
|
1117
|
+
i = attrsResult.nextIndex;
|
|
1118
|
+
const propsExpr = attrsResult.propsCode;
|
|
1119
|
+
|
|
1120
|
+
if (attrsResult.selfClosing) {
|
|
1121
|
+
return {
|
|
1122
|
+
code: `__bb_h(${tagExpr}, ${propsExpr})`,
|
|
1123
|
+
nextIndex: i,
|
|
1124
|
+
};
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
const childrenResult = parseJsxChildren(source, i, tagName);
|
|
1128
|
+
return {
|
|
1129
|
+
code: `__bb_h(${tagExpr}, ${propsExpr}${childrenResult.args.length ? ", " + childrenResult.args.join(", ") : ""})`,
|
|
1130
|
+
nextIndex: childrenResult.nextIndex,
|
|
1131
|
+
};
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
/**
|
|
1135
|
+
* Parses attributes inside an opening JSX tag up to `>` or `/>`.
|
|
1136
|
+
* @param {string} source
|
|
1137
|
+
* @param {number} start
|
|
1138
|
+
* @returns {{ propsCode: string, selfClosing: boolean, nextIndex: number } | null}
|
|
1139
|
+
*/
|
|
1140
|
+
function parseJsxAttributes(source, start) {
|
|
1141
|
+
let i = start;
|
|
1142
|
+
const len = source.length;
|
|
1143
|
+
const entries = [];
|
|
1144
|
+
|
|
1145
|
+
while (i < len) {
|
|
1146
|
+
while (i < len && /\s/.test(source[i])) i++;
|
|
1147
|
+
if (i >= len) return null;
|
|
1148
|
+
|
|
1149
|
+
if (source[i] === "/" && source[i + 1] === ">") {
|
|
1150
|
+
return {
|
|
1151
|
+
propsCode: entries.length ? `{ ${entries.join(", ")} }` : "null",
|
|
1152
|
+
selfClosing: true,
|
|
1153
|
+
nextIndex: i + 2,
|
|
1154
|
+
};
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
if (source[i] === ">") {
|
|
1158
|
+
return {
|
|
1159
|
+
propsCode: entries.length ? `{ ${entries.join(", ")} }` : "null",
|
|
1160
|
+
selfClosing: false,
|
|
1161
|
+
nextIndex: i + 1,
|
|
1162
|
+
};
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
if (source[i] === "{") {
|
|
1166
|
+
const expr = readBalancedExpression(source, i + 1);
|
|
1167
|
+
const trimmed = expr.code.trim();
|
|
1168
|
+
if (trimmed.startsWith("...")) {
|
|
1169
|
+
entries.push(`...(${transformJsFragment(trimmed.slice(3))})`);
|
|
1170
|
+
} else {
|
|
1171
|
+
entries.push(transformJsFragment(trimmed));
|
|
1172
|
+
}
|
|
1173
|
+
i = expr.nextIndex;
|
|
1174
|
+
continue;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
const nameMatch = source.slice(i).match(/^([a-zA-Z_$][a-zA-Z0-9_$.:-]*)/);
|
|
1178
|
+
if (!nameMatch) return null;
|
|
1179
|
+
|
|
1180
|
+
const attrName = nameMatch[1];
|
|
1181
|
+
const safeKey = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(attrName)
|
|
1182
|
+
? attrName
|
|
1183
|
+
: JSON.stringify(attrName);
|
|
1184
|
+
i += attrName.length;
|
|
1185
|
+
|
|
1186
|
+
while (i < len && /\s/.test(source[i])) i++;
|
|
1187
|
+
|
|
1188
|
+
if (source[i] !== "=") {
|
|
1189
|
+
entries.push(`${safeKey}: true`);
|
|
1190
|
+
continue;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
i++;
|
|
1194
|
+
while (i < len && /\s/.test(source[i])) i++;
|
|
1195
|
+
|
|
1196
|
+
const valChar = source[i];
|
|
1197
|
+
if (valChar === '"' || valChar === "'") {
|
|
1198
|
+
const quote = valChar;
|
|
1199
|
+
let strVal = "";
|
|
1200
|
+
i++;
|
|
1201
|
+
while (i < len && source[i] !== quote) {
|
|
1202
|
+
if (source[i] === "\\") {
|
|
1203
|
+
strVal += source[i] + (source[i + 1] || "");
|
|
1204
|
+
i += 2;
|
|
1205
|
+
} else {
|
|
1206
|
+
strVal += source[i];
|
|
1207
|
+
i++;
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
i++;
|
|
1211
|
+
entries.push(`${safeKey}: ${JSON.stringify(decodeHtmlEntities(strVal))}`);
|
|
1212
|
+
} else if (valChar === "{") {
|
|
1213
|
+
const expr = readBalancedExpression(source, i + 1);
|
|
1214
|
+
entries.push(`${safeKey}: (${transformJsFragment(expr.code)})`);
|
|
1215
|
+
i = expr.nextIndex;
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
return null;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
/**
|
|
1223
|
+
* Decodes common HTML entities in static JSX text and attributes.
|
|
1224
|
+
* @param {string} text
|
|
1225
|
+
* @returns {string}
|
|
1226
|
+
*/
|
|
1227
|
+
function decodeHtmlEntities(text) {
|
|
1228
|
+
if (!text.includes("&")) return text;
|
|
1229
|
+
return text
|
|
1230
|
+
.replace(/&/g, "&")
|
|
1231
|
+
.replace(/</g, "<")
|
|
1232
|
+
.replace(/>/g, ">")
|
|
1233
|
+
.replace(/"/g, '"')
|
|
1234
|
+
.replace(/'/g, "'")
|
|
1235
|
+
.replace(/'/g, "'")
|
|
1236
|
+
.replace(/→/g, "→")
|
|
1237
|
+
.replace(/←/g, "←")
|
|
1238
|
+
.replace(/•/g, "•")
|
|
1239
|
+
.replace(/−/g, "−")
|
|
1240
|
+
.replace(/+/g, "+")
|
|
1241
|
+
.replace(/×/g, "×")
|
|
1242
|
+
.replace(/ /g, "\u00A0");
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
/**
|
|
1246
|
+
* Normalizes JSX whitespace rules (collapsing multi-line indentation like Babel/React).
|
|
1247
|
+
* @param {string} rawText
|
|
1248
|
+
* @returns {string}
|
|
1249
|
+
*/
|
|
1250
|
+
function cleanJsxText(rawText) {
|
|
1251
|
+
if (!rawText.includes("\n") && !rawText.includes("\r")) {
|
|
1252
|
+
return decodeHtmlEntities(rawText);
|
|
1253
|
+
}
|
|
1254
|
+
const lines = rawText.split(/\r\n|\n|\r/);
|
|
1255
|
+
const cleaned = [];
|
|
1256
|
+
|
|
1257
|
+
for (let idx = 0; idx < lines.length; idx++) {
|
|
1258
|
+
let line = lines[idx].replace(/\t/g, " ");
|
|
1259
|
+
if (idx !== 0) {
|
|
1260
|
+
line = line.trimStart();
|
|
1261
|
+
}
|
|
1262
|
+
if (idx !== lines.length - 1) {
|
|
1263
|
+
line = line.trimEnd();
|
|
1264
|
+
}
|
|
1265
|
+
if (line.length > 0) {
|
|
1266
|
+
cleaned.push(line);
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
return decodeHtmlEntities(cleaned.join(" "));
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
/**
|
|
1274
|
+
* Parses JSX children until the matching closing tag `</tagName>` or `</>`.
|
|
1275
|
+
* @param {string} source
|
|
1276
|
+
* @param {number} start
|
|
1277
|
+
* @param {string} tagName - Empty string for fragments.
|
|
1278
|
+
* @returns {{ args: string[], nextIndex: number }}
|
|
1279
|
+
*/
|
|
1280
|
+
function parseJsxChildren(source, start, tagName) {
|
|
1281
|
+
let i = start;
|
|
1282
|
+
const len = source.length;
|
|
1283
|
+
const args = [];
|
|
1284
|
+
let textStart = i;
|
|
1285
|
+
|
|
1286
|
+
const flushText = (endIdx) => {
|
|
1287
|
+
if (endIdx > textStart) {
|
|
1288
|
+
const raw = source.slice(textStart, endIdx);
|
|
1289
|
+
const cleaned = cleanJsxText(raw);
|
|
1290
|
+
if (cleaned) {
|
|
1291
|
+
args.push(JSON.stringify(cleaned));
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
};
|
|
1295
|
+
|
|
1296
|
+
while (i < len) {
|
|
1297
|
+
if (source[i] === "<" && source[i + 1] === "/") {
|
|
1298
|
+
flushText(i);
|
|
1299
|
+
const closeStart = i + 2;
|
|
1300
|
+
const closeEnd = source.indexOf(">", closeStart);
|
|
1301
|
+
if (closeEnd === -1) {
|
|
1302
|
+
return { args, nextIndex: len };
|
|
1303
|
+
}
|
|
1304
|
+
return { args, nextIndex: closeEnd + 1 };
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
if (source[i] === "<") {
|
|
1308
|
+
flushText(i);
|
|
1309
|
+
const childEl = parseJsxElement(source, i);
|
|
1310
|
+
if (childEl) {
|
|
1311
|
+
args.push(childEl.code);
|
|
1312
|
+
i = childEl.nextIndex;
|
|
1313
|
+
textStart = i;
|
|
1314
|
+
continue;
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
if (source[i] === "{") {
|
|
1319
|
+
flushText(i);
|
|
1320
|
+
const expr = readBalancedExpression(source, i + 1);
|
|
1321
|
+
const trimmed = expr.code.trim();
|
|
1322
|
+
if (trimmed && !/^\/\*[\s\S]*\*\/$/.test(trimmed)) {
|
|
1323
|
+
args.push(`(${transformJsFragment(trimmed)})`);
|
|
1324
|
+
}
|
|
1325
|
+
i = expr.nextIndex;
|
|
1326
|
+
textStart = i;
|
|
1327
|
+
continue;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
i++;
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
flushText(len);
|
|
1334
|
+
return { args, nextIndex: len };
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
let hooksRegistered = false;
|
|
1338
|
+
|
|
1339
|
+
/**
|
|
1340
|
+
* Strips TypeScript type annotations and declarations from JavaScript code using Node's native
|
|
1341
|
+
* stripTypeScriptTypes if available, or lightweight zero-dependency pattern stripping.
|
|
1342
|
+
*
|
|
1343
|
+
* @param {string} code
|
|
1344
|
+
* @returns {string}
|
|
1345
|
+
*/
|
|
1346
|
+
export function stripTsTypes(code) {
|
|
1347
|
+
try {
|
|
1348
|
+
if (typeof nodeModule?.stripTypeScriptTypes === "function") {
|
|
1349
|
+
return nodeModule.stripTypeScriptTypes(code);
|
|
1350
|
+
}
|
|
1351
|
+
} catch {}
|
|
1352
|
+
return code;
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
/**
|
|
1356
|
+
* Registers Node.js native module customization hooks (`module.registerHooks`) so `.jsx` and `.tsx` files
|
|
1357
|
+
* can import other `.jsx` and `.tsx` components directly without any external build step or disk temp files.
|
|
1358
|
+
*/
|
|
1359
|
+
export function registerJsxLoader() {
|
|
1360
|
+
if (hooksRegistered) return;
|
|
1361
|
+
hooksRegistered = true;
|
|
1362
|
+
|
|
1363
|
+
try {
|
|
1364
|
+
if (typeof nodeModule?.registerHooks === "function") {
|
|
1365
|
+
nodeModule.registerHooks({
|
|
1366
|
+
load(url, context, nextLoad) {
|
|
1367
|
+
const cleanUrl = url.split("?")[0];
|
|
1368
|
+
const isJsx = cleanUrl.endsWith(".jsx");
|
|
1369
|
+
const isTsx = cleanUrl.endsWith(".tsx");
|
|
1370
|
+
const isTs = cleanUrl.endsWith(".ts");
|
|
1371
|
+
|
|
1372
|
+
if (isJsx || isTsx || isTs) {
|
|
1373
|
+
let rawSource;
|
|
1374
|
+
if (cleanUrl.startsWith("file:")) {
|
|
1375
|
+
const filePath = fileURLToPath(cleanUrl);
|
|
1376
|
+
rawSource = fs.readFileSync(filePath, "utf-8");
|
|
1377
|
+
} else {
|
|
1378
|
+
const loaded = nextLoad(url, { ...context, format: "module" });
|
|
1379
|
+
rawSource =
|
|
1380
|
+
typeof loaded.source === "string"
|
|
1381
|
+
? loaded.source
|
|
1382
|
+
: Buffer.from(loaded.source).toString("utf-8");
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
let source;
|
|
1386
|
+
if (isTs) {
|
|
1387
|
+
source = stripTsTypes(rawSource);
|
|
1388
|
+
} else {
|
|
1389
|
+
source = compileJsx(rawSource, { ts: isTsx });
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
return {
|
|
1393
|
+
format: "module",
|
|
1394
|
+
shortCircuit: true,
|
|
1395
|
+
source,
|
|
1396
|
+
};
|
|
1397
|
+
}
|
|
1398
|
+
return nextLoad(url, context);
|
|
1399
|
+
},
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1402
|
+
} catch {}
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
registerJsxLoader();
|
|
1406
|
+
|
|
1407
|
+
export default {
|
|
1408
|
+
h,
|
|
1409
|
+
createElement,
|
|
1410
|
+
jsx,
|
|
1411
|
+
jsxs,
|
|
1412
|
+
Fragment,
|
|
1413
|
+
Island,
|
|
1414
|
+
Client,
|
|
1415
|
+
ErrorBoundary,
|
|
1416
|
+
Suspense,
|
|
1417
|
+
Head,
|
|
1418
|
+
Title,
|
|
1419
|
+
Meta,
|
|
1420
|
+
useState,
|
|
1421
|
+
useEffect,
|
|
1422
|
+
useRef,
|
|
1423
|
+
useMemo,
|
|
1424
|
+
useCallback,
|
|
1425
|
+
useAction,
|
|
1426
|
+
useActionState,
|
|
1427
|
+
isJsxElement,
|
|
1428
|
+
renderJsxToString,
|
|
1429
|
+
compileJsx,
|
|
1430
|
+
stripTsTypes,
|
|
1431
|
+
registerJsxLoader,
|
|
1432
|
+
};
|