@builder.io/dev-tools 1.72.5-dev.202607071234.b7d113565 → 1.72.5-dev.202607071534.b7d113565
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/cli/index.cjs +108 -3
- package/cli/index.cjs.map +2 -2
- package/core/index.cjs +1 -1
- package/core/index.mjs +1 -1
- package/node/index.cjs +1 -1
- package/node/index.mjs +1 -1
- package/package.json +1 -1
- package/server/index.cjs +3 -2
- package/server/index.mjs +3 -2
- package/types/cli/launch/memory-pressure-monitor.d.ts +44 -0
- package/types/cli/launch/memory-pressure-monitor.test.d.ts +1 -0
- package/types/tsconfig.tsbuildinfo +1 -1
|
@@ -7,3 +7,47 @@
|
|
|
7
7
|
* Uses container memory limit if available, falls back to V8 heap stats
|
|
8
8
|
*/
|
|
9
9
|
export declare function getMemoryPressure(): number;
|
|
10
|
+
/** True when the process runs under a real container memory limit (cgroup). */
|
|
11
|
+
export declare function hasConstrainedMemory(): boolean;
|
|
12
|
+
export type MemoryPressureAction = "none" | "warn" | "critical";
|
|
13
|
+
export interface MemoryPressureEvaluatorOptions {
|
|
14
|
+
/** Ratio (0-1) at which to start warning. */
|
|
15
|
+
warnThreshold?: number;
|
|
16
|
+
/** Ratio (0-1) at which OOM is imminent and we should bail out. */
|
|
17
|
+
criticalThreshold?: number;
|
|
18
|
+
/** Consecutive critical readings required before acting (debounces spikes). */
|
|
19
|
+
sustainedCriticalChecks?: number;
|
|
20
|
+
/** Minimum gap between "warn" actions so logs don't flood. */
|
|
21
|
+
warnThrottleMs?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Pure decision logic for memory-pressure handling, split out so the
|
|
25
|
+
* thresholds / debounce / throttle behaviour can be unit-tested without timers.
|
|
26
|
+
*
|
|
27
|
+
* `evaluate` is called once per sample and returns at most one action:
|
|
28
|
+
* - "warn": pressure is high (throttled) — log loudly.
|
|
29
|
+
* - "critical": pressure has stayed above the critical threshold for
|
|
30
|
+
* `sustainedCriticalChecks` samples. Fires exactly once — the caller should
|
|
31
|
+
* initiate a graceful shutdown before the kernel OOM-kills the process.
|
|
32
|
+
*/
|
|
33
|
+
export declare class MemoryPressureEvaluator {
|
|
34
|
+
#private;
|
|
35
|
+
constructor(opts?: MemoryPressureEvaluatorOptions);
|
|
36
|
+
evaluate(pressure: number, nowMs: number): MemoryPressureAction;
|
|
37
|
+
}
|
|
38
|
+
export interface MemoryPressureGuard {
|
|
39
|
+
start(): void;
|
|
40
|
+
stop(): void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Periodically samples memory pressure and dispatches warn / critical actions.
|
|
44
|
+
* `onCritical` is invoked at most once per guard instance.
|
|
45
|
+
*/
|
|
46
|
+
export declare function createMemoryPressureGuard(opts: {
|
|
47
|
+
onWarn: (pressure: number) => void;
|
|
48
|
+
onCritical: (pressure: number) => void;
|
|
49
|
+
intervalMs?: number;
|
|
50
|
+
getPressure?: () => number;
|
|
51
|
+
now?: () => number;
|
|
52
|
+
evaluator?: MemoryPressureEvaluatorOptions;
|
|
53
|
+
}): MemoryPressureGuard;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|