marko 6.0.15 → 6.0.17
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 +194 -189
- package/dist/debug/dom.mjs +194 -189
- package/dist/dom/renderer.d.ts +9 -11
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +140 -138
- package/dist/dom.mjs +140 -138
- package/dist/translator/index.js +150 -75
- package/dist/translator/util/references.d.ts +3 -2
- package/dist/translator/util/sections.d.ts +1 -0
- package/dist/translator/util/signals.d.ts +2 -1
- package/package.json +1 -1
package/dist/translator/index.js
CHANGED
@@ -1987,6 +1987,7 @@ function startSection(path5) {
|
|
1987
1987
|
parent: parentSection,
|
1988
1988
|
sectionAccessor: void 0,
|
1989
1989
|
params: void 0,
|
1990
|
+
referencedLocalClosures: void 0,
|
1990
1991
|
referencedClosures: void 0,
|
1991
1992
|
referencedHoists: void 0,
|
1992
1993
|
bindings: void 0,
|
@@ -3048,9 +3049,6 @@ function getHoistFunctionIdentifier(hoistedBinding) {
|
|
3048
3049
|
}
|
3049
3050
|
return identifier;
|
3050
3051
|
}
|
3051
|
-
var unimplementedBuild = () => {
|
3052
|
-
return import_compiler20.types.stringLiteral("SIGNAL NOT INITIALIZED");
|
3053
|
-
};
|
3054
3052
|
function getSignal(section, referencedBindings, name2 = generateSignalName(referencedBindings)) {
|
3055
3053
|
const signals = getSignals(section);
|
3056
3054
|
let signal = signals.get(referencedBindings);
|
@@ -3069,7 +3067,7 @@ function getSignal(section, referencedBindings, name2 = generateSignalName(refer
|
|
3069
3067
|
effect: [],
|
3070
3068
|
effectReferencedBindings: void 0,
|
3071
3069
|
subscribers: [],
|
3072
|
-
build:
|
3070
|
+
build: void 0,
|
3073
3071
|
export: !!exportName
|
3074
3072
|
}
|
3075
3073
|
);
|
@@ -3113,7 +3111,7 @@ function initValue(binding, runtimeHelper = "value") {
|
|
3113
3111
|
const signal = getSignal(section, binding);
|
3114
3112
|
signal.build = () => {
|
3115
3113
|
const fn = getSignalFn(signal);
|
3116
|
-
const isParamBinding = !binding.upstreamAlias && (binding.type === 3 /* param */ || binding.type === 2 /* input */);
|
3114
|
+
const isParamBinding = !binding.upstreamAlias && (binding.type === 3 /* param */ || binding.type === 4 /* local */ || binding.type === 2 /* input */);
|
3117
3115
|
const isNakedAlias = binding.upstreamAlias && !binding.property;
|
3118
3116
|
const needsGuard = !isNakedAlias && (binding.closureSections || binding.downstreamExpressions.size || fn.type === "ArrowFunctionExpression" && fn.body.body.length > 0);
|
3119
3117
|
const needsCache = needsGuard || signal.intersection;
|
@@ -3208,7 +3206,7 @@ function getSignalFn(signal) {
|
|
3208
3206
|
)
|
3209
3207
|
);
|
3210
3208
|
});
|
3211
|
-
if (isValue && binding.sources) {
|
3209
|
+
if (isValue && binding.sources && binding.type !== 4 /* local */) {
|
3212
3210
|
let dynamicClosureArgs;
|
3213
3211
|
let dynamicClosureSignalIdentifier;
|
3214
3212
|
if (binding.sources) {
|
@@ -3286,6 +3284,9 @@ function getSignalFn(signal) {
|
|
3286
3284
|
}
|
3287
3285
|
}
|
3288
3286
|
if (i === -1) {
|
3287
|
+
if (expression.callee.type === "MemberExpression" && expression.callee.property.type === "Identifier" && expression.callee.property.name === "_") {
|
3288
|
+
return expression.callee.object;
|
3289
|
+
}
|
3289
3290
|
return expression.callee;
|
3290
3291
|
}
|
3291
3292
|
}
|
@@ -3441,7 +3442,7 @@ function writeSignals(section) {
|
|
3441
3442
|
writeSignal(signal);
|
3442
3443
|
}
|
3443
3444
|
function writeSignal(signal) {
|
3444
|
-
if (seen.has(signal)) return;
|
3445
|
+
if (!signal.build || seen.has(signal)) return;
|
3445
3446
|
seen.add(signal);
|
3446
3447
|
for (const value2 of signal.values) {
|
3447
3448
|
writeSignal(value2.signal);
|
@@ -3740,11 +3741,13 @@ function writeHTMLResumeStatements(path5) {
|
|
3740
3741
|
);
|
3741
3742
|
}
|
3742
3743
|
}
|
3744
|
+
const debug = !isOptimize();
|
3745
|
+
const writeScopeBuilder = getSectionWriteScopeBuilder(section);
|
3743
3746
|
const serializedLookup = getSerializedAccessors(section);
|
3744
3747
|
const serializedProperties = [];
|
3745
3748
|
const sectionSerializeReason = nonAnalyzedForceSerializedSection.has(section) ? true : section.serializeReason;
|
3746
|
-
|
3747
|
-
|
3749
|
+
let debugVars;
|
3750
|
+
const writeSerializedBinding = (binding) => {
|
3748
3751
|
const reason = getBindingSerializeReason(section, binding);
|
3749
3752
|
if (!reason) return;
|
3750
3753
|
const accessor = getScopeAccessor(binding);
|
@@ -3755,7 +3758,25 @@ function writeHTMLResumeStatements(path5) {
|
|
3755
3758
|
sectionSerializeReason && (sectionSerializeReason === reason || sectionSerializeReason !== true && reason !== true && compareSources(sectionSerializeReason, reason) === 0) ? getDeclaredBindingExpression(binding) : getExprIfSerialized(reason, getDeclaredBindingExpression(binding))
|
3756
3759
|
)
|
3757
3760
|
);
|
3761
|
+
if (debug) {
|
3762
|
+
const { root, access } = getDebugScopeAccess(binding);
|
3763
|
+
const locExpr = root.loc && import_compiler20.types.stringLiteral(`${root.loc.start.line}:${root.loc.start.column + 1}`);
|
3764
|
+
(debugVars ||= []).push(
|
3765
|
+
toObjectProperty(
|
3766
|
+
getScopeAccessor(binding),
|
3767
|
+
root !== binding ? import_compiler20.types.arrayExpression(
|
3768
|
+
locExpr ? [import_compiler20.types.stringLiteral(root.name + access), locExpr] : [import_compiler20.types.stringLiteral(root.name + access)]
|
3769
|
+
) : locExpr || import_compiler20.types.numericLiteral(0)
|
3770
|
+
)
|
3771
|
+
);
|
3772
|
+
}
|
3773
|
+
};
|
3774
|
+
forEach(section.bindings, (binding) => {
|
3775
|
+
if (binding.type !== 0 /* dom */ && binding.type !== 4 /* local */) {
|
3776
|
+
writeSerializedBinding(binding);
|
3777
|
+
}
|
3758
3778
|
});
|
3779
|
+
forEach(section.referencedLocalClosures, writeSerializedBinding);
|
3759
3780
|
if (section.parent) {
|
3760
3781
|
const ownerAccessor = getAccessorProp().Owner;
|
3761
3782
|
const ownerReason = getSectionSerializeReason(section, ownerAccessor);
|
@@ -3778,7 +3799,6 @@ function writeHTMLResumeStatements(path5) {
|
|
3778
3799
|
toObjectProperty(key, getExprIfSerialized(reason, expression))
|
3779
3800
|
);
|
3780
3801
|
}
|
3781
|
-
const writeScopeBuilder = getSectionWriteScopeBuilder(section);
|
3782
3802
|
if (sectionSerializeReason) {
|
3783
3803
|
for (const prop of serializedProperties) {
|
3784
3804
|
if (prop.key.type === "Identifier" && prop.value.type === "Identifier" && prop.key.name === prop.value.name) {
|
@@ -3789,25 +3809,7 @@ function writeHTMLResumeStatements(path5) {
|
|
3789
3809
|
scopeIdIdentifier,
|
3790
3810
|
import_compiler20.types.objectExpression(serializedProperties)
|
3791
3811
|
];
|
3792
|
-
if (
|
3793
|
-
let debugVars;
|
3794
|
-
forEach(section.bindings, (binding) => {
|
3795
|
-
if (binding.type === 0 /* dom */) return;
|
3796
|
-
const serializeReason = getBindingSerializeReason(section, binding);
|
3797
|
-
if (!serializeReason) return;
|
3798
|
-
const { root, access } = getDebugScopeAccess(binding);
|
3799
|
-
const locExpr = root.loc && import_compiler20.types.stringLiteral(
|
3800
|
-
`${root.loc.start.line}:${root.loc.start.column + 1}`
|
3801
|
-
);
|
3802
|
-
(debugVars ||= []).push(
|
3803
|
-
toObjectProperty(
|
3804
|
-
getScopeAccessor(binding),
|
3805
|
-
root !== binding ? import_compiler20.types.arrayExpression(
|
3806
|
-
locExpr ? [import_compiler20.types.stringLiteral(root.name + access), locExpr] : [import_compiler20.types.stringLiteral(root.name + access)]
|
3807
|
-
) : locExpr || import_compiler20.types.numericLiteral(0)
|
3808
|
-
)
|
3809
|
-
);
|
3810
|
-
});
|
3812
|
+
if (debug) {
|
3811
3813
|
writeScopeArgs.push(
|
3812
3814
|
import_compiler20.types.stringLiteral(path5.hub.file.opts.filenameRelative),
|
3813
3815
|
section.loc && section.loc.start.line != null ? import_compiler20.types.stringLiteral(
|
@@ -4037,34 +4039,33 @@ var dom_default = {
|
|
4037
4039
|
}
|
4038
4040
|
forEachSectionReverse((childSection) => {
|
4039
4041
|
if (childSection !== section) {
|
4042
|
+
forEach(childSection.referencedClosures, (closure) => {
|
4043
|
+
const closureSignal = getSignal(childSection, closure);
|
4044
|
+
addStatement(
|
4045
|
+
"render",
|
4046
|
+
childSection,
|
4047
|
+
void 0,
|
4048
|
+
import_compiler21.types.expressionStatement(
|
4049
|
+
import_compiler21.types.callExpression(
|
4050
|
+
isDynamicClosure(childSection, closure) ? closureSignal.identifier : import_compiler21.types.memberExpression(
|
4051
|
+
closureSignal.identifier,
|
4052
|
+
import_compiler21.types.identifier(getAccessorProp().Owner)
|
4053
|
+
),
|
4054
|
+
[scopeIdentifier]
|
4055
|
+
)
|
4056
|
+
)
|
4057
|
+
);
|
4058
|
+
});
|
4040
4059
|
const tagParamsSignal = childSection.params && initValue(childSection.params);
|
4041
4060
|
const { walks: walks2, writes: writes2, setup: setup2 } = getSectionMeta(childSection);
|
4042
4061
|
const identifier = import_compiler21.types.identifier(childSection.name);
|
4043
|
-
|
4044
|
-
[scopeIdentifier],
|
4045
|
-
toFirstExpressionOrBlock(
|
4046
|
-
toArray(childSection.referencedClosures, (closure) => {
|
4047
|
-
const closureSignal = getSignal(childSection, closure);
|
4048
|
-
return import_compiler21.types.expressionStatement(
|
4049
|
-
import_compiler21.types.callExpression(
|
4050
|
-
isDynamicClosure(childSection, closure) ? closureSignal.identifier : import_compiler21.types.memberExpression(
|
4051
|
-
closureSignal.identifier,
|
4052
|
-
import_compiler21.types.identifier(getAccessorProp().Owner)
|
4053
|
-
),
|
4054
|
-
[scopeIdentifier]
|
4055
|
-
)
|
4056
|
-
);
|
4057
|
-
})
|
4058
|
-
)
|
4059
|
-
) : getSignal(childSection, childSection.referencedClosures).identifier : void 0;
|
4060
|
-
const renderer = getSectionParentIsOwner(childSection) ? callRuntime(
|
4062
|
+
let renderer = getSectionParentIsOwner(childSection) ? callRuntime(
|
4061
4063
|
"createRenderer",
|
4062
4064
|
...replaceNullishAndEmptyFunctionsWith0([
|
4063
4065
|
writes2,
|
4064
4066
|
walks2,
|
4065
4067
|
setup2,
|
4066
|
-
tagParamsSignal?.identifier
|
4067
|
-
referencedClosures
|
4068
|
+
tagParamsSignal?.identifier
|
4068
4069
|
])
|
4069
4070
|
) : callRuntime(
|
4070
4071
|
isSerializedSection(childSection) ? "registerContent" : "createContent",
|
@@ -4074,10 +4075,30 @@ var dom_default = {
|
|
4074
4075
|
walks2,
|
4075
4076
|
setup2,
|
4076
4077
|
tagParamsSignal?.identifier,
|
4077
|
-
referencedClosures,
|
4078
4078
|
childSection.hoisted || childSection.isHoistThrough ? getSectionInstancesAccessorLiteral(childSection) : void 0
|
4079
4079
|
])
|
4080
4080
|
);
|
4081
|
+
if (childSection.referencedLocalClosures) {
|
4082
|
+
renderer = callRuntime(
|
4083
|
+
"localClosures",
|
4084
|
+
renderer,
|
4085
|
+
import_compiler21.types.objectExpression(
|
4086
|
+
toArray(childSection.referencedLocalClosures, (closure) => {
|
4087
|
+
const expr = getSignalFn(getSignal(childSection, closure));
|
4088
|
+
const key = toPropertyName(getScopeAccessor(closure));
|
4089
|
+
if (import_compiler21.types.isFunction(expr) && import_compiler21.types.isBlockStatement(expr.body)) {
|
4090
|
+
return import_compiler21.types.objectMethod(
|
4091
|
+
"method",
|
4092
|
+
key,
|
4093
|
+
expr.params,
|
4094
|
+
expr.body
|
4095
|
+
);
|
4096
|
+
}
|
4097
|
+
return import_compiler21.types.objectProperty(key, expr);
|
4098
|
+
})
|
4099
|
+
)
|
4100
|
+
);
|
4101
|
+
}
|
4081
4102
|
writeSignals(childSection);
|
4082
4103
|
program.node.body.push(
|
4083
4104
|
import_compiler21.types.variableDeclaration("const", [
|
@@ -4272,7 +4293,7 @@ function createScopeReadPattern(section, referencedBindings) {
|
|
4272
4293
|
const propertyKey = getScopeAccessor(ref);
|
4273
4294
|
const isShorthand = propertyKey === propertyValue;
|
4274
4295
|
let pattern = rootPattern;
|
4275
|
-
if (ref.section !== section) {
|
4296
|
+
if (ref.section !== section && ref.type !== 4 /* local */) {
|
4276
4297
|
if (!nestedPatterns) nestedPatterns = [rootPattern];
|
4277
4298
|
const relativeDepth = rootDepth - ref.section.depth;
|
4278
4299
|
let i = nestedPatterns.length;
|
@@ -4443,7 +4464,7 @@ function trackHoistedReference(referencePath, binding) {
|
|
4443
4464
|
hoistSection,
|
4444
4465
|
hoistedBinding = createBinding(
|
4445
4466
|
generateUid("hoisted_" + referencePath.node.name),
|
4446
|
-
|
4467
|
+
6 /* hoist */,
|
4447
4468
|
hoistSection,
|
4448
4469
|
void 0,
|
4449
4470
|
void 0,
|
@@ -4475,6 +4496,9 @@ function trackReferencesForBinding(babelBinding, binding) {
|
|
4475
4496
|
for (const referencePath of referencePaths) {
|
4476
4497
|
const referenceSection = getOrCreateSection(referencePath);
|
4477
4498
|
if (isSameOrChildSection(binding.section, referenceSection)) {
|
4499
|
+
if (binding.type === 4 /* local */ && referenceSection === binding.section) {
|
4500
|
+
continue;
|
4501
|
+
}
|
4478
4502
|
trackReference(referencePath, binding);
|
4479
4503
|
} else {
|
4480
4504
|
trackHoistedReference(referencePath, binding);
|
@@ -4769,16 +4793,23 @@ function finalizeReferences() {
|
|
4769
4793
|
canonicalUpstreamAlias.closureSections,
|
4770
4794
|
section2
|
4771
4795
|
);
|
4772
|
-
|
4773
|
-
section2.
|
4774
|
-
|
4775
|
-
|
4776
|
-
|
4777
|
-
|
4778
|
-
|
4779
|
-
|
4780
|
-
|
4781
|
-
|
4796
|
+
if (binding.type === 4 /* local */) {
|
4797
|
+
section2.referencedLocalClosures = bindingUtil.add(
|
4798
|
+
section2.referencedLocalClosures,
|
4799
|
+
binding
|
4800
|
+
);
|
4801
|
+
} else {
|
4802
|
+
section2.referencedClosures = bindingUtil.add(
|
4803
|
+
section2.referencedClosures,
|
4804
|
+
binding
|
4805
|
+
);
|
4806
|
+
addOwnersSerializeReason(
|
4807
|
+
section2,
|
4808
|
+
canonicalUpstreamAlias.section,
|
4809
|
+
!!isEffect || canonicalUpstreamAlias.sources,
|
4810
|
+
getAccessorProp().Owner
|
4811
|
+
);
|
4812
|
+
}
|
4782
4813
|
}
|
4783
4814
|
if (isEffect) {
|
4784
4815
|
forEach(
|
@@ -4871,6 +4902,32 @@ function finalizeReferences() {
|
|
4871
4902
|
}
|
4872
4903
|
}
|
4873
4904
|
}
|
4905
|
+
forEach(section.referencedLocalClosures, (closure) => {
|
4906
|
+
if (!isBindingForceSerialized(section, closure)) {
|
4907
|
+
const sourceSection = closure.section;
|
4908
|
+
let serializeReason;
|
4909
|
+
let currentSection = section;
|
4910
|
+
while (currentSection !== sourceSection) {
|
4911
|
+
const upstreamReason = !currentSection.upstreamExpression || getSerializeSourcesForExpr(currentSection.upstreamExpression);
|
4912
|
+
if (upstreamReason === true) {
|
4913
|
+
serializeReason = true;
|
4914
|
+
break;
|
4915
|
+
}
|
4916
|
+
serializeReason = mergeSerializeReasons(
|
4917
|
+
serializeReason,
|
4918
|
+
upstreamReason
|
4919
|
+
);
|
4920
|
+
currentSection = currentSection.parent;
|
4921
|
+
}
|
4922
|
+
addBindingSerializeReason(section, closure, serializeReason);
|
4923
|
+
}
|
4924
|
+
if (closure.sources) {
|
4925
|
+
addSectionSerializeReason(
|
4926
|
+
section,
|
4927
|
+
getBindingSerializeReason(section, closure)
|
4928
|
+
);
|
4929
|
+
}
|
4930
|
+
});
|
4874
4931
|
forEach(section.referencedClosures, (closure) => {
|
4875
4932
|
if (!isBindingForceSerialized(closure.section, closure)) {
|
4876
4933
|
const sourceSection = closure.section;
|
@@ -5187,7 +5244,7 @@ function getReadReplacement(node) {
|
|
5187
5244
|
}
|
5188
5245
|
if (binding) {
|
5189
5246
|
if (node.type === "Identifier") {
|
5190
|
-
if (binding.type ===
|
5247
|
+
if (binding.type === 6 /* hoist */) {
|
5191
5248
|
replacement = node.extra?.[kIsInvoked] ? import_compiler24.types.callExpression(getHoistFunctionIdentifier(binding), [
|
5192
5249
|
getScopeExpression(node.extra.section, binding.section)
|
5193
5250
|
]) : import_compiler24.types.identifier(getScopeAccessor(binding));
|
@@ -5523,7 +5580,7 @@ var const_default = {
|
|
5523
5580
|
if (upstreamAlias) {
|
5524
5581
|
valueExtra.pruned = true;
|
5525
5582
|
}
|
5526
|
-
const binding = trackVarReferences(tag,
|
5583
|
+
const binding = trackVarReferences(tag, 5 /* derived */, upstreamAlias);
|
5527
5584
|
if (binding) {
|
5528
5585
|
if (!valueExtra.nullable) binding.nullable = false;
|
5529
5586
|
setBindingValueExpr(binding, valueExtra);
|
@@ -6617,7 +6674,13 @@ function getOptimizedOnlyChildNodeBinding(tag, section, branchSize = 1) {
|
|
6617
6674
|
// src/translator/core/for.ts
|
6618
6675
|
var for_default = {
|
6619
6676
|
analyze(tag) {
|
6677
|
+
const tagSection = getOrCreateSection(tag);
|
6620
6678
|
const isAttrTag = tag.node.body.attributeTags;
|
6679
|
+
const tagBody = tag.get("body");
|
6680
|
+
const paramsBinding = trackParamsReferences(
|
6681
|
+
tagBody,
|
6682
|
+
isAttrTag ? 4 /* local */ : 3 /* param */
|
6683
|
+
);
|
6621
6684
|
let allowAttrs;
|
6622
6685
|
(0, import_babel_utils25.assertNoVar)(tag);
|
6623
6686
|
(0, import_babel_utils25.assertNoArgs)(tag);
|
@@ -6642,15 +6705,12 @@ var for_default = {
|
|
6642
6705
|
}
|
6643
6706
|
(0, import_babel_utils25.assertAllowedAttributes)(tag, allowAttrs);
|
6644
6707
|
if (isAttrTag) return;
|
6645
|
-
const tagBody = tag.get("body");
|
6646
6708
|
const bodySection = startSection(tagBody);
|
6647
6709
|
if (!bodySection) {
|
6648
6710
|
dropReferences(getAllTagReferenceNodes(tag.node));
|
6649
6711
|
return;
|
6650
6712
|
}
|
6651
|
-
const tagSection = getOrCreateSection(tag);
|
6652
6713
|
const nodeBinding = getOptimizedOnlyChildNodeBinding(tag, tagSection);
|
6653
|
-
const paramsBinding = trackParamsReferences(tagBody, 3 /* param */);
|
6654
6714
|
const tagExtra = mergeReferences(
|
6655
6715
|
tagSection,
|
6656
6716
|
tag.node,
|
@@ -7250,9 +7310,24 @@ function buildContent(body) {
|
|
7250
7310
|
) : void 0
|
7251
7311
|
);
|
7252
7312
|
} else {
|
7253
|
-
return import_compiler34.types.callExpression(
|
7254
|
-
|
7255
|
-
|
7313
|
+
return import_compiler34.types.callExpression(
|
7314
|
+
import_compiler34.types.identifier(bodySection.name),
|
7315
|
+
bodySection.referencedLocalClosures ? [
|
7316
|
+
scopeIdentifier,
|
7317
|
+
import_compiler34.types.objectExpression(
|
7318
|
+
toArray(bodySection.referencedLocalClosures, (ref) => {
|
7319
|
+
const accessor = getScopeAccessor(ref);
|
7320
|
+
const isShorthand = accessor === ref.name;
|
7321
|
+
return import_compiler34.types.objectProperty(
|
7322
|
+
toPropertyName(accessor),
|
7323
|
+
import_compiler34.types.identifier(ref.name),
|
7324
|
+
false,
|
7325
|
+
isShorthand
|
7326
|
+
);
|
7327
|
+
})
|
7328
|
+
)
|
7329
|
+
] : [scopeIdentifier]
|
7330
|
+
);
|
7256
7331
|
}
|
7257
7332
|
}
|
7258
7333
|
}
|
@@ -7273,7 +7348,7 @@ var define_default = {
|
|
7273
7348
|
}
|
7274
7349
|
const tagBody = tag.get("body");
|
7275
7350
|
const bodySection = startSection(tagBody);
|
7276
|
-
const varBinding = trackVarReferences(tag,
|
7351
|
+
const varBinding = trackVarReferences(tag, 5 /* derived */);
|
7277
7352
|
if (bodySection) {
|
7278
7353
|
if (varBinding) {
|
7279
7354
|
bodySection.downstreamBinding = varBinding.propertyAliases.get("content") || varBinding;
|
@@ -8420,7 +8495,7 @@ var id_default = {
|
|
8420
8495
|
if (!import_compiler40.types.isIdentifier(node.var)) {
|
8421
8496
|
throw tag.get("var").buildCodeFrameError("The `id` tag cannot be destructured");
|
8422
8497
|
}
|
8423
|
-
const binding = trackVarReferences(tag,
|
8498
|
+
const binding = trackVarReferences(tag, 5 /* derived */);
|
8424
8499
|
if (binding) {
|
8425
8500
|
setBindingValueExpr(binding, false);
|
8426
8501
|
}
|
@@ -8959,7 +9034,7 @@ var lifecycle_default = {
|
|
8959
9034
|
);
|
8960
9035
|
tagExtra[kRef] = createBinding(
|
8961
9036
|
generateUid("lifecycle"),
|
8962
|
-
|
9037
|
+
5 /* derived */,
|
8963
9038
|
section
|
8964
9039
|
);
|
8965
9040
|
if (node.attributes.length === 0) {
|
@@ -10014,7 +10089,7 @@ var custom_tag_default = {
|
|
10014
10089
|
if (!childFile) {
|
10015
10090
|
throw tag.get("name").buildCodeFrameError("Unable to resolve file for tag.");
|
10016
10091
|
}
|
10017
|
-
const varBinding = trackVarReferences(tag,
|
10092
|
+
const varBinding = trackVarReferences(tag, 5 /* derived */);
|
10018
10093
|
if (varBinding) {
|
10019
10094
|
varBinding.scopeOffset = tagExtra[kChildOffsetScopeBinding] = createBinding("#scopeOffset", 0 /* dom */, section);
|
10020
10095
|
}
|
@@ -10815,7 +10890,7 @@ var dynamic_tag_default = {
|
|
10815
10890
|
tagSection
|
10816
10891
|
);
|
10817
10892
|
if (hasVar) {
|
10818
|
-
trackVarReferences(tag,
|
10893
|
+
trackVarReferences(tag, 5 /* derived */);
|
10819
10894
|
tag.node.var.extra.binding.scopeOffset = tagExtra[kChildOffsetScopeBinding2] = createBinding("#scopeOffset", 0 /* dom */, tagSection);
|
10820
10895
|
}
|
10821
10896
|
startSection(tagBody);
|
@@ -21,6 +21,7 @@ export interface Section {
|
|
21
21
|
prefix: AccessorPrefix;
|
22
22
|
} | undefined;
|
23
23
|
params: undefined | Binding;
|
24
|
+
referencedLocalClosures: ReferencedBindings;
|
24
25
|
referencedClosures: ReferencedBindings;
|
25
26
|
referencedHoists: ReferencedBindings;
|
26
27
|
bindings: ReferencedBindings;
|
@@ -8,7 +8,7 @@ export type Signal = {
|
|
8
8
|
valueAccessor?: t.Expression;
|
9
9
|
referencedBindings: ReferencedBindings;
|
10
10
|
section: Section;
|
11
|
-
build: () => t.Expression;
|
11
|
+
build: undefined | (() => t.Expression);
|
12
12
|
register?: boolean;
|
13
13
|
values: Array<{
|
14
14
|
signal: Signal;
|
@@ -34,6 +34,7 @@ export declare const getHTMLSectionStatements: (section: Section) => t.Statement
|
|
34
34
|
export declare function getHoistFunctionIdentifier(hoistedBinding: Binding): t.Identifier;
|
35
35
|
export declare function getSignal(section: Section, referencedBindings: ReferencedBindings, name?: string): Signal;
|
36
36
|
export declare function initValue(binding: Binding, runtimeHelper?: "value" | "state"): Signal;
|
37
|
+
export declare function getSignalFn(signal: Signal): t.Expression;
|
37
38
|
export declare function subscribe(provider: ReferencedBindings, subscriber: Signal): void;
|
38
39
|
export declare function replaceNullishAndEmptyFunctionsWith0(args: (t.Expression | undefined | false)[]): t.Expression[];
|
39
40
|
export declare function addStatement(type: "render" | "effect", targetSection: Section, referencedBindings: ReferencedBindings, statement: t.Statement | t.Statement[], usedReferences?: ReferencedBindings[] | false): void;
|