marko 6.0.0-next.3.59 → 6.0.0-next.3.61
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/common/accessor.d.ts +24 -0
- package/dist/common/accessor.debug.d.ts +24 -0
- package/dist/common/types.d.ts +2 -17
- package/dist/debug/dom.js +348 -183
- package/dist/debug/dom.mjs +348 -183
- package/dist/debug/html.js +123 -44
- package/dist/debug/html.mjs +123 -44
- package/dist/dom/control-flow.d.ts +5 -0
- package/dist/dom/queue.d.ts +2 -1
- package/dist/dom/scope.d.ts +1 -0
- package/dist/dom.d.ts +2 -2
- package/dist/dom.js +282 -159
- package/dist/dom.mjs +282 -159
- package/dist/html/dynamic-tag.d.ts +3 -4
- package/dist/html/serializer.d.ts +2 -1
- package/dist/html/writer.d.ts +2 -3
- package/dist/html.js +107 -39
- package/dist/html.mjs +107 -39
- package/dist/translator/core/await.d.ts +7 -0
- package/dist/translator/core/try.d.ts +7 -0
- package/dist/translator/index.js +222 -43
- package/dist/translator/util/get-accessor-char.d.ts +4 -0
- package/dist/translator/util/sections.d.ts +1 -1
- package/package.json +1 -1
package/dist/translator/index.js
CHANGED
@@ -112,6 +112,34 @@ var attrs_default = {
|
|
112
112
|
var import_compiler23 = require("@marko/compiler");
|
113
113
|
var import_babel_utils12 = require("@marko/compiler/babel-utils");
|
114
114
|
|
115
|
+
// src/common/accessor.debug.ts
|
116
|
+
var AccessorPrefix = /* @__PURE__ */ ((AccessorPrefix3) => {
|
117
|
+
AccessorPrefix3["ClosureScopes"] = "ClosureScopes:";
|
118
|
+
AccessorPrefix3["ClosureSignalIndex"] = "ClosureSignalIndex:";
|
119
|
+
AccessorPrefix3["ConditionalRenderer"] = "ConditionalRenderer:";
|
120
|
+
AccessorPrefix3["ConditionalScope"] = "ConditionalScope:";
|
121
|
+
AccessorPrefix3["ControlledHandler"] = "ControlledHandler:";
|
122
|
+
AccessorPrefix3["ControlledType"] = "ControlledType:";
|
123
|
+
AccessorPrefix3["ControlledValue"] = "ControlledValue:";
|
124
|
+
AccessorPrefix3["DynamicPlaceholderLastChild"] = "DynamicPlaceholderLastChild:";
|
125
|
+
AccessorPrefix3["EventAttributes"] = "EventAttributes:";
|
126
|
+
AccessorPrefix3["Getter"] = "Getter:";
|
127
|
+
AccessorPrefix3["LifecycleAbortController"] = "LifecycleAbortController:";
|
128
|
+
AccessorPrefix3["LoopScopeArray"] = "LoopScopeArray:";
|
129
|
+
AccessorPrefix3["LoopScopeMap"] = "LoopScopeMap:";
|
130
|
+
AccessorPrefix3["Promise"] = "Promise:";
|
131
|
+
return AccessorPrefix3;
|
132
|
+
})(AccessorPrefix || {});
|
133
|
+
var AccessorProp = /* @__PURE__ */ ((AccessorProp3) => {
|
134
|
+
AccessorProp3["BranchAccessor"] = "*BranchAccessor";
|
135
|
+
AccessorProp3["CatchContent"] = "^CatchContent";
|
136
|
+
AccessorProp3["PlaceholderBranch"] = "#PlaceholderBranch";
|
137
|
+
AccessorProp3["PlaceholderContent"] = "%PlaceholderContent";
|
138
|
+
AccessorProp3["TagVariable"] = "/TagVariable";
|
139
|
+
AccessorProp3["TagVariableChange"] = "@TagVariableChange";
|
140
|
+
return AccessorProp3;
|
141
|
+
})(AccessorProp || {});
|
142
|
+
|
115
143
|
// src/translator/util/evaluate.ts
|
116
144
|
var import_babel_utils2 = require("@marko/compiler/babel-utils");
|
117
145
|
function evaluate(value) {
|
@@ -649,8 +677,10 @@ function toMemberExpression(object, key, optional) {
|
|
649
677
|
|
650
678
|
// src/translator/util/runtime.ts
|
651
679
|
var pureFunctions = [
|
680
|
+
"awaitTag",
|
652
681
|
"conditional",
|
653
682
|
"conditionalClosure",
|
683
|
+
"createTry",
|
654
684
|
"dynamicTag",
|
655
685
|
"createRenderer",
|
656
686
|
"createContent",
|
@@ -1263,6 +1293,8 @@ function getNodeContentType(path5, extraMember, contentInfo) {
|
|
1263
1293
|
return 3 /* Tag */;
|
1264
1294
|
case "for":
|
1265
1295
|
case "if":
|
1296
|
+
case "await":
|
1297
|
+
case "try":
|
1266
1298
|
return 1 /* Dynamic */;
|
1267
1299
|
default:
|
1268
1300
|
return null;
|
@@ -1393,6 +1425,42 @@ var import_babel_utils9 = require("@marko/compiler/babel-utils");
|
|
1393
1425
|
var import_compiler11 = require("@marko/compiler");
|
1394
1426
|
var import_babel_utils8 = require("@marko/compiler/babel-utils");
|
1395
1427
|
|
1428
|
+
// src/common/accessor.ts
|
1429
|
+
var AccessorPrefix2 = /* @__PURE__ */ ((AccessorPrefix3) => {
|
1430
|
+
AccessorPrefix3["ClosureScopes"] = "a";
|
1431
|
+
AccessorPrefix3["ClosureSignalIndex"] = "b";
|
1432
|
+
AccessorPrefix3["ConditionalRenderer"] = "c";
|
1433
|
+
AccessorPrefix3["ConditionalScope"] = "d";
|
1434
|
+
AccessorPrefix3["ControlledHandler"] = "e";
|
1435
|
+
AccessorPrefix3["ControlledType"] = "f";
|
1436
|
+
AccessorPrefix3["ControlledValue"] = "g";
|
1437
|
+
AccessorPrefix3["DynamicPlaceholderLastChild"] = "h";
|
1438
|
+
AccessorPrefix3["EventAttributes"] = "i";
|
1439
|
+
AccessorPrefix3["Getter"] = "j";
|
1440
|
+
AccessorPrefix3["LifecycleAbortController"] = "k";
|
1441
|
+
AccessorPrefix3["LoopScopeArray"] = "l";
|
1442
|
+
AccessorPrefix3["LoopScopeMap"] = "m";
|
1443
|
+
AccessorPrefix3["Promise"] = "n";
|
1444
|
+
return AccessorPrefix3;
|
1445
|
+
})(AccessorPrefix2 || {});
|
1446
|
+
var AccessorProp2 = /* @__PURE__ */ ((AccessorProp3) => {
|
1447
|
+
AccessorProp3["BranchAccessor"] = "*";
|
1448
|
+
AccessorProp3["CatchContent"] = "^";
|
1449
|
+
AccessorProp3["PlaceholderBranch"] = "#";
|
1450
|
+
AccessorProp3["PlaceholderContent"] = "%";
|
1451
|
+
AccessorProp3["TagVariable"] = "/";
|
1452
|
+
AccessorProp3["TagVariableChange"] = "@";
|
1453
|
+
return AccessorProp3;
|
1454
|
+
})(AccessorProp2 || {});
|
1455
|
+
|
1456
|
+
// src/translator/util/get-accessor-char.ts
|
1457
|
+
function getAccessorPrefix() {
|
1458
|
+
return isOptimize() ? AccessorPrefix2 : AccessorPrefix;
|
1459
|
+
}
|
1460
|
+
function getAccessorProp() {
|
1461
|
+
return isOptimize() ? AccessorProp2 : AccessorProp;
|
1462
|
+
}
|
1463
|
+
|
1396
1464
|
// src/translator/util/get-known-attr-values.ts
|
1397
1465
|
function getKnownAttrValues(tag) {
|
1398
1466
|
const attrs2 = {};
|
@@ -1805,7 +1873,7 @@ var return_default = {
|
|
1805
1873
|
if (attrs2.valueChange) {
|
1806
1874
|
setSerializedProperty(
|
1807
1875
|
section,
|
1808
|
-
|
1876
|
+
getAccessorProp().TagVariableChange,
|
1809
1877
|
attrs2.valueChange
|
1810
1878
|
);
|
1811
1879
|
}
|
@@ -2194,7 +2262,8 @@ function getSignal(section, referencedBindings, name2 = generateSignalName(refer
|
|
2194
2262
|
scopeIdentifier,
|
2195
2263
|
import_compiler17.types.identifier(referencedBindings.name)
|
2196
2264
|
]);
|
2197
|
-
|
2265
|
+
const closureSignalBuilder = getClosureSignalBuilder(section);
|
2266
|
+
return !closureSignalBuilder || isDynamicClosure(section, referencedBindings) ? callRuntime(
|
2198
2267
|
"dynamicClosureRead",
|
2199
2268
|
getScopeAccessorLiteral(referencedBindings),
|
2200
2269
|
render,
|
@@ -2497,7 +2566,9 @@ function writeSignals(section) {
|
|
2497
2566
|
forEach(section.hoisted, (binding) => {
|
2498
2567
|
for (const hoistedBinding of binding.hoists.values()) {
|
2499
2568
|
const accessors = [
|
2500
|
-
binding.type === 0 /* dom */ ? import_compiler17.types.stringLiteral(
|
2569
|
+
binding.type === 0 /* dom */ ? import_compiler17.types.stringLiteral(
|
2570
|
+
getAccessorPrefix().Getter + getScopeAccessor(binding)
|
2571
|
+
) : getScopeAccessorLiteral(binding)
|
2501
2572
|
];
|
2502
2573
|
let currentSection = section;
|
2503
2574
|
while (currentSection && currentSection !== hoistedBinding.section) {
|
@@ -2715,13 +2786,13 @@ function writeHTMLResumeStatements(path5) {
|
|
2715
2786
|
);
|
2716
2787
|
setSerializedProperty(
|
2717
2788
|
closure.section,
|
2718
|
-
|
2789
|
+
getAccessorPrefix().ClosureScopes + getScopeAccessor(closure),
|
2719
2790
|
identifier
|
2720
2791
|
);
|
2721
2792
|
}
|
2722
2793
|
setSerializedProperty(
|
2723
2794
|
section,
|
2724
|
-
|
2795
|
+
getAccessorPrefix().ClosureSignalIndex + getScopeAccessor(closure),
|
2725
2796
|
import_compiler17.types.numericLiteral(getDynamicClosureIndex(closure, section))
|
2726
2797
|
);
|
2727
2798
|
addWriteScopeBuilder(
|
@@ -4174,7 +4245,7 @@ function getScopeAccessor(binding, includeId) {
|
|
4174
4245
|
return binding.name + (includeId || binding.type === 0 /* dom */ ? `/${binding.id}` : "");
|
4175
4246
|
}
|
4176
4247
|
function getSectionInstancesAccessor(section) {
|
4177
|
-
return section.sectionAccessor ?
|
4248
|
+
return section.sectionAccessor ? section.sectionAccessor.prefix + getScopeAccessor(section.sectionAccessor.binding) : getAccessorPrefix().ClosureScopes + section.id;
|
4178
4249
|
}
|
4179
4250
|
function getSectionInstancesAccessorLiteral(section) {
|
4180
4251
|
const accessor = getSectionInstancesAccessor(section);
|
@@ -4349,6 +4420,7 @@ function isStatefulBinding(binding) {
|
|
4349
4420
|
}
|
4350
4421
|
|
4351
4422
|
// src/translator/core/await.ts
|
4423
|
+
var kDOMBinding = Symbol("await tag dom binding");
|
4352
4424
|
var await_default = {
|
4353
4425
|
analyze(tag) {
|
4354
4426
|
(0, import_babel_utils12.assertNoVar)(tag);
|
@@ -4356,7 +4428,17 @@ var await_default = {
|
|
4356
4428
|
assertNoSpreadAttrs(tag);
|
4357
4429
|
(0, import_babel_utils12.assertNoAttributeTags)(tag);
|
4358
4430
|
const { node } = tag;
|
4431
|
+
const tagBody = tag.get("body");
|
4432
|
+
const section = getOrCreateSection(tag);
|
4359
4433
|
const [valueAttr] = node.attributes;
|
4434
|
+
const tagExtra = tag.node.extra ??= {};
|
4435
|
+
tagExtra[kDOMBinding] = createBinding(
|
4436
|
+
"#text",
|
4437
|
+
0 /* dom */,
|
4438
|
+
section,
|
4439
|
+
void 0,
|
4440
|
+
tagExtra
|
4441
|
+
);
|
4360
4442
|
if (!valueAttr) {
|
4361
4443
|
throw tag.get("name").buildCodeFrameError("The `await` tag requires a value.");
|
4362
4444
|
}
|
@@ -4373,10 +4455,11 @@ var await_default = {
|
|
4373
4455
|
"The `await` tag only supports a single parameter."
|
4374
4456
|
);
|
4375
4457
|
}
|
4458
|
+
startSection(tagBody);
|
4376
4459
|
getOrCreateSection(tag);
|
4377
4460
|
trackParamsReferences(
|
4378
|
-
|
4379
|
-
|
4461
|
+
tagBody,
|
4462
|
+
3 /* param */,
|
4380
4463
|
void 0,
|
4381
4464
|
evaluate(valueAttr.value)
|
4382
4465
|
);
|
@@ -4396,7 +4479,10 @@ var await_default = {
|
|
4396
4479
|
exit(tag) {
|
4397
4480
|
const { node } = tag;
|
4398
4481
|
const [valueAttr] = node.attributes;
|
4482
|
+
const tagExtra = node.extra;
|
4483
|
+
const nodeRef2 = tagExtra[kDOMBinding];
|
4399
4484
|
const tagBody = tag.get("body");
|
4485
|
+
const section = getSection(tag);
|
4400
4486
|
const bodySection = getSectionForBody(tagBody);
|
4401
4487
|
if (isStatefulReferences(valueAttr.extra?.referencedBindings) || checkStatefulClosures(bodySection, true)) {
|
4402
4488
|
setForceResumeScope(bodySection);
|
@@ -4407,6 +4493,8 @@ var await_default = {
|
|
4407
4493
|
import_compiler23.types.expressionStatement(
|
4408
4494
|
callRuntime(
|
4409
4495
|
"fork",
|
4496
|
+
getScopeIdIdentifier(section),
|
4497
|
+
getScopeAccessorLiteral(nodeRef2),
|
4410
4498
|
valueAttr.value,
|
4411
4499
|
import_compiler23.types.arrowFunctionExpression(
|
4412
4500
|
node.body.params,
|
@@ -4426,8 +4514,29 @@ var await_default = {
|
|
4426
4514
|
return;
|
4427
4515
|
}
|
4428
4516
|
setSectionParentIsOwner(bodySection, true);
|
4517
|
+
visit(tag, 37 /* Replace */);
|
4518
|
+
enterShallow(tag);
|
4429
4519
|
},
|
4430
4520
|
exit(tag) {
|
4521
|
+
const { node } = tag;
|
4522
|
+
const tagExtra = node.extra;
|
4523
|
+
const nodeRef2 = tagExtra[kDOMBinding];
|
4524
|
+
const section = getSection(tag);
|
4525
|
+
const bodySection = getSectionForBody(tag.get("body"));
|
4526
|
+
const signal = getSignal(section, nodeRef2, "await");
|
4527
|
+
signal.build = () => {
|
4528
|
+
return callRuntime(
|
4529
|
+
"awaitTag",
|
4530
|
+
getScopeAccessorLiteral(nodeRef2),
|
4531
|
+
import_compiler23.types.identifier(bodySection.name)
|
4532
|
+
);
|
4533
|
+
};
|
4534
|
+
addValue(
|
4535
|
+
section,
|
4536
|
+
tag.node.attributes[0].value.extra?.referencedBindings,
|
4537
|
+
signal,
|
4538
|
+
tag.node.attributes[0].value
|
4539
|
+
);
|
4431
4540
|
tag.remove();
|
4432
4541
|
}
|
4433
4542
|
}
|
@@ -4978,7 +5087,7 @@ var native_tag_default = {
|
|
4978
5087
|
"nodeRef",
|
4979
5088
|
import_compiler29.types.stringLiteral(getterId),
|
4980
5089
|
import_compiler29.types.stringLiteral(
|
4981
|
-
getScopeAccessorLiteral(nodeRef2).value
|
5090
|
+
getAccessorPrefix().Getter + getScopeAccessorLiteral(nodeRef2).value
|
4982
5091
|
)
|
4983
5092
|
)
|
4984
5093
|
)
|
@@ -5006,7 +5115,7 @@ var native_tag_default = {
|
|
5006
5115
|
import_compiler29.types.memberExpression(
|
5007
5116
|
getScopeExpression(section, referenceSection),
|
5008
5117
|
import_compiler29.types.stringLiteral(
|
5009
|
-
getScopeAccessorLiteral(nodeRef2).value
|
5118
|
+
getAccessorPrefix().Getter + getScopeAccessorLiteral(nodeRef2).value
|
5010
5119
|
),
|
5011
5120
|
true
|
5012
5121
|
)
|
@@ -5465,7 +5574,7 @@ var for_default = {
|
|
5465
5574
|
mergeReferences(section, tag.node, getAllTagReferenceNodes(tag.node));
|
5466
5575
|
bodySection.sectionAccessor = {
|
5467
5576
|
binding: getOptimizedOnlyChildNodeRef(tag, section),
|
5468
|
-
|
5577
|
+
prefix: getAccessorPrefix().LoopScopeMap
|
5469
5578
|
};
|
5470
5579
|
bodySection.upstreamExpression = tagExtra;
|
5471
5580
|
bodySection.isBranch = true;
|
@@ -5587,7 +5696,7 @@ var for_default = {
|
|
5587
5696
|
}
|
5588
5697
|
setSerializedProperty(
|
5589
5698
|
tagSection,
|
5590
|
-
|
5699
|
+
getAccessorPrefix().LoopScopeMap + getScopeAccessor(nodeRef2),
|
5591
5700
|
import_compiler31.types.conditionalExpression(
|
5592
5701
|
import_compiler31.types.memberExpression(forScopesIdentifier, import_compiler31.types.identifier("size")),
|
5593
5702
|
forScopesIdentifier,
|
@@ -7344,7 +7453,7 @@ var IfTag = {
|
|
7344
7453
|
section,
|
7345
7454
|
branches.length
|
7346
7455
|
),
|
7347
|
-
|
7456
|
+
prefix: getAccessorPrefix().ConditionalScope
|
7348
7457
|
};
|
7349
7458
|
rootExtra.singleNodeOptimization = singleNodeOptimization;
|
7350
7459
|
}
|
@@ -7442,7 +7551,7 @@ var IfTag = {
|
|
7442
7551
|
if (isStateful) {
|
7443
7552
|
setSerializedProperty(
|
7444
7553
|
section,
|
7445
|
-
|
7554
|
+
getAccessorPrefix().ConditionalRenderer + getScopeAccessor(nodeRef2),
|
7446
7555
|
ifBranchIdentifier
|
7447
7556
|
);
|
7448
7557
|
const cbNode = import_compiler40.types.arrowFunctionExpression(
|
@@ -7476,7 +7585,7 @@ var IfTag = {
|
|
7476
7585
|
);
|
7477
7586
|
setSerializedProperty(
|
7478
7587
|
section,
|
7479
|
-
|
7588
|
+
getAccessorPrefix().ConditionalScope + getScopeAccessor(nodeRef2),
|
7480
7589
|
callRuntime("getScopeById", ifScopeIdIdentifier)
|
7481
7590
|
);
|
7482
7591
|
} else {
|
@@ -7764,7 +7873,7 @@ var let_default = {
|
|
7764
7873
|
if (valueChangeAttr) {
|
7765
7874
|
setSerializedProperty(
|
7766
7875
|
section,
|
7767
|
-
|
7876
|
+
getAccessorProp().TagVariableChange + getScopeAccessor(binding),
|
7768
7877
|
valueChangeAttr.value
|
7769
7878
|
);
|
7770
7879
|
}
|
@@ -8231,6 +8340,7 @@ var style_default = {
|
|
8231
8340
|
// src/translator/core/try.ts
|
8232
8341
|
var import_compiler48 = require("@marko/compiler");
|
8233
8342
|
var import_babel_utils37 = require("@marko/compiler/babel-utils");
|
8343
|
+
var kDOMBinding2 = Symbol("try tag dom binding");
|
8234
8344
|
var try_default = {
|
8235
8345
|
analyze(tag) {
|
8236
8346
|
(0, import_babel_utils37.assertNoVar)(tag);
|
@@ -8241,9 +8351,19 @@ var try_default = {
|
|
8241
8351
|
analyzeAttributeTags(tag);
|
8242
8352
|
const { node } = tag;
|
8243
8353
|
const section = getOrCreateSection(tag);
|
8354
|
+
const tagExtra = tag.node.extra ??= {};
|
8355
|
+
const tagBody = tag.get("body");
|
8356
|
+
tagExtra[kDOMBinding2] = createBinding(
|
8357
|
+
"#text",
|
8358
|
+
0 /* dom */,
|
8359
|
+
section,
|
8360
|
+
void 0,
|
8361
|
+
tagExtra
|
8362
|
+
);
|
8244
8363
|
if (!node.body.body.length) {
|
8245
8364
|
throw tag.get("name").buildCodeFrameError("The `try` tag requires body content.");
|
8246
8365
|
}
|
8366
|
+
startSection(tagBody);
|
8247
8367
|
mergeReferences(section, tag.node, getAllTagReferenceNodes(tag.node));
|
8248
8368
|
},
|
8249
8369
|
translate: translateByTarget({
|
@@ -8253,12 +8373,27 @@ var try_default = {
|
|
8253
8373
|
tag.remove();
|
8254
8374
|
return;
|
8255
8375
|
}
|
8256
|
-
|
8376
|
+
const tagBody = tag.get("body");
|
8377
|
+
const bodySection = getSectionForBody(tagBody);
|
8378
|
+
setSectionParentIsOwner(bodySection, true);
|
8257
8379
|
flushBefore(tag);
|
8258
8380
|
},
|
8259
8381
|
exit(tag) {
|
8382
|
+
const { node } = tag;
|
8383
|
+
const section = getSection(tag);
|
8384
|
+
const tagExtra = node.extra;
|
8260
8385
|
const tagBody = tag.get("body");
|
8261
8386
|
const translatedAttrs = translateAttrs(tag);
|
8387
|
+
const nodeRef2 = tagExtra[kDOMBinding2];
|
8388
|
+
const contentProp = getTranslatedBodyContentProperty(
|
8389
|
+
translatedAttrs.properties
|
8390
|
+
);
|
8391
|
+
if (contentProp) {
|
8392
|
+
translatedAttrs.properties.splice(
|
8393
|
+
translatedAttrs.properties.indexOf(contentProp),
|
8394
|
+
1
|
8395
|
+
);
|
8396
|
+
}
|
8262
8397
|
flushInto(tag);
|
8263
8398
|
writeHTMLResumeStatements(tagBody);
|
8264
8399
|
tag.insertBefore(translatedAttrs.statements);
|
@@ -8266,6 +8401,9 @@ var try_default = {
|
|
8266
8401
|
import_compiler48.types.expressionStatement(
|
8267
8402
|
callRuntime(
|
8268
8403
|
"tryContent",
|
8404
|
+
getScopeIdIdentifier(section),
|
8405
|
+
getScopeAccessorLiteral(nodeRef2),
|
8406
|
+
contentProp?.value,
|
8269
8407
|
propsToExpression(translatedAttrs.properties)
|
8270
8408
|
)
|
8271
8409
|
)
|
@@ -8274,9 +8412,56 @@ var try_default = {
|
|
8274
8412
|
},
|
8275
8413
|
dom: {
|
8276
8414
|
enter(tag) {
|
8277
|
-
|
8415
|
+
const tagBody = tag.get("body");
|
8416
|
+
const bodySection = getSectionForBody(tagBody);
|
8417
|
+
setSectionParentIsOwner(bodySection, true);
|
8418
|
+
visit(tag, 37 /* Replace */);
|
8419
|
+
enterShallow(tag);
|
8278
8420
|
},
|
8279
8421
|
exit(tag) {
|
8422
|
+
const { node } = tag;
|
8423
|
+
const tagExtra = node.extra;
|
8424
|
+
const nodeRef2 = tagExtra[kDOMBinding2];
|
8425
|
+
const referencedBindings = tagExtra.referencedBindings;
|
8426
|
+
const translatedAttrs = translateAttrs(tag);
|
8427
|
+
const contentProp = getTranslatedBodyContentProperty(
|
8428
|
+
translatedAttrs.properties
|
8429
|
+
);
|
8430
|
+
if (contentProp) {
|
8431
|
+
translatedAttrs.properties.splice(
|
8432
|
+
translatedAttrs.properties.indexOf(contentProp),
|
8433
|
+
1
|
8434
|
+
);
|
8435
|
+
}
|
8436
|
+
const section = getSection(tag);
|
8437
|
+
const bodySection = getSectionForBody(tag.get("body"));
|
8438
|
+
const signal = getSignal(section, nodeRef2, "try");
|
8439
|
+
signal.build = () => {
|
8440
|
+
return callRuntime(
|
8441
|
+
"createTry",
|
8442
|
+
getScopeAccessorLiteral(nodeRef2),
|
8443
|
+
import_compiler48.types.identifier(bodySection.name)
|
8444
|
+
);
|
8445
|
+
};
|
8446
|
+
if (translatedAttrs.statements.length) {
|
8447
|
+
addStatement(
|
8448
|
+
"render",
|
8449
|
+
section,
|
8450
|
+
referencedBindings,
|
8451
|
+
translatedAttrs.statements
|
8452
|
+
);
|
8453
|
+
}
|
8454
|
+
currentProgramPath.pushContainer(
|
8455
|
+
"body",
|
8456
|
+
import_compiler48.types.expressionStatement(callRuntime("enableCatch"))
|
8457
|
+
);
|
8458
|
+
addValue(
|
8459
|
+
section,
|
8460
|
+
referencedBindings,
|
8461
|
+
signal,
|
8462
|
+
propsToExpression(translatedAttrs.properties)
|
8463
|
+
);
|
8464
|
+
signal.hasDownstreamIntersections = () => true;
|
8280
8465
|
tag.remove();
|
8281
8466
|
}
|
8282
8467
|
}
|
@@ -8290,17 +8475,6 @@ var try_default = {
|
|
8290
8475
|
],
|
8291
8476
|
types: runtime_info_default.name + "/tag-types/try.d.marko"
|
8292
8477
|
};
|
8293
|
-
function setAllSectionsParentIsOwner(tag) {
|
8294
|
-
for (const attrTag2 of tag.get("attributeTags")) {
|
8295
|
-
if (attrTag2.isMarkoTag()) {
|
8296
|
-
setAllSectionsParentIsOwner(attrTag2);
|
8297
|
-
}
|
8298
|
-
}
|
8299
|
-
const bodySection = getSectionForBody(tag.get("body"));
|
8300
|
-
if (bodySection) {
|
8301
|
-
setSectionParentIsOwner(bodySection, true);
|
8302
|
-
}
|
8303
|
-
}
|
8304
8478
|
|
8305
8479
|
// src/translator/core/index.ts
|
8306
8480
|
var core_default = {
|
@@ -9418,7 +9592,7 @@ function always() {
|
|
9418
9592
|
// src/translator/visitors/tag/dynamic-tag.ts
|
9419
9593
|
var import_compiler54 = require("@marko/compiler");
|
9420
9594
|
var import_babel_utils42 = require("@marko/compiler/babel-utils");
|
9421
|
-
var
|
9595
|
+
var kDOMBinding3 = Symbol("dynamic tag dom binding");
|
9422
9596
|
var kChildOffsetScopeBinding2 = Symbol("custom tag scope offset");
|
9423
9597
|
var dynamic_tag_default = {
|
9424
9598
|
analyze: {
|
@@ -9428,7 +9602,7 @@ var dynamic_tag_default = {
|
|
9428
9602
|
const section = getOrCreateSection(tag);
|
9429
9603
|
const tagExtra = tag.node.extra ??= {};
|
9430
9604
|
const tagBody = tag.get("body");
|
9431
|
-
tagExtra[
|
9605
|
+
tagExtra[kDOMBinding3] = createBinding(
|
9432
9606
|
"#text",
|
9433
9607
|
0 /* dom */,
|
9434
9608
|
section,
|
@@ -9467,7 +9641,7 @@ var dynamic_tag_default = {
|
|
9467
9641
|
exit(tag) {
|
9468
9642
|
const { node } = tag;
|
9469
9643
|
const tagExtra = node.extra;
|
9470
|
-
const nodeRef2 = tagExtra[
|
9644
|
+
const nodeRef2 = tagExtra[kDOMBinding3];
|
9471
9645
|
const section = getSection(tag);
|
9472
9646
|
const isClassAPI = tagExtra.featureType === "class";
|
9473
9647
|
const referencedBindings = tagExtra.referencedBindings;
|
@@ -9483,14 +9657,19 @@ var dynamic_tag_default = {
|
|
9483
9657
|
if (isOutputHTML()) {
|
9484
9658
|
currentProgramPath.pushContainer(
|
9485
9659
|
"body",
|
9486
|
-
import_compiler54.types.
|
9487
|
-
|
9488
|
-
|
9489
|
-
|
9490
|
-
|
9491
|
-
|
9492
|
-
|
9493
|
-
|
9660
|
+
import_compiler54.types.markoScriptlet(
|
9661
|
+
[
|
9662
|
+
import_compiler54.types.expressionStatement(
|
9663
|
+
import_compiler54.types.callExpression(
|
9664
|
+
(0, import_babel_utils42.importNamed)(tag.hub.file, getCompatRuntimeFile(), "s"),
|
9665
|
+
[
|
9666
|
+
import_compiler54.types.identifier(tagExpression.name),
|
9667
|
+
import_compiler54.types.stringLiteral((0, import_babel_utils42.loadFileForTag)(tag).metadata.marko.id)
|
9668
|
+
]
|
9669
|
+
)
|
9670
|
+
)
|
9671
|
+
],
|
9672
|
+
true
|
9494
9673
|
)
|
9495
9674
|
);
|
9496
9675
|
} else {
|
@@ -9590,12 +9769,12 @@ var dynamic_tag_default = {
|
|
9590
9769
|
}
|
9591
9770
|
setSerializedProperty(
|
9592
9771
|
section,
|
9593
|
-
|
9772
|
+
getAccessorPrefix().ConditionalScope + getScopeAccessor(nodeRef2),
|
9594
9773
|
callRuntime("writeExistingScope", dynamicScopeIdentifier)
|
9595
9774
|
);
|
9596
9775
|
setSerializedProperty(
|
9597
9776
|
section,
|
9598
|
-
|
9777
|
+
getAccessorPrefix().ConditionalRenderer + getScopeAccessor(nodeRef2),
|
9599
9778
|
callRuntime(
|
9600
9779
|
"dynamicTagId",
|
9601
9780
|
import_compiler54.types.isIdentifier(tagExpression) ? import_compiler54.types.identifier(tagExpression.name) : tagExpression
|
@@ -9620,7 +9799,7 @@ var dynamic_tag_default = {
|
|
9620
9799
|
import_compiler54.types.memberExpression(
|
9621
9800
|
getScopeExpression(tagVarSignal.section, valueSection),
|
9622
9801
|
import_compiler54.types.stringLiteral(
|
9623
|
-
|
9802
|
+
getAccessorPrefix().ConditionalScope + getScopeAccessor(nodeRef2)
|
9624
9803
|
),
|
9625
9804
|
true
|
9626
9805
|
),
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { AccessorPrefix as ProductionAccessorPrefix, AccessorProp as ProductionAccessorProp } from "../../common/accessor";
|
2
|
+
import { AccessorPrefix as DebugAccessorPrefix, AccessorProp as DebugAccessorProp } from "../../common/accessor.debug";
|
3
|
+
export declare function getAccessorPrefix(): typeof DebugAccessorPrefix | typeof ProductionAccessorPrefix;
|
4
|
+
export declare function getAccessorProp(): typeof DebugAccessorProp | typeof ProductionAccessorProp;
|