marko 6.0.0-next.3.65 → 6.0.0-next.3.67
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/dom.js +17 -16
- package/dist/debug/dom.mjs +17 -16
- package/dist/debug/html.js +21 -11
- package/dist/debug/html.mjs +21 -11
- package/dist/dom.js +15 -13
- package/dist/dom.mjs +15 -13
- package/dist/html/writer.d.ts +2 -3
- package/dist/html.js +15 -8
- package/dist/html.mjs +15 -8
- package/dist/translator/index.js +901 -754
- package/dist/translator/util/dynamic-sources.d.ts +18 -0
- package/dist/translator/util/optional.d.ts +2 -0
- package/dist/translator/util/references.d.ts +3 -3
- package/dist/translator/util/sections.d.ts +3 -2
- package/dist/translator/util/signals.d.ts +2 -2
- package/package.json +2 -2
- package/dist/translator/util/is-stateful.d.ts +0 -3
package/dist/debug/dom.js
CHANGED
@@ -277,6 +277,8 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
277
277
|
const branchIds = /* @__PURE__ */ new Set();
|
278
278
|
const parentBranchIds = /* @__PURE__ */ new Map();
|
279
279
|
let currentBranchId;
|
280
|
+
let $global;
|
281
|
+
let lastScopeId = 0;
|
280
282
|
render.w = () => {
|
281
283
|
walk2.call(render);
|
282
284
|
const visits = render.v;
|
@@ -303,12 +305,12 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
303
305
|
for (const visit of visitNodes) {
|
304
306
|
const commentText = visit.data;
|
305
307
|
const dataIndex = commentText.indexOf(" ") + 1;
|
306
|
-
const scopeId = commentText.slice(
|
308
|
+
const scopeId = +commentText.slice(
|
307
309
|
commentPrefixLen + 1,
|
308
310
|
dataIndex ? dataIndex - 1 : commentText.length
|
309
311
|
);
|
310
312
|
const scope = scopeLookup[scopeId] ||= {
|
311
|
-
___id:
|
313
|
+
___id: scopeId
|
312
314
|
};
|
313
315
|
const data2 = dataIndex ? commentText.slice(dataIndex) : "";
|
314
316
|
const token = commentText[commentPrefixLen];
|
@@ -344,7 +346,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
344
346
|
while (~next) {
|
345
347
|
const start = next + 1;
|
346
348
|
next = data2.indexOf(" ", start);
|
347
|
-
const childScopeId = data2.slice(
|
349
|
+
const childScopeId = +data2.slice(
|
348
350
|
start,
|
349
351
|
~next ? next : data2.length
|
350
352
|
);
|
@@ -361,20 +363,19 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
361
363
|
for (let i = 0; i < resumes.length; i++) {
|
362
364
|
const serialized = resumes[i];
|
363
365
|
if (typeof serialized === "function") {
|
364
|
-
const
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
const scope = scopes[scopeId];
|
366
|
+
for (const scope of serialized(serializeContext)) {
|
367
|
+
if (!$global) {
|
368
|
+
$global = scope || {};
|
369
|
+
$global.runtimeId = runtimeId;
|
370
|
+
$global.renderId = renderId;
|
371
|
+
$global.___nextScopeId = 1e6;
|
372
|
+
} else if (typeof scope === "number") {
|
373
|
+
lastScopeId += scope;
|
374
|
+
} else {
|
375
|
+
const scopeId = ++lastScopeId;
|
375
376
|
const prevScope = scopeLookup[scopeId];
|
376
377
|
scope.$global = $global;
|
377
|
-
scope.___id =
|
378
|
+
scope.___id = scopeId;
|
378
379
|
if (prevScope !== scope) {
|
379
380
|
scopeLookup[scopeId] = Object.assign(
|
380
381
|
scope,
|
@@ -383,7 +384,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
383
384
|
}
|
384
385
|
const parentBranchId = scope["#ClosestBranchId" /* ClosestBranchId */] || parentBranchIds.get(scopeId);
|
385
386
|
if (parentBranchId) {
|
386
|
-
scope.___closestBranch =
|
387
|
+
scope.___closestBranch = scopeLookup[parentBranchId];
|
387
388
|
}
|
388
389
|
if (branchIds.has(scopeId)) {
|
389
390
|
const branch = scope;
|
package/dist/debug/dom.mjs
CHANGED
@@ -189,6 +189,8 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
189
189
|
const branchIds = /* @__PURE__ */ new Set();
|
190
190
|
const parentBranchIds = /* @__PURE__ */ new Map();
|
191
191
|
let currentBranchId;
|
192
|
+
let $global;
|
193
|
+
let lastScopeId = 0;
|
192
194
|
render.w = () => {
|
193
195
|
walk2.call(render);
|
194
196
|
const visits = render.v;
|
@@ -215,12 +217,12 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
215
217
|
for (const visit of visitNodes) {
|
216
218
|
const commentText = visit.data;
|
217
219
|
const dataIndex = commentText.indexOf(" ") + 1;
|
218
|
-
const scopeId = commentText.slice(
|
220
|
+
const scopeId = +commentText.slice(
|
219
221
|
commentPrefixLen + 1,
|
220
222
|
dataIndex ? dataIndex - 1 : commentText.length
|
221
223
|
);
|
222
224
|
const scope = scopeLookup[scopeId] ||= {
|
223
|
-
___id:
|
225
|
+
___id: scopeId
|
224
226
|
};
|
225
227
|
const data2 = dataIndex ? commentText.slice(dataIndex) : "";
|
226
228
|
const token = commentText[commentPrefixLen];
|
@@ -256,7 +258,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
256
258
|
while (~next) {
|
257
259
|
const start = next + 1;
|
258
260
|
next = data2.indexOf(" ", start);
|
259
|
-
const childScopeId = data2.slice(
|
261
|
+
const childScopeId = +data2.slice(
|
260
262
|
start,
|
261
263
|
~next ? next : data2.length
|
262
264
|
);
|
@@ -273,20 +275,19 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
273
275
|
for (let i = 0; i < resumes.length; i++) {
|
274
276
|
const serialized = resumes[i];
|
275
277
|
if (typeof serialized === "function") {
|
276
|
-
const
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
const scope = scopes[scopeId];
|
278
|
+
for (const scope of serialized(serializeContext)) {
|
279
|
+
if (!$global) {
|
280
|
+
$global = scope || {};
|
281
|
+
$global.runtimeId = runtimeId;
|
282
|
+
$global.renderId = renderId;
|
283
|
+
$global.___nextScopeId = 1e6;
|
284
|
+
} else if (typeof scope === "number") {
|
285
|
+
lastScopeId += scope;
|
286
|
+
} else {
|
287
|
+
const scopeId = ++lastScopeId;
|
287
288
|
const prevScope = scopeLookup[scopeId];
|
288
289
|
scope.$global = $global;
|
289
|
-
scope.___id =
|
290
|
+
scope.___id = scopeId;
|
290
291
|
if (prevScope !== scope) {
|
291
292
|
scopeLookup[scopeId] = Object.assign(
|
292
293
|
scope,
|
@@ -295,7 +296,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
295
296
|
}
|
296
297
|
const parentBranchId = scope["#ClosestBranchId" /* ClosestBranchId */] || parentBranchIds.get(scopeId);
|
297
298
|
if (parentBranchId) {
|
298
|
-
scope.___closestBranch =
|
299
|
+
scope.___closestBranch = scopeLookup[parentBranchId];
|
299
300
|
}
|
300
301
|
if (branchIds.has(scopeId)) {
|
301
302
|
const branch = scope;
|
package/dist/debug/html.js
CHANGED
@@ -1891,14 +1891,8 @@ var writeScope = (scopeId, partialScope) => {
|
|
1891
1891
|
}
|
1892
1892
|
if (state.writeScopes) {
|
1893
1893
|
state.writeScopes[scopeId] = scope;
|
1894
|
-
} else if (state.hasGlobals) {
|
1895
|
-
state.writeScopes = { [scopeId]: scope };
|
1896
1894
|
} else {
|
1897
|
-
state.
|
1898
|
-
state.writeScopes = {
|
1899
|
-
$: getFilteredGlobals(state.$global),
|
1900
|
-
[scopeId]: scope
|
1901
|
-
};
|
1895
|
+
state.writeScopes = { [scopeId]: scope };
|
1902
1896
|
}
|
1903
1897
|
return scope;
|
1904
1898
|
};
|
@@ -2099,6 +2093,7 @@ var State2 = class {
|
|
2099
2093
|
tagId = 1;
|
2100
2094
|
scopeId = 1;
|
2101
2095
|
reorderId = 1;
|
2096
|
+
lastSerializedScopeId = this.scopeId;
|
2102
2097
|
hasGlobals = false;
|
2103
2098
|
needsMainRuntime = false;
|
2104
2099
|
hasMainRuntime = false;
|
@@ -2292,8 +2287,23 @@ function prepareChunk(chunk) {
|
|
2292
2287
|
}
|
2293
2288
|
let resumes = "";
|
2294
2289
|
if (state.writeScopes || serializer.flushed) {
|
2295
|
-
|
2290
|
+
let { lastSerializedScopeId } = state;
|
2291
|
+
const serializeData = [];
|
2292
|
+
if (!state.hasGlobals) {
|
2293
|
+
state.hasGlobals = true;
|
2294
|
+
serializeData.push(getFilteredGlobals(state.$global));
|
2295
|
+
}
|
2296
|
+
for (const key in state.writeScopes) {
|
2297
|
+
const scope = state.writeScopes[key];
|
2298
|
+
const scopeId = getScopeId(scope);
|
2299
|
+
const scopeIdDelta = scopeId - lastSerializedScopeId;
|
2300
|
+
lastSerializedScopeId = scopeId + 1;
|
2301
|
+
if (scopeIdDelta) serializeData.push(scopeIdDelta);
|
2302
|
+
serializeData.push(scope);
|
2303
|
+
}
|
2304
|
+
resumes = state.serializer.stringify(serializeData, boundary);
|
2296
2305
|
state.writeScopes = null;
|
2306
|
+
state.lastSerializedScopeId = lastSerializedScopeId;
|
2297
2307
|
}
|
2298
2308
|
if (effects) {
|
2299
2309
|
hasWalk = true;
|
@@ -2432,10 +2442,10 @@ function isPromise(value) {
|
|
2432
2442
|
return value != null && typeof value.then === "function";
|
2433
2443
|
}
|
2434
2444
|
function getFilteredGlobals($global2) {
|
2435
|
-
if (!$global2) return
|
2445
|
+
if (!$global2) return 0;
|
2436
2446
|
const serializedGlobals = $global2.serializedGlobals;
|
2437
|
-
if (!serializedGlobals) return
|
2438
|
-
let filtered;
|
2447
|
+
if (!serializedGlobals) return 0;
|
2448
|
+
let filtered = 0;
|
2439
2449
|
if (Array.isArray(serializedGlobals)) {
|
2440
2450
|
for (const key of serializedGlobals) {
|
2441
2451
|
const value = $global2[key];
|
package/dist/debug/html.mjs
CHANGED
@@ -1807,14 +1807,8 @@ var writeScope = (scopeId, partialScope) => {
|
|
1807
1807
|
}
|
1808
1808
|
if (state.writeScopes) {
|
1809
1809
|
state.writeScopes[scopeId] = scope;
|
1810
|
-
} else if (state.hasGlobals) {
|
1811
|
-
state.writeScopes = { [scopeId]: scope };
|
1812
1810
|
} else {
|
1813
|
-
state.
|
1814
|
-
state.writeScopes = {
|
1815
|
-
$: getFilteredGlobals(state.$global),
|
1816
|
-
[scopeId]: scope
|
1817
|
-
};
|
1811
|
+
state.writeScopes = { [scopeId]: scope };
|
1818
1812
|
}
|
1819
1813
|
return scope;
|
1820
1814
|
};
|
@@ -2015,6 +2009,7 @@ var State2 = class {
|
|
2015
2009
|
tagId = 1;
|
2016
2010
|
scopeId = 1;
|
2017
2011
|
reorderId = 1;
|
2012
|
+
lastSerializedScopeId = this.scopeId;
|
2018
2013
|
hasGlobals = false;
|
2019
2014
|
needsMainRuntime = false;
|
2020
2015
|
hasMainRuntime = false;
|
@@ -2208,8 +2203,23 @@ function prepareChunk(chunk) {
|
|
2208
2203
|
}
|
2209
2204
|
let resumes = "";
|
2210
2205
|
if (state.writeScopes || serializer.flushed) {
|
2211
|
-
|
2206
|
+
let { lastSerializedScopeId } = state;
|
2207
|
+
const serializeData = [];
|
2208
|
+
if (!state.hasGlobals) {
|
2209
|
+
state.hasGlobals = true;
|
2210
|
+
serializeData.push(getFilteredGlobals(state.$global));
|
2211
|
+
}
|
2212
|
+
for (const key in state.writeScopes) {
|
2213
|
+
const scope = state.writeScopes[key];
|
2214
|
+
const scopeId = getScopeId(scope);
|
2215
|
+
const scopeIdDelta = scopeId - lastSerializedScopeId;
|
2216
|
+
lastSerializedScopeId = scopeId + 1;
|
2217
|
+
if (scopeIdDelta) serializeData.push(scopeIdDelta);
|
2218
|
+
serializeData.push(scope);
|
2219
|
+
}
|
2220
|
+
resumes = state.serializer.stringify(serializeData, boundary);
|
2212
2221
|
state.writeScopes = null;
|
2222
|
+
state.lastSerializedScopeId = lastSerializedScopeId;
|
2213
2223
|
}
|
2214
2224
|
if (effects) {
|
2215
2225
|
hasWalk = true;
|
@@ -2348,10 +2358,10 @@ function isPromise(value) {
|
|
2348
2358
|
return value != null && typeof value.then === "function";
|
2349
2359
|
}
|
2350
2360
|
function getFilteredGlobals($global2) {
|
2351
|
-
if (!$global2) return
|
2361
|
+
if (!$global2) return 0;
|
2352
2362
|
const serializedGlobals = $global2.serializedGlobals;
|
2353
|
-
if (!serializedGlobals) return
|
2354
|
-
let filtered;
|
2363
|
+
if (!serializedGlobals) return 0;
|
2364
|
+
let filtered = 0;
|
2355
2365
|
if (Array.isArray(serializedGlobals)) {
|
2356
2366
|
for (const key of serializedGlobals) {
|
2357
2367
|
const value = $global2[key];
|
package/dist/dom.js
CHANGED
@@ -213,7 +213,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
213
213
|
value: resumeRender = (renderId) => {
|
214
214
|
let render = resumeRender[renderId] = renders2[renderId] || renders2(renderId), walk2 = render.w, commentPrefixLen = render.i.length, branchStack = [], scopeLookup = render.s = {}, serializeContext = {
|
215
215
|
_: registeredValues
|
216
|
-
}, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map(), currentBranchId;
|
216
|
+
}, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map(), currentBranchId, $global, lastScopeId = 0;
|
217
217
|
return render.w = () => {
|
218
218
|
walk2.call(render);
|
219
219
|
let visits = render.v, resumes = render.r;
|
@@ -229,11 +229,11 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
229
229
|
)), branch.j = lastEndNode = endNode, branch.h ||= endNode, branchIds.add(branchId), branch;
|
230
230
|
};
|
231
231
|
for (let visit of visitNodes) {
|
232
|
-
let commentText = visit.data, dataIndex = commentText.indexOf(" ") + 1, scopeId = commentText.slice(
|
232
|
+
let commentText = visit.data, dataIndex = commentText.indexOf(" ") + 1, scopeId = +commentText.slice(
|
233
233
|
commentPrefixLen + 1,
|
234
234
|
dataIndex ? dataIndex - 1 : commentText.length
|
235
235
|
), scope = scopeLookup[scopeId] ||= {
|
236
|
-
m:
|
236
|
+
m: scopeId
|
237
237
|
}, data2 = dataIndex ? commentText.slice(dataIndex) : "", token = commentText[commentPrefixLen];
|
238
238
|
if (token === "*" /* Node */) {
|
239
239
|
let node = scope[data2] = visit.previousSibling;
|
@@ -252,7 +252,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
252
252
|
for (scope[~next ? data2.slice(0, next) : data2] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit; ~next; ) {
|
253
253
|
let start = next + 1;
|
254
254
|
next = data2.indexOf(" ", start);
|
255
|
-
let childScopeId = data2.slice(
|
255
|
+
let childScopeId = +data2.slice(
|
256
256
|
start,
|
257
257
|
~next ? next : data2.length
|
258
258
|
);
|
@@ -266,25 +266,27 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
266
266
|
render.r = [], isResuming = !0;
|
267
267
|
for (let i = 0; i < resumes.length; i++) {
|
268
268
|
let serialized = resumes[i];
|
269
|
-
if (typeof serialized == "function")
|
270
|
-
let
|
271
|
-
|
272
|
-
|
273
|
-
if (
|
274
|
-
|
275
|
-
|
269
|
+
if (typeof serialized == "function")
|
270
|
+
for (let scope of serialized(serializeContext))
|
271
|
+
if (!$global)
|
272
|
+
$global = scope || {}, $global.runtimeId = runtimeId, $global.renderId = renderId, $global.n = 1e6;
|
273
|
+
else if (typeof scope == "number")
|
274
|
+
lastScopeId += scope;
|
275
|
+
else {
|
276
|
+
let scopeId = ++lastScopeId, prevScope = scopeLookup[scopeId];
|
277
|
+
scope.$global = $global, scope.m = scopeId, prevScope !== scope && (scopeLookup[scopeId] = Object.assign(
|
276
278
|
scope,
|
277
279
|
prevScope
|
278
280
|
));
|
279
281
|
let parentBranchId = scope.g || parentBranchIds.get(scopeId);
|
280
|
-
if (parentBranchId && (scope.k =
|
282
|
+
if (parentBranchId && (scope.k = scopeLookup[parentBranchId]), branchIds.has(scopeId)) {
|
281
283
|
let branch = scope, parentBranch = branch.k;
|
282
284
|
scope.k = branch, parentBranch && (branch.u = parentBranch, (parentBranch.A ||= /* @__PURE__ */ new Set()).add(
|
283
285
|
branch
|
284
286
|
));
|
285
287
|
}
|
286
288
|
}
|
287
|
-
|
289
|
+
else
|
288
290
|
registeredValues[resumes[++i]](
|
289
291
|
scopeLookup[serialized],
|
290
292
|
scopeLookup[serialized]
|
package/dist/dom.mjs
CHANGED
@@ -128,7 +128,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
128
128
|
value: resumeRender = (renderId) => {
|
129
129
|
let render = resumeRender[renderId] = renders2[renderId] || renders2(renderId), walk2 = render.w, commentPrefixLen = render.i.length, branchStack = [], scopeLookup = render.s = {}, serializeContext = {
|
130
130
|
_: registeredValues
|
131
|
-
}, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map(), currentBranchId;
|
131
|
+
}, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map(), currentBranchId, $global, lastScopeId = 0;
|
132
132
|
return render.w = () => {
|
133
133
|
walk2.call(render);
|
134
134
|
let visits = render.v, resumes = render.r;
|
@@ -144,11 +144,11 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
144
144
|
)), branch.j = lastEndNode = endNode, branch.h ||= endNode, branchIds.add(branchId), branch;
|
145
145
|
};
|
146
146
|
for (let visit of visitNodes) {
|
147
|
-
let commentText = visit.data, dataIndex = commentText.indexOf(" ") + 1, scopeId = commentText.slice(
|
147
|
+
let commentText = visit.data, dataIndex = commentText.indexOf(" ") + 1, scopeId = +commentText.slice(
|
148
148
|
commentPrefixLen + 1,
|
149
149
|
dataIndex ? dataIndex - 1 : commentText.length
|
150
150
|
), scope = scopeLookup[scopeId] ||= {
|
151
|
-
m:
|
151
|
+
m: scopeId
|
152
152
|
}, data2 = dataIndex ? commentText.slice(dataIndex) : "", token = commentText[commentPrefixLen];
|
153
153
|
if (token === "*" /* Node */) {
|
154
154
|
let node = scope[data2] = visit.previousSibling;
|
@@ -167,7 +167,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
167
167
|
for (scope[~next ? data2.slice(0, next) : data2] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit; ~next; ) {
|
168
168
|
let start = next + 1;
|
169
169
|
next = data2.indexOf(" ", start);
|
170
|
-
let childScopeId = data2.slice(
|
170
|
+
let childScopeId = +data2.slice(
|
171
171
|
start,
|
172
172
|
~next ? next : data2.length
|
173
173
|
);
|
@@ -181,25 +181,27 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
181
181
|
render.r = [], isResuming = !0;
|
182
182
|
for (let i = 0; i < resumes.length; i++) {
|
183
183
|
let serialized = resumes[i];
|
184
|
-
if (typeof serialized == "function")
|
185
|
-
let
|
186
|
-
|
187
|
-
|
188
|
-
if (
|
189
|
-
|
190
|
-
|
184
|
+
if (typeof serialized == "function")
|
185
|
+
for (let scope of serialized(serializeContext))
|
186
|
+
if (!$global)
|
187
|
+
$global = scope || {}, $global.runtimeId = runtimeId, $global.renderId = renderId, $global.n = 1e6;
|
188
|
+
else if (typeof scope == "number")
|
189
|
+
lastScopeId += scope;
|
190
|
+
else {
|
191
|
+
let scopeId = ++lastScopeId, prevScope = scopeLookup[scopeId];
|
192
|
+
scope.$global = $global, scope.m = scopeId, prevScope !== scope && (scopeLookup[scopeId] = Object.assign(
|
191
193
|
scope,
|
192
194
|
prevScope
|
193
195
|
));
|
194
196
|
let parentBranchId = scope.g || parentBranchIds.get(scopeId);
|
195
|
-
if (parentBranchId && (scope.k =
|
197
|
+
if (parentBranchId && (scope.k = scopeLookup[parentBranchId]), branchIds.has(scopeId)) {
|
196
198
|
let branch = scope, parentBranch = branch.k;
|
197
199
|
scope.k = branch, parentBranch && (branch.u = parentBranch, (parentBranch.A ||= /* @__PURE__ */ new Set()).add(
|
198
200
|
branch
|
199
201
|
));
|
200
202
|
}
|
201
203
|
}
|
202
|
-
|
204
|
+
else
|
203
205
|
registeredValues[resumes[++i]](
|
204
206
|
scopeLookup[serialized],
|
205
207
|
scopeLookup[serialized]
|
package/dist/html/writer.d.ts
CHANGED
@@ -63,6 +63,7 @@ export declare class State {
|
|
63
63
|
tagId: number;
|
64
64
|
scopeId: number;
|
65
65
|
reorderId: number;
|
66
|
+
lastSerializedScopeId: number;
|
66
67
|
hasGlobals: boolean;
|
67
68
|
needsMainRuntime: boolean;
|
68
69
|
hasMainRuntime: boolean;
|
@@ -73,9 +74,7 @@ export declare class State {
|
|
73
74
|
serializer: Serializer;
|
74
75
|
writeReorders: Chunk[] | null;
|
75
76
|
scopes: Map<number, PartialScope>;
|
76
|
-
writeScopes: null |
|
77
|
-
$?: unknown;
|
78
|
-
});
|
77
|
+
writeScopes: null | Record<number, PartialScope>;
|
79
78
|
constructor($global: $Global & {
|
80
79
|
renderId: string;
|
81
80
|
runtimeId: string;
|
package/dist/html.js
CHANGED
@@ -1250,10 +1250,7 @@ function resumeSingleNodeConditional(cb, scopeId, accessor, onlyChild) {
|
|
1250
1250
|
}
|
1251
1251
|
var writeScope = (scopeId, partialScope) => {
|
1252
1252
|
let { state } = $chunk.boundary, { scopes } = state, scope = scopes.get(scopeId);
|
1253
|
-
return state.needsMainRuntime = !0, scope ? Object.assign(scope, partialScope) : (scope = partialScope, scope[K_SCOPE_ID] = scopeId, state.scopes.set(scopeId, scope)), state.writeScopes ? state.writeScopes[scopeId] = scope : state.
|
1254
|
-
$: getFilteredGlobals(state.$global),
|
1255
|
-
[scopeId]: scope
|
1256
|
-
}), scope;
|
1253
|
+
return state.needsMainRuntime = !0, scope ? Object.assign(scope, partialScope) : (scope = partialScope, scope[K_SCOPE_ID] = scopeId, state.scopes.set(scopeId, scope)), state.writeScopes ? state.writeScopes[scopeId] = scope : state.writeScopes = { [scopeId]: scope }, scope;
|
1257
1254
|
};
|
1258
1255
|
function writeExistingScope(scope) {
|
1259
1256
|
return writeScope(scope[K_SCOPE_ID], scope);
|
@@ -1371,6 +1368,7 @@ var State2 = class {
|
|
1371
1368
|
tagId = 1;
|
1372
1369
|
scopeId = 1;
|
1373
1370
|
reorderId = 1;
|
1371
|
+
lastSerializedScopeId = this.scopeId;
|
1374
1372
|
hasGlobals = !1;
|
1375
1373
|
needsMainRuntime = !1;
|
1376
1374
|
hasMainRuntime = !1;
|
@@ -1498,7 +1496,16 @@ function prepareChunk(chunk) {
|
|
1498
1496
|
WALKER_RUNTIME_CODE + '("' + $global2.runtimeId + '")("' + $global2.renderId + '")'
|
1499
1497
|
));
|
1500
1498
|
let resumes = "";
|
1501
|
-
if (
|
1499
|
+
if (state.writeScopes || serializer.flushed) {
|
1500
|
+
let { lastSerializedScopeId } = state, serializeData = [];
|
1501
|
+
state.hasGlobals || (state.hasGlobals = !0, serializeData.push(getFilteredGlobals(state.$global)));
|
1502
|
+
for (let key in state.writeScopes) {
|
1503
|
+
let scope = state.writeScopes[key], scopeId = getScopeId(scope), scopeIdDelta = scopeId - lastSerializedScopeId;
|
1504
|
+
lastSerializedScopeId = scopeId + 1, scopeIdDelta && serializeData.push(scopeIdDelta), serializeData.push(scope);
|
1505
|
+
}
|
1506
|
+
resumes = state.serializer.stringify(serializeData, boundary), state.writeScopes = null, state.lastSerializedScopeId = lastSerializedScopeId;
|
1507
|
+
}
|
1508
|
+
if (effects && (hasWalk = !0, resumes = resumes ? resumes + "," + effects : effects), resumes && (state.hasWrittenResume ? scripts = concatScripts(
|
1502
1509
|
scripts,
|
1503
1510
|
runtimePrefix + ".r.push(" + resumes + ")"
|
1504
1511
|
) : (state.hasWrittenResume = !0, scripts = concatScripts(
|
@@ -1566,10 +1573,10 @@ function isPromise(value) {
|
|
1566
1573
|
return value != null && typeof value.then == "function";
|
1567
1574
|
}
|
1568
1575
|
function getFilteredGlobals($global2) {
|
1569
|
-
if (!$global2) return;
|
1576
|
+
if (!$global2) return 0;
|
1570
1577
|
let serializedGlobals = $global2.serializedGlobals;
|
1571
|
-
if (!serializedGlobals) return;
|
1572
|
-
let filtered;
|
1578
|
+
if (!serializedGlobals) return 0;
|
1579
|
+
let filtered = 0;
|
1573
1580
|
if (Array.isArray(serializedGlobals))
|
1574
1581
|
for (let key of serializedGlobals) {
|
1575
1582
|
let value = $global2[key];
|
package/dist/html.mjs
CHANGED
@@ -1169,10 +1169,7 @@ function resumeSingleNodeConditional(cb, scopeId, accessor, onlyChild) {
|
|
1169
1169
|
}
|
1170
1170
|
var writeScope = (scopeId, partialScope) => {
|
1171
1171
|
let { state } = $chunk.boundary, { scopes } = state, scope = scopes.get(scopeId);
|
1172
|
-
return state.needsMainRuntime = !0, scope ? Object.assign(scope, partialScope) : (scope = partialScope, scope[K_SCOPE_ID] = scopeId, state.scopes.set(scopeId, scope)), state.writeScopes ? state.writeScopes[scopeId] = scope : state.
|
1173
|
-
$: getFilteredGlobals(state.$global),
|
1174
|
-
[scopeId]: scope
|
1175
|
-
}), scope;
|
1172
|
+
return state.needsMainRuntime = !0, scope ? Object.assign(scope, partialScope) : (scope = partialScope, scope[K_SCOPE_ID] = scopeId, state.scopes.set(scopeId, scope)), state.writeScopes ? state.writeScopes[scopeId] = scope : state.writeScopes = { [scopeId]: scope }, scope;
|
1176
1173
|
};
|
1177
1174
|
function writeExistingScope(scope) {
|
1178
1175
|
return writeScope(scope[K_SCOPE_ID], scope);
|
@@ -1290,6 +1287,7 @@ var State2 = class {
|
|
1290
1287
|
tagId = 1;
|
1291
1288
|
scopeId = 1;
|
1292
1289
|
reorderId = 1;
|
1290
|
+
lastSerializedScopeId = this.scopeId;
|
1293
1291
|
hasGlobals = !1;
|
1294
1292
|
needsMainRuntime = !1;
|
1295
1293
|
hasMainRuntime = !1;
|
@@ -1417,7 +1415,16 @@ function prepareChunk(chunk) {
|
|
1417
1415
|
WALKER_RUNTIME_CODE + '("' + $global2.runtimeId + '")("' + $global2.renderId + '")'
|
1418
1416
|
));
|
1419
1417
|
let resumes = "";
|
1420
|
-
if (
|
1418
|
+
if (state.writeScopes || serializer.flushed) {
|
1419
|
+
let { lastSerializedScopeId } = state, serializeData = [];
|
1420
|
+
state.hasGlobals || (state.hasGlobals = !0, serializeData.push(getFilteredGlobals(state.$global)));
|
1421
|
+
for (let key in state.writeScopes) {
|
1422
|
+
let scope = state.writeScopes[key], scopeId = getScopeId(scope), scopeIdDelta = scopeId - lastSerializedScopeId;
|
1423
|
+
lastSerializedScopeId = scopeId + 1, scopeIdDelta && serializeData.push(scopeIdDelta), serializeData.push(scope);
|
1424
|
+
}
|
1425
|
+
resumes = state.serializer.stringify(serializeData, boundary), state.writeScopes = null, state.lastSerializedScopeId = lastSerializedScopeId;
|
1426
|
+
}
|
1427
|
+
if (effects && (hasWalk = !0, resumes = resumes ? resumes + "," + effects : effects), resumes && (state.hasWrittenResume ? scripts = concatScripts(
|
1421
1428
|
scripts,
|
1422
1429
|
runtimePrefix + ".r.push(" + resumes + ")"
|
1423
1430
|
) : (state.hasWrittenResume = !0, scripts = concatScripts(
|
@@ -1485,10 +1492,10 @@ function isPromise(value) {
|
|
1485
1492
|
return value != null && typeof value.then == "function";
|
1486
1493
|
}
|
1487
1494
|
function getFilteredGlobals($global2) {
|
1488
|
-
if (!$global2) return;
|
1495
|
+
if (!$global2) return 0;
|
1489
1496
|
let serializedGlobals = $global2.serializedGlobals;
|
1490
|
-
if (!serializedGlobals) return;
|
1491
|
-
let filtered;
|
1497
|
+
if (!serializedGlobals) return 0;
|
1498
|
+
let filtered = 0;
|
1492
1499
|
if (Array.isArray(serializedGlobals))
|
1493
1500
|
for (let key of serializedGlobals) {
|
1494
1501
|
let value = $global2[key];
|