marko 6.3.26 → 6.3.27

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.
@@ -751,16 +751,11 @@ function writeReferenceOr(state, write, val, parent, accessor) {
751
751
  abortUnreachableChannel(state, val);
752
752
  return false;
753
753
  }
754
- if (parent) {
755
- if (ref.assigns) {
756
- addAssignment(ref, accessId(state, parent) + toAccess(accessor));
757
- return false;
758
- } else if (isCircular(parent, ref)) {
759
- ensureId(state, ref);
760
- state.assigned.add(ref);
761
- addAssignment(ref, accessId(state, parent) + toAccess(accessor));
762
- return false;
763
- }
754
+ if (parent && isCircular(parent, ref)) {
755
+ ensureId(state, ref);
756
+ state.assigned.add(ref);
757
+ addAssignment(ref, accessId(state, parent) + toAccess(accessor));
758
+ return false;
764
759
  }
765
760
  state.buf.push(ensureId(state, ref));
766
761
  return true;
@@ -749,16 +749,11 @@ function writeReferenceOr(state, write, val, parent, accessor) {
749
749
  abortUnreachableChannel(state, val);
750
750
  return false;
751
751
  }
752
- if (parent) {
753
- if (ref.assigns) {
754
- addAssignment(ref, accessId(state, parent) + toAccess(accessor));
755
- return false;
756
- } else if (isCircular(parent, ref)) {
757
- ensureId(state, ref);
758
- state.assigned.add(ref);
759
- addAssignment(ref, accessId(state, parent) + toAccess(accessor));
760
- return false;
761
- }
752
+ if (parent && isCircular(parent, ref)) {
753
+ ensureId(state, ref);
754
+ state.assigned.add(ref);
755
+ addAssignment(ref, accessId(state, parent) + toAccess(accessor));
756
+ return false;
762
757
  }
763
758
  state.buf.push(ensureId(state, ref));
764
759
  return true;
package/dist/html.js CHANGED
@@ -593,14 +593,7 @@ function writeProp(state, val, parent, accessor) {
593
593
  }
594
594
  function writeReferenceOr(state, write, val, parent, accessor) {
595
595
  let ref = state.refs.get(val);
596
- if (ref) {
597
- if (!trackChannel(state, ref)) return !1;
598
- if (parent) {
599
- if (ref.assigns) return addAssignment(ref, accessId(state, parent) + toAccess(accessor)), !1;
600
- if (isCircular(parent, ref)) return ensureId(state, ref), state.assigned.add(ref), addAssignment(ref, accessId(state, parent) + toAccess(accessor)), !1;
601
- }
602
- return state.buf.push(ensureId(state, ref)), !0;
603
- }
596
+ if (ref) return trackChannel(state, ref) ? parent && isCircular(parent, ref) ? (ensureId(state, ref), state.assigned.add(ref), addAssignment(ref, accessId(state, parent) + toAccess(accessor)), !1) : (state.buf.push(ensureId(state, ref)), !0) : !1;
604
597
  let registered = REGISTRY.get(val);
605
598
  return registered ? writeRegistered(state, val, parent, accessor, registered) : (state.refs.set(val, ref = new Reference(parent, accessor, state.flush, state.buf.length)), ref.channel = state.channel, write(state, val, ref) ? !0 : (state.refs.delete(val), !1));
606
599
  }
package/dist/html.mjs CHANGED
@@ -592,14 +592,7 @@ function writeProp(state, val, parent, accessor) {
592
592
  }
593
593
  function writeReferenceOr(state, write, val, parent, accessor) {
594
594
  let ref = state.refs.get(val);
595
- if (ref) {
596
- if (!trackChannel(state, ref)) return !1;
597
- if (parent) {
598
- if (ref.assigns) return addAssignment(ref, accessId(state, parent) + toAccess(accessor)), !1;
599
- if (isCircular(parent, ref)) return ensureId(state, ref), state.assigned.add(ref), addAssignment(ref, accessId(state, parent) + toAccess(accessor)), !1;
600
- }
601
- return state.buf.push(ensureId(state, ref)), !0;
602
- }
595
+ if (ref) return trackChannel(state, ref) ? parent && isCircular(parent, ref) ? (ensureId(state, ref), state.assigned.add(ref), addAssignment(ref, accessId(state, parent) + toAccess(accessor)), !1) : (state.buf.push(ensureId(state, ref)), !0) : !1;
603
596
  let registered = REGISTRY.get(val);
604
597
  return registered ? writeRegistered(state, val, parent, accessor, registered) : (state.refs.set(val, ref = new Reference(parent, accessor, state.flush, state.buf.length)), ref.channel = state.channel, write(state, val, ref) ? !0 : (state.refs.delete(val), !1));
605
598
  }
@@ -4183,13 +4183,11 @@ function getBaseArgsInForTag(type, attrs) {
4183
4183
  }
4184
4184
  //#endregion
4185
4185
  //#region src/translator/util/nested-attribute-tags.ts
4186
- const attrTagToIdentifierLookup = /* @__PURE__ */ new WeakMap();
4186
+ const [getAttrTagIdentifiers] = createProgramState(() => /* @__PURE__ */ new WeakMap());
4187
4187
  function getAttrTagIdentifier(meta) {
4188
- let name = attrTagToIdentifierLookup.get(meta);
4189
- if (!name) {
4190
- name = generateUid(meta.name);
4191
- attrTagToIdentifierLookup.set(meta, name);
4192
- }
4188
+ const identifiers = getAttrTagIdentifiers();
4189
+ let name = identifiers.get(meta);
4190
+ if (!name) identifiers.set(meta, name = generateUid(meta.name));
4193
4191
  return _marko_compiler.types.identifier(name);
4194
4192
  }
4195
4193
  function getAttrTagPaths(tag) {
@@ -4511,6 +4509,10 @@ var native_tag_default = {
4511
4509
  assertExclusiveAttrs(seen, (msg) => {
4512
4510
  throw tag.get("name").buildCodeFrameError(msg);
4513
4511
  });
4512
+ if (seen.content) {
4513
+ if ((0, _marko_compiler_babel_utils.getTagDef)(tag)?.parseOptions?.openTagOnly) throw tag.hub.buildError(seen.content, `The \`<${tagName}>\` tag cannot have content, so it does not support the \`content\` attribute.`);
4514
+ if (isTextOnly) throw tag.hub.buildError(seen.content, `The \`<${tagName}>\` tag takes its content from its body as text, so it does not support the \`content\` attribute.`);
4515
+ }
4514
4516
  let textPlaceholders;
4515
4517
  if (isTextOnly) {
4516
4518
  for (const child of tag.node.body.body) if (_marko_compiler.types.isMarkoPlaceholder(child)) (textPlaceholders ||= []).push(child.value);
@@ -4572,10 +4574,11 @@ var native_tag_default = {
4572
4574
  const write = writeTo(tag);
4573
4575
  const tagSection = getSection(tag);
4574
4576
  const visitAccessor = nodeBinding && getScopeAccessorLiteral(nodeBinding);
4575
- write`<${tagName}`;
4576
4577
  const usedAttrs = getUsedAttrs(tagName, tag.node);
4577
4578
  const { staticAttrs, staticControllable, staticContentAttr, skipExpression, injectNonce } = usedAttrs;
4578
4579
  let { spreadExpression } = usedAttrs;
4580
+ if (tagName === "select" && (staticControllable || spreadExpression)) flushBefore(tag);
4581
+ write`<${tagName}`;
4579
4582
  if (injectNonce) write`${callRuntime("_attr_nonce")}`;
4580
4583
  if (staticControllable) {
4581
4584
  const hasChangeHandler = !!staticControllable.attrs[1];
@@ -9589,7 +9592,6 @@ function translateDOM(tag) {
9589
9592
  (0, _marko_compiler_babel_utils.getProgram)().node.body.push(_marko_compiler.types.variableDeclaration("let", [_marko_compiler.types.variableDeclarator(setupIdent, callRuntime("_load_setup", getScopeAccessorLiteral(node.extra[kLoadTagBinding], true), getScopeAccessorLiteral(childBinding, true), triggerIdent ? _marko_compiler.types.addComment(_marko_compiler.types.callExpression(triggerIdent, [setupLoadExpr]), "leading", "@__PURE__") : setupLoadExpr))]));
9590
9593
  addStatement("render", section, void 0, _marko_compiler.types.expressionStatement(_marko_compiler.types.callExpression(setupIdent, [scopeIdentifier])));
9591
9594
  });
9592
- write`<!>`;
9593
9595
  visit(tag, 37);
9594
9596
  injectWalks(tag, tagName);
9595
9597
  enterShallow(tag);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.3.26",
3
+ "version": "6.3.27",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",
@@ -48,14 +48,14 @@
48
48
  }
49
49
  },
50
50
  "dependencies": {
51
- "@marko/compiler": "^5.41.10",
51
+ "@marko/compiler": "^5.41.11",
52
52
  "csstype": "^3.2.3",
53
53
  "fastest-levenshtein": "^1.0.16",
54
54
  "magic-string": "^0.30.21"
55
55
  },
56
56
  "devDependencies": {
57
- "marko": "5.39.30",
58
- "@marko/runtime-tags": "npm:marko@6.3.26"
57
+ "@marko/runtime-tags": "npm:marko@6.3.27",
58
+ "marko": "5.39.30"
59
59
  },
60
60
  "engines": {
61
61
  "node": ">=22"