marko 6.0.0-next.3.21 → 6.0.0-next.3.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/common/for.d.ts +3 -4
- package/dist/common/types.d.ts +18 -17
- package/dist/debug/dom.js +696 -740
- package/dist/debug/dom.mjs +696 -740
- package/dist/debug/html.js +256 -99
- package/dist/debug/html.mjs +247 -95
- package/dist/dom/abort-signal.d.ts +1 -1
- package/dist/dom/compat.d.ts +1 -0
- package/dist/dom/control-flow.d.ts +6 -8
- package/dist/dom/queue.d.ts +4 -2
- package/dist/dom/reconcile.d.ts +2 -2
- package/dist/dom/renderer.d.ts +7 -8
- package/dist/dom/resume.d.ts +3 -3
- package/dist/dom/scope.d.ts +4 -4
- package/dist/dom/signals.d.ts +13 -26
- package/dist/dom/template.d.ts +2 -2
- package/dist/dom.d.ts +2 -2
- package/dist/dom.js +441 -482
- package/dist/dom.mjs +441 -482
- package/dist/html/dynamic-tag.d.ts +3 -3
- package/dist/html/writer.d.ts +12 -12
- package/dist/html.d.ts +1 -1
- package/dist/html.js +202 -65
- package/dist/html.mjs +193 -61
- package/dist/translator/core/for.d.ts +0 -2
- package/dist/translator/index.js +474 -468
- package/dist/translator/util/get-style-file.d.ts +2 -0
- package/dist/translator/util/runtime.d.ts +1 -2
- package/dist/translator/util/sections.d.ts +2 -1
- package/dist/translator/util/signals.d.ts +2 -2
- package/package.json +2 -2
- package/tags-html.d.ts +152 -152
package/dist/translator/index.js
CHANGED
@@ -110,7 +110,7 @@ var attrs_default = {
|
|
110
110
|
|
111
111
|
// src/translator/core/await.ts
|
112
112
|
var import_compiler22 = require("@marko/compiler");
|
113
|
-
var
|
113
|
+
var import_babel_utils12 = require("@marko/compiler/babel-utils");
|
114
114
|
|
115
115
|
// src/translator/util/evaluate.ts
|
116
116
|
var import_babel_utils2 = require("@marko/compiler/babel-utils");
|
@@ -137,8 +137,8 @@ var import_compiler21 = require("@marko/compiler");
|
|
137
137
|
|
138
138
|
// src/translator/visitors/program/index.ts
|
139
139
|
var import_compiler20 = require("@marko/compiler");
|
140
|
-
var
|
141
|
-
var
|
140
|
+
var import_babel_utils11 = require("@marko/compiler/babel-utils");
|
141
|
+
var import_path2 = __toESM(require("path"));
|
142
142
|
|
143
143
|
// src/translator/util/binding-has-downstream-expressions.ts
|
144
144
|
function bindingHasDownstreamExpressions(binding) {
|
@@ -546,6 +546,7 @@ var KNOWN_OBJECTS = /* @__PURE__ */ new Map([
|
|
546
546
|
// src/html/writer.ts
|
547
547
|
var K_SCOPE_ID = Symbol("Scope ID");
|
548
548
|
var kPendingContexts = Symbol("Pending Contexts");
|
549
|
+
var branchIdKey = Symbol();
|
549
550
|
var tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb));
|
550
551
|
|
551
552
|
// src/html/attrs.ts
|
@@ -626,7 +627,8 @@ var pureFunctions = [
|
|
626
627
|
"value",
|
627
628
|
"state",
|
628
629
|
"intersection",
|
629
|
-
"
|
630
|
+
"loopClosure",
|
631
|
+
"conditionalClosure",
|
630
632
|
"dynamicClosure",
|
631
633
|
"loopOf",
|
632
634
|
"loopIn",
|
@@ -857,9 +859,6 @@ function find(data, cb) {
|
|
857
859
|
}
|
858
860
|
}
|
859
861
|
}
|
860
|
-
function map(data, cb) {
|
861
|
-
return data ? Array.isArray(data) ? data.map(cb) : [cb(data, 0)] : [];
|
862
|
-
}
|
863
862
|
function findSorted(compare, data, item) {
|
864
863
|
let max = data.length;
|
865
864
|
let pos = 0;
|
@@ -936,17 +935,17 @@ function joinRepeatable(compare, a, b) {
|
|
936
935
|
|
937
936
|
// src/translator/util/state.ts
|
938
937
|
var createProgramState = (init) => {
|
939
|
-
const
|
938
|
+
const map = /* @__PURE__ */ new WeakMap();
|
940
939
|
return [
|
941
940
|
() => {
|
942
|
-
let state =
|
941
|
+
let state = map.get(currentProgramPath);
|
943
942
|
if (!state) {
|
944
|
-
|
943
|
+
map.set(currentProgramPath, state = init());
|
945
944
|
}
|
946
945
|
return state;
|
947
946
|
},
|
948
947
|
(value) => {
|
949
|
-
|
948
|
+
map.set(currentProgramPath, value);
|
950
949
|
}
|
951
950
|
];
|
952
951
|
};
|
@@ -1021,37 +1020,37 @@ function analyzeTagNameType(tag) {
|
|
1021
1020
|
}
|
1022
1021
|
function analyzeExpressionTagName(name2, extra) {
|
1023
1022
|
const pending = [name2];
|
1024
|
-
let
|
1023
|
+
let path5;
|
1025
1024
|
let type;
|
1026
1025
|
let nullable = false;
|
1027
1026
|
let tagNameImported;
|
1028
|
-
while ((
|
1029
|
-
if (
|
1030
|
-
pending.push(
|
1031
|
-
if (
|
1032
|
-
pending.push(
|
1033
|
-
}
|
1034
|
-
} else if (
|
1035
|
-
if (
|
1036
|
-
pending.push(
|
1027
|
+
while ((path5 = pending.pop()) && type !== 2 /* DynamicTag */) {
|
1028
|
+
if (path5.isConditionalExpression()) {
|
1029
|
+
pending.push(path5.get("consequent"));
|
1030
|
+
if (path5.node.alternate) {
|
1031
|
+
pending.push(path5.get("alternate"));
|
1032
|
+
}
|
1033
|
+
} else if (path5.isLogicalExpression()) {
|
1034
|
+
if (path5.node.operator === "||") {
|
1035
|
+
pending.push(path5.get("left"));
|
1037
1036
|
} else {
|
1038
1037
|
nullable = true;
|
1039
1038
|
}
|
1040
|
-
pending.push(
|
1041
|
-
} else if (
|
1042
|
-
pending.push(
|
1043
|
-
} else if (
|
1044
|
-
type =
|
1045
|
-
} else if (
|
1039
|
+
pending.push(path5.get("right"));
|
1040
|
+
} else if (path5.isAssignmentExpression()) {
|
1041
|
+
pending.push(path5.get("right"));
|
1042
|
+
} else if (path5.isBinaryExpression()) {
|
1043
|
+
type = path5.node.operator !== "+" || type !== void 0 ? 2 /* DynamicTag */ : 0 /* NativeTag */;
|
1044
|
+
} else if (path5.isStringLiteral() || path5.isTemplateLiteral()) {
|
1046
1045
|
type = type !== void 0 ? 2 /* DynamicTag */ : 0 /* NativeTag */;
|
1047
|
-
} else if (
|
1046
|
+
} else if (path5.isNullLiteral()) {
|
1048
1047
|
nullable = true;
|
1049
|
-
} else if (
|
1050
|
-
if (
|
1048
|
+
} else if (path5.isIdentifier()) {
|
1049
|
+
if (path5.node.name === "undefined") {
|
1051
1050
|
nullable = true;
|
1052
1051
|
continue;
|
1053
1052
|
}
|
1054
|
-
const binding =
|
1053
|
+
const binding = path5.scope.getBinding(path5.node.name);
|
1055
1054
|
if (!binding) {
|
1056
1055
|
type = 2 /* DynamicTag */;
|
1057
1056
|
continue;
|
@@ -1101,18 +1100,18 @@ function analyzeExpressionTagName(name2, extra) {
|
|
1101
1100
|
}
|
1102
1101
|
|
1103
1102
|
// src/translator/util/sections.ts
|
1104
|
-
function startSection(
|
1105
|
-
const extra =
|
1103
|
+
function startSection(path5) {
|
1104
|
+
const extra = path5.node.extra ??= {};
|
1106
1105
|
let section = extra.section;
|
1107
|
-
if (!section && (
|
1108
|
-
const parentSection =
|
1109
|
-
const sectionNamePath =
|
1106
|
+
if (!section && (path5.type === "Program" || path5.get("body").length)) {
|
1107
|
+
const parentSection = path5.parentPath ? getOrCreateSection(path5.parentPath) : void 0;
|
1108
|
+
const sectionNamePath = path5.parentPath?.get(
|
1110
1109
|
"name"
|
1111
1110
|
);
|
1112
|
-
const sectionName =
|
1111
|
+
const sectionName = path5.isProgram() ? "" : currentProgramPath.scope.generateUid(
|
1113
1112
|
sectionNamePath.toString() + "_content"
|
1114
1113
|
);
|
1115
|
-
const programExtra =
|
1114
|
+
const programExtra = path5.hub.file.path.node.extra ??= {};
|
1116
1115
|
const sections = programExtra.sections ??= [];
|
1117
1116
|
section = extra.section = {
|
1118
1117
|
id: sections.length,
|
@@ -1122,16 +1121,17 @@ function startSection(path4) {
|
|
1122
1121
|
params: void 0,
|
1123
1122
|
closures: void 0,
|
1124
1123
|
bindings: void 0,
|
1125
|
-
content: getContentInfo(
|
1124
|
+
content: getContentInfo(path5),
|
1126
1125
|
upstreamExpression: void 0,
|
1127
|
-
|
1126
|
+
hasAbortSignal: false,
|
1127
|
+
isBranch: false
|
1128
1128
|
};
|
1129
1129
|
sections.push(section);
|
1130
1130
|
}
|
1131
1131
|
return section;
|
1132
1132
|
}
|
1133
|
-
function getOrCreateSection(
|
1134
|
-
let cur =
|
1133
|
+
function getOrCreateSection(path5) {
|
1134
|
+
let cur = path5;
|
1135
1135
|
while (true) {
|
1136
1136
|
if (cur.type === "Program" || cur.type === "MarkoTagBody" && !cur.node.attributeTags && analyzeTagNameType(cur.parentPath) !== 0 /* NativeTag */ && cur.parent.name.value !== "html-comment") {
|
1137
1137
|
return startSection(cur);
|
@@ -1142,9 +1142,9 @@ function getOrCreateSection(path4) {
|
|
1142
1142
|
function getSectionForBody(body) {
|
1143
1143
|
return body.node.extra?.section;
|
1144
1144
|
}
|
1145
|
-
function getSection(
|
1145
|
+
function getSection(path5) {
|
1146
1146
|
let section;
|
1147
|
-
let currentPath =
|
1147
|
+
let currentPath = path5;
|
1148
1148
|
while ((section = currentPath.node.extra?.section) === void 0) {
|
1149
1149
|
currentPath = currentPath.parentPath;
|
1150
1150
|
}
|
@@ -1176,8 +1176,8 @@ function forEachSectionReverse(fn) {
|
|
1176
1176
|
fn(sections[i]);
|
1177
1177
|
}
|
1178
1178
|
}
|
1179
|
-
function getContentInfo(
|
1180
|
-
const body =
|
1179
|
+
function getContentInfo(path5) {
|
1180
|
+
const body = path5.get("body");
|
1181
1181
|
const contentInfo = {
|
1182
1182
|
startType: null,
|
1183
1183
|
endType: null,
|
@@ -1201,8 +1201,8 @@ function getContentInfo(path4) {
|
|
1201
1201
|
}
|
1202
1202
|
return null;
|
1203
1203
|
}
|
1204
|
-
function getNodeContentType(
|
1205
|
-
switch (
|
1204
|
+
function getNodeContentType(path5, extraMember, contentInfo) {
|
1205
|
+
switch (path5.type) {
|
1206
1206
|
case "MarkoText":
|
1207
1207
|
return 4 /* Text */;
|
1208
1208
|
case "MarkoPlaceholder":
|
@@ -1214,7 +1214,7 @@ function getNodeContentType(path4, extraMember, contentInfo) {
|
|
1214
1214
|
case "ExportNamedDeclaration":
|
1215
1215
|
return null;
|
1216
1216
|
case "MarkoTag": {
|
1217
|
-
const tag =
|
1217
|
+
const tag = path5;
|
1218
1218
|
if (isCoreTag(tag)) {
|
1219
1219
|
switch (tag.node.name.value) {
|
1220
1220
|
case "html-comment":
|
@@ -1265,6 +1265,43 @@ var checkStatefulClosures = (section, immediateOnly) => {
|
|
1265
1265
|
|
1266
1266
|
// src/translator/visitors/program/dom.ts
|
1267
1267
|
var import_compiler18 = require("@marko/compiler");
|
1268
|
+
var import_babel_utils10 = require("@marko/compiler/babel-utils");
|
1269
|
+
|
1270
|
+
// src/translator/util/get-style-file.ts
|
1271
|
+
var import_path = __toESM(require("path"));
|
1272
|
+
function getStyleFile(file) {
|
1273
|
+
const { filename } = file.opts;
|
1274
|
+
const fs = file.markoOpts.fileSystem;
|
1275
|
+
const base = getBase(filename);
|
1276
|
+
const styleMatch = new RegExp(
|
1277
|
+
`^(${escapeRegExp(base)}\\.${"index" === base ? "|" : ""})style\\.\\w+$`
|
1278
|
+
);
|
1279
|
+
for (const file2 of fs.readdirSync(import_path.default.dirname(filename)).sort()) {
|
1280
|
+
if (styleMatch.test(file2)) {
|
1281
|
+
return `./${file2}`;
|
1282
|
+
}
|
1283
|
+
}
|
1284
|
+
}
|
1285
|
+
function getBase(filename) {
|
1286
|
+
const start = filename.lastIndexOf(import_path.default.sep) + 1;
|
1287
|
+
const leftDot = filename.indexOf(".", start);
|
1288
|
+
if (leftDot === -1) {
|
1289
|
+
return filename.slice(start);
|
1290
|
+
}
|
1291
|
+
const rightDot = filename.lastIndexOf(".");
|
1292
|
+
const closeBracket = leftDot - 1;
|
1293
|
+
if (filename[closeBracket] === "]") {
|
1294
|
+
const openBracket = filename.lastIndexOf("[", closeBracket);
|
1295
|
+
if (openBracket > start) {
|
1296
|
+
return filename.slice(start, openBracket) + filename.slice(leftDot, rightDot);
|
1297
|
+
}
|
1298
|
+
}
|
1299
|
+
return filename.slice(start, rightDot);
|
1300
|
+
}
|
1301
|
+
var regexpCharsReg = /[\\^$.*+?()[\]{}|]/g;
|
1302
|
+
function escapeRegExp(str) {
|
1303
|
+
return str.replace(regexpCharsReg, "\\$&");
|
1304
|
+
}
|
1268
1305
|
|
1269
1306
|
// src/translator/util/signals.ts
|
1270
1307
|
var import_compiler17 = require("@marko/compiler");
|
@@ -1287,29 +1324,29 @@ function getKnownAttrValues(tag) {
|
|
1287
1324
|
|
1288
1325
|
// src/translator/util/plugin-hooks.ts
|
1289
1326
|
var import_compiler7 = require("@marko/compiler");
|
1290
|
-
function enter(modulePlugin,
|
1327
|
+
function enter(modulePlugin, path5) {
|
1291
1328
|
if (!modulePlugin) {
|
1292
1329
|
return false;
|
1293
1330
|
}
|
1294
|
-
const { node } =
|
1331
|
+
const { node } = path5;
|
1295
1332
|
const plugin = isModulePlugin(modulePlugin) ? modulePlugin.default : modulePlugin;
|
1296
1333
|
if (isFunctionPlugin(plugin)) {
|
1297
|
-
plugin(
|
1334
|
+
plugin(path5, import_compiler7.types);
|
1298
1335
|
} else if (plugin.enter) {
|
1299
|
-
plugin.enter(
|
1336
|
+
plugin.enter(path5, import_compiler7.types);
|
1300
1337
|
}
|
1301
|
-
return node !==
|
1338
|
+
return node !== path5.node;
|
1302
1339
|
}
|
1303
|
-
function exit(modulePlugin,
|
1340
|
+
function exit(modulePlugin, path5) {
|
1304
1341
|
if (!modulePlugin) {
|
1305
1342
|
return false;
|
1306
1343
|
}
|
1307
|
-
const { node } =
|
1344
|
+
const { node } = path5;
|
1308
1345
|
const plugin = isModulePlugin(modulePlugin) ? modulePlugin.default : modulePlugin;
|
1309
1346
|
if (!isFunctionPlugin(plugin) && plugin.exit) {
|
1310
|
-
plugin.exit(
|
1347
|
+
plugin.exit(path5, import_compiler7.types);
|
1311
1348
|
}
|
1312
|
-
return node !==
|
1349
|
+
return node !== path5.node;
|
1313
1350
|
}
|
1314
1351
|
function isModulePlugin(plugin) {
|
1315
1352
|
return Boolean(plugin.default);
|
@@ -1341,11 +1378,11 @@ function translateByTarget({
|
|
1341
1378
|
dom
|
1342
1379
|
}) {
|
1343
1380
|
return {
|
1344
|
-
enter(
|
1345
|
-
enter(isOutputHTML() ? html : dom,
|
1381
|
+
enter(path5) {
|
1382
|
+
enter(isOutputHTML() ? html : dom, path5);
|
1346
1383
|
},
|
1347
|
-
exit(
|
1348
|
-
exit(isOutputHTML() ? html : dom,
|
1384
|
+
exit(path5) {
|
1385
|
+
exit(isOutputHTML() ? html : dom, path5);
|
1349
1386
|
}
|
1350
1387
|
};
|
1351
1388
|
}
|
@@ -1431,18 +1468,18 @@ var walkCodeToName = {
|
|
1431
1468
|
[116 /* OutEnd */]: "outEnd",
|
1432
1469
|
[126 /* MultiplierEnd */]: "multiplierEnd"
|
1433
1470
|
};
|
1434
|
-
function enter2(
|
1435
|
-
getSteps(getSection(
|
1471
|
+
function enter2(path5) {
|
1472
|
+
getSteps(getSection(path5)).push(0 /* Enter */);
|
1436
1473
|
}
|
1437
|
-
function exit2(
|
1438
|
-
getSteps(getSection(
|
1474
|
+
function exit2(path5) {
|
1475
|
+
getSteps(getSection(path5)).push(1 /* Exit */);
|
1439
1476
|
}
|
1440
|
-
function enterShallow(
|
1441
|
-
getSteps(getSection(
|
1477
|
+
function enterShallow(path5) {
|
1478
|
+
getSteps(getSection(path5)).push(0 /* Enter */, 1 /* Exit */);
|
1442
1479
|
}
|
1443
|
-
function injectWalks(
|
1444
|
-
const walks = getWalks(getSection(
|
1445
|
-
const walkComment = getWalkComment(getSection(
|
1480
|
+
function injectWalks(path5, expr) {
|
1481
|
+
const walks = getWalks(getSection(path5));
|
1482
|
+
const walkComment = getWalkComment(getSection(path5));
|
1446
1483
|
walkComment.push(
|
1447
1484
|
`${walkCodeToName[47 /* BeginChild */]}`,
|
1448
1485
|
expr.name,
|
@@ -1451,11 +1488,11 @@ function injectWalks(path4, expr) {
|
|
1451
1488
|
appendLiteral(walks, String.fromCharCode(47 /* BeginChild */));
|
1452
1489
|
walks.push(expr, String.fromCharCode(38 /* EndChild */));
|
1453
1490
|
}
|
1454
|
-
function visit(
|
1491
|
+
function visit(path5, code) {
|
1455
1492
|
if (isOutputHTML()) {
|
1456
1493
|
return;
|
1457
1494
|
}
|
1458
|
-
const section = getSection(
|
1495
|
+
const section = getSection(path5);
|
1459
1496
|
const steps = getSteps(section);
|
1460
1497
|
const walks = getWalks(section);
|
1461
1498
|
const walkComment = getWalkComment(section);
|
@@ -1497,7 +1534,7 @@ function visit(path4, code) {
|
|
1497
1534
|
}
|
1498
1535
|
if (code !== void 0) {
|
1499
1536
|
if (code !== 32 /* Get */) {
|
1500
|
-
writeTo(
|
1537
|
+
writeTo(path5)`<!>`;
|
1501
1538
|
}
|
1502
1539
|
walkComment.push(`${walkCodeToName[code]}`);
|
1503
1540
|
walkString += String.fromCharCode(code);
|
@@ -1555,8 +1592,8 @@ var [getTrailerWrites] = createSectionState(
|
|
1555
1592
|
"trailerWrites",
|
1556
1593
|
() => [""]
|
1557
1594
|
);
|
1558
|
-
function writeTo(
|
1559
|
-
const section = getSection(
|
1595
|
+
function writeTo(path5, trailer) {
|
1596
|
+
const section = getSection(path5);
|
1560
1597
|
const get = trailer ? getTrailerWrites : getWrites;
|
1561
1598
|
return (strs, ...exprs) => {
|
1562
1599
|
const exprsLen = exprs.length;
|
@@ -1567,8 +1604,8 @@ function writeTo(path4, trailer) {
|
|
1567
1604
|
}
|
1568
1605
|
};
|
1569
1606
|
}
|
1570
|
-
function consumeHTML(
|
1571
|
-
const section = getSection(
|
1607
|
+
function consumeHTML(path5) {
|
1608
|
+
const section = getSection(path5);
|
1572
1609
|
const writes = getWrites(section);
|
1573
1610
|
const trailers = getTrailerWrites(section);
|
1574
1611
|
const writeResult = normalizeStringExpression(writes);
|
@@ -1590,14 +1627,14 @@ function consumeHTML(path4) {
|
|
1590
1627
|
return import_compiler10.types.expressionStatement(callRuntime("writeTrailers", trailerResult));
|
1591
1628
|
}
|
1592
1629
|
}
|
1593
|
-
function flushBefore(
|
1594
|
-
const expr = consumeHTML(
|
1630
|
+
function flushBefore(path5) {
|
1631
|
+
const expr = consumeHTML(path5);
|
1595
1632
|
if (expr) {
|
1596
|
-
|
1633
|
+
path5.insertBefore(expr)[0].skip();
|
1597
1634
|
}
|
1598
1635
|
}
|
1599
|
-
function flushInto(
|
1600
|
-
const target =
|
1636
|
+
function flushInto(path5) {
|
1637
|
+
const target = path5.isProgram() ? path5 : path5.get("body");
|
1601
1638
|
const expr = consumeHTML(target);
|
1602
1639
|
if (expr) {
|
1603
1640
|
target.pushContainer("body", expr)[0].skip();
|
@@ -1613,15 +1650,15 @@ function getSectionMeta(section) {
|
|
1613
1650
|
writes: normalizeStringExpression([writePrefix, ...writes, writePostfix]) || import_compiler10.types.stringLiteral("")
|
1614
1651
|
};
|
1615
1652
|
}
|
1616
|
-
function markNode(
|
1617
|
-
const section = getSection(
|
1653
|
+
function markNode(path5, binding) {
|
1654
|
+
const section = getSection(path5);
|
1618
1655
|
if (binding.type !== 0 /* dom */) {
|
1619
|
-
throw
|
1656
|
+
throw path5.buildCodeFrameError(
|
1620
1657
|
"Tried to mark a node that was not determined to need a mark during analyze."
|
1621
1658
|
);
|
1622
1659
|
}
|
1623
1660
|
if (isOutputHTML()) {
|
1624
|
-
writeTo(
|
1661
|
+
writeTo(path5)`${callRuntime(
|
1625
1662
|
"markResumeNode",
|
1626
1663
|
getScopeIdIdentifier(section),
|
1627
1664
|
getScopeAccessorLiteral(binding)
|
@@ -1926,9 +1963,9 @@ var [getSignals] = createSectionState(
|
|
1926
1963
|
"signals",
|
1927
1964
|
() => /* @__PURE__ */ new Map()
|
1928
1965
|
);
|
1929
|
-
var [
|
1930
|
-
function
|
1931
|
-
|
1966
|
+
var [getClosureSignalBuilder, _setClosureSignalBuilder] = createSectionState("queue");
|
1967
|
+
function setClosureSignalBuilder(tag, builder) {
|
1968
|
+
_setClosureSignalBuilder(getSectionForBody(tag.get("body")), builder);
|
1932
1969
|
}
|
1933
1970
|
var [forceResumeScope, _setForceResumeScope] = createSectionState("forceResumeScope");
|
1934
1971
|
function setForceResumeScope(section) {
|
@@ -1960,7 +1997,7 @@ function getSignal(section, referencedBindings, name2 = generateSignalName(refer
|
|
1960
1997
|
subscribers: [],
|
1961
1998
|
closures: /* @__PURE__ */ new Map(),
|
1962
1999
|
hasDownstreamIntersections: () => {
|
1963
|
-
let hasDownstreamIntersections = !!
|
2000
|
+
let hasDownstreamIntersections = !!signal.intersection;
|
1964
2001
|
if (!hasDownstreamIntersections) {
|
1965
2002
|
for (const value of signal.values) {
|
1966
2003
|
if (value.signal.hasDownstreamIntersections()) {
|
@@ -2014,24 +2051,41 @@ function getSignal(section, referencedBindings, name2 = generateSignalName(refer
|
|
2014
2051
|
signal
|
2015
2052
|
);
|
2016
2053
|
signal.build = () => {
|
2017
|
-
const builder =
|
2054
|
+
const builder = getClosureSignalBuilder(section);
|
2018
2055
|
const ownerScope = getScopeExpression(
|
2019
2056
|
section,
|
2020
2057
|
referencedBindings.section
|
2021
2058
|
);
|
2022
2059
|
const isImmediateOwner = ownerScope.object === scopeIdentifier;
|
2023
|
-
const isDynamicClosure =
|
2024
|
-
|
2025
|
-
|
2060
|
+
const isDynamicClosure = !isImmediateOwner || !builder;
|
2061
|
+
const render = getSignalFn(signal, [
|
2062
|
+
scopeIdentifier,
|
2063
|
+
import_compiler17.types.identifier(referencedBindings.name)
|
2064
|
+
]);
|
2065
|
+
signal.isDynamicClosure = isDynamicClosure;
|
2066
|
+
const intersection = buildSignalIntersections(signal);
|
2067
|
+
return isDynamicClosure ? callRuntime(
|
2068
|
+
"dynamicClosure",
|
2026
2069
|
getScopeAccessorLiteral(referencedBindings),
|
2027
|
-
|
2028
|
-
scopeIdentifier,
|
2029
|
-
import_compiler17.types.identifier(referencedBindings.name)
|
2030
|
-
]),
|
2070
|
+
render,
|
2031
2071
|
isImmediateOwner ? null : import_compiler17.types.arrowFunctionExpression([scopeIdentifier], ownerScope),
|
2032
|
-
|
2033
|
-
);
|
2072
|
+
intersection
|
2073
|
+
) : builder(signal, render, intersection);
|
2034
2074
|
};
|
2075
|
+
addStatement(
|
2076
|
+
"render",
|
2077
|
+
section,
|
2078
|
+
void 0,
|
2079
|
+
import_compiler17.types.expressionStatement(
|
2080
|
+
import_compiler17.types.callExpression(
|
2081
|
+
import_compiler17.types.memberExpression(signal.identifier, import_compiler17.types.identifier("_")),
|
2082
|
+
[
|
2083
|
+
scopeIdentifier,
|
2084
|
+
createScopeReadExpression(section, referencedBindings)
|
2085
|
+
]
|
2086
|
+
)
|
2087
|
+
)
|
2088
|
+
);
|
2035
2089
|
}
|
2036
2090
|
}
|
2037
2091
|
return signal;
|
@@ -2069,8 +2123,9 @@ function initValue(binding, runtimeHelper = "value") {
|
|
2069
2123
|
function getSignalFn(signal, params, referencedBindings) {
|
2070
2124
|
const section = signal.section;
|
2071
2125
|
const binding = signal.referencedBindings;
|
2072
|
-
|
2073
|
-
|
2126
|
+
const [scopeIdentifier2, valueIdentifier] = params;
|
2127
|
+
const isValueSignal = binding && !Array.isArray(binding) && binding.section === section;
|
2128
|
+
if (isValueSignal) {
|
2074
2129
|
for (const alias of binding.aliases) {
|
2075
2130
|
const aliasSignal = getSignal(alias.section, alias);
|
2076
2131
|
signal.render.push(
|
@@ -2107,12 +2162,29 @@ function getSignalFn(signal, params, referencedBindings) {
|
|
2107
2162
|
)
|
2108
2163
|
);
|
2109
2164
|
}
|
2165
|
+
if (isValueSignal) {
|
2166
|
+
const closureEntries = Array.from(signal.closures.entries()).sort(
|
2167
|
+
([a], [b]) => a.id - b.id
|
2168
|
+
);
|
2169
|
+
for (const [_closureSection, closureSignal] of closureEntries) {
|
2170
|
+
if (isStatefulReferences(closureSignal.referencedBindings)) {
|
2171
|
+
signal.render.push(
|
2172
|
+
import_compiler17.types.expressionStatement(
|
2173
|
+
import_compiler17.types.callExpression(closureSignal.identifier, [
|
2174
|
+
scopeIdentifier2,
|
2175
|
+
valueIdentifier
|
2176
|
+
])
|
2177
|
+
)
|
2178
|
+
);
|
2179
|
+
}
|
2180
|
+
}
|
2181
|
+
}
|
2110
2182
|
if (referencedBindings) {
|
2111
2183
|
signal.render.unshift(
|
2112
2184
|
import_compiler17.types.variableDeclaration("const", [
|
2113
2185
|
import_compiler17.types.variableDeclarator(
|
2114
2186
|
createScopeReadPattern(section, referencedBindings),
|
2115
|
-
|
2187
|
+
scopeIdentifier2
|
2116
2188
|
)
|
2117
2189
|
])
|
2118
2190
|
);
|
@@ -2132,7 +2204,6 @@ function getTranslatedExtraArgs(signal) {
|
|
2132
2204
|
return emptyExtraArgs;
|
2133
2205
|
}
|
2134
2206
|
function buildSignalIntersections(signal) {
|
2135
|
-
const section = signal.section;
|
2136
2207
|
let intersections = signal.intersection;
|
2137
2208
|
const binding = signal.referencedBindings;
|
2138
2209
|
if (binding && !Array.isArray(binding) && binding.section === signal.section) {
|
@@ -2163,24 +2234,6 @@ function buildSignalIntersections(signal) {
|
|
2163
2234
|
);
|
2164
2235
|
}
|
2165
2236
|
}
|
2166
|
-
const closureEntries = Array.from(signal.closures.entries()).sort(
|
2167
|
-
([a], [b]) => a.id - b.id
|
2168
|
-
);
|
2169
|
-
for (const [closureSection, closureSignal] of closureEntries) {
|
2170
|
-
const builder = getSubscribeBuilder(closureSection);
|
2171
|
-
const isImmediateOwner = closureSection.parent === section;
|
2172
|
-
if (builder && isImmediateOwner) {
|
2173
|
-
intersections = push(intersections, builder(closureSignal.identifier));
|
2174
|
-
} else if (!signal.hasDynamicSubscribers) {
|
2175
|
-
signal.hasDynamicSubscribers = true;
|
2176
|
-
}
|
2177
|
-
}
|
2178
|
-
if (signal.hasDynamicSubscribers) {
|
2179
|
-
intersections = push(
|
2180
|
-
intersections,
|
2181
|
-
callRuntime("dynamicSubscribers", signal.valueAccessor)
|
2182
|
-
);
|
2183
|
-
}
|
2184
2237
|
return intersections && import_compiler17.types.arrowFunctionExpression(
|
2185
2238
|
[],
|
2186
2239
|
Array.isArray(intersections) ? callRuntime("intersections", import_compiler17.types.arrayExpression(intersections)) : intersections
|
@@ -2474,8 +2527,8 @@ function getMappedId(reference) {
|
|
2474
2527
|
function addHTMLEffectCall(section, referencedBindings) {
|
2475
2528
|
addStatement("effect", section, referencedBindings, void 0, false);
|
2476
2529
|
}
|
2477
|
-
function writeHTMLResumeStatements(
|
2478
|
-
const section = getSectionForBody(
|
2530
|
+
function writeHTMLResumeStatements(path5, tagVarIdentifier) {
|
2531
|
+
const section = getSectionForBody(path5);
|
2479
2532
|
if (!section) return;
|
2480
2533
|
const allSignals = Array.from(getSignals(section).values());
|
2481
2534
|
const scopeIdIdentifier = getScopeIdIdentifier(section);
|
@@ -2493,9 +2546,9 @@ function writeHTMLResumeStatements(path4, tagVarIdentifier) {
|
|
2493
2546
|
}
|
2494
2547
|
setForceResumeScope(closure.section);
|
2495
2548
|
const isImmediateOwner = section.parent?.id === closure.section.id;
|
2496
|
-
const isDynamicClosure = !
|
2549
|
+
const isDynamicClosure = !getClosureSignalBuilder(section) || !isImmediateOwner;
|
2497
2550
|
if (isDynamicClosure) {
|
2498
|
-
|
2551
|
+
path5.pushContainer(
|
2499
2552
|
"body",
|
2500
2553
|
import_compiler17.types.expressionStatement(
|
2501
2554
|
callRuntime(
|
@@ -2513,7 +2566,7 @@ function writeHTMLResumeStatements(path4, tagVarIdentifier) {
|
|
2513
2566
|
for (let i = allSignals.length; i--; ) {
|
2514
2567
|
if (allSignals[i].effect.length) {
|
2515
2568
|
const signalRefs = allSignals[i].referencedBindings;
|
2516
|
-
|
2569
|
+
path5.pushContainer(
|
2517
2570
|
"body",
|
2518
2571
|
import_compiler17.types.expressionStatement(
|
2519
2572
|
callRuntime(
|
@@ -2554,7 +2607,7 @@ function writeHTMLResumeStatements(path4, tagVarIdentifier) {
|
|
2554
2607
|
}
|
2555
2608
|
}
|
2556
2609
|
if (serializedProperties.length || forceResumeScope(section)) {
|
2557
|
-
|
2610
|
+
path5.pushContainer(
|
2558
2611
|
"body",
|
2559
2612
|
import_compiler17.types.expressionStatement(
|
2560
2613
|
callRuntime(
|
@@ -2565,8 +2618,17 @@ function writeHTMLResumeStatements(path4, tagVarIdentifier) {
|
|
2565
2618
|
)
|
2566
2619
|
);
|
2567
2620
|
}
|
2568
|
-
|
2569
|
-
|
2621
|
+
const resumeClosestBranch2 = !section.isBranch && (section.hasAbortSignal || !!section.closures || !!find(section.bindings, (binding) => binding.type === 1 /* let */));
|
2622
|
+
if (resumeClosestBranch2) {
|
2623
|
+
path5.pushContainer(
|
2624
|
+
"body",
|
2625
|
+
import_compiler17.types.expressionStatement(
|
2626
|
+
callRuntime("resumeClosestBranch", scopeIdIdentifier)
|
2627
|
+
)
|
2628
|
+
);
|
2629
|
+
}
|
2630
|
+
if (path5.get("body").length) {
|
2631
|
+
path5.unshiftContainer(
|
2570
2632
|
"body",
|
2571
2633
|
import_compiler17.types.variableDeclaration("const", [
|
2572
2634
|
import_compiler17.types.variableDeclarator(scopeIdIdentifier, callRuntime("nextScopeId"))
|
@@ -2753,21 +2815,22 @@ var dom_default = {
|
|
2753
2815
|
const templateIdentifier = import_compiler18.types.identifier(domExports.template);
|
2754
2816
|
const walksIdentifier = import_compiler18.types.identifier(domExports.walks);
|
2755
2817
|
const setupIdentifier = import_compiler18.types.identifier(domExports.setup);
|
2756
|
-
const closuresIdentifier = import_compiler18.types.identifier(domExports.closures);
|
2757
2818
|
const paramsBinding = program.node.extra.binding;
|
2758
2819
|
const programParamsSignal = paramsBinding && bindingHasDownstreamExpressions(paramsBinding) ? initValue(paramsBinding) : void 0;
|
2820
|
+
const styleFile = getStyleFile(program.hub.file);
|
2821
|
+
if (styleFile) {
|
2822
|
+
(0, import_babel_utils10.importDefault)(program.hub.file, styleFile);
|
2823
|
+
}
|
2759
2824
|
forEachSectionReverse((childSection) => {
|
2760
2825
|
if (childSection !== section) {
|
2761
2826
|
const tagParamsSignal = childSection.params && initValue(childSection.params);
|
2762
2827
|
const { walks: walks2, writes: writes2, setup: setup2 } = getSectionMeta(childSection);
|
2763
|
-
const closures2 = getSectionClosuresExpr(childSection);
|
2764
2828
|
const identifier = import_compiler18.types.identifier(childSection.name);
|
2765
2829
|
const renderer = callRuntime(
|
2766
2830
|
getSectionParentIsOwner(childSection) ? "createRenderer" : "createRendererWithOwner",
|
2767
2831
|
writes2,
|
2768
2832
|
walks2,
|
2769
2833
|
setup2,
|
2770
|
-
closures2 && import_compiler18.types.arrowFunctionExpression([], closures2),
|
2771
2834
|
tagParamsSignal?.identifier && import_compiler18.types.arrowFunctionExpression([], tagParamsSignal.identifier)
|
2772
2835
|
);
|
2773
2836
|
writeSignals(childSection);
|
@@ -2787,7 +2850,6 @@ var dom_default = {
|
|
2787
2850
|
);
|
2788
2851
|
}
|
2789
2852
|
});
|
2790
|
-
const closures = getSectionClosuresExpr(section);
|
2791
2853
|
writeSignals(section);
|
2792
2854
|
writeRegisteredFns();
|
2793
2855
|
if (!setup) {
|
@@ -2817,15 +2879,6 @@ var dom_default = {
|
|
2817
2879
|
])
|
2818
2880
|
)
|
2819
2881
|
);
|
2820
|
-
if (closures) {
|
2821
|
-
program.node.body.push(
|
2822
|
-
import_compiler18.types.exportNamedDeclaration(
|
2823
|
-
import_compiler18.types.variableDeclaration("const", [
|
2824
|
-
import_compiler18.types.variableDeclarator(closuresIdentifier, closures)
|
2825
|
-
])
|
2826
|
-
)
|
2827
|
-
);
|
2828
|
-
}
|
2829
2882
|
program.node.body.push(
|
2830
2883
|
import_compiler18.types.exportDefaultDeclaration(
|
2831
2884
|
callRuntime(
|
@@ -2834,7 +2887,6 @@ var dom_default = {
|
|
2834
2887
|
templateIdentifier,
|
2835
2888
|
walksIdentifier,
|
2836
2889
|
setupIdentifier,
|
2837
|
-
closures && import_compiler18.types.arrowFunctionExpression([], closuresIdentifier),
|
2838
2890
|
programParamsSignal?.identifier && import_compiler18.types.arrowFunctionExpression([], programParamsSignal.identifier)
|
2839
2891
|
)
|
2840
2892
|
)
|
@@ -2842,23 +2894,13 @@ var dom_default = {
|
|
2842
2894
|
}
|
2843
2895
|
}
|
2844
2896
|
};
|
2845
|
-
function getSectionClosuresExpr(section) {
|
2846
|
-
if (section.closures) {
|
2847
|
-
return import_compiler18.types.arrayExpression(
|
2848
|
-
map(
|
2849
|
-
section.closures,
|
2850
|
-
(closure) => getSignal(section, closure).identifier
|
2851
|
-
).reverse()
|
2852
|
-
);
|
2853
|
-
}
|
2854
|
-
}
|
2855
2897
|
|
2856
2898
|
// src/translator/visitors/program/html.ts
|
2857
2899
|
var import_compiler19 = require("@marko/compiler");
|
2858
2900
|
|
2859
2901
|
// src/translator/util/is-static.ts
|
2860
|
-
function isStatic(
|
2861
|
-
return
|
2902
|
+
function isStatic(path5) {
|
2903
|
+
return path5.isImportDeclaration() || path5.isExportDeclaration() || path5.isMarkoScriptlet({ static: true });
|
2862
2904
|
}
|
2863
2905
|
|
2864
2906
|
// src/translator/visitors/program/html.ts
|
@@ -3057,12 +3099,12 @@ var program_default = {
|
|
3057
3099
|
if (getMarkoOpts().output === "hydrate") {
|
3058
3100
|
const entryFile = program.hub.file;
|
3059
3101
|
const visitedFiles = /* @__PURE__ */ new Set([
|
3060
|
-
(0,
|
3102
|
+
(0, import_babel_utils11.resolveRelativePath)(entryFile, entryFile.opts.filename)
|
3061
3103
|
]);
|
3062
3104
|
entry_builder_default.visit(entryFile, entryFile, function visitChild(resolved) {
|
3063
3105
|
if (!visitedFiles.has(resolved)) {
|
3064
3106
|
visitedFiles.add(resolved);
|
3065
|
-
const file = (0,
|
3107
|
+
const file = (0, import_babel_utils11.loadFileForImport)(entryFile, resolved);
|
3066
3108
|
if (file) {
|
3067
3109
|
entry_builder_default.visit(
|
3068
3110
|
file,
|
@@ -3101,9 +3143,9 @@ var program_default = {
|
|
3101
3143
|
}
|
3102
3144
|
};
|
3103
3145
|
function resolveRelativeToEntry(entryFile, file, req) {
|
3104
|
-
return file === entryFile ? (0,
|
3146
|
+
return file === entryFile ? (0, import_babel_utils11.resolveRelativePath)(file, req) : (0, import_babel_utils11.resolveRelativePath)(
|
3105
3147
|
entryFile,
|
3106
|
-
req[0] === "." ?
|
3148
|
+
req[0] === "." ? import_path2.default.join(file.opts.filename, "..", req) : req
|
3107
3149
|
);
|
3108
3150
|
}
|
3109
3151
|
function buildTemplateExports(binding, scope) {
|
@@ -3131,22 +3173,22 @@ function buildTemplateExports(binding, scope) {
|
|
3131
3173
|
}
|
3132
3174
|
|
3133
3175
|
// src/translator/util/get-root.ts
|
3134
|
-
function getMarkoRoot(
|
3135
|
-
let curPath =
|
3176
|
+
function getMarkoRoot(path5) {
|
3177
|
+
let curPath = path5;
|
3136
3178
|
do
|
3137
3179
|
curPath = curPath.parentPath;
|
3138
3180
|
while (curPath && !isMarko(curPath));
|
3139
3181
|
return curPath;
|
3140
3182
|
}
|
3141
|
-
function getExprRoot(
|
3142
|
-
let curPath =
|
3183
|
+
function getExprRoot(path5) {
|
3184
|
+
let curPath = path5;
|
3143
3185
|
while (!isMarko(curPath.parentPath)) {
|
3144
3186
|
curPath = curPath.parentPath;
|
3145
3187
|
}
|
3146
3188
|
return curPath;
|
3147
3189
|
}
|
3148
|
-
function getFnRoot(
|
3149
|
-
let curPath =
|
3190
|
+
function getFnRoot(path5) {
|
3191
|
+
let curPath = path5;
|
3150
3192
|
if (curPath.isProgram()) return;
|
3151
3193
|
while (!isFunctionExpression(curPath)) {
|
3152
3194
|
if (isMarko(curPath)) return;
|
@@ -3154,8 +3196,8 @@ function getFnRoot(path4) {
|
|
3154
3196
|
}
|
3155
3197
|
return curPath;
|
3156
3198
|
}
|
3157
|
-
function isMarko(
|
3158
|
-
switch (
|
3199
|
+
function isMarko(path5) {
|
3200
|
+
switch (path5.type) {
|
3159
3201
|
case "MarkoTag":
|
3160
3202
|
case "MarkoTagBody":
|
3161
3203
|
case "MarkoAttribute":
|
@@ -3167,8 +3209,8 @@ function isMarko(path4) {
|
|
3167
3209
|
return false;
|
3168
3210
|
}
|
3169
3211
|
}
|
3170
|
-
function isFunctionExpression(
|
3171
|
-
switch (
|
3212
|
+
function isFunctionExpression(path5) {
|
3213
|
+
switch (path5.type) {
|
3172
3214
|
case "FunctionExpression":
|
3173
3215
|
case "ArrowFunctionExpression":
|
3174
3216
|
return true;
|
@@ -3292,8 +3334,8 @@ function trackAssignment(assignment, binding) {
|
|
3292
3334
|
}
|
3293
3335
|
});
|
3294
3336
|
}
|
3295
|
-
function setReferencesScope(
|
3296
|
-
let fnRoot = getFnRoot(
|
3337
|
+
function setReferencesScope(path5) {
|
3338
|
+
let fnRoot = getFnRoot(path5);
|
3297
3339
|
while (fnRoot) {
|
3298
3340
|
(fnRoot.node.extra ??= {}).referencesScope = true;
|
3299
3341
|
fnRoot = getFnRoot(fnRoot.parentPath);
|
@@ -3635,10 +3677,10 @@ var [getReadsByExpression] = createProgramState(
|
|
3635
3677
|
var [getReadsByFunction] = createProgramState(
|
3636
3678
|
() => /* @__PURE__ */ new Map()
|
3637
3679
|
);
|
3638
|
-
function addReadToExpression(
|
3639
|
-
const exprExtra =
|
3680
|
+
function addReadToExpression(path5, binding, node) {
|
3681
|
+
const exprExtra = path5.node.extra ??= {};
|
3640
3682
|
const readsByExpression = getReadsByExpression();
|
3641
|
-
exprExtra.section = getOrCreateSection(
|
3683
|
+
exprExtra.section = getOrCreateSection(path5);
|
3642
3684
|
readsByExpression.set(
|
3643
3685
|
exprExtra,
|
3644
3686
|
push(readsByExpression.get(exprExtra), { binding, node })
|
@@ -3855,10 +3897,10 @@ function isStatefulBinding(binding) {
|
|
3855
3897
|
// src/translator/core/await.ts
|
3856
3898
|
var await_default = {
|
3857
3899
|
analyze(tag) {
|
3858
|
-
(0,
|
3859
|
-
(0,
|
3900
|
+
(0, import_babel_utils12.assertNoVar)(tag);
|
3901
|
+
(0, import_babel_utils12.assertNoArgs)(tag);
|
3860
3902
|
assertNoSpreadAttrs(tag);
|
3861
|
-
(0,
|
3903
|
+
(0, import_babel_utils12.assertNoAttributeTags)(tag);
|
3862
3904
|
const { node } = tag;
|
3863
3905
|
const [valueAttr] = node.attributes;
|
3864
3906
|
if (!valueAttr) {
|
@@ -3906,8 +3948,6 @@ var await_default = {
|
|
3906
3948
|
setForceResumeScope(bodySection);
|
3907
3949
|
}
|
3908
3950
|
flushInto(tag);
|
3909
|
-
setSubscriberBuilder(tag, () => {
|
3910
|
-
});
|
3911
3951
|
writeHTMLResumeStatements(tagBody);
|
3912
3952
|
tag.replaceWith(
|
3913
3953
|
import_compiler22.types.expressionStatement(
|
@@ -3932,7 +3972,6 @@ var await_default = {
|
|
3932
3972
|
return;
|
3933
3973
|
}
|
3934
3974
|
setSectionParentIsOwner(bodySection, true);
|
3935
|
-
setSubscriberBuilder(tag, (signal) => signal);
|
3936
3975
|
},
|
3937
3976
|
exit(tag) {
|
3938
3977
|
tag.remove();
|
@@ -3951,7 +3990,7 @@ var await_default = {
|
|
3951
3990
|
|
3952
3991
|
// src/translator/core/client.ts
|
3953
3992
|
var import_compiler23 = require("@marko/compiler");
|
3954
|
-
var
|
3993
|
+
var import_babel_utils13 = require("@marko/compiler/babel-utils");
|
3955
3994
|
var client_default = {
|
3956
3995
|
parse(tag) {
|
3957
3996
|
const {
|
@@ -3961,7 +4000,7 @@ var client_default = {
|
|
3961
4000
|
const rawValue = node.rawValue;
|
3962
4001
|
const code = rawValue.replace(/^client\s*/, "").trim();
|
3963
4002
|
const start = node.name.start + (rawValue.length - code.length);
|
3964
|
-
let body = (0,
|
4003
|
+
let body = (0, import_babel_utils13.parseStatements)(file, code, start, start + code.length);
|
3965
4004
|
if (body.length === 1 && import_compiler23.types.isBlockStatement(body[0])) {
|
3966
4005
|
body = body[0].body;
|
3967
4006
|
}
|
@@ -3982,7 +4021,7 @@ var client_default = {
|
|
3982
4021
|
|
3983
4022
|
// src/translator/core/const.ts
|
3984
4023
|
var import_compiler25 = require("@marko/compiler");
|
3985
|
-
var
|
4024
|
+
var import_babel_utils14 = require("@marko/compiler/babel-utils");
|
3986
4025
|
|
3987
4026
|
// src/translator/util/translate-var.ts
|
3988
4027
|
var import_compiler24 = require("@marko/compiler");
|
@@ -4001,8 +4040,8 @@ function translateVar(tag, initialValue, kind = "const") {
|
|
4001
4040
|
// src/translator/core/const.ts
|
4002
4041
|
var const_default = {
|
4003
4042
|
analyze(tag) {
|
4004
|
-
(0,
|
4005
|
-
(0,
|
4043
|
+
(0, import_babel_utils14.assertNoArgs)(tag);
|
4044
|
+
(0, import_babel_utils14.assertNoParams)(tag);
|
4006
4045
|
assertNoBodyContent(tag);
|
4007
4046
|
const { node } = tag;
|
4008
4047
|
const [valueAttr] = node.attributes;
|
@@ -4059,13 +4098,13 @@ var const_default = {
|
|
4059
4098
|
|
4060
4099
|
// src/translator/core/debug.ts
|
4061
4100
|
var import_compiler26 = require("@marko/compiler");
|
4062
|
-
var
|
4101
|
+
var import_babel_utils15 = require("@marko/compiler/babel-utils");
|
4063
4102
|
var debug_default = {
|
4064
4103
|
analyze(tag) {
|
4065
4104
|
const [valueAttr] = tag.node.attributes;
|
4066
|
-
(0,
|
4067
|
-
(0,
|
4068
|
-
(0,
|
4105
|
+
(0, import_babel_utils15.assertNoVar)(tag);
|
4106
|
+
(0, import_babel_utils15.assertNoArgs)(tag);
|
4107
|
+
(0, import_babel_utils15.assertNoParams)(tag);
|
4069
4108
|
assertNoBodyContent(tag);
|
4070
4109
|
if (tag.node.attributes.length > 1 || tag.node.attributes.length === 1 && (!import_compiler26.types.isMarkoAttribute(valueAttr) || !valueAttr.default && valueAttr.name !== "value")) {
|
4071
4110
|
throw tag.get("name").buildCodeFrameError(
|
@@ -4102,11 +4141,11 @@ var debug_default = {
|
|
4102
4141
|
|
4103
4142
|
// src/translator/core/define.ts
|
4104
4143
|
var import_compiler31 = require("@marko/compiler");
|
4105
|
-
var
|
4144
|
+
var import_babel_utils20 = require("@marko/compiler/babel-utils");
|
4106
4145
|
|
4107
4146
|
// src/translator/util/nested-attribute-tags.ts
|
4108
4147
|
var import_compiler27 = require("@marko/compiler");
|
4109
|
-
var
|
4148
|
+
var import_babel_utils16 = require("@marko/compiler/babel-utils");
|
4110
4149
|
|
4111
4150
|
// src/translator/util/get-parent-tag.ts
|
4112
4151
|
function getParentTag(tag) {
|
@@ -4136,12 +4175,12 @@ function analyzeAttributeTags(tag) {
|
|
4136
4175
|
const sampleAttrTagsForControlFlow = /* @__PURE__ */ new Map();
|
4137
4176
|
for (const child of attrTags2) {
|
4138
4177
|
if (child.isMarkoTag()) {
|
4139
|
-
if ((0,
|
4178
|
+
if ((0, import_babel_utils16.isAttributeTag)(child)) {
|
4140
4179
|
const name2 = getTagName(child);
|
4141
4180
|
lookup[name2] ||= createAttrTagMeta(name2, [name2]);
|
4142
4181
|
analyzeAttributeTags(child);
|
4143
4182
|
} else {
|
4144
|
-
const isRepeated = (0,
|
4183
|
+
const isRepeated = (0, import_babel_utils16.isLoopTag)(child);
|
4145
4184
|
let curGroup;
|
4146
4185
|
for (const name2 of crawlAttrTags(child, attrTagNodesByName)) {
|
4147
4186
|
const oldMeta = lookup[name2];
|
@@ -4196,7 +4235,7 @@ function crawlAttrTags(tag, attrTagNodesByName, attrTagNames = /* @__PURE__ */ n
|
|
4196
4235
|
const attrTags2 = tag.node.body.attributeTags ? tag.get("body").get("body") : tag.get("attributeTags");
|
4197
4236
|
for (const child of attrTags2) {
|
4198
4237
|
if (child.isMarkoTag()) {
|
4199
|
-
if ((0,
|
4238
|
+
if ((0, import_babel_utils16.isAttributeTag)(child)) {
|
4200
4239
|
const tagName = getTagName(child);
|
4201
4240
|
attrTagNames.add(tagName);
|
4202
4241
|
(attrTagNodesByName[tagName] ||= []).push(child);
|
@@ -4237,15 +4276,15 @@ function getConditionRoot(tag) {
|
|
4237
4276
|
|
4238
4277
|
// src/translator/util/translate-attrs.ts
|
4239
4278
|
var import_compiler30 = require("@marko/compiler");
|
4240
|
-
var
|
4279
|
+
var import_babel_utils19 = require("@marko/compiler/babel-utils");
|
4241
4280
|
|
4242
4281
|
// src/translator/core/for.ts
|
4243
4282
|
var import_compiler29 = require("@marko/compiler");
|
4244
|
-
var
|
4283
|
+
var import_babel_utils18 = require("@marko/compiler/babel-utils");
|
4245
4284
|
|
4246
4285
|
// src/translator/visitors/tag/native-tag.ts
|
4247
4286
|
var import_compiler28 = require("@marko/compiler");
|
4248
|
-
var
|
4287
|
+
var import_babel_utils17 = require("@marko/compiler/babel-utils");
|
4249
4288
|
var kNativeTagBinding = Symbol("native tag binding");
|
4250
4289
|
var kSerializeMarker = Symbol("serialize marker");
|
4251
4290
|
var kGetterId = Symbol("node getter id");
|
@@ -4347,9 +4386,9 @@ var native_tag_default = {
|
|
4347
4386
|
},
|
4348
4387
|
analyze: {
|
4349
4388
|
enter(tag) {
|
4350
|
-
(0,
|
4351
|
-
(0,
|
4352
|
-
(0,
|
4389
|
+
(0, import_babel_utils17.assertNoArgs)(tag);
|
4390
|
+
(0, import_babel_utils17.assertNoParams)(tag);
|
4391
|
+
(0, import_babel_utils17.assertNoAttributeTags)(tag);
|
4353
4392
|
const { node } = tag;
|
4354
4393
|
if (node.var && !import_compiler28.types.isIdentifier(node.var)) {
|
4355
4394
|
throw tag.get("var").buildCodeFrameError(
|
@@ -4441,7 +4480,7 @@ var native_tag_default = {
|
|
4441
4480
|
const nodeRef2 = extra[kNativeTagBinding];
|
4442
4481
|
const isHTML = isOutputHTML();
|
4443
4482
|
const name2 = tag.get("name");
|
4444
|
-
const tagDef = (0,
|
4483
|
+
const tagDef = (0, import_babel_utils17.getTagDef)(tag);
|
4445
4484
|
const write2 = writeTo(tag);
|
4446
4485
|
const section = getSection(tag);
|
4447
4486
|
if (isHTML && extra.tagNameNullable) {
|
@@ -4758,7 +4797,7 @@ var native_tag_default = {
|
|
4758
4797
|
const extra = tag.node.extra;
|
4759
4798
|
const nodeRef2 = extra[kNativeTagBinding];
|
4760
4799
|
const isHTML = isOutputHTML();
|
4761
|
-
const openTagOnly = (0,
|
4800
|
+
const openTagOnly = (0, import_babel_utils17.getTagDef)(tag)?.parseOptions?.openTagOnly;
|
4762
4801
|
const selectArgs = isHTML && htmlSelectArgs.get(tag.node);
|
4763
4802
|
const tagName = getTagName(tag);
|
4764
4803
|
if (isHTML && extra.tagNameNullable) {
|
@@ -4895,15 +4934,14 @@ function isInvokedFunction(expr) {
|
|
4895
4934
|
|
4896
4935
|
// src/translator/core/for.ts
|
4897
4936
|
var kForMarkerBinding = Symbol("for marker binding");
|
4898
|
-
var kForScopeStartIndex = Symbol("for scope start index");
|
4899
4937
|
var kOnlyChildInParent = Symbol("only child in parent");
|
4900
4938
|
var for_default = {
|
4901
4939
|
analyze(tag) {
|
4902
4940
|
const tagExtra = tag.node.extra ??= {};
|
4903
4941
|
const isAttrTag = tag.node.body.attributeTags;
|
4904
4942
|
let allowAttrs;
|
4905
|
-
(0,
|
4906
|
-
(0,
|
4943
|
+
(0, import_babel_utils18.assertNoVar)(tag);
|
4944
|
+
(0, import_babel_utils18.assertNoArgs)(tag);
|
4907
4945
|
assertNoSpreadAttrs(tag);
|
4908
4946
|
switch (getForType(tag.node)) {
|
4909
4947
|
case "of":
|
@@ -4923,7 +4961,7 @@ var for_default = {
|
|
4923
4961
|
if (!isAttrTag) {
|
4924
4962
|
allowAttrs.push("by");
|
4925
4963
|
}
|
4926
|
-
(0,
|
4964
|
+
(0, import_babel_utils18.assertAllowedAttributes)(tag, allowAttrs);
|
4927
4965
|
if (isAttrTag) return;
|
4928
4966
|
const tagBody = tag.get("body");
|
4929
4967
|
const bodySection = startSection(tagBody);
|
@@ -4931,6 +4969,7 @@ var for_default = {
|
|
4931
4969
|
dropReferences(getAllTagReferenceNodes(tag.node));
|
4932
4970
|
return;
|
4933
4971
|
}
|
4972
|
+
bodySection.isBranch = true;
|
4934
4973
|
const section = getOrCreateSection(tag);
|
4935
4974
|
if (isOnlyChildInParent(tag)) {
|
4936
4975
|
const parentTag = getParentTag(tag).node;
|
@@ -4961,22 +5000,12 @@ var for_default = {
|
|
4961
5000
|
tag.remove();
|
4962
5001
|
return;
|
4963
5002
|
}
|
4964
|
-
const tagExtra = tag.node.extra;
|
4965
|
-
const isStateful = isStatefulReferences(tagExtra.referencedBindings);
|
4966
5003
|
setSectionParentIsOwner(bodySection, true);
|
4967
5004
|
if (!isOnlyChildInParent(tag)) {
|
4968
5005
|
visit(tag, 37 /* Replace */);
|
4969
5006
|
enterShallow(tag);
|
4970
5007
|
}
|
4971
5008
|
flushBefore(tag);
|
4972
|
-
if (isStateful && !bodySection.content?.singleChild) {
|
4973
|
-
tagExtra[kForScopeStartIndex] = tag.scope.generateUidIdentifier("k");
|
4974
|
-
writeTo(tagBody)`${callRuntime(
|
4975
|
-
"markResumeScopeStart",
|
4976
|
-
getScopeIdIdentifier(bodySection),
|
4977
|
-
import_compiler29.types.updateExpression("++", tagExtra[kForScopeStartIndex])
|
4978
|
-
)}`;
|
4979
|
-
}
|
4980
5009
|
},
|
4981
5010
|
exit(tag) {
|
4982
5011
|
if (tag.node.body.attributeTags) return;
|
@@ -4994,22 +5023,12 @@ var for_default = {
|
|
4994
5023
|
const statements = [];
|
4995
5024
|
const bodyStatements = node.body.body;
|
4996
5025
|
const hasStatefulClosures = checkStatefulClosures(bodySection, true);
|
5026
|
+
const singleNodeOptimization = bodySection.content === null || bodySection.content.singleChild;
|
4997
5027
|
let keyExpression;
|
4998
5028
|
if (isStateful && isOnlyChildInParent(tag)) {
|
4999
5029
|
parentTag.node.extra[kSerializeMarker] = true;
|
5000
5030
|
}
|
5001
|
-
if (tagExtra[kForScopeStartIndex]) {
|
5002
|
-
statements.push(
|
5003
|
-
import_compiler29.types.variableDeclaration("let", [
|
5004
|
-
import_compiler29.types.variableDeclarator(
|
5005
|
-
tagExtra[kForScopeStartIndex],
|
5006
|
-
import_compiler29.types.numericLiteral(0)
|
5007
|
-
)
|
5008
|
-
])
|
5009
|
-
);
|
5010
|
-
}
|
5011
5031
|
if (isStateful || hasStatefulClosures) {
|
5012
|
-
const singleNodeOptimization = bodySection.content === null || bodySection.content.singleChild;
|
5013
5032
|
const defaultParamNames = {
|
5014
5033
|
of: ["list", "index"],
|
5015
5034
|
in: ["key", "value"],
|
@@ -5060,50 +5079,33 @@ var for_default = {
|
|
5060
5079
|
} else {
|
5061
5080
|
keyExpression = params[defaultByParamIndex];
|
5062
5081
|
}
|
5063
|
-
const write2 = writeTo(tag);
|
5064
|
-
const forScopeIdsIdentifier = tag.scope.generateUidIdentifier("forScopeIds");
|
5065
5082
|
const forScopesIdentifier = getScopeIdentifier(bodySection);
|
5066
5083
|
statements.push(
|
5067
|
-
import_compiler29.types.variableDeclaration(
|
5068
|
-
|
5069
|
-
|
5070
|
-
|
5071
|
-
|
5072
|
-
|
5073
|
-
),
|
5074
|
-
import_compiler29.types.variableDeclarator(
|
5075
|
-
forScopesIdentifier,
|
5076
|
-
import_compiler29.types.newExpression(import_compiler29.types.identifier("Map"), [])
|
5077
|
-
)
|
5078
|
-
].filter(Boolean)
|
5079
|
-
)
|
5084
|
+
import_compiler29.types.variableDeclaration("const", [
|
5085
|
+
import_compiler29.types.variableDeclarator(
|
5086
|
+
forScopesIdentifier,
|
5087
|
+
import_compiler29.types.newExpression(import_compiler29.types.identifier("Map"), [])
|
5088
|
+
)
|
5089
|
+
])
|
5080
5090
|
);
|
5081
|
-
if (isStateful) {
|
5082
|
-
|
5083
|
-
|
5084
|
-
import_compiler29.types.
|
5085
|
-
import_compiler29.types.
|
5086
|
-
|
5087
|
-
|
5088
|
-
|
5089
|
-
|
5090
|
-
|
5091
|
-
|
5091
|
+
if (keyExpression && (isStateful || hasStatefulClosures)) {
|
5092
|
+
bodyStatements.push(
|
5093
|
+
import_compiler29.types.expressionStatement(
|
5094
|
+
import_compiler29.types.callExpression(
|
5095
|
+
import_compiler29.types.memberExpression(
|
5096
|
+
getScopeIdentifier(bodySection),
|
5097
|
+
import_compiler29.types.identifier("set")
|
5098
|
+
),
|
5099
|
+
[
|
5100
|
+
keyExpression,
|
5101
|
+
callRuntime(
|
5102
|
+
"ensureScopeWithId",
|
5103
|
+
getScopeIdIdentifier(bodySection)
|
5104
|
+
)
|
5105
|
+
]
|
5092
5106
|
)
|
5093
|
-
)
|
5094
|
-
|
5095
|
-
"markResumeControlSingleNodeEnd",
|
5096
|
-
getScopeIdIdentifier(tagSection),
|
5097
|
-
getScopeAccessorLiteral(nodeRef2),
|
5098
|
-
forScopeIdsIdentifier
|
5099
|
-
)}`;
|
5100
|
-
} else {
|
5101
|
-
write2`${callRuntime(
|
5102
|
-
"markResumeControlEnd",
|
5103
|
-
getScopeIdIdentifier(tagSection),
|
5104
|
-
getScopeAccessorLiteral(nodeRef2)
|
5105
|
-
)}`;
|
5106
|
-
}
|
5107
|
+
)
|
5108
|
+
);
|
5107
5109
|
}
|
5108
5110
|
getSerializedScopeProperties(tagSection).set(
|
5109
5111
|
import_compiler29.types.stringLiteral(
|
@@ -5117,30 +5119,22 @@ var for_default = {
|
|
5117
5119
|
);
|
5118
5120
|
}
|
5119
5121
|
flushInto(tag);
|
5120
|
-
|
5122
|
+
setClosureSignalBuilder(tag, () => {
|
5121
5123
|
});
|
5122
5124
|
writeHTMLResumeStatements(tagBody);
|
5123
|
-
|
5124
|
-
|
5125
|
-
|
5126
|
-
|
5127
|
-
|
5128
|
-
|
5129
|
-
|
5130
|
-
|
5131
|
-
|
5132
|
-
keyExpression,
|
5133
|
-
callRuntime(
|
5134
|
-
"getScopeById",
|
5135
|
-
getScopeIdIdentifier(bodySection)
|
5136
|
-
)
|
5137
|
-
]
|
5138
|
-
)
|
5139
|
-
)
|
5125
|
+
const forTagArgs = getBaseArgsInForTag(forType, forAttrs);
|
5126
|
+
const forTagHTMLRuntime = isStateful ? forTypeToHTMLResumeRuntime(forType, singleNodeOptimization) : forTypeToRuntime(forType);
|
5127
|
+
forTagArgs.push(
|
5128
|
+
import_compiler29.types.arrowFunctionExpression(params, import_compiler29.types.blockStatement(bodyStatements))
|
5129
|
+
);
|
5130
|
+
if (isStateful) {
|
5131
|
+
forTagArgs.push(
|
5132
|
+
getScopeIdIdentifier(tagSection),
|
5133
|
+
getScopeAccessorLiteral(nodeRef2)
|
5140
5134
|
);
|
5141
5135
|
}
|
5142
5136
|
statements.push(
|
5143
|
-
|
5137
|
+
import_compiler29.types.expressionStatement(callRuntime(forTagHTMLRuntime, ...forTagArgs))
|
5144
5138
|
);
|
5145
5139
|
for (const replacement of tag.replaceWithMultiple(statements)) {
|
5146
5140
|
replacement.skip();
|
@@ -5171,11 +5165,12 @@ var for_default = {
|
|
5171
5165
|
const tagExtra = node.extra;
|
5172
5166
|
const { referencedBindings } = tagExtra;
|
5173
5167
|
const nodeRef2 = isOnlyChildInParent(tag) ? getParentTag(tag).node.extra[kNativeTagBinding] : tag.node.extra[kForMarkerBinding];
|
5174
|
-
|
5168
|
+
setClosureSignalBuilder(tag, (_closureSignal, render, intersection) => {
|
5175
5169
|
return callRuntime(
|
5176
|
-
"
|
5177
|
-
|
5178
|
-
|
5170
|
+
"loopClosure",
|
5171
|
+
getScopeAccessorLiteral(nodeRef2),
|
5172
|
+
render,
|
5173
|
+
intersection
|
5179
5174
|
);
|
5180
5175
|
});
|
5181
5176
|
const forType = getForType(node);
|
@@ -5314,6 +5309,27 @@ function forTypeToRuntime(type) {
|
|
5314
5309
|
return "forTo";
|
5315
5310
|
}
|
5316
5311
|
}
|
5312
|
+
function forTypeToHTMLResumeRuntime(type, singleNodeOptimization) {
|
5313
|
+
if (singleNodeOptimization) {
|
5314
|
+
switch (type) {
|
5315
|
+
case "of":
|
5316
|
+
return "resumeSingleNodeForOf";
|
5317
|
+
case "in":
|
5318
|
+
return "resumeSingleNodeForIn";
|
5319
|
+
case "to":
|
5320
|
+
return "resumeSingleNodeForTo";
|
5321
|
+
}
|
5322
|
+
} else {
|
5323
|
+
switch (type) {
|
5324
|
+
case "of":
|
5325
|
+
return "resumeForOf";
|
5326
|
+
case "in":
|
5327
|
+
return "resumeForIn";
|
5328
|
+
case "to":
|
5329
|
+
return "resumeForTo";
|
5330
|
+
}
|
5331
|
+
}
|
5332
|
+
}
|
5317
5333
|
function forTypeToDOMRuntime(type) {
|
5318
5334
|
switch (type) {
|
5319
5335
|
case "of":
|
@@ -5354,7 +5370,7 @@ function isOnlyChildInParent(tag) {
|
|
5354
5370
|
return extra[kOnlyChildInParent];
|
5355
5371
|
}
|
5356
5372
|
const parentTag = getParentTag(tag);
|
5357
|
-
if (parentTag && (0,
|
5373
|
+
if (parentTag && (0, import_babel_utils18.getTagDef)(parentTag)?.html) {
|
5358
5374
|
return extra[kOnlyChildInParent] = tag.parent.body.length === 1;
|
5359
5375
|
}
|
5360
5376
|
return extra[kOnlyChildInParent] = false;
|
@@ -5390,7 +5406,7 @@ function translateAttrs(tag, templateExports, statements = [], contentKey = "con
|
|
5390
5406
|
for (let i = 0; i < attrTags2.length; i++) {
|
5391
5407
|
const child = attrTags2[i];
|
5392
5408
|
if (child.isMarkoTag()) {
|
5393
|
-
if ((0,
|
5409
|
+
if ((0, import_babel_utils19.isAttributeTag)(child)) {
|
5394
5410
|
const attrTagMeta = attrTagLookup[getTagName(child)];
|
5395
5411
|
if (attrTagMeta.dynamic) {
|
5396
5412
|
i = addDynamicAttrTagStatements(
|
@@ -5488,7 +5504,7 @@ function getTranslatedBodyContentProperty(props) {
|
|
5488
5504
|
function addDynamicAttrTagStatements(attrTags2, index, attrTagLookup, statements, templateExports, contentKey = "content") {
|
5489
5505
|
const tag = attrTags2[index];
|
5490
5506
|
if (tag.isMarkoTag()) {
|
5491
|
-
if ((0,
|
5507
|
+
if ((0, import_babel_utils19.isAttributeTag)(tag)) {
|
5492
5508
|
const attrTagMeta = attrTagLookup[getTagName(tag)];
|
5493
5509
|
if (usesExport(templateExports, attrTagMeta.name) && attrTagMeta.dynamic) {
|
5494
5510
|
const translatedAttrTag = translateAttrs(
|
@@ -5693,7 +5709,7 @@ function buildContent(body) {
|
|
5693
5709
|
}
|
5694
5710
|
function getNonAttributeTagParent(tag) {
|
5695
5711
|
let cur = tag;
|
5696
|
-
while ((0,
|
5712
|
+
while ((0, import_babel_utils19.isAttributeTag)(cur) || (0, import_babel_utils19.isTransparentTag)(cur)) {
|
5697
5713
|
cur = getParentTag(cur);
|
5698
5714
|
}
|
5699
5715
|
return cur;
|
@@ -5702,7 +5718,7 @@ function getNonAttributeTagParent(tag) {
|
|
5702
5718
|
// src/translator/core/define.ts
|
5703
5719
|
var define_default = {
|
5704
5720
|
analyze(tag) {
|
5705
|
-
(0,
|
5721
|
+
(0, import_babel_utils20.assertNoArgs)(tag);
|
5706
5722
|
if (!tag.node.var) {
|
5707
5723
|
throw tag.get("name").buildCodeFrameError("The `define` tag requires a tag variable.");
|
5708
5724
|
}
|
@@ -5765,17 +5781,17 @@ var define_default = {
|
|
5765
5781
|
|
5766
5782
|
// src/translator/core/effect.ts
|
5767
5783
|
var import_compiler32 = require("@marko/compiler");
|
5768
|
-
var
|
5784
|
+
var import_babel_utils21 = require("@marko/compiler/babel-utils");
|
5769
5785
|
var effect_default = {
|
5770
5786
|
migrate: [
|
5771
5787
|
(tag) => {
|
5772
|
-
(0,
|
5773
|
-
(0,
|
5788
|
+
(0, import_babel_utils21.assertNoArgs)(tag);
|
5789
|
+
(0, import_babel_utils21.assertNoParams)(tag);
|
5774
5790
|
assertNoBodyContent(tag);
|
5775
|
-
(0,
|
5791
|
+
(0, import_babel_utils21.assertNoAttributeTags)(tag);
|
5776
5792
|
assertNoSpreadAttrs(tag);
|
5777
|
-
(0,
|
5778
|
-
(0,
|
5793
|
+
(0, import_babel_utils21.assertAllowedAttributes)(tag, ["value"]);
|
5794
|
+
(0, import_babel_utils21.diagnosticDeprecate)(tag, {
|
5779
5795
|
label: "The 'effect' tag has been replaced by the 'script' tag.",
|
5780
5796
|
fix() {
|
5781
5797
|
const { node } = tag;
|
@@ -5798,12 +5814,12 @@ var effect_default = {
|
|
5798
5814
|
};
|
5799
5815
|
|
5800
5816
|
// src/translator/core/export.ts
|
5801
|
-
var
|
5817
|
+
var import_babel_utils22 = require("@marko/compiler/babel-utils");
|
5802
5818
|
var export_default = {
|
5803
5819
|
parse(tag) {
|
5804
5820
|
const { node } = tag;
|
5805
5821
|
tag.replaceWith(
|
5806
|
-
(0,
|
5822
|
+
(0, import_babel_utils22.parseStatements)(tag.hub.file, node.rawValue, node.start, node.end)[0]
|
5807
5823
|
);
|
5808
5824
|
},
|
5809
5825
|
parseOptions: {
|
@@ -5819,14 +5835,14 @@ var export_default = {
|
|
5819
5835
|
|
5820
5836
|
// src/translator/core/html-comment.ts
|
5821
5837
|
var import_compiler33 = require("@marko/compiler");
|
5822
|
-
var
|
5838
|
+
var import_babel_utils23 = require("@marko/compiler/babel-utils");
|
5823
5839
|
var kCommentTagBinding = Symbol("comment tag binding");
|
5824
5840
|
var kGetterId2 = Symbol("node getter id");
|
5825
5841
|
var html_comment_default = {
|
5826
5842
|
analyze(tag) {
|
5827
|
-
(0,
|
5828
|
-
(0,
|
5829
|
-
(0,
|
5843
|
+
(0, import_babel_utils23.assertNoArgs)(tag);
|
5844
|
+
(0, import_babel_utils23.assertNoParams)(tag);
|
5845
|
+
(0, import_babel_utils23.assertNoAttributes)(tag);
|
5830
5846
|
const tagVar = tag.node.var;
|
5831
5847
|
let needsBinding = false;
|
5832
5848
|
let needsGetter = false;
|
@@ -5995,12 +6011,12 @@ var html_comment_default = {
|
|
5995
6011
|
|
5996
6012
|
// src/translator/core/html-script.ts
|
5997
6013
|
var import_compiler34 = require("@marko/compiler");
|
5998
|
-
var
|
6014
|
+
var import_babel_utils24 = require("@marko/compiler/babel-utils");
|
5999
6015
|
var kGetterId3 = Symbol("node getter id");
|
6000
6016
|
var html_script_default = {
|
6001
6017
|
analyze(tag) {
|
6002
|
-
(0,
|
6003
|
-
(0,
|
6018
|
+
(0, import_babel_utils24.assertNoArgs)(tag);
|
6019
|
+
(0, import_babel_utils24.assertNoParams)(tag);
|
6004
6020
|
const { node } = tag;
|
6005
6021
|
if (node.var && !import_compiler34.types.isIdentifier(node.var)) {
|
6006
6022
|
throw tag.get("var").buildCodeFrameError(
|
@@ -6390,12 +6406,12 @@ function getUsedAttrs2(tag) {
|
|
6390
6406
|
|
6391
6407
|
// src/translator/core/html-style.ts
|
6392
6408
|
var import_compiler35 = require("@marko/compiler");
|
6393
|
-
var
|
6409
|
+
var import_babel_utils25 = require("@marko/compiler/babel-utils");
|
6394
6410
|
var kGetterId4 = Symbol("node getter id");
|
6395
6411
|
var html_style_default = {
|
6396
6412
|
analyze(tag) {
|
6397
|
-
(0,
|
6398
|
-
(0,
|
6413
|
+
(0, import_babel_utils25.assertNoArgs)(tag);
|
6414
|
+
(0, import_babel_utils25.assertNoParams)(tag);
|
6399
6415
|
const { node } = tag;
|
6400
6416
|
if (node.var && !import_compiler35.types.isIdentifier(node.var)) {
|
6401
6417
|
throw tag.get("var").buildCodeFrameError(
|
@@ -6780,14 +6796,14 @@ function getUsedAttrs3(tag) {
|
|
6780
6796
|
|
6781
6797
|
// src/translator/core/id.ts
|
6782
6798
|
var import_compiler36 = require("@marko/compiler");
|
6783
|
-
var
|
6799
|
+
var import_babel_utils26 = require("@marko/compiler/babel-utils");
|
6784
6800
|
var id_default = {
|
6785
6801
|
analyze(tag) {
|
6786
|
-
(0,
|
6787
|
-
(0,
|
6788
|
-
(0,
|
6802
|
+
(0, import_babel_utils26.assertNoArgs)(tag);
|
6803
|
+
(0, import_babel_utils26.assertNoParams)(tag);
|
6804
|
+
(0, import_babel_utils26.assertNoAttributes)(tag);
|
6789
6805
|
assertNoBodyContent(tag);
|
6790
|
-
(0,
|
6806
|
+
(0, import_babel_utils26.assertNoAttributeTags)(tag);
|
6791
6807
|
const { node } = tag;
|
6792
6808
|
if (!node.var) {
|
6793
6809
|
throw tag.get("name").buildCodeFrameError("The `id` tag requires a tag variable.");
|
@@ -6829,7 +6845,7 @@ var id_default = {
|
|
6829
6845
|
|
6830
6846
|
// src/translator/core/if.ts
|
6831
6847
|
var import_compiler38 = require("@marko/compiler");
|
6832
|
-
var
|
6848
|
+
var import_babel_utils27 = require("@marko/compiler/babel-utils");
|
6833
6849
|
|
6834
6850
|
// src/translator/util/to-first-statement-or-block.ts
|
6835
6851
|
var import_compiler37 = require("@marko/compiler");
|
@@ -6858,6 +6874,7 @@ var IfTag = {
|
|
6858
6874
|
let singleNodeOptimization = true;
|
6859
6875
|
for (const [branchTag, branchBodySection] of branches) {
|
6860
6876
|
if (branchBodySection) {
|
6877
|
+
branchBodySection.isBranch = true;
|
6861
6878
|
branchBodySection.upstreamExpression = rootExtra;
|
6862
6879
|
if (!(branchBodySection.content === null || branchBodySection.content?.singleChild)) {
|
6863
6880
|
singleNodeOptimization = false;
|
@@ -6885,9 +6902,6 @@ var IfTag = {
|
|
6885
6902
|
if (tag.node.body.attributeTags) return;
|
6886
6903
|
const tagBody = tag.get("body");
|
6887
6904
|
const bodySection = getSectionForBody(tagBody);
|
6888
|
-
const rootExtra = getRoot(tag).node.extra;
|
6889
|
-
const isStateful = isStatefulReferences(rootExtra.referencedBindings);
|
6890
|
-
const singleNodeOptimization = rootExtra.singleNodeOptimization;
|
6891
6905
|
if (isRoot(tag)) {
|
6892
6906
|
visit(tag, 37 /* Replace */);
|
6893
6907
|
}
|
@@ -6895,12 +6909,6 @@ var IfTag = {
|
|
6895
6909
|
flushBefore(tag);
|
6896
6910
|
if (bodySection) {
|
6897
6911
|
setSectionParentIsOwner(bodySection, true);
|
6898
|
-
if (isStateful && !singleNodeOptimization) {
|
6899
|
-
writeTo(tagBody)`${callRuntime(
|
6900
|
-
"markResumeScopeStart",
|
6901
|
-
getScopeIdIdentifier(bodySection)
|
6902
|
-
)}`;
|
6903
|
-
}
|
6904
6912
|
}
|
6905
6913
|
},
|
6906
6914
|
exit(tag) {
|
@@ -6919,12 +6927,11 @@ var IfTag = {
|
|
6919
6927
|
setForceResumeScope(bodySection);
|
6920
6928
|
}
|
6921
6929
|
flushInto(tag);
|
6922
|
-
|
6930
|
+
setClosureSignalBuilder(tag, () => {
|
6923
6931
|
});
|
6924
6932
|
writeHTMLResumeStatements(tagBody);
|
6925
6933
|
}
|
6926
6934
|
if (isLast) {
|
6927
|
-
const write2 = writeTo(tag);
|
6928
6935
|
const nextTag = tag.getNextSibling();
|
6929
6936
|
const ifScopeIdIdentifier = tag.scope.generateUidIdentifier("ifScopeId");
|
6930
6937
|
const ifRendererIdentifier = tag.scope.generateUidIdentifier("ifRenderer");
|
@@ -6985,6 +6992,31 @@ var IfTag = {
|
|
6985
6992
|
if (!(isStateful || hasStatefulClosures)) {
|
6986
6993
|
nextTag.insertBefore(statement);
|
6987
6994
|
} else {
|
6995
|
+
if (isStateful) {
|
6996
|
+
getSerializedScopeProperties(section).set(
|
6997
|
+
import_compiler38.types.stringLiteral(
|
6998
|
+
getScopeAccessorLiteral(nodeRef2).value + "(" /* ConditionalRenderer */
|
6999
|
+
),
|
7000
|
+
ifRendererIdentifier
|
7001
|
+
);
|
7002
|
+
const cbNode = import_compiler38.types.arrowFunctionExpression(
|
7003
|
+
[],
|
7004
|
+
import_compiler38.types.blockStatement([statement])
|
7005
|
+
);
|
7006
|
+
statement = import_compiler38.types.expressionStatement(
|
7007
|
+
singleNodeOptimization ? callRuntime(
|
7008
|
+
"resumeSingleNodeConditional",
|
7009
|
+
cbNode,
|
7010
|
+
getScopeIdIdentifier(section),
|
7011
|
+
getScopeAccessorLiteral(nodeRef2)
|
7012
|
+
) : callRuntime(
|
7013
|
+
"resumeConditional",
|
7014
|
+
cbNode,
|
7015
|
+
getScopeIdIdentifier(section),
|
7016
|
+
getScopeAccessorLiteral(nodeRef2)
|
7017
|
+
)
|
7018
|
+
);
|
7019
|
+
}
|
6988
7020
|
nextTag.insertBefore([
|
6989
7021
|
import_compiler38.types.variableDeclaration(
|
6990
7022
|
"let",
|
@@ -6995,28 +7027,6 @@ var IfTag = {
|
|
6995
7027
|
),
|
6996
7028
|
statement
|
6997
7029
|
]);
|
6998
|
-
if (isStateful) {
|
6999
|
-
if (singleNodeOptimization) {
|
7000
|
-
write2`${callRuntime(
|
7001
|
-
"markResumeControlSingleNodeEnd",
|
7002
|
-
getScopeIdIdentifier(section),
|
7003
|
-
getScopeAccessorLiteral(nodeRef2),
|
7004
|
-
ifScopeIdIdentifier
|
7005
|
-
)}`;
|
7006
|
-
} else {
|
7007
|
-
write2`${callRuntime(
|
7008
|
-
"markResumeControlEnd",
|
7009
|
-
getScopeIdIdentifier(section),
|
7010
|
-
getScopeAccessorLiteral(nodeRef2)
|
7011
|
-
)}`;
|
7012
|
-
}
|
7013
|
-
getSerializedScopeProperties(section).set(
|
7014
|
-
import_compiler38.types.stringLiteral(
|
7015
|
-
getScopeAccessorLiteral(nodeRef2).value + "(" /* ConditionalRenderer */
|
7016
|
-
),
|
7017
|
-
ifRendererIdentifier
|
7018
|
-
);
|
7019
|
-
}
|
7020
7030
|
getSerializedScopeProperties(section).set(
|
7021
7031
|
import_compiler38.types.stringLiteral(
|
7022
7032
|
getScopeAccessorLiteral(nodeRef2).value + "!" /* ConditionalScope */
|
@@ -7055,14 +7065,21 @@ var IfTag = {
|
|
7055
7065
|
const [branchTag, branchBodySection] = branches[i];
|
7056
7066
|
const [testAttr] = branchTag.node.attributes;
|
7057
7067
|
const consequent = branchBodySection ? import_compiler38.types.identifier(branchBodySection.name) : import_compiler38.types.numericLiteral(0);
|
7058
|
-
|
7059
|
-
|
7060
|
-
|
7061
|
-
|
7062
|
-
|
7063
|
-
|
7064
|
-
|
7065
|
-
|
7068
|
+
setClosureSignalBuilder(
|
7069
|
+
branchTag,
|
7070
|
+
(_closureSignal, render, intersection) => {
|
7071
|
+
return callRuntime(
|
7072
|
+
"conditionalClosure",
|
7073
|
+
getScopeAccessorLiteral(nodeRef2),
|
7074
|
+
import_compiler38.types.arrowFunctionExpression(
|
7075
|
+
[],
|
7076
|
+
import_compiler38.types.identifier(branchBodySection.name)
|
7077
|
+
),
|
7078
|
+
render,
|
7079
|
+
intersection
|
7080
|
+
);
|
7081
|
+
}
|
7082
|
+
);
|
7066
7083
|
branchTag.remove();
|
7067
7084
|
expr = testAttr ? import_compiler38.types.conditionalExpression(testAttr.value, consequent, expr) : consequent;
|
7068
7085
|
}
|
@@ -7109,9 +7126,9 @@ var ElseTag = {
|
|
7109
7126
|
]
|
7110
7127
|
};
|
7111
7128
|
function assertValidCondition(tag) {
|
7112
|
-
(0,
|
7113
|
-
(0,
|
7114
|
-
(0,
|
7129
|
+
(0, import_babel_utils27.assertNoVar)(tag);
|
7130
|
+
(0, import_babel_utils27.assertNoArgs)(tag);
|
7131
|
+
(0, import_babel_utils27.assertNoParams)(tag);
|
7115
7132
|
assertHasBody(tag);
|
7116
7133
|
assertNoSpreadAttrs(tag);
|
7117
7134
|
switch (getTagName(tag)) {
|
@@ -7194,20 +7211,17 @@ function getBranches(tag, bodySection) {
|
|
7194
7211
|
}
|
7195
7212
|
return [isLast, branches];
|
7196
7213
|
}
|
7197
|
-
function getRoot(tag) {
|
7198
|
-
return isRoot(tag) ? tag : BRANCHES_LOOKUP.get(tag)[0][0];
|
7199
|
-
}
|
7200
7214
|
function isRoot(tag) {
|
7201
7215
|
return isCoreTagName(tag, "if");
|
7202
7216
|
}
|
7203
7217
|
|
7204
7218
|
// src/translator/core/import.ts
|
7205
|
-
var
|
7219
|
+
var import_babel_utils28 = require("@marko/compiler/babel-utils");
|
7206
7220
|
var import_default = {
|
7207
7221
|
parse(tag) {
|
7208
7222
|
const { node } = tag;
|
7209
7223
|
tag.replaceWith(
|
7210
|
-
(0,
|
7224
|
+
(0, import_babel_utils28.parseStatements)(tag.hub.file, node.rawValue, node.start, node.end)[0]
|
7211
7225
|
);
|
7212
7226
|
},
|
7213
7227
|
parseOptions: {
|
@@ -7226,7 +7240,7 @@ var import_default = {
|
|
7226
7240
|
|
7227
7241
|
// src/translator/core/let.ts
|
7228
7242
|
var import_compiler39 = require("@marko/compiler");
|
7229
|
-
var
|
7243
|
+
var import_babel_utils29 = require("@marko/compiler/babel-utils");
|
7230
7244
|
var let_default = {
|
7231
7245
|
analyze(tag) {
|
7232
7246
|
const { node } = tag;
|
@@ -7255,8 +7269,8 @@ var let_default = {
|
|
7255
7269
|
}
|
7256
7270
|
}
|
7257
7271
|
}
|
7258
|
-
(0,
|
7259
|
-
(0,
|
7272
|
+
(0, import_babel_utils29.assertNoArgs)(tag);
|
7273
|
+
(0, import_babel_utils29.assertNoParams)(tag);
|
7260
7274
|
assertNoBodyContent(tag);
|
7261
7275
|
assertNoSpreadAttrs(tag);
|
7262
7276
|
if (!tagVar) {
|
@@ -7265,7 +7279,7 @@ var let_default = {
|
|
7265
7279
|
if (!import_compiler39.types.isIdentifier(tagVar)) {
|
7266
7280
|
throw tag.get("var").buildCodeFrameError("The `let` tag variable cannot be destructured.");
|
7267
7281
|
}
|
7268
|
-
if (valueChangeAttr && (0,
|
7282
|
+
if (valueChangeAttr && (0, import_babel_utils29.computeNode)(valueChangeAttr.value)) {
|
7269
7283
|
throw tag.get("attributes").find((attr2) => attr2.node === valueChangeAttr).get("value").buildCodeFrameError(
|
7270
7284
|
"The `let` tag `valueChange` attribute must be a function."
|
7271
7285
|
);
|
@@ -7328,13 +7342,13 @@ var let_default = {
|
|
7328
7342
|
|
7329
7343
|
// src/translator/core/lifecycle.ts
|
7330
7344
|
var import_compiler40 = require("@marko/compiler");
|
7331
|
-
var
|
7345
|
+
var import_babel_utils30 = require("@marko/compiler/babel-utils");
|
7332
7346
|
var kRef = Symbol("lifecycle attrs reference");
|
7333
7347
|
var lifecycle_default = {
|
7334
7348
|
analyze(tag) {
|
7335
|
-
(0,
|
7336
|
-
(0,
|
7337
|
-
(0,
|
7349
|
+
(0, import_babel_utils30.assertNoArgs)(tag);
|
7350
|
+
(0, import_babel_utils30.assertNoVar)(tag);
|
7351
|
+
(0, import_babel_utils30.assertNoParams)(tag);
|
7338
7352
|
assertNoBodyContent(tag);
|
7339
7353
|
const { node } = tag;
|
7340
7354
|
const tagExtra = node.extra ??= {};
|
@@ -7408,13 +7422,13 @@ var lifecycle_default = {
|
|
7408
7422
|
|
7409
7423
|
// src/translator/core/log.ts
|
7410
7424
|
var import_compiler41 = require("@marko/compiler");
|
7411
|
-
var
|
7425
|
+
var import_babel_utils31 = require("@marko/compiler/babel-utils");
|
7412
7426
|
var log_default = {
|
7413
7427
|
analyze(tag) {
|
7414
7428
|
const [valueAttr] = tag.node.attributes;
|
7415
|
-
(0,
|
7416
|
-
(0,
|
7417
|
-
(0,
|
7429
|
+
(0, import_babel_utils31.assertNoArgs)(tag);
|
7430
|
+
(0, import_babel_utils31.assertNoVar)(tag);
|
7431
|
+
(0, import_babel_utils31.assertNoParams)(tag);
|
7418
7432
|
assertNoBodyContent(tag);
|
7419
7433
|
if (!valueAttr) {
|
7420
7434
|
throw tag.get("name").buildCodeFrameError("The `log` tag requires a value.");
|
@@ -7460,7 +7474,7 @@ var log_default = {
|
|
7460
7474
|
|
7461
7475
|
// src/translator/core/script.ts
|
7462
7476
|
var import_compiler42 = require("@marko/compiler");
|
7463
|
-
var
|
7477
|
+
var import_babel_utils32 = require("@marko/compiler/babel-utils");
|
7464
7478
|
var htmlScriptTagAlternateMsg = " For a native html `script` tag use the `html-script` core tag instead.";
|
7465
7479
|
var script_default = {
|
7466
7480
|
parse(tag) {
|
@@ -7480,7 +7494,7 @@ var script_default = {
|
|
7480
7494
|
}
|
7481
7495
|
const start = body[0]?.start;
|
7482
7496
|
const end = body[body.length - 1]?.end;
|
7483
|
-
const bodyStatements = (0,
|
7497
|
+
const bodyStatements = (0, import_babel_utils32.parseStatements)(tag.hub.file, code, start, end);
|
7484
7498
|
const valueFn = import_compiler42.types.arrowFunctionExpression(
|
7485
7499
|
[],
|
7486
7500
|
import_compiler42.types.blockStatement(bodyStatements),
|
@@ -7492,10 +7506,10 @@ var script_default = {
|
|
7492
7506
|
},
|
7493
7507
|
analyze(tag) {
|
7494
7508
|
const { node } = tag;
|
7495
|
-
(0,
|
7496
|
-
(0,
|
7509
|
+
(0, import_babel_utils32.assertNoArgs)(tag);
|
7510
|
+
(0, import_babel_utils32.assertNoParams)(tag);
|
7497
7511
|
assertNoBodyContent(tag);
|
7498
|
-
(0,
|
7512
|
+
(0, import_babel_utils32.assertNoAttributeTags)(tag);
|
7499
7513
|
if (node.var) {
|
7500
7514
|
throw tag.hub.buildError(
|
7501
7515
|
node.var,
|
@@ -7597,7 +7611,7 @@ function isAwaitExpression(node) {
|
|
7597
7611
|
|
7598
7612
|
// src/translator/core/server.ts
|
7599
7613
|
var import_compiler43 = require("@marko/compiler");
|
7600
|
-
var
|
7614
|
+
var import_babel_utils33 = require("@marko/compiler/babel-utils");
|
7601
7615
|
var server_default = {
|
7602
7616
|
parse(tag) {
|
7603
7617
|
const {
|
@@ -7607,7 +7621,7 @@ var server_default = {
|
|
7607
7621
|
const rawValue = node.rawValue;
|
7608
7622
|
const code = rawValue.replace(/^server\s*/, "").trim();
|
7609
7623
|
const start = node.name.start + (rawValue.length - code.length);
|
7610
|
-
let body = (0,
|
7624
|
+
let body = (0, import_babel_utils33.parseStatements)(file, code, start, start + code.length);
|
7611
7625
|
if (body.length === 1 && import_compiler43.types.isBlockStatement(body[0])) {
|
7612
7626
|
body = body[0].body;
|
7613
7627
|
}
|
@@ -7628,7 +7642,7 @@ var server_default = {
|
|
7628
7642
|
|
7629
7643
|
// src/translator/core/static.ts
|
7630
7644
|
var import_compiler44 = require("@marko/compiler");
|
7631
|
-
var
|
7645
|
+
var import_babel_utils34 = require("@marko/compiler/babel-utils");
|
7632
7646
|
var static_default = {
|
7633
7647
|
parse(tag) {
|
7634
7648
|
const {
|
@@ -7638,7 +7652,7 @@ var static_default = {
|
|
7638
7652
|
const rawValue = node.rawValue;
|
7639
7653
|
const code = rawValue.replace(/^static\s*/, "").trim();
|
7640
7654
|
const start = node.name.start + (rawValue.length - code.length);
|
7641
|
-
let body = (0,
|
7655
|
+
let body = (0, import_babel_utils34.parseStatements)(file, code, start, start + code.length);
|
7642
7656
|
if (body.length === 1 && import_compiler44.types.isBlockStatement(body[0])) {
|
7643
7657
|
body = body[0].body;
|
7644
7658
|
}
|
@@ -7659,16 +7673,16 @@ var static_default = {
|
|
7659
7673
|
|
7660
7674
|
// src/translator/core/style.ts
|
7661
7675
|
var import_compiler45 = require("@marko/compiler");
|
7662
|
-
var
|
7676
|
+
var import_babel_utils35 = require("@marko/compiler/babel-utils");
|
7663
7677
|
var import_magic_string = __toESM(require("magic-string"));
|
7664
|
-
var
|
7678
|
+
var import_path3 = __toESM(require("path"));
|
7665
7679
|
var STYLE_EXT_REG = /^style((?:\.[a-zA-Z0-9$_-]+)+)?/;
|
7666
7680
|
var htmlStyleTagAlternateMsg = " For a native html `style` tag use the `html-style` core tag instead.";
|
7667
7681
|
var style_default = {
|
7668
7682
|
analyze(tag) {
|
7669
|
-
(0,
|
7670
|
-
(0,
|
7671
|
-
(0,
|
7683
|
+
(0, import_babel_utils35.assertNoArgs)(tag);
|
7684
|
+
(0, import_babel_utils35.assertNoParams)(tag);
|
7685
|
+
(0, import_babel_utils35.assertNoAttributeTags)(tag);
|
7672
7686
|
const { node } = tag;
|
7673
7687
|
const ext = STYLE_EXT_REG.exec(node.rawValue || "")?.[1]?.slice(1);
|
7674
7688
|
for (const attr2 of node.attributes) {
|
@@ -7707,30 +7721,30 @@ var style_default = {
|
|
7707
7721
|
}
|
7708
7722
|
const markoText = node.body.body[0];
|
7709
7723
|
const { resolveVirtualDependency } = getMarkoOpts();
|
7710
|
-
const start = (0,
|
7711
|
-
const end = (0,
|
7724
|
+
const start = (0, import_babel_utils35.getStart)(file, markoText);
|
7725
|
+
const end = (0, import_babel_utils35.getEnd)(file, markoText);
|
7712
7726
|
let code = markoText.value;
|
7713
|
-
let
|
7727
|
+
let map;
|
7714
7728
|
if (resolveVirtualDependency && sourceMaps && start !== null && end !== null) {
|
7715
7729
|
const magicString = new import_magic_string.default(file.code, { filename });
|
7716
7730
|
magicString.remove(0, start);
|
7717
7731
|
magicString.remove(end, file.code.length);
|
7718
|
-
|
7732
|
+
map = magicString.generateMap({
|
7719
7733
|
source: filename,
|
7720
7734
|
includeContent: true
|
7721
7735
|
});
|
7722
7736
|
if (sourceMaps === "inline" || sourceMaps === "both") {
|
7723
7737
|
code += `
|
7724
|
-
/*# sourceMappingURL=${
|
7738
|
+
/*# sourceMappingURL=${map.toUrl()}*/`;
|
7725
7739
|
if (sourceMaps === "inline") {
|
7726
|
-
|
7740
|
+
map = void 0;
|
7727
7741
|
}
|
7728
7742
|
}
|
7729
7743
|
}
|
7730
7744
|
const importPath = resolveVirtualDependency?.(filename, {
|
7731
|
-
virtualPath: `./${
|
7745
|
+
virtualPath: `./${import_path3.default.basename(filename) + ext}`,
|
7732
7746
|
code,
|
7733
|
-
map
|
7747
|
+
map
|
7734
7748
|
});
|
7735
7749
|
if (importPath) {
|
7736
7750
|
if (!node.var) {
|
@@ -7752,7 +7766,7 @@ var style_default = {
|
|
7752
7766
|
import_compiler45.types.variableDeclaration("const", [
|
7753
7767
|
import_compiler45.types.variableDeclarator(
|
7754
7768
|
node.var,
|
7755
|
-
(0,
|
7769
|
+
(0, import_babel_utils35.importDefault)(file, importPath, "style")
|
7756
7770
|
)
|
7757
7771
|
])
|
7758
7772
|
);
|
@@ -7771,13 +7785,13 @@ var style_default = {
|
|
7771
7785
|
|
7772
7786
|
// src/translator/core/try.ts
|
7773
7787
|
var import_compiler46 = require("@marko/compiler");
|
7774
|
-
var
|
7788
|
+
var import_babel_utils36 = require("@marko/compiler/babel-utils");
|
7775
7789
|
var try_default = {
|
7776
7790
|
analyze(tag) {
|
7777
|
-
(0,
|
7778
|
-
(0,
|
7779
|
-
(0,
|
7780
|
-
(0,
|
7791
|
+
(0, import_babel_utils36.assertNoVar)(tag);
|
7792
|
+
(0, import_babel_utils36.assertNoArgs)(tag);
|
7793
|
+
(0, import_babel_utils36.assertNoParams)(tag);
|
7794
|
+
(0, import_babel_utils36.assertNoAttributes)(tag);
|
7781
7795
|
assertNoSpreadAttrs(tag);
|
7782
7796
|
analyzeAttributeTags(tag);
|
7783
7797
|
const { node } = tag;
|
@@ -7840,7 +7854,6 @@ function setAllSectionsParentIsOwner(tag) {
|
|
7840
7854
|
const bodySection = getSectionForBody(tag.get("body"));
|
7841
7855
|
if (bodySection) {
|
7842
7856
|
setSectionParentIsOwner(bodySection, true);
|
7843
|
-
setSubscriberBuilder(tag, (signal) => signal);
|
7844
7857
|
}
|
7845
7858
|
}
|
7846
7859
|
|
@@ -7920,7 +7933,7 @@ var document_type_default = {
|
|
7920
7933
|
|
7921
7934
|
// src/translator/visitors/function.ts
|
7922
7935
|
var import_compiler47 = require("@marko/compiler");
|
7923
|
-
var
|
7936
|
+
var import_babel_utils37 = require("@marko/compiler/babel-utils");
|
7924
7937
|
var functionIdsBySection = /* @__PURE__ */ new WeakMap();
|
7925
7938
|
var function_default = {
|
7926
7939
|
analyze(fn) {
|
@@ -7936,7 +7949,7 @@ var function_default = {
|
|
7936
7949
|
const name2 = extra.name = fn.node.id?.name || (isMarkoAttribute(markoRoot) ? markoRoot.node.default ? import_compiler47.types.toIdentifier(
|
7937
7950
|
markoRoot.parentPath.has("var") ? markoRoot.parentPath.get("var") : markoRoot.parentPath.get("name")
|
7938
7951
|
) : markoRoot.node.name : import_compiler47.types.isVariableDeclarator(fn.parent) && import_compiler47.types.isIdentifier(fn.parent.id) ? fn.parent.id.name : "anonymous");
|
7939
|
-
if (isMarkoAttribute(markoRoot) && ((0,
|
7952
|
+
if (isMarkoAttribute(markoRoot) && ((0, import_babel_utils37.isNativeTag)(markoRoot.parentPath) && /^on[A-Z-]/.test(markoRoot.node.name) || isCoreTagName(markoRoot.parentPath, "script") || isCoreTagName(markoRoot.parentPath, "lifecycle") || isCoreTagName(markoRoot.parentPath, "for"))) {
|
7940
7953
|
return;
|
7941
7954
|
}
|
7942
7955
|
const {
|
@@ -7957,7 +7970,7 @@ var function_default = {
|
|
7957
7970
|
id = `_${index}`;
|
7958
7971
|
}
|
7959
7972
|
extra.section = section;
|
7960
|
-
extra.registerId = (0,
|
7973
|
+
extra.registerId = (0, import_babel_utils37.getTemplateId)(
|
7961
7974
|
markoOpts,
|
7962
7975
|
filename,
|
7963
7976
|
`${section.id}/${name2 + id}`
|
@@ -7975,18 +7988,18 @@ function isFunction(fn, isStatic2) {
|
|
7975
7988
|
return false;
|
7976
7989
|
}
|
7977
7990
|
}
|
7978
|
-
function isMarkoAttribute(
|
7979
|
-
return
|
7991
|
+
function isMarkoAttribute(path5) {
|
7992
|
+
return path5 ? path5.isMarkoAttribute() : false;
|
7980
7993
|
}
|
7981
7994
|
|
7982
7995
|
// src/translator/visitors/import-declaration.ts
|
7983
|
-
var
|
7996
|
+
var import_babel_utils38 = require("@marko/compiler/babel-utils");
|
7984
7997
|
var import_declaration_default = {
|
7985
7998
|
analyze(importDecl) {
|
7986
7999
|
const { node } = importDecl;
|
7987
8000
|
const { source } = node;
|
7988
8001
|
const { value } = source;
|
7989
|
-
const tagImport = (0,
|
8002
|
+
const tagImport = (0, import_babel_utils38.resolveTagImport)(importDecl, value);
|
7990
8003
|
if (tagImport) {
|
7991
8004
|
node.extra ??= {};
|
7992
8005
|
node.extra.tagImport = tagImport;
|
@@ -8156,7 +8169,11 @@ var referenced_identifier_default = {
|
|
8156
8169
|
analyze(identifier) {
|
8157
8170
|
const { name: name2 } = identifier.node;
|
8158
8171
|
if (identifier.scope.hasBinding(name2)) return;
|
8159
|
-
if (name2 === "$global"
|
8172
|
+
if (name2 === "$global") {
|
8173
|
+
setReferencesScope(identifier);
|
8174
|
+
} else if (name2 === "$signal") {
|
8175
|
+
const section = getOrCreateSection(identifier);
|
8176
|
+
section.hasAbortSignal = true;
|
8160
8177
|
setReferencesScope(identifier);
|
8161
8178
|
}
|
8162
8179
|
},
|
@@ -8177,13 +8194,6 @@ var referenced_identifier_default = {
|
|
8177
8194
|
break;
|
8178
8195
|
case "$signal":
|
8179
8196
|
if (isOutputHTML()) {
|
8180
|
-
const section = getSection(identifier);
|
8181
|
-
if (!section.hasCleanup) {
|
8182
|
-
section.hasCleanup = true;
|
8183
|
-
const exprRoot = getExprRoot(identifier);
|
8184
|
-
const write2 = writeTo(exprRoot);
|
8185
|
-
write2`${callRuntime("markResumeCleanup", getScopeIdIdentifier(section))}`;
|
8186
|
-
}
|
8187
8197
|
identifier.replaceWith(
|
8188
8198
|
import_compiler49.types.callExpression(
|
8189
8199
|
import_compiler49.types.arrowFunctionExpression(
|
@@ -8269,20 +8279,20 @@ var scriptlet_default = {
|
|
8269
8279
|
|
8270
8280
|
// src/translator/visitors/tag/index.ts
|
8271
8281
|
var import_compiler53 = require("@marko/compiler");
|
8272
|
-
var
|
8282
|
+
var import_babel_utils42 = require("@marko/compiler/babel-utils");
|
8273
8283
|
|
8274
8284
|
// src/translator/visitors/tag/attribute-tag.ts
|
8275
8285
|
var import_compiler50 = require("@marko/compiler");
|
8276
|
-
var
|
8286
|
+
var import_babel_utils39 = require("@marko/compiler/babel-utils");
|
8277
8287
|
var attribute_tag_default = {
|
8278
8288
|
analyze: {
|
8279
8289
|
enter(tag) {
|
8280
|
-
(0,
|
8281
|
-
(0,
|
8290
|
+
(0, import_babel_utils39.assertNoVar)(tag);
|
8291
|
+
(0, import_babel_utils39.assertNoArgs)(tag);
|
8282
8292
|
const body = tag.get("body");
|
8283
8293
|
startSection(body);
|
8284
8294
|
trackParamsReferences(body, 3 /* param */);
|
8285
|
-
if (!(0,
|
8295
|
+
if (!(0, import_babel_utils39.findParentTag)(tag)) {
|
8286
8296
|
throw tag.get("name").buildCodeFrameError("@tags must be nested within another tag.");
|
8287
8297
|
}
|
8288
8298
|
}
|
@@ -8304,15 +8314,15 @@ var attribute_tag_default = {
|
|
8304
8314
|
|
8305
8315
|
// src/translator/visitors/tag/custom-tag.ts
|
8306
8316
|
var import_compiler51 = require("@marko/compiler");
|
8307
|
-
var
|
8308
|
-
var
|
8317
|
+
var import_babel_utils40 = require("@marko/compiler/babel-utils");
|
8318
|
+
var import_path4 = __toESM(require("path"));
|
8309
8319
|
var kChildScopeBinding = Symbol("custom tag child scope");
|
8310
8320
|
var custom_tag_default = {
|
8311
8321
|
analyze: {
|
8312
8322
|
enter(tag) {
|
8313
|
-
(0,
|
8323
|
+
(0, import_babel_utils40.assertAttributesOrSingleArg)(tag);
|
8314
8324
|
analyzeAttributeTags(tag);
|
8315
|
-
const templateFile = (0,
|
8325
|
+
const templateFile = (0, import_babel_utils40.getTagTemplate)(tag);
|
8316
8326
|
if (!templateFile) {
|
8317
8327
|
const tagName = getTagName(tag);
|
8318
8328
|
if (tagName && tag.scope.hasBinding(tagName)) {
|
@@ -8335,7 +8345,7 @@ var custom_tag_default = {
|
|
8335
8345
|
void 0,
|
8336
8346
|
tagExtra
|
8337
8347
|
);
|
8338
|
-
const childFile = (0,
|
8348
|
+
const childFile = (0, import_babel_utils40.loadFileForTag)(tag);
|
8339
8349
|
if (childFile.opts.filename === tag.hub.file.opts.filename) {
|
8340
8350
|
mergeReferences(section, tag.node, getAllTagReferenceNodes(tag.node));
|
8341
8351
|
} else {
|
@@ -8373,7 +8383,7 @@ function translateHTML(tag) {
|
|
8373
8383
|
writeHTMLResumeStatements(tagBody);
|
8374
8384
|
if (import_compiler51.types.isStringLiteral(node.name)) {
|
8375
8385
|
const relativePath = getTagRelativePath(tag);
|
8376
|
-
tagIdentifier = isCircularRequest(tag.hub.file, relativePath) ? htmlRendererIdentifier : (0,
|
8386
|
+
tagIdentifier = isCircularRequest(tag.hub.file, relativePath) ? htmlRendererIdentifier : (0, import_babel_utils40.importDefault)(tag.hub.file, relativePath, getTagName(tag));
|
8377
8387
|
} else {
|
8378
8388
|
tagIdentifier = node.name;
|
8379
8389
|
}
|
@@ -8390,7 +8400,7 @@ function translateHTML(tag) {
|
|
8390
8400
|
getScopeAccessorLiteral(childScopeBinding),
|
8391
8401
|
callRuntime("writeExistingScope", peekScopeId)
|
8392
8402
|
);
|
8393
|
-
const inputExport = (0,
|
8403
|
+
const inputExport = (0, import_babel_utils40.loadFileForTag)(tag)?.ast.program.extra?.domExports?.params?.props?.[0];
|
8394
8404
|
const { properties, statements } = inputExport ? translateAttrs(tag, inputExport.props) : {
|
8395
8405
|
properties: [],
|
8396
8406
|
statements: []
|
@@ -8467,7 +8477,7 @@ function translateDOM(tag) {
|
|
8467
8477
|
const { file } = tag.hub;
|
8468
8478
|
const tagName = import_compiler51.types.isIdentifier(node.name) ? node.name.name : import_compiler51.types.isStringLiteral(node.name) ? node.name.value : "tag";
|
8469
8479
|
const relativePath = getTagRelativePath(tag);
|
8470
|
-
const childFile = (0,
|
8480
|
+
const childFile = (0, import_babel_utils40.loadFileForTag)(tag);
|
8471
8481
|
const childExports = childFile.ast.program.extra.domExports;
|
8472
8482
|
const tagIdentifier = importOrSelfReferenceName(
|
8473
8483
|
file,
|
@@ -8484,10 +8494,10 @@ function translateDOM(tag) {
|
|
8484
8494
|
childScopeBinding
|
8485
8495
|
});
|
8486
8496
|
}
|
8487
|
-
write2`${(0,
|
8497
|
+
write2`${(0, import_babel_utils40.importNamed)(file, relativePath, childExports.template, `${tagName}_template`)}`;
|
8488
8498
|
injectWalks(
|
8489
8499
|
tag,
|
8490
|
-
(0,
|
8500
|
+
(0, import_babel_utils40.importNamed)(file, relativePath, childExports.walks, `${tagName}_walks`)
|
8491
8501
|
);
|
8492
8502
|
if (node.var) {
|
8493
8503
|
const source = initValue(
|
@@ -8534,8 +8544,8 @@ function getTagRelativePath(tag) {
|
|
8534
8544
|
} = tag;
|
8535
8545
|
let relativePath;
|
8536
8546
|
if (import_compiler51.types.isStringLiteral(node.name)) {
|
8537
|
-
const template = (0,
|
8538
|
-
relativePath = template && (0,
|
8547
|
+
const template = (0, import_babel_utils40.getTagTemplate)(tag);
|
8548
|
+
relativePath = template && (0, import_babel_utils40.resolveRelativePath)(file, template);
|
8539
8549
|
} else if (node.extra?.tagNameImported) {
|
8540
8550
|
relativePath = node.extra.tagNameImported;
|
8541
8551
|
}
|
@@ -8581,7 +8591,7 @@ function analyzeAttrs(section, tag, templateExport) {
|
|
8581
8591
|
const attrTags2 = tag.node.body.attributeTags ? tag.get("body").get("body") : tag.get("attributeTags");
|
8582
8592
|
for (const child of attrTags2) {
|
8583
8593
|
if (child.isMarkoTag()) {
|
8584
|
-
if ((0,
|
8594
|
+
if ((0, import_babel_utils40.isAttributeTag)(child)) {
|
8585
8595
|
const attrTagMeta = attrTagLookup[getTagName(child)];
|
8586
8596
|
const childAttrExports = templateExport.props[attrTagMeta.name];
|
8587
8597
|
if (childAttrExports) {
|
@@ -8678,7 +8688,7 @@ function writeAttrsToExports(tag, templateExport, importAlias, info) {
|
|
8678
8688
|
);
|
8679
8689
|
}
|
8680
8690
|
let translatedProps = propsToExpression(translatedAttrs.properties);
|
8681
|
-
if ((0,
|
8691
|
+
if ((0, import_babel_utils40.isAttributeTag)(tag)) {
|
8682
8692
|
translatedProps = callRuntime("attrTag", translatedProps);
|
8683
8693
|
}
|
8684
8694
|
addValue(
|
@@ -8724,7 +8734,7 @@ function writeAttrsToExports(tag, templateExport, importAlias, info) {
|
|
8724
8734
|
for (let i = 0; i < attrTags2.length; i++) {
|
8725
8735
|
const child = attrTags2[i];
|
8726
8736
|
if (child.isMarkoTag()) {
|
8727
|
-
if ((0,
|
8737
|
+
if ((0, import_babel_utils40.isAttributeTag)(child)) {
|
8728
8738
|
const attrTagMeta = attrTagLookup[getTagName(child)];
|
8729
8739
|
const childAttrExport = templateExport.props[attrTagMeta.name];
|
8730
8740
|
if (childAttrExport) {
|
@@ -8786,7 +8796,7 @@ function writeAttrsToExports(tag, templateExport, importAlias, info) {
|
|
8786
8796
|
if (bodySection && !seen.has("content")) {
|
8787
8797
|
seen.add("content");
|
8788
8798
|
if (templateExport.props.content) {
|
8789
|
-
const contentExportIdentifier = (0,
|
8799
|
+
const contentExportIdentifier = (0, import_babel_utils40.importNamed)(
|
8790
8800
|
tag.hub.file,
|
8791
8801
|
info.relativePath,
|
8792
8802
|
templateExport.props.content.id,
|
@@ -8890,11 +8900,11 @@ function importOrSelfReferenceName(file, request, name2, nameHint) {
|
|
8890
8900
|
if (isCircularRequest(file, request)) {
|
8891
8901
|
return import_compiler51.types.identifier(name2);
|
8892
8902
|
}
|
8893
|
-
return (0,
|
8903
|
+
return (0, import_babel_utils40.importNamed)(file, request, name2, nameHint);
|
8894
8904
|
}
|
8895
8905
|
function isCircularRequest(file, request) {
|
8896
8906
|
const { filename } = file.opts;
|
8897
|
-
return request === filename || request[0] === "." &&
|
8907
|
+
return request === filename || request[0] === "." && import_path4.default.resolve(filename, "..", request) === filename;
|
8898
8908
|
}
|
8899
8909
|
function callStatement(id, ...args) {
|
8900
8910
|
return import_compiler51.types.expressionStatement(callExpression(id, ...args));
|
@@ -8917,12 +8927,12 @@ function always() {
|
|
8917
8927
|
|
8918
8928
|
// src/translator/visitors/tag/dynamic-tag.ts
|
8919
8929
|
var import_compiler52 = require("@marko/compiler");
|
8920
|
-
var
|
8930
|
+
var import_babel_utils41 = require("@marko/compiler/babel-utils");
|
8921
8931
|
var kDOMBinding = Symbol("dynamic tag dom binding");
|
8922
8932
|
var dynamic_tag_default = {
|
8923
8933
|
analyze: {
|
8924
8934
|
enter(tag) {
|
8925
|
-
(0,
|
8935
|
+
(0, import_babel_utils41.assertAttributesOrArgs)(tag);
|
8926
8936
|
analyzeAttributeTags(tag);
|
8927
8937
|
const section = getOrCreateSection(tag);
|
8928
8938
|
const tagExtra = tag.node.extra ??= {};
|
@@ -8957,7 +8967,7 @@ var dynamic_tag_default = {
|
|
8957
8967
|
const isClassAPI = extra.featureType === "class";
|
8958
8968
|
let tagExpression = node.name;
|
8959
8969
|
if (import_compiler52.types.isStringLiteral(tagExpression)) {
|
8960
|
-
tagExpression = (0,
|
8970
|
+
tagExpression = (0, import_babel_utils41.importDefault)(
|
8961
8971
|
tag.hub.file,
|
8962
8972
|
getTagRelativePath(tag),
|
8963
8973
|
tagExpression.value
|
@@ -8969,10 +8979,10 @@ var dynamic_tag_default = {
|
|
8969
8979
|
"body",
|
8970
8980
|
import_compiler52.types.expressionStatement(
|
8971
8981
|
import_compiler52.types.callExpression(
|
8972
|
-
(0,
|
8982
|
+
(0, import_babel_utils41.importNamed)(tag.hub.file, getCompatRuntimeFile(), "s"),
|
8973
8983
|
[
|
8974
8984
|
import_compiler52.types.identifier(tagExpression.name),
|
8975
|
-
import_compiler52.types.stringLiteral((0,
|
8985
|
+
import_compiler52.types.stringLiteral((0, import_babel_utils41.loadFileForTag)(tag).metadata.marko.id)
|
8976
8986
|
]
|
8977
8987
|
)
|
8978
8988
|
)
|
@@ -8983,7 +8993,7 @@ var dynamic_tag_default = {
|
|
8983
8993
|
import_compiler52.types.expressionStatement(
|
8984
8994
|
callRuntime(
|
8985
8995
|
"register",
|
8986
|
-
import_compiler52.types.stringLiteral((0,
|
8996
|
+
import_compiler52.types.stringLiteral((0, import_babel_utils41.loadFileForTag)(tag).metadata.marko.id),
|
8987
8997
|
import_compiler52.types.identifier(tagExpression.name)
|
8988
8998
|
)
|
8989
8999
|
)
|
@@ -9018,7 +9028,6 @@ var dynamic_tag_default = {
|
|
9018
9028
|
if (isOutputHTML()) {
|
9019
9029
|
flushInto(tag);
|
9020
9030
|
writeHTMLResumeStatements(tag.get("body"));
|
9021
|
-
const write2 = writeTo(tag);
|
9022
9031
|
if (node.var) {
|
9023
9032
|
if (!hasMultipleArgs && args.length === 1) {
|
9024
9033
|
args.push(import_compiler52.types.unaryExpression("void", import_compiler52.types.numericLiteral(0)));
|
@@ -9042,12 +9051,14 @@ var dynamic_tag_default = {
|
|
9042
9051
|
const dynamicScopeIdentifier = currentProgramPath.scope.generateUidIdentifier("dynamicScope");
|
9043
9052
|
const dynamicTagExpr = hasMultipleArgs ? callRuntime(
|
9044
9053
|
"dynamicTagArgs",
|
9045
|
-
|
9054
|
+
getScopeIdIdentifier(section),
|
9055
|
+
getScopeAccessorLiteral(nodeRef2),
|
9046
9056
|
tagExpression,
|
9047
9057
|
import_compiler52.types.arrayExpression(args)
|
9048
9058
|
) : callRuntime(
|
9049
9059
|
"dynamicTagInput",
|
9050
|
-
|
9060
|
+
getScopeIdIdentifier(section),
|
9061
|
+
getScopeAccessorLiteral(nodeRef2),
|
9051
9062
|
tagExpression,
|
9052
9063
|
...args
|
9053
9064
|
);
|
@@ -9064,11 +9075,6 @@ var dynamic_tag_default = {
|
|
9064
9075
|
import_compiler52.types.variableDeclarator(node.var, dynamicTagExpr)
|
9065
9076
|
]) : import_compiler52.types.expressionStatement(dynamicTagExpr)
|
9066
9077
|
);
|
9067
|
-
write2`${callRuntime(
|
9068
|
-
"markResumeControlEnd",
|
9069
|
-
getScopeIdIdentifier(section),
|
9070
|
-
getScopeAccessorLiteral(nodeRef2)
|
9071
|
-
)}`;
|
9072
9078
|
getSerializedScopeProperties(section).set(
|
9073
9079
|
import_compiler52.types.stringLiteral(
|
9074
9080
|
getScopeAccessorLiteral(nodeRef2).value + "!" /* ConditionalScope */
|
@@ -9219,7 +9225,7 @@ var tag_default = {
|
|
9219
9225
|
},
|
9220
9226
|
analyze: {
|
9221
9227
|
enter(tag) {
|
9222
|
-
const tagDef = (0,
|
9228
|
+
const tagDef = (0, import_babel_utils42.getTagDef)(tag);
|
9223
9229
|
const type = analyzeTagNameType(tag);
|
9224
9230
|
const hook = tagDef?.analyzer?.hook;
|
9225
9231
|
if (hook) {
|
@@ -9243,7 +9249,7 @@ var tag_default = {
|
|
9243
9249
|
}
|
9244
9250
|
},
|
9245
9251
|
exit(tag) {
|
9246
|
-
const hook = (0,
|
9252
|
+
const hook = (0, import_babel_utils42.getTagDef)(tag)?.analyzer?.hook;
|
9247
9253
|
if (hook) {
|
9248
9254
|
exit(hook, tag);
|
9249
9255
|
return;
|
@@ -9252,7 +9258,7 @@ var tag_default = {
|
|
9252
9258
|
},
|
9253
9259
|
translate: {
|
9254
9260
|
enter(tag) {
|
9255
|
-
const tagDef = (0,
|
9261
|
+
const tagDef = (0, import_babel_utils42.getTagDef)(tag);
|
9256
9262
|
const extra = tag.node.extra;
|
9257
9263
|
if (tagDef?.translator) {
|
9258
9264
|
if (tagDef.translator.path) {
|
@@ -9269,7 +9275,7 @@ var tag_default = {
|
|
9269
9275
|
);
|
9270
9276
|
}
|
9271
9277
|
if (attr2.node.modifier) {
|
9272
|
-
if ((0,
|
9278
|
+
if ((0, import_babel_utils42.isNativeTag)(attr2.parentPath)) {
|
9273
9279
|
attr2.node.name += `:${attr2.node.modifier}`;
|
9274
9280
|
} else {
|
9275
9281
|
throw attr2.buildCodeFrameError(
|
@@ -9305,7 +9311,7 @@ var tag_default = {
|
|
9305
9311
|
}
|
9306
9312
|
},
|
9307
9313
|
exit(tag) {
|
9308
|
-
const translator = (0,
|
9314
|
+
const translator = (0, import_babel_utils42.getTagDef)(tag)?.translator;
|
9309
9315
|
if (translator) {
|
9310
9316
|
exit(translator.hook, tag);
|
9311
9317
|
return;
|