marko 6.0.124 → 6.0.126

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.
@@ -30,15 +30,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/translator/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
- analyze: () => analyze2,
33
+ analyze: () => analyze,
34
34
  createInteropTranslator: () => createInteropTranslator,
35
- getRuntimeEntryFiles: () => getRuntimeEntryFiles2,
35
+ getRuntimeEntryFiles: () => getRuntimeEntryFiles,
36
36
  internalEntryBuilder: () => entry_builder_default,
37
37
  preferAPI: () => preferAPI,
38
- tagDiscoveryDirs: () => tagDiscoveryDirs2,
39
- taglibs: () => taglibs2,
40
- transform: () => transform2,
41
- translate: () => translate2
38
+ tagDiscoveryDirs: () => tagDiscoveryDirs,
39
+ taglibs: () => taglibs,
40
+ transform: () => transform,
41
+ translate: () => translate
42
42
  });
43
43
  module.exports = __toCommonJS(index_exports);
44
44
 
@@ -1619,14 +1619,14 @@ function analyzeTagNameType(tag, allowDynamic) {
1619
1619
  }
1620
1620
  if (!extra.tagNameDynamic && extra.tagNameType === 1 /* CustomTag */ && !isCoreTag(tag)) {
1621
1621
  const childFile = (0, import_babel_utils9.loadFileForTag)(tag);
1622
- if (!childFile) {
1623
- extra.tagNameType = 2 /* DynamicTag */;
1624
- extra.tagNameDynamic = true;
1625
- } else if (childFile.ast.program.extra.featureType === "class") {
1622
+ if ((0, import_babel_utils9.getTagDef)(tag)?.renderer || childFile?.ast.program.extra.featureType === "class") {
1626
1623
  extra.tagNameType = 2 /* DynamicTag */;
1627
1624
  extra.tagNameDynamic = true;
1628
1625
  extra.featureType = "class";
1629
1626
  ((0, import_babel_utils9.getProgram)().node.extra ??= {}).needsCompat = true;
1627
+ } else if (!childFile) {
1628
+ extra.tagNameType = 2 /* DynamicTag */;
1629
+ extra.tagNameDynamic = true;
1630
1630
  }
1631
1631
  }
1632
1632
  }
@@ -5498,13 +5498,26 @@ function translateVar(tag, initialValue, kind = "const") {
5498
5498
  const changeName = binding.property + "Change";
5499
5499
  const changeBinding = binding.upstreamAlias.propertyAliases.get(changeName);
5500
5500
  if (changeBinding && changeName !== changeBinding.name) {
5501
- getDestructurePattern(id)?.pushContainer(
5502
- "properties",
5503
- import_compiler32.types.objectProperty(
5504
- import_compiler32.types.identifier(changeName),
5505
- import_compiler32.types.identifier(changeBinding.name)
5506
- )
5507
- );
5501
+ const pattern = getDestructurePattern(id);
5502
+ if (pattern) {
5503
+ pattern.unshiftContainer(
5504
+ "properties",
5505
+ import_compiler32.types.objectProperty(
5506
+ import_compiler32.types.identifier(changeName),
5507
+ import_compiler32.types.identifier(changeBinding.name)
5508
+ )
5509
+ );
5510
+ const lastProperty = pattern.get("properties").at(-1);
5511
+ if (lastProperty?.node.type === "RestElement") {
5512
+ const restBinding = lastProperty.node.argument.extra?.binding;
5513
+ if (restBinding) {
5514
+ restBinding.excludeProperties = propsUtil.add(
5515
+ restBinding.excludeProperties,
5516
+ changeName
5517
+ );
5518
+ }
5519
+ }
5520
+ }
5508
5521
  }
5509
5522
  });
5510
5523
  tag.insertBefore(
@@ -6487,7 +6500,9 @@ function getOnlyChildParentTagName(tag, branchSize = 1) {
6487
6500
  return extra[kOnlyChildInParent];
6488
6501
  }
6489
6502
  const parentTag = getParentTag(tag);
6490
- return extra[kOnlyChildInParent] = parentTag && (0, import_babel_utils22.getTagDef)(parentTag)?.html && parentTag.node.name.type === "StringLiteral" && tag.parent.body.length === branchSize ? parentTag.node.name.value : false;
6503
+ return extra[kOnlyChildInParent] = parentTag && (0, import_babel_utils22.getTagDef)(parentTag)?.html && parentTag.node.name.type === "StringLiteral" && tag.parent.body.filter(
6504
+ (node) => node.type !== "MarkoComment"
6505
+ ).length === branchSize ? parentTag.node.name.value : false;
6491
6506
  }
