@marko/runtime-tags 6.0.172 → 6.0.173

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.
@@ -176,7 +176,7 @@ function forStepBy(by, index) {
176
176
  return index;
177
177
  }
178
178
  //#endregion
179
- //#region src/html/inlined-runtimes.ts
179
+ //#region src/html/inlined-runtimes.debug.ts
180
180
  const WALKER_RUNTIME_CODE = `((runtimeId) => (self[runtimeId] || (self[runtimeId] = (
181
181
  renderId,
182
182
  prefix = runtimeId + renderId,
@@ -270,7 +270,7 @@ const REORDER_RUNTIME_CODE = `((runtime) => {
270
270
  })`;
271
271
  //#endregion
272
272
  //#region src/html/serializer.ts
273
- const kTouchedIterator = Symbol();
273
+ const kTouchedIterator = Symbol.for("marko.touchedIterator");
274
274
  const { hasOwnProperty } = {};
275
275
  const Generator = (function* () {})().constructor;
276
276
  const AsyncGenerator = (async function* () {})().constructor;
@@ -1402,11 +1402,13 @@ function isWord(char) {
1402
1402
  return char >= "a" && char <= "z" || char >= "A" && char <= "Z" || char === "_" || char === "$";
1403
1403
  }
1404
1404
  function patchIteratorNext(proto) {
1405
+ if (proto.next[kTouchedIterator]) return;
1405
1406
  const { next } = proto;
1406
1407
  proto.next = function(value) {
1407
1408
  this[kTouchedIterator] = 1;
1408
1409
  return next.call(this, value);
1409
1410
  };
1411
+ proto.next[kTouchedIterator] = true;
1410
1412
  }
1411
1413
  function compareRegisteredReferences(a, b) {
1412
1414
  return a.registered.instanceId - b.registered.instanceId;
@@ -174,7 +174,7 @@ function forStepBy(by, index) {
174
174
  return index;
175
175
  }
176
176
  //#endregion
177
- //#region src/html/inlined-runtimes.ts
177
+ //#region src/html/inlined-runtimes.debug.ts
178
178
  const WALKER_RUNTIME_CODE = `((runtimeId) => (self[runtimeId] || (self[runtimeId] = (
179
179
  renderId,
180
180
  prefix = runtimeId + renderId,
@@ -268,7 +268,7 @@ const REORDER_RUNTIME_CODE = `((runtime) => {
268
268
  })`;
269
269
  //#endregion
270
270
  //#region src/html/serializer.ts
271
- const kTouchedIterator = Symbol();
271
+ const kTouchedIterator = Symbol.for("marko.touchedIterator");
272
272
  const { hasOwnProperty } = {};
273
273
  const Generator = (function* () {})().constructor;
274
274
  const AsyncGenerator = (async function* () {})().constructor;
@@ -1400,11 +1400,13 @@ function isWord(char) {
1400
1400
  return char >= "a" && char <= "z" || char >= "A" && char <= "Z" || char === "_" || char === "$";
1401
1401
  }
1402
1402
  function patchIteratorNext(proto) {
1403
+ if (proto.next[kTouchedIterator]) return;
1403
1404
  const { next } = proto;
1404
1405
  proto.next = function(value) {
1405
1406
  this[kTouchedIterator] = 1;
1406
1407
  return next.call(this, value);
1407
1408
  };
1409
+ proto.next[kTouchedIterator] = true;
1408
1410
  }
1409
1411
  function compareRegisteredReferences(a, b) {
1410
1412
  return a.registered.instanceId - b.registered.instanceId;
@@ -1,2 +1,2 @@
1
- export declare const WALKER_RUNTIME_CODE: string;
2
- export declare const REORDER_RUNTIME_CODE: string;
1
+ export declare const WALKER_RUNTIME_CODE = "(e=>(self[e]||(self[e]=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(a[r=l.slice(s+1)]=e,l[s]),r,e),l>\"#\"&&d.push(e)}}),self[e]))";
2
+ export declare const REORDER_RUNTIME_CODE = "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.d.head.append(e.d.querySelector(\"style[\"+e.i+\"]\")||\"\"),e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"!\"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,c(i=e.l[\"^\"+a]){if(--o.i)return 1;for(;(r=e.l[a].previousSibling||i).remove(),i!=r;);c(a,d)}}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})";
@@ -0,0 +1,2 @@
1
+ export declare const WALKER_RUNTIME_CODE = "((runtimeId) => (self[runtimeId] || (self[runtimeId] = (\n renderId,\n prefix = runtimeId + renderId,\n prefixLen = prefix.length,\n lookup = {},\n visits = [],\n doc = document,\n walker = doc.createTreeWalker(\n doc,\n 129 /* NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_ELEMENT */,\n ),\n) =>\n doc = (self[runtimeId][renderId] = {\n i: prefix,\n d: doc,\n l: lookup,\n v: visits,\n x() {},\n w(node, op, id) {\n while ((node = walker.nextNode())) {\n doc.x(\n (op =\n (op = node.data) &&\n !op.indexOf(prefix) &&\n ((lookup[(id = op.slice(prefixLen + 1))] = node), op[prefixLen])),\n id,\n node,\n );\n\n if (op > \"#\") {\n visits.push(node);\n }\n }\n },\n })\n), self[runtimeId]))";
2
+ export declare const REORDER_RUNTIME_CODE = "((runtime) => {\n if (runtime.j) return;\n let onNextSibling,\n placeholder,\n nextSibling,\n placeholders = runtime.p = {},\n replace = (id, container) => runtime.l[id].replaceWith(...container.childNodes);\n runtime.d.head.append(\n runtime.d.querySelector(\"style[\" + runtime.i + \"]\") || \"\"\n );\n runtime.j = {};\n runtime.x = (op, id, node, placeholderRoot, placeholderCb) => {\n if (node == nextSibling) {\n onNextSibling();\n }\n\n if (op == \"#\") {\n (placeholders[id] = placeholder).i++;\n } else if (op == \"!\") {\n if (runtime.l[id] && placeholders[id]) {\n nextSibling = node.nextSibling;\n onNextSibling = () => placeholders[id].c();\n }\n } else if (node.tagName == \"T\" && (id = node.getAttribute(runtime.i))) {\n nextSibling = node.nextSibling;\n onNextSibling = () => {\n node.remove();\n placeholderRoot || replace(id, node);\n placeholder.c();\n };\n placeholder =\n placeholders[id] ||\n (placeholderRoot = placeholders[id] =\n {\n i: runtime.l[id] ? 1 : 2,\n c(start = runtime.l[\"^\" + id]) {\n if (--placeholderRoot.i) return 1;\n for (\n ;\n (nextSibling =\n runtime.l[id].previousSibling || start).remove(),\n start != nextSibling;\n\n );\n replace(id, node);\n },\n });\n // repurpose \"op\" for callbacks ...carefully\n if ((op = runtime.j[id])) {\n placeholderCb = placeholder.c;\n placeholder.c = () => placeholderCb() || op(runtime.r);\n }\n }\n };\n})";
package/dist/html.js CHANGED
@@ -4,7 +4,7 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
4
4
  else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
5
5
  else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
6
6
  return str;
7
- }, unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&amp;" : "&lt;", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str, unsafeScriptReg = /<\/script/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str, unsafeStyleReg = /<\/style/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str, unsafeCommentReg = />/g, escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, "&gt;") : str, kTouchedIterator = Symbol(), { hasOwnProperty } = {}, Generator = (function* () {})().constructor, AsyncGenerator = (async function* () {})().constructor, REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = (() => {
7
+ }, unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&amp;" : "&lt;", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str, unsafeScriptReg = /<\/script/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str, unsafeStyleReg = /<\/style/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str, unsafeCommentReg = />/g, escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, "&gt;") : str, kTouchedIterator = Symbol.for("marko.touchedIterator"), { hasOwnProperty } = {}, Generator = (function* () {})().constructor, AsyncGenerator = (async function* () {})().constructor, REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = (() => {
8
8
  let KNOWN_SYMBOLS = /* @__PURE__ */ new Map();
9
9
  for (let name of Object.getOwnPropertyNames(Symbol)) {
10
10
  let symbol = Symbol[name];
@@ -973,10 +973,11 @@ function isWord(char) {
973
973
  return char >= "a" && char <= "z" || char >= "A" && char <= "Z" || char === "_" || char === "$";
974
974
  }
975
975
  function patchIteratorNext(proto) {
976
+ if (proto.next[kTouchedIterator]) return;
976
977
  let { next } = proto;
977
978
  proto.next = function(value) {
978
979
  return this[kTouchedIterator] = 1, next.call(this, value);
979
- };
980
+ }, proto.next[kTouchedIterator] = !0;
980
981
  }
981
982
  function compareRegisteredReferences(a, b) {
982
983
  return a.registered.instanceId - b.registered.instanceId;
package/dist/html.mjs CHANGED
@@ -4,7 +4,7 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
4
4
  else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
5
5
  else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
6
6
  return str;
7
- }, unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&amp;" : "&lt;", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str, unsafeScriptReg = /<\/script/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str, unsafeStyleReg = /<\/style/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str, unsafeCommentReg = />/g, escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, "&gt;") : str, kTouchedIterator = Symbol(), { hasOwnProperty } = {}, Generator = (function* () {})().constructor, AsyncGenerator = (async function* () {})().constructor, REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = (() => {
7
+ }, unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&amp;" : "&lt;", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str, unsafeScriptReg = /<\/script/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str, unsafeStyleReg = /<\/style/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str, unsafeCommentReg = />/g, escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, "&gt;") : str, kTouchedIterator = Symbol.for("marko.touchedIterator"), { hasOwnProperty } = {}, Generator = (function* () {})().constructor, AsyncGenerator = (async function* () {})().constructor, REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = (() => {
8
8
  let KNOWN_SYMBOLS = /* @__PURE__ */ new Map();
9
9
  for (let name of Object.getOwnPropertyNames(Symbol)) {
10
10
  let symbol = Symbol[name];
@@ -972,10 +972,11 @@ function isWord(char) {
972
972
  return char >= "a" && char <= "z" || char >= "A" && char <= "Z" || char === "_" || char === "$";
973
973
  }
974
974
  function patchIteratorNext(proto) {
975
+ if (proto.next[kTouchedIterator]) return;
975
976
  let { next } = proto;
976
977
  proto.next = function(value) {
977
978
  return this[kTouchedIterator] = 1, next.call(this, value);
978
- };
979
+ }, proto.next[kTouchedIterator] = !0;
979
980
  }
980
981
  function compareRegisteredReferences(a, b) {
981
982
  return a.registered.instanceId - b.registered.instanceId;
@@ -248,7 +248,7 @@ function normalizeDynamicRenderer(value) {
248
248
  const decodeAccessor = (num) => (num + (num < 26 ? 10 : num < 962 ? 334 : 11998)).toString(36);
249
249
  //#endregion
250
250
  //#region src/html/serializer.ts
251
- const kTouchedIterator = Symbol();
251
+ const kTouchedIterator = Symbol.for("marko.touchedIterator");
252
252
  const { hasOwnProperty } = {};
253
253
  const Generator = (function* () {})().constructor;
254
254
  const AsyncGenerator = (async function* () {})().constructor;
@@ -496,11 +496,13 @@ function toAccess(accessor) {
496
496
  return start === "\"" || start >= "0" && start <= "9" ? "[" + accessor + "]" : "." + accessor;
497
497
  }
498
498
  function patchIteratorNext(proto) {
499
+ if (proto.next[kTouchedIterator]) return;
499
500
  const { next } = proto;
500
501
  proto.next = function(value) {
501
502
  this[kTouchedIterator] = 1;
502
503
  return next.call(this, value);
503
504
  };
505
+ proto.next[kTouchedIterator] = true;
504
506
  }
505
507
  //#endregion
506
508
  //#region src/translator/util/get-compile-stage.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/runtime-tags",
3
- "version": "6.0.172",
3
+ "version": "6.0.173",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",