marko 6.0.162 → 6.0.164

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.
Files changed (38) hide show
  1. package/dist/common/helpers.d.ts +0 -1
  2. package/dist/common/types.d.ts +0 -1
  3. package/dist/debug/dom.js +1 -1
  4. package/dist/debug/dom.mjs +1 -1
  5. package/dist/debug/html.js +9 -2
  6. package/dist/debug/html.mjs +8 -2
  7. package/dist/dom/dom.d.ts +0 -3
  8. package/dist/dom.js +1 -1
  9. package/dist/dom.mjs +1 -1
  10. package/dist/html/attrs.d.ts +0 -2
  11. package/dist/html/content.d.ts +1 -0
  12. package/dist/html/for.d.ts +4 -3
  13. package/dist/html/template.d.ts +0 -1
  14. package/dist/html/writer.d.ts +0 -2
  15. package/dist/html.d.ts +1 -1
  16. package/dist/html.js +8 -2
  17. package/dist/html.mjs +7 -2
  18. package/dist/translator/core/for.d.ts +2 -57
  19. package/dist/translator/core/if.d.ts +70 -27
  20. package/dist/translator/core/index.d.ts +70 -84
  21. package/dist/translator/index.d.ts +70 -84
  22. package/dist/translator/index.js +250 -248
  23. package/dist/translator/util/generate-uid.d.ts +0 -1
  24. package/dist/translator/util/get-compile-stage.d.ts +0 -8
  25. package/dist/translator/util/get-root.d.ts +2 -2
  26. package/dist/translator/util/nested-attribute-tags.d.ts +1 -1
  27. package/dist/translator/util/references.d.ts +0 -2
  28. package/dist/translator/util/resolve-relative-to-entry.d.ts +2 -0
  29. package/dist/translator/util/runtime.d.ts +2 -1
  30. package/dist/translator/util/scope-read.d.ts +1 -2
  31. package/dist/translator/util/sections.d.ts +0 -1
  32. package/dist/translator/util/serialize-reasons.d.ts +0 -3
  33. package/dist/translator/util/signals.d.ts +0 -2
  34. package/dist/translator/util/state.d.ts +1 -1
  35. package/dist/translator/visitors/program/index.d.ts +0 -11
  36. package/dist/translator/visitors/program/pre-analyze.d.ts +0 -1
  37. package/package.json +1 -1
  38. /package/dist/translator/util/{get-defined-binding-expression.d.ts → get-declared-binding-expression.d.ts} +0 -0
