@marko/runtime-tags 6.0.172 → 6.1.0
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/dist/debug/html.js +5 -3
- package/dist/debug/html.mjs +5 -3
- package/dist/html/inlined-runtimes.d.ts +2 -2
- package/dist/html/inlined-runtimes.debug.d.ts +2 -0
- package/dist/html/writer.d.ts +1 -1
- package/dist/html.js +4 -3
- package/dist/html.mjs +4 -3
- package/dist/translator/index.js +28 -22
- package/dist/translator/util/runtime.d.ts +1 -1
- package/package.json +1 -1
package/dist/debug/html.js
CHANGED
|
@@ -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;
|
|
@@ -2216,7 +2218,7 @@ function getFilteredGlobals($global) {
|
|
|
2216
2218
|
return filtered;
|
|
2217
2219
|
}
|
|
2218
2220
|
function _subscribe(subscribers, scope) {
|
|
2219
|
-
$chunk.boundary.state.serializer.writeCall(scope, subscribers, "add");
|
|
2221
|
+
if (subscribers) $chunk.boundary.state.serializer.writeCall(scope, subscribers, "add");
|
|
2220
2222
|
return referenceScope(scope);
|
|
2221
2223
|
}
|
|
2222
2224
|
//#endregion
|
package/dist/debug/html.mjs
CHANGED
|
@@ -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;
|
|
@@ -2214,7 +2216,7 @@ function getFilteredGlobals($global) {
|
|
|
2214
2216
|
return filtered;
|
|
2215
2217
|
}
|
|
2216
2218
|
function _subscribe(subscribers, scope) {
|
|
2217
|
-
$chunk.boundary.state.serializer.writeCall(scope, subscribers, "add");
|
|
2219
|
+
if (subscribers) $chunk.boundary.state.serializer.writeCall(scope, subscribers, "add");
|
|
2218
2220
|
return referenceScope(scope);
|
|
2219
2221
|
}
|
|
2220
2222
|
//#endregion
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const WALKER_RUNTIME_CODE:
|
|
2
|
-
export declare const REORDER_RUNTIME_CODE:
|
|
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/writer.d.ts
CHANGED
|
@@ -145,4 +145,4 @@ export declare function _trailers(html: string): void;
|
|
|
145
145
|
type QueueCallback = (ticked: true) => void;
|
|
146
146
|
export declare function queueTick(cb: QueueCallback): void;
|
|
147
147
|
export declare function offTick(cb: QueueCallback): void;
|
|
148
|
-
export declare function _subscribe(subscribers: Set<ScopeInternals
|
|
148
|
+
export declare function _subscribe(subscribers: Set<ScopeInternals> | undefined, scope: ScopeInternals): ScopeInternals;
|
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 === "&" ? "&" : "<", 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, ">") : str, kTouchedIterator = Symbol(), { hasOwnProperty } = {}, Generator = (function* () {})().constructor, AsyncGenerator = (async function* () {})().constructor, REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = (() => {
|
|
7
|
+
}, unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&" : "<", 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, ">") : 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;
|
|
@@ -1463,7 +1464,7 @@ function getFilteredGlobals($global) {
|
|
|
1463
1464
|
return filtered;
|
|
1464
1465
|
}
|
|
1465
1466
|
function _subscribe(subscribers, scope) {
|
|
1466
|
-
return $chunk.boundary.state.serializer.writeCall(scope, subscribers, "add"), referenceScope(scope);
|
|
1467
|
+
return subscribers && $chunk.boundary.state.serializer.writeCall(scope, subscribers, "add"), referenceScope(scope);
|
|
1467
1468
|
}
|
|
1468
1469
|
//#endregion
|
|
1469
1470
|
//#region src/html/attrs.ts
|
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 === "&" ? "&" : "<", 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, ">") : str, kTouchedIterator = Symbol(), { hasOwnProperty } = {}, Generator = (function* () {})().constructor, AsyncGenerator = (async function* () {})().constructor, REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = (() => {
|
|
7
|
+
}, unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&" : "<", 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, ">") : 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;
|
|
@@ -1462,7 +1463,7 @@ function getFilteredGlobals($global) {
|
|
|
1462
1463
|
return filtered;
|
|
1463
1464
|
}
|
|
1464
1465
|
function _subscribe(subscribers, scope) {
|
|
1465
|
-
return $chunk.boundary.state.serializer.writeCall(scope, subscribers, "add"), referenceScope(scope);
|
|
1466
|
+
return subscribers && $chunk.boundary.state.serializer.writeCall(scope, subscribers, "add"), referenceScope(scope);
|
|
1466
1467
|
}
|
|
1467
1468
|
//#endregion
|
|
1468
1469
|
//#region src/html/attrs.ts
|
package/dist/translator/index.js
CHANGED
|
@@ -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
|
|
@@ -2132,24 +2134,6 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
|
|
|
2132
2134
|
};
|
|
2133
2135
|
})(_dynamic_tag);
|
|
2134
2136
|
//#endregion
|
|
2135
|
-
//#region src/translator/util/to-property-name.ts
|
|
2136
|
-
function isValidPropertyIdentifier(name) {
|
|
2137
|
-
return /^[a-z_$][a-z0-9_$]*$/i.test(name);
|
|
2138
|
-
}
|
|
2139
|
-
function toPropertyName(name) {
|
|
2140
|
-
if (isValidPropertyIdentifier(name)) return _marko_compiler.types.identifier(name);
|
|
2141
|
-
else if (/^(?:0|[1-9][0-9]*)$/.test(name)) return _marko_compiler.types.numericLiteral(parseInt(name, 10));
|
|
2142
|
-
return _marko_compiler.types.stringLiteral(name);
|
|
2143
|
-
}
|
|
2144
|
-
function toObjectProperty(name, value) {
|
|
2145
|
-
return _marko_compiler.types.objectProperty(toPropertyName(name), value);
|
|
2146
|
-
}
|
|
2147
|
-
function toMemberExpression(object, key, optional) {
|
|
2148
|
-
const prop = toPropertyName(key);
|
|
2149
|
-
const computed = prop.type !== "Identifier";
|
|
2150
|
-
return optional ? _marko_compiler.types.optionalMemberExpression(object, prop, computed, true) : _marko_compiler.types.memberExpression(object, prop, computed);
|
|
2151
|
-
}
|
|
2152
|
-
//#endregion
|
|
2153
2137
|
//#region src/translator/util/runtime.ts
|
|
2154
2138
|
const pureDOMFunctions = new Set([
|
|
2155
2139
|
"_await_promise",
|
|
@@ -2175,7 +2159,7 @@ const pureDOMFunctions = new Set([
|
|
|
2175
2159
|
]);
|
|
2176
2160
|
function importRuntime(name) {
|
|
2177
2161
|
const { output } = getMarkoOpts();
|
|
2178
|
-
return
|
|
2162
|
+
return (0, _marko_compiler_babel_utils.importNamed)((0, _marko_compiler_babel_utils.getFile)(), getRuntimePath(output), name);
|
|
2179
2163
|
}
|
|
2180
2164
|
function callRuntime(name, ...args) {
|
|
2181
2165
|
const callExpression = _marko_compiler.types.callExpression(importRuntime(name), filterArguments(args));
|
|
@@ -2769,6 +2753,24 @@ function forEachIdentifierPath(nodePath, cb) {
|
|
|
2769
2753
|
}
|
|
2770
2754
|
}
|
|
2771
2755
|
//#endregion
|
|
2756
|
+
//#region src/translator/util/to-property-name.ts
|
|
2757
|
+
function isValidPropertyIdentifier(name) {
|
|
2758
|
+
return /^[a-z_$][a-z0-9_$]*$/i.test(name);
|
|
2759
|
+
}
|
|
2760
|
+
function toPropertyName(name) {
|
|
2761
|
+
if (isValidPropertyIdentifier(name)) return _marko_compiler.types.identifier(name);
|
|
2762
|
+
else if (/^(?:0|[1-9][0-9]*)$/.test(name)) return _marko_compiler.types.numericLiteral(parseInt(name, 10));
|
|
2763
|
+
return _marko_compiler.types.stringLiteral(name);
|
|
2764
|
+
}
|
|
2765
|
+
function toObjectProperty(name, value) {
|
|
2766
|
+
return _marko_compiler.types.objectProperty(toPropertyName(name), value);
|
|
2767
|
+
}
|
|
2768
|
+
function toMemberExpression(object, key, optional) {
|
|
2769
|
+
const prop = toPropertyName(key);
|
|
2770
|
+
const computed = prop.type !== "Identifier";
|
|
2771
|
+
return optional ? _marko_compiler.types.optionalMemberExpression(object, prop, computed, true) : _marko_compiler.types.memberExpression(object, prop, computed);
|
|
2772
|
+
}
|
|
2773
|
+
//#endregion
|
|
2772
2774
|
//#region src/translator/util/get-declared-binding-expression.ts
|
|
2773
2775
|
function getDeclaredBindingExpression(binding) {
|
|
2774
2776
|
const canonicalBinding = getCanonicalBinding(binding);
|
|
@@ -3202,6 +3204,7 @@ function writeHTMLResumeStatements(path) {
|
|
|
3202
3204
|
const body = path.node.body;
|
|
3203
3205
|
const allSignals = Array.from(getSignals(section).values());
|
|
3204
3206
|
const scopeIdIdentifier = getScopeIdIdentifier(section);
|
|
3207
|
+
const sectionSerializeReason = nonAnalyzedForceSerializedSection.has(section) ? true : section.serializeReason;
|
|
3205
3208
|
forEach(section.referencedClosures, (closure) => {
|
|
3206
3209
|
if (closure.sources) {
|
|
3207
3210
|
if (isDynamicClosure(section, closure)) {
|
|
@@ -3217,7 +3220,11 @@ function writeHTMLResumeStatements(path) {
|
|
|
3217
3220
|
if (underTryPlaceholder(section)) {
|
|
3218
3221
|
const reason = getSerializeReason(section);
|
|
3219
3222
|
if (reason) getHTMLSectionStatements(section).push(_marko_compiler.types.expressionStatement(getExprIfSerialized(section, reason, callRuntime("_script", getScopeIdIdentifier(section), _marko_compiler.types.stringLiteral(getResumeRegisterId(section, closure, "pending"))))));
|
|
3220
|
-
} else
|
|
3223
|
+
} else {
|
|
3224
|
+
const closureScopesReason = getSerializeReason(closure.section, closure, getAccessorPrefix().ClosureScopes);
|
|
3225
|
+
const subscribeArg = isReasonDynamic(closureScopesReason) && !isSameReason(closureScopesReason, sectionSerializeReason) ? getExprIfSerialized(closure.section, closureScopesReason, identifier) : identifier;
|
|
3226
|
+
addWriteScopeBuilder(section, (expr) => callRuntime("_subscribe", subscribeArg, expr));
|
|
3227
|
+
}
|
|
3221
3228
|
}
|
|
3222
3229
|
}
|
|
3223
3230
|
});
|
|
@@ -3229,7 +3236,6 @@ function writeHTMLResumeStatements(path) {
|
|
|
3229
3236
|
const writeScopeBuilder = getSectionWriteScopeBuilder(section);
|
|
3230
3237
|
const serializedLookup = getSerializedAccessors(section);
|
|
3231
3238
|
const serializedProperties = [];
|
|
3232
|
-
const sectionSerializeReason = nonAnalyzedForceSerializedSection.has(section) ? true : section.serializeReason;
|
|
3233
3239
|
const ifSerialized = (reason, expr) => {
|
|
3234
3240
|
if (isSameReason(sectionSerializeReason, reason)) return expr;
|
|
3235
3241
|
return getExprIfSerialized(section, reason, expr);
|
|
@@ -3,7 +3,7 @@ import type { Falsy } from "../../common/types";
|
|
|
3
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
|
-
export declare function importRuntime(name: DOMRuntimeHelpers | HTMLRuntimeHelpers): t.
|
|
6
|
+
export declare function importRuntime(name: DOMRuntimeHelpers | HTMLRuntimeHelpers): t.Identifier;
|
|
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;
|