marko 6.3.2 → 6.3.4
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/cheatsheet.md +146 -0
- package/dist/common/accessor.d.ts +0 -1
- package/dist/common/accessor.debug.d.ts +0 -1
- package/dist/debug/dom.js +8 -0
- package/dist/debug/dom.mjs +8 -0
- package/dist/debug/html.js +39 -30
- package/dist/debug/html.mjs +39 -30
- package/dist/dom/compat.d.ts +1 -0
- package/dist/dom.js +8 -2
- package/dist/dom.mjs +8 -2
- package/dist/html/compat.d.ts +1 -1
- package/dist/html.js +33 -31
- package/dist/html.mjs +33 -31
- package/dist/translator/index.js +125 -54
- package/dist/translator/util/analyze-errors.d.ts +3 -0
- package/dist/translator/util/body-to-text-literal.d.ts +9 -1
- package/dist/translator/util/sections.d.ts +3 -0
- package/dist/translator/visitors/referenced-identifier.d.ts +7 -0
- package/dist/translator/visitors/tag/index.d.ts +5 -0
- package/package.json +6 -3
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$1") : 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, K_SCOPE_ID = Symbol("Scope ID"), kTouchedIterator = Symbol.for("marko.touchedIterator"), { hasOwnProperty: hasOwnProperty$1 } = {}, 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$1") : 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, K_SCOPE_ID = Symbol("Scope ID"), kTouchedIterator = Symbol.for("marko.touchedIterator"), { hasOwnProperty: hasOwnProperty$1 } = {}, objectProto = Object.prototype, arrayProto = Array.prototype, 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];
|
|
@@ -323,14 +323,14 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
323
323
|
if (boundary.flush() === 1) throw Error("Cannot serialize promise across tags/class compat layer.");
|
|
324
324
|
return new Chunk(boundary, null, null, state).flushScript().scripts;
|
|
325
325
|
},
|
|
326
|
-
render(renderer, willRerender, classAPIOut, component, input, completeChunks) {
|
|
326
|
+
render(renderer, willRerender, classAPIOut, component, input, completeChunks, registerChildScope) {
|
|
327
327
|
let state = this.ensureState(classAPIOut.global), boundary = new Boundary(state), head = new Chunk(boundary, null, null, state), normalizedInput = input;
|
|
328
328
|
if ("renderBody" in input) {
|
|
329
329
|
normalizedInput = {};
|
|
330
330
|
for (let key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
331
331
|
}
|
|
332
332
|
head.render(() => {
|
|
333
|
-
if (willRerender) {
|
|
333
|
+
if (willRerender || registerChildScope) {
|
|
334
334
|
let scopeId = _peek_scope_id();
|
|
335
335
|
writeScope(scopeId, { m5c: component.id }), _script(scopeId, SET_SCOPE_REGISTER_ID);
|
|
336
336
|
}
|
|
@@ -565,8 +565,6 @@ function writeProp(state, val, parent, accessor) {
|
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
567
|
function writeReferenceOr(state, write, val, parent, accessor) {
|
|
568
|
-
let scopeId = val[K_SCOPE_ID];
|
|
569
|
-
if (scopeId !== void 0) return trackScope(state, val, scopeId), state.buf.push("_(" + scopeId + ")"), !0;
|
|
570
568
|
let ref = state.refs.get(val);
|
|
571
569
|
if (ref) {
|
|
572
570
|
if (!trackChannel(state, ref)) return !1;
|
|
@@ -639,11 +637,16 @@ function writeNull(state) {
|
|
|
639
637
|
}
|
|
640
638
|
function writeObject(state, val, parent, accessor) {
|
|
641
639
|
if (val === null) return writeNull(state);
|
|
640
|
+
let scopeId = val[K_SCOPE_ID];
|
|
641
|
+
if (scopeId !== void 0) return trackScope(state, val, scopeId), state.buf.push("_(" + scopeId + ")"), !0;
|
|
642
642
|
let wellKnownObject = KNOWN_OBJECTS.get(val);
|
|
643
643
|
return wellKnownObject ? (state.buf.push(wellKnownObject), !0) : writeReferenceOr(state, writeUnknownObject, val, parent, accessor);
|
|
644
644
|
}
|
|
645
645
|
function writeUnknownObject(state, val, ref) {
|
|
646
|
-
|
|
646
|
+
let proto = Object.getPrototypeOf(val);
|
|
647
|
+
if (proto === objectProto) return writePlainObject(state, val, ref);
|
|
648
|
+
if (proto === arrayProto) return writeArray(state, val, ref);
|
|
649
|
+
switch (proto?.constructor) {
|
|
647
650
|
case void 0: return writeNullObject(state, val, ref);
|
|
648
651
|
case Object: return writePlainObject(state, val, ref);
|
|
649
652
|
case Array: return writeArray(state, val, ref);
|
|
@@ -685,7 +688,7 @@ function writeUnknownObject(state, val, ref) {
|
|
|
685
688
|
return !1;
|
|
686
689
|
}
|
|
687
690
|
function writePlainObject(state, val, ref) {
|
|
688
|
-
return state.buf.push("{"),
|
|
691
|
+
return state.buf.push("{"), writeMaybeIterableProps(state, val, ref), state.buf.push("}"), !0;
|
|
689
692
|
}
|
|
690
693
|
function writeArray(state, val, ref) {
|
|
691
694
|
let sep = "[";
|
|
@@ -843,7 +846,7 @@ function writeAsyncGenerator(state, iter, ref) {
|
|
|
843
846
|
return state.buf.push("(async function*(_,f,v,l,i,p=a=>l=new Promise((r,j)=>{f=_.r=r;_.j=j}),a=((_.f=v=>{f(v);a.push(p())}),[p()])){for(i of a)v=await i,i!=l&&(yield v);return v})(" + iterId + "={})"), iter.next().then(onFulfilled, onRejected), boundary.startAsync(), !0;
|
|
844
847
|
}
|
|
845
848
|
function writeNullObject(state, val, ref) {
|
|
846
|
-
return state.buf.push("{"), state.buf.push(
|
|
849
|
+
return state.buf.push("{"), state.buf.push(writeMaybeIterableProps(state, val, ref) + "__proto__:null}"), !0;
|
|
847
850
|
}
|
|
848
851
|
function writeObjectProps(state, val, ref) {
|
|
849
852
|
let sep = "";
|
|
@@ -851,6 +854,10 @@ function writeObjectProps(state, val, ref) {
|
|
|
851
854
|
let escapedKey = toObjectKey(key);
|
|
852
855
|
state.buf.push(sep + escapedKey + ":"), writeProp(state, val[key], ref, escapedKey) ? sep = "," : state.buf.pop();
|
|
853
856
|
}
|
|
857
|
+
return sep;
|
|
858
|
+
}
|
|
859
|
+
function writeMaybeIterableProps(state, val, ref) {
|
|
860
|
+
let sep = writeObjectProps(state, val, ref);
|
|
854
861
|
if (hasSymbolIterator(val)) {
|
|
855
862
|
let yieldSelf = "", iterArr = [];
|
|
856
863
|
for (let item of val) item === val && !(yieldSelf || iterArr.length) ? yieldSelf = "yield this;" : iterArr.push(item);
|
|
@@ -892,14 +899,18 @@ function isCircular(parent, ref) {
|
|
|
892
899
|
function toObjectKey(name) {
|
|
893
900
|
if (name === "") return "\"\"";
|
|
894
901
|
if (name === "__proto__") return "[\"__proto__\"]";
|
|
895
|
-
let
|
|
896
|
-
if (
|
|
897
|
-
if (
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
902
|
+
let len = name.length, c0 = name.charCodeAt(0);
|
|
903
|
+
if (c0 >= 48 && c0 <= 57) if (c0 === 48) {
|
|
904
|
+
if (len !== 1) return quote(name, 1);
|
|
905
|
+
} else for (let i = 1; i < len; i++) {
|
|
906
|
+
let c = name.charCodeAt(i);
|
|
907
|
+
if (c < 48 || c > 57) return quote(name, i);
|
|
908
|
+
}
|
|
909
|
+
else if (c0 >= 97 && c0 <= 122 || c0 >= 65 && c0 <= 90 || c0 === 95 || c0 === 36) for (let i = 1; i < len; i++) {
|
|
910
|
+
let c = name.charCodeAt(i);
|
|
911
|
+
if (!(c >= 97 && c <= 122 || c >= 65 && c <= 90 || c >= 48 && c <= 57 || c === 95 || c === 36)) return quote(name, i);
|
|
912
|
+
}
|
|
913
|
+
else return quote(name, 0);
|
|
903
914
|
return name;
|
|
904
915
|
}
|
|
905
916
|
function toAccess(accessor) {
|
|
@@ -1009,15 +1020,6 @@ function hasOnlyZeros(typedArray) {
|
|
|
1009
1020
|
for (let i = 0; i < typedArray.length; i++) if (typedArray[i] !== 0) return !1;
|
|
1010
1021
|
return !0;
|
|
1011
1022
|
}
|
|
1012
|
-
function isWordOrDigit(char) {
|
|
1013
|
-
return isWord(char) || isDigit(char);
|
|
1014
|
-
}
|
|
1015
|
-
function isDigit(char) {
|
|
1016
|
-
return char >= "0" && char <= "9";
|
|
1017
|
-
}
|
|
1018
|
-
function isWord(char) {
|
|
1019
|
-
return char >= "a" && char <= "z" || char >= "A" && char <= "Z" || char === "_" || char === "$";
|
|
1020
|
-
}
|
|
1021
1023
|
function patchIteratorNext(proto) {
|
|
1022
1024
|
if (proto.next[kTouchedIterator]) return;
|
|
1023
1025
|
let { next } = proto;
|
|
@@ -1885,7 +1887,7 @@ var ServerRendered = class {
|
|
|
1885
1887
|
}
|
|
1886
1888
|
pipe(stream) {
|
|
1887
1889
|
this.#read((html) => {
|
|
1888
|
-
stream.write(html);
|
|
1890
|
+
stream.write(html), stream.flush?.();
|
|
1889
1891
|
}, (err) => {
|
|
1890
1892
|
let socket = "socket" in stream && stream.socket;
|
|
1891
1893
|
if (socket && typeof socket.destroySoon == "function" && socket.destroySoon(), !stream.emit?.("error", err)) throw err;
|
|
@@ -1894,21 +1896,21 @@ var ServerRendered = class {
|
|
|
1894
1896
|
});
|
|
1895
1897
|
}
|
|
1896
1898
|
toReadable() {
|
|
1897
|
-
let cancelled = !1, boundary, encoder = new TextEncoder();
|
|
1899
|
+
let cancelled = !1, started = !1, boundary, encoder = new TextEncoder();
|
|
1898
1900
|
return new ReadableStream({
|
|
1899
|
-
|
|
1900
|
-
boundary = this.#read((html) => {
|
|
1901
|
+
pull: (ctrl) => {
|
|
1902
|
+
started || (started = !0, boundary = this.#read((html) => {
|
|
1901
1903
|
ctrl.enqueue(encoder.encode(html));
|
|
1902
1904
|
}, (err) => {
|
|
1903
1905
|
boundary = void 0, cancelled || ctrl.error(err);
|
|
1904
1906
|
}, () => {
|
|
1905
1907
|
boundary = void 0, ctrl.close();
|
|
1906
|
-
});
|
|
1908
|
+
}));
|
|
1907
1909
|
},
|
|
1908
1910
|
cancel: (reason) => {
|
|
1909
1911
|
cancelled = !0, boundary?.abort(reason);
|
|
1910
1912
|
}
|
|
1911
|
-
});
|
|
1913
|
+
}, { highWaterMark: 0 });
|
|
1912
1914
|
}
|
|
1913
1915
|
then(onfulfilled, onrejected) {
|
|
1914
1916
|
return this.#promise().then(onfulfilled, onrejected);
|
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$1") : 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, K_SCOPE_ID = Symbol("Scope ID"), kTouchedIterator = Symbol.for("marko.touchedIterator"), { hasOwnProperty: hasOwnProperty$1 } = {}, 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$1") : 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, K_SCOPE_ID = Symbol("Scope ID"), kTouchedIterator = Symbol.for("marko.touchedIterator"), { hasOwnProperty: hasOwnProperty$1 } = {}, objectProto = Object.prototype, arrayProto = Array.prototype, 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];
|
|
@@ -323,14 +323,14 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
323
323
|
if (boundary.flush() === 1) throw Error("Cannot serialize promise across tags/class compat layer.");
|
|
324
324
|
return new Chunk(boundary, null, null, state).flushScript().scripts;
|
|
325
325
|
},
|
|
326
|
-
render(renderer, willRerender, classAPIOut, component, input, completeChunks) {
|
|
326
|
+
render(renderer, willRerender, classAPIOut, component, input, completeChunks, registerChildScope) {
|
|
327
327
|
let state = this.ensureState(classAPIOut.global), boundary = new Boundary(state), head = new Chunk(boundary, null, null, state), normalizedInput = input;
|
|
328
328
|
if ("renderBody" in input) {
|
|
329
329
|
normalizedInput = {};
|
|
330
330
|
for (let key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
331
331
|
}
|
|
332
332
|
head.render(() => {
|
|
333
|
-
if (willRerender) {
|
|
333
|
+
if (willRerender || registerChildScope) {
|
|
334
334
|
let scopeId = _peek_scope_id();
|
|
335
335
|
writeScope(scopeId, { m5c: component.id }), _script(scopeId, SET_SCOPE_REGISTER_ID);
|
|
336
336
|
}
|
|
@@ -564,8 +564,6 @@ function writeProp(state, val, parent, accessor) {
|
|
|
564
564
|
}
|
|
565
565
|
}
|
|
566
566
|
function writeReferenceOr(state, write, val, parent, accessor) {
|
|
567
|
-
let scopeId = val[K_SCOPE_ID];
|
|
568
|
-
if (scopeId !== void 0) return trackScope(state, val, scopeId), state.buf.push("_(" + scopeId + ")"), !0;
|
|
569
567
|
let ref = state.refs.get(val);
|
|
570
568
|
if (ref) {
|
|
571
569
|
if (!trackChannel(state, ref)) return !1;
|
|
@@ -638,11 +636,16 @@ function writeNull(state) {
|
|
|
638
636
|
}
|
|
639
637
|
function writeObject(state, val, parent, accessor) {
|
|
640
638
|
if (val === null) return writeNull(state);
|
|
639
|
+
let scopeId = val[K_SCOPE_ID];
|
|
640
|
+
if (scopeId !== void 0) return trackScope(state, val, scopeId), state.buf.push("_(" + scopeId + ")"), !0;
|
|
641
641
|
let wellKnownObject = KNOWN_OBJECTS.get(val);
|
|
642
642
|
return wellKnownObject ? (state.buf.push(wellKnownObject), !0) : writeReferenceOr(state, writeUnknownObject, val, parent, accessor);
|
|
643
643
|
}
|
|
644
644
|
function writeUnknownObject(state, val, ref) {
|
|
645
|
-
|
|
645
|
+
let proto = Object.getPrototypeOf(val);
|
|
646
|
+
if (proto === objectProto) return writePlainObject(state, val, ref);
|
|
647
|
+
if (proto === arrayProto) return writeArray(state, val, ref);
|
|
648
|
+
switch (proto?.constructor) {
|
|
646
649
|
case void 0: return writeNullObject(state, val, ref);
|
|
647
650
|
case Object: return writePlainObject(state, val, ref);
|
|
648
651
|
case Array: return writeArray(state, val, ref);
|
|
@@ -684,7 +687,7 @@ function writeUnknownObject(state, val, ref) {
|
|
|
684
687
|
return !1;
|
|
685
688
|
}
|
|
686
689
|
function writePlainObject(state, val, ref) {
|
|
687
|
-
return state.buf.push("{"),
|
|
690
|
+
return state.buf.push("{"), writeMaybeIterableProps(state, val, ref), state.buf.push("}"), !0;
|
|
688
691
|
}
|
|
689
692
|
function writeArray(state, val, ref) {
|
|
690
693
|
let sep = "[";
|
|
@@ -842,7 +845,7 @@ function writeAsyncGenerator(state, iter, ref) {
|
|
|
842
845
|
return state.buf.push("(async function*(_,f,v,l,i,p=a=>l=new Promise((r,j)=>{f=_.r=r;_.j=j}),a=((_.f=v=>{f(v);a.push(p())}),[p()])){for(i of a)v=await i,i!=l&&(yield v);return v})(" + iterId + "={})"), iter.next().then(onFulfilled, onRejected), boundary.startAsync(), !0;
|
|
843
846
|
}
|
|
844
847
|
function writeNullObject(state, val, ref) {
|
|
845
|
-
return state.buf.push("{"), state.buf.push(
|
|
848
|
+
return state.buf.push("{"), state.buf.push(writeMaybeIterableProps(state, val, ref) + "__proto__:null}"), !0;
|
|
846
849
|
}
|
|
847
850
|
function writeObjectProps(state, val, ref) {
|
|
848
851
|
let sep = "";
|
|
@@ -850,6 +853,10 @@ function writeObjectProps(state, val, ref) {
|
|
|
850
853
|
let escapedKey = toObjectKey(key);
|
|
851
854
|
state.buf.push(sep + escapedKey + ":"), writeProp(state, val[key], ref, escapedKey) ? sep = "," : state.buf.pop();
|
|
852
855
|
}
|
|
856
|
+
return sep;
|
|
857
|
+
}
|
|
858
|
+
function writeMaybeIterableProps(state, val, ref) {
|
|
859
|
+
let sep = writeObjectProps(state, val, ref);
|
|
853
860
|
if (hasSymbolIterator(val)) {
|
|
854
861
|
let yieldSelf = "", iterArr = [];
|
|
855
862
|
for (let item of val) item === val && !(yieldSelf || iterArr.length) ? yieldSelf = "yield this;" : iterArr.push(item);
|
|
@@ -891,14 +898,18 @@ function isCircular(parent, ref) {
|
|
|
891
898
|
function toObjectKey(name) {
|
|
892
899
|
if (name === "") return "\"\"";
|
|
893
900
|
if (name === "__proto__") return "[\"__proto__\"]";
|
|
894
|
-
let
|
|
895
|
-
if (
|
|
896
|
-
if (
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
901
|
+
let len = name.length, c0 = name.charCodeAt(0);
|
|
902
|
+
if (c0 >= 48 && c0 <= 57) if (c0 === 48) {
|
|
903
|
+
if (len !== 1) return quote(name, 1);
|
|
904
|
+
} else for (let i = 1; i < len; i++) {
|
|
905
|
+
let c = name.charCodeAt(i);
|
|
906
|
+
if (c < 48 || c > 57) return quote(name, i);
|
|
907
|
+
}
|
|
908
|
+
else if (c0 >= 97 && c0 <= 122 || c0 >= 65 && c0 <= 90 || c0 === 95 || c0 === 36) for (let i = 1; i < len; i++) {
|
|
909
|
+
let c = name.charCodeAt(i);
|
|
910
|
+
if (!(c >= 97 && c <= 122 || c >= 65 && c <= 90 || c >= 48 && c <= 57 || c === 95 || c === 36)) return quote(name, i);
|
|
911
|
+
}
|
|
912
|
+
else return quote(name, 0);
|
|
902
913
|
return name;
|
|
903
914
|
}
|
|
904
915
|
function toAccess(accessor) {
|
|
@@ -1008,15 +1019,6 @@ function hasOnlyZeros(typedArray) {
|
|
|
1008
1019
|
for (let i = 0; i < typedArray.length; i++) if (typedArray[i] !== 0) return !1;
|
|
1009
1020
|
return !0;
|
|
1010
1021
|
}
|
|
1011
|
-
function isWordOrDigit(char) {
|
|
1012
|
-
return isWord(char) || isDigit(char);
|
|
1013
|
-
}
|
|
1014
|
-
function isDigit(char) {
|
|
1015
|
-
return char >= "0" && char <= "9";
|
|
1016
|
-
}
|
|
1017
|
-
function isWord(char) {
|
|
1018
|
-
return char >= "a" && char <= "z" || char >= "A" && char <= "Z" || char === "_" || char === "$";
|
|
1019
|
-
}
|
|
1020
1022
|
function patchIteratorNext(proto) {
|
|
1021
1023
|
if (proto.next[kTouchedIterator]) return;
|
|
1022
1024
|
let { next } = proto;
|
|
@@ -1884,7 +1886,7 @@ var ServerRendered = class {
|
|
|
1884
1886
|
}
|
|
1885
1887
|
pipe(stream) {
|
|
1886
1888
|
this.#read((html) => {
|
|
1887
|
-
stream.write(html);
|
|
1889
|
+
stream.write(html), stream.flush?.();
|
|
1888
1890
|
}, (err) => {
|
|
1889
1891
|
let socket = "socket" in stream && stream.socket;
|
|
1890
1892
|
if (socket && typeof socket.destroySoon == "function" && socket.destroySoon(), !stream.emit?.("error", err)) throw err;
|
|
@@ -1893,21 +1895,21 @@ var ServerRendered = class {
|
|
|
1893
1895
|
});
|
|
1894
1896
|
}
|
|
1895
1897
|
toReadable() {
|
|
1896
|
-
let cancelled = !1, boundary, encoder = new TextEncoder();
|
|
1898
|
+
let cancelled = !1, started = !1, boundary, encoder = new TextEncoder();
|
|
1897
1899
|
return new ReadableStream({
|
|
1898
|
-
|
|
1899
|
-
boundary = this.#read((html) => {
|
|
1900
|
+
pull: (ctrl) => {
|
|
1901
|
+
started || (started = !0, boundary = this.#read((html) => {
|
|
1900
1902
|
ctrl.enqueue(encoder.encode(html));
|
|
1901
1903
|
}, (err) => {
|
|
1902
1904
|
boundary = void 0, cancelled || ctrl.error(err);
|
|
1903
1905
|
}, () => {
|
|
1904
1906
|
boundary = void 0, ctrl.close();
|
|
1905
|
-
});
|
|
1907
|
+
}));
|
|
1906
1908
|
},
|
|
1907
1909
|
cancel: (reason) => {
|
|
1908
1910
|
cancelled = !0, boundary?.abort(reason);
|
|
1909
1911
|
}
|
|
1910
|
-
});
|
|
1912
|
+
}, { highWaterMark: 0 });
|
|
1911
1913
|
}
|
|
1912
1914
|
then(onfulfilled, onrejected) {
|
|
1913
1915
|
return this.#promise().then(onfulfilled, onrejected);
|