6492
6507
  function getOptimizedOnlyChildNodeBinding(tag, section, branchSize = 1) {
6493
6508
  if (getOnlyChildParentTagName(tag, branchSize)) {
@@ -11874,7 +11889,7 @@ function getTagRelativePath(tag) {
11874
11889
  } = tag;
11875
11890
  let relativePath;
11876
11891
  if (import_compiler61.types.isStringLiteral(node.name)) {
11877
- const template = (0, import_babel_utils49.getTagTemplate)(tag);
11892
+ const template = node.extra?.featureType === "class" && (0, import_babel_utils49.getTagDef)(tag)?.renderer || (0, import_babel_utils49.getTagTemplate)(tag);
11878
11893
  relativePath = template && (0, import_babel_utils49.resolveRelativePath)(file, template);
11879
11894
  } else if (node.extra?.tagNameImported) {
11880
11895
  relativePath = node.extra.tagNameImported;
@@ -12342,7 +12357,6 @@ var text_default = {
12342
12357
  var import_generator = __toESM(require("@babel/generator"));
12343
12358
  var import_compiler65 = require("@marko/compiler");
12344
12359
  var import_babel_utils53 = require("@marko/compiler/babel-utils");
12345
- var translate6 = __toESM(require("@marko/runtime-tags/translator"));
12346
12360
  var import_path6 = __toESM(require("path"));
12347
12361
 
12348
12362
  // src/translator/interop/feature-detection.ts
@@ -12573,23 +12587,23 @@ function addFeature(state, type, name2, path7) {
12573
12587
  function createInteropTranslator(translate5) {
12574
12588
  return {
12575
12589
  preferAPI: translate5.preferAPI,
12576
- transform: mergeVisitors(translate5.transform, translate6.transform),
12577
- analyze: mergeVisitors(translate5.analyze, translate6.analyze),
12590
+ transform: mergeVisitors(translate5.transform, transform),
12591
+ analyze: mergeVisitors(translate5.analyze, analyze),
12578
12592
  translate: patchTranslateProgram(
12579
- mergeVisitors(translate5.translate, translate6.translate)
12593
+ mergeVisitors(translate5.translate, translate)
12580
12594
  ),
12581
12595
  tagDiscoveryDirs: [
12582
- ...translate6.tagDiscoveryDirs,
12596
+ ...tagDiscoveryDirs,
12583
12597
  ...translate5.tagDiscoveryDirs
12584
12598
  ],
12585
12599
  taglibs: mergeTaglibs(
12586
12600
  import_compiler65.taglib.resolveOptionalTaglibs(translate5.optionalTaglibs).concat(translate5.taglibs),
12587
- translate6.taglibs
12601
+ taglibs
12588
12602
  ),
12589
12603
  getRuntimeEntryFiles(output, optimize) {
12590
12604
  return [
12591
12605
  ...translate5.getRuntimeEntryFiles(output, optimize),
12592
- ...translate6.getRuntimeEntryFiles(output, optimize)
12606
+ ...getRuntimeEntryFiles(output, optimize)
12593
12607
  ];
12594
12608
  }
12595
12609
  };
@@ -12627,7 +12641,7 @@ function createInteropTranslator(translate5) {
12627
12641
  return [
12628
12642
  importHydrateProgram(
12629
12643
  "6",
12630
- translate6.internalEntryBuilder.build(entryFile, true)
12644
+ entry_builder_default.build(entryFile, true)
12631
12645
  ),
12632
12646
  importHydrateProgram(
12633
12647
  "5",
@@ -12644,7 +12658,7 @@ function createInteropTranslator(translate5) {
12644
12658
  return translate5.internalEntryBuilder.build(entryFile);
12645
12659
  }
12646
12660
  } else {
12647
- return translate6.internalEntryBuilder.build(entryFile);
12661
+ return entry_builder_default.build(entryFile);
12648
12662
  }
12649
12663
  },
12650
12664
  visit(file, entryFile, visitChild) {
@@ -12654,7 +12668,7 @@ function createInteropTranslator(translate5) {
12654
12668
  };
12655
12669
  if (isTagsAPI(file)) {
12656
12670
  state.has6 = true;
12657
- translate6.internalEntryBuilder.visit(file, entryFile, visitChild);
12671
+ entry_builder_default.visit(file, entryFile, visitChild);
12658
12672
  } else {
12659
12673
  state.has5 = true;
12660
12674
  translate5.internalEntryBuilder.visit(file, entryFile, visitChild);
@@ -12857,10 +12871,10 @@ var visitors = extractVisitors({
12857
12871
  MarkoScriptlet: scriptlet_default,
12858
12872
  MarkoComment: comment_default
12859
12873
  });
12860
- var tagDiscoveryDirs2 = ["tags"];
12874
+ var tagDiscoveryDirs = ["tags"];
12861
12875
  var preferAPI = "tags";
12862
- var { transform: transform2, analyze: analyze2, translate: translate2 } = visitors;
12863
- var taglibs2 = [
12876
+ var { transform, analyze, translate } = visitors;
12877
+ var taglibs = [
12864
12878
  [
12865
12879
  core_default.taglibId,
12866
12880
  {
@@ -12869,7 +12883,7 @@ var taglibs2 = [
12869
12883
  }
12870
12884
  ]
12871
12885
  ];
12872
- function getRuntimeEntryFiles2(output, optimize) {
12886
+ function getRuntimeEntryFiles(output, optimize) {
12873
12887
  return [
12874
12888
  `${runtime_info_default.name}${optimize ? "" : "/debug"}/${output === "html" ? "html" : "dom"}`
12875
12889
  ];
@@ -1,4 +1,4 @@
1
1
  import { types as t } from "@marko/compiler";
2
- import type { Binding } from "./references";
2
+ import { type Binding } from "./references";
3
3
  export default function translateVar(tag: t.NodePath<t.MarkoTag>, initialValue: t.Expression, kind?: "let" | "const"): void;
4
4
  export declare function translateDomVar(tag: t.NodePath<t.MarkoTag>, binding: Binding | undefined): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.0.124",
3
+ "version": "6.0.126",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",