marko 6.0.133 → 6.0.134
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 +29 -14
- package/package.json +1 -1
package/dist/translator/index.js
CHANGED
|
@@ -1028,8 +1028,8 @@ var Sorted = class {
|
|
|
1028
1028
|
return false;
|
|
1029
1029
|
}
|
|
1030
1030
|
for (let i = subLen; i--; ) {
|
|
1031
|
-
const
|
|
1032
|
-
if (
|
|
1031
|
+
const found = findIndexSorted(this.compare, superset, subset[i]);
|
|
1032
|
+
if (found === -1 || supLen - found <= i) return false;
|
|
1033
1033
|
}
|
|
1034
1034
|
return true;
|
|
1035
1035
|
}
|
|
@@ -3460,8 +3460,16 @@ function getBindingGetterIdentifier(binding) {
|
|
|
3460
3460
|
return identifier;
|
|
3461
3461
|
}
|
|
3462
3462
|
function getSignal(section, referencedBindings, name2 = generateSignalName(referencedBindings)) {
|
|
3463
|
-
if (!Array.isArray(referencedBindings)
|
|
3464
|
-
|
|
3463
|
+
if (referencedBindings && !Array.isArray(referencedBindings)) {
|
|
3464
|
+
if (referencedBindings.type === 7 /* constant */) {
|
|
3465
|
+
return getSignal(section, void 0);
|
|
3466
|
+
}
|
|
3467
|
+
if (referencedBindings.type !== 4 /* local */ && referencedBindings.section !== section) {
|
|
3468
|
+
const canonicalReference = getCanonicalBinding(referencedBindings);
|
|
3469
|
+
if (canonicalReference !== referencedBindings) {
|
|
3470
|
+
return getSignal(section, canonicalReference);
|
|
3471
|
+
}
|
|
3472
|
+
}
|
|
3465
3473
|
}
|
|
3466
3474
|
const signals = getSignals(section);
|
|
3467
3475
|
let signal = signals.get(referencedBindings);
|
|
@@ -3506,9 +3514,9 @@ function getSignal(section, referencedBindings, name2 = generateSignalName(refer
|
|
|
3506
3514
|
scopeOffset && getScopeAccessorLiteral(scopeOffset, true)
|
|
3507
3515
|
);
|
|
3508
3516
|
};
|
|
3509
|
-
} else if (referencedBindings.section !== section &&
|
|
3517
|
+
} else if (referencedBindings.section !== section && sectionUtil.has(referencedBindings.closureSections, section)) {
|
|
3510
3518
|
signal.build = () => {
|
|
3511
|
-
const closure =
|
|
3519
|
+
const closure = referencedBindings;
|
|
3512
3520
|
const render = getSignalFn(signal);
|
|
3513
3521
|
const closureSignalBuilder = getClosureSignalBuilder(section);
|
|
3514
3522
|
if (closureSignalBuilder && !isDynamicClosure(section, closure)) {
|
|
@@ -3690,7 +3698,7 @@ function getSignalFn(signal) {
|
|
|
3690
3698
|
)
|
|
3691
3699
|
);
|
|
3692
3700
|
});
|
|
3693
|
-
if (isValue && binding.sources
|
|
3701
|
+
if (isValue && binding.sources) {
|
|
3694
3702
|
let dynamicClosureArgs;
|
|
3695
3703
|
let dynamicClosureSignalIdentifier;
|
|
3696
3704
|
forEach(binding.closureSections, (closureSection) => {
|
|
@@ -9038,20 +9046,20 @@ function finalizeReferences() {
|
|
|
9038
9046
|
);
|
|
9039
9047
|
for (const { isEffect, section: section2 } of binding.reads) {
|
|
9040
9048
|
if (section2 !== binding.section) {
|
|
9041
|
-
const canonicalUpstreamAlias = getCanonicalBinding(binding);
|
|
9042
|
-
canonicalUpstreamAlias.closureSections = sectionUtil.add(
|
|
9043
|
-
canonicalUpstreamAlias.closureSections,
|
|
9044
|
-
section2
|
|
9045
|
-
);
|
|
9046
9049
|
if (binding.type === 4 /* local */) {
|
|
9047
9050
|
section2.referencedLocalClosures = bindingUtil.add(
|
|
9048
9051
|
section2.referencedLocalClosures,
|
|
9049
9052
|
binding
|
|
9050
9053
|
);
|
|
9051
9054
|
} else {
|
|
9055
|
+
const canonicalUpstreamAlias = getCanonicalBinding(binding);
|
|
9056
|
+
canonicalUpstreamAlias.closureSections = sectionUtil.add(
|
|
9057
|
+
canonicalUpstreamAlias.closureSections,
|
|
9058
|
+
section2
|
|
9059
|
+
);
|
|
9052
9060
|
section2.referencedClosures = bindingUtil.add(
|
|
9053
9061
|
section2.referencedClosures,
|
|
9054
|
-
|
|
9062
|
+
canonicalUpstreamAlias
|
|
9055
9063
|
);
|
|
9056
9064
|
addOwnerSerializeReason(
|
|
9057
9065
|
section2,
|
|
@@ -10286,12 +10294,13 @@ var define_default = {
|
|
|
10286
10294
|
dropNodes(getAllTagReferenceNodes(tag.node));
|
|
10287
10295
|
return;
|
|
10288
10296
|
}
|
|
10289
|
-
trackParamsReferences(tagBody, 3 /* param */);
|
|
10297
|
+
const paramsBinding = trackParamsReferences(tagBody, 3 /* param */);
|
|
10290
10298
|
setTagDownstream(tag, varBinding);
|
|
10291
10299
|
if (bodySection) {
|
|
10292
10300
|
if (import_compiler43.types.isIdentifier(tag.node.var)) {
|
|
10293
10301
|
const babelBinding = tag.scope.getBinding(tag.node.var.name);
|
|
10294
10302
|
let allDirectReferences = true;
|
|
10303
|
+
let allHaveInput = true;
|
|
10295
10304
|
for (const ref of babelBinding.referencePaths) {
|
|
10296
10305
|
if (isReferenceHoisted(babelBinding.path, ref)) {
|
|
10297
10306
|
throw ref.buildCodeFrameError(
|
|
@@ -10300,12 +10309,18 @@ var define_default = {
|
|
|
10300
10309
|
}
|
|
10301
10310
|
if (ref.parent.type === "MarkoTag" && ref.parent.name === ref.node) {
|
|
10302
10311
|
(ref.parent.extra ??= {}).defineBodySection = bodySection;
|
|
10312
|
+
allHaveInput &&= !ref.parent.arguments?.length;
|
|
10303
10313
|
dropNodes(ref.parent.name);
|
|
10304
10314
|
} else {
|
|
10315
|
+
allHaveInput = false;
|
|
10305
10316
|
allDirectReferences = false;
|
|
10306
10317
|
}
|
|
10307
10318
|
}
|
|
10308
10319
|
if (allDirectReferences) {
|
|
10320
|
+
const inputAlias = allHaveInput && paramsBinding?.propertyAliases.get("0");
|
|
10321
|
+
if (inputAlias) {
|
|
10322
|
+
inputAlias.nullable = false;
|
|
10323
|
+
}
|
|
10309
10324
|
dropNodes(getAllTagReferenceNodes(tag.node));
|
|
10310
10325
|
return;
|
|
10311
10326
|
}
|