marko 6.0.85 → 6.0.86
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 +3 -3
- package/dist/debug/html.mjs +2 -2
- package/dist/html/writer.d.ts +1 -1
- package/dist/html.d.ts +1 -1
- package/dist/html.js +3 -3
- package/dist/html.mjs +2 -2
- package/dist/translator/index.js +118 -89
- package/dist/translator/util/serialize-guard.d.ts +4 -3
- package/package.json +1 -1
package/dist/debug/html.js
CHANGED
|
@@ -52,7 +52,6 @@ __export(html_exports, {
|
|
|
52
52
|
_for_of: () => _for_of,
|
|
53
53
|
_for_to: () => _for_to,
|
|
54
54
|
_for_until: () => _for_until,
|
|
55
|
-
_get_serialize_reason: () => _get_serialize_reason,
|
|
56
55
|
_hoist: () => _hoist,
|
|
57
56
|
_html: () => _html,
|
|
58
57
|
_id: () => _id,
|
|
@@ -62,6 +61,7 @@ __export(html_exports, {
|
|
|
62
61
|
_resume_branch: () => _resume_branch,
|
|
63
62
|
_scope: () => writeScope,
|
|
64
63
|
_scope_id: () => _scope_id,
|
|
64
|
+
_scope_reason: () => _scope_reason,
|
|
65
65
|
_scope_with_id: () => _scope_with_id,
|
|
66
66
|
_script: () => _script,
|
|
67
67
|
_sep: () => _sep,
|
|
@@ -1804,7 +1804,7 @@ function getScopeById(scopeId) {
|
|
|
1804
1804
|
function _set_serialize_reason(reason) {
|
|
1805
1805
|
$chunk.boundary.state.serializeReason = reason;
|
|
1806
1806
|
}
|
|
1807
|
-
function
|
|
1807
|
+
function _scope_reason() {
|
|
1808
1808
|
const reason = $chunk.boundary.state.serializeReason;
|
|
1809
1809
|
$chunk.boundary.state.serializeReason = void 0;
|
|
1810
1810
|
return reason;
|
|
@@ -3480,7 +3480,6 @@ function NOOP3() {
|
|
|
3480
3480
|
_for_of,
|
|
3481
3481
|
_for_to,
|
|
3482
3482
|
_for_until,
|
|
3483
|
-
_get_serialize_reason,
|
|
3484
3483
|
_hoist,
|
|
3485
3484
|
_html,
|
|
3486
3485
|
_id,
|
|
@@ -3490,6 +3489,7 @@ function NOOP3() {
|
|
|
3490
3489
|
_resume_branch,
|
|
3491
3490
|
_scope,
|
|
3492
3491
|
_scope_id,
|
|
3492
|
+
_scope_reason,
|
|
3493
3493
|
_scope_with_id,
|
|
3494
3494
|
_script,
|
|
3495
3495
|
_sep,
|
package/dist/debug/html.mjs
CHANGED
|
@@ -1715,7 +1715,7 @@ function getScopeById(scopeId) {
|
|
|
1715
1715
|
function _set_serialize_reason(reason) {
|
|
1716
1716
|
$chunk.boundary.state.serializeReason = reason;
|
|
1717
1717
|
}
|
|
1718
|
-
function
|
|
1718
|
+
function _scope_reason() {
|
|
1719
1719
|
const reason = $chunk.boundary.state.serializeReason;
|
|
1720
1720
|
$chunk.boundary.state.serializeReason = void 0;
|
|
1721
1721
|
return reason;
|
|
@@ -3390,7 +3390,6 @@ export {
|
|
|
3390
3390
|
_for_of,
|
|
3391
3391
|
_for_to,
|
|
3392
3392
|
_for_until,
|
|
3393
|
-
_get_serialize_reason,
|
|
3394
3393
|
_hoist,
|
|
3395
3394
|
_html,
|
|
3396
3395
|
_id,
|
|
@@ -3400,6 +3399,7 @@ export {
|
|
|
3400
3399
|
_resume_branch,
|
|
3401
3400
|
writeScope as _scope,
|
|
3402
3401
|
_scope_id,
|
|
3402
|
+
_scope_reason,
|
|
3403
3403
|
_scope_with_id,
|
|
3404
3404
|
_script,
|
|
3405
3405
|
_sep,
|
package/dist/html/writer.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export declare function _scope_id(): number;
|
|
|
28
28
|
export declare function _peek_scope_id(): number;
|
|
29
29
|
export declare function getScopeById(scopeId: number | undefined): PartialScope | undefined;
|
|
30
30
|
export declare function _set_serialize_reason(reason: undefined | 0 | 1): void;
|
|
31
|
-
export declare function
|
|
31
|
+
export declare function _scope_reason(): 0 | 1 | undefined;
|
|
32
32
|
export declare function _serialize_if(condition: undefined | 1 | Record<string, 1>, key: string): 1 | undefined;
|
|
33
33
|
export declare function _serialize_guard(condition: undefined | 1 | Record<string, 1>, key: string): 0 | 1;
|
|
34
34
|
export declare function _el_resume(scopeId: number, accessor: Accessor, shouldResume?: 0 | 1): string;
|
package/dist/html.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ export { _escape, _escape_script, _escape_style, _escape_textarea_value, _unesca
|
|
|
5
5
|
export { _content, _content_resume, _dynamic_tag } from "./html/dynamic-tag";
|
|
6
6
|
export { forIn, forInBy, forOf, forOfBy, forStepBy, forTo, forUntil, } from "./html/for";
|
|
7
7
|
export { _template } from "./html/template";
|
|
8
|
-
export { _attr_content, _await, _el, _el_resume, _existing_scope, _for_in, _for_of, _for_to, _for_until,
|
|
8
|
+
export { _attr_content, _await, _el, _el_resume, _existing_scope, _for_in, _for_of, _for_to, _for_until, _hoist, _html, _id, _if, _peek_scope_id, _resume, _resume_branch, _scope, _scope_id, _scope_reason, _scope_with_id, _script, _sep, _serialize_guard, _serialize_if, _set_serialize_reason, _subscribe, _trailers, _try, _var, $global, } from "./html/writer";
|
package/dist/html.js
CHANGED
|
@@ -49,7 +49,6 @@ __export(html_exports, {
|
|
|
49
49
|
_for_of: () => _for_of,
|
|
50
50
|
_for_to: () => _for_to,
|
|
51
51
|
_for_until: () => _for_until,
|
|
52
|
-
_get_serialize_reason: () => _get_serialize_reason,
|
|
53
52
|
_hoist: () => _hoist,
|
|
54
53
|
_html: () => _html,
|
|
55
54
|
_id: () => _id,
|
|
@@ -59,6 +58,7 @@ __export(html_exports, {
|
|
|
59
58
|
_resume_branch: () => _resume_branch,
|
|
60
59
|
_scope: () => writeScope,
|
|
61
60
|
_scope_id: () => _scope_id,
|
|
61
|
+
_scope_reason: () => _scope_reason,
|
|
62
62
|
_scope_with_id: () => _scope_with_id,
|
|
63
63
|
_script: () => _script,
|
|
64
64
|
_sep: () => _sep,
|
|
@@ -1173,7 +1173,7 @@ function getScopeById(scopeId) {
|
|
|
1173
1173
|
function _set_serialize_reason(reason) {
|
|
1174
1174
|
$chunk.boundary.state.serializeReason = reason;
|
|
1175
1175
|
}
|
|
1176
|
-
function
|
|
1176
|
+
function _scope_reason() {
|
|
1177
1177
|
let reason = $chunk.boundary.state.serializeReason;
|
|
1178
1178
|
return $chunk.boundary.state.serializeReason = void 0, reason;
|
|
1179
1179
|
}
|
|
@@ -2275,7 +2275,6 @@ function NOOP3() {
|
|
|
2275
2275
|
_for_of,
|
|
2276
2276
|
_for_to,
|
|
2277
2277
|
_for_until,
|
|
2278
|
-
_get_serialize_reason,
|
|
2279
2278
|
_hoist,
|
|
2280
2279
|
_html,
|
|
2281
2280
|
_id,
|
|
@@ -2285,6 +2284,7 @@ function NOOP3() {
|
|
|
2285
2284
|
_resume_branch,
|
|
2286
2285
|
_scope,
|
|
2287
2286
|
_scope_id,
|
|
2287
|
+
_scope_reason,
|
|
2288
2288
|
_scope_with_id,
|
|
2289
2289
|
_script,
|
|
2290
2290
|
_sep,
|
package/dist/html.mjs
CHANGED
|
@@ -1087,7 +1087,7 @@ function getScopeById(scopeId) {
|
|
|
1087
1087
|
function _set_serialize_reason(reason) {
|
|
1088
1088
|
$chunk.boundary.state.serializeReason = reason;
|
|
1089
1089
|
}
|
|
1090
|
-
function
|
|
1090
|
+
function _scope_reason() {
|
|
1091
1091
|
let reason = $chunk.boundary.state.serializeReason;
|
|
1092
1092
|
return $chunk.boundary.state.serializeReason = void 0, reason;
|
|
1093
1093
|
}
|
|
@@ -2188,7 +2188,6 @@ export {
|
|
|
2188
2188
|
_for_of,
|
|
2189
2189
|
_for_to,
|
|
2190
2190
|
_for_until,
|
|
2191
|
-
_get_serialize_reason,
|
|
2192
2191
|
_hoist,
|
|
2193
2192
|
_html,
|
|
2194
2193
|
_id,
|
|
@@ -2198,6 +2197,7 @@ export {
|
|
|
2198
2197
|
_resume_branch,
|
|
2199
2198
|
writeScope as _scope,
|
|
2200
2199
|
_scope_id,
|
|
2200
|
+
_scope_reason,
|
|
2201
2201
|
_scope_with_id,
|
|
2202
2202
|
_script,
|
|
2203
2203
|
_sep,
|
package/dist/translator/index.js
CHANGED
|
@@ -2650,74 +2650,85 @@ var import_compiler14 = require("@marko/compiler");
|
|
|
2650
2650
|
|
|
2651
2651
|
// src/translator/util/with-comment.ts
|
|
2652
2652
|
function withLeadingComment(node, value) {
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2653
|
+
if (value) {
|
|
2654
|
+
const comment = {
|
|
2655
|
+
type: "CommentBlock",
|
|
2656
|
+
value: ` ${value} `
|
|
2657
|
+
};
|
|
2658
|
+
node.leadingComments = node.leadingComments ? [...node.leadingComments, comment] : [comment];
|
|
2659
|
+
}
|
|
2658
2660
|
return node;
|
|
2659
2661
|
}
|
|
2660
2662
|
|
|
2661
2663
|
// src/translator/util/serialize-guard.ts
|
|
2662
|
-
function getSerializeGuard(reason, optional) {
|
|
2663
|
-
|
|
2664
|
+
function getSerializeGuard(section, reason, optional) {
|
|
2665
|
+
if (!isReasonDynamic(reason)) {
|
|
2666
|
+
return reason ? optional ? void 0 : withLeadingComment(
|
|
2667
|
+
import_compiler14.types.numericLiteral(1),
|
|
2668
|
+
getDebugNames(reason === true ? void 0 : reason.state)
|
|
2669
|
+
) : import_compiler14.types.numericLiteral(0);
|
|
2670
|
+
}
|
|
2671
|
+
let expr;
|
|
2672
|
+
for (const [paramsSection, params] of groupParamsBySection(reason.param)) {
|
|
2673
|
+
if (!isSameOrChildSection(paramsSection, section)) {
|
|
2674
|
+
return optional ? void 0 : withLeadingComment(import_compiler14.types.numericLiteral(1), getDebugNames(params));
|
|
2675
|
+
}
|
|
2676
|
+
const serializeIdentifier = import_compiler14.types.identifier(
|
|
2677
|
+
getSharedUid(`scope${paramsSection.id}_reason`, paramsSection)
|
|
2678
|
+
);
|
|
2679
|
+
const guard = paramsSection.paramReasonGroups ? callRuntime(
|
|
2680
|
+
"_serialize_guard",
|
|
2681
|
+
serializeIdentifier,
|
|
2682
|
+
withLeadingComment(
|
|
2683
|
+
import_compiler14.types.numericLiteral(getParamReasonGroupIndex(paramsSection, params)),
|
|
2684
|
+
getDebugNames(params)
|
|
2685
|
+
)
|
|
2686
|
+
) : serializeIdentifier;
|
|
2687
|
+
expr = expr ? import_compiler14.types.logicalExpression("||", expr, guard) : guard;
|
|
2688
|
+
}
|
|
2689
|
+
return expr;
|
|
2664
2690
|
}
|
|
2665
|
-
function getSerializeGuardForAny(reasons, optional) {
|
|
2691
|
+
function getSerializeGuardForAny(section, reasons, optional) {
|
|
2666
2692
|
if (!reasons || reasons === true) {
|
|
2667
|
-
return getSerializeGuard(reasons, optional);
|
|
2693
|
+
return getSerializeGuard(section, reasons, optional);
|
|
2668
2694
|
}
|
|
2669
2695
|
if (reasons.length === 1) {
|
|
2670
|
-
return getSerializeGuard(reasons[0], optional);
|
|
2696
|
+
return getSerializeGuard(section, reasons[0], optional);
|
|
2671
2697
|
}
|
|
2672
2698
|
let expr;
|
|
2673
2699
|
for (const reason of reasons) {
|
|
2674
|
-
if (reason
|
|
2700
|
+
if (!isReasonDynamic(reason)) {
|
|
2675
2701
|
return optional ? void 0 : withLeadingComment(import_compiler14.types.numericLiteral(1), getDebugNames(reason.state));
|
|
2676
2702
|
}
|
|
2677
|
-
const guard = getSerializeGuard(reason, false);
|
|
2703
|
+
const guard = getSerializeGuard(section, reason, false);
|
|
2678
2704
|
expr = expr ? import_compiler14.types.logicalExpression("||", expr, guard) : guard;
|
|
2679
2705
|
}
|
|
2680
2706
|
return expr;
|
|
2681
2707
|
}
|
|
2682
|
-
function getExprIfSerialized(reason, expr) {
|
|
2708
|
+
function getExprIfSerialized(section, reason, expr) {
|
|
2683
2709
|
if (!isReasonDynamic(reason)) {
|
|
2684
2710
|
return reason && expr;
|
|
2685
2711
|
}
|
|
2686
2712
|
let orExpr;
|
|
2687
|
-
for (const [
|
|
2713
|
+
for (const [paramsSection, params] of groupParamsBySection(reason.param)) {
|
|
2714
|
+
if (!isSameOrChildSection(paramsSection, section)) {
|
|
2715
|
+
return expr;
|
|
2716
|
+
}
|
|
2688
2717
|
const serializeIdentifier = import_compiler14.types.identifier(
|
|
2689
|
-
getSharedUid(
|
|
2718
|
+
getSharedUid(`scope${paramsSection.id}_reason`, paramsSection)
|
|
2690
2719
|
);
|
|
2691
|
-
const guard =
|
|
2720
|
+
const guard = paramsSection.paramReasonGroups ? callRuntime(
|
|
2692
2721
|
"_serialize_if",
|
|
2693
2722
|
serializeIdentifier,
|
|
2694
2723
|
withLeadingComment(
|
|
2695
|
-
import_compiler14.types.numericLiteral(getParamReasonGroupIndex(
|
|
2696
|
-
getDebugNames(
|
|
2724
|
+
import_compiler14.types.numericLiteral(getParamReasonGroupIndex(paramsSection, params)),
|
|
2725
|
+
getDebugNames(params)
|
|
2697
2726
|
)
|
|
2698
2727
|
) : serializeIdentifier;
|
|
2699
2728
|
orExpr = orExpr ? import_compiler14.types.logicalExpression("||", orExpr, guard) : guard;
|
|
2700
2729
|
}
|
|
2701
2730
|
return import_compiler14.types.logicalExpression("&&", orExpr, expr);
|
|
2702
2731
|
}
|
|
2703
|
-
function getInputSerializeReasonGuard(reason) {
|
|
2704
|
-
let expr;
|
|
2705
|
-
for (const [section, reasons] of groupParamsBySection(reason.param)) {
|
|
2706
|
-
const serializeIdentifier = import_compiler14.types.identifier(
|
|
2707
|
-
getSharedUid("serialize", section)
|
|
2708
|
-
);
|
|
2709
|
-
const guard = section.paramReasonGroups ? callRuntime(
|
|
2710
|
-
"_serialize_guard",
|
|
2711
|
-
serializeIdentifier,
|
|
2712
|
-
withLeadingComment(
|
|
2713
|
-
import_compiler14.types.numericLiteral(getParamReasonGroupIndex(section, reasons)),
|
|
2714
|
-
getDebugNames(reasons)
|
|
2715
|
-
)
|
|
2716
|
-
) : serializeIdentifier;
|
|
2717
|
-
expr = expr ? import_compiler14.types.logicalExpression("||", expr, guard) : guard;
|
|
2718
|
-
}
|
|
2719
|
-
return expr;
|
|
2720
|
-
}
|
|
2721
2732
|
|
|
2722
2733
|
// src/translator/util/walks.ts
|
|
2723
2734
|
var import_compiler15 = require("@marko/compiler");
|
|
@@ -2986,7 +2997,7 @@ function markNode(path5, nodeBinding, reason) {
|
|
|
2986
2997
|
"_el_resume",
|
|
2987
2998
|
getScopeIdIdentifier(section),
|
|
2988
2999
|
getScopeAccessorLiteral(nodeBinding),
|
|
2989
|
-
getSerializeGuard(reason, true)
|
|
3000
|
+
getSerializeGuard(section, reason, true)
|
|
2990
3001
|
)}`;
|
|
2991
3002
|
}
|
|
2992
3003
|
}
|
|
@@ -4051,7 +4062,11 @@ function writeHTMLResumeStatements(path5) {
|
|
|
4051
4062
|
serializedProperties.push(
|
|
4052
4063
|
toObjectProperty(
|
|
4053
4064
|
accessor,
|
|
4054
|
-
sectionSerializeReason && (sectionSerializeReason === reason || sectionSerializeReason !== true && reason !== true && compareSources(sectionSerializeReason, reason) === 0) ? getDeclaredBindingExpression(binding) : getExprIfSerialized(
|
|
4065
|
+
sectionSerializeReason && (sectionSerializeReason === reason || sectionSerializeReason !== true && reason !== true && compareSources(sectionSerializeReason, reason) === 0) ? getDeclaredBindingExpression(binding) : getExprIfSerialized(
|
|
4066
|
+
section,
|
|
4067
|
+
reason,
|
|
4068
|
+
getDeclaredBindingExpression(binding)
|
|
4069
|
+
)
|
|
4055
4070
|
)
|
|
4056
4071
|
);
|
|
4057
4072
|
if (debug) {
|
|
@@ -4085,14 +4100,14 @@ function writeHTMLResumeStatements(path5) {
|
|
|
4085
4100
|
serializedProperties.push(
|
|
4086
4101
|
toObjectProperty(
|
|
4087
4102
|
ownerAccessor,
|
|
4088
|
-
sectionSerializeReason && (sectionSerializeReason === ownerReason || sectionSerializeReason !== true && ownerReason !== true && compareSources(sectionSerializeReason, ownerReason) === 0) ? getOwnerExpr : getExprIfSerialized(ownerReason, getOwnerExpr)
|
|
4103
|
+
sectionSerializeReason && (sectionSerializeReason === ownerReason || sectionSerializeReason !== true && ownerReason !== true && compareSources(sectionSerializeReason, ownerReason) === 0) ? getOwnerExpr : getExprIfSerialized(section, ownerReason, getOwnerExpr)
|
|
4089
4104
|
)
|
|
4090
4105
|
);
|
|
4091
4106
|
}
|
|
4092
4107
|
}
|
|
4093
4108
|
for (const [key, { expression, reason }] of serializedLookup) {
|
|
4094
4109
|
serializedProperties.push(
|
|
4095
|
-
toObjectProperty(key, getExprIfSerialized(reason, expression))
|
|
4110
|
+
toObjectProperty(key, getExprIfSerialized(section, reason, expression))
|
|
4096
4111
|
);
|
|
4097
4112
|
}
|
|
4098
4113
|
if (sectionSerializeReason) {
|
|
@@ -4116,15 +4131,15 @@ function writeHTMLResumeStatements(path5) {
|
|
|
4116
4131
|
writeScopeArgs.push(import_compiler22.types.objectExpression(debugVars));
|
|
4117
4132
|
}
|
|
4118
4133
|
}
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4134
|
+
body.push(
|
|
4135
|
+
import_compiler22.types.expressionStatement(
|
|
4136
|
+
getExprIfSerialized(
|
|
4137
|
+
section,
|
|
4138
|
+
sectionSerializeReason,
|
|
4139
|
+
writeScopeBuilder ? writeScopeBuilder(callRuntime("_scope", ...writeScopeArgs)) : callRuntime("_scope", ...writeScopeArgs)
|
|
4140
|
+
)
|
|
4141
|
+
)
|
|
4142
|
+
);
|
|
4128
4143
|
}
|
|
4129
4144
|
const resumeClosestBranch = !section.isBranch && (section.hasAbortSignal || !!section.referencedClosures || !!find(section.bindings, (binding) => binding.type === 1 /* let */));
|
|
4130
4145
|
if (resumeClosestBranch) {
|
|
@@ -4519,8 +4534,8 @@ var html_default = {
|
|
|
4519
4534
|
renderContent.push(
|
|
4520
4535
|
import_compiler24.types.variableDeclaration("const", [
|
|
4521
4536
|
import_compiler24.types.variableDeclarator(
|
|
4522
|
-
import_compiler24.types.identifier(getSharedUid(
|
|
4523
|
-
callRuntime("
|
|
4537
|
+
import_compiler24.types.identifier(getSharedUid(`scope${section.id}_reason`, section)),
|
|
4538
|
+
callRuntime("_scope_reason")
|
|
4524
4539
|
)
|
|
4525
4540
|
])
|
|
4526
4541
|
);
|
|
@@ -5283,6 +5298,7 @@ var native_tag_default = {
|
|
|
5283
5298
|
getScopeIdIdentifier(tagSection),
|
|
5284
5299
|
usedAttrs.staticContentAttr.value,
|
|
5285
5300
|
getSerializeGuard(
|
|
5301
|
+
tagSection,
|
|
5286
5302
|
nodeBinding && getSerializeReason(tagSection, nodeBinding),
|
|
5287
5303
|
true
|
|
5288
5304
|
)
|
|
@@ -5291,6 +5307,7 @@ var native_tag_default = {
|
|
|
5291
5307
|
];
|
|
5292
5308
|
} else if (spreadExpression && !hasChildren) {
|
|
5293
5309
|
const serializeReason = getSerializeGuard(
|
|
5310
|
+
tagSection,
|
|
5294
5311
|
nodeBinding && getSerializeReason(tagSection, nodeBinding),
|
|
5295
5312
|
true
|
|
5296
5313
|
);
|
|
@@ -6040,10 +6057,12 @@ var for_default = {
|
|
|
6040
6057
|
if (branchSerializeReason) {
|
|
6041
6058
|
const skipParentEnd = onlyChildParentTagName && markerSerializeReason;
|
|
6042
6059
|
const statefulSerializeArg = getSerializeGuard(
|
|
6060
|
+
tagSection,
|
|
6043
6061
|
getSerializeReason(tagSection, kStatefulReason),
|
|
6044
6062
|
!(skipParentEnd || singleNodeOptimization)
|
|
6045
6063
|
);
|
|
6046
6064
|
const markerSerializeArg = getSerializeGuard(
|
|
6065
|
+
tagSection,
|
|
6047
6066
|
markerSerializeReason,
|
|
6048
6067
|
!statefulSerializeArg
|
|
6049
6068
|
);
|
|
@@ -6051,7 +6070,11 @@ var for_default = {
|
|
|
6051
6070
|
forAttrs.by || import_compiler31.types.numericLiteral(0),
|
|
6052
6071
|
getScopeIdIdentifier(tagSection),
|
|
6053
6072
|
getScopeAccessorLiteral(nodeBinding),
|
|
6054
|
-
getSerializeGuard(
|
|
6073
|
+
getSerializeGuard(
|
|
6074
|
+
tagSection,
|
|
6075
|
+
branchSerializeReason,
|
|
6076
|
+
!markerSerializeArg
|
|
6077
|
+
),
|
|
6055
6078
|
markerSerializeArg,
|
|
6056
6079
|
statefulSerializeArg
|
|
6057
6080
|
);
|
|
@@ -6602,8 +6625,10 @@ function buildContent(body) {
|
|
|
6602
6625
|
body.node.body.unshift(
|
|
6603
6626
|
import_compiler32.types.variableDeclaration("const", [
|
|
6604
6627
|
import_compiler32.types.variableDeclarator(
|
|
6605
|
-
import_compiler32.types.identifier(
|
|
6606
|
-
|
|
6628
|
+
import_compiler32.types.identifier(
|
|
6629
|
+
getSharedUid(`scope${bodySection.id}_reason`, bodySection)
|
|
6630
|
+
),
|
|
6631
|
+
callRuntime("_scope_reason")
|
|
6607
6632
|
)
|
|
6608
6633
|
])
|
|
6609
6634
|
);
|
|
@@ -6754,7 +6779,7 @@ function knownTagTranslateHTML(tag, tagIdentifier, contentSection, propTree) {
|
|
|
6754
6779
|
if (contentSection.paramReasonGroups.length === 1) {
|
|
6755
6780
|
const [group] = contentSection.paramReasonGroups;
|
|
6756
6781
|
const reason = getSerializeReason(section, childScopeBinding, group.id);
|
|
6757
|
-
childSerializeReasonExpr = reason && getSerializeGuard(reason, false);
|
|
6782
|
+
childSerializeReasonExpr = reason && getSerializeGuard(section, reason, false);
|
|
6758
6783
|
} else {
|
|
6759
6784
|
const props = [];
|
|
6760
6785
|
let hasDynamicReasons = false;
|
|
@@ -6770,7 +6795,7 @@ function knownTagTranslateHTML(tag, tagIdentifier, contentSection, propTree) {
|
|
|
6770
6795
|
import_compiler33.types.numericLiteral(i),
|
|
6771
6796
|
getDebugNames(group.reason)
|
|
6772
6797
|
),
|
|
6773
|
-
getSerializeGuard(reason, false)
|
|
6798
|
+
getSerializeGuard(section, reason, false)
|
|
6774
6799
|
)
|
|
6775
6800
|
);
|
|
6776
6801
|
} else {
|
|
@@ -8038,6 +8063,8 @@ function finalizeReferences() {
|
|
|
8038
8063
|
}
|
|
8039
8064
|
}
|
|
8040
8065
|
}
|
|
8066
|
+
});
|
|
8067
|
+
forEachSection((section) => {
|
|
8041
8068
|
forEach(section.referencedLocalClosures, (closure) => {
|
|
8042
8069
|
addSerializeReason(
|
|
8043
8070
|
section,
|
|
@@ -8046,41 +8073,39 @@ function finalizeReferences() {
|
|
|
8046
8073
|
);
|
|
8047
8074
|
});
|
|
8048
8075
|
forEach(section.referencedClosures, (closure) => {
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
|
|
8055
|
-
|
|
8056
|
-
|
|
8057
|
-
break;
|
|
8058
|
-
}
|
|
8059
|
-
serializeReason = mergeSerializeReasons(
|
|
8060
|
-
serializeReason,
|
|
8061
|
-
upstreamReason
|
|
8062
|
-
);
|
|
8063
|
-
currentSection = currentSection.parent;
|
|
8076
|
+
const sourceSection = closure.section;
|
|
8077
|
+
let currentSection = section;
|
|
8078
|
+
let branchesReason;
|
|
8079
|
+
while (currentSection !== sourceSection) {
|
|
8080
|
+
const upstreamReason = currentSection.downstreamBinding ? getSectionRegisterReasons(currentSection) || void 0 : !currentSection.upstreamExpression || getSerializeSourcesForExpr(currentSection.upstreamExpression);
|
|
8081
|
+
if (upstreamReason === true) {
|
|
8082
|
+
branchesReason = true;
|
|
8083
|
+
break;
|
|
8064
8084
|
}
|
|
8065
|
-
|
|
8085
|
+
branchesReason = mergeSerializeReasons(branchesReason, upstreamReason);
|
|
8086
|
+
currentSection = currentSection.parent;
|
|
8066
8087
|
}
|
|
8088
|
+
addSerializeReason(sourceSection, branchesReason, closure);
|
|
8067
8089
|
addSerializeReason(
|
|
8068
|
-
|
|
8069
|
-
getSerializeReason(
|
|
8090
|
+
sourceSection,
|
|
8091
|
+
getSerializeReason(sourceSection, closure)
|
|
8070
8092
|
);
|
|
8071
|
-
if (
|
|
8072
|
-
|
|
8073
|
-
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
|
|
8077
|
-
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
|
|
8083
|
-
|
|
8093
|
+
if (isDynamicClosure(section, closure)) {
|
|
8094
|
+
addOwnerSerializeReason(section, sourceSection, branchesReason);
|
|
8095
|
+
if (closure.sources) {
|
|
8096
|
+
addSerializeReason(
|
|
8097
|
+
sourceSection,
|
|
8098
|
+
closure.sources,
|
|
8099
|
+
closure,
|
|
8100
|
+
getAccessorPrefix().ClosureScopes
|
|
8101
|
+
);
|
|
8102
|
+
addSerializeReason(
|
|
8103
|
+
section,
|
|
8104
|
+
closure.sources,
|
|
8105
|
+
closure,
|
|
8106
|
+
getAccessorPrefix().ClosureSignalIndex
|
|
8107
|
+
);
|
|
8108
|
+
}
|
|
8084
8109
|
}
|
|
8085
8110
|
});
|
|
8086
8111
|
});
|
|
@@ -8705,7 +8730,7 @@ var await_default = {
|
|
|
8705
8730
|
node.body.params,
|
|
8706
8731
|
toFirstExpressionOrBlock(node.body.body)
|
|
8707
8732
|
),
|
|
8708
|
-
getSerializeGuard(bodySection?.serializeReason, true)
|
|
8733
|
+
getSerializeGuard(section, bodySection?.serializeReason, true)
|
|
8709
8734
|
)
|
|
8710
8735
|
)
|
|
8711
8736
|
)[0].skip();
|
|
@@ -10314,10 +10339,12 @@ var IfTag = {
|
|
|
10314
10339
|
getParentTag(ifTag).node.extra[kSkipEndTag] = true;
|
|
10315
10340
|
}
|
|
10316
10341
|
const statefulSerializeArg = getSerializeGuard(
|
|
10342
|
+
ifTagSection,
|
|
10317
10343
|
getSerializeReason(ifTagSection, kStatefulReason2),
|
|
10318
10344
|
!(skipParentEnd || singleNodeOptimization)
|
|
10319
10345
|
);
|
|
10320
10346
|
const markerSerializeArg = getSerializeGuard(
|
|
10347
|
+
ifTagSection,
|
|
10321
10348
|
markerSerializeReason,
|
|
10322
10349
|
!statefulSerializeArg
|
|
10323
10350
|
);
|
|
@@ -10332,6 +10359,7 @@ var IfTag = {
|
|
|
10332
10359
|
getScopeIdIdentifier(ifTagSection),
|
|
10333
10360
|
getScopeAccessorLiteral(nodeBinding),
|
|
10334
10361
|
getSerializeGuardForAny(
|
|
10362
|
+
ifTagSection,
|
|
10335
10363
|
branchSerializeReasons,
|
|
10336
10364
|
!markerSerializeArg
|
|
10337
10365
|
),
|
|
@@ -11435,7 +11463,7 @@ var placeholder_default = {
|
|
|
11435
11463
|
if (markerSerializeReason === true || markerSerializeReason.state) {
|
|
11436
11464
|
write`<!>`;
|
|
11437
11465
|
} else {
|
|
11438
|
-
write`${callRuntime("_sep", getSerializeGuard(markerSerializeReason, true))}`;
|
|
11466
|
+
write`${callRuntime("_sep", getSerializeGuard(section, markerSerializeReason, true))}`;
|
|
11439
11467
|
}
|
|
11440
11468
|
}
|
|
11441
11469
|
visit(placeholder, 37 /* Replace */);
|
|
@@ -12079,6 +12107,7 @@ var dynamic_tag_default = {
|
|
|
12079
12107
|
flushInto(tag);
|
|
12080
12108
|
writeHTMLResumeStatements(tag.get("body"));
|
|
12081
12109
|
const serializeArg = getSerializeGuard(
|
|
12110
|
+
tagSection,
|
|
12082
12111
|
getSerializeReason(tagSection, nodeBinding),
|
|
12083
12112
|
true
|
|
12084
12113
|
);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
|
+
import { type Section } from "./sections";
|
|
2
3
|
import { type SerializeReason, type SerializeReasons } from "./serialize-reasons";
|
|
3
|
-
export declare function getSerializeGuard(reason: undefined | SerializeReason, optional: boolean): t.Expression | undefined;
|
|
4
|
-
export declare function getSerializeGuardForAny(reasons: undefined | SerializeReasons, optional: boolean): t.Expression | undefined;
|
|
5
|
-
export declare function getExprIfSerialized<T extends undefined | SerializeReason, U extends t.Expression>(reason: T, expr: U): T extends {} ? U : undefined;
|
|
4
|
+
export declare function getSerializeGuard(section: Section, reason: undefined | SerializeReason, optional: boolean): t.Expression | undefined;
|
|
5
|
+
export declare function getSerializeGuardForAny(section: Section, reasons: undefined | SerializeReasons, optional: boolean): t.Expression | undefined;
|
|
6
|
+
export declare function getExprIfSerialized<T extends undefined | SerializeReason, U extends t.Expression>(section: Section, reason: T, expr: U): T extends {} ? U : undefined;
|