@ogygia/devtools 0.0.0 → 0.11.1
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 +24 -1
- package/dist/client.d.ts +3 -0
- package/dist/client.js +24 -0
- package/dist/devtools/BoundaryOverlay.svelte +396 -0
- package/dist/devtools/BoundaryOverlay.svelte.d.ts +19 -0
- package/dist/devtools/Devtools.svelte +663 -0
- package/dist/devtools/Devtools.svelte.d.ts +15 -0
- package/dist/devtools/HubTab.svelte +206 -0
- package/dist/devtools/HubTab.svelte.d.ts +11 -0
- package/dist/devtools/HydrationTab.svelte +237 -0
- package/dist/devtools/HydrationTab.svelte.d.ts +13 -0
- package/dist/devtools/IslandDetail.svelte +615 -0
- package/dist/devtools/IslandDetail.svelte.d.ts +15 -0
- package/dist/devtools/LedgerTab.svelte +287 -0
- package/dist/devtools/LedgerTab.svelte.d.ts +11 -0
- package/dist/devtools/LensTab.svelte +290 -0
- package/dist/devtools/LensTab.svelte.d.ts +19 -0
- package/dist/devtools/NavTab.svelte +229 -0
- package/dist/devtools/NavTab.svelte.d.ts +11 -0
- package/dist/devtools/PageTab.svelte +1122 -0
- package/dist/devtools/PageTab.svelte.d.ts +15 -0
- package/dist/devtools/ProfilerTab.svelte +755 -0
- package/dist/devtools/ProfilerTab.svelte.d.ts +15 -0
- package/dist/devtools/PropsTree.svelte +155 -0
- package/dist/devtools/PropsTree.svelte.d.ts +15 -0
- package/dist/devtools/SessionTab.svelte +796 -0
- package/dist/devtools/SessionTab.svelte.d.ts +11 -0
- package/dist/devtools/TimelineTab.svelte +267 -0
- package/dist/devtools/TimelineTab.svelte.d.ts +11 -0
- package/dist/devtools/WireTab.svelte +149 -0
- package/dist/devtools/WireTab.svelte.d.ts +11 -0
- package/dist/devtools/bytes.d.ts +70 -0
- package/dist/devtools/bytes.js +82 -0
- package/dist/devtools/cache-headers.d.ts +20 -0
- package/dist/devtools/cache-headers.js +81 -0
- package/dist/devtools/highlight.d.ts +7 -0
- package/dist/devtools/highlight.js +83 -0
- package/dist/devtools/hydration.d.ts +48 -0
- package/dist/devtools/hydration.js +93 -0
- package/dist/devtools/index.d.ts +3 -0
- package/dist/devtools/index.js +3 -0
- package/dist/devtools/ledger-dom.d.ts +7 -0
- package/dist/devtools/ledger-dom.js +151 -0
- package/dist/devtools/leftovers.d.ts +77 -0
- package/dist/devtools/leftovers.js +319 -0
- package/dist/devtools/names.d.ts +1 -0
- package/dist/devtools/names.js +34 -0
- package/dist/devtools/page.d.ts +96 -0
- package/dist/devtools/page.js +957 -0
- package/dist/devtools/profile-anchors.d.ts +22 -0
- package/dist/devtools/profile-anchors.js +135 -0
- package/dist/devtools/profile-store.d.ts +175 -0
- package/dist/devtools/profile-store.js +239 -0
- package/dist/devtools/regions.d.ts +77 -0
- package/dist/devtools/regions.js +132 -0
- package/dist/devtools/session.d.ts +31 -0
- package/dist/devtools/session.js +455 -0
- package/dist/devtools/since-load.d.ts +50 -0
- package/dist/devtools/since-load.js +89 -0
- package/dist/devtools/source-lines.d.ts +24 -0
- package/dist/devtools/source-lines.js +106 -0
- package/dist/devtools/styles.d.ts +52 -0
- package/dist/devtools/styles.js +248 -0
- package/dist/devtools/testing-engine.d.ts +83 -0
- package/dist/devtools/testing-engine.js +220 -0
- package/dist/devtools/ui-app.d.ts +5 -0
- package/dist/devtools/ui-app.js +69 -0
- package/dist/devtools/ui.d.ts +50 -0
- package/dist/devtools/ui.js +175 -0
- package/dist/profiler/alloc.d.ts +75 -0
- package/dist/profiler/alloc.js +76 -0
- package/dist/profiler/analyze.d.ts +437 -0
- package/dist/profiler/analyze.js +1941 -0
- package/dist/profiler/app-path.d.ts +7 -0
- package/dist/profiler/app-path.js +26 -0
- package/dist/profiler/async-io.d.ts +58 -0
- package/dist/profiler/async-io.js +187 -0
- package/dist/profiler/beacon-standalone.d.ts +4 -0
- package/dist/profiler/beacon-standalone.js +409 -0
- package/dist/profiler/browser-findings.d.ts +25 -0
- package/dist/profiler/browser-findings.js +260 -0
- package/dist/profiler/byte-strip.d.ts +58 -0
- package/dist/profiler/byte-strip.js +228 -0
- package/dist/profiler/client-files.d.ts +16 -0
- package/dist/profiler/client-files.js +60 -0
- package/dist/profiler/client-windows.d.ts +49 -0
- package/dist/profiler/client-windows.js +95 -0
- package/dist/profiler/client.d.ts +40 -0
- package/dist/profiler/client.js +82 -0
- package/dist/profiler/compare.d.ts +308 -0
- package/dist/profiler/compare.js +733 -0
- package/dist/profiler/compress.d.ts +10 -0
- package/dist/profiler/compress.js +36 -0
- package/dist/profiler/contention.d.ts +60 -0
- package/dist/profiler/contention.js +86 -0
- package/dist/profiler/crypto.d.ts +19 -0
- package/dist/profiler/crypto.js +101 -0
- package/dist/profiler/doc-diff.d.ts +47 -0
- package/dist/profiler/doc-diff.js +214 -0
- package/dist/profiler/dom-diff.d.ts +43 -0
- package/dist/profiler/dom-diff.js +121 -0
- package/dist/profiler/drill.d.ts +89 -0
- package/dist/profiler/drill.js +553 -0
- package/dist/profiler/embedded-maps.d.ts +37 -0
- package/dist/profiler/embedded-maps.js +135 -0
- package/dist/profiler/env.d.ts +6 -0
- package/dist/profiler/env.js +10 -0
- package/dist/profiler/forecast.d.ts +76 -0
- package/dist/profiler/forecast.js +225 -0
- package/dist/profiler/frames.d.ts +11 -0
- package/dist/profiler/frames.js +42 -0
- package/dist/profiler/gc.d.ts +144 -0
- package/dist/profiler/gc.js +271 -0
- package/dist/profiler/hole-slots.d.ts +31 -0
- package/dist/profiler/hole-slots.js +90 -0
- package/dist/profiler/index.d.ts +288 -0
- package/dist/profiler/index.js +4921 -0
- package/dist/profiler/insights.d.ts +96 -0
- package/dist/profiler/insights.js +239 -0
- package/dist/profiler/ledger.d.ts +121 -0
- package/dist/profiler/ledger.js +440 -0
- package/dist/profiler/lineage.d.ts +81 -0
- package/dist/profiler/lineage.js +359 -0
- package/dist/profiler/module-map.d.ts +12 -0
- package/dist/profiler/module-map.js +94 -0
- package/dist/profiler/net.d.ts +169 -0
- package/dist/profiler/net.js +586 -0
- package/dist/profiler/on-demand.d.ts +11 -0
- package/dist/profiler/on-demand.js +15 -0
- package/dist/profiler/own-requests.d.ts +9 -0
- package/dist/profiler/own-requests.js +17 -0
- package/dist/profiler/patterns.d.ts +476 -0
- package/dist/profiler/patterns.js +2203 -0
- package/dist/profiler/profiler-router.d.ts +245 -0
- package/dist/profiler/profiler-router.js +113 -0
- package/dist/profiler/refresh-stub.d.ts +2 -0
- package/dist/profiler/refresh-stub.js +37 -0
- package/dist/profiler/report.d.ts +1404 -0
- package/dist/profiler/report.js +2638 -0
- package/dist/profiler/river.d.ts +65 -0
- package/dist/profiler/river.js +298 -0
- package/dist/profiler/route-files.d.ts +22 -0
- package/dist/profiler/route-files.js +55 -0
- package/dist/profiler/route-imports.d.ts +14 -0
- package/dist/profiler/route-imports.js +83 -0
- package/dist/profiler/saving.d.ts +22 -0
- package/dist/profiler/saving.js +42 -0
- package/dist/profiler/score.d.ts +109 -0
- package/dist/profiler/score.js +261 -0
- package/dist/profiler/session-cookie.d.ts +28 -0
- package/dist/profiler/session-cookie.js +45 -0
- package/dist/profiler/sink.d.ts +81 -0
- package/dist/profiler/sink.js +124 -0
- package/dist/profiler/site-fixes.d.ts +25 -0
- package/dist/profiler/site-fixes.js +62 -0
- package/dist/profiler/source-scan.d.ts +210 -0
- package/dist/profiler/source-scan.js +1724 -0
- package/dist/profiler/span.d.ts +90 -0
- package/dist/profiler/span.js +109 -0
- package/dist/profiler/stacks.d.ts +43 -0
- package/dist/profiler/stacks.js +107 -0
- package/dist/profiler/standalone.d.ts +27 -0
- package/dist/profiler/standalone.js +98 -0
- package/dist/profiler/steps.d.ts +39 -0
- package/dist/profiler/steps.js +74 -0
- package/dist/profiler/storage/index.d.ts +87 -0
- package/dist/profiler/storage/index.js +76 -0
- package/dist/profiler/storage/postgres.d.ts +12 -0
- package/dist/profiler/storage/postgres.js +94 -0
- package/dist/profiler/storage/redis.d.ts +19 -0
- package/dist/profiler/storage/redis.js +148 -0
- package/dist/profiler/storage/sqlite.d.ts +2 -0
- package/dist/profiler/storage/sqlite.js +85 -0
- package/dist/profiler/storage/visits.d.ts +4 -0
- package/dist/profiler/storage/visits.js +6 -0
- package/dist/profiler/stream-tail.d.ts +26 -0
- package/dist/profiler/stream-tail.js +74 -0
- package/dist/profiler/timeline.d.ts +279 -0
- package/dist/profiler/timeline.js +690 -0
- package/dist/profiler/ui/AllocStrip.svelte +146 -0
- package/dist/profiler/ui/AllocStrip.svelte.d.ts +17 -0
- package/dist/profiler/ui/Awaits.svelte +363 -0
- package/dist/profiler/ui/Awaits.svelte.d.ts +16 -0
- package/dist/profiler/ui/ByteStrip.svelte +182 -0
- package/dist/profiler/ui/ByteStrip.svelte.d.ts +18 -0
- package/dist/profiler/ui/Compare.svelte +24 -0
- package/dist/profiler/ui/Compare.svelte.d.ts +16 -0
- package/dist/profiler/ui/CompareBody.svelte +429 -0
- package/dist/profiler/ui/CompareBody.svelte.d.ts +8 -0
- package/dist/profiler/ui/ComponentsTable.svelte +265 -0
- package/dist/profiler/ui/ComponentsTable.svelte.d.ts +20 -0
- package/dist/profiler/ui/Dashboard.svelte +492 -0
- package/dist/profiler/ui/Dashboard.svelte.d.ts +31 -0
- package/dist/profiler/ui/DataRiver.svelte +206 -0
- package/dist/profiler/ui/DataRiver.svelte.d.ts +13 -0
- package/dist/profiler/ui/DomTravel.svelte +207 -0
- package/dist/profiler/ui/DomTravel.svelte.d.ts +9 -0
- package/dist/profiler/ui/DownloadHtml.svelte +52 -0
- package/dist/profiler/ui/DownloadHtml.svelte.d.ts +10 -0
- package/dist/profiler/ui/Drill.svelte +276 -0
- package/dist/profiler/ui/Drill.svelte.d.ts +12 -0
- package/dist/profiler/ui/ExportButton.svelte +59 -0
- package/dist/profiler/ui/ExportButton.svelte.d.ts +8 -0
- package/dist/profiler/ui/Flame.svelte +222 -0
- package/dist/profiler/ui/Flame.svelte.d.ts +12 -0
- package/dist/profiler/ui/FrameDetails.svelte +308 -0
- package/dist/profiler/ui/FrameDetails.svelte.d.ts +16 -0
- package/dist/profiler/ui/FunctionsTable.svelte +156 -0
- package/dist/profiler/ui/FunctionsTable.svelte.d.ts +17 -0
- package/dist/profiler/ui/IslandHeatmap.svelte +151 -0
- package/dist/profiler/ui/IslandHeatmap.svelte.d.ts +16 -0
- package/dist/profiler/ui/IslandsTable.svelte +448 -0
- package/dist/profiler/ui/IslandsTable.svelte.d.ts +16 -0
- package/dist/profiler/ui/KeepLocal.svelte +46 -0
- package/dist/profiler/ui/KeepLocal.svelte.d.ts +8 -0
- package/dist/profiler/ui/Ledger.svelte +196 -0
- package/dist/profiler/ui/Ledger.svelte.d.ts +18 -0
- package/dist/profiler/ui/LocalCompare.svelte +48 -0
- package/dist/profiler/ui/LocalCompare.svelte.d.ts +8 -0
- package/dist/profiler/ui/LocalReports.svelte +68 -0
- package/dist/profiler/ui/LocalReports.svelte.d.ts +7 -0
- package/dist/profiler/ui/Login.svelte +13 -0
- package/dist/profiler/ui/Login.svelte.d.ts +12 -0
- package/dist/profiler/ui/LoginForm.svelte +42 -0
- package/dist/profiler/ui/LoginForm.svelte.d.ts +7 -0
- package/dist/profiler/ui/Message.svelte +10 -0
- package/dist/profiler/ui/Message.svelte.d.ts +12 -0
- package/dist/profiler/ui/OnThisPage.svelte +137 -0
- package/dist/profiler/ui/OnThisPage.svelte.d.ts +3 -0
- package/dist/profiler/ui/OneClock.svelte +297 -0
- package/dist/profiler/ui/OneClock.svelte.d.ts +27 -0
- package/dist/profiler/ui/Panel.svelte +10 -0
- package/dist/profiler/ui/Panel.svelte.d.ts +16 -0
- package/dist/profiler/ui/Paths.svelte +269 -0
- package/dist/profiler/ui/Paths.svelte.d.ts +15 -0
- package/dist/profiler/ui/Patterns.svelte +364 -0
- package/dist/profiler/ui/Patterns.svelte.d.ts +15 -0
- package/dist/profiler/ui/PermalinkGate.svelte +143 -0
- package/dist/profiler/ui/PermalinkGate.svelte.d.ts +10 -0
- package/dist/profiler/ui/RenderSteps.svelte +218 -0
- package/dist/profiler/ui/RenderSteps.svelte.d.ts +13 -0
- package/dist/profiler/ui/Report.svelte +28 -0
- package/dist/profiler/ui/Report.svelte.d.ts +20 -0
- package/dist/profiler/ui/ReportBody.svelte +2592 -0
- package/dist/profiler/ui/ReportBody.svelte.d.ts +21 -0
- package/dist/profiler/ui/Run.svelte +17 -0
- package/dist/profiler/ui/Run.svelte.d.ts +14 -0
- package/dist/profiler/ui/RunView.svelte +146 -0
- package/dist/profiler/ui/RunView.svelte.d.ts +10 -0
- package/dist/profiler/ui/ScoreCard.svelte +197 -0
- package/dist/profiler/ui/ScoreCard.svelte.d.ts +7 -0
- package/dist/profiler/ui/Scrub.svelte +293 -0
- package/dist/profiler/ui/Scrub.svelte.d.ts +18 -0
- package/dist/profiler/ui/SeedExplainer.svelte +193 -0
- package/dist/profiler/ui/SeedExplainer.svelte.d.ts +16 -0
- package/dist/profiler/ui/ShareLink.svelte +148 -0
- package/dist/profiler/ui/ShareLink.svelte.d.ts +8 -0
- package/dist/profiler/ui/Shell.svelte +50 -0
- package/dist/profiler/ui/Shell.svelte.d.ts +27 -0
- package/dist/profiler/ui/Sidebar.svelte +312 -0
- package/dist/profiler/ui/Sidebar.svelte.d.ts +7 -0
- package/dist/profiler/ui/Site.svelte +20 -0
- package/dist/profiler/ui/Site.svelte.d.ts +23 -0
- package/dist/profiler/ui/SiteView.svelte +385 -0
- package/dist/profiler/ui/SiteView.svelte.d.ts +27 -0
- package/dist/profiler/ui/ThemeSwitch.svelte +78 -0
- package/dist/profiler/ui/ThemeSwitch.svelte.d.ts +3 -0
- package/dist/profiler/ui/Timeline.svelte +672 -0
- package/dist/profiler/ui/Timeline.svelte.d.ts +22 -0
- package/dist/profiler/ui/Treemap.svelte +278 -0
- package/dist/profiler/ui/Treemap.svelte.d.ts +20 -0
- package/dist/profiler/ui/Upload.svelte +19 -0
- package/dist/profiler/ui/Upload.svelte.d.ts +10 -0
- package/dist/profiler/ui/UploadForm.svelte +59 -0
- package/dist/profiler/ui/UploadForm.svelte.d.ts +6 -0
- package/dist/profiler/ui/WaitingTable.svelte +55 -0
- package/dist/profiler/ui/WaitingTable.svelte.d.ts +14 -0
- package/dist/profiler/ui/Waterfall.svelte +371 -0
- package/dist/profiler/ui/Waterfall.svelte.d.ts +7 -0
- package/dist/profiler/ui/WhatIf.svelte +87 -0
- package/dist/profiler/ui/WhatIf.svelte.d.ts +18 -0
- package/dist/profiler/ui/fake-progress.svelte.d.ts +15 -0
- package/dist/profiler/ui/fake-progress.svelte.js +38 -0
- package/dist/profiler/ui/format.d.ts +20 -0
- package/dist/profiler/ui/format.js +71 -0
- package/dist/profiler/ui/permalink.d.ts +9 -0
- package/dist/profiler/ui/permalink.js +108 -0
- package/dist/profiler/ui/press.d.ts +5 -0
- package/dist/profiler/ui/press.js +19 -0
- package/dist/profiler/ui/profiler.css +650 -0
- package/dist/profiler/ui/report-data.d.ts +189 -0
- package/dist/profiler/ui/report-data.js +393 -0
- package/dist/profiler/ui/report-request.d.ts +6 -0
- package/dist/profiler/ui/report-request.js +50 -0
- package/dist/profiler/ui/row-anchor.svelte.d.ts +12 -0
- package/dist/profiler/ui/row-anchor.svelte.js +44 -0
- package/dist/profiler/ui/sort.svelte.d.ts +14 -0
- package/dist/profiler/ui/sort.svelte.js +37 -0
- package/dist/profiler/ui/store.d.ts +45 -0
- package/dist/profiler/ui/store.js +92 -0
- package/dist/profiler/visit.d.ts +389 -0
- package/dist/profiler/visit.js +1002 -0
- package/dist/report.d.ts +5 -0
- package/dist/report.js +4 -0
- package/dist/server.d.ts +11 -0
- package/dist/server.js +38 -0
- package/dist/vite.d.ts +12 -0
- package/dist/vite.js +78 -0
- package/package.json +99 -6
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
import { Timeline, TimelineInput } from "./timeline.js";
|
|
2
|
+
import { another_routes_file, route_dirs, route_file_of } from "./route-files.js";
|
|
3
|
+
export interface CallFrame {
|
|
4
|
+
functionName: string;
|
|
5
|
+
scriptId?: string;
|
|
6
|
+
url: string;
|
|
7
|
+
lineNumber: number;
|
|
8
|
+
columnNumber: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function learn_script_urls(profile: {
|
|
11
|
+
nodes?: readonly ProfileNode[];
|
|
12
|
+
} | null | undefined): void;
|
|
13
|
+
/** a frame with its url filled from its script id when the profile left it empty */
|
|
14
|
+
export declare function with_script_url(f: CallFrame): CallFrame;
|
|
15
|
+
export interface ProfileNode {
|
|
16
|
+
id: number;
|
|
17
|
+
callFrame: CallFrame;
|
|
18
|
+
hitCount?: number;
|
|
19
|
+
children?: number[];
|
|
20
|
+
/** V8's per-LINE sample counts inside this function (1-based lines of the script) */
|
|
21
|
+
positionTicks?: {
|
|
22
|
+
line: number;
|
|
23
|
+
ticks: number;
|
|
24
|
+
}[];
|
|
25
|
+
/** why V8 threw this function out of optimized code, when it did (`wrong map`, `not a Smi`…) */
|
|
26
|
+
deoptReason?: string;
|
|
27
|
+
}
|
|
28
|
+
/** a function V8 deoptimized during the window, with the reasons it gave */
|
|
29
|
+
export interface DeoptRow {
|
|
30
|
+
key: string;
|
|
31
|
+
name: string;
|
|
32
|
+
url: string;
|
|
33
|
+
line: number;
|
|
34
|
+
category: FrameCategory;
|
|
35
|
+
reasons: Record<string, number>;
|
|
36
|
+
count: number;
|
|
37
|
+
self_ms: number;
|
|
38
|
+
}
|
|
39
|
+
export interface CpuProfile {
|
|
40
|
+
nodes: ProfileNode[];
|
|
41
|
+
/** microseconds */
|
|
42
|
+
startTime: number;
|
|
43
|
+
/** microseconds */
|
|
44
|
+
endTime: number;
|
|
45
|
+
samples?: number[];
|
|
46
|
+
/** microseconds between consecutive samples */
|
|
47
|
+
timeDeltas?: number[];
|
|
48
|
+
}
|
|
49
|
+
export type FrameCategory = "component" | "app" | "dependency" | "svelte" | "node" | "gc" | "idle" | "v8" | "profiler" | "unknown";
|
|
50
|
+
/** One call path into a function: the nearest callers first, and how much of the function's time
|
|
51
|
+
* (inclusive — the subtree reached through this exact path) came this way. */
|
|
52
|
+
export interface CallStack {
|
|
53
|
+
ms: number;
|
|
54
|
+
/** nearest caller first; `n` = display name, `f` = `file:line` ('' for native), `c` = category
|
|
55
|
+
* (the UI dims framework/runtime frames so your own code stands out) */
|
|
56
|
+
frames: {
|
|
57
|
+
n: string;
|
|
58
|
+
f: string;
|
|
59
|
+
c: FrameCategory;
|
|
60
|
+
}[];
|
|
61
|
+
}
|
|
62
|
+
export interface FrameStat {
|
|
63
|
+
/** the aggregation identity (`C:<name>` for a component, `<name> <url>` otherwise) */
|
|
64
|
+
key: string;
|
|
65
|
+
name: string;
|
|
66
|
+
/** an anonymous app function's own first line, trimmed (`span('ds.splice', () => {`): what it
|
|
67
|
+
* is, where a name cannot say */
|
|
68
|
+
label?: string;
|
|
69
|
+
/** short display path (last segments, or the node_modules-relative path) */
|
|
70
|
+
url: string;
|
|
71
|
+
/** the full path as V8 (or the sourcemap) reported it — absolute in dev, so it can be opened */
|
|
72
|
+
path: string;
|
|
73
|
+
line: number;
|
|
74
|
+
/** 1-based column; 0 when unknown */
|
|
75
|
+
col: number;
|
|
76
|
+
category: FrameCategory;
|
|
77
|
+
/** package name when category is 'dependency' */
|
|
78
|
+
pkg?: string;
|
|
79
|
+
/** ms spent exactly here */
|
|
80
|
+
self_ms: number;
|
|
81
|
+
/** ms spent here plus everything it called (recursion counted once) */
|
|
82
|
+
total_ms: number;
|
|
83
|
+
/** exact invocation count from V8 precise coverage, when available (this frame's own count) */
|
|
84
|
+
calls?: number;
|
|
85
|
+
/** the heaviest call paths into this function (filled for the hot functions and every component) */
|
|
86
|
+
stacks?: CallStack[];
|
|
87
|
+
/** components: ms spent BUILDING MARKUP — Svelte's server internals (escape, attr, push…) run
|
|
88
|
+
* under this component with no nearer component — versus RUNNING LOGIC — its own script and
|
|
89
|
+
* the app / dependency / node code it calls. Nested components are in neither. */
|
|
90
|
+
markup_ms?: number;
|
|
91
|
+
logic_ms?: number;
|
|
92
|
+
/** components: the component whose render contained most of this one's time — the parent of a
|
|
93
|
+
* `{#each}` list's rows */
|
|
94
|
+
parent?: string;
|
|
95
|
+
/** THE HOT LINES: where inside this function the self time landed (V8's per-line ticks, mapped
|
|
96
|
+
* through the sourcemap when one resolved), heaviest first */
|
|
97
|
+
lines?: {
|
|
98
|
+
line: number;
|
|
99
|
+
ms: number;
|
|
100
|
+
}[];
|
|
101
|
+
/** the source around the hot lines, captured at report time — from the sourcemap's embedded
|
|
102
|
+
* copy (so it works on a deployed host with no source on disk) or the local file. Carried in
|
|
103
|
+
* the report itself: the code shows in exports and share links with no request to make. */
|
|
104
|
+
src?: {
|
|
105
|
+
start: number;
|
|
106
|
+
lines: string[];
|
|
107
|
+
};
|
|
108
|
+
/** components, page mode: inclusive ms in EACH run — the spread says cache miss vs slow code */
|
|
109
|
+
runs_ms?: number[];
|
|
110
|
+
/** app functions and components: WHAT THIS ONE CALLED and how much of its total went into each
|
|
111
|
+
* (inclusive ms; builtins, dependencies, other app code), heaviest first — where a function's
|
|
112
|
+
* time goes when it is not its own lines */
|
|
113
|
+
callees?: Callee[];
|
|
114
|
+
/** library work this function started that ran AFTER an await (no app frame on its stacks),
|
|
115
|
+
* charged to it by time; not part of `total_ms` */
|
|
116
|
+
async_ms?: number;
|
|
117
|
+
}
|
|
118
|
+
export interface Callee {
|
|
119
|
+
key: string;
|
|
120
|
+
name: string;
|
|
121
|
+
category: FrameCategory;
|
|
122
|
+
/** the package it belongs to, when the analyzer knows (a node_modules path, or the module map) */
|
|
123
|
+
pkg?: string;
|
|
124
|
+
/** short `file:line`, '' for a builtin */
|
|
125
|
+
file: string;
|
|
126
|
+
ms: number;
|
|
127
|
+
/** share of the caller's total */
|
|
128
|
+
share: number;
|
|
129
|
+
/** of `ms`, the part that ran after an await: library continuations with no app frame on their
|
|
130
|
+
* stacks, charged to this caller as the app code that entered the library nearest in time */
|
|
131
|
+
async_ms?: number;
|
|
132
|
+
}
|
|
133
|
+
export interface GroupStat {
|
|
134
|
+
key: string;
|
|
135
|
+
category: FrameCategory;
|
|
136
|
+
self_ms: number;
|
|
137
|
+
}
|
|
138
|
+
export interface FlameNode {
|
|
139
|
+
/** display name */
|
|
140
|
+
n: string;
|
|
141
|
+
/** category (for coloring) */
|
|
142
|
+
c: FrameCategory;
|
|
143
|
+
/** total ms, rounded to 2dp */
|
|
144
|
+
t: number;
|
|
145
|
+
/** self ms */
|
|
146
|
+
s: number;
|
|
147
|
+
/** file:line, '' when none */
|
|
148
|
+
f: string;
|
|
149
|
+
ch?: FlameNode[];
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* ONE PATH, SEVERAL HOT FUNCTIONS: a caller in your code under which two or more of the hot
|
|
153
|
+
* functions burn their time. Fixing the caller once (cache its result, call it less, move it out
|
|
154
|
+
* of the render) addresses all of them, where the table would have you chase each on its own.
|
|
155
|
+
*/
|
|
156
|
+
export interface PathGroup {
|
|
157
|
+
/** the caller to fix: a component or an app function */
|
|
158
|
+
owner: {
|
|
159
|
+
key: string;
|
|
160
|
+
name: string;
|
|
161
|
+
url: string;
|
|
162
|
+
line: number;
|
|
163
|
+
category: FrameCategory;
|
|
164
|
+
total_ms: number;
|
|
165
|
+
calls?: number;
|
|
166
|
+
};
|
|
167
|
+
/** the hot functions under it, with the self time they burned on this path, heaviest first */
|
|
168
|
+
fns: {
|
|
169
|
+
key: string;
|
|
170
|
+
name: string;
|
|
171
|
+
url: string;
|
|
172
|
+
line: number;
|
|
173
|
+
category: FrameCategory;
|
|
174
|
+
pkg?: string;
|
|
175
|
+
ms: number;
|
|
176
|
+
}[];
|
|
177
|
+
/** their summed self time under the owner */
|
|
178
|
+
ms: number;
|
|
179
|
+
/** how much of the owner's inclusive time that is */
|
|
180
|
+
share: number;
|
|
181
|
+
/** the call tree from the owner down to the hot functions — only the branches that reach one */
|
|
182
|
+
tree: PathNode;
|
|
183
|
+
}
|
|
184
|
+
/** One node of a path tree: a frame between the owner and a hot function, or one of them. */
|
|
185
|
+
export interface PathNode {
|
|
186
|
+
key: string;
|
|
187
|
+
name: string;
|
|
188
|
+
category: FrameCategory;
|
|
189
|
+
/** `file:line`, '' when none */
|
|
190
|
+
file: string;
|
|
191
|
+
/** ms of hot-function self time that flowed through this node on the path */
|
|
192
|
+
ms: number;
|
|
193
|
+
/** a hot function itself (a leaf of the path, or a hot caller of another hot function) */
|
|
194
|
+
hot: boolean;
|
|
195
|
+
/** how many times it was called across the window (from coverage), when known */
|
|
196
|
+
calls?: number | null;
|
|
197
|
+
children: PathNode[];
|
|
198
|
+
}
|
|
199
|
+
/** One resolved frame of the stack index: what a sample's stack is made of. */
|
|
200
|
+
export interface StackFrameRef {
|
|
201
|
+
/** the frame's display name (sourcemapped, renamed like every other row) */
|
|
202
|
+
n: string;
|
|
203
|
+
/** `file:line`, when known */
|
|
204
|
+
f?: string;
|
|
205
|
+
c: FrameCategory;
|
|
206
|
+
/** the index of the parent frame in `frames`, -1 at a root */
|
|
207
|
+
p: number;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* THE SAMPLES THEMSELVES, on the render's clock: every CPU sample inside the one window the
|
|
211
|
+
* report explains, as `(time, length, leaf frame)` with the frame table the leaves hang from.
|
|
212
|
+
* Every other table is an aggregate of this; this is the substrate they came from, so any range
|
|
213
|
+
* of the render can be asked "what ran here" and any instant "what was the stack" — without
|
|
214
|
+
* the raw profile (megabytes) and without re-resolving anything. Consecutive samples of one
|
|
215
|
+
* leaf are folded (one entry with the summed length); beyond `MAX_INDEX_SAMPLES` the folded
|
|
216
|
+
* entries are stride-sampled, the lengths kept so the sum still is the CPU time.
|
|
217
|
+
*/
|
|
218
|
+
export interface StackIndex {
|
|
219
|
+
frames: StackFrameRef[];
|
|
220
|
+
/** ms from the window's start, per sample */
|
|
221
|
+
t: number[];
|
|
222
|
+
/** ms each sample stands for */
|
|
223
|
+
d: number[];
|
|
224
|
+
/** the leaf frame per sample (an index into `frames`), -1 for an idle sample */
|
|
225
|
+
leaf: number[];
|
|
226
|
+
/** how many raw samples were folded into `t` */
|
|
227
|
+
raw: number;
|
|
228
|
+
window_ms: number;
|
|
229
|
+
}
|
|
230
|
+
export interface Analysis {
|
|
231
|
+
/** wall-clock length of the recording window in ms */
|
|
232
|
+
duration_ms: number;
|
|
233
|
+
/** ms the CPU was running the APP's JS/GC: everything except idle and the profiler's own frames */
|
|
234
|
+
busy_ms: number;
|
|
235
|
+
idle_ms: number;
|
|
236
|
+
gc_ms: number;
|
|
237
|
+
/** ms the CPU spent in the profiler's own code (its I/O tracker, its heap reads, its stack
|
|
238
|
+
* captures): measured, reported, and kept OUT of every other number */
|
|
239
|
+
overhead_ms: number;
|
|
240
|
+
/** the profiler's own frames by self time (what the overhead was), a few */
|
|
241
|
+
overhead_functions: {
|
|
242
|
+
name: string;
|
|
243
|
+
url: string;
|
|
244
|
+
line: number;
|
|
245
|
+
self_ms: number;
|
|
246
|
+
}[];
|
|
247
|
+
/** page mode: the profiler's own CPU inside each run's window (what each run's wall time
|
|
248
|
+
* carries that the app would not have paid); the rest of `overhead_ms` sits between runs
|
|
249
|
+
* or before the first — the profiler's start-up scan of compiled code, its final reads */
|
|
250
|
+
overhead_by_run_ms?: number[];
|
|
251
|
+
/** the CPU segments over the WHOLE capture (every run), on the capture's clock — what was
|
|
252
|
+
* running at any moment (the GC attribution names what ran when each pause fell) */
|
|
253
|
+
capture_cpu?: {
|
|
254
|
+
t0: number;
|
|
255
|
+
t1: number;
|
|
256
|
+
label: string;
|
|
257
|
+
category: FrameCategory;
|
|
258
|
+
file?: string;
|
|
259
|
+
}[];
|
|
260
|
+
/** page mode: each CPU owner's ms in every run (grouped as the drill-down groups them): how much
|
|
261
|
+
* a row moves from one render to the next */
|
|
262
|
+
owner_runs_ms?: Record<string, number[]>;
|
|
263
|
+
/** functions V8 deoptimized during the window, by self time */
|
|
264
|
+
deopts: DeoptRow[];
|
|
265
|
+
sample_count: number;
|
|
266
|
+
/** every frame aggregated across the profile, sorted by self time desc */
|
|
267
|
+
functions: FrameStat[];
|
|
268
|
+
/** frames that look like Svelte component SSR functions, by total desc */
|
|
269
|
+
components: FrameStat[];
|
|
270
|
+
/** self time grouped by source file, desc */
|
|
271
|
+
files: GroupStat[];
|
|
272
|
+
/** self time grouped by npm package / category bucket, desc */
|
|
273
|
+
buckets: GroupStat[];
|
|
274
|
+
/** left-heavy call tree for the flamegraph, roots under a synthetic root */
|
|
275
|
+
flame: FlameNode;
|
|
276
|
+
/** true when at least one bundled frame was mapped back through a sourcemap */
|
|
277
|
+
sourcemapped: boolean;
|
|
278
|
+
/** CPU sampled under ANOTHER route's page or layout (another visitor's request, answered while
|
|
279
|
+
* the profiled one rendered), set aside: ms over the whole window */
|
|
280
|
+
other_requests_ms?: number;
|
|
281
|
+
/** no sourcemaps, but the app's script modules were matched to their source by text (the
|
|
282
|
+
* source on this machine): the lines, and so the fixes, are there */
|
|
283
|
+
text_mapped?: boolean;
|
|
284
|
+
/** ONE request's critical path + phases (page / request mode; absent for a plain window) */
|
|
285
|
+
timeline?: Timeline;
|
|
286
|
+
/** the samples inside that one window, with their stacks (the substrate every table came from) */
|
|
287
|
+
stacks?: StackIndex;
|
|
288
|
+
/** hot functions grouped by the one caller they share — the paths to fix, biggest first */
|
|
289
|
+
paths: PathGroup[];
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* The stack index of one window (see `StackIndex`). `frame_of` gives a node's resolved frame,
|
|
293
|
+
* `parent_of` its parent node; only nodes on a sampled stack inside the window enter the table.
|
|
294
|
+
*/
|
|
295
|
+
export declare function build_stack_index(profile: CpuProfile, frame_of: (id: number) => {
|
|
296
|
+
name: string;
|
|
297
|
+
url: string;
|
|
298
|
+
line: number;
|
|
299
|
+
category: FrameCategory;
|
|
300
|
+
}, parent_of: (id: number) => number | undefined, perf_start: number, window: {
|
|
301
|
+
start: number;
|
|
302
|
+
end: number;
|
|
303
|
+
}): StackIndex | undefined;
|
|
304
|
+
/** A frame name with the bundler's `$N` collision suffix removed. */
|
|
305
|
+
export declare function strip_bundler_suffix(name: string): string;
|
|
306
|
+
export declare function component_name_from_file(url: string): string | undefined;
|
|
307
|
+
export declare function clean_url(url: string): string;
|
|
308
|
+
/**
|
|
309
|
+
* A sourcemap's `sources` are relative to the MAP FILE (`../../src/lib/Foo.svelte` from
|
|
310
|
+
* `.svelte-kit/output/server/chunks/x.js.map`). Joined onto the chunk's own directory they become
|
|
311
|
+
* the real path — absolute when V8 reported the chunk absolutely (a `vite preview`, adapter-node),
|
|
312
|
+
* which is what lets a row open in an editor. Pure string work (no `node:path`): this module runs
|
|
313
|
+
* anywhere. An absolute source, a URL, or a chunk with no directory passes through unchanged.
|
|
314
|
+
*/
|
|
315
|
+
export declare function join_source(chunk: string, source: string): string;
|
|
316
|
+
export declare function categorize(frame: CallFrame): {
|
|
317
|
+
category: FrameCategory;
|
|
318
|
+
pkg?: string;
|
|
319
|
+
};
|
|
320
|
+
interface MappedLine {
|
|
321
|
+
/** generated column -> [column, source index, original line, name index (-1 = none), original column] */
|
|
322
|
+
cols: [number, number, number, number, number][];
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* A MAP'S MAPPINGS, PACKED: every segment as five numbers in one array — generated column, source
|
|
326
|
+
* index, original line, name index (-1 = none), original column — and where each generated line's
|
|
327
|
+
* segments start. A real app's server maps hold millions of segments; an array (and an object) per
|
|
328
|
+
* segment cost the profiler over 100 MB on one, the packed form about a fifth of that.
|
|
329
|
+
*/
|
|
330
|
+
export interface PackedMappings {
|
|
331
|
+
/** SEG numbers per segment */
|
|
332
|
+
segs: Int32Array;
|
|
333
|
+
/** generated line l's segments are `starts[l]` up to `starts[l + 1]` (segment indices) */
|
|
334
|
+
starts: Int32Array;
|
|
335
|
+
}
|
|
336
|
+
/** Decode one VLQ-encoded sourcemap `mappings` string, packed. */
|
|
337
|
+
export declare function decode_packed(mappings: string): PackedMappings;
|
|
338
|
+
/** Decode one VLQ-encoded sourcemap `mappings` string into per-line column maps (the readable
|
|
339
|
+
* form of {@link decode_packed}) */
|
|
340
|
+
export declare function decode_mappings(mappings: string): MappedLine[];
|
|
341
|
+
export declare class SourceMapResolver {
|
|
342
|
+
#private;
|
|
343
|
+
/** whether any lookup succeeded */
|
|
344
|
+
hit: boolean;
|
|
345
|
+
/** whether any line of a chunk WITHOUT a map was matched to its source by text */
|
|
346
|
+
text_hit: boolean;
|
|
347
|
+
constructor(read: (path: string) => string | undefined, module_at?: ModuleAt, opts?: {
|
|
348
|
+
any_ext?: boolean;
|
|
349
|
+
});
|
|
350
|
+
/** every original source a loaded map carries a copy of */
|
|
351
|
+
embedded_sources(): IterableIterator<string>;
|
|
352
|
+
/** Lines `from`..`to` (1-based, inclusive) of an original source, untrimmed — the source view.
|
|
353
|
+
* Undefined when the source is not available (no embedded copy, not on this machine). */
|
|
354
|
+
source_lines(source: string, from: number, to: number): {
|
|
355
|
+
start: number;
|
|
356
|
+
lines: string[];
|
|
357
|
+
} | undefined;
|
|
358
|
+
/** The original source LINE at a mapped position, trimmed and cut: what an anonymous callback
|
|
359
|
+
* IS (`tags.map(async (tag) => {`), for a label a name cannot give. Undefined when the source
|
|
360
|
+
* is not available. */
|
|
361
|
+
line_at_source(source: string, line: number, max?: number): string | undefined;
|
|
362
|
+
/** The function name written in the ORIGINAL source at a mapped position (1-based line and
|
|
363
|
+
* column), for a frame whose map carries no name there: `function foo(`, a method `foo(` /
|
|
364
|
+
* `#foo(` / `async foo(`, or an arrow assigned to `foo` (`const foo = () =>`, `foo: () =>`).
|
|
365
|
+
* Undefined for a true anonymous callback. Reads the source through the same `read`. */
|
|
366
|
+
name_at_source(source: string, line: number, column: number): string | undefined;
|
|
367
|
+
/**
|
|
368
|
+
* A LINE OF A FUNCTION MATCHED BY TEXT that matched nothing itself (a build without maps: the
|
|
369
|
+
* build wrote `void 0`, folded a declaration into the next line, or wrapped one statement over
|
|
370
|
+
* several lines). From the nearest line above it that did match, within the function: still
|
|
371
|
+
* inside that statement (its brackets not yet closed) → that statement's line; else as far
|
|
372
|
+
* below it as in the build. Else from the function's own line. 0-based lines in, 1-based out.
|
|
373
|
+
*/
|
|
374
|
+
text_nearby(url: string, line: number, fn_line: number): number | undefined;
|
|
375
|
+
/** A FUNCTION whose own line carries no mapping (Svelte leaves `function _page($$renderer…) {`
|
|
376
|
+
* unmapped and maps the body from its next line to `+page.svelte`): the first mapped line of
|
|
377
|
+
* its body, a few lines down. V8 places a function at its definition, so without this every
|
|
378
|
+
* route component read as its built chunk. Generated code (ogygia's virtual modules) is not a
|
|
379
|
+
* source anyone opens, and is left unmapped. */
|
|
380
|
+
resolve_body(url: string, line: number): {
|
|
381
|
+
source: string;
|
|
382
|
+
line: number;
|
|
383
|
+
column: number;
|
|
384
|
+
name?: string;
|
|
385
|
+
near_name?: string;
|
|
386
|
+
text?: true;
|
|
387
|
+
} | undefined;
|
|
388
|
+
resolve(url: string, line: number, column: number): {
|
|
389
|
+
source: string;
|
|
390
|
+
line: number;
|
|
391
|
+
column: number;
|
|
392
|
+
name?: string;
|
|
393
|
+
near_name?: string;
|
|
394
|
+
text?: true;
|
|
395
|
+
} | undefined;
|
|
396
|
+
}
|
|
397
|
+
/** Build a {@link SourceMapResolver} backed by `.map` files next to the chunks. */
|
|
398
|
+
/** the module a built chunk's line belongs to (a build without maps), and whether it is the app's
|
|
399
|
+
* own script module to match by text */
|
|
400
|
+
export type ModuleAt = (path: string, line: number) => {
|
|
401
|
+
source: string;
|
|
402
|
+
text: boolean;
|
|
403
|
+
} | undefined;
|
|
404
|
+
export declare function sourcemap_resolver(read: (path: string) => string | undefined, module_at?: ModuleAt, opts?: {
|
|
405
|
+
any_ext?: boolean;
|
|
406
|
+
}): SourceMapResolver;
|
|
407
|
+
export declare function analyze(profile: CpuProfile, resolver?: SourceMapResolver, call_counts?: Record<string, number>, timeline_input?: TimelineInput, rename?: (name: string, url: string, stage: "frame" | "confirmed") => string | undefined, url_category?: (url: string, name: string, line: number) => FrameCategory | {
|
|
408
|
+
category: FrameCategory;
|
|
409
|
+
pkg?: string;
|
|
410
|
+
} | undefined): Analysis;
|
|
411
|
+
export interface HeapNode {
|
|
412
|
+
callFrame: CallFrame;
|
|
413
|
+
selfSize: number;
|
|
414
|
+
children?: HeapNode[];
|
|
415
|
+
}
|
|
416
|
+
export interface HeapAllocator {
|
|
417
|
+
name: string;
|
|
418
|
+
url: string;
|
|
419
|
+
line: number;
|
|
420
|
+
category: FrameCategory;
|
|
421
|
+
self_bytes: number;
|
|
422
|
+
total_bytes: number;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* The renamer for a BROWSER profile: a component confirmed in a minified client chunk (Svelte's
|
|
426
|
+
* runtime is below it, so it is one, but its name is `Y`) is named after the `.svelte` files the
|
|
427
|
+
* build put in that chunk — `ProductCard`, or `ProductCard (+2 in chunk)` when the chunk holds
|
|
428
|
+
* several. `contents` is the build handoff's chunk summary by path (`chunkContents`). Only the
|
|
429
|
+
* confirmed stage renames: an unconfirmed `Pt` is a helper and stays app code.
|
|
430
|
+
*/
|
|
431
|
+
export declare function chunk_component_renamer(contents: (path: string) => readonly string[] | null | undefined): (name: string, url: string, stage: "frame" | "confirmed") => string | undefined;
|
|
432
|
+
export declare function heap_by_component(head: HeapNode, limit?: number): {
|
|
433
|
+
name: string;
|
|
434
|
+
bytes: number;
|
|
435
|
+
}[];
|
|
436
|
+
export declare function analyze_heap(head: HeapNode, limit?: number): HeapAllocator[];
|
|
437
|
+
export { another_routes_file, route_dirs, route_file_of };
|