@marko/runtime-tags 6.0.111 → 6.0.113

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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <div align="center">
2
2
 
3
- # [<img alt="Marko" src="https://raw.githubusercontent.com/marko-js/website-next/refs/heads/main/public/logo.svg" width="250">](https://markojs.com/)
3
+ # [<img alt="Marko" src="https://raw.githubusercontent.com/marko-js/website/refs/heads/main/public/assets/logo.svg" width="250">](https://markojs.com/)
4
4
 
5
5
  **A declarative, HTML-based language that makes building web apps fun 🔥**
6
6
 
package/dist/debug/dom.js CHANGED
@@ -511,6 +511,7 @@ function getDebugKey(index, node) {
511
511
  // src/dom/resume.ts
512
512
  var registeredValues = {};
513
513
  var branchesEnabled;
514
+ var isInit;
514
515
  function enableBranches() {
515
516
  branchesEnabled = 1;
516
517
  }
@@ -620,7 +621,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
620
621
  );
621
622
  render.w = (effects = []) => {
622
623
  try {
623
- walk2();
624
+ isInit || walk2();
624
625
  isResuming = 1;
625
626
  for (const serialized of resumes = render.r || []) {
626
627
  if (typeof serialized === "string") {
@@ -667,7 +668,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
667
668
  }
668
669
  runEffects(effects);
669
670
  } finally {
670
- isResuming = visits.length = resumes.length = 0;
671
+ isInit = isResuming = visits.length = resumes.length = 0;
671
672
  }
672
673
  };
673
674
  return render;
@@ -677,6 +678,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
677
678
  if (renders) {
678
679
  initRuntime(renders);
679
680
  for (const renderId in renders) {
681
+ isInit = 1;
680
682
  resumeRender(renderId).w();
681
683
  }
682
684
  } else {
@@ -408,6 +408,7 @@ function getDebugKey(index, node) {
408
408
  // src/dom/resume.ts
409
409
  var registeredValues = {};
410
410
  var branchesEnabled;
411
+ var isInit;
411
412
  function enableBranches() {
412
413
  branchesEnabled = 1;
413
414
  }
@@ -517,7 +518,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
517
518
  );
518
519
  render.w = (effects = []) => {
519
520
  try {
520
- walk2();
521
+ isInit || walk2();
521
522
  isResuming = 1;
522
523
  for (const serialized of resumes = render.r || []) {
523
524
  if (typeof serialized === "string") {
@@ -564,7 +565,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
564
565
  }
565
566
  runEffects(effects);
566
567
  } finally {
567
- isResuming = visits.length = resumes.length = 0;
568
+ isInit = isResuming = visits.length = resumes.length = 0;
568
569
  }
569
570
  };
570
571
  return render;
@@ -574,6 +575,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
574
575
  if (renders) {
575
576
  initRuntime(renders);
576
577
  for (const renderId in renders) {
578
+ isInit = 1;
577
579
  resumeRender(renderId).w();
578
580
  }
579
581
  } else {
@@ -30,6 +30,7 @@ __export(html_exports, {
30
30
  _attr_input_checked: () => _attr_input_checked,
31
31
  _attr_input_checkedValue: () => _attr_input_checkedValue,
32
32
  _attr_input_value: () => _attr_input_value,
33
+ _attr_nonce: () => _attr_nonce,
33
34
  _attr_option_value: () => _attr_option_value,
34
35
  _attr_select_value: () => _attr_select_value,
35
36
  _attr_style: () => _attr_style,
@@ -2929,6 +2930,9 @@ function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange) {
2929
2930
  }
2930
2931
  return _attr("open", open);
2931
2932
  }
2933
+ function _attr_nonce() {
2934
+ return getChunk().boundary.state.nonceAttr;
2935
+ }
2932
2936
  function _attr(name, value) {
2933
2937
  return isVoid(value) ? "" : nonVoidAttr(name, value);
2934
2938
  }
@@ -3620,6 +3624,7 @@ function NOOP3() {
3620
3624
  _attr_input_checked,
3621
3625
  _attr_input_checkedValue,
3622
3626
  _attr_input_value,
3627
+ _attr_nonce,
3623
3628
  _attr_option_value,
3624
3629
  _attr_select_value,
3625
3630
  _attr_style,
@@ -2837,6 +2837,9 @@ function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange) {
2837
2837
  }
2838
2838
  return _attr("open", open);
2839
2839
  }
2840
+ function _attr_nonce() {
2841
+ return getChunk().boundary.state.nonceAttr;
2842
+ }
2840
2843
  function _attr(name, value) {
2841
2844
  return isVoid(value) ? "" : nonVoidAttr(name, value);
2842
2845
  }
@@ -3527,6 +3530,7 @@ export {
3527
3530
  _attr_input_checked,
3528
3531
  _attr_input_checkedValue,
3529
3532
  _attr_input_value,
3533
+ _attr_nonce,
3530
3534
  _attr_option_value,
3531
3535
  _attr_select_value,
3532
3536
  _attr_style,
package/dist/dom.js CHANGED
@@ -332,7 +332,7 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
332
332
  }
333
333
 
334
334
  // src/dom/resume.ts
335
- var registeredValues = {}, branchesEnabled;
335
+ var registeredValues = {}, branchesEnabled, isInit;
336
336
  function enableBranches() {
337
337
  branchesEnabled = 1;
338
338
  }
@@ -377,7 +377,7 @@ function init(runtimeId = "M") {
377
377
  );
378
378
  return render.w = (effects = []) => {
379
379
  try {
380
- walk2(), isResuming = 1;
380
+ isInit || walk2(), isResuming = 1;
381
381
  for (let serialized of resumes = render.r || [])
382
382
  if (typeof serialized == "string")
383
383
  lastEffect = serialized;
@@ -399,7 +399,7 @@ function init(runtimeId = "M") {
399
399
  }, visitType === "*" /* Node */ ? visitScope["J" /* Getter */ + nextToken()] = /* @__PURE__ */ ((node) => () => node)(visitScope[lastToken] = visit.previousSibling) : branchesEnabled && visitBranches();
400
400
  runEffects(effects);
401
401
  } finally {
402
- isResuming = visits.length = resumes.length = 0;
402
+ isInit = isResuming = visits.length = resumes.length = 0;
403
403
  }
404
404
  }, render;
405
405
  })
@@ -408,7 +408,7 @@ function init(runtimeId = "M") {
408
408
  if (renders) {
409
409
  initRuntime(renders);
410
410
  for (let renderId in renders)
411
- resumeRender(renderId).w();
411
+ isInit = 1, resumeRender(renderId).w();
412
412
  } else
413
413
  defineRuntime({
414
414
  configurable: !0,
package/dist/dom.mjs CHANGED
@@ -232,7 +232,7 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
232
232
  }
233
233
 
234
234
  // src/dom/resume.ts
235
- var registeredValues = {}, branchesEnabled;
235
+ var registeredValues = {}, branchesEnabled, isInit;
236
236
  function enableBranches() {
237
237
  branchesEnabled = 1;
238
238
  }
@@ -277,7 +277,7 @@ function init(runtimeId = "M") {
277
277
  );
278
278
  return render.w = (effects = []) => {
279
279
  try {
280
- walk2(), isResuming = 1;
280
+ isInit || walk2(), isResuming = 1;
281
281
  for (let serialized of resumes = render.r || [])
282
282
  if (typeof serialized == "string")
283
283
  lastEffect = serialized;
@@ -299,7 +299,7 @@ function init(runtimeId = "M") {
299
299
  }, visitType === "*" /* Node */ ? visitScope["J" /* Getter */ + nextToken()] = /* @__PURE__ */ ((node) => () => node)(visitScope[lastToken] = visit.previousSibling) : branchesEnabled && visitBranches();
300
300
  runEffects(effects);
301
301
  } finally {
302
- isResuming = visits.length = resumes.length = 0;
302
+ isInit = isResuming = visits.length = resumes.length = 0;
303
303
  }
304
304
  }, render;
305
305
  })
@@ -308,7 +308,7 @@ function init(runtimeId = "M") {
308
308
  if (renders) {
309
309
  initRuntime(renders);
310
310
  for (let renderId in renders)
311
- resumeRender(renderId).w();
311
+ isInit = 1, resumeRender(renderId).w();
312
312
  } else
313
313
  defineRuntime({
314
314
  configurable: !0,
@@ -8,6 +8,7 @@ export declare function _attr_input_value(scopeId: number, nodeAccessor: Accesso
8
8
  export declare function _attr_input_checked(scopeId: number, nodeAccessor: Accessor, checked: unknown, checkedChange: unknown): string;
9
9
  export declare function _attr_input_checkedValue(scopeId: number, nodeAccessor: Accessor, checkedValue: unknown, checkedValueChange: unknown, value: unknown): string;
10
10
  export declare function _attr_details_or_dialog_open(scopeId: number, nodeAccessor: Accessor, open: unknown, openChange: unknown): string;
11
+ export declare function _attr_nonce(): string;
11
12
  export declare function _attr(name: string, value: unknown): string;
12
13
  export declare function _attrs(data: Record<string, unknown>, nodeAccessor: Accessor, scopeId: number, tagName: string): string;
13
14
  export declare function _attrs_content(data: Record<string, unknown>, nodeAccessor: Accessor, scopeId: number, tagName: string, serializeReason?: 1 | 0): void;
package/dist/html.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { attrTag, attrTags } from "./common/attr-tag";
2
2
  export { _assert_hoist, _el_read_error, _hoist_read_error, } from "./common/errors";
3
- export { _attr, _attr_class, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_option_value, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, } from "./html/attrs";
3
+ export { _attr, _attr_class, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_option_value, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, } from "./html/attrs";
4
4
  export { compat } from "./html/compat";
5
5
  export { _escape, _escape_script, _escape_style, _escape_textarea_value, _unescaped, } from "./html/content";
6
6
  export { _content, _content_resume, _dynamic_tag } from "./html/dynamic-tag";
package/dist/html.js CHANGED
@@ -27,6 +27,7 @@ __export(html_exports, {
27
27
  _attr_input_checked: () => _attr_input_checked,
28
28
  _attr_input_checkedValue: () => _attr_input_checkedValue,
29
29
  _attr_input_value: () => _attr_input_value,
30
+ _attr_nonce: () => _attr_nonce,
30
31
  _attr_option_value: () => _attr_option_value,
31
32
  _attr_select_value: () => _attr_select_value,
32
33
  _attr_style: () => _attr_style,
@@ -1820,6 +1821,9 @@ function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange) {
1820
1821
  openChange
1821
1822
  ), _attr("open", open);
1822
1823
  }
1824
+ function _attr_nonce() {
1825
+ return getChunk().boundary.state.nonceAttr;
1826
+ }
1823
1827
  function _attr(name, value) {
1824
1828
  return isVoid(value) ? "" : nonVoidAttr(name, value);
1825
1829
  }
@@ -2301,6 +2305,7 @@ function NOOP3() {
2301
2305
  _attr_input_checked,
2302
2306
  _attr_input_checkedValue,
2303
2307
  _attr_input_value,
2308
+ _attr_nonce,
2304
2309
  _attr_option_value,
2305
2310
  _attr_select_value,
2306
2311
  _attr_style,
package/dist/html.mjs CHANGED
@@ -1731,6 +1731,9 @@ function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange) {
1731
1731
  openChange
1732
1732
  ), _attr("open", open);
1733
1733
  }
1734
+ function _attr_nonce() {
1735
+ return getChunk().boundary.state.nonceAttr;
1736
+ }
1734
1737
  function _attr(name, value) {
1735
1738
  return isVoid(value) ? "" : nonVoidAttr(name, value);
1736
1739
  }
@@ -2211,6 +2214,7 @@ export {
2211
2214
  _attr_input_checked,
2212
2215
  _attr_input_checkedValue,
2213
2216
  _attr_input_value,
2217
+ _attr_nonce,
2214
2218
  _attr_option_value,
2215
2219
  _attr_select_value,
2216
2220
  _attr_style,
@@ -9832,8 +9832,11 @@ var html_script_default = {
9832
9832
  visit(tag, 32 /* Get */);
9833
9833
  }
9834
9834
  write`<script`;
9835
- const usedAttrs = getUsedAttrs2(tag.node);
9836
- const { staticAttrs, skipExpression, spreadExpression } = usedAttrs;
9835
+ const usedAttrs = getUsedAttrs2(tag.node, isHTML);
9836
+ const { hasNonce, staticAttrs, skipExpression, spreadExpression } = usedAttrs;
9837
+ if (isHTML && !hasNonce && !spreadExpression) {
9838
+ write`${callRuntime("_attr_nonce")}`;
9839
+ }
9837
9840
  for (const attr of staticAttrs) {
9838
9841
  const { name: name2, value } = attr;
9839
9842
  const { confident, computed } = value.extra || {};
@@ -10022,7 +10025,7 @@ var html_script_default = {
10022
10025
  }
10023
10026
  ]
10024
10027
  };
10025
- function getUsedAttrs2(tag) {
10028
+ function getUsedAttrs2(tag, injectNonce) {
10026
10029
  const seen = {};
10027
10030
  const { attributes } = tag;
10028
10031
  const maybeStaticAttrs = /* @__PURE__ */ new Set();
@@ -10030,6 +10033,7 @@ function getUsedAttrs2(tag) {
10030
10033
  let skipExpression;
10031
10034
  let spreadProps;
10032
10035
  let skipProps;
10036
+ let hasNonce = false;
10033
10037
  for (let i = attributes.length; i--; ) {
10034
10038
  const attr = attributes[i];
10035
10039
  const { value } = attr;
@@ -10040,6 +10044,9 @@ function getUsedAttrs2(tag) {
10040
10044
  spreadProps.push(import_compiler44.types.spreadElement(value));
10041
10045
  } else if (!seen[attr.name]) {
10042
10046
  seen[attr.name] = attr;
10047
+ if (attr.name === "nonce") {
10048
+ hasNonce = true;
10049
+ }
10043
10050
  if (spreadProps) {
10044
10051
  spreadProps.push(toObjectProperty(attr.name, attr.value));
10045
10052
  } else {
@@ -10056,9 +10063,18 @@ function getUsedAttrs2(tag) {
10056
10063
  if (skipProps) {
10057
10064
  skipExpression = import_compiler44.types.objectExpression(skipProps);
10058
10065
  }
10066
+ if (injectNonce && !hasNonce) {
10067
+ spreadProps.unshift(
10068
+ import_compiler44.types.objectProperty(
10069
+ import_compiler44.types.identifier("nonce"),
10070
+ import_compiler44.types.memberExpression(callRuntime("$global"), import_compiler44.types.identifier("cspNonce"))
10071
+ )
10072
+ );
10073
+ }
10059
10074
  spreadExpression = propsToExpression(spreadProps);
10060
10075
  }
10061
10076
  return {
10077
+ hasNonce,
10062
10078
  staticAttrs,
10063
10079
  spreadExpression,
10064
10080
  skipExpression
@@ -10173,8 +10189,11 @@ var html_style_default = {
10173
10189
  visit(tag, 32 /* Get */);
10174
10190
  }
10175
10191
  write`<style`;
10176
- const usedAttrs = getUsedAttrs3(tag.node);
10177
- const { staticAttrs, skipExpression, spreadExpression } = usedAttrs;
10192
+ const usedAttrs = getUsedAttrs3(tag.node, isHTML);
10193
+ const { hasNonce, staticAttrs, skipExpression, spreadExpression } = usedAttrs;
10194
+ if (isHTML && !hasNonce && !spreadExpression) {
10195
+ write`${callRuntime("_attr_nonce")}`;
10196
+ }
10178
10197
  for (const attr of staticAttrs) {
10179
10198
  const { name: name2, value } = attr;
10180
10199
  const { confident, computed } = value.extra || {};
@@ -10358,7 +10377,7 @@ var html_style_default = {
10358
10377
  }
10359
10378
  ]
10360
10379
  };
10361
- function getUsedAttrs3(tag) {
10380
+ function getUsedAttrs3(tag, injectNonce) {
10362
10381
  const seen = {};
10363
10382
  const { attributes } = tag;
10364
10383
  const maybeStaticAttrs = /* @__PURE__ */ new Set();
@@ -10366,6 +10385,7 @@ function getUsedAttrs3(tag) {
10366
10385
  let skipExpression;
10367
10386
  let spreadProps;
10368
10387
  let skipProps;
10388
+ let hasNonce = false;
10369
10389
  for (let i = attributes.length; i--; ) {
10370
10390
  const attr = attributes[i];
10371
10391
  const { value } = attr;
@@ -10376,6 +10396,9 @@ function getUsedAttrs3(tag) {
10376
10396
  spreadProps.push(import_compiler45.types.spreadElement(value));
10377
10397
  } else if (!seen[attr.name]) {
10378
10398
  seen[attr.name] = attr;
10399
+ if (attr.name === "nonce") {
10400
+ hasNonce = true;
10401
+ }
10379
10402
  if (spreadProps) {
10380
10403
  spreadProps.push(toObjectProperty(attr.name, attr.value));
10381
10404
  } else {
@@ -10392,9 +10415,18 @@ function getUsedAttrs3(tag) {
10392
10415
  if (skipProps) {
10393
10416
  skipExpression = import_compiler45.types.objectExpression(skipProps);
10394
10417
  }
10418
+ if (injectNonce && !hasNonce) {
10419
+ spreadProps.unshift(
10420
+ import_compiler45.types.objectProperty(
10421
+ import_compiler45.types.identifier("nonce"),
10422
+ import_compiler45.types.memberExpression(callRuntime("$global"), import_compiler45.types.identifier("cspNonce"))
10423
+ )
10424
+ );
10425
+ }
10395
10426
  spreadExpression = propsToExpression(spreadProps);
10396
10427
  }
10397
10428
  return {
10429
+ hasNonce,
10398
10430
  staticAttrs,
10399
10431
  spreadExpression,
10400
10432
  skipExpression
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/runtime-tags",
3
- "version": "6.0.111",
3
+ "version": "6.0.113",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",