marko 6.0.0-next.3.57 → 6.0.0-next.3.58
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/translator/index.js
CHANGED
@@ -2688,27 +2688,12 @@ function writeHTMLResumeStatements(path5) {
|
|
2688
2688
|
if (!section) return;
|
2689
2689
|
const allSignals = Array.from(getSignals(section).values());
|
2690
2690
|
const scopeIdIdentifier = getScopeIdIdentifier(section);
|
2691
|
-
const
|
2692
|
-
|
2693
|
-
|
2694
|
-
const currentSerialized = getSerializedScopeProperties(currentSection);
|
2695
|
-
currentSection = currentSection.parent;
|
2696
|
-
if (!currentSerialized.has("_")) {
|
2697
|
-
currentSerialized.set(
|
2698
|
-
"_",
|
2699
|
-
callRuntime(
|
2700
|
-
"ensureScopeWithId",
|
2701
|
-
getScopeIdIdentifier(currentSection)
|
2702
|
-
)
|
2703
|
-
);
|
2704
|
-
}
|
2705
|
-
}
|
2706
|
-
};
|
2707
|
-
forEach(section.assignments, serializeOwnersUntilBindingSection);
|
2708
|
-
forEach(section.referencedHoists, serializeOwnersUntilBindingSection);
|
2691
|
+
const serializeOwnersUntilBinding = (binding) => serializeOwners(section, binding.section);
|
2692
|
+
forEach(section.assignments, serializeOwnersUntilBinding);
|
2693
|
+
forEach(section.referencedHoists, serializeOwnersUntilBinding);
|
2709
2694
|
forEach(section.referencedClosures, (closure) => {
|
2710
2695
|
if (isStatefulReferences(closure)) {
|
2711
|
-
|
2696
|
+
serializeOwnersUntilBinding(closure);
|
2712
2697
|
setForceResumeScope(closure.section);
|
2713
2698
|
if (isDynamicClosure(section, closure)) {
|
2714
2699
|
const closureSignal = getSignal(closure.section, closure);
|
@@ -2910,6 +2895,21 @@ function writeHTMLResumeStatements(path5) {
|
|
2910
2895
|
path5.pushContainer("body", import_compiler17.types.returnStatement(returnIdentifier));
|
2911
2896
|
}
|
2912
2897
|
}
|
2898
|
+
function serializeOwners(from, to) {
|
2899
|
+
let cur = from;
|
2900
|
+
while (cur !== to) {
|
2901
|
+
const parent = cur.parent;
|
2902
|
+
if (!parent) break;
|
2903
|
+
const serialized = getSerializedScopeProperties(cur);
|
2904
|
+
cur = parent;
|
2905
|
+
if (!serialized.has("_")) {
|
2906
|
+
serialized.set(
|
2907
|
+
"_",
|
2908
|
+
callRuntime("ensureScopeWithId", getScopeIdIdentifier(cur))
|
2909
|
+
);
|
2910
|
+
}
|
2911
|
+
}
|
2912
|
+
}
|
2913
2913
|
function getSetup(section) {
|
2914
2914
|
return getSignals(section).get(void 0)?.identifier;
|
2915
2915
|
}
|
@@ -3863,7 +3863,7 @@ function trackReference(referencePath, binding) {
|
|
3863
3863
|
propPath = reference.name;
|
3864
3864
|
continue;
|
3865
3865
|
}
|
3866
|
-
if (root.parentPath
|
3866
|
+
if (isInvokedFunction(root.parentPath) && !isEventOrChangeHandler(prop)) {
|
3867
3867
|
break;
|
3868
3868
|
}
|
3869
3869
|
root = root.parentPath;
|
@@ -4951,19 +4951,7 @@ var native_tag_default = {
|
|
4951
4951
|
for (const reference of varBinding.referencePaths) {
|
4952
4952
|
const referenceSection = getSection(reference);
|
4953
4953
|
if (!reference.node.extra?.hoist) {
|
4954
|
-
|
4955
|
-
while (currentSection !== section && currentSection.parent) {
|
4956
|
-
setSerializedProperty(
|
4957
|
-
currentSection,
|
4958
|
-
"_",
|
4959
|
-
callRuntime(
|
4960
|
-
"ensureScopeWithId",
|
4961
|
-
getScopeIdIdentifier(
|
4962
|
-
currentSection = currentSection.parent
|
4963
|
-
)
|
4964
|
-
)
|
4965
|
-
);
|
4966
|
-
}
|
4954
|
+
serializeOwners(referenceSection, section);
|
4967
4955
|
}
|
4968
4956
|
}
|
4969
4957
|
setForceResumeScope(section);
|
@@ -6336,7 +6324,7 @@ var html_comment_default = {
|
|
6336
6324
|
}
|
6337
6325
|
needsBinding = true;
|
6338
6326
|
for (const ref of tag.scope.getBinding(tagVar.name).referencePaths) {
|
6339
|
-
if (!ref
|
6327
|
+
if (!isInvokedFunction(ref)) {
|
6340
6328
|
needsGetter = true;
|
6341
6329
|
break;
|
6342
6330
|
}
|
@@ -6407,7 +6395,7 @@ var html_comment_default = {
|
|
6407
6395
|
}
|
6408
6396
|
for (const reference of references) {
|
6409
6397
|
const referenceSection = getSection(reference);
|
6410
|
-
if (reference
|
6398
|
+
if (isInvokedFunction(reference)) {
|
6411
6399
|
reference.parentPath.replaceWith(
|
6412
6400
|
import_compiler35.types.expressionStatement(
|
6413
6401
|
createScopeReadExpression(referenceSection, commentBinding)
|
@@ -6571,7 +6559,7 @@ var html_script_default = {
|
|
6571
6559
|
);
|
6572
6560
|
if (node.var) {
|
6573
6561
|
for (const ref of tag.scope.getBinding(node.var.name).referencePaths) {
|
6574
|
-
if (!ref
|
6562
|
+
if (!isInvokedFunction(ref)) {
|
6575
6563
|
tagExtra[kGetterId3] = getRegisterUID(section, bindingName);
|
6576
6564
|
break;
|
6577
6565
|
}
|
@@ -6592,17 +6580,7 @@ var html_script_default = {
|
|
6592
6580
|
const varName = tag.node.var.name;
|
6593
6581
|
const references = tag.scope.getBinding(varName).referencePaths;
|
6594
6582
|
for (const reference of references) {
|
6595
|
-
|
6596
|
-
while (currentSection !== section && currentSection.parent) {
|
6597
|
-
setSerializedProperty(
|
6598
|
-
currentSection,
|
6599
|
-
"_",
|
6600
|
-
callRuntime(
|
6601
|
-
"ensureScopeWithId",
|
6602
|
-
getScopeIdIdentifier(currentSection = currentSection.parent)
|
6603
|
-
)
|
6604
|
-
);
|
6605
|
-
}
|
6583
|
+
serializeOwners(getSection(reference), section);
|
6606
6584
|
}
|
6607
6585
|
translateVar(
|
6608
6586
|
tag,
|
@@ -6636,7 +6614,7 @@ var html_script_default = {
|
|
6636
6614
|
}
|
6637
6615
|
for (const reference of references) {
|
6638
6616
|
const referenceSection = getSection(reference);
|
6639
|
-
if (reference
|
6617
|
+
if (isInvokedFunction(reference)) {
|
6640
6618
|
reference.parentPath.replaceWith(
|
6641
6619
|
import_compiler36.types.expressionStatement(
|
6642
6620
|
createScopeReadExpression(referenceSection, nodeRef2)
|
@@ -6967,7 +6945,7 @@ var html_style_default = {
|
|
6967
6945
|
);
|
6968
6946
|
if (node.var) {
|
6969
6947
|
for (const ref of tag.scope.getBinding(node.var.name).referencePaths) {
|
6970
|
-
if (!ref
|
6948
|
+
if (!isInvokedFunction(ref)) {
|
6971
6949
|
tagExtra[kGetterId4] = getRegisterUID(section, bindingName);
|
6972
6950
|
break;
|
6973
6951
|
}
|
@@ -6988,17 +6966,7 @@ var html_style_default = {
|
|
6988
6966
|
const varName = tag.node.var.name;
|
6989
6967
|
const references = tag.scope.getBinding(varName).referencePaths;
|
6990
6968
|
for (const reference of references) {
|
6991
|
-
|
6992
|
-
while (currentSection !== section && currentSection.parent) {
|
6993
|
-
setSerializedProperty(
|
6994
|
-
currentSection,
|
6995
|
-
"_",
|
6996
|
-
callRuntime(
|
6997
|
-
"ensureScopeWithId",
|
6998
|
-
getScopeIdIdentifier(currentSection = currentSection.parent)
|
6999
|
-
)
|
7000
|
-
);
|
7001
|
-
}
|
6969
|
+
serializeOwners(getSection(reference), section);
|
7002
6970
|
}
|
7003
6971
|
translateVar(
|
7004
6972
|
tag,
|
@@ -7032,7 +7000,7 @@ var html_style_default = {
|
|
7032
7000
|
}
|
7033
7001
|
for (const reference of references) {
|
7034
7002
|
const referenceSection = getSection(reference);
|
7035
|
-
if (reference
|
7003
|
+
if (isInvokedFunction(reference)) {
|
7036
7004
|
reference.parentPath.replaceWith(
|
7037
7005
|
import_compiler37.types.expressionStatement(
|
7038
7006
|
createScopeReadExpression(referenceSection, nodeRef2)
|
@@ -55,6 +55,7 @@ export declare function writeSignals(section: Section): void;
|
|
55
55
|
export declare function writeRegisteredFns(): void;
|
56
56
|
export declare function addHTMLEffectCall(section: Section, referencedBindings?: ReferencedBindings): void;
|
57
57
|
export declare function writeHTMLResumeStatements(path: t.NodePath<t.MarkoTagBody | t.Program>): void;
|
58
|
+
export declare function serializeOwners(from: Section, to?: Section): void;
|
58
59
|
export declare function getSetup(section: Section): t.Identifier | undefined;
|
59
60
|
export declare function replaceRegisteredFunctionNode(node: t.Node): t.CallExpression | t.ClassPrivateProperty | t.ClassProperty | t.VariableDeclaration | t.Identifier | t.ObjectProperty | undefined;
|
60
61
|
export {};
|