mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
implement perf_hooks.constants (#3476)
This commit is contained in:
26
packages/bun-types/perf_hooks.d.ts
vendored
26
packages/bun-types/perf_hooks.d.ts
vendored
@@ -452,19 +452,19 @@ declare module "perf_hooks" {
|
||||
// },
|
||||
// ): void;
|
||||
// }
|
||||
// namespace constants {
|
||||
// const NODE_PERFORMANCE_GC_MAJOR: number;
|
||||
// const NODE_PERFORMANCE_GC_MINOR: number;
|
||||
// const NODE_PERFORMANCE_GC_INCREMENTAL: number;
|
||||
// const NODE_PERFORMANCE_GC_WEAKCB: number;
|
||||
// const NODE_PERFORMANCE_GC_FLAGS_NO: number;
|
||||
// const NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: number;
|
||||
// const NODE_PERFORMANCE_GC_FLAGS_FORCED: number;
|
||||
// const NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: number;
|
||||
// const NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: number;
|
||||
// const NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: number;
|
||||
// const NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: number;
|
||||
// }
|
||||
namespace constants {
|
||||
const NODE_PERFORMANCE_GC_MAJOR: number;
|
||||
const NODE_PERFORMANCE_GC_MINOR: number;
|
||||
const NODE_PERFORMANCE_GC_INCREMENTAL: number;
|
||||
const NODE_PERFORMANCE_GC_WEAKCB: number;
|
||||
const NODE_PERFORMANCE_GC_FLAGS_NO: number;
|
||||
const NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: number;
|
||||
const NODE_PERFORMANCE_GC_FLAGS_FORCED: number;
|
||||
const NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: number;
|
||||
const NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: number;
|
||||
const NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: number;
|
||||
const NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: number;
|
||||
}
|
||||
const performance: Performance;
|
||||
// interface EventLoopMonitorOptions {
|
||||
// /**
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
// Hardcoded module "node:perf_hooks"
|
||||
import { throwNotImplemented } from "../shared";
|
||||
|
||||
export var constants = {
|
||||
NODE_PERFORMANCE_GC_MAJOR: 4,
|
||||
NODE_PERFORMANCE_GC_MINOR: 1,
|
||||
NODE_PERFORMANCE_GC_INCREMENTAL: 8,
|
||||
NODE_PERFORMANCE_GC_WEAKCB: 16,
|
||||
NODE_PERFORMANCE_GC_FLAGS_NO: 0,
|
||||
NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: 2,
|
||||
NODE_PERFORMANCE_GC_FLAGS_FORCED: 4,
|
||||
NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: 8,
|
||||
NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: 16,
|
||||
NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: 32,
|
||||
NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: 64,
|
||||
};
|
||||
|
||||
export var performance = globalThis.performance;
|
||||
|
||||
export class PerformanceObserver {
|
||||
@@ -22,6 +36,7 @@ export class PerformanceNodeTiming {
|
||||
|
||||
export default {
|
||||
performance,
|
||||
constants,
|
||||
PerformanceEntry,
|
||||
PerformanceNodeTiming,
|
||||
[Symbol.for("CommonJS")]: 0,
|
||||
|
||||
Reference in New Issue
Block a user