@caspian2026/agent-sdk 0.0.24 → 0.0.26
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/gateway/index.js +98 -22
- package/dist/gateway/worker.js +196 -47
- package/dist/sdk/query.cjs +2 -362
- package/dist/sdk/query.js +2 -367
- package/package.json +4 -6
- package/dist/chunk-05kvhzd7.js +0 -3561
- package/dist/chunk-07069jq1.js +0 -30
- package/dist/chunk-0731m51q.js +0 -8
- package/dist/chunk-08bspa4b.js +0 -673
- package/dist/chunk-0brkf8q8.js +0 -89
- package/dist/chunk-0n843xh7.js +0 -261
- package/dist/chunk-0nbp5jwx.js +0 -8583
- package/dist/chunk-0nj16az9.js +0 -169
- package/dist/chunk-0paqc2yw.js +0 -15
- package/dist/chunk-0q6b50ps.js +0 -111
- package/dist/chunk-0r5bb9j4.js +0 -477
- package/dist/chunk-0rpz1wgn.js +0 -1030
- package/dist/chunk-0t81d427.js +0 -41
- package/dist/chunk-0vaw02wq.js +0 -24
- package/dist/chunk-0vkfrmqm.js +0 -690
- package/dist/chunk-0vp3wfab.js +0 -12
- package/dist/chunk-0vr10742.js +0 -1809
- package/dist/chunk-0xjaqda8.js +0 -1124
- package/dist/chunk-13ehyphg.js +0 -223
- package/dist/chunk-15jsw9bb.js +0 -349
- package/dist/chunk-16m7eyyw.js +0 -1385
- package/dist/chunk-1ae3nt9j.js +0 -31
- package/dist/chunk-1gq4r3v1.js +0 -308
- package/dist/chunk-1gx78081.js +0 -66
- package/dist/chunk-1h2famwb.js +0 -49
- package/dist/chunk-1n546sfg.js +0 -200
- package/dist/chunk-1qg06d60.js +0 -494
- package/dist/chunk-1t0rqstn.js +0 -146
- package/dist/chunk-1z8p2eqd.js +0 -40
- package/dist/chunk-1zjh9cc5.js +0 -266
- package/dist/chunk-20ahkkrb.js +0 -132
- package/dist/chunk-21pbfch8.js +0 -105
- package/dist/chunk-26wtxbdc.js +0 -13870
- package/dist/chunk-2fwze72g.js +0 -24
- package/dist/chunk-2gcbr1c7.js +0 -107
- package/dist/chunk-2grc1yr8.js +0 -654
- package/dist/chunk-2gzv8nrw.js +0 -205
- package/dist/chunk-2r212cvt.js +0 -253
- package/dist/chunk-2s74bt6e.js +0 -317
- package/dist/chunk-2v385w7r.js +0 -7422
- package/dist/chunk-2wtkvpp2.js +0 -167
- package/dist/chunk-31rsspfr.js +0 -418
- package/dist/chunk-3c25bcsw.js +0 -17
- package/dist/chunk-3jm08aaw.js +0 -91
- package/dist/chunk-3mgywd32.js +0 -8
- package/dist/chunk-3nk79af8.js +0 -8
- package/dist/chunk-3v4sk2py.js +0 -101
- package/dist/chunk-3vwft0eh.js +0 -349
- package/dist/chunk-3vy1jt9p.js +0 -1010
- package/dist/chunk-3wvqzq9w.js +0 -92
- package/dist/chunk-3wvv2s8d.js +0 -336
- package/dist/chunk-4060b3s2.js +0 -108
- package/dist/chunk-434e0vh4.js +0 -275
- package/dist/chunk-46dm23zs.js +0 -344
- package/dist/chunk-4bh4qs70.js +0 -209
- package/dist/chunk-4cxzbqws.js +0 -94
- package/dist/chunk-4jm600zv.js +0 -13
- package/dist/chunk-4k9d7gxv.js +0 -118
- package/dist/chunk-4nc3t6ms.js +0 -396
- package/dist/chunk-4pbx3g7s.js +0 -26
- package/dist/chunk-4qhh8bpa.js +0 -54
- package/dist/chunk-4v63px9y.js +0 -133
- package/dist/chunk-4xnnzt3j.js +0 -74
- package/dist/chunk-4zchh01h.js +0 -201
- package/dist/chunk-5216fha8.js +0 -1163
- package/dist/chunk-55raexh7.js +0 -14358
- package/dist/chunk-5bffhf64.js +0 -81
- package/dist/chunk-5ccdsxgy.js +0 -74
- package/dist/chunk-5ddh2hyn.js +0 -91
- package/dist/chunk-5e6ncq5j.js +0 -61
- package/dist/chunk-5ekyhb1w.js +0 -422
- package/dist/chunk-5fy4r8rv.js +0 -52
- package/dist/chunk-5h5kx2jd.js +0 -34
- package/dist/chunk-5mbgdvyz.js +0 -847
- package/dist/chunk-5n1jc02d.js +0 -87
- package/dist/chunk-5pysjah8.js +0 -1543
- package/dist/chunk-5ssfz438.js +0 -323
- package/dist/chunk-5z28bqne.js +0 -6748
- package/dist/chunk-603y0mmg.js +0 -50
- package/dist/chunk-62v5kkff.js +0 -90
- package/dist/chunk-64c1avct.js +0 -13
- package/dist/chunk-64r16v22.js +0 -162
- package/dist/chunk-64smdx4a.js +0 -418
- package/dist/chunk-66zry909.js +0 -11
- package/dist/chunk-68ffk5qa.js +0 -14
- package/dist/chunk-69n11zng.js +0 -436
- package/dist/chunk-6dj5t602.js +0 -341
- package/dist/chunk-6dngjwkh.js +0 -63
- package/dist/chunk-6nsd9606.js +0 -790
- package/dist/chunk-6pkh8frk.js +0 -253
- package/dist/chunk-6qcmt5eb.js +0 -251
- package/dist/chunk-6ww7451s.js +0 -60
- package/dist/chunk-6xgb0kqz.js +0 -90
- package/dist/chunk-72ys9m07.js +0 -121
- package/dist/chunk-741sgvtx.js +0 -121
- package/dist/chunk-7aw745vx.js +0 -40175
- package/dist/chunk-7c8b8cfb.js +0 -219
- package/dist/chunk-7mwt4e1z.js +0 -234
- package/dist/chunk-7sgtxrsc.js +0 -1059
- package/dist/chunk-7wm5s02e.js +0 -216
- package/dist/chunk-7xyswgjh.js +0 -8
- package/dist/chunk-80a197ez.js +0 -1438
- package/dist/chunk-83hfzbx3.js +0 -10
- package/dist/chunk-8akrsgad.js +0 -55
- package/dist/chunk-8g5pe1gr.js +0 -37
- package/dist/chunk-8s07t4k7.js +0 -40
- package/dist/chunk-8yhf030a.js +0 -69
- package/dist/chunk-928tzaa8.js +0 -107
- package/dist/chunk-949pjzj9.js +0 -266
- package/dist/chunk-9aycd4z9.js +0 -490
- package/dist/chunk-9bzqvsz5.js +0 -211
- package/dist/chunk-9q3xfy27.js +0 -460
- package/dist/chunk-9vzg1360.js +0 -153
- package/dist/chunk-9wbh8n1y.js +0 -63
- package/dist/chunk-9x5zgy22.js +0 -12
- package/dist/chunk-9zdj4ypz.js +0 -206
- package/dist/chunk-a0bvcgyd.js +0 -127
- package/dist/chunk-a4m3yr2q.js +0 -117
- package/dist/chunk-a8jd4gee.js +0 -227
- package/dist/chunk-ase86y73.js +0 -15
- package/dist/chunk-atfzpm6r.js +0 -325
- package/dist/chunk-awqsddp2.js +0 -338
- package/dist/chunk-awrgzpk6.js +0 -29
- package/dist/chunk-b0kf00ff.js +0 -637
- package/dist/chunk-b1kcd3ss.js +0 -27
- package/dist/chunk-b4hy21c4.js +0 -140
- package/dist/chunk-b9mkm8mg.js +0 -111
- package/dist/chunk-bdjx14rd.js +0 -594
- package/dist/chunk-bfb41q9h.js +0 -295
- package/dist/chunk-bg4x9ex0.js +0 -21
- package/dist/chunk-bh5zqvyc.js +0 -36
- package/dist/chunk-bn0zv2y2.js +0 -1154
- package/dist/chunk-bn7t681c.js +0 -2669
- package/dist/chunk-br4wgffc.js +0 -393
- package/dist/chunk-brjd9zmk.js +0 -42
- package/dist/chunk-byfawrfx.js +0 -121
- package/dist/chunk-c6sjhj89.js +0 -1284
- package/dist/chunk-c7jwbe76.js +0 -29030
- package/dist/chunk-cdef9v7b.js +0 -27
- package/dist/chunk-cdz5yb0r.js +0 -57
- package/dist/chunk-cevq1787.js +0 -2718
- package/dist/chunk-cgfdkzhb.js +0 -12
- package/dist/chunk-cgqw4x5z.js +0 -155
- package/dist/chunk-cmmmc8e0.js +0 -212
- package/dist/chunk-cnsj3vq2.js +0 -35
- package/dist/chunk-cxrktb5g.js +0 -51
- package/dist/chunk-cyhrb0bk.js +0 -251
- package/dist/chunk-d23rmn8r.js +0 -62
- package/dist/chunk-d4mdda98.js +0 -94
- package/dist/chunk-dcwp94cj.js +0 -152
- package/dist/chunk-ddsjkqs4.js +0 -39
- package/dist/chunk-ddv56j39.js +0 -148
- package/dist/chunk-dfq6pbq7.js +0 -5822
- package/dist/chunk-dfzkwynj.js +0 -5368
- package/dist/chunk-dkgkd8b7.js +0 -516
- package/dist/chunk-dpnmf0pq.js +0 -312
- package/dist/chunk-dygx7vcc.js +0 -226
- package/dist/chunk-e0abab5b.js +0 -445
- package/dist/chunk-e5qhvhjy.js +0 -168
- package/dist/chunk-e60y6r1n.js +0 -20
- package/dist/chunk-e68kgvcq.js +0 -79
- package/dist/chunk-e9w9zc0g.js +0 -392
- package/dist/chunk-ecj9w6tm.js +0 -558
- package/dist/chunk-ehtwnxpg.js +0 -1591
- package/dist/chunk-eqp1rfft.js +0 -17
- package/dist/chunk-etdt1xz3.js +0 -19
- package/dist/chunk-ewadzrm8.js +0 -103
- package/dist/chunk-f03s83vj.js +0 -91
- package/dist/chunk-f3kk0p3s.js +0 -150
- package/dist/chunk-f3pjerx4.js +0 -4265
- package/dist/chunk-f6h5weh6.js +0 -61
- package/dist/chunk-fajg8x36.js +0 -8158
- package/dist/chunk-fbv4apne.js +0 -51
- package/dist/chunk-fcynwjpm.js +0 -1072
- package/dist/chunk-fdvaf6nn.js +0 -20
- package/dist/chunk-feyzykye.js +0 -10
- package/dist/chunk-ff85rwvc.js +0 -180
- package/dist/chunk-fqak69ft.js +0 -458
- package/dist/chunk-fxdkbabd.js +0 -195
- package/dist/chunk-fyc5fepv.js +0 -10
- package/dist/chunk-g78c6ztj.js +0 -89
- package/dist/chunk-g8ee7yza.js +0 -105
- package/dist/chunk-g9f19ttm.js +0 -15
- package/dist/chunk-gcktsbxb.js +0 -77
- package/dist/chunk-gdwdqewd.js +0 -19
- package/dist/chunk-gg55fns0.js +0 -6440
- package/dist/chunk-gnpt1t6q.js +0 -209364
- package/dist/chunk-gsbw2j2b.js +0 -276
- package/dist/chunk-gybt680f.js +0 -9114
- package/dist/chunk-gz1e8y1w.js +0 -33
- package/dist/chunk-gz7vn2gg.js +0 -114
- package/dist/chunk-h0d5eat0.js +0 -101
- package/dist/chunk-h27tjbp3.js +0 -33118
- package/dist/chunk-h2yy8k4c.js +0 -58
- package/dist/chunk-h5acpdqt.js +0 -103
- package/dist/chunk-h63r8vps.js +0 -2840
- package/dist/chunk-h64x5b04.js +0 -860
- package/dist/chunk-h92snc84.js +0 -420
- package/dist/chunk-h9n54swm.js +0 -27
- package/dist/chunk-hafcrnpc.js +0 -145
- package/dist/chunk-hakdhagh.js +0 -16606
- package/dist/chunk-hk4phsaw.js +0 -388
- package/dist/chunk-hph1bmqw.js +0 -65
- package/dist/chunk-hvnztnp3.js +0 -71
- package/dist/chunk-hwfknpxv.js +0 -39
- package/dist/chunk-j2xxd002.js +0 -1052
- package/dist/chunk-j3qbygme.js +0 -105
- package/dist/chunk-j5bth84e.js +0 -97
- package/dist/chunk-j64ga6ta.js +0 -8035
- package/dist/chunk-jbwgyskk.js +0 -385
- package/dist/chunk-jd32zbps.js +0 -15
- package/dist/chunk-jdhkh2bb.js +0 -618
- package/dist/chunk-jeqcwgt7.js +0 -177
- package/dist/chunk-jf75p9ap.js +0 -445
- package/dist/chunk-jgvk0za1.js +0 -260
- package/dist/chunk-jhpaevah.js +0 -565
- package/dist/chunk-jmjwrbwd.js +0 -635
- package/dist/chunk-jpdbfwvq.js +0 -100
- package/dist/chunk-jps4m6sz.js +0 -183
- package/dist/chunk-jwf0s51s.js +0 -867
- package/dist/chunk-jxge4dgh.js +0 -83
- package/dist/chunk-jz71gv95.js +0 -1161
- package/dist/chunk-jzthz1bx.js +0 -15
- package/dist/chunk-jzvd2ycp.js +0 -120
- package/dist/chunk-k0p9w03v.js +0 -4957
- package/dist/chunk-k4dcreh0.js +0 -442
- package/dist/chunk-k7akhwkn.js +0 -151
- package/dist/chunk-k8vp0atq.js +0 -2331
- package/dist/chunk-kgd7gfvk.js +0 -407
- package/dist/chunk-km5ycg1j.js +0 -87
- package/dist/chunk-kvyrxzj8.js +0 -26
- package/dist/chunk-kwekc97v.js +0 -18
- package/dist/chunk-ky1z78ve.js +0 -119
- package/dist/chunk-mcws22k3.js +0 -42
- package/dist/chunk-mjazvyd8.js +0 -528
- package/dist/chunk-mswx2nma.js +0 -103
- package/dist/chunk-mz6a0phh.js +0 -2962
- package/dist/chunk-n2tg12hg.js +0 -374
- package/dist/chunk-n3fv4ya7.js +0 -146
- package/dist/chunk-n4eabmqd.js +0 -93
- package/dist/chunk-n4tx7baq.js +0 -193
- package/dist/chunk-n6g4jbeh.js +0 -289
- package/dist/chunk-n6wzfxf1.js +0 -100
- package/dist/chunk-ndcmqfkv.js +0 -244
- package/dist/chunk-netzwgv1.js +0 -154
- package/dist/chunk-nhcg04jt.js +0 -120
- package/dist/chunk-nhsm3ntd.js +0 -439
- package/dist/chunk-njev89d1.js +0 -2335
- package/dist/chunk-nmgj86tt.js +0 -24
- package/dist/chunk-ns7x6xam.js +0 -22820
- package/dist/chunk-p7vkh4wx.js +0 -15
- package/dist/chunk-p8na2wwp.js +0 -14
- package/dist/chunk-p97fd5af.js +0 -684
- package/dist/chunk-pe3rkfp2.js +0 -74
- package/dist/chunk-pgtnj1mt.js +0 -705
- package/dist/chunk-phmnkw9y.js +0 -283
- package/dist/chunk-pnds7g1q.js +0 -130
- package/dist/chunk-ppwjyveh.js +0 -8
- package/dist/chunk-pqqxdk5f.js +0 -543
- package/dist/chunk-ps49ymvj.js +0 -43
- package/dist/chunk-pwwa7s62.js +0 -11
- package/dist/chunk-q3hfrat2.js +0 -313
- package/dist/chunk-qajrkk97.js +0 -298
- package/dist/chunk-qatfdxvd.js +0 -34
- package/dist/chunk-qb5qcctj.js +0 -206
- package/dist/chunk-qb6k2afy.js +0 -153
- package/dist/chunk-qgk93a75.js +0 -85
- package/dist/chunk-qkczt8cr.js +0 -24
- package/dist/chunk-qn1be1vf.js +0 -267
- package/dist/chunk-qnfx3qtx.js +0 -617
- package/dist/chunk-qnwne2m4.js +0 -87
- package/dist/chunk-qp2qdcda.js +0 -100
- package/dist/chunk-qpp3wwh5.js +0 -697
- package/dist/chunk-r0bx1gc7.js +0 -174
- package/dist/chunk-radnwk8x.js +0 -107
- package/dist/chunk-rkv5jq0y.js +0 -71
- package/dist/chunk-rmbbmd3s.js +0 -68
- package/dist/chunk-rmgbs5an.js +0 -640
- package/dist/chunk-rn0v1hk8.js +0 -34
- package/dist/chunk-rnxctq9p.js +0 -1646
- package/dist/chunk-rtd39n81.js +0 -95
- package/dist/chunk-s8gy4ky9.js +0 -122
- package/dist/chunk-s8kj6ajy.js +0 -32
- package/dist/chunk-sd36yzx8.js +0 -954
- package/dist/chunk-sdenh194.js +0 -121
- package/dist/chunk-sdtqp75c.js +0 -55
- package/dist/chunk-sedbc8ep.js +0 -212
- package/dist/chunk-sfrb15b2.js +0 -321
- package/dist/chunk-sgpmpn90.js +0 -35
- package/dist/chunk-sh02d2qn.js +0 -38
- package/dist/chunk-shd4yhsf.js +0 -32
- package/dist/chunk-shkycj1q.js +0 -178
- package/dist/chunk-sk7h93je.js +0 -153
- package/dist/chunk-sm8g6fsm.js +0 -122
- package/dist/chunk-snrjy66h.js +0 -671
- package/dist/chunk-sq4a0yjh.js +0 -116
- package/dist/chunk-sr3t4thh.js +0 -895
- package/dist/chunk-srj6qnf6.js +0 -107
- package/dist/chunk-sz62n77p.js +0 -155
- package/dist/chunk-szj5wvdy.js +0 -28
- package/dist/chunk-t29a6zb5.js +0 -45
- package/dist/chunk-t2ecddwj.js +0 -731
- package/dist/chunk-t33hmmmm.js +0 -113
- package/dist/chunk-t4khqff1.js +0 -16
- package/dist/chunk-t9p85zff.js +0 -24
- package/dist/chunk-ta3jyvxs.js +0 -984
- package/dist/chunk-tkx5eec8.js +0 -54
- package/dist/chunk-v1kzp02e.js +0 -785
- package/dist/chunk-v4t6dyyh.js +0 -9076
- package/dist/chunk-v78fj8by.js +0 -145
- package/dist/chunk-v8kjswxt.js +0 -61
- package/dist/chunk-v9smspw2.js +0 -4301
- package/dist/chunk-vf612n57.js +0 -472
- package/dist/chunk-vkhrrvfq.js +0 -44
- package/dist/chunk-vt5wm07k.js +0 -74
- package/dist/chunk-vvvrv61g.js +0 -875
- package/dist/chunk-vyjeh50y.js +0 -2149
- package/dist/chunk-w0kxcv73.js +0 -97
- package/dist/chunk-w6m6trzq.js +0 -58
- package/dist/chunk-wa8yn2p0.js +0 -2007
- package/dist/chunk-wb18cecv.js +0 -995
- package/dist/chunk-wgk9sxk7.js +0 -329
- package/dist/chunk-wh0ev1bw.js +0 -111
- package/dist/chunk-wka1647p.js +0 -98
- package/dist/chunk-wnwfwyj4.js +0 -90
- package/dist/chunk-wpdchyy2.js +0 -97
- package/dist/chunk-x3g44n7k.js +0 -114
- package/dist/chunk-x47h283a.js +0 -56
- package/dist/chunk-x6r4v44b.js +0 -8
- package/dist/chunk-x7fdwq3d.js +0 -33
- package/dist/chunk-x8d2ehd7.js +0 -19
- package/dist/chunk-xbeg2hej.js +0 -257
- package/dist/chunk-xeb6075z.js +0 -3435
- package/dist/chunk-xhfmdq1y.js +0 -147
- package/dist/chunk-xhscn33a.js +0 -138
- package/dist/chunk-xv3era3s.js +0 -8
- package/dist/chunk-xz5gbhc3.js +0 -93
- package/dist/chunk-y1784krc.js +0 -19
- package/dist/chunk-y1vyezct.js +0 -123
- package/dist/chunk-y45ecntg.js +0 -942
- package/dist/chunk-y4ca9kqz.js +0 -3830
- package/dist/chunk-y9bhjjdz.js +0 -145
- package/dist/chunk-yb3bxv3w.js +0 -30
- package/dist/chunk-ye2q9gqj.js +0 -332
- package/dist/chunk-yfg3adfq.js +0 -88
- package/dist/chunk-yst0wmgw.js +0 -269
- package/dist/chunk-ywe9dbnz.js +0 -460
- package/dist/chunk-yyex5gsf.js +0 -269
- package/dist/chunk-yz2kzqk5.js +0 -439
- package/dist/chunk-z263ehpg.js +0 -131
- package/dist/chunk-z2dp53wn.js +0 -17
- package/dist/chunk-zaq348h2.js +0 -281
- package/dist/chunk-zr0qx9q0.js +0 -642
- package/dist/chunk-zxh62ved.js +0 -31
- package/dist/chunk-zy5vn8sd.js +0 -329
- package/dist/chunk-zzm33q8x.js +0 -8
- package/dist/cli.js +0 -91
package/dist/chunk-rnxctq9p.js
DELETED
|
@@ -1,1646 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
init_lazySchema,
|
|
4
|
-
lazySchema
|
|
5
|
-
} from "./chunk-64c1avct.js";
|
|
6
|
-
import {
|
|
7
|
-
init_v4
|
|
8
|
-
} from "./chunk-4pbx3g7s.js";
|
|
9
|
-
import {
|
|
10
|
-
exports_external
|
|
11
|
-
} from "./chunk-26wtxbdc.js";
|
|
12
|
-
import {
|
|
13
|
-
init_memoize,
|
|
14
|
-
memoizeWithLRU
|
|
15
|
-
} from "./chunk-vkhrrvfq.js";
|
|
16
|
-
import {
|
|
17
|
-
init_log,
|
|
18
|
-
init_slowOperations,
|
|
19
|
-
jsonStringify,
|
|
20
|
-
logError
|
|
21
|
-
} from "./chunk-gg55fns0.js";
|
|
22
|
-
import {
|
|
23
|
-
__callDispose,
|
|
24
|
-
__esm,
|
|
25
|
-
__using
|
|
26
|
-
} from "./chunk-qp2qdcda.js";
|
|
27
|
-
|
|
28
|
-
// src/utils/jsonRead.ts
|
|
29
|
-
function stripBOM(content) {
|
|
30
|
-
return content.startsWith(UTF8_BOM) ? content.slice(1) : content;
|
|
31
|
-
}
|
|
32
|
-
var UTF8_BOM = "\uFEFF";
|
|
33
|
-
var init_jsonRead = () => {};
|
|
34
|
-
|
|
35
|
-
// node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
36
|
-
function createScanner(text, ignoreTrivia = false) {
|
|
37
|
-
const len = text.length;
|
|
38
|
-
let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
|
|
39
|
-
function scanHexDigits(count, exact) {
|
|
40
|
-
let digits = 0;
|
|
41
|
-
let value2 = 0;
|
|
42
|
-
while (digits < count || !exact) {
|
|
43
|
-
let ch = text.charCodeAt(pos);
|
|
44
|
-
if (ch >= 48 && ch <= 57) {
|
|
45
|
-
value2 = value2 * 16 + ch - 48;
|
|
46
|
-
} else if (ch >= 65 && ch <= 70) {
|
|
47
|
-
value2 = value2 * 16 + ch - 65 + 10;
|
|
48
|
-
} else if (ch >= 97 && ch <= 102) {
|
|
49
|
-
value2 = value2 * 16 + ch - 97 + 10;
|
|
50
|
-
} else {
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
pos++;
|
|
54
|
-
digits++;
|
|
55
|
-
}
|
|
56
|
-
if (digits < count) {
|
|
57
|
-
value2 = -1;
|
|
58
|
-
}
|
|
59
|
-
return value2;
|
|
60
|
-
}
|
|
61
|
-
function setPosition(newPosition) {
|
|
62
|
-
pos = newPosition;
|
|
63
|
-
value = "";
|
|
64
|
-
tokenOffset = 0;
|
|
65
|
-
token = 16;
|
|
66
|
-
scanError = 0;
|
|
67
|
-
}
|
|
68
|
-
function scanNumber() {
|
|
69
|
-
let start = pos;
|
|
70
|
-
if (text.charCodeAt(pos) === 48) {
|
|
71
|
-
pos++;
|
|
72
|
-
} else {
|
|
73
|
-
pos++;
|
|
74
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
75
|
-
pos++;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
if (pos < text.length && text.charCodeAt(pos) === 46) {
|
|
79
|
-
pos++;
|
|
80
|
-
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
81
|
-
pos++;
|
|
82
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
83
|
-
pos++;
|
|
84
|
-
}
|
|
85
|
-
} else {
|
|
86
|
-
scanError = 3;
|
|
87
|
-
return text.substring(start, pos);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
let end = pos;
|
|
91
|
-
if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
|
|
92
|
-
pos++;
|
|
93
|
-
if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) {
|
|
94
|
-
pos++;
|
|
95
|
-
}
|
|
96
|
-
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
97
|
-
pos++;
|
|
98
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
99
|
-
pos++;
|
|
100
|
-
}
|
|
101
|
-
end = pos;
|
|
102
|
-
} else {
|
|
103
|
-
scanError = 3;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return text.substring(start, end);
|
|
107
|
-
}
|
|
108
|
-
function scanString() {
|
|
109
|
-
let result = "", start = pos;
|
|
110
|
-
while (true) {
|
|
111
|
-
if (pos >= len) {
|
|
112
|
-
result += text.substring(start, pos);
|
|
113
|
-
scanError = 2;
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
const ch = text.charCodeAt(pos);
|
|
117
|
-
if (ch === 34) {
|
|
118
|
-
result += text.substring(start, pos);
|
|
119
|
-
pos++;
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
if (ch === 92) {
|
|
123
|
-
result += text.substring(start, pos);
|
|
124
|
-
pos++;
|
|
125
|
-
if (pos >= len) {
|
|
126
|
-
scanError = 2;
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
const ch2 = text.charCodeAt(pos++);
|
|
130
|
-
switch (ch2) {
|
|
131
|
-
case 34:
|
|
132
|
-
result += '"';
|
|
133
|
-
break;
|
|
134
|
-
case 92:
|
|
135
|
-
result += "\\";
|
|
136
|
-
break;
|
|
137
|
-
case 47:
|
|
138
|
-
result += "/";
|
|
139
|
-
break;
|
|
140
|
-
case 98:
|
|
141
|
-
result += "\b";
|
|
142
|
-
break;
|
|
143
|
-
case 102:
|
|
144
|
-
result += "\f";
|
|
145
|
-
break;
|
|
146
|
-
case 110:
|
|
147
|
-
result += `
|
|
148
|
-
`;
|
|
149
|
-
break;
|
|
150
|
-
case 114:
|
|
151
|
-
result += "\r";
|
|
152
|
-
break;
|
|
153
|
-
case 116:
|
|
154
|
-
result += "\t";
|
|
155
|
-
break;
|
|
156
|
-
case 117:
|
|
157
|
-
const ch3 = scanHexDigits(4, true);
|
|
158
|
-
if (ch3 >= 0) {
|
|
159
|
-
result += String.fromCharCode(ch3);
|
|
160
|
-
} else {
|
|
161
|
-
scanError = 4;
|
|
162
|
-
}
|
|
163
|
-
break;
|
|
164
|
-
default:
|
|
165
|
-
scanError = 5;
|
|
166
|
-
}
|
|
167
|
-
start = pos;
|
|
168
|
-
continue;
|
|
169
|
-
}
|
|
170
|
-
if (ch >= 0 && ch <= 31) {
|
|
171
|
-
if (isLineBreak(ch)) {
|
|
172
|
-
result += text.substring(start, pos);
|
|
173
|
-
scanError = 2;
|
|
174
|
-
break;
|
|
175
|
-
} else {
|
|
176
|
-
scanError = 6;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
pos++;
|
|
180
|
-
}
|
|
181
|
-
return result;
|
|
182
|
-
}
|
|
183
|
-
function scanNext() {
|
|
184
|
-
value = "";
|
|
185
|
-
scanError = 0;
|
|
186
|
-
tokenOffset = pos;
|
|
187
|
-
lineStartOffset = lineNumber;
|
|
188
|
-
prevTokenLineStartOffset = tokenLineStartOffset;
|
|
189
|
-
if (pos >= len) {
|
|
190
|
-
tokenOffset = len;
|
|
191
|
-
return token = 17;
|
|
192
|
-
}
|
|
193
|
-
let code = text.charCodeAt(pos);
|
|
194
|
-
if (isWhiteSpace(code)) {
|
|
195
|
-
do {
|
|
196
|
-
pos++;
|
|
197
|
-
value += String.fromCharCode(code);
|
|
198
|
-
code = text.charCodeAt(pos);
|
|
199
|
-
} while (isWhiteSpace(code));
|
|
200
|
-
return token = 15;
|
|
201
|
-
}
|
|
202
|
-
if (isLineBreak(code)) {
|
|
203
|
-
pos++;
|
|
204
|
-
value += String.fromCharCode(code);
|
|
205
|
-
if (code === 13 && text.charCodeAt(pos) === 10) {
|
|
206
|
-
pos++;
|
|
207
|
-
value += `
|
|
208
|
-
`;
|
|
209
|
-
}
|
|
210
|
-
lineNumber++;
|
|
211
|
-
tokenLineStartOffset = pos;
|
|
212
|
-
return token = 14;
|
|
213
|
-
}
|
|
214
|
-
switch (code) {
|
|
215
|
-
case 123:
|
|
216
|
-
pos++;
|
|
217
|
-
return token = 1;
|
|
218
|
-
case 125:
|
|
219
|
-
pos++;
|
|
220
|
-
return token = 2;
|
|
221
|
-
case 91:
|
|
222
|
-
pos++;
|
|
223
|
-
return token = 3;
|
|
224
|
-
case 93:
|
|
225
|
-
pos++;
|
|
226
|
-
return token = 4;
|
|
227
|
-
case 58:
|
|
228
|
-
pos++;
|
|
229
|
-
return token = 6;
|
|
230
|
-
case 44:
|
|
231
|
-
pos++;
|
|
232
|
-
return token = 5;
|
|
233
|
-
case 34:
|
|
234
|
-
pos++;
|
|
235
|
-
value = scanString();
|
|
236
|
-
return token = 10;
|
|
237
|
-
case 47:
|
|
238
|
-
const start = pos - 1;
|
|
239
|
-
if (text.charCodeAt(pos + 1) === 47) {
|
|
240
|
-
pos += 2;
|
|
241
|
-
while (pos < len) {
|
|
242
|
-
if (isLineBreak(text.charCodeAt(pos))) {
|
|
243
|
-
break;
|
|
244
|
-
}
|
|
245
|
-
pos++;
|
|
246
|
-
}
|
|
247
|
-
value = text.substring(start, pos);
|
|
248
|
-
return token = 12;
|
|
249
|
-
}
|
|
250
|
-
if (text.charCodeAt(pos + 1) === 42) {
|
|
251
|
-
pos += 2;
|
|
252
|
-
const safeLength = len - 1;
|
|
253
|
-
let commentClosed = false;
|
|
254
|
-
while (pos < safeLength) {
|
|
255
|
-
const ch = text.charCodeAt(pos);
|
|
256
|
-
if (ch === 42 && text.charCodeAt(pos + 1) === 47) {
|
|
257
|
-
pos += 2;
|
|
258
|
-
commentClosed = true;
|
|
259
|
-
break;
|
|
260
|
-
}
|
|
261
|
-
pos++;
|
|
262
|
-
if (isLineBreak(ch)) {
|
|
263
|
-
if (ch === 13 && text.charCodeAt(pos) === 10) {
|
|
264
|
-
pos++;
|
|
265
|
-
}
|
|
266
|
-
lineNumber++;
|
|
267
|
-
tokenLineStartOffset = pos;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
if (!commentClosed) {
|
|
271
|
-
pos++;
|
|
272
|
-
scanError = 1;
|
|
273
|
-
}
|
|
274
|
-
value = text.substring(start, pos);
|
|
275
|
-
return token = 13;
|
|
276
|
-
}
|
|
277
|
-
value += String.fromCharCode(code);
|
|
278
|
-
pos++;
|
|
279
|
-
return token = 16;
|
|
280
|
-
case 45:
|
|
281
|
-
value += String.fromCharCode(code);
|
|
282
|
-
pos++;
|
|
283
|
-
if (pos === len || !isDigit(text.charCodeAt(pos))) {
|
|
284
|
-
return token = 16;
|
|
285
|
-
}
|
|
286
|
-
case 48:
|
|
287
|
-
case 49:
|
|
288
|
-
case 50:
|
|
289
|
-
case 51:
|
|
290
|
-
case 52:
|
|
291
|
-
case 53:
|
|
292
|
-
case 54:
|
|
293
|
-
case 55:
|
|
294
|
-
case 56:
|
|
295
|
-
case 57:
|
|
296
|
-
value += scanNumber();
|
|
297
|
-
return token = 11;
|
|
298
|
-
default:
|
|
299
|
-
while (pos < len && isUnknownContentCharacter(code)) {
|
|
300
|
-
pos++;
|
|
301
|
-
code = text.charCodeAt(pos);
|
|
302
|
-
}
|
|
303
|
-
if (tokenOffset !== pos) {
|
|
304
|
-
value = text.substring(tokenOffset, pos);
|
|
305
|
-
switch (value) {
|
|
306
|
-
case "true":
|
|
307
|
-
return token = 8;
|
|
308
|
-
case "false":
|
|
309
|
-
return token = 9;
|
|
310
|
-
case "null":
|
|
311
|
-
return token = 7;
|
|
312
|
-
}
|
|
313
|
-
return token = 16;
|
|
314
|
-
}
|
|
315
|
-
value += String.fromCharCode(code);
|
|
316
|
-
pos++;
|
|
317
|
-
return token = 16;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
function isUnknownContentCharacter(code) {
|
|
321
|
-
if (isWhiteSpace(code) || isLineBreak(code)) {
|
|
322
|
-
return false;
|
|
323
|
-
}
|
|
324
|
-
switch (code) {
|
|
325
|
-
case 125:
|
|
326
|
-
case 93:
|
|
327
|
-
case 123:
|
|
328
|
-
case 91:
|
|
329
|
-
case 34:
|
|
330
|
-
case 58:
|
|
331
|
-
case 44:
|
|
332
|
-
case 47:
|
|
333
|
-
return false;
|
|
334
|
-
}
|
|
335
|
-
return true;
|
|
336
|
-
}
|
|
337
|
-
function scanNextNonTrivia() {
|
|
338
|
-
let result;
|
|
339
|
-
do {
|
|
340
|
-
result = scanNext();
|
|
341
|
-
} while (result >= 12 && result <= 15);
|
|
342
|
-
return result;
|
|
343
|
-
}
|
|
344
|
-
return {
|
|
345
|
-
setPosition,
|
|
346
|
-
getPosition: () => pos,
|
|
347
|
-
scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
|
|
348
|
-
getToken: () => token,
|
|
349
|
-
getTokenValue: () => value,
|
|
350
|
-
getTokenOffset: () => tokenOffset,
|
|
351
|
-
getTokenLength: () => pos - tokenOffset,
|
|
352
|
-
getTokenStartLine: () => lineStartOffset,
|
|
353
|
-
getTokenStartCharacter: () => tokenOffset - prevTokenLineStartOffset,
|
|
354
|
-
getTokenError: () => scanError
|
|
355
|
-
};
|
|
356
|
-
}
|
|
357
|
-
function isWhiteSpace(ch) {
|
|
358
|
-
return ch === 32 || ch === 9;
|
|
359
|
-
}
|
|
360
|
-
function isLineBreak(ch) {
|
|
361
|
-
return ch === 10 || ch === 13;
|
|
362
|
-
}
|
|
363
|
-
function isDigit(ch) {
|
|
364
|
-
return ch >= 48 && ch <= 57;
|
|
365
|
-
}
|
|
366
|
-
var CharacterCodes;
|
|
367
|
-
var init_scanner = __esm(() => {
|
|
368
|
-
(function(CharacterCodes2) {
|
|
369
|
-
CharacterCodes2[CharacterCodes2["lineFeed"] = 10] = "lineFeed";
|
|
370
|
-
CharacterCodes2[CharacterCodes2["carriageReturn"] = 13] = "carriageReturn";
|
|
371
|
-
CharacterCodes2[CharacterCodes2["space"] = 32] = "space";
|
|
372
|
-
CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0";
|
|
373
|
-
CharacterCodes2[CharacterCodes2["_1"] = 49] = "_1";
|
|
374
|
-
CharacterCodes2[CharacterCodes2["_2"] = 50] = "_2";
|
|
375
|
-
CharacterCodes2[CharacterCodes2["_3"] = 51] = "_3";
|
|
376
|
-
CharacterCodes2[CharacterCodes2["_4"] = 52] = "_4";
|
|
377
|
-
CharacterCodes2[CharacterCodes2["_5"] = 53] = "_5";
|
|
378
|
-
CharacterCodes2[CharacterCodes2["_6"] = 54] = "_6";
|
|
379
|
-
CharacterCodes2[CharacterCodes2["_7"] = 55] = "_7";
|
|
380
|
-
CharacterCodes2[CharacterCodes2["_8"] = 56] = "_8";
|
|
381
|
-
CharacterCodes2[CharacterCodes2["_9"] = 57] = "_9";
|
|
382
|
-
CharacterCodes2[CharacterCodes2["a"] = 97] = "a";
|
|
383
|
-
CharacterCodes2[CharacterCodes2["b"] = 98] = "b";
|
|
384
|
-
CharacterCodes2[CharacterCodes2["c"] = 99] = "c";
|
|
385
|
-
CharacterCodes2[CharacterCodes2["d"] = 100] = "d";
|
|
386
|
-
CharacterCodes2[CharacterCodes2["e"] = 101] = "e";
|
|
387
|
-
CharacterCodes2[CharacterCodes2["f"] = 102] = "f";
|
|
388
|
-
CharacterCodes2[CharacterCodes2["g"] = 103] = "g";
|
|
389
|
-
CharacterCodes2[CharacterCodes2["h"] = 104] = "h";
|
|
390
|
-
CharacterCodes2[CharacterCodes2["i"] = 105] = "i";
|
|
391
|
-
CharacterCodes2[CharacterCodes2["j"] = 106] = "j";
|
|
392
|
-
CharacterCodes2[CharacterCodes2["k"] = 107] = "k";
|
|
393
|
-
CharacterCodes2[CharacterCodes2["l"] = 108] = "l";
|
|
394
|
-
CharacterCodes2[CharacterCodes2["m"] = 109] = "m";
|
|
395
|
-
CharacterCodes2[CharacterCodes2["n"] = 110] = "n";
|
|
396
|
-
CharacterCodes2[CharacterCodes2["o"] = 111] = "o";
|
|
397
|
-
CharacterCodes2[CharacterCodes2["p"] = 112] = "p";
|
|
398
|
-
CharacterCodes2[CharacterCodes2["q"] = 113] = "q";
|
|
399
|
-
CharacterCodes2[CharacterCodes2["r"] = 114] = "r";
|
|
400
|
-
CharacterCodes2[CharacterCodes2["s"] = 115] = "s";
|
|
401
|
-
CharacterCodes2[CharacterCodes2["t"] = 116] = "t";
|
|
402
|
-
CharacterCodes2[CharacterCodes2["u"] = 117] = "u";
|
|
403
|
-
CharacterCodes2[CharacterCodes2["v"] = 118] = "v";
|
|
404
|
-
CharacterCodes2[CharacterCodes2["w"] = 119] = "w";
|
|
405
|
-
CharacterCodes2[CharacterCodes2["x"] = 120] = "x";
|
|
406
|
-
CharacterCodes2[CharacterCodes2["y"] = 121] = "y";
|
|
407
|
-
CharacterCodes2[CharacterCodes2["z"] = 122] = "z";
|
|
408
|
-
CharacterCodes2[CharacterCodes2["A"] = 65] = "A";
|
|
409
|
-
CharacterCodes2[CharacterCodes2["B"] = 66] = "B";
|
|
410
|
-
CharacterCodes2[CharacterCodes2["C"] = 67] = "C";
|
|
411
|
-
CharacterCodes2[CharacterCodes2["D"] = 68] = "D";
|
|
412
|
-
CharacterCodes2[CharacterCodes2["E"] = 69] = "E";
|
|
413
|
-
CharacterCodes2[CharacterCodes2["F"] = 70] = "F";
|
|
414
|
-
CharacterCodes2[CharacterCodes2["G"] = 71] = "G";
|
|
415
|
-
CharacterCodes2[CharacterCodes2["H"] = 72] = "H";
|
|
416
|
-
CharacterCodes2[CharacterCodes2["I"] = 73] = "I";
|
|
417
|
-
CharacterCodes2[CharacterCodes2["J"] = 74] = "J";
|
|
418
|
-
CharacterCodes2[CharacterCodes2["K"] = 75] = "K";
|
|
419
|
-
CharacterCodes2[CharacterCodes2["L"] = 76] = "L";
|
|
420
|
-
CharacterCodes2[CharacterCodes2["M"] = 77] = "M";
|
|
421
|
-
CharacterCodes2[CharacterCodes2["N"] = 78] = "N";
|
|
422
|
-
CharacterCodes2[CharacterCodes2["O"] = 79] = "O";
|
|
423
|
-
CharacterCodes2[CharacterCodes2["P"] = 80] = "P";
|
|
424
|
-
CharacterCodes2[CharacterCodes2["Q"] = 81] = "Q";
|
|
425
|
-
CharacterCodes2[CharacterCodes2["R"] = 82] = "R";
|
|
426
|
-
CharacterCodes2[CharacterCodes2["S"] = 83] = "S";
|
|
427
|
-
CharacterCodes2[CharacterCodes2["T"] = 84] = "T";
|
|
428
|
-
CharacterCodes2[CharacterCodes2["U"] = 85] = "U";
|
|
429
|
-
CharacterCodes2[CharacterCodes2["V"] = 86] = "V";
|
|
430
|
-
CharacterCodes2[CharacterCodes2["W"] = 87] = "W";
|
|
431
|
-
CharacterCodes2[CharacterCodes2["X"] = 88] = "X";
|
|
432
|
-
CharacterCodes2[CharacterCodes2["Y"] = 89] = "Y";
|
|
433
|
-
CharacterCodes2[CharacterCodes2["Z"] = 90] = "Z";
|
|
434
|
-
CharacterCodes2[CharacterCodes2["asterisk"] = 42] = "asterisk";
|
|
435
|
-
CharacterCodes2[CharacterCodes2["backslash"] = 92] = "backslash";
|
|
436
|
-
CharacterCodes2[CharacterCodes2["closeBrace"] = 125] = "closeBrace";
|
|
437
|
-
CharacterCodes2[CharacterCodes2["closeBracket"] = 93] = "closeBracket";
|
|
438
|
-
CharacterCodes2[CharacterCodes2["colon"] = 58] = "colon";
|
|
439
|
-
CharacterCodes2[CharacterCodes2["comma"] = 44] = "comma";
|
|
440
|
-
CharacterCodes2[CharacterCodes2["dot"] = 46] = "dot";
|
|
441
|
-
CharacterCodes2[CharacterCodes2["doubleQuote"] = 34] = "doubleQuote";
|
|
442
|
-
CharacterCodes2[CharacterCodes2["minus"] = 45] = "minus";
|
|
443
|
-
CharacterCodes2[CharacterCodes2["openBrace"] = 123] = "openBrace";
|
|
444
|
-
CharacterCodes2[CharacterCodes2["openBracket"] = 91] = "openBracket";
|
|
445
|
-
CharacterCodes2[CharacterCodes2["plus"] = 43] = "plus";
|
|
446
|
-
CharacterCodes2[CharacterCodes2["slash"] = 47] = "slash";
|
|
447
|
-
CharacterCodes2[CharacterCodes2["formFeed"] = 12] = "formFeed";
|
|
448
|
-
CharacterCodes2[CharacterCodes2["tab"] = 9] = "tab";
|
|
449
|
-
})(CharacterCodes || (CharacterCodes = {}));
|
|
450
|
-
});
|
|
451
|
-
|
|
452
|
-
// node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/string-intern.js
|
|
453
|
-
var cachedSpaces, maxCachedValues = 200, cachedBreakLinesWithSpaces, supportedEols;
|
|
454
|
-
var init_string_intern = __esm(() => {
|
|
455
|
-
cachedSpaces = new Array(20).fill(0).map((_, index) => {
|
|
456
|
-
return " ".repeat(index);
|
|
457
|
-
});
|
|
458
|
-
cachedBreakLinesWithSpaces = {
|
|
459
|
-
" ": {
|
|
460
|
-
"\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
461
|
-
return `
|
|
462
|
-
` + " ".repeat(index);
|
|
463
|
-
}),
|
|
464
|
-
"\r": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
465
|
-
return "\r" + " ".repeat(index);
|
|
466
|
-
}),
|
|
467
|
-
"\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
468
|
-
return `\r
|
|
469
|
-
` + " ".repeat(index);
|
|
470
|
-
})
|
|
471
|
-
},
|
|
472
|
-
"\t": {
|
|
473
|
-
"\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
474
|
-
return `
|
|
475
|
-
` + "\t".repeat(index);
|
|
476
|
-
}),
|
|
477
|
-
"\r": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
478
|
-
return "\r" + "\t".repeat(index);
|
|
479
|
-
}),
|
|
480
|
-
"\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
481
|
-
return `\r
|
|
482
|
-
` + "\t".repeat(index);
|
|
483
|
-
})
|
|
484
|
-
}
|
|
485
|
-
};
|
|
486
|
-
supportedEols = [`
|
|
487
|
-
`, "\r", `\r
|
|
488
|
-
`];
|
|
489
|
-
});
|
|
490
|
-
|
|
491
|
-
// node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/format.js
|
|
492
|
-
function format(documentText, range, options) {
|
|
493
|
-
let initialIndentLevel;
|
|
494
|
-
let formatText;
|
|
495
|
-
let formatTextStart;
|
|
496
|
-
let rangeStart;
|
|
497
|
-
let rangeEnd;
|
|
498
|
-
if (range) {
|
|
499
|
-
rangeStart = range.offset;
|
|
500
|
-
rangeEnd = rangeStart + range.length;
|
|
501
|
-
formatTextStart = rangeStart;
|
|
502
|
-
while (formatTextStart > 0 && !isEOL(documentText, formatTextStart - 1)) {
|
|
503
|
-
formatTextStart--;
|
|
504
|
-
}
|
|
505
|
-
let endOffset = rangeEnd;
|
|
506
|
-
while (endOffset < documentText.length && !isEOL(documentText, endOffset)) {
|
|
507
|
-
endOffset++;
|
|
508
|
-
}
|
|
509
|
-
formatText = documentText.substring(formatTextStart, endOffset);
|
|
510
|
-
initialIndentLevel = computeIndentLevel(formatText, options);
|
|
511
|
-
} else {
|
|
512
|
-
formatText = documentText;
|
|
513
|
-
initialIndentLevel = 0;
|
|
514
|
-
formatTextStart = 0;
|
|
515
|
-
rangeStart = 0;
|
|
516
|
-
rangeEnd = documentText.length;
|
|
517
|
-
}
|
|
518
|
-
const eol = getEOL(options, documentText);
|
|
519
|
-
const eolFastPathSupported = supportedEols.includes(eol);
|
|
520
|
-
let numberLineBreaks = 0;
|
|
521
|
-
let indentLevel = 0;
|
|
522
|
-
let indentValue;
|
|
523
|
-
if (options.insertSpaces) {
|
|
524
|
-
indentValue = cachedSpaces[options.tabSize || 4] ?? repeat(cachedSpaces[1], options.tabSize || 4);
|
|
525
|
-
} else {
|
|
526
|
-
indentValue = "\t";
|
|
527
|
-
}
|
|
528
|
-
const indentType = indentValue === "\t" ? "\t" : " ";
|
|
529
|
-
let scanner = createScanner(formatText, false);
|
|
530
|
-
let hasError = false;
|
|
531
|
-
function newLinesAndIndent() {
|
|
532
|
-
if (numberLineBreaks > 1) {
|
|
533
|
-
return repeat(eol, numberLineBreaks) + repeat(indentValue, initialIndentLevel + indentLevel);
|
|
534
|
-
}
|
|
535
|
-
const amountOfSpaces = indentValue.length * (initialIndentLevel + indentLevel);
|
|
536
|
-
if (!eolFastPathSupported || amountOfSpaces > cachedBreakLinesWithSpaces[indentType][eol].length) {
|
|
537
|
-
return eol + repeat(indentValue, initialIndentLevel + indentLevel);
|
|
538
|
-
}
|
|
539
|
-
if (amountOfSpaces <= 0) {
|
|
540
|
-
return eol;
|
|
541
|
-
}
|
|
542
|
-
return cachedBreakLinesWithSpaces[indentType][eol][amountOfSpaces];
|
|
543
|
-
}
|
|
544
|
-
function scanNext() {
|
|
545
|
-
let token = scanner.scan();
|
|
546
|
-
numberLineBreaks = 0;
|
|
547
|
-
while (token === 15 || token === 14) {
|
|
548
|
-
if (token === 14 && options.keepLines) {
|
|
549
|
-
numberLineBreaks += 1;
|
|
550
|
-
} else if (token === 14) {
|
|
551
|
-
numberLineBreaks = 1;
|
|
552
|
-
}
|
|
553
|
-
token = scanner.scan();
|
|
554
|
-
}
|
|
555
|
-
hasError = token === 16 || scanner.getTokenError() !== 0;
|
|
556
|
-
return token;
|
|
557
|
-
}
|
|
558
|
-
const editOperations = [];
|
|
559
|
-
function addEdit(text, startOffset, endOffset) {
|
|
560
|
-
if (!hasError && (!range || startOffset < rangeEnd && endOffset > rangeStart) && documentText.substring(startOffset, endOffset) !== text) {
|
|
561
|
-
editOperations.push({ offset: startOffset, length: endOffset - startOffset, content: text });
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
let firstToken = scanNext();
|
|
565
|
-
if (options.keepLines && numberLineBreaks > 0) {
|
|
566
|
-
addEdit(repeat(eol, numberLineBreaks), 0, 0);
|
|
567
|
-
}
|
|
568
|
-
if (firstToken !== 17) {
|
|
569
|
-
let firstTokenStart = scanner.getTokenOffset() + formatTextStart;
|
|
570
|
-
let initialIndent = indentValue.length * initialIndentLevel < 20 && options.insertSpaces ? cachedSpaces[indentValue.length * initialIndentLevel] : repeat(indentValue, initialIndentLevel);
|
|
571
|
-
addEdit(initialIndent, formatTextStart, firstTokenStart);
|
|
572
|
-
}
|
|
573
|
-
while (firstToken !== 17) {
|
|
574
|
-
let firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
|
|
575
|
-
let secondToken = scanNext();
|
|
576
|
-
let replaceContent = "";
|
|
577
|
-
let needsLineBreak = false;
|
|
578
|
-
while (numberLineBreaks === 0 && (secondToken === 12 || secondToken === 13)) {
|
|
579
|
-
let commentTokenStart = scanner.getTokenOffset() + formatTextStart;
|
|
580
|
-
addEdit(cachedSpaces[1], firstTokenEnd, commentTokenStart);
|
|
581
|
-
firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
|
|
582
|
-
needsLineBreak = secondToken === 12;
|
|
583
|
-
replaceContent = needsLineBreak ? newLinesAndIndent() : "";
|
|
584
|
-
secondToken = scanNext();
|
|
585
|
-
}
|
|
586
|
-
if (secondToken === 2) {
|
|
587
|
-
if (firstToken !== 1) {
|
|
588
|
-
indentLevel--;
|
|
589
|
-
}
|
|
590
|
-
if (options.keepLines && numberLineBreaks > 0 || !options.keepLines && firstToken !== 1) {
|
|
591
|
-
replaceContent = newLinesAndIndent();
|
|
592
|
-
} else if (options.keepLines) {
|
|
593
|
-
replaceContent = cachedSpaces[1];
|
|
594
|
-
}
|
|
595
|
-
} else if (secondToken === 4) {
|
|
596
|
-
if (firstToken !== 3) {
|
|
597
|
-
indentLevel--;
|
|
598
|
-
}
|
|
599
|
-
if (options.keepLines && numberLineBreaks > 0 || !options.keepLines && firstToken !== 3) {
|
|
600
|
-
replaceContent = newLinesAndIndent();
|
|
601
|
-
} else if (options.keepLines) {
|
|
602
|
-
replaceContent = cachedSpaces[1];
|
|
603
|
-
}
|
|
604
|
-
} else {
|
|
605
|
-
switch (firstToken) {
|
|
606
|
-
case 3:
|
|
607
|
-
case 1:
|
|
608
|
-
indentLevel++;
|
|
609
|
-
if (options.keepLines && numberLineBreaks > 0 || !options.keepLines) {
|
|
610
|
-
replaceContent = newLinesAndIndent();
|
|
611
|
-
} else {
|
|
612
|
-
replaceContent = cachedSpaces[1];
|
|
613
|
-
}
|
|
614
|
-
break;
|
|
615
|
-
case 5:
|
|
616
|
-
if (options.keepLines && numberLineBreaks > 0 || !options.keepLines) {
|
|
617
|
-
replaceContent = newLinesAndIndent();
|
|
618
|
-
} else {
|
|
619
|
-
replaceContent = cachedSpaces[1];
|
|
620
|
-
}
|
|
621
|
-
break;
|
|
622
|
-
case 12:
|
|
623
|
-
replaceContent = newLinesAndIndent();
|
|
624
|
-
break;
|
|
625
|
-
case 13:
|
|
626
|
-
if (numberLineBreaks > 0) {
|
|
627
|
-
replaceContent = newLinesAndIndent();
|
|
628
|
-
} else if (!needsLineBreak) {
|
|
629
|
-
replaceContent = cachedSpaces[1];
|
|
630
|
-
}
|
|
631
|
-
break;
|
|
632
|
-
case 6:
|
|
633
|
-
if (options.keepLines && numberLineBreaks > 0) {
|
|
634
|
-
replaceContent = newLinesAndIndent();
|
|
635
|
-
} else if (!needsLineBreak) {
|
|
636
|
-
replaceContent = cachedSpaces[1];
|
|
637
|
-
}
|
|
638
|
-
break;
|
|
639
|
-
case 10:
|
|
640
|
-
if (options.keepLines && numberLineBreaks > 0) {
|
|
641
|
-
replaceContent = newLinesAndIndent();
|
|
642
|
-
} else if (secondToken === 6 && !needsLineBreak) {
|
|
643
|
-
replaceContent = "";
|
|
644
|
-
}
|
|
645
|
-
break;
|
|
646
|
-
case 7:
|
|
647
|
-
case 8:
|
|
648
|
-
case 9:
|
|
649
|
-
case 11:
|
|
650
|
-
case 2:
|
|
651
|
-
case 4:
|
|
652
|
-
if (options.keepLines && numberLineBreaks > 0) {
|
|
653
|
-
replaceContent = newLinesAndIndent();
|
|
654
|
-
} else {
|
|
655
|
-
if ((secondToken === 12 || secondToken === 13) && !needsLineBreak) {
|
|
656
|
-
replaceContent = cachedSpaces[1];
|
|
657
|
-
} else if (secondToken !== 5 && secondToken !== 17) {
|
|
658
|
-
hasError = true;
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
break;
|
|
662
|
-
case 16:
|
|
663
|
-
hasError = true;
|
|
664
|
-
break;
|
|
665
|
-
}
|
|
666
|
-
if (numberLineBreaks > 0 && (secondToken === 12 || secondToken === 13)) {
|
|
667
|
-
replaceContent = newLinesAndIndent();
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
if (secondToken === 17) {
|
|
671
|
-
if (options.keepLines && numberLineBreaks > 0) {
|
|
672
|
-
replaceContent = newLinesAndIndent();
|
|
673
|
-
} else {
|
|
674
|
-
replaceContent = options.insertFinalNewline ? eol : "";
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
const secondTokenStart = scanner.getTokenOffset() + formatTextStart;
|
|
678
|
-
addEdit(replaceContent, firstTokenEnd, secondTokenStart);
|
|
679
|
-
firstToken = secondToken;
|
|
680
|
-
}
|
|
681
|
-
return editOperations;
|
|
682
|
-
}
|
|
683
|
-
function repeat(s, count) {
|
|
684
|
-
let result = "";
|
|
685
|
-
for (let i = 0;i < count; i++) {
|
|
686
|
-
result += s;
|
|
687
|
-
}
|
|
688
|
-
return result;
|
|
689
|
-
}
|
|
690
|
-
function computeIndentLevel(content, options) {
|
|
691
|
-
let i = 0;
|
|
692
|
-
let nChars = 0;
|
|
693
|
-
const tabSize = options.tabSize || 4;
|
|
694
|
-
while (i < content.length) {
|
|
695
|
-
let ch = content.charAt(i);
|
|
696
|
-
if (ch === cachedSpaces[1]) {
|
|
697
|
-
nChars++;
|
|
698
|
-
} else if (ch === "\t") {
|
|
699
|
-
nChars += tabSize;
|
|
700
|
-
} else {
|
|
701
|
-
break;
|
|
702
|
-
}
|
|
703
|
-
i++;
|
|
704
|
-
}
|
|
705
|
-
return Math.floor(nChars / tabSize);
|
|
706
|
-
}
|
|
707
|
-
function getEOL(options, text) {
|
|
708
|
-
for (let i = 0;i < text.length; i++) {
|
|
709
|
-
const ch = text.charAt(i);
|
|
710
|
-
if (ch === "\r") {
|
|
711
|
-
if (i + 1 < text.length && text.charAt(i + 1) === `
|
|
712
|
-
`) {
|
|
713
|
-
return `\r
|
|
714
|
-
`;
|
|
715
|
-
}
|
|
716
|
-
return "\r";
|
|
717
|
-
} else if (ch === `
|
|
718
|
-
`) {
|
|
719
|
-
return `
|
|
720
|
-
`;
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
return options && options.eol || `
|
|
724
|
-
`;
|
|
725
|
-
}
|
|
726
|
-
function isEOL(text, offset) {
|
|
727
|
-
return `\r
|
|
728
|
-
`.indexOf(text.charAt(offset)) !== -1;
|
|
729
|
-
}
|
|
730
|
-
var init_format = __esm(() => {
|
|
731
|
-
init_scanner();
|
|
732
|
-
init_string_intern();
|
|
733
|
-
});
|
|
734
|
-
|
|
735
|
-
// node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/parser.js
|
|
736
|
-
function parse(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
737
|
-
let currentProperty = null;
|
|
738
|
-
let currentParent = [];
|
|
739
|
-
const previousParents = [];
|
|
740
|
-
function onValue(value) {
|
|
741
|
-
if (Array.isArray(currentParent)) {
|
|
742
|
-
currentParent.push(value);
|
|
743
|
-
} else if (currentProperty !== null) {
|
|
744
|
-
currentParent[currentProperty] = value;
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
const visitor = {
|
|
748
|
-
onObjectBegin: () => {
|
|
749
|
-
const object = {};
|
|
750
|
-
onValue(object);
|
|
751
|
-
previousParents.push(currentParent);
|
|
752
|
-
currentParent = object;
|
|
753
|
-
currentProperty = null;
|
|
754
|
-
},
|
|
755
|
-
onObjectProperty: (name) => {
|
|
756
|
-
currentProperty = name;
|
|
757
|
-
},
|
|
758
|
-
onObjectEnd: () => {
|
|
759
|
-
currentParent = previousParents.pop();
|
|
760
|
-
},
|
|
761
|
-
onArrayBegin: () => {
|
|
762
|
-
const array = [];
|
|
763
|
-
onValue(array);
|
|
764
|
-
previousParents.push(currentParent);
|
|
765
|
-
currentParent = array;
|
|
766
|
-
currentProperty = null;
|
|
767
|
-
},
|
|
768
|
-
onArrayEnd: () => {
|
|
769
|
-
currentParent = previousParents.pop();
|
|
770
|
-
},
|
|
771
|
-
onLiteralValue: onValue,
|
|
772
|
-
onError: (error, offset, length) => {
|
|
773
|
-
errors.push({ error, offset, length });
|
|
774
|
-
}
|
|
775
|
-
};
|
|
776
|
-
visit(text, visitor, options);
|
|
777
|
-
return currentParent[0];
|
|
778
|
-
}
|
|
779
|
-
function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
780
|
-
let currentParent = { type: "array", offset: -1, length: -1, children: [], parent: undefined };
|
|
781
|
-
function ensurePropertyComplete(endOffset) {
|
|
782
|
-
if (currentParent.type === "property") {
|
|
783
|
-
currentParent.length = endOffset - currentParent.offset;
|
|
784
|
-
currentParent = currentParent.parent;
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
function onValue(valueNode) {
|
|
788
|
-
currentParent.children.push(valueNode);
|
|
789
|
-
return valueNode;
|
|
790
|
-
}
|
|
791
|
-
const visitor = {
|
|
792
|
-
onObjectBegin: (offset) => {
|
|
793
|
-
currentParent = onValue({ type: "object", offset, length: -1, parent: currentParent, children: [] });
|
|
794
|
-
},
|
|
795
|
-
onObjectProperty: (name, offset, length) => {
|
|
796
|
-
currentParent = onValue({ type: "property", offset, length: -1, parent: currentParent, children: [] });
|
|
797
|
-
currentParent.children.push({ type: "string", value: name, offset, length, parent: currentParent });
|
|
798
|
-
},
|
|
799
|
-
onObjectEnd: (offset, length) => {
|
|
800
|
-
ensurePropertyComplete(offset + length);
|
|
801
|
-
currentParent.length = offset + length - currentParent.offset;
|
|
802
|
-
currentParent = currentParent.parent;
|
|
803
|
-
ensurePropertyComplete(offset + length);
|
|
804
|
-
},
|
|
805
|
-
onArrayBegin: (offset, length) => {
|
|
806
|
-
currentParent = onValue({ type: "array", offset, length: -1, parent: currentParent, children: [] });
|
|
807
|
-
},
|
|
808
|
-
onArrayEnd: (offset, length) => {
|
|
809
|
-
currentParent.length = offset + length - currentParent.offset;
|
|
810
|
-
currentParent = currentParent.parent;
|
|
811
|
-
ensurePropertyComplete(offset + length);
|
|
812
|
-
},
|
|
813
|
-
onLiteralValue: (value, offset, length) => {
|
|
814
|
-
onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
|
|
815
|
-
ensurePropertyComplete(offset + length);
|
|
816
|
-
},
|
|
817
|
-
onSeparator: (sep, offset, length) => {
|
|
818
|
-
if (currentParent.type === "property") {
|
|
819
|
-
if (sep === ":") {
|
|
820
|
-
currentParent.colonOffset = offset;
|
|
821
|
-
} else if (sep === ",") {
|
|
822
|
-
ensurePropertyComplete(offset);
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
},
|
|
826
|
-
onError: (error, offset, length) => {
|
|
827
|
-
errors.push({ error, offset, length });
|
|
828
|
-
}
|
|
829
|
-
};
|
|
830
|
-
visit(text, visitor, options);
|
|
831
|
-
const result = currentParent.children[0];
|
|
832
|
-
if (result) {
|
|
833
|
-
delete result.parent;
|
|
834
|
-
}
|
|
835
|
-
return result;
|
|
836
|
-
}
|
|
837
|
-
function findNodeAtLocation(root, path) {
|
|
838
|
-
if (!root) {
|
|
839
|
-
return;
|
|
840
|
-
}
|
|
841
|
-
let node = root;
|
|
842
|
-
for (let segment of path) {
|
|
843
|
-
if (typeof segment === "string") {
|
|
844
|
-
if (node.type !== "object" || !Array.isArray(node.children)) {
|
|
845
|
-
return;
|
|
846
|
-
}
|
|
847
|
-
let found = false;
|
|
848
|
-
for (const propertyNode of node.children) {
|
|
849
|
-
if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment && propertyNode.children.length === 2) {
|
|
850
|
-
node = propertyNode.children[1];
|
|
851
|
-
found = true;
|
|
852
|
-
break;
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
if (!found) {
|
|
856
|
-
return;
|
|
857
|
-
}
|
|
858
|
-
} else {
|
|
859
|
-
const index = segment;
|
|
860
|
-
if (node.type !== "array" || index < 0 || !Array.isArray(node.children) || index >= node.children.length) {
|
|
861
|
-
return;
|
|
862
|
-
}
|
|
863
|
-
node = node.children[index];
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
return node;
|
|
867
|
-
}
|
|
868
|
-
function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
869
|
-
const _scanner = createScanner(text, false);
|
|
870
|
-
const _jsonPath = [];
|
|
871
|
-
let suppressedCallbacks = 0;
|
|
872
|
-
function toNoArgVisit(visitFunction) {
|
|
873
|
-
return visitFunction ? () => suppressedCallbacks === 0 && visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
874
|
-
}
|
|
875
|
-
function toOneArgVisit(visitFunction) {
|
|
876
|
-
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
877
|
-
}
|
|
878
|
-
function toOneArgVisitWithPath(visitFunction) {
|
|
879
|
-
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
|
|
880
|
-
}
|
|
881
|
-
function toBeginVisit(visitFunction) {
|
|
882
|
-
return visitFunction ? () => {
|
|
883
|
-
if (suppressedCallbacks > 0) {
|
|
884
|
-
suppressedCallbacks++;
|
|
885
|
-
} else {
|
|
886
|
-
let cbReturn = visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice());
|
|
887
|
-
if (cbReturn === false) {
|
|
888
|
-
suppressedCallbacks = 1;
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
} : () => true;
|
|
892
|
-
}
|
|
893
|
-
function toEndVisit(visitFunction) {
|
|
894
|
-
return visitFunction ? () => {
|
|
895
|
-
if (suppressedCallbacks > 0) {
|
|
896
|
-
suppressedCallbacks--;
|
|
897
|
-
}
|
|
898
|
-
if (suppressedCallbacks === 0) {
|
|
899
|
-
visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter());
|
|
900
|
-
}
|
|
901
|
-
} : () => true;
|
|
902
|
-
}
|
|
903
|
-
const onObjectBegin = toBeginVisit(visitor.onObjectBegin), onObjectProperty = toOneArgVisitWithPath(visitor.onObjectProperty), onObjectEnd = toEndVisit(visitor.onObjectEnd), onArrayBegin = toBeginVisit(visitor.onArrayBegin), onArrayEnd = toEndVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisitWithPath(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError = toOneArgVisit(visitor.onError);
|
|
904
|
-
const disallowComments = options && options.disallowComments;
|
|
905
|
-
const allowTrailingComma = options && options.allowTrailingComma;
|
|
906
|
-
function scanNext() {
|
|
907
|
-
while (true) {
|
|
908
|
-
const token = _scanner.scan();
|
|
909
|
-
switch (_scanner.getTokenError()) {
|
|
910
|
-
case 4:
|
|
911
|
-
handleError(14);
|
|
912
|
-
break;
|
|
913
|
-
case 5:
|
|
914
|
-
handleError(15);
|
|
915
|
-
break;
|
|
916
|
-
case 3:
|
|
917
|
-
handleError(13);
|
|
918
|
-
break;
|
|
919
|
-
case 1:
|
|
920
|
-
if (!disallowComments) {
|
|
921
|
-
handleError(11);
|
|
922
|
-
}
|
|
923
|
-
break;
|
|
924
|
-
case 2:
|
|
925
|
-
handleError(12);
|
|
926
|
-
break;
|
|
927
|
-
case 6:
|
|
928
|
-
handleError(16);
|
|
929
|
-
break;
|
|
930
|
-
}
|
|
931
|
-
switch (token) {
|
|
932
|
-
case 12:
|
|
933
|
-
case 13:
|
|
934
|
-
if (disallowComments) {
|
|
935
|
-
handleError(10);
|
|
936
|
-
} else {
|
|
937
|
-
onComment();
|
|
938
|
-
}
|
|
939
|
-
break;
|
|
940
|
-
case 16:
|
|
941
|
-
handleError(1);
|
|
942
|
-
break;
|
|
943
|
-
case 15:
|
|
944
|
-
case 14:
|
|
945
|
-
break;
|
|
946
|
-
default:
|
|
947
|
-
return token;
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
function handleError(error, skipUntilAfter = [], skipUntil = []) {
|
|
952
|
-
onError(error);
|
|
953
|
-
if (skipUntilAfter.length + skipUntil.length > 0) {
|
|
954
|
-
let token = _scanner.getToken();
|
|
955
|
-
while (token !== 17) {
|
|
956
|
-
if (skipUntilAfter.indexOf(token) !== -1) {
|
|
957
|
-
scanNext();
|
|
958
|
-
break;
|
|
959
|
-
} else if (skipUntil.indexOf(token) !== -1) {
|
|
960
|
-
break;
|
|
961
|
-
}
|
|
962
|
-
token = scanNext();
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
function parseString(isValue) {
|
|
967
|
-
const value = _scanner.getTokenValue();
|
|
968
|
-
if (isValue) {
|
|
969
|
-
onLiteralValue(value);
|
|
970
|
-
} else {
|
|
971
|
-
onObjectProperty(value);
|
|
972
|
-
_jsonPath.push(value);
|
|
973
|
-
}
|
|
974
|
-
scanNext();
|
|
975
|
-
return true;
|
|
976
|
-
}
|
|
977
|
-
function parseLiteral() {
|
|
978
|
-
switch (_scanner.getToken()) {
|
|
979
|
-
case 11:
|
|
980
|
-
const tokenValue = _scanner.getTokenValue();
|
|
981
|
-
let value = Number(tokenValue);
|
|
982
|
-
if (isNaN(value)) {
|
|
983
|
-
handleError(2);
|
|
984
|
-
value = 0;
|
|
985
|
-
}
|
|
986
|
-
onLiteralValue(value);
|
|
987
|
-
break;
|
|
988
|
-
case 7:
|
|
989
|
-
onLiteralValue(null);
|
|
990
|
-
break;
|
|
991
|
-
case 8:
|
|
992
|
-
onLiteralValue(true);
|
|
993
|
-
break;
|
|
994
|
-
case 9:
|
|
995
|
-
onLiteralValue(false);
|
|
996
|
-
break;
|
|
997
|
-
default:
|
|
998
|
-
return false;
|
|
999
|
-
}
|
|
1000
|
-
scanNext();
|
|
1001
|
-
return true;
|
|
1002
|
-
}
|
|
1003
|
-
function parseProperty() {
|
|
1004
|
-
if (_scanner.getToken() !== 10) {
|
|
1005
|
-
handleError(3, [], [2, 5]);
|
|
1006
|
-
return false;
|
|
1007
|
-
}
|
|
1008
|
-
parseString(false);
|
|
1009
|
-
if (_scanner.getToken() === 6) {
|
|
1010
|
-
onSeparator(":");
|
|
1011
|
-
scanNext();
|
|
1012
|
-
if (!parseValue()) {
|
|
1013
|
-
handleError(4, [], [2, 5]);
|
|
1014
|
-
}
|
|
1015
|
-
} else {
|
|
1016
|
-
handleError(5, [], [2, 5]);
|
|
1017
|
-
}
|
|
1018
|
-
_jsonPath.pop();
|
|
1019
|
-
return true;
|
|
1020
|
-
}
|
|
1021
|
-
function parseObject() {
|
|
1022
|
-
onObjectBegin();
|
|
1023
|
-
scanNext();
|
|
1024
|
-
let needsComma = false;
|
|
1025
|
-
while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17) {
|
|
1026
|
-
if (_scanner.getToken() === 5) {
|
|
1027
|
-
if (!needsComma) {
|
|
1028
|
-
handleError(4, [], []);
|
|
1029
|
-
}
|
|
1030
|
-
onSeparator(",");
|
|
1031
|
-
scanNext();
|
|
1032
|
-
if (_scanner.getToken() === 2 && allowTrailingComma) {
|
|
1033
|
-
break;
|
|
1034
|
-
}
|
|
1035
|
-
} else if (needsComma) {
|
|
1036
|
-
handleError(6, [], []);
|
|
1037
|
-
}
|
|
1038
|
-
if (!parseProperty()) {
|
|
1039
|
-
handleError(4, [], [2, 5]);
|
|
1040
|
-
}
|
|
1041
|
-
needsComma = true;
|
|
1042
|
-
}
|
|
1043
|
-
onObjectEnd();
|
|
1044
|
-
if (_scanner.getToken() !== 2) {
|
|
1045
|
-
handleError(7, [2], []);
|
|
1046
|
-
} else {
|
|
1047
|
-
scanNext();
|
|
1048
|
-
}
|
|
1049
|
-
return true;
|
|
1050
|
-
}
|
|
1051
|
-
function parseArray() {
|
|
1052
|
-
onArrayBegin();
|
|
1053
|
-
scanNext();
|
|
1054
|
-
let isFirstElement = true;
|
|
1055
|
-
let needsComma = false;
|
|
1056
|
-
while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17) {
|
|
1057
|
-
if (_scanner.getToken() === 5) {
|
|
1058
|
-
if (!needsComma) {
|
|
1059
|
-
handleError(4, [], []);
|
|
1060
|
-
}
|
|
1061
|
-
onSeparator(",");
|
|
1062
|
-
scanNext();
|
|
1063
|
-
if (_scanner.getToken() === 4 && allowTrailingComma) {
|
|
1064
|
-
break;
|
|
1065
|
-
}
|
|
1066
|
-
} else if (needsComma) {
|
|
1067
|
-
handleError(6, [], []);
|
|
1068
|
-
}
|
|
1069
|
-
if (isFirstElement) {
|
|
1070
|
-
_jsonPath.push(0);
|
|
1071
|
-
isFirstElement = false;
|
|
1072
|
-
} else {
|
|
1073
|
-
_jsonPath[_jsonPath.length - 1]++;
|
|
1074
|
-
}
|
|
1075
|
-
if (!parseValue()) {
|
|
1076
|
-
handleError(4, [], [4, 5]);
|
|
1077
|
-
}
|
|
1078
|
-
needsComma = true;
|
|
1079
|
-
}
|
|
1080
|
-
onArrayEnd();
|
|
1081
|
-
if (!isFirstElement) {
|
|
1082
|
-
_jsonPath.pop();
|
|
1083
|
-
}
|
|
1084
|
-
if (_scanner.getToken() !== 4) {
|
|
1085
|
-
handleError(8, [4], []);
|
|
1086
|
-
} else {
|
|
1087
|
-
scanNext();
|
|
1088
|
-
}
|
|
1089
|
-
return true;
|
|
1090
|
-
}
|
|
1091
|
-
function parseValue() {
|
|
1092
|
-
switch (_scanner.getToken()) {
|
|
1093
|
-
case 3:
|
|
1094
|
-
return parseArray();
|
|
1095
|
-
case 1:
|
|
1096
|
-
return parseObject();
|
|
1097
|
-
case 10:
|
|
1098
|
-
return parseString(true);
|
|
1099
|
-
default:
|
|
1100
|
-
return parseLiteral();
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
scanNext();
|
|
1104
|
-
if (_scanner.getToken() === 17) {
|
|
1105
|
-
if (options.allowEmptyContent) {
|
|
1106
|
-
return true;
|
|
1107
|
-
}
|
|
1108
|
-
handleError(4, [], []);
|
|
1109
|
-
return false;
|
|
1110
|
-
}
|
|
1111
|
-
if (!parseValue()) {
|
|
1112
|
-
handleError(4, [], []);
|
|
1113
|
-
return false;
|
|
1114
|
-
}
|
|
1115
|
-
if (_scanner.getToken() !== 17) {
|
|
1116
|
-
handleError(9, [], []);
|
|
1117
|
-
}
|
|
1118
|
-
return true;
|
|
1119
|
-
}
|
|
1120
|
-
function getNodeType(value) {
|
|
1121
|
-
switch (typeof value) {
|
|
1122
|
-
case "boolean":
|
|
1123
|
-
return "boolean";
|
|
1124
|
-
case "number":
|
|
1125
|
-
return "number";
|
|
1126
|
-
case "string":
|
|
1127
|
-
return "string";
|
|
1128
|
-
case "object": {
|
|
1129
|
-
if (!value) {
|
|
1130
|
-
return "null";
|
|
1131
|
-
} else if (Array.isArray(value)) {
|
|
1132
|
-
return "array";
|
|
1133
|
-
}
|
|
1134
|
-
return "object";
|
|
1135
|
-
}
|
|
1136
|
-
default:
|
|
1137
|
-
return "null";
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1140
|
-
var ParseOptions;
|
|
1141
|
-
var init_parser = __esm(() => {
|
|
1142
|
-
init_scanner();
|
|
1143
|
-
(function(ParseOptions2) {
|
|
1144
|
-
ParseOptions2.DEFAULT = {
|
|
1145
|
-
allowTrailingComma: false
|
|
1146
|
-
};
|
|
1147
|
-
})(ParseOptions || (ParseOptions = {}));
|
|
1148
|
-
});
|
|
1149
|
-
|
|
1150
|
-
// node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/edit.js
|
|
1151
|
-
function setProperty(text, originalPath, value, options) {
|
|
1152
|
-
const path = originalPath.slice();
|
|
1153
|
-
const errors = [];
|
|
1154
|
-
const root = parseTree(text, errors);
|
|
1155
|
-
let parent = undefined;
|
|
1156
|
-
let lastSegment = undefined;
|
|
1157
|
-
while (path.length > 0) {
|
|
1158
|
-
lastSegment = path.pop();
|
|
1159
|
-
parent = findNodeAtLocation(root, path);
|
|
1160
|
-
if (parent === undefined && value !== undefined) {
|
|
1161
|
-
if (typeof lastSegment === "string") {
|
|
1162
|
-
value = { [lastSegment]: value };
|
|
1163
|
-
} else {
|
|
1164
|
-
value = [value];
|
|
1165
|
-
}
|
|
1166
|
-
} else {
|
|
1167
|
-
break;
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
if (!parent) {
|
|
1171
|
-
if (value === undefined) {
|
|
1172
|
-
throw new Error("Can not delete in empty document");
|
|
1173
|
-
}
|
|
1174
|
-
return withFormatting(text, { offset: root ? root.offset : 0, length: root ? root.length : 0, content: JSON.stringify(value) }, options);
|
|
1175
|
-
} else if (parent.type === "object" && typeof lastSegment === "string" && Array.isArray(parent.children)) {
|
|
1176
|
-
const existing = findNodeAtLocation(parent, [lastSegment]);
|
|
1177
|
-
if (existing !== undefined) {
|
|
1178
|
-
if (value === undefined) {
|
|
1179
|
-
if (!existing.parent) {
|
|
1180
|
-
throw new Error("Malformed AST");
|
|
1181
|
-
}
|
|
1182
|
-
const propertyIndex = parent.children.indexOf(existing.parent);
|
|
1183
|
-
let removeBegin;
|
|
1184
|
-
let removeEnd = existing.parent.offset + existing.parent.length;
|
|
1185
|
-
if (propertyIndex > 0) {
|
|
1186
|
-
let previous = parent.children[propertyIndex - 1];
|
|
1187
|
-
removeBegin = previous.offset + previous.length;
|
|
1188
|
-
} else {
|
|
1189
|
-
removeBegin = parent.offset + 1;
|
|
1190
|
-
if (parent.children.length > 1) {
|
|
1191
|
-
let next = parent.children[1];
|
|
1192
|
-
removeEnd = next.offset;
|
|
1193
|
-
}
|
|
1194
|
-
}
|
|
1195
|
-
return withFormatting(text, { offset: removeBegin, length: removeEnd - removeBegin, content: "" }, options);
|
|
1196
|
-
} else {
|
|
1197
|
-
return withFormatting(text, { offset: existing.offset, length: existing.length, content: JSON.stringify(value) }, options);
|
|
1198
|
-
}
|
|
1199
|
-
} else {
|
|
1200
|
-
if (value === undefined) {
|
|
1201
|
-
return [];
|
|
1202
|
-
}
|
|
1203
|
-
const newProperty = `${JSON.stringify(lastSegment)}: ${JSON.stringify(value)}`;
|
|
1204
|
-
const index = options.getInsertionIndex ? options.getInsertionIndex(parent.children.map((p) => p.children[0].value)) : parent.children.length;
|
|
1205
|
-
let edit;
|
|
1206
|
-
if (index > 0) {
|
|
1207
|
-
let previous = parent.children[index - 1];
|
|
1208
|
-
edit = { offset: previous.offset + previous.length, length: 0, content: "," + newProperty };
|
|
1209
|
-
} else if (parent.children.length === 0) {
|
|
1210
|
-
edit = { offset: parent.offset + 1, length: 0, content: newProperty };
|
|
1211
|
-
} else {
|
|
1212
|
-
edit = { offset: parent.offset + 1, length: 0, content: newProperty + "," };
|
|
1213
|
-
}
|
|
1214
|
-
return withFormatting(text, edit, options);
|
|
1215
|
-
}
|
|
1216
|
-
} else if (parent.type === "array" && typeof lastSegment === "number" && Array.isArray(parent.children)) {
|
|
1217
|
-
const insertIndex = lastSegment;
|
|
1218
|
-
if (insertIndex === -1) {
|
|
1219
|
-
const newProperty = `${JSON.stringify(value)}`;
|
|
1220
|
-
let edit;
|
|
1221
|
-
if (parent.children.length === 0) {
|
|
1222
|
-
edit = { offset: parent.offset + 1, length: 0, content: newProperty };
|
|
1223
|
-
} else {
|
|
1224
|
-
const previous = parent.children[parent.children.length - 1];
|
|
1225
|
-
edit = { offset: previous.offset + previous.length, length: 0, content: "," + newProperty };
|
|
1226
|
-
}
|
|
1227
|
-
return withFormatting(text, edit, options);
|
|
1228
|
-
} else if (value === undefined && parent.children.length >= 0) {
|
|
1229
|
-
const removalIndex = lastSegment;
|
|
1230
|
-
const toRemove = parent.children[removalIndex];
|
|
1231
|
-
let edit;
|
|
1232
|
-
if (parent.children.length === 1) {
|
|
1233
|
-
edit = { offset: parent.offset + 1, length: parent.length - 2, content: "" };
|
|
1234
|
-
} else if (parent.children.length - 1 === removalIndex) {
|
|
1235
|
-
let previous = parent.children[removalIndex - 1];
|
|
1236
|
-
let offset = previous.offset + previous.length;
|
|
1237
|
-
let parentEndOffset = parent.offset + parent.length;
|
|
1238
|
-
edit = { offset, length: parentEndOffset - 2 - offset, content: "" };
|
|
1239
|
-
} else {
|
|
1240
|
-
edit = { offset: toRemove.offset, length: parent.children[removalIndex + 1].offset - toRemove.offset, content: "" };
|
|
1241
|
-
}
|
|
1242
|
-
return withFormatting(text, edit, options);
|
|
1243
|
-
} else if (value !== undefined) {
|
|
1244
|
-
let edit;
|
|
1245
|
-
const newProperty = `${JSON.stringify(value)}`;
|
|
1246
|
-
if (!options.isArrayInsertion && parent.children.length > lastSegment) {
|
|
1247
|
-
const toModify = parent.children[lastSegment];
|
|
1248
|
-
edit = { offset: toModify.offset, length: toModify.length, content: newProperty };
|
|
1249
|
-
} else if (parent.children.length === 0 || lastSegment === 0) {
|
|
1250
|
-
edit = { offset: parent.offset + 1, length: 0, content: parent.children.length === 0 ? newProperty : newProperty + "," };
|
|
1251
|
-
} else {
|
|
1252
|
-
const index = lastSegment > parent.children.length ? parent.children.length : lastSegment;
|
|
1253
|
-
const previous = parent.children[index - 1];
|
|
1254
|
-
edit = { offset: previous.offset + previous.length, length: 0, content: "," + newProperty };
|
|
1255
|
-
}
|
|
1256
|
-
return withFormatting(text, edit, options);
|
|
1257
|
-
} else {
|
|
1258
|
-
throw new Error(`Can not ${value === undefined ? "remove" : options.isArrayInsertion ? "insert" : "modify"} Array index ${insertIndex} as length is not sufficient`);
|
|
1259
|
-
}
|
|
1260
|
-
} else {
|
|
1261
|
-
throw new Error(`Can not add ${typeof lastSegment !== "number" ? "index" : "property"} to parent of type ${parent.type}`);
|
|
1262
|
-
}
|
|
1263
|
-
}
|
|
1264
|
-
function withFormatting(text, edit, options) {
|
|
1265
|
-
if (!options.formattingOptions) {
|
|
1266
|
-
return [edit];
|
|
1267
|
-
}
|
|
1268
|
-
let newText = applyEdit(text, edit);
|
|
1269
|
-
let begin = edit.offset;
|
|
1270
|
-
let end = edit.offset + edit.content.length;
|
|
1271
|
-
if (edit.length === 0 || edit.content.length === 0) {
|
|
1272
|
-
while (begin > 0 && !isEOL(newText, begin - 1)) {
|
|
1273
|
-
begin--;
|
|
1274
|
-
}
|
|
1275
|
-
while (end < newText.length && !isEOL(newText, end)) {
|
|
1276
|
-
end++;
|
|
1277
|
-
}
|
|
1278
|
-
}
|
|
1279
|
-
const edits = format(newText, { offset: begin, length: end - begin }, { ...options.formattingOptions, keepLines: false });
|
|
1280
|
-
for (let i = edits.length - 1;i >= 0; i--) {
|
|
1281
|
-
const edit2 = edits[i];
|
|
1282
|
-
newText = applyEdit(newText, edit2);
|
|
1283
|
-
begin = Math.min(begin, edit2.offset);
|
|
1284
|
-
end = Math.max(end, edit2.offset + edit2.length);
|
|
1285
|
-
end += edit2.content.length - edit2.length;
|
|
1286
|
-
}
|
|
1287
|
-
const editLength = text.length - (newText.length - end) - begin;
|
|
1288
|
-
return [{ offset: begin, length: editLength, content: newText.substring(begin, end) }];
|
|
1289
|
-
}
|
|
1290
|
-
function applyEdit(text, edit) {
|
|
1291
|
-
return text.substring(0, edit.offset) + edit.content + text.substring(edit.offset + edit.length);
|
|
1292
|
-
}
|
|
1293
|
-
var init_edit = __esm(() => {
|
|
1294
|
-
init_format();
|
|
1295
|
-
init_parser();
|
|
1296
|
-
});
|
|
1297
|
-
|
|
1298
|
-
// node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js
|
|
1299
|
-
function modify(text, path, value, options) {
|
|
1300
|
-
return setProperty(text, path, value, options);
|
|
1301
|
-
}
|
|
1302
|
-
function applyEdits(text, edits) {
|
|
1303
|
-
let sortedEdits = edits.slice(0).sort((a, b) => {
|
|
1304
|
-
const diff = a.offset - b.offset;
|
|
1305
|
-
if (diff === 0) {
|
|
1306
|
-
return a.length - b.length;
|
|
1307
|
-
}
|
|
1308
|
-
return diff;
|
|
1309
|
-
});
|
|
1310
|
-
let lastModifiedOffset = text.length;
|
|
1311
|
-
for (let i = sortedEdits.length - 1;i >= 0; i--) {
|
|
1312
|
-
let e = sortedEdits[i];
|
|
1313
|
-
if (e.offset + e.length <= lastModifiedOffset) {
|
|
1314
|
-
text = applyEdit(text, e);
|
|
1315
|
-
} else {
|
|
1316
|
-
throw new Error("Overlapping edit");
|
|
1317
|
-
}
|
|
1318
|
-
lastModifiedOffset = e.offset;
|
|
1319
|
-
}
|
|
1320
|
-
return text;
|
|
1321
|
-
}
|
|
1322
|
-
var ScanError, SyntaxKind, parse2, ParseErrorCode;
|
|
1323
|
-
var init_main = __esm(() => {
|
|
1324
|
-
init_format();
|
|
1325
|
-
init_edit();
|
|
1326
|
-
init_scanner();
|
|
1327
|
-
init_parser();
|
|
1328
|
-
(function(ScanError2) {
|
|
1329
|
-
ScanError2[ScanError2["None"] = 0] = "None";
|
|
1330
|
-
ScanError2[ScanError2["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
|
|
1331
|
-
ScanError2[ScanError2["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
|
|
1332
|
-
ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
|
|
1333
|
-
ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
|
|
1334
|
-
ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
|
|
1335
|
-
ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
|
|
1336
|
-
})(ScanError || (ScanError = {}));
|
|
1337
|
-
(function(SyntaxKind2) {
|
|
1338
|
-
SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
|
|
1339
|
-
SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
|
|
1340
|
-
SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
|
|
1341
|
-
SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
|
|
1342
|
-
SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
|
|
1343
|
-
SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
|
|
1344
|
-
SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
|
|
1345
|
-
SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
|
|
1346
|
-
SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
|
|
1347
|
-
SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
|
|
1348
|
-
SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
|
|
1349
|
-
SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
|
|
1350
|
-
SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
|
|
1351
|
-
SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
|
|
1352
|
-
SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
|
|
1353
|
-
SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
|
|
1354
|
-
SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
|
|
1355
|
-
})(SyntaxKind || (SyntaxKind = {}));
|
|
1356
|
-
parse2 = parse;
|
|
1357
|
-
(function(ParseErrorCode2) {
|
|
1358
|
-
ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
|
|
1359
|
-
ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
|
|
1360
|
-
ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
|
|
1361
|
-
ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
|
|
1362
|
-
ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
|
|
1363
|
-
ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
|
|
1364
|
-
ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
|
|
1365
|
-
ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
|
|
1366
|
-
ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
|
|
1367
|
-
ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
|
|
1368
|
-
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
|
|
1369
|
-
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
|
|
1370
|
-
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
|
|
1371
|
-
ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
|
|
1372
|
-
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
1373
|
-
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
1374
|
-
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
1375
|
-
});
|
|
1376
|
-
|
|
1377
|
-
// src/utils/json.ts
|
|
1378
|
-
import { open, readFile, stat } from "fs/promises";
|
|
1379
|
-
function parseJSONUncached(json, shouldLogError) {
|
|
1380
|
-
try {
|
|
1381
|
-
return { ok: true, value: JSON.parse(stripBOM(json)) };
|
|
1382
|
-
} catch (e) {
|
|
1383
|
-
if (shouldLogError) {
|
|
1384
|
-
logError(e);
|
|
1385
|
-
}
|
|
1386
|
-
return { ok: false };
|
|
1387
|
-
}
|
|
1388
|
-
}
|
|
1389
|
-
function safeParseJSONC(json) {
|
|
1390
|
-
if (!json) {
|
|
1391
|
-
return null;
|
|
1392
|
-
}
|
|
1393
|
-
try {
|
|
1394
|
-
return parse2(stripBOM(json));
|
|
1395
|
-
} catch (e) {
|
|
1396
|
-
logError(e);
|
|
1397
|
-
return null;
|
|
1398
|
-
}
|
|
1399
|
-
}
|
|
1400
|
-
function parseJSONLBun(data) {
|
|
1401
|
-
const parse3 = bunJSONLParse;
|
|
1402
|
-
const len = data.length;
|
|
1403
|
-
const result = parse3(data);
|
|
1404
|
-
if (!result.error || result.done || result.read >= len) {
|
|
1405
|
-
return result.values;
|
|
1406
|
-
}
|
|
1407
|
-
let values = result.values;
|
|
1408
|
-
let offset = result.read;
|
|
1409
|
-
while (offset < len) {
|
|
1410
|
-
const newlineIndex = typeof data === "string" ? data.indexOf(`
|
|
1411
|
-
`, offset) : data.indexOf(10, offset);
|
|
1412
|
-
if (newlineIndex === -1)
|
|
1413
|
-
break;
|
|
1414
|
-
offset = newlineIndex + 1;
|
|
1415
|
-
const next = parse3(data, offset);
|
|
1416
|
-
if (next.values.length > 0) {
|
|
1417
|
-
values = values.concat(next.values);
|
|
1418
|
-
}
|
|
1419
|
-
if (!next.error || next.done || next.read >= len)
|
|
1420
|
-
break;
|
|
1421
|
-
offset = next.read;
|
|
1422
|
-
}
|
|
1423
|
-
return values;
|
|
1424
|
-
}
|
|
1425
|
-
function parseJSONLBuffer(buf) {
|
|
1426
|
-
const bufLen = buf.length;
|
|
1427
|
-
let start = 0;
|
|
1428
|
-
if (buf[0] === 239 && buf[1] === 187 && buf[2] === 191) {
|
|
1429
|
-
start = 3;
|
|
1430
|
-
}
|
|
1431
|
-
const results = [];
|
|
1432
|
-
while (start < bufLen) {
|
|
1433
|
-
let end = buf.indexOf(10, start);
|
|
1434
|
-
if (end === -1)
|
|
1435
|
-
end = bufLen;
|
|
1436
|
-
const line = buf.toString("utf8", start, end).trim();
|
|
1437
|
-
start = end + 1;
|
|
1438
|
-
if (!line)
|
|
1439
|
-
continue;
|
|
1440
|
-
try {
|
|
1441
|
-
results.push(JSON.parse(line));
|
|
1442
|
-
} catch {}
|
|
1443
|
-
}
|
|
1444
|
-
return results;
|
|
1445
|
-
}
|
|
1446
|
-
function parseJSONLString(data) {
|
|
1447
|
-
const stripped = stripBOM(data);
|
|
1448
|
-
const len = stripped.length;
|
|
1449
|
-
let start = 0;
|
|
1450
|
-
const results = [];
|
|
1451
|
-
while (start < len) {
|
|
1452
|
-
let end = stripped.indexOf(`
|
|
1453
|
-
`, start);
|
|
1454
|
-
if (end === -1)
|
|
1455
|
-
end = len;
|
|
1456
|
-
const line = stripped.substring(start, end).trim();
|
|
1457
|
-
start = end + 1;
|
|
1458
|
-
if (!line)
|
|
1459
|
-
continue;
|
|
1460
|
-
try {
|
|
1461
|
-
results.push(JSON.parse(line));
|
|
1462
|
-
} catch {}
|
|
1463
|
-
}
|
|
1464
|
-
return results;
|
|
1465
|
-
}
|
|
1466
|
-
function parseJSONL(data) {
|
|
1467
|
-
if (bunJSONLParse) {
|
|
1468
|
-
return parseJSONLBun(data);
|
|
1469
|
-
}
|
|
1470
|
-
if (typeof data === "string") {
|
|
1471
|
-
return parseJSONLString(data);
|
|
1472
|
-
}
|
|
1473
|
-
return parseJSONLBuffer(data);
|
|
1474
|
-
}
|
|
1475
|
-
async function readJSONLFile(filePath) {
|
|
1476
|
-
let __stack = [];
|
|
1477
|
-
try {
|
|
1478
|
-
const { size } = await stat(filePath);
|
|
1479
|
-
if (size <= MAX_JSONL_READ_BYTES) {
|
|
1480
|
-
return parseJSONL(await readFile(filePath));
|
|
1481
|
-
}
|
|
1482
|
-
const fd = __using(__stack, await open(filePath, "r"), 1);
|
|
1483
|
-
const buf = Buffer.allocUnsafe(MAX_JSONL_READ_BYTES);
|
|
1484
|
-
let totalRead = 0;
|
|
1485
|
-
const fileOffset = size - MAX_JSONL_READ_BYTES;
|
|
1486
|
-
while (totalRead < MAX_JSONL_READ_BYTES) {
|
|
1487
|
-
const { bytesRead } = await fd.read(buf, totalRead, MAX_JSONL_READ_BYTES - totalRead, fileOffset + totalRead);
|
|
1488
|
-
if (bytesRead === 0)
|
|
1489
|
-
break;
|
|
1490
|
-
totalRead += bytesRead;
|
|
1491
|
-
}
|
|
1492
|
-
const newlineIndex = buf.indexOf(10);
|
|
1493
|
-
if (newlineIndex !== -1 && newlineIndex < totalRead - 1) {
|
|
1494
|
-
return parseJSONL(buf.subarray(newlineIndex + 1, totalRead));
|
|
1495
|
-
}
|
|
1496
|
-
return parseJSONL(buf.subarray(0, totalRead));
|
|
1497
|
-
} catch (_catch) {
|
|
1498
|
-
var _err = _catch, _hasErr = 1;
|
|
1499
|
-
} finally {
|
|
1500
|
-
var _promise = __callDispose(__stack, _err, _hasErr);
|
|
1501
|
-
_promise && await _promise;
|
|
1502
|
-
}
|
|
1503
|
-
}
|
|
1504
|
-
function addItemToJSONCArray(content, newItem) {
|
|
1505
|
-
try {
|
|
1506
|
-
if (!content || content.trim() === "") {
|
|
1507
|
-
return jsonStringify([newItem], null, 4);
|
|
1508
|
-
}
|
|
1509
|
-
const cleanContent = stripBOM(content);
|
|
1510
|
-
const parsedContent = parse2(cleanContent);
|
|
1511
|
-
if (Array.isArray(parsedContent)) {
|
|
1512
|
-
const arrayLength = parsedContent.length;
|
|
1513
|
-
const isEmpty = arrayLength === 0;
|
|
1514
|
-
const insertPath = isEmpty ? [0] : [arrayLength];
|
|
1515
|
-
const edits = modify(cleanContent, insertPath, newItem, {
|
|
1516
|
-
formattingOptions: { insertSpaces: true, tabSize: 4 },
|
|
1517
|
-
isArrayInsertion: true
|
|
1518
|
-
});
|
|
1519
|
-
if (!edits || edits.length === 0) {
|
|
1520
|
-
const copy = [...parsedContent, newItem];
|
|
1521
|
-
return jsonStringify(copy, null, 4);
|
|
1522
|
-
}
|
|
1523
|
-
return applyEdits(cleanContent, edits);
|
|
1524
|
-
} else {
|
|
1525
|
-
return jsonStringify([newItem], null, 4);
|
|
1526
|
-
}
|
|
1527
|
-
} catch (e) {
|
|
1528
|
-
logError(e);
|
|
1529
|
-
return jsonStringify([newItem], null, 4);
|
|
1530
|
-
}
|
|
1531
|
-
}
|
|
1532
|
-
var PARSE_CACHE_MAX_KEY_BYTES, parseJSONCached, safeParseJSON, bunJSONLParse, MAX_JSONL_READ_BYTES;
|
|
1533
|
-
var init_json = __esm(() => {
|
|
1534
|
-
init_main();
|
|
1535
|
-
init_jsonRead();
|
|
1536
|
-
init_log();
|
|
1537
|
-
init_memoize();
|
|
1538
|
-
init_slowOperations();
|
|
1539
|
-
PARSE_CACHE_MAX_KEY_BYTES = 8 * 1024;
|
|
1540
|
-
parseJSONCached = memoizeWithLRU(parseJSONUncached, (json) => json, 50);
|
|
1541
|
-
safeParseJSON = Object.assign(function safeParseJSON2(json, shouldLogError = true) {
|
|
1542
|
-
if (!json)
|
|
1543
|
-
return null;
|
|
1544
|
-
const result = json.length > PARSE_CACHE_MAX_KEY_BYTES ? parseJSONUncached(json, shouldLogError) : parseJSONCached(json, shouldLogError);
|
|
1545
|
-
return result.ok ? result.value : null;
|
|
1546
|
-
}, { cache: parseJSONCached.cache });
|
|
1547
|
-
bunJSONLParse = (() => {
|
|
1548
|
-
if (typeof Bun === "undefined")
|
|
1549
|
-
return false;
|
|
1550
|
-
const b = Bun;
|
|
1551
|
-
const jsonl = b.JSONL;
|
|
1552
|
-
if (!jsonl?.parseChunk)
|
|
1553
|
-
return false;
|
|
1554
|
-
return jsonl.parseChunk;
|
|
1555
|
-
})();
|
|
1556
|
-
MAX_JSONL_READ_BYTES = 100 * 1024 * 1024;
|
|
1557
|
-
});
|
|
1558
|
-
|
|
1559
|
-
// src/services/mcp/types.ts
|
|
1560
|
-
var ConfigScopeSchema, TransportSchema, McpStdioServerConfigSchema, McpXaaConfigSchema, McpOAuthConfigSchema, McpSSEServerConfigSchema, McpSSEIDEServerConfigSchema, McpWebSocketIDEServerConfigSchema, McpHTTPServerConfigSchema, McpWebSocketServerConfigSchema, McpSdkServerConfigSchema, McpClaudeAIProxyServerConfigSchema, McpServerConfigSchema, McpJsonConfigSchema;
|
|
1561
|
-
var init_types = __esm(() => {
|
|
1562
|
-
init_v4();
|
|
1563
|
-
init_lazySchema();
|
|
1564
|
-
ConfigScopeSchema = lazySchema(() => exports_external.enum([
|
|
1565
|
-
"local",
|
|
1566
|
-
"user",
|
|
1567
|
-
"project",
|
|
1568
|
-
"dynamic",
|
|
1569
|
-
"enterprise",
|
|
1570
|
-
"claudeai",
|
|
1571
|
-
"managed"
|
|
1572
|
-
]));
|
|
1573
|
-
TransportSchema = lazySchema(() => exports_external.enum(["stdio", "sse", "sse-ide", "http", "ws", "sdk"]));
|
|
1574
|
-
McpStdioServerConfigSchema = lazySchema(() => exports_external.object({
|
|
1575
|
-
type: exports_external.literal("stdio").optional(),
|
|
1576
|
-
command: exports_external.string().min(1, "Command cannot be empty"),
|
|
1577
|
-
args: exports_external.array(exports_external.string()).default([]),
|
|
1578
|
-
env: exports_external.record(exports_external.string(), exports_external.string()).optional()
|
|
1579
|
-
}));
|
|
1580
|
-
McpXaaConfigSchema = lazySchema(() => exports_external.boolean());
|
|
1581
|
-
McpOAuthConfigSchema = lazySchema(() => exports_external.object({
|
|
1582
|
-
clientId: exports_external.string().optional(),
|
|
1583
|
-
callbackPort: exports_external.number().int().positive().optional(),
|
|
1584
|
-
authServerMetadataUrl: exports_external.string().url().startsWith("https://", {
|
|
1585
|
-
message: "authServerMetadataUrl must use https://"
|
|
1586
|
-
}).optional(),
|
|
1587
|
-
xaa: McpXaaConfigSchema().optional()
|
|
1588
|
-
}));
|
|
1589
|
-
McpSSEServerConfigSchema = lazySchema(() => exports_external.object({
|
|
1590
|
-
type: exports_external.literal("sse"),
|
|
1591
|
-
url: exports_external.string(),
|
|
1592
|
-
headers: exports_external.record(exports_external.string(), exports_external.string()).optional(),
|
|
1593
|
-
headersHelper: exports_external.string().optional(),
|
|
1594
|
-
oauth: McpOAuthConfigSchema().optional()
|
|
1595
|
-
}));
|
|
1596
|
-
McpSSEIDEServerConfigSchema = lazySchema(() => exports_external.object({
|
|
1597
|
-
type: exports_external.literal("sse-ide"),
|
|
1598
|
-
url: exports_external.string(),
|
|
1599
|
-
ideName: exports_external.string(),
|
|
1600
|
-
ideRunningInWindows: exports_external.boolean().optional()
|
|
1601
|
-
}));
|
|
1602
|
-
McpWebSocketIDEServerConfigSchema = lazySchema(() => exports_external.object({
|
|
1603
|
-
type: exports_external.literal("ws-ide"),
|
|
1604
|
-
url: exports_external.string(),
|
|
1605
|
-
ideName: exports_external.string(),
|
|
1606
|
-
authToken: exports_external.string().optional(),
|
|
1607
|
-
ideRunningInWindows: exports_external.boolean().optional()
|
|
1608
|
-
}));
|
|
1609
|
-
McpHTTPServerConfigSchema = lazySchema(() => exports_external.object({
|
|
1610
|
-
type: exports_external.literal("http"),
|
|
1611
|
-
url: exports_external.string(),
|
|
1612
|
-
headers: exports_external.record(exports_external.string(), exports_external.string()).optional(),
|
|
1613
|
-
headersHelper: exports_external.string().optional(),
|
|
1614
|
-
oauth: McpOAuthConfigSchema().optional()
|
|
1615
|
-
}));
|
|
1616
|
-
McpWebSocketServerConfigSchema = lazySchema(() => exports_external.object({
|
|
1617
|
-
type: exports_external.literal("ws"),
|
|
1618
|
-
url: exports_external.string(),
|
|
1619
|
-
headers: exports_external.record(exports_external.string(), exports_external.string()).optional(),
|
|
1620
|
-
headersHelper: exports_external.string().optional()
|
|
1621
|
-
}));
|
|
1622
|
-
McpSdkServerConfigSchema = lazySchema(() => exports_external.object({
|
|
1623
|
-
type: exports_external.literal("sdk"),
|
|
1624
|
-
name: exports_external.string()
|
|
1625
|
-
}));
|
|
1626
|
-
McpClaudeAIProxyServerConfigSchema = lazySchema(() => exports_external.object({
|
|
1627
|
-
type: exports_external.literal("claudeai-proxy"),
|
|
1628
|
-
url: exports_external.string(),
|
|
1629
|
-
id: exports_external.string()
|
|
1630
|
-
}));
|
|
1631
|
-
McpServerConfigSchema = lazySchema(() => exports_external.union([
|
|
1632
|
-
McpStdioServerConfigSchema(),
|
|
1633
|
-
McpSSEServerConfigSchema(),
|
|
1634
|
-
McpSSEIDEServerConfigSchema(),
|
|
1635
|
-
McpWebSocketIDEServerConfigSchema(),
|
|
1636
|
-
McpHTTPServerConfigSchema(),
|
|
1637
|
-
McpWebSocketServerConfigSchema(),
|
|
1638
|
-
McpSdkServerConfigSchema(),
|
|
1639
|
-
McpClaudeAIProxyServerConfigSchema()
|
|
1640
|
-
]));
|
|
1641
|
-
McpJsonConfigSchema = lazySchema(() => exports_external.object({
|
|
1642
|
-
mcpServers: exports_external.record(exports_external.string(), McpServerConfigSchema())
|
|
1643
|
-
}));
|
|
1644
|
-
});
|
|
1645
|
-
|
|
1646
|
-
export { stripBOM, init_jsonRead, safeParseJSON, safeParseJSONC, parseJSONL, readJSONLFile, addItemToJSONCArray, init_json, ConfigScopeSchema, McpStdioServerConfigSchema, McpServerConfigSchema, McpJsonConfigSchema, init_types };
|