ajo 0.1.29 → 0.1.30
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/html.cjs +1 -1
- package/dist/html.js +42 -64
- package/package.json +54 -59
- package/readme.md +12 -41
- package/types.ts +1 -20
- package/dist/stream.cjs +0 -1
- package/dist/stream.js +0 -24
package/dist/html.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./context.cjs"),m=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),b=Symbol.for("ajo.args"),y=e=>e.replace(/[&<>"']/g,r=>`&#${r.charCodeAt(0)};`),f=()=>{},p=e=>[...a(e)].join(""),a=function*(e){for(e of c(e))typeof e=="string"?yield y(e):yield*k(e)},k=function*({nodeName:e,children:r,...i}){let o="";for(const n in i)n.startsWith("set:")||i[n]==null||i[n]===!1||(i[n]===!0?o+=` ${n}`:o+=` ${n}="${y(String(i[n]))}"`);m.has(e)?yield`<${e}${o}>`:(yield`<${e}${o}>`,r!=null&&(yield*a(r)),yield`</${e}>`)},c=function*(e){if(e==null)return;const r=typeof e;if(r!="boolean")if(r=="string")yield e;else if(r=="number"||r=="bigint")yield String(e);else if(Symbol.iterator in e)for(e of e)yield*c(e);else"nodeName"in e?typeof e.nodeName=="function"?yield*$(e):yield d(e):yield String(e)},$=function*({nodeName:e,fallback:r=e.fallback,...i}){e.constructor.name=="GeneratorFunction"?yield S(e,i):yield*c(e(i))},S=(e,r)=>{const i={...e.attrs},o={...e.args};for(const t in r)t.startsWith("attr:")?i[t.slice(5)]=r[t]:t=="key"||t=="skip"||t=="memo"||t=="ref"||t.startsWith("set:")?i[t]=r[t]:o[t]=r[t];const n={[s.Context]:Object.create(s.current()?.[s.Context]??null),[b]:o,next:f,return:f,throw:t=>{throw t}},l=e.call(n,o),g=s.current();s.current(n);const u=t=>({...i,nodeName:e.is??"div",...d({children:t})});try{return u(l.next().value)}catch(t){return u(l.throw(t).value)}finally{l.return?.(),s.current(g)}},d=({key:e,skip:r,memo:i,ref:o,...n})=>{if("children"in n){const l=[...c(n.children)];l.length?n.children=l.length==1?l[0]:l:delete n.children}return n};exports.html=a;exports.render=p;
|
package/dist/html.js
CHANGED
|
@@ -1,75 +1,53 @@
|
|
|
1
|
-
import { Context as
|
|
2
|
-
const
|
|
3
|
-
},
|
|
4
|
-
for (e of
|
|
5
|
-
typeof e == "string" ? yield
|
|
6
|
-
},
|
|
7
|
-
let
|
|
8
|
-
for (const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
},
|
|
1
|
+
import { Context as f, current as s } from "./context.js";
|
|
2
|
+
const p = /* @__PURE__ */ new Set(["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]), b = /* @__PURE__ */ Symbol.for("ajo.args"), y = (e) => e.replace(/[&<>"']/g, (n) => `&#${n.charCodeAt(0)};`), u = () => {
|
|
3
|
+
}, v = (e) => [...d(e)].join(""), d = function* (e) {
|
|
4
|
+
for (e of c(e))
|
|
5
|
+
typeof e == "string" ? yield y(e) : yield* k(e);
|
|
6
|
+
}, k = function* ({ nodeName: e, children: n, ...i }) {
|
|
7
|
+
let o = "";
|
|
8
|
+
for (const r in i)
|
|
9
|
+
r.startsWith("set:") || i[r] == null || i[r] === !1 || (i[r] === !0 ? o += ` ${r}` : o += ` ${r}="${y(String(i[r]))}"`);
|
|
10
|
+
p.has(e) ? yield `<${e}${o}>` : (yield `<${e}${o}>`, n != null && (yield* d(n)), yield `</${e}>`);
|
|
11
|
+
}, c = function* (e) {
|
|
12
12
|
if (e == null) return;
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
15
|
-
if (
|
|
16
|
-
else if (
|
|
17
|
-
else if (Symbol.iterator in e) for (e of e) yield*
|
|
18
|
-
else "nodeName" in e ? typeof e.nodeName == "function" ? yield*
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
c.startsWith("attr:") ? n[c.slice(5)] = r[c] : c == "key" || c == "skip" || c == "memo" || c == "ref" || c.startsWith("set:") ? n[c] = r[c] : l[c] = r[c];
|
|
29
|
-
const i = {
|
|
30
|
-
[d]: Object.create(o()?.[d] ?? null),
|
|
31
|
-
[w]: l,
|
|
13
|
+
const n = typeof e;
|
|
14
|
+
if (n != "boolean")
|
|
15
|
+
if (n == "string") yield e;
|
|
16
|
+
else if (n == "number" || n == "bigint") yield String(e);
|
|
17
|
+
else if (Symbol.iterator in e) for (e of e) yield* c(e);
|
|
18
|
+
else "nodeName" in e ? typeof e.nodeName == "function" ? yield* $(e) : yield m(e) : yield String(e);
|
|
19
|
+
}, $ = function* ({ nodeName: e, fallback: n = e.fallback, ...i }) {
|
|
20
|
+
e.constructor.name == "GeneratorFunction" ? yield w(e, i) : yield* c(e(i));
|
|
21
|
+
}, w = (e, n) => {
|
|
22
|
+
const i = { ...e.attrs }, o = { ...e.args };
|
|
23
|
+
for (const t in n)
|
|
24
|
+
t.startsWith("attr:") ? i[t.slice(5)] = n[t] : t == "key" || t == "skip" || t == "memo" || t == "ref" || t.startsWith("set:") ? i[t] = n[t] : o[t] = n[t];
|
|
25
|
+
const r = {
|
|
26
|
+
[f]: Object.create(s()?.[f] ?? null),
|
|
27
|
+
[b]: o,
|
|
32
28
|
next: u,
|
|
33
29
|
return: u,
|
|
34
|
-
throw: (
|
|
35
|
-
throw
|
|
30
|
+
throw: (t) => {
|
|
31
|
+
throw t;
|
|
36
32
|
}
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
const
|
|
33
|
+
}, l = e.call(r, o), g = s();
|
|
34
|
+
s(r);
|
|
35
|
+
const a = (t) => ({ ...i, nodeName: e.is ?? "div", ...m({ children: t }) });
|
|
40
36
|
try {
|
|
41
|
-
return
|
|
42
|
-
} catch (
|
|
43
|
-
return
|
|
37
|
+
return a(l.next().value);
|
|
38
|
+
} catch (t) {
|
|
39
|
+
return a(l.throw(t).value);
|
|
44
40
|
} finally {
|
|
45
|
-
|
|
41
|
+
l.return?.(), s(g);
|
|
46
42
|
}
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
n = { ...n, alloc: (s = l) => n.alloc(s) };
|
|
52
|
-
try {
|
|
53
|
-
for (t = await i.next(); !t.done; )
|
|
54
|
-
n.push({ id: l, h: a(t.value, n), done: !1 }), t = await i.next();
|
|
55
|
-
n.push({ id: l, h: a(t.value, n), done: !0 });
|
|
56
|
-
} catch (s) {
|
|
57
|
-
n.push({ id: l, h: a(s, n), done: !0 });
|
|
58
|
-
} finally {
|
|
59
|
-
i.return?.();
|
|
60
|
-
}
|
|
61
|
-
}), n.placeholder(l, r);
|
|
62
|
-
}, G = (e, r, t) => {
|
|
63
|
-
const n = t.alloc();
|
|
64
|
-
return r.then((l) => t.push({ id: n, h: a(l, { ...t, alloc: (i = n) => t.alloc(i) }), done: !0 })), t.placeholder(n, e);
|
|
65
|
-
}, a = ({ key: e, skip: r, memo: t, ref: n, ...l }, i) => {
|
|
66
|
-
if ("children" in l) {
|
|
67
|
-
const s = [...f(l.children, i)];
|
|
68
|
-
s.length ? l.children = s.length == 1 ? s[0] : s : delete l.children;
|
|
43
|
+
}, m = ({ key: e, skip: n, memo: i, ref: o, ...r }) => {
|
|
44
|
+
if ("children" in r) {
|
|
45
|
+
const l = [...c(r.children)];
|
|
46
|
+
l.length ? r.children = l.length == 1 ? l[0] : l : delete r.children;
|
|
69
47
|
}
|
|
70
|
-
return
|
|
48
|
+
return r;
|
|
71
49
|
};
|
|
72
50
|
export {
|
|
73
|
-
|
|
74
|
-
|
|
51
|
+
d as html,
|
|
52
|
+
v as render
|
|
75
53
|
};
|
package/package.json
CHANGED
|
@@ -1,60 +1,55 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"build": "vite build",
|
|
57
|
-
"bump": "pnpm version patch && git push && git push --tags",
|
|
58
|
-
"release": "pnpm test && pnpm build && pnpm bump && pnpm publish"
|
|
59
|
-
}
|
|
60
|
-
}
|
|
2
|
+
"name": "ajo",
|
|
3
|
+
"version": "0.1.30",
|
|
4
|
+
"description": "ajo is a JavaScript view library for building user interfaces",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"types": "./types.ts",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"main": "./dist/index.cjs",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./types.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
},
|
|
15
|
+
"./context": {
|
|
16
|
+
"types": "./types.ts",
|
|
17
|
+
"import": "./dist/context.js",
|
|
18
|
+
"require": "./dist/context.cjs"
|
|
19
|
+
},
|
|
20
|
+
"./html": {
|
|
21
|
+
"types": "./types.ts",
|
|
22
|
+
"import": "./dist/html.js",
|
|
23
|
+
"require": "./dist/html.cjs"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"types.ts"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"test": "vitest --run",
|
|
32
|
+
"build": "vite build",
|
|
33
|
+
"bump": "pnpm version patch && git push && git push --tags",
|
|
34
|
+
"release": "pnpm test && pnpm build && pnpm bump && pnpm publish"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "25.2.3",
|
|
38
|
+
"happy-dom": "20.6.1",
|
|
39
|
+
"vite": "7.3.1",
|
|
40
|
+
"vite-tsconfig-paths": "6.1.1",
|
|
41
|
+
"vitest": "4.0.18"
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"ui",
|
|
45
|
+
"frontend",
|
|
46
|
+
"web",
|
|
47
|
+
"dom",
|
|
48
|
+
"jsx"
|
|
49
|
+
],
|
|
50
|
+
"repository": "cristianfalcone/ajo",
|
|
51
|
+
"author": "Cristian Falcone",
|
|
52
|
+
"license": "ISC",
|
|
53
|
+
"bugs": "https://github.com/cristianfalcone/ajo/issues",
|
|
54
|
+
"homepage": "https://github.com/cristianfalcone/ajo#readme"
|
|
55
|
+
}
|
package/readme.md
CHANGED
|
@@ -13,11 +13,10 @@
|
|
|
13
13
|
</a>
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
|
-
A modern JavaScript library for building user interfaces with generator-based state management
|
|
16
|
+
A modern JavaScript library for building user interfaces with generator-based state management and efficient DOM updates.
|
|
17
17
|
|
|
18
18
|
- **Generator-Based Components**: Use `function*` for stateful components with built-in lifecycle
|
|
19
19
|
- **Efficient DOM Updates**: In-place reconciliation minimizes DOM manipulation
|
|
20
|
-
- **Streaming SSR**: Progressive rendering with selective hydration (islands)
|
|
21
20
|
|
|
22
21
|
## Quick Start
|
|
23
22
|
|
|
@@ -29,6 +28,7 @@ npm install ajo
|
|
|
29
28
|
import { render } from 'ajo'
|
|
30
29
|
|
|
31
30
|
function* Counter() {
|
|
31
|
+
|
|
32
32
|
let count = 0
|
|
33
33
|
|
|
34
34
|
while (true) yield (
|
|
@@ -91,6 +91,7 @@ Generator functions with automatic wrapper elements. The structure provides a na
|
|
|
91
91
|
|
|
92
92
|
```javascript
|
|
93
93
|
function* TodoList() {
|
|
94
|
+
|
|
94
95
|
let todos = []
|
|
95
96
|
let text = ''
|
|
96
97
|
|
|
@@ -102,6 +103,7 @@ function* TodoList() {
|
|
|
102
103
|
})
|
|
103
104
|
|
|
104
105
|
while (true) {
|
|
106
|
+
|
|
105
107
|
const count = todos.length
|
|
106
108
|
|
|
107
109
|
yield (
|
|
@@ -127,6 +129,7 @@ Call `this.next()` to trigger a re-render. The optional callback receives curren
|
|
|
127
129
|
|
|
128
130
|
```javascript
|
|
129
131
|
function* Stepper(args) {
|
|
132
|
+
|
|
130
133
|
let count = 0
|
|
131
134
|
|
|
132
135
|
// Access current props in callback
|
|
@@ -159,7 +162,9 @@ Use `try...finally` for cleanup when the component unmounts:
|
|
|
159
162
|
|
|
160
163
|
```javascript
|
|
161
164
|
function* Clock() {
|
|
165
|
+
|
|
162
166
|
let time = new Date()
|
|
167
|
+
|
|
163
168
|
const interval = setInterval(() => this.next(() => time = new Date()), 1000)
|
|
164
169
|
|
|
165
170
|
try {
|
|
@@ -223,6 +228,7 @@ function* ErrorBoundary(args) {
|
|
|
223
228
|
|
|
224
229
|
```javascript
|
|
225
230
|
function* AutoFocus() {
|
|
231
|
+
|
|
226
232
|
let input = null
|
|
227
233
|
|
|
228
234
|
while (true) yield (
|
|
@@ -251,6 +257,7 @@ timer?.next() // trigger re-render from outside
|
|
|
251
257
|
|
|
252
258
|
```javascript
|
|
253
259
|
function* Chart(args) {
|
|
260
|
+
|
|
254
261
|
let chart = null
|
|
255
262
|
|
|
256
263
|
while (true) yield (
|
|
@@ -292,6 +299,7 @@ const Card = ({ title }) => {
|
|
|
292
299
|
|
|
293
300
|
// Stateful - write inside loop (updates each render)
|
|
294
301
|
function* ThemeProvider(args) {
|
|
302
|
+
|
|
295
303
|
let theme = 'light'
|
|
296
304
|
|
|
297
305
|
while (true) {
|
|
@@ -318,6 +326,7 @@ function* FixedTheme(args) {
|
|
|
318
326
|
|
|
319
327
|
```javascript
|
|
320
328
|
function* UserProfile(args) {
|
|
329
|
+
|
|
321
330
|
let data = null, error = null, loading = true
|
|
322
331
|
|
|
323
332
|
fetch(`/api/users/${args.id}`)
|
|
@@ -336,41 +345,8 @@ function* UserProfile(args) {
|
|
|
336
345
|
## Server-Side Rendering
|
|
337
346
|
|
|
338
347
|
```javascript
|
|
339
|
-
// Static
|
|
340
348
|
import { render } from 'ajo/html'
|
|
341
349
|
const html = render(<App />)
|
|
342
|
-
|
|
343
|
-
// Streaming
|
|
344
|
-
import { stream } from 'ajo/stream'
|
|
345
|
-
for await (const chunk of stream(<App />)) res.write(chunk)
|
|
346
|
-
|
|
347
|
-
// Hydration (client-side)
|
|
348
|
-
import { hydrate } from 'ajo/stream'
|
|
349
|
-
window.$stream = { push: hydrate }
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
### Islands Architecture
|
|
353
|
-
|
|
354
|
-
```javascript
|
|
355
|
-
function* Interactive() {
|
|
356
|
-
let count = 0
|
|
357
|
-
while (true) yield (
|
|
358
|
-
<button set:onclick={() => this.next(() => count++)}>
|
|
359
|
-
{count}
|
|
360
|
-
</button>
|
|
361
|
-
)
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
Interactive.src = '/islands/interactive.js' // hydrate on client
|
|
365
|
-
|
|
366
|
-
const Page = () => (
|
|
367
|
-
<html>
|
|
368
|
-
<body>
|
|
369
|
-
<p>Static content</p>
|
|
370
|
-
<Interactive fallback={<button>0</button>} />
|
|
371
|
-
</body>
|
|
372
|
-
</html>
|
|
373
|
-
)
|
|
374
350
|
```
|
|
375
351
|
|
|
376
352
|
## TypeScript
|
|
@@ -388,6 +364,7 @@ const Card: Stateless<CardProps> = ({ title, children }) => (
|
|
|
388
364
|
type CounterProps = { initial: number; step?: number }
|
|
389
365
|
|
|
390
366
|
const Counter: Stateful<CounterProps, 'section'> = function* (args) {
|
|
367
|
+
|
|
391
368
|
let count = args.initial
|
|
392
369
|
|
|
393
370
|
while (true) {
|
|
@@ -423,12 +400,6 @@ let ref: ThisParameterType<typeof Counter> | null = null
|
|
|
423
400
|
|--------|-------------|
|
|
424
401
|
| `render(children)` | Render to HTML string |
|
|
425
402
|
|
|
426
|
-
### `ajo/stream`
|
|
427
|
-
| Export | Description |
|
|
428
|
-
|--------|-------------|
|
|
429
|
-
| `stream(children)` | Async iterator for streaming SSR |
|
|
430
|
-
| `hydrate(patch)` | Apply streamed patch on client |
|
|
431
|
-
|
|
432
403
|
### Stateful `this`
|
|
433
404
|
| Method | Description |
|
|
434
405
|
|--------|-------------|
|
package/types.ts
CHANGED
|
@@ -80,27 +80,8 @@ declare module 'ajo/context' {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
declare module 'ajo/html' {
|
|
83
|
-
|
|
84
|
-
type Patch = {
|
|
85
|
-
id: string,
|
|
86
|
-
h: import('ajo').Children,
|
|
87
|
-
src?: string,
|
|
88
|
-
done: boolean,
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
type Hooks = {
|
|
92
|
-
alloc?: (parentId: string) => string,
|
|
93
|
-
placeholder?: (id: string, children: import('ajo').Children) => unknown,
|
|
94
|
-
push?: (patch: Patch) => void,
|
|
95
|
-
}
|
|
96
|
-
|
|
97
83
|
function render(h: import('ajo').Children): string
|
|
98
|
-
function html(h: import('ajo').Children
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
declare module 'ajo/stream' {
|
|
102
|
-
function stream(h: import('ajo').Children): AsyncIterableIterator<string>
|
|
103
|
-
function hydrate(patch: import('ajo/html').Patch): Promise<void>
|
|
84
|
+
function html(h: import('ajo').Children): IterableIterator<string>
|
|
104
85
|
}
|
|
105
86
|
|
|
106
87
|
declare namespace JSX {
|
package/dist/stream.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index.cjs"),m=require("./html.cjs"),y=async function*(o,n=""){const s=new Map([[n,0]]),t=new Set,i=[],r=(e=n)=>(s.set(e,(s.get(e)??0)+1),e?`${e}:${s.get(e)-1}`:String(s.get(e)-1)),h=(e,c)=>({nodeName:"div","data-ssr":e,children:c}),f=e=>{const c=Promise.resolve(`<script>window.$stream?.push(${JSON.stringify(e)})<\/script>`);t.add(c),c.then(u=>i.push(u)).finally(()=>t.delete(c))};for(const e of m.html(o,{alloc:r,placeholder:h,push:f}))yield e;for(;t.size||i.length;){for(;i.length;)yield i.shift();t.size&&await Promise.race(t)}},d=new Set;async function l({id:o,src:n,h:s}){const t=document.querySelector(`[data-ssr="${o}"]`);if(!t)return d.add({id:o,src:n,h:s});n?a.render(a.h((await import(n)).default,s),t):a.render(s,t);const i=o+":";for(const r of d)r.id.startsWith(i)&&(d.delete(r),l(r))}exports.hydrate=l;exports.stream=y;
|
package/dist/stream.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { render as l, h as m } from "./index.js";
|
|
2
|
-
import { html as u } from "./html.js";
|
|
3
|
-
const y = async function* (i, n = "") {
|
|
4
|
-
const s = /* @__PURE__ */ new Map([[n, 0]]), e = /* @__PURE__ */ new Set(), o = [], c = (t = n) => (s.set(t, (s.get(t) ?? 0) + 1), t ? `${t}:${s.get(t) - 1}` : String(s.get(t) - 1)), d = (t, r) => ({ nodeName: "div", "data-ssr": t, children: r }), f = (t) => {
|
|
5
|
-
const r = Promise.resolve(`<script>window.$stream?.push(${JSON.stringify(t)})<\/script>`);
|
|
6
|
-
e.add(r), r.then((h) => o.push(h)).finally(() => e.delete(r));
|
|
7
|
-
};
|
|
8
|
-
for (const t of u(i, { alloc: c, placeholder: d, push: f })) yield t;
|
|
9
|
-
for (; e.size || o.length; ) {
|
|
10
|
-
for (; o.length; ) yield o.shift();
|
|
11
|
-
e.size && await Promise.race(e);
|
|
12
|
-
}
|
|
13
|
-
}, a = /* @__PURE__ */ new Set();
|
|
14
|
-
async function p({ id: i, src: n, h: s }) {
|
|
15
|
-
const e = document.querySelector(`[data-ssr="${i}"]`);
|
|
16
|
-
if (!e) return a.add({ id: i, src: n, h: s });
|
|
17
|
-
n ? l(m((await import(n)).default, s), e) : l(s, e);
|
|
18
|
-
const o = i + ":";
|
|
19
|
-
for (const c of a) c.id.startsWith(o) && (a.delete(c), p(c));
|
|
20
|
-
}
|
|
21
|
-
export {
|
|
22
|
-
p as hydrate,
|
|
23
|
-
y as stream
|
|
24
|
-
};
|