File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { writeFileSync } from "fs" ;
1
2
import path from "path" ;
3
+
4
+ const getV8Flags = ( nodeVersionMajor : number ) => {
5
+ const flags = [
6
+ "--hash-seed=1" ,
7
+ "--random-seed=1" ,
8
+ "--no-opt" ,
9
+ "--predictable" ,
10
+ "--predictable-gc-schedule" ,
11
+ ] ;
12
+ if ( nodeVersionMajor < 18 ) {
13
+ flags . push ( "--no-randomize-hashes" ) ;
14
+ }
15
+ if ( nodeVersionMajor < 20 ) {
16
+ flags . push ( "--no-scavenge-task" ) ;
17
+ }
18
+ return flags ;
19
+ } ;
20
+
21
+ if ( process . env . __CODSPEED_NODE_CORE_INTROSPECTION_PATH__ !== undefined ) {
22
+ const nodeVersionMajor = parseInt ( process . version . slice ( 1 ) . split ( "." ) [ 0 ] ) ;
23
+
24
+ const introspectionMetadata = {
25
+ flags : getV8Flags ( nodeVersionMajor ) ,
26
+ } ;
27
+ writeFileSync (
28
+ process . env . __CODSPEED_NODE_CORE_INTROSPECTION_PATH__ ,
29
+ JSON . stringify ( introspectionMetadata )
30
+ ) ;
31
+ process . exit ( 0 ) ;
32
+ }
33
+
2
34
declare const __VERSION__ : string ;
3
35
4
36
/* eslint-disable @typescript-eslint/no-empty-function */
You can’t perform that action at this time.
0 commit comments