reactive-md 0.9.0 → 0.9.1
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/CHANGELOG-ch.md +13 -0
- package/CHANGELOG.md +13 -0
- package/README-ch.md +6 -6
- package/README-en.md +6 -6
- package/README.md +6 -6
- package/SECURITY-ch.md +3 -3
- package/SECURITY.md +3 -3
- package/THIRD_PARTY_NOTICES.md +111 -1
- package/cli/build.mjs +1 -0
- package/cli/init.mjs +1 -1
- package/dist-library/{LocalDocumentView-K7Y-2bRJ.js → LocalDocumentView-sthUP0ct.js} +10 -10
- package/dist-library/LocalDocumentViewCore-GiWV3bey.js +9829 -0
- package/dist-library/LocalReactiveDocumentCore-ZjQSGyHE.js +275 -0
- package/dist-library/{authoring-Co_TiE-P.js → authoring-Dsune4Hy.js} +40 -20
- package/dist-library/{compile-LhpTKqCR.js → compile-wUv8KEge.js} +1 -1
- package/dist-library/{compiler-core-DTxY-qYz.js → compiler-core-As_m-MNm.js} +2449 -1742
- package/dist-library/{compiler-DfGbQhyD.js → compiler-eOfcinZs.js} +19 -19
- package/dist-library/{component-state-BBJ08vML.js → component-state-C52ZFJGl.js} +1 -1
- package/dist-library/{config-BUo-8O5C.js → config-BadfhjdP.js} +1 -1
- package/dist-library/{config-validation-C5kJYk-J.js → config-validation-F47AcE6o.js} +49 -1
- package/dist-library/{controls-BWiLLtBO.js → controls-CcT6n7k_.js} +2433 -2409
- package/dist-library/{coordinate-BSl6enWV.js → coordinate-CWS9p5q_.js} +108 -107
- package/dist-library/{data-table-DfvytZKQ.js → data-table-Bgccxd7h.js} +68 -65
- package/dist-library/{display-lw3BT1TA.js → display-B-VhqVND.js} +1 -1
- package/dist-library/{export-C7IDW9ul.js → export-BqVmTXm8.js} +145 -87
- package/dist-library/{gallery-B8kSt1oI.js → gallery-CY6mTx8i.js} +151 -147
- package/dist-library/html-CNT4KD-2.js +757 -0
- package/dist-library/{incremental-D_6vwAAE.js → incremental-Dv0FSp_U.js} +404 -142
- package/dist-library/layout-C0YlEPGr.js +562 -0
- package/dist-library/{mount-preset-C5s9ebEH.js → mount-preset-KxvtKgJb.js} +2 -2
- package/dist-library/options-1aDLK7JY.js +121 -0
- package/dist-library/{package-core-D0POW4Gd.js → package-core-WFK1RhAZ.js} +3 -3
- package/dist-library/{parser-standard-OToYcOBL.js → parser-standard-Yuf3A_VI.js} +3270 -3778
- package/dist-library/react-D5iGiUdL.js +7 -0
- package/dist-library/reactive-md-authoring.js +16 -18
- package/dist-library/reactive-md-build.js +51 -51
- package/dist-library/reactive-md-compiler-standard.js +10 -9
- package/dist-library/reactive-md-compiler.js +3 -3
- package/dist-library/reactive-md-export.js +4 -4
- package/dist-library/reactive-md-minimal-react-preset.js +3 -3
- package/dist-library/reactive-md-pdf.js +127 -3
- package/dist-library/reactive-md-plugin-chart.js +2 -2
- package/dist-library/reactive-md-plugin-data.js +4 -4
- package/dist-library/reactive-md-plugin-diagram.js +3 -3
- package/dist-library/reactive-md-plugin-forms.js +2 -2
- package/dist-library/reactive-md-plugin-gallery.js +2 -2
- package/dist-library/reactive-md-plugin-navigation.js +2 -2
- package/dist-library/reactive-md-plugin-network.js +117 -115
- package/dist-library/reactive-md-plugin-plot.js +3 -3
- package/dist-library/reactive-md-react-minimal.js +4 -4
- package/dist-library/reactive-md-react-server.js +6 -6
- package/dist-library/reactive-md-react-unstyled.js +10 -11
- package/dist-library/reactive-md-react.js +10 -11
- package/dist-library/reactive-md-sdk.js +3 -3
- package/dist-library/reactive-md-standalone-configured.js +2 -2
- package/dist-library/reactive-md-standalone-host.js +2 -2
- package/dist-library/reactive-md-testing-browser.js +2 -2
- package/dist-library/reactive-md-testing-react.js +6 -6
- package/dist-library/reactive-md-testing.js +4 -4
- package/dist-library/reactive-md.js +280 -193
- package/dist-library/{registry-05JiqmEp.js → registry-B9NGct4d.js} +1 -1
- package/dist-library/{resources-IeJomeUT.js → resources-D2GDQS0p.js} +1 -1
- package/dist-library/{runtime-CuOyRe9f.js → runtime-kcA7bG7G.js} +341 -341
- package/dist-library/{schema-C-AeByPp.js → schema-BufhKUSM.js} +5 -5
- package/dist-library/{sdk-core-BJLJaVR5.js → sdk-core-BoJT1SIt.js} +490 -150
- package/dist-library/{session-core-BGka5D1J.js → session-core-nmJHuR9c.js} +170 -156
- package/dist-library/{shareable-jkGi2g6y.js → shareable-DpbE-59H.js} +207 -242
- package/dist-library/types/authoring/catalog.d.ts +1 -2
- package/dist-library/types/components/shared/visual-frame.d.ts +6 -2
- package/dist-library/types/local/compilation/compiler-capabilities.d.ts +3 -0
- package/dist-library/types/local/compilation/compiler-core.d.ts +11 -3
- package/dist-library/types/local/compilation/compiler-services.d.ts +8 -4
- package/dist-library/types/local/compilation/compiler.d.ts +3 -3
- package/dist-library/types/local/compilation/session/incremental.d.ts +20 -5
- package/dist-library/types/local/compilation/streaming.d.ts +27 -0
- package/dist-library/types/local/configuration/capability-policy.d.ts +3 -0
- package/dist-library/types/local/configuration/diagnostic-messages.d.ts +48 -0
- package/dist-library/types/local/configuration/options-core.d.ts +1 -2
- package/dist-library/types/local/configuration/options.d.ts +1 -0
- package/dist-library/types/local/css/author-css.d.ts +66 -0
- package/dist-library/types/local/html/extended-fragment.d.ts +41 -0
- package/dist-library/types/local/html/html.d.ts +39 -3
- package/dist-library/types/local/index.d.ts +1 -1
- package/dist-library/types/local/parsing/author-markdown.d.ts +11 -0
- package/dist-library/types/local/parsing/parse-session.d.ts +2 -2
- package/dist-library/types/local/parsing/parser-convert.d.ts +2 -1
- package/dist-library/types/local/parsing/parser-core.d.ts +8 -1
- package/dist-library/types/local/parsing/parser.d.ts +2 -2
- package/dist-library/types/local/rendering/document/ExtendedHtmlFragment.d.ts +14 -0
- package/dist-library/types/local/rendering/document/LocalDocumentViewCore.d.ts +25 -1
- package/dist-library/types/local/rendering/document/LocalReactiveDocumentCore.d.ts +1 -1
- package/dist-library/types/local/rendering/document/use-author-script.d.ts +3 -0
- package/dist-library/types/local/rendering/document/view-render-context.d.ts +11 -1
- package/dist-library/types/local/runtime/author-script-protocol.d.ts +59 -0
- package/dist-library/types/local/transport/worker.d.ts +27 -4
- package/dist-library/types/local/types.d.ts +52 -16
- package/dist-library/types/react/component-api.d.ts +10 -1
- package/dist-library/types/react/component-utils.d.ts +9 -1
- package/dist-library/types/react/sdk-core.d.ts +4 -1
- package/dist-library/types/shareable.d.ts +5 -4
- package/dist-library/types/standalone/prepare.d.ts +1 -1
- package/dist-library/types/standalone/session-core.d.ts +3 -2
- package/dist-library/{types-BFC5rzC4.js → types-BeNtPqdY.js} +1 -1
- package/dist-library/{validation-BlDL2uD9.js → validation-BEBA_HvS.js} +88 -72
- package/dist-library/{visual-frame-G8PHoj1e.js → visual-frame-CyV1FXzs.js} +6 -5
- package/dist-library/{visuals-BkYRmYGO.js → visuals-BZbZYA7w.js} +24181 -24180
- package/dist-standalone/reactive-md-standalone.js +124 -117
- package/docs/README-ch.md +2 -1
- package/docs/README.md +2 -1
- package/docs/compatibility/compatibility-ch.md +6 -6
- package/docs/compatibility/compatibility-en.md +6 -6
- package/docs/compatibility/source-versioning-ch.md +1 -1
- package/docs/compatibility/source-versioning-en.md +1 -1
- package/docs/development/component-development-ch.md +2 -2
- package/docs/development/component-development-en.md +2 -2
- package/docs/development/component-development-reference-ch.md +2 -2
- package/docs/development/component-development-reference-en.md +2 -2
- package/docs/development/component-protocol-ch.md +2 -2
- package/docs/development/component-protocol-en.md +2 -2
- package/docs/development/extension-tutorial-ch.md +3 -3
- package/docs/development/extension-tutorial-en.md +3 -3
- package/docs/integration/author-tools-ch.md +1 -1
- package/docs/integration/author-tools-en.md +1 -1
- package/docs/integration/compiler-ch.md +3 -1
- package/docs/integration/compiler-en.md +3 -1
- package/docs/integration/editor-ch.md +3 -3
- package/docs/integration/editor-en.md +3 -3
- package/docs/integration/extension-sdk-ch.md +2 -2
- package/docs/integration/extension-sdk-en.md +2 -2
- package/docs/integration/local-integration-ch.md +130 -8
- package/docs/integration/local-integration-en.md +130 -8
- package/docs/integration/shareable-export-ch.md +4 -2
- package/docs/integration/shareable-export-en.md +4 -2
- package/docs/reference/html-compatibility-ch.md +20 -67
- package/docs/reference/html-compatibility-en.md +19 -64
- package/docs/reference/public-api-ch.md +10 -7
- package/docs/reference/public-api-en.md +10 -7
- package/docs/releases/release-0.9.1-ch.md +29 -0
- package/docs/releases/release-0.9.1-en.md +29 -0
- package/examples/component-package/README-ch.md +1 -1
- package/examples/component-package/README.md +1 -1
- package/examples/game-2048-package/README-ch.md +1 -1
- package/examples/game-2048-package/README.md +1 -1
- package/examples/integration/README-ch.md +21 -2
- package/examples/integration/README.md +21 -2
- package/examples/integration/extension-sdk/README-ch.md +1 -1
- package/examples/integration/extension-sdk/README.md +1 -1
- package/examples/integration/streaming/index.html +48 -0
- package/examples/integration/streaming/main.js +175 -0
- package/examples/integration/streaming/package.json +13 -0
- package/examples/integration/streaming/worker.js +3 -0
- package/examples/minimal-extension/README-ch.md +3 -3
- package/examples/minimal-extension/README.md +3 -3
- package/examples/tetris-package/README-ch.md +1 -1
- package/examples/tetris-package/README.md +1 -1
- package/package.json +6 -1
- package/dist-library/LocalDocumentViewCore-BLG4hMuO.js +0 -9535
- package/dist-library/LocalReactiveDocumentCore-DVQ6WA9G.js +0 -259
- package/dist-library/component-utils-BvHL8VGt.js +0 -298
- package/dist-library/layout-C22VjZh0.js +0 -542
- package/dist-library/options-CdSKOi7p.js +0 -116
- package/dist-library/react-LY5qsVeP.js +0 -7
|
@@ -1,15 +1,205 @@
|
|
|
1
1
|
import { r as e } from "./latex-1w7aQgD5.js";
|
|
2
2
|
import "./preset-core-CKc5YXSM.js";
|
|
3
|
-
import { t } from "./compile-
|
|
4
|
-
import {
|
|
5
|
-
import { n as
|
|
6
|
-
import { i, n as
|
|
7
|
-
import { s } from "./config-
|
|
8
|
-
import {
|
|
9
|
-
import { n as
|
|
10
|
-
import { c as
|
|
3
|
+
import { t } from "./compile-wUv8KEge.js";
|
|
4
|
+
import { d as n, f as r } from "./compiler-core-As_m-MNm.js";
|
|
5
|
+
import { n as i } from "./display-B-VhqVND.js";
|
|
6
|
+
import { i as a, n as o, r as s } from "./parser-standard-Yuf3A_VI.js";
|
|
7
|
+
import { s as c } from "./config-BadfhjdP.js";
|
|
8
|
+
import { r as l, t as u } from "./options-1aDLK7JY.js";
|
|
9
|
+
import { n as d } from "./compiler-eOfcinZs.js";
|
|
10
|
+
import { c as f, r as p } from "./schema-BufhKUSM.js";
|
|
11
|
+
function m(e, t) {
|
|
12
|
+
if (typeof t != "string" || t.length > 1e6) return !0;
|
|
13
|
+
if (e.severity !== "error") return !1;
|
|
14
|
+
let n = e.code, r = (e) => n === e || n.startsWith(`${e}.`);
|
|
15
|
+
return r("local.options") || r("local.budget") || r("local.version") || r("local.html") || r("local.parse") || r("local.security") || r("local.config") || r("local.registry") || r("local.capability");
|
|
16
|
+
}
|
|
17
|
+
function h(e, t) {
|
|
18
|
+
let n = e.filter((e) => !m(e, t)), r = [];
|
|
19
|
+
for (let i of e) m(i, t) && (i.code === "local.html" && n.some((e) => e.range.start === i.range.start && e.range.end === i.range.end) ? n.push(i) : r.push(i));
|
|
20
|
+
return {
|
|
21
|
+
definite: r,
|
|
22
|
+
transient: n
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function g(e) {
|
|
26
|
+
return `${e.code}:${e.range.start}:${e.range.end}`;
|
|
27
|
+
}
|
|
28
|
+
function _(e, t) {
|
|
29
|
+
return e.range.start - t.range.start || e.range.end - t.range.end || e.line - t.line || e.column - t.column || (e.code < t.code ? -1 : +(e.code > t.code));
|
|
30
|
+
}
|
|
31
|
+
function v(e) {
|
|
32
|
+
let t = /* @__PURE__ */ new Map();
|
|
33
|
+
for (let n of e) for (let e of n) {
|
|
34
|
+
let n = g(e);
|
|
35
|
+
t.has(n) || t.set(n, e);
|
|
36
|
+
}
|
|
37
|
+
return [...t.values()].sort(_);
|
|
38
|
+
}
|
|
39
|
+
function y(e, t) {
|
|
40
|
+
let n = t.filter((e) => e.code !== "local.author.unclosed"), r = t.filter((e) => e.code === "local.author.unclosed"), i = new Set(n.map(g));
|
|
41
|
+
return {
|
|
42
|
+
diagnostics: n,
|
|
43
|
+
transientDiagnostics: v([...e, r]).filter((e) => !i.has(g(e)))
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function b(e, t) {
|
|
47
|
+
if (e.length !== t.length) return !1;
|
|
48
|
+
for (let n = 0; n < e.length; n += 1) if (e[n].start !== t[n].start || e[n].end !== t[n].end) return !1;
|
|
49
|
+
return !0;
|
|
50
|
+
}
|
|
51
|
+
function x(e, t) {
|
|
52
|
+
return e.length === 1 && e[0].start === 0 && e[0].end === t;
|
|
53
|
+
}
|
|
54
|
+
function S(e, t, n) {
|
|
55
|
+
for (let r of e) if (r.range.start <= t && r.range.end >= n) return r;
|
|
56
|
+
}
|
|
57
|
+
function C(e, t, n) {
|
|
58
|
+
let r = t.length, i = Math.max(0, Math.min(r, e.range.start)), a = S(n, i, Math.max(i, Math.min(r, e.range.end)));
|
|
59
|
+
if (a) return {
|
|
60
|
+
start: a.range.start,
|
|
61
|
+
end: a.range.end
|
|
62
|
+
};
|
|
63
|
+
let o = i;
|
|
64
|
+
for (; o > 0 && t[o - 1] !== "\n";) --o;
|
|
65
|
+
let s = i;
|
|
66
|
+
for (; s < r && t[s] !== "\n";) s += 1;
|
|
67
|
+
return s < r && (s += 1), s > o ? {
|
|
68
|
+
start: o,
|
|
69
|
+
end: s
|
|
70
|
+
} : {
|
|
71
|
+
start: i,
|
|
72
|
+
end: r
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function w(e, t) {
|
|
76
|
+
let n = t;
|
|
77
|
+
for (let t of e) t.range.start < n && (n = t.range.start);
|
|
78
|
+
return n;
|
|
79
|
+
}
|
|
80
|
+
function T(e, t, n, i, a) {
|
|
81
|
+
let o = [...e];
|
|
82
|
+
for (let e of t) o.push(C(e, i, n?.nodes ?? []));
|
|
83
|
+
let s = r(o, i.length), c = w(t, i.length);
|
|
84
|
+
return a && (s = r([...s, {
|
|
85
|
+
start: c,
|
|
86
|
+
end: i.length
|
|
87
|
+
}], i.length)), b(s, e) && (s = r([...e, {
|
|
88
|
+
start: c,
|
|
89
|
+
end: i.length
|
|
90
|
+
}], i.length)), s;
|
|
91
|
+
}
|
|
92
|
+
function E(e, t) {
|
|
93
|
+
for (let [n, r] of Object.entries(t)) typeof r == "number" && Number.isFinite(r) && (e[n] = (e[n] ?? 0) + r);
|
|
94
|
+
}
|
|
95
|
+
function ee(e, t, n) {
|
|
96
|
+
let r = [], i = [], a = {}, o, s = 0;
|
|
97
|
+
for (let c = 1; c <= 6; c += 1) {
|
|
98
|
+
s = c, o = d(e, t, n, r), E(a, o.timings);
|
|
99
|
+
let l = o.result;
|
|
100
|
+
if (l.ok) {
|
|
101
|
+
let e = y(i, l.diagnostics);
|
|
102
|
+
return {
|
|
103
|
+
result: {
|
|
104
|
+
...l,
|
|
105
|
+
status: "partial",
|
|
106
|
+
...e
|
|
107
|
+
},
|
|
108
|
+
...o.parsed ? { parsed: o.parsed } : {},
|
|
109
|
+
transientDiagnostics: e.transientDiagnostics,
|
|
110
|
+
literalRanges: [...r],
|
|
111
|
+
attempts: s,
|
|
112
|
+
timings: a
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
let { definite: u, transient: f } = h(l.diagnostics, e);
|
|
116
|
+
if (u.length > 0) {
|
|
117
|
+
let e = v([...i, f]);
|
|
118
|
+
return {
|
|
119
|
+
result: {
|
|
120
|
+
ok: !1,
|
|
121
|
+
diagnostics: u,
|
|
122
|
+
...l.recoveries ? { recoveries: [...l.recoveries] } : {},
|
|
123
|
+
status: "failed",
|
|
124
|
+
transientDiagnostics: e
|
|
125
|
+
},
|
|
126
|
+
...o.parsed ? { parsed: o.parsed } : {},
|
|
127
|
+
transientDiagnostics: e,
|
|
128
|
+
literalRanges: [...r],
|
|
129
|
+
attempts: s,
|
|
130
|
+
timings: a
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
if (i.push(f), c === 6) break;
|
|
134
|
+
let p = T(r, f, o.parsed, e, c >= 5);
|
|
135
|
+
if (b(p, r)) break;
|
|
136
|
+
r = p, x(r, e.length);
|
|
137
|
+
}
|
|
138
|
+
if (typeof e == "string" && e.length <= 1e6 && !x(r, e.length)) {
|
|
139
|
+
let o = [{
|
|
140
|
+
start: 0,
|
|
141
|
+
end: e.length
|
|
142
|
+
}], c = d(e, t, n, o);
|
|
143
|
+
if (E(a, c.timings), s += 1, c.result.ok) {
|
|
144
|
+
let e = y(i, c.result.diagnostics);
|
|
145
|
+
return {
|
|
146
|
+
result: {
|
|
147
|
+
...c.result,
|
|
148
|
+
status: "partial",
|
|
149
|
+
...e
|
|
150
|
+
},
|
|
151
|
+
...c.parsed ? { parsed: c.parsed } : {},
|
|
152
|
+
transientDiagnostics: e.transientDiagnostics,
|
|
153
|
+
literalRanges: o,
|
|
154
|
+
attempts: s,
|
|
155
|
+
timings: a
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
let { definite: l, transient: u } = h(c.result.diagnostics, e), f = v([...i, u]);
|
|
159
|
+
if (l.length > 0) return {
|
|
160
|
+
result: {
|
|
161
|
+
ok: !1,
|
|
162
|
+
diagnostics: l,
|
|
163
|
+
...c.result.recoveries ? { recoveries: [...c.result.recoveries] } : {},
|
|
164
|
+
status: "failed",
|
|
165
|
+
transientDiagnostics: f
|
|
166
|
+
},
|
|
167
|
+
...c.parsed ? { parsed: c.parsed } : {},
|
|
168
|
+
transientDiagnostics: f,
|
|
169
|
+
literalRanges: o,
|
|
170
|
+
attempts: s,
|
|
171
|
+
timings: a
|
|
172
|
+
};
|
|
173
|
+
r = o;
|
|
174
|
+
}
|
|
175
|
+
let c = o, l = v(i);
|
|
176
|
+
return {
|
|
177
|
+
result: {
|
|
178
|
+
ok: !1,
|
|
179
|
+
diagnostics: c !== void 0 && c.result.ok === !1 && c.result.diagnostics.length > 0 ? [...c.result.diagnostics] : l.length > 0 ? l : [{
|
|
180
|
+
code: "local.parse",
|
|
181
|
+
message: "The streaming snapshot could not be compiled.",
|
|
182
|
+
severity: "error",
|
|
183
|
+
range: {
|
|
184
|
+
start: 0,
|
|
185
|
+
end: 0
|
|
186
|
+
},
|
|
187
|
+
line: 1,
|
|
188
|
+
column: 1
|
|
189
|
+
}],
|
|
190
|
+
...c?.result.recoveries ? { recoveries: [...c.result.recoveries] } : {},
|
|
191
|
+
status: "failed",
|
|
192
|
+
transientDiagnostics: l
|
|
193
|
+
},
|
|
194
|
+
...c?.parsed ? { parsed: c.parsed } : {},
|
|
195
|
+
transientDiagnostics: l,
|
|
196
|
+
literalRanges: [...r],
|
|
197
|
+
attempts: s,
|
|
198
|
+
timings: a
|
|
199
|
+
};
|
|
200
|
+
}
|
|
11
201
|
// src/local/compilation/session/semantic-cache.ts
|
|
12
|
-
var
|
|
202
|
+
var D = () => ({
|
|
13
203
|
expressionsCompiled: 0,
|
|
14
204
|
expressionsReused: 0,
|
|
15
205
|
typesInferred: 0,
|
|
@@ -22,18 +212,18 @@ var p = () => ({
|
|
|
22
212
|
formulasReused: 0,
|
|
23
213
|
displaysInspected: 0,
|
|
24
214
|
displaysReused: 0
|
|
25
|
-
}),
|
|
215
|
+
}), te = class {
|
|
26
216
|
capacity;
|
|
27
217
|
maxWeight;
|
|
28
218
|
key;
|
|
29
219
|
values = /* @__PURE__ */ new Map();
|
|
30
220
|
weight = 0;
|
|
31
|
-
counts =
|
|
221
|
+
counts = D();
|
|
32
222
|
constructor(e = 16384, t = 8e6) {
|
|
33
223
|
this.capacity = e, this.maxWeight = t;
|
|
34
224
|
}
|
|
35
225
|
begin(e) {
|
|
36
|
-
this.key !== e && (this.clear(), this.key = e), this.counts =
|
|
226
|
+
this.key !== e && (this.clear(), this.key = e), this.counts = D();
|
|
37
227
|
}
|
|
38
228
|
get stats() {
|
|
39
229
|
return {
|
|
@@ -42,7 +232,7 @@ var p = () => ({
|
|
|
42
232
|
};
|
|
43
233
|
}
|
|
44
234
|
clear() {
|
|
45
|
-
this.values.clear(), this.weight = 0, this.key = void 0, this.counts =
|
|
235
|
+
this.values.clear(), this.weight = 0, this.key = void 0, this.counts = D();
|
|
46
236
|
}
|
|
47
237
|
get(e) {
|
|
48
238
|
let t = this.values.get(e);
|
|
@@ -91,16 +281,16 @@ var p = () => ({
|
|
|
91
281
|
return this.counts.formulasCompiled++, this.put(n, i), i;
|
|
92
282
|
}
|
|
93
283
|
display(e, t) {
|
|
94
|
-
let n = "display:" + JSON.stringify([e, t]),
|
|
95
|
-
if (
|
|
96
|
-
let a =
|
|
284
|
+
let n = "display:" + JSON.stringify([e, t]), r = this.get(n);
|
|
285
|
+
if (r) return this.counts.displaysReused++, r;
|
|
286
|
+
let a = i(e, t);
|
|
97
287
|
return this.counts.displaysInspected++, this.put(n, a), a;
|
|
98
288
|
}
|
|
99
|
-
},
|
|
100
|
-
function
|
|
289
|
+
}, ne = 128, re = 512, ie = 32, ae = 131072, O = (e) => JSON.parse(JSON.stringify(e));
|
|
290
|
+
function oe(e) {
|
|
101
291
|
return typeof e == "object" && !!e && e.strict === !1;
|
|
102
292
|
}
|
|
103
|
-
var
|
|
293
|
+
var k = class {
|
|
104
294
|
limit;
|
|
105
295
|
byteLimit;
|
|
106
296
|
entries = /* @__PURE__ */ new Map();
|
|
@@ -128,13 +318,13 @@ var x = class {
|
|
|
128
318
|
clear() {
|
|
129
319
|
this.entries.clear(), this.bytes = 0;
|
|
130
320
|
}
|
|
131
|
-
},
|
|
321
|
+
}, se = class {
|
|
132
322
|
disposed = !1;
|
|
133
323
|
optionKey;
|
|
134
324
|
recoveryMode;
|
|
135
|
-
plans = new
|
|
136
|
-
inline = new
|
|
137
|
-
trees = new
|
|
325
|
+
plans = new k(ne, 524288);
|
|
326
|
+
inline = new k(re, 262144);
|
|
327
|
+
trees = new k(ie, 524288);
|
|
138
328
|
counts = {
|
|
139
329
|
hits: 0,
|
|
140
330
|
misses: 0,
|
|
@@ -145,10 +335,10 @@ var x = class {
|
|
|
145
335
|
reusedItemNodes: 0,
|
|
146
336
|
reusedAst: 0
|
|
147
337
|
};
|
|
148
|
-
parse(e, t, n, r) {
|
|
338
|
+
parse(e, t, n, r, i) {
|
|
149
339
|
if (this.disposed) throw Error("Local parse session is disposed");
|
|
150
|
-
let
|
|
151
|
-
return (
|
|
340
|
+
let a = u(t), o = oe(t);
|
|
341
|
+
return (a !== this.optionKey || o !== this.recoveryMode) && (this.optionKey = a, this.recoveryMode = o, this.reset()), i && i.length > 0 ? f(e, t, n, void 0, void 0, i) : f(e, t, n, this, r);
|
|
152
342
|
}
|
|
153
343
|
clear() {
|
|
154
344
|
this.optionKey = void 0, this.recoveryMode = void 0, this.reset();
|
|
@@ -193,9 +383,9 @@ var x = class {
|
|
|
193
383
|
return this.lookup(this.inline, e);
|
|
194
384
|
}
|
|
195
385
|
writeInline(e, t) {
|
|
196
|
-
e.length >
|
|
386
|
+
e.length > ae || this.inline.write(O(e), t?.map((e) => ({
|
|
197
387
|
...e,
|
|
198
|
-
value:
|
|
388
|
+
value: O(e.value)
|
|
199
389
|
})));
|
|
200
390
|
}
|
|
201
391
|
notePlanReuse() {
|
|
@@ -217,8 +407,8 @@ var x = class {
|
|
|
217
407
|
let r = e.read(t);
|
|
218
408
|
return r.hit ? (this.counts.hits += 1, n && (this.counts.reusedAst += 1)) : this.counts.misses += 1, r;
|
|
219
409
|
}
|
|
220
|
-
},
|
|
221
|
-
function
|
|
410
|
+
}, A = /* @__PURE__ */ new WeakSet();
|
|
411
|
+
function j(e, t) {
|
|
222
412
|
let n = 0, r = 0, i = /* @__PURE__ */ new WeakMap(), a = [], o = (e, t, n) => {
|
|
223
413
|
e && (Object.defineProperty(e.output, t, {
|
|
224
414
|
value: n,
|
|
@@ -229,7 +419,7 @@ function w(e, t) {
|
|
|
229
419
|
}, s = (e, t, r, o) => {
|
|
230
420
|
if (typeof t != "object" || !t) return t;
|
|
231
421
|
if (e === t) return n++, e;
|
|
232
|
-
if (e === void 0 &&
|
|
422
|
+
if (e === void 0 && A.has(t)) return n++, t;
|
|
233
423
|
if (i.has(t)) return i.get(t);
|
|
234
424
|
let s = Array.isArray(t), c = typeof e == "object" && e && Array.isArray(e) === s ? e : void 0, l = Object.keys(t), u = c ? Object.keys(c) : [], d = s ? Array(t.length) : {};
|
|
235
425
|
i.set(t, d);
|
|
@@ -256,7 +446,7 @@ function w(e, t) {
|
|
|
256
446
|
}
|
|
257
447
|
a.pop();
|
|
258
448
|
let t;
|
|
259
|
-
e.equal ? (t = e.before, n++) : (r++, t = Object.isFrozen(e.after) ? Object.freeze(e.output) : e.output,
|
|
449
|
+
e.equal ? (t = e.before, n++) : (r++, t = Object.isFrozen(e.after) ? Object.freeze(e.output) : e.output, A.add(t)), i.set(e.after, t), e.parent ? o(e.parent, e.key, t) : c = t;
|
|
260
450
|
}
|
|
261
451
|
return {
|
|
262
452
|
value: c,
|
|
@@ -264,7 +454,7 @@ function w(e, t) {
|
|
|
264
454
|
created: r
|
|
265
455
|
};
|
|
266
456
|
}
|
|
267
|
-
function
|
|
457
|
+
function ce(e, t) {
|
|
268
458
|
if (!e?.ok || !t.ok) return 0;
|
|
269
459
|
let n = /* @__PURE__ */ new Set(), r = [...e.document.nodes];
|
|
270
460
|
for (; r.length;) {
|
|
@@ -279,7 +469,7 @@ function T(e, t) {
|
|
|
279
469
|
return i;
|
|
280
470
|
}
|
|
281
471
|
// src/local/compilation/session/row-reuse.ts
|
|
282
|
-
function
|
|
472
|
+
function M(e) {
|
|
283
473
|
if (e.nodes.length !== 1) return;
|
|
284
474
|
let t = e.nodes[0], n, r;
|
|
285
475
|
if (t.type === "list") n = "item", r = "listItem";
|
|
@@ -305,25 +495,25 @@ function E(e) {
|
|
|
305
495
|
rows: a
|
|
306
496
|
};
|
|
307
497
|
}
|
|
308
|
-
function
|
|
498
|
+
function N(e, t) {
|
|
309
499
|
if (e === t) return !0;
|
|
310
500
|
if (typeof e != "object" || typeof t != "object" || e === null || t === null || Array.isArray(e) !== Array.isArray(t)) return !1;
|
|
311
501
|
let n = Object.keys(e), r = Object.keys(t);
|
|
312
502
|
if (n.length !== r.length) return !1;
|
|
313
|
-
for (let r of n) if (!Object.hasOwn(t, r) || !
|
|
503
|
+
for (let r of n) if (!Object.hasOwn(t, r) || !N(e[r], t[r])) return !1;
|
|
314
504
|
return !0;
|
|
315
505
|
}
|
|
316
|
-
function
|
|
506
|
+
function P(e, t, n, r) {
|
|
317
507
|
if (e.type !== t.type || e.range.start - n !== t.range.start - r || e.range.end - n !== t.range.end - r) return !1;
|
|
318
508
|
let i = Object.keys(e), a = Object.keys(t);
|
|
319
509
|
if (i.length !== a.length) return !1;
|
|
320
|
-
for (let n of i) if (n !== "id" && n !== "range" && n !== "children" && (!Object.hasOwn(t, n) || !
|
|
510
|
+
for (let n of i) if (n !== "id" && n !== "range" && n !== "children" && (!Object.hasOwn(t, n) || !N(e[n], t[n]))) return !1;
|
|
321
511
|
let o = e.children ?? [], s = t.children ?? [];
|
|
322
512
|
if (o.length !== s.length) return !1;
|
|
323
|
-
for (let e = 0; e < o.length; e++) if (!
|
|
513
|
+
for (let e = 0; e < o.length; e++) if (!P(o[e], s[e], n, r)) return !1;
|
|
324
514
|
return !0;
|
|
325
515
|
}
|
|
326
|
-
function
|
|
516
|
+
function F(e, t) {
|
|
327
517
|
let n = {
|
|
328
518
|
...e,
|
|
329
519
|
range: {
|
|
@@ -331,14 +521,14 @@ function k(e, t) {
|
|
|
331
521
|
end: e.range.end + t
|
|
332
522
|
}
|
|
333
523
|
};
|
|
334
|
-
return e.attrs && (n.attrs = { ...e.attrs }), e.align && (n.align = [...e.align]), e.children && (n.children = e.children.map((e) =>
|
|
524
|
+
return e.attrs && (n.attrs = { ...e.attrs }), e.align && (n.align = [...e.align]), e.children && (n.children = e.children.map((e) => F(e, t))), n;
|
|
335
525
|
}
|
|
336
|
-
function
|
|
337
|
-
if (t.add(e.id), e.children) for (let n of e.children)
|
|
526
|
+
function I(e, t) {
|
|
527
|
+
if (t.add(e.id), e.children) for (let n of e.children) I(n, t);
|
|
338
528
|
}
|
|
339
|
-
function
|
|
529
|
+
function le(e, t) {
|
|
340
530
|
if (!e) return;
|
|
341
|
-
let n =
|
|
531
|
+
let n = M(e), r = M(t);
|
|
342
532
|
if (!n || !r || n.kind !== r.kind) return;
|
|
343
533
|
let i = n.rows, a = r.rows, o = Math.min(i.length, a.length), s = 0;
|
|
344
534
|
for (; s < o && i[s].text === a[s].text;) s += 1;
|
|
@@ -349,9 +539,9 @@ function j(e, t) {
|
|
|
349
539
|
let n;
|
|
350
540
|
if (t < s ? n = t : t >= a.length - c && (n = i.length - (a.length - t)), n === void 0) return e.node;
|
|
351
541
|
let r = i[n];
|
|
352
|
-
if (!
|
|
353
|
-
let o = e.node.range.start - r.node.range.start, d = o === 0 ? r.node :
|
|
354
|
-
return u += 1,
|
|
542
|
+
if (!P(r.node, e.node, r.node.range.start, e.node.range.start)) return e.node;
|
|
543
|
+
let o = e.node.range.start - r.node.range.start, d = o === 0 ? r.node : F(r.node, o);
|
|
544
|
+
return u += 1, I(d, l), d;
|
|
355
545
|
});
|
|
356
546
|
if (!u) return;
|
|
357
547
|
let f = {
|
|
@@ -367,14 +557,42 @@ function j(e, t) {
|
|
|
367
557
|
};
|
|
368
558
|
}
|
|
369
559
|
// src/local/compilation/session/incremental.ts
|
|
370
|
-
function
|
|
560
|
+
function L(e) {
|
|
371
561
|
return typeof e == "object" && !!e && e.strict === !1;
|
|
372
562
|
}
|
|
373
|
-
function
|
|
563
|
+
function R(e) {
|
|
374
564
|
return Object.hasOwn(e, "recoveries") && e.recoveries !== void 0;
|
|
375
565
|
}
|
|
376
|
-
|
|
377
|
-
|
|
566
|
+
function z(e) {
|
|
567
|
+
return e === "streaming" || e === "final" ? e : void 0;
|
|
568
|
+
}
|
|
569
|
+
function ue() {
|
|
570
|
+
return {
|
|
571
|
+
ok: !1,
|
|
572
|
+
status: "failed",
|
|
573
|
+
diagnostics: [{
|
|
574
|
+
code: "local.options.invalid",
|
|
575
|
+
message: "Compile option sourcePhase must be \"streaming\" or \"final\".",
|
|
576
|
+
severity: "error",
|
|
577
|
+
range: {
|
|
578
|
+
start: 0,
|
|
579
|
+
end: 0
|
|
580
|
+
},
|
|
581
|
+
line: 1,
|
|
582
|
+
column: 1,
|
|
583
|
+
messageKey: "local.options.invalid.source-phase"
|
|
584
|
+
}]
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
function de(e) {
|
|
588
|
+
try {
|
|
589
|
+
return typeof e == "object" && e ? z(e.sourcePhase) : void 0;
|
|
590
|
+
} catch {
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
var B = s.configure(o), V = "\n\n<!-- incremental-boundary -->\n\n";
|
|
595
|
+
function H(e) {
|
|
378
596
|
let t = [], n = [...e].reverse();
|
|
379
597
|
for (; n.length;) {
|
|
380
598
|
let e = n.pop();
|
|
@@ -382,7 +600,7 @@ function I(e) {
|
|
|
382
600
|
}
|
|
383
601
|
return t;
|
|
384
602
|
}
|
|
385
|
-
function
|
|
603
|
+
function U(e, t, n) {
|
|
386
604
|
return t === 0 && !n ? e : e.map((e) => ({
|
|
387
605
|
...e,
|
|
388
606
|
id: n?.get(e.id) ?? e.id,
|
|
@@ -392,18 +610,22 @@ function L(e, t, n) {
|
|
|
392
610
|
},
|
|
393
611
|
...e.attrs ? { attrs: { ...e.attrs } } : {},
|
|
394
612
|
...e.align ? { align: [...e.align] } : {},
|
|
395
|
-
...e.children ? { children:
|
|
613
|
+
...e.children ? { children: U(e.children, t, n) } : {}
|
|
396
614
|
}));
|
|
397
615
|
}
|
|
398
|
-
function
|
|
616
|
+
function W(e, t, n) {
|
|
399
617
|
let r = Object.create(null);
|
|
400
|
-
for (let i of
|
|
618
|
+
for (let i of H(e)) r[n?.get(i.id) ?? i.id] = t.dependencies?.[i.id] ?? null;
|
|
401
619
|
return r;
|
|
402
620
|
}
|
|
403
|
-
function
|
|
621
|
+
function G(e) {
|
|
404
622
|
let t = !1;
|
|
405
|
-
for (let n of
|
|
623
|
+
for (let n of H([e])) {
|
|
406
624
|
if ([
|
|
625
|
+
"authorCss",
|
|
626
|
+
"authorJavaScript",
|
|
627
|
+
"extendedHtmlRaw"
|
|
628
|
+
].includes(n.type) || n.attrs && (Object.hasOwn(n.attrs, "css") || Object.hasOwn(n.attrs, "action-id")) || [
|
|
407
629
|
"definition",
|
|
408
630
|
"footnoteDefinition",
|
|
409
631
|
"footnoteReference",
|
|
@@ -411,19 +633,19 @@ function z(e) {
|
|
|
411
633
|
"imageReference"
|
|
412
634
|
].includes(n.type) || n.type === "hostComponent" || n.type === "htmlDocument" || n.type === "fallback") return "unsupported";
|
|
413
635
|
if (n.type === "component") {
|
|
414
|
-
if (["anchor", "jump"].includes(n.name ?? "") || !
|
|
636
|
+
if (["anchor", "jump"].includes(n.name ?? "") || !p(n.name ?? "")) return "unsupported";
|
|
415
637
|
t = !0;
|
|
416
638
|
}
|
|
417
639
|
n.type === "comment" && (t = !0);
|
|
418
640
|
}
|
|
419
641
|
return t ? "context" : "fragment";
|
|
420
642
|
}
|
|
421
|
-
function
|
|
643
|
+
function K(e, t) {
|
|
422
644
|
let n = "", r = 0;
|
|
423
645
|
for (let i of t) n += e.slice(r, i.from) + i.text.replace(/[^\r\n]/g, " "), r = i.to;
|
|
424
646
|
return n + e.slice(r);
|
|
425
647
|
}
|
|
426
|
-
function
|
|
648
|
+
function q(e, t, n) {
|
|
427
649
|
let r = e.cursor();
|
|
428
650
|
do
|
|
429
651
|
if (r.name === "LinkReference") return null;
|
|
@@ -442,14 +664,14 @@ function V(e, t, n) {
|
|
|
442
664
|
}
|
|
443
665
|
return i;
|
|
444
666
|
}
|
|
445
|
-
function
|
|
667
|
+
function J(e) {
|
|
446
668
|
return /\r(?!\n)/.test(e);
|
|
447
669
|
}
|
|
448
|
-
function
|
|
670
|
+
function fe(e, t) {
|
|
449
671
|
for (; t > 0 && e[t - 1] !== "\n" && e[t - 1] !== "\r";) t--;
|
|
450
672
|
return t;
|
|
451
673
|
}
|
|
452
|
-
function
|
|
674
|
+
function Y(e, t) {
|
|
453
675
|
let n = new Set(t.map((e) => e.from));
|
|
454
676
|
for (let r of t) {
|
|
455
677
|
let t = r.to;
|
|
@@ -464,7 +686,7 @@ function W(e, t) {
|
|
|
464
686
|
}
|
|
465
687
|
return !1;
|
|
466
688
|
}
|
|
467
|
-
function
|
|
689
|
+
function X(e, t, n, r) {
|
|
468
690
|
if (e.type !== n.type || e.range.start + t !== n.range.start + r || e.range.end + t !== n.range.end + r) return !1;
|
|
469
691
|
let i = 0;
|
|
470
692
|
for (let [a, o] of Object.entries(e)) {
|
|
@@ -474,13 +696,13 @@ function G(e, t, n, r) {
|
|
|
474
696
|
if (a === "children") {
|
|
475
697
|
let n = o, i = e;
|
|
476
698
|
if (!i || n.length !== i.length) return !1;
|
|
477
|
-
for (let e = 0; e < n.length; e++) if (!
|
|
699
|
+
for (let e = 0; e < n.length; e++) if (!X(n[e], t, i[e], r)) return !1;
|
|
478
700
|
} else if (o !== e && JSON.stringify(o) !== JSON.stringify(e)) return !1;
|
|
479
701
|
}
|
|
480
702
|
for (let [e, t] of Object.entries(n)) t !== void 0 && e !== "id" && e !== "range" && i--;
|
|
481
703
|
return i === 0;
|
|
482
704
|
}
|
|
483
|
-
function
|
|
705
|
+
function Z(e, t) {
|
|
484
706
|
let n = 0, r = e.length, i = t.length;
|
|
485
707
|
for (; n < r && n < i && e.charCodeAt(n) === t.charCodeAt(n);) n++;
|
|
486
708
|
for (; r > n && i > n && e.charCodeAt(r - 1) === t.charCodeAt(i - 1);) r--, i--;
|
|
@@ -491,19 +713,19 @@ function K(e, t) {
|
|
|
491
713
|
delta: i - r
|
|
492
714
|
};
|
|
493
715
|
}
|
|
494
|
-
function
|
|
716
|
+
function Q(e, t) {
|
|
495
717
|
let n = e.parsed?.plans;
|
|
496
718
|
if (n?.length) {
|
|
497
719
|
for (let e of n) if (e.source === t) return e.rows;
|
|
498
720
|
if (n.length === 1) return n[0].rows;
|
|
499
721
|
}
|
|
500
722
|
}
|
|
501
|
-
var
|
|
723
|
+
var $ = class {
|
|
502
724
|
disposed = !1;
|
|
503
725
|
snapshot = null;
|
|
504
726
|
deferred = null;
|
|
505
|
-
parseSession = new
|
|
506
|
-
semantic = new
|
|
727
|
+
parseSession = new se();
|
|
728
|
+
semantic = new te();
|
|
507
729
|
services = {
|
|
508
730
|
parser: this.parseSession,
|
|
509
731
|
semantic: this.semantic
|
|
@@ -511,6 +733,7 @@ var J = class {
|
|
|
511
733
|
shared = null;
|
|
512
734
|
sharedKey;
|
|
513
735
|
sharedMode;
|
|
736
|
+
streamingCache = null;
|
|
514
737
|
epoch = 0;
|
|
515
738
|
cacheBuilds = 0;
|
|
516
739
|
serial = 0;
|
|
@@ -527,25 +750,64 @@ var J = class {
|
|
|
527
750
|
cacheBuilds: this.cacheBuilds
|
|
528
751
|
};
|
|
529
752
|
}
|
|
530
|
-
compile(e, t) {
|
|
531
|
-
let
|
|
753
|
+
compile(e, t, r) {
|
|
754
|
+
let i = this.compileShared(e, t, r), a = performance.now(), o = n(i);
|
|
532
755
|
return this.lastStats = {
|
|
533
756
|
...this.lastStats,
|
|
534
757
|
stages: {
|
|
535
758
|
...this.lastStats.stages,
|
|
536
|
-
publicSnapshotMs: performance.now() -
|
|
759
|
+
publicSnapshotMs: performance.now() - a
|
|
537
760
|
}
|
|
538
|
-
},
|
|
761
|
+
}, o;
|
|
539
762
|
}
|
|
540
|
-
compileShared(e, t) {
|
|
763
|
+
compileShared(e, t, n) {
|
|
541
764
|
if (this.disposed) throw Error("Local compile session is disposed");
|
|
765
|
+
if (n !== void 0 && z(n) === void 0) return ue();
|
|
766
|
+
let r = z(n) ?? de(t);
|
|
767
|
+
return r === "streaming" ? this.compileStreaming(e, t) : r === "final" ? this.compileFinal(e, t) : this.compileFinalOrLegacy(e, t);
|
|
768
|
+
}
|
|
769
|
+
compileFinal(e, t) {
|
|
770
|
+
let n = this.compileFinalOrLegacy(e, t);
|
|
771
|
+
return n.ok ? {
|
|
772
|
+
...n,
|
|
773
|
+
status: R(n) ? "recovered" : "valid"
|
|
774
|
+
} : {
|
|
775
|
+
...n,
|
|
776
|
+
status: "failed"
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
compileStreaming(e, t) {
|
|
780
|
+
let n = l(t).ok, r = u(t), i = this.streamingCache;
|
|
781
|
+
if (n && i !== null && i.source === e && i.key === r) return this.lastStats = {
|
|
782
|
+
mode: "streaming",
|
|
783
|
+
totalBlocks: i.blocks,
|
|
784
|
+
compiledBlocks: 0,
|
|
785
|
+
reusedBlocks: 0,
|
|
786
|
+
compiledCharacters: 0
|
|
787
|
+
}, i.result;
|
|
788
|
+
let a = ee(e, t, this.services), o = a.parsed?.nodes.length ?? 0;
|
|
789
|
+
return this.lastStats = {
|
|
790
|
+
mode: "streaming",
|
|
791
|
+
totalBlocks: o,
|
|
792
|
+
compiledBlocks: o,
|
|
793
|
+
reusedBlocks: 0,
|
|
794
|
+
compiledCharacters: typeof e == "string" ? e.length : 0,
|
|
795
|
+
stages: a.timings
|
|
796
|
+
}, n && (this.streamingCache = {
|
|
797
|
+
source: e,
|
|
798
|
+
key: r,
|
|
799
|
+
result: a.result,
|
|
800
|
+
blocks: o
|
|
801
|
+
}), a.result;
|
|
802
|
+
}
|
|
803
|
+
compileFinalOrLegacy(e, t) {
|
|
542
804
|
this.epoch++;
|
|
543
|
-
let n =
|
|
805
|
+
let n = u(t), r = L(t);
|
|
544
806
|
(n !== this.sharedKey || r !== this.sharedMode) && (this.shared = null, this.sharedKey = n, this.sharedMode = r);
|
|
545
|
-
let i = this.compileCore(e, t), a = performance.now(), o = this.shared, s =
|
|
807
|
+
let i = this.compileCore(e, t), a = performance.now(), o = this.shared, s = j(o ?? void 0, i).value;
|
|
546
808
|
return this.shared = s, this.lastStats = {
|
|
547
809
|
...this.lastStats,
|
|
548
|
-
sharedNodes:
|
|
810
|
+
sharedNodes: ce(o, s),
|
|
549
811
|
parse: this.parseSession.stats,
|
|
550
812
|
semantic: this.lastStats.semantic ?? this.semantic.stats,
|
|
551
813
|
stages: {
|
|
@@ -557,8 +819,8 @@ var J = class {
|
|
|
557
819
|
compileCore(e, t) {
|
|
558
820
|
if (this.disposed) throw Error("Local compile session is disposed");
|
|
559
821
|
this.cacheBuilds = 0;
|
|
560
|
-
let r =
|
|
561
|
-
if (this.deferred = null, !a && f && f.key === r && i.ok &&
|
|
822
|
+
let r = u(t), i = l(t), a = L(t), o = a ? "recovery-reference" : "initial", s = !1, f = this.deferred;
|
|
823
|
+
if (this.deferred = null, !a && f && f.key === r && i.ok && typeof e == "string" && e.length <= 1e6) {
|
|
562
824
|
if (e === f.source) return this.deferred = f, this.lastStats = {
|
|
563
825
|
mode: "cached",
|
|
564
826
|
totalBlocks: this.lastStats.totalBlocks,
|
|
@@ -566,16 +828,16 @@ var J = class {
|
|
|
566
828
|
reusedBlocks: this.lastStats.totalBlocks,
|
|
567
829
|
compiledCharacters: 0
|
|
568
830
|
}, f.tracked.result;
|
|
569
|
-
|
|
570
|
-
let n =
|
|
571
|
-
if (a && !/[`\\~]/.test(f.source.slice(n.from, n.oldTo) + e.slice(n.from, n.newTo)) && !a.nodes.some((e) => i(e.range) &&
|
|
831
|
+
s = !0, o = "scope-or-boundary";
|
|
832
|
+
let n = Z(f.source, e), i = (e) => n.from <= e.end && n.oldTo >= e.start, a = f.tracked.parsed;
|
|
833
|
+
if (a && !/[`\\~]/.test(f.source.slice(n.from, n.oldTo) + e.slice(n.from, n.newTo)) && !a.nodes.some((e) => i(e.range) && G(e) !== "fragment") && ![a.versionDeclaration?.range, a.themeRange].some((e) => e && i(e))) try {
|
|
572
834
|
this.snapshot = this.seed(f.source, r, f.tracked, t);
|
|
573
835
|
} catch {
|
|
574
836
|
this.snapshot = null;
|
|
575
837
|
}
|
|
576
838
|
} else f && (o = a ? "recovery-reference" : "options-or-limits");
|
|
577
839
|
let p = this.snapshot;
|
|
578
|
-
if (!a && p && p.key === r && i.ok &&
|
|
840
|
+
if (!a && p && p.key === r && i.ok && typeof e == "string" && e.length <= 1e6) {
|
|
579
841
|
if (e === p.source) return this.lastStats = {
|
|
580
842
|
mode: "cached",
|
|
581
843
|
totalBlocks: p.blocks.length,
|
|
@@ -588,10 +850,10 @@ var J = class {
|
|
|
588
850
|
n = this.update(p, e, t, i.maxSyntaxNodes);
|
|
589
851
|
} catch {}
|
|
590
852
|
if (n) return this.snapshot = n, this.publish(n);
|
|
591
|
-
o = "scope-or-boundary",
|
|
853
|
+
o = "scope-or-boundary", s = !0;
|
|
592
854
|
} else p && (o = a ? "recovery-reference" : "options-or-limits");
|
|
593
855
|
this.snapshot = null;
|
|
594
|
-
let m =
|
|
856
|
+
let m = d(e, t, this.services);
|
|
595
857
|
if (this.lastStats = {
|
|
596
858
|
mode: "full",
|
|
597
859
|
totalBlocks: m.parsed?.nodes.length ?? 0,
|
|
@@ -601,13 +863,13 @@ var J = class {
|
|
|
601
863
|
fallbackReason: o,
|
|
602
864
|
semantic: m.semantic,
|
|
603
865
|
stages: m.timings
|
|
604
|
-
}, !a && m.result.ok && m.result.diagnostics.length === 0 && !
|
|
605
|
-
if (
|
|
866
|
+
}, !a && m.result.ok && !m.result.document.capabilities && m.result.diagnostics.length === 0 && !R(m.result) && i.ok && r !== "invalid") {
|
|
867
|
+
if (s) {
|
|
606
868
|
let i = t === void 0 ? void 0 : n(t), a = i;
|
|
607
869
|
if (i?.config !== void 0) try {
|
|
608
870
|
a = {
|
|
609
871
|
...i,
|
|
610
|
-
config:
|
|
872
|
+
config: c(i.config)
|
|
611
873
|
};
|
|
612
874
|
} catch {}
|
|
613
875
|
this.deferred = {
|
|
@@ -626,8 +888,8 @@ var J = class {
|
|
|
626
888
|
return this.snapshot ? this.publish(this.snapshot) : m.result;
|
|
627
889
|
}
|
|
628
890
|
seed(e, t, n, r, i) {
|
|
629
|
-
if (this.cacheBuilds++, !n.result.ok || !n.parsed ||
|
|
630
|
-
let a = n.parsed.nodes, o = a.map(
|
|
891
|
+
if (this.cacheBuilds++, !n.result.ok || !n.parsed || R(n.result) || e.includes("[^") || e.includes("") || J(e)) return null;
|
|
892
|
+
let a = n.parsed.nodes, o = a.map(G), s = a.length === 1 && o[0] === "fragment" && (a[0].type === "list" || a[0].type === "table");
|
|
631
893
|
if (o.includes("unsupported") || !s && o.filter((e) => e === "fragment").length < 2) return null;
|
|
632
894
|
let c = {
|
|
633
895
|
...n.result.document,
|
|
@@ -645,7 +907,7 @@ var J = class {
|
|
|
645
907
|
origin: n.range.start,
|
|
646
908
|
text: e.slice(n.range.start, n.range.end),
|
|
647
909
|
nodes: t,
|
|
648
|
-
dependencies:
|
|
910
|
+
dependencies: W(t, c),
|
|
649
911
|
cost: 0
|
|
650
912
|
});
|
|
651
913
|
}
|
|
@@ -659,10 +921,10 @@ var J = class {
|
|
|
659
921
|
dependencies: {},
|
|
660
922
|
cost: 0
|
|
661
923
|
});
|
|
662
|
-
if (u.sort((e, t) => e.from - t.from),
|
|
663
|
-
let f =
|
|
924
|
+
if (u.sort((e, t) => e.from - t.from), Y(e, u)) return null;
|
|
925
|
+
let f = K(e, u);
|
|
664
926
|
if (f.includes("<")) return null;
|
|
665
|
-
let p = i ??
|
|
927
|
+
let p = i ?? B.parse(f), m = q(p, u, f);
|
|
666
928
|
if (!m) return null;
|
|
667
929
|
let h = [], g = 0;
|
|
668
930
|
for (let t of m) {
|
|
@@ -673,20 +935,20 @@ var J = class {
|
|
|
673
935
|
r.push(e), g++;
|
|
674
936
|
}
|
|
675
937
|
if (!r.length) return null;
|
|
676
|
-
let i = r.flatMap((e) => l.has(e.id) ? [l.get(e.id)] : []), a =
|
|
938
|
+
let i = r.flatMap((e) => l.has(e.id) ? [l.get(e.id)] : []), a = H(i).length, o = e.slice(t.start, t.end);
|
|
677
939
|
h.push({
|
|
678
940
|
from: t.start,
|
|
679
941
|
to: t.end,
|
|
680
942
|
origin: t.start,
|
|
681
943
|
text: o,
|
|
682
944
|
nodes: i,
|
|
683
|
-
dependencies:
|
|
945
|
+
dependencies: W(i, c),
|
|
684
946
|
cost: a,
|
|
685
|
-
rowPlans:
|
|
947
|
+
rowPlans: Q(n, o)
|
|
686
948
|
});
|
|
687
949
|
}
|
|
688
950
|
if (g !== d.length) return null;
|
|
689
|
-
let _ = u.length ? u.map((e) => e.text).join(
|
|
951
|
+
let _ = u.length ? u.map((e) => e.text).join(V) + V : "", v = _ ? this.parseSession.parse(_, r) : null;
|
|
690
952
|
if (v?.diagnostics.length) return null;
|
|
691
953
|
let y = (n.parsed.syntaxNodes ?? 0) - h.reduce((e, t) => e + t.cost, 0);
|
|
692
954
|
return y < 0 ? null : (c.nodes = [], c.source = "", delete c.dependencies, {
|
|
@@ -702,13 +964,13 @@ var J = class {
|
|
|
702
964
|
});
|
|
703
965
|
}
|
|
704
966
|
update(e, t, n, r) {
|
|
705
|
-
if (t.includes("[^") || t.includes("") ||
|
|
706
|
-
let
|
|
707
|
-
if (/[`\\~]/.test(e.source.slice(
|
|
967
|
+
if (t.includes("[^") || t.includes("") || J(t)) return null;
|
|
968
|
+
let i = Z(e.source, t);
|
|
969
|
+
if (/[`\\~]/.test(e.source.slice(i.from, i.oldTo) + t.slice(i.from, i.newTo))) return null;
|
|
708
970
|
let o = [];
|
|
709
971
|
for (let n of e.context) {
|
|
710
|
-
if (
|
|
711
|
-
let e = n.from >=
|
|
972
|
+
if (i.from <= n.to && i.oldTo >= n.from) return null;
|
|
973
|
+
let e = n.from >= i.oldTo ? i.delta : 0, r = {
|
|
712
974
|
...n,
|
|
713
975
|
from: n.from + e,
|
|
714
976
|
to: n.to + e
|
|
@@ -716,38 +978,38 @@ var J = class {
|
|
|
716
978
|
if (t.slice(r.from, r.to) !== n.text) return null;
|
|
717
979
|
o.push(r);
|
|
718
980
|
}
|
|
719
|
-
if (
|
|
720
|
-
let s =
|
|
721
|
-
fromA:
|
|
722
|
-
toA:
|
|
723
|
-
fromB:
|
|
724
|
-
toB:
|
|
725
|
-
}], 0), c =
|
|
981
|
+
if (Y(t, o)) return null;
|
|
982
|
+
let s = a.applyChanges(a.addTree(e.tree), [{
|
|
983
|
+
fromA: i.from,
|
|
984
|
+
toA: i.oldTo,
|
|
985
|
+
fromB: i.from,
|
|
986
|
+
toB: i.newTo
|
|
987
|
+
}], 0), c = K(t, o);
|
|
726
988
|
if (c.includes("<")) return null;
|
|
727
|
-
let l =
|
|
728
|
-
if (!
|
|
989
|
+
let l = B.parse(c, s), u = q(l, o, c);
|
|
990
|
+
if (!u) return null;
|
|
729
991
|
let f = new Map(e.blocks.map((e) => [`${e.from}:${e.to}`, e])), p = [], m = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), g = 0, _ = 0, v = 0, y = e.contextCost;
|
|
730
|
-
for (let
|
|
731
|
-
let o =
|
|
992
|
+
for (let a of u) {
|
|
993
|
+
let o = a.start >= i.newTo ? i.delta : 0, s = a.end <= i.from || a.start >= i.newTo ? f.get(`${a.start - o}:${a.end - o}`) : void 0, c = t.slice(a.start, a.end);
|
|
732
994
|
if (s && s.text === c) {
|
|
733
995
|
p.push({
|
|
734
996
|
...s,
|
|
735
|
-
from:
|
|
736
|
-
to:
|
|
997
|
+
from: a.start,
|
|
998
|
+
to: a.end
|
|
737
999
|
}), g++, y += s.cost;
|
|
738
|
-
for (let e of
|
|
1000
|
+
for (let e of H(s.nodes)) m.add(e.id);
|
|
739
1001
|
} else {
|
|
740
1002
|
let t = e.prefix.length, r = e.blocks.find((e) => {
|
|
741
|
-
let t = e.from >=
|
|
742
|
-
return t <
|
|
1003
|
+
let t = e.from >= i.oldTo ? e.from + i.delta : e.from, n = e.to >= i.oldTo ? e.to + i.delta : e.to;
|
|
1004
|
+
return t < a.end && n > a.start;
|
|
743
1005
|
}), o = r?.rowPlans ? {
|
|
744
1006
|
...this.services,
|
|
745
1007
|
rowPlans: r.rowPlans
|
|
746
|
-
} : this.services, s =
|
|
747
|
-
if (v += t + c.length, _++, !s.result.ok || s.result.diagnostics.length || !s.parsed ||
|
|
1008
|
+
} : this.services, s = d(e.prefix + c, n, o);
|
|
1009
|
+
if (v += t + c.length, _++, !s.result.ok || s.result.diagnostics.length || !s.parsed || R(s.result)) return null;
|
|
748
1010
|
let l = s.parsed.nodes.filter((e) => e.range.start >= t);
|
|
749
|
-
if (!l.length || l.some((e) =>
|
|
750
|
-
let
|
|
1011
|
+
if (!l.length || l.some((e) => G(e) !== "fragment")) return null;
|
|
1012
|
+
let u = s.result.document.nodes.filter((e) => e.range.start >= t), f = new Map(H(u).map((e) => [e.id, `incremental-${++this.serial}-${e.id}`])), g = U(u, 0, f), b = r ? le({
|
|
751
1013
|
text: r.text,
|
|
752
1014
|
origin: r.origin,
|
|
753
1015
|
nodes: r.nodes
|
|
@@ -763,29 +1025,29 @@ var J = class {
|
|
|
763
1025
|
}
|
|
764
1026
|
}
|
|
765
1027
|
let x = b?.nodes ?? g, S = (s.parsed.syntaxNodes ?? 0) - e.prefixCost;
|
|
766
|
-
if (S <
|
|
767
|
-
let C =
|
|
768
|
-
for (let e of
|
|
1028
|
+
if (S < H(x).length) return null;
|
|
1029
|
+
let C = W(u, s.result.document, f), w = Object.create(null);
|
|
1030
|
+
for (let e of H(x)) w[e.id] = C[e.id] ?? null;
|
|
769
1031
|
if (b && r) {
|
|
770
1032
|
let e = r.nodes[0]?.id, t = g[0]?.id;
|
|
771
1033
|
for (let n of b.reusedIds) w[n] = n === e && t !== void 0 ? C[t] ?? null : r.dependencies[n] ?? null, m.add(n);
|
|
772
1034
|
for (let e = 0; e < b.reused; e++) this.parseSession.noteRowReuse(b.kind);
|
|
773
1035
|
}
|
|
774
1036
|
let T = {
|
|
775
|
-
from:
|
|
776
|
-
to:
|
|
1037
|
+
from: a.start,
|
|
1038
|
+
to: a.end,
|
|
777
1039
|
origin: t,
|
|
778
1040
|
text: c,
|
|
779
1041
|
nodes: x,
|
|
780
1042
|
dependencies: w,
|
|
781
1043
|
cost: S,
|
|
782
|
-
rowPlans:
|
|
1044
|
+
rowPlans: Q(s, c)
|
|
783
1045
|
};
|
|
784
1046
|
p.push(T), h.add(T), y += S;
|
|
785
1047
|
}
|
|
786
1048
|
if (y > r) return null;
|
|
787
1049
|
}
|
|
788
|
-
return y > r || !this.sameBoundaries(t, p, o, h,
|
|
1050
|
+
return y > r || !this.sameBoundaries(t, p, o, h, i, n) ? null : (this.lastStats = {
|
|
789
1051
|
mode: "incremental",
|
|
790
1052
|
totalBlocks: p.length,
|
|
791
1053
|
compiledBlocks: _,
|
|
@@ -819,7 +1081,7 @@ var J = class {
|
|
|
819
1081
|
delta: a
|
|
820
1082
|
});
|
|
821
1083
|
}
|
|
822
|
-
let i = r[0], l = r[r.length - 1], u = "node" in i ? Math.max(s[t].from,
|
|
1084
|
+
let i = r[0], l = r[r.length - 1], u = "node" in i ? Math.max(s[t].from, fe(e, i.node.range.start + i.delta)) : i.from, d = "node" in l ? l.node.range.end + l.delta : l.to, f = s.slice(t, n + 2).flatMap((e) => e.rowPlans ? [e.rowPlans] : []), p = f.length < 2 ? f[0] : {
|
|
823
1085
|
has: (e) => f.some((t) => t.has(e)),
|
|
824
1086
|
get: (e) => f.find((t) => t.has(e))?.get(e)
|
|
825
1087
|
}, m = this.parseSession.parse(e.slice(u, d), a, void 0, p);
|
|
@@ -827,7 +1089,7 @@ var J = class {
|
|
|
827
1089
|
for (let e = 0; e < r.length; e++) {
|
|
828
1090
|
let t = r[e], n = m.nodes[e];
|
|
829
1091
|
if ("node" in t) {
|
|
830
|
-
if (!
|
|
1092
|
+
if (!X(n, u, t.node, t.delta)) return !1;
|
|
831
1093
|
} else if (n.range.start + u !== t.from || n.range.end + u !== t.to) return !1;
|
|
832
1094
|
}
|
|
833
1095
|
t = n;
|
|
@@ -841,7 +1103,7 @@ var J = class {
|
|
|
841
1103
|
t.nodes = r.flatMap((e) => {
|
|
842
1104
|
let t = e.from - e.origin;
|
|
843
1105
|
if (e.publication?.delta === t) return e.publication.nodes;
|
|
844
|
-
let n =
|
|
1106
|
+
let n = j(e.publication?.nodes ?? e.nodes.map((e) => i.get(e.id)).filter((e) => !!e), U(e.nodes, t)).value;
|
|
845
1107
|
return e.publication = {
|
|
846
1108
|
delta: t,
|
|
847
1109
|
nodes: n
|
|
@@ -895,7 +1157,7 @@ var J = class {
|
|
|
895
1157
|
if (await t(), !i() || !n.tracked.result.ok || !n.tracked.parsed) return !1;
|
|
896
1158
|
let a = [], o = n.tracked.parsed.nodes;
|
|
897
1159
|
for (let e = 0; e < o.length; e++) {
|
|
898
|
-
let r = o[e], s =
|
|
1160
|
+
let r = o[e], s = G(r);
|
|
899
1161
|
if (s === "unsupported" || (s === "context" && a.push({
|
|
900
1162
|
from: r.range.start,
|
|
901
1163
|
to: r.range.end,
|
|
@@ -916,9 +1178,9 @@ var J = class {
|
|
|
916
1178
|
cost: 0
|
|
917
1179
|
});
|
|
918
1180
|
a.sort((e, t) => e.from - t.from);
|
|
919
|
-
let s =
|
|
1181
|
+
let s = K(n.source, a);
|
|
920
1182
|
if (s.includes("<")) return !1;
|
|
921
|
-
let c =
|
|
1183
|
+
let c = B.startParse(s), l = null;
|
|
922
1184
|
for (; !l;) if (l = c.advance(), !l && (await t(), !i())) return !1;
|
|
923
1185
|
if (await t(), !i()) return !1;
|
|
924
1186
|
let u = this.cacheBuilds;
|
|
@@ -932,13 +1194,13 @@ var J = class {
|
|
|
932
1194
|
}
|
|
933
1195
|
}
|
|
934
1196
|
clear() {
|
|
935
|
-
this.epoch++, this.snapshot = null, this.deferred = null, this.serial = 0, this.cacheBuilds = 0, this.shared = null, this.sharedKey = void 0, this.sharedMode = void 0, this.parseSession.clear(), this.semantic.clear();
|
|
1197
|
+
this.epoch++, this.snapshot = null, this.deferred = null, this.serial = 0, this.cacheBuilds = 0, this.shared = null, this.sharedKey = void 0, this.sharedMode = void 0, this.streamingCache = null, this.parseSession.clear(), this.semantic.clear();
|
|
936
1198
|
}
|
|
937
1199
|
dispose() {
|
|
938
1200
|
this.clear(), this.parseSession.dispose(), this.disposed = !0;
|
|
939
1201
|
}
|
|
940
1202
|
};
|
|
941
|
-
function
|
|
942
|
-
return new
|
|
1203
|
+
function pe() {
|
|
1204
|
+
return new $();
|
|
943
1205
|
}
|
|
944
|
-
export {
|
|
1206
|
+
export { pe as n, $ as t };
|