@wular/pnext 0.1.6 → 0.1.8
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/bin/pnext +9 -2
- package/dist/server/_chunks/aliases-pycbtjt1.js +46 -0
- package/dist/server/_chunks/analyze-4d9e00g9.js +449 -0
- package/dist/server/_chunks/boot-bhemypxz.js +38 -0
- package/dist/server/_chunks/build-c991dv65.js +86 -0
- package/dist/server/_chunks/build-kh5e3x48.js +3341 -0
- package/dist/server/_chunks/build-tier-0a96kmx3.js +2456 -0
- package/dist/server/_chunks/compile-040r79gj.js +22 -0
- package/dist/server/_chunks/config-0tvz03a6.js +24 -0
- package/dist/server/_chunks/config-27rj7830.js +36 -0
- package/dist/server/_chunks/create-9rvwshsp.js +135 -0
- package/dist/server/_chunks/dev-ex9exynt.js +220 -0
- package/dist/server/_chunks/esbuild-yyktfrtt.js +15 -0
- package/dist/server/_chunks/generate-myw9hef7.js +22 -0
- package/dist/server/_chunks/index-0r5eqfc7.js +279 -0
- package/dist/server/_chunks/index-0yjv5v47.js +105 -0
- package/dist/server/_chunks/index-11xpbfej.js +17 -0
- package/dist/server/_chunks/index-141vcwk6.js +109 -0
- package/dist/server/_chunks/index-1pzm1hdy.js +4130 -0
- package/dist/server/_chunks/index-29pq0kax.js +590 -0
- package/dist/server/_chunks/index-2vz0wzdn.js +59 -0
- package/dist/server/_chunks/index-2wfv4kvx.js +182 -0
- package/dist/server/_chunks/index-38xpdxwd.js +194 -0
- package/dist/server/_chunks/index-3e075kny.js +128 -0
- package/dist/server/_chunks/index-3ycf5ckv.js +472 -0
- package/dist/server/_chunks/index-4399bvd2.js +18 -0
- package/dist/server/_chunks/index-4da76t62.js +297 -0
- package/dist/server/_chunks/index-4t92hdxd.js +172 -0
- package/dist/server/_chunks/index-4zzebszd.js +10 -0
- package/dist/server/_chunks/index-52k54ykj.js +95 -0
- package/dist/server/_chunks/index-5hr4062s.js +70 -0
- package/dist/server/_chunks/index-68m3mwbd.js +84 -0
- package/dist/server/_chunks/index-6b009mt0.js +56 -0
- package/dist/server/_chunks/index-6gex3pfa.js +15 -0
- package/dist/server/_chunks/index-6kp9r0d9.js +11 -0
- package/dist/server/_chunks/index-6q7zvrap.js +134 -0
- package/dist/server/_chunks/index-71885zaq.js +284 -0
- package/dist/server/_chunks/index-73z4esab.js +38 -0
- package/dist/server/_chunks/index-79ngvam8.js +60 -0
- package/dist/server/_chunks/index-7wc9n8be.js +25 -0
- package/dist/server/_chunks/index-8ct7rqy3.js +198 -0
- package/dist/server/_chunks/index-8kcxdfya.js +206 -0
- package/dist/server/_chunks/index-9ch50vtq.js +18 -0
- package/dist/server/_chunks/index-9f49w76j.js +213 -0
- package/dist/server/_chunks/index-9hz3s0m8.js +851 -0
- package/dist/server/_chunks/index-akkrvjn6.js +535 -0
- package/dist/server/_chunks/index-b6wtkdp4.js +24 -0
- package/dist/server/_chunks/index-b7j671dj.js +207 -0
- package/dist/server/_chunks/index-bcws5eh2.js +35 -0
- package/dist/server/_chunks/index-bzd2ef7t.js +10 -0
- package/dist/server/_chunks/index-cjgqs13g.js +65 -0
- package/dist/server/_chunks/index-ckkdpht5.js +41 -0
- package/dist/server/_chunks/index-cn86z041.js +296 -0
- package/dist/server/_chunks/index-cvr4z22m.js +92 -0
- package/dist/server/_chunks/index-cyfednwb.js +87 -0
- package/dist/server/_chunks/index-d158y67j.js +152 -0
- package/dist/server/_chunks/index-d1jsmhhk.js +955 -0
- package/dist/server/_chunks/index-dg0f05zs.js +199 -0
- package/dist/server/_chunks/index-dgr390q7.js +9438 -0
- package/dist/server/_chunks/index-drwv61cc.js +185 -0
- package/dist/server/_chunks/index-e3a6yx84.js +18 -0
- package/dist/server/_chunks/index-e88tyv35.js +45 -0
- package/dist/server/_chunks/index-en7n9f7m.js +22 -0
- package/dist/server/_chunks/index-entm8bmz.js +28 -0
- package/dist/server/_chunks/index-evhd413j.js +57 -0
- package/dist/server/_chunks/index-ezgj0tr1.js +88 -0
- package/dist/server/_chunks/index-fjv96re1.js +5295 -0
- package/dist/server/_chunks/index-fn1chkkd.js +214 -0
- package/dist/server/_chunks/index-fp8r0sqs.js +64 -0
- package/dist/server/_chunks/index-gcmj16xy.js +92 -0
- package/dist/server/_chunks/index-gkndxkxf.js +736 -0
- package/dist/server/_chunks/index-grta8ap3.js +238 -0
- package/dist/server/_chunks/index-h2a70tg4.js +7 -0
- package/dist/server/_chunks/index-h4xy648y.js +51 -0
- package/dist/server/_chunks/index-hdbwtdv2.js +352 -0
- package/dist/server/_chunks/index-he6n2bvp.js +1270 -0
- package/dist/server/_chunks/index-j0m1jxqa.js +1253 -0
- package/dist/server/_chunks/index-j2zrcp1k.js +66 -0
- package/dist/server/_chunks/index-j681c48a.js +2530 -0
- package/dist/server/_chunks/index-jbj7ehef.js +50 -0
- package/dist/server/_chunks/index-jcsjq3d1.js +20 -0
- package/dist/server/_chunks/index-jks0x0a1.js +14 -0
- package/dist/server/_chunks/index-jn9rbhrx.js +1599 -0
- package/dist/server/_chunks/index-jt8e1pje.js +12 -0
- package/dist/server/_chunks/index-kdhxpwyq.js +483 -0
- package/dist/server/_chunks/index-knp0s912.js +7 -0
- package/dist/server/_chunks/index-kqyy1d4f.js +50 -0
- package/dist/server/_chunks/index-kresp2n8.js +445 -0
- package/dist/server/_chunks/index-m63czgq5.js +590 -0
- package/dist/server/_chunks/index-ms9v9tnx.js +31 -0
- package/dist/server/_chunks/index-n4hxpng2.js +11 -0
- package/dist/server/_chunks/index-n629dy38.js +1071 -0
- package/dist/server/_chunks/index-nf3df4jy.js +266 -0
- package/dist/server/_chunks/index-nqh3xhdc.js +57 -0
- package/dist/server/_chunks/index-pym1cezq.js +39 -0
- package/dist/server/_chunks/index-q3r9z8mq.js +213 -0
- package/dist/server/_chunks/index-q738kkhj.js +100 -0
- package/dist/server/_chunks/index-qcrvt6er.js +112 -0
- package/dist/server/_chunks/index-qjj6gddn.js +54 -0
- package/dist/server/_chunks/index-qpwsgt3a.js +158 -0
- package/dist/server/_chunks/index-r97ptz1q.js +97 -0
- package/dist/server/_chunks/index-ras0sdab.js +26 -0
- package/dist/server/_chunks/index-rcs322t1.js +19 -0
- package/dist/server/_chunks/index-rgj5mx84.js +101 -0
- package/dist/server/_chunks/index-rjegyfx4.js +1435 -0
- package/dist/server/_chunks/index-rt9qq1va.js +4 -0
- package/dist/server/_chunks/index-rthrsed5.js +356 -0
- package/dist/server/_chunks/index-sq3kvz3g.js +200 -0
- package/dist/server/_chunks/index-stbk3jhn.js +31 -0
- package/dist/server/_chunks/index-tf4j19ge.js +130 -0
- package/dist/server/_chunks/index-tgcakdxc.js +125 -0
- package/dist/server/_chunks/index-tgsfjmep.js +74 -0
- package/dist/server/_chunks/index-tq1f96v7.js +51 -0
- package/dist/server/_chunks/index-tq3b39a5.js +107 -0
- package/dist/server/_chunks/index-typcbcsv.js +819 -0
- package/dist/server/_chunks/index-v1ags1na.js +132 -0
- package/dist/server/_chunks/index-vmr35jjw.js +170 -0
- package/dist/server/_chunks/index-vvq7rqtn.js +329 -0
- package/dist/server/_chunks/index-vz0km5qk.js +33 -0
- package/dist/server/_chunks/index-w6h8m6vp.js +138 -0
- package/dist/server/_chunks/index-web361b8.js +138 -0
- package/dist/server/_chunks/index-wm36rj4v.js +311 -0
- package/dist/server/_chunks/index-x0y005nh.js +283 -0
- package/dist/server/_chunks/index-x2m17v9c.js +6166 -0
- package/dist/server/_chunks/index-x3yn4ywm.js +22 -0
- package/dist/server/_chunks/index-x9c55pzy.js +871 -0
- package/dist/server/_chunks/index-xh1nbk46.js +1299 -0
- package/dist/server/_chunks/index-xvj80c3a.js +30 -0
- package/dist/server/_chunks/index-xywjg2vc.js +100 -0
- package/dist/server/_chunks/index-y4d02znn.js +66 -0
- package/dist/server/_chunks/index-y7mzvq2q.js +110 -0
- package/dist/server/_chunks/index-ye9hmsvf.js +47 -0
- package/dist/server/_chunks/index-yhxkxghe.js +56 -0
- package/dist/server/_chunks/index-yrjkqtfj.js +86 -0
- package/dist/server/_chunks/index-z88qv16t.js +11 -0
- package/dist/server/_chunks/index-zfrwq472.js +154 -0
- package/dist/server/_chunks/index-zqpqyg8p.js +666 -0
- package/dist/server/_chunks/loader-5en7wpt5.js +80 -0
- package/dist/server/_chunks/modules-t92favpj.js +76 -0
- package/dist/server/_chunks/pipeline-4t9q43ht.js +836 -0
- package/dist/server/_chunks/production-385bw8df.js +55 -0
- package/dist/server/_chunks/proxy-config-60gprphe.js +23 -0
- package/dist/server/_chunks/proxy-gfhmktbk.js +35 -0
- package/dist/server/_chunks/router-xnrva921.js +501 -0
- package/dist/server/_chunks/routes-ht868pdc.js +66 -0
- package/dist/server/_chunks/run-d40d63ag.js +697 -0
- package/dist/server/_chunks/server-2p8fgqq2.js +1839 -0
- package/dist/server/_chunks/tsconfig-defaults-bcn34eqb.js +21 -0
- package/dist/server/_chunks/typegen-dvtcjtaw.js +37 -0
- package/dist/server/api/client-cache.js +14 -0
- package/dist/server/cli/index.js +375 -0
- package/dist/server/cli/start.js +158 -0
- package/dist/server/client/reference.js +16 -0
- package/dist/server/compat/next/cache.js +56 -0
- package/dist/server/compat/next/canonical-url.js +13 -0
- package/dist/server/compat/next/client-cache.js +57 -0
- package/dist/server/compat/next/client-navigation.js +232 -0
- package/dist/server/compat/next/client-only.js +1 -0
- package/dist/server/compat/next/client-script.js +178 -0
- package/dist/server/compat/next/client-server.js +34 -0
- package/dist/server/compat/next/config-headers.js +34 -0
- package/dist/server/compat/next/config-loader.js +25 -0
- package/dist/server/compat/next/config.js +10 -0
- package/dist/server/compat/next/constants.js +18 -0
- package/dist/server/compat/next/custom-server.js +10 -0
- package/dist/server/compat/next/dist/client/components/app-router-headers.js +48 -0
- package/dist/server/compat/next/dist/server/web/spec-extension/revalidate.js +27 -0
- package/dist/server/compat/next/dist/server/web/spec-extension/unstable-cache.js +25 -0
- package/dist/server/compat/next/dist/server/web/spec-extension/unstable-no-store.js +25 -0
- package/dist/server/compat/next/dynamic.js +21 -0
- package/dist/server/compat/next/error.js +112 -0
- package/dist/server/compat/next/font/cache.js +16 -0
- package/dist/server/compat/next/font/google.js +3 -0
- package/dist/server/compat/next/font/index.js +1 -0
- package/dist/server/compat/next/font/local.js +24 -0
- package/dist/server/compat/next/font/runtime-client.js +33 -0
- package/dist/server/compat/next/font/runtime.js +43 -0
- package/dist/server/compat/next/font/shared.js +22 -0
- package/dist/server/compat/next/form.js +129 -0
- package/dist/server/compat/next/head.js +10 -0
- package/dist/server/compat/next/headers.js +30 -0
- package/dist/server/compat/next/image/client.js +11 -0
- package/dist/server/compat/next/image/config.js +18 -0
- package/dist/server/compat/next/image/optimizer.js +25 -0
- package/dist/server/compat/next/image/patterns.js +12 -0
- package/dist/server/compat/next/image/props.js +16 -0
- package/dist/server/compat/next/image/shared.js +86 -0
- package/dist/server/compat/next/image/static-metadata.js +32 -0
- package/dist/server/compat/next/image/validate.js +8 -0
- package/dist/server/compat/next/image.js +59 -0
- package/dist/server/compat/next/index.js +1 -0
- package/dist/server/compat/next/legacy-image.js +78 -0
- package/dist/server/compat/next/legacy-request-apis.js +24 -0
- package/dist/server/compat/next/link-transform.js +15 -0
- package/dist/server/compat/next/link.js +14 -0
- package/dist/server/compat/next/navigation.js +191 -0
- package/dist/server/compat/next/offline.js +45 -0
- package/dist/server/compat/next/og.js +8 -0
- package/dist/server/compat/next/preferred-region.js +8 -0
- package/dist/server/compat/next/redirects.js +32 -0
- package/dist/server/compat/next/resource-hints.js +30 -0
- package/dist/server/compat/next/rewrites.js +43 -0
- package/dist/server/compat/next/root-params.js +121 -0
- package/dist/server/compat/next/route-state.js +23 -0
- package/dist/server/compat/next/router.js +103 -0
- package/dist/server/compat/next/script.js +37 -0
- package/dist/server/compat/next/server-only.js +1 -0
- package/dist/server/compat/next/server.js +131 -0
- package/dist/server/compat/next/svgr.js +14 -0
- package/dist/server/compat/next/telemetry.js +10 -0
- package/dist/server/compat/next/usage.js +13 -0
- package/dist/server/compat/next/user-agent.js +12 -0
- package/dist/server/compat/next/web-vitals.js +35 -0
- package/dist/server/compat/react/action-state.js +11 -0
- package/dist/server/compat/react/client-lite.js +83 -0
- package/dist/server/compat/react/client.js +131 -0
- package/dist/server/compat/react/compiler-runtime.js +42 -0
- package/dist/server/compat/react/dom-client.js +106 -0
- package/dist/server/compat/react/dom-react-server.js +37 -0
- package/dist/server/compat/react/dom-server.js +40 -0
- package/dist/server/compat/react/dom.js +52 -0
- package/dist/server/compat/react/hooks-extra.js +12 -0
- package/dist/server/compat/react/internals.js +14 -0
- package/dist/server/compat/react/parity.js +11 -0
- package/dist/server/compat/react/preact.js +113 -0
- package/dist/server/compat/react/react-server.js +133 -0
- package/dist/server/compat/react/router-shim.js +8 -0
- package/dist/server/compat/react/server-component-use.js +14 -0
- package/dist/server/compat/react/server-inserted-html.js +14 -0
- package/dist/server/compat/react/server.js +194 -0
- package/dist/server/compat/react/style-values.js +10 -0
- package/dist/server/compat/react/use.js +10 -0
- package/dist/server/compat/react/view-transition.js +12 -0
- package/dist/server/generation.json +1 -0
- package/package.json +4 -1
- package/reference/compat.md +1 -1
- package/reference/config.md +2 -2
- package/reference/dev.md +1 -1
- package/reference/getting-started.md +1 -1
- package/reference/rendering.md +4 -4
- package/src/api/dynamic.tsx +86 -4
- package/src/api/server.ts +24 -6
- package/src/cli/adapters/vercel-warm.ts +327 -62
- package/src/cli/adapters/vercel.ts +164 -1054
- package/src/cli/analyze.ts +3 -2
- package/src/cli/build/cache.ts +6 -6
- package/src/cli/build.ts +78 -45
- package/src/cli/index.ts +21 -3
- package/src/cli/serve/immutable.ts +31 -0
- package/src/cli/serve/pipeline.ts +97 -93
- package/src/cli/serve/standalone-worker.ts +8 -0
- package/src/cli/serve/standalone.ts +703 -0
- package/src/cli/start.ts +31 -8
- package/src/client/build.ts +1 -1
- package/src/client/chunk-fold.ts +19 -6
- package/src/client/react-tier.ts +3 -2
- package/src/client/reference-stub.ts +23 -36
- package/src/compat/actions/client-plugin.ts +4 -2
- package/src/compat/actions/config.ts +6 -5
- package/src/compat/actions/extensions.ts +5 -5
- package/src/compat/aliases.ts +8 -1
- package/src/compat/bundler/config.ts +88 -0
- package/src/compat/bundler/optimize-package-imports.ts +86 -26
- package/src/compat/bundler/relay-transform.ts +15 -3
- package/src/compat/bundler/require-context.ts +2 -1
- package/src/compat/bundler/webpack-loaders.ts +3 -2
- package/src/compat/bundler/worker.ts +2 -2
- package/src/compat/cache-control.ts +16 -8
- package/src/compat/css/inline-css.ts +1 -1
- package/src/compat/css/modules.ts +18 -5
- package/src/compat/export/build-complete.ts +1 -1
- package/src/compat/export/emit.ts +4 -4
- package/src/compat/export/standalone.ts +30 -65
- package/src/compat/image-optimizer/optimize.ts +1 -1
- package/src/compat/lifecycle/error-funnel.ts +1 -1
- package/src/compat/lifecycle/instrumentation-client.ts +4 -3
- package/src/compat/lifecycle/instrumentation.ts +117 -24
- package/src/compat/lifecycle/testmode.ts +3 -2
- package/src/compat/metadata-artifacts.ts +1 -1
- package/src/compat/next/config-loader.ts +140 -13
- package/src/compat/next/dynamic.tsx +10 -23
- package/src/compat/next/font/cache.ts +2 -1
- package/src/compat/next/font/runtime.ts +23 -3
- package/src/compat/next/og.ts +3 -3
- package/src/compat/next/usage.ts +3 -2
- package/src/compat/pages/api.ts +83 -14
- package/src/compat/pages/router.ts +30 -14
- package/src/compat/register/bundler.ts +3 -1
- package/src/compat/register/image.ts +1 -1
- package/src/compat/register/middleware.ts +1 -1
- package/src/compat/register/otel.ts +5 -9
- package/src/compat/register/render.ts +3 -1
- package/src/compat/register/use-cache.ts +3 -1
- package/src/compat/release.ts +46 -0
- package/src/compat/segment/serve.ts +1 -1
- package/src/compat/typecheck/check.ts +6 -4
- package/src/compat/validation/validate.ts +10 -7
- package/src/config.ts +76 -9
- package/src/css/assets.ts +213 -0
- package/src/css/build.ts +190 -247
- package/src/dev/client-chunk-store.ts +2 -1
- package/src/dev/restart/client-key.ts +2 -1
- package/src/dev/restart/global-css.ts +2 -1
- package/src/dev/restart/route-bundle-key.ts +2 -1
- package/src/dev/restart/route-facts.ts +2 -1
- package/src/dev/server.ts +34 -14
- package/src/extensions.ts +4 -0
- package/src/out-paths.ts +10 -0
- package/src/render/hooks.ts +13 -0
- package/src/render/renderer.ts +53 -33
- package/src/request/context.ts +9 -0
- package/src/resolve/dynamic.ts +7 -1
- package/src/resolve/engine.ts +2 -12
- package/src/resolve/imports.ts +12 -52
- package/src/resolve/package-json.ts +56 -0
- package/src/resolve/scan-facts.ts +250 -1
- package/src/routing/href.ts +10 -3
- package/src/routing/match.ts +287 -0
- package/src/routing/metadata-files.ts +20 -6
- package/src/routing/proxy-config.ts +137 -0
- package/src/routing/proxy.ts +35 -134
- package/src/routing/routes.ts +22 -281
- package/src/runtime/fingerprint.ts +23 -8
- package/src/runtime/load.ts +170 -0
- package/src/runtime/loader.ts +218 -44
- package/src/runtime/module-cache.ts +15 -1
- package/src/runtime/modules.ts +405 -82
- package/src/runtime/prebundle.ts +101 -0
- package/src/runtime/production.ts +456 -0
- package/src/runtime/release-graph.ts +342 -0
- package/src/runtime/vendor-build.ts +750 -17
- package/src/runtime/vendor.ts +16 -3
- package/src/types.ts +4 -3
- package/src/utils/directive.ts +40 -0
- package/src/utils/fs.ts +95 -4
- package/src/utils/resource-query.ts +12 -0
- package/src/cli/serve/entry.ts +0 -45
package/bin/pnext
CHANGED
|
@@ -64,11 +64,18 @@ case "$1" in
|
|
|
64
64
|
*) named=pnext ;;
|
|
65
65
|
esac
|
|
66
66
|
|
|
67
|
+
# The published package runs `start` from its publish-time prebundle, once its stamp marks it
|
|
68
|
+
# complete; the prebundle hands a build of any other source back to src.
|
|
69
|
+
entry=$dir/../src/cli/index.ts
|
|
70
|
+
if [ "$1" = start ] && [ -f "$dir/../dist/server/generation.json" ]; then
|
|
71
|
+
entry=$dir/../dist/server/cli/index.js
|
|
72
|
+
fi
|
|
73
|
+
|
|
67
74
|
bun_bin=$(command -v bun)
|
|
68
75
|
for candidate in "${XDG_CACHE_HOME:-$HOME/.cache}"/pnext/bin/bun-*/"$named"; do
|
|
69
76
|
if [ -x "$candidate" ] && [ "$candidate" -ef "$bun_bin" ]; then
|
|
70
|
-
exec "$candidate" --conditions=react-server "$
|
|
77
|
+
exec "$candidate" --conditions=react-server "$entry" "$@"
|
|
71
78
|
fi
|
|
72
79
|
done
|
|
73
80
|
|
|
74
|
-
exec bun --conditions=react-server "$
|
|
81
|
+
exec bun --conditions=react-server "$entry" "$@"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
SHIMMED_NEXT_DIST_PATHS,
|
|
4
|
+
compatAliasPlugin,
|
|
5
|
+
compatAliases,
|
|
6
|
+
compatSuspenseType,
|
|
7
|
+
ensureCompatSuspense,
|
|
8
|
+
missingCompatImportError,
|
|
9
|
+
nextCompatAliasEntries,
|
|
10
|
+
nextCompatAliases,
|
|
11
|
+
nextCompatEnabled,
|
|
12
|
+
reactCompatAliases,
|
|
13
|
+
reactCompatEnabled,
|
|
14
|
+
reactCompilerOptions,
|
|
15
|
+
reactServerLayerAliases,
|
|
16
|
+
rewriteNextFontSource
|
|
17
|
+
} from "./index-kdhxpwyq.js";
|
|
18
|
+
import"./index-0yjv5v47.js";
|
|
19
|
+
import"./index-6q7zvrap.js";
|
|
20
|
+
import"./index-4da76t62.js";
|
|
21
|
+
import"./index-71885zaq.js";
|
|
22
|
+
import"./index-bzd2ef7t.js";
|
|
23
|
+
import"./index-hdbwtdv2.js";
|
|
24
|
+
import"./index-grta8ap3.js";
|
|
25
|
+
import"./index-kresp2n8.js";
|
|
26
|
+
import"./index-e3a6yx84.js";
|
|
27
|
+
import"./index-pym1cezq.js";
|
|
28
|
+
import"./index-jt8e1pje.js";
|
|
29
|
+
import"./index-qjj6gddn.js";
|
|
30
|
+
import"./index-rt9qq1va.js";
|
|
31
|
+
export {
|
|
32
|
+
SHIMMED_NEXT_DIST_PATHS,
|
|
33
|
+
compatAliasPlugin,
|
|
34
|
+
compatAliases,
|
|
35
|
+
compatSuspenseType,
|
|
36
|
+
ensureCompatSuspense,
|
|
37
|
+
missingCompatImportError,
|
|
38
|
+
nextCompatAliasEntries,
|
|
39
|
+
nextCompatAliases,
|
|
40
|
+
nextCompatEnabled,
|
|
41
|
+
reactCompatAliases,
|
|
42
|
+
reactCompatEnabled,
|
|
43
|
+
reactCompilerOptions,
|
|
44
|
+
reactServerLayerAliases,
|
|
45
|
+
rewriteNextFontSource
|
|
46
|
+
};
|
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import"./index-jn9rbhrx.js";
|
|
3
|
+
import"./index-0r5eqfc7.js";
|
|
4
|
+
import {
|
|
5
|
+
matchRoute
|
|
6
|
+
} from "./index-8ct7rqy3.js";
|
|
7
|
+
import"./index-n629dy38.js";
|
|
8
|
+
import"./index-73z4esab.js";
|
|
9
|
+
import {
|
|
10
|
+
emittedAssetName,
|
|
11
|
+
publishEmittedAssets,
|
|
12
|
+
routeCssAssetNames
|
|
13
|
+
} from "./index-d158y67j.js";
|
|
14
|
+
import"./index-web361b8.js";
|
|
15
|
+
import"./index-fp8r0sqs.js";
|
|
16
|
+
import"./index-cjgqs13g.js";
|
|
17
|
+
import"./index-cn86z041.js";
|
|
18
|
+
import {
|
|
19
|
+
listFiles
|
|
20
|
+
} from "./index-4da76t62.js";
|
|
21
|
+
import {
|
|
22
|
+
loadConfig
|
|
23
|
+
} from "./index-71885zaq.js";
|
|
24
|
+
import"./index-bzd2ef7t.js";
|
|
25
|
+
import {
|
|
26
|
+
buildManifestFile
|
|
27
|
+
} from "./index-hdbwtdv2.js";
|
|
28
|
+
import {
|
|
29
|
+
bold,
|
|
30
|
+
cyan,
|
|
31
|
+
dim
|
|
32
|
+
} from "./index-6kp9r0d9.js";
|
|
33
|
+
import"./index-ras0sdab.js";
|
|
34
|
+
import"./index-grta8ap3.js";
|
|
35
|
+
import"./index-kresp2n8.js";
|
|
36
|
+
import"./index-e3a6yx84.js";
|
|
37
|
+
import"./index-x9c55pzy.js";
|
|
38
|
+
import"./index-d1jsmhhk.js";
|
|
39
|
+
import"./index-7wc9n8be.js";
|
|
40
|
+
import"./index-pym1cezq.js";
|
|
41
|
+
import"./index-jt8e1pje.js";
|
|
42
|
+
import"./index-zqpqyg8p.js";
|
|
43
|
+
import"./index-qjj6gddn.js";
|
|
44
|
+
import"./index-rt9qq1va.js";
|
|
45
|
+
|
|
46
|
+
// src/cli/analyze.ts
|
|
47
|
+
import { existsSync } from "fs";
|
|
48
|
+
import { readFile } from "fs/promises";
|
|
49
|
+
import path from "path";
|
|
50
|
+
import zlib from "zlib";
|
|
51
|
+
async function analyzeProject(root, options = {}) {
|
|
52
|
+
const config = await loadConfig(root);
|
|
53
|
+
if (!existsSync(config.outPath)) {
|
|
54
|
+
throw new Error(`No PNext output found at ${config.outPath}. Run pnext build first.`);
|
|
55
|
+
}
|
|
56
|
+
const target = analyzeTarget(config.outPath);
|
|
57
|
+
if (!target) {
|
|
58
|
+
throw new Error(`No production build found at ${config.outPath}. Run pnext build first.`);
|
|
59
|
+
}
|
|
60
|
+
const compression = options.compression ?? "gzip";
|
|
61
|
+
const files = await listFiles(target.root);
|
|
62
|
+
const rows = await Promise.all(files.map(async (file) => {
|
|
63
|
+
const bytes = await readFile(file);
|
|
64
|
+
return {
|
|
65
|
+
path: path.relative(target.root, file),
|
|
66
|
+
type: fileType(file),
|
|
67
|
+
rawBytes: bytes.length,
|
|
68
|
+
compressedBytes: compressedSize(bytes, compression)
|
|
69
|
+
};
|
|
70
|
+
}));
|
|
71
|
+
const routeBundles = await analyzeRouteBundles(config.outPath, target.root, rows, options.route);
|
|
72
|
+
return {
|
|
73
|
+
root: path.relative(config.root, target.root),
|
|
74
|
+
compression,
|
|
75
|
+
files: rows,
|
|
76
|
+
routeBundles,
|
|
77
|
+
totals: rows.reduce((total, row) => ({
|
|
78
|
+
rawBytes: total.rawBytes + row.rawBytes,
|
|
79
|
+
compressedBytes: total.compressedBytes + row.compressedBytes
|
|
80
|
+
}), { rawBytes: 0, compressedBytes: 0 })
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
async function analyzeRouteBundles(outPath, publicPath, files, routeFilter) {
|
|
84
|
+
const manifestPath = buildManifestFile(outPath);
|
|
85
|
+
if (!existsSync(manifestPath))
|
|
86
|
+
return [];
|
|
87
|
+
const manifest = JSON.parse(await readFile(manifestPath, "utf8"));
|
|
88
|
+
publishEmittedAssets(outPath, manifest.assetNames);
|
|
89
|
+
const pages = manifest.routes.filter((route) => route.kind === "page");
|
|
90
|
+
const selected = routeFilter ? filterAnalyzeRoutes(pages, routeFilter) : pages.map((route) => ({ route }));
|
|
91
|
+
if (routeFilter && selected.length === 0) {
|
|
92
|
+
throw new Error(`No route matches ${routeFilter}. Routes:
|
|
93
|
+
${pages.map((route) => publicRoutePath(route.route)).join(`
|
|
94
|
+
`)}`);
|
|
95
|
+
}
|
|
96
|
+
const sizes = new Map(files.map((file) => [toPosix(file.path), file]));
|
|
97
|
+
const contents = new Map;
|
|
98
|
+
async function js(pathname) {
|
|
99
|
+
const normalized = toPosix(pathname);
|
|
100
|
+
if (contents.has(normalized))
|
|
101
|
+
return contents.get(normalized) ?? "";
|
|
102
|
+
const text = await readFile(path.join(publicPath, normalized), "utf8");
|
|
103
|
+
contents.set(normalized, text);
|
|
104
|
+
return text;
|
|
105
|
+
}
|
|
106
|
+
const bundles = [];
|
|
107
|
+
for (const { route, pathname } of selected) {
|
|
108
|
+
bundles.push(await analyzeRouteBundle(outPath, route, sizes, js, pathname));
|
|
109
|
+
}
|
|
110
|
+
return bundles;
|
|
111
|
+
}
|
|
112
|
+
function filterAnalyzeRoutes(pages, filter) {
|
|
113
|
+
const normalized = filter === "/" ? filter : filter.replace(/\/+$/, "");
|
|
114
|
+
const direct = pages.filter((route) => route.route === normalized || publicRoutePath(route.route) === normalized);
|
|
115
|
+
if (direct.length > 0)
|
|
116
|
+
return direct.map((route) => ({ route }));
|
|
117
|
+
const matched = matchRoute(pages, normalized);
|
|
118
|
+
return matched ? [{ route: matched.route, pathname: normalized }] : [];
|
|
119
|
+
}
|
|
120
|
+
function publicRoutePath(route) {
|
|
121
|
+
return route.replace(/:([a-zA-Z0-9_]+)\*/g, "[...$1]").replace(/:([a-zA-Z0-9_]+)/g, "[$1]");
|
|
122
|
+
}
|
|
123
|
+
async function analyzeRouteBundle(outPath, route, sizes, js, pathname) {
|
|
124
|
+
const initial = new Set;
|
|
125
|
+
addIfExists(initial, sizes, routeHtmlPath(route, pathname));
|
|
126
|
+
const assetFile = (name) => `assets/${emittedAssetName({ outPath }, name)}`;
|
|
127
|
+
addIfExists(initial, sizes, assetFile("global.css"));
|
|
128
|
+
for (const asset of routeCssAssetNames(route))
|
|
129
|
+
addIfExists(initial, sizes, assetFile(asset));
|
|
130
|
+
addIfExists(initial, sizes, "_next/static/pnext/_buildManifest.js");
|
|
131
|
+
if (route.clientEntry) {
|
|
132
|
+
addIfExists(initial, sizes, route.clientEntry);
|
|
133
|
+
for (const asset of route.clientEntryImports ?? [])
|
|
134
|
+
addIfExists(initial, sizes, asset);
|
|
135
|
+
for (const dependency of await staticDependencies(route.clientEntry, sizes, js))
|
|
136
|
+
initial.add(dependency);
|
|
137
|
+
}
|
|
138
|
+
const visibleDynamic = [];
|
|
139
|
+
const dynamic = [];
|
|
140
|
+
const dynamicTargets = new Set;
|
|
141
|
+
const lazyShared = new Set;
|
|
142
|
+
if (route.clientEntry && sizes.has(toPosix(route.clientEntry))) {
|
|
143
|
+
const entrySource = await js(route.clientEntry);
|
|
144
|
+
for (const island of islandImports(entrySource, route.clientEntry)) {
|
|
145
|
+
const row = sizes.get(island.path);
|
|
146
|
+
if (!row)
|
|
147
|
+
continue;
|
|
148
|
+
const reference = route.clientReferences.find((item2) => item2.id === island.id);
|
|
149
|
+
const load = reference?.dynamic?.load === "visible" ? "visible" : "render";
|
|
150
|
+
dynamicTargets.add(island.path);
|
|
151
|
+
const exportName = reference?.exportName ?? "default";
|
|
152
|
+
const item = {
|
|
153
|
+
path: island.path,
|
|
154
|
+
id: island.id,
|
|
155
|
+
component: islandComponent(exportName, reference?.file, island.path),
|
|
156
|
+
exportName,
|
|
157
|
+
load,
|
|
158
|
+
rawBytes: row.rawBytes,
|
|
159
|
+
compressedBytes: row.compressedBytes
|
|
160
|
+
};
|
|
161
|
+
if (load === "visible")
|
|
162
|
+
visibleDynamic.push(item);
|
|
163
|
+
else
|
|
164
|
+
dynamic.push(item);
|
|
165
|
+
if (reference?.cssImports?.length)
|
|
166
|
+
addIfExists(lazyShared, sizes, `assets/${island.id}.css`);
|
|
167
|
+
for (const dependency of await staticDependencies(island.path, sizes, js)) {
|
|
168
|
+
if (!initial.has(dependency) && !dynamicTargets.has(dependency))
|
|
169
|
+
lazyShared.add(dependency);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
for (const asset of [
|
|
173
|
+
...route.clientDynamicImports ?? [],
|
|
174
|
+
...dynamicImportPaths(entrySource, route.clientEntry)
|
|
175
|
+
]) {
|
|
176
|
+
const importedPath = toPosix(asset);
|
|
177
|
+
if (initial.has(importedPath) || dynamicTargets.has(importedPath))
|
|
178
|
+
continue;
|
|
179
|
+
if (sizes.has(importedPath))
|
|
180
|
+
lazyShared.add(importedPath);
|
|
181
|
+
for (const dependency of await staticDependencies(importedPath, sizes, js)) {
|
|
182
|
+
if (!initial.has(dependency) && !dynamicTargets.has(dependency))
|
|
183
|
+
lazyShared.add(dependency);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return {
|
|
188
|
+
route: route.route,
|
|
189
|
+
page: route.client ? "client" : "server",
|
|
190
|
+
initial: bundleFiles([...initial], sizes),
|
|
191
|
+
visibleDynamic: visibleDynamic.sort((a, b) => b.compressedBytes - a.compressedBytes),
|
|
192
|
+
dynamic: dynamic.sort((a, b) => b.compressedBytes - a.compressedBytes),
|
|
193
|
+
lazyShared: bundleFiles([...lazyShared], sizes)
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function islandComponent(exportName, file, chunkPath) {
|
|
197
|
+
if (exportName !== "default")
|
|
198
|
+
return exportName;
|
|
199
|
+
const source = file ?? chunkPath.replace(/-[A-Z0-9]{8}\.js$/, ".js");
|
|
200
|
+
return path.posix.basename(toPosix(source)).replace(/\.[^.]+$/, "");
|
|
201
|
+
}
|
|
202
|
+
async function staticDependencies(entry, sizes, js, seen = new Set) {
|
|
203
|
+
const dependencies = new Set;
|
|
204
|
+
const normalized = toPosix(entry);
|
|
205
|
+
if (seen.has(normalized) || !sizes.has(normalized))
|
|
206
|
+
return dependencies;
|
|
207
|
+
seen.add(normalized);
|
|
208
|
+
for (const specifier of staticImports(await js(normalized))) {
|
|
209
|
+
const dependency = resolveBuiltImport(normalized, specifier);
|
|
210
|
+
if (!dependency || !sizes.has(dependency))
|
|
211
|
+
continue;
|
|
212
|
+
dependencies.add(dependency);
|
|
213
|
+
for (const transitive of await staticDependencies(dependency, sizes, js, seen))
|
|
214
|
+
dependencies.add(transitive);
|
|
215
|
+
}
|
|
216
|
+
return dependencies;
|
|
217
|
+
}
|
|
218
|
+
function islandImports(source, from) {
|
|
219
|
+
const imports = [];
|
|
220
|
+
const pattern = /\bid\s*:\s*"([^"]+)"\s*,\s*options\s*:\s*\{[^{}]*\}\s*,\s*load\s*:\s*\(\)\s*=>\s*(?:Promise\.all\(\[\s*)?import\(\s*"([^"]+)"\s*\)/g;
|
|
221
|
+
let match;
|
|
222
|
+
while (match = pattern.exec(source)) {
|
|
223
|
+
const id = match[1];
|
|
224
|
+
const specifier = match[2];
|
|
225
|
+
if (!id || !specifier)
|
|
226
|
+
continue;
|
|
227
|
+
const resolved = resolveBuiltImport(from, specifier);
|
|
228
|
+
if (resolved)
|
|
229
|
+
imports.push({ path: resolved, id });
|
|
230
|
+
}
|
|
231
|
+
return imports;
|
|
232
|
+
}
|
|
233
|
+
function dynamicImportPaths(source, from) {
|
|
234
|
+
const imports = [];
|
|
235
|
+
const pattern = /import\("([^"]+)"\)/g;
|
|
236
|
+
let match;
|
|
237
|
+
while (match = pattern.exec(source)) {
|
|
238
|
+
const specifier = match[1];
|
|
239
|
+
if (!specifier)
|
|
240
|
+
continue;
|
|
241
|
+
const resolved = resolveBuiltImport(from, specifier);
|
|
242
|
+
if (resolved)
|
|
243
|
+
imports.push(resolved);
|
|
244
|
+
}
|
|
245
|
+
return imports;
|
|
246
|
+
}
|
|
247
|
+
function staticImports(source) {
|
|
248
|
+
const imports = [];
|
|
249
|
+
const pattern = /import\s*(?:[^'"]*?from\s*)?["']([^'"]+)["']/g;
|
|
250
|
+
let match;
|
|
251
|
+
while (match = pattern.exec(source)) {
|
|
252
|
+
if (match[1])
|
|
253
|
+
imports.push(match[1]);
|
|
254
|
+
}
|
|
255
|
+
return imports;
|
|
256
|
+
}
|
|
257
|
+
function resolveBuiltImport(from, specifier) {
|
|
258
|
+
if (!specifier.startsWith("."))
|
|
259
|
+
return null;
|
|
260
|
+
return toPosix(path.posix.normalize(path.posix.join(path.posix.dirname(toPosix(from)), specifier)));
|
|
261
|
+
}
|
|
262
|
+
function addIfExists(items, sizes, pathname) {
|
|
263
|
+
const normalized = toPosix(pathname);
|
|
264
|
+
if (sizes.has(normalized))
|
|
265
|
+
items.add(normalized);
|
|
266
|
+
}
|
|
267
|
+
function bundleFiles(paths, sizes) {
|
|
268
|
+
return paths.map((pathname) => {
|
|
269
|
+
const row = sizes.get(pathname);
|
|
270
|
+
return row ? { path: pathname, rawBytes: row.rawBytes, compressedBytes: row.compressedBytes } : null;
|
|
271
|
+
}).filter((file) => Boolean(file)).sort((a, b) => b.compressedBytes - a.compressedBytes);
|
|
272
|
+
}
|
|
273
|
+
function routeHtmlPath(route, pathname) {
|
|
274
|
+
const target = pathname ?? prerenderedPathname(route) ?? route.route;
|
|
275
|
+
return target === "/" ? "index.html" : `${target.replace(/^\/+/, "")}/index.html`;
|
|
276
|
+
}
|
|
277
|
+
function prerenderedPathname(route) {
|
|
278
|
+
const params = route.prerenderedParams?.[0];
|
|
279
|
+
if (!params)
|
|
280
|
+
return;
|
|
281
|
+
return route.route.replace(/:([a-zA-Z0-9_]+)\*?/g, (_match, name) => {
|
|
282
|
+
const value = params[name];
|
|
283
|
+
return Array.isArray(value) ? value.join("/") : value ?? "";
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
function analyzeTarget(outPath) {
|
|
287
|
+
const publicPath = path.join(outPath, "static");
|
|
288
|
+
return existsSync(publicPath) ? { root: publicPath } : null;
|
|
289
|
+
}
|
|
290
|
+
function compressedSize(bytes, compression) {
|
|
291
|
+
if (compression === "brotli") {
|
|
292
|
+
return zlib.brotliCompressSync(bytes, {
|
|
293
|
+
params: { [zlib.constants.BROTLI_PARAM_QUALITY]: 11 }
|
|
294
|
+
}).length;
|
|
295
|
+
}
|
|
296
|
+
return zlib.gzipSync(bytes, { level: 9 }).length;
|
|
297
|
+
}
|
|
298
|
+
function fileType(file) {
|
|
299
|
+
if (file.endsWith(".html"))
|
|
300
|
+
return "html";
|
|
301
|
+
if (file.endsWith(".css"))
|
|
302
|
+
return "css";
|
|
303
|
+
if (file.endsWith(".js"))
|
|
304
|
+
return "js";
|
|
305
|
+
return "asset";
|
|
306
|
+
}
|
|
307
|
+
function toPosix(value) {
|
|
308
|
+
return value.split(path.sep).join("/");
|
|
309
|
+
}
|
|
310
|
+
function printAnalyzeResult(result, options) {
|
|
311
|
+
console.log(`PNext analyze: production build at ${dim(result.root)} (${result.compression})`);
|
|
312
|
+
printRouteBundles(result);
|
|
313
|
+
if (!options.route)
|
|
314
|
+
printAnalyzeFiles(result, { details: options.files });
|
|
315
|
+
}
|
|
316
|
+
function printRouteBundles(result) {
|
|
317
|
+
if (result.routeBundles.length === 0)
|
|
318
|
+
return;
|
|
319
|
+
console.log(`
|
|
320
|
+
${bold("Routes")}`);
|
|
321
|
+
for (const bundle of result.routeBundles) {
|
|
322
|
+
console.log(`
|
|
323
|
+
${cyan(bundle.route)} ${dim(`(${bundle.page} page)`)}`);
|
|
324
|
+
printBundleGroup("initial", bundle.initial, result.compression);
|
|
325
|
+
printDynamicBundleGroup("visible dynamic", bundle.visibleDynamic, result.compression);
|
|
326
|
+
printDynamicBundleGroup("dynamic", bundle.dynamic, result.compression);
|
|
327
|
+
printBundleGroup("shared after dynamic", bundle.lazyShared, result.compression);
|
|
328
|
+
}
|
|
329
|
+
console.log("");
|
|
330
|
+
}
|
|
331
|
+
function printBundleGroup(label, files, compression) {
|
|
332
|
+
if (files.length === 0)
|
|
333
|
+
return;
|
|
334
|
+
console.log(`
|
|
335
|
+
${bold(label.padEnd(22))} ${formatTotalSize(files, compression)}`);
|
|
336
|
+
printBundleFiles(files, compression, " ", rowColumns(files));
|
|
337
|
+
}
|
|
338
|
+
function printDynamicBundleGroup(label, files, compression) {
|
|
339
|
+
if (files.length === 0)
|
|
340
|
+
return;
|
|
341
|
+
console.log(`
|
|
342
|
+
${bold(label)}`);
|
|
343
|
+
const columns = rowColumns(files);
|
|
344
|
+
const componentWidth = Math.max(...files.map((file) => file.component.length));
|
|
345
|
+
const pathWidth = Math.max(...files.map((file) => file.path.length));
|
|
346
|
+
for (const file of files) {
|
|
347
|
+
console.log(` ${file.component.padEnd(componentWidth)} ${dim(file.path.padEnd(pathWidth))} ${formatFileSize(file, compression, columns)}`);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
function formatTotalSize(files, compression) {
|
|
351
|
+
const rawBytes = files.reduce((total, file) => total + file.rawBytes, 0);
|
|
352
|
+
const compressedBytes = files.reduce((total, file) => total + file.compressedBytes, 0);
|
|
353
|
+
return `${formatBytes(compressedBytes)} ${compression} ${dim(`${formatBytes(rawBytes)} raw`)}`;
|
|
354
|
+
}
|
|
355
|
+
function printAnalyzeFiles(result, options) {
|
|
356
|
+
const routeFiles = new Set(result.routeBundles.flatMap((bundle) => [
|
|
357
|
+
...bundle.initial.map((file) => file.path),
|
|
358
|
+
...bundle.visibleDynamic.map((file) => file.path),
|
|
359
|
+
...bundle.dynamic.map((file) => file.path),
|
|
360
|
+
...bundle.lazyShared.map((file) => file.path)
|
|
361
|
+
]));
|
|
362
|
+
const sorted = sortedAnalyzeFiles(result.files).filter((file) => !routeFiles.has(file.path));
|
|
363
|
+
if (sorted.length === 0)
|
|
364
|
+
return;
|
|
365
|
+
if (!options.details) {
|
|
366
|
+
console.log(`Other files: ${formatFileCount(sorted)} ${formatTotalSize(sorted, result.compression)}`);
|
|
367
|
+
console.log("List them: pnext analyze --files");
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
console.log(`${bold("Other files")}
|
|
371
|
+
`);
|
|
372
|
+
for (const type of ["html", "css", "js", "asset"]) {
|
|
373
|
+
const files = sorted.filter((file) => file.type === type);
|
|
374
|
+
if (files.length === 0)
|
|
375
|
+
continue;
|
|
376
|
+
console.log(bold(type));
|
|
377
|
+
printBundleFiles(files, result.compression, " ", rowColumns(files));
|
|
378
|
+
console.log("");
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
function printBundleFiles(files, compression, indent, columns) {
|
|
382
|
+
const pathWidth = Math.max(...files.map((file) => file.path.length));
|
|
383
|
+
for (const file of files) {
|
|
384
|
+
console.log(`${indent}${dim(file.path.padEnd(pathWidth))} ${formatFileSize(file, compression, columns)}`);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
function rowColumns(files) {
|
|
388
|
+
return {
|
|
389
|
+
compressedWidth: Math.max(...files.map((file) => formatBytes(file.compressedBytes).length)),
|
|
390
|
+
rawWidth: Math.max(...files.map((file) => formatBytes(file.rawBytes).length))
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
function formatFileSize(file, compression, columns) {
|
|
394
|
+
const compressed = formatBytes(file.compressedBytes).padStart(columns.compressedWidth);
|
|
395
|
+
const raw = `${formatBytes(file.rawBytes).padStart(columns.rawWidth)} raw`;
|
|
396
|
+
return `${compressed} ${compression} ${dim(raw)}`;
|
|
397
|
+
}
|
|
398
|
+
function formatFileCount(files) {
|
|
399
|
+
const counts = new Map;
|
|
400
|
+
for (const file of files)
|
|
401
|
+
counts.set(file.type, (counts.get(file.type) ?? 0) + 1);
|
|
402
|
+
return [...counts].map(([type, count]) => `${count} ${pluralFileType(type, count)}`).join(", ");
|
|
403
|
+
}
|
|
404
|
+
function pluralFileType(type, count) {
|
|
405
|
+
if (count === 1)
|
|
406
|
+
return type;
|
|
407
|
+
if (type === "js" || type === "css" || type === "html")
|
|
408
|
+
return type;
|
|
409
|
+
return `${type}s`;
|
|
410
|
+
}
|
|
411
|
+
function sortedAnalyzeFiles(files) {
|
|
412
|
+
return [...files].sort((a, b) => {
|
|
413
|
+
const typeDelta = analyzeTypeRank(a.type) - analyzeTypeRank(b.type);
|
|
414
|
+
if (typeDelta)
|
|
415
|
+
return typeDelta;
|
|
416
|
+
const sizeDelta = b.compressedBytes - a.compressedBytes;
|
|
417
|
+
if (sizeDelta)
|
|
418
|
+
return sizeDelta;
|
|
419
|
+
return a.path.localeCompare(b.path);
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
function analyzeTypeRank(type) {
|
|
423
|
+
switch (type) {
|
|
424
|
+
case "html":
|
|
425
|
+
return 0;
|
|
426
|
+
case "css":
|
|
427
|
+
return 1;
|
|
428
|
+
case "js":
|
|
429
|
+
return 2;
|
|
430
|
+
case "asset":
|
|
431
|
+
return 3;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
function formatBytes(bytes) {
|
|
435
|
+
if (bytes < 1024)
|
|
436
|
+
return `${bytes} B`;
|
|
437
|
+
const units = ["KB", "MB", "GB", "TB"];
|
|
438
|
+
let value = bytes / 1024;
|
|
439
|
+
let unitIndex = 0;
|
|
440
|
+
while (value >= 1024 && unitIndex < units.length - 1) {
|
|
441
|
+
value /= 1024;
|
|
442
|
+
unitIndex += 1;
|
|
443
|
+
}
|
|
444
|
+
return `${value >= 10 ? value.toFixed(1) : value.toFixed(2)} ${units[unitIndex]}`;
|
|
445
|
+
}
|
|
446
|
+
export {
|
|
447
|
+
analyzeProject,
|
|
448
|
+
printAnalyzeResult
|
|
449
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
registerCompatBootExtensions
|
|
4
|
+
} from "./index-xh1nbk46.js";
|
|
5
|
+
import"./index-2wfv4kvx.js";
|
|
6
|
+
import"./index-wm36rj4v.js";
|
|
7
|
+
import"./index-8ct7rqy3.js";
|
|
8
|
+
import"./index-kdhxpwyq.js";
|
|
9
|
+
import"./index-3ycf5ckv.js";
|
|
10
|
+
import"./index-0yjv5v47.js";
|
|
11
|
+
import"./index-6q7zvrap.js";
|
|
12
|
+
import"./index-z88qv16t.js";
|
|
13
|
+
import"./index-2vz0wzdn.js";
|
|
14
|
+
import"./index-m63czgq5.js";
|
|
15
|
+
import"./index-cjgqs13g.js";
|
|
16
|
+
import"./index-jks0x0a1.js";
|
|
17
|
+
import"./index-6b009mt0.js";
|
|
18
|
+
import"./index-4zzebszd.js";
|
|
19
|
+
import"./index-sq3kvz3g.js";
|
|
20
|
+
import"./index-ckkdpht5.js";
|
|
21
|
+
import"./index-4da76t62.js";
|
|
22
|
+
import"./index-71885zaq.js";
|
|
23
|
+
import"./index-bzd2ef7t.js";
|
|
24
|
+
import"./index-jcsjq3d1.js";
|
|
25
|
+
import"./index-hdbwtdv2.js";
|
|
26
|
+
import"./index-grta8ap3.js";
|
|
27
|
+
import"./index-kresp2n8.js";
|
|
28
|
+
import"./index-e3a6yx84.js";
|
|
29
|
+
import"./index-d1jsmhhk.js";
|
|
30
|
+
import"./index-7wc9n8be.js";
|
|
31
|
+
import"./index-pym1cezq.js";
|
|
32
|
+
import"./index-jt8e1pje.js";
|
|
33
|
+
import"./index-zqpqyg8p.js";
|
|
34
|
+
import"./index-qjj6gddn.js";
|
|
35
|
+
import"./index-rt9qq1va.js";
|
|
36
|
+
export {
|
|
37
|
+
registerCompatBootExtensions
|
|
38
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
buildClientReferenceCss,
|
|
4
|
+
buildGlobalCss,
|
|
5
|
+
buildNotFoundCss,
|
|
6
|
+
buildRouteCss,
|
|
7
|
+
buildRouteStylesheets,
|
|
8
|
+
clearGlobalCssSourceCache,
|
|
9
|
+
cssModuleClientPlugin,
|
|
10
|
+
globalCssSource,
|
|
11
|
+
globalCssSources,
|
|
12
|
+
globalCssSourcesForPaths,
|
|
13
|
+
hoistCssImports,
|
|
14
|
+
isCssFile,
|
|
15
|
+
prepareRouteCssChunks,
|
|
16
|
+
rewriteTailwindConfigDirectives,
|
|
17
|
+
runPostcssOffThread,
|
|
18
|
+
setGlobalCssSourceStore,
|
|
19
|
+
stopCssWorker,
|
|
20
|
+
warmCssPipeline,
|
|
21
|
+
warmCssWorker
|
|
22
|
+
} from "./index-n629dy38.js";
|
|
23
|
+
import"./index-73z4esab.js";
|
|
24
|
+
import {
|
|
25
|
+
assetHref,
|
|
26
|
+
assetPathname,
|
|
27
|
+
clearEmittedAssets,
|
|
28
|
+
cssModuleMapping,
|
|
29
|
+
emitFontCssStylesheet,
|
|
30
|
+
emittedAssetName,
|
|
31
|
+
emittedAssetNames,
|
|
32
|
+
publishEmittedAssets,
|
|
33
|
+
recordEmittedAsset,
|
|
34
|
+
registerCssRuntime,
|
|
35
|
+
routeCssAssetNames,
|
|
36
|
+
routeCssHref,
|
|
37
|
+
withAssetPrefix
|
|
38
|
+
} from "./index-d158y67j.js";
|
|
39
|
+
import"./index-web361b8.js";
|
|
40
|
+
import"./index-fp8r0sqs.js";
|
|
41
|
+
import"./index-cjgqs13g.js";
|
|
42
|
+
import"./index-4da76t62.js";
|
|
43
|
+
import"./index-bzd2ef7t.js";
|
|
44
|
+
import"./index-hdbwtdv2.js";
|
|
45
|
+
import"./index-6kp9r0d9.js";
|
|
46
|
+
import"./index-d1jsmhhk.js";
|
|
47
|
+
import"./index-7wc9n8be.js";
|
|
48
|
+
import"./index-pym1cezq.js";
|
|
49
|
+
import"./index-jt8e1pje.js";
|
|
50
|
+
import"./index-zqpqyg8p.js";
|
|
51
|
+
import"./index-qjj6gddn.js";
|
|
52
|
+
import"./index-rt9qq1va.js";
|
|
53
|
+
export {
|
|
54
|
+
assetHref,
|
|
55
|
+
assetPathname,
|
|
56
|
+
buildClientReferenceCss,
|
|
57
|
+
buildGlobalCss,
|
|
58
|
+
buildNotFoundCss,
|
|
59
|
+
buildRouteCss,
|
|
60
|
+
buildRouteStylesheets,
|
|
61
|
+
clearEmittedAssets,
|
|
62
|
+
clearGlobalCssSourceCache,
|
|
63
|
+
cssModuleClientPlugin,
|
|
64
|
+
cssModuleMapping,
|
|
65
|
+
emitFontCssStylesheet,
|
|
66
|
+
emittedAssetName,
|
|
67
|
+
emittedAssetNames,
|
|
68
|
+
globalCssSource,
|
|
69
|
+
globalCssSources,
|
|
70
|
+
globalCssSourcesForPaths,
|
|
71
|
+
hoistCssImports,
|
|
72
|
+
isCssFile,
|
|
73
|
+
prepareRouteCssChunks,
|
|
74
|
+
publishEmittedAssets,
|
|
75
|
+
recordEmittedAsset,
|
|
76
|
+
registerCssRuntime,
|
|
77
|
+
rewriteTailwindConfigDirectives,
|
|
78
|
+
routeCssAssetNames,
|
|
79
|
+
routeCssHref,
|
|
80
|
+
runPostcssOffThread,
|
|
81
|
+
setGlobalCssSourceStore,
|
|
82
|
+
stopCssWorker,
|
|
83
|
+
warmCssPipeline,
|
|
84
|
+
warmCssWorker,
|
|
85
|
+
withAssetPrefix
|
|
86
|
+
};
|