@stacksjs/stx 0.2.413 → 0.2.415
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/appearance-bootstrap.js +1 -1
- package/dist/binding-manifest.d.ts +1 -1
- package/dist/builtins/image-delivery.js +19 -11
- package/dist/bundle-analyzer.js +20 -20
- package/dist/chunk-020xyn9q.js +3 -0
- package/dist/chunk-04jhmfbz.js +2 -0
- package/dist/chunk-0pnj3zt2.js +2 -0
- package/dist/{chunk-bwjxk1dw.js → chunk-0zaess6f.js} +29 -29
- package/dist/chunk-1098mas0.js +2 -0
- package/dist/chunk-169n1vpx.js +12 -0
- package/dist/chunk-18vmfkcc.js +2 -0
- package/dist/chunk-1b6t12hd.js +2 -0
- package/dist/chunk-1xdzcy9d.js +14 -0
- package/dist/chunk-1zs30k3y.js +2 -0
- package/dist/chunk-2ce7f416.js +2 -0
- package/dist/chunk-340a824p.js +2 -0
- package/dist/chunk-393341w7.js +2 -0
- package/dist/chunk-39g1134q.js +2 -0
- package/dist/chunk-3efw27as.js +2785 -0
- package/dist/chunk-3kthfs03.js +3 -0
- package/dist/chunk-3qn1wcdg.js +2 -0
- package/dist/chunk-3s2vnqcf.js +2 -0
- package/dist/chunk-42wbs8vq.js +17 -0
- package/dist/chunk-4bjravgk.js +2 -0
- package/dist/chunk-5gsxpaqk.js +2 -0
- package/dist/{chunk-bwsxym3d.js → chunk-5qns2sdz.js} +17 -17
- package/dist/chunk-6cfa3g0r.js +2 -0
- package/dist/{chunk-bjar18jd.js → chunk-6h38kkjf.js} +46 -52
- package/dist/chunk-6hc5vz20.js +3 -0
- package/dist/chunk-6q6g76vg.js +499 -0
- package/dist/chunk-74j18qk0.js +930 -0
- package/dist/chunk-752hw7cd.js +4 -0
- package/dist/{chunk-kgd8kchy.js → chunk-765e1s44.js} +11 -76
- package/dist/chunk-7gkv67ky.js +4 -0
- package/dist/chunk-7z2ra0yf.js +2 -0
- package/dist/chunk-8eqrwj1k.js +20 -0
- package/dist/chunk-8nhshfz6.js +5 -0
- package/dist/chunk-92ps1xpk.js +2 -0
- package/dist/chunk-96k8s808.js +3 -0
- package/dist/chunk-9amp82bx.js +7 -0
- package/dist/chunk-9g27ybyr.js +3 -0
- package/dist/chunk-9p9qkbtg.js +3 -0
- package/dist/{chunk-xq1acw1r.js → chunk-9pt8fd2n.js} +13 -13
- package/dist/{chunk-24zher49.js → chunk-9vrja6vp.js} +4 -4
- package/dist/chunk-9xrbve19.js +2 -0
- package/dist/chunk-a688m6js.js +3 -0
- package/dist/chunk-ak1cgcah.js +5 -0
- package/dist/{chunk-4m7ajama.js → chunk-amd6ey3t.js} +14 -14
- package/dist/chunk-amtr3rmf.js +11 -0
- package/dist/chunk-atws6p5s.js +2 -0
- package/dist/chunk-b84h16er.js +61 -0
- package/dist/chunk-b98be3yp.js +32 -0
- package/dist/{chunk-hx998w7n.js → chunk-bay9s6rs.js} +13 -13
- package/dist/chunk-ce1sejr3.js +3 -0
- package/dist/chunk-cg8hg6cs.js +3 -0
- package/dist/{chunk-4f9zyfdw.js → chunk-czxt605c.js} +4 -5
- package/dist/chunk-dd8cja4h.js +2 -0
- package/dist/chunk-dgdm3hy3.js +2 -0
- package/dist/chunk-e9hs7kk6.js +12 -0
- package/dist/chunk-eed4fwps.js +3 -0
- package/dist/chunk-ej9j6k1q.js +3 -0
- package/dist/chunk-et0rr8c7.js +3 -0
- package/dist/chunk-f1sxycmv.js +2 -0
- package/dist/chunk-f46qsp4m.js +4 -0
- package/dist/chunk-fbcv4fes.js +2 -0
- package/dist/{chunk-bjcsc6wx.js → chunk-fh1qrp68.js} +21 -21
- package/dist/chunk-fjs0a8h7.js +2 -0
- package/dist/chunk-fpfzm238.js +2 -0
- package/dist/chunk-fr2txj8q.js +829 -0
- package/dist/{chunk-xssw417m.js → chunk-ft4p6d28.js} +14 -14
- package/dist/chunk-fyzajkrx.js +2 -0
- package/dist/chunk-fzapbw9p.js +3 -0
- package/dist/chunk-g03s93qr.js +3 -0
- package/dist/chunk-g186znp9.js +33 -0
- package/dist/chunk-gawrg4gb.js +216 -0
- package/dist/chunk-gc1drn2p.js +2 -0
- package/dist/chunk-gea5hf0v.js +2 -0
- package/dist/chunk-gqv3ta5d.js +2 -0
- package/dist/chunk-h6kp2m9r.js +2 -0
- package/dist/chunk-h6zsqb9r.js +3 -0
- package/dist/{chunk-2snqdnk9.js → chunk-h85hrwkq.js} +13 -13
- package/dist/chunk-hbxz85wy.js +2 -0
- package/dist/chunk-hepd9qgx.js +6 -0
- package/dist/chunk-hhnw2sn3.js +2 -0
- package/dist/chunk-hjg3ndgh.js +2 -0
- package/dist/chunk-hk1mj4tz.js +2 -0
- package/dist/{chunk-smcj3442.js → chunk-hkrmcbwy.js} +79 -79
- package/dist/chunk-hn9pkyv8.js +2 -0
- package/dist/chunk-hpgr4qgp.js +2 -0
- package/dist/chunk-hrbbbtbn.js +2 -0
- package/dist/chunk-j03revz2.js +8 -0
- package/dist/chunk-j9qcrwbg.js +2 -0
- package/dist/chunk-jk4njz0w.js +2 -0
- package/dist/chunk-jmabeqfq.js +2 -0
- package/dist/chunk-jnkrn913.js +4 -0
- package/dist/chunk-jp10q90g.js +2 -0
- package/dist/chunk-jt0n43mk.js +2 -0
- package/dist/chunk-kjbv8a3m.js +2 -0
- package/dist/chunk-m1vdghnx.js +2 -0
- package/dist/chunk-m4sk62wb.js +5 -0
- package/dist/chunk-md8rqn48.js +30 -0
- package/dist/chunk-mp6hy8g4.js +2 -0
- package/dist/chunk-nc8my58s.js +2 -0
- package/dist/chunk-ngc2wke4.js +3 -0
- package/dist/chunk-nn2vstke.js +2 -0
- package/dist/chunk-nppdrf0x.js +2 -0
- package/dist/chunk-p2v2a68k.js +2 -0
- package/dist/chunk-pazfr1a1.js +2 -0
- package/dist/{chunk-qn5srnj3.js → chunk-pbh4smw3.js} +16 -16
- package/dist/chunk-pdb5fw3r.js +2 -0
- package/dist/chunk-pdt69hpb.js +2 -0
- package/dist/chunk-pgzvyrv6.js +29 -0
- package/dist/chunk-px7fvbj6.js +3 -0
- package/dist/chunk-q6vrb2pe.js +2 -0
- package/dist/chunk-q7qchkvk.js +2 -0
- package/dist/chunk-q9bdh4s5.js +8 -0
- package/dist/chunk-qghxz7jm.js +194 -0
- package/dist/chunk-r3f9jcf7.js +5 -0
- package/dist/chunk-re8b5r9x.js +3 -0
- package/dist/chunk-s5xezjps.js +3 -0
- package/dist/chunk-sd321bn3.js +2 -0
- package/dist/chunk-shr559s7.js +3 -0
- package/dist/chunk-t4hzprsm.js +3 -0
- package/dist/chunk-t5pvq5mx.js +2 -0
- package/dist/{chunk-pv3d7sfn.js → chunk-t61vdbje.js} +89 -89
- package/dist/chunk-tafqyf2g.js +2033 -0
- package/dist/chunk-tfexmdkt.js +3 -0
- package/dist/chunk-thyt8ed8.js +6 -0
- package/dist/chunk-v91p6ekp.js +24 -0
- package/dist/chunk-vgvtnwxa.js +4 -0
- package/dist/chunk-w72qx0eb.js +2 -0
- package/dist/chunk-wfy1zq53.js +30 -0
- package/dist/chunk-wzx0164n.js +18 -0
- package/dist/chunk-x0q32ees.js +3 -0
- package/dist/chunk-xfp7k0v8.js +64 -0
- package/dist/chunk-xtvf6n6f.js +4 -0
- package/dist/chunk-xwzvfqcb.js +2 -0
- package/dist/chunk-y1cmjvk3.js +43 -0
- package/dist/chunk-y5310237.js +311 -0
- package/dist/chunk-ya0qecph.js +27 -0
- package/dist/chunk-yazk54jr.js +8 -0
- package/dist/chunk-ydjfar14.js +2 -0
- package/dist/chunk-ym95v4nc.js +3 -0
- package/dist/chunk-z0g9jvv0.js +40 -0
- package/dist/chunk-z23kaxq6.js +2 -0
- package/dist/chunk-z8xn5ta3.js +2 -0
- package/dist/{chunk-8sdhs0zk.js → chunk-zhxdpzga.js} +4 -4
- package/dist/cli.js +110 -110
- package/dist/craft-entry.js +7 -7
- package/dist/craft.js +7 -7
- package/dist/database.js +2 -2
- package/dist/image-optimization/component.js +4 -4
- package/dist/media/image/component.js +5 -5
- package/dist/media/protected/component.js +2 -2
- package/dist/media/video/index.js +4 -4
- package/dist/native/bridge/protocol.d.ts +325 -0
- package/dist/native/bridge/protocol.js +219 -0
- package/dist/native/cli.d.ts +24 -0
- package/dist/native/cli.js +52 -0
- package/dist/native/compiler/bundle.d.ts +41 -0
- package/dist/native/compiler/bundle.js +90 -0
- package/dist/native/compiler/client-script.d.ts +8 -0
- package/dist/native/compiler/client-script.js +31 -0
- package/dist/native/compiler/codegen.d.ts +10 -0
- package/dist/native/compiler/codegen.js +145 -0
- package/dist/native/compiler/headwind-to-style.d.ts +395 -0
- package/dist/native/compiler/headwind-to-style.js +1163 -0
- package/dist/native/compiler/html-to-ir.d.ts +41 -0
- package/dist/native/compiler/html-to-ir.js +411 -0
- package/dist/native/compiler/icons.d.ts +220 -0
- package/dist/native/compiler/icons.js +208 -0
- package/dist/native/compiler/ir.d.ts +234 -0
- package/dist/native/compiler/ir.js +15 -0
- package/dist/native/compiler/parser.d.ts +88 -0
- package/dist/native/compiler/parser.js +753 -0
- package/dist/native/compiler/render-screen.d.ts +26 -0
- package/dist/native/compiler/render-screen.js +31 -0
- package/dist/native/components/primitives.d.ts +291 -0
- package/dist/native/components/primitives.js +22 -0
- package/dist/native/hot-reload/client.d.ts +62 -0
- package/dist/native/hot-reload/client.js +324 -0
- package/dist/native/index.d.ts +90 -0
- package/dist/native/index.js +34 -0
- package/dist/native/primitives/ActivityIndicator.stx +5 -0
- package/dist/native/primitives/Button.stx +5 -0
- package/dist/native/primitives/DatePicker.stx +5 -0
- package/dist/native/primitives/FlatList.stx +5 -0
- package/dist/native/primitives/Image.stx +5 -0
- package/dist/native/primitives/ImageBackground.stx +5 -0
- package/dist/native/primitives/KeyboardAvoidingView.stx +5 -0
- package/dist/native/primitives/Modal.stx +5 -0
- package/dist/native/primitives/Picker.stx +5 -0
- package/dist/native/primitives/Pressable.stx +5 -0
- package/dist/native/primitives/RefreshControl.stx +5 -0
- package/dist/native/primitives/SafeAreaView.stx +5 -0
- package/dist/native/primitives/ScrollView.stx +5 -0
- package/dist/native/primitives/SectionList.stx +5 -0
- package/dist/native/primitives/Slider.stx +5 -0
- package/dist/native/primitives/StatusBar.stx +5 -0
- package/dist/native/primitives/Switch.stx +5 -0
- package/dist/native/primitives/Text.stx +5 -0
- package/dist/native/primitives/TextInput.stx +5 -0
- package/dist/native/primitives/TouchableHighlight.stx +5 -0
- package/dist/native/primitives/TouchableOpacity.stx +5 -0
- package/dist/native/primitives/View.stx +5 -0
- package/dist/native/runtime/craft.d.ts +75 -0
- package/dist/native/runtime/craft.js +0 -0
- package/dist/native/runtime/entry.d.ts +1 -0
- package/dist/native/runtime/entry.js +3 -0
- package/dist/native/runtime/index.d.ts +45 -0
- package/dist/native/runtime/index.js +165 -0
- package/dist/native/runtime/native-host.d.ts +33 -0
- package/dist/native/runtime/native-host.js +184 -0
- package/dist/native/runtime/screen.d.ts +43 -0
- package/dist/native/runtime/screen.js +808 -0
- package/dist/pwa/service-worker.js +1 -1
- package/dist/pwa/workbox.js +1 -1
- package/dist/pwa.js +8 -8
- package/dist/site-url.d.ts +1 -1
- package/dist/ssg.js +53 -53
- package/dist/visual-testing.js +42 -42
- package/dist/web-components/reactive-generator.js +2 -2
- package/package.json +9 -5
- package/dist/chunk-0btmm4m2.js +0 -147
- package/dist/chunk-0c2h69k2.js +0 -4
- package/dist/chunk-0d0qeqvv.js +0 -2
- package/dist/chunk-0psndabd.js +0 -2
- package/dist/chunk-0qv8yf53.js +0 -2
- package/dist/chunk-0vkxyvsd.js +0 -2
- package/dist/chunk-0we9nw1d.js +0 -3
- package/dist/chunk-0xqdmemy.js +0 -3
- package/dist/chunk-0y46fbkx.js +0 -3
- package/dist/chunk-158wqccn.js +0 -4422
- package/dist/chunk-1cyxbb8y.js +0 -16
- package/dist/chunk-1enwnh2a.js +0 -2
- package/dist/chunk-213pzm0d.js +0 -3
- package/dist/chunk-21hzqyja.js +0 -12
- package/dist/chunk-266t58b8.js +0 -5
- package/dist/chunk-27fgag95.js +0 -4
- package/dist/chunk-2a9n102n.js +0 -2
- package/dist/chunk-2eqzrczk.js +0 -2
- package/dist/chunk-2ke37m54.js +0 -14
- package/dist/chunk-35ds08e7.js +0 -3
- package/dist/chunk-3mtwkjcg.js +0 -2
- package/dist/chunk-4xr8zwkp.js +0 -2
- package/dist/chunk-58v77x2c.js +0 -2
- package/dist/chunk-5mhq8605.js +0 -2
- package/dist/chunk-5se8xt9e.js +0 -64
- package/dist/chunk-5zh0h080.js +0 -2
- package/dist/chunk-62435225.js +0 -2
- package/dist/chunk-6kdrncsx.js +0 -30
- package/dist/chunk-6n2rr3x7.js +0 -2
- package/dist/chunk-6xk87qf2.js +0 -30
- package/dist/chunk-72rwcbp6.js +0 -3
- package/dist/chunk-76w34xne.js +0 -3
- package/dist/chunk-7ekd7zj9.js +0 -2
- package/dist/chunk-7pr3wdd5.js +0 -3
- package/dist/chunk-7rxvafwc.js +0 -24
- package/dist/chunk-7tnwfa7w.js +0 -8
- package/dist/chunk-8c5je0wf.js +0 -2
- package/dist/chunk-8dz6nyvx.js +0 -2
- package/dist/chunk-98zj3fv2.js +0 -7
- package/dist/chunk-9e8t0twa.js +0 -3
- package/dist/chunk-9fqp72ze.js +0 -5
- package/dist/chunk-anydpa34.js +0 -3
- package/dist/chunk-ay6zjq8v.js +0 -3
- package/dist/chunk-az4v4ard.js +0 -3
- package/dist/chunk-ba5erggg.js +0 -2
- package/dist/chunk-bnagrdz6.js +0 -2
- package/dist/chunk-by8wghtf.js +0 -2
- package/dist/chunk-cd7h4q51.js +0 -2
- package/dist/chunk-cjmv8hgp.js +0 -33
- package/dist/chunk-cthf912y.js +0 -2
- package/dist/chunk-cxbpmwq5.js +0 -4
- package/dist/chunk-d3sy16qn.js +0 -2
- package/dist/chunk-dh6s7mrj.js +0 -1199
- package/dist/chunk-dm2nzg7a.js +0 -2
- package/dist/chunk-e2sgcnxc.js +0 -2
- package/dist/chunk-e3b7jj74.js +0 -2
- package/dist/chunk-ec4wq2sv.js +0 -6
- package/dist/chunk-ekzg97dn.js +0 -29
- package/dist/chunk-epjt342x.js +0 -2
- package/dist/chunk-eqe26g14.js +0 -18
- package/dist/chunk-ev0v1yma.js +0 -2
- package/dist/chunk-f53psr2y.js +0 -5
- package/dist/chunk-f8p69dsg.js +0 -3
- package/dist/chunk-f95drhdb.js +0 -194
- package/dist/chunk-ff5a6hvb.js +0 -17
- package/dist/chunk-fs5fy4h8.js +0 -2
- package/dist/chunk-fzsygce3.js +0 -2
- package/dist/chunk-g465x63k.js +0 -2
- package/dist/chunk-g708ekh1.js +0 -2
- package/dist/chunk-gcr9e83g.js +0 -11
- package/dist/chunk-gdmyrsr8.js +0 -4
- package/dist/chunk-gkms2ngq.js +0 -2
- package/dist/chunk-gnfywmgs.js +0 -7
- package/dist/chunk-hpf8kq7e.js +0 -2
- package/dist/chunk-j4x3faf8.js +0 -2
- package/dist/chunk-jkavtw9f.js +0 -2
- package/dist/chunk-kg1rdena.js +0 -3
- package/dist/chunk-km91wx0v.js +0 -2
- package/dist/chunk-kmsyvaex.js +0 -8
- package/dist/chunk-mrahwn5v.js +0 -8
- package/dist/chunk-nk3czvnk.js +0 -2
- package/dist/chunk-nmw4eewb.js +0 -2
- package/dist/chunk-nq5zxrk0.js +0 -4
- package/dist/chunk-ny67c03k.js +0 -3
- package/dist/chunk-p4wdxp2c.js +0 -2
- package/dist/chunk-pcxp4r9n.js +0 -3
- package/dist/chunk-pdyeaxc1.js +0 -2
- package/dist/chunk-pf06ded4.js +0 -2
- package/dist/chunk-pfs0gpzm.js +0 -2
- package/dist/chunk-pshdwq44.js +0 -2
- package/dist/chunk-pwgv84pn.js +0 -32
- package/dist/chunk-pwsnafp3.js +0 -4367
- package/dist/chunk-q9n5swx7.js +0 -3
- package/dist/chunk-qr346wnp.js +0 -2
- package/dist/chunk-r02hke04.js +0 -2
- package/dist/chunk-ranshpyc.js +0 -3
- package/dist/chunk-rn194bhp.js +0 -20
- package/dist/chunk-rn1hgyc8.js +0 -930
- package/dist/chunk-s7z5dp70.js +0 -43
- package/dist/chunk-s8jd13nb.js +0 -3
- package/dist/chunk-sn7exv0n.js +0 -2
- package/dist/chunk-t1tdjjht.js +0 -216
- package/dist/chunk-t6qx04s8.js +0 -499
- package/dist/chunk-t6y6gyps.js +0 -2
- package/dist/chunk-tjfs7cc3.js +0 -2
- package/dist/chunk-tkyrk66a.js +0 -3
- package/dist/chunk-tntv9hvq.js +0 -2
- package/dist/chunk-v3nwkveg.js +0 -12
- package/dist/chunk-vd4cb5xr.js +0 -2
- package/dist/chunk-vkhdce50.js +0 -2
- package/dist/chunk-w183av08.js +0 -2
- package/dist/chunk-w2m02njv.js +0 -2
- package/dist/chunk-wpjrcrs5.js +0 -2
- package/dist/chunk-wqmppf6b.js +0 -3
- package/dist/chunk-wtb9fxdy.js +0 -2
- package/dist/chunk-xmzygmcz.js +0 -3
- package/dist/chunk-xsng1mtq.js +0 -3
- package/dist/chunk-xxzefj4j.js +0 -2
- package/dist/chunk-yq8x8bxq.js +0 -47
- package/dist/chunk-ytma76qe.js +0 -3
- package/dist/chunk-yw1m115e.js +0 -2
- package/dist/chunk-z64a924m.js +0 -2
- package/dist/chunk-zcz9rs6p.js +0 -3
|
@@ -7,7 +7,7 @@ function assertString(value, label) {
|
|
|
7
7
|
function normalizeOptions(value) {
|
|
8
8
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
9
9
|
throw Error("@appearanceBootstrap expects an options object");
|
|
10
|
-
const input = value,
|
|
10
|
+
const input = value, { appearance, colorMode } = input;
|
|
11
11
|
assertString(input.storageKey, "storageKey");
|
|
12
12
|
if (appearance !== void 0 && (!appearance || typeof appearance !== "object" || Array.isArray(appearance)))
|
|
13
13
|
throw Error("@appearanceBootstrap appearance must be an object when given");
|
|
@@ -9,7 +9,7 @@ export declare function bindingsOf(attributes: Iterable<[string, string]>): Bind
|
|
|
9
9
|
* Works on the rendered output rather than the template on purpose: by then
|
|
10
10
|
* every server directive has run, components are expanded and slots are filled,
|
|
11
11
|
* so what is left is exactly the set of bindings that will reach a client. It
|
|
12
|
-
* is also the same input shape stx
|
|
12
|
+
* is also the same input shape stx's native translator takes, which keeps one
|
|
13
13
|
* definition of "a binding" across both.
|
|
14
14
|
*/
|
|
15
15
|
export declare function extractBindingManifest(html: string): { html: string, manifest: BindingManifest };
|
|
@@ -41,7 +41,12 @@ export function imageEncoderIdentity() {
|
|
|
41
41
|
}).join("+");
|
|
42
42
|
return encoderIdentity;
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
const DELIVERY_STATE = Symbol.for("stx.image-delivery");
|
|
45
|
+
function deliveryState() {
|
|
46
|
+
const scope = globalThis;
|
|
47
|
+
scope[DELIVERY_STATE] ??= { catalog: new Map, transparent: new Set };
|
|
48
|
+
return scope[DELIVERY_STATE];
|
|
49
|
+
}
|
|
45
50
|
const warnedOpaqueWebp = new Set;
|
|
46
51
|
function publicUrl(relativePath) {
|
|
47
52
|
return `/${relativePath.split(path.sep).map(encodeURIComponent).join("/")}`;
|
|
@@ -206,11 +211,11 @@ function normalizeLookupSource(src) {
|
|
|
206
211
|
}
|
|
207
212
|
export function getImageDelivery(src) {
|
|
208
213
|
const key = normalizeLookupSource(src);
|
|
209
|
-
return key ?
|
|
214
|
+
return key ? deliveryState().catalog.get(key) : void 0;
|
|
210
215
|
}
|
|
211
216
|
export function isTransparentImage(src) {
|
|
212
217
|
const key = normalizeLookupSource(src);
|
|
213
|
-
return key ?
|
|
218
|
+
return key ? deliveryState().transparent.has(key) : !1;
|
|
214
219
|
}
|
|
215
220
|
export function efficientDeliverySources(delivery) {
|
|
216
221
|
const bytesByFormat = (format) => delivery.variants.filter((variant) => variant.format === format).reduce((total, variant) => total + variant.bytes, 0), fallbackBytes = bytesByFormat(delivery.fallback.format);
|
|
@@ -230,15 +235,18 @@ export function deliveredImage(src) {
|
|
|
230
235
|
};
|
|
231
236
|
}
|
|
232
237
|
export function clearImageDeliveryCatalog() {
|
|
233
|
-
|
|
234
|
-
|
|
238
|
+
const state = deliveryState();
|
|
239
|
+
state.catalog = new Map;
|
|
240
|
+
state.transparent = new Set;
|
|
235
241
|
}
|
|
236
242
|
export function snapshotImageDelivery() {
|
|
237
|
-
|
|
243
|
+
const state = deliveryState();
|
|
244
|
+
return { entries: [...state.catalog], transparent: [...state.transparent] };
|
|
238
245
|
}
|
|
239
246
|
export function installImageDelivery(snapshot) {
|
|
240
|
-
|
|
241
|
-
|
|
247
|
+
const state = deliveryState();
|
|
248
|
+
state.catalog = new Map(snapshot.entries);
|
|
249
|
+
state.transparent = new Set(snapshot.transparent);
|
|
242
250
|
}
|
|
243
251
|
export async function prepareImageDelivery(publicDir, outputDir, options = {}) {
|
|
244
252
|
if (!publicDir || !fs.existsSync(publicDir)) {
|
|
@@ -312,9 +320,9 @@ export async function prepareImageDelivery(publicDir, outputDir, options = {}) {
|
|
|
312
320
|
entries: deliveryEntries(optimizedFiles, alphaStorage)
|
|
313
321
|
});
|
|
314
322
|
}
|
|
315
|
-
const transparent = await findTransparent(catalog.entries), droppedWebp = dropOpaqueWebp(catalog.entries, transparent);
|
|
316
|
-
|
|
317
|
-
|
|
323
|
+
const transparent = await findTransparent(catalog.entries), droppedWebp = dropOpaqueWebp(catalog.entries, transparent), state = deliveryState();
|
|
324
|
+
state.catalog = new Map(Object.entries(catalog.entries));
|
|
325
|
+
state.transparent = transparent;
|
|
318
326
|
const fingerprint = transparent.size === 0 && droppedWebp.length === 0 ? catalog.fingerprint : createHash("sha256").update(catalog.fingerprint).update(JSON.stringify({ transparent: [...transparent].sort(), droppedWebp: droppedWebp.sort() })).digest("hex");
|
|
319
327
|
return { count: optimizedFiles.length, fingerprint };
|
|
320
328
|
}
|
package/dist/bundle-analyzer.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import
|
|
3
|
-
`)}function
|
|
4
|
-
`)}function
|
|
2
|
+
import b from"fs";import z from"path";import{gzipSync as O}from"zlib";import{createHash as G}from"crypto";var I={".js":"js",".mjs":"js",".cjs":"js",".ts":"js",".jsx":"js",".tsx":"js",".css":"css",".scss":"css",".sass":"css",".less":"css",".html":"html",".htm":"html",".png":"image",".jpg":"image",".jpeg":"image",".gif":"image",".svg":"image",".webp":"image",".avif":"image",".ico":"image",".woff":"font",".woff2":"font",".ttf":"font",".eot":"font",".otf":"font"},E=[/node_modules/,/vendor/,/bower_components/,/\.min\./],F=[/index\.(js|ts|html)$/,/main\.(js|ts)$/,/app\.(js|ts)$/,/entry\.(js|ts)$/];async function S(t,o={}){let{includeSourceMaps:e=!1,parseImports:n=!0,detectDuplicates:a=!0,topModulesCount:r=20}=o;if(!b.existsSync(t))throw Error(`Build directory not found: ${t}`);if(!b.statSync(t).isDirectory())throw Error(`Not a directory: ${t}`);let s=await P(t,e),d=[],u=[];for(let h of s)try{let m=await L(h,t,n);d.push(m)}catch(m){u.push(`Failed to process ${h}: ${m}`)}let c=V(d,t),p=d.reduce((h,m)=>h+m.size,0),y=d.reduce((h,m)=>h+m.gzipSize,0),w=_(d),f=a?H(d):[],g=[...d].sort((h,m)=>m.size-h.size).slice(0,r);return{timestamp:Date.now(),buildDir:z.resolve(t),chunks:c,totalSize:p,totalGzipSize:y,moduleCount:d.length,duplicates:f,byType:w,largestModules:g,warnings:u}}async function P(t,o){let e=[];async function n(a){let r=await b.promises.readdir(a,{withFileTypes:!0});for(let i of r){let s=z.join(a,i.name);if(i.isDirectory()){if(!i.name.startsWith(".")&&i.name!=="node_modules")await n(s)}else if(i.isFile()){if(!o&&i.name.endsWith(".map"))continue;e.push(s)}}}return await n(t),e}async function L(t,o,e){let n=await b.promises.readFile(t),a=z.relative(o,t),r=z.extname(t).toLowerCase(),i=n.length,s=N(n),d=D(n,r),u=G("md5").update(n).digest("hex").slice(0,8),c=I[r]||"other",p=[];if(e&&c==="js")p.push(...A(n.toString("utf-8")));return{id:a,path:a,size:i,gzipSize:s,parsedSize:d,extension:r,type:c,imports:p,importedBy:[],hash:u}}function N(t){try{let o=O(t,{level:9}).length;return Math.min(o,t.length)}catch{return t.length}}function D(t,o){if(o.includes(".min.")||t.length<1000)return t.length;let n=I[o];if(n==="js")return Math.round(t.length*0.6);if(n==="css")return Math.round(t.length*0.7);return t.length}function A(t){let o=[],e=/import\s+(?:[\w*{}\s,]+\s+from\s+)?['"]([^'"]+)['"]/g,n;while((n=e.exec(t))!==null)o.push(n[1]);let a=/import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;while((n=a.exec(t))!==null)o.push(n[1]);let r=/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;while((n=r.exec(t))!==null)o.push(n[1]);return[...new Set(o)]}function V(t,o){let e=new Map;for(let a of t){let r=a.path.split(z.sep),i;if(r.length===1)i=z.basename(a.path,a.extension);else i=r[0];let s=e.get(i)||[];s.push(a),e.set(i,s)}let n=[];for(let[a,r]of e){let i=r.reduce((c,p)=>c+p.size,0),s=r.reduce((c,p)=>c+p.gzipSize,0),d=r.some((c)=>F.some((p)=>p.test(c.path))),u=r.some((c)=>E.some((p)=>p.test(c.path)));n.push({name:a,files:r.map((c)=>c.path),modules:r,size:i,gzipSize:s,isEntry:d,isVendor:u})}return n.sort((a,r)=>r.size-a.size)}function _(t){let o={js:{count:0,size:0,gzipSize:0},css:{count:0,size:0,gzipSize:0},html:{count:0,size:0,gzipSize:0},image:{count:0,size:0,gzipSize:0},font:{count:0,size:0,gzipSize:0},other:{count:0,size:0,gzipSize:0}};for(let e of t)o[e.type].count++,o[e.type].size+=e.size,o[e.type].gzipSize+=e.gzipSize;return o}function H(t){let o=new Map;for(let n of t){let a=o.get(n.hash)||[];a.push(n),o.set(n.hash,a)}let e=[];for(let[,n]of o)if(n.length>1){let a=n[0];e.push({path:a.path,count:n.length,wastedBytes:a.size*(n.length-1),locations:n.map((r)=>r.path)})}return e.sort((n,a)=>a.wastedBytes-n.wastedBytes)}function l(t){if(t<1024)return`${t} B`;if(t<1048576)return`${(t/1024).toFixed(2)} KB`;return`${(t/1048576).toFixed(2)} MB`}function M(t){let o=t.match(/^([\d.]+)\s*(B|KB|MB|GB)?$/i);if(!o)return 0;let e=Number.parseFloat(o[1]);switch((o[2]||"B").toUpperCase()){case"KB":return e*1024;case"MB":return e*1024*1024;case"GB":return e*1024*1024*1024;default:return e}}function v(t,o){if(o===0)return"0%";return`${(t/o*100).toFixed(1)}%`}function T(t,o){switch(o.format){case"json":return J(t,o);case"markdown":return K(t,o);case"text":default:return W(t,o)}}function J(t,o){let e=x(t,o);return JSON.stringify({timestamp:t.timestamp,buildDir:t.buildDir,summary:{totalSize:t.totalSize,totalSizeFormatted:l(t.totalSize),totalGzipSize:t.totalGzipSize,totalGzipSizeFormatted:l(t.totalGzipSize),moduleCount:t.moduleCount,chunkCount:t.chunks.length,duplicateCount:t.duplicates.length},byType:Object.fromEntries(Object.entries(t.byType).map(([n,a])=>[n,{...a,sizeFormatted:l(a.size),gzipSizeFormatted:l(a.gzipSize)}])),chunks:t.chunks.map((n)=>({name:n.name,size:n.size,sizeFormatted:l(n.size),gzipSize:n.gzipSize,gzipSizeFormatted:l(n.gzipSize),moduleCount:n.modules.length,isEntry:n.isEntry,isVendor:n.isVendor})),largestModules:t.largestModules.slice(0,o.topModules||10).map((n)=>({path:n.path,size:n.size,sizeFormatted:l(n.size),gzipSize:n.gzipSize,gzipSizeFormatted:l(n.gzipSize),type:n.type})),duplicates:t.duplicates,analysis:e,warnings:t.warnings},null,2)}function W(t,o){let e=[],n=o.showGzip!==!1;if(e.push(""),e.push("Bundle Analysis Report"),e.push("\u2550".repeat(50)),e.push(""),e.push("Summary"),e.push("\u2500".repeat(50)),n)e.push(`Total Size: ${l(t.totalSize)} (${l(t.totalGzipSize)} gzip)`);else e.push(`Total Size: ${l(t.totalSize)}`);if(e.push(`Modules: ${t.moduleCount}`),e.push(`Chunks: ${t.chunks.length}`),t.duplicates.length>0)e.push(`Duplicates: ${t.duplicates.length}`);if(e.push(""),o.threshold&&t.totalSize>o.threshold)e.push(`\u26A0\uFE0F Bundle exceeds threshold of ${l(o.threshold)}!`),e.push("");e.push("Size by Type"),e.push("\u2500".repeat(50));let a=["js","css","html","image","font","other"];for(let i of a){let s=t.byType[i];if(s.count>0){let d=v(s.size,t.totalSize),u=n?` (${l(s.gzipSize)} gzip)`:"";e.push(` ${i.padEnd(8)} ${l(s.size).padStart(12)}${u} ${d.padStart(6)} (${s.count} files)`)}}e.push(""),e.push("Chunks"),e.push("\u2500".repeat(50));for(let i of t.chunks.slice(0,10)){let s=[];if(i.isEntry)s.push("entry");if(i.isVendor)s.push("vendor");let d=s.length>0?` [${s.join(", ")}]`:"",u=n?` (${l(i.gzipSize)} gzip)`:"";e.push(` ${i.name.padEnd(20)} ${l(i.size).padStart(12)}${u}${d}`)}if(t.chunks.length>10)e.push(` ... and ${t.chunks.length-10} more chunks`);e.push("");let r=o.topModules||10;e.push(`Largest Modules (Top ${r})`),e.push("\u2500".repeat(50));for(let i=0;i<Math.min(r,t.largestModules.length);i++){let s=t.largestModules[i],d=n?` (${l(s.gzipSize)} gzip)`:"";e.push(` ${(i+1).toString().padStart(2)}. ${s.path}`),e.push(` ${l(s.size)}${d}`)}if(e.push(""),t.duplicates.length>0){e.push("Duplicate Modules"),e.push("\u2500".repeat(50));for(let i of t.duplicates.slice(0,5))e.push(` ${i.path}`),e.push(` ${i.count} copies, wasting ${l(i.wastedBytes)}`);if(t.duplicates.length>5)e.push(` ... and ${t.duplicates.length-5} more duplicates`);e.push("")}if(o.recommendations!==!1){let i=x(t,o);if(i.recommendations.length>0){e.push("Recommendations"),e.push("\u2500".repeat(50));for(let s of i.recommendations.slice(0,5)){let d=s.impact==="high"?"\u26A1":s.impact==="medium"?"\uD83D\uDCCA":"\uD83D\uDCA1";e.push(` ${d} ${s.title}`),e.push(` ${s.description}`)}e.push("")}}if(t.warnings.length>0){e.push("Warnings"),e.push("\u2500".repeat(50));for(let i of t.warnings)e.push(` \u26A0\uFE0F ${i}`);e.push("")}return e.join(`
|
|
3
|
+
`)}function K(t,o){let e=[],n=o.showGzip!==!1;if(e.push("# Bundle Analysis Report"),e.push(""),e.push(`Generated: ${new Date(t.timestamp).toISOString()}`),e.push(""),e.push("## Summary"),e.push(""),e.push("| Metric | Value |"),e.push("|--------|-------|"),e.push(`| Total Size | ${l(t.totalSize)} |`),n)e.push(`| Gzip Size | ${l(t.totalGzipSize)} |`);e.push(`| Modules | ${t.moduleCount} |`),e.push(`| Chunks | ${t.chunks.length} |`),e.push(`| Duplicates | ${t.duplicates.length} |`),e.push(""),e.push("## Size by Type"),e.push(""),e.push("| Type | Size | Gzip | % | Files |"),e.push("|------|------|------|---|-------|");let a=["js","css","html","image","font","other"];for(let i of a){let s=t.byType[i];if(s.count>0)e.push(`| ${i} | ${l(s.size)} | ${l(s.gzipSize)} | ${v(s.size,t.totalSize)} | ${s.count} |`)}e.push(""),e.push("## Chunks"),e.push(""),e.push("| Name | Size | Gzip | Modules | Type |"),e.push("|------|------|------|---------|------|");for(let i of t.chunks.slice(0,15)){let s=i.isEntry?"Entry":i.isVendor?"Vendor":"-";e.push(`| ${i.name} | ${l(i.size)} | ${l(i.gzipSize)} | ${i.modules.length} | ${s} |`)}e.push("");let r=o.topModules||10;e.push(`## Largest Modules (Top ${r})`),e.push(""),e.push("| # | Path | Size | Gzip |"),e.push("|---|------|------|------|");for(let i=0;i<Math.min(r,t.largestModules.length);i++){let s=t.largestModules[i];e.push(`| ${i+1} | \`${s.path}\` | ${l(s.size)} | ${l(s.gzipSize)} |`)}if(e.push(""),t.duplicates.length>0){e.push("## Duplicates"),e.push(""),e.push("| Path | Copies | Wasted |"),e.push("|------|--------|--------|");for(let i of t.duplicates.slice(0,10))e.push(`| \`${i.path}\` | ${i.count} | ${l(i.wastedBytes)} |`);e.push("")}if(o.recommendations!==!1){let i=x(t,o);if(i.recommendations.length>0){e.push("## Recommendations"),e.push("");for(let s of i.recommendations)e.push(`### ${s.title}`),e.push(""),e.push(s.description),e.push(""),e.push(`- **Impact:** ${s.impact}`),e.push(`- **Effort:** ${s.effort}`),e.push("")}}return e.join(`
|
|
4
|
+
`)}function x(t,o){let e=[],n=[];if(o.threshold&&t.totalSize>o.threshold)e.push({severity:"error",message:`Bundle size (${l(t.totalSize)}) exceeds threshold (${l(o.threshold)})`});if(t.totalSize>1048576)e.push({severity:"warning",message:`Bundle is over 1MB (${l(t.totalSize)})`,details:"Large bundles can significantly impact load time"});if(t.duplicates.length>0){let s=t.duplicates.reduce((d,u)=>d+u.wastedBytes,0);e.push({severity:"warning",message:`${t.duplicates.length} duplicate modules found, wasting ${l(s)}`}),n.push({title:"Remove Duplicate Modules",description:"Consider using import aliases or ensuring consistent package versions to eliminate duplicates.",impact:"medium",effort:"low"})}if(t.byType.js.size/t.totalSize>0.8&&t.totalSize>512000)n.push({title:"Code Splitting",description:"Over 80% of your bundle is JavaScript. Consider splitting code by route or feature.",impact:"high",effort:"medium"});let r=t.largestModules.filter((s)=>s.size>102400);if(r.length>0){e.push({severity:"info",message:`${r.length} modules are over 100KB`});for(let s of r){if(s.path.includes("lodash")&&!s.path.includes("lodash-es"))n.push({title:"Use lodash-es instead of lodash",description:"lodash-es supports tree-shaking and can significantly reduce bundle size.",impact:"high",effort:"low"});if(s.path.includes("moment"))n.push({title:"Replace moment.js",description:"Consider using date-fns or dayjs for smaller date handling libraries.",impact:"high",effort:"medium"})}}if(t.byType.image.size>512000)n.push({title:"Optimize Images",description:`Images account for ${l(t.byType.image.size)}. Consider using WebP/AVIF formats and responsive images.`,impact:"high",effort:"low"});let i=100;if(t.totalSize>1048576)i-=20;else if(t.totalSize>512000)i-=10;if(i-=Math.min(20,t.duplicates.length*2),i-=Math.min(15,r.length*3),o.threshold&&t.totalSize>o.threshold)i-=25;return{score:Math.max(0,i),issues:e,recommendations:n}}var U={lodash:{alternative:"lodash-es or individual imports",savings:"~70%"},moment:{alternative:"date-fns or dayjs",savings:"~90%"},"chart.js":{alternative:"chart.js with tree-shaking",savings:"~50%"},"highlight.js":{alternative:"Selective language imports",savings:"~80%"},fontawesome:{alternative:"Individual icon imports",savings:"~90%"},"material-ui":{alternative:"Named imports from @mui/*",savings:"~60%"}};function Y(t){for(let[o,e]of Object.entries(U))if(t.includes(o))return{title:`Optimize ${o}`,description:`Consider using ${e.alternative}. Potential savings: ${e.savings}`,impact:"high",effort:"low"};return null}var q={default:{js:"#f7df1e",css:"#264de4",html:"#e34c26",image:"#4caf50",font:"#9c27b0",other:"#607d8b",vendor:"#ff5722"},pastel:{js:"#fff3b0",css:"#b0d4ff",html:"#ffb0b0",image:"#b0ffb0",font:"#e0b0ff",other:"#d0d0d0",vendor:"#ffcfb0"},monochrome:{js:"#333333",css:"#555555",html:"#777777",image:"#999999",font:"#bbbbbb",other:"#dddddd",vendor:"#444444"}};function B(t,o={}){let{title:e="Bundle Analysis",gzip:n=!0,colorScheme:a="default"}=o,r=q[a],i=X(t),s=JSON.stringify(i);return`<!DOCTYPE html>
|
|
5
5
|
<html lang="en">
|
|
6
6
|
<head>
|
|
7
7
|
<meta charset="UTF-8">
|
|
8
8
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
9
|
-
<title>${
|
|
9
|
+
<title>${R(e)}</title>
|
|
10
10
|
<style>
|
|
11
11
|
* {
|
|
12
12
|
box-sizing: border-box;
|
|
@@ -212,22 +212,22 @@ import v from"fs";import H from"path";import{gzipSync as z}from"zlib";import{cre
|
|
|
212
212
|
</head>
|
|
213
213
|
<body>
|
|
214
214
|
<div class="header">
|
|
215
|
-
<h1>${
|
|
215
|
+
<h1>${R(e)}</h1>
|
|
216
216
|
<div class="stats">
|
|
217
217
|
<div class="stat">
|
|
218
|
-
<div class="stat-value" id="total-size">${
|
|
218
|
+
<div class="stat-value" id="total-size">${l(t.totalSize)}</div>
|
|
219
219
|
<div class="stat-label">Total Size</div>
|
|
220
220
|
</div>
|
|
221
221
|
<div class="stat">
|
|
222
|
-
<div class="stat-value" id="gzip-size">${
|
|
222
|
+
<div class="stat-value" id="gzip-size">${l(t.totalGzipSize)}</div>
|
|
223
223
|
<div class="stat-label">Gzip Size</div>
|
|
224
224
|
</div>
|
|
225
225
|
<div class="stat">
|
|
226
|
-
<div class="stat-value">${
|
|
226
|
+
<div class="stat-value">${t.moduleCount}</div>
|
|
227
227
|
<div class="stat-label">Modules</div>
|
|
228
228
|
</div>
|
|
229
229
|
<div class="stat">
|
|
230
|
-
<div class="stat-value">${
|
|
230
|
+
<div class="stat-value">${t.chunks.length}</div>
|
|
231
231
|
<div class="stat-label">Chunks</div>
|
|
232
232
|
</div>
|
|
233
233
|
</div>
|
|
@@ -238,7 +238,7 @@ import v from"fs";import H from"path";import{gzipSync as z}from"zlib";import{cre
|
|
|
238
238
|
<input type="text" id="search" placeholder="Search modules...">
|
|
239
239
|
</div>
|
|
240
240
|
<label>
|
|
241
|
-
<input type="checkbox" id="show-gzip" ${
|
|
241
|
+
<input type="checkbox" id="show-gzip" ${n?"checked":""}>
|
|
242
242
|
Show Gzip Size
|
|
243
243
|
</label>
|
|
244
244
|
</div>
|
|
@@ -254,37 +254,37 @@ import v from"fs";import H from"path";import{gzipSync as z}from"zlib";import{cre
|
|
|
254
254
|
<div class="legend">
|
|
255
255
|
<div class="legend-title">File Types</div>
|
|
256
256
|
<div class="legend-item">
|
|
257
|
-
<div class="legend-color" style="background: ${
|
|
257
|
+
<div class="legend-color" style="background: ${r.js}"></div>
|
|
258
258
|
<span>JavaScript</span>
|
|
259
259
|
</div>
|
|
260
260
|
<div class="legend-item">
|
|
261
|
-
<div class="legend-color" style="background: ${
|
|
261
|
+
<div class="legend-color" style="background: ${r.css}"></div>
|
|
262
262
|
<span>CSS</span>
|
|
263
263
|
</div>
|
|
264
264
|
<div class="legend-item">
|
|
265
|
-
<div class="legend-color" style="background: ${
|
|
265
|
+
<div class="legend-color" style="background: ${r.html}"></div>
|
|
266
266
|
<span>HTML</span>
|
|
267
267
|
</div>
|
|
268
268
|
<div class="legend-item">
|
|
269
|
-
<div class="legend-color" style="background: ${
|
|
269
|
+
<div class="legend-color" style="background: ${r.image}"></div>
|
|
270
270
|
<span>Images</span>
|
|
271
271
|
</div>
|
|
272
272
|
<div class="legend-item">
|
|
273
|
-
<div class="legend-color" style="background: ${
|
|
273
|
+
<div class="legend-color" style="background: ${r.font}"></div>
|
|
274
274
|
<span>Fonts</span>
|
|
275
275
|
</div>
|
|
276
276
|
<div class="legend-item">
|
|
277
|
-
<div class="legend-color" style="background: ${
|
|
277
|
+
<div class="legend-color" style="background: ${r.other}"></div>
|
|
278
278
|
<span>Other</span>
|
|
279
279
|
</div>
|
|
280
280
|
</div>
|
|
281
281
|
|
|
282
282
|
<script src="https://d3js.org/d3.v7.min.js"></script>
|
|
283
283
|
<script>
|
|
284
|
-
const data = ${
|
|
285
|
-
const colors = ${JSON.stringify(
|
|
284
|
+
const data = ${s};
|
|
285
|
+
const colors = ${JSON.stringify(r)};
|
|
286
286
|
|
|
287
|
-
let showGzip = ${
|
|
287
|
+
let showGzip = ${n};
|
|
288
288
|
let currentRoot = data;
|
|
289
289
|
let searchTerm = '';
|
|
290
290
|
|
|
@@ -496,4 +496,4 @@ import v from"fs";import H from"path";import{gzipSync as z}from"zlib";import{cre
|
|
|
496
496
|
render();
|
|
497
497
|
</script>
|
|
498
498
|
</body>
|
|
499
|
-
</html>`}function
|
|
499
|
+
</html>`}function X(t){let o={name:"root",size:t.totalSize,gzipSize:t.totalGzipSize,children:[]};for(let e of t.chunks){let n={name:e.name,size:e.size,gzipSize:e.gzipSize,children:[]};for(let a of e.modules)Q(n,a);o.children.push(n)}return o}function Q(t,o){let e=o.path.split("/"),n=t;for(let r=0;r<e.length-1;r++){let i=e[r],s=n.children?.find((d)=>d.name===i);if(!s){if(s={name:i,size:0,gzipSize:0,children:[]},!n.children)n.children=[];n.children.push(s)}n=s}let a=e[e.length-1];if(!n.children)n.children=[];n.children.push({name:a,path:o.path,size:o.size,gzipSize:o.gzipSize,type:o.type}),Z(t,o.size,o.gzipSize)}function Z(t,o,e){}function R(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function k(t){let o=process.platform,e=o==="darwin"?"open":o==="win32"?"start":"xdg-open";Bun.spawn([e,t],{stdio:["ignore","ignore","ignore"]})}import j from"fs";import C from"path";async function fe(t={}){let{directory:o="dist",output:e,format:n="html",open:a=!0,gzip:r=!0,threshold:i,recommendations:s=!0,topModules:d=20,parseImports:u=!0}=t,p=await S(o,{parseImports:u,detectDuplicates:!0,topModulesCount:d}),y=i?typeof i==="string"?M(i):i:void 0,w=y?p.totalSize>y:!1,f,g;if(n==="html"){let h={title:`Bundle Analysis - ${C.basename(C.resolve(o))}`,gzip:r};if(f=B(p,h),g=e||C.join(o,"bundle-report.html"),await j.promises.writeFile(g,f),a)k(g)}else if(f=T(p,{format:n,threshold:y,recommendations:s,topModules:d,showGzip:r}),e)g=e,await j.promises.writeFile(g,f);return{stats:p,report:f,outputPath:g,exceedsThreshold:w}}async function ze(t){let o=await S(t,{parseImports:!1,detectDuplicates:!1,topModulesCount:0});return{totalSize:o.totalSize,totalSizeFormatted:l(o.totalSize),gzipSize:o.totalGzipSize,gzipSizeFormatted:l(o.totalGzipSize),moduleCount:o.moduleCount,chunkCount:o.chunks.length}}export{fe as analyze,x as analyzeBundle,S as collectBundleStats,l as formatBytes,T as generateReport,B as generateTreemap,ze as getBundleSummary,Y as getModuleRecommendation,k as openInBrowser,M as parseSize,v as percentage};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{L,j,B,Lt,Z,oe,Tn,Yo,Ie,ut,jt,Bt,Ft,F,zt,Ht,_n}from"./chunk-eed4fwps.js";export{j as DEFAULT_FORMATS,B as DEFAULT_QUALITY,L as DEFAULT_WIDTHS,_n as ImageProcessingError,Ht as formatSize,ut as generateSizes,Ie as generateSrcSet,jt as getFallbackVariant,Tn as getImageMetadata,F as getMimeType,zt as getTotalSize,Bt as groupVariantsByFormat,Z as isImageBackendAvailable,Ft as isImageFile,Lt as isSharpAvailable,oe as processImage,Yo as resizeAndConvert};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Nu,ve,Gi,Lu,cs,ls,us}from"./chunk-3efw27as.js";import"./chunk-752hw7cd.js";import"./chunk-shr559s7.js";import"./chunk-ak1cgcah.js";import"./chunk-9amp82bx.js";import"./chunk-b98be3yp.js";import"./chunk-ngc2wke4.js";import"./chunk-xfp7k0v8.js";import"./chunk-m4sk62wb.js";import"./chunk-z0g9jvv0.js";import"./chunk-8nhshfz6.js";import"./chunk-7gkv67ky.js";import"./chunk-ce1sejr3.js";import"./chunk-czxt605c.js";export{Lu as clearOnceStore,Gi as onceStore,ve as partialsCache,cs as processIncludes,ls as processStackPushDirectives,us as processStackReplacements,Nu as resetUnscopedSignalWarnings};
|