marko 6.0.58 → 6.0.60

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.
@@ -5501,7 +5501,7 @@ function mergeSources(a, b) {
5501
5501
  );
5502
5502
  }
5503
5503
  var bindingUtil = new Sorted(function compareBindings(a, b) {
5504
- return a === b ? 0 : a.section.id - b.section.id || a.type !== b.type && (a.type === 0 /* dom */ || b.type === 0 /* dom */) ? a.type - b.type || a.id - b.id : a.id - b.id;
5504
+ return a === b ? 0 : a.section.id - b.section.id || (a.type !== b.type && (a.type === 0 /* dom */ || b.type === 0 /* dom */) ? a.type - b.type || a.id - b.id : a.id - b.id);
5505
5505
  });
5506
5506
  var propsUtil = new Sorted(function compareProps(a, b) {
5507
5507
  return a < b ? -1 : a > b ? 1 : 0;
@@ -9069,10 +9069,10 @@ var id_default = {
9069
9069
  analyze(tag) {
9070
9070
  (0, import_babel_utils35.assertNoArgs)(tag);
9071
9071
  (0, import_babel_utils35.assertNoParams)(tag);
9072
- (0, import_babel_utils35.assertNoAttributes)(tag);
9073
9072
  assertNoBodyContent(tag);
9074
9073
  (0, import_babel_utils35.assertNoAttributeTags)(tag);
9075
9074
  const { node } = tag;
9075
+ const [valueAttr] = node.attributes;
9076
9076
  if (!node.var) {
9077
9077
  throw tag.get("name").buildCodeFrameError(
9078
9078
  "The [`<id>` tag](https://next.markojs.com/docs/reference/core-tag#id) requires a [tag variable](https://next.markojs.com/docs/reference/language#tag-variables)."
@@ -9083,22 +9083,44 @@ var id_default = {
9083
9083
  "The [`<id>` tag](https://next.markojs.com/docs/reference/core-tag#id) cannot be destructured."
9084
9084
  );
9085
9085
  }
9086
+ if (tag.node.attributes.length > 1 || tag.node.attributes.length === 1 && (!import_compiler41.types.isMarkoAttribute(valueAttr) || !valueAttr.default && valueAttr.name !== "value")) {
9087
+ throw tag.get("name").buildCodeFrameError(
9088
+ "The [`<id>` tag](https://next.markojs.com/docs/reference/core-tag#id) only supports the [`value=` attribute](https://next.markojs.com/docs/reference/language#shorthand-value)."
9089
+ );
9090
+ }
9086
9091
  const binding = trackVarReferences(tag, 5 /* derived */);
9087
9092
  if (binding) {
9088
- setBindingDownstream(binding, false);
9093
+ setBindingDownstream(binding, !!valueAttr && evaluate(valueAttr.value));
9089
9094
  }
9090
9095
  },
9091
9096
  translate: {
9092
9097
  exit(tag) {
9093
9098
  const { node } = tag;
9094
9099
  const id = isOutputHTML() ? callRuntime("nextTagId") : callRuntime("nextTagId", scopeIdentifier);
9100
+ const [valueAttr] = tag.node.attributes;
9095
9101
  if (isOutputHTML()) {
9096
9102
  tag.replaceWith(
9097
- import_compiler41.types.variableDeclaration("const", [import_compiler41.types.variableDeclarator(node.var, id)])
9103
+ import_compiler41.types.variableDeclaration("const", [
9104
+ import_compiler41.types.variableDeclarator(
9105
+ node.var,
9106
+ valueAttr ? import_compiler41.types.logicalExpression("||", valueAttr.value, id) : id
9107
+ )
9108
+ ])
9098
9109
  );
9099
9110
  } else {
9111
+ const section = getSection(tag);
9100
9112
  const source = initValue(node.var.extra.binding);
9101
- addValue(getSection(tag), void 0, source, id);
9113
+ if (valueAttr) {
9114
+ const { value } = valueAttr;
9115
+ addValue(
9116
+ section,
9117
+ value.extra?.referencedBindings,
9118
+ source,
9119
+ import_compiler41.types.logicalExpression("||", value, id)
9120
+ );
9121
+ } else {
9122
+ addValue(section, void 0, source, id);
9123
+ }
9102
9124
  tag.remove();
9103
9125
  }
9104
9126
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.0.58",
3
+ "version": "6.0.60",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",