@marko/runtime-tags 0.2.0 → 0.2.2
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 +28 -7
- package/dist/debug/html.mjs +26 -6
- package/dist/html/writer.d.ts +7 -5
- package/dist/html.d.ts +1 -1
- package/dist/html.js +14 -8
- package/dist/html.mjs +12 -7
- package/package.json +1 -1
package/dist/debug/html.js
CHANGED
|
@@ -66,7 +66,8 @@ __export(html_exports, {
|
|
|
66
66
|
write: () => write,
|
|
67
67
|
writeEffect: () => writeEffect,
|
|
68
68
|
writeExistingScope: () => writeExistingScope,
|
|
69
|
-
writeScope: () => writeScope
|
|
69
|
+
writeScope: () => writeScope,
|
|
70
|
+
writeTrailers: () => writeTrailers
|
|
70
71
|
});
|
|
71
72
|
module.exports = __toCommonJS(html_exports);
|
|
72
73
|
|
|
@@ -1676,6 +1677,7 @@ var State2 = class {
|
|
|
1676
1677
|
hasMainRuntime = false;
|
|
1677
1678
|
hasReorderRuntime = false;
|
|
1678
1679
|
hasWrittenResume = false;
|
|
1680
|
+
trailerHTML = "";
|
|
1679
1681
|
serializer = new Serializer();
|
|
1680
1682
|
writeReorders = null;
|
|
1681
1683
|
scopes = /* @__PURE__ */ new Map();
|
|
@@ -1952,10 +1954,28 @@ function prepareChunk(chunk) {
|
|
|
1952
1954
|
head.scripts = scripts;
|
|
1953
1955
|
return head;
|
|
1954
1956
|
}
|
|
1955
|
-
function flushChunk(head) {
|
|
1957
|
+
function flushChunk(head, last) {
|
|
1958
|
+
const { boundary } = head;
|
|
1959
|
+
const { state } = boundary;
|
|
1956
1960
|
const { html, scripts } = head;
|
|
1961
|
+
const { $global: $global2 } = state;
|
|
1962
|
+
const { __flush__ } = $global2;
|
|
1963
|
+
let result = html;
|
|
1957
1964
|
head.html = head.scripts = "";
|
|
1958
|
-
|
|
1965
|
+
if (scripts) {
|
|
1966
|
+
result += ($global2.cspNonce ? "<script nonce=" + escapeAttrValue($global2.cspNonce + "") + ">" : "<script>") + scripts + "</script>";
|
|
1967
|
+
}
|
|
1968
|
+
if (__flush__) {
|
|
1969
|
+
$global2.__flush__ = void 0;
|
|
1970
|
+
result = __flush__($global2, result);
|
|
1971
|
+
}
|
|
1972
|
+
if (last && state.trailerHTML) {
|
|
1973
|
+
result += state.trailerHTML;
|
|
1974
|
+
}
|
|
1975
|
+
return result;
|
|
1976
|
+
}
|
|
1977
|
+
function writeTrailers(html) {
|
|
1978
|
+
$chunk.boundary.state.trailerHTML += html;
|
|
1959
1979
|
}
|
|
1960
1980
|
function concatEffects(a, b) {
|
|
1961
1981
|
return a ? b ? a + "," + b : a : b;
|
|
@@ -2554,7 +2574,7 @@ var ServerRenderResult = class {
|
|
|
2554
2574
|
reject(boundary.signal.reason);
|
|
2555
2575
|
} else {
|
|
2556
2576
|
head = prepareChunk(head);
|
|
2557
|
-
if (boundary.done) resolve(flushChunk(head));
|
|
2577
|
+
if (boundary.done) resolve(flushChunk(head, true));
|
|
2558
2578
|
}
|
|
2559
2579
|
}
|
|
2560
2580
|
})();
|
|
@@ -2579,7 +2599,7 @@ var ServerRenderResult = class {
|
|
|
2579
2599
|
head = prepareChunk(head);
|
|
2580
2600
|
}
|
|
2581
2601
|
if (write2 || boundary.done) {
|
|
2582
|
-
const html = flushChunk(head);
|
|
2602
|
+
const html = flushChunk(head, boundary.done);
|
|
2583
2603
|
if (html) onWrite(html);
|
|
2584
2604
|
if (boundary.done) {
|
|
2585
2605
|
if (!tick2) offTick(onNext);
|
|
@@ -2600,7 +2620,7 @@ var ServerRenderResult = class {
|
|
|
2600
2620
|
if (!head) throw new Error("Cannot read from a consumed render result");
|
|
2601
2621
|
if (head.next) throw new Error("Cannot fork in sync mode");
|
|
2602
2622
|
this.#head = null;
|
|
2603
|
-
return flushChunk(prepareChunk(head));
|
|
2623
|
+
return flushChunk(prepareChunk(head), true);
|
|
2604
2624
|
}
|
|
2605
2625
|
};
|
|
2606
2626
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -2651,5 +2671,6 @@ var ServerRenderResult = class {
|
|
|
2651
2671
|
write,
|
|
2652
2672
|
writeEffect,
|
|
2653
2673
|
writeExistingScope,
|
|
2654
|
-
writeScope
|
|
2674
|
+
writeScope,
|
|
2675
|
+
writeTrailers
|
|
2655
2676
|
});
|
package/dist/debug/html.mjs
CHANGED
|
@@ -1604,6 +1604,7 @@ var State2 = class {
|
|
|
1604
1604
|
hasMainRuntime = false;
|
|
1605
1605
|
hasReorderRuntime = false;
|
|
1606
1606
|
hasWrittenResume = false;
|
|
1607
|
+
trailerHTML = "";
|
|
1607
1608
|
serializer = new Serializer();
|
|
1608
1609
|
writeReorders = null;
|
|
1609
1610
|
scopes = /* @__PURE__ */ new Map();
|
|
@@ -1880,10 +1881,28 @@ function prepareChunk(chunk) {
|
|
|
1880
1881
|
head.scripts = scripts;
|
|
1881
1882
|
return head;
|
|
1882
1883
|
}
|
|
1883
|
-
function flushChunk(head) {
|
|
1884
|
+
function flushChunk(head, last) {
|
|
1885
|
+
const { boundary } = head;
|
|
1886
|
+
const { state } = boundary;
|
|
1884
1887
|
const { html, scripts } = head;
|
|
1888
|
+
const { $global: $global2 } = state;
|
|
1889
|
+
const { __flush__ } = $global2;
|
|
1890
|
+
let result = html;
|
|
1885
1891
|
head.html = head.scripts = "";
|
|
1886
|
-
|
|
1892
|
+
if (scripts) {
|
|
1893
|
+
result += ($global2.cspNonce ? "<script nonce=" + escapeAttrValue($global2.cspNonce + "") + ">" : "<script>") + scripts + "</script>";
|
|
1894
|
+
}
|
|
1895
|
+
if (__flush__) {
|
|
1896
|
+
$global2.__flush__ = void 0;
|
|
1897
|
+
result = __flush__($global2, result);
|
|
1898
|
+
}
|
|
1899
|
+
if (last && state.trailerHTML) {
|
|
1900
|
+
result += state.trailerHTML;
|
|
1901
|
+
}
|
|
1902
|
+
return result;
|
|
1903
|
+
}
|
|
1904
|
+
function writeTrailers(html) {
|
|
1905
|
+
$chunk.boundary.state.trailerHTML += html;
|
|
1887
1906
|
}
|
|
1888
1907
|
function concatEffects(a, b) {
|
|
1889
1908
|
return a ? b ? a + "," + b : a : b;
|
|
@@ -2482,7 +2501,7 @@ var ServerRenderResult = class {
|
|
|
2482
2501
|
reject(boundary.signal.reason);
|
|
2483
2502
|
} else {
|
|
2484
2503
|
head = prepareChunk(head);
|
|
2485
|
-
if (boundary.done) resolve(flushChunk(head));
|
|
2504
|
+
if (boundary.done) resolve(flushChunk(head, true));
|
|
2486
2505
|
}
|
|
2487
2506
|
}
|
|
2488
2507
|
})();
|
|
@@ -2507,7 +2526,7 @@ var ServerRenderResult = class {
|
|
|
2507
2526
|
head = prepareChunk(head);
|
|
2508
2527
|
}
|
|
2509
2528
|
if (write2 || boundary.done) {
|
|
2510
|
-
const html = flushChunk(head);
|
|
2529
|
+
const html = flushChunk(head, boundary.done);
|
|
2511
2530
|
if (html) onWrite(html);
|
|
2512
2531
|
if (boundary.done) {
|
|
2513
2532
|
if (!tick2) offTick(onNext);
|
|
@@ -2528,7 +2547,7 @@ var ServerRenderResult = class {
|
|
|
2528
2547
|
if (!head) throw new Error("Cannot read from a consumed render result");
|
|
2529
2548
|
if (head.next) throw new Error("Cannot fork in sync mode");
|
|
2530
2549
|
this.#head = null;
|
|
2531
|
-
return flushChunk(prepareChunk(head));
|
|
2550
|
+
return flushChunk(prepareChunk(head), true);
|
|
2532
2551
|
}
|
|
2533
2552
|
};
|
|
2534
2553
|
export {
|
|
@@ -2578,5 +2597,6 @@ export {
|
|
|
2578
2597
|
write,
|
|
2579
2598
|
writeEffect,
|
|
2580
2599
|
writeExistingScope,
|
|
2581
|
-
writeScope
|
|
2600
|
+
writeScope,
|
|
2601
|
+
writeTrailers
|
|
2582
2602
|
};
|
package/dist/html/writer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Accessor } from "../common/types";
|
|
1
|
+
import type { $Global, Accessor } from "../common/types";
|
|
2
2
|
import { Serializer } from "./serializer";
|
|
3
3
|
export type PartialScope = Record<Accessor, unknown>;
|
|
4
4
|
type ScopeInternals = PartialScope & {
|
|
@@ -36,7 +36,7 @@ export declare function markResumeCleanup(scopeId: number): string;
|
|
|
36
36
|
export declare function writeScope(scopeId: number, partialScope: PartialScope): ScopeInternals;
|
|
37
37
|
export declare function writeExistingScope(scope: ScopeInternals): ScopeInternals;
|
|
38
38
|
export declare function ensureScopeWithId(scopeId: number): PartialScope;
|
|
39
|
-
export declare function $global():
|
|
39
|
+
export declare function $global(): $Global & {
|
|
40
40
|
renderId: string;
|
|
41
41
|
runtimeId: string;
|
|
42
42
|
};
|
|
@@ -44,7 +44,7 @@ export declare function fork<T>(promise: Promise<T> | T, renderBody: (value: T)
|
|
|
44
44
|
export declare function tryPlaceholder(renderBody: () => void, renderPlaceholder: () => void): void;
|
|
45
45
|
export declare function tryCatch(renderBody: () => void, renderCatch: (err: unknown) => void): void;
|
|
46
46
|
export declare class State {
|
|
47
|
-
$global:
|
|
47
|
+
$global: $Global & {
|
|
48
48
|
renderId: string;
|
|
49
49
|
runtimeId: string;
|
|
50
50
|
};
|
|
@@ -56,13 +56,14 @@ export declare class State {
|
|
|
56
56
|
hasMainRuntime: boolean;
|
|
57
57
|
hasReorderRuntime: boolean;
|
|
58
58
|
hasWrittenResume: boolean;
|
|
59
|
+
trailerHTML: string;
|
|
59
60
|
serializer: Serializer;
|
|
60
61
|
writeReorders: Chunk[] | null;
|
|
61
62
|
scopes: Map<number, PartialScope>;
|
|
62
63
|
writeScopes: null | (Record<number, PartialScope> & {
|
|
63
64
|
$?: unknown;
|
|
64
65
|
});
|
|
65
|
-
constructor($global:
|
|
66
|
+
constructor($global: $Global & {
|
|
66
67
|
renderId: string;
|
|
67
68
|
runtimeId: string;
|
|
68
69
|
});
|
|
@@ -104,7 +105,8 @@ export declare class Chunk {
|
|
|
104
105
|
render<T>(renderBody: (val: T) => void, val: T): Chunk;
|
|
105
106
|
}
|
|
106
107
|
export declare function prepareChunk(chunk: Chunk): Chunk;
|
|
107
|
-
export declare function flushChunk(head: Chunk): string;
|
|
108
|
+
export declare function flushChunk(head: Chunk, last: boolean): string;
|
|
109
|
+
export declare function writeTrailers(html: string): void;
|
|
108
110
|
type QueueCallback = (ticked: true) => void;
|
|
109
111
|
export declare function queueTick(cb: QueueCallback): void;
|
|
110
112
|
export declare function offTick(cb: QueueCallback): void;
|
package/dist/html.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ export { compat } from "./html/compat";
|
|
|
6
6
|
export { escapeScript, escapeStyle, escapeXML, toString } from "./html/content";
|
|
7
7
|
export { createRenderer, dynamicTagArgs, dynamicTagInput, } from "./html/dynamic-tag";
|
|
8
8
|
export { createTemplate } from "./html/template";
|
|
9
|
-
export { $global, ensureScopeWithId, fork, getScopeById, markResumeCleanup, markResumeControlEnd, markResumeControlSingleNodeEnd, markResumeNode, markResumeScopeStart, nextScopeId, nextTagId, nodeRef, peekNextScope, register, tryCatch, tryPlaceholder, write, writeEffect, writeExistingScope, writeScope, } from "./html/writer";
|
|
9
|
+
export { $global, ensureScopeWithId, fork, getScopeById, markResumeCleanup, markResumeControlEnd, markResumeControlSingleNodeEnd, markResumeNode, markResumeScopeStart, nextScopeId, nextTagId, nodeRef, peekNextScope, register, tryCatch, tryPlaceholder, write, writeEffect, writeExistingScope, writeScope, writeTrailers, } from "./html/writer";
|
package/dist/html.js
CHANGED
|
@@ -63,7 +63,8 @@ __export(html_exports, {
|
|
|
63
63
|
write: () => write,
|
|
64
64
|
writeEffect: () => writeEffect,
|
|
65
65
|
writeExistingScope: () => writeExistingScope,
|
|
66
|
-
writeScope: () => writeScope
|
|
66
|
+
writeScope: () => writeScope,
|
|
67
|
+
writeTrailers: () => writeTrailers
|
|
67
68
|
});
|
|
68
69
|
module.exports = __toCommonJS(html_exports);
|
|
69
70
|
|
|
@@ -1119,6 +1120,7 @@ var State2 = class {
|
|
|
1119
1120
|
hasMainRuntime = !1;
|
|
1120
1121
|
hasReorderRuntime = !1;
|
|
1121
1122
|
hasWrittenResume = !1;
|
|
1123
|
+
trailerHTML = "";
|
|
1122
1124
|
serializer = new Serializer();
|
|
1123
1125
|
writeReorders = null;
|
|
1124
1126
|
scopes = /* @__PURE__ */ new Map();
|
|
@@ -1272,9 +1274,12 @@ function prepareChunk(chunk) {
|
|
|
1272
1274
|
}
|
|
1273
1275
|
return hasWalk && (scripts = concatScripts(scripts, runtimePrefix + ".w()")), head.html = html, head.scripts = scripts, head;
|
|
1274
1276
|
}
|
|
1275
|
-
function flushChunk(head) {
|
|
1276
|
-
let { html, scripts } = head;
|
|
1277
|
-
return head.html = head.scripts = "",
|
|
1277
|
+
function flushChunk(head, last) {
|
|
1278
|
+
let { boundary } = head, { state } = boundary, { html, scripts } = head, { $global: $global2 } = state, { __flush__ } = $global2, result = html;
|
|
1279
|
+
return head.html = head.scripts = "", scripts && (result += ($global2.cspNonce ? "<script nonce=" + escapeAttrValue($global2.cspNonce + "") + ">" : "<script>") + scripts + "</script>"), __flush__ && ($global2.__flush__ = void 0, result = __flush__($global2, result)), last && state.trailerHTML && (result += state.trailerHTML), result;
|
|
1280
|
+
}
|
|
1281
|
+
function writeTrailers(html) {
|
|
1282
|
+
$chunk.boundary.state.trailerHTML += html;
|
|
1278
1283
|
}
|
|
1279
1284
|
function concatEffects(a, b) {
|
|
1280
1285
|
return a ? b ? a + "," + b : a : b;
|
|
@@ -1689,7 +1694,7 @@ var ServerRenderResult = class {
|
|
|
1689
1694
|
return reject(new Error("Cannot read from a consumed render result"));
|
|
1690
1695
|
let { boundary } = head;
|
|
1691
1696
|
(boundary.onNext = () => {
|
|
1692
|
-
boundary.done && (boundary.signal.aborted ? reject(boundary.signal.reason) : (head = prepareChunk(head), boundary.done && resolve(flushChunk(head))));
|
|
1697
|
+
boundary.done && (boundary.signal.aborted ? reject(boundary.signal.reason) : (head = prepareChunk(head), boundary.done && resolve(flushChunk(head, !0))));
|
|
1693
1698
|
})();
|
|
1694
1699
|
});
|
|
1695
1700
|
}
|
|
@@ -1708,7 +1713,7 @@ var ServerRenderResult = class {
|
|
|
1708
1713
|
head = prepareChunk(head);
|
|
1709
1714
|
}
|
|
1710
1715
|
if (write2 || boundary.done) {
|
|
1711
|
-
let html = flushChunk(head);
|
|
1716
|
+
let html = flushChunk(head, boundary.done);
|
|
1712
1717
|
html && onWrite(html), boundary.done ? (tick2 || offTick(onNext), onClose()) : tick2 = !0;
|
|
1713
1718
|
} else tick2 && (tick2 = !1, queueTick(onNext));
|
|
1714
1719
|
};
|
|
@@ -1718,7 +1723,7 @@ var ServerRenderResult = class {
|
|
|
1718
1723
|
let head = this.#head;
|
|
1719
1724
|
if (!head) throw new Error("Cannot read from a consumed render result");
|
|
1720
1725
|
if (head.next) throw new Error("Cannot fork in sync mode");
|
|
1721
|
-
return this.#head = null, flushChunk(prepareChunk(head));
|
|
1726
|
+
return this.#head = null, flushChunk(prepareChunk(head), !0);
|
|
1722
1727
|
}
|
|
1723
1728
|
};
|
|
1724
1729
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1769,5 +1774,6 @@ var ServerRenderResult = class {
|
|
|
1769
1774
|
write,
|
|
1770
1775
|
writeEffect,
|
|
1771
1776
|
writeExistingScope,
|
|
1772
|
-
writeScope
|
|
1777
|
+
writeScope,
|
|
1778
|
+
writeTrailers
|
|
1773
1779
|
});
|
package/dist/html.mjs
CHANGED
|
@@ -1050,6 +1050,7 @@ var State2 = class {
|
|
|
1050
1050
|
hasMainRuntime = !1;
|
|
1051
1051
|
hasReorderRuntime = !1;
|
|
1052
1052
|
hasWrittenResume = !1;
|
|
1053
|
+
trailerHTML = "";
|
|
1053
1054
|
serializer = new Serializer();
|
|
1054
1055
|
writeReorders = null;
|
|
1055
1056
|
scopes = /* @__PURE__ */ new Map();
|
|
@@ -1203,9 +1204,12 @@ function prepareChunk(chunk) {
|
|
|
1203
1204
|
}
|
|
1204
1205
|
return hasWalk && (scripts = concatScripts(scripts, runtimePrefix + ".w()")), head.html = html, head.scripts = scripts, head;
|
|
1205
1206
|
}
|
|
1206
|
-
function flushChunk(head) {
|
|
1207
|
-
let { html, scripts } = head;
|
|
1208
|
-
return head.html = head.scripts = "",
|
|
1207
|
+
function flushChunk(head, last) {
|
|
1208
|
+
let { boundary } = head, { state } = boundary, { html, scripts } = head, { $global: $global2 } = state, { __flush__ } = $global2, result = html;
|
|
1209
|
+
return head.html = head.scripts = "", scripts && (result += ($global2.cspNonce ? "<script nonce=" + escapeAttrValue($global2.cspNonce + "") + ">" : "<script>") + scripts + "</script>"), __flush__ && ($global2.__flush__ = void 0, result = __flush__($global2, result)), last && state.trailerHTML && (result += state.trailerHTML), result;
|
|
1210
|
+
}
|
|
1211
|
+
function writeTrailers(html) {
|
|
1212
|
+
$chunk.boundary.state.trailerHTML += html;
|
|
1209
1213
|
}
|
|
1210
1214
|
function concatEffects(a, b) {
|
|
1211
1215
|
return a ? b ? a + "," + b : a : b;
|
|
@@ -1620,7 +1624,7 @@ var ServerRenderResult = class {
|
|
|
1620
1624
|
return reject(new Error("Cannot read from a consumed render result"));
|
|
1621
1625
|
let { boundary } = head;
|
|
1622
1626
|
(boundary.onNext = () => {
|
|
1623
|
-
boundary.done && (boundary.signal.aborted ? reject(boundary.signal.reason) : (head = prepareChunk(head), boundary.done && resolve(flushChunk(head))));
|
|
1627
|
+
boundary.done && (boundary.signal.aborted ? reject(boundary.signal.reason) : (head = prepareChunk(head), boundary.done && resolve(flushChunk(head, !0))));
|
|
1624
1628
|
})();
|
|
1625
1629
|
});
|
|
1626
1630
|
}
|
|
@@ -1639,7 +1643,7 @@ var ServerRenderResult = class {
|
|
|
1639
1643
|
head = prepareChunk(head);
|
|
1640
1644
|
}
|
|
1641
1645
|
if (write2 || boundary.done) {
|
|
1642
|
-
let html = flushChunk(head);
|
|
1646
|
+
let html = flushChunk(head, boundary.done);
|
|
1643
1647
|
html && onWrite(html), boundary.done ? (tick2 || offTick(onNext), onClose()) : tick2 = !0;
|
|
1644
1648
|
} else tick2 && (tick2 = !1, queueTick(onNext));
|
|
1645
1649
|
};
|
|
@@ -1649,7 +1653,7 @@ var ServerRenderResult = class {
|
|
|
1649
1653
|
let head = this.#head;
|
|
1650
1654
|
if (!head) throw new Error("Cannot read from a consumed render result");
|
|
1651
1655
|
if (head.next) throw new Error("Cannot fork in sync mode");
|
|
1652
|
-
return this.#head = null, flushChunk(prepareChunk(head));
|
|
1656
|
+
return this.#head = null, flushChunk(prepareChunk(head), !0);
|
|
1653
1657
|
}
|
|
1654
1658
|
};
|
|
1655
1659
|
export {
|
|
@@ -1699,5 +1703,6 @@ export {
|
|
|
1699
1703
|
write,
|
|
1700
1704
|
writeEffect,
|
|
1701
1705
|
writeExistingScope,
|
|
1702
|
-
writeScope
|
|
1706
|
+
writeScope,
|
|
1707
|
+
writeTrailers
|
|
1703
1708
|
};
|