marko 6.0.0 → 6.0.2
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 +38 -37
- package/dist/debug/html.mjs +38 -37
- package/dist/html.js +1 -1
- package/dist/html.mjs +1 -1
- package/dist/translator/index.js +110 -70
- package/dist/translator/util/references.d.ts +1 -1
- package/dist/translator/util/sections.d.ts +0 -2
- package/dist/translator/util/serialize-reasons.d.ts +2 -1
- package/dist/translator/util/signals.d.ts +0 -1
- package/package.json +1 -1
package/dist/debug/html.js
CHANGED
@@ -213,44 +213,45 @@ function forTo(to, from, step, cb) {
|
|
213
213
|
// src/html/inlined-runtimes.ts
|
214
214
|
var WALKER_RUNTIME_CODE = true ? (
|
215
215
|
/* js */
|
216
|
-
`((runtimeId) =>
|
217
|
-
(self[runtimeId] =
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
216
|
+
`((runtimeId) => (
|
217
|
+
(self[runtimeId] = (
|
218
|
+
renderId,
|
219
|
+
prefix = runtimeId + renderId,
|
220
|
+
prefixLen = prefix.length,
|
221
|
+
lookup = {},
|
222
|
+
visits = [],
|
223
|
+
doc = document,
|
224
|
+
walker = doc.createTreeWalker(
|
225
|
+
doc,
|
226
|
+
129 /* NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_ELEMENT */,
|
227
|
+
),
|
228
|
+
) =>
|
229
|
+
(self[runtimeId][renderId] = {
|
230
|
+
i: prefix,
|
231
|
+
d: doc,
|
232
|
+
l: lookup,
|
233
|
+
v: visits,
|
234
|
+
x() {},
|
235
|
+
w(node, op, id) {
|
236
|
+
while ((node = walker.nextNode())) {
|
237
|
+
this.x(
|
238
|
+
(op =
|
239
|
+
(op = node.data) &&
|
240
|
+
!op.indexOf(prefix) &&
|
241
|
+
((lookup[(id = op.slice(prefixLen + 1))] = node), op[prefixLen])),
|
242
|
+
id,
|
243
|
+
node,
|
244
|
+
);
|
244
245
|
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
) : `(e=>self[e]=
|
246
|
+
if (op > "#") {
|
247
|
+
visits.push(node);
|
248
|
+
}
|
249
|
+
}
|
250
|
+
},
|
251
|
+
})),
|
252
|
+
self[runtimeId]
|
253
|
+
))`
|
254
|
+
) : `(e=>(self[e]=(l,t=e+l,d=t.length,f={},s=[],x=document,a=x.createTreeWalker(x,129))=>self[e][l]={i:t,d:x,l:f,v:s,x(){},w(e,l,x){for(;e=a.nextNode();)this.x(l=(l=e.data)&&!l.indexOf(t)&&(f[x=l.slice(d+1)]=e,l[d]),x,e),l>"#"&&s.push(e)}},self[e]))`;
|
254
255
|
var REORDER_RUNTIME_CODE = true ? (
|
255
256
|
/* js */
|
256
257
|
`((runtime) => {
|
package/dist/debug/html.mjs
CHANGED
@@ -128,44 +128,45 @@ function forTo(to, from, step, cb) {
|
|
128
128
|
// src/html/inlined-runtimes.ts
|
129
129
|
var WALKER_RUNTIME_CODE = true ? (
|
130
130
|
/* js */
|
131
|
-
`((runtimeId) =>
|
132
|
-
(self[runtimeId] =
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
131
|
+
`((runtimeId) => (
|
132
|
+
(self[runtimeId] = (
|
133
|
+
renderId,
|
134
|
+
prefix = runtimeId + renderId,
|
135
|
+
prefixLen = prefix.length,
|
136
|
+
lookup = {},
|
137
|
+
visits = [],
|
138
|
+
doc = document,
|
139
|
+
walker = doc.createTreeWalker(
|
140
|
+
doc,
|
141
|
+
129 /* NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_ELEMENT */,
|
142
|
+
),
|
143
|
+
) =>
|
144
|
+
(self[runtimeId][renderId] = {
|
145
|
+
i: prefix,
|
146
|
+
d: doc,
|
147
|
+
l: lookup,
|
148
|
+
v: visits,
|
149
|
+
x() {},
|
150
|
+
w(node, op, id) {
|
151
|
+
while ((node = walker.nextNode())) {
|
152
|
+
this.x(
|
153
|
+
(op =
|
154
|
+
(op = node.data) &&
|
155
|
+
!op.indexOf(prefix) &&
|
156
|
+
((lookup[(id = op.slice(prefixLen + 1))] = node), op[prefixLen])),
|
157
|
+
id,
|
158
|
+
node,
|
159
|
+
);
|
159
160
|
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
) : `(e=>self[e]=
|
161
|
+
if (op > "#") {
|
162
|
+
visits.push(node);
|
163
|
+
}
|
164
|
+
}
|
165
|
+
},
|
166
|
+
})),
|
167
|
+
self[runtimeId]
|
168
|
+
))`
|
169
|
+
) : `(e=>(self[e]=(l,t=e+l,d=t.length,f={},s=[],x=document,a=x.createTreeWalker(x,129))=>self[e][l]={i:t,d:x,l:f,v:s,x(){},w(e,l,x){for(;e=a.nextNode();)this.x(l=(l=e.data)&&!l.indexOf(t)&&(f[x=l.slice(d+1)]=e,l[d]),x,e),l>"#"&&s.push(e)}},self[e]))`;
|
169
170
|
var REORDER_RUNTIME_CODE = true ? (
|
170
171
|
/* js */
|
171
172
|
`((runtime) => {
|
package/dist/html.js
CHANGED
@@ -179,7 +179,7 @@ function forTo(to, from, step, cb) {
|
|
179
179
|
}
|
180
180
|
|
181
181
|
// src/html/inlined-runtimes.ts
|
182
|
-
var WALKER_RUNTIME_CODE = '(e=>self[e]=
|
182
|
+
var WALKER_RUNTIME_CODE = '(e=>(self[e]=(l,t=e+l,d=t.length,f={},s=[],x=document,a=x.createTreeWalker(x,129))=>self[e][l]={i:t,d:x,l:f,v:s,x(){},w(e,l,x){for(;e=a.nextNode();)this.x(l=(l=e.data)&&!l.indexOf(t)&&(f[x=l.slice(d+1)]=e,l[d]),x,e),l>"#"&&s.push(e)}},self[e]))', REORDER_RUNTIME_CODE = '(e=>{let i,l,t,r={},c=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(d,o,n,a,g)=>{"#"==d?(r[o]=l).i++:n==t&&i(),"T"==n.tagName&&(o=n.getAttribute(e.i))&&((a=e.l["^"+o])&&(r[o]={i:1,c(i=e.l[o]||n){for(;(t=i.previousSibling||a).remove(),a!=t;);c(i,n)}}),t=n.nextSibling,l=r[o],i=()=>{a||c(e.l[o],n),--l.i||l.c()},(d=e.j[o])&&(g=l.c,l.c=()=>g()+d(e.r)))}})';
|
183
183
|
|
184
184
|
// src/html/serializer.ts
|
185
185
|
var kTouchedIterator = Symbol(), { hasOwnProperty } = {}, Generator = function* () {
|
package/dist/html.mjs
CHANGED
@@ -97,7 +97,7 @@ function forTo(to, from, step, cb) {
|
|
97
97
|
}
|
98
98
|
|
99
99
|
// src/html/inlined-runtimes.ts
|
100
|
-
var WALKER_RUNTIME_CODE = '(e=>self[e]=
|
100
|
+
var WALKER_RUNTIME_CODE = '(e=>(self[e]=(l,t=e+l,d=t.length,f={},s=[],x=document,a=x.createTreeWalker(x,129))=>self[e][l]={i:t,d:x,l:f,v:s,x(){},w(e,l,x){for(;e=a.nextNode();)this.x(l=(l=e.data)&&!l.indexOf(t)&&(f[x=l.slice(d+1)]=e,l[d]),x,e),l>"#"&&s.push(e)}},self[e]))', REORDER_RUNTIME_CODE = '(e=>{let i,l,t,r={},c=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(d,o,n,a,g)=>{"#"==d?(r[o]=l).i++:n==t&&i(),"T"==n.tagName&&(o=n.getAttribute(e.i))&&((a=e.l["^"+o])&&(r[o]={i:1,c(i=e.l[o]||n){for(;(t=i.previousSibling||a).remove(),a!=t;);c(i,n)}}),t=n.nextSibling,l=r[o],i=()=>{a||c(e.l[o],n),--l.i||l.c()},(d=e.j[o])&&(g=l.c,l.c=()=>g()+d(e.r)))}})';
|
101
101
|
|
102
102
|
// src/html/serializer.ts
|
103
103
|
var kTouchedIterator = Symbol(), { hasOwnProperty } = {}, Generator = function* () {
|
package/dist/translator/index.js
CHANGED
@@ -1518,6 +1518,22 @@ var reasonExprs = /* @__PURE__ */ new WeakMap();
|
|
1518
1518
|
var keyedReasonExprs = /* @__PURE__ */ new WeakMap();
|
1519
1519
|
var serializeKeysByBinding = /* @__PURE__ */ new WeakMap();
|
1520
1520
|
var serializeKeyBySourceModifier = {};
|
1521
|
+
function forceOwnersSerialize(from, to, prop) {
|
1522
|
+
let cur = from;
|
1523
|
+
while (cur !== to && cur.parent) {
|
1524
|
+
forceSectionSerialize(cur, prop);
|
1525
|
+
cur = cur.parent;
|
1526
|
+
}
|
1527
|
+
}
|
1528
|
+
function addOwnersSerializeReason(from, to, reason, prop) {
|
1529
|
+
if (reason) {
|
1530
|
+
let cur = from;
|
1531
|
+
while (cur !== to && cur.parent) {
|
1532
|
+
addSectionSerializeReason(cur, reason, prop);
|
1533
|
+
cur = cur.parent;
|
1534
|
+
}
|
1535
|
+
}
|
1536
|
+
}
|
1521
1537
|
function forceSectionSerialize(section, prop) {
|
1522
1538
|
if (prop) {
|
1523
1539
|
forceSerializeKey(section, getSectionPropSerializeReasonKey(section, prop));
|
@@ -1961,7 +1977,6 @@ function startSection(path5) {
|
|
1961
1977
|
bindings: void 0,
|
1962
1978
|
hoisted: void 0,
|
1963
1979
|
isHoistThrough: void 0,
|
1964
|
-
assignments: void 0,
|
1965
1980
|
serializeReason: void 0,
|
1966
1981
|
serializeReasons: /* @__PURE__ */ new Map(),
|
1967
1982
|
content: getContentInfo(path5),
|
@@ -2105,9 +2120,6 @@ var isSerializedSection = (section) => {
|
|
2105
2120
|
}
|
2106
2121
|
return true;
|
2107
2122
|
};
|
2108
|
-
function isSectionWithHoists(section) {
|
2109
|
-
return !!(section.hoisted || section.isHoistThrough || section.referencedHoists);
|
2110
|
-
}
|
2111
2123
|
function isImmediateOwner(section, binding) {
|
2112
2124
|
return section.parent?.id === binding.section.id;
|
2113
2125
|
}
|
@@ -2811,7 +2823,7 @@ var return_default = {
|
|
2811
2823
|
}
|
2812
2824
|
if (attrs2.valueChange) {
|
2813
2825
|
forceSectionSerialize(
|
2814
|
-
|
2826
|
+
getOrCreateSection(tag),
|
2815
2827
|
getAccessorProp().TagVariableChange
|
2816
2828
|
);
|
2817
2829
|
}
|
@@ -3588,12 +3600,8 @@ function writeHTMLResumeStatements(path5) {
|
|
3588
3600
|
const body = path5.node.body;
|
3589
3601
|
const allSignals = Array.from(getSignals(section).values());
|
3590
3602
|
const scopeIdIdentifier = getScopeIdIdentifier(section);
|
3591
|
-
const serializeOwnersUntilBinding = (binding) => serializeOwners(section, binding.section);
|
3592
|
-
forEach(section.assignments, serializeOwnersUntilBinding);
|
3593
|
-
forEach(section.referencedHoists, serializeOwnersUntilBinding);
|
3594
3603
|
forEach(section.referencedClosures, (closure) => {
|
3595
3604
|
if (closure.sources) {
|
3596
|
-
serializeOwnersUntilBinding(closure);
|
3597
3605
|
if (isDynamicClosure(section, closure)) {
|
3598
3606
|
const closureSignal = getSignal(closure.section, closure);
|
3599
3607
|
let identifier = htmlDynamicClosureInstancesIdentifier.get(closureSignal);
|
@@ -3722,6 +3730,23 @@ function writeHTMLResumeStatements(path5) {
|
|
3722
3730
|
)
|
3723
3731
|
);
|
3724
3732
|
});
|
3733
|
+
if (section.parent) {
|
3734
|
+
const ownerAccessor = getAccessorProp().Owner;
|
3735
|
+
const ownerReason = getSectionSerializeReason(section, ownerAccessor);
|
3736
|
+
if (ownerReason) {
|
3737
|
+
const getOwnerExpr = callRuntime(
|
3738
|
+
"ensureScopeWithId",
|
3739
|
+
getScopeIdIdentifier(section.parent)
|
3740
|
+
);
|
3741
|
+
serializedLookup.delete(ownerAccessor);
|
3742
|
+
serializedProperties.push(
|
3743
|
+
toObjectProperty(
|
3744
|
+
ownerAccessor,
|
3745
|
+
sectionSerializeReason && (sectionSerializeReason === ownerReason || sectionSerializeReason !== true && ownerReason !== true && compareSerializeReasons(sectionSerializeReason, ownerReason) === 0) ? getOwnerExpr : getExprIfSerialized(ownerReason, getOwnerExpr)
|
3746
|
+
)
|
3747
|
+
);
|
3748
|
+
}
|
3749
|
+
}
|
3725
3750
|
for (const [key, { expression, reason }] of serializedLookup) {
|
3726
3751
|
serializedProperties.push(
|
3727
3752
|
toObjectProperty(key, getExprIfSerialized(reason, expression))
|
@@ -3806,23 +3831,6 @@ function writeHTMLResumeStatements(path5) {
|
|
3806
3831
|
body.push(import_compiler20.types.returnStatement(returnIdentifier));
|
3807
3832
|
}
|
3808
3833
|
}
|
3809
|
-
function serializeOwners(from, to) {
|
3810
|
-
const ownerProp = getAccessorProp().Owner;
|
3811
|
-
let cur = from;
|
3812
|
-
while (cur !== to) {
|
3813
|
-
const parent = cur.parent;
|
3814
|
-
if (!parent) break;
|
3815
|
-
const serialized = getSerializedAccessors(cur);
|
3816
|
-
nonAnalyzedForceSerializedSection.add(cur);
|
3817
|
-
cur = parent;
|
3818
|
-
if (!serialized.has(ownerProp)) {
|
3819
|
-
serialized.set(ownerProp, {
|
3820
|
-
expression: callRuntime("ensureScopeWithId", getScopeIdIdentifier(cur)),
|
3821
|
-
reason: true
|
3822
|
-
});
|
3823
|
-
}
|
3824
|
-
}
|
3825
|
-
}
|
3826
3834
|
function getSetup(section) {
|
3827
3835
|
return getSignals(section).get(void 0)?.identifier;
|
3828
3836
|
}
|
@@ -4321,6 +4329,7 @@ function createBinding(name2, type, section, upstreamAlias, property, loc = null
|
|
4321
4329
|
property,
|
4322
4330
|
declared,
|
4323
4331
|
closureSections: void 0,
|
4332
|
+
assignmentSections: void 0,
|
4324
4333
|
excludeProperties: void 0,
|
4325
4334
|
serializeSources: void 0,
|
4326
4335
|
sources: void 0,
|
@@ -4418,7 +4427,6 @@ function trackHoistedReference(referencePath, binding) {
|
|
4418
4427
|
currentSection = currentSection.parent;
|
4419
4428
|
}
|
4420
4429
|
}
|
4421
|
-
extra.hoistedBinding = hoistedBinding;
|
4422
4430
|
if (isInvokedFunction(referencePath)) {
|
4423
4431
|
extra.read = createRead(hoistedBinding, void 0);
|
4424
4432
|
extra.section = referenceSection;
|
@@ -4461,7 +4469,10 @@ function trackAssignment(assignment, binding) {
|
|
4461
4469
|
forEachIdentifier(assignment.node, (id) => {
|
4462
4470
|
if (id.name === binding.name) {
|
4463
4471
|
const extra = id.extra ??= {};
|
4464
|
-
|
4472
|
+
binding.assignmentSections = sectionUtil.add(
|
4473
|
+
binding.assignmentSections,
|
4474
|
+
section
|
4475
|
+
);
|
4465
4476
|
extra.assignment = binding;
|
4466
4477
|
extra.section = section;
|
4467
4478
|
}
|
@@ -4707,6 +4718,10 @@ function finalizeReferences() {
|
|
4707
4718
|
if (binding.hoists.size) {
|
4708
4719
|
forceBindingSerialize(binding.section, binding);
|
4709
4720
|
}
|
4721
|
+
forEach(
|
4722
|
+
binding.assignmentSections,
|
4723
|
+
(assignedSection) => forceOwnersSerialize(assignedSection, section, getAccessorProp().Owner)
|
4724
|
+
);
|
4710
4725
|
if (find(section.bindings, ({ name: name3 }) => name3 === binding.name)) {
|
4711
4726
|
binding.name = generateUid(name2);
|
4712
4727
|
}
|
@@ -4726,6 +4741,12 @@ function finalizeReferences() {
|
|
4726
4741
|
section2.referencedClosures,
|
4727
4742
|
binding
|
4728
4743
|
);
|
4744
|
+
addOwnersSerializeReason(
|
4745
|
+
section2,
|
4746
|
+
binding.section,
|
4747
|
+
binding.serializeSources,
|
4748
|
+
getAccessorProp().Owner
|
4749
|
+
);
|
4729
4750
|
}
|
4730
4751
|
if (isEffect) {
|
4731
4752
|
forEach(
|
@@ -4736,9 +4757,16 @@ function finalizeReferences() {
|
|
4736
4757
|
}
|
4737
4758
|
}
|
4738
4759
|
forEachSection((section) => {
|
4739
|
-
if (
|
4760
|
+
if (section.isHoistThrough) {
|
4740
4761
|
forceSectionSerialize(section);
|
4741
4762
|
}
|
4763
|
+
forEach(section.referencedHoists, (hoistedBinding) => {
|
4764
|
+
forceOwnersSerialize(
|
4765
|
+
section,
|
4766
|
+
hoistedBinding.section,
|
4767
|
+
getAccessorProp().Owner
|
4768
|
+
);
|
4769
|
+
});
|
4742
4770
|
if (section.parent && section.isBranch && section.sectionAccessor && section.upstreamExpression) {
|
4743
4771
|
addSectionSerializeReasonRef(section, getDirectClosures(section));
|
4744
4772
|
addSectionSerializeReasonExpr(section, section.upstreamExpression);
|
@@ -5756,22 +5784,27 @@ var native_tag_default = {
|
|
5756
5784
|
);
|
5757
5785
|
}
|
5758
5786
|
if (node.var) {
|
5759
|
-
forceSectionSerialize(tagSection);
|
5760
5787
|
forceBindingSerialize(tagSection, nodeBinding);
|
5761
|
-
const
|
5762
|
-
|
5763
|
-
|
5764
|
-
|
5765
|
-
|
5788
|
+
for (const ref of tag.scope.getBinding(node.var.name).referencePaths) {
|
5789
|
+
const refSection = getOrCreateSection(ref);
|
5790
|
+
setReferencesScope(ref);
|
5791
|
+
if (isSameOrChildSection(tagSection, refSection)) {
|
5792
|
+
forceOwnersSerialize(
|
5793
|
+
refSection,
|
5794
|
+
tagSection,
|
5795
|
+
getAccessorProp().Owner
|
5796
|
+
);
|
5797
|
+
if (!isInvokedFunction(ref)) {
|
5798
|
+
tagExtra[kGetterId] ||= getRegisterUID(
|
5799
|
+
tagSection,
|
5800
|
+
nodeBinding.name
|
5801
|
+
);
|
5802
|
+
}
|
5803
|
+
} else {
|
5766
5804
|
trackHoistedReference(
|
5767
|
-
|
5805
|
+
ref,
|
5768
5806
|
nodeBinding
|
5769
5807
|
);
|
5770
|
-
} else if (!isInvokedFunction(referencePath)) {
|
5771
|
-
tagExtra[kGetterId] ||= getRegisterUID(
|
5772
|
-
tagSection,
|
5773
|
-
nodeBinding.name
|
5774
|
-
);
|
5775
5808
|
}
|
5776
5809
|
}
|
5777
5810
|
} else if (hasEventHandlers || spreadReferenceNodes) {
|
@@ -5804,12 +5837,6 @@ var native_tag_default = {
|
|
5804
5837
|
const varBinding = tag.scope.getBinding(varName);
|
5805
5838
|
const getterId = tagExtra[kGetterId];
|
5806
5839
|
if (isHTML) {
|
5807
|
-
for (const reference of varBinding.referencePaths) {
|
5808
|
-
const referenceSection = getSection(reference);
|
5809
|
-
if (!reference.node.extra?.hoist) {
|
5810
|
-
serializeOwners(referenceSection, tagSection);
|
5811
|
-
}
|
5812
|
-
}
|
5813
5840
|
translateVar(
|
5814
5841
|
tag,
|
5815
5842
|
callRuntime(
|
@@ -5838,8 +5865,8 @@ var native_tag_default = {
|
|
5838
5865
|
);
|
5839
5866
|
}
|
5840
5867
|
for (const reference of varBinding.referencePaths) {
|
5841
|
-
|
5842
|
-
|
5868
|
+
const referenceSection = getSection(reference);
|
5869
|
+
if (isSameOrChildSection(tagSection, referenceSection)) {
|
5843
5870
|
if (isInvokedFunction(reference)) {
|
5844
5871
|
reference.parentPath.replaceWith(
|
5845
5872
|
import_compiler31.types.expressionStatement(
|
@@ -6958,20 +6985,22 @@ var define_default = {
|
|
6958
6985
|
}
|
6959
6986
|
const tagBody = tag.get("body");
|
6960
6987
|
const bodySection = startSection(tagBody);
|
6961
|
-
trackVarReferences(tag, 4 /* derived */);
|
6988
|
+
const varBinding = trackVarReferences(tag, 4 /* derived */);
|
6962
6989
|
if (bodySection) {
|
6963
|
-
const varBinding = tag.node.var?.extra?.binding;
|
6964
6990
|
if (varBinding) {
|
6965
6991
|
bodySection.downstreamBinding = varBinding.propertyAliases.get("content") || varBinding;
|
6966
6992
|
}
|
6967
6993
|
}
|
6968
6994
|
trackParamsReferences(tagBody, 3 /* param */);
|
6969
6995
|
analyzeAttributeTags(tag);
|
6970
|
-
mergeReferences(
|
6996
|
+
const tagExtra = mergeReferences(
|
6971
6997
|
getOrCreateSection(tag),
|
6972
6998
|
tag.node,
|
6973
6999
|
getAllTagReferenceNodes(tag.node)
|
6974
7000
|
);
|
7001
|
+
if (varBinding) {
|
7002
|
+
setBindingValueExpr(varBinding, tagExtra);
|
7003
|
+
}
|
6975
7004
|
},
|
6976
7005
|
translate: {
|
6977
7006
|
enter(tag) {
|
@@ -7345,9 +7374,19 @@ var html_script_default = {
|
|
7345
7374
|
if (node.var) {
|
7346
7375
|
forceBindingSerialize(tagSection, nodeBinding);
|
7347
7376
|
for (const ref of tag.scope.getBinding(node.var.name).referencePaths) {
|
7348
|
-
|
7349
|
-
|
7350
|
-
|
7377
|
+
const refSection = getOrCreateSection(ref);
|
7378
|
+
setReferencesScope(ref);
|
7379
|
+
if (isSameOrChildSection(tagSection, refSection)) {
|
7380
|
+
forceOwnersSerialize(
|
7381
|
+
refSection,
|
7382
|
+
tagSection,
|
7383
|
+
getAccessorProp().Owner
|
7384
|
+
);
|
7385
|
+
if (!tagExtra[kGetterId3] && !isInvokedFunction(ref)) {
|
7386
|
+
tagExtra[kGetterId3] = getRegisterUID(tagSection, "#script");
|
7387
|
+
}
|
7388
|
+
} else {
|
7389
|
+
trackHoistedReference(ref, nodeBinding);
|
7351
7390
|
}
|
7352
7391
|
}
|
7353
7392
|
} else if (hasEventHandlers || spreadReferenceNodes) {
|
@@ -7372,11 +7411,6 @@ var html_script_default = {
|
|
7372
7411
|
if (hasVar) {
|
7373
7412
|
const getterId = tagExtra[kGetterId3];
|
7374
7413
|
if (isHTML) {
|
7375
|
-
const varName = tag.node.var.name;
|
7376
|
-
const references = tag.scope.getBinding(varName).referencePaths;
|
7377
|
-
for (const reference of references) {
|
7378
|
-
serializeOwners(getSection(reference), tagSection);
|
7379
|
-
}
|
7380
7414
|
translateVar(
|
7381
7415
|
tag,
|
7382
7416
|
callRuntime(
|
@@ -7752,9 +7786,19 @@ var html_style_default = {
|
|
7752
7786
|
if (node.var) {
|
7753
7787
|
forceBindingSerialize(tagSection, nodeBinding);
|
7754
7788
|
for (const ref of tag.scope.getBinding(node.var.name).referencePaths) {
|
7755
|
-
|
7756
|
-
|
7757
|
-
|
7789
|
+
const refSection = getOrCreateSection(ref);
|
7790
|
+
setReferencesScope(ref);
|
7791
|
+
if (isSameOrChildSection(tagSection, refSection)) {
|
7792
|
+
forceOwnersSerialize(
|
7793
|
+
refSection,
|
7794
|
+
tagSection,
|
7795
|
+
getAccessorProp().Owner
|
7796
|
+
);
|
7797
|
+
if (!tagExtra[kGetterId4] && !isInvokedFunction(ref)) {
|
7798
|
+
tagExtra[kGetterId4] = getRegisterUID(tagSection, "#style");
|
7799
|
+
}
|
7800
|
+
} else {
|
7801
|
+
trackHoistedReference(ref, nodeBinding);
|
7758
7802
|
}
|
7759
7803
|
}
|
7760
7804
|
} else if (hasEventHandlers || spreadReferenceNodes) {
|
@@ -7779,11 +7823,6 @@ var html_style_default = {
|
|
7779
7823
|
if (hasVar) {
|
7780
7824
|
const getterId = tagExtra[kGetterId4];
|
7781
7825
|
if (isHTML) {
|
7782
|
-
const varName = tag.node.var.name;
|
7783
|
-
const references = tag.scope.getBinding(varName).referencePaths;
|
7784
|
-
for (const reference of references) {
|
7785
|
-
serializeOwners(getSection(reference), tagSection);
|
7786
|
-
}
|
7787
7826
|
translateVar(
|
7788
7827
|
tag,
|
7789
7828
|
callRuntime(
|
@@ -8543,17 +8582,18 @@ var let_default = {
|
|
8543
8582
|
"The `let` tag `valueChange` attribute must be a function."
|
8544
8583
|
);
|
8545
8584
|
}
|
8585
|
+
const tagSection = getOrCreateSection(tag);
|
8546
8586
|
const binding = trackVarReferences(tag, 1 /* let */);
|
8547
8587
|
setBindingValueExpr(
|
8548
8588
|
binding,
|
8549
|
-
mergeReferences(
|
8589
|
+
mergeReferences(tagSection, tag.node, [
|
8550
8590
|
valueAttr?.value,
|
8551
8591
|
valueChangeAttr?.value
|
8552
8592
|
])
|
8553
8593
|
);
|
8554
8594
|
if (valueChangeAttr) {
|
8555
8595
|
forceBindingSerialize(
|
8556
|
-
|
8596
|
+
tagSection,
|
8557
8597
|
binding,
|
8558
8598
|
getAccessorPrefix().TagVariableChange
|
8559
8599
|
);
|
@@ -21,6 +21,7 @@ export interface Binding {
|
|
21
21
|
loc: t.SourceLocation | null;
|
22
22
|
section: Section;
|
23
23
|
closureSections: Opt<Section>;
|
24
|
+
assignmentSections: Opt<Section>;
|
24
25
|
sources: Opt<Binding>;
|
25
26
|
serializeSources: undefined | SerializeReason;
|
26
27
|
aliases: Set<Binding>;
|
@@ -45,7 +46,6 @@ declare module "@marko/compiler/dist/types" {
|
|
45
46
|
section?: Section;
|
46
47
|
referencedBindings?: ReferencedBindings;
|
47
48
|
binding?: Binding;
|
48
|
-
hoistedBinding?: Binding;
|
49
49
|
assignment?: Binding;
|
50
50
|
read?: {
|
51
51
|
binding: Binding;
|
@@ -28,7 +28,6 @@ export interface Section {
|
|
28
28
|
serializeReason: undefined | SerializeReason;
|
29
29
|
serializeReasons: Map<symbol, SerializeReason>;
|
30
30
|
isHoistThrough: true | undefined;
|
31
|
-
assignments: ReferencedBindings;
|
32
31
|
upstreamExpression: t.NodeExtra | undefined;
|
33
32
|
downstreamBinding: Binding | undefined;
|
34
33
|
hasAbortSignal: boolean;
|
@@ -53,7 +52,6 @@ export declare function startSection(path: t.NodePath<t.MarkoTagBody | t.Program
|
|
53
52
|
export declare function getOrCreateSection(path: t.NodePath<any>): Section;
|
54
53
|
export declare function getSectionForBody(body: t.NodePath<t.MarkoTagBody | t.Program>): Section | undefined;
|
55
54
|
export declare function getSection(path: t.NodePath): Section;
|
56
|
-
export declare function getParentSection(path: t.NodePath): Section;
|
57
55
|
export declare const getScopeIdIdentifier: (section: Section) => t.Identifier;
|
58
56
|
export declare const getSectionParentIsOwner: (section: Section) => boolean, setSectionParentIsOwner: (section: Section, value: boolean) => void;
|
59
57
|
export declare const getScopeIdentifier: (section: Section, ignoreDefault?: boolean) => t.Identifier;
|
@@ -12,7 +12,8 @@ export type SerializeReason = true | DynamicSerializeReason;
|
|
12
12
|
export type SerializeKey = symbol & {
|
13
13
|
__serialize_key__: 1;
|
14
14
|
};
|
15
|
-
export declare function
|
15
|
+
export declare function forceOwnersSerialize(from: Section, to: Section, prop?: AccessorProp | symbol): void;
|
16
|
+
export declare function addOwnersSerializeReason(from: Section, to: Section, reason: undefined | boolean | SerializeReason, prop?: AccessorProp | symbol): void;
|
16
17
|
export declare function forceSectionSerialize(section: Section, prop?: AccessorProp | symbol): void;
|
17
18
|
export declare function forceBindingSerialize(section: Section, binding: Binding, prefix?: AccessorPrefix | symbol): void;
|
18
19
|
export declare function isSectionForceSerialized(section: Section, prop?: AccessorProp | symbol): boolean;
|
@@ -56,7 +56,6 @@ export declare function writeSignals(section: Section): void;
|
|
56
56
|
export declare function writeRegisteredFns(): void;
|
57
57
|
export declare function addHTMLEffectCall(section: Section, referencedBindings?: ReferencedBindings): void;
|
58
58
|
export declare function writeHTMLResumeStatements(path: t.NodePath<t.MarkoTagBody | t.Program>): void;
|
59
|
-
export declare function serializeOwners(from: Section, to?: Section): void;
|
60
59
|
export declare function getSetup(section: Section): t.Identifier | undefined;
|
61
60
|
export declare function replaceRegisteredFunctionNode(node: t.Node): t.CallExpression | t.ClassPrivateProperty | t.ClassProperty | t.VariableDeclaration | t.Identifier | t.ObjectProperty | undefined;
|
62
61
|
export {};
|