marko 6.1.22 → 6.1.23
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
|
@@ -1757,6 +1757,7 @@ function isClientAssetImport(file, request) {
|
|
|
1757
1757
|
const kDirectContent = Symbol("direct content");
|
|
1758
1758
|
function getBindingPropTree(binding) {
|
|
1759
1759
|
if (pruneBinding(binding)) return;
|
|
1760
|
+
binding.exposed = true;
|
|
1760
1761
|
const props = {
|
|
1761
1762
|
binding,
|
|
1762
1763
|
props: void 0,
|
|
@@ -3007,6 +3008,7 @@ function initValue(binding, isLet = false) {
|
|
|
3007
3008
|
const section = binding.section;
|
|
3008
3009
|
const signal = getSignal(section, binding);
|
|
3009
3010
|
signal.build = () => {
|
|
3011
|
+
if (isPureMemberForwarder(binding)) return;
|
|
3010
3012
|
const fn = getSignalFn(signal);
|
|
3011
3013
|
if (binding.upstreamAlias && binding.property === void 0 && binding.excludeProperties === void 0 || !signal.hasSideEffect || !signalHasStatements(signal)) return fn;
|
|
3012
3014
|
return callRuntime(isLet ? signal.extraArgs ? "_let_change" : "_let" : "_const", getScopeAccessorLiteral(binding, true, isLet), fn);
|
|
@@ -3023,6 +3025,23 @@ function signalHasStatements(signal) {
|
|
|
3023
3025
|
} else if (signal.section.referencedClosures) return true;
|
|
3024
3026
|
return false;
|
|
3025
3027
|
}
|
|
3028
|
+
function isPureMemberForwarder(binding) {
|
|
3029
|
+
if (binding.property === void 0 || binding.reads.size || binding.exposed || binding.aliases.size || binding.assignmentSections || getSerializeReason(binding.section, binding) || getSignal(binding.section, binding).hasSideEffect) return false;
|
|
3030
|
+
for (const alias of binding.propertyAliases.values()) if (alias.type !== 6) return true;
|
|
3031
|
+
return false;
|
|
3032
|
+
}
|
|
3033
|
+
function pushMemberForwards(renderStatements, value, alias) {
|
|
3034
|
+
if (isPureMemberForwarder(alias)) {
|
|
3035
|
+
for (const [key, child] of alias.propertyAliases) if (child.type !== 6) pushMemberForwards(renderStatements, toMemberExpression(_marko_compiler.types.cloneNode(value, true), key, alias.nullable), child);
|
|
3036
|
+
} else {
|
|
3037
|
+
const aliasSignal = getSignal(alias.section, alias);
|
|
3038
|
+
renderStatements.push(_marko_compiler.types.expressionStatement(_marko_compiler.types.callExpression(aliasSignal.identifier, [
|
|
3039
|
+
scopeIdentifier,
|
|
3040
|
+
value,
|
|
3041
|
+
...getTranslatedExtraArgs(aliasSignal)
|
|
3042
|
+
])));
|
|
3043
|
+
}
|
|
3044
|
+
}
|
|
3026
3045
|
function getSignalFn(signal) {
|
|
3027
3046
|
const section = signal.section;
|
|
3028
3047
|
const binding = signal.referencedBindings;
|
|
@@ -3056,14 +3075,7 @@ function getSignalFn(signal) {
|
|
|
3056
3075
|
...getTranslatedExtraArgs(aliasSignal)
|
|
3057
3076
|
])));
|
|
3058
3077
|
}
|
|
3059
|
-
for (const [key, alias] of binding.propertyAliases) if (alias.type !== 6)
|
|
3060
|
-
const aliasSignal = getSignal(alias.section, alias);
|
|
3061
|
-
signal.render.push(_marko_compiler.types.expressionStatement(_marko_compiler.types.callExpression(aliasSignal.identifier, [
|
|
3062
|
-
scopeIdentifier,
|
|
3063
|
-
toMemberExpression(createScopeReadExpression(binding), key, binding.nullable),
|
|
3064
|
-
...getTranslatedExtraArgs(aliasSignal)
|
|
3065
|
-
])));
|
|
3066
|
-
}
|
|
3078
|
+
for (const [key, alias] of binding.propertyAliases) if (alias.type !== 6) pushMemberForwards(signal.render, toMemberExpression(createScopeReadExpression(binding), key, binding.nullable), alias);
|
|
3067
3079
|
if (assertsHoists) signal.render.push(_marko_compiler.types.expressionStatement(callRuntime("_assert_hoist", createScopeReadExpression(binding))));
|
|
3068
3080
|
}
|
|
3069
3081
|
for (const value of signal.values) if (signalHasStatements(value.signal)) signal.render.push(_marko_compiler.types.expressionStatement(_marko_compiler.types.callExpression(value.signal.identifier, [
|
|
@@ -6274,7 +6286,8 @@ function createBinding(name, type, refSection, upstreamAlias, property, excludeP
|
|
|
6274
6286
|
export: void 0,
|
|
6275
6287
|
directContentExport: void 0,
|
|
6276
6288
|
nullable: !sameSection || excludeProperties === void 0,
|
|
6277
|
-
pruned: void 0
|
|
6289
|
+
pruned: void 0,
|
|
6290
|
+
exposed: false
|
|
6278
6291
|
};
|
|
6279
6292
|
if (property) {
|
|
6280
6293
|
if (declared) upstreamAlias.nullable = false;
|