marko 6.0.163 → 6.0.164

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.
@@ -47,6 +47,7 @@ __export(html_exports, {
47
47
  _el_read_error: () => _el_read_error,
48
48
  _el_resume: () => _el_resume,
49
49
  _escape: () => _escape,
50
+ _escape_comment: () => _escape_comment,
50
51
  _escape_script: () => _escape_script,
51
52
  _escape_style: () => _escape_style,
52
53
  _existing_scope: () => _existing_scope,
@@ -256,16 +257,21 @@ var escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, r
256
257
  function _escape(val) {
257
258
  return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
258
259
  }
259
- var unsafeScriptReg = /<\/script/g;
260
+ var unsafeScriptReg = /<\/script/gi;
260
261
  var escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
261
262
  function _escape_script(val) {
262
263
  return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
263
264
  }
264
- var unsafeStyleReg = /<\/style/g;
265
+ var unsafeStyleReg = /<\/style/gi;
265
266
  var escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str;
266
267
  function _escape_style(val) {
267
268
  return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
268
269
  }
270
+ var unsafeCommentReg = />/g;
271
+ var escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, "&gt;") : str;
272
+ function _escape_comment(val) {
273
+ return val ? escapeCommentStr(val + "") : val === 0 ? "0" : "";
274
+ }
269
275
 
270
276
  // src/common/for.ts
271
277
  function forIn(obj, cb) {
@@ -3764,6 +3770,7 @@ function NOOP3() {
3764
3770
  _el_read_error,
3765
3771
  _el_resume,
3766
3772
  _escape,
3773
+ _escape_comment,
3767
3774
  _escape_script,
3768
3775
  _escape_style,
3769
3776
  _existing_scope,
@@ -164,16 +164,21 @@ var escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, r
164
164
  function _escape(val) {
165
165
  return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
166
166
  }
167
- var unsafeScriptReg = /<\/script/g;
167
+ var unsafeScriptReg = /<\/script/gi;
168
168
  var escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
169
169
  function _escape_script(val) {
170
170
  return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
171
171
  }
172
- var unsafeStyleReg = /<\/style/g;
172
+ var unsafeStyleReg = /<\/style/gi;
173
173
  var escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str;
174
174
  function _escape_style(val) {
175
175
  return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
176
176
  }
177
+ var unsafeCommentReg = />/g;
178
+ var escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, "&gt;") : str;
179
+ function _escape_comment(val) {
180
+ return val ? escapeCommentStr(val + "") : val === 0 ? "0" : "";
181
+ }
177
182
 
178
183
  // src/common/for.ts
179
184
  function forIn(obj, cb) {
@@ -3671,6 +3676,7 @@ export {
3671
3676
  _el_read_error,
3672
3677
  _el_resume,
3673
3678
  _escape,
3679
+ _escape_comment,
3674
3680
  _escape_script,
3675
3681
  _escape_style,
3676
3682
  _existing_scope,
@@ -2,3 +2,4 @@ export declare function _unescaped(val: unknown): string;
2
2
  export declare function _escape(val: unknown): string;
3
3
  export declare function _escape_script(val: unknown): string;
4
4
  export declare function _escape_style(val: unknown): string;
5
+ export declare function _escape_comment(val: unknown): string;
package/dist/html.d.ts CHANGED
@@ -2,7 +2,7 @@ export { attrTag, attrTags } from "./common/attr-tag";
2
2
  export { _assert_hoist, _el_read_error, _hoist_read_error, } from "./common/errors";
3
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
- export { _escape, _escape_script, _escape_style, _unescaped, } from "./html/content";
5
+ export { _escape, _escape_comment, _escape_script, _escape_style, _unescaped, } from "./html/content";
6
6
  export { _content, _content_resume, _dynamic_tag } from "./html/dynamic-tag";
7
7
  export { forIn, forInBy, forOf, forOfBy, forStepBy, forTo, forUntil, } from "./html/for";
8
8
  export { _template } from "./html/template";
package/dist/html.js CHANGED
@@ -44,6 +44,7 @@ __export(html_exports, {
44
44
  _el_read_error: () => _el_read_error,
45
45
  _el_resume: () => _el_resume,
46
46
  _escape: () => _escape,
47
+ _escape_comment: () => _escape_comment,
47
48
  _escape_script: () => _escape_script,
48
49
  _escape_style: () => _escape_style,
49
50
  _existing_scope: () => _existing_scope,
@@ -159,14 +160,18 @@ var unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&amp;" : "&lt
159
160
  function _escape(val) {
160
161
  return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
161
162
  }
162
- var unsafeScriptReg = /<\/script/g, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
163
+ var unsafeScriptReg = /<\/script/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
163
164
  function _escape_script(val) {
164
165
  return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
165
166
  }
166
- var unsafeStyleReg = /<\/style/g, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str;
167
+ var unsafeStyleReg = /<\/style/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str;
167
168
  function _escape_style(val) {
168
169
  return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
169
170
  }
171
+ var unsafeCommentReg = />/g, escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, "&gt;") : str;
172
+ function _escape_comment(val) {
173
+ return val ? escapeCommentStr(val + "") : val === 0 ? "0" : "";
174
+ }
170
175
 
171
176
  // src/common/for.ts
172
177
  function forIn(obj, cb) {
@@ -2394,6 +2399,7 @@ function NOOP3() {
2394
2399
  _el_read_error,
2395
2400
  _el_resume,
2396
2401
  _escape,
2402
+ _escape_comment,
2397
2403
  _escape_script,
2398
2404
  _escape_style,
2399
2405
  _existing_scope,
package/dist/html.mjs CHANGED
@@ -70,14 +70,18 @@ var unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&amp;" : "&lt
70
70
  function _escape(val) {
71
71
  return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
72
72
  }
73
- var unsafeScriptReg = /<\/script/g, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
73
+ var unsafeScriptReg = /<\/script/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
74
74
  function _escape_script(val) {
75
75
  return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
76
76
  }
77
- var unsafeStyleReg = /<\/style/g, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str;
77
+ var unsafeStyleReg = /<\/style/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str;
78
78
  function _escape_style(val) {
79
79
  return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
80
80
  }
81
+ var unsafeCommentReg = />/g, escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, "&gt;") : str;
82
+ function _escape_comment(val) {
83
+ return val ? escapeCommentStr(val + "") : val === 0 ? "0" : "";
84
+ }
81
85
 
82
86
  // src/common/for.ts
83
87
  function forIn(obj, cb) {
@@ -2304,6 +2308,7 @@ export {
2304
2308
  _el_read_error,
2305
2309
  _el_resume,
2306
2310
  _escape,
2311
+ _escape_comment,
2307
2312
  _escape_script,
2308
2313
  _escape_style,
2309
2314
  _existing_scope,
@@ -2377,16 +2377,21 @@ var escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, r
2377
2377
  function _escape(val) {
2378
2378
  return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
2379
2379
  }
2380
- var unsafeScriptReg = /<\/script/g;
2380
+ var unsafeScriptReg = /<\/script/gi;
2381
2381
  var escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
2382
2382
  function _escape_script(val) {
2383
2383
  return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
2384
2384
  }
2385
- var unsafeStyleReg = /<\/style/g;
2385
+ var unsafeStyleReg = /<\/style/gi;
2386
2386
  var escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str;
2387
2387
  function _escape_style(val) {
2388
2388
  return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
2389
2389
  }
2390
+ var unsafeCommentReg = />/g;
2391
+ var escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, "&gt;") : str;
2392
+ function _escape_comment(val) {
2393
+ return val ? escapeCommentStr(val + "") : val === 0 ? "0" : "";
2394
+ }
2390
2395
 
2391
2396
  // src/html/writer.ts
2392
2397
  if (false) {
@@ -2530,6 +2535,7 @@ function callRuntime(name2, ...args) {
2530
2535
  function getHTMLRuntime() {
2531
2536
  return {
2532
2537
  _escape,
2538
+ _escape_comment,
2533
2539
  _unescaped,
2534
2540
  _attr,
2535
2541
  _attr_class,
@@ -10827,7 +10833,7 @@ var html_comment_default = {
10827
10833
  if (import_compiler45.types.isMarkoText(child)) {
10828
10834
  write`${child.value}`;
10829
10835
  } else if (import_compiler45.types.isMarkoPlaceholder(child)) {
10830
- write`${callRuntime("_escape", child.value)}`;
10836
+ write`${callRuntime(child.escape ? "_escape_comment" : "_unescaped", child.value)}`;
10831
10837
  }
10832
10838
  }
10833
10839
  } else {
@@ -1,12 +1,13 @@
1
1
  import { types as t } from "@marko/compiler";
2
2
  import type { Falsy } from "../../common/types";
3
- import { _attr, _attr_class, _attr_style, _escape, _escape_script, _escape_style, _unescaped } from "../../html";
3
+ import { _attr, _attr_class, _attr_style, _escape, _escape_comment, _escape_script, _escape_style, _unescaped } from "../../html";
4
4
  export type DOMRuntimeHelpers = keyof typeof import("../../dom");
5
5
  export type HTMLRuntimeHelpers = keyof typeof import("../../html");
6
6
  export declare function importRuntime(name: DOMRuntimeHelpers | HTMLRuntimeHelpers): t.MemberExpression;
7
7
  export declare function callRuntime(name: DOMRuntimeHelpers | HTMLRuntimeHelpers, ...args: Array<Parameters<typeof t.callExpression>[1][number] | Falsy>): t.CallExpression;
8
8
  export declare function getHTMLRuntime(): {
9
9
  _escape: typeof _escape;
10
+ _escape_comment: typeof _escape_comment;
10
11
  _unescaped: typeof _unescaped;
11
12
  _attr: typeof _attr;
12
13
  _attr_class: typeof _attr_class;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.0.163",
3
+ "version": "6.0.164",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",