gemi 0.52.0 → 0.54.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/app/index.js +2 -2
- package/dist/app/index.js.map +1 -1
- package/dist/bin/gemi.js +1456 -5
- package/dist/bin/gemi.js.map +9 -5
- package/dist/broadcasting/index.js +1 -1
- package/dist/bun/plugin.js +2 -2
- package/dist/bun/plugin.js.map +1 -1
- package/dist/bun/preload.js +2 -2
- package/dist/bun/preload.js.map +1 -1
- package/dist/{chunk-msz8rngs.js → chunk-004bcmsa.js} +2 -2
- package/dist/chunk-004bcmsa.js.map +10 -0
- package/dist/chunk-07t0dmdg.js +4 -0
- package/dist/{chunk-faa987e4.js.map → chunk-07t0dmdg.js.map} +2 -2
- package/dist/{chunk-4t6a82fh.js → chunk-0weeq0ke.js} +2 -2
- package/dist/{chunk-4t6a82fh.js.map → chunk-0weeq0ke.js.map} +1 -1
- package/dist/chunk-113khwbw.js +5 -0
- package/dist/{chunk-2qn472j4.js.map → chunk-113khwbw.js.map} +1 -1
- package/dist/{chunk-tmk4zfz9.js → chunk-1sh6kqjn.js} +3 -3
- package/dist/{chunk-tmk4zfz9.js.map → chunk-1sh6kqjn.js.map} +1 -1
- package/dist/{chunk-2gw6cyyj.js → chunk-1snh7yc4.js} +2 -2
- package/dist/{chunk-2gw6cyyj.js.map → chunk-1snh7yc4.js.map} +1 -1
- package/dist/chunk-26r8dcxd.js +6 -0
- package/dist/{chunk-hbycemy5.js.map → chunk-26r8dcxd.js.map} +2 -2
- package/dist/{chunk-ebcgdv00.js → chunk-2pt6kyn9.js} +3 -3
- package/dist/{chunk-ebcgdv00.js.map → chunk-2pt6kyn9.js.map} +1 -1
- package/dist/{chunk-jdfe4dmh.js → chunk-2zmz3pjk.js} +3 -3
- package/dist/{chunk-jdfe4dmh.js.map → chunk-2zmz3pjk.js.map} +1 -1
- package/dist/{chunk-zhsaz9cr.js → chunk-3bw1jk21.js} +1 -1
- package/dist/chunk-4qkzdyj7.js +4 -0
- package/dist/{chunk-4e61qbp4.js.map → chunk-4qkzdyj7.js.map} +1 -1
- package/dist/{chunk-d1ahbza9.js → chunk-50vm7x98.js} +3 -3
- package/dist/{chunk-d1ahbza9.js.map → chunk-50vm7x98.js.map} +1 -1
- package/dist/{chunk-qyaqg07q.js → chunk-6j1z2cqt.js} +2 -2
- package/dist/{chunk-qyaqg07q.js.map → chunk-6j1z2cqt.js.map} +1 -1
- package/dist/chunk-6rhebm18.js +5 -0
- package/dist/chunk-6rhebm18.js.map +10 -0
- package/dist/{chunk-rq770c71.js → chunk-71m47kad.js} +2 -2
- package/dist/{chunk-rq770c71.js.map → chunk-71m47kad.js.map} +1 -1
- package/dist/{chunk-0h3jr9d9.js → chunk-7f5ad759.js} +2 -2
- package/dist/{chunk-8p6rqegw.js.map → chunk-7f5ad759.js.map} +1 -1
- package/dist/{chunk-qj4mmner.js → chunk-85av4ncy.js} +2 -2
- package/dist/{chunk-qj4mmner.js.map → chunk-85av4ncy.js.map} +1 -1
- package/dist/{chunk-23g7qdpg.js → chunk-9taz1h3t.js} +3 -3
- package/dist/{chunk-23g7qdpg.js.map → chunk-9taz1h3t.js.map} +1 -1
- package/dist/{chunk-ppt296ye.js → chunk-agabw2w1.js} +2 -2
- package/dist/{chunk-ppt296ye.js.map → chunk-agabw2w1.js.map} +1 -1
- package/dist/{chunk-092pj2j2.js → chunk-bb3zvxsf.js} +3 -3
- package/dist/{chunk-092pj2j2.js.map → chunk-bb3zvxsf.js.map} +1 -1
- package/dist/{chunk-h7jv3ame.js → chunk-br8ten26.js} +2 -2
- package/dist/{chunk-h7jv3ame.js.map → chunk-br8ten26.js.map} +1 -1
- package/dist/{chunk-4e61qbp4.js → chunk-bzhtymvv.js} +2 -2
- package/dist/{chunk-0h3jr9d9.js.map → chunk-bzhtymvv.js.map} +1 -1
- package/dist/{chunk-68w225rv.js → chunk-c0wcsmpj.js} +2 -2
- package/dist/{chunk-68w225rv.js.map → chunk-c0wcsmpj.js.map} +1 -1
- package/dist/{chunk-xsmt86n3.js → chunk-c22vcxty.js} +2 -2
- package/dist/{chunk-xsmt86n3.js.map → chunk-c22vcxty.js.map} +1 -1
- package/dist/{chunk-a0sy9f9x.js → chunk-c2pv3ah8.js} +2 -2
- package/dist/{chunk-a0sy9f9x.js.map → chunk-c2pv3ah8.js.map} +2 -2
- package/dist/{chunk-q09mmr05.js → chunk-cz3szqhq.js} +2 -2
- package/dist/{chunk-q09mmr05.js.map → chunk-cz3szqhq.js.map} +1 -1
- package/dist/{chunk-69w4egkg.js → chunk-dwx2y7br.js} +4 -4
- package/dist/{chunk-69w4egkg.js.map → chunk-dwx2y7br.js.map} +1 -1
- package/dist/{chunk-2sfz64xh.js → chunk-dxw8k6f1.js} +2 -2
- package/dist/{chunk-2sfz64xh.js.map → chunk-dxw8k6f1.js.map} +1 -1
- package/dist/chunk-e3mggavt.js +5 -0
- package/dist/chunk-e3mggavt.js.map +11 -0
- package/dist/{chunk-j1knf8gv.js → chunk-efsk1wy0.js} +3 -3
- package/dist/{chunk-j1knf8gv.js.map → chunk-efsk1wy0.js.map} +1 -1
- package/dist/{chunk-t4n25km9.js → chunk-f13f68c0.js} +2 -2
- package/dist/{chunk-t4n25km9.js.map → chunk-f13f68c0.js.map} +1 -1
- package/dist/{chunk-vv72kw74.js → chunk-f418jh9k.js} +2 -2
- package/dist/{chunk-vv72kw74.js.map → chunk-f418jh9k.js.map} +1 -1
- package/dist/chunk-f4e7fh95.js +17 -0
- package/dist/chunk-f4e7fh95.js.map +14 -0
- package/dist/{chunk-ewgv1j8q.js → chunk-fcqc3e3r.js} +2 -2
- package/dist/{chunk-ewgv1j8q.js.map → chunk-fcqc3e3r.js.map} +1 -1
- package/dist/{chunk-3y9nf09k.js → chunk-g5tj10p8.js} +2 -2
- package/dist/{chunk-3y9nf09k.js.map → chunk-g5tj10p8.js.map} +1 -1
- package/dist/chunk-gn9zjgep.js +5 -0
- package/dist/chunk-gn9zjgep.js.map +10 -0
- package/dist/{chunk-5s45prj5.js → chunk-h7mcwfg5.js} +4 -4
- package/dist/{chunk-5s45prj5.js.map → chunk-h7mcwfg5.js.map} +1 -1
- package/dist/chunk-hk067634.js +4 -0
- package/dist/{chunk-vnjvd82s.js.map → chunk-hk067634.js.map} +2 -2
- package/dist/{chunk-qx6sahe0.js → chunk-hrrmxreg.js} +2 -2
- package/dist/{chunk-qx6sahe0.js.map → chunk-hrrmxreg.js.map} +1 -1
- package/dist/{chunk-p22rkf1g.js → chunk-jb022m7n.js} +2 -2
- package/dist/{chunk-p22rkf1g.js.map → chunk-jb022m7n.js.map} +1 -1
- package/dist/chunk-jb2nst6v.js +4 -0
- package/dist/{chunk-6scjrbw7.js.map → chunk-jb2nst6v.js.map} +2 -2
- package/dist/{chunk-kxzwem3g.js → chunk-jdgvdddd.js} +2 -2
- package/dist/{chunk-kxzwem3g.js.map → chunk-jdgvdddd.js.map} +1 -1
- package/dist/{chunk-2yth3kk2.js → chunk-jp4pf3yt.js} +4 -4
- package/dist/{chunk-2yth3kk2.js.map → chunk-jp4pf3yt.js.map} +1 -1
- package/dist/{chunk-0tbwn6er.js → chunk-k14dmqwh.js} +3 -3
- package/dist/{chunk-0tbwn6er.js.map → chunk-k14dmqwh.js.map} +1 -1
- package/dist/{chunk-1ce7veh9.js → chunk-k8endm5j.js} +3 -3
- package/dist/{chunk-1ce7veh9.js.map → chunk-k8endm5j.js.map} +1 -1
- package/dist/chunk-kkkqyvwv.js +81 -0
- package/dist/{chunk-km6x37ws.js.map → chunk-kkkqyvwv.js.map} +5 -5
- package/dist/{chunk-cmq5t8p9.js → chunk-kv2ep453.js} +3 -3
- package/dist/{chunk-cmq5t8p9.js.map → chunk-kv2ep453.js.map} +1 -1
- package/dist/{chunk-z4q1ty6w.js → chunk-kz39hphm.js} +3 -3
- package/dist/{chunk-z4q1ty6w.js.map → chunk-kz39hphm.js.map} +1 -1
- package/dist/{chunk-kaxvw75w.js → chunk-ms8qd7da.js} +3 -3
- package/dist/{chunk-kaxvw75w.js.map → chunk-ms8qd7da.js.map} +1 -1
- package/dist/{chunk-ttzkn1qd.js → chunk-n1tkn8gv.js} +2 -2
- package/dist/{chunk-ttzkn1qd.js.map → chunk-n1tkn8gv.js.map} +1 -1
- package/dist/chunk-nncwsdzz.js +5 -0
- package/dist/chunk-nncwsdzz.js.map +10 -0
- package/dist/{chunk-et0j6jx8.js → chunk-pgjk5ft3.js} +3 -3
- package/dist/{chunk-et0j6jx8.js.map → chunk-pgjk5ft3.js.map} +1 -1
- package/dist/{chunk-tztqkat2.js → chunk-r06rxn19.js} +2 -2
- package/dist/{chunk-tztqkat2.js.map → chunk-r06rxn19.js.map} +1 -1
- package/dist/chunk-r9z5rrk0.js +4 -0
- package/dist/{chunk-1ab1ptq5.js.map → chunk-r9z5rrk0.js.map} +2 -2
- package/dist/{chunk-h5g05qwb.js → chunk-s6e7cvek.js} +2 -2
- package/dist/{chunk-h5g05qwb.js.map → chunk-s6e7cvek.js.map} +1 -1
- package/dist/{chunk-53e48ce8.js → chunk-sqp7kn7h.js} +3 -3
- package/dist/{chunk-53e48ce8.js.map → chunk-sqp7kn7h.js.map} +1 -1
- package/dist/{chunk-mt2755rs.js → chunk-w6gb9gc5.js} +3 -3
- package/dist/{chunk-mt2755rs.js.map → chunk-w6gb9gc5.js.map} +1 -1
- package/dist/{chunk-ha7n1c94.js → chunk-xxw0gz4q.js} +2 -2
- package/dist/{chunk-ha7n1c94.js.map → chunk-xxw0gz4q.js.map} +1 -1
- package/dist/chunk-ywr2vd5r.js +5 -0
- package/dist/{chunk-f29vd5mc.js.map → chunk-ywr2vd5r.js.map} +2 -2
- package/dist/{chunk-38ma6gg3.js → chunk-zckj6bs6.js} +3 -3
- package/dist/{chunk-38ma6gg3.js.map → chunk-zckj6bs6.js.map} +1 -1
- package/dist/chunks/ThemeProvider-Bk1eZymb.js +2901 -0
- package/dist/chunks/ThemeProvider-Bk1eZymb.js.map +1 -0
- package/dist/client/ComponentContext.d.ts.map +1 -1
- package/dist/client/DictionarySinkContext.d.ts +10 -0
- package/dist/client/DictionarySinkContext.d.ts.map +1 -0
- package/dist/client/Mutation.d.ts +1 -1
- package/dist/client/Mutation.d.ts.map +1 -1
- package/dist/client/ThemeProvider.d.ts +7 -0
- package/dist/client/ThemeProvider.d.ts.map +1 -1
- package/dist/client/createRoot.d.ts.map +1 -1
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +242 -2629
- package/dist/client/index.js.map +1 -1
- package/dist/client/useDictionary.d.ts +34 -0
- package/dist/client/useDictionary.d.ts.map +1 -0
- package/dist/client/useDictionary.test-d.d.ts +2 -0
- package/dist/client/useDictionary.test-d.d.ts.map +1 -0
- package/dist/client/useIsNavigationPending.d.ts.map +1 -1
- package/dist/client/useMutate.d.ts.map +1 -1
- package/dist/client/useTranslator.d.ts +8 -0
- package/dist/client/useTranslator.d.ts.map +1 -1
- package/dist/config/index.js +1 -1
- package/dist/console/run.js +2 -2
- package/dist/console/run.js.map +1 -1
- package/dist/container/index.js +2 -2
- package/dist/container/index.js.map +1 -1
- package/dist/database/index.js +2 -2
- package/dist/database/index.js.map +1 -1
- package/dist/email/index.js +2 -2
- package/dist/email/index.js.map +1 -1
- package/dist/facades/Lang.d.ts.map +1 -1
- package/dist/facades/index.js +2 -2
- package/dist/facades/index.js.map +1 -1
- package/dist/foundation/index.js +2 -2
- package/dist/foundation/index.js.map +1 -1
- package/dist/http/index.js +2 -2
- package/dist/http/index.js.map +1 -1
- package/dist/i18n/Dictionary.d.ts +7 -0
- package/dist/i18n/Dictionary.d.ts.map +1 -1
- package/dist/i18n/Translator.d.ts +12 -0
- package/dist/i18n/Translator.d.ts.map +1 -1
- package/dist/i18n/config.d.ts +6 -0
- package/dist/i18n/config.d.ts.map +1 -1
- package/dist/i18n/defineDictionary.d.ts +65 -0
- package/dist/i18n/defineDictionary.d.ts.map +1 -0
- package/dist/i18n/dictionaryRegistry.d.ts +85 -0
- package/dist/i18n/dictionaryRegistry.d.ts.map +1 -0
- package/dist/i18n/dictionaryRuntime.d.ts +16 -0
- package/dist/i18n/dictionaryRuntime.d.ts.map +1 -0
- package/dist/i18n/dictionaryRuntime.js +4 -0
- package/dist/i18n/dictionaryRuntime.js.map +9 -0
- package/dist/i18n/dictionaryShape.d.ts +66 -0
- package/dist/i18n/dictionaryShape.d.ts.map +1 -0
- package/dist/i18n/dictionarySink.d.ts +31 -0
- package/dist/i18n/dictionarySink.d.ts.map +1 -0
- package/dist/i18n/index.d.ts +3 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +2 -2
- package/dist/i18n/index.js.map +5 -4
- package/dist/i18n/translate.d.ts +21 -0
- package/dist/i18n/translate.d.ts.map +1 -0
- package/dist/internal/gemiExternals.d.ts +1 -1
- package/dist/internal/gemiExternals.d.ts.map +1 -1
- package/dist/kernel/index.js +2 -2
- package/dist/kernel/index.js.map +2 -2
- package/dist/orm/index.js +2 -2
- package/dist/orm/index.js.map +2 -2
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/dist/services/index.js +4 -4
- package/dist/services/index.js.map +2 -2
- package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
- package/dist/services/router/streamQueryInjection.d.ts +9 -1
- package/dist/services/router/streamQueryInjection.d.ts.map +1 -1
- package/dist/support/index.js +2 -2
- package/dist/support/index.js.map +1 -1
- package/dist/testing/Page.d.ts +166 -0
- package/dist/testing/Page.d.ts.map +1 -0
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +352 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/utils/Subject.d.ts.map +1 -1
- package/dist/utils/variantKey.d.ts +19 -0
- package/dist/utils/variantKey.d.ts.map +1 -0
- package/dist/vite/__vite-browser-external-S5EYS4bz.mjs +7 -0
- package/dist/vite/api_vite-DSBC5Nzy.mjs +5 -0
- package/dist/vite/browser-DFEUWTkA.mjs +6086 -0
- package/dist/vite/build-C0lmnz6d.mjs +5326 -0
- package/dist/vite/index.mjs +1349 -1
- package/dist/vite/lib-TT6NqN6b.mjs +363 -0
- package/dist/vite/lib-U4DF62jt.mjs +48846 -0
- package/dist/vite/main-Drp2rSLR.mjs +2123 -0
- package/dist/vite/node-BgyIm-M7.mjs +17799 -0
- package/dist/vite/node-yGkKTK1d.mjs +789 -0
- package/dist/vite/postcss-hCXrlC4m.mjs +3515 -0
- package/dist/vite/postcss-import-rYEe0OKc.mjs +448 -0
- package/dist/vite/prompt--dNycKSZ-BmZ8jzP_.mjs +889 -0
- package/dist/vite/rolldown-runtime-B4lejLz5.mjs +37 -0
- package/package.json +4 -1
- package/dist/chunk-1ab1ptq5.js +0 -4
- package/dist/chunk-2qn472j4.js +0 -5
- package/dist/chunk-6scjrbw7.js +0 -4
- package/dist/chunk-88pq4gmf.js +0 -5
- package/dist/chunk-88pq4gmf.js.map +0 -10
- package/dist/chunk-8p6rqegw.js +0 -4
- package/dist/chunk-f29vd5mc.js +0 -5
- package/dist/chunk-faa987e4.js +0 -4
- package/dist/chunk-hbycemy5.js +0 -6
- package/dist/chunk-km6x37ws.js +0 -81
- package/dist/chunk-msz8rngs.js.map +0 -10
- package/dist/chunk-vnjvd82s.js +0 -4
- package/dist/chunk-xw44bwnh.js +0 -5
- package/dist/chunk-xw44bwnh.js.map +0 -11
- /package/dist/{chunk-zhsaz9cr.js.map → chunk-3bw1jk21.js.map} +0 -0
package/dist/bin/gemi.js
CHANGED
|
@@ -37764,6 +37764,1456 @@ function isGemiExternal(id) {
|
|
|
37764
37764
|
return id === "gemi" || id.startsWith("gemi/");
|
|
37765
37765
|
}
|
|
37766
37766
|
|
|
37767
|
+
// ../../node_modules/.bun/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
37768
|
+
var comma = 44;
|
|
37769
|
+
var semicolon = 59;
|
|
37770
|
+
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
37771
|
+
var intToChar = new Uint8Array(64);
|
|
37772
|
+
var charToInt = new Uint8Array(128);
|
|
37773
|
+
for (let i = 0;i < chars.length; i++) {
|
|
37774
|
+
const c = chars.charCodeAt(i);
|
|
37775
|
+
intToChar[i] = c;
|
|
37776
|
+
charToInt[c] = i;
|
|
37777
|
+
}
|
|
37778
|
+
function encodeInteger(builder, num, relative) {
|
|
37779
|
+
let delta = num - relative;
|
|
37780
|
+
delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
|
|
37781
|
+
do {
|
|
37782
|
+
let clamped = delta & 31;
|
|
37783
|
+
delta >>>= 5;
|
|
37784
|
+
if (delta > 0)
|
|
37785
|
+
clamped |= 32;
|
|
37786
|
+
builder.write(intToChar[clamped]);
|
|
37787
|
+
} while (delta > 0);
|
|
37788
|
+
return num;
|
|
37789
|
+
}
|
|
37790
|
+
var bufLength = 1024 * 16;
|
|
37791
|
+
var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder : typeof Buffer !== "undefined" ? {
|
|
37792
|
+
decode(buf) {
|
|
37793
|
+
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
37794
|
+
return out.toString();
|
|
37795
|
+
}
|
|
37796
|
+
} : {
|
|
37797
|
+
decode(buf) {
|
|
37798
|
+
let out = "";
|
|
37799
|
+
for (let i = 0;i < buf.length; i++) {
|
|
37800
|
+
out += String.fromCharCode(buf[i]);
|
|
37801
|
+
}
|
|
37802
|
+
return out;
|
|
37803
|
+
}
|
|
37804
|
+
};
|
|
37805
|
+
var StringWriter = class {
|
|
37806
|
+
constructor() {
|
|
37807
|
+
this.pos = 0;
|
|
37808
|
+
this.out = "";
|
|
37809
|
+
this.buffer = new Uint8Array(bufLength);
|
|
37810
|
+
}
|
|
37811
|
+
write(v) {
|
|
37812
|
+
const { buffer } = this;
|
|
37813
|
+
buffer[this.pos++] = v;
|
|
37814
|
+
if (this.pos === bufLength) {
|
|
37815
|
+
this.out += td.decode(buffer);
|
|
37816
|
+
this.pos = 0;
|
|
37817
|
+
}
|
|
37818
|
+
}
|
|
37819
|
+
flush() {
|
|
37820
|
+
const { buffer, out, pos } = this;
|
|
37821
|
+
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
|
|
37822
|
+
}
|
|
37823
|
+
};
|
|
37824
|
+
function encode(decoded) {
|
|
37825
|
+
const writer = new StringWriter;
|
|
37826
|
+
let sourcesIndex = 0;
|
|
37827
|
+
let sourceLine = 0;
|
|
37828
|
+
let sourceColumn = 0;
|
|
37829
|
+
let namesIndex = 0;
|
|
37830
|
+
for (let i = 0;i < decoded.length; i++) {
|
|
37831
|
+
const line = decoded[i];
|
|
37832
|
+
if (i > 0)
|
|
37833
|
+
writer.write(semicolon);
|
|
37834
|
+
if (line.length === 0)
|
|
37835
|
+
continue;
|
|
37836
|
+
let genColumn = 0;
|
|
37837
|
+
for (let j = 0;j < line.length; j++) {
|
|
37838
|
+
const segment = line[j];
|
|
37839
|
+
if (j > 0)
|
|
37840
|
+
writer.write(comma);
|
|
37841
|
+
genColumn = encodeInteger(writer, segment[0], genColumn);
|
|
37842
|
+
if (segment.length === 1)
|
|
37843
|
+
continue;
|
|
37844
|
+
sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
|
|
37845
|
+
sourceLine = encodeInteger(writer, segment[2], sourceLine);
|
|
37846
|
+
sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
|
|
37847
|
+
if (segment.length === 4)
|
|
37848
|
+
continue;
|
|
37849
|
+
namesIndex = encodeInteger(writer, segment[4], namesIndex);
|
|
37850
|
+
}
|
|
37851
|
+
}
|
|
37852
|
+
return writer.flush();
|
|
37853
|
+
}
|
|
37854
|
+
|
|
37855
|
+
// ../../node_modules/.bun/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs
|
|
37856
|
+
class BitSet {
|
|
37857
|
+
constructor(arg) {
|
|
37858
|
+
this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
|
|
37859
|
+
}
|
|
37860
|
+
add(n) {
|
|
37861
|
+
this.bits[n >> 5] |= 1 << (n & 31);
|
|
37862
|
+
}
|
|
37863
|
+
has(n) {
|
|
37864
|
+
return !!(this.bits[n >> 5] & 1 << (n & 31));
|
|
37865
|
+
}
|
|
37866
|
+
}
|
|
37867
|
+
|
|
37868
|
+
class Chunk {
|
|
37869
|
+
constructor(start, end, content) {
|
|
37870
|
+
this.start = start;
|
|
37871
|
+
this.end = end;
|
|
37872
|
+
this.original = content;
|
|
37873
|
+
this.intro = "";
|
|
37874
|
+
this.outro = "";
|
|
37875
|
+
this.content = content;
|
|
37876
|
+
this.storeName = false;
|
|
37877
|
+
this.edited = false;
|
|
37878
|
+
{
|
|
37879
|
+
this.previous = null;
|
|
37880
|
+
this.next = null;
|
|
37881
|
+
}
|
|
37882
|
+
}
|
|
37883
|
+
appendLeft(content) {
|
|
37884
|
+
this.outro += content;
|
|
37885
|
+
}
|
|
37886
|
+
appendRight(content) {
|
|
37887
|
+
this.intro = this.intro + content;
|
|
37888
|
+
}
|
|
37889
|
+
clone() {
|
|
37890
|
+
const chunk = new Chunk(this.start, this.end, this.original);
|
|
37891
|
+
chunk.intro = this.intro;
|
|
37892
|
+
chunk.outro = this.outro;
|
|
37893
|
+
chunk.content = this.content;
|
|
37894
|
+
chunk.storeName = this.storeName;
|
|
37895
|
+
chunk.edited = this.edited;
|
|
37896
|
+
return chunk;
|
|
37897
|
+
}
|
|
37898
|
+
contains(index) {
|
|
37899
|
+
return this.start < index && index < this.end;
|
|
37900
|
+
}
|
|
37901
|
+
eachNext(fn) {
|
|
37902
|
+
let chunk = this;
|
|
37903
|
+
while (chunk) {
|
|
37904
|
+
fn(chunk);
|
|
37905
|
+
chunk = chunk.next;
|
|
37906
|
+
}
|
|
37907
|
+
}
|
|
37908
|
+
eachPrevious(fn) {
|
|
37909
|
+
let chunk = this;
|
|
37910
|
+
while (chunk) {
|
|
37911
|
+
fn(chunk);
|
|
37912
|
+
chunk = chunk.previous;
|
|
37913
|
+
}
|
|
37914
|
+
}
|
|
37915
|
+
edit(content, storeName, contentOnly) {
|
|
37916
|
+
this.content = content;
|
|
37917
|
+
if (!contentOnly) {
|
|
37918
|
+
this.intro = "";
|
|
37919
|
+
this.outro = "";
|
|
37920
|
+
}
|
|
37921
|
+
this.storeName = storeName;
|
|
37922
|
+
this.edited = true;
|
|
37923
|
+
return this;
|
|
37924
|
+
}
|
|
37925
|
+
prependLeft(content) {
|
|
37926
|
+
this.outro = content + this.outro;
|
|
37927
|
+
}
|
|
37928
|
+
prependRight(content) {
|
|
37929
|
+
this.intro = content + this.intro;
|
|
37930
|
+
}
|
|
37931
|
+
reset() {
|
|
37932
|
+
this.intro = "";
|
|
37933
|
+
this.outro = "";
|
|
37934
|
+
if (this.edited) {
|
|
37935
|
+
this.content = this.original;
|
|
37936
|
+
this.storeName = false;
|
|
37937
|
+
this.edited = false;
|
|
37938
|
+
}
|
|
37939
|
+
}
|
|
37940
|
+
split(index) {
|
|
37941
|
+
const sliceIndex = index - this.start;
|
|
37942
|
+
const originalBefore = this.original.slice(0, sliceIndex);
|
|
37943
|
+
const originalAfter = this.original.slice(sliceIndex);
|
|
37944
|
+
this.original = originalBefore;
|
|
37945
|
+
const newChunk = new Chunk(index, this.end, originalAfter);
|
|
37946
|
+
newChunk.outro = this.outro;
|
|
37947
|
+
this.outro = "";
|
|
37948
|
+
this.end = index;
|
|
37949
|
+
if (this.edited) {
|
|
37950
|
+
newChunk.edit("", false);
|
|
37951
|
+
this.content = "";
|
|
37952
|
+
} else {
|
|
37953
|
+
this.content = originalBefore;
|
|
37954
|
+
}
|
|
37955
|
+
newChunk.next = this.next;
|
|
37956
|
+
if (newChunk.next)
|
|
37957
|
+
newChunk.next.previous = newChunk;
|
|
37958
|
+
newChunk.previous = this;
|
|
37959
|
+
this.next = newChunk;
|
|
37960
|
+
return newChunk;
|
|
37961
|
+
}
|
|
37962
|
+
toString() {
|
|
37963
|
+
return this.intro + this.content + this.outro;
|
|
37964
|
+
}
|
|
37965
|
+
trimEnd(rx) {
|
|
37966
|
+
this.outro = this.outro.replace(rx, "");
|
|
37967
|
+
if (this.outro.length)
|
|
37968
|
+
return true;
|
|
37969
|
+
const trimmed = this.content.replace(rx, "");
|
|
37970
|
+
if (trimmed.length) {
|
|
37971
|
+
if (trimmed !== this.content) {
|
|
37972
|
+
this.split(this.start + trimmed.length).edit("", undefined, true);
|
|
37973
|
+
if (this.edited) {
|
|
37974
|
+
this.edit(trimmed, this.storeName, true);
|
|
37975
|
+
}
|
|
37976
|
+
}
|
|
37977
|
+
return true;
|
|
37978
|
+
} else {
|
|
37979
|
+
this.edit("", undefined, true);
|
|
37980
|
+
this.intro = this.intro.replace(rx, "");
|
|
37981
|
+
if (this.intro.length)
|
|
37982
|
+
return true;
|
|
37983
|
+
}
|
|
37984
|
+
}
|
|
37985
|
+
trimStart(rx) {
|
|
37986
|
+
this.intro = this.intro.replace(rx, "");
|
|
37987
|
+
if (this.intro.length)
|
|
37988
|
+
return true;
|
|
37989
|
+
const trimmed = this.content.replace(rx, "");
|
|
37990
|
+
if (trimmed.length) {
|
|
37991
|
+
if (trimmed !== this.content) {
|
|
37992
|
+
const newChunk = this.split(this.end - trimmed.length);
|
|
37993
|
+
if (this.edited) {
|
|
37994
|
+
newChunk.edit(trimmed, this.storeName, true);
|
|
37995
|
+
}
|
|
37996
|
+
this.edit("", undefined, true);
|
|
37997
|
+
}
|
|
37998
|
+
return true;
|
|
37999
|
+
} else {
|
|
38000
|
+
this.edit("", undefined, true);
|
|
38001
|
+
this.outro = this.outro.replace(rx, "");
|
|
38002
|
+
if (this.outro.length)
|
|
38003
|
+
return true;
|
|
38004
|
+
}
|
|
38005
|
+
}
|
|
38006
|
+
}
|
|
38007
|
+
function getBtoa() {
|
|
38008
|
+
if (typeof globalThis !== "undefined" && typeof globalThis.btoa === "function") {
|
|
38009
|
+
return (str) => globalThis.btoa(unescape(encodeURIComponent(str)));
|
|
38010
|
+
} else if (typeof Buffer === "function") {
|
|
38011
|
+
return (str) => Buffer.from(str, "utf-8").toString("base64");
|
|
38012
|
+
} else {
|
|
38013
|
+
return () => {
|
|
38014
|
+
throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.");
|
|
38015
|
+
};
|
|
38016
|
+
}
|
|
38017
|
+
}
|
|
38018
|
+
var btoa = /* @__PURE__ */ getBtoa();
|
|
38019
|
+
|
|
38020
|
+
class SourceMap {
|
|
38021
|
+
constructor(properties) {
|
|
38022
|
+
this.version = 3;
|
|
38023
|
+
this.file = properties.file;
|
|
38024
|
+
this.sources = properties.sources;
|
|
38025
|
+
this.sourcesContent = properties.sourcesContent;
|
|
38026
|
+
this.names = properties.names;
|
|
38027
|
+
this.mappings = encode(properties.mappings);
|
|
38028
|
+
if (typeof properties.x_google_ignoreList !== "undefined") {
|
|
38029
|
+
this.x_google_ignoreList = properties.x_google_ignoreList;
|
|
38030
|
+
}
|
|
38031
|
+
if (typeof properties.debugId !== "undefined") {
|
|
38032
|
+
this.debugId = properties.debugId;
|
|
38033
|
+
}
|
|
38034
|
+
}
|
|
38035
|
+
toString() {
|
|
38036
|
+
return JSON.stringify(this);
|
|
38037
|
+
}
|
|
38038
|
+
toUrl() {
|
|
38039
|
+
return "data:application/json;charset=utf-8;base64," + btoa(this.toString());
|
|
38040
|
+
}
|
|
38041
|
+
}
|
|
38042
|
+
function guessIndent(code) {
|
|
38043
|
+
const lines = code.split(`
|
|
38044
|
+
`);
|
|
38045
|
+
const tabbed = lines.filter((line) => /^\t+/.test(line));
|
|
38046
|
+
const spaced = lines.filter((line) => /^ {2,}/.test(line));
|
|
38047
|
+
if (tabbed.length === 0 && spaced.length === 0) {
|
|
38048
|
+
return null;
|
|
38049
|
+
}
|
|
38050
|
+
if (tabbed.length >= spaced.length) {
|
|
38051
|
+
return "\t";
|
|
38052
|
+
}
|
|
38053
|
+
const min = spaced.reduce((previous, current) => {
|
|
38054
|
+
const numSpaces = /^ +/.exec(current)[0].length;
|
|
38055
|
+
return Math.min(numSpaces, previous);
|
|
38056
|
+
}, Infinity);
|
|
38057
|
+
return new Array(min + 1).join(" ");
|
|
38058
|
+
}
|
|
38059
|
+
function getRelativePath(from, to) {
|
|
38060
|
+
const fromParts = from.split(/[/\\]/);
|
|
38061
|
+
const toParts = to.split(/[/\\]/);
|
|
38062
|
+
fromParts.pop();
|
|
38063
|
+
while (fromParts[0] === toParts[0]) {
|
|
38064
|
+
fromParts.shift();
|
|
38065
|
+
toParts.shift();
|
|
38066
|
+
}
|
|
38067
|
+
if (fromParts.length) {
|
|
38068
|
+
let i = fromParts.length;
|
|
38069
|
+
while (i--)
|
|
38070
|
+
fromParts[i] = "..";
|
|
38071
|
+
}
|
|
38072
|
+
return fromParts.concat(toParts).join("/");
|
|
38073
|
+
}
|
|
38074
|
+
var toString = Object.prototype.toString;
|
|
38075
|
+
function isObject(thing) {
|
|
38076
|
+
return toString.call(thing) === "[object Object]";
|
|
38077
|
+
}
|
|
38078
|
+
function getLocator(source) {
|
|
38079
|
+
const originalLines = source.split(`
|
|
38080
|
+
`);
|
|
38081
|
+
const lineOffsets = [];
|
|
38082
|
+
for (let i = 0, pos = 0;i < originalLines.length; i++) {
|
|
38083
|
+
lineOffsets.push(pos);
|
|
38084
|
+
pos += originalLines[i].length + 1;
|
|
38085
|
+
}
|
|
38086
|
+
return function locate(index) {
|
|
38087
|
+
let i = 0;
|
|
38088
|
+
let j = lineOffsets.length;
|
|
38089
|
+
while (i < j) {
|
|
38090
|
+
const m = i + j >> 1;
|
|
38091
|
+
if (index < lineOffsets[m]) {
|
|
38092
|
+
j = m;
|
|
38093
|
+
} else {
|
|
38094
|
+
i = m + 1;
|
|
38095
|
+
}
|
|
38096
|
+
}
|
|
38097
|
+
const line = i - 1;
|
|
38098
|
+
const column = index - lineOffsets[line];
|
|
38099
|
+
return { line, column };
|
|
38100
|
+
};
|
|
38101
|
+
}
|
|
38102
|
+
var wordRegex = /\w/;
|
|
38103
|
+
|
|
38104
|
+
class Mappings {
|
|
38105
|
+
constructor(hires) {
|
|
38106
|
+
this.hires = hires;
|
|
38107
|
+
this.generatedCodeLine = 0;
|
|
38108
|
+
this.generatedCodeColumn = 0;
|
|
38109
|
+
this.raw = [];
|
|
38110
|
+
this.rawSegments = this.raw[this.generatedCodeLine] = [];
|
|
38111
|
+
this.pending = null;
|
|
38112
|
+
}
|
|
38113
|
+
addEdit(sourceIndex, content, loc, nameIndex) {
|
|
38114
|
+
if (content.length) {
|
|
38115
|
+
const contentLengthMinusOne = content.length - 1;
|
|
38116
|
+
let contentLineEnd = content.indexOf(`
|
|
38117
|
+
`, 0);
|
|
38118
|
+
let previousContentLineEnd = -1;
|
|
38119
|
+
while (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) {
|
|
38120
|
+
const segment2 = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
38121
|
+
if (nameIndex >= 0) {
|
|
38122
|
+
segment2.push(nameIndex);
|
|
38123
|
+
}
|
|
38124
|
+
this.rawSegments.push(segment2);
|
|
38125
|
+
this.generatedCodeLine += 1;
|
|
38126
|
+
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
38127
|
+
this.generatedCodeColumn = 0;
|
|
38128
|
+
previousContentLineEnd = contentLineEnd;
|
|
38129
|
+
contentLineEnd = content.indexOf(`
|
|
38130
|
+
`, contentLineEnd + 1);
|
|
38131
|
+
}
|
|
38132
|
+
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
38133
|
+
if (nameIndex >= 0) {
|
|
38134
|
+
segment.push(nameIndex);
|
|
38135
|
+
}
|
|
38136
|
+
this.rawSegments.push(segment);
|
|
38137
|
+
this.advance(content.slice(previousContentLineEnd + 1));
|
|
38138
|
+
} else if (this.pending) {
|
|
38139
|
+
this.rawSegments.push(this.pending);
|
|
38140
|
+
this.advance(content);
|
|
38141
|
+
}
|
|
38142
|
+
this.pending = null;
|
|
38143
|
+
}
|
|
38144
|
+
addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
|
|
38145
|
+
let originalCharIndex = chunk.start;
|
|
38146
|
+
let first = true;
|
|
38147
|
+
let charInHiresBoundary = false;
|
|
38148
|
+
while (originalCharIndex < chunk.end) {
|
|
38149
|
+
if (original[originalCharIndex] === `
|
|
38150
|
+
`) {
|
|
38151
|
+
loc.line += 1;
|
|
38152
|
+
loc.column = 0;
|
|
38153
|
+
this.generatedCodeLine += 1;
|
|
38154
|
+
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
38155
|
+
this.generatedCodeColumn = 0;
|
|
38156
|
+
first = true;
|
|
38157
|
+
charInHiresBoundary = false;
|
|
38158
|
+
} else {
|
|
38159
|
+
if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
|
|
38160
|
+
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
38161
|
+
if (this.hires === "boundary") {
|
|
38162
|
+
if (wordRegex.test(original[originalCharIndex])) {
|
|
38163
|
+
if (!charInHiresBoundary) {
|
|
38164
|
+
this.rawSegments.push(segment);
|
|
38165
|
+
charInHiresBoundary = true;
|
|
38166
|
+
}
|
|
38167
|
+
} else {
|
|
38168
|
+
this.rawSegments.push(segment);
|
|
38169
|
+
charInHiresBoundary = false;
|
|
38170
|
+
}
|
|
38171
|
+
} else {
|
|
38172
|
+
this.rawSegments.push(segment);
|
|
38173
|
+
}
|
|
38174
|
+
}
|
|
38175
|
+
loc.column += 1;
|
|
38176
|
+
this.generatedCodeColumn += 1;
|
|
38177
|
+
first = false;
|
|
38178
|
+
}
|
|
38179
|
+
originalCharIndex += 1;
|
|
38180
|
+
}
|
|
38181
|
+
this.pending = null;
|
|
38182
|
+
}
|
|
38183
|
+
advance(str) {
|
|
38184
|
+
if (!str)
|
|
38185
|
+
return;
|
|
38186
|
+
const lines = str.split(`
|
|
38187
|
+
`);
|
|
38188
|
+
if (lines.length > 1) {
|
|
38189
|
+
for (let i = 0;i < lines.length - 1; i++) {
|
|
38190
|
+
this.generatedCodeLine++;
|
|
38191
|
+
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
38192
|
+
}
|
|
38193
|
+
this.generatedCodeColumn = 0;
|
|
38194
|
+
}
|
|
38195
|
+
this.generatedCodeColumn += lines[lines.length - 1].length;
|
|
38196
|
+
}
|
|
38197
|
+
}
|
|
38198
|
+
var n = `
|
|
38199
|
+
`;
|
|
38200
|
+
var warned = {
|
|
38201
|
+
insertLeft: false,
|
|
38202
|
+
insertRight: false,
|
|
38203
|
+
storeName: false
|
|
38204
|
+
};
|
|
38205
|
+
|
|
38206
|
+
class MagicString {
|
|
38207
|
+
constructor(string, options = {}) {
|
|
38208
|
+
const chunk = new Chunk(0, string.length, string);
|
|
38209
|
+
Object.defineProperties(this, {
|
|
38210
|
+
original: { writable: true, value: string },
|
|
38211
|
+
outro: { writable: true, value: "" },
|
|
38212
|
+
intro: { writable: true, value: "" },
|
|
38213
|
+
firstChunk: { writable: true, value: chunk },
|
|
38214
|
+
lastChunk: { writable: true, value: chunk },
|
|
38215
|
+
lastSearchedChunk: { writable: true, value: chunk },
|
|
38216
|
+
byStart: { writable: true, value: {} },
|
|
38217
|
+
byEnd: { writable: true, value: {} },
|
|
38218
|
+
filename: { writable: true, value: options.filename },
|
|
38219
|
+
indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
|
|
38220
|
+
sourcemapLocations: { writable: true, value: new BitSet },
|
|
38221
|
+
storedNames: { writable: true, value: {} },
|
|
38222
|
+
indentStr: { writable: true, value: undefined },
|
|
38223
|
+
ignoreList: { writable: true, value: options.ignoreList },
|
|
38224
|
+
offset: { writable: true, value: options.offset || 0 }
|
|
38225
|
+
});
|
|
38226
|
+
this.byStart[0] = chunk;
|
|
38227
|
+
this.byEnd[string.length] = chunk;
|
|
38228
|
+
}
|
|
38229
|
+
addSourcemapLocation(char) {
|
|
38230
|
+
this.sourcemapLocations.add(char);
|
|
38231
|
+
}
|
|
38232
|
+
append(content) {
|
|
38233
|
+
if (typeof content !== "string")
|
|
38234
|
+
throw new TypeError("outro content must be a string");
|
|
38235
|
+
this.outro += content;
|
|
38236
|
+
return this;
|
|
38237
|
+
}
|
|
38238
|
+
appendLeft(index, content) {
|
|
38239
|
+
index = index + this.offset;
|
|
38240
|
+
if (typeof content !== "string")
|
|
38241
|
+
throw new TypeError("inserted content must be a string");
|
|
38242
|
+
this._split(index);
|
|
38243
|
+
const chunk = this.byEnd[index];
|
|
38244
|
+
if (chunk) {
|
|
38245
|
+
chunk.appendLeft(content);
|
|
38246
|
+
} else {
|
|
38247
|
+
this.intro += content;
|
|
38248
|
+
}
|
|
38249
|
+
return this;
|
|
38250
|
+
}
|
|
38251
|
+
appendRight(index, content) {
|
|
38252
|
+
index = index + this.offset;
|
|
38253
|
+
if (typeof content !== "string")
|
|
38254
|
+
throw new TypeError("inserted content must be a string");
|
|
38255
|
+
this._split(index);
|
|
38256
|
+
const chunk = this.byStart[index];
|
|
38257
|
+
if (chunk) {
|
|
38258
|
+
chunk.appendRight(content);
|
|
38259
|
+
} else {
|
|
38260
|
+
this.outro += content;
|
|
38261
|
+
}
|
|
38262
|
+
return this;
|
|
38263
|
+
}
|
|
38264
|
+
clone() {
|
|
38265
|
+
const cloned = new MagicString(this.original, { filename: this.filename, offset: this.offset });
|
|
38266
|
+
let originalChunk = this.firstChunk;
|
|
38267
|
+
let clonedChunk = cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone();
|
|
38268
|
+
while (originalChunk) {
|
|
38269
|
+
cloned.byStart[clonedChunk.start] = clonedChunk;
|
|
38270
|
+
cloned.byEnd[clonedChunk.end] = clonedChunk;
|
|
38271
|
+
const nextOriginalChunk = originalChunk.next;
|
|
38272
|
+
const nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
|
|
38273
|
+
if (nextClonedChunk) {
|
|
38274
|
+
clonedChunk.next = nextClonedChunk;
|
|
38275
|
+
nextClonedChunk.previous = clonedChunk;
|
|
38276
|
+
clonedChunk = nextClonedChunk;
|
|
38277
|
+
}
|
|
38278
|
+
originalChunk = nextOriginalChunk;
|
|
38279
|
+
}
|
|
38280
|
+
cloned.lastChunk = clonedChunk;
|
|
38281
|
+
if (this.indentExclusionRanges) {
|
|
38282
|
+
cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
|
|
38283
|
+
}
|
|
38284
|
+
cloned.sourcemapLocations = new BitSet(this.sourcemapLocations);
|
|
38285
|
+
cloned.intro = this.intro;
|
|
38286
|
+
cloned.outro = this.outro;
|
|
38287
|
+
return cloned;
|
|
38288
|
+
}
|
|
38289
|
+
generateDecodedMap(options) {
|
|
38290
|
+
options = options || {};
|
|
38291
|
+
const sourceIndex = 0;
|
|
38292
|
+
const names = Object.keys(this.storedNames);
|
|
38293
|
+
const mappings = new Mappings(options.hires);
|
|
38294
|
+
const locate = getLocator(this.original);
|
|
38295
|
+
if (this.intro) {
|
|
38296
|
+
mappings.advance(this.intro);
|
|
38297
|
+
}
|
|
38298
|
+
this.firstChunk.eachNext((chunk) => {
|
|
38299
|
+
const loc = locate(chunk.start);
|
|
38300
|
+
if (chunk.intro.length)
|
|
38301
|
+
mappings.advance(chunk.intro);
|
|
38302
|
+
if (chunk.edited) {
|
|
38303
|
+
mappings.addEdit(sourceIndex, chunk.content, loc, chunk.storeName ? names.indexOf(chunk.original) : -1);
|
|
38304
|
+
} else {
|
|
38305
|
+
mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);
|
|
38306
|
+
}
|
|
38307
|
+
if (chunk.outro.length)
|
|
38308
|
+
mappings.advance(chunk.outro);
|
|
38309
|
+
});
|
|
38310
|
+
if (this.outro) {
|
|
38311
|
+
mappings.advance(this.outro);
|
|
38312
|
+
}
|
|
38313
|
+
return {
|
|
38314
|
+
file: options.file ? options.file.split(/[/\\]/).pop() : undefined,
|
|
38315
|
+
sources: [
|
|
38316
|
+
options.source ? getRelativePath(options.file || "", options.source) : options.file || ""
|
|
38317
|
+
],
|
|
38318
|
+
sourcesContent: options.includeContent ? [this.original] : undefined,
|
|
38319
|
+
names,
|
|
38320
|
+
mappings: mappings.raw,
|
|
38321
|
+
x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined
|
|
38322
|
+
};
|
|
38323
|
+
}
|
|
38324
|
+
generateMap(options) {
|
|
38325
|
+
return new SourceMap(this.generateDecodedMap(options));
|
|
38326
|
+
}
|
|
38327
|
+
_ensureindentStr() {
|
|
38328
|
+
if (this.indentStr === undefined) {
|
|
38329
|
+
this.indentStr = guessIndent(this.original);
|
|
38330
|
+
}
|
|
38331
|
+
}
|
|
38332
|
+
_getRawIndentString() {
|
|
38333
|
+
this._ensureindentStr();
|
|
38334
|
+
return this.indentStr;
|
|
38335
|
+
}
|
|
38336
|
+
getIndentString() {
|
|
38337
|
+
this._ensureindentStr();
|
|
38338
|
+
return this.indentStr === null ? "\t" : this.indentStr;
|
|
38339
|
+
}
|
|
38340
|
+
indent(indentStr, options) {
|
|
38341
|
+
const pattern = /^[^\r\n]/gm;
|
|
38342
|
+
if (isObject(indentStr)) {
|
|
38343
|
+
options = indentStr;
|
|
38344
|
+
indentStr = undefined;
|
|
38345
|
+
}
|
|
38346
|
+
if (indentStr === undefined) {
|
|
38347
|
+
this._ensureindentStr();
|
|
38348
|
+
indentStr = this.indentStr || "\t";
|
|
38349
|
+
}
|
|
38350
|
+
if (indentStr === "")
|
|
38351
|
+
return this;
|
|
38352
|
+
options = options || {};
|
|
38353
|
+
const isExcluded = {};
|
|
38354
|
+
if (options.exclude) {
|
|
38355
|
+
const exclusions = typeof options.exclude[0] === "number" ? [options.exclude] : options.exclude;
|
|
38356
|
+
exclusions.forEach((exclusion) => {
|
|
38357
|
+
for (let i = exclusion[0];i < exclusion[1]; i += 1) {
|
|
38358
|
+
isExcluded[i] = true;
|
|
38359
|
+
}
|
|
38360
|
+
});
|
|
38361
|
+
}
|
|
38362
|
+
let shouldIndentNextCharacter = options.indentStart !== false;
|
|
38363
|
+
const replacer = (match) => {
|
|
38364
|
+
if (shouldIndentNextCharacter)
|
|
38365
|
+
return `${indentStr}${match}`;
|
|
38366
|
+
shouldIndentNextCharacter = true;
|
|
38367
|
+
return match;
|
|
38368
|
+
};
|
|
38369
|
+
this.intro = this.intro.replace(pattern, replacer);
|
|
38370
|
+
let charIndex = 0;
|
|
38371
|
+
let chunk = this.firstChunk;
|
|
38372
|
+
while (chunk) {
|
|
38373
|
+
const end = chunk.end;
|
|
38374
|
+
if (chunk.edited) {
|
|
38375
|
+
if (!isExcluded[charIndex]) {
|
|
38376
|
+
chunk.content = chunk.content.replace(pattern, replacer);
|
|
38377
|
+
if (chunk.content.length) {
|
|
38378
|
+
shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === `
|
|
38379
|
+
`;
|
|
38380
|
+
}
|
|
38381
|
+
}
|
|
38382
|
+
} else {
|
|
38383
|
+
charIndex = chunk.start;
|
|
38384
|
+
while (charIndex < end) {
|
|
38385
|
+
if (!isExcluded[charIndex]) {
|
|
38386
|
+
const char = this.original[charIndex];
|
|
38387
|
+
if (char === `
|
|
38388
|
+
`) {
|
|
38389
|
+
shouldIndentNextCharacter = true;
|
|
38390
|
+
} else if (char !== "\r" && shouldIndentNextCharacter) {
|
|
38391
|
+
shouldIndentNextCharacter = false;
|
|
38392
|
+
if (charIndex === chunk.start) {
|
|
38393
|
+
chunk.prependRight(indentStr);
|
|
38394
|
+
} else {
|
|
38395
|
+
this._splitChunk(chunk, charIndex);
|
|
38396
|
+
chunk = chunk.next;
|
|
38397
|
+
chunk.prependRight(indentStr);
|
|
38398
|
+
}
|
|
38399
|
+
}
|
|
38400
|
+
}
|
|
38401
|
+
charIndex += 1;
|
|
38402
|
+
}
|
|
38403
|
+
}
|
|
38404
|
+
charIndex = chunk.end;
|
|
38405
|
+
chunk = chunk.next;
|
|
38406
|
+
}
|
|
38407
|
+
this.outro = this.outro.replace(pattern, replacer);
|
|
38408
|
+
return this;
|
|
38409
|
+
}
|
|
38410
|
+
insert() {
|
|
38411
|
+
throw new Error("magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)");
|
|
38412
|
+
}
|
|
38413
|
+
insertLeft(index, content) {
|
|
38414
|
+
if (!warned.insertLeft) {
|
|
38415
|
+
console.warn("magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead");
|
|
38416
|
+
warned.insertLeft = true;
|
|
38417
|
+
}
|
|
38418
|
+
return this.appendLeft(index, content);
|
|
38419
|
+
}
|
|
38420
|
+
insertRight(index, content) {
|
|
38421
|
+
if (!warned.insertRight) {
|
|
38422
|
+
console.warn("magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead");
|
|
38423
|
+
warned.insertRight = true;
|
|
38424
|
+
}
|
|
38425
|
+
return this.prependRight(index, content);
|
|
38426
|
+
}
|
|
38427
|
+
move(start, end, index) {
|
|
38428
|
+
start = start + this.offset;
|
|
38429
|
+
end = end + this.offset;
|
|
38430
|
+
index = index + this.offset;
|
|
38431
|
+
if (index >= start && index <= end)
|
|
38432
|
+
throw new Error("Cannot move a selection inside itself");
|
|
38433
|
+
this._split(start);
|
|
38434
|
+
this._split(end);
|
|
38435
|
+
this._split(index);
|
|
38436
|
+
const first = this.byStart[start];
|
|
38437
|
+
const last = this.byEnd[end];
|
|
38438
|
+
const oldLeft = first.previous;
|
|
38439
|
+
const oldRight = last.next;
|
|
38440
|
+
const newRight = this.byStart[index];
|
|
38441
|
+
if (!newRight && last === this.lastChunk)
|
|
38442
|
+
return this;
|
|
38443
|
+
const newLeft = newRight ? newRight.previous : this.lastChunk;
|
|
38444
|
+
if (oldLeft)
|
|
38445
|
+
oldLeft.next = oldRight;
|
|
38446
|
+
if (oldRight)
|
|
38447
|
+
oldRight.previous = oldLeft;
|
|
38448
|
+
if (newLeft)
|
|
38449
|
+
newLeft.next = first;
|
|
38450
|
+
if (newRight)
|
|
38451
|
+
newRight.previous = last;
|
|
38452
|
+
if (!first.previous)
|
|
38453
|
+
this.firstChunk = last.next;
|
|
38454
|
+
if (!last.next) {
|
|
38455
|
+
this.lastChunk = first.previous;
|
|
38456
|
+
this.lastChunk.next = null;
|
|
38457
|
+
}
|
|
38458
|
+
first.previous = newLeft;
|
|
38459
|
+
last.next = newRight || null;
|
|
38460
|
+
if (!newLeft)
|
|
38461
|
+
this.firstChunk = first;
|
|
38462
|
+
if (!newRight)
|
|
38463
|
+
this.lastChunk = last;
|
|
38464
|
+
return this;
|
|
38465
|
+
}
|
|
38466
|
+
overwrite(start, end, content, options) {
|
|
38467
|
+
options = options || {};
|
|
38468
|
+
return this.update(start, end, content, { ...options, overwrite: !options.contentOnly });
|
|
38469
|
+
}
|
|
38470
|
+
update(start, end, content, options) {
|
|
38471
|
+
start = start + this.offset;
|
|
38472
|
+
end = end + this.offset;
|
|
38473
|
+
if (typeof content !== "string")
|
|
38474
|
+
throw new TypeError("replacement content must be a string");
|
|
38475
|
+
if (this.original.length !== 0) {
|
|
38476
|
+
while (start < 0)
|
|
38477
|
+
start += this.original.length;
|
|
38478
|
+
while (end < 0)
|
|
38479
|
+
end += this.original.length;
|
|
38480
|
+
}
|
|
38481
|
+
if (end > this.original.length)
|
|
38482
|
+
throw new Error("end is out of bounds");
|
|
38483
|
+
if (start === end)
|
|
38484
|
+
throw new Error("Cannot overwrite a zero-length range \u2013 use appendLeft or prependRight instead");
|
|
38485
|
+
this._split(start);
|
|
38486
|
+
this._split(end);
|
|
38487
|
+
if (options === true) {
|
|
38488
|
+
if (!warned.storeName) {
|
|
38489
|
+
console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string");
|
|
38490
|
+
warned.storeName = true;
|
|
38491
|
+
}
|
|
38492
|
+
options = { storeName: true };
|
|
38493
|
+
}
|
|
38494
|
+
const storeName = options !== undefined ? options.storeName : false;
|
|
38495
|
+
const overwrite = options !== undefined ? options.overwrite : false;
|
|
38496
|
+
if (storeName) {
|
|
38497
|
+
const original = this.original.slice(start, end);
|
|
38498
|
+
Object.defineProperty(this.storedNames, original, {
|
|
38499
|
+
writable: true,
|
|
38500
|
+
value: true,
|
|
38501
|
+
enumerable: true
|
|
38502
|
+
});
|
|
38503
|
+
}
|
|
38504
|
+
const first = this.byStart[start];
|
|
38505
|
+
const last = this.byEnd[end];
|
|
38506
|
+
if (first) {
|
|
38507
|
+
let chunk = first;
|
|
38508
|
+
while (chunk !== last) {
|
|
38509
|
+
if (chunk.next !== this.byStart[chunk.end]) {
|
|
38510
|
+
throw new Error("Cannot overwrite across a split point");
|
|
38511
|
+
}
|
|
38512
|
+
chunk = chunk.next;
|
|
38513
|
+
chunk.edit("", false);
|
|
38514
|
+
}
|
|
38515
|
+
first.edit(content, storeName, !overwrite);
|
|
38516
|
+
} else {
|
|
38517
|
+
const newChunk = new Chunk(start, end, "").edit(content, storeName);
|
|
38518
|
+
last.next = newChunk;
|
|
38519
|
+
newChunk.previous = last;
|
|
38520
|
+
}
|
|
38521
|
+
return this;
|
|
38522
|
+
}
|
|
38523
|
+
prepend(content) {
|
|
38524
|
+
if (typeof content !== "string")
|
|
38525
|
+
throw new TypeError("outro content must be a string");
|
|
38526
|
+
this.intro = content + this.intro;
|
|
38527
|
+
return this;
|
|
38528
|
+
}
|
|
38529
|
+
prependLeft(index, content) {
|
|
38530
|
+
index = index + this.offset;
|
|
38531
|
+
if (typeof content !== "string")
|
|
38532
|
+
throw new TypeError("inserted content must be a string");
|
|
38533
|
+
this._split(index);
|
|
38534
|
+
const chunk = this.byEnd[index];
|
|
38535
|
+
if (chunk) {
|
|
38536
|
+
chunk.prependLeft(content);
|
|
38537
|
+
} else {
|
|
38538
|
+
this.intro = content + this.intro;
|
|
38539
|
+
}
|
|
38540
|
+
return this;
|
|
38541
|
+
}
|
|
38542
|
+
prependRight(index, content) {
|
|
38543
|
+
index = index + this.offset;
|
|
38544
|
+
if (typeof content !== "string")
|
|
38545
|
+
throw new TypeError("inserted content must be a string");
|
|
38546
|
+
this._split(index);
|
|
38547
|
+
const chunk = this.byStart[index];
|
|
38548
|
+
if (chunk) {
|
|
38549
|
+
chunk.prependRight(content);
|
|
38550
|
+
} else {
|
|
38551
|
+
this.outro = content + this.outro;
|
|
38552
|
+
}
|
|
38553
|
+
return this;
|
|
38554
|
+
}
|
|
38555
|
+
remove(start, end) {
|
|
38556
|
+
start = start + this.offset;
|
|
38557
|
+
end = end + this.offset;
|
|
38558
|
+
if (this.original.length !== 0) {
|
|
38559
|
+
while (start < 0)
|
|
38560
|
+
start += this.original.length;
|
|
38561
|
+
while (end < 0)
|
|
38562
|
+
end += this.original.length;
|
|
38563
|
+
}
|
|
38564
|
+
if (start === end)
|
|
38565
|
+
return this;
|
|
38566
|
+
if (start < 0 || end > this.original.length)
|
|
38567
|
+
throw new Error("Character is out of bounds");
|
|
38568
|
+
if (start > end)
|
|
38569
|
+
throw new Error("end must be greater than start");
|
|
38570
|
+
this._split(start);
|
|
38571
|
+
this._split(end);
|
|
38572
|
+
let chunk = this.byStart[start];
|
|
38573
|
+
while (chunk) {
|
|
38574
|
+
chunk.intro = "";
|
|
38575
|
+
chunk.outro = "";
|
|
38576
|
+
chunk.edit("");
|
|
38577
|
+
chunk = end > chunk.end ? this.byStart[chunk.end] : null;
|
|
38578
|
+
}
|
|
38579
|
+
return this;
|
|
38580
|
+
}
|
|
38581
|
+
reset(start, end) {
|
|
38582
|
+
start = start + this.offset;
|
|
38583
|
+
end = end + this.offset;
|
|
38584
|
+
if (this.original.length !== 0) {
|
|
38585
|
+
while (start < 0)
|
|
38586
|
+
start += this.original.length;
|
|
38587
|
+
while (end < 0)
|
|
38588
|
+
end += this.original.length;
|
|
38589
|
+
}
|
|
38590
|
+
if (start === end)
|
|
38591
|
+
return this;
|
|
38592
|
+
if (start < 0 || end > this.original.length)
|
|
38593
|
+
throw new Error("Character is out of bounds");
|
|
38594
|
+
if (start > end)
|
|
38595
|
+
throw new Error("end must be greater than start");
|
|
38596
|
+
this._split(start);
|
|
38597
|
+
this._split(end);
|
|
38598
|
+
let chunk = this.byStart[start];
|
|
38599
|
+
while (chunk) {
|
|
38600
|
+
chunk.reset();
|
|
38601
|
+
chunk = end > chunk.end ? this.byStart[chunk.end] : null;
|
|
38602
|
+
}
|
|
38603
|
+
return this;
|
|
38604
|
+
}
|
|
38605
|
+
lastChar() {
|
|
38606
|
+
if (this.outro.length)
|
|
38607
|
+
return this.outro[this.outro.length - 1];
|
|
38608
|
+
let chunk = this.lastChunk;
|
|
38609
|
+
do {
|
|
38610
|
+
if (chunk.outro.length)
|
|
38611
|
+
return chunk.outro[chunk.outro.length - 1];
|
|
38612
|
+
if (chunk.content.length)
|
|
38613
|
+
return chunk.content[chunk.content.length - 1];
|
|
38614
|
+
if (chunk.intro.length)
|
|
38615
|
+
return chunk.intro[chunk.intro.length - 1];
|
|
38616
|
+
} while (chunk = chunk.previous);
|
|
38617
|
+
if (this.intro.length)
|
|
38618
|
+
return this.intro[this.intro.length - 1];
|
|
38619
|
+
return "";
|
|
38620
|
+
}
|
|
38621
|
+
lastLine() {
|
|
38622
|
+
let lineIndex = this.outro.lastIndexOf(n);
|
|
38623
|
+
if (lineIndex !== -1)
|
|
38624
|
+
return this.outro.substr(lineIndex + 1);
|
|
38625
|
+
let lineStr = this.outro;
|
|
38626
|
+
let chunk = this.lastChunk;
|
|
38627
|
+
do {
|
|
38628
|
+
if (chunk.outro.length > 0) {
|
|
38629
|
+
lineIndex = chunk.outro.lastIndexOf(n);
|
|
38630
|
+
if (lineIndex !== -1)
|
|
38631
|
+
return chunk.outro.substr(lineIndex + 1) + lineStr;
|
|
38632
|
+
lineStr = chunk.outro + lineStr;
|
|
38633
|
+
}
|
|
38634
|
+
if (chunk.content.length > 0) {
|
|
38635
|
+
lineIndex = chunk.content.lastIndexOf(n);
|
|
38636
|
+
if (lineIndex !== -1)
|
|
38637
|
+
return chunk.content.substr(lineIndex + 1) + lineStr;
|
|
38638
|
+
lineStr = chunk.content + lineStr;
|
|
38639
|
+
}
|
|
38640
|
+
if (chunk.intro.length > 0) {
|
|
38641
|
+
lineIndex = chunk.intro.lastIndexOf(n);
|
|
38642
|
+
if (lineIndex !== -1)
|
|
38643
|
+
return chunk.intro.substr(lineIndex + 1) + lineStr;
|
|
38644
|
+
lineStr = chunk.intro + lineStr;
|
|
38645
|
+
}
|
|
38646
|
+
} while (chunk = chunk.previous);
|
|
38647
|
+
lineIndex = this.intro.lastIndexOf(n);
|
|
38648
|
+
if (lineIndex !== -1)
|
|
38649
|
+
return this.intro.substr(lineIndex + 1) + lineStr;
|
|
38650
|
+
return this.intro + lineStr;
|
|
38651
|
+
}
|
|
38652
|
+
slice(start = 0, end = this.original.length - this.offset) {
|
|
38653
|
+
start = start + this.offset;
|
|
38654
|
+
end = end + this.offset;
|
|
38655
|
+
if (this.original.length !== 0) {
|
|
38656
|
+
while (start < 0)
|
|
38657
|
+
start += this.original.length;
|
|
38658
|
+
while (end < 0)
|
|
38659
|
+
end += this.original.length;
|
|
38660
|
+
}
|
|
38661
|
+
let result = "";
|
|
38662
|
+
let chunk = this.firstChunk;
|
|
38663
|
+
while (chunk && (chunk.start > start || chunk.end <= start)) {
|
|
38664
|
+
if (chunk.start < end && chunk.end >= end) {
|
|
38665
|
+
return result;
|
|
38666
|
+
}
|
|
38667
|
+
chunk = chunk.next;
|
|
38668
|
+
}
|
|
38669
|
+
if (chunk && chunk.edited && chunk.start !== start)
|
|
38670
|
+
throw new Error(`Cannot use replaced character ${start} as slice start anchor.`);
|
|
38671
|
+
const startChunk = chunk;
|
|
38672
|
+
while (chunk) {
|
|
38673
|
+
if (chunk.intro && (startChunk !== chunk || chunk.start === start)) {
|
|
38674
|
+
result += chunk.intro;
|
|
38675
|
+
}
|
|
38676
|
+
const containsEnd = chunk.start < end && chunk.end >= end;
|
|
38677
|
+
if (containsEnd && chunk.edited && chunk.end !== end)
|
|
38678
|
+
throw new Error(`Cannot use replaced character ${end} as slice end anchor.`);
|
|
38679
|
+
const sliceStart = startChunk === chunk ? start - chunk.start : 0;
|
|
38680
|
+
const sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
|
|
38681
|
+
result += chunk.content.slice(sliceStart, sliceEnd);
|
|
38682
|
+
if (chunk.outro && (!containsEnd || chunk.end === end)) {
|
|
38683
|
+
result += chunk.outro;
|
|
38684
|
+
}
|
|
38685
|
+
if (containsEnd) {
|
|
38686
|
+
break;
|
|
38687
|
+
}
|
|
38688
|
+
chunk = chunk.next;
|
|
38689
|
+
}
|
|
38690
|
+
return result;
|
|
38691
|
+
}
|
|
38692
|
+
snip(start, end) {
|
|
38693
|
+
const clone = this.clone();
|
|
38694
|
+
clone.remove(0, start);
|
|
38695
|
+
clone.remove(end, clone.original.length);
|
|
38696
|
+
return clone;
|
|
38697
|
+
}
|
|
38698
|
+
_split(index) {
|
|
38699
|
+
if (this.byStart[index] || this.byEnd[index])
|
|
38700
|
+
return;
|
|
38701
|
+
let chunk = this.lastSearchedChunk;
|
|
38702
|
+
let previousChunk = chunk;
|
|
38703
|
+
const searchForward = index > chunk.end;
|
|
38704
|
+
while (chunk) {
|
|
38705
|
+
if (chunk.contains(index))
|
|
38706
|
+
return this._splitChunk(chunk, index);
|
|
38707
|
+
chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
|
|
38708
|
+
if (chunk === previousChunk)
|
|
38709
|
+
return;
|
|
38710
|
+
previousChunk = chunk;
|
|
38711
|
+
}
|
|
38712
|
+
}
|
|
38713
|
+
_splitChunk(chunk, index) {
|
|
38714
|
+
if (chunk.edited && chunk.content.length) {
|
|
38715
|
+
const loc = getLocator(this.original)(index);
|
|
38716
|
+
throw new Error(`Cannot split a chunk that has already been edited (${loc.line}:${loc.column} \u2013 "${chunk.original}")`);
|
|
38717
|
+
}
|
|
38718
|
+
const newChunk = chunk.split(index);
|
|
38719
|
+
this.byEnd[index] = chunk;
|
|
38720
|
+
this.byStart[index] = newChunk;
|
|
38721
|
+
this.byEnd[newChunk.end] = newChunk;
|
|
38722
|
+
if (chunk === this.lastChunk)
|
|
38723
|
+
this.lastChunk = newChunk;
|
|
38724
|
+
this.lastSearchedChunk = chunk;
|
|
38725
|
+
return true;
|
|
38726
|
+
}
|
|
38727
|
+
toString() {
|
|
38728
|
+
let str = this.intro;
|
|
38729
|
+
let chunk = this.firstChunk;
|
|
38730
|
+
while (chunk) {
|
|
38731
|
+
str += chunk.toString();
|
|
38732
|
+
chunk = chunk.next;
|
|
38733
|
+
}
|
|
38734
|
+
return str + this.outro;
|
|
38735
|
+
}
|
|
38736
|
+
isEmpty() {
|
|
38737
|
+
let chunk = this.firstChunk;
|
|
38738
|
+
do {
|
|
38739
|
+
if (chunk.intro.length && chunk.intro.trim() || chunk.content.length && chunk.content.trim() || chunk.outro.length && chunk.outro.trim())
|
|
38740
|
+
return false;
|
|
38741
|
+
} while (chunk = chunk.next);
|
|
38742
|
+
return true;
|
|
38743
|
+
}
|
|
38744
|
+
length() {
|
|
38745
|
+
let chunk = this.firstChunk;
|
|
38746
|
+
let length = 0;
|
|
38747
|
+
do {
|
|
38748
|
+
length += chunk.intro.length + chunk.content.length + chunk.outro.length;
|
|
38749
|
+
} while (chunk = chunk.next);
|
|
38750
|
+
return length;
|
|
38751
|
+
}
|
|
38752
|
+
trimLines() {
|
|
38753
|
+
return this.trim("[\\r\\n]");
|
|
38754
|
+
}
|
|
38755
|
+
trim(charType) {
|
|
38756
|
+
return this.trimStart(charType).trimEnd(charType);
|
|
38757
|
+
}
|
|
38758
|
+
trimEndAborted(charType) {
|
|
38759
|
+
const rx = new RegExp((charType || "\\s") + "+$");
|
|
38760
|
+
this.outro = this.outro.replace(rx, "");
|
|
38761
|
+
if (this.outro.length)
|
|
38762
|
+
return true;
|
|
38763
|
+
let chunk = this.lastChunk;
|
|
38764
|
+
do {
|
|
38765
|
+
const end = chunk.end;
|
|
38766
|
+
const aborted = chunk.trimEnd(rx);
|
|
38767
|
+
if (chunk.end !== end) {
|
|
38768
|
+
if (this.lastChunk === chunk) {
|
|
38769
|
+
this.lastChunk = chunk.next;
|
|
38770
|
+
}
|
|
38771
|
+
this.byEnd[chunk.end] = chunk;
|
|
38772
|
+
this.byStart[chunk.next.start] = chunk.next;
|
|
38773
|
+
this.byEnd[chunk.next.end] = chunk.next;
|
|
38774
|
+
}
|
|
38775
|
+
if (aborted)
|
|
38776
|
+
return true;
|
|
38777
|
+
chunk = chunk.previous;
|
|
38778
|
+
} while (chunk);
|
|
38779
|
+
return false;
|
|
38780
|
+
}
|
|
38781
|
+
trimEnd(charType) {
|
|
38782
|
+
this.trimEndAborted(charType);
|
|
38783
|
+
return this;
|
|
38784
|
+
}
|
|
38785
|
+
trimStartAborted(charType) {
|
|
38786
|
+
const rx = new RegExp("^" + (charType || "\\s") + "+");
|
|
38787
|
+
this.intro = this.intro.replace(rx, "");
|
|
38788
|
+
if (this.intro.length)
|
|
38789
|
+
return true;
|
|
38790
|
+
let chunk = this.firstChunk;
|
|
38791
|
+
do {
|
|
38792
|
+
const end = chunk.end;
|
|
38793
|
+
const aborted = chunk.trimStart(rx);
|
|
38794
|
+
if (chunk.end !== end) {
|
|
38795
|
+
if (chunk === this.lastChunk)
|
|
38796
|
+
this.lastChunk = chunk.next;
|
|
38797
|
+
this.byEnd[chunk.end] = chunk;
|
|
38798
|
+
this.byStart[chunk.next.start] = chunk.next;
|
|
38799
|
+
this.byEnd[chunk.next.end] = chunk.next;
|
|
38800
|
+
}
|
|
38801
|
+
if (aborted)
|
|
38802
|
+
return true;
|
|
38803
|
+
chunk = chunk.next;
|
|
38804
|
+
} while (chunk);
|
|
38805
|
+
return false;
|
|
38806
|
+
}
|
|
38807
|
+
trimStart(charType) {
|
|
38808
|
+
this.trimStartAborted(charType);
|
|
38809
|
+
return this;
|
|
38810
|
+
}
|
|
38811
|
+
hasChanged() {
|
|
38812
|
+
return this.original !== this.toString();
|
|
38813
|
+
}
|
|
38814
|
+
_replaceRegexp(searchValue, replacement) {
|
|
38815
|
+
function getReplacement(match, str) {
|
|
38816
|
+
if (typeof replacement === "string") {
|
|
38817
|
+
return replacement.replace(/\$(\$|&|\d+)/g, (_, i) => {
|
|
38818
|
+
if (i === "$")
|
|
38819
|
+
return "$";
|
|
38820
|
+
if (i === "&")
|
|
38821
|
+
return match[0];
|
|
38822
|
+
const num = +i;
|
|
38823
|
+
if (num < match.length)
|
|
38824
|
+
return match[+i];
|
|
38825
|
+
return `$${i}`;
|
|
38826
|
+
});
|
|
38827
|
+
} else {
|
|
38828
|
+
return replacement(...match, match.index, str, match.groups);
|
|
38829
|
+
}
|
|
38830
|
+
}
|
|
38831
|
+
function matchAll(re, str) {
|
|
38832
|
+
let match;
|
|
38833
|
+
const matches = [];
|
|
38834
|
+
while (match = re.exec(str)) {
|
|
38835
|
+
matches.push(match);
|
|
38836
|
+
}
|
|
38837
|
+
return matches;
|
|
38838
|
+
}
|
|
38839
|
+
if (searchValue.global) {
|
|
38840
|
+
const matches = matchAll(searchValue, this.original);
|
|
38841
|
+
matches.forEach((match) => {
|
|
38842
|
+
if (match.index != null) {
|
|
38843
|
+
const replacement2 = getReplacement(match, this.original);
|
|
38844
|
+
if (replacement2 !== match[0]) {
|
|
38845
|
+
this.overwrite(match.index, match.index + match[0].length, replacement2);
|
|
38846
|
+
}
|
|
38847
|
+
}
|
|
38848
|
+
});
|
|
38849
|
+
} else {
|
|
38850
|
+
const match = this.original.match(searchValue);
|
|
38851
|
+
if (match && match.index != null) {
|
|
38852
|
+
const replacement2 = getReplacement(match, this.original);
|
|
38853
|
+
if (replacement2 !== match[0]) {
|
|
38854
|
+
this.overwrite(match.index, match.index + match[0].length, replacement2);
|
|
38855
|
+
}
|
|
38856
|
+
}
|
|
38857
|
+
}
|
|
38858
|
+
return this;
|
|
38859
|
+
}
|
|
38860
|
+
_replaceString(string, replacement) {
|
|
38861
|
+
const { original } = this;
|
|
38862
|
+
const index = original.indexOf(string);
|
|
38863
|
+
if (index !== -1) {
|
|
38864
|
+
if (typeof replacement === "function") {
|
|
38865
|
+
replacement = replacement(string, index, original);
|
|
38866
|
+
}
|
|
38867
|
+
if (string !== replacement) {
|
|
38868
|
+
this.overwrite(index, index + string.length, replacement);
|
|
38869
|
+
}
|
|
38870
|
+
}
|
|
38871
|
+
return this;
|
|
38872
|
+
}
|
|
38873
|
+
replace(searchValue, replacement) {
|
|
38874
|
+
if (typeof searchValue === "string") {
|
|
38875
|
+
return this._replaceString(searchValue, replacement);
|
|
38876
|
+
}
|
|
38877
|
+
return this._replaceRegexp(searchValue, replacement);
|
|
38878
|
+
}
|
|
38879
|
+
_replaceAllString(string, replacement) {
|
|
38880
|
+
const { original } = this;
|
|
38881
|
+
const stringLength = string.length;
|
|
38882
|
+
for (let index = original.indexOf(string);index !== -1; index = original.indexOf(string, index + stringLength)) {
|
|
38883
|
+
const previous = original.slice(index, index + stringLength);
|
|
38884
|
+
let _replacement = replacement;
|
|
38885
|
+
if (typeof replacement === "function") {
|
|
38886
|
+
_replacement = replacement(previous, index, original);
|
|
38887
|
+
}
|
|
38888
|
+
if (previous !== _replacement)
|
|
38889
|
+
this.overwrite(index, index + stringLength, _replacement);
|
|
38890
|
+
}
|
|
38891
|
+
return this;
|
|
38892
|
+
}
|
|
38893
|
+
replaceAll(searchValue, replacement) {
|
|
38894
|
+
if (typeof searchValue === "string") {
|
|
38895
|
+
return this._replaceAllString(searchValue, replacement);
|
|
38896
|
+
}
|
|
38897
|
+
if (!searchValue.global) {
|
|
38898
|
+
throw new TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument");
|
|
38899
|
+
}
|
|
38900
|
+
return this._replaceRegexp(searchValue, replacement);
|
|
38901
|
+
}
|
|
38902
|
+
}
|
|
38903
|
+
|
|
38904
|
+
// vite/dictionaryPlugin.ts
|
|
38905
|
+
import { parseAstAsync } from "vite";
|
|
38906
|
+
|
|
38907
|
+
// i18n/dictionaryShape.ts
|
|
38908
|
+
function dictionaryLocales(translations, sourceLocale) {
|
|
38909
|
+
const locales = [];
|
|
38910
|
+
const seen = new Set;
|
|
38911
|
+
if (sourceLocale) {
|
|
38912
|
+
seen.add(sourceLocale);
|
|
38913
|
+
locales.push(sourceLocale);
|
|
38914
|
+
}
|
|
38915
|
+
for (const byLocale of Object.values(translations)) {
|
|
38916
|
+
for (const locale of Object.keys(byLocale)) {
|
|
38917
|
+
if (!seen.has(locale)) {
|
|
38918
|
+
seen.add(locale);
|
|
38919
|
+
locales.push(locale);
|
|
38920
|
+
}
|
|
38921
|
+
}
|
|
38922
|
+
}
|
|
38923
|
+
return locales;
|
|
38924
|
+
}
|
|
38925
|
+
function localeStrings(translations, locale, fallbackOrder = dictionaryLocales(translations)) {
|
|
38926
|
+
const out = {};
|
|
38927
|
+
for (const [key, byLocale] of Object.entries(translations)) {
|
|
38928
|
+
let value = byLocale?.[locale];
|
|
38929
|
+
if (typeof value !== "string") {
|
|
38930
|
+
for (const candidate of fallbackOrder) {
|
|
38931
|
+
const fallback = byLocale?.[candidate];
|
|
38932
|
+
if (typeof fallback === "string") {
|
|
38933
|
+
value = fallback;
|
|
38934
|
+
break;
|
|
38935
|
+
}
|
|
38936
|
+
}
|
|
38937
|
+
}
|
|
38938
|
+
if (typeof value === "string") {
|
|
38939
|
+
out[key] = value;
|
|
38940
|
+
}
|
|
38941
|
+
}
|
|
38942
|
+
return out;
|
|
38943
|
+
}
|
|
38944
|
+
function findSourceDisagreement(translations) {
|
|
38945
|
+
let againstKey;
|
|
38946
|
+
let againstFirst;
|
|
38947
|
+
for (const [key, byLocale] of Object.entries(translations)) {
|
|
38948
|
+
const first = Object.keys(byLocale ?? {})[0];
|
|
38949
|
+
if (first === undefined)
|
|
38950
|
+
continue;
|
|
38951
|
+
if (againstFirst === undefined) {
|
|
38952
|
+
againstFirst = first;
|
|
38953
|
+
againstKey = key;
|
|
38954
|
+
continue;
|
|
38955
|
+
}
|
|
38956
|
+
if (first !== againstFirst) {
|
|
38957
|
+
return { key, first, againstKey, againstFirst };
|
|
38958
|
+
}
|
|
38959
|
+
}
|
|
38960
|
+
return null;
|
|
38961
|
+
}
|
|
38962
|
+
function canonicalizeDictionary(translations) {
|
|
38963
|
+
const keys = Object.keys(translations).sort();
|
|
38964
|
+
const parts = keys.map((key) => {
|
|
38965
|
+
const byLocale = translations[key] ?? {};
|
|
38966
|
+
const locales = Object.keys(byLocale).sort();
|
|
38967
|
+
const inner = locales.map((l) => JSON.stringify([l, byLocale[l]])).join(",");
|
|
38968
|
+
return `${JSON.stringify(key)}:[${inner}]`;
|
|
38969
|
+
});
|
|
38970
|
+
return `{${parts.join(",")}}`;
|
|
38971
|
+
}
|
|
38972
|
+
function dictionaryId(translations) {
|
|
38973
|
+
const input = canonicalizeDictionary(translations);
|
|
38974
|
+
let a = 2166136261;
|
|
38975
|
+
let b = 16777619;
|
|
38976
|
+
for (let i = 0;i < input.length; i++) {
|
|
38977
|
+
const c = input.charCodeAt(i);
|
|
38978
|
+
a = Math.imul(a ^ c, 16777619);
|
|
38979
|
+
b = Math.imul(b ^ c, 2166136261);
|
|
38980
|
+
}
|
|
38981
|
+
const hex = (n2) => (n2 >>> 0).toString(16).padStart(8, "0");
|
|
38982
|
+
return `d_${hex(a)}${hex(b)}`;
|
|
38983
|
+
}
|
|
38984
|
+
|
|
38985
|
+
// vite/dictionaryPlugin.ts
|
|
38986
|
+
var VIRTUAL_PREFIX = "virtual:gemi-dict/";
|
|
38987
|
+
var RESOLVED_PREFIX = "\x00virtual:gemi-dict/";
|
|
38988
|
+
var DICTIONARY_SOURCES = new Set(["gemi/dictionary", "gemi/client", "gemi/i18n"]);
|
|
38989
|
+
var RUNTIME_SOURCE = "gemi/dictionary";
|
|
38990
|
+
function gemiDictionaryPlugin() {
|
|
38991
|
+
const extracted = new Map;
|
|
38992
|
+
return {
|
|
38993
|
+
name: "gemi-plugin-dictionary",
|
|
38994
|
+
enforce: "post",
|
|
38995
|
+
resolveId(id) {
|
|
38996
|
+
if (id.startsWith(VIRTUAL_PREFIX)) {
|
|
38997
|
+
return `\x00${id}`;
|
|
38998
|
+
}
|
|
38999
|
+
return null;
|
|
39000
|
+
},
|
|
39001
|
+
async load(id) {
|
|
39002
|
+
if (!id.startsWith(RESOLVED_PREFIX)) {
|
|
39003
|
+
return null;
|
|
39004
|
+
}
|
|
39005
|
+
const rest = id.slice(RESOLVED_PREFIX.length);
|
|
39006
|
+
const slash = rest.lastIndexOf("/");
|
|
39007
|
+
const virtualKey = rest.slice(0, slash);
|
|
39008
|
+
const locale = rest.slice(slash + 1);
|
|
39009
|
+
let entry = extracted.get(virtualKey);
|
|
39010
|
+
if (!entry) {
|
|
39011
|
+
const sourceId = decodeSourceId(virtualKey);
|
|
39012
|
+
if (sourceId) {
|
|
39013
|
+
try {
|
|
39014
|
+
await this.load({ id: sourceId });
|
|
39015
|
+
} catch {}
|
|
39016
|
+
entry = extracted.get(virtualKey);
|
|
39017
|
+
}
|
|
39018
|
+
}
|
|
39019
|
+
if (!entry) {
|
|
39020
|
+
this.error(`No dictionary registered for "${virtualKey}". If this persists, restart the dev server.`);
|
|
39021
|
+
return null;
|
|
39022
|
+
}
|
|
39023
|
+
const strings = localeStrings(entry.translations, locale, entry.locales);
|
|
39024
|
+
return `export default ${JSON.stringify(strings)};
|
|
39025
|
+
`;
|
|
39026
|
+
},
|
|
39027
|
+
async transform(code, id) {
|
|
39028
|
+
if (!code.includes("defineDictionary")) {
|
|
39029
|
+
return null;
|
|
39030
|
+
}
|
|
39031
|
+
if (id.startsWith("\x00") || id.includes("/node_modules/")) {
|
|
39032
|
+
return null;
|
|
39033
|
+
}
|
|
39034
|
+
const ast = await parseAstAsync(code);
|
|
39035
|
+
const localNames = new Set;
|
|
39036
|
+
for (const node of ast.body) {
|
|
39037
|
+
if (node.type !== "ImportDeclaration")
|
|
39038
|
+
continue;
|
|
39039
|
+
if (!DICTIONARY_SOURCES.has(node.source?.value))
|
|
39040
|
+
continue;
|
|
39041
|
+
for (const spec of node.specifiers ?? []) {
|
|
39042
|
+
if (spec.type === "ImportSpecifier" && spec.imported?.name === "defineDictionary") {
|
|
39043
|
+
localNames.add(spec.local.name);
|
|
39044
|
+
}
|
|
39045
|
+
}
|
|
39046
|
+
}
|
|
39047
|
+
const calls = [];
|
|
39048
|
+
let unresolved = 0;
|
|
39049
|
+
walk2(ast, (node) => {
|
|
39050
|
+
if (node.type !== "CallExpression")
|
|
39051
|
+
return;
|
|
39052
|
+
const callee = node.callee;
|
|
39053
|
+
if (callee?.type === "Identifier" && localNames.has(callee.name)) {
|
|
39054
|
+
calls.push(node);
|
|
39055
|
+
return;
|
|
39056
|
+
}
|
|
39057
|
+
const name = callee?.type === "Identifier" ? callee.name : callee?.type === "MemberExpression" && !callee.computed ? callee.property?.name : undefined;
|
|
39058
|
+
if (name === "defineDictionary") {
|
|
39059
|
+
unresolved++;
|
|
39060
|
+
}
|
|
39061
|
+
});
|
|
39062
|
+
if (unresolved > 0 && declaresOwn(ast, "defineDictionary")) {
|
|
39063
|
+
unresolved = 0;
|
|
39064
|
+
}
|
|
39065
|
+
if (unresolved > 0) {
|
|
39066
|
+
this.warn(`${id}: ${unresolved} defineDictionary() call(s) could not be traced to an import of "gemi/dictionary", "gemi/client" or "gemi/i18n", so their locales were left inline and will all ship to the browser. Import defineDictionary directly by name rather than through a namespace import or a local re-export.`);
|
|
39067
|
+
}
|
|
39068
|
+
if (calls.length === 0) {
|
|
39069
|
+
return null;
|
|
39070
|
+
}
|
|
39071
|
+
const s = new MagicString(code);
|
|
39072
|
+
let rewrote = false;
|
|
39073
|
+
for (const call of calls) {
|
|
39074
|
+
if (call.arguments?.length < 1 || call.arguments?.length > 2) {
|
|
39075
|
+
this.error({
|
|
39076
|
+
message: `defineDictionary() takes an object literal and an optional options object.`,
|
|
39077
|
+
pos: call.start
|
|
39078
|
+
});
|
|
39079
|
+
}
|
|
39080
|
+
const translations = readObjectLiteral(call.arguments[0], (message) => this.error({ message, pos: call.arguments[0]?.start ?? call.start }));
|
|
39081
|
+
const sourceLocale = readSourceLocale(call.arguments[1], (message) => this.error({ message, pos: call.arguments[1]?.start ?? call.start }));
|
|
39082
|
+
const runtimeId = dictionaryId(translations);
|
|
39083
|
+
const virtualKey = `${Buffer.from(id).toString("base64url")}/${runtimeId}`;
|
|
39084
|
+
const locales = dictionaryLocales(translations, sourceLocale);
|
|
39085
|
+
if (locales.length === 0) {
|
|
39086
|
+
this.error({
|
|
39087
|
+
message: `defineDictionary() declares no locales \u2014 every key needs at least one "<locale>": "<string>" entry.`,
|
|
39088
|
+
pos: call.start
|
|
39089
|
+
});
|
|
39090
|
+
}
|
|
39091
|
+
if (!sourceLocale) {
|
|
39092
|
+
const clash = findSourceDisagreement(translations);
|
|
39093
|
+
if (clash) {
|
|
39094
|
+
this.error({
|
|
39095
|
+
message: `defineDictionary() cannot infer a source language. Key "${clash.againstKey}" lists "${clash.againstFirst}" first ` + `but "${clash.key}" lists "${clash.first}" first, so the locale every key falls back to depends on the order ` + `they are written in \u2014 moving one key would change what language a reader sees. ` + `Pass { sourceLocale: "<locale>" } as the second argument to pin it.`,
|
|
39096
|
+
pos: call.start
|
|
39097
|
+
});
|
|
39098
|
+
}
|
|
39099
|
+
}
|
|
39100
|
+
extracted.set(virtualKey, { id: runtimeId, locales, translations });
|
|
39101
|
+
const loaders = locales.map((locale) => `${JSON.stringify(locale)}:()=>import(${JSON.stringify(`${VIRTUAL_PREFIX}${virtualKey}/${locale}`)})`).join(",");
|
|
39102
|
+
s.overwrite(call.start, call.end, `__gemi_dict__(${JSON.stringify(runtimeId)},{${loaders}})`);
|
|
39103
|
+
rewrote = true;
|
|
39104
|
+
}
|
|
39105
|
+
if (!rewrote) {
|
|
39106
|
+
return null;
|
|
39107
|
+
}
|
|
39108
|
+
s.append(`
|
|
39109
|
+
import { __gemi_dict__ } from ${JSON.stringify(RUNTIME_SOURCE)};
|
|
39110
|
+
`);
|
|
39111
|
+
return { code: s.toString(), map: s.generateMap({ hires: true }) };
|
|
39112
|
+
}
|
|
39113
|
+
};
|
|
39114
|
+
}
|
|
39115
|
+
function decodeSourceId(virtualKey) {
|
|
39116
|
+
const slash = virtualKey.indexOf("/");
|
|
39117
|
+
if (slash === -1)
|
|
39118
|
+
return null;
|
|
39119
|
+
try {
|
|
39120
|
+
return Buffer.from(virtualKey.slice(0, slash), "base64url").toString("utf8");
|
|
39121
|
+
} catch {
|
|
39122
|
+
return null;
|
|
39123
|
+
}
|
|
39124
|
+
}
|
|
39125
|
+
function readObjectLiteral(node, fail) {
|
|
39126
|
+
if (node?.type !== "ObjectExpression") {
|
|
39127
|
+
fail(`defineDictionary() needs an inline object literal \u2014 it is read at build time, so a variable or spread cannot be resolved.`);
|
|
39128
|
+
}
|
|
39129
|
+
const out = {};
|
|
39130
|
+
for (const prop of node.properties) {
|
|
39131
|
+
const key = propertyName(prop);
|
|
39132
|
+
if (key === null) {
|
|
39133
|
+
fail(`defineDictionary() keys must be plain string keys \u2014 computed keys and spreads cannot be read at build time.`);
|
|
39134
|
+
}
|
|
39135
|
+
if (prop.value?.type !== "ObjectExpression") {
|
|
39136
|
+
fail(`defineDictionary() entry "${key}" must be an object of "<locale>": "<string>" pairs.`);
|
|
39137
|
+
}
|
|
39138
|
+
const byLocale = {};
|
|
39139
|
+
for (const localeProp of prop.value.properties) {
|
|
39140
|
+
const locale = propertyName(localeProp);
|
|
39141
|
+
if (locale === null) {
|
|
39142
|
+
fail(`defineDictionary() entry "${key}" has a locale key that cannot be read at build time.`);
|
|
39143
|
+
}
|
|
39144
|
+
const value = localeProp.value;
|
|
39145
|
+
if (value?.type !== "Literal" || typeof value.value !== "string") {
|
|
39146
|
+
fail(`defineDictionary() entry "${key}" locale "${locale}" must be a string literal. Use {{param}} interpolation instead of a template literal or a function.`);
|
|
39147
|
+
}
|
|
39148
|
+
byLocale[locale] = value.value;
|
|
39149
|
+
}
|
|
39150
|
+
out[key] = byLocale;
|
|
39151
|
+
}
|
|
39152
|
+
return out;
|
|
39153
|
+
}
|
|
39154
|
+
function readSourceLocale(node, fail) {
|
|
39155
|
+
if (node === undefined) {
|
|
39156
|
+
return;
|
|
39157
|
+
}
|
|
39158
|
+
if (node.type !== "ObjectExpression") {
|
|
39159
|
+
fail(`defineDictionary() options must be an inline object literal \u2014 it is read at build time.`);
|
|
39160
|
+
}
|
|
39161
|
+
for (const prop of node.properties) {
|
|
39162
|
+
if (propertyName(prop) !== "sourceLocale")
|
|
39163
|
+
continue;
|
|
39164
|
+
const value = prop.value;
|
|
39165
|
+
if (value?.type !== "Literal" || typeof value.value !== "string") {
|
|
39166
|
+
fail(`defineDictionary() sourceLocale must be a string literal.`);
|
|
39167
|
+
}
|
|
39168
|
+
return value.value;
|
|
39169
|
+
}
|
|
39170
|
+
return;
|
|
39171
|
+
}
|
|
39172
|
+
function declaresOwn(ast, name) {
|
|
39173
|
+
let found = false;
|
|
39174
|
+
walk2(ast, (node) => {
|
|
39175
|
+
if (found)
|
|
39176
|
+
return;
|
|
39177
|
+
if (node.type === "FunctionDeclaration" && node.id?.name === name) {
|
|
39178
|
+
found = true;
|
|
39179
|
+
}
|
|
39180
|
+
if (node.type === "VariableDeclarator" && node.id?.name === name) {
|
|
39181
|
+
found = true;
|
|
39182
|
+
}
|
|
39183
|
+
});
|
|
39184
|
+
return found;
|
|
39185
|
+
}
|
|
39186
|
+
function propertyName(prop) {
|
|
39187
|
+
if (prop?.type !== "Property" || prop.computed)
|
|
39188
|
+
return null;
|
|
39189
|
+
if (prop.key?.type === "Identifier")
|
|
39190
|
+
return prop.key.name;
|
|
39191
|
+
if (prop.key?.type === "Literal" && typeof prop.key.value === "string") {
|
|
39192
|
+
return prop.key.value;
|
|
39193
|
+
}
|
|
39194
|
+
return null;
|
|
39195
|
+
}
|
|
39196
|
+
function walk2(node, visit) {
|
|
39197
|
+
if (node === null || typeof node !== "object")
|
|
39198
|
+
return;
|
|
39199
|
+
if (Array.isArray(node)) {
|
|
39200
|
+
for (const child of node)
|
|
39201
|
+
walk2(child, visit);
|
|
39202
|
+
return;
|
|
39203
|
+
}
|
|
39204
|
+
if (typeof node.type === "string") {
|
|
39205
|
+
visit(node);
|
|
39206
|
+
}
|
|
39207
|
+
for (const key of Object.keys(node)) {
|
|
39208
|
+
if (key === "parent")
|
|
39209
|
+
continue;
|
|
39210
|
+
const value = node[key];
|
|
39211
|
+
if (value && typeof value === "object") {
|
|
39212
|
+
walk2(value, visit);
|
|
39213
|
+
}
|
|
39214
|
+
}
|
|
39215
|
+
}
|
|
39216
|
+
|
|
37767
39217
|
// vite/index.ts
|
|
37768
39218
|
var gemi = async () => {
|
|
37769
39219
|
const userConfig = await loadGemiConfig(process.cwd());
|
|
@@ -37806,7 +39256,8 @@ var gemi = async () => {
|
|
|
37806
39256
|
}
|
|
37807
39257
|
}
|
|
37808
39258
|
},
|
|
37809
|
-
...userVitePlugins
|
|
39259
|
+
...userVitePlugins,
|
|
39260
|
+
gemiDictionaryPlugin()
|
|
37810
39261
|
];
|
|
37811
39262
|
};
|
|
37812
39263
|
var vite_default = gemi;
|
|
@@ -37840,7 +39291,7 @@ function sourceFiles(dir, ignore = []) {
|
|
|
37840
39291
|
const rel2 = relative(dir, path3).split("\\").join("/");
|
|
37841
39292
|
return ignore.some((pattern) => rel2 === pattern || rel2.startsWith(`${pattern}/`));
|
|
37842
39293
|
};
|
|
37843
|
-
const
|
|
39294
|
+
const walk3 = (current) => {
|
|
37844
39295
|
for (const entry of readdirSync2(current, { withFileTypes: true }).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0)) {
|
|
37845
39296
|
const path3 = join3(current, entry.name);
|
|
37846
39297
|
if (ignored(path3))
|
|
@@ -37850,7 +39301,7 @@ function sourceFiles(dir, ignore = []) {
|
|
|
37850
39301
|
continue;
|
|
37851
39302
|
if (existsSync3(join3(path3, "package.json")))
|
|
37852
39303
|
continue;
|
|
37853
|
-
|
|
39304
|
+
walk3(path3);
|
|
37854
39305
|
continue;
|
|
37855
39306
|
}
|
|
37856
39307
|
if (!entry.name.endsWith(".ts") && !entry.name.endsWith(".tsx"))
|
|
@@ -37864,7 +39315,7 @@ function sourceFiles(dir, ignore = []) {
|
|
|
37864
39315
|
};
|
|
37865
39316
|
if (!existsSync3(dir))
|
|
37866
39317
|
return out;
|
|
37867
|
-
|
|
39318
|
+
walk3(dir);
|
|
37868
39319
|
return out;
|
|
37869
39320
|
}
|
|
37870
39321
|
|
|
@@ -38487,5 +39938,5 @@ program.command("app:route-manifest").action(async () => {
|
|
|
38487
39938
|
});
|
|
38488
39939
|
program.parse();
|
|
38489
39940
|
|
|
38490
|
-
//# debugId=
|
|
39941
|
+
//# debugId=FD52AD3855B4935264756E2164756E21
|
|
38491
39942
|
//# sourceMappingURL=gemi.js.map
|