@ogygia/core 0.0.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +7 -1
- package/ambient.d.ts +194 -0
- package/dist/ClientBindingStub.svelte +6 -0
- package/dist/ClientBindingStub.svelte.d.ts +26 -0
- package/dist/KeepHost.svelte +19 -0
- package/dist/KeepHost.svelte.d.ts +10 -0
- package/dist/LakeBoundary.svelte +16 -0
- package/dist/LakeBoundary.svelte.d.ts +11 -0
- package/dist/LateIsland.svelte +22 -0
- package/dist/LateIsland.svelte.d.ts +15 -0
- package/dist/LateIslandAwait.svelte +17 -0
- package/dist/LateIslandAwait.svelte.d.ts +15 -0
- package/dist/LiveHost.svelte +19 -0
- package/dist/LiveHost.svelte.d.ts +10 -0
- package/dist/NestedProvider.svelte +13 -0
- package/dist/NestedProvider.svelte.d.ts +8 -0
- package/dist/OgygiaBoundary.svelte +5 -0
- package/dist/OgygiaBoundary.svelte.d.ts +17 -0
- package/dist/PromiseRegion.svelte +40 -0
- package/dist/PromiseRegion.svelte.d.ts +15 -0
- package/dist/PromiseRegionAwait.svelte +27 -0
- package/dist/PromiseRegionAwait.svelte.d.ts +15 -0
- package/dist/Provide.svelte +27 -0
- package/dist/Provide.svelte.d.ts +8 -0
- package/dist/RawHtml.svelte +9 -0
- package/dist/RawHtml.svelte.d.ts +6 -0
- package/dist/Region.svelte +1173 -0
- package/dist/Region.svelte.d.ts +68 -0
- package/dist/SlotBoundary.svelte +13 -0
- package/dist/SlotBoundary.svelte.d.ts +7 -0
- package/dist/app.d.ts +4 -0
- package/dist/app.js +3 -0
- package/dist/boundary.d.ts +35 -0
- package/dist/boundary.js +127 -0
- package/dist/build-cache.d.ts +13 -0
- package/dist/build-cache.js +77 -0
- package/dist/compiler/blank-styles.d.ts +1 -0
- package/dist/compiler/blank-styles.js +63 -0
- package/dist/compiler/bom.d.ts +2 -0
- package/dist/compiler/bom.js +15 -0
- package/dist/compiler/browser-full.d.ts +8 -0
- package/dist/compiler/browser-full.js +8 -0
- package/dist/compiler/browser.d.ts +11 -0
- package/dist/compiler/browser.js +11 -0
- package/dist/compiler/content/transportables.d.ts +26 -0
- package/dist/compiler/content/transportables.js +219 -0
- package/dist/compiler/ctx.d.ts +180 -0
- package/dist/compiler/ctx.js +183 -0
- package/dist/compiler/debarrel/barrel.d.ts +55 -0
- package/dist/compiler/debarrel/barrel.js +248 -0
- package/dist/compiler/debarrel/options.d.ts +67 -0
- package/dist/compiler/debarrel/options.js +31 -0
- package/dist/compiler/debarrel/parse.d.ts +65 -0
- package/dist/compiler/debarrel/parse.js +256 -0
- package/dist/compiler/debarrel/plugin.d.ts +31 -0
- package/dist/compiler/debarrel/plugin.js +190 -0
- package/dist/compiler/debarrel/rewrite.d.ts +27 -0
- package/dist/compiler/debarrel/rewrite.js +118 -0
- package/dist/compiler/debarrel/svelte.d.ts +13 -0
- package/dist/compiler/debarrel/svelte.js +56 -0
- package/dist/compiler/dev/css-scope.d.ts +16 -0
- package/dist/compiler/dev/css-scope.js +38 -0
- package/dist/compiler/dev/dev-hmr.d.ts +25 -0
- package/dist/compiler/dev/dev-hmr.js +29 -0
- package/dist/compiler/dev/hmr.d.ts +34 -0
- package/dist/compiler/dev/hmr.js +57 -0
- package/dist/compiler/dev/region-bytes.d.ts +34 -0
- package/dist/compiler/dev/region-bytes.js +126 -0
- package/dist/compiler/driver.d.ts +280 -0
- package/dist/compiler/driver.js +1352 -0
- package/dist/compiler/flags.d.ts +16 -0
- package/dist/compiler/flags.js +101 -0
- package/dist/compiler/fouc-css.d.ts +97 -0
- package/dist/compiler/fouc-css.js +335 -0
- package/dist/compiler/free-vars.d.ts +20 -0
- package/dist/compiler/free-vars.js +327 -0
- package/dist/compiler/host.d.ts +65 -0
- package/dist/compiler/host.js +51 -0
- package/dist/compiler/ids.d.ts +84 -0
- package/dist/compiler/ids.js +86 -0
- package/dist/compiler/index.d.ts +11 -0
- package/dist/compiler/index.js +11 -0
- package/dist/compiler/kit.d.ts +129 -0
- package/dist/compiler/kit.js +563 -0
- package/dist/compiler/link/build-output.d.ts +44 -0
- package/dist/compiler/link/build-output.js +147 -0
- package/dist/compiler/link/caps.d.ts +48 -0
- package/dist/compiler/link/caps.js +64 -0
- package/dist/compiler/link/context-detect.d.ts +23 -0
- package/dist/compiler/link/context-detect.js +137 -0
- package/dist/compiler/link/emit-gate.d.ts +11 -0
- package/dist/compiler/link/emit-gate.js +40 -0
- package/dist/compiler/link/entry-shim.d.ts +4 -0
- package/dist/compiler/link/entry-shim.js +29 -0
- package/dist/compiler/link/island-deps.d.ts +142 -0
- package/dist/compiler/link/island-deps.js +525 -0
- package/dist/compiler/link/manifest.d.ts +5 -0
- package/dist/compiler/link/manifest.js +9 -0
- package/dist/compiler/link/page-keys.d.ts +64 -0
- package/dist/compiler/link/page-keys.js +683 -0
- package/dist/compiler/link/registry-stub.d.ts +41 -0
- package/dist/compiler/link/registry-stub.js +212 -0
- package/dist/compiler/link/router-config.d.ts +11 -0
- package/dist/compiler/link/router-config.js +15 -0
- package/dist/compiler/link/router-css.d.ts +22 -0
- package/dist/compiler/link/router-css.js +142 -0
- package/dist/compiler/link/runtime-entry.d.ts +71 -0
- package/dist/compiler/link/runtime-entry.js +132 -0
- package/dist/compiler/link/server-manifest.d.ts +12 -0
- package/dist/compiler/link/server-manifest.js +45 -0
- package/dist/compiler/link/speculation.d.ts +17 -0
- package/dist/compiler/link/speculation.js +36 -0
- package/dist/compiler/link/transport.d.ts +31 -0
- package/dist/compiler/link/transport.js +67 -0
- package/dist/compiler/macros/bake.d.ts +20 -0
- package/dist/compiler/macros/bake.js +317 -0
- package/dist/compiler/macros/browser.d.ts +11 -0
- package/dist/compiler/macros/browser.js +69 -0
- package/dist/compiler/macros/dedent.d.ts +12 -0
- package/dist/compiler/macros/dedent.js +36 -0
- package/dist/compiler/macros/dollar.d.ts +15 -0
- package/dist/compiler/macros/dollar.js +387 -0
- package/dist/compiler/macros/pipeline.d.ts +31 -0
- package/dist/compiler/macros/pipeline.js +106 -0
- package/dist/compiler/macros/source.d.ts +6 -0
- package/dist/compiler/macros/source.js +127 -0
- package/dist/compiler/macros/store.d.ts +17 -0
- package/dist/compiler/macros/store.js +244 -0
- package/dist/compiler/macros/wire.d.ts +14 -0
- package/dist/compiler/macros/wire.js +160 -0
- package/dist/compiler/ownership-stamps.d.ts +6 -0
- package/dist/compiler/ownership-stamps.js +144 -0
- package/dist/compiler/parse/oxc.d.ts +34 -0
- package/dist/compiler/parse/oxc.js +59 -0
- package/dist/compiler/parse/scan.d.ts +43 -0
- package/dist/compiler/parse/scan.js +232 -0
- package/dist/compiler/program.d.ts +140 -0
- package/dist/compiler/program.js +242 -0
- package/dist/compiler/region/emit.d.ts +169 -0
- package/dist/compiler/region/emit.js +286 -0
- package/dist/compiler/region/identity.d.ts +28 -0
- package/dist/compiler/region/identity.js +75 -0
- package/dist/compiler/region/ir.d.ts +65 -0
- package/dist/compiler/region/ir.js +0 -0
- package/dist/compiler/region/transform.d.ts +178 -0
- package/dist/compiler/region/transform.js +1933 -0
- package/dist/compiler/script-request.d.ts +1 -0
- package/dist/compiler/script-request.js +43 -0
- package/dist/context-bridge.d.ts +65 -0
- package/dist/context-bridge.js +217 -0
- package/dist/context-registry.d.ts +40 -0
- package/dist/context-registry.js +15 -0
- package/dist/context.d.ts +72 -0
- package/dist/context.js +158 -0
- package/dist/current-region.d.ts +14 -0
- package/dist/current-region.js +36 -0
- package/dist/document.d.ts +41 -0
- package/dist/document.js +125 -0
- package/dist/entry-hydrate.d.ts +5 -0
- package/dist/entry-hydrate.js +42 -0
- package/dist/escape.d.ts +18 -0
- package/dist/escape.js +37 -0
- package/dist/events/bus.d.ts +33 -0
- package/dist/events/bus.js +153 -0
- package/dist/events/index.d.ts +4 -0
- package/dist/events/index.js +4 -0
- package/dist/events/schema.d.ts +389 -0
- package/dist/events/schema.js +23 -0
- package/dist/events/server-registry.d.ts +7 -0
- package/dist/events/server-registry.js +13 -0
- package/dist/events/sinks.d.ts +64 -0
- package/dist/events/sinks.js +85 -0
- package/dist/fn-transport.d.ts +33 -0
- package/dist/fn-transport.js +140 -0
- package/dist/frame.d.ts +20 -0
- package/dist/frame.js +19 -0
- package/dist/holes-record.d.ts +6 -0
- package/dist/holes-record.js +8 -0
- package/dist/hooks.d.ts +43 -0
- package/dist/hooks.js +1191 -0
- package/dist/hydration-info.d.ts +1 -0
- package/dist/hydration-info.js +31 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +17 -0
- package/dist/insights/attr-rules.d.ts +15 -0
- package/dist/insights/attr-rules.js +27 -0
- package/dist/insights/cpu.d.ts +82 -0
- package/dist/insights/cpu.js +177 -0
- package/dist/insights/fp-drift.d.ts +28 -0
- package/dist/insights/fp-drift.js +148 -0
- package/dist/insights/hole-segments.d.ts +26 -0
- package/dist/insights/hole-segments.js +50 -0
- package/dist/insights/html-diff.d.ts +25 -0
- package/dist/insights/html-diff.js +157 -0
- package/dist/insights/hydration-hazards.d.ts +36 -0
- package/dist/insights/hydration-hazards.js +136 -0
- package/dist/insights/hydration-status.d.ts +2 -0
- package/dist/insights/hydration-status.js +0 -0
- package/dist/insights/index.d.ts +14 -0
- package/dist/insights/index.js +12 -0
- package/dist/insights/page-assets.d.ts +211 -0
- package/dist/insights/page-assets.js +608 -0
- package/dist/insights/page-insights.d.ts +749 -0
- package/dist/insights/page-insights.js +2157 -0
- package/dist/insights/session-data.d.ts +108 -0
- package/dist/insights/session-data.js +0 -0
- package/dist/insights/session-insights.d.ts +121 -0
- package/dist/insights/session-insights.js +548 -0
- package/dist/insights/switch.d.ts +53 -0
- package/dist/insights/switch.js +91 -0
- package/dist/insights/testing-version.d.ts +19 -0
- package/dist/insights/testing-version.js +21 -0
- package/dist/insights/third-party.d.ts +75 -0
- package/dist/insights/third-party.js +160 -0
- package/dist/internal-instruments.d.ts +13 -0
- package/dist/internal-instruments.js +12 -0
- package/dist/internal-reconcile.d.ts +3 -0
- package/dist/internal-reconcile.js +3 -0
- package/dist/internal-register.d.ts +7 -0
- package/dist/internal-register.js +7 -0
- package/dist/internal-server.d.ts +7 -0
- package/dist/internal-server.js +7 -0
- package/dist/internal.d.ts +13 -0
- package/dist/internal.js +13 -0
- package/dist/island-graph.d.ts +36 -0
- package/dist/island-graph.js +89 -0
- package/dist/keep-fallback-marker.d.ts +7 -0
- package/dist/keep-fallback-marker.js +9 -0
- package/dist/keep-fallback.d.ts +13 -0
- package/dist/keep-fallback.js +39 -0
- package/dist/kit-paths.d.ts +2 -0
- package/dist/kit-paths.js +39 -0
- package/dist/late-region-registry.d.ts +40 -0
- package/dist/late-region-registry.js +36 -0
- package/dist/live-transport.d.ts +57 -0
- package/dist/live-transport.js +145 -0
- package/dist/markup.d.ts +4 -0
- package/dist/markup.js +4 -0
- package/dist/own-package.d.ts +15 -0
- package/dist/own-package.js +20 -0
- package/dist/page-defer.d.ts +33 -0
- package/dist/page-defer.js +35 -0
- package/dist/page-facts-script.d.ts +7 -0
- package/dist/page-facts-script.js +9 -0
- package/dist/page-seed-registry.d.ts +72 -0
- package/dist/page-seed-registry.js +31 -0
- package/dist/plugin/capability.d.ts +14 -0
- package/dist/plugin/capability.js +44 -0
- package/dist/plugin/client.d.ts +39 -0
- package/dist/plugin/client.js +6 -0
- package/dist/plugin/css.d.ts +3 -0
- package/dist/plugin/css.js +54 -0
- package/dist/plugin/facts.d.ts +42 -0
- package/dist/plugin/facts.js +37 -0
- package/dist/plugin/hooks.d.ts +33 -0
- package/dist/plugin/hooks.js +38 -0
- package/dist/plugin/index.d.ts +127 -0
- package/dist/plugin/index.js +26 -0
- package/dist/plugin/routes.d.ts +32 -0
- package/dist/plugin/routes.js +35 -0
- package/dist/plugin/server.d.ts +27 -0
- package/dist/plugin/server.js +92 -0
- package/dist/plugin/standard-schema.d.ts +27 -0
- package/dist/plugin/standard-schema.js +0 -0
- package/dist/plugin/testing.d.ts +13 -0
- package/dist/plugin/testing.js +54 -0
- package/dist/plugin/utils.d.ts +13 -0
- package/dist/plugin/utils.js +19 -0
- package/dist/portable-form.d.ts +22 -0
- package/dist/portable-form.js +52 -0
- package/dist/preference.d.ts +35 -0
- package/dist/preference.js +84 -0
- package/dist/preload.d.ts +1 -0
- package/dist/preload.js +21 -0
- package/dist/ref-watch.d.ts +31 -0
- package/dist/ref-watch.js +66 -0
- package/dist/ref.d.ts +124 -0
- package/dist/ref.js +272 -0
- package/dist/region-brand.d.ts +8 -0
- package/dist/region-brand.js +10 -0
- package/dist/region-core.d.ts +2 -0
- package/dist/region-core.js +1 -0
- package/dist/region-snippet.d.ts +73 -0
- package/dist/region-snippet.js +351 -0
- package/dist/region.d.ts +127 -0
- package/dist/region.js +162 -0
- package/dist/request-event.d.ts +1 -0
- package/dist/request-event.js +37 -0
- package/dist/router-css.d.ts +39 -0
- package/dist/router-css.js +66 -0
- package/dist/runtime/app-transport.d.ts +2 -0
- package/dist/runtime/app-transport.js +13 -0
- package/dist/runtime/beacon.d.ts +271 -0
- package/dist/runtime/beacon.js +2190 -0
- package/dist/runtime/boot-link.d.ts +1 -0
- package/dist/runtime/boot-link.js +44 -0
- package/dist/runtime/client-hooks.d.ts +5 -0
- package/dist/runtime/client-hooks.js +22 -0
- package/dist/runtime/client-plugins.d.ts +8 -0
- package/dist/runtime/client-plugins.js +34 -0
- package/dist/runtime/concurrency.d.ts +12 -0
- package/dist/runtime/concurrency.js +29 -0
- package/dist/runtime/connected.d.ts +12 -0
- package/dist/runtime/connected.js +16 -0
- package/dist/runtime/context.d.ts +1 -0
- package/dist/runtime/context.js +19 -0
- package/dist/runtime/core.d.ts +15 -0
- package/dist/runtime/core.js +1173 -0
- package/dist/runtime/drift-watch.d.ts +9 -0
- package/dist/runtime/drift-watch.js +60 -0
- package/dist/runtime/entry-locations.d.ts +33 -0
- package/dist/runtime/entry-locations.js +119 -0
- package/dist/runtime/foreign-props.d.ts +8 -0
- package/dist/runtime/foreign-props.js +14 -0
- package/dist/runtime/form-continuity.d.ts +10 -0
- package/dist/runtime/form-continuity.js +107 -0
- package/dist/runtime/frame-nav.d.ts +36 -0
- package/dist/runtime/frame-nav.js +225 -0
- package/dist/runtime/frame-store.d.ts +62 -0
- package/dist/runtime/frame-store.js +214 -0
- package/dist/runtime/frames.d.ts +1 -0
- package/dist/runtime/frames.js +25 -0
- package/dist/runtime/full.d.ts +4 -0
- package/dist/runtime/full.js +32 -0
- package/dist/runtime/hash.d.ts +41 -0
- package/dist/runtime/hash.js +79 -0
- package/dist/runtime/hole-facts.d.ts +8 -0
- package/dist/runtime/hole-facts.js +57 -0
- package/dist/runtime/host-classes.d.ts +24 -0
- package/dist/runtime/host-classes.js +43 -0
- package/dist/runtime/hydrate-core.d.ts +101 -0
- package/dist/runtime/hydrate-core.js +605 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/interaction-replay.d.ts +11 -0
- package/dist/runtime/interaction-replay.js +70 -0
- package/dist/runtime/interaction.d.ts +33 -0
- package/dist/runtime/interaction.js +217 -0
- package/dist/runtime/island-graph-preload.d.ts +13 -0
- package/dist/runtime/island-graph-preload.js +99 -0
- package/dist/runtime/kit-boot.d.ts +29 -0
- package/dist/runtime/kit-boot.js +60 -0
- package/dist/runtime/kit-page-thread.svelte.d.ts +1 -0
- package/dist/runtime/kit-page-thread.svelte.js +116 -0
- package/dist/runtime/lake-anchors.d.ts +13 -0
- package/dist/runtime/lake-anchors.js +19 -0
- package/dist/runtime/lakes.d.ts +15 -0
- package/dist/runtime/lakes.js +212 -0
- package/dist/runtime/live.d.ts +3 -0
- package/dist/runtime/live.js +17 -0
- package/dist/runtime/load-scheduler.d.ts +53 -0
- package/dist/runtime/load-scheduler.js +317 -0
- package/dist/runtime/morph.d.ts +42 -0
- package/dist/runtime/morph.js +671 -0
- package/dist/runtime/nav-handle.d.ts +25 -0
- package/dist/runtime/nav-handle.js +71 -0
- package/dist/runtime/nav-hooks.d.ts +2 -0
- package/dist/runtime/nav-hooks.js +23 -0
- package/dist/runtime/nearest-attr.d.ts +4 -0
- package/dist/runtime/nearest-attr.js +16 -0
- package/dist/runtime/observe.d.ts +27 -0
- package/dist/runtime/observe.js +63 -0
- package/dist/runtime/own-cost.d.ts +9 -0
- package/dist/runtime/own-cost.js +35 -0
- package/dist/runtime/ownership.d.ts +101 -0
- package/dist/runtime/ownership.js +115 -0
- package/dist/runtime/page-cache.d.ts +23 -0
- package/dist/runtime/page-cache.js +74 -0
- package/dist/runtime/page-defer.d.ts +14 -0
- package/dist/runtime/page-defer.js +103 -0
- package/dist/runtime/parse-html.d.ts +40 -0
- package/dist/runtime/parse-html.js +81 -0
- package/dist/runtime/reconcile.d.ts +41 -0
- package/dist/runtime/reconcile.js +194 -0
- package/dist/runtime/region-attrs.d.ts +95 -0
- package/dist/runtime/region-attrs.js +153 -0
- package/dist/runtime/region-endpoint-url.d.ts +76 -0
- package/dist/runtime/region-endpoint-url.js +169 -0
- package/dist/runtime/region-ids.d.ts +8 -0
- package/dist/runtime/region-ids.js +33 -0
- package/dist/runtime/remote-seeds.d.ts +2 -0
- package/dist/runtime/remote-seeds.js +21 -0
- package/dist/runtime/render-blocking.d.ts +2 -0
- package/dist/runtime/render-blocking.js +30 -0
- package/dist/runtime/restore.d.ts +34 -0
- package/dist/runtime/restore.js +390 -0
- package/dist/runtime/router-nav.d.ts +63 -0
- package/dist/runtime/router-nav.js +740 -0
- package/dist/runtime/router.d.ts +201 -0
- package/dist/runtime/router.js +593 -0
- package/dist/runtime/schedule.d.ts +49 -0
- package/dist/runtime/schedule.js +256 -0
- package/dist/runtime/seeds.d.ts +50 -0
- package/dist/runtime/seeds.js +208 -0
- package/dist/runtime/session.d.ts +52 -0
- package/dist/runtime/session.js +130 -0
- package/dist/runtime/sidecar.d.ts +3 -0
- package/dist/runtime/sidecar.js +56 -0
- package/dist/runtime/slots.d.ts +183 -0
- package/dist/runtime/slots.js +44 -0
- package/dist/runtime/spa-cacheable.d.ts +7 -0
- package/dist/runtime/spa-cacheable.js +18 -0
- package/dist/runtime/speculate-hint.d.ts +1 -0
- package/dist/runtime/speculate-hint.js +35 -0
- package/dist/runtime/svelte-warnings.d.ts +28 -0
- package/dist/runtime/svelte-warnings.js +71 -0
- package/dist/runtime/wire-classes.d.ts +3 -0
- package/dist/runtime/wire-classes.js +69 -0
- package/dist/runtime/wire-format.d.ts +7 -0
- package/dist/runtime/wire-format.js +22 -0
- package/dist/script.d.ts +134 -0
- package/dist/script.js +184 -0
- package/dist/seed-refs.d.ts +105 -0
- package/dist/seed-refs.js +487 -0
- package/dist/server/capability-lifetime.d.ts +28 -0
- package/dist/server/capability-lifetime.js +31 -0
- package/dist/server/dead-kit-resolves.d.ts +1 -0
- package/dist/server/dead-kit-resolves.js +39 -0
- package/dist/server/document-assembly.d.ts +30 -0
- package/dist/server/document-assembly.js +26 -0
- package/dist/server/document-tail.d.ts +113 -0
- package/dist/server/document-tail.js +208 -0
- package/dist/server/endpoint.d.ts +51 -0
- package/dist/server/endpoint.js +90 -0
- package/dist/server/entry-location.d.ts +8 -0
- package/dist/server/entry-location.js +29 -0
- package/dist/server/fingerprint.d.ts +1 -0
- package/dist/server/fingerprint.js +25 -0
- package/dist/server/head-presence.d.ts +45 -0
- package/dist/server/head-presence.js +156 -0
- package/dist/server/hmac.d.ts +38 -0
- package/dist/server/hmac.js +89 -0
- package/dist/server/hole-graph.d.ts +7 -0
- package/dist/server/hole-graph.js +71 -0
- package/dist/server/hole-urls.d.ts +3 -0
- package/dist/server/hole-urls.js +76 -0
- package/dist/server/html-scan.d.ts +19 -0
- package/dist/server/html-scan.js +60 -0
- package/dist/server/kit-context.d.ts +78 -0
- package/dist/server/kit-context.js +110 -0
- package/dist/server/late-wire.d.ts +22 -0
- package/dist/server/late-wire.js +28 -0
- package/dist/server/page-facts.d.ts +25 -0
- package/dist/server/page-facts.js +138 -0
- package/dist/server/page-seed.d.ts +33 -0
- package/dist/server/page-seed.js +60 -0
- package/dist/server/page-stream.d.ts +55 -0
- package/dist/server/page-stream.js +121 -0
- package/dist/server/payload.d.ts +6 -0
- package/dist/server/payload.js +22 -0
- package/dist/server/personal-response.d.ts +6 -0
- package/dist/server/personal-response.js +13 -0
- package/dist/server/props-wire.d.ts +56 -0
- package/dist/server/props-wire.js +178 -0
- package/dist/server/rate-limit.d.ts +22 -0
- package/dist/server/rate-limit.js +63 -0
- package/dist/server/region-css.d.ts +5 -0
- package/dist/server/region-css.js +30 -0
- package/dist/server/region-endpoint.d.ts +35 -0
- package/dist/server/region-endpoint.js +142 -0
- package/dist/server/region-props.d.ts +6 -0
- package/dist/server/region-props.js +44 -0
- package/dist/server/remote-seed-gate.d.ts +50 -0
- package/dist/server/remote-seed-gate.js +66 -0
- package/dist/server/render-cache.d.ts +26 -0
- package/dist/server/render-cache.js +51 -0
- package/dist/server/render-page.d.ts +51 -0
- package/dist/server/render-page.js +176 -0
- package/dist/server/render-region-html.d.ts +2 -0
- package/dist/server/render-region-html.js +19 -0
- package/dist/server/request-stats.d.ts +174 -0
- package/dist/server/request-stats.js +54 -0
- package/dist/server/reversible.d.ts +83 -0
- package/dist/server/reversible.js +994 -0
- package/dist/server/seed-shape.d.ts +22 -0
- package/dist/server/seed-shape.js +24 -0
- package/dist/server/shared-cache.d.ts +35 -0
- package/dist/server/shared-cache.js +104 -0
- package/dist/server/signing-key.d.ts +11 -0
- package/dist/server/signing-key.js +47 -0
- package/dist/server/sized-lru.d.ts +20 -0
- package/dist/server/sized-lru.js +68 -0
- package/dist/server/split-regions.d.ts +81 -0
- package/dist/server/split-regions.js +368 -0
- package/dist/server/stream-regions.d.ts +5 -0
- package/dist/server/stream-regions.js +36 -0
- package/dist/shared-state.d.ts +7 -0
- package/dist/shared-state.js +152 -0
- package/dist/shims/app-environment.d.ts +4 -0
- package/dist/shims/app-environment.js +6 -0
- package/dist/shims/app-navigation.d.ts +33 -0
- package/dist/shims/app-navigation.js +119 -0
- package/dist/shims/app-paths.d.ts +6 -0
- package/dist/shims/app-paths.js +18 -0
- package/dist/shims/app-state.svelte.d.ts +23 -0
- package/dist/shims/app-state.svelte.js +50 -0
- package/dist/shims/app-stores.d.ts +21 -0
- package/dist/shims/app-stores.js +54 -0
- package/dist/shims/kit-bridge.d.ts +29 -0
- package/dist/shims/kit-bridge.js +7 -0
- package/dist/shims/kit-remote/client-stub.d.ts +27 -0
- package/dist/shims/kit-remote/client-stub.js +43 -0
- package/dist/shims/kit-remote/paths-internal-stub.d.ts +3 -0
- package/dist/shims/kit-remote/paths-internal-stub.js +5 -0
- package/dist/shims/kit-remote/remote-cache.d.ts +49 -0
- package/dist/shims/kit-remote/remote-cache.js +73 -0
- package/dist/shims/kit-remote/state-stub.d.ts +8 -0
- package/dist/shims/kit-remote/state-stub.js +8 -0
- package/dist/shims/page-store.svelte.d.ts +39 -0
- package/dist/shims/page-store.svelte.js +77 -0
- package/dist/source.d.ts +29 -0
- package/dist/source.js +87 -0
- package/dist/store-transport.d.ts +86 -0
- package/dist/store-transport.js +229 -0
- package/dist/tool-fetches.d.ts +5 -0
- package/dist/tool-fetches.js +41 -0
- package/dist/transport.d.ts +48 -0
- package/dist/transport.js +181 -0
- package/dist/unscoped-css.d.ts +26 -0
- package/dist/unscoped-css.js +53 -0
- package/dist/vite/dev-maps.d.ts +33 -0
- package/dist/vite/dev-maps.js +140 -0
- package/dist/vite/index.d.ts +19 -0
- package/dist/vite/index.js +820 -0
- package/dist/vite/kit-dirs.d.ts +7 -0
- package/dist/vite/kit-dirs.js +67 -0
- package/dist/vite/late-island.d.ts +25 -0
- package/dist/vite/late-island.js +33 -0
- package/dist/vite/module-map.d.ts +8 -0
- package/dist/vite/module-map.js +144 -0
- package/dist/vite/options.d.ts +208 -0
- package/dist/vite/options.js +74 -0
- package/dist/vite/package-files.d.ts +3 -0
- package/dist/vite/package-files.js +84 -0
- package/dist/vite/paths.d.ts +45 -0
- package/dist/vite/paths.js +112 -0
- package/dist/vite/plugin-api.d.ts +166 -0
- package/dist/vite/plugin-api.js +212 -0
- package/dist/vite/profiler-maps.d.ts +23 -0
- package/dist/vite/profiler-maps.js +178 -0
- package/dist/vite/server-sourcemaps.d.ts +8 -0
- package/dist/vite/server-sourcemaps.js +80 -0
- package/dist/vite/sourcemaps.d.ts +18 -0
- package/dist/vite/sourcemaps.js +80 -0
- package/dist/vite/style-preprocess.d.ts +2 -0
- package/dist/vite/style-preprocess.js +96 -0
- package/package.json +180 -6
|
@@ -0,0 +1,608 @@
|
|
|
1
|
+
import { find_unscoped } from "../unscoped-css.js";
|
|
2
|
+
// src/insights/page-assets.ts
|
|
3
|
+
/**
|
|
4
|
+
* THE PAGE'S WEIGHT — every file the rendered document makes the browser fetch at start, found in
|
|
5
|
+
* the HTML and weighed through the app. Not only the islands: the page's own `<script>`s, every
|
|
6
|
+
* `modulepreload` (a Kit-hydrated page lists its whole start graph there), the modules an inline
|
|
7
|
+
* script imports (Kit's start/app entries), each module's STATIC imports followed to the end,
|
|
8
|
+
* stylesheets (and which of them block the first paint), fonts and images preloaded or in the
|
|
9
|
+
* markup. A page that ships 6 MB of JS shows 6 MB here, whatever made it.
|
|
10
|
+
*
|
|
11
|
+
* Two halves: `scan_assets` (pure: HTML in, references out — string scanning, no regex) and
|
|
12
|
+
* `weigh_assets` (fetches each once through the app, decoded + gzip-estimated sizes, follows static
|
|
13
|
+
* imports, bounded in time and count). The score (score.ts) reads the totals.
|
|
14
|
+
*/
|
|
15
|
+
/** Attributes of one start tag (`<tag a="1" b c='2'>`), names lower-cased; valueless → ''. */
|
|
16
|
+
function tag_attrs(tag) {
|
|
17
|
+
const out = /* @__PURE__ */ new Map();
|
|
18
|
+
let i = 1;
|
|
19
|
+
while (i < tag.length && !is_space(tag.charCodeAt(i)) && tag[i] !== ">" && tag[i] !== "/") i++;
|
|
20
|
+
while (i < tag.length) {
|
|
21
|
+
while (i < tag.length && (is_space(tag.charCodeAt(i)) || tag[i] === "/")) i++;
|
|
22
|
+
if (i >= tag.length || tag[i] === ">") break;
|
|
23
|
+
const ns = i;
|
|
24
|
+
while (i < tag.length && !is_space(tag.charCodeAt(i)) && tag[i] !== "=" && tag[i] !== ">" && tag[i] !== "/") i++;
|
|
25
|
+
const name = tag.slice(ns, i).toLowerCase();
|
|
26
|
+
while (i < tag.length && is_space(tag.charCodeAt(i))) i++;
|
|
27
|
+
let value = "";
|
|
28
|
+
if (tag[i] === "=") {
|
|
29
|
+
i++;
|
|
30
|
+
while (i < tag.length && is_space(tag.charCodeAt(i))) i++;
|
|
31
|
+
const q = tag[i];
|
|
32
|
+
if (q === "\"" || q === "'") {
|
|
33
|
+
const end = tag.indexOf(q, i + 1);
|
|
34
|
+
value = tag.slice(i + 1, end === -1 ? tag.length : end);
|
|
35
|
+
i = end === -1 ? tag.length : end + 1;
|
|
36
|
+
} else {
|
|
37
|
+
const vs = i;
|
|
38
|
+
while (i < tag.length && !is_space(tag.charCodeAt(i)) && tag[i] !== ">") i++;
|
|
39
|
+
value = tag.slice(vs, i);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (name && !out.has(name)) out.set(name, decode_entities(value));
|
|
43
|
+
}
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
46
|
+
function is_space(c) {
|
|
47
|
+
return c === 32 || c === 9 || c === 10 || c === 13 || c === 12;
|
|
48
|
+
}
|
|
49
|
+
function decode_entities(s) {
|
|
50
|
+
if (s.indexOf("&") === -1) return s;
|
|
51
|
+
return s.split("&").join("&").split(""").join("\"").split("'").join("'");
|
|
52
|
+
}
|
|
53
|
+
const FONT_EXT = /* @__PURE__ */ new Set([
|
|
54
|
+
"woff",
|
|
55
|
+
"woff2",
|
|
56
|
+
"ttf",
|
|
57
|
+
"otf"
|
|
58
|
+
]);
|
|
59
|
+
const IMG_EXT = /* @__PURE__ */ new Set([
|
|
60
|
+
"png",
|
|
61
|
+
"jpg",
|
|
62
|
+
"jpeg",
|
|
63
|
+
"gif",
|
|
64
|
+
"webp",
|
|
65
|
+
"avif",
|
|
66
|
+
"svg",
|
|
67
|
+
"ico"
|
|
68
|
+
]);
|
|
69
|
+
function ext_of(url) {
|
|
70
|
+
let end = url.length;
|
|
71
|
+
const q = url.indexOf("?");
|
|
72
|
+
if (q !== -1) end = q;
|
|
73
|
+
const h = url.indexOf("#");
|
|
74
|
+
if (h !== -1 && h < end) end = h;
|
|
75
|
+
const path = url.slice(0, end);
|
|
76
|
+
const dot = path.lastIndexOf(".");
|
|
77
|
+
return dot > path.lastIndexOf("/") ? path.slice(dot + 1).toLowerCase() : "";
|
|
78
|
+
}
|
|
79
|
+
function kind_of(url, as) {
|
|
80
|
+
if (as === "script" || as === "module") return "script";
|
|
81
|
+
if (as === "style") return "style";
|
|
82
|
+
if (as === "font") return "font";
|
|
83
|
+
if (as === "image") return "image";
|
|
84
|
+
const e = ext_of(url);
|
|
85
|
+
if (e === "js" || e === "mjs") return "script";
|
|
86
|
+
if (e === "css") return "style";
|
|
87
|
+
if (FONT_EXT.has(e)) return "font";
|
|
88
|
+
if (IMG_EXT.has(e)) return "image";
|
|
89
|
+
return "other";
|
|
90
|
+
}
|
|
91
|
+
/** `import("x")` / `import('x')` specifiers in a script's text (Kit's inline start). */
|
|
92
|
+
function dynamic_imports(text) {
|
|
93
|
+
const out = [];
|
|
94
|
+
let at = text.indexOf("import(");
|
|
95
|
+
while (at !== -1) {
|
|
96
|
+
let i = at + 7;
|
|
97
|
+
while (i < text.length && is_space(text.charCodeAt(i))) i++;
|
|
98
|
+
const q = text[i];
|
|
99
|
+
if (q === "\"" || q === "'" || q === "`") {
|
|
100
|
+
const end = text.indexOf(q, i + 1);
|
|
101
|
+
if (end !== -1) {
|
|
102
|
+
const spec = text.slice(i + 1, end);
|
|
103
|
+
if (spec && spec.indexOf("${") === -1) out.push(spec);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
at = text.indexOf("import(", at + 7);
|
|
107
|
+
}
|
|
108
|
+
return out;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The STATIC imports of a bundled module (`import{a}from"./x.js"`, `import"./y.js"`,
|
|
112
|
+
* `export*from"./z.js"`): specifiers after `from` / a bare `import` that look like module paths
|
|
113
|
+
* (relative or absolute, ending in .js/.mjs). Bundler output writes them plainly; a string that
|
|
114
|
+
* merely contains such text inflates nothing that does not exist — every hit is fetched, and a
|
|
115
|
+
* miss is dropped.
|
|
116
|
+
*/
|
|
117
|
+
function static_imports(code) {
|
|
118
|
+
const out = /* @__PURE__ */ new Set();
|
|
119
|
+
const grab = (from) => {
|
|
120
|
+
let i = from;
|
|
121
|
+
while (i < code.length && is_space(code.charCodeAt(i))) i++;
|
|
122
|
+
const q = code[i];
|
|
123
|
+
if (q !== "\"" && q !== "'") return;
|
|
124
|
+
const end = code.indexOf(q, i + 1);
|
|
125
|
+
if (end === -1 || end - i > 400) return;
|
|
126
|
+
const spec = code.slice(i + 1, end);
|
|
127
|
+
const e = ext_of(spec);
|
|
128
|
+
if ((spec.startsWith("./") || spec.startsWith("../") || spec.startsWith("/")) && (e === "js" || e === "mjs")) out.add(spec);
|
|
129
|
+
};
|
|
130
|
+
for (const word of ["from", "import"]) {
|
|
131
|
+
let at = code.indexOf(word);
|
|
132
|
+
while (at !== -1) {
|
|
133
|
+
const before = at > 0 ? code.charCodeAt(at - 1) : 32;
|
|
134
|
+
const ok = !(is_ident(before) || before === 46);
|
|
135
|
+
const next = code[at + word.length];
|
|
136
|
+
if (ok && next !== "(" && next !== void 0 && !is_ident(code.charCodeAt(at + word.length))) grab(at + word.length);
|
|
137
|
+
at = code.indexOf(word, at + word.length);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return [...out];
|
|
141
|
+
}
|
|
142
|
+
function is_ident(c) {
|
|
143
|
+
return c >= 48 && c <= 57 || c >= 65 && c <= 90 || c >= 97 && c <= 122 || c === 95 || c === 36;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* A Kit-hydrated page's route nodes: its inline start script passes `node_ids: [0, 5]` to
|
|
147
|
+
* `kit.start`, and `app.js` imports each node on demand (`import("../nodes/5.<hash>.js")`) — the
|
|
148
|
+
* page's OWN code, the heaviest part, reachable only through that dynamic import. Empty when the
|
|
149
|
+
* page is not Kit-hydrated.
|
|
150
|
+
*/
|
|
151
|
+
function kit_node_ids(script) {
|
|
152
|
+
const at = script.indexOf("node_ids:");
|
|
153
|
+
if (at === -1) return [];
|
|
154
|
+
const open = script.indexOf("[", at);
|
|
155
|
+
const close = script.indexOf("]", open);
|
|
156
|
+
if (open === -1 || close === -1 || open - at > 20) return [];
|
|
157
|
+
const out = [];
|
|
158
|
+
for (const part of script.slice(open + 1, close).split(",")) {
|
|
159
|
+
const n = Number(part.trim());
|
|
160
|
+
if (Number.isInteger(n) && n >= 0) out.push(n);
|
|
161
|
+
}
|
|
162
|
+
return out;
|
|
163
|
+
}
|
|
164
|
+
/** Every file the document asks for at start, in document order, deduped by URL (the first,
|
|
165
|
+
* strongest ask wins: a blocking stylesheet stays blocking). Inline script/style bytes counted. */
|
|
166
|
+
function scan_assets(html) {
|
|
167
|
+
const refs = [];
|
|
168
|
+
const seen = /* @__PURE__ */ new Set();
|
|
169
|
+
const add = (url, kind, via, blocking) => {
|
|
170
|
+
if (!url) return;
|
|
171
|
+
const u = url.trim();
|
|
172
|
+
if (!u || u.startsWith("data:") || u.startsWith("blob:") || u.startsWith("#") || u.startsWith("javascript:")) return;
|
|
173
|
+
if (seen.has(u)) return;
|
|
174
|
+
seen.add(u);
|
|
175
|
+
refs.push({
|
|
176
|
+
url: u,
|
|
177
|
+
kind,
|
|
178
|
+
blocking,
|
|
179
|
+
via
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
const inline = {
|
|
183
|
+
script: 0,
|
|
184
|
+
style: 0
|
|
185
|
+
};
|
|
186
|
+
let kit_nodes = [];
|
|
187
|
+
const head_end = html.indexOf("</head>");
|
|
188
|
+
let i = html.indexOf("<");
|
|
189
|
+
while (i !== -1) {
|
|
190
|
+
const c = html.charCodeAt(i + 1);
|
|
191
|
+
if (html.startsWith("<!--", i)) {
|
|
192
|
+
const end = html.indexOf("-->", i + 4);
|
|
193
|
+
i = end === -1 ? -1 : html.indexOf("<", end + 3);
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
if (!(c >= 97 && c <= 122 || c >= 65 && c <= 90)) {
|
|
197
|
+
i = html.indexOf("<", i + 1);
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
const close = html.indexOf(">", i);
|
|
201
|
+
if (close === -1) break;
|
|
202
|
+
const tag = html.slice(i, close + 1);
|
|
203
|
+
const name = tag_name(tag);
|
|
204
|
+
const in_head = head_end !== -1 && i < head_end;
|
|
205
|
+
if (name === "script") {
|
|
206
|
+
const a = tag_attrs(tag);
|
|
207
|
+
const end = html.indexOf("<\/script", close);
|
|
208
|
+
const body = end === -1 ? "" : html.slice(close + 1, end);
|
|
209
|
+
const type = (a.get("type") ?? "").toLowerCase();
|
|
210
|
+
const is_js = type === "" || type === "module" || type === "text/javascript" || type === "application/javascript";
|
|
211
|
+
if (a.has("src")) {
|
|
212
|
+
if (is_js) {
|
|
213
|
+
const n = refs.length;
|
|
214
|
+
add(a.get("src"), "script", "script", type !== "module" && !a.has("async") && !a.has("defer") && in_head);
|
|
215
|
+
if (refs.length > n && a.has("data-ogygia-runtime")) refs[n].runtime = true;
|
|
216
|
+
}
|
|
217
|
+
} else if (is_js) {
|
|
218
|
+
inline.script += body.length;
|
|
219
|
+
for (const spec of dynamic_imports(body)) add(spec, "script", "inline-import", false);
|
|
220
|
+
if (!kit_nodes.length) kit_nodes = kit_node_ids(body);
|
|
221
|
+
if (type === "module") for (const spec of static_imports(body)) add(spec, "script", "inline-import", false);
|
|
222
|
+
}
|
|
223
|
+
i = end === -1 ? -1 : html.indexOf("<", end + 8);
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
if (name === "style") {
|
|
227
|
+
const end = html.indexOf("</style", close);
|
|
228
|
+
if (end !== -1) inline.style += end - close - 1;
|
|
229
|
+
i = end === -1 ? -1 : html.indexOf("<", end + 7);
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
if (name === "link") {
|
|
233
|
+
const a = tag_attrs(tag);
|
|
234
|
+
const rel = words((a.get("rel") ?? "").toLowerCase());
|
|
235
|
+
const href = a.get("href");
|
|
236
|
+
if (rel.includes("stylesheet")) {
|
|
237
|
+
const media = (a.get("media") ?? "").toLowerCase();
|
|
238
|
+
if (!a.has("disabled")) add(href, "style", "stylesheet", media === "" || media === "all" || media === "screen");
|
|
239
|
+
} else if (rel.includes("modulepreload")) add(href, "script", "modulepreload", false);
|
|
240
|
+
else if (rel.includes("preload")) add(href, kind_of(href ?? "", (a.get("as") ?? "").toLowerCase()), "preload", false);
|
|
241
|
+
else if (rel.includes("icon")) add(href, "image", "img", false);
|
|
242
|
+
} else if (name === "img") {
|
|
243
|
+
const a = tag_attrs(tag);
|
|
244
|
+
if ((a.get("loading") ?? "").toLowerCase() !== "lazy") add(a.get("src"), "image", "img", false);
|
|
245
|
+
}
|
|
246
|
+
i = html.indexOf("<", close + 1);
|
|
247
|
+
}
|
|
248
|
+
return {
|
|
249
|
+
refs,
|
|
250
|
+
inline,
|
|
251
|
+
kit_nodes
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
function words(s) {
|
|
255
|
+
const out = [];
|
|
256
|
+
let w = "";
|
|
257
|
+
for (let i = 0; i < s.length; i++) if (is_space(s.charCodeAt(i))) {
|
|
258
|
+
if (w) out.push(w);
|
|
259
|
+
w = "";
|
|
260
|
+
} else w += s[i];
|
|
261
|
+
if (w) out.push(w);
|
|
262
|
+
return out;
|
|
263
|
+
}
|
|
264
|
+
function tag_name(tag) {
|
|
265
|
+
let e = 1;
|
|
266
|
+
while (e < tag.length && !is_space(tag.charCodeAt(e)) && tag[e] !== ">" && tag[e] !== "/") e++;
|
|
267
|
+
return tag.slice(1, e).toLowerCase();
|
|
268
|
+
}
|
|
269
|
+
/** Resolve a reference against the page (and a module's import against its module). */
|
|
270
|
+
function resolve_ref(ref, base) {
|
|
271
|
+
try {
|
|
272
|
+
const u = new URL(ref, base);
|
|
273
|
+
if (u.protocol !== "http:" && u.protocol !== "https:") return null;
|
|
274
|
+
return u.href;
|
|
275
|
+
} catch {
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
async function weigh_assets(opts) {
|
|
280
|
+
const { refs, inline, kit_nodes } = scan_assets(opts.html);
|
|
281
|
+
const node_marks = kit_nodes.map((n) => `/nodes/${n}.`);
|
|
282
|
+
const deadline = Date.now() + (opts.budget_ms ?? 6e3);
|
|
283
|
+
const max_files = opts.max_files ?? 400;
|
|
284
|
+
const origin = new URL(opts.page_url).origin;
|
|
285
|
+
const queue = [];
|
|
286
|
+
const queued = /* @__PURE__ */ new Set();
|
|
287
|
+
const push = (r) => {
|
|
288
|
+
const abs = resolve_ref(r.url, opts.page_url);
|
|
289
|
+
if (!abs || queued.has(abs)) return;
|
|
290
|
+
queued.add(abs);
|
|
291
|
+
queue.push({
|
|
292
|
+
...r,
|
|
293
|
+
url: abs
|
|
294
|
+
});
|
|
295
|
+
};
|
|
296
|
+
for (const r of refs) push(r);
|
|
297
|
+
const extra = opts.extra ?? [];
|
|
298
|
+
for (const r of extra) if (!r.lazy) push(r);
|
|
299
|
+
for (const r of extra) if (r.lazy) push(r);
|
|
300
|
+
const assets = [];
|
|
301
|
+
const missed = [];
|
|
302
|
+
const missed_why = [];
|
|
303
|
+
const miss = (url, why) => {
|
|
304
|
+
missed.push(url);
|
|
305
|
+
missed_why.push({
|
|
306
|
+
url,
|
|
307
|
+
why
|
|
308
|
+
});
|
|
309
|
+
};
|
|
310
|
+
let at = 0;
|
|
311
|
+
const worker = async () => {
|
|
312
|
+
while (at < queue.length && Date.now() < deadline && assets.length + missed.length < max_files) {
|
|
313
|
+
const r = queue[at++];
|
|
314
|
+
let w = opts.cache.get(r.url);
|
|
315
|
+
if (w === void 0) {
|
|
316
|
+
const got = await weigh_one(r, opts, deadline, origin);
|
|
317
|
+
if ("miss" in got) {
|
|
318
|
+
if (got.miss.startsWith("status ")) opts.cache.set(r.url, null);
|
|
319
|
+
miss(r.url, got.miss);
|
|
320
|
+
continue;
|
|
321
|
+
}
|
|
322
|
+
w = got;
|
|
323
|
+
opts.cache.set(r.url, w);
|
|
324
|
+
}
|
|
325
|
+
if (!w) {
|
|
326
|
+
miss(r.url, "an error status before (cached)");
|
|
327
|
+
continue;
|
|
328
|
+
}
|
|
329
|
+
const contains = r.kind === "script" || r.kind === "style" ? opts.contents_of?.(r.url) : null;
|
|
330
|
+
assets.push({
|
|
331
|
+
...r,
|
|
332
|
+
bytes: w.bytes,
|
|
333
|
+
wire: w.wire,
|
|
334
|
+
...contains?.length ? { contains } : {},
|
|
335
|
+
...w.vary ? { vary: w.vary } : {}
|
|
336
|
+
});
|
|
337
|
+
if (r.kind === "script" && w.imports) for (const spec of w.imports) push({
|
|
338
|
+
url: spec,
|
|
339
|
+
kind: "script",
|
|
340
|
+
blocking: false,
|
|
341
|
+
via: "static-import",
|
|
342
|
+
...r.lazy ? { lazy: true } : {},
|
|
343
|
+
...r.phase ? { phase: true } : {}
|
|
344
|
+
});
|
|
345
|
+
if (r.runtime && w.dynamic) for (const spec of w.dynamic) push({
|
|
346
|
+
url: spec,
|
|
347
|
+
kind: "script",
|
|
348
|
+
blocking: false,
|
|
349
|
+
via: "runtime-phase",
|
|
350
|
+
lazy: true,
|
|
351
|
+
phase: true
|
|
352
|
+
});
|
|
353
|
+
if (node_marks.length && w.dynamic) {
|
|
354
|
+
for (const spec of w.dynamic) if (node_marks.some((m) => spec.includes(m))) push({
|
|
355
|
+
url: spec,
|
|
356
|
+
kind: "script",
|
|
357
|
+
blocking: false,
|
|
358
|
+
via: "route-node"
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
while (at < queue.length && Date.now() < deadline && assets.length + missed.length < max_files) await Promise.all(Array.from({ length: Math.min(6, queue.length - at) }, worker));
|
|
364
|
+
for (let k = at; k < queue.length; k++) miss(queue[k].url, assets.length + missed.length >= max_files ? "file cap" : "budget");
|
|
365
|
+
const html_bytes = byte_length(opts.html);
|
|
366
|
+
const html_wire = opts.gzip ? opts.gzip(new TextEncoder().encode(opts.html)) : html_bytes;
|
|
367
|
+
const t = {
|
|
368
|
+
js: 0,
|
|
369
|
+
js_wire: 0,
|
|
370
|
+
css: 0,
|
|
371
|
+
css_wire: 0,
|
|
372
|
+
font: 0,
|
|
373
|
+
image: 0,
|
|
374
|
+
wire: html_wire,
|
|
375
|
+
lazy_js: 0,
|
|
376
|
+
blocking: 0,
|
|
377
|
+
blocking_count: 0,
|
|
378
|
+
js_files: 0
|
|
379
|
+
};
|
|
380
|
+
for (const a of assets) {
|
|
381
|
+
if (a.lazy) {
|
|
382
|
+
if (a.kind === "script") t.lazy_js += a.bytes;
|
|
383
|
+
continue;
|
|
384
|
+
}
|
|
385
|
+
t.wire += a.wire;
|
|
386
|
+
if (a.kind === "script") {
|
|
387
|
+
t.js += a.bytes;
|
|
388
|
+
t.js_wire += a.wire;
|
|
389
|
+
t.js_files++;
|
|
390
|
+
} else if (a.kind === "style") {
|
|
391
|
+
t.css += a.bytes;
|
|
392
|
+
t.css_wire += a.wire;
|
|
393
|
+
} else if (a.kind === "font") t.font += a.wire;
|
|
394
|
+
else if (a.kind === "image") t.image += a.wire;
|
|
395
|
+
if (a.blocking) {
|
|
396
|
+
t.blocking += a.bytes;
|
|
397
|
+
t.blocking_count++;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
const unscoped = find_unscoped(inline_style_text(opts.html)).map((u) => ({
|
|
401
|
+
...u,
|
|
402
|
+
in: "the document"
|
|
403
|
+
}));
|
|
404
|
+
for (const a of assets) if (a.kind === "style") {
|
|
405
|
+
for (const u of opts.cache.get(a.url)?.unscoped ?? []) if (!unscoped.some((x) => x.file === u.file)) unscoped.push({
|
|
406
|
+
...u,
|
|
407
|
+
in: a.url
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
return {
|
|
411
|
+
assets: assets.sort((x, y) => y.bytes - x.bytes),
|
|
412
|
+
missed,
|
|
413
|
+
...missed_why.length ? { missed_why } : {},
|
|
414
|
+
...unscoped.length ? { unscoped } : {},
|
|
415
|
+
html: {
|
|
416
|
+
bytes: html_bytes,
|
|
417
|
+
wire: html_wire
|
|
418
|
+
},
|
|
419
|
+
inline,
|
|
420
|
+
totals: t
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
/** The text of every inline `<style>` in the document (only there is a marker the build's: a page
|
|
424
|
+
* that quotes one in its content is not a fallback). */
|
|
425
|
+
function inline_style_text(html) {
|
|
426
|
+
let out = "";
|
|
427
|
+
let at = html.indexOf("<style");
|
|
428
|
+
while (at !== -1) {
|
|
429
|
+
const open = html.indexOf(">", at);
|
|
430
|
+
const close = open === -1 ? -1 : html.indexOf("</style", open);
|
|
431
|
+
if (close === -1) break;
|
|
432
|
+
out += html.slice(open + 1, close) + "\n";
|
|
433
|
+
at = html.indexOf("<style", close);
|
|
434
|
+
}
|
|
435
|
+
return out;
|
|
436
|
+
}
|
|
437
|
+
const MIN_CHANGE = 5120;
|
|
438
|
+
function assets_diff(a, b) {
|
|
439
|
+
const key = (x) => x.contains?.length ? "c:" + [...x.contains].sort().join("|") : "u:" + x.url;
|
|
440
|
+
const scripts = (p) => {
|
|
441
|
+
const m = /* @__PURE__ */ new Map();
|
|
442
|
+
for (const x of p.assets) if (x.kind === "script") m.set(key(x), x);
|
|
443
|
+
return m;
|
|
444
|
+
};
|
|
445
|
+
const A = scripts(a);
|
|
446
|
+
const B = scripts(b);
|
|
447
|
+
const name = (x) => {
|
|
448
|
+
const q = x.url.indexOf("?");
|
|
449
|
+
const path = q === -1 ? x.url : x.url.slice(0, q);
|
|
450
|
+
return path.slice(path.lastIndexOf("/") + 1);
|
|
451
|
+
};
|
|
452
|
+
const change = (x, av, bv) => ({
|
|
453
|
+
name: name(x),
|
|
454
|
+
...x.contains?.length ? { contains: x.contains.slice(0, 4) } : {},
|
|
455
|
+
a: av,
|
|
456
|
+
b: bv,
|
|
457
|
+
...x.lazy ? { lazy: true } : {}
|
|
458
|
+
});
|
|
459
|
+
const added = [];
|
|
460
|
+
const removed = [];
|
|
461
|
+
const grew = [];
|
|
462
|
+
const shrank = [];
|
|
463
|
+
const to_start = [];
|
|
464
|
+
const to_later = [];
|
|
465
|
+
for (const [k, x] of B) {
|
|
466
|
+
const was = A.get(k);
|
|
467
|
+
if (!was) {
|
|
468
|
+
if (x.bytes >= MIN_CHANGE) added.push(change(x, 0, x.bytes));
|
|
469
|
+
continue;
|
|
470
|
+
}
|
|
471
|
+
if (x.bytes - was.bytes >= MIN_CHANGE) grew.push(change(x, was.bytes, x.bytes));
|
|
472
|
+
else if (was.bytes - x.bytes >= MIN_CHANGE) shrank.push(change(x, was.bytes, x.bytes));
|
|
473
|
+
if (!!was.lazy !== !!x.lazy && x.bytes >= MIN_CHANGE) (x.lazy ? to_later : to_start).push(change(x, was.bytes, x.bytes));
|
|
474
|
+
}
|
|
475
|
+
for (const [k, x] of A) if (!B.has(k) && x.bytes >= MIN_CHANGE) removed.push(change(x, x.bytes, 0));
|
|
476
|
+
const by = (s) => s.sort((p, q) => Math.abs(q.b - q.a) - Math.abs(p.b - p.a)).slice(0, 5);
|
|
477
|
+
const big = (s) => s.sort((p, q) => q.b - p.b).slice(0, 5);
|
|
478
|
+
return {
|
|
479
|
+
js: {
|
|
480
|
+
a: a.totals.js,
|
|
481
|
+
b: b.totals.js
|
|
482
|
+
},
|
|
483
|
+
lazy_js: {
|
|
484
|
+
a: a.totals.lazy_js,
|
|
485
|
+
b: b.totals.lazy_js
|
|
486
|
+
},
|
|
487
|
+
added: by(added),
|
|
488
|
+
removed: by(removed),
|
|
489
|
+
grew: by(grew),
|
|
490
|
+
shrank: by(shrank),
|
|
491
|
+
to_start: big(to_start),
|
|
492
|
+
to_later: big(to_later)
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* SCRIPTS LOADED AT RUNTIME — what the browser fetched that neither the HTML nor any module's
|
|
497
|
+
* imports name: a script that loads more scripts (a CDN component library fetching its parts, a tag
|
|
498
|
+
* manager, a runtime's on-demand chunk). The server cannot see them coming; the profiler user's own
|
|
499
|
+
* visit saw them. `until`: the end of "at start" on the visit's clock (a lazy island woken by a
|
|
500
|
+
* scroll later does not count). Null when there are none.
|
|
501
|
+
*/
|
|
502
|
+
function runtime_scripts(assets, resources, origin, until) {
|
|
503
|
+
const named = new Set(assets.map((a) => a.url));
|
|
504
|
+
const by = /* @__PURE__ */ new Map();
|
|
505
|
+
let files = 0;
|
|
506
|
+
let bytes = 0;
|
|
507
|
+
let wire = 0;
|
|
508
|
+
let entries = 0;
|
|
509
|
+
const seen = /* @__PURE__ */ new Set();
|
|
510
|
+
for (const r of resources) {
|
|
511
|
+
if (r.type !== "script" || r.start > until || named.has(r.url) || seen.has(r.url) || r.url.includes("/__profiler/")) continue;
|
|
512
|
+
seen.add(r.url);
|
|
513
|
+
const size = r.size ?? 0;
|
|
514
|
+
files++;
|
|
515
|
+
bytes += size;
|
|
516
|
+
wire += r.transfer || Math.round(size / 3);
|
|
517
|
+
const who = serves(r.url, origin);
|
|
518
|
+
const g = by.get(who) ?? {
|
|
519
|
+
who,
|
|
520
|
+
files: 0,
|
|
521
|
+
bytes: 0
|
|
522
|
+
};
|
|
523
|
+
g.files++;
|
|
524
|
+
g.bytes += size;
|
|
525
|
+
by.set(who, g);
|
|
526
|
+
if (who === "this app" && r.url.slice(r.url.lastIndexOf("/") + 1).startsWith("og-region.")) entries++;
|
|
527
|
+
}
|
|
528
|
+
return files ? {
|
|
529
|
+
files,
|
|
530
|
+
bytes,
|
|
531
|
+
wire,
|
|
532
|
+
by: [...by.values()].sort((a, b) => b.bytes - a.bytes),
|
|
533
|
+
...entries ? { island_entries: entries } : {}
|
|
534
|
+
} : null;
|
|
535
|
+
}
|
|
536
|
+
/** `this app`, a CDN package (`@scope/name` after `/npm/`), or the host. */
|
|
537
|
+
function serves(url, origin) {
|
|
538
|
+
let u;
|
|
539
|
+
try {
|
|
540
|
+
u = new URL(url);
|
|
541
|
+
} catch {
|
|
542
|
+
return "unknown";
|
|
543
|
+
}
|
|
544
|
+
if (u.origin === origin) return "this app";
|
|
545
|
+
const at = u.pathname.indexOf("/npm/");
|
|
546
|
+
if (at !== -1) {
|
|
547
|
+
const parts = u.pathname.slice(at + 5).split("/");
|
|
548
|
+
const pkg = parts[0].startsWith("@") ? `${parts[0]}/${parts[1] ?? ""}` : parts[0];
|
|
549
|
+
const bare = pkg.lastIndexOf("@") > 0 ? pkg.slice(0, pkg.lastIndexOf("@")) : pkg;
|
|
550
|
+
return `${u.host} ${bare}`;
|
|
551
|
+
}
|
|
552
|
+
return u.host;
|
|
553
|
+
}
|
|
554
|
+
function byte_length(s) {
|
|
555
|
+
let n = 0;
|
|
556
|
+
for (let i = 0; i < s.length; i++) {
|
|
557
|
+
const c = s.charCodeAt(i);
|
|
558
|
+
if (c < 128) n += 1;
|
|
559
|
+
else if (c < 2048) n += 2;
|
|
560
|
+
else if (c >= 55296 && c <= 56319) {
|
|
561
|
+
n += 4;
|
|
562
|
+
i++;
|
|
563
|
+
} else n += 3;
|
|
564
|
+
}
|
|
565
|
+
return n;
|
|
566
|
+
}
|
|
567
|
+
async function weigh_one(r, opts, deadline, origin) {
|
|
568
|
+
const left = deadline - Date.now();
|
|
569
|
+
if (left < 100) return { miss: "budget" };
|
|
570
|
+
try {
|
|
571
|
+
const res = await Promise.race([opts.fetch_url(r.url.startsWith(origin) ? r.url.slice(origin.length) || "/" : r.url), new Promise((ok) => setTimeout(() => ok(null), left))]);
|
|
572
|
+
if (!res) return { miss: "timeout" };
|
|
573
|
+
if (!res.ok) return { miss: `status ${res.status}` };
|
|
574
|
+
const enc = res.headers.get("content-encoding");
|
|
575
|
+
const len = Number(res.headers.get("content-length"));
|
|
576
|
+
const buf = new Uint8Array(await res.arrayBuffer());
|
|
577
|
+
const wire = enc && Number.isFinite(len) && len > 0 ? len : opts.gzip && buf.byteLength > 256 ? opts.gzip(buf) : buf.byteLength;
|
|
578
|
+
const w = {
|
|
579
|
+
bytes: buf.byteLength,
|
|
580
|
+
wire
|
|
581
|
+
};
|
|
582
|
+
if (r.kind === "script") {
|
|
583
|
+
const code = new TextDecoder().decode(buf);
|
|
584
|
+
const imports = [];
|
|
585
|
+
for (const spec of static_imports(code)) {
|
|
586
|
+
const abs = resolve_ref(spec, r.url);
|
|
587
|
+
if (abs) imports.push(abs);
|
|
588
|
+
}
|
|
589
|
+
if (imports.length) w.imports = imports;
|
|
590
|
+
const dynamic = [];
|
|
591
|
+
for (const spec of dynamic_imports(code)) {
|
|
592
|
+
const abs = resolve_ref(spec, r.url);
|
|
593
|
+
if (abs) dynamic.push(abs);
|
|
594
|
+
}
|
|
595
|
+
if (dynamic.length) w.dynamic = dynamic;
|
|
596
|
+
} else if (r.kind === "style") {
|
|
597
|
+
const u = find_unscoped(new TextDecoder().decode(buf));
|
|
598
|
+
if (u.length) w.unscoped = u;
|
|
599
|
+
} else if (r.kind === "font") {
|
|
600
|
+
const vary = res.headers.get("vary");
|
|
601
|
+
if (vary) w.vary = vary.slice(0, 120);
|
|
602
|
+
}
|
|
603
|
+
return w;
|
|
604
|
+
} catch (e) {
|
|
605
|
+
return { miss: "error: " + (e instanceof Error ? e.message : String(e)).slice(0, 120) };
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
export { assets_diff, dynamic_imports, kit_node_ids, resolve_ref, runtime_scripts, scan_assets, static_imports, tag_attrs, weigh_assets };
|