@costrict/csc 4.0.4 → 4.0.5
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/README.md +398 -398
- package/dist/{chunk-b4ftppkp.js → chunk-03a7ns5s.js} +22 -22
- package/dist/{chunk-pn0k5wak.js → chunk-03qpgz7e.js} +749 -23
- package/dist/{chunk-rar7nmve.js → chunk-06daydfw.js} +57 -57
- package/dist/{chunk-hyc3kbfq.js → chunk-0bf745n6.js} +4 -4
- package/dist/{chunk-bhwnjx3e.js → chunk-0d43nxnk.js} +8 -8
- package/dist/{chunk-2mmx9qqz.js → chunk-0d4p6r24.js} +27 -27
- package/dist/{chunk-tw4tjc73.js → chunk-0jd3p53p.js} +1 -1
- package/dist/{chunk-waar1mpa.js → chunk-0mf8c3kx.js} +2 -3
- package/dist/chunk-0vrstrej.js +40 -0
- package/dist/{chunk-13g6d7wt.js → chunk-1bbvgt3p.js} +10 -10
- package/dist/{chunk-125xg82c.js → chunk-1c3k1g6e.js} +22 -22
- package/dist/{chunk-ga3m4ews.js → chunk-1dbz25dk.js} +56 -56
- package/dist/{chunk-6rrp0t66.js → chunk-1gj2ern2.js} +530 -1321
- package/dist/{chunk-zatd0y92.js → chunk-1nmcmem8.js} +5 -5
- package/dist/{chunk-nvrje5t4.js → chunk-1zh5bbh0.js} +70 -70
- package/dist/{chunk-vxs1rvy8.js → chunk-23mmypzf.js} +6 -6
- package/dist/{chunk-z8zf2bjp.js → chunk-24e25s3h.js} +4 -4
- package/dist/{chunk-m5chmh67.js → chunk-2c0sn45e.js} +2 -2
- package/dist/{chunk-4qcmn89e.js → chunk-2dhbfegz.js} +14 -17
- package/dist/{chunk-e5ewhhx6.js → chunk-2gdcc9xa.js} +56 -56
- package/dist/{chunk-cb0cjgk3.js → chunk-2hdktzjd.js} +56 -56
- package/dist/{chunk-j1psatq5.js → chunk-2j59ksap.js} +3 -3
- package/dist/{chunk-j5bved6z.js → chunk-2jx4kafd.js} +61 -61
- package/dist/{chunk-pv6amr31.js → chunk-2kmmz00g.js} +1 -1
- package/dist/{chunk-ftwqpbvy.js → chunk-2p4eesfa.js} +56 -56
- package/dist/{chunk-wsm0s0c3.js → chunk-2whdc8zz.js} +3 -3
- package/dist/chunk-2xpkjfdd.js +94 -0
- package/dist/{chunk-d9bvzfkg.js → chunk-2xq2cy9m.js} +62 -62
- package/dist/{chunk-knc5za98.js → chunk-2y6bv8mp.js} +57 -57
- package/dist/{chunk-sx291v4f.js → chunk-30kmyxwn.js} +63 -63
- package/dist/{chunk-p6359g16.js → chunk-32rcf02k.js} +26 -26
- package/dist/{chunk-metmg93w.js → chunk-36k4p0e8.js} +2 -2
- package/dist/{chunk-njdz3yry.js → chunk-381axhkg.js} +4 -4
- package/dist/{chunk-vhjhyt2r.js → chunk-3djy352h.js} +26 -26
- package/dist/{chunk-vjv7wvnc.js → chunk-3dt68zn5.js} +4 -4
- package/dist/{chunk-2f3vsxna.js → chunk-3dyj1fqs.js} +5 -5
- package/dist/{chunk-wj8gbr2g.js → chunk-3m5d2kwd.js} +58 -58
- package/dist/{chunk-r089a4na.js → chunk-3p3r8awv.js} +22 -22
- package/dist/{chunk-tz2rkx2s.js → chunk-3qksgf50.js} +3 -3
- package/dist/{chunk-xs12ggs7.js → chunk-3rr330xr.js} +60 -60
- package/dist/{chunk-j2bv645h.js → chunk-3s96vaet.js} +9 -11
- package/dist/{chunk-bbxfenf0.js → chunk-3t41eh7n.js} +57 -57
- package/dist/{chunk-8ew7s39b.js → chunk-3wdbgpa5.js} +1 -1
- package/dist/{chunk-4nvhfqsy.js → chunk-40txw5vw.js} +58 -58
- package/dist/{chunk-w2x18mrn.js → chunk-43pqyz7x.js} +23 -23
- package/dist/{chunk-6zf34pgy.js → chunk-47sy4t29.js} +1 -1
- package/dist/{chunk-ndcrbqq2.js → chunk-4b0pe90d.js} +57 -57
- package/dist/{chunk-7rk9ppx4.js → chunk-4d9bywzd.js} +1 -1
- package/dist/{chunk-zwwgfs0j.js → chunk-4g5nvh92.js} +3 -3
- package/dist/{chunk-rn68wk3p.js → chunk-4grs5afv.js} +22 -22
- package/dist/{chunk-fp2z22f1.js → chunk-4hwyxaeq.js} +59 -59
- package/dist/{chunk-n00sjrne.js → chunk-4m7gyesz.js} +6 -6
- package/dist/{chunk-90tgpdv5.js → chunk-4q954a7f.js} +3 -3
- package/dist/{chunk-7sgatxct.js → chunk-4qqswajh.js} +5 -5
- package/dist/{chunk-rexrttsb.js → chunk-4r7jf6h7.js} +33 -33
- package/dist/{chunk-122wp3n9.js → chunk-4sfd9m3h.js} +2 -2
- package/dist/{chunk-1ymedh1v.js → chunk-4v0pzqmq.js} +23 -23
- package/dist/{chunk-9pp9xrw2.js → chunk-50fv6d8k.js} +14 -17
- package/dist/{chunk-fmq83t7h.js → chunk-50x6aec4.js} +3 -3
- package/dist/{chunk-zw543g0m.js → chunk-52tk9vq4.js} +57 -57
- package/dist/{chunk-9k7n4z3r.js → chunk-54nmt278.js} +5 -5
- package/dist/{chunk-0wrzeej6.js → chunk-55pz9658.js} +1 -1
- package/dist/{chunk-zwv3h48p.js → chunk-5chc8z8n.js} +3 -3
- package/dist/{chunk-f6qh3vrn.js → chunk-5dm6af6g.js} +4 -4
- package/dist/{chunk-d09j71dr.js → chunk-5kgmwm72.js} +6 -6
- package/dist/{chunk-2dtmmwxh.js → chunk-5p9szceb.js} +4 -4
- package/dist/{chunk-wxe04dx4.js → chunk-5pnqgsv4.js} +3 -3
- package/dist/{chunk-eenv3551.js → chunk-5s80z8bj.js} +56 -56
- package/dist/{chunk-1sg2k4mx.js → chunk-5vdpbk46.js} +515 -515
- package/dist/{chunk-ekqvx6ek.js → chunk-60fbc7y7.js} +56 -56
- package/dist/{chunk-h5qx4apy.js → chunk-61v89yt3.js} +1 -1
- package/dist/{chunk-9rtywfhp.js → chunk-64nsm3qd.js} +2 -2
- package/dist/{chunk-7mpdfrdm.js → chunk-656z4m7c.js} +5 -5
- package/dist/{chunk-jvf4wvhn.js → chunk-67ex9rnd.js} +57 -57
- package/dist/{chunk-8jpxzesa.js → chunk-67zpbdn4.js} +1 -1
- package/dist/{chunk-7t38tp7c.js → chunk-6837xx50.js} +24 -24
- package/dist/{chunk-8vawdfrp.js → chunk-6c5zyga7.js} +3 -5
- package/dist/{chunk-8ympg941.js → chunk-6fecngep.js} +1 -1
- package/dist/{chunk-t1mtqz1e.js → chunk-6r247w4d.js} +1 -1
- package/dist/{chunk-63v197w4.js → chunk-6svr4g5y.js} +56 -56
- package/dist/{chunk-j2ba3wye.js → chunk-71ptxz0w.js} +22 -22
- package/dist/{chunk-zf5wkcyy.js → chunk-7bme7hfa.js} +127 -1099
- package/dist/{chunk-qdfzdcz3.js → chunk-7h58vakp.js} +60 -60
- package/dist/{chunk-9pkh2w7v.js → chunk-7kdnj6r5.js} +8 -8
- package/dist/{chunk-9m27g5s1.js → chunk-7njxy9q8.js} +18 -3
- package/dist/{chunk-vdh36rw7.js → chunk-7pdhxye3.js} +3 -3
- package/dist/{chunk-tzaj5mwz.js → chunk-7pfa478f.js} +31 -31
- package/dist/{chunk-5a6vqs49.js → chunk-7rh6ws9p.js} +67 -67
- package/dist/{chunk-skxa5fes.js → chunk-7sk1sscc.js} +14 -16
- package/dist/{chunk-bgptt4dd.js → chunk-7x4tde6q.js} +56 -56
- package/dist/{chunk-b909mp8w.js → chunk-84r7ze95.js} +1 -1
- package/dist/{chunk-4h43b7ww.js → chunk-85jw2w2x.js} +69 -69
- package/dist/{chunk-7srwepm7.js → chunk-872211k4.js} +1 -1
- package/dist/{chunk-00m08jnq.js → chunk-89p21yqs.js} +56 -56
- package/dist/{chunk-vxnvzfnv.js → chunk-8avfrdpz.js} +2 -3
- package/dist/{chunk-h13g15kb.js → chunk-8bcxzxe5.js} +1 -1
- package/dist/{chunk-pb2x8g1w.js → chunk-8db0c0z2.js} +67 -67
- package/dist/{chunk-7e78w86v.js → chunk-8e2v15zy.js} +3 -3
- package/dist/{chunk-vhk0hgnv.js → chunk-8ehhzphf.js} +56 -56
- package/dist/{chunk-mz0qfs55.js → chunk-8fvt9r29.js} +63 -63
- package/dist/{chunk-tq82bwaf.js → chunk-8fxvkn6g.js} +2 -2
- package/dist/{chunk-j64ga6ta.js → chunk-8jyp5q4y.js} +304 -272
- package/dist/{chunk-npvte75f.js → chunk-8kqdnkkh.js} +5 -5
- package/dist/{chunk-wdwa58v1.js → chunk-8nsmkgac.js} +59 -59
- package/dist/{chunk-dc4krjj4.js → chunk-8sba81p1.js} +22 -22
- package/dist/{chunk-t31xvfy2.js → chunk-8vwcxhjg.js} +60 -60
- package/dist/{chunk-zwkqabbj.js → chunk-8wxvkw8d.js} +11 -11
- package/dist/{chunk-9azyfe65.js → chunk-8yhh34se.js} +61 -61
- package/dist/{chunk-vmf74a91.js → chunk-91fnfkf9.js} +57 -57
- package/dist/{chunk-td6j7fcr.js → chunk-91scsdr2.js} +56 -56
- package/dist/{chunk-03mgn26m.js → chunk-91wvyz0j.js} +65 -65
- package/dist/{chunk-3b5a4wa6.js → chunk-94jwb8h8.js} +22 -22
- package/dist/{chunk-02n5zpyc.js → chunk-95gj5fgc.js} +4 -4
- package/dist/{chunk-7vzj8rfd.js → chunk-96ac88tt.js} +4 -4
- package/dist/{chunk-h9ef6kkf.js → chunk-981dc4d2.js} +5 -5
- package/dist/{chunk-b3t64cwd.js → chunk-9962psf2.js} +59 -59
- package/dist/{chunk-ng8q29em.js → chunk-9f1128wv.js} +2 -2
- package/dist/{chunk-sdzpdzj3.js → chunk-9ks4hkyv.js} +58 -58
- package/dist/{chunk-kh9hfyzf.js → chunk-9nvdx365.js} +56 -56
- package/dist/{chunk-q72weaf5.js → chunk-9svnj49d.js} +829 -2177
- package/dist/{chunk-eserktyd.js → chunk-9szwp11z.js} +4 -4
- package/dist/{chunk-7sgn6fv0.js → chunk-9vxn5hr7.js} +6 -6
- package/dist/{chunk-34vn56ag.js → chunk-9zjvwht8.js} +8 -8
- package/dist/{chunk-ppa284pd.js → chunk-9zvsj7b5.js} +56 -56
- package/dist/{chunk-5zpstd3m.js → chunk-a4wba4ee.js} +7 -7
- package/dist/chunk-a5vsq9cy.js +334 -0
- package/dist/{chunk-3c1ddhnk.js → chunk-a8w9fre5.js} +19 -207
- package/dist/{chunk-tzpxsjm3.js → chunk-a8z3cmge.js} +29 -29
- package/dist/{chunk-whs655k7.js → chunk-aa2jk5ec.js} +57 -57
- package/dist/{chunk-1d0d18qj.js → chunk-aahtgv6t.js} +22 -22
- package/dist/{chunk-bneqxcmf.js → chunk-acv242nr.js} +1 -1
- package/dist/{chunk-w12f58yz.js → chunk-amp2gnxw.js} +14 -17
- package/dist/{chunk-xeehxb1q.js → chunk-av497x84.js} +3 -3
- package/dist/{chunk-31959kp1.js → chunk-b183xr8z.js} +5 -5
- package/dist/{chunk-cx8c18e3.js → chunk-b2dttpvp.js} +62 -62
- package/dist/{chunk-4mygvv18.js → chunk-b3x56xw6.js} +57 -57
- package/dist/{chunk-x6ceqp7t.js → chunk-b66fr7fs.js} +23 -23
- package/dist/{chunk-edt6c4pc.js → chunk-b78pzw80.js} +73 -73
- package/dist/{chunk-skrja2sz.js → chunk-b7van57x.js} +2 -2
- package/dist/{chunk-vh70jg33.js → chunk-b9mgqx58.js} +4 -4
- package/dist/{chunk-khdftpea.js → chunk-b9n20qcw.js} +9 -9
- package/dist/{chunk-3jjc204v.js → chunk-bakrp6by.js} +18 -18
- package/dist/{chunk-2ab59kwj.js → chunk-bdr1btg9.js} +3 -3
- package/dist/{chunk-w8ttjf01.js → chunk-bf68vqnt.js} +183 -179
- package/dist/{chunk-xafy9ccy.js → chunk-bnf2s6m6.js} +57 -57
- package/dist/{chunk-j04z48rw.js → chunk-bt64sq5y.js} +3 -3
- package/dist/{chunk-5qxgyby3.js → chunk-btma241g.js} +612 -2
- package/dist/{chunk-4w4wdgeb.js → chunk-bwy9pa2a.js} +23 -23
- package/dist/{chunk-y8ab9dyv.js → chunk-bzm15s0d.js} +1 -1
- package/dist/{chunk-6hk5a6ky.js → chunk-c0cxm1jj.js} +56 -56
- package/dist/{chunk-vgdtw10n.js → chunk-c0jj717y.js} +2 -2
- package/dist/{chunk-d8ztpy7x.js → chunk-c2e4y5dn.js} +7 -7
- package/dist/{chunk-jq9vjfbd.js → chunk-c2wjqfxa.js} +57 -57
- package/dist/{chunk-2c8aqb33.js → chunk-c58vpgh1.js} +56 -56
- package/dist/{chunk-ex2q76wx.js → chunk-c5yryhhe.js} +1 -1
- package/dist/{chunk-dct4myst.js → chunk-c7ncsekp.js} +57 -57
- package/dist/{chunk-8w2a9md8.js → chunk-cdv319m8.js} +3 -3
- package/dist/{chunk-ffy37ks3.js → chunk-cj93y6v4.js} +23 -23
- package/dist/{chunk-7vzwyazf.js → chunk-cnkwshve.js} +4 -4
- package/dist/{chunk-g8w2205d.js → chunk-cpmv1jg1.js} +6 -6
- package/dist/{chunk-mj9rbmy1.js → chunk-cxytr6ke.js} +5 -5
- package/dist/{chunk-tg41r14s.js → chunk-cy9y3g9c.js} +5 -5
- package/dist/{chunk-rgm0v4he.js → chunk-d20gvf1p.js} +24 -24
- package/dist/{chunk-drnr3z7x.js → chunk-d61srzjw.js} +144 -144
- package/dist/{chunk-npywdb7q.js → chunk-das7sqxf.js} +3 -3
- package/dist/{chunk-k95meznc.js → chunk-dcy4yhmx.js} +7 -7
- package/dist/{chunk-p2xfr5am.js → chunk-deeqzmz8.js} +57 -57
- package/dist/{chunk-tp3mqwh3.js → chunk-degs4pmz.js} +7 -7
- package/dist/{chunk-ngrj6x74.js → chunk-df52t7ys.js} +168 -161
- package/dist/{chunk-kxptk43f.js → chunk-dqpsg3x6.js} +57 -57
- package/dist/{chunk-yztxtgd8.js → chunk-dw02dt93.js} +66 -66
- package/dist/{chunk-sqb7kkqx.js → chunk-e0nvbjhe.js} +6 -6
- package/dist/{chunk-xt4v95je.js → chunk-e51ayxz6.js} +3 -3
- package/dist/{chunk-v4zejp1f.js → chunk-e7x5yj2h.js} +57 -57
- package/dist/{chunk-rw44vqpq.js → chunk-e92z3mma.js} +56 -56
- package/dist/{chunk-sd3jwppm.js → chunk-ebbxn1k1.js} +8 -8
- package/dist/{chunk-zvxjnak3.js → chunk-ehvhhmg2.js} +56 -56
- package/dist/{chunk-wkh76b1p.js → chunk-enxnnzk5.js} +7 -7
- package/dist/{chunk-jxe1a8kz.js → chunk-epkh4aat.js} +6 -6
- package/dist/{chunk-t4z17xt4.js → chunk-eqrenafc.js} +10 -10
- package/dist/{chunk-n0pkzaaw.js → chunk-erqq5705.js} +6 -6
- package/dist/{chunk-zwa133ny.js → chunk-es1hw74y.js} +2 -2
- package/dist/{chunk-xq3k2392.js → chunk-f05a5t1g.js} +57 -57
- package/dist/{chunk-dc83q1dm.js → chunk-f4kbe948.js} +2 -2
- package/dist/{chunk-9jt1c7t9.js → chunk-f6begf39.js} +58 -58
- package/dist/{chunk-g0jmqbp4.js → chunk-f6kfvezc.js} +6 -6
- package/dist/{chunk-w8krbzb0.js → chunk-fc1dg6fw.js} +4 -4
- package/dist/chunk-ff3ahqvh.js +85 -0
- package/dist/{chunk-yb6x70md.js → chunk-fg5ke2mj.js} +1786 -141
- package/dist/{chunk-m7r4wqc3.js → chunk-fnc95ck8.js} +1 -1
- package/dist/{chunk-cs9xxrmx.js → chunk-fps1h69y.js} +56 -56
- package/dist/{chunk-gaz7te9m.js → chunk-fqcserhk.js} +6 -6
- package/dist/{chunk-bwqvhzrw.js → chunk-fthbxpt7.js} +76 -69
- package/dist/{chunk-1nz1mgm6.js → chunk-fw8e2t6e.js} +39 -268
- package/dist/{chunk-hfy21maq.js → chunk-fyq9f1r4.js} +6 -6
- package/dist/{chunk-fw64v27c.js → chunk-fz0ch109.js} +3 -3
- package/dist/{chunk-q4tkspkp.js → chunk-g2ddxeq0.js} +4 -4
- package/dist/{chunk-65gzht6d.js → chunk-g3zh09cs.js} +56 -56
- package/dist/{chunk-j2cbcyf7.js → chunk-g649rtg8.js} +4 -6
- package/dist/{chunk-z43cvm9f.js → chunk-g7f6rhkv.js} +75 -75
- package/dist/{chunk-yhc1fee8.js → chunk-gafvwfpg.js} +23 -23
- package/dist/{chunk-js21kfpq.js → chunk-garqv1np.js} +1 -1
- package/dist/{chunk-84cjtasj.js → chunk-gckjpwer.js} +58 -58
- package/dist/{chunk-tsdqd747.js → chunk-gfex5hb6.js} +10 -4
- package/dist/{chunk-jvgc4q2b.js → chunk-gjkekgkm.js} +59 -59
- package/dist/{chunk-kpdp2gz2.js → chunk-gm3xyt0n.js} +13 -13
- package/dist/{chunk-3px6f9s5.js → chunk-gn36711e.js} +2 -2
- package/dist/{chunk-e08marnp.js → chunk-gneehjp8.js} +4 -4
- package/dist/{chunk-dge3af7q.js → chunk-gqqy616g.js} +8 -8
- package/dist/{chunk-5dn1m1r7.js → chunk-gwyn2qmg.js} +2 -2
- package/dist/{chunk-ds6b4567.js → chunk-h0p49ypw.js} +67 -67
- package/dist/{chunk-zpm1rpmw.js → chunk-h50wemgt.js} +16 -16
- package/dist/{chunk-yw0st51b.js → chunk-hdkf83nm.js} +57 -57
- package/dist/{chunk-nn8nkawn.js → chunk-hece55mn.js} +7 -7
- package/dist/{chunk-bg86k3wz.js → chunk-hkbjsxr5.js} +83 -339
- package/dist/{chunk-zr78q4qg.js → chunk-hnfwnrdw.js} +56 -56
- package/dist/{chunk-h0n9zhgw.js → chunk-hsyh3ht5.js} +56 -56
- package/dist/{chunk-1395xfcq.js → chunk-htqgje52.js} +58 -58
- package/dist/{chunk-tyxhcbsd.js → chunk-j3khjf4a.js} +1 -1
- package/dist/{chunk-z5tmqz5e.js → chunk-j3ww1b8w.js} +56 -56
- package/dist/{chunk-ebx4j5r5.js → chunk-j6k3zjb5.js} +5 -7
- package/dist/{chunk-3nmhzccb.js → chunk-j6v1eh21.js} +2 -2
- package/dist/{chunk-m3szhhvz.js → chunk-jcck08pa.js} +58 -58
- package/dist/{chunk-nt36mbmr.js → chunk-jdabxq24.js} +14 -14
- package/dist/{chunk-2xezy8pc.js → chunk-jfr51c5y.js} +7 -7
- package/dist/{chunk-jxyh3xyq.js → chunk-jh3g1h2m.js} +23 -23
- package/dist/{chunk-wn8nakrh.js → chunk-jhaf8e2t.js} +56 -56
- package/dist/{chunk-9kqtdah4.js → chunk-jr21cjeg.js} +1 -1
- package/dist/{chunk-rvp6qq44.js → chunk-jr6arg95.js} +5 -5
- package/dist/{chunk-znehavdm.js → chunk-jvnb1zrw.js} +1 -1
- package/dist/{chunk-me2986xy.js → chunk-jwf80scb.js} +57 -57
- package/dist/{chunk-79ztw13h.js → chunk-jytvzpqv.js} +2 -2
- package/dist/{chunk-tjaexdr7.js → chunk-jzheakwg.js} +56 -56
- package/dist/{chunk-32fv3vze.js → chunk-k0bqymfw.js} +25 -25
- package/dist/{chunk-zwna33ms.js → chunk-k4mg16w6.js} +36 -36
- package/dist/{chunk-k591s450.js → chunk-ke1bzwj0.js} +56 -56
- package/dist/{chunk-8y3eszv7.js → chunk-krbnqs28.js} +2 -2
- package/dist/{chunk-9b48fxkx.js → chunk-kvb1xp5b.js} +56 -56
- package/dist/{chunk-6dhen79h.js → chunk-m4th1xcy.js} +8 -8
- package/dist/{chunk-vf3etxnx.js → chunk-mcs219z2.js} +1 -1
- package/dist/{chunk-jp8tnjzr.js → chunk-mf1zbwh9.js} +59 -59
- package/dist/{chunk-61edjmf6.js → chunk-mg1w5bk3.js} +2 -2
- package/dist/{chunk-m1qqm2nc.js → chunk-mgbjn0ry.js} +3 -3
- package/dist/{chunk-svw35ajj.js → chunk-mkcbbspz.js} +57 -57
- package/dist/{chunk-g24e2jr3.js → chunk-mm6hffs4.js} +56 -56
- package/dist/{chunk-rwzb4fmk.js → chunk-mq26zsme.js} +59 -59
- package/dist/{chunk-z6wpnk5y.js → chunk-msyn852e.js} +1 -1
- package/dist/{chunk-n5pe3jtt.js → chunk-n1bh6pgv.js} +2 -2
- package/dist/{chunk-t0twk3e5.js → chunk-n217n8sr.js} +1 -1
- package/dist/chunk-n35vwqby.js +777 -0
- package/dist/{chunk-4tre5ddg.js → chunk-neak2qc4.js} +1 -1
- package/dist/{chunk-s6a338bt.js → chunk-nnw29ezr.js} +3 -3
- package/dist/{chunk-5p8k3wyp.js → chunk-nre8a00v.js} +59 -59
- package/dist/{chunk-ew68a4sy.js → chunk-nwj1t73f.js} +57 -57
- package/dist/{chunk-vj8q7shk.js → chunk-nxrm815g.js} +2 -2
- package/dist/{chunk-0pkrwxrg.js → chunk-nz4mxnb9.js} +3 -3
- package/dist/{chunk-send164b.js → chunk-p173c51d.js} +23 -23
- package/dist/{chunk-74v2mh4t.js → chunk-p1adg740.js} +1 -1
- package/dist/{chunk-j5keq4ye.js → chunk-p3bcc8q8.js} +60 -60
- package/dist/{chunk-3q10e1r5.js → chunk-pa2aeq9e.js} +64 -64
- package/dist/{chunk-1j8anrn2.js → chunk-pb5csk8f.js} +56 -56
- package/dist/{chunk-6ge6zddg.js → chunk-pfjb68fx.js} +3 -3
- package/dist/{chunk-rvn77re6.js → chunk-pgf6xysn.js} +23 -23
- package/dist/{chunk-67jg7cfy.js → chunk-phce1mav.js} +2 -2
- package/dist/{chunk-hk24qq7n.js → chunk-pj2h71rb.js} +9 -9
- package/dist/{chunk-3xhmzvxm.js → chunk-pjkaqt23.js} +5 -5
- package/dist/{chunk-6eq35v86.js → chunk-pnv69npn.js} +1 -1
- package/dist/{chunk-zbrk28bp.js → chunk-ptw6r102.js} +56 -56
- package/dist/{chunk-0wp0zaz8.js → chunk-pzna8nzx.js} +57 -57
- package/dist/{chunk-0gqymhpf.js → chunk-q17esyxh.js} +4 -4
- package/dist/{chunk-j95j6wz8.js → chunk-q27bsq0y.js} +1 -1
- package/dist/{chunk-7kbezevv.js → chunk-q68qcqnd.js} +5 -5
- package/dist/{chunk-0xfz1hj1.js → chunk-q6kttwf6.js} +6 -6
- package/dist/{chunk-t2ex5gsn.js → chunk-q99z5w71.js} +3 -3
- package/dist/{chunk-wyz7j9j0.js → chunk-qc9dbg7c.js} +23 -23
- package/dist/{chunk-r41sjxcn.js → chunk-qegzj6nm.js} +1 -1
- package/dist/{chunk-kerkk89t.js → chunk-qfdzqed0.js} +4 -4
- package/dist/{chunk-6jdrt36m.js → chunk-qk4akts4.js} +2 -2
- package/dist/{chunk-5ycqyqbj.js → chunk-qnbe7d8a.js} +1 -1
- package/dist/{chunk-e4jqbn4d.js → chunk-qqfbkaad.js} +3 -4
- package/dist/{chunk-zqhxr0h7.js → chunk-qs2xnhte.js} +5 -7
- package/dist/{chunk-nbvc8bh6.js → chunk-qst4b9as.js} +24 -24
- package/dist/chunk-qt0k08nw.js +500 -0
- package/dist/{chunk-vntvaf0c.js → chunk-qt8j21yc.js} +63 -63
- package/dist/{chunk-tbce47cr.js → chunk-qxsrtfzn.js} +4 -4
- package/dist/{chunk-kn9hzg11.js → chunk-r1zjw4gp.js} +3 -3
- package/dist/{chunk-pb2nc7r0.js → chunk-r5c38r2r.js} +149 -61
- package/dist/{chunk-jd2ams26.js → chunk-r6r0heh4.js} +6 -6
- package/dist/{chunk-ns3babbs.js → chunk-r7mjzgyn.js} +2 -4
- package/dist/{chunk-b3behs0y.js → chunk-ra1n1z0c.js} +3 -3
- package/dist/chunk-red9b98p.js +378 -0
- package/dist/{chunk-2kxk7ftp.js → chunk-rf9vga8z.js} +59 -59
- package/dist/{chunk-drnxbc1w.js → chunk-rfp8ja4z.js} +2 -2
- package/dist/{chunk-s38qgqfs.js → chunk-rrtkz2js.js} +4 -4
- package/dist/{chunk-epat31ss.js → chunk-rs3fergy.js} +1 -1
- package/dist/{chunk-3d953efq.js → chunk-ryb0h1z5.js} +5 -5
- package/dist/{chunk-7jm7pa1e.js → chunk-ryd3pd8a.js} +14 -17
- package/dist/{chunk-yhjccrrs.js → chunk-rynkredv.js} +97 -97
- package/dist/{chunk-ekkewv4y.js → chunk-s1gf9fzs.js} +1 -1
- package/dist/{chunk-1k0wbt0f.js → chunk-s23ksgx0.js} +87 -87
- package/dist/{chunk-kk42fg5v.js → chunk-s4ncrmd8.js} +23 -23
- package/dist/{chunk-92skmpg9.js → chunk-s6rchtpq.js} +56 -56
- package/dist/{chunk-rzj6hzme.js → chunk-s7xzavdg.js} +8 -8
- package/dist/{chunk-0ejzh5by.js → chunk-s9nd7cyj.js} +58 -58
- package/dist/{chunk-f62xm8dh.js → chunk-sca0gdmn.js} +3 -3
- package/dist/{chunk-y64tceyw.js → chunk-sdw4pkat.js} +3 -3
- package/dist/{chunk-smzahkka.js → chunk-sekayrhn.js} +4 -4
- package/dist/chunk-shj5md9j.js +1486 -0
- package/dist/{chunk-ntwe4mq2.js → chunk-spb70nw0.js} +11 -11
- package/dist/{chunk-b82adekm.js → chunk-sq3cem22.js} +57 -57
- package/dist/{chunk-f16qs2ag.js → chunk-srtcyav5.js} +56 -56
- package/dist/{chunk-2cpxc5we.js → chunk-ssdgf1bt.js} +56 -56
- package/dist/{chunk-vny8tpke.js → chunk-svyfbay6.js} +24 -24
- package/dist/{chunk-0kh2f6kh.js → chunk-sz53f4b4.js} +3 -3
- package/dist/{chunk-h28xqfk8.js → chunk-t4360128.js} +62 -62
- package/dist/{chunk-hhc28ga0.js → chunk-t6keftkw.js} +26 -26
- package/dist/{chunk-z93cpz34.js → chunk-t7b3r8v9.js} +3 -3
- package/dist/{chunk-mq7m54qk.js → chunk-tbrzz94r.js} +69 -69
- package/dist/{chunk-b43rsa2d.js → chunk-tgmxbtrk.js} +2 -2
- package/dist/{chunk-sjraxh5y.js → chunk-thnkgdqf.js} +57 -57
- package/dist/{chunk-95dy6w67.js → chunk-tq7vtsx4.js} +2 -2
- package/dist/{chunk-99p0sa4h.js → chunk-tvrpmrzn.js} +2 -2
- package/dist/{chunk-neh0bkkf.js → chunk-tx1zp6k9.js} +56 -56
- package/dist/{chunk-vmfckw4g.js → chunk-txq07t1t.js} +56 -56
- package/dist/{chunk-34b0y9w3.js → chunk-v1bc0k7r.js} +57 -57
- package/dist/chunk-v1mewt1d.js +180 -0
- package/dist/{chunk-bnznxckg.js → chunk-v890zxjh.js} +56 -56
- package/dist/{chunk-sm24ay0y.js → chunk-v9mb8wyh.js} +117 -117
- package/dist/{chunk-3gaxrmqq.js → chunk-vd2cdqer.js} +15 -15
- package/dist/{chunk-kh9fj2xh.js → chunk-vdw3tpqy.js} +60 -60
- package/dist/{chunk-k6tzzr9c.js → chunk-vs0hwycc.js} +7 -7
- package/dist/{chunk-fq1j9zm0.js → chunk-vsa6z84y.js} +3 -3
- package/dist/{chunk-mbv3f2vm.js → chunk-vywhk0sd.js} +4 -4
- package/dist/{chunk-atpyr1kg.js → chunk-w3jk4zrh.js} +57 -57
- package/dist/{chunk-ezwhbfk8.js → chunk-wbhz1kax.js} +5 -5
- package/dist/{chunk-4vqz7w3v.js → chunk-wckky1kf.js} +4 -4
- package/dist/{chunk-w8yhf638.js → chunk-we086xcr.js} +1 -1
- package/dist/{chunk-jh0d0pbd.js → chunk-wg0d4shw.js} +4 -4
- package/dist/{chunk-z5w7a1cv.js → chunk-whas4b6c.js} +26 -26
- package/dist/{chunk-s8zha7q1.js → chunk-ws1046mv.js} +9 -11
- package/dist/{chunk-mnrswcqf.js → chunk-x33anyzd.js} +56 -56
- package/dist/{chunk-sf4rsw52.js → chunk-x463hr55.js} +8 -8
- package/dist/{chunk-r6ewgv12.js → chunk-x46veg46.js} +1 -1
- package/dist/{chunk-1zrpqh8h.js → chunk-x7aa6ah7.js} +1 -1
- package/dist/{chunk-2katyzq9.js → chunk-x8zp00qp.js} +3 -3
- package/dist/{chunk-371mcwkv.js → chunk-xcbm675k.js} +7 -7
- package/dist/{chunk-pp347e16.js → chunk-xdhd191v.js} +56 -56
- package/dist/{chunk-d6713rzt.js → chunk-xmj20j9w.js} +30 -10
- package/dist/{chunk-g1jfytsa.js → chunk-xt17cf7n.js} +5 -5
- package/dist/{chunk-nzqmmqwj.js → chunk-xvwnb277.js} +23 -23
- package/dist/{chunk-7f0atzzf.js → chunk-xyh08jpm.js} +57 -57
- package/dist/{chunk-kaqp12mx.js → chunk-xz775vz4.js} +56 -56
- package/dist/{chunk-9b2ts7my.js → chunk-y4b897ek.js} +1 -1
- package/dist/{chunk-avtcf910.js → chunk-y5x8wqe5.js} +1 -1
- package/dist/{chunk-sjmx1scx.js → chunk-y7r4awy2.js} +23 -23
- package/dist/{chunk-m0yqzzgm.js → chunk-yc2ay8fz.js} +2 -2
- package/dist/{chunk-swq8qack.js → chunk-ydgsnc70.js} +24 -24
- package/dist/{chunk-p6ejgd85.js → chunk-yq0e1vbr.js} +60 -60
- package/dist/{chunk-nbath9yz.js → chunk-ys6ctp3c.js} +7 -7
- package/dist/{chunk-6v1p41rg.js → chunk-ysvkq1vy.js} +7 -7
- package/dist/{chunk-7d3ba1n4.js → chunk-yvzh49tc.js} +1 -1
- package/dist/{chunk-5wxavbb8.js → chunk-yw9303pb.js} +23 -23
- package/dist/{chunk-pbn6n0kg.js → chunk-z47zsr3f.js} +56 -56
- package/dist/chunk-z51d7scc.js +244 -0
- package/dist/{chunk-b2pxvgwp.js → chunk-zd7ftnd0.js} +10 -10
- package/dist/{chunk-dxcr07z5.js → chunk-ze6zvkg6.js} +4 -4
- package/dist/{chunk-t1whcbtd.js → chunk-zhmhyt38.js} +73 -73
- package/dist/{chunk-sw51thrz.js → chunk-zn27z1n9.js} +59 -59
- package/dist/{chunk-9snpw77c.js → chunk-zvffthkn.js} +67 -67
- package/dist/{chunk-ztqfa7pd.js → chunk-zwm57zy3.js} +56 -56
- package/dist/{chunk-d6vexw90.js → chunk-zyy7th0a.js} +1 -1
- package/dist/{chunk-a7bs51hq.js → chunk-zzykgkph.js} +28 -28
- package/dist/cli-bun.js +0 -0
- package/dist/cli-node.js +0 -0
- package/dist/cli.js +11 -11
- package/dist/download-ripgrep.js +1 -1
- package/package.json +195 -195
- package/scripts/postinstall.cjs +339 -339
- package/scripts/setup-chrome-mcp.mjs +39 -39
- package/dist/chunk-05rcynmf.js +0 -81
- package/dist/chunk-27xc1csx.js +0 -104
- package/dist/chunk-30rst83v.js +0 -168
- package/dist/chunk-33tdaxv0.js +0 -16
- package/dist/chunk-3enkzjbw.js +0 -3966
- package/dist/chunk-3h8a89gy.js +0 -46
- package/dist/chunk-3qm927vk.js +0 -542
- package/dist/chunk-3z7wsvpa.js +0 -24
- package/dist/chunk-44ct1wzm.js +0 -17
- package/dist/chunk-4s0bw3mn.js +0 -208
- package/dist/chunk-7m3ja921.js +0 -27
- package/dist/chunk-7vs34s16.js +0 -173
- package/dist/chunk-80h2am3g.js +0 -5241
- package/dist/chunk-8f6raa6q.js +0 -615
- package/dist/chunk-a9vdeb6y.js +0 -258
- package/dist/chunk-ahc4y7pa.js +0 -782
- package/dist/chunk-b0bk6bxs.js +0 -742
- package/dist/chunk-b4wg70y1.js +0 -54
- package/dist/chunk-btnvjcc5.js +0 -15
- package/dist/chunk-cs6c9gbk.js +0 -1172
- package/dist/chunk-enhtm7h3.js +0 -1731
- package/dist/chunk-fckn68n0.js +0 -180
- package/dist/chunk-h0qngp9w.js +0 -157
- package/dist/chunk-hasadm64.js +0 -412
- package/dist/chunk-hk9xz7gk.js +0 -118
- package/dist/chunk-j2k4p94p.js +0 -55
- package/dist/chunk-jgcsawpq.js +0 -659
- package/dist/chunk-jzmz18nn.js +0 -65
- package/dist/chunk-kg4qmgbk.js +0 -1095
- package/dist/chunk-n0qaeaa5.js +0 -256
- package/dist/chunk-nbxr4cfd.js +0 -880
- package/dist/chunk-q25bjaev.js +0 -15
- package/dist/chunk-qpydzzk0.js +0 -182
- package/dist/chunk-qqy9drhh.js +0 -864
- package/dist/chunk-qtddenhw.js +0 -607
- package/dist/chunk-r6h4zwjj.js +0 -36
- package/dist/chunk-th1cykx3.js +0 -494
- package/dist/chunk-ttk5dzz8.js +0 -25
- package/dist/chunk-v9yc4wjc.js +0 -220
- package/dist/chunk-vsemkegd.js +0 -718
- package/dist/chunk-wadkbt36.js +0 -40
- package/dist/chunk-xsq9ae7x.js +0 -90
- package/dist/chunk-ze6h1ch1.js +0 -21
- package/dist/chunk-ztpbxsq6.js +0 -910
- package/dist/{chunk-2j1t3hcw.js → chunk-a07s68gh.js} +3 -3
package/scripts/postinstall.cjs
CHANGED
|
@@ -1,339 +1,339 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Postinstall script — runs automatically after `bun install` or `npm install`.
|
|
4
|
-
*
|
|
5
|
-
* Downloads ripgrep binary (idempotent, skips if exists).
|
|
6
|
-
* Works in dev mode (src/ exists), published mode (dist/ exists), with bun or node.
|
|
7
|
-
*
|
|
8
|
-
* Usage:
|
|
9
|
-
* node scripts/postinstall.js
|
|
10
|
-
* node scripts/postinstall.js --force
|
|
11
|
-
* bun run scripts/postinstall.js
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
const { existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync, chmodSync } =
|
|
15
|
-
require("fs")
|
|
16
|
-
const { spawnSync } = require("child_process")
|
|
17
|
-
const { setDefaultResultOrder } = require("node:dns")
|
|
18
|
-
const path = require("path")
|
|
19
|
-
const os = require("os")
|
|
20
|
-
|
|
21
|
-
// Prefer IPv4 first — Bun on Windows sometimes fails GitHub over broken IPv6 paths.
|
|
22
|
-
try {
|
|
23
|
-
setDefaultResultOrder("ipv4first")
|
|
24
|
-
} catch {
|
|
25
|
-
/* ignore */
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// --- Config ---
|
|
29
|
-
|
|
30
|
-
const RG_VERSION = "15.0.1"
|
|
31
|
-
const DEFAULT_RELEASE_BASE = `https://github.com/microsoft/ripgrep-prebuilt/releases/download/v${RG_VERSION}`
|
|
32
|
-
const MIRROR_RELEASE_BASE = `https://ghproxy.net/https://github.com/microsoft/ripgrep-prebuilt/releases/download/v${RG_VERSION}`
|
|
33
|
-
const RELEASE_BASE = (process.env.RIPGREP_DOWNLOAD_BASE ?? DEFAULT_RELEASE_BASE).replace(/\/$/, "")
|
|
34
|
-
|
|
35
|
-
const scriptDir = path.dirname(__filename)
|
|
36
|
-
const projectRoot = path.resolve(scriptDir, "..")
|
|
37
|
-
|
|
38
|
-
// --- Platform mapping ---
|
|
39
|
-
|
|
40
|
-
function getPlatformMapping() {
|
|
41
|
-
const arch = process.arch
|
|
42
|
-
const platform = process.platform
|
|
43
|
-
|
|
44
|
-
if (platform === "darwin") {
|
|
45
|
-
if (arch === "arm64") return { target: "aarch64-apple-darwin", ext: "tar.gz" }
|
|
46
|
-
if (arch === "x64") return { target: "x86_64-apple-darwin", ext: "tar.gz" }
|
|
47
|
-
throw new Error(`Unsupported macOS arch: ${arch}`)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (platform === "win32") {
|
|
51
|
-
if (arch === "x64") return { target: "x86_64-pc-windows-msvc", ext: "zip" }
|
|
52
|
-
if (arch === "arm64") return { target: "aarch64-pc-windows-msvc", ext: "zip" }
|
|
53
|
-
throw new Error(`Unsupported Windows arch: ${arch}`)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (platform === "linux") {
|
|
57
|
-
const isMusl = detectMusl()
|
|
58
|
-
if (arch === "x64") {
|
|
59
|
-
return { target: "x86_64-unknown-linux-musl", ext: "tar.gz" }
|
|
60
|
-
}
|
|
61
|
-
if (arch === "arm64") {
|
|
62
|
-
return isMusl
|
|
63
|
-
? { target: "aarch64-unknown-linux-musl", ext: "tar.gz" }
|
|
64
|
-
: { target: "aarch64-unknown-linux-gnu", ext: "tar.gz" }
|
|
65
|
-
}
|
|
66
|
-
throw new Error(`Unsupported Linux arch: ${arch}`)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
throw new Error(`Unsupported platform: ${platform}`)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function detectMusl() {
|
|
73
|
-
const muslArch = process.arch === "x64" ? "x86_64" : "aarch64"
|
|
74
|
-
try {
|
|
75
|
-
statSync(`/lib/libc.musl-${muslArch}.so.1`)
|
|
76
|
-
return true
|
|
77
|
-
} catch {
|
|
78
|
-
return false
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// --- Paths ---
|
|
83
|
-
|
|
84
|
-
function getVendorDir() {
|
|
85
|
-
if (existsSync(path.join(projectRoot, "src"))) {
|
|
86
|
-
return path.resolve(projectRoot, "src", "utils", "vendor", "ripgrep")
|
|
87
|
-
}
|
|
88
|
-
return path.resolve(projectRoot, "dist", "vendor", "ripgrep")
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function getBinaryPath() {
|
|
92
|
-
const dir = getVendorDir()
|
|
93
|
-
const subdir = `${process.arch}-${process.platform}`
|
|
94
|
-
const binary = process.platform === "win32" ? "rg.exe" : "rg"
|
|
95
|
-
return path.resolve(dir, subdir, binary)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// --- Download helpers ---
|
|
99
|
-
|
|
100
|
-
function proxyEnvSet() {
|
|
101
|
-
const v = (s) => (s ?? "").trim()
|
|
102
|
-
return !!(v(process.env.HTTPS_PROXY) || v(process.env.HTTP_PROXY) || v(process.env.ALL_PROXY) || v(process.env.https_proxy) || v(process.env.http_proxy))
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function tryPowerShellDownload(url, dest) {
|
|
106
|
-
const u = url.replace(/'/g, "''")
|
|
107
|
-
const d = dest.replace(/'/g, "''")
|
|
108
|
-
const cmd = `Invoke-WebRequest -Uri '${u}' -OutFile '${d}' -UseBasicParsing`
|
|
109
|
-
const result = spawnSync(
|
|
110
|
-
"powershell.exe",
|
|
111
|
-
["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command", cmd],
|
|
112
|
-
{ stdio: "pipe", windowsHide: true },
|
|
113
|
-
)
|
|
114
|
-
return result.status === 0 && existsSync(dest) && statSync(dest).size > 0
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function tryCurlDownload(url, dest) {
|
|
118
|
-
const curl = process.platform === "win32" ? "curl.exe" : "curl"
|
|
119
|
-
const result = spawnSync(curl, ["-fsSL", "-L", "--fail", "-o", dest, url], {
|
|
120
|
-
stdio: "pipe",
|
|
121
|
-
windowsHide: true,
|
|
122
|
-
})
|
|
123
|
-
return result.status === 0 && existsSync(dest) && statSync(dest).size > 0
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
async function fetchRelease(url) {
|
|
127
|
-
if (proxyEnvSet()) {
|
|
128
|
-
// Dynamic require so it works in node without bundling issues
|
|
129
|
-
const undici = require("undici")
|
|
130
|
-
return await undici.fetch(url, {
|
|
131
|
-
redirect: "follow",
|
|
132
|
-
dispatcher: new undici.EnvHttpProxyAgent(),
|
|
133
|
-
})
|
|
134
|
-
}
|
|
135
|
-
// Node 18+ has global fetch, Bun has it too
|
|
136
|
-
return await fetch(url, { redirect: "follow" })
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
async function downloadUrlToBuffer(url) {
|
|
140
|
-
const response = await fetchRelease(url)
|
|
141
|
-
if (!response.ok) {
|
|
142
|
-
throw new Error(`Download failed: ${response.status} ${response.statusText}`)
|
|
143
|
-
}
|
|
144
|
-
return Buffer.from(await response.arrayBuffer())
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
async function downloadUrlToBufferWithFallback(url) {
|
|
148
|
-
let firstError
|
|
149
|
-
try {
|
|
150
|
-
return await downloadUrlToBuffer(url)
|
|
151
|
-
} catch (e) {
|
|
152
|
-
firstError = e
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const tmpRoot = path.join(os.tmpdir(), `ripgrep-dl-${process.pid}-${Date.now()}`)
|
|
156
|
-
const tmpFile = path.join(tmpRoot, "archive")
|
|
157
|
-
mkdirSync(tmpRoot, { recursive: true })
|
|
158
|
-
try {
|
|
159
|
-
if (process.platform === "win32" && tryPowerShellDownload(url, tmpFile)) {
|
|
160
|
-
return readFileSync(tmpFile)
|
|
161
|
-
}
|
|
162
|
-
if (tryCurlDownload(url, tmpFile)) {
|
|
163
|
-
return readFileSync(tmpFile)
|
|
164
|
-
}
|
|
165
|
-
} finally {
|
|
166
|
-
rmSync(tmpRoot, { recursive: true, force: true })
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
throw firstError
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// --- Extract ---
|
|
173
|
-
|
|
174
|
-
function findZipEntryKey(files, want) {
|
|
175
|
-
return Object.keys(files).find((k) => {
|
|
176
|
-
const norm = k.replace(/\\/g, "/")
|
|
177
|
-
return norm === want || norm.endsWith(`/${want}`)
|
|
178
|
-
})
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
async function extractZip(buffer, binaryPath, extractedBinary) {
|
|
182
|
-
const binaryDir = path.dirname(binaryPath)
|
|
183
|
-
// Try fflate first (bundled dep)
|
|
184
|
-
let fflateError
|
|
185
|
-
try {
|
|
186
|
-
const { unzipSync } = require("fflate")
|
|
187
|
-
const unzipped = unzipSync(new Uint8Array(buffer))
|
|
188
|
-
const key = findZipEntryKey(unzipped, extractedBinary)
|
|
189
|
-
if (!key) {
|
|
190
|
-
throw new Error(`Binary ${extractedBinary} not found in zip`)
|
|
191
|
-
}
|
|
192
|
-
writeFileSync(binaryPath, Buffer.from(unzipped[key]))
|
|
193
|
-
return
|
|
194
|
-
} catch (e) {
|
|
195
|
-
fflateError = e
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// Fallback: PowerShell Expand-Archive or unzip CLI
|
|
199
|
-
const tmpDir = path.join(binaryDir, ".tmp-download")
|
|
200
|
-
rmSync(tmpDir, { recursive: true, force: true })
|
|
201
|
-
mkdirSync(tmpDir, { recursive: true })
|
|
202
|
-
try {
|
|
203
|
-
const assetName = `archive.zip`
|
|
204
|
-
const archivePath = path.join(tmpDir, assetName)
|
|
205
|
-
writeFileSync(archivePath, buffer)
|
|
206
|
-
|
|
207
|
-
let extracted = false
|
|
208
|
-
if (process.platform === "win32") {
|
|
209
|
-
const psCmd = `Expand-Archive -Path '${archivePath.replace(/'/g, "''")}' -DestinationPath '${tmpDir.replace(/'/g, "''")}' -Force`
|
|
210
|
-
const psResult = spawnSync(
|
|
211
|
-
"powershell.exe",
|
|
212
|
-
["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command", psCmd],
|
|
213
|
-
{ stdio: "pipe", windowsHide: true },
|
|
214
|
-
)
|
|
215
|
-
if (psResult.status === 0) {
|
|
216
|
-
extracted = true
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
if (!extracted) {
|
|
221
|
-
const result = spawnSync("unzip", ["-o", archivePath, "-d", tmpDir], { stdio: "pipe" })
|
|
222
|
-
if (result.status !== 0) {
|
|
223
|
-
const unzipErr = result.stderr?.toString().trim() || "command not found"
|
|
224
|
-
const fflateMsg = fflateError instanceof Error ? fflateError.message : String(fflateError)
|
|
225
|
-
throw new Error(`zip extraction failed (fflate: ${fflateMsg}; unzip: ${unzipErr})`)
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
const srcBinary = path.join(tmpDir, extractedBinary)
|
|
230
|
-
if (!existsSync(srcBinary)) {
|
|
231
|
-
throw new Error(`Binary not found at expected path: ${srcBinary}`)
|
|
232
|
-
}
|
|
233
|
-
renameSync(srcBinary, binaryPath)
|
|
234
|
-
} finally {
|
|
235
|
-
rmSync(tmpDir, { recursive: true, force: true })
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
async function extractTarGz(buffer, binaryPath, extractedBinary, assetName) {
|
|
240
|
-
const binaryDir = path.dirname(binaryPath)
|
|
241
|
-
const tmpDir = path.join(binaryDir, ".tmp-download")
|
|
242
|
-
rmSync(tmpDir, { recursive: true, force: true })
|
|
243
|
-
mkdirSync(tmpDir, { recursive: true })
|
|
244
|
-
try {
|
|
245
|
-
const archivePath = path.join(tmpDir, assetName)
|
|
246
|
-
writeFileSync(archivePath, buffer)
|
|
247
|
-
const result = spawnSync("tar", ["xzf", archivePath, "-C", tmpDir], { stdio: "pipe" })
|
|
248
|
-
if (result.status !== 0) {
|
|
249
|
-
throw new Error(`tar extract failed: ${result.stderr?.toString()}`)
|
|
250
|
-
}
|
|
251
|
-
const srcBinary = path.join(tmpDir, extractedBinary)
|
|
252
|
-
if (!existsSync(srcBinary)) {
|
|
253
|
-
throw new Error(`Binary not found at expected path: ${srcBinary}`)
|
|
254
|
-
}
|
|
255
|
-
renameSync(srcBinary, binaryPath)
|
|
256
|
-
} finally {
|
|
257
|
-
rmSync(tmpDir, { recursive: true, force: true })
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
// --- Main ---
|
|
262
|
-
|
|
263
|
-
async function downloadAndExtract() {
|
|
264
|
-
const { target, ext } = getPlatformMapping()
|
|
265
|
-
const assetName = `ripgrep-v${RG_VERSION}-${target}.${ext}`
|
|
266
|
-
|
|
267
|
-
const binaryPath = getBinaryPath()
|
|
268
|
-
const binaryDir = path.dirname(binaryPath)
|
|
269
|
-
|
|
270
|
-
const force = process.argv.includes("--force")
|
|
271
|
-
if (!force && existsSync(binaryPath)) {
|
|
272
|
-
const stat = statSync(binaryPath)
|
|
273
|
-
if (stat.size > 0) {
|
|
274
|
-
console.log(`[ripgrep] Binary already exists at ${binaryPath}, skipping.`)
|
|
275
|
-
return
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
console.log(`[ripgrep] Downloading v${RG_VERSION} for ${target}...`)
|
|
280
|
-
|
|
281
|
-
const extractedBinary = process.platform === "win32" ? "rg.exe" : "rg"
|
|
282
|
-
|
|
283
|
-
const mirrors = [RELEASE_BASE]
|
|
284
|
-
if (RELEASE_BASE === DEFAULT_RELEASE_BASE.replace(/\/$/, "")) {
|
|
285
|
-
mirrors.push(MIRROR_RELEASE_BASE.replace(/\/$/, ""))
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
let buffer
|
|
289
|
-
let lastError
|
|
290
|
-
for (const base of mirrors) {
|
|
291
|
-
const url = `${base}/${assetName}`
|
|
292
|
-
try {
|
|
293
|
-
console.log(`[ripgrep] Trying ${url}`)
|
|
294
|
-
buffer = await downloadUrlToBufferWithFallback(url)
|
|
295
|
-
break
|
|
296
|
-
} catch (e) {
|
|
297
|
-
console.warn(`[ripgrep] Download from ${base} failed: ${e instanceof Error ? e.message : e}`)
|
|
298
|
-
lastError = e
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
if (!buffer) {
|
|
302
|
-
throw lastError
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
try {
|
|
306
|
-
console.log(`[ripgrep] Downloaded ${Math.round(buffer.length / 1024)} KB`)
|
|
307
|
-
|
|
308
|
-
mkdirSync(binaryDir, { recursive: true })
|
|
309
|
-
|
|
310
|
-
if (ext === "tar.gz") {
|
|
311
|
-
await extractTarGz(buffer, binaryPath, extractedBinary, assetName)
|
|
312
|
-
} else {
|
|
313
|
-
await extractZip(buffer, binaryPath, extractedBinary)
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
if (process.platform !== "win32") {
|
|
317
|
-
chmodSync(binaryPath, 0o755)
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
console.log(`[ripgrep] Installed to ${binaryPath}`)
|
|
321
|
-
} catch (e) {
|
|
322
|
-
const msg = e instanceof Error ? e.message : String(e)
|
|
323
|
-
const hint =
|
|
324
|
-
"Check network or set HTTPS_PROXY. If GitHub is blocked, set RIPGREP_DOWNLOAD_BASE to a mirror (see script header)."
|
|
325
|
-
throw new Error(`${msg} ${hint}`)
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
async function main() {
|
|
330
|
-
await downloadAndExtract()
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
main().catch((error) => {
|
|
334
|
-
const msg = error instanceof Error ? error.message : String(error)
|
|
335
|
-
console.error(`[postinstall] ripgrep download failed (non-fatal): ${msg}`)
|
|
336
|
-
console.error(`[postinstall] You can install ripgrep manually: https://github.com/BurntSushi/ripgrep#installation`)
|
|
337
|
-
// Never exit with error code — postinstall must not break install
|
|
338
|
-
process.exit(0)
|
|
339
|
-
})
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Postinstall script — runs automatically after `bun install` or `npm install`.
|
|
4
|
+
*
|
|
5
|
+
* Downloads ripgrep binary (idempotent, skips if exists).
|
|
6
|
+
* Works in dev mode (src/ exists), published mode (dist/ exists), with bun or node.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* node scripts/postinstall.js
|
|
10
|
+
* node scripts/postinstall.js --force
|
|
11
|
+
* bun run scripts/postinstall.js
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const { existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync, chmodSync } =
|
|
15
|
+
require("fs")
|
|
16
|
+
const { spawnSync } = require("child_process")
|
|
17
|
+
const { setDefaultResultOrder } = require("node:dns")
|
|
18
|
+
const path = require("path")
|
|
19
|
+
const os = require("os")
|
|
20
|
+
|
|
21
|
+
// Prefer IPv4 first — Bun on Windows sometimes fails GitHub over broken IPv6 paths.
|
|
22
|
+
try {
|
|
23
|
+
setDefaultResultOrder("ipv4first")
|
|
24
|
+
} catch {
|
|
25
|
+
/* ignore */
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// --- Config ---
|
|
29
|
+
|
|
30
|
+
const RG_VERSION = "15.0.1"
|
|
31
|
+
const DEFAULT_RELEASE_BASE = `https://github.com/microsoft/ripgrep-prebuilt/releases/download/v${RG_VERSION}`
|
|
32
|
+
const MIRROR_RELEASE_BASE = `https://ghproxy.net/https://github.com/microsoft/ripgrep-prebuilt/releases/download/v${RG_VERSION}`
|
|
33
|
+
const RELEASE_BASE = (process.env.RIPGREP_DOWNLOAD_BASE ?? DEFAULT_RELEASE_BASE).replace(/\/$/, "")
|
|
34
|
+
|
|
35
|
+
const scriptDir = path.dirname(__filename)
|
|
36
|
+
const projectRoot = path.resolve(scriptDir, "..")
|
|
37
|
+
|
|
38
|
+
// --- Platform mapping ---
|
|
39
|
+
|
|
40
|
+
function getPlatformMapping() {
|
|
41
|
+
const arch = process.arch
|
|
42
|
+
const platform = process.platform
|
|
43
|
+
|
|
44
|
+
if (platform === "darwin") {
|
|
45
|
+
if (arch === "arm64") return { target: "aarch64-apple-darwin", ext: "tar.gz" }
|
|
46
|
+
if (arch === "x64") return { target: "x86_64-apple-darwin", ext: "tar.gz" }
|
|
47
|
+
throw new Error(`Unsupported macOS arch: ${arch}`)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (platform === "win32") {
|
|
51
|
+
if (arch === "x64") return { target: "x86_64-pc-windows-msvc", ext: "zip" }
|
|
52
|
+
if (arch === "arm64") return { target: "aarch64-pc-windows-msvc", ext: "zip" }
|
|
53
|
+
throw new Error(`Unsupported Windows arch: ${arch}`)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (platform === "linux") {
|
|
57
|
+
const isMusl = detectMusl()
|
|
58
|
+
if (arch === "x64") {
|
|
59
|
+
return { target: "x86_64-unknown-linux-musl", ext: "tar.gz" }
|
|
60
|
+
}
|
|
61
|
+
if (arch === "arm64") {
|
|
62
|
+
return isMusl
|
|
63
|
+
? { target: "aarch64-unknown-linux-musl", ext: "tar.gz" }
|
|
64
|
+
: { target: "aarch64-unknown-linux-gnu", ext: "tar.gz" }
|
|
65
|
+
}
|
|
66
|
+
throw new Error(`Unsupported Linux arch: ${arch}`)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
throw new Error(`Unsupported platform: ${platform}`)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function detectMusl() {
|
|
73
|
+
const muslArch = process.arch === "x64" ? "x86_64" : "aarch64"
|
|
74
|
+
try {
|
|
75
|
+
statSync(`/lib/libc.musl-${muslArch}.so.1`)
|
|
76
|
+
return true
|
|
77
|
+
} catch {
|
|
78
|
+
return false
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// --- Paths ---
|
|
83
|
+
|
|
84
|
+
function getVendorDir() {
|
|
85
|
+
if (existsSync(path.join(projectRoot, "src"))) {
|
|
86
|
+
return path.resolve(projectRoot, "src", "utils", "vendor", "ripgrep")
|
|
87
|
+
}
|
|
88
|
+
return path.resolve(projectRoot, "dist", "vendor", "ripgrep")
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function getBinaryPath() {
|
|
92
|
+
const dir = getVendorDir()
|
|
93
|
+
const subdir = `${process.arch}-${process.platform}`
|
|
94
|
+
const binary = process.platform === "win32" ? "rg.exe" : "rg"
|
|
95
|
+
return path.resolve(dir, subdir, binary)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// --- Download helpers ---
|
|
99
|
+
|
|
100
|
+
function proxyEnvSet() {
|
|
101
|
+
const v = (s) => (s ?? "").trim()
|
|
102
|
+
return !!(v(process.env.HTTPS_PROXY) || v(process.env.HTTP_PROXY) || v(process.env.ALL_PROXY) || v(process.env.https_proxy) || v(process.env.http_proxy))
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function tryPowerShellDownload(url, dest) {
|
|
106
|
+
const u = url.replace(/'/g, "''")
|
|
107
|
+
const d = dest.replace(/'/g, "''")
|
|
108
|
+
const cmd = `Invoke-WebRequest -Uri '${u}' -OutFile '${d}' -UseBasicParsing`
|
|
109
|
+
const result = spawnSync(
|
|
110
|
+
"powershell.exe",
|
|
111
|
+
["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command", cmd],
|
|
112
|
+
{ stdio: "pipe", windowsHide: true },
|
|
113
|
+
)
|
|
114
|
+
return result.status === 0 && existsSync(dest) && statSync(dest).size > 0
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function tryCurlDownload(url, dest) {
|
|
118
|
+
const curl = process.platform === "win32" ? "curl.exe" : "curl"
|
|
119
|
+
const result = spawnSync(curl, ["-fsSL", "-L", "--fail", "-o", dest, url], {
|
|
120
|
+
stdio: "pipe",
|
|
121
|
+
windowsHide: true,
|
|
122
|
+
})
|
|
123
|
+
return result.status === 0 && existsSync(dest) && statSync(dest).size > 0
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async function fetchRelease(url) {
|
|
127
|
+
if (proxyEnvSet()) {
|
|
128
|
+
// Dynamic require so it works in node without bundling issues
|
|
129
|
+
const undici = require("undici")
|
|
130
|
+
return await undici.fetch(url, {
|
|
131
|
+
redirect: "follow",
|
|
132
|
+
dispatcher: new undici.EnvHttpProxyAgent(),
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
// Node 18+ has global fetch, Bun has it too
|
|
136
|
+
return await fetch(url, { redirect: "follow" })
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
async function downloadUrlToBuffer(url) {
|
|
140
|
+
const response = await fetchRelease(url)
|
|
141
|
+
if (!response.ok) {
|
|
142
|
+
throw new Error(`Download failed: ${response.status} ${response.statusText}`)
|
|
143
|
+
}
|
|
144
|
+
return Buffer.from(await response.arrayBuffer())
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async function downloadUrlToBufferWithFallback(url) {
|
|
148
|
+
let firstError
|
|
149
|
+
try {
|
|
150
|
+
return await downloadUrlToBuffer(url)
|
|
151
|
+
} catch (e) {
|
|
152
|
+
firstError = e
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const tmpRoot = path.join(os.tmpdir(), `ripgrep-dl-${process.pid}-${Date.now()}`)
|
|
156
|
+
const tmpFile = path.join(tmpRoot, "archive")
|
|
157
|
+
mkdirSync(tmpRoot, { recursive: true })
|
|
158
|
+
try {
|
|
159
|
+
if (process.platform === "win32" && tryPowerShellDownload(url, tmpFile)) {
|
|
160
|
+
return readFileSync(tmpFile)
|
|
161
|
+
}
|
|
162
|
+
if (tryCurlDownload(url, tmpFile)) {
|
|
163
|
+
return readFileSync(tmpFile)
|
|
164
|
+
}
|
|
165
|
+
} finally {
|
|
166
|
+
rmSync(tmpRoot, { recursive: true, force: true })
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
throw firstError
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// --- Extract ---
|
|
173
|
+
|
|
174
|
+
function findZipEntryKey(files, want) {
|
|
175
|
+
return Object.keys(files).find((k) => {
|
|
176
|
+
const norm = k.replace(/\\/g, "/")
|
|
177
|
+
return norm === want || norm.endsWith(`/${want}`)
|
|
178
|
+
})
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
async function extractZip(buffer, binaryPath, extractedBinary) {
|
|
182
|
+
const binaryDir = path.dirname(binaryPath)
|
|
183
|
+
// Try fflate first (bundled dep)
|
|
184
|
+
let fflateError
|
|
185
|
+
try {
|
|
186
|
+
const { unzipSync } = require("fflate")
|
|
187
|
+
const unzipped = unzipSync(new Uint8Array(buffer))
|
|
188
|
+
const key = findZipEntryKey(unzipped, extractedBinary)
|
|
189
|
+
if (!key) {
|
|
190
|
+
throw new Error(`Binary ${extractedBinary} not found in zip`)
|
|
191
|
+
}
|
|
192
|
+
writeFileSync(binaryPath, Buffer.from(unzipped[key]))
|
|
193
|
+
return
|
|
194
|
+
} catch (e) {
|
|
195
|
+
fflateError = e
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Fallback: PowerShell Expand-Archive or unzip CLI
|
|
199
|
+
const tmpDir = path.join(binaryDir, ".tmp-download")
|
|
200
|
+
rmSync(tmpDir, { recursive: true, force: true })
|
|
201
|
+
mkdirSync(tmpDir, { recursive: true })
|
|
202
|
+
try {
|
|
203
|
+
const assetName = `archive.zip`
|
|
204
|
+
const archivePath = path.join(tmpDir, assetName)
|
|
205
|
+
writeFileSync(archivePath, buffer)
|
|
206
|
+
|
|
207
|
+
let extracted = false
|
|
208
|
+
if (process.platform === "win32") {
|
|
209
|
+
const psCmd = `Expand-Archive -Path '${archivePath.replace(/'/g, "''")}' -DestinationPath '${tmpDir.replace(/'/g, "''")}' -Force`
|
|
210
|
+
const psResult = spawnSync(
|
|
211
|
+
"powershell.exe",
|
|
212
|
+
["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command", psCmd],
|
|
213
|
+
{ stdio: "pipe", windowsHide: true },
|
|
214
|
+
)
|
|
215
|
+
if (psResult.status === 0) {
|
|
216
|
+
extracted = true
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (!extracted) {
|
|
221
|
+
const result = spawnSync("unzip", ["-o", archivePath, "-d", tmpDir], { stdio: "pipe" })
|
|
222
|
+
if (result.status !== 0) {
|
|
223
|
+
const unzipErr = result.stderr?.toString().trim() || "command not found"
|
|
224
|
+
const fflateMsg = fflateError instanceof Error ? fflateError.message : String(fflateError)
|
|
225
|
+
throw new Error(`zip extraction failed (fflate: ${fflateMsg}; unzip: ${unzipErr})`)
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const srcBinary = path.join(tmpDir, extractedBinary)
|
|
230
|
+
if (!existsSync(srcBinary)) {
|
|
231
|
+
throw new Error(`Binary not found at expected path: ${srcBinary}`)
|
|
232
|
+
}
|
|
233
|
+
renameSync(srcBinary, binaryPath)
|
|
234
|
+
} finally {
|
|
235
|
+
rmSync(tmpDir, { recursive: true, force: true })
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
async function extractTarGz(buffer, binaryPath, extractedBinary, assetName) {
|
|
240
|
+
const binaryDir = path.dirname(binaryPath)
|
|
241
|
+
const tmpDir = path.join(binaryDir, ".tmp-download")
|
|
242
|
+
rmSync(tmpDir, { recursive: true, force: true })
|
|
243
|
+
mkdirSync(tmpDir, { recursive: true })
|
|
244
|
+
try {
|
|
245
|
+
const archivePath = path.join(tmpDir, assetName)
|
|
246
|
+
writeFileSync(archivePath, buffer)
|
|
247
|
+
const result = spawnSync("tar", ["xzf", archivePath, "-C", tmpDir], { stdio: "pipe" })
|
|
248
|
+
if (result.status !== 0) {
|
|
249
|
+
throw new Error(`tar extract failed: ${result.stderr?.toString()}`)
|
|
250
|
+
}
|
|
251
|
+
const srcBinary = path.join(tmpDir, extractedBinary)
|
|
252
|
+
if (!existsSync(srcBinary)) {
|
|
253
|
+
throw new Error(`Binary not found at expected path: ${srcBinary}`)
|
|
254
|
+
}
|
|
255
|
+
renameSync(srcBinary, binaryPath)
|
|
256
|
+
} finally {
|
|
257
|
+
rmSync(tmpDir, { recursive: true, force: true })
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// --- Main ---
|
|
262
|
+
|
|
263
|
+
async function downloadAndExtract() {
|
|
264
|
+
const { target, ext } = getPlatformMapping()
|
|
265
|
+
const assetName = `ripgrep-v${RG_VERSION}-${target}.${ext}`
|
|
266
|
+
|
|
267
|
+
const binaryPath = getBinaryPath()
|
|
268
|
+
const binaryDir = path.dirname(binaryPath)
|
|
269
|
+
|
|
270
|
+
const force = process.argv.includes("--force")
|
|
271
|
+
if (!force && existsSync(binaryPath)) {
|
|
272
|
+
const stat = statSync(binaryPath)
|
|
273
|
+
if (stat.size > 0) {
|
|
274
|
+
console.log(`[ripgrep] Binary already exists at ${binaryPath}, skipping.`)
|
|
275
|
+
return
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
console.log(`[ripgrep] Downloading v${RG_VERSION} for ${target}...`)
|
|
280
|
+
|
|
281
|
+
const extractedBinary = process.platform === "win32" ? "rg.exe" : "rg"
|
|
282
|
+
|
|
283
|
+
const mirrors = [RELEASE_BASE]
|
|
284
|
+
if (RELEASE_BASE === DEFAULT_RELEASE_BASE.replace(/\/$/, "")) {
|
|
285
|
+
mirrors.push(MIRROR_RELEASE_BASE.replace(/\/$/, ""))
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
let buffer
|
|
289
|
+
let lastError
|
|
290
|
+
for (const base of mirrors) {
|
|
291
|
+
const url = `${base}/${assetName}`
|
|
292
|
+
try {
|
|
293
|
+
console.log(`[ripgrep] Trying ${url}`)
|
|
294
|
+
buffer = await downloadUrlToBufferWithFallback(url)
|
|
295
|
+
break
|
|
296
|
+
} catch (e) {
|
|
297
|
+
console.warn(`[ripgrep] Download from ${base} failed: ${e instanceof Error ? e.message : e}`)
|
|
298
|
+
lastError = e
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
if (!buffer) {
|
|
302
|
+
throw lastError
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
try {
|
|
306
|
+
console.log(`[ripgrep] Downloaded ${Math.round(buffer.length / 1024)} KB`)
|
|
307
|
+
|
|
308
|
+
mkdirSync(binaryDir, { recursive: true })
|
|
309
|
+
|
|
310
|
+
if (ext === "tar.gz") {
|
|
311
|
+
await extractTarGz(buffer, binaryPath, extractedBinary, assetName)
|
|
312
|
+
} else {
|
|
313
|
+
await extractZip(buffer, binaryPath, extractedBinary)
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if (process.platform !== "win32") {
|
|
317
|
+
chmodSync(binaryPath, 0o755)
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
console.log(`[ripgrep] Installed to ${binaryPath}`)
|
|
321
|
+
} catch (e) {
|
|
322
|
+
const msg = e instanceof Error ? e.message : String(e)
|
|
323
|
+
const hint =
|
|
324
|
+
"Check network or set HTTPS_PROXY. If GitHub is blocked, set RIPGREP_DOWNLOAD_BASE to a mirror (see script header)."
|
|
325
|
+
throw new Error(`${msg} ${hint}`)
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
async function main() {
|
|
330
|
+
await downloadAndExtract()
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
main().catch((error) => {
|
|
334
|
+
const msg = error instanceof Error ? error.message : String(error)
|
|
335
|
+
console.error(`[postinstall] ripgrep download failed (non-fatal): ${msg}`)
|
|
336
|
+
console.error(`[postinstall] You can install ripgrep manually: https://github.com/BurntSushi/ripgrep#installation`)
|
|
337
|
+
// Never exit with error code — postinstall must not break install
|
|
338
|
+
process.exit(0)
|
|
339
|
+
})
|