marko 6.0.52 → 6.0.53
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 +14 -22
- package/dist/debug/html.mjs +14 -22
- package/dist/html/compat.d.ts +3 -2
- package/dist/html.js +7 -13
- package/dist/html.mjs +7 -13
- package/dist/translator/index.js +60 -47
- package/dist/translator/util/walks.d.ts +1 -1
- package/package.json +1 -1
package/dist/debug/html.js
CHANGED
@@ -3262,6 +3262,15 @@ var compat = {
|
|
3262
3262
|
nextScopeId,
|
3263
3263
|
peekNextScopeId,
|
3264
3264
|
isInResumedBranch,
|
3265
|
+
ensureState($global2) {
|
3266
|
+
let state = $global2[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
3267
|
+
if (!state) {
|
3268
|
+
$global2.runtimeId ||= DEFAULT_RUNTIME_ID;
|
3269
|
+
$global2.renderId ||= $global2.componentIdPrefix || $global2.widgetIdPrefix || DEFAULT_RENDER_ID;
|
3270
|
+
$global2[K_TAGS_API_STATE] = state = new State2($global2);
|
3271
|
+
}
|
3272
|
+
return state;
|
3273
|
+
},
|
3265
3274
|
isTagsAPI(fn) {
|
3266
3275
|
return !!fn.___id;
|
3267
3276
|
},
|
@@ -3294,15 +3303,8 @@ var compat = {
|
|
3294
3303
|
}
|
3295
3304
|
return compatRegistered;
|
3296
3305
|
},
|
3297
|
-
render(renderer, willRerender, classAPIOut, component, input,
|
3298
|
-
const
|
3299
|
-
let state = $global2[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
3300
|
-
if (!state) {
|
3301
|
-
$global2.runtimeId ||= DEFAULT_RUNTIME_ID;
|
3302
|
-
$global2.renderId ||= $global2.componentIdPrefix || $global2.widgetIdPrefix || DEFAULT_RENDER_ID;
|
3303
|
-
$global2[K_TAGS_API_STATE] = state = new State2($global2);
|
3304
|
-
}
|
3305
|
-
const boundary = new Boundary(state);
|
3306
|
+
render(renderer, willRerender, classAPIOut, component, input, completeChunks) {
|
3307
|
+
const boundary = new Boundary(this.ensureState(classAPIOut.global));
|
3306
3308
|
let head = new Chunk(
|
3307
3309
|
boundary,
|
3308
3310
|
null,
|
@@ -3332,21 +3334,11 @@ var compat = {
|
|
3332
3334
|
asyncOut.error(boundary.signal.reason);
|
3333
3335
|
boundary.onNext = NOOP3;
|
3334
3336
|
} else if (!boundary.count) {
|
3335
|
-
|
3336
|
-
if (boundary.done) {
|
3337
|
-
const { html, scripts } = head.flushScript();
|
3338
|
-
writer.script(scripts);
|
3339
|
-
writer.write(html);
|
3340
|
-
} else {
|
3341
|
-
asyncOut.error(
|
3342
|
-
new Error("Cannot serialize promises with class/tags interop.")
|
3343
|
-
);
|
3344
|
-
}
|
3345
|
-
});
|
3346
|
-
head = head.consume();
|
3337
|
+
completeChunks.push(head = head.consume());
|
3347
3338
|
asyncOut.write(head.html);
|
3339
|
+
asyncOut.script(head.scripts);
|
3348
3340
|
asyncOut.end();
|
3349
|
-
head.html = "";
|
3341
|
+
head.html = head.scripts = "";
|
3350
3342
|
}
|
3351
3343
|
})();
|
3352
3344
|
});
|
package/dist/debug/html.mjs
CHANGED
@@ -3178,6 +3178,15 @@ var compat = {
|
|
3178
3178
|
nextScopeId,
|
3179
3179
|
peekNextScopeId,
|
3180
3180
|
isInResumedBranch,
|
3181
|
+
ensureState($global2) {
|
3182
|
+
let state = $global2[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
3183
|
+
if (!state) {
|
3184
|
+
$global2.runtimeId ||= DEFAULT_RUNTIME_ID;
|
3185
|
+
$global2.renderId ||= $global2.componentIdPrefix || $global2.widgetIdPrefix || DEFAULT_RENDER_ID;
|
3186
|
+
$global2[K_TAGS_API_STATE] = state = new State2($global2);
|
3187
|
+
}
|
3188
|
+
return state;
|
3189
|
+
},
|
3181
3190
|
isTagsAPI(fn) {
|
3182
3191
|
return !!fn.___id;
|
3183
3192
|
},
|
@@ -3210,15 +3219,8 @@ var compat = {
|
|
3210
3219
|
}
|
3211
3220
|
return compatRegistered;
|
3212
3221
|
},
|
3213
|
-
render(renderer, willRerender, classAPIOut, component, input,
|
3214
|
-
const
|
3215
|
-
let state = $global2[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
3216
|
-
if (!state) {
|
3217
|
-
$global2.runtimeId ||= DEFAULT_RUNTIME_ID;
|
3218
|
-
$global2.renderId ||= $global2.componentIdPrefix || $global2.widgetIdPrefix || DEFAULT_RENDER_ID;
|
3219
|
-
$global2[K_TAGS_API_STATE] = state = new State2($global2);
|
3220
|
-
}
|
3221
|
-
const boundary = new Boundary(state);
|
3222
|
+
render(renderer, willRerender, classAPIOut, component, input, completeChunks) {
|
3223
|
+
const boundary = new Boundary(this.ensureState(classAPIOut.global));
|
3222
3224
|
let head = new Chunk(
|
3223
3225
|
boundary,
|
3224
3226
|
null,
|
@@ -3248,21 +3250,11 @@ var compat = {
|
|
3248
3250
|
asyncOut.error(boundary.signal.reason);
|
3249
3251
|
boundary.onNext = NOOP3;
|
3250
3252
|
} else if (!boundary.count) {
|
3251
|
-
|
3252
|
-
if (boundary.done) {
|
3253
|
-
const { html, scripts } = head.flushScript();
|
3254
|
-
writer.script(scripts);
|
3255
|
-
writer.write(html);
|
3256
|
-
} else {
|
3257
|
-
asyncOut.error(
|
3258
|
-
new Error("Cannot serialize promises with class/tags interop.")
|
3259
|
-
);
|
3260
|
-
}
|
3261
|
-
});
|
3262
|
-
head = head.consume();
|
3253
|
+
completeChunks.push(head = head.consume());
|
3263
3254
|
asyncOut.write(head.html);
|
3255
|
+
asyncOut.script(head.scripts);
|
3264
3256
|
asyncOut.end();
|
3265
|
-
head.html = "";
|
3257
|
+
head.html = head.scripts = "";
|
3266
3258
|
}
|
3267
3259
|
})();
|
3268
3260
|
});
|
package/dist/html/compat.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { patchDynamicTag } from "./dynamic-tag";
|
2
2
|
import { type ServerRenderer } from "./template";
|
3
|
-
import { $global, Chunk, fork, isInResumedBranch, nextScopeId, peekNextScopeId, write, writeScript } from "./writer";
|
3
|
+
import { $global, Chunk, fork, isInResumedBranch, nextScopeId, peekNextScopeId, State, write, writeScript } from "./writer";
|
4
4
|
export declare const compat: {
|
5
5
|
$global: typeof $global;
|
6
6
|
fork: typeof fork;
|
@@ -9,12 +9,13 @@ export declare const compat: {
|
|
9
9
|
nextScopeId: typeof nextScopeId;
|
10
10
|
peekNextScopeId: typeof peekNextScopeId;
|
11
11
|
isInResumedBranch: typeof isInResumedBranch;
|
12
|
+
ensureState($global: any): State;
|
12
13
|
isTagsAPI(fn: any): boolean;
|
13
14
|
onFlush(fn: (chunk: Chunk) => void): void;
|
14
15
|
patchDynamicTag: typeof patchDynamicTag;
|
15
16
|
writeSetScopeForComponent(branchId: number, m5c: string): void;
|
16
17
|
toJSON(this: WeakKey): [registryId: string, scopeId: unknown] | undefined;
|
17
|
-
render(renderer: ServerRenderer, willRerender: boolean, classAPIOut: any, component: any, input: any,
|
18
|
+
render(renderer: ServerRenderer, willRerender: boolean, classAPIOut: any, component: any, input: any, completeChunks: Chunk[]): void;
|
18
19
|
registerRenderer(renderer: any, id: string): any;
|
19
20
|
registerRenderBody(fn: any): void;
|
20
21
|
};
|
package/dist/html.js
CHANGED
@@ -2097,6 +2097,10 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
2097
2097
|
nextScopeId,
|
2098
2098
|
peekNextScopeId,
|
2099
2099
|
isInResumedBranch,
|
2100
|
+
ensureState($global2) {
|
2101
|
+
let state = $global2[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
2102
|
+
return state || ($global2.runtimeId ||= "M", $global2.renderId ||= $global2.componentIdPrefix || $global2.widgetIdPrefix || "_", $global2[K_TAGS_API_STATE] = state = new State2($global2)), state;
|
2103
|
+
},
|
2100
2104
|
isTagsAPI(fn) {
|
2101
2105
|
return !!fn.h;
|
2102
2106
|
},
|
@@ -2124,10 +2128,8 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
2124
2128
|
}
|
2125
2129
|
return compatRegistered;
|
2126
2130
|
},
|
2127
|
-
render(renderer, willRerender, classAPIOut, component, input,
|
2128
|
-
let
|
2129
|
-
state || ($global2.runtimeId ||= "M", $global2.renderId ||= $global2.componentIdPrefix || $global2.widgetIdPrefix || "_", $global2[K_TAGS_API_STATE] = state = new State2($global2));
|
2130
|
-
let boundary = new Boundary(state), head = new Chunk(
|
2131
|
+
render(renderer, willRerender, classAPIOut, component, input, completeChunks) {
|
2132
|
+
let boundary = new Boundary(this.ensureState(classAPIOut.global)), head = new Chunk(
|
2131
2133
|
boundary,
|
2132
2134
|
null,
|
2133
2135
|
null
|
@@ -2145,15 +2147,7 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
2145
2147
|
isTemplate(renderer) && willRerender ? renderer(normalizedInput, 1) : renderer(normalizedInput);
|
2146
2148
|
let asyncOut = classAPIOut.beginAsync();
|
2147
2149
|
(boundary.onNext = () => {
|
2148
|
-
boundary.signal.aborted ? (asyncOut.error(boundary.signal.reason), boundary.onNext = NOOP3) : boundary.count || (asyncOut.
|
2149
|
-
if (boundary.done) {
|
2150
|
-
let { html, scripts } = head.flushScript();
|
2151
|
-
writer.script(scripts), writer.write(html);
|
2152
|
-
} else
|
2153
|
-
asyncOut.error(
|
2154
|
-
new Error("Cannot serialize promises with class/tags interop.")
|
2155
|
-
);
|
2156
|
-
}), head = head.consume(), asyncOut.write(head.html), asyncOut.end(), head.html = "");
|
2150
|
+
boundary.signal.aborted ? (asyncOut.error(boundary.signal.reason), boundary.onNext = NOOP3) : boundary.count || (completeChunks.push(head = head.consume()), asyncOut.write(head.html), asyncOut.script(head.scripts), asyncOut.end(), head.html = head.scripts = "");
|
2157
2151
|
})();
|
2158
2152
|
});
|
2159
2153
|
},
|
package/dist/html.mjs
CHANGED
@@ -2016,6 +2016,10 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
2016
2016
|
nextScopeId,
|
2017
2017
|
peekNextScopeId,
|
2018
2018
|
isInResumedBranch,
|
2019
|
+
ensureState($global2) {
|
2020
|
+
let state = $global2[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
2021
|
+
return state || ($global2.runtimeId ||= "M", $global2.renderId ||= $global2.componentIdPrefix || $global2.widgetIdPrefix || "_", $global2[K_TAGS_API_STATE] = state = new State2($global2)), state;
|
2022
|
+
},
|
2019
2023
|
isTagsAPI(fn) {
|
2020
2024
|
return !!fn.h;
|
2021
2025
|
},
|
@@ -2043,10 +2047,8 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
2043
2047
|
}
|
2044
2048
|
return compatRegistered;
|
2045
2049
|
},
|
2046
|
-
render(renderer, willRerender, classAPIOut, component, input,
|
2047
|
-
let
|
2048
|
-
state || ($global2.runtimeId ||= "M", $global2.renderId ||= $global2.componentIdPrefix || $global2.widgetIdPrefix || "_", $global2[K_TAGS_API_STATE] = state = new State2($global2));
|
2049
|
-
let boundary = new Boundary(state), head = new Chunk(
|
2050
|
+
render(renderer, willRerender, classAPIOut, component, input, completeChunks) {
|
2051
|
+
let boundary = new Boundary(this.ensureState(classAPIOut.global)), head = new Chunk(
|
2050
2052
|
boundary,
|
2051
2053
|
null,
|
2052
2054
|
null
|
@@ -2064,15 +2066,7 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
2064
2066
|
isTemplate(renderer) && willRerender ? renderer(normalizedInput, 1) : renderer(normalizedInput);
|
2065
2067
|
let asyncOut = classAPIOut.beginAsync();
|
2066
2068
|
(boundary.onNext = () => {
|
2067
|
-
boundary.signal.aborted ? (asyncOut.error(boundary.signal.reason), boundary.onNext = NOOP3) : boundary.count || (asyncOut.
|
2068
|
-
if (boundary.done) {
|
2069
|
-
let { html, scripts } = head.flushScript();
|
2070
|
-
writer.script(scripts), writer.write(html);
|
2071
|
-
} else
|
2072
|
-
asyncOut.error(
|
2073
|
-
new Error("Cannot serialize promises with class/tags interop.")
|
2074
|
-
);
|
2075
|
-
}), head = head.consume(), asyncOut.write(head.html), asyncOut.end(), head.html = "");
|
2069
|
+
boundary.signal.aborted ? (asyncOut.error(boundary.signal.reason), boundary.onNext = NOOP3) : boundary.count || (completeChunks.push(head = head.consume()), asyncOut.write(head.html), asyncOut.script(head.scripts), asyncOut.end(), head.html = head.scripts = "");
|
2076
2070
|
})();
|
2077
2071
|
});
|
2078
2072
|
},
|
package/dist/translator/index.js
CHANGED
@@ -2673,7 +2673,12 @@ var [getWalkComment] = createSectionState(
|
|
2673
2673
|
"walkComment",
|
2674
2674
|
() => []
|
2675
2675
|
);
|
2676
|
-
var [getSteps] = createSectionState("steps", () =>
|
2676
|
+
var [getSteps] = createSectionState("steps", (section) => {
|
2677
|
+
if (section.content?.startType === 1 /* Dynamic */) {
|
2678
|
+
return [0 /* Enter */, 1 /* Exit */];
|
2679
|
+
}
|
2680
|
+
return [];
|
2681
|
+
});
|
2677
2682
|
var walkCodeToName = {
|
2678
2683
|
[32 /* Get */]: "get",
|
2679
2684
|
[36 /* Inside */]: "inside",
|
@@ -2692,17 +2697,23 @@ var walkCodeToName = {
|
|
2692
2697
|
[126 /* MultiplierEnd */]: "multiplierEnd"
|
2693
2698
|
};
|
2694
2699
|
function enter2(path5) {
|
2695
|
-
getSteps(getSection(path5))
|
2700
|
+
const steps = getSteps(getSection(path5));
|
2701
|
+
steps.push(0 /* Enter */);
|
2696
2702
|
}
|
2697
2703
|
function exit2(path5) {
|
2698
|
-
getSteps(getSection(path5))
|
2704
|
+
const steps = getSteps(getSection(path5));
|
2705
|
+
steps.push(1 /* Exit */);
|
2699
2706
|
}
|
2700
2707
|
function enterShallow(path5) {
|
2701
|
-
|
2708
|
+
const section = getSection(path5);
|
2709
|
+
const steps = getSteps(section);
|
2710
|
+
steps.push(0 /* Enter */, 1 /* Exit */);
|
2702
2711
|
}
|
2703
2712
|
function injectWalks(tag, expr) {
|
2704
|
-
const
|
2705
|
-
const
|
2713
|
+
const section = getSection(tag);
|
2714
|
+
const walks = getWalks(section);
|
2715
|
+
const walkComment = getWalkComment(section);
|
2716
|
+
visitInternal(section);
|
2706
2717
|
walkComment.push(
|
2707
2718
|
`${walkCodeToName[tag.node.var ? 48 /* BeginChildWithVar */ : 47 /* BeginChild */]}`,
|
2708
2719
|
expr.name,
|
@@ -2721,52 +2732,54 @@ function visit(path5, code) {
|
|
2721
2732
|
return;
|
2722
2733
|
}
|
2723
2734
|
const section = getSection(path5);
|
2735
|
+
const walks = getWalks(section);
|
2736
|
+
const walkComment = getWalkComment(section);
|
2737
|
+
visitInternal(section);
|
2738
|
+
if (code !== 32 /* Get */) {
|
2739
|
+
writeTo(path5)`<!>`;
|
2740
|
+
}
|
2741
|
+
walkComment.push(`${walkCodeToName[code]}`);
|
2742
|
+
appendLiteral(walks, String.fromCharCode(code));
|
2743
|
+
}
|
2744
|
+
function visitInternal(section) {
|
2724
2745
|
const steps = getSteps(section);
|
2746
|
+
if (!steps.length) return;
|
2725
2747
|
const walks = getWalks(section);
|
2726
2748
|
const walkComment = getWalkComment(section);
|
2749
|
+
const walkCodes = [];
|
2727
2750
|
let walkString = "";
|
2728
|
-
|
2729
|
-
|
2730
|
-
|
2731
|
-
|
2732
|
-
|
2733
|
-
|
2734
|
-
|
2735
|
-
|
2736
|
-
|
2737
|
-
|
2738
|
-
walkCodes.length = walkCodes.lastIndexOf(67 /* Next */);
|
2739
|
-
walkCodes.push(97 /* Over */);
|
2740
|
-
} else {
|
2741
|
-
walkCodes.length = walkCodes.lastIndexOf(107 /* Out */) + 1;
|
2742
|
-
walkCodes.push(107 /* Out */);
|
2743
|
-
depth = 0;
|
2744
|
-
}
|
2745
|
-
}
|
2746
|
-
}
|
2747
|
-
let current = walkCodes[0];
|
2748
|
-
let count = 0;
|
2749
|
-
for (const walk of walkCodes) {
|
2750
|
-
if (walk !== current) {
|
2751
|
-
walkComment.push(`${walkCodeToName[current]}(${count})`);
|
2752
|
-
walkString += nCodeString(current, count);
|
2753
|
-
current = walk;
|
2754
|
-
count = 1;
|
2751
|
+
let depth = 0;
|
2752
|
+
for (const step of steps) {
|
2753
|
+
if (step === 0 /* Enter */) {
|
2754
|
+
depth++;
|
2755
|
+
walkCodes.push(67 /* Next */);
|
2756
|
+
} else {
|
2757
|
+
depth--;
|
2758
|
+
if (depth >= 0) {
|
2759
|
+
walkCodes.length = walkCodes.lastIndexOf(67 /* Next */);
|
2760
|
+
walkCodes.push(97 /* Over */);
|
2755
2761
|
} else {
|
2756
|
-
|
2762
|
+
walkCodes.length = walkCodes.lastIndexOf(107 /* Out */) + 1;
|
2763
|
+
walkCodes.push(107 /* Out */);
|
2764
|
+
depth = 0;
|
2757
2765
|
}
|
2758
2766
|
}
|
2759
|
-
walkComment.push(`${walkCodeToName[current]}(${count})`);
|
2760
|
-
walkString += nCodeString(current, count);
|
2761
|
-
steps.length = 0;
|
2762
2767
|
}
|
2763
|
-
|
2764
|
-
|
2765
|
-
|
2768
|
+
let current = walkCodes[0];
|
2769
|
+
let count = 0;
|
2770
|
+
for (const walk of walkCodes) {
|
2771
|
+
if (walk !== current) {
|
2772
|
+
walkComment.push(`${walkCodeToName[current]}(${count})`);
|
2773
|
+
walkString += nCodeString(current, count);
|
2774
|
+
current = walk;
|
2775
|
+
count = 1;
|
2776
|
+
} else {
|
2777
|
+
count++;
|
2766
2778
|
}
|
2767
|
-
walkComment.push(`${walkCodeToName[code]}`);
|
2768
|
-
walkString += String.fromCharCode(code);
|
2769
2779
|
}
|
2780
|
+
walkComment.push(`${walkCodeToName[current]}(${count})`);
|
2781
|
+
walkString += nCodeString(current, count);
|
2782
|
+
steps.length = 0;
|
2770
2783
|
appendLiteral(walks, walkString);
|
2771
2784
|
}
|
2772
2785
|
function nCodeString(code, number) {
|
@@ -2796,10 +2809,12 @@ function toCharString(number, startCode, rangeSize) {
|
|
2796
2809
|
return result;
|
2797
2810
|
}
|
2798
2811
|
function getWalkString(section) {
|
2799
|
-
|
2800
|
-
|
2812
|
+
if (section.content?.endType === 1 /* Dynamic */) {
|
2813
|
+
getSteps(section).push(0 /* Enter */, 1 /* Exit */);
|
2814
|
+
}
|
2815
|
+
visitInternal(section);
|
2801
2816
|
const walks = getWalks(section);
|
2802
|
-
const walkLiteral = normalizeStringExpression(
|
2817
|
+
const walkLiteral = normalizeStringExpression(walks);
|
2803
2818
|
if (walkLiteral && walkLiteral.value !== "") {
|
2804
2819
|
withLeadingComment(walkLiteral, getWalkComment(section).join(", "));
|
2805
2820
|
}
|
@@ -4142,7 +4157,6 @@ function getRegisteredFnExpression2(node) {
|
|
4142
4157
|
var dom_default = {
|
4143
4158
|
translate: {
|
4144
4159
|
exit(program) {
|
4145
|
-
visit(program);
|
4146
4160
|
const section = getSectionForBody(program);
|
4147
4161
|
const { walks, writes, setup } = getSectionMeta(section);
|
4148
4162
|
const domExports = program.node.extra.domExports;
|
@@ -10499,7 +10513,6 @@ var custom_tag_default = {
|
|
10499
10513
|
},
|
10500
10514
|
translate: {
|
10501
10515
|
enter(tag) {
|
10502
|
-
visit(tag);
|
10503
10516
|
if (isOutputHTML()) {
|
10504
10517
|
flushBefore(tag);
|
10505
10518
|
}
|
@@ -10,6 +10,6 @@ export declare function enter(path: t.NodePath<any>): void;
|
|
10
10
|
export declare function exit(path: t.NodePath<any>): void;
|
11
11
|
export declare function enterShallow(path: t.NodePath<any>): void;
|
12
12
|
export declare function injectWalks(tag: t.NodePath<t.MarkoTag>, expr: t.Expression): void;
|
13
|
-
export declare function visit(path: t.NodePath<t.MarkoTag | t.MarkoPlaceholder | t.Program>, code
|
13
|
+
export declare function visit(path: t.NodePath<t.MarkoTag | t.MarkoPlaceholder | t.Program>, code: VisitCodes): void;
|
14
14
|
export declare function getWalkString(section: Section): t.Expression | undefined;
|
15
15
|
export {};
|