@ogygia/devtools 0.12.0 → 0.13.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.
Files changed (79) hide show
  1. package/dist/app.d.ts +3 -0
  2. package/dist/app.js +9 -0
  3. package/dist/devtools/BoundaryOverlay.svelte +10 -6
  4. package/dist/devtools/Devtools.svelte +24 -18
  5. package/dist/devtools/IslandDetail.svelte +7 -5
  6. package/dist/devtools/PageTab.svelte +4 -2
  7. package/dist/devtools/ProfilerTab.svelte +8 -2
  8. package/dist/devtools/SessionTab.svelte +21 -8
  9. package/dist/devtools/highlight.js +14 -7
  10. package/dist/devtools/ledger-dom.js +6 -9
  11. package/dist/devtools/names.js +18 -17
  12. package/dist/devtools/page.d.ts +2 -0
  13. package/dist/devtools/page.js +37 -17
  14. package/dist/devtools/profile-store.d.ts +4 -9
  15. package/dist/devtools/profile-store.js +26 -21
  16. package/dist/devtools/session.d.ts +2 -0
  17. package/dist/devtools/session.js +48 -42
  18. package/dist/devtools/testing-engine.js +10 -1
  19. package/dist/devtools/ui-app.d.ts +3 -1
  20. package/dist/devtools/ui-app.js +9 -3
  21. package/dist/devtools/ui.js +83 -40
  22. package/dist/messages/build.d.ts +21 -0
  23. package/dist/messages/build.js +56 -0
  24. package/dist/messages/index.d.ts +3 -0
  25. package/dist/messages/index.js +3 -0
  26. package/dist/messages/runtime.d.ts +63 -0
  27. package/dist/messages/runtime.js +122 -0
  28. package/dist/profiler/async-io.d.ts +12 -7
  29. package/dist/profiler/async-io.js +94 -82
  30. package/dist/profiler/beacon-standalone.js +15 -6
  31. package/dist/profiler/busy.d.ts +13 -0
  32. package/dist/profiler/busy.js +45 -0
  33. package/dist/profiler/client.js +5 -24
  34. package/dist/profiler/embedded-maps.js +9 -5
  35. package/dist/profiler/gc.d.ts +5 -0
  36. package/dist/profiler/gc.js +75 -11
  37. package/dist/profiler/index.d.ts +23 -2
  38. package/dist/profiler/index.js +648 -373
  39. package/dist/profiler/net.d.ts +14 -6
  40. package/dist/profiler/net.js +61 -45
  41. package/dist/profiler/patterns.js +29 -1
  42. package/dist/profiler/source-scan.js +24 -12
  43. package/dist/profiler/storage/index.d.ts +14 -3
  44. package/dist/profiler/storage/index.js +41 -41
  45. package/dist/profiler/storage/postgres.d.ts +18 -5
  46. package/dist/profiler/storage/postgres.js +124 -85
  47. package/dist/profiler/storage/redis.d.ts +18 -5
  48. package/dist/profiler/storage/redis.js +160 -131
  49. package/dist/profiler/storage/sqlite.d.ts +15 -2
  50. package/dist/profiler/storage/sqlite.js +54 -48
  51. package/dist/profiler/ui/ComponentsTable.svelte +2 -2
  52. package/dist/profiler/ui/Dashboard.svelte +2 -3
  53. package/dist/profiler/ui/DownloadHtml.svelte +1 -0
  54. package/dist/profiler/ui/ExportButton.svelte +1 -0
  55. package/dist/profiler/ui/Flame.svelte +10 -4
  56. package/dist/profiler/ui/Flame.svelte.d.ts +0 -5
  57. package/dist/profiler/ui/FrameDetails.svelte +13 -2
  58. package/dist/profiler/ui/FrameDetails.svelte.d.ts +0 -6
  59. package/dist/profiler/ui/FunctionsTable.svelte +2 -2
  60. package/dist/profiler/ui/IslandsTable.svelte +2 -2
  61. package/dist/profiler/ui/OnThisPage.svelte +12 -4
  62. package/dist/profiler/ui/RunView.svelte +31 -27
  63. package/dist/profiler/ui/ShareLink.svelte +6 -1
  64. package/dist/profiler/ui/Sidebar.svelte +14 -9
  65. package/dist/profiler/ui/Treemap.svelte +11 -4
  66. package/dist/profiler/ui/Treemap.svelte.d.ts +0 -6
  67. package/dist/profiler/ui/WaitingTable.svelte +2 -2
  68. package/dist/profiler/ui/fake-progress.svelte.d.ts +7 -12
  69. package/dist/profiler/ui/fake-progress.svelte.js +57 -36
  70. package/dist/profiler/ui/press.js +4 -2
  71. package/dist/profiler/ui/row-anchor.svelte.d.ts +0 -6
  72. package/dist/profiler/ui/row-anchor.svelte.js +13 -8
  73. package/dist/profiler/ui/sort.svelte.d.ts +9 -6
  74. package/dist/profiler/ui/sort.svelte.js +34 -28
  75. package/dist/profiler/visit.d.ts +0 -1
  76. package/dist/profiler/visit.js +1 -2
  77. package/dist/server.js +27 -10
  78. package/dist/vite.js +3 -2
  79. package/package.json +13 -4
