import stripJsonComments from 'strip-json-comments' ; const nodeVersion = ( process . versions . node . match ( /^(\d+)\.(\d+)/ ) || [ ] ) . slice ( 1 ) . map ( Number ) ; export function removeNodePrefix ( code ) { if ( nodeVersion [ 0 ] <= 14 && nodeVersion [ 1 ] < 18 ) { return code . replace ( /([\b\(])require\("node:([^"]+)"\)([\b\)])/g , '$1require("$2")$3' ) ; } return code ; } export function jsoncParse ( data ) { try { return new Function ( 'return ' + stripJsonComments ( data ) . trim ( ) ) ( ) ; } catch ( _ ) { return { } ; } }