marko 6.0.57 → 6.0.58

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.
@@ -56,16 +56,19 @@ var import_babel_utils = require("@marko/compiler/babel-utils");
56
56
  function assertNoSpreadAttrs(tag) {
57
57
  for (const attr2 of tag.get("attributes")) {
58
58
  if (attr2.isMarkoSpreadAttribute()) {
59
+ const tagName = tag.get("name").node.value;
59
60
  throw attr2.buildCodeFrameError(
60
- `The \`${tag.get("name").node.value}\` tag does not support \`...spread\` attributes.`
61
+ `The [\`<${tagName}>\`](https://next.markojs.com/docs/reference/core-tag#${tagName}) tag does not support \`...spread\` attributes.`
61
62
  );
62
63
  }
63
64
  }
64
65
  }
65
66
  function assertNoBodyContent(tag) {
66
67
  if (tag.node.body.body.length) {
67
- throw tag.get("name").buildCodeFrameError(
68
- `The \`${tag.get("name").node.value}\` tag does not support body content.`
68
+ const tagName = tag.get("name");
69
+ const tagNameLiteral = tagName.node.value;
70
+ throw tagName.buildCodeFrameError(
71
+ `The [\`<${tagNameLiteral}>\`](https://next.markojs.com/docs/reference/core-tag#${tagNameLiteral}) tag does not support body content.`
69
72
  );
70
73
  }
71
74
  }
@@ -3067,7 +3070,7 @@ function getSectionMeta(section) {
3067
3070
  function markNode(path5, nodeBinding, reason) {
3068
3071
  if (nodeBinding.type !== 0 /* dom */) {
3069
3072
  throw path5.buildCodeFrameError(
3070
- "Tried to mark a node that was not determined to need a mark during analyze."
3073
+ "POTENTIAL MARKO BUG: Tried to mark a node that was not determined to need a mark during analyze."
3071
3074
  );
3072
3075
  }
3073
3076
  if (isOutputHTML()) {
@@ -3097,24 +3100,26 @@ var return_default = {
3097
3100
  if (parentTag) {
3098
3101
  if ((0, import_babel_utils15.isNativeTag)(parentTag)) {
3099
3102
  throw tag.get("name").buildCodeFrameError(
3100
- "The `return` tag can not be used in a native tag."
3103
+ "The [`<return>` tag](https://next.markojs.com/docs/reference/core-tag#return) can not be used in a [native tag](https://next.markojs.com/docs/reference/native-tag)."
3101
3104
  );
3102
3105
  } else if (isControlFlowTag(parentTag)) {
3103
3106
  throw tag.get("name").buildCodeFrameError(
3104
- `The \`return\` tag can not be used under an \`${parentTag.get("name").toString()}\` tag.`
3107
+ `The [\`<return>\` tag](https://next.markojs.com/docs/reference/core-tag#return) can not be used under the \`<${parentTag.get("name").toString()}>\` tag.`
3105
3108
  );
3106
3109
  }
3107
3110
  }
3108
3111
  if (tagsWithReturn.has(tag.parentPath)) {
3109
3112
  throw tag.get("name").buildCodeFrameError(
3110
- `Cannot have multiple \`return\` tags ${tag.parent.type === "Program" ? "for the template" : "within a tag's body content"}.`
3113
+ `Cannot have multiple [\`<return>\` tags](https://next.markojs.com/docs/reference/core-tag#return) ${tag.parent.type === "Program" ? "for the template" : "within a tag's body content"}.`
3111
3114
  );
3112
3115
  } else {
3113
3116
  tagsWithReturn.add(tag.parentPath);
3114
3117
  }
3115
3118
  const attrs2 = getKnownAttrValues(tag.node);
3116
3119
  if (!attrs2.value) {
3117
- throw tag.get("name").buildCodeFrameError("The `return` tag requires a value.");
3120
+ throw tag.get("name").buildCodeFrameError(
3121
+ "The [`<return>` tag](https://next.markojs.com/docs/reference/core-tag#return) requires a [`value=` attribute](https://next.markojs.com/docs/reference/language#shorthand-value)."
3122
+ );
3118
3123
  }
3119
3124
  if (attrs2.valueChange) {
3120
3125
  (attrs2.valueChange.extra ??= {}).isEffect = true;
@@ -3188,7 +3193,7 @@ var return_default = {
3188
3193
  displayText: "return=<value>",
3189
3194
  description: "Provides a value for use in a parent template.",
3190
3195
  snippet: "return=${1:value}",
3191
- descriptionMoreURL: "https://markojs.com/docs/core-tags/#return"
3196
+ descriptionMoreURL: "https://next.markojs.com/docs/reference/core-tag#return"
3192
3197
  }
3193
3198
  ]
3194
3199
  };
@@ -4860,7 +4865,7 @@ function trackAssignment(assignment, binding) {
4860
4865
  const changePropName = binding.property + "Change";
4861
4866
  const changeBinding = binding.upstreamAlias.propertyAliases.get(changePropName) || createBinding(
4862
4867
  generateUid(changePropName),
4863
- 5 /* derived */,
4868
+ binding.type === 2 /* input */ ? binding.type : 5 /* derived */,
4864
4869
  binding.section,
4865
4870
  binding.upstreamAlias,
4866
4871
  changePropName,
@@ -5849,19 +5854,23 @@ var await_default = {
5849
5854
  const tagExtra = tag.node.extra ??= {};
5850
5855
  tagExtra[kDOMBinding] = createBinding("#text", 0 /* dom */, section);
5851
5856
  if (!valueAttr) {
5852
- throw tag.get("name").buildCodeFrameError("The `await` tag requires a value.");
5857
+ throw tag.get("name").buildCodeFrameError(
5858
+ "The [`<await>` tag](https://next.markojs.com/docs/reference/core-tag#await) requires a [`value=` attribute](https://next.markojs.com/docs/reference/language#shorthand-value)."
5859
+ );
5853
5860
  }
5854
5861
  if (node.attributes.length > 1 || !import_compiler26.types.isMarkoAttribute(valueAttr) || valueAttr.name !== "value") {
5855
5862
  throw tag.get("name").buildCodeFrameError(
5856
- "The `await` tag only supports the `value` attribute."
5863
+ "The [`<await>` tag](https://next.markojs.com/docs/reference/core-tag#await) only supports the [`value=` attribute](https://next.markojs.com/docs/reference/language#shorthand-value)."
5857
5864
  );
5858
5865
  }
5859
5866
  if (!node.body.body.length) {
5860
- throw tag.get("name").buildCodeFrameError("The `await` tag requires body content.");
5867
+ throw tag.get("name").buildCodeFrameError(
5868
+ "The [`<await>` tag](https://next.markojs.com/docs/reference/core-tag#await) requires [content](https://next.markojs.com/docs/reference/language#tag-content)."
5869
+ );
5861
5870
  }
5862
5871
  if (node.body.params.length && (node.body.params.length > 1 || import_compiler26.types.isSpreadElement(node.body.params[0]))) {
5863
5872
  throw tag.get("name").buildCodeFrameError(
5864
- "The `await` tag only supports a single parameter."
5873
+ "The [`<await>` tag](https://next.markojs.com/docs/reference/core-tag#await) only supports a single parameter."
5865
5874
  );
5866
5875
  }
5867
5876
  const bodySection = startSection(tagBody);
@@ -5955,7 +5964,7 @@ var await_default = {
5955
5964
  autocomplete: [
5956
5965
  {
5957
5966
  description: "Use to consume asynchronous an data.",
5958
- descriptionMoreURL: "https://markojs.com/docs/core-tags/#await"
5967
+ descriptionMoreURL: "https://next.markojs.com/docs/reference/core-tag#await"
5959
5968
  }
5960
5969
  ],
5961
5970
  types: runtime_info_default.name + "/tags/await.d.marko"
@@ -6045,14 +6054,18 @@ var const_default = {
6045
6054
  const { node } = tag;
6046
6055
  const [valueAttr] = node.attributes;
6047
6056
  if (!node.var) {
6048
- throw tag.get("name").buildCodeFrameError("The `const` tag requires a tag variable.");
6057
+ throw tag.get("name").buildCodeFrameError(
6058
+ "The [`<const>` tag](https://next.markojs.com/docs/reference/core-tag#const) requires a [tag variable](https://next.markojs.com/docs/reference/language#tag-variables)."
6059
+ );
6049
6060
  }
6050
6061
  if (!valueAttr) {
6051
- throw tag.get("name").buildCodeFrameError("The `const` tag requires a value.");
6062
+ throw tag.get("name").buildCodeFrameError(
6063
+ "The [`<const>` tag](https://next.markojs.com/docs/reference/core-tag#const) requires a [`value=` attribute](https://next.markojs.com/docs/reference/language#shorthand-value)."
6064
+ );
6052
6065
  }
6053
6066
  if (node.attributes.length > 1 || !import_compiler29.types.isMarkoAttribute(valueAttr) || !valueAttr.default && valueAttr.name !== "value") {
6054
6067
  throw tag.get("name").buildCodeFrameError(
6055
- "The `const` tag only supports the `value` attribute."
6068
+ "The [`<const>` tag](https://next.markojs.com/docs/reference/core-tag#const) only supports the [`value=` attribute](https://next.markojs.com/docs/reference/language#shorthand-value)."
6056
6069
  );
6057
6070
  }
6058
6071
  const valueExtra = evaluate(valueAttr.value);
@@ -6091,7 +6104,7 @@ var const_default = {
6091
6104
  autocomplete: [
6092
6105
  {
6093
6106
  description: "Use to create an constant binding.",
6094
- descriptionMoreURL: "https://markojs.com/docs/core-tags/#const"
6107
+ descriptionMoreURL: "https://next.markojs.com/docs/reference/core-tag#const"
6095
6108
  }
6096
6109
  ],
6097
6110
  types: runtime_info_default.name + "/tags/const.d.marko"
@@ -6109,7 +6122,7 @@ var debug_default = {
6109
6122
  assertNoBodyContent(tag);
6110
6123
  if (tag.node.attributes.length > 1 || tag.node.attributes.length === 1 && (!import_compiler30.types.isMarkoAttribute(valueAttr) || !valueAttr.default && valueAttr.name !== "value")) {
6111
6124
  throw tag.get("name").buildCodeFrameError(
6112
- "The `debug` tag only supports the `value` attribute."
6125
+ "The [`<debug>` tag](https://next.markojs.com/docs/reference/core-tag#debug) only supports the [`value=` attribute](https://next.markojs.com/docs/reference/language#shorthand-value)."
6113
6126
  );
6114
6127
  }
6115
6128
  },
@@ -6134,7 +6147,7 @@ var debug_default = {
6134
6147
  autocomplete: [
6135
6148
  {
6136
6149
  description: "Debug on value change.",
6137
- descriptionMoreURL: "https://markojs.com/docs/core-tags/#debug"
6150
+ descriptionMoreURL: "https://next.markojs.com/docs/reference/core-tag#debug"
6138
6151
  }
6139
6152
  ],
6140
6153
  types: runtime_info_default.name + "/tags/debug.d.marko"
@@ -6321,7 +6334,7 @@ var native_tag_default = {
6321
6334
  const { node } = tag;
6322
6335
  if (node.var && !import_compiler32.types.isIdentifier(node.var)) {
6323
6336
  throw tag.get("var").buildCodeFrameError(
6324
- "Tag variables on native elements cannot be destructured."
6337
+ "Tag variables on [native tags](https://next.markojs.com/docs/reference/native-tag) cannot be destructured."
6325
6338
  );
6326
6339
  }
6327
6340
  const tagName = getTagName(tag);
@@ -7255,7 +7268,7 @@ var for_default = {
7255
7268
  break;
7256
7269
  default:
7257
7270
  throw tag.buildCodeFrameError(
7258
- "Invalid `for` tag, missing an `of=`, `in=`, `to=` attribute."
7271
+ "The [`<for>` tag](https://next.markojs.com/docs/reference/core-tag#for) requires an `of=`, `in=`, or `to=` attribute."
7259
7272
  );
7260
7273
  }
7261
7274
  if (!isAttrTag) {
@@ -7465,15 +7478,15 @@ var for_default = {
7465
7478
  {
7466
7479
  snippet: "for|${1:value, index}| of=${3:array}",
7467
7480
  description: "Use to iterate over lists, object properties, or between ranges.",
7468
- descriptionMoreURL: "https://markojs.com/docs/core-tags/#iterating-over-a-list"
7481
+ descriptionMoreURL: "https://next.markojs.com/docs/reference/core-tag#for"
7469
7482
  },
7470
7483
  {
7471
7484
  snippet: "for|${1:name, value}| in=${3:object}",
7472
- descriptionMoreURL: "https://markojs.com/docs/core-tags/#iterating-over-an-objects-properties"
7485
+ descriptionMoreURL: "https://next.markojs.com/docs/reference/core-tag#for"
7473
7486
  },
7474
7487
  {
7475
7488
  snippet: "for|${1:index}| to=${2:number}",
7476
- descriptionMoreURL: "https://markojs.com/docs/core-tags/#iterating-between-a-range-of-numbers"
7489
+ descriptionMoreURL: "https://next.markojs.com/docs/reference/core-tag#for"
7477
7490
  }
7478
7491
  ]
7479
7492
  };
@@ -7895,7 +7908,9 @@ var define_default = {
7895
7908
  analyze(tag) {
7896
7909
  (0, import_babel_utils29.assertNoArgs)(tag);
7897
7910
  if (!tag.node.var) {
7898
- throw tag.get("name").buildCodeFrameError("The `define` tag requires a tag variable.");
7911
+ throw tag.get("name").buildCodeFrameError(
7912
+ "The [`<define>` tag](https://next.markojs.com/docs/reference/core-tag#define) requires a [tag variable](https://next.markojs.com/docs/reference/language#tag-variables)."
7913
+ );
7899
7914
  }
7900
7915
  const tagBody = tag.get("body");
7901
7916
  const bodySection = startSection(tagBody);
@@ -7956,7 +7971,7 @@ var define_default = {
7956
7971
  autocomplete: [
7957
7972
  {
7958
7973
  description: "Use to create a constant object binding that can be rendered.",
7959
- descriptionMoreURL: "https://markojs.com/docs/core-tags/#define"
7974
+ descriptionMoreURL: "https://next.markojs.com/docs/reference/core-tag#define"
7960
7975
  }
7961
7976
  ],
7962
7977
  types: runtime_info_default.name + "/tags/define.d.marko"
@@ -8032,7 +8047,7 @@ var html_comment_default = {
8032
8047
  if (tagVar) {
8033
8048
  if (!import_compiler38.types.isIdentifier(tagVar)) {
8034
8049
  throw tag.get("var").buildCodeFrameError(
8035
- "The `html-comment` tag variable cannot be destructured."
8050
+ "The [`<html-comment>` tag](https://next.markojs.com/docs/reference/core-tag#html-comment) tag variable cannot be destructured."
8036
8051
  );
8037
8052
  }
8038
8053
  needsBinding = true;
@@ -8199,7 +8214,7 @@ var html_comment_default = {
8199
8214
  autocomplete: [
8200
8215
  {
8201
8216
  description: "Use to create an html comment that is not stripped from the output.",
8202
- descriptionMoreURL: "https://markojs.com/docs/core-tags/#html-comment"
8217
+ descriptionMoreURL: "https://next.markojs.com/docs/reference/core-tag#html-comment"
8203
8218
  }
8204
8219
  ]
8205
8220
  };
@@ -8577,7 +8592,13 @@ var html_script_default = {
8577
8592
  parseOptions: {
8578
8593
  text: true,
8579
8594
  preserveWhitespace: true
8580
- }
8595
+ },
8596
+ autocomplete: [
8597
+ {
8598
+ description: "Use instead of `<script>` to render a native tag directly, without processing by Marko.",
8599
+ descriptionMoreURL: "https://next.markojs.com/docs/reference/core-tag#html-script--html-style"
8600
+ }
8601
+ ]
8581
8602
  };
8582
8603
  function getUsedAttrs2(tag) {
8583
8604
  const seen = {};
@@ -8990,7 +9011,13 @@ var html_style_default = {
8990
9011
  parseOptions: {
8991
9012
  text: true,
8992
9013
  preserveWhitespace: true
8993
- }
9014
+ },
9015
+ autocomplete: [
9016
+ {
9017
+ description: "Use instead of `<style>` to render a native tag directly, without processing by Marko.",
9018
+ descriptionMoreURL: "https://next.markojs.com/docs/reference/core-tag#html-script--html-style"
9019
+ }
9020
+ ]
8994
9021
  };
8995
9022
  function getUsedAttrs3(tag) {
8996
9023
  const seen = {};
@@ -9047,10 +9074,14 @@ var id_default = {
9047
9074
  (0, import_babel_utils35.assertNoAttributeTags)(tag);
9048
9075
  const { node } = tag;
9049
9076
  if (!node.var) {
9050
- throw tag.get("name").buildCodeFrameError("The `id` tag requires a tag variable.");
9077
+ throw tag.get("name").buildCodeFrameError(
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)."
9079
+ );
9051
9080
  }
9052
9081
  if (!import_compiler41.types.isIdentifier(node.var)) {
9053
- throw tag.get("var").buildCodeFrameError("The `id` tag cannot be destructured");
9082
+ throw tag.get("var").buildCodeFrameError(
9083
+ "The [`<id>` tag](https://next.markojs.com/docs/reference/core-tag#id) cannot be destructured."
9084
+ );
9054
9085
  }
9055
9086
  const binding = trackVarReferences(tag, 5 /* derived */);
9056
9087
  if (binding) {
@@ -9081,7 +9112,7 @@ var id_default = {
9081
9112
  displayText: "id/<name>",
9082
9113
  description: "Use to create a unique identifier.",
9083
9114
  snippet: "id/${1:name}",
9084
- descriptionMoreURL: "https://markojs.com/docs/core-tags/#id"
9115
+ descriptionMoreURL: "https://next.markojs.com/docs/reference/core-tag#id"
9085
9116
  }
9086
9117
  ],
9087
9118
  types: runtime_info_default.name + "/tags/id.d.marko"
@@ -9314,7 +9345,7 @@ var IfTag = {
9314
9345
  {
9315
9346
  snippet: "if=${1:condition}",
9316
9347
  description: "Use to display content only if the condition is met.",
9317
- descriptionMoreURL: "https://markojs.com/docs/core-tags/#if-else-if-else"
9348
+ descriptionMoreURL: "https://next.markojs.com/docs/reference/core-tag#if--else"
9318
9349
  }
9319
9350
  ]
9320
9351
  };
@@ -9324,7 +9355,7 @@ var ElseIfTag = {
9324
9355
  {
9325
9356
  snippet: "else-if=${1:condition}",
9326
9357
  description: "Use after an <if> or <else-if> tag to display content if those conditions do not match and this one does.",
9327
- descriptionMoreURL: "https://markojs.com/docs/core-tags/#if-else-if-else"
9358
+ descriptionMoreURL: "https://next.markojs.com/docs/reference/core-tag#if--else"
9328
9359
  }
9329
9360
  ]
9330
9361
  };
@@ -9333,7 +9364,7 @@ var ElseTag = {
9333
9364
  autocomplete: [
9334
9365
  {
9335
9366
  description: "Use after an <if> or <else-if> tag to display content if those conditions do not match.",
9336
- descriptionMoreURL: "https://markojs.com/docs/core-tags/#if-else-if-else"
9367
+ descriptionMoreURL: "https://next.markojs.com/docs/reference/core-tag#if--else"
9337
9368
  }
9338
9369
  ]
9339
9370
  };
@@ -9362,14 +9393,14 @@ function assertHasPrecedingCondition(tag) {
9362
9393
  while (prev.node && prev.isMarkoComment()) prev = prev.getPrevSibling();
9363
9394
  if (!isConditionTag(prev) || getTagName(prev) !== "else" && !prev.node.attributes.length) {
9364
9395
  throw tag.buildCodeFrameError(
9365
- `The \`<${getTagName(tag)}>\` must have a preceding \`<if=cond>\`, \`<else-if=cond>\`, or \`<else if=cond>\`.`
9396
+ `The [\`<${getTagName(tag)}>\` tag](https://next.markojs.com/docs/reference/core-tag#if--else) must have a preceding \`<if=cond>\` or \`<else if=cond>\`.`
9366
9397
  );
9367
9398
  }
9368
9399
  }
9369
9400
  function assertHasBody(tag) {
9370
9401
  if (!(tag.node.body.body.length || tag.node.attributeTags.length)) {
9371
9402
  throw tag.get("name").buildCodeFrameError(
9372
- `The \`${getTagName(tag)}\` tag requires body content.`
9403
+ `The [\`${getTagName(tag)}\` tag](https://next.markojs.com/docs/reference/core-tag#if--else) requires [body content](https://next.markojs.com/docs/reference/language#tag-content).`
9373
9404
  );
9374
9405
  }
9375
9406
  }
@@ -9377,12 +9408,14 @@ function assertHasValueAttribute(tag) {
9377
9408
  const { node } = tag;
9378
9409
  const [valueAttr] = node.attributes;
9379
9410
  if (!import_compiler43.types.isMarkoAttribute(valueAttr) || !valueAttr.default) {
9380
- throw tag.get("name").buildCodeFrameError(`The \`${getTagName(tag)}\` tag requires a value.`);
9411
+ throw tag.get("name").buildCodeFrameError(
9412
+ `The [\`${getTagName(tag)}\` tag](https://next.markojs.com/docs/reference/core-tag#if--else) requires a [\`value=\` attribute](https://next.markojs.com/docs/reference/language#shorthand-value).`
9413
+ );
9381
9414
  }
9382
9415
  if (node.attributes.length > 1) {
9383
9416
  const start = node.attributes[1].loc?.start;
9384
9417
  const end = node.attributes[node.attributes.length - 1].loc?.end;
9385
- const msg = `The \`${getTagName(tag)}\` tag only supports the \`value\` attribute.`;
9418
+ const msg = `The [\`${getTagName(tag)}\` tag](https://next.markojs.com/docs/reference/core-tag#if--else) only supports the [\`value=\` attribute](https://next.markojs.com/docs/reference/language#shorthand-value).`;
9386
9419
  if (start == null || end == null) {
9387
9420
  throw tag.get("name").buildCodeFrameError(msg);
9388
9421
  } else {
@@ -9400,7 +9433,7 @@ function assertOptionalIfAttribute(tag) {
9400
9433
  if (node.attributes.length > 1 || ifAttr && ifAttr.name !== "if") {
9401
9434
  const start = node.attributes[1].loc?.start;
9402
9435
  const end = node.attributes[node.attributes.length - 1].loc?.end;
9403
- const msg = `The \`${getTagName(tag)}\` tag only supports an \`if=\` attribute.`;
9436
+ const msg = `The [\`${getTagName(tag)}\` tag](https://next.markojs.com/docs/reference/core-tag#if--else) only supports an \`if=\` attribute.`;
9404
9437
  if (start == null || end == null) {
9405
9438
  throw tag.get("name").buildCodeFrameError(msg);
9406
9439
  } else {
@@ -9477,7 +9510,7 @@ var let_default = {
9477
9510
  } else {
9478
9511
  const start = attr2.loc?.start;
9479
9512
  const end = attr2.loc?.end;
9480
- const msg = "The `let` tag only supports the `value` attribute and its change handler.";
9513
+ const msg = "The [`<let>` tag](https://next.markojs.com/docs/reference/core-tag#let) only supports the [`value=` attribute](https://next.markojs.com/docs/reference/language#shorthand-value) and its change handler.";
9481
9514
  if (start == null || end == null) {
9482
9515
  throw tag.get("name").buildCodeFrameError(msg);
9483
9516
  } else {
@@ -9495,14 +9528,18 @@ var let_default = {
9495
9528
  assertNoBodyContent(tag);
9496
9529
  assertNoSpreadAttrs(tag);
9497
9530
  if (!tagVar) {
9498
- throw tag.get("name").buildCodeFrameError("The `let` tag requires a tag variable.");
9531
+ throw tag.get("name").buildCodeFrameError(
9532
+ "The [`<let>` tag](https://next.markojs.com/docs/reference/core-tag#let) requires a [tag variable](https://next.markojs.com/docs/reference/language#tag-variables)."
9533
+ );
9499
9534
  }
9500
9535
  if (!import_compiler44.types.isIdentifier(tagVar)) {
9501
- throw tag.get("var").buildCodeFrameError("The `let` tag variable cannot be destructured.");
9536
+ throw tag.get("var").buildCodeFrameError(
9537
+ "The [`<let>` tag](https://next.markojs.com/docs/reference/core-tag#let) variable cannot be destructured."
9538
+ );
9502
9539
  }
9503
9540
  if (valueChangeAttr && (0, import_babel_utils38.computeNode)(valueChangeAttr.value)) {
9504
9541
  throw tag.get("attributes").find((attr2) => attr2.node === valueChangeAttr).get("value").buildCodeFrameError(
9505
- "The `let` tag `valueChange` attribute must be a function."
9542
+ "The [`<let>` tag](https://next.markojs.com/docs/reference/core-tag#let) [`valueChange=` attribute](https://next.markojs.com/docs/reference/core-tag#controllable-let) must be a function."
9506
9543
  );
9507
9544
  }
9508
9545
  const tagSection = getOrCreateSection(tag);
@@ -9566,7 +9603,7 @@ var let_default = {
9566
9603
  autocomplete: [
9567
9604
  {
9568
9605
  description: "Use to create a mutable binding.",
9569
- descriptionMoreURL: "https://markojs.com/docs/core-tags/#let"
9606
+ descriptionMoreURL: "https://next.markojs.com/docs/reference/core-tag#let"
9570
9607
  }
9571
9608
  ],
9572
9609
  types: runtime_info_default.name + "/tags/let.d.marko"
@@ -9597,13 +9634,13 @@ var lifecycle_default = {
9597
9634
  binding.downstreamExpressions.add(tagExtra);
9598
9635
  if (node.attributes.length === 0) {
9599
9636
  throw tag.get("name").buildCodeFrameError(
9600
- "The `lifecycle` tag requires at least one attribute."
9637
+ "The [`<lifecycle>` tag](https://next.markojs.com/docs/reference/core-tag#lifecycle) requires at least one attribute."
9601
9638
  );
9602
9639
  }
9603
9640
  for (const attr2 of node.attributes) {
9604
9641
  if (import_compiler45.types.isMarkoSpreadAttribute(attr2)) {
9605
9642
  throw tag.get("name").buildCodeFrameError(
9606
- "The `lifecycle` tag does not support `...spread` attributes."
9643
+ "The [`<lifecycle>` tag](https://next.markojs.com/docs/reference/core-tag#lifecycle) does not support [`...spread` attributes](https://next.markojs.com/docs/reference/language#spread-attributes)."
9607
9644
  );
9608
9645
  }
9609
9646
  (attr2.value.extra ??= {}).isEffect = true;
@@ -9648,7 +9685,7 @@ var lifecycle_default = {
9648
9685
  autocomplete: [
9649
9686
  {
9650
9687
  description: "Use to create a side effects.",
9651
- descriptionMoreURL: "https://markojs.com/docs/core-tags/#effect"
9688
+ descriptionMoreURL: "https://next.markojs.com/docs/reference/core-tag#lifecycle"
9652
9689
  }
9653
9690
  ],
9654
9691
  types: runtime_info_default.name + "/tags/lifecycle.d.marko"
@@ -9665,11 +9702,13 @@ var log_default = {
9665
9702
  (0, import_babel_utils40.assertNoParams)(tag);
9666
9703
  assertNoBodyContent(tag);
9667
9704
  if (!valueAttr) {
9668
- throw tag.get("name").buildCodeFrameError("The `log` tag requires a value.");
9705
+ throw tag.get("name").buildCodeFrameError(
9706
+ "The [`<log>` tag](https://next.markojs.com/docs/reference/core-tag#log) requires a [`value=` attribute](https://next.markojs.com/docs/reference/language#shorthand-value)."
9707
+ );
9669
9708
  }
9670
9709
  if (tag.node.attributes.length > 1 || !import_compiler46.types.isMarkoAttribute(valueAttr) || !valueAttr.default && valueAttr.name !== "value") {
9671
9710
  throw tag.get("name").buildCodeFrameError(
9672
- "The `log` tag only supports the `value` attribute."
9711
+ "The [`<log>` tag](https://next.markojs.com/docs/reference/core-tag#log) only supports the [`value=` attribute](https://next.markojs.com/docs/reference/language#shorthand-value)."
9673
9712
  );
9674
9713
  }
9675
9714
  },
@@ -9700,7 +9739,7 @@ var log_default = {
9700
9739
  autocomplete: [
9701
9740
  {
9702
9741
  description: "Use to log a value to the console.",
9703
- descriptionMoreURL: "https://markojs.com/docs/core-tags/#log"
9742
+ descriptionMoreURL: "https://next.markojs.com/docs/reference/core-tag#log"
9704
9743
  }
9705
9744
  ],
9706
9745
  types: runtime_info_default.name + "/tags/log.d.marko"
@@ -9709,7 +9748,7 @@ var log_default = {
9709
9748
  // src/translator/core/script.ts
9710
9749
  var import_compiler47 = require("@marko/compiler");
9711
9750
  var import_babel_utils41 = require("@marko/compiler/babel-utils");
9712
- var htmlScriptTagAlternateMsg = " For a native html `script` tag use the `html-script` core tag instead.";
9751
+ var htmlScriptTagAlternateMsg = " For a native html [`<script>` tag](https://next.markojs.com/docs/reference/core-tag#script) use the `html-script` core tag instead.";
9713
9752
  var script_default = {
9714
9753
  parse(tag) {
9715
9754
  const { node } = tag;
@@ -9720,7 +9759,7 @@ var script_default = {
9720
9759
  if (child.type !== "MarkoText") {
9721
9760
  throw tag.hub.file.hub.buildError(
9722
9761
  child,
9723
- "Unexpected content in `script` tag. Only javascript and typescript is supported." + htmlScriptTagAlternateMsg,
9762
+ "Unexpected content in [`<script>` tag](https://next.markojs.com/docs/reference/core-tag#script). Only javascript and typescript is supported." + htmlScriptTagAlternateMsg,
9724
9763
  SyntaxError
9725
9764
  );
9726
9765
  }
@@ -9747,7 +9786,7 @@ var script_default = {
9747
9786
  if (node.var) {
9748
9787
  throw tag.hub.buildError(
9749
9788
  node.var,
9750
- "The `script` tag does not support a tag variable reference." + htmlScriptTagAlternateMsg
9789
+ "The [`<script>` tag](https://next.markojs.com/docs/reference/core-tag#script) does not support a tag variable reference." + htmlScriptTagAlternateMsg
9751
9790
  );
9752
9791
  }
9753
9792
  let seenValueAttr = false;
@@ -9762,7 +9801,7 @@ var script_default = {
9762
9801
  } else {
9763
9802
  throw tag.hub.buildError(
9764
9803
  attr2,
9765
- "The `script` tag does not support html attributes." + htmlScriptTagAlternateMsg
9804
+ "The [`<script>` tag](https://next.markojs.com/docs/reference/core-tag#script) does not support html attributes." + htmlScriptTagAlternateMsg
9766
9805
  );
9767
9806
  }
9768
9807
  }
@@ -9912,7 +9951,7 @@ var import_babel_utils44 = require("@marko/compiler/babel-utils");
9912
9951
  var import_magic_string = __toESM(require("magic-string"));
9913
9952
  var import_path3 = __toESM(require("path"));
9914
9953
  var STYLE_EXT_REG = /^style((?:\.[a-zA-Z0-9$_-]+)+)?/;
9915
- var htmlStyleTagAlternateMsg = " For a native html `style` tag use the `html-style` core tag instead.";
9954
+ var htmlStyleTagAlternateMsg = " For a native html [`<style>` tag](https://next.markojs.com/docs/reference/core-tag#style) use the `html-style` core tag instead.";
9916
9955
  var style_default = {
9917
9956
  analyze(tag) {
9918
9957
  (0, import_babel_utils44.assertNoArgs)(tag);
@@ -9933,14 +9972,14 @@ var style_default = {
9933
9972
  if (child.type !== "MarkoText") {
9934
9973
  throw tag.hub.buildError(
9935
9974
  child,
9936
- "The `style` tag currently only supports static content." + htmlStyleTagAlternateMsg
9975
+ "The [`<style>` tag](https://next.markojs.com/docs/reference/core-tag#style) currently only supports static content." + htmlStyleTagAlternateMsg
9937
9976
  );
9938
9977
  }
9939
9978
  }
9940
9979
  if (node.body.body.length > 1) {
9941
9980
  throw tag.hub.buildError(
9942
9981
  node.name,
9943
- "The `style` tag currently only supports static content." + htmlStyleTagAlternateMsg
9982
+ "The [`<style>` tag](https://next.markojs.com/docs/reference/core-tag#style) currently only supports static content." + htmlStyleTagAlternateMsg
9944
9983
  );
9945
9984
  }
9946
9985
  },
@@ -10035,7 +10074,9 @@ var try_default = {
10035
10074
  );
10036
10075
  tagExtra[kDOMBinding2] = createBinding("#text", 0 /* dom */, section);
10037
10076
  if (!tag.node.body.body.length) {
10038
- throw tag.get("name").buildCodeFrameError("The `try` tag requires body content.");
10077
+ throw tag.get("name").buildCodeFrameError(
10078
+ "The [`<try>` tag](https://next.markojs.com/docs/reference/core-tag#try) requires [body content](https://next.markojs.com/docs/reference/language#tag-content)."
10079
+ );
10039
10080
  }
10040
10081
  startSection(tag.get("body"));
10041
10082
  },
@@ -10141,7 +10182,7 @@ var try_default = {
10141
10182
  autocomplete: [
10142
10183
  {
10143
10184
  description: "Used to capture errors and display placeholders for nested content.",
10144
- descriptionMoreURL: "https://markojs.com/docs/core-tags/#try"
10185
+ descriptionMoreURL: "https://next.markojs.com/docs/reference/core-tag#try"
10145
10186
  }
10146
10187
  ],
10147
10188
  types: runtime_info_default.name + "/tags/try.d.marko"
@@ -10588,7 +10629,9 @@ var attribute_tag_default = {
10588
10629
  startSection(body);
10589
10630
  trackParamsReferences(body, 3 /* param */);
10590
10631
  if (!(0, import_babel_utils48.findParentTag)(tag)) {
10591
- throw tag.get("name").buildCodeFrameError("@tags must be nested within another tag.");
10632
+ throw tag.get("name").buildCodeFrameError(
10633
+ "[Attribute tags](https://next.markojs.com/docs/reference/language#attribute-tags) must be nested within another tag."
10634
+ );
10592
10635
  }
10593
10636
  }
10594
10637
  },
@@ -10626,11 +10669,11 @@ var custom_tag_default = {
10626
10669
  const tagName = getTagName(tag);
10627
10670
  if (tagName && tag.scope.hasBinding(tagName)) {
10628
10671
  throw tag.get("name").buildCodeFrameError(
10629
- `Local variables must be in a dynamic tag unless they are PascalCase. Use \`<\${${tagName}}/>\` or rename to \`${tagName.charAt(0).toUpperCase() + tagName.slice(1)}\`.`
10672
+ `Local variables must be in a [dynamic tag](https://next.markojs.com/docs/reference/language#dynamic-tags) unless they are PascalCase. Use \`<\${${tagName}}/>\` or rename to \`${tagName.charAt(0).toUpperCase() + tagName.slice(1)}\`.`
10630
10673
  );
10631
10674
  }
10632
10675
  throw tag.get("name").buildCodeFrameError(
10633
- `Unable to find entry point for custom tag \`<${tagName}>\`.`
10676
+ `Unable to find entry point for [custom tag](https://next.markojs.com/docs/reference/custom-tag#relative-custom-tags) \`<${tagName}>\`.`
10634
10677
  );
10635
10678
  }
10636
10679
  const section = getOrCreateSection(tag);
@@ -10969,11 +11012,11 @@ function getTagRelativePath(tag) {
10969
11012
  const tagName = getTagName(tag);
10970
11013
  if (tagName && tag.scope.hasBinding(tagName)) {
10971
11014
  throw tag.get("name").buildCodeFrameError(
10972
- `Local variables must be in a dynamic tag unless they are PascalCase. Use \`<\${${tagName}}/>\` or rename to \`${tagName.charAt(0).toUpperCase() + tagName.slice(1)}\`.`
11015
+ `Local variables must be in a [dynamic tag](https://next.markojs.com/docs/reference/language#dynamic-tags) unless they are PascalCase. Use \`<\${${tagName}}/>\` or rename to \`${tagName.charAt(0).toUpperCase() + tagName.slice(1)}\`.`
10973
11016
  );
10974
11017
  }
10975
11018
  throw tag.get("name").buildCodeFrameError(
10976
- `Unable to find entry point for custom tag \`<${tagName}>\`.`
11019
+ `Unable to find entry point for [custom tag](https://next.markojs.com/docs/reference/custom-tag#relative-custom-tags) \`<${tagName}>\`.`
10977
11020
  );
10978
11021
  }
10979
11022
  return relativePath;
@@ -11854,9 +11897,16 @@ function getChangeHandler(tag, attr2) {
11854
11897
  );
11855
11898
  const existingChangedAttr = BINDING_CHANGE_HANDLER.get(binding.identifier);
11856
11899
  if (!existingChangedAttr) {
11900
+ const bindingIdentifierPath = binding.path.getOuterBindingIdentifierPaths()[binding.identifier.name];
11901
+ const changeAttrExpr = bindingIdentifierPath ? bindingIdentifierPath.parentPath === binding.path ? buildChangeHandlerFunction(attr2.value) : bindingIdentifierPath.parentPath.isObjectProperty() ? getChangeHandlerFromObjectPattern(
11902
+ bindingIdentifierPath.parentPath
11903
+ ) : void 0 : void 0;
11904
+ if (!changeAttrExpr) {
11905
+ throw tag.hub.buildError(attr2.value, "Unable to bind to value.");
11906
+ }
11857
11907
  const changeHandlerAttr = import_compiler58.types.markoAttribute(
11858
11908
  changeAttrName,
11859
- buildChangeHandlerFunction(attr2.value)
11909
+ changeAttrExpr
11860
11910
  );
11861
11911
  BINDING_CHANGE_HANDLER.set(binding.identifier, changeHandlerAttr);
11862
11912
  return changeHandlerAttr;
@@ -11932,6 +11982,51 @@ function buildChangeHandlerFunction(id) {
11932
11982
  ])
11933
11983
  );
11934
11984
  }
11985
+ function getChangeHandlerFromObjectPattern(parent) {
11986
+ let changeKey;
11987
+ const pattern = parent.parentPath;
11988
+ if (parent.node.computed) {
11989
+ changeKey = generateUidIdentifier(`dynamicChange`);
11990
+ pattern.pushContainer(
11991
+ "properties",
11992
+ import_compiler58.types.objectProperty(
11993
+ import_compiler58.types.binaryExpression(
11994
+ "+",
11995
+ parent.get("key").node,
11996
+ import_compiler58.types.stringLiteral("Change")
11997
+ ),
11998
+ changeKey,
11999
+ true
12000
+ )
12001
+ );
12002
+ } else {
12003
+ const key = parent.get("key");
12004
+ const searchKey = `${getStringOrIdentifierValue(key)}Change`;
12005
+ for (const prop of pattern.get("properties")) {
12006
+ if (prop.isObjectProperty()) {
12007
+ const propKey = prop.get("key");
12008
+ const propValue = prop.get("value");
12009
+ if (!prop.node.computed && getStringOrIdentifierValue(propKey) === searchKey && propValue.isIdentifier()) {
12010
+ changeKey = propValue.node;
12011
+ break;
12012
+ }
12013
+ }
12014
+ }
12015
+ if (!changeKey) {
12016
+ pattern.unshiftContainer(
12017
+ "properties",
12018
+ import_compiler58.types.objectProperty(
12019
+ import_compiler58.types.stringLiteral(searchKey),
12020
+ changeKey = generateUidIdentifier(searchKey)
12021
+ )
12022
+ );
12023
+ }
12024
+ }
12025
+ return changeKey;
12026
+ }
12027
+ function getStringOrIdentifierValue(path5) {
12028
+ return path5.isStringLiteral() ? path5.node.value : path5.node.name;
12029
+ }
11935
12030
 
11936
12031
  // src/translator/visitors/text.ts
11937
12032
  var import_compiler59 = require("@marko/compiler");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.0.57",
3
+ "version": "6.0.58",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",