@yetanotheraryan/coldstart 1.0.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/dist/chunk-7HD2T2AD.mjs +261 -0
- package/dist/chunk-B5TADGOF.mjs +12 -0
- package/dist/chunk-IGYROJNQ.mjs +170 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +285 -0
- package/dist/cli.mjs +123 -0
- package/dist/esm-loader.d.mts +30 -0
- package/dist/esm-loader.d.ts +30 -0
- package/dist/esm-loader.js +125 -0
- package/dist/esm-loader.mjs +100 -0
- package/dist/index.d.mts +67 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.js +816 -0
- package/dist/index.mjs +368 -0
- package/dist/register.d.mts +2 -0
- package/dist/register.d.ts +2 -0
- package/dist/register.js +438 -0
- package/dist/register.mjs +181 -0
- package/package.json +63 -0
- package/readme.md +440 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* coldstart — tracer.ts
|
|
3
|
+
* Receives raw module load events from cjs.ts and builds:
|
|
4
|
+
* - A call tree (parent → children)
|
|
5
|
+
* - Inclusive timing (module + all its transitive requires)
|
|
6
|
+
* - Exclusive timing (module's own code only, not children)
|
|
7
|
+
* - Top slowest modules list
|
|
8
|
+
* - Event loop blocking stats (via perf_hooks)
|
|
9
|
+
*/
|
|
10
|
+
interface ModuleLoadEvent {
|
|
11
|
+
id: string;
|
|
12
|
+
request: string;
|
|
13
|
+
resolvedPath: string;
|
|
14
|
+
parentPath: string;
|
|
15
|
+
durationMs: number;
|
|
16
|
+
startTime: number;
|
|
17
|
+
cached: boolean;
|
|
18
|
+
isNodeModule: boolean;
|
|
19
|
+
isBuiltin: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface ModuleNode {
|
|
22
|
+
id: string;
|
|
23
|
+
request: string;
|
|
24
|
+
resolvedPath: string;
|
|
25
|
+
parentPath: string;
|
|
26
|
+
inclusiveMs: number;
|
|
27
|
+
exclusiveMs: number;
|
|
28
|
+
cached: boolean;
|
|
29
|
+
isNodeModule: boolean;
|
|
30
|
+
isBuiltin: boolean;
|
|
31
|
+
children: ModuleNode[];
|
|
32
|
+
depth: number;
|
|
33
|
+
}
|
|
34
|
+
interface StartupReport {
|
|
35
|
+
totalStartupMs: number;
|
|
36
|
+
eventLoop: {
|
|
37
|
+
maxBlockMs: number;
|
|
38
|
+
meanBlockMs: number;
|
|
39
|
+
p99BlockMs: number;
|
|
40
|
+
};
|
|
41
|
+
tree: ModuleNode[];
|
|
42
|
+
flat: ModuleNode[];
|
|
43
|
+
slowest: ModuleNode[];
|
|
44
|
+
nodeModuleTime: number;
|
|
45
|
+
firstPartyTime: number;
|
|
46
|
+
totalModulesLoaded: number;
|
|
47
|
+
cachedModulesCount: number;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface TextReporterOptions {
|
|
51
|
+
color?: boolean;
|
|
52
|
+
barWidth?: number;
|
|
53
|
+
showSummary?: boolean;
|
|
54
|
+
}
|
|
55
|
+
declare function renderTextReport(report: StartupReport, options?: TextReporterOptions): string;
|
|
56
|
+
|
|
57
|
+
interface JsonReporterOptions {
|
|
58
|
+
pretty?: boolean;
|
|
59
|
+
}
|
|
60
|
+
declare function renderJsonReport(report: StartupReport, options?: JsonReporterOptions): string;
|
|
61
|
+
|
|
62
|
+
declare function renderFlamegraphHtml(report: StartupReport): string;
|
|
63
|
+
|
|
64
|
+
declare function monitor(): () => StartupReport;
|
|
65
|
+
declare function report(): StartupReport;
|
|
66
|
+
|
|
67
|
+
export { type JsonReporterOptions, type ModuleLoadEvent, type ModuleNode, type StartupReport, type TextReporterOptions, monitor, renderFlamegraphHtml, renderJsonReport, renderTextReport, report };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* coldstart — tracer.ts
|
|
3
|
+
* Receives raw module load events from cjs.ts and builds:
|
|
4
|
+
* - A call tree (parent → children)
|
|
5
|
+
* - Inclusive timing (module + all its transitive requires)
|
|
6
|
+
* - Exclusive timing (module's own code only, not children)
|
|
7
|
+
* - Top slowest modules list
|
|
8
|
+
* - Event loop blocking stats (via perf_hooks)
|
|
9
|
+
*/
|
|
10
|
+
interface ModuleLoadEvent {
|
|
11
|
+
id: string;
|
|
12
|
+
request: string;
|
|
13
|
+
resolvedPath: string;
|
|
14
|
+
parentPath: string;
|
|
15
|
+
durationMs: number;
|
|
16
|
+
startTime: number;
|
|
17
|
+
cached: boolean;
|
|
18
|
+
isNodeModule: boolean;
|
|
19
|
+
isBuiltin: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface ModuleNode {
|
|
22
|
+
id: string;
|
|
23
|
+
request: string;
|
|
24
|
+
resolvedPath: string;
|
|
25
|
+
parentPath: string;
|
|
26
|
+
inclusiveMs: number;
|
|
27
|
+
exclusiveMs: number;
|
|
28
|
+
cached: boolean;
|
|
29
|
+
isNodeModule: boolean;
|
|
30
|
+
isBuiltin: boolean;
|
|
31
|
+
children: ModuleNode[];
|
|
32
|
+
depth: number;
|
|
33
|
+
}
|
|
34
|
+
interface StartupReport {
|
|
35
|
+
totalStartupMs: number;
|
|
36
|
+
eventLoop: {
|
|
37
|
+
maxBlockMs: number;
|
|
38
|
+
meanBlockMs: number;
|
|
39
|
+
p99BlockMs: number;
|
|
40
|
+
};
|
|
41
|
+
tree: ModuleNode[];
|
|
42
|
+
flat: ModuleNode[];
|
|
43
|
+
slowest: ModuleNode[];
|
|
44
|
+
nodeModuleTime: number;
|
|
45
|
+
firstPartyTime: number;
|
|
46
|
+
totalModulesLoaded: number;
|
|
47
|
+
cachedModulesCount: number;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface TextReporterOptions {
|
|
51
|
+
color?: boolean;
|
|
52
|
+
barWidth?: number;
|
|
53
|
+
showSummary?: boolean;
|
|
54
|
+
}
|
|
55
|
+
declare function renderTextReport(report: StartupReport, options?: TextReporterOptions): string;
|
|
56
|
+
|
|
57
|
+
interface JsonReporterOptions {
|
|
58
|
+
pretty?: boolean;
|
|
59
|
+
}
|
|
60
|
+
declare function renderJsonReport(report: StartupReport, options?: JsonReporterOptions): string;
|
|
61
|
+
|
|
62
|
+
declare function renderFlamegraphHtml(report: StartupReport): string;
|
|
63
|
+
|
|
64
|
+
declare function monitor(): () => StartupReport;
|
|
65
|
+
declare function report(): StartupReport;
|
|
66
|
+
|
|
67
|
+
export { type JsonReporterOptions, type ModuleLoadEvent, type ModuleNode, type StartupReport, type TextReporterOptions, monitor, renderFlamegraphHtml, renderJsonReport, renderTextReport, report };
|