@@ -114,7 +114,7 @@ var attrs_default = {
114
114
 
115
115
  // src/translator/core/await.ts
116
116
  var import_compiler39 = require("@marko/compiler");
117
- var import_babel_utils28 = require("@marko/compiler/babel-utils");
117
+ var import_babel_utils29 = require("@marko/compiler/babel-utils");
118
118
 
119
119
  // src/common/accessor.debug.ts
120
120
  var AccessorPrefix = /* @__PURE__ */ ((AccessorPrefix4) => {
@@ -252,7 +252,7 @@ function isNullableExpr(expr) {
252
252
 
253
253
  // src/translator/util/references.ts
254
254
  var import_compiler38 = require("@marko/compiler");
255
- var import_babel_utils27 = require("@marko/compiler/babel-utils");
255
+ var import_babel_utils28 = require("@marko/compiler/babel-utils");
256
256
  var import_config = require("@marko/compiler/config");
257
257
 
258
258
  // src/common/helpers.ts
@@ -580,12 +580,12 @@ var import_babel_utils4 = require("@marko/compiler/babel-utils");
580
580
 
581
581
  // src/translator/util/get-compile-stage.ts
582
582
  var import_babel_utils3 = require("@marko/compiler/babel-utils");
583
- function getCompileStage() {
584
- return (0, import_babel_utils3.getFile)().___compileStage;
585
- }
586
583
  function isTranslate() {
587
584
  return getCompileStage() === "translate" /* translate */;
588
585
  }
586
+ function getCompileStage() {
587
+ return (0, import_babel_utils3.getFile)().___compileStage;
588
+ }
589
589
 
590
590
  // src/translator/util/traverse.ts
591
591
  var import_compiler2 = require("@marko/compiler");
@@ -716,7 +716,7 @@ function getInitialCounts(file) {
716
716
  const counts = /* @__PURE__ */ new Map();
717
717
  const program = file.path;
718
718
  const countName = (name2) => {
719
- const match = /^$(.*?)([1-9]\d*)?$/.exec(name2);
719
+ const match = /^\$(.*?)([1-9]\d*)?$/.exec(name2);
720
720
  if (match) {
721
721
  const name3 = match[1];
722
722
  const count = match[2] ? +match[2] + 1 : 1;
@@ -1583,7 +1583,7 @@ function setPropSerializeReason(section, key, reason) {
1583
1583
 
1584
1584
  // src/translator/util/state.ts
1585
1585
  var import_babel_utils8 = require("@marko/compiler/babel-utils");
1586
- var createProgramState = (init) => {
1586
+ function createProgramState(init) {
1587
1587
  const map = /* @__PURE__ */ new WeakMap();
1588
1588
  return [
1589
1589
  () => {
@@ -1597,7 +1597,7 @@ var createProgramState = (init) => {
1597
1597
  map.set((0, import_babel_utils8.getProgram)(), value);
1598
1598
  }
1599
1599
  ];
1600
- };
1600
+ }
1601
1601
  function createSectionState(key, init) {
1602
1602
  return [
1603
1603
  (section) => {
@@ -1801,10 +1801,6 @@ var [getScopeIdIdentifier] = createSectionState(
1801
1801
  (section) => generateUidIdentifier(`scope${section.id}_id`)
1802
1802
  );
1803
1803
  var [getSectionParentIsOwner, setSectionParentIsOwner] = createSectionState("parentIsOwner", () => false);
1804
- var [_getScopeIdentifier] = createSectionState(
1805
- "scopeIdentifier",
1806
- () => import_compiler7.types.identifier("undefined")
1807
- );
1808
1804
  var [getBranchRendererArgs, setBranchRendererArgs] = createSectionState("rendererExpression");
1809
1805
  function forEachSection(fn) {
1810
1806
  const { sections } = (0, import_babel_utils10.getProgram)().node.extra;
@@ -2178,8 +2174,7 @@ function isStaticRoot(path7) {
2178
2174
 
2179
2175
  // src/translator/visitors/program/index.ts
2180
2176
  var import_compiler27 = require("@marko/compiler");
2181
- var import_babel_utils18 = require("@marko/compiler/babel-utils");
2182
- var import_path2 = __toESM(require("path"));
2177
+ var import_babel_utils19 = require("@marko/compiler/babel-utils");
2183
2178
 
2184
2179
  // src/translator/util/binding-prop-tree.ts
2185
2180
  function getBindingPropTree(binding) {
@@ -2314,9 +2309,19 @@ var entry_builder_default = {
2314
2309
  }
2315
2310
  };
2316
2311
 
2312
+ // src/translator/util/resolve-relative-to-entry.ts
2313
+ var import_babel_utils13 = require("@marko/compiler/babel-utils");
2314
+ var import_path = __toESM(require("path"));
2315
+ function resolveRelativeToEntry(entryFile, file, req) {
2316
+ return file === entryFile ? (0, import_babel_utils13.resolveRelativePath)(file, req) : (0, import_babel_utils13.resolveRelativePath)(
2317
+ entryFile,
2318
+ req[0] === "." ? import_path.default.join(file.opts.filename, "..", req) : req
2319
+ );
2320
+ }
2321
+
2317
2322
  // src/translator/util/runtime.ts
2318
2323
  var import_compiler11 = require("@marko/compiler");
2319
- var import_babel_utils13 = require("@marko/compiler/babel-utils");
2324
+ var import_babel_utils14 = require("@marko/compiler/babel-utils");
2320
2325
 
2321
2326
  // src/common/errors.ts
2322
2327
  function assertExclusiveAttrs(attrs, onError = throwErr) {
@@ -2372,16 +2377,21 @@ var escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, r
2372
2377
  function _escape(val) {
2373
2378
  return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
2374
2379
  }
2375
- var unsafeScriptReg = /<\/script/g;
2380
+ var unsafeScriptReg = /<\/script/gi;
2376
2381
  var escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
2377
2382
  function _escape_script(val) {
2378
2383
  return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
2379
2384
  }
2380
- var unsafeStyleReg = /<\/style/g;
2385
+ var unsafeStyleReg = /<\/style/gi;
2381
2386
  var escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str;
2382
2387
  function _escape_style(val) {
2383
2388
  return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
2384
2389
  }
2390
+ var unsafeCommentReg = />/g;
2391
+ var escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, "&gt;") : str;
2392
+ function _escape_comment(val) {
2393
+ return val ? escapeCommentStr(val + "") : val === 0 ? "0" : "";
2394
+ }
2385
2395
 
2386
2396
  // src/html/writer.ts
2387
2397
  if (false) {
@@ -2503,7 +2513,7 @@ var pureDOMFunctions = /* @__PURE__ */ new Set([
2503
2513
  function importRuntime(name2) {
2504
2514
  const { output } = getMarkoOpts();
2505
2515
  return toMemberExpression(
2506
- (0, import_babel_utils13.importStar)((0, import_babel_utils13.getFile)(), getRuntimePath(output), "_"),
2516
+ (0, import_babel_utils14.importStar)((0, import_babel_utils14.getFile)(), getRuntimePath(output), "_"),
2507
2517
  name2
2508
2518
  );
2509
2519
  }
@@ -2525,6 +2535,7 @@ function callRuntime(name2, ...args) {
2525
2535
  function getHTMLRuntime() {
2526
2536
  return {
2527
2537
  _escape,
2538
+ _escape_comment,
2528
2539
  _unescaped,
2529
2540
  _attr,
2530
2541
  _attr_class,
@@ -2554,7 +2565,7 @@ function getCompatRuntimeFile() {
2554
2565
 
2555
2566
  // src/translator/visitors/program/dom.ts
2556
2567
  var import_compiler23 = require("@marko/compiler");
2557
- var import_babel_utils16 = require("@marko/compiler/babel-utils");
2568
+ var import_babel_utils17 = require("@marko/compiler/babel-utils");
2558
2569
 
2559
2570
  // src/translator/util/binding-has-prop.ts
2560
2571
  function bindingHasProperty(binding, properties) {
@@ -2587,7 +2598,7 @@ function bindingHasProperty(binding, properties) {
2587
2598
  }
2588
2599
 
2589
2600
  // src/translator/util/get-style-file.ts
2590
- var import_path = __toESM(require("path"));
2601
+ var import_path2 = __toESM(require("path"));
2591
2602
  function getStyleFile(file) {
2592
2603
  const { filename } = file.opts;
2593
2604
  const fs = file.markoOpts.fileSystem;
@@ -2595,14 +2606,14 @@ function getStyleFile(file) {
2595
2606
  const styleMatch = new RegExp(
2596
2607
  `^(${escapeRegExp(base)}\\.${"index" === base ? "|" : ""})style\\.\\w+$`
2597
2608
  );
2598
- for (const file2 of fs.readdirSync(import_path.default.dirname(filename)).sort()) {
2609
+ for (const file2 of fs.readdirSync(import_path2.default.dirname(filename)).sort()) {
2599
2610
  if (styleMatch.test(file2)) {
2600
2611
  return `./${file2}`;
2601
2612
  }
2602
2613
  }
2603
2614
  }
2604
2615
  function getBase(filename) {
2605
- const start = filename.lastIndexOf(import_path.default.sep) + 1;
2616
+ const start = filename.lastIndexOf(import_path2.default.sep) + 1;
2606
2617
  const leftDot = filename.indexOf(".", start);
2607
2618
  if (leftDot === -1) {
2608
2619
  return filename.slice(start);
@@ -2624,11 +2635,11 @@ function escapeRegExp(str) {
2624
2635
 
2625
2636
  // src/translator/util/signals.ts
2626
2637
  var import_compiler22 = require("@marko/compiler");
2627
- var import_babel_utils15 = require("@marko/compiler/babel-utils");
2638
+ var import_babel_utils16 = require("@marko/compiler/babel-utils");
2628
2639
 
2629
2640
  // src/translator/core/return.ts
2630
2641
  var import_compiler17 = require("@marko/compiler");
2631
- var import_babel_utils14 = require("@marko/compiler/babel-utils");
2642
+ var import_babel_utils15 = require("@marko/compiler/babel-utils");
2632
2643
 
2633
2644
  // src/translator/util/get-known-attr-values.ts
2634
2645
  function getKnownAttrValues(tag) {
@@ -3177,14 +3188,14 @@ function unwrapWrite(write) {
3177
3188
  var [getSectionReturnValueIdentifier, setReturnValueIdentifier] = createSectionState("returnValue");
3178
3189
  var return_default = {
3179
3190
  analyze(tag) {
3180
- (0, import_babel_utils14.assertNoArgs)(tag);
3181
- (0, import_babel_utils14.assertNoVar)(tag);
3182
- (0, import_babel_utils14.assertNoParams)(tag);
3191
+ (0, import_babel_utils15.assertNoArgs)(tag);
3192
+ (0, import_babel_utils15.assertNoVar)(tag);
3193
+ (0, import_babel_utils15.assertNoParams)(tag);
3183
3194
  assertNoBodyContent(tag);
3184
- (0, import_babel_utils14.assertAllowedAttributes)(tag, ["value", "valueChange"]);
3195
+ (0, import_babel_utils15.assertAllowedAttributes)(tag, ["value", "valueChange"]);
3185
3196
  const parentTag = getParentTag(tag);
3186
3197
  if (parentTag) {
3187
- if ((0, import_babel_utils14.isNativeTag)(parentTag)) {
3198
+ if ((0, import_babel_utils15.isNativeTag)(parentTag)) {
3188
3199
  throw tag.get("name").buildCodeFrameError(
3189
3200
  "The [`<return>` tag](https://markojs.com/docs/reference/core-tag#return) can not be used in a [native tag](https://markojs.com/docs/reference/native-tag)."
3190
3201
  );
@@ -3353,7 +3364,7 @@ function forEachIdentifierPath(nodePath, cb) {
3353
3364
  }
3354
3365
  }
3355
3366
 
3356
- // src/translator/util/get-defined-binding-expression.ts
3367
+ // src/translator/util/get-declared-binding-expression.ts
3357
3368
  var import_compiler18 = require("@marko/compiler");
3358
3369
  function getDeclaredBindingExpression(binding) {
3359
3370
  const canonicalBinding = getCanonicalBinding(binding);
@@ -3522,7 +3533,7 @@ function getSignal(section, referencedBindings, name2) {
3522
3533
  let signal = signals.get(referencedBindings);
3523
3534
  if (!signal) {
3524
3535
  const signalName = name2 ?? (referencedBindings ? getDebugNamesAsIdentifier(referencedBindings) : "setup");
3525
- const exportName = referencedBindings ? !Array.isArray(referencedBindings) && referencedBindings.section === section && referencedBindings.export : !section.parent && (0, import_babel_utils15.getProgram)().node.extra.domExports?.setup;
3536
+ const exportName = referencedBindings ? !Array.isArray(referencedBindings) && referencedBindings.section === section && referencedBindings.export : !section.parent && (0, import_babel_utils16.getProgram)().node.extra.domExports?.setup;
3526
3537
  signals.set(
3527
3538
  referencedBindings,
3528
3539
  signal = {
@@ -3941,7 +3952,7 @@ function getResumeRegisterId(section, referencedBindings, type) {
3941
3952
  const {
3942
3953
  markoOpts,
3943
3954
  opts: { filename }
3944
- } = (0, import_babel_utils15.getFile)();
3955
+ } = (0, import_babel_utils16.getFile)();
3945
3956
  let name2 = "";
3946
3957
  if (referencedBindings) {
3947
3958
  if (typeof referencedBindings === "string") {
@@ -3954,7 +3965,7 @@ function getResumeRegisterId(section, referencedBindings, type) {
3954
3965
  name2 += `_${referencedBindings.name}`;
3955
3966
  }
3956
3967
  }
3957
- return (0, import_babel_utils15.getTemplateId)(
3968
+ return (0, import_babel_utils16.getTemplateId)(
3958
3969
  markoOpts,
3959
3970
  filename,
3960
3971
  `${section.id}${name2}${type ? "/" + type : ""}`
@@ -4031,7 +4042,7 @@ function writeSignals(section) {
4031
4042
  if (signalDeclaration) {
4032
4043
  signalStatements.push(signalDeclaration);
4033
4044
  }
4034
- (0, import_babel_utils15.getProgram)().node.body.push(...signalStatements);
4045
+ (0, import_babel_utils16.getProgram)().node.body.push(...signalStatements);
4035
4046
  written.add(signal);
4036
4047
  }
4037
4048
  return written;
@@ -4056,7 +4067,7 @@ function writeGetters(section) {
4056
4067
  currentSection = parentSection;
4057
4068
  }
4058
4069
  }
4059
- (0, import_babel_utils15.getProgram)().node.body.push(
4070
+ (0, import_babel_utils16.getProgram)().node.body.push(
4060
4071
  import_compiler22.types.variableDeclaration("const", [
4061
4072
  import_compiler22.types.variableDeclarator(
4062
4073
  getterIdentifier,
@@ -4078,7 +4089,7 @@ function writeGetters(section) {
4078
4089
  });
4079
4090
  }
4080
4091
  function writeRegisteredFns() {
4081
- const registeredFns = registeredFnsForProgram.get((0, import_babel_utils15.getProgram)().node);
4092
+ const registeredFns = registeredFnsForProgram.get((0, import_babel_utils16.getProgram)().node);
4082
4093
  const statements = [];
4083
4094
  if (registeredFns) {
4084
4095
  for (const registeredFn of registeredFns) {
@@ -4113,7 +4124,7 @@ function writeRegisteredFns() {
4113
4124
  )
4114
4125
  );
4115
4126
  }
4116
- (0, import_babel_utils15.getProgram)().node.body.push(...statements);
4127
+ (0, import_babel_utils16.getProgram)().node.body.push(...statements);
4117
4128
  }
4118
4129
  }
4119
4130
  function toReturnedFunction(rawFn) {
@@ -4156,12 +4167,15 @@ function writeHTMLResumeStatements(path7) {
4156
4167
  getAccessorPrefix().ClosureScopes
4157
4168
  );
4158
4169
  }
4159
- setBindingSerializedValue(
4160
- section,
4161
- closure,
4162
- import_compiler22.types.numericLiteral(getDynamicClosureIndex(closure, section)),
4163
- getAccessorPrefix().ClosureSignalIndex
4164
- );
4170
+ const closureIndex = getDynamicClosureIndex(closure, section);
4171
+ if (closureIndex) {
4172
+ setBindingSerializedValue(
4173
+ section,
4174
+ closure,
4175
+ import_compiler22.types.numericLiteral(closureIndex),
4176
+ getAccessorPrefix().ClosureSignalIndex
4177
+ );
4178
+ }
4165
4179
  if (underTryPlaceholder(section)) {
4166
4180
  const reason = getSerializeReason(section);
4167
4181
  if (reason) {
@@ -4533,9 +4547,9 @@ function getRegisteredFnExpression(node) {
4533
4547
  const id = extra.name;
4534
4548
  const referencesScope = extra.referencesScope;
4535
4549
  const referencedBindings = extra.referencedBindingsInFunction;
4536
- let registeredFns = registeredFnsForProgram.get((0, import_babel_utils15.getProgram)().node);
4550
+ let registeredFns = registeredFnsForProgram.get((0, import_babel_utils16.getProgram)().node);
4537
4551
  if (!registeredFns) {
4538
- registeredFnsForProgram.set((0, import_babel_utils15.getProgram)().node, registeredFns = []);
4552
+ registeredFnsForProgram.set((0, import_babel_utils16.getProgram)().node, registeredFns = []);
4539
4553
  }
4540
4554
  registeredFns.push({
4541
4555
  id,
@@ -4597,7 +4611,7 @@ var dom_default = {
4597
4611
  let extraDecls = decls;
4598
4612
  const styleFile = getStyleFile(program.hub.file);
4599
4613
  if (styleFile) {
4600
- (0, import_babel_utils16.importDefault)(program.hub.file, styleFile);
4614
+ (0, import_babel_utils17.importDefault)(program.hub.file, styleFile);
4601
4615
  }
4602
4616
  forEachSectionReverse((childSection) => {
4603
4617
  if (childSection !== section) {
@@ -4947,7 +4961,7 @@ function getRegisteredFnExpression2(node) {
4947
4961
 
4948
4962
  // src/translator/visitors/program/pre-analyze.ts
4949
4963
  var import_compiler26 = require("@marko/compiler");
4950
- var import_babel_utils17 = require("@marko/compiler/babel-utils");
4964
+ var import_babel_utils18 = require("@marko/compiler/babel-utils");
4951
4965
 
4952
4966
  // src/translator/core/textarea.ts
4953
4967
  var import_compiler25 = require("@marko/compiler");
@@ -5021,7 +5035,7 @@ function normalizeTag(tag) {
5021
5035
  const tagName = name2.value;
5022
5036
  if (tag.scope.getBinding(tagName) && TAG_NAME_IDENTIFIER_REG.test(tagName)) {
5023
5037
  node.name = withPreviousLocation(import_compiler26.types.identifier(tagName), name2);
5024
- } else if ((0, import_babel_utils17.isNativeTag)(tag)) {
5038
+ } else if ((0, import_babel_utils18.isNativeTag)(tag)) {
5025
5039
  attrNameReg = htmlAttrNameReg;
5026
5040
  switch (tagName) {
5027
5041
  case "textarea":
@@ -5365,12 +5379,12 @@ var program_default = {
5365
5379
  if (getMarkoOpts().output === "hydrate") {
5366
5380
  const entryFile = program.hub.file;
5367
5381
  const visitedFiles = /* @__PURE__ */ new Set([
5368
- (0, import_babel_utils18.resolveRelativePath)(entryFile, entryFile.opts.filename)
5382
+ (0, import_babel_utils19.resolveRelativePath)(entryFile, entryFile.opts.filename)
5369
5383
  ]);
5370
5384
  entry_builder_default.visit(entryFile, entryFile, function visitChild(resolved) {
5371
5385
  if (!visitedFiles.has(resolved)) {
5372
5386
  visitedFiles.add(resolved);
5373
- const file = (0, import_babel_utils18.loadFileForImport)(entryFile, resolved);
5387
+ const file = (0, import_babel_utils19.loadFileForImport)(entryFile, resolved);
5374
5388
  if (file) {
5375
5389
  entry_builder_default.visit(
5376
5390
  file,
@@ -5412,12 +5426,6 @@ var program_default = {
5412
5426
  }
5413
5427
  }
5414
5428
  };
5415
- function resolveRelativeToEntry(entryFile, file, req) {
5416
- return file === entryFile ? (0, import_babel_utils18.resolveRelativePath)(file, req) : (0, import_babel_utils18.resolveRelativePath)(
5417
- entryFile,
5418
- req[0] === "." ? import_path2.default.join(file.opts.filename, "..", req) : req
5419
- );
5420
- }
5421
5429
 
5422
5430
  // src/translator/util/is-event-or-change-handler.ts
5423
5431
  function isEventOrChangeHandler(prop) {
@@ -5426,11 +5434,11 @@ function isEventOrChangeHandler(prop) {
5426
5434
 
5427
5435
  // src/translator/util/known-tag.ts
5428
5436
  var import_compiler37 = require("@marko/compiler");
5429
- var import_babel_utils26 = require("@marko/compiler/babel-utils");
5437
+ var import_babel_utils27 = require("@marko/compiler/babel-utils");
5430
5438
 
5431
5439
  // src/translator/util/nested-attribute-tags.ts
5432
5440
  var import_compiler28 = require("@marko/compiler");
5433
- var import_babel_utils19 = require("@marko/compiler/babel-utils");
5441
+ var import_babel_utils20 = require("@marko/compiler/babel-utils");
5434
5442
  var attrTagToIdentifierLookup = /* @__PURE__ */ new WeakMap();
5435
5443
  function getAttrTagIdentifier(meta) {
5436
5444
  let name2 = attrTagToIdentifierLookup.get(meta);
@@ -5440,9 +5448,12 @@ function getAttrTagIdentifier(meta) {
5440
5448
  }
5441
5449
  return import_compiler28.types.identifier(name2);
5442
5450
  }
5451
+ function getAttrTagPaths(tag) {
5452
+ return tag.node.body.attributeTags ? tag.get("body").get("body") : tag.get("attributeTags");
5453
+ }
5443
5454
  function analyzeAttributeTags(tag) {
5444
5455
  if (tag.node.extra?.attributeTags) return tag.node.extra.attributeTags;
5445
- const attrTags2 = tag.node.body.attributeTags ? tag.get("body").get("body") : tag.get("attributeTags");
5456
+ const attrTags2 = getAttrTagPaths(tag);
5446
5457
  if (!attrTags2.length) return;
5447
5458
  const tagExtra = tag.node.extra ??= {};
5448
5459
  const lookup = tagExtra.attributeTags = {};
@@ -5450,13 +5461,13 @@ function analyzeAttributeTags(tag) {
5450
5461
  const sampleAttrTagsForControlFlow = /* @__PURE__ */ new Map();
5451
5462
  for (const child of attrTags2) {
5452
5463
  if (child.isMarkoTag()) {
5453
- if ((0, import_babel_utils19.isAttributeTag)(child)) {
5464
+ if ((0, import_babel_utils20.isAttributeTag)(child)) {
5454
5465
  const name2 = getTagName(child);
5455
5466
  lookup[name2] ||= createAttrTagMeta(name2, [name2]);
5456
5467
  (attrTagNodesByName[name2] ||= []).push(child);
5457
5468
  analyzeAttributeTags(child);
5458
5469
  } else {
5459
- const isRepeated = (0, import_babel_utils19.isLoopTag)(child);
5470
+ const isRepeated = (0, import_babel_utils20.isLoopTag)(child);
5460
5471
  let curGroup;
5461
5472
  for (const name2 of crawlAttrTags(child, attrTagNodesByName)) {
5462
5473
  const oldMeta = lookup[name2];
@@ -5508,10 +5519,10 @@ function createAttrTagMeta(name2, group) {
5508
5519
  };
5509
5520
  }
5510
5521
  function crawlAttrTags(tag, attrTagNodesByName, attrTagNames = /* @__PURE__ */ new Set()) {
5511
- const attrTags2 = tag.node.body.attributeTags ? tag.get("body").get("body") : tag.get("attributeTags");
5522
+ const attrTags2 = getAttrTagPaths(tag);
5512
5523
  for (const child of attrTags2) {
5513
5524
  if (child.isMarkoTag()) {
5514
- if ((0, import_babel_utils19.isAttributeTag)(child)) {
5525
+ if ((0, import_babel_utils20.isAttributeTag)(child)) {
5515
5526
  const tagName = getTagName(child);
5516
5527
  attrTagNames.add(tagName);
5517
5528
  (attrTagNodesByName[tagName] ||= []).push(child);
@@ -5552,7 +5563,7 @@ function getConditionRoot(tag) {
5552
5563
 
5553
5564
  // src/translator/util/set-tag-sections-downstream.ts
5554
5565
  var import_compiler29 = require("@marko/compiler");
5555
- var import_babel_utils20 = require("@marko/compiler/babel-utils");
5566
+ var import_babel_utils21 = require("@marko/compiler/babel-utils");
5556
5567
  var [getTagDownstreams] = createSectionState(
5557
5568
  "tag-downstreams",
5558
5569
  () => /* @__PURE__ */ new Map()
@@ -5579,10 +5590,10 @@ function crawlSectionsAndSetBinding(tag, binding, properties, skip2) {
5579
5590
  }
5580
5591
  const attrTagLookup = analyzeAttributeTags(tag);
5581
5592
  if (!attrTagLookup) return;
5582
- const attrTags2 = tag.node.body.attributeTags ? tag.get("body").get("body") : tag.get("attributeTags");
5593
+ const attrTags2 = getAttrTagPaths(tag);
5583
5594
  for (const child of attrTags2) {
5584
5595
  if (child.isMarkoTag()) {
5585
- if ((0, import_babel_utils20.isAttributeTag)(child)) {
5596
+ if ((0, import_babel_utils21.isAttributeTag)(child)) {
5586
5597
  const attrTagMeta = attrTagLookup[getTagName(child)];
5587
5598
  crawlSectionsAndSetBinding(
5588
5599
  child,
@@ -5598,19 +5609,19 @@ function crawlSectionsAndSetBinding(tag, binding, properties, skip2) {
5598
5609
 
5599
5610
  // src/translator/util/translate-attrs.ts
5600
5611
  var import_compiler35 = require("@marko/compiler");
5601
- var import_babel_utils25 = require("@marko/compiler/babel-utils");
5612
+ var import_babel_utils26 = require("@marko/compiler/babel-utils");
5602
5613
 
5603
5614
  // src/translator/core/for.ts
5604
5615
  var import_compiler34 = require("@marko/compiler");
5605
- var import_babel_utils24 = require("@marko/compiler/babel-utils");
5616
+ var import_babel_utils25 = require("@marko/compiler/babel-utils");
5606
5617
 
5607
5618
  // src/translator/util/is-only-child-in-parent.ts
5608
5619
  var import_compiler33 = require("@marko/compiler");
5609
- var import_babel_utils23 = require("@marko/compiler/babel-utils");
5620
+ var import_babel_utils24 = require("@marko/compiler/babel-utils");
5610
5621
 
5611
5622
  // src/translator/visitors/tag/native-tag.ts
5612
5623
  var import_compiler32 = require("@marko/compiler");
5613
- var import_babel_utils22 = require("@marko/compiler/babel-utils");
5624
+ var import_babel_utils23 = require("@marko/compiler/babel-utils");
5614
5625
 
5615
5626
  // src/translator/util/body-to-text-literal.ts
5616
5627
  var import_compiler30 = require("@marko/compiler");
@@ -5649,7 +5660,7 @@ function templateElement(value, tail) {
5649
5660
 
5650
5661
  // src/translator/util/is-non-html-text.ts
5651
5662
  var import_compiler31 = require("@marko/compiler");
5652
- var import_babel_utils21 = require("@marko/compiler/babel-utils");
5663
+ var import_babel_utils22 = require("@marko/compiler/babel-utils");
5653
5664
  function isNonHTMLText(placeholder) {
5654
5665
  const parentTag = placeholder.parentPath.isMarkoTagBody() && placeholder.parentPath.parentPath;
5655
5666
  if (parentTag) {
@@ -5667,7 +5678,7 @@ function isNonHTMLText(placeholder) {
5667
5678
  return false;
5668
5679
  }
5669
5680
  function isTextOnlyNativeTag(tag) {
5670
- const def = (0, import_babel_utils21.getTagDef)(tag);
5681
+ const def = (0, import_babel_utils22.getTagDef)(tag);
5671
5682
  return !!(def && def.html && (def.name === "title" || def.parseOptions?.text));
5672
5683
  }
5673
5684
 
@@ -5679,9 +5690,9 @@ var htmlSelectArgs = /* @__PURE__ */ new WeakMap();
5679
5690
  var native_tag_default = {
5680
5691
  analyze: {
5681
5692
  enter(tag) {
5682
- (0, import_babel_utils22.assertNoArgs)(tag);
5683
- (0, import_babel_utils22.assertNoParams)(tag);
5684
- (0, import_babel_utils22.assertNoAttributeTags)(tag);
5693
+ (0, import_babel_utils23.assertNoArgs)(tag);
5694
+ (0, import_babel_utils23.assertNoParams)(tag);
5695
+ (0, import_babel_utils23.assertNoAttributeTags)(tag);
5685
5696
  const { node } = tag;
5686
5697
  if (node.var && !import_compiler32.types.isIdentifier(node.var)) {
5687
5698
  throw tag.get("var").buildCodeFrameError(
@@ -5693,7 +5704,7 @@ var native_tag_default = {
5693
5704
  case "html":
5694
5705
  case "body":
5695
5706
  case "head":
5696
- (0, import_babel_utils22.getProgram)().node.extra.page ??= true;
5707
+ (0, import_babel_utils23.getProgram)().node.extra.page ??= true;
5697
5708
  break;
5698
5709
  }
5699
5710
  const isTextOnly = isTextOnlyNativeTag(tag);
@@ -5767,7 +5778,7 @@ var native_tag_default = {
5767
5778
  !!node.var
5768
5779
  );
5769
5780
  if (hasEventHandlers) {
5770
- (0, import_babel_utils22.getProgram)().node.extra.isInteractive = true;
5781
+ (0, import_babel_utils23.getProgram)().node.extra.isInteractive = true;
5771
5782
  }
5772
5783
  if (spreadReferenceNodes) {
5773
5784
  if (relatedControllable && !relatedControllable.attrs.every(Boolean)) {
@@ -5815,7 +5826,7 @@ var native_tag_default = {
5815
5826
  const tagName = getCanonicalTagName(tag);
5816
5827
  const tagExtra = tag.node.extra;
5817
5828
  const nodeBinding = tagExtra[kNativeTagBinding];
5818
- const tagDef = (0, import_babel_utils22.getTagDef)(tag);
5829
+ const tagDef = (0, import_babel_utils23.getTagDef)(tag);
5819
5830
  const write = writeTo(tag);
5820
5831
  const tagSection = getSection(tag);
5821
5832
  const visitAccessor = nodeBinding && getScopeAccessorLiteral(nodeBinding);
@@ -5895,7 +5906,7 @@ var native_tag_default = {
5895
5906
  if (valueChange) {
5896
5907
  writeAtStartOfBody = callRuntime(
5897
5908
  "_attr_textarea_value",
5898
- getScopeIdIdentifier(getSection(tag)),
5909
+ getScopeIdIdentifier(tagSection),
5899
5910
  visitAccessor,
5900
5911
  value,
5901
5912
  valueChange
@@ -6029,7 +6040,7 @@ var native_tag_default = {
6029
6040
  exit(tag) {
6030
6041
  const tagExtra = tag.node.extra;
6031
6042
  const nodeBinding = tagExtra[kNativeTagBinding];
6032
- const isOpenOnly = (0, import_babel_utils22.getTagDef)(tag)?.parseOptions?.openTagOnly;
6043
+ const isOpenOnly = (0, import_babel_utils23.getTagDef)(tag)?.parseOptions?.openTagOnly;
6033
6044
  const isTextOnly = isTextOnlyNativeTag(tag);
6034
6045
  const selectArgs = htmlSelectArgs.get(tag.node);
6035
6046
  const tagName = getCanonicalTagName(tag);
@@ -6051,7 +6062,7 @@ var native_tag_default = {
6051
6062
  import_compiler32.types.expressionStatement(
6052
6063
  callRuntime(
6053
6064
  "_attr_select_value",
6054
- getScopeIdIdentifier(getSection(tag)),
6065
+ getScopeIdIdentifier(tagSection),
6055
6066
  nodeBinding && getScopeAccessorLiteral(nodeBinding),
6056
6067
  selectArgs.value,
6057
6068
  selectArgs.valueChange,
@@ -6087,7 +6098,7 @@ var native_tag_default = {
6087
6098
  const tagName = getCanonicalTagName(tag);
6088
6099
  const tagExtra = tag.node.extra;
6089
6100
  const nodeBinding = tagExtra[kNativeTagBinding];
6090
- const tagDef = (0, import_babel_utils22.getTagDef)(tag);
6101
+ const tagDef = (0, import_babel_utils23.getTagDef)(tag);
6091
6102
  const write = writeTo(tag);
6092
6103
  const tagSection = getSection(tag);
6093
6104
  const visitAccessor = nodeBinding && getScopeAccessorLiteral(nodeBinding);
@@ -6340,7 +6351,7 @@ var native_tag_default = {
6340
6351
  exit(tag) {
6341
6352
  const tagExtra = tag.node.extra;
6342
6353
  const nodeBinding = tagExtra[kNativeTagBinding];
6343
- const openTagOnly = (0, import_babel_utils22.getTagDef)(tag)?.parseOptions?.openTagOnly;
6354
+ const openTagOnly = (0, import_babel_utils23.getTagDef)(tag)?.parseOptions?.openTagOnly;
6344
6355
  const tagName = getCanonicalTagName(tag);
6345
6356
  if (!openTagOnly) {
6346
6357
  const write = writeTo(tag);
@@ -6662,7 +6673,7 @@ function getOnlyChildParentTagName(tag, branchSize = 1) {
6662
6673
  return extra[kOnlyChildInParent];
6663
6674
  }
6664
6675
  const parentTag = getParentTag(tag);
6665
- return extra[kOnlyChildInParent] = parentTag && (0, import_babel_utils23.getTagDef)(parentTag)?.html && parentTag.node.name.type === "StringLiteral" && tag.parent.body.filter(
6676
+ return extra[kOnlyChildInParent] = parentTag && (0, import_babel_utils24.getTagDef)(parentTag)?.html && parentTag.node.name.type === "StringLiteral" && tag.parent.body.filter(
6666
6677
  (node) => node.type !== "MarkoComment"
6667
6678
  ).length === branchSize ? parentTag.node.name.value : false;
6668
6679
  }
@@ -6696,8 +6707,8 @@ var for_default = {
6696
6707
  isAttrTag ? 4 /* local */ : 5 /* derived */
6697
6708
  );
6698
6709
  let allowAttrs;
6699
- (0, import_babel_utils24.assertNoVar)(tag);
6700
- (0, import_babel_utils24.assertNoArgs)(tag);
6710
+ (0, import_babel_utils25.assertNoVar)(tag);
6711
+ (0, import_babel_utils25.assertNoArgs)(tag);
6701
6712
  assertNoSpreadAttrs(tag);
6702
6713
  const forType = getForType(tag.node);
6703
6714
  switch (forType) {
@@ -6721,7 +6732,7 @@ var for_default = {
6721
6732
  if (!isAttrTag) {
6722
6733
  allowAttrs.push("by");
6723
6734
  }
6724
- (0, import_babel_utils24.assertAllowedAttributes)(tag, allowAttrs);
6735
+ (0, import_babel_utils25.assertAllowedAttributes)(tag, allowAttrs);
6725
6736
  if (isAttrTag) return;
6726
6737
  const bodySection = startSection(tagBody);
6727
6738
  if (!bodySection) {
@@ -7074,11 +7085,11 @@ function translateAttrs(tag, propTree = true, skip2, statements = [], contentKey
7074
7085
  }
7075
7086
  }
7076
7087
  }
7077
- const attrTags2 = tag.node.body.attributeTags ? tag.get("body").get("body") : tag.get("attributeTags");
7088
+ const attrTags2 = getAttrTagPaths(tag);
7078
7089
  for (let i = 0; i < attrTags2.length; i++) {
7079
7090
  const child = attrTags2[i];
7080
7091
  if (child.isMarkoTag()) {
7081
- if ((0, import_babel_utils25.isAttributeTag)(child)) {
7092
+ if ((0, import_babel_utils26.isAttributeTag)(child)) {
7082
7093
  const attrTagMeta = attrTagLookup[getTagName(child)];
7083
7094
  if (skip2?.has(attrTagMeta.name)) continue;
7084
7095
  if (attrTagMeta.dynamic) {
@@ -7178,7 +7189,7 @@ function getTranslatedBodyContentProperty(props) {
7178
7189
  function addDynamicAttrTagStatements(attrTags2, index, attrTagLookup, statements, propTree, contentKey = "content") {
7179
7190
  const tag = attrTags2[index];
7180
7191
  if (tag.isMarkoTag()) {
7181
- if ((0, import_babel_utils25.isAttributeTag)(tag)) {
7192
+ if ((0, import_babel_utils26.isAttributeTag)(tag)) {
7182
7193
  const attrTagMeta = attrTagLookup[getTagName(tag)];
7183
7194
  const attrTagExport = getKnownFromPropTree(propTree, attrTagMeta.name);
7184
7195
  if (attrTagExport && attrTagMeta.dynamic) {
@@ -7317,7 +7328,7 @@ function translateIfAttrTag(attrTags2, index, attrTagLookup, statements, propTre
7317
7328
  return nextIndex - 1;
7318
7329
  }
7319
7330
  function addAllAttrTagsAsDynamic(tag, attrTagLookup, statements, propTree, contentKey) {
7320
- const attrTags2 = tag.node.body.attributeTags ? tag.get("body").get("body") : tag.get("attributeTags");
7331
+ const attrTags2 = getAttrTagPaths(tag);
7321
7332
  for (let i = 0; i < attrTags2.length; i++) {
7322
7333
  i = addDynamicAttrTagStatements(
7323
7334
  attrTags2,
@@ -7802,10 +7813,10 @@ function analyzeAttrs(rootTagExtra, section, tag, propTree, rootAttrExprs) {
7802
7813
  for (const attrTagName in attrTagLookup) {
7803
7814
  seen.add(attrTagLookup[attrTagName].name);
7804
7815
  }
7805
- const attrTags2 = tag.node.body.attributeTags ? tag.get("body").get("body") : tag.get("attributeTags");
7816
+ const attrTags2 = getAttrTagPaths(tag);
7806
7817
  for (const child of attrTags2) {
7807
7818
  if (child.isMarkoTag()) {
7808
- if ((0, import_babel_utils26.isAttributeTag)(child)) {
7819
+ if ((0, import_babel_utils27.isAttributeTag)(child)) {
7809
7820
  const attrTagMeta = attrTagLookup[getTagName(child)];
7810
7821
  const childAttrExport = getKnownFromPropTree(
7811
7822
  propTree,
@@ -8083,7 +8094,7 @@ function applyAttrObject(tag, propTree, tagInputIdentifier, info) {
8083
8094
  translatedAttrs.statements
8084
8095
  );
8085
8096
  }
8086
- if ((0, import_babel_utils26.isAttributeTag)(tag)) {
8097
+ if ((0, import_babel_utils27.isAttributeTag)(tag)) {
8087
8098
  const attrTagName = getTagName(tag);
8088
8099
  const parentTag = tag.parentPath;
8089
8100
  const repeated = analyzeAttributeTags(parentTag)?.[attrTagName]?.repeated;
@@ -8203,7 +8214,7 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
8203
8214
  for (let i = 0; i < attrTags2.length; i++) {
8204
8215
  const child = attrTags2[i];
8205
8216
  if (child.isMarkoTag()) {
8206
- if ((0, import_babel_utils26.isAttributeTag)(child)) {
8217
+ if ((0, import_babel_utils27.isAttributeTag)(child)) {
8207
8218
  const attrTagMeta = attrTagLookup[getTagName(child)];
8208
8219
  const childAttrExport = getKnownFromPropTree(
8209
8220
  propTree,
@@ -9322,12 +9333,14 @@ function finalizeReferences() {
9322
9333
  closure,
9323
9334
  getAccessorPrefix().ClosureScopes
9324
9335
  );
9325
- addSerializeReason(
9326
- section,
9327
- closure.sources,
9328
- closure,
9329
- getAccessorPrefix().ClosureSignalIndex
9330
- );
9336
+ if (getDynamicClosureIndex(closure, section)) {
9337
+ addSerializeReason(
9338
+ section,
9339
+ closure.sources,
9340
+ closure,
9341
+ getAccessorPrefix().ClosureSignalIndex
9342
+ );
9343
+ }
9331
9344
  }
9332
9345
  }
9333
9346
  });
@@ -9398,7 +9411,7 @@ function finalizeReferences() {
9398
9411
  });
9399
9412
  }
9400
9413
  });
9401
- const programSection = (0, import_babel_utils27.getProgram)().node.extra.section;
9414
+ const programSection = (0, import_babel_utils28.getProgram)().node.extra.section;
9402
9415
  if (programSection.returnValueExpr) {
9403
9416
  programSection.returnSerializeReason = getSerializeSourcesForExpr(
9404
9417
  programSection.returnValueExpr
@@ -10139,7 +10152,7 @@ function getAllSerializeReasonsForExtra(extra) {
10139
10152
  let reason = serializeReasonCache.get(extra);
10140
10153
  if (reason === false) return;
10141
10154
  if (reason === void 0) {
10142
- if (extra === (0, import_babel_utils27.getProgram)().node.extra?.section.returnValueExpr) {
10155
+ if (extra === (0, import_babel_utils28.getProgram)().node.extra?.section.returnValueExpr) {
10143
10156
  reason = true;
10144
10157
  } else {
10145
10158
  serializeReasonCache.set(extra, false);
@@ -10263,10 +10276,10 @@ function setReadsOwner(from, to) {
10263
10276
  var kDOMBinding = /* @__PURE__ */ Symbol("await tag dom binding");
10264
10277
  var await_default = {
10265
10278
  analyze(tag) {
10266
- (0, import_babel_utils28.assertNoVar)(tag);
10267
- (0, import_babel_utils28.assertNoArgs)(tag);
10279
+ (0, import_babel_utils29.assertNoVar)(tag);
10280
+ (0, import_babel_utils29.assertNoArgs)(tag);
10268
10281
  assertNoSpreadAttrs(tag);
10269
- (0, import_babel_utils28.assertNoAttributeTags)(tag);
10282
+ (0, import_babel_utils29.assertNoAttributeTags)(tag);
10270
10283
  const { node } = tag;
10271
10284
  const tagBody = tag.get("body");
10272
10285
  const section = getOrCreateSection(tag);
@@ -10295,7 +10308,6 @@ var await_default = {
10295
10308
  }
10296
10309
  const bodySection = startSection(tagBody);
10297
10310
  const valueExtra = evaluate(valueAttr.value);
10298
- getOrCreateSection(tag);
10299
10311
  const paramsBinding = trackParamsReferences(tagBody, 5 /* derived */);
10300
10312
  if (paramsBinding) {
10301
10313
  setBindingDownstream(paramsBinding, valueExtra);
@@ -10403,7 +10415,7 @@ var await_default = {
10403
10415
  attributes: {},
10404
10416
  autocomplete: [
10405
10417
  {
10406
- description: "Use to consume asynchronous an data.",
10418
+ description: "Use to consume asynchronous data.",
10407
10419
  descriptionMoreURL: "https://markojs.com/docs/reference/core-tag#await"
10408
10420
  }
10409
10421
  ],
@@ -10412,7 +10424,7 @@ var await_default = {
10412
10424
 
10413
10425
  // src/translator/core/client.ts
10414
10426
  var import_compiler40 = require("@marko/compiler");
10415
- var import_babel_utils29 = require("@marko/compiler/babel-utils");
10427
+ var import_babel_utils30 = require("@marko/compiler/babel-utils");
10416
10428
  var client_default = {
10417
10429
  parse(tag) {
10418
10430
  const {
@@ -10422,7 +10434,7 @@ var client_default = {
10422
10434
  const rawValue = node.rawValue;
10423
10435
  const code = rawValue.replace(/^client\s*/, "");
10424
10436
  const start = node.start + (rawValue.length - code.length);
10425
- let body = (0, import_babel_utils29.parseStatements)(file, code, start, start + code.length);
10437
+ let body = (0, import_babel_utils30.parseStatements)(file, code, start, start + code.length);
10426
10438
  if (body.length === 1 && import_compiler40.types.isBlockStatement(body[0])) {
10427
10439
  body = body[0].body;
10428
10440
  }
@@ -10443,11 +10455,11 @@ var client_default = {
10443
10455
 
10444
10456
  // src/translator/core/const.ts
10445
10457
  var import_compiler41 = require("@marko/compiler");
10446
- var import_babel_utils30 = require("@marko/compiler/babel-utils");
10458
+ var import_babel_utils31 = require("@marko/compiler/babel-utils");
10447
10459
  var const_default = {
10448
10460
  analyze(tag) {
10449
- (0, import_babel_utils30.assertNoArgs)(tag);
10450
- (0, import_babel_utils30.assertNoParams)(tag);
10461
+ (0, import_babel_utils31.assertNoArgs)(tag);
10462
+ (0, import_babel_utils31.assertNoParams)(tag);
10451
10463
  assertNoBodyContent(tag);
10452
10464
  const { node } = tag;
10453
10465
  const [valueAttr] = node.attributes;
@@ -10515,7 +10527,7 @@ var const_default = {
10515
10527
  attributes: {},
10516
10528
  autocomplete: [
10517
10529
  {
10518
- description: "Use to create an constant binding.",
10530
+ description: "Use to create a constant binding.",
10519
10531
  descriptionMoreURL: "https://markojs.com/docs/reference/core-tag#const"
10520
10532
  }
10521
10533
  ],
@@ -10524,13 +10536,13 @@ var const_default = {
10524
10536
 
10525
10537
  // src/translator/core/debug.ts
10526
10538
  var import_compiler42 = require("@marko/compiler");
10527
- var import_babel_utils31 = require("@marko/compiler/babel-utils");
10539
+ var import_babel_utils32 = require("@marko/compiler/babel-utils");
10528
10540
  var debug_default = {
10529
10541
  analyze(tag) {
10530
10542
  const [valueAttr] = tag.node.attributes;
10531
- (0, import_babel_utils31.assertNoVar)(tag);
10532
- (0, import_babel_utils31.assertNoArgs)(tag);
10533
- (0, import_babel_utils31.assertNoParams)(tag);
10543
+ (0, import_babel_utils32.assertNoVar)(tag);
10544
+ (0, import_babel_utils32.assertNoArgs)(tag);
10545
+ (0, import_babel_utils32.assertNoParams)(tag);
10534
10546
  assertNoBodyContent(tag);
10535
10547
  if (tag.node.attributes.length > 1 || tag.node.attributes.length === 1 && (!import_compiler42.types.isMarkoAttribute(valueAttr) || !valueAttr.default && valueAttr.name !== "value")) {
10536
10548
  throw tag.get("name").buildCodeFrameError(
@@ -10567,10 +10579,10 @@ var debug_default = {
10567
10579
 
10568
10580
  // src/translator/core/define.ts
10569
10581
  var import_compiler43 = require("@marko/compiler");
10570
- var import_babel_utils32 = require("@marko/compiler/babel-utils");
10582
+ var import_babel_utils33 = require("@marko/compiler/babel-utils");
10571
10583
  var define_default = {
10572
10584
  analyze(tag) {
10573
- (0, import_babel_utils32.assertNoArgs)(tag);
10585
+ (0, import_babel_utils33.assertNoArgs)(tag);
10574
10586
  if (!tag.node.var) {
10575
10587
  throw tag.get("name").buildCodeFrameError(
10576
10588
  "The [`<define>` tag](https://markojs.com/docs/reference/core-tag#define) requires a [tag variable](https://markojs.com/docs/reference/language#tag-variables)."
@@ -10701,17 +10713,17 @@ var define_default = {
10701
10713
 
10702
10714
  // src/translator/core/effect.ts
10703
10715
  var import_compiler44 = require("@marko/compiler");
10704
- var import_babel_utils33 = require("@marko/compiler/babel-utils");
10716
+ var import_babel_utils34 = require("@marko/compiler/babel-utils");
10705
10717
  var effect_default = {
10706
10718
  migrate: [
10707
10719
  (tag) => {
10708
- (0, import_babel_utils33.assertNoArgs)(tag);
10709
- (0, import_babel_utils33.assertNoParams)(tag);
10720
+ (0, import_babel_utils34.assertNoArgs)(tag);
10721
+ (0, import_babel_utils34.assertNoParams)(tag);
10710
10722
  assertNoBodyContent(tag);
10711
- (0, import_babel_utils33.assertNoAttributeTags)(tag);
10723
+ (0, import_babel_utils34.assertNoAttributeTags)(tag);
10712
10724
  assertNoSpreadAttrs(tag);
10713
- (0, import_babel_utils33.assertAllowedAttributes)(tag, ["value"]);
10714
- (0, import_babel_utils33.diagnosticDeprecate)(tag, {
10725
+ (0, import_babel_utils34.assertAllowedAttributes)(tag, ["value"]);
10726
+ (0, import_babel_utils34.diagnosticDeprecate)(tag, {
10715
10727
  label: "The 'effect' tag has been replaced by the 'script' tag.",
10716
10728
  fix() {
10717
10729
  const { node } = tag;
@@ -10734,12 +10746,12 @@ var effect_default = {
10734
10746
  };
10735
10747
 
10736
10748
  // src/translator/core/export.ts
10737
- var import_babel_utils34 = require("@marko/compiler/babel-utils");
10749
+ var import_babel_utils35 = require("@marko/compiler/babel-utils");
10738
10750
  var export_default = {
10739
10751
  parse(tag) {
10740
10752
  const { node } = tag;
10741
10753
  tag.replaceWith(
10742
- (0, import_babel_utils34.parseStatements)(tag.hub.file, node.rawValue, node.start, node.end)[0]
10754
+ (0, import_babel_utils35.parseStatements)(tag.hub.file, node.rawValue, node.start, node.end)[0]
10743
10755
  );
10744
10756
  },
10745
10757
  parseOptions: {
@@ -10755,13 +10767,13 @@ var export_default = {
10755
10767
 
10756
10768
  // src/translator/core/html-comment.ts
10757
10769
  var import_compiler45 = require("@marko/compiler");
10758
- var import_babel_utils35 = require("@marko/compiler/babel-utils");
10770
+ var import_babel_utils36 = require("@marko/compiler/babel-utils");
10759
10771
  var kNodeBinding = /* @__PURE__ */ Symbol("comment tag binding");
10760
10772
  var html_comment_default = {
10761
10773
  analyze(tag) {
10762
- (0, import_babel_utils35.assertNoArgs)(tag);
10763
- (0, import_babel_utils35.assertNoParams)(tag);
10764
- (0, import_babel_utils35.assertNoAttributes)(tag);
10774
+ (0, import_babel_utils36.assertNoArgs)(tag);
10775
+ (0, import_babel_utils36.assertNoParams)(tag);
10776
+ (0, import_babel_utils36.assertNoAttributes)(tag);
10765
10777
  const tagVar = tag.node.var;
10766
10778
  let needsBinding = false;
10767
10779
  if (tagVar) {
@@ -10821,7 +10833,7 @@ var html_comment_default = {
10821
10833
  if (import_compiler45.types.isMarkoText(child)) {
10822
10834
  write`${child.value}`;
10823
10835
  } else if (import_compiler45.types.isMarkoPlaceholder(child)) {
10824
- write`${callRuntime("_escape", child.value)}`;
10836
+ write`${callRuntime(child.escape ? "_escape_comment" : "_unescaped", child.value)}`;
10825
10837
  }
10826
10838
  }
10827
10839
  } else {
@@ -10831,7 +10843,7 @@ var html_comment_default = {
10831
10843
  } else {
10832
10844
  addStatement(
10833
10845
  "render",
10834
- getSection(tag),
10846
+ tagSection,
10835
10847
  tagExtra.referencedBindings,
10836
10848
  import_compiler45.types.expressionStatement(
10837
10849
  callRuntime(
@@ -10901,13 +10913,13 @@ var html_style_default = {
10901
10913
 
10902
10914
  // src/translator/core/id.ts
10903
10915
  var import_compiler46 = require("@marko/compiler");
10904
- var import_babel_utils36 = require("@marko/compiler/babel-utils");
10916
+ var import_babel_utils37 = require("@marko/compiler/babel-utils");
10905
10917
  var id_default = {
10906
10918
  analyze(tag) {
10907
- (0, import_babel_utils36.assertNoArgs)(tag);
10908
- (0, import_babel_utils36.assertNoParams)(tag);
10919
+ (0, import_babel_utils37.assertNoArgs)(tag);
10920
+ (0, import_babel_utils37.assertNoParams)(tag);
10909
10921
  assertNoBodyContent(tag);
10910
- (0, import_babel_utils36.assertNoAttributeTags)(tag);
10922
+ (0, import_babel_utils37.assertNoAttributeTags)(tag);
10911
10923
  const { node } = tag;
10912
10924
  const [valueAttr] = node.attributes;
10913
10925
  if (!node.var) {
@@ -10979,7 +10991,7 @@ var id_default = {
10979
10991
 
10980
10992
  // src/translator/core/if.ts
10981
10993
  var import_compiler48 = require("@marko/compiler");
10982
- var import_babel_utils37 = require("@marko/compiler/babel-utils");
10994
+ var import_babel_utils38 = require("@marko/compiler/babel-utils");
10983
10995
 
10984
10996
  // src/translator/util/to-first-statement-or-block.ts
10985
10997
  var import_compiler47 = require("@marko/compiler");
@@ -11247,9 +11259,9 @@ var ElseTag = {
11247
11259
  ]
11248
11260
  };
11249
11261
  function assertValidCondition(tag) {
11250
- (0, import_babel_utils37.assertNoVar)(tag);
11251
- (0, import_babel_utils37.assertNoArgs)(tag);
11252
- (0, import_babel_utils37.assertNoParams)(tag);
11262
+ (0, import_babel_utils38.assertNoVar)(tag);
11263
+ (0, import_babel_utils38.assertNoArgs)(tag);
11264
+ (0, import_babel_utils38.assertNoParams)(tag);
11253
11265
  assertHasBody(tag);
11254
11266
  assertNoSpreadAttrs(tag);
11255
11267
  switch (getTagName(tag)) {
@@ -11348,12 +11360,12 @@ function isRoot(tag) {
11348
11360
  }
11349
11361
 
11350
11362
  // src/translator/core/import.ts
11351
- var import_babel_utils38 = require("@marko/compiler/babel-utils");
11363
+ var import_babel_utils39 = require("@marko/compiler/babel-utils");
11352
11364
  var import_default = {
11353
11365
  parse(tag) {
11354
11366
  const { node } = tag;
11355
11367
  tag.replaceWith(
11356
- (0, import_babel_utils38.parseStatements)(tag.hub.file, node.rawValue, node.start, node.end)[0]
11368
+ (0, import_babel_utils39.parseStatements)(tag.hub.file, node.rawValue, node.start, node.end)[0]
11357
11369
  );
11358
11370
  },
11359
11371
  parseOptions: {
@@ -11372,7 +11384,7 @@ var import_default = {
11372
11384
 
11373
11385
  // src/translator/core/let.ts
11374
11386
  var import_compiler49 = require("@marko/compiler");
11375
- var import_babel_utils39 = require("@marko/compiler/babel-utils");
11387
+ var import_babel_utils40 = require("@marko/compiler/babel-utils");
11376
11388
  var let_default = {
11377
11389
  analyze(tag) {
11378
11390
  const { node } = tag;
@@ -11401,8 +11413,8 @@ var let_default = {
11401
11413
  }
11402
11414
  }
11403
11415
  }
11404
- (0, import_babel_utils39.assertNoArgs)(tag);
11405
- (0, import_babel_utils39.assertNoParams)(tag);
11416
+ (0, import_babel_utils40.assertNoArgs)(tag);
11417
+ (0, import_babel_utils40.assertNoParams)(tag);
11406
11418
  assertNoBodyContent(tag);
11407
11419
  assertNoSpreadAttrs(tag);
11408
11420
  if (!tagVar) {
@@ -11415,7 +11427,7 @@ var let_default = {
11415
11427
  "The [`<let>` tag](https://markojs.com/docs/reference/core-tag#let) variable cannot be destructured."
11416
11428
  );
11417
11429
  }
11418
- if (valueChangeAttr && (0, import_babel_utils39.computeNode)(valueChangeAttr.value)?.value) {
11430
+ if (valueChangeAttr && (0, import_babel_utils40.computeNode)(valueChangeAttr.value)?.value) {
11419
11431
  throw tag.get("attributes").find((attr) => attr.node === valueChangeAttr).get("value").buildCodeFrameError(
11420
11432
  "The [`<let>` tag](https://markojs.com/docs/reference/core-tag#let) [`valueChange=` attribute](https://markojs.com/docs/reference/core-tag#controllable-let) must be a function."
11421
11433
  );
@@ -11498,13 +11510,13 @@ var let_default = {
11498
11510
 
11499
11511
  // src/translator/core/lifecycle.ts
11500
11512
  var import_compiler50 = require("@marko/compiler");
11501
- var import_babel_utils40 = require("@marko/compiler/babel-utils");
11513
+ var import_babel_utils41 = require("@marko/compiler/babel-utils");
11502
11514
  var [getIndex, setIndex] = createSectionState("lifecycleIndex", () => 0);
11503
11515
  var lifecycle_default = {
11504
11516
  analyze(tag) {
11505
- (0, import_babel_utils40.assertNoArgs)(tag);
11506
- (0, import_babel_utils40.assertNoVar)(tag);
11507
- (0, import_babel_utils40.assertNoParams)(tag);
11517
+ (0, import_babel_utils41.assertNoArgs)(tag);
11518
+ (0, import_babel_utils41.assertNoVar)(tag);
11519
+ (0, import_babel_utils41.assertNoParams)(tag);
11508
11520
  assertNoBodyContent(tag);
11509
11521
  const { node } = tag;
11510
11522
  const section = getOrCreateSection(tag);
@@ -11526,7 +11538,7 @@ var lifecycle_default = {
11526
11538
  );
11527
11539
  }
11528
11540
  }
11529
- (0, import_babel_utils40.getProgram)().node.extra.isInteractive = true;
11541
+ (0, import_babel_utils41.getProgram)().node.extra.isInteractive = true;
11530
11542
  },
11531
11543
  translate: {
11532
11544
  exit(tag) {
@@ -11566,7 +11578,7 @@ var lifecycle_default = {
11566
11578
  attributes: {},
11567
11579
  autocomplete: [
11568
11580
  {
11569
- description: "Use to create a side effects.",
11581
+ description: "Use to create side effects.",
11570
11582
  descriptionMoreURL: "https://markojs.com/docs/reference/core-tag#lifecycle"
11571
11583
  }
11572
11584
  ],
@@ -11575,13 +11587,13 @@ var lifecycle_default = {
11575
11587
 
11576
11588
  // src/translator/core/log.ts
11577
11589
  var import_compiler51 = require("@marko/compiler");
11578
- var import_babel_utils41 = require("@marko/compiler/babel-utils");
11590
+ var import_babel_utils42 = require("@marko/compiler/babel-utils");
11579
11591
  var log_default = {
11580
11592
  analyze(tag) {
11581
11593
  const [valueAttr] = tag.node.attributes;
11582
- (0, import_babel_utils41.assertNoArgs)(tag);
11583
- (0, import_babel_utils41.assertNoVar)(tag);
11584
- (0, import_babel_utils41.assertNoParams)(tag);
11594
+ (0, import_babel_utils42.assertNoArgs)(tag);
11595
+ (0, import_babel_utils42.assertNoVar)(tag);
11596
+ (0, import_babel_utils42.assertNoParams)(tag);
11585
11597
  assertNoBodyContent(tag);
11586
11598
  if (!valueAttr) {
11587
11599
  throw tag.get("name").buildCodeFrameError(
@@ -11629,7 +11641,7 @@ var log_default = {
11629
11641
 
11630
11642
  // src/translator/core/script.ts
11631
11643
  var import_compiler52 = require("@marko/compiler");
11632
- var import_babel_utils42 = require("@marko/compiler/babel-utils");
11644
+ var import_babel_utils43 = require("@marko/compiler/babel-utils");
11633
11645
  var htmlScriptTagAlternateMsg = " For a native html [`<script>` tag](https://markojs.com/docs/reference/core-tag#script) use the `html-script` core tag instead.";
11634
11646
  var script_default = {
11635
11647
  parse(tag) {
@@ -11649,7 +11661,7 @@ var script_default = {
11649
11661
  }
11650
11662
  const start = body[0]?.start;
11651
11663
  const end = body[body.length - 1]?.end;
11652
- const bodyStatements = (0, import_babel_utils42.parseStatements)(tag.hub.file, code, start, end);
11664
+ const bodyStatements = (0, import_babel_utils43.parseStatements)(tag.hub.file, code, start, end);
11653
11665
  if (bodyStatements.length) {
11654
11666
  const valueFn = import_compiler52.types.arrowFunctionExpression(
11655
11667
  [],
@@ -11663,10 +11675,10 @@ var script_default = {
11663
11675
  },
11664
11676
  analyze(tag) {
11665
11677
  const { node } = tag;
11666
- (0, import_babel_utils42.assertNoArgs)(tag);
11667
- (0, import_babel_utils42.assertNoParams)(tag);
11678
+ (0, import_babel_utils43.assertNoArgs)(tag);
11679
+ (0, import_babel_utils43.assertNoParams)(tag);
11668
11680
  assertNoBodyContent(tag);
11669
- (0, import_babel_utils42.assertNoAttributeTags)(tag);
11681
+ (0, import_babel_utils43.assertNoAttributeTags)(tag);
11670
11682
  if (node.var) {
11671
11683
  throw tag.hub.buildError(
11672
11684
  node.var,
@@ -11681,7 +11693,7 @@ var script_default = {
11681
11693
  }
11682
11694
  seenValueAttr = true;
11683
11695
  (attr.value.extra ??= {}).isEffect = true;
11684
- (0, import_babel_utils42.getProgram)().node.extra.isInteractive = true;
11696
+ (0, import_babel_utils43.getProgram)().node.extra.isInteractive = true;
11685
11697
  } else {
11686
11698
  throw tag.hub.buildError(
11687
11699
  attr,
@@ -11745,7 +11757,7 @@ var script_default = {
11745
11757
  },
11746
11758
  autocomplete: [
11747
11759
  {
11748
- description: "Use to create a side effects.",
11760
+ description: "Use to create side effects.",
11749
11761
  descriptionMoreURL: "https://markojs.com/docs/core-tags/#script"
11750
11762
  }
11751
11763
  ],
@@ -11771,7 +11783,7 @@ function isAwaitExpression(node) {
11771
11783
 
11772
11784
  // src/translator/core/server.ts
11773
11785
  var import_compiler53 = require("@marko/compiler");
11774
- var import_babel_utils43 = require("@marko/compiler/babel-utils");
11786
+ var import_babel_utils44 = require("@marko/compiler/babel-utils");
11775
11787
  var server_default = {
11776
11788
  parse(tag) {
11777
11789
  const {
@@ -11781,7 +11793,7 @@ var server_default = {
11781
11793
  const rawValue = node.rawValue;
11782
11794
  const code = rawValue.replace(/^server\s*/, "");
11783
11795
  const start = node.start + (rawValue.length - code.length);
11784
- let body = (0, import_babel_utils43.parseStatements)(file, code, start, start + code.length);
11796
+ let body = (0, import_babel_utils44.parseStatements)(file, code, start, start + code.length);
11785
11797
  if (body.length === 1 && import_compiler53.types.isBlockStatement(body[0])) {
11786
11798
  body = body[0].body;
11787
11799
  }
@@ -11802,7 +11814,7 @@ var server_default = {
11802
11814
 
11803
11815
  // src/translator/core/static.ts
11804
11816
  var import_compiler54 = require("@marko/compiler");
11805
- var import_babel_utils44 = require("@marko/compiler/babel-utils");
11817
+ var import_babel_utils45 = require("@marko/compiler/babel-utils");
11806
11818
  var static_default = {
11807
11819
  parse(tag) {
11808
11820
  const {
@@ -11812,7 +11824,7 @@ var static_default = {
11812
11824
  const rawValue = node.rawValue;
11813
11825
  const code = rawValue.replace(/^static\s*/, "");
11814
11826
  const start = node.start + (rawValue.length - code.length);
11815
- let body = (0, import_babel_utils44.parseStatements)(file, code, start, start + code.length);
11827
+ let body = (0, import_babel_utils45.parseStatements)(file, code, start, start + code.length);
11816
11828
  if (body.length === 1 && import_compiler54.types.isBlockStatement(body[0])) {
11817
11829
  body = body[0].body;
11818
11830
  }
@@ -11833,16 +11845,16 @@ var static_default = {
11833
11845
 
11834
11846
  // src/translator/core/style.ts
11835
11847
  var import_compiler55 = require("@marko/compiler");
11836
- var import_babel_utils45 = require("@marko/compiler/babel-utils");
11848
+ var import_babel_utils46 = require("@marko/compiler/babel-utils");
11837
11849
  var import_magic_string = __toESM(require("magic-string"));
11838
11850
  var import_path3 = __toESM(require("path"));
11839
11851
  var STYLE_EXT_REG = /^style((?:\.[a-zA-Z0-9$_-]+)+)?/;
11840
11852
  var htmlStyleTagAlternateMsg = " For a native html [`<style>` tag](https://markojs.com/docs/reference/core-tag#style) use the `html-style` core tag instead.";
11841
11853
  var style_default = {
11842
11854
  analyze(tag) {
11843
- (0, import_babel_utils45.assertNoArgs)(tag);
11844
- (0, import_babel_utils45.assertNoParams)(tag);
11845
- (0, import_babel_utils45.assertNoAttributeTags)(tag);
11855
+ (0, import_babel_utils46.assertNoArgs)(tag);
11856
+ (0, import_babel_utils46.assertNoParams)(tag);
11857
+ (0, import_babel_utils46.assertNoAttributeTags)(tag);
11846
11858
  const { node } = tag;
11847
11859
  const ext = STYLE_EXT_REG.exec(node.rawValue || "")?.[1]?.slice(1);
11848
11860
  for (const attr of node.attributes) {
@@ -11882,13 +11894,13 @@ var style_default = {
11882
11894
  for (const child of node.body.body) {
11883
11895
  code += child.value;
11884
11896
  if (createMap) {
11885
- const start = (0, import_babel_utils45.getStart)(file, child);
11897
+ const start = (0, import_babel_utils46.getStart)(file, child);
11886
11898
  if (start !== null) {
11887
11899
  magicString ||= new import_magic_string.default(file.code, { filename });
11888
11900
  if (start > last) {
11889
11901
  magicString.remove(last, start);
11890
11902
  }
11891
- last = (0, import_babel_utils45.getEnd)(file, child);
11903
+ last = (0, import_babel_utils46.getEnd)(file, child);
11892
11904
  }
11893
11905
  }
11894
11906
  }
@@ -11915,11 +11927,11 @@ var style_default = {
11915
11927
  });
11916
11928
  if (importPath) {
11917
11929
  if (!node.var) {
11918
- (0, import_babel_utils45.getProgram)().node.body.push(
11930
+ (0, import_babel_utils46.getProgram)().node.body.push(
11919
11931
  import_compiler55.types.importDeclaration([], import_compiler55.types.stringLiteral(importPath))
11920
11932
  );
11921
11933
  } else if (import_compiler55.types.isIdentifier(node.var)) {
11922
- (0, import_babel_utils45.getProgram)().node.body.push(
11934
+ (0, import_babel_utils46.getProgram)().node.body.push(
11923
11935
  import_compiler55.types.importDeclaration(
11924
11936
  [import_compiler55.types.importNamespaceSpecifier(node.var)],
11925
11937
  import_compiler55.types.stringLiteral(importPath)
@@ -11927,9 +11939,9 @@ var style_default = {
11927
11939
  );
11928
11940
  } else {
11929
11941
  const varDecl = import_compiler55.types.variableDeclaration("const", [
11930
- import_compiler55.types.variableDeclarator(node.var, (0, import_babel_utils45.importStar)(file, importPath, "style"))
11942
+ import_compiler55.types.variableDeclarator(node.var, (0, import_babel_utils46.importStar)(file, importPath, "style"))
11931
11943
  ]);
11932
- (0, import_babel_utils45.getProgram)().node.body.push(
11944
+ (0, import_babel_utils46.getProgram)().node.body.push(
11933
11945
  isOutputDOM() ? varDecl : import_compiler55.types.markoScriptlet([varDecl], true)
11934
11946
  );
11935
11947
  }
@@ -11947,16 +11959,15 @@ var style_default = {
11947
11959
 
11948
11960
  // src/translator/core/try.ts
11949
11961
  var import_compiler56 = require("@marko/compiler");
11950
- var import_babel_utils46 = require("@marko/compiler/babel-utils");
11962
+ var import_babel_utils47 = require("@marko/compiler/babel-utils");
11951
11963
  var hasEnabledCatch = /* @__PURE__ */ new WeakSet();
11952
11964
  var kDOMBinding2 = /* @__PURE__ */ Symbol("try tag dom binding");
11953
11965
  var try_default = {
11954
11966
  analyze(tag) {
11955
- (0, import_babel_utils46.assertNoVar)(tag);
11956
- (0, import_babel_utils46.assertNoArgs)(tag);
11957
- (0, import_babel_utils46.assertNoParams)(tag);
11958
- (0, import_babel_utils46.assertNoAttributes)(tag);
11959
- assertNoSpreadAttrs(tag);
11967
+ (0, import_babel_utils47.assertNoVar)(tag);
11968
+ (0, import_babel_utils47.assertNoArgs)(tag);
11969
+ (0, import_babel_utils47.assertNoParams)(tag);
11970
+ (0, import_babel_utils47.assertNoAttributes)(tag);
11960
11971
  analyzeAttributeTags(tag);
11961
11972
  const section = getOrCreateSection(tag);
11962
11973
  const tagExtra = mergeReferences(
@@ -12068,7 +12079,7 @@ var try_default = {
12068
12079
  translatedAttrs.statements
12069
12080
  );
12070
12081
  }
12071
- const program = (0, import_babel_utils46.getProgram)().node;
12082
+ const program = (0, import_babel_utils47.getProgram)().node;
12072
12083
  if (!hasEnabledCatch.has(program)) {
12073
12084
  hasEnabledCatch.add(program);
12074
12085
  program.body.push(
@@ -12170,13 +12181,13 @@ var document_type_default = {
12170
12181
  };
12171
12182
 
12172
12183
  // src/translator/visitors/import-declaration.ts
12173
- var import_babel_utils47 = require("@marko/compiler/babel-utils");
12184
+ var import_babel_utils48 = require("@marko/compiler/babel-utils");
12174
12185
  var import_declaration_default = {
12175
12186
  analyze(importDecl) {
12176
12187
  const { node } = importDecl;
12177
12188
  const { source } = node;
12178
12189
  const { value } = source;
12179
- const tagImport = (0, import_babel_utils47.resolveTagImport)(importDecl, value);
12190
+ const tagImport = (0, import_babel_utils48.resolveTagImport)(importDecl, value);
12180
12191
  if (tagImport) {
12181
12192
  node.extra ??= {};
12182
12193
  node.extra.tagImport = tagImport;
@@ -12211,7 +12222,7 @@ var placeholder_default = {
12211
12222
  const { node } = placeholder;
12212
12223
  const valueExtra = evaluate(node.value);
12213
12224
  const { confident, computed } = valueExtra;
12214
- if (confident && isVoid2(computed)) return;
12225
+ if (confident && isVoid(computed)) return;
12215
12226
  if (isStaticText(node)) {
12216
12227
  if (isStaticText(getPrev(placeholder)) || isStaticText(getNext(placeholder))) {
12217
12228
  (node.extra ??= {})[kSharedText] = true;
@@ -12234,7 +12245,7 @@ var placeholder_default = {
12234
12245
  const { value } = node;
12235
12246
  const valueExtra = evaluate(value);
12236
12247
  const { confident, computed } = valueExtra;
12237
- if (confident && isVoid2(computed)) {
12248
+ if (confident && isVoid(computed)) {
12238
12249
  placeholder.remove();
12239
12250
  return;
12240
12251
  }
@@ -12273,7 +12284,7 @@ var placeholder_default = {
12273
12284
  } else {
12274
12285
  addStatement(
12275
12286
  "render",
12276
- getSection(placeholder),
12287
+ section,
12277
12288
  valueExtra.referencedBindings,
12278
12289
  import_compiler57.types.expressionStatement(
12279
12290
  method === "_text" ? callRuntime(
@@ -12337,9 +12348,6 @@ function analyzeSiblingText(placeholder) {
12337
12348
  }
12338
12349
  return placeholderExtra[kSiblingText] = 0 /* None */;
12339
12350
  }
12340
- function isVoid2(value) {
12341
- return value == null || value === false;
12342
- }
12343
12351
  function isStaticText(node) {
12344
12352
  switch (node?.type) {
12345
12353
  case "MarkoText":
@@ -12347,7 +12355,7 @@ function isStaticText(node) {
12347
12355
  case "MarkoPlaceholder": {
12348
12356
  if (node.escape) {
12349
12357
  const { confident, computed } = evaluate(node.value);
12350
- return confident && !isVoid2(computed);
12358
+ return confident && !isVoid(computed);
12351
12359
  } else {
12352
12360
  return false;
12353
12361
  }
@@ -12370,7 +12378,7 @@ function getNext(path7) {
12370
12378
  }
12371
12379
  function isEmptyPlaceholder(placeholder) {
12372
12380
  const { confident, computed } = evaluate(placeholder.value);
12373
- return confident && isVoid2(computed);
12381
+ return confident && isVoid(computed);
12374
12382
  }
12375
12383
 
12376
12384
  // src/translator/visitors/referenced-identifier.ts
@@ -12478,7 +12486,7 @@ var referenced_identifier_default = {
12478
12486
 
12479
12487
  // src/translator/visitors/scriptlet.ts
12480
12488
  var import_compiler59 = require("@marko/compiler");
12481
- var import_babel_utils48 = require("@marko/compiler/babel-utils");
12489
+ var import_babel_utils49 = require("@marko/compiler/babel-utils");
12482
12490
  var scriptlet_default = {
12483
12491
  analyze(scriptlet) {
12484
12492
  if (!scriptlet.node.static) {
@@ -12492,7 +12500,7 @@ var scriptlet_default = {
12492
12500
  scriptlet.node.body
12493
12501
  );
12494
12502
  if (scriptlet.node.target === "client") {
12495
- (0, import_babel_utils48.getProgram)().node.extra.isInteractive = true;
12503
+ (0, import_babel_utils49.getProgram)().node.extra.isInteractive = true;
12496
12504
  }
12497
12505
  },
12498
12506
  translate: {
@@ -12528,20 +12536,20 @@ var scriptlet_default = {
12528
12536
 
12529
12537
  // src/translator/visitors/tag/index.ts
12530
12538
  var import_compiler63 = require("@marko/compiler");
12531
- var import_babel_utils52 = require("@marko/compiler/babel-utils");
12539
+ var import_babel_utils53 = require("@marko/compiler/babel-utils");
12532
12540
 
12533
12541
  // src/translator/visitors/tag/attribute-tag.ts
12534
12542
  var import_compiler60 = require("@marko/compiler");
12535
- var import_babel_utils49 = require("@marko/compiler/babel-utils");
12543
+ var import_babel_utils50 = require("@marko/compiler/babel-utils");
12536
12544
  var attribute_tag_default = {
12537
12545
  analyze: {
12538
12546
  enter(tag) {
12539
- (0, import_babel_utils49.assertNoVar)(tag);
12540
- (0, import_babel_utils49.assertNoArgs)(tag);
12547
+ (0, import_babel_utils50.assertNoVar)(tag);
12548
+ (0, import_babel_utils50.assertNoArgs)(tag);
12541
12549
  const body = tag.get("body");
12542
12550
  startSection(body);
12543
12551
  trackParamsReferences(body, 3 /* param */);
12544
- if (!(0, import_babel_utils49.findParentTag)(tag)) {
12552
+ if (!(0, import_babel_utils50.findParentTag)(tag)) {
12545
12553
  throw tag.get("name").buildCodeFrameError(
12546
12554
  "[Attribute tags](https://markojs.com/docs/reference/language#attribute-tags) must be nested within another tag."
12547
12555
  );
@@ -12565,20 +12573,20 @@ var attribute_tag_default = {
12565
12573
 
12566
12574
  // src/translator/visitors/tag/custom-tag.ts
12567
12575
  var import_compiler61 = require("@marko/compiler");
12568
- var import_babel_utils50 = require("@marko/compiler/babel-utils");
12576
+ var import_babel_utils51 = require("@marko/compiler/babel-utils");
12569
12577
  var import_fastest_levenshtein = require("fastest-levenshtein");
12570
12578
  var import_path4 = __toESM(require("path"));
12571
12579
  var custom_tag_default = {
12572
12580
  analyze: {
12573
12581
  enter(tag) {
12574
- const templateFile = (0, import_babel_utils50.getTagTemplate)(tag);
12582
+ const templateFile = (0, import_babel_utils51.getTagTemplate)(tag);
12575
12583
  if (!templateFile) throw tagNotFoundError(tag);
12576
- (0, import_babel_utils50.assertAttributesOrSingleArg)(tag);
12577
- const childFile = (0, import_babel_utils50.loadFileForTag)(tag);
12584
+ (0, import_babel_utils51.assertAttributesOrSingleArg)(tag);
12585
+ const childFile = (0, import_babel_utils51.loadFileForTag)(tag);
12578
12586
  if (!childFile) {
12579
12587
  throw tag.get("name").buildCodeFrameError("Unable to resolve file for tag.");
12580
12588
  }
12581
- const programExtra = (0, import_babel_utils50.getProgram)().node.extra;
12589
+ const programExtra = (0, import_babel_utils51.getProgram)().node.extra;
12582
12590
  const programSection = programExtra.section;
12583
12591
  const childProgram = childFile.ast.program;
12584
12592
  const childExtra = childProgram.extra;
@@ -12610,12 +12618,12 @@ var custom_tag_default = {
12610
12618
  };
12611
12619
  function translateHTML(tag) {
12612
12620
  const { node } = tag;
12613
- const childProgram = (0, import_babel_utils50.loadFileForTag)(tag).ast.program;
12621
+ const childProgram = (0, import_babel_utils51.loadFileForTag)(tag).ast.program;
12614
12622
  const childExtra = childProgram.extra;
12615
12623
  let tagIdentifier;
12616
12624
  if (import_compiler61.types.isStringLiteral(node.name)) {
12617
12625
  const relativePath = getTagRelativePath(tag);
12618
- tagIdentifier = isCircularRequest(tag.hub.file, relativePath) ? import_compiler61.types.identifier(getTemplateContentName()) : (0, import_babel_utils50.importDefault)(tag.hub.file, relativePath, getTagName(tag));
12626
+ tagIdentifier = isCircularRequest(tag.hub.file, relativePath) ? import_compiler61.types.identifier(getTemplateContentName()) : (0, import_babel_utils51.importDefault)(tag.hub.file, relativePath, getTagName(tag));
12619
12627
  } else {
12620
12628
  tagIdentifier = node.name;
12621
12629
  }
@@ -12631,8 +12639,8 @@ function translateDOM(tag) {
12631
12639
  const { file } = tag.hub;
12632
12640
  const write = writeTo(tag);
12633
12641
  const relativePath = getTagRelativePath(tag);
12634
- const programSection = (0, import_babel_utils50.getProgram)().node.extra.section;
12635
- const childFile = (0, import_babel_utils50.loadFileForTag)(tag);
12642
+ const programSection = (0, import_babel_utils51.getProgram)().node.extra.section;
12643
+ const childFile = (0, import_babel_utils51.loadFileForTag)(tag);
12636
12644
  const childExtra = childFile.ast.program.extra;
12637
12645
  const childExports = childExtra.domExports;
12638
12646
  const childSection = childExtra.section;
@@ -12686,11 +12694,11 @@ function translateDOM(tag) {
12686
12694
  );
12687
12695
  }
12688
12696
  );
12689
- write`${(0, import_babel_utils50.importNamed)(file, relativePath, childExports.template, `${tagName}_template`)}`;
12697
+ write`${(0, import_babel_utils51.importNamed)(file, relativePath, childExports.template, `${tagName}_template`)}`;
12690
12698
  injectWalks(
12691
12699
  tag,
12692
12700
  tagName,
12693
- (0, import_babel_utils50.importNamed)(file, relativePath, childExports.walks, `${tagName}_walks`)
12701
+ (0, import_babel_utils51.importNamed)(file, relativePath, childExports.walks, `${tagName}_walks`)
12694
12702
  );
12695
12703
  }
12696
12704
  tag.remove();
@@ -12702,8 +12710,8 @@ function getTagRelativePath(tag) {
12702
12710
  } = tag;
12703
12711
  let relativePath;
12704
12712
  if (import_compiler61.types.isStringLiteral(node.name)) {
12705
- const template = node.extra?.featureType === "class" && (0, import_babel_utils50.getTagDef)(tag)?.renderer || (0, import_babel_utils50.getTagTemplate)(tag);
12706
- relativePath = template && (0, import_babel_utils50.resolveRelativePath)(file, template);
12713
+ const template = node.extra?.featureType === "class" && (0, import_babel_utils51.getTagDef)(tag)?.renderer || (0, import_babel_utils51.getTagTemplate)(tag);
12714
+ relativePath = template && (0, import_babel_utils51.resolveRelativePath)(file, template);
12707
12715
  } else if (node.extra?.tagNameImported) {
12708
12716
  relativePath = node.extra.tagNameImported;
12709
12717
  }
@@ -12735,7 +12743,7 @@ function importOrSelfReferenceName(file, request, name2, nameHint) {
12735
12743
  if (isCircularRequest(file, request)) {
12736
12744
  return import_compiler61.types.identifier(name2);
12737
12745
  }
12738
- return (0, import_babel_utils50.importNamed)(file, request, name2, nameHint);
12746
+ return (0, import_babel_utils51.importNamed)(file, request, name2, nameHint);
12739
12747
  }
12740
12748
  function isCircularRequest(file, request) {
12741
12749
  const { filename } = file.opts;
@@ -12744,14 +12752,14 @@ function isCircularRequest(file, request) {
12744
12752
 
12745
12753
  // src/translator/visitors/tag/dynamic-tag.ts
12746
12754
  var import_compiler62 = require("@marko/compiler");
12747
- var import_babel_utils51 = require("@marko/compiler/babel-utils");
12755
+ var import_babel_utils52 = require("@marko/compiler/babel-utils");
12748
12756
  var kDOMBinding3 = /* @__PURE__ */ Symbol("dynamic tag dom binding");
12749
12757
  var kChildOffsetScopeBinding2 = /* @__PURE__ */ Symbol("custom tag scope offset");
12750
12758
  var importedDynamicTagResume = /* @__PURE__ */ new WeakSet();
12751
12759
  var dynamic_tag_default = {
12752
12760
  analyze: {
12753
12761
  enter(tag) {
12754
- (0, import_babel_utils51.assertAttributesOrArgs)(tag);
12762
+ (0, import_babel_utils52.assertAttributesOrArgs)(tag);
12755
12763
  const { node } = tag;
12756
12764
  const definedBodySection = node.extra?.defineBodySection;
12757
12765
  if (definedBodySection) {
@@ -12778,7 +12786,7 @@ var dynamic_tag_default = {
12778
12786
  if (hasVar || tag.node.attributes.some(
12779
12787
  (attr) => import_compiler62.types.isMarkoSpreadAttribute(attr) || isEventOrChangeHandler(attr.name)
12780
12788
  )) {
12781
- (0, import_babel_utils51.getProgram)().node.extra.isInteractive = true;
12789
+ (0, import_babel_utils52.getProgram)().node.extra.isInteractive = true;
12782
12790
  }
12783
12791
  if (hasVar) {
12784
12792
  trackVarReferences(tag, 5 /* derived */);
@@ -12792,7 +12800,7 @@ var dynamic_tag_default = {
12792
12800
  translate: {
12793
12801
  enter(tag) {
12794
12802
  const tagExtra = tag.node.extra;
12795
- if (tagExtra?.featureType === "class" && !isOutputHTML() && !(0, import_babel_utils51.getTagTemplate)(tag)) {
12803
+ if (tagExtra?.featureType === "class" && !isOutputHTML() && !(0, import_babel_utils52.getTagTemplate)(tag)) {
12796
12804
  tag.remove();
12797
12805
  return;
12798
12806
  }
@@ -12882,26 +12890,26 @@ var dynamic_tag_default = {
12882
12890
  const isClassAPI = tagExtra.featureType === "class";
12883
12891
  let tagExpression = node.name;
12884
12892
  if (import_compiler62.types.isStringLiteral(tagExpression)) {
12885
- tagExpression = (0, import_babel_utils51.importDefault)(
12893
+ tagExpression = (0, import_babel_utils52.importDefault)(
12886
12894
  tag.hub.file,
12887
12895
  getTagRelativePath(tag),
12888
12896
  tagExpression.value
12889
12897
  );
12890
12898
  }
12891
12899
  if (isClassAPI) {
12892
- if ((0, import_babel_utils51.getTagTemplate)(tag)) {
12900
+ if ((0, import_babel_utils52.getTagTemplate)(tag)) {
12893
12901
  if (getSerializeReason(tagSection, nodeBinding)) {
12894
12902
  if (isOutputHTML()) {
12895
- (0, import_babel_utils51.getProgram)().node.body.push(
12903
+ (0, import_babel_utils52.getProgram)().node.body.push(
12896
12904
  import_compiler62.types.markoScriptlet(
12897
12905
  [
12898
12906
  import_compiler62.types.expressionStatement(
12899
12907
  import_compiler62.types.callExpression(
12900
- (0, import_babel_utils51.importNamed)(tag.hub.file, getCompatRuntimeFile(), "s"),
12908
+ (0, import_babel_utils52.importNamed)(tag.hub.file, getCompatRuntimeFile(), "s"),
12901
12909
  [
12902
12910
  import_compiler62.types.identifier(tagExpression.name),
12903
12911
  import_compiler62.types.stringLiteral(
12904
- (0, import_babel_utils51.loadFileForTag)(tag).metadata.marko.id
12912
+ (0, import_babel_utils52.loadFileForTag)(tag).metadata.marko.id
12905
12913
  )
12906
12914
  ]
12907
12915
  )
@@ -12911,11 +12919,11 @@ var dynamic_tag_default = {
12911
12919
  )
12912
12920
  );
12913
12921
  } else {
12914
- (0, import_babel_utils51.getProgram)().node.body.push(
12922
+ (0, import_babel_utils52.getProgram)().node.body.push(
12915
12923
  import_compiler62.types.expressionStatement(
12916
12924
  callRuntime(
12917
12925
  "_resume",
12918
- import_compiler62.types.stringLiteral((0, import_babel_utils51.loadFileForTag)(tag).metadata.marko.id),
12926
+ import_compiler62.types.stringLiteral((0, import_babel_utils52.loadFileForTag)(tag).metadata.marko.id),
12919
12927
  import_compiler62.types.identifier(tagExpression.name)
12920
12928
  )
12921
12929
  )
@@ -12923,7 +12931,7 @@ var dynamic_tag_default = {
12923
12931
  }
12924
12932
  }
12925
12933
  } else {
12926
- (0, import_babel_utils51.getProgram)().node.body.push(
12934
+ (0, import_babel_utils52.getProgram)().node.body.push(
12927
12935
  import_compiler62.types.markoScriptlet(
12928
12936
  [
12929
12937
  import_compiler62.types.expressionStatement(
@@ -13093,7 +13101,7 @@ var dynamic_tag_default = {
13093
13101
  }
13094
13102
  };
13095
13103
  function enableDynamicTagResume(tag) {
13096
- const program = (0, import_babel_utils51.getProgram)().node;
13104
+ const program = (0, import_babel_utils52.getProgram)().node;
13097
13105
  if (!importedDynamicTagResume.has(program) && analyzeTagNameType(tag, true) !== 1 /* CustomTag */) {
13098
13106
  for (const attr of tag.node.attributes) {
13099
13107
  if (attr.type === "MarkoSpreadAttribute" || attr.type === "MarkoAttribute" && isEventOrChangeHandler(attr.name)) {
@@ -13111,7 +13119,7 @@ function enableDynamicTagResume(tag) {
13111
13119
  var tag_default = {
13112
13120
  analyze: {
13113
13121
  enter(tag) {
13114
- const tagDef = (0, import_babel_utils52.getTagDef)(tag);
13122
+ const tagDef = (0, import_babel_utils53.getTagDef)(tag);
13115
13123
  const type = analyzeTagNameType(tag);
13116
13124
  const hook = tagDef?.analyzer?.hook;
13117
13125
  if (hook) {
@@ -13135,7 +13143,7 @@ var tag_default = {
13135
13143
  }
13136
13144
  },
13137
13145
  exit(tag) {
13138
- const hook = (0, import_babel_utils52.getTagDef)(tag)?.analyzer?.hook;
13146
+ const hook = (0, import_babel_utils53.getTagDef)(tag)?.analyzer?.hook;
13139
13147
  if (hook) {
13140
13148
  exit(hook, tag);
13141
13149
  return;
@@ -13144,7 +13152,7 @@ var tag_default = {
13144
13152
  },
13145
13153
  translate: {
13146
13154
  enter(tag) {
13147
- const tagDef = (0, import_babel_utils52.getTagDef)(tag);
13155
+ const tagDef = (0, import_babel_utils53.getTagDef)(tag);
13148
13156
  if (tagDef?.translator) {
13149
13157
  if (tagDef.translator.path) {
13150
13158
  tag.hub.file.metadata.marko.watchFiles.push(tagDef.translator.path);
@@ -13177,7 +13185,7 @@ var tag_default = {
13177
13185
  }
13178
13186
  },
13179
13187
  exit(tag) {
13180
- const translator = (0, import_babel_utils52.getTagDef)(tag)?.translator;
13188
+ const translator = (0, import_babel_utils53.getTagDef)(tag)?.translator;
13181
13189
  if (translator) {
13182
13190
  exit(translator.hook, tag);
13183
13191
  return;
@@ -13215,12 +13223,12 @@ var text_default = {
13215
13223
 
13216
13224
  // src/translator/interop/index.ts
13217
13225
  var import_compiler65 = require("@marko/compiler");
13218
- var import_babel_utils54 = require("@marko/compiler/babel-utils");
13226
+ var import_babel_utils55 = require("@marko/compiler/babel-utils");
13219
13227
  var import_babel2 = require("@marko/compiler/internal/babel");
13220
13228
  var import_path6 = __toESM(require("path"));
13221
13229
 
13222
13230
  // src/translator/interop/feature-detection.ts
13223
- var import_babel_utils53 = require("@marko/compiler/babel-utils");
13231
+ var import_babel_utils54 = require("@marko/compiler/babel-utils");
13224
13232
 
13225
13233
  // src/translator/interop/build-aggregate-error.ts
13226
13234
  var import_babel = require("@marko/compiler/internal/babel");
@@ -13277,12 +13285,12 @@ function getFileNameWithLoc(fileName, { node: { loc } }) {
13277
13285
  }
13278
13286
 
13279
13287
  // src/translator/interop/feature-detection.ts
13280
- function isTagsAPI(file = (0, import_babel_utils53.getFile)()) {
13288
+ function isTagsAPI(file = (0, import_babel_utils54.getFile)()) {
13281
13289
  const program = file.path;
13282
13290
  const programExtra = program.node.extra ??= {};
13283
13291
  let { featureType } = programExtra;
13284
13292
  if (!featureType) {
13285
- const lookup = (0, import_babel_utils53.getTaglibLookup)(file);
13293
+ const lookup = (0, import_babel_utils54.getTaglibLookup)(file);
13286
13294
  const tagsDir = getTagsDir(file.opts.filename);
13287
13295
  const state = {};
13288
13296
  if (tagsDir && !lookup.manualTagsDirs?.has(tagsDir)) {
@@ -13363,7 +13371,7 @@ function scanTag(state, tag) {
13363
13371
  tag.get("var")
13364
13372
  );
13365
13373
  }
13366
- const tagDef = (0, import_babel_utils53.getTagDef)(tag);
13374
+ const tagDef = (0, import_babel_utils54.getTagDef)(tag);
13367
13375
  if (tagDef) {
13368
13376
  if (tagDef.name === "style") {
13369
13377
  if (/^style(?:(?:\.[^.\s\\/:*?"<>|({]+)+)?\s*\{/.test(
@@ -13545,7 +13553,7 @@ function createInteropTranslator(translate5) {
13545
13553
  return enterProgram?.call(this, program, state);
13546
13554
  }
13547
13555
  const visitedFiles = /* @__PURE__ */ new Set([
13548
- (0, import_babel_utils54.resolveRelativePath)(entryFile, entryFile.opts.filename)
13556
+ (0, import_babel_utils55.resolveRelativePath)(entryFile, entryFile.opts.filename)
13549
13557
  ]);
13550
13558
  entryBuilder.visit(
13551
13559
  entryFile,
@@ -13553,12 +13561,12 @@ function createInteropTranslator(translate5) {
13553
13561
  function visitChild(resolved) {
13554
13562
  if (!visitedFiles.has(resolved)) {
13555
13563
  visitedFiles.add(resolved);
13556
- const file = (0, import_babel_utils54.loadFileForImport)(entryFile, resolved);
13564
+ const file = (0, import_babel_utils55.loadFileForImport)(entryFile, resolved);
13557
13565
  if (file) {
13558
13566
  entryBuilder.visit(
13559
13567
  file,
13560
13568
  entryFile,
13561
- (id) => visitChild(resolveRelativeToEntry2(entryFile, file, id))
13569
+ (id) => visitChild(resolveRelativeToEntry(entryFile, file, id))
13562
13570
  );
13563
13571
  }
13564
13572
  }
@@ -13709,12 +13717,6 @@ function getVisitorEnter(visit2) {
13709
13717
  function getVisitorExit(visit2) {
13710
13718
  return typeof visit2 === "object" ? visit2?.exit : void 0;
13711
13719
  }
13712
- function resolveRelativeToEntry2(entryFile, file, req) {
13713
- return file === entryFile ? (0, import_babel_utils54.resolveRelativePath)(file, req) : (0, import_babel_utils54.resolveRelativePath)(
13714
- entryFile,
13715
- req[0] === "." ? import_path6.default.join(file.opts.filename, "..", req) : req
13716
- );
13717
- }
13718
13720
 
13719
13721
  // src/translator/index.ts
13720
13722
  var visitors = extractVisitors({