marko 6.0.0-next.3.73 → 6.0.0-next.3.75
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/debug/html.js +30 -7
- package/dist/debug/html.mjs +30 -7
- package/dist/html/writer.d.ts +1 -0
- package/dist/html.js +22 -9
- package/dist/html.mjs +22 -9
- package/dist/translator/index.js +670 -629
- package/dist/translator/util/is-non-html-text.d.ts +2 -0
- package/package.json +1 -1
package/dist/debug/html.js
CHANGED
@@ -307,11 +307,14 @@ runtime.x = (op, id, node, start, placeholderCallback) => {
|
|
307
307
|
) : `(e=>{let i,l,t,r={},c=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(d,o,n,a,g)=>{"#"==d?(r[o]=l).i++:n==t&&i(),"T"==n.tagName&&(o=n.getAttribute(e.i))&&((a=e.l["^"+o])&&(r[o]={i:1,c(i=e.l[o]||n){for(;(t=i.previousSibling||a).remove(),a!=t;);c(i,n)}}),t=n.nextSibling,l=r[o],i=()=>{a||c(e.l[o],n),--l.i||l.c()},(d=e.j[o])&&(g=l.c,l.c=()=>g()+d(e.r)))}})`;
|
308
308
|
|
309
309
|
// src/html/serializer.ts
|
310
|
+
var kTouchedIterator = Symbol();
|
310
311
|
var { hasOwnProperty } = {};
|
311
312
|
var Generator = function* () {
|
312
313
|
}().constructor;
|
313
314
|
var AsyncGenerator = async function* () {
|
314
315
|
}().constructor;
|
316
|
+
patchIteratorNext(Generator.prototype);
|
317
|
+
patchIteratorNext(AsyncGenerator.prototype);
|
315
318
|
var REGISTRY = /* @__PURE__ */ new WeakMap();
|
316
319
|
var KNOWN_SYMBOLS = (() => {
|
317
320
|
const KNOWN_SYMBOLS2 = /* @__PURE__ */ new Map();
|
@@ -1312,6 +1315,10 @@ function writeReadableStream(state, val, ref) {
|
|
1312
1315
|
return true;
|
1313
1316
|
}
|
1314
1317
|
function writeGenerator(state, iter, ref) {
|
1318
|
+
if (iter[kTouchedIterator]) {
|
1319
|
+
state.buf.push("(async function*(){}())");
|
1320
|
+
return true;
|
1321
|
+
}
|
1315
1322
|
let sep = "";
|
1316
1323
|
state.buf.push("(function*(){");
|
1317
1324
|
while (true) {
|
@@ -1335,6 +1342,10 @@ function writeGenerator(state, iter, ref) {
|
|
1335
1342
|
return true;
|
1336
1343
|
}
|
1337
1344
|
function writeAsyncGenerator(state, iter, ref) {
|
1345
|
+
if (iter[kTouchedIterator]) {
|
1346
|
+
state.buf.push("(async function*(){}())");
|
1347
|
+
return true;
|
1348
|
+
}
|
1338
1349
|
const { boundary } = state;
|
1339
1350
|
if (!boundary) return false;
|
1340
1351
|
const iterId = nextRefAccess(state);
|
@@ -1639,6 +1650,13 @@ function isDigit(char) {
|
|
1639
1650
|
function isWord(char) {
|
1640
1651
|
return char >= "a" && char <= "z" || char >= "A" && char <= "Z" || char === "_" || char === "$";
|
1641
1652
|
}
|
1653
|
+
function patchIteratorNext(proto) {
|
1654
|
+
const { next } = proto;
|
1655
|
+
proto.next = function(value) {
|
1656
|
+
this[kTouchedIterator] = 1;
|
1657
|
+
return next.call(this, value);
|
1658
|
+
};
|
1659
|
+
}
|
1642
1660
|
|
1643
1661
|
// src/html/writer.ts
|
1644
1662
|
var $chunk;
|
@@ -2173,6 +2191,7 @@ var State2 = class {
|
|
2173
2191
|
hasMainRuntime = false;
|
2174
2192
|
hasReorderRuntime = false;
|
2175
2193
|
hasWrittenResume = false;
|
2194
|
+
walkOnNextFlush = false;
|
2176
2195
|
trailerHTML = "";
|
2177
2196
|
resumes = "";
|
2178
2197
|
nonceAttr = "";
|
@@ -2350,9 +2369,9 @@ var Chunk = class {
|
|
2350
2369
|
const { boundary, effects } = this;
|
2351
2370
|
const { state } = boundary;
|
2352
2371
|
const { $global: $global2, runtimePrefix, nonceAttr } = state;
|
2353
|
-
let { resumes } = state;
|
2354
2372
|
let { html, scripts } = this;
|
2355
|
-
let hasWalk =
|
2373
|
+
let hasWalk = state.walkOnNextFlush;
|
2374
|
+
if (hasWalk) state.walkOnNextFlush = false;
|
2356
2375
|
if (state.needsMainRuntime && !state.hasMainRuntime) {
|
2357
2376
|
state.hasMainRuntime = true;
|
2358
2377
|
scripts = concatScripts(
|
@@ -2362,19 +2381,19 @@ var Chunk = class {
|
|
2362
2381
|
}
|
2363
2382
|
if (effects) {
|
2364
2383
|
hasWalk = true;
|
2365
|
-
resumes = resumes ? resumes + "," + effects : effects;
|
2384
|
+
state.resumes = state.resumes ? state.resumes + "," + effects : effects;
|
2366
2385
|
}
|
2367
|
-
if (resumes) {
|
2386
|
+
if (state.resumes) {
|
2368
2387
|
if (state.hasWrittenResume) {
|
2369
2388
|
scripts = concatScripts(
|
2370
2389
|
scripts,
|
2371
|
-
runtimePrefix + ".r.push(" + resumes + ")"
|
2390
|
+
runtimePrefix + ".r.push(" + state.resumes + ")"
|
2372
2391
|
);
|
2373
2392
|
} else {
|
2374
2393
|
state.hasWrittenResume = true;
|
2375
2394
|
scripts = concatScripts(
|
2376
2395
|
scripts,
|
2377
|
-
runtimePrefix + ".r=[" + resumes + "]"
|
2396
|
+
runtimePrefix + ".r=[" + state.resumes + "]"
|
2378
2397
|
);
|
2379
2398
|
}
|
2380
2399
|
}
|
@@ -2469,7 +2488,8 @@ var Chunk = class {
|
|
2469
2488
|
function flushSerializer(boundary) {
|
2470
2489
|
const { state } = boundary;
|
2471
2490
|
const { writeScopes, serializer } = state;
|
2472
|
-
|
2491
|
+
const { flushed } = serializer;
|
2492
|
+
if (writeScopes || flushed) {
|
2473
2493
|
const serializeData = [];
|
2474
2494
|
let { lastSerializedScopeId } = state;
|
2475
2495
|
if (!state.hasGlobals) {
|
@@ -2490,6 +2510,9 @@ function flushSerializer(boundary) {
|
|
2490
2510
|
);
|
2491
2511
|
state.lastSerializedScopeId = lastSerializedScopeId;
|
2492
2512
|
state.writeScopes = null;
|
2513
|
+
if (flushed) {
|
2514
|
+
state.walkOnNextFlush = true;
|
2515
|
+
}
|
2493
2516
|
}
|
2494
2517
|
}
|
2495
2518
|
function writeTrailers(html) {
|
package/dist/debug/html.mjs
CHANGED
@@ -225,11 +225,14 @@ runtime.x = (op, id, node, start, placeholderCallback) => {
|
|
225
225
|
) : `(e=>{let i,l,t,r={},c=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(d,o,n,a,g)=>{"#"==d?(r[o]=l).i++:n==t&&i(),"T"==n.tagName&&(o=n.getAttribute(e.i))&&((a=e.l["^"+o])&&(r[o]={i:1,c(i=e.l[o]||n){for(;(t=i.previousSibling||a).remove(),a!=t;);c(i,n)}}),t=n.nextSibling,l=r[o],i=()=>{a||c(e.l[o],n),--l.i||l.c()},(d=e.j[o])&&(g=l.c,l.c=()=>g()+d(e.r)))}})`;
|
226
226
|
|
227
227
|
// src/html/serializer.ts
|
228
|
+
var kTouchedIterator = Symbol();
|
228
229
|
var { hasOwnProperty } = {};
|
229
230
|
var Generator = function* () {
|
230
231
|
}().constructor;
|
231
232
|
var AsyncGenerator = async function* () {
|
232
233
|
}().constructor;
|
234
|
+
patchIteratorNext(Generator.prototype);
|
235
|
+
patchIteratorNext(AsyncGenerator.prototype);
|
233
236
|
var REGISTRY = /* @__PURE__ */ new WeakMap();
|
234
237
|
var KNOWN_SYMBOLS = (() => {
|
235
238
|
const KNOWN_SYMBOLS2 = /* @__PURE__ */ new Map();
|
@@ -1230,6 +1233,10 @@ function writeReadableStream(state, val, ref) {
|
|
1230
1233
|
return true;
|
1231
1234
|
}
|
1232
1235
|
function writeGenerator(state, iter, ref) {
|
1236
|
+
if (iter[kTouchedIterator]) {
|
1237
|
+
state.buf.push("(async function*(){}())");
|
1238
|
+
return true;
|
1239
|
+
}
|
1233
1240
|
let sep = "";
|
1234
1241
|
state.buf.push("(function*(){");
|
1235
1242
|
while (true) {
|
@@ -1253,6 +1260,10 @@ function writeGenerator(state, iter, ref) {
|
|
1253
1260
|
return true;
|
1254
1261
|
}
|
1255
1262
|
function writeAsyncGenerator(state, iter, ref) {
|
1263
|
+
if (iter[kTouchedIterator]) {
|
1264
|
+
state.buf.push("(async function*(){}())");
|
1265
|
+
return true;
|
1266
|
+
}
|
1256
1267
|
const { boundary } = state;
|
1257
1268
|
if (!boundary) return false;
|
1258
1269
|
const iterId = nextRefAccess(state);
|
@@ -1557,6 +1568,13 @@ function isDigit(char) {
|
|
1557
1568
|
function isWord(char) {
|
1558
1569
|
return char >= "a" && char <= "z" || char >= "A" && char <= "Z" || char === "_" || char === "$";
|
1559
1570
|
}
|
1571
|
+
function patchIteratorNext(proto) {
|
1572
|
+
const { next } = proto;
|
1573
|
+
proto.next = function(value) {
|
1574
|
+
this[kTouchedIterator] = 1;
|
1575
|
+
return next.call(this, value);
|
1576
|
+
};
|
1577
|
+
}
|
1560
1578
|
|
1561
1579
|
// src/html/writer.ts
|
1562
1580
|
var $chunk;
|
@@ -2091,6 +2109,7 @@ var State2 = class {
|
|
2091
2109
|
hasMainRuntime = false;
|
2092
2110
|
hasReorderRuntime = false;
|
2093
2111
|
hasWrittenResume = false;
|
2112
|
+
walkOnNextFlush = false;
|
2094
2113
|
trailerHTML = "";
|
2095
2114
|
resumes = "";
|
2096
2115
|
nonceAttr = "";
|
@@ -2268,9 +2287,9 @@ var Chunk = class {
|
|
2268
2287
|
const { boundary, effects } = this;
|
2269
2288
|
const { state } = boundary;
|
2270
2289
|
const { $global: $global2, runtimePrefix, nonceAttr } = state;
|
2271
|
-
let { resumes } = state;
|
2272
2290
|
let { html, scripts } = this;
|
2273
|
-
let hasWalk =
|
2291
|
+
let hasWalk = state.walkOnNextFlush;
|
2292
|
+
if (hasWalk) state.walkOnNextFlush = false;
|
2274
2293
|
if (state.needsMainRuntime && !state.hasMainRuntime) {
|
2275
2294
|
state.hasMainRuntime = true;
|
2276
2295
|
scripts = concatScripts(
|
@@ -2280,19 +2299,19 @@ var Chunk = class {
|
|
2280
2299
|
}
|
2281
2300
|
if (effects) {
|
2282
2301
|
hasWalk = true;
|
2283
|
-
resumes = resumes ? resumes + "," + effects : effects;
|
2302
|
+
state.resumes = state.resumes ? state.resumes + "," + effects : effects;
|
2284
2303
|
}
|
2285
|
-
if (resumes) {
|
2304
|
+
if (state.resumes) {
|
2286
2305
|
if (state.hasWrittenResume) {
|
2287
2306
|
scripts = concatScripts(
|
2288
2307
|
scripts,
|
2289
|
-
runtimePrefix + ".r.push(" + resumes + ")"
|
2308
|
+
runtimePrefix + ".r.push(" + state.resumes + ")"
|
2290
2309
|
);
|
2291
2310
|
} else {
|
2292
2311
|
state.hasWrittenResume = true;
|
2293
2312
|
scripts = concatScripts(
|
2294
2313
|
scripts,
|
2295
|
-
runtimePrefix + ".r=[" + resumes + "]"
|
2314
|
+
runtimePrefix + ".r=[" + state.resumes + "]"
|
2296
2315
|
);
|
2297
2316
|
}
|
2298
2317
|
}
|
@@ -2387,7 +2406,8 @@ var Chunk = class {
|
|
2387
2406
|
function flushSerializer(boundary) {
|
2388
2407
|
const { state } = boundary;
|
2389
2408
|
const { writeScopes, serializer } = state;
|
2390
|
-
|
2409
|
+
const { flushed } = serializer;
|
2410
|
+
if (writeScopes || flushed) {
|
2391
2411
|
const serializeData = [];
|
2392
2412
|
let { lastSerializedScopeId } = state;
|
2393
2413
|
if (!state.hasGlobals) {
|
@@ -2408,6 +2428,9 @@ function flushSerializer(boundary) {
|
|
2408
2428
|
);
|
2409
2429
|
state.lastSerializedScopeId = lastSerializedScopeId;
|
2410
2430
|
state.writeScopes = null;
|
2431
|
+
if (flushed) {
|
2432
|
+
state.walkOnNextFlush = true;
|
2433
|
+
}
|
2411
2434
|
}
|
2412
2435
|
}
|
2413
2436
|
function writeTrailers(html) {
|
package/dist/html/writer.d.ts
CHANGED
package/dist/html.js
CHANGED
@@ -179,9 +179,11 @@ function forTo(to, from, step, cb) {
|
|
179
179
|
var WALKER_RUNTIME_CODE = '(e=>self[e]=self[e]||(l=>{let t,d={},s=[],f=document,i=f.createTreeWalker(f,129),n=self[e][l]={i:l=e+l,d:f,l:d,v:s,x(){},w(e){for(;e=i.nextNode();)this.x(n=(n=e.data)&&!n.indexOf(l)&&(d[t=n.slice(x+1)]=e,n[x]),t,e),n>"#"&&s.push(e)}},x=l.length}))', REORDER_RUNTIME_CODE = '(e=>{let i,l,t,r={},c=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(d,o,n,a,g)=>{"#"==d?(r[o]=l).i++:n==t&&i(),"T"==n.tagName&&(o=n.getAttribute(e.i))&&((a=e.l["^"+o])&&(r[o]={i:1,c(i=e.l[o]||n){for(;(t=i.previousSibling||a).remove(),a!=t;);c(i,n)}}),t=n.nextSibling,l=r[o],i=()=>{a||c(e.l[o],n),--l.i||l.c()},(d=e.j[o])&&(g=l.c,l.c=()=>g()+d(e.r)))}})';
|
180
180
|
|
181
181
|
// src/html/serializer.ts
|
182
|
-
var { hasOwnProperty } = {}, Generator = function* () {
|
182
|
+
var kTouchedIterator = Symbol(), { hasOwnProperty } = {}, Generator = function* () {
|
183
183
|
}().constructor, AsyncGenerator = async function* () {
|
184
184
|
}().constructor;
|
185
|
+
patchIteratorNext(Generator.prototype);
|
186
|
+
patchIteratorNext(AsyncGenerator.prototype);
|
185
187
|
var REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = (() => {
|
186
188
|
let KNOWN_SYMBOLS2 = /* @__PURE__ */ new Map();
|
187
189
|
for (let name of Object.getOwnPropertyNames(Symbol)) {
|
@@ -854,6 +856,8 @@ function writeReadableStream(state, val, ref) {
|
|
854
856
|
), reader.read().then(onFulfilled, onRejected), boundary.startAsync(), !0;
|
855
857
|
}
|
856
858
|
function writeGenerator(state, iter, ref) {
|
859
|
+
if (iter[kTouchedIterator])
|
860
|
+
return state.buf.push("(async function*(){}())"), !0;
|
857
861
|
let sep = "";
|
858
862
|
for (state.buf.push("(function*(){"); ; ) {
|
859
863
|
let { value, done } = iter.next();
|
@@ -866,6 +870,8 @@ function writeGenerator(state, iter, ref) {
|
|
866
870
|
return state.buf.push("})()"), !0;
|
867
871
|
}
|
868
872
|
function writeAsyncGenerator(state, iter, ref) {
|
873
|
+
if (iter[kTouchedIterator])
|
874
|
+
return state.buf.push("(async function*(){}())"), !0;
|
869
875
|
let { boundary } = state;
|
870
876
|
if (!boundary) return !1;
|
871
877
|
let iterId = nextRefAccess(state), iterRef = new Reference(ref, null, state.flush, null, iterId), onFulfilled = ({ value, done }) => {
|
@@ -1064,6 +1070,12 @@ function isDigit(char) {
|
|
1064
1070
|
function isWord(char) {
|
1065
1071
|
return char >= "a" && char <= "z" || char >= "A" && char <= "Z" || char === "_" || char === "$";
|
1066
1072
|
}
|
1073
|
+
function patchIteratorNext(proto) {
|
1074
|
+
let { next } = proto;
|
1075
|
+
proto.next = function(value) {
|
1076
|
+
return this[kTouchedIterator] = 1, next.call(this, value);
|
1077
|
+
};
|
1078
|
+
}
|
1067
1079
|
|
1068
1080
|
// src/html/writer.ts
|
1069
1081
|
var $chunk, NOOP = () => {
|
@@ -1410,6 +1422,7 @@ var State2 = class {
|
|
1410
1422
|
hasMainRuntime = !1;
|
1411
1423
|
hasReorderRuntime = !1;
|
1412
1424
|
hasWrittenResume = !1;
|
1425
|
+
walkOnNextFlush = !1;
|
1413
1426
|
trailerHTML = "";
|
1414
1427
|
resumes = "";
|
1415
1428
|
nonceAttr = "";
|
@@ -1527,16 +1540,16 @@ var State2 = class {
|
|
1527
1540
|
}
|
1528
1541
|
flushScript() {
|
1529
1542
|
flushSerializer(this.boundary);
|
1530
|
-
let { boundary, effects } = this, { state } = boundary, { $global: $global2, runtimePrefix, nonceAttr } = state, {
|
1531
|
-
if (state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(
|
1543
|
+
let { boundary, effects } = this, { state } = boundary, { $global: $global2, runtimePrefix, nonceAttr } = state, { html, scripts } = this, hasWalk = state.walkOnNextFlush;
|
1544
|
+
if (hasWalk && (state.walkOnNextFlush = !1), state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(
|
1532
1545
|
scripts,
|
1533
1546
|
WALKER_RUNTIME_CODE + '("' + $global2.runtimeId + '")("' + $global2.renderId + '")'
|
1534
|
-
)), effects && (hasWalk = !0, resumes = resumes ? resumes + "," + effects : effects), resumes && (state.hasWrittenResume ? scripts = concatScripts(
|
1547
|
+
)), effects && (hasWalk = !0, state.resumes = state.resumes ? state.resumes + "," + effects : effects), state.resumes && (state.hasWrittenResume ? scripts = concatScripts(
|
1535
1548
|
scripts,
|
1536
|
-
runtimePrefix + ".r.push(" + resumes + ")"
|
1549
|
+
runtimePrefix + ".r.push(" + state.resumes + ")"
|
1537
1550
|
) : (state.hasWrittenResume = !0, scripts = concatScripts(
|
1538
1551
|
scripts,
|
1539
|
-
runtimePrefix + ".r=[" + resumes + "]"
|
1552
|
+
runtimePrefix + ".r=[" + state.resumes + "]"
|
1540
1553
|
))), state.writeReorders) {
|
1541
1554
|
hasWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, html += "<style " + state.commentPrefix + nonceAttr + ">t{display:none}</style>", scripts = concatScripts(
|
1542
1555
|
scripts,
|
@@ -1577,8 +1590,8 @@ var State2 = class {
|
|
1577
1590
|
}
|
1578
1591
|
};
|
1579
1592
|
function flushSerializer(boundary) {
|
1580
|
-
let { state } = boundary, { writeScopes, serializer } = state;
|
1581
|
-
if (writeScopes ||
|
1593
|
+
let { state } = boundary, { writeScopes, serializer } = state, { flushed } = serializer;
|
1594
|
+
if (writeScopes || flushed) {
|
1582
1595
|
let serializeData = [], { lastSerializedScopeId } = state;
|
1583
1596
|
state.hasGlobals || (state.hasGlobals = !0, serializeData.push(getFilteredGlobals(state.$global)));
|
1584
1597
|
for (let key in writeScopes) {
|
@@ -1588,7 +1601,7 @@ function flushSerializer(boundary) {
|
|
1588
1601
|
state.resumes = concatEffects(
|
1589
1602
|
state.resumes,
|
1590
1603
|
serializer.stringify(serializeData, boundary)
|
1591
|
-
), state.lastSerializedScopeId = lastSerializedScopeId, state.writeScopes = null;
|
1604
|
+
), state.lastSerializedScopeId = lastSerializedScopeId, state.writeScopes = null, flushed && (state.walkOnNextFlush = !0);
|
1592
1605
|
}
|
1593
1606
|
}
|
1594
1607
|
function writeTrailers(html) {
|
package/dist/html.mjs
CHANGED
@@ -100,9 +100,11 @@ function forTo(to, from, step, cb) {
|
|
100
100
|
var WALKER_RUNTIME_CODE = '(e=>self[e]=self[e]||(l=>{let t,d={},s=[],f=document,i=f.createTreeWalker(f,129),n=self[e][l]={i:l=e+l,d:f,l:d,v:s,x(){},w(e){for(;e=i.nextNode();)this.x(n=(n=e.data)&&!n.indexOf(l)&&(d[t=n.slice(x+1)]=e,n[x]),t,e),n>"#"&&s.push(e)}},x=l.length}))', REORDER_RUNTIME_CODE = '(e=>{let i,l,t,r={},c=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(d,o,n,a,g)=>{"#"==d?(r[o]=l).i++:n==t&&i(),"T"==n.tagName&&(o=n.getAttribute(e.i))&&((a=e.l["^"+o])&&(r[o]={i:1,c(i=e.l[o]||n){for(;(t=i.previousSibling||a).remove(),a!=t;);c(i,n)}}),t=n.nextSibling,l=r[o],i=()=>{a||c(e.l[o],n),--l.i||l.c()},(d=e.j[o])&&(g=l.c,l.c=()=>g()+d(e.r)))}})';
|
101
101
|
|
102
102
|
// src/html/serializer.ts
|
103
|
-
var { hasOwnProperty } = {}, Generator = function* () {
|
103
|
+
var kTouchedIterator = Symbol(), { hasOwnProperty } = {}, Generator = function* () {
|
104
104
|
}().constructor, AsyncGenerator = async function* () {
|
105
105
|
}().constructor;
|
106
|
+
patchIteratorNext(Generator.prototype);
|
107
|
+
patchIteratorNext(AsyncGenerator.prototype);
|
106
108
|
var REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = (() => {
|
107
109
|
let KNOWN_SYMBOLS2 = /* @__PURE__ */ new Map();
|
108
110
|
for (let name of Object.getOwnPropertyNames(Symbol)) {
|
@@ -775,6 +777,8 @@ function writeReadableStream(state, val, ref) {
|
|
775
777
|
), reader.read().then(onFulfilled, onRejected), boundary.startAsync(), !0;
|
776
778
|
}
|
777
779
|
function writeGenerator(state, iter, ref) {
|
780
|
+
if (iter[kTouchedIterator])
|
781
|
+
return state.buf.push("(async function*(){}())"), !0;
|
778
782
|
let sep = "";
|
779
783
|
for (state.buf.push("(function*(){"); ; ) {
|
780
784
|
let { value, done } = iter.next();
|
@@ -787,6 +791,8 @@ function writeGenerator(state, iter, ref) {
|
|
787
791
|
return state.buf.push("})()"), !0;
|
788
792
|
}
|
789
793
|
function writeAsyncGenerator(state, iter, ref) {
|
794
|
+
if (iter[kTouchedIterator])
|
795
|
+
return state.buf.push("(async function*(){}())"), !0;
|
790
796
|
let { boundary } = state;
|
791
797
|
if (!boundary) return !1;
|
792
798
|
let iterId = nextRefAccess(state), iterRef = new Reference(ref, null, state.flush, null, iterId), onFulfilled = ({ value, done }) => {
|
@@ -985,6 +991,12 @@ function isDigit(char) {
|
|
985
991
|
function isWord(char) {
|
986
992
|
return char >= "a" && char <= "z" || char >= "A" && char <= "Z" || char === "_" || char === "$";
|
987
993
|
}
|
994
|
+
function patchIteratorNext(proto) {
|
995
|
+
let { next } = proto;
|
996
|
+
proto.next = function(value) {
|
997
|
+
return this[kTouchedIterator] = 1, next.call(this, value);
|
998
|
+
};
|
999
|
+
}
|
988
1000
|
|
989
1001
|
// src/html/writer.ts
|
990
1002
|
var $chunk, NOOP = () => {
|
@@ -1331,6 +1343,7 @@ var State2 = class {
|
|
1331
1343
|
hasMainRuntime = !1;
|
1332
1344
|
hasReorderRuntime = !1;
|
1333
1345
|
hasWrittenResume = !1;
|
1346
|
+
walkOnNextFlush = !1;
|
1334
1347
|
trailerHTML = "";
|
1335
1348
|
resumes = "";
|
1336
1349
|
nonceAttr = "";
|
@@ -1448,16 +1461,16 @@ var State2 = class {
|
|
1448
1461
|
}
|
1449
1462
|
flushScript() {
|
1450
1463
|
flushSerializer(this.boundary);
|
1451
|
-
let { boundary, effects } = this, { state } = boundary, { $global: $global2, runtimePrefix, nonceAttr } = state, {
|
1452
|
-
if (state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(
|
1464
|
+
let { boundary, effects } = this, { state } = boundary, { $global: $global2, runtimePrefix, nonceAttr } = state, { html, scripts } = this, hasWalk = state.walkOnNextFlush;
|
1465
|
+
if (hasWalk && (state.walkOnNextFlush = !1), state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(
|
1453
1466
|
scripts,
|
1454
1467
|
WALKER_RUNTIME_CODE + '("' + $global2.runtimeId + '")("' + $global2.renderId + '")'
|
1455
|
-
)), effects && (hasWalk = !0, resumes = resumes ? resumes + "," + effects : effects), resumes && (state.hasWrittenResume ? scripts = concatScripts(
|
1468
|
+
)), effects && (hasWalk = !0, state.resumes = state.resumes ? state.resumes + "," + effects : effects), state.resumes && (state.hasWrittenResume ? scripts = concatScripts(
|
1456
1469
|
scripts,
|
1457
|
-
runtimePrefix + ".r.push(" + resumes + ")"
|
1470
|
+
runtimePrefix + ".r.push(" + state.resumes + ")"
|
1458
1471
|
) : (state.hasWrittenResume = !0, scripts = concatScripts(
|
1459
1472
|
scripts,
|
1460
|
-
runtimePrefix + ".r=[" + resumes + "]"
|
1473
|
+
runtimePrefix + ".r=[" + state.resumes + "]"
|
1461
1474
|
))), state.writeReorders) {
|
1462
1475
|
hasWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, html += "<style " + state.commentPrefix + nonceAttr + ">t{display:none}</style>", scripts = concatScripts(
|
1463
1476
|
scripts,
|
@@ -1498,8 +1511,8 @@ var State2 = class {
|
|
1498
1511
|
}
|
1499
1512
|
};
|
1500
1513
|
function flushSerializer(boundary) {
|
1501
|
-
let { state } = boundary, { writeScopes, serializer } = state;
|
1502
|
-
if (writeScopes ||
|
1514
|
+
let { state } = boundary, { writeScopes, serializer } = state, { flushed } = serializer;
|
1515
|
+
if (writeScopes || flushed) {
|
1503
1516
|
let serializeData = [], { lastSerializedScopeId } = state;
|
1504
1517
|
state.hasGlobals || (state.hasGlobals = !0, serializeData.push(getFilteredGlobals(state.$global)));
|
1505
1518
|
for (let key in writeScopes) {
|
@@ -1509,7 +1522,7 @@ function flushSerializer(boundary) {
|
|
1509
1522
|
state.resumes = concatEffects(
|
1510
1523
|
state.resumes,
|
1511
1524
|
serializer.stringify(serializeData, boundary)
|
1512
|
-
), state.lastSerializedScopeId = lastSerializedScopeId, state.writeScopes = null;
|
1525
|
+
), state.lastSerializedScopeId = lastSerializedScopeId, state.writeScopes = null, flushed && (state.walkOnNextFlush = !0);
|
1513
1526
|
}
|
1514
1527
|
}
|
1515
1528
|
function writeTrailers(html) {
|