@@ -18,6 +18,7 @@ import { Forecast } from "./forecast.js";
18
18
  import { HeapGrowth, Pattern } from "./patterns.js";
19
19
  import { SpanRecord } from "./span.js";
20
20
  import { PageAssets } from "@ogygia/core/insights";
21
+ import { Flights } from "@ogygia/machine";
21
22
  import { Handle } from "@ogygia/core/plugin";
22
23
  export interface ProfilerOptions {
23
24
  /**
@@ -114,7 +115,7 @@ export interface ProfilerOptions {
114
115
  * own copies). Not a `devtools({ profiler })` option: a store is a live object the build-time
115
116
  * options cannot carry, so the app sets it at runtime with `setProfilerStore(store)` from
116
117
  * `@ogygia/devtools/profiler/storage`, in hooks.server.ts, and the server half passes it in here
117
- * when the profiler mounts. A store is `sqliteStore(...)`, `redisStore(...)` or `postgresStore(...)`
118
+ * when the profiler mounts. A store is `new SqliteStore(…)`, `new RedisStore(…)` or `new PostgresStore(…)`
118
119
  * from `@ogygia/devtools/profiler/storage/{sqlite,redis,postgres}`, or your own; every finished
119
120
  * report is written there and read back from there, so it survives the instance that made it and
120
121
  * a whole team shares one list. The store is dual-written: memory stays the hot cache, the store
@@ -147,7 +148,9 @@ export interface TrapStatus {
147
148
  window_ms: number;
148
149
  caught: number;
149
150
  keep: number;
150
- armed: boolean;
151
+ /** `armed`: it waits for or takes its next window; `stopped`: a window failed (the dashboard's
152
+ * note says why); `done`: it kept all it was asked to, or is not armed yet */
153
+ state: "armed" | "done" | "stopped";
151
154
  }
152
155
  interface UserTiming {
153
156
  name: string;
@@ -262,6 +265,24 @@ export interface StoredReport {
262
265
  * stacks); `null` for anything not shaped like a trace. Exported for the tests.
263
266
  */
264
267
  export declare function self_profile_to_cpuprofile(trace: unknown): CpuProfile | null;
268
+ /** A report's fetch of one of the app's files, through the app (`signal`: the weigh gave up). */
269
+ type FetchUrl = (url: string, signal?: AbortSignal) => Promise<Response>;
270
+ /** What one weigh is handed: the URL (its key), and the fetch of the report that asked. */
271
+ type WeighAsk = {
272
+ url: string;
273
+ fetch_url: FetchUrl;
274
+ };
275
+ /** Bytes per asset URL (`null`: the file is not there), measured once per process: a hashed
276
+ * asset never changes. */
277
+ type UrlWeights = Flights<WeighAsk, number | null, Pick<WeighAsk, "url">>;
278
+ /** The process's URL weights: an answer (bytes, or a file that is not there) is kept; a failure
279
+ * (a 5xx, a timeout, the network) is not, so the next report asks again. Reports weighing the
280
+ * same file at once share one fetch. */
281
+ export declare const url_weights: () => UrlWeights;
282
+ /** GET each URL through the app's own fetch and count its bytes — the JS weight of an island's
283
+ * closure. Kept per process (`url_weights`), a handful at a time, capped in time so a slow static
284
+ * host can never hold a report hostage: a URL not weighed within the budget is left out. */
285
+ export declare function weigh_urls(urls: Iterable<string>, fetch_url: FetchUrl, weights: UrlWeights, budget_ms?: number): Promise<Record<string, number>>;
265
286
  /**
266
287
  * Build a profiler handle. INTERNAL — the profiler is configured in vite.config.ts
267
288
  * (`ogygia({ profiler: true })`) and `ogygia.handle()` constructs + mounts this itself.