@mateosuarezdev/flash 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +896 -0
- package/dist/index.js +22 -22
- package/dist/server.cjs +4 -4
- package/dist/server.js +38 -36
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -134,7 +134,7 @@ function G(t) {
|
|
|
134
134
|
for (var e = t.s; e !== void 0; e = e.n) if (e.S.i !== e.i || !e.S.h() || e.S.i !== e.i) return !0;
|
|
135
135
|
return !1;
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function j(t) {
|
|
138
138
|
for (var e = t.s; e !== void 0; e = e.n) {
|
|
139
139
|
var i = e.S.n;
|
|
140
140
|
if (i !== void 0 && (e.r = i), e.S.n = e, e.i = -1, e.n === void 0) {
|
|
@@ -143,7 +143,7 @@ function X(t) {
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function X(t) {
|
|
147
147
|
for (var e = t.s, i = void 0; e !== void 0; ) {
|
|
148
148
|
var n = e.p;
|
|
149
149
|
e.i === -1 ? (e.S.U(e), n !== void 0 && (n.n = e.n), e.n !== void 0 && (e.n.p = n)) : i = e, e.S.n = e.r, e.r !== void 0 && (e.r = void 0), e = n;
|
|
@@ -161,13 +161,13 @@ y.prototype.h = function() {
|
|
|
161
161
|
return this.f &= -2, !0;
|
|
162
162
|
var t = c;
|
|
163
163
|
try {
|
|
164
|
-
|
|
164
|
+
j(this), c = this;
|
|
165
165
|
var e = this.x();
|
|
166
166
|
(16 & this.f || this.v !== e || this.i === 0) && (this.v = e, this.f &= -17, this.i++);
|
|
167
167
|
} catch (i) {
|
|
168
168
|
this.v = i, this.f |= 16, this.i++;
|
|
169
169
|
}
|
|
170
|
-
return c = t,
|
|
170
|
+
return c = t, X(this), this.f &= -2, !0;
|
|
171
171
|
};
|
|
172
172
|
y.prototype.S = function(t) {
|
|
173
173
|
if (this.t === void 0) {
|
|
@@ -206,19 +206,19 @@ function Y(t) {
|
|
|
206
206
|
try {
|
|
207
207
|
e();
|
|
208
208
|
} catch (n) {
|
|
209
|
-
throw t.f &= -2, t.f |= 8,
|
|
209
|
+
throw t.f &= -2, t.f |= 8, M(t), n;
|
|
210
210
|
} finally {
|
|
211
211
|
c = i, T();
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function M(t) {
|
|
216
216
|
for (var e = t.s; e !== void 0; e = e.n) e.S.U(e);
|
|
217
217
|
t.x = void 0, t.s = void 0, Y(t);
|
|
218
218
|
}
|
|
219
219
|
function q(t) {
|
|
220
220
|
if (c !== this) throw new Error("Out-of-order effect");
|
|
221
|
-
|
|
221
|
+
X(this), c = t, this.f &= -2, 8 & this.f && M(this), T();
|
|
222
222
|
}
|
|
223
223
|
function g(t, e) {
|
|
224
224
|
this.x = t, this.u = void 0, this.s = void 0, this.o = void 0, this.f = 32, this.name = e?.name;
|
|
@@ -235,7 +235,7 @@ g.prototype.c = function() {
|
|
|
235
235
|
};
|
|
236
236
|
g.prototype.S = function() {
|
|
237
237
|
if (1 & this.f) throw new Error("Cycle detected");
|
|
238
|
-
this.f |= 1, this.f &= -9, Y(this),
|
|
238
|
+
this.f |= 1, this.f &= -9, Y(this), j(this), p++;
|
|
239
239
|
var t = c;
|
|
240
240
|
return c = this, q.bind(this, t);
|
|
241
241
|
};
|
|
@@ -243,7 +243,7 @@ g.prototype.N = function() {
|
|
|
243
243
|
2 & this.f || (this.f |= 2, this.o = S, S = this);
|
|
244
244
|
};
|
|
245
245
|
g.prototype.d = function() {
|
|
246
|
-
this.f |= 8, 1 & this.f ||
|
|
246
|
+
this.f |= 8, 1 & this.f || M(this);
|
|
247
247
|
};
|
|
248
248
|
g.prototype.dispose = function() {
|
|
249
249
|
this.d();
|
|
@@ -267,7 +267,7 @@ function Ne(t) {
|
|
|
267
267
|
function Ae(t, e) {
|
|
268
268
|
typeof e == "function" ? t.value = e() : t.value = e;
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function Me(t) {
|
|
271
271
|
return t instanceof u ? () => t.value : t;
|
|
272
272
|
}
|
|
273
273
|
function Z(t, e, i = !1) {
|
|
@@ -348,7 +348,7 @@ function k(t, e) {
|
|
|
348
348
|
}
|
|
349
349
|
return { vnode: null, dom: null };
|
|
350
350
|
}
|
|
351
|
-
class
|
|
351
|
+
class x {
|
|
352
352
|
_cancelled = !1;
|
|
353
353
|
_cancelCallbacks = [];
|
|
354
354
|
get cancelled() {
|
|
@@ -373,7 +373,7 @@ class M {
|
|
|
373
373
|
}
|
|
374
374
|
async function U(t, e) {
|
|
375
375
|
if (!t) return;
|
|
376
|
-
const i = t, n = e || new
|
|
376
|
+
const i = t, n = e || new x();
|
|
377
377
|
if ("_onBeforeExitCallbacks" in i && i._onBeforeExitCallbacks.length > 0)
|
|
378
378
|
for (const r of i._onBeforeExitCallbacks)
|
|
379
379
|
try {
|
|
@@ -399,7 +399,7 @@ async function U(t, e) {
|
|
|
399
399
|
}
|
|
400
400
|
function $(t) {
|
|
401
401
|
if (!t) return;
|
|
402
|
-
const e = t, i = new
|
|
402
|
+
const e = t, i = new x();
|
|
403
403
|
if (i.cancel(), "_onBeforeExitCallbacks" in e && e._onBeforeExitCallbacks.length > 0 && e._onBeforeExitCallbacks.forEach((n) => {
|
|
404
404
|
try {
|
|
405
405
|
const r = n(i);
|
|
@@ -438,7 +438,7 @@ async function O(t, e, i) {
|
|
|
438
438
|
}
|
|
439
439
|
const o = ++Q, a = h.get(t);
|
|
440
440
|
a && a.token.cancel();
|
|
441
|
-
const l = new
|
|
441
|
+
const l = new x();
|
|
442
442
|
if (h.set(t, { id: o, token: l }), r && "_lifecycleState" in r && (r._lifecycleState = "exiting"), r)
|
|
443
443
|
try {
|
|
444
444
|
await U(r, l);
|
|
@@ -549,7 +549,7 @@ function W(t, e = !1) {
|
|
|
549
549
|
if (t._dom)
|
|
550
550
|
return t._dom;
|
|
551
551
|
const i = e || t.type === "svg", n = i ? document.createElementNS(ae, t.type) : document.createElement(t.type), r = Z(n, t.props, i);
|
|
552
|
-
return t._onUnmountCallbacks.push(r), t.props.innerHTML !== void 0 ? n.innerHTML = t.props.innerHTML : t.props.children && B(n, t.props.children, t, i), t._dom = n, t._lifecycleState = "mounted", t._onMountCallbacks.length > 0 && t._onMountCallbacks.forEach((s) => s()), n;
|
|
552
|
+
return t._onUnmountCallbacks.push(r), t.props.innerHTML !== void 0 ? n.innerHTML = typeof t.props.innerHTML == "object" ? JSON.stringify(t.props.innerHTML) : t.props.innerHTML : t.props.children && B(n, t.props.children, t, i), t._dom = n, t._lifecycleState = "mounted", t._onMountCallbacks.length > 0 && t._onMountCallbacks.forEach((s) => s()), n;
|
|
553
553
|
}
|
|
554
554
|
function _(t, e = !1) {
|
|
555
555
|
if ("type" in t && t.type === "reactive")
|
|
@@ -575,7 +575,7 @@ function _(t, e = !1) {
|
|
|
575
575
|
s();
|
|
576
576
|
}), r && (i._lifecycleState = "mounted"), r;
|
|
577
577
|
}
|
|
578
|
-
function
|
|
578
|
+
function xe(t, e) {
|
|
579
579
|
const i = t instanceof Node ? t : _(t);
|
|
580
580
|
i && e.append(i);
|
|
581
581
|
}
|
|
@@ -1275,10 +1275,10 @@ class _e {
|
|
|
1275
1275
|
this.el && (this.el.removeEventListener("touchstart", this.boundOnStart), document.removeEventListener("touchmove", this.boundOnMove), document.removeEventListener("touchend", this.boundOnEnd), document.removeEventListener("touchcancel", this.boundOnEnd), this.el.removeEventListener("mousedown", this.boundOnStart), document.removeEventListener("mousemove", this.boundOnMove), document.removeEventListener("mouseup", this.boundOnEnd), document.removeEventListener("mouseleave", this.boundOnEnd), this.controller.release(this.id));
|
|
1276
1276
|
}
|
|
1277
1277
|
}
|
|
1278
|
-
function
|
|
1278
|
+
function je(t, e) {
|
|
1279
1279
|
return ve.createGesture(t, e);
|
|
1280
1280
|
}
|
|
1281
|
-
function
|
|
1281
|
+
function Xe(t) {
|
|
1282
1282
|
typeof document > "u" || (document.startViewTransition ? document.startViewTransition(t) : t());
|
|
1283
1283
|
}
|
|
1284
1284
|
let Se = 0;
|
|
@@ -1315,20 +1315,20 @@ export {
|
|
|
1315
1315
|
Ce as batch,
|
|
1316
1316
|
Ee as computed,
|
|
1317
1317
|
De as createContext,
|
|
1318
|
-
|
|
1318
|
+
je as createGesture,
|
|
1319
1319
|
v as effect,
|
|
1320
1320
|
Ne as get,
|
|
1321
1321
|
Oe as hydrate,
|
|
1322
|
-
|
|
1322
|
+
Me as link,
|
|
1323
1323
|
Ie as onBeforeExit,
|
|
1324
1324
|
Ke as onLoad,
|
|
1325
1325
|
Le as onMount,
|
|
1326
1326
|
He as onUnmount,
|
|
1327
1327
|
Te as peek,
|
|
1328
|
-
|
|
1328
|
+
xe as render,
|
|
1329
1329
|
Ae as set,
|
|
1330
1330
|
we as signal,
|
|
1331
|
-
|
|
1331
|
+
Xe as startViewTransition,
|
|
1332
1332
|
Pe as suspend,
|
|
1333
1333
|
Fe as useContext,
|
|
1334
1334
|
Ye as withViewTransition
|
package/dist/server.cjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* See LICENSE file for full terms.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("node:fs/promises"),m=require("node:path");function A(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function b(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}const v=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function
|
|
11
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("node:fs/promises"),m=require("node:path");function A(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function b(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}const v=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function H(t){return/^on[A-Z]/.test(t)}function j(t){return Object.entries(t).map(([r,o])=>`${r.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}:${o}`).join(";")}function E(t,r=!0){const o=Object.entries(t).filter(([e,n])=>!(n==null||r&&e==="children"||e==="innerHTML"||H(e))).map(([e,n])=>(e==="className"&&(e="class"),e==="style"&&typeof n=="object"&&(n=j(n)),typeof n=="boolean"?n?e:"":`${e}="${b(String(n))}"`)).filter(Boolean).join(" ");return o?` ${o}`:""}function $(t){return t?Array.isArray(t)?t:[t]:[]}function T(t){return t&&typeof t.then=="function"}function h(t,r){return`<div id="${t}" data-server-component="suspended" data-component-name="${r}">Loading...</div>`}const l=new Map;let d=0;function w(t){return l.clear(),d=0,s(t)}async function D(t){l.clear(),d=0;let r=s(t);for(;l.size>0;){console.log(`🔄 Resolving ${l.size} async components in parallel...`);const o=Array.from(l.entries());l.clear();const e=await Promise.allSettled(o.map(([n,{promise:i}])=>i));for(let n=0;n<o.length;n++){const i=o[n];if(!i)continue;const[a,{componentName:c,errorFallback:u}]=i,p=e[n];if(!p)continue;const y=h(a,c);if(p.status==="fulfilled")try{console.log(`✅ Resolved: ${c} (${a})`);const f=s(p.value);r=r.replace(y,f)}catch(f){console.error(`❌ Error rendering ${c}:`,f);const S=u?s(typeof u=="function"?u(f):u):`<div class="error">Error rendering ${c}</div>`;r=r.replace(y,S)}else{console.error(`❌ Error resolving ${c}:`,p.reason);const f=u?s(typeof u=="function"?u(p.reason):u):`<div class="error">Error loading ${c}</div>`;r=r.replace(y,f)}}}return console.log("✅ All async components resolved!"),r}async function*P(t){for(l.clear(),d=0,yield s(t);l.size>0;){const o=Array.from(l.entries());l.clear();const e=o.map(async([n,{promise:i}])=>{try{const a=await i,c=s(a);return`<script>
|
|
12
12
|
(function() {
|
|
13
13
|
const el = document.getElementById('${n}');
|
|
14
14
|
if (el) {
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
el.innerHTML = '<div class="error">Error loading component</div>';
|
|
23
23
|
}
|
|
24
24
|
})();
|
|
25
|
-
<\/script>`}});for(const n of e)yield await n}}function s(t){if(typeof t=="function"){const e=t();return Array.isArray(e)?`<!--reactive-list-->${e.map(i=>s(i)).join("")}`:s(e)}if(typeof t=="string")return A(t);if(typeof t=="number")return String(t);if(Array.isArray(t))return t.map(e=>s(e)).join("");if(!t||typeof t!="object")return"";const{type:r,props:o}=t;if(r===Symbol.for("jsx.fragment"))return $(o.children).map(n=>s(n)).join("");if(typeof r=="string"&&r==="suspended"){const e=t,n=`async-${d++}`;return console.log(`⏳ Suspending: ${e._componentName} (${n})`),
|
|
26
|
-
Example: const ${i} = suspend(async (props) => { ... }, <Loading />, <Error />);`),console.log(`⏳ Suspending: ${i} (${n})`),
|
|
27
|
-
<html${e}>${i}</html>`:`<${r}${e}>${i}</${r}>`}return""}class
|
|
25
|
+
<\/script>`}});for(const n of e)yield await n}}function s(t){if(typeof t=="function"){const e=t();return Array.isArray(e)?`<!--reactive-list-->${e.map(i=>s(i)).join("")}`:s(e)}if(typeof t=="string")return A(t);if(typeof t=="number")return String(t);if(Array.isArray(t))return t.map(e=>s(e)).join("");if(!t||typeof t!="object")return"";const{type:r,props:o}=t;if(r===Symbol.for("jsx.fragment"))return $(o.children).map(n=>s(n)).join("");if(typeof r=="string"&&r==="suspended"){const e=t,n=`async-${d++}`;return console.log(`⏳ Suspending: ${e._componentName} (${n})`),l.set(n,{id:n,promise:e.promise,componentName:e._componentName,errorFallback:e.errorFallback}),h(n,e._componentName)}if(typeof r=="function"){const e=r(o);if(T(e)){const n=`async-${d++}`,i=r.name||"AsyncComponent";return console.warn(`⚠️ DEPRECATED: Direct async component "${i}" detected. Please use suspend() HOF instead for better type safety and custom fallbacks.
|
|
26
|
+
Example: const ${i} = suspend(async (props) => { ... }, <Loading />, <Error />);`),console.log(`⏳ Suspending: ${i} (${n})`),l.set(n,{id:n,promise:e,componentName:i}),h(n,i)}return s(e)}if(typeof r=="string"){const e=E(o);if(v.has(r))return`<${r}${e} />`;if(o.innerHTML!==void 0){const a=typeof o.innerHTML=="object"?JSON.stringify(o.innerHTML):o.innerHTML;return`<${r}${e}>${a}</${r}>`}const i=$(o.children).map(a=>{if(Array.isArray(a))return a.map(c=>s(c)).join("");if(typeof a=="function"){const c=a();return Array.isArray(c)?`<!--reactive-list-->${c.map(p=>s(p)).join("")}`:`<!--reactive-->${s(c)}`}return s(a)}).join("");return r==="html"?`<!DOCTYPE html>
|
|
27
|
+
<html${e}>${i}</html>`:`<${r}${e}>${i}</${r}>`}return""}class L{cacheDir;useDirectoryStructure;constructor(r={}){this.cacheDir=r.cacheDir||"./cache/html",this.useDirectoryStructure=r.useDirectoryStructure??!1}async save(r,o){const e=this.getFilepath(r);return await g.mkdir(m.dirname(e),{recursive:!0}),await Bun.write(e,o),console.log(`✅ Pre-rendered: ${r} → ${e}`),e}async load(r){const o=this.getFilepath(r),e=Bun.file(o);return await e.exists()?e:null}async clear(){await g.rm(this.cacheDir,{recursive:!0,force:!0}),await g.mkdir(this.cacheDir,{recursive:!0}),console.log("🗑️ Cache cleared")}async exists(r){const o=this.getFilepath(r);return await Bun.file(o).exists()}getFilepath(r){const o=r.replace(/^\/+|\/+$/g,"");if(this.useDirectoryStructure)return o===""?m.join(this.cacheDir,"index.html"):m.join(this.cacheDir,o,"index.html");{const e=o===""?"index.html":`${o.replace(/\//g,"-")}.html`;return m.join(this.cacheDir,e)}}}exports.PreRenderer=L;exports.renderToStream=P;exports.renderToString=w;exports.renderToStringAsync=D;
|
package/dist/server.js
CHANGED
|
@@ -13,10 +13,10 @@ import { dirname as b, join as y } from "node:path";
|
|
|
13
13
|
function v(t) {
|
|
14
14
|
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function H(t) {
|
|
17
17
|
return t.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
18
18
|
}
|
|
19
|
-
const
|
|
19
|
+
const E = /* @__PURE__ */ new Set([
|
|
20
20
|
"area",
|
|
21
21
|
"base",
|
|
22
22
|
"br",
|
|
@@ -38,7 +38,7 @@ function D(t) {
|
|
|
38
38
|
return Object.entries(t).map(([r, o]) => `${r.replace(/[A-Z]/g, (n) => `-${n.toLowerCase()}`)}:${o}`).join(";");
|
|
39
39
|
}
|
|
40
40
|
function j(t, r = !0) {
|
|
41
|
-
const o = Object.entries(t).filter(([e, n]) => !(n == null || r && e === "children" || e === "innerHTML" || w(e))).map(([e, n]) => (e === "className" && (e = "class"), e === "style" && typeof n == "object" && (n = D(n)), typeof n == "boolean" ? n ? e : "" : `${e}="${
|
|
41
|
+
const o = Object.entries(t).filter(([e, n]) => !(n == null || r && e === "children" || e === "innerHTML" || w(e))).map(([e, n]) => (e === "className" && (e = "class"), e === "style" && typeof n == "object" && (n = D(n)), typeof n == "boolean" ? n ? e : "" : `${e}="${H(String(n))}"`)).filter(Boolean).join(" ");
|
|
42
42
|
return o ? ` ${o}` : "";
|
|
43
43
|
}
|
|
44
44
|
function $(t) {
|
|
@@ -50,32 +50,32 @@ function T(t) {
|
|
|
50
50
|
function g(t, r) {
|
|
51
51
|
return `<div id="${t}" data-server-component="suspended" data-component-name="${r}">Loading...</div>`;
|
|
52
52
|
}
|
|
53
|
-
const
|
|
53
|
+
const l = /* @__PURE__ */ new Map();
|
|
54
54
|
let d = 0;
|
|
55
|
-
function
|
|
56
|
-
return
|
|
55
|
+
function P(t) {
|
|
56
|
+
return l.clear(), d = 0, s(t);
|
|
57
57
|
}
|
|
58
|
-
async function
|
|
59
|
-
|
|
58
|
+
async function x(t) {
|
|
59
|
+
l.clear(), d = 0;
|
|
60
60
|
let r = s(t);
|
|
61
|
-
for (;
|
|
61
|
+
for (; l.size > 0; ) {
|
|
62
62
|
console.log(
|
|
63
|
-
`🔄 Resolving ${
|
|
63
|
+
`🔄 Resolving ${l.size} async components in parallel...`
|
|
64
64
|
);
|
|
65
|
-
const o = Array.from(
|
|
66
|
-
|
|
65
|
+
const o = Array.from(l.entries());
|
|
66
|
+
l.clear();
|
|
67
67
|
const e = await Promise.allSettled(
|
|
68
68
|
o.map(([n, { promise: i }]) => i)
|
|
69
69
|
);
|
|
70
70
|
for (let n = 0; n < o.length; n++) {
|
|
71
71
|
const i = o[n];
|
|
72
72
|
if (!i) continue;
|
|
73
|
-
const [
|
|
73
|
+
const [a, { componentName: c, errorFallback: u }] = i, p = e[n];
|
|
74
74
|
if (!p) continue;
|
|
75
|
-
const m = g(
|
|
75
|
+
const m = g(a, c);
|
|
76
76
|
if (p.status === "fulfilled")
|
|
77
77
|
try {
|
|
78
|
-
console.log(`✅ Resolved: ${c} (${
|
|
78
|
+
console.log(`✅ Resolved: ${c} (${a})`);
|
|
79
79
|
const f = s(p.value);
|
|
80
80
|
r = r.replace(m, f);
|
|
81
81
|
} catch (f) {
|
|
@@ -96,14 +96,14 @@ async function L(t) {
|
|
|
96
96
|
}
|
|
97
97
|
return console.log("✅ All async components resolved!"), r;
|
|
98
98
|
}
|
|
99
|
-
async function*
|
|
100
|
-
for (
|
|
101
|
-
const o = Array.from(
|
|
102
|
-
|
|
99
|
+
async function* C(t) {
|
|
100
|
+
for (l.clear(), d = 0, yield s(t); l.size > 0; ) {
|
|
101
|
+
const o = Array.from(l.entries());
|
|
102
|
+
l.clear();
|
|
103
103
|
const e = o.map(
|
|
104
104
|
async ([n, { promise: i }]) => {
|
|
105
105
|
try {
|
|
106
|
-
const
|
|
106
|
+
const a = await i, c = s(a);
|
|
107
107
|
return `<script>
|
|
108
108
|
(function() {
|
|
109
109
|
const el = document.getElementById('${n}');
|
|
@@ -148,7 +148,7 @@ function s(t) {
|
|
|
148
148
|
const e = t, n = `async-${d++}`;
|
|
149
149
|
return console.log(
|
|
150
150
|
`⏳ Suspending: ${e._componentName} (${n})`
|
|
151
|
-
),
|
|
151
|
+
), l.set(n, {
|
|
152
152
|
id: n,
|
|
153
153
|
promise: e.promise,
|
|
154
154
|
componentName: e._componentName,
|
|
@@ -163,7 +163,7 @@ function s(t) {
|
|
|
163
163
|
return console.warn(
|
|
164
164
|
`⚠️ DEPRECATED: Direct async component "${i}" detected. Please use suspend() HOF instead for better type safety and custom fallbacks.
|
|
165
165
|
Example: const ${i} = suspend(async (props) => { ... }, <Loading />, <Error />);`
|
|
166
|
-
), console.log(`⏳ Suspending: ${i} (${n})`),
|
|
166
|
+
), console.log(`⏳ Suspending: ${i} (${n})`), l.set(n, {
|
|
167
167
|
id: n,
|
|
168
168
|
promise: e,
|
|
169
169
|
componentName: i
|
|
@@ -173,25 +173,27 @@ Example: const ${i} = suspend(async (props) => { ... }, <Loading />, <Error />);
|
|
|
173
173
|
}
|
|
174
174
|
if (typeof r == "string") {
|
|
175
175
|
const e = j(o);
|
|
176
|
-
if (
|
|
176
|
+
if (E.has(r))
|
|
177
177
|
return `<${r}${e} />`;
|
|
178
|
-
if (o.innerHTML !== void 0)
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (
|
|
184
|
-
|
|
178
|
+
if (o.innerHTML !== void 0) {
|
|
179
|
+
const a = typeof o.innerHTML == "object" ? JSON.stringify(o.innerHTML) : o.innerHTML;
|
|
180
|
+
return `<${r}${e}>${a}</${r}>`;
|
|
181
|
+
}
|
|
182
|
+
const i = $(o.children).map((a) => {
|
|
183
|
+
if (Array.isArray(a))
|
|
184
|
+
return a.map((c) => s(c)).join("");
|
|
185
|
+
if (typeof a == "function") {
|
|
186
|
+
const c = a();
|
|
185
187
|
return Array.isArray(c) ? `<!--reactive-list-->${c.map((p) => s(p)).join("")}` : `<!--reactive-->${s(c)}`;
|
|
186
188
|
}
|
|
187
|
-
return s(
|
|
189
|
+
return s(a);
|
|
188
190
|
}).join("");
|
|
189
191
|
return r === "html" ? `<!DOCTYPE html>
|
|
190
192
|
<html${e}>${i}</html>` : `<${r}${e}>${i}</${r}>`;
|
|
191
193
|
}
|
|
192
194
|
return "";
|
|
193
195
|
}
|
|
194
|
-
class
|
|
196
|
+
class M {
|
|
195
197
|
cacheDir;
|
|
196
198
|
useDirectoryStructure;
|
|
197
199
|
constructor(r = {}) {
|
|
@@ -223,8 +225,8 @@ class F {
|
|
|
223
225
|
}
|
|
224
226
|
}
|
|
225
227
|
export {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
228
|
+
M as PreRenderer,
|
|
229
|
+
C as renderToStream,
|
|
230
|
+
P as renderToString,
|
|
231
|
+
x as renderToStringAsync
|
|
230
232
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mateosuarezdev/flash",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Custom jsx runtime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"sideEffects": false,
|
|
47
47
|
"scripts": {
|
|
48
48
|
"dev": "vite --host",
|
|
49
|
-
"build": "vite build && bun run scripts/prepend-license.ts",
|
|
49
|
+
"build": "vite build && bun run scripts/append-jsx-types.ts && bun run scripts/prepend-license.ts",
|
|
50
50
|
"build:visualize": "vite-bundle-visualizer",
|
|
51
51
|
"typecheck": "tsc --noEmit",
|
|
52
52
|
"clean": "rimraf dist",
|