@@ -62,7 +62,9 @@ function patcher$1(fs = fs__namespace, roots) {
62
62
if ( err ) {
63
63
return cb ( err ) ;
64
64
}
65
- path__namespace . resolve ( args [ 0 ] ) ;
65
+ path__namespace . resolve (
66
+ // node 20.12 tightened the constraints and requires the input to be a string
67
+ String ( args [ 0 ] ) ) ;
66
68
if ( ! stats . isSymbolicLink ( ) ) {
67
69
return cb ( null , stats ) ;
68
70
}
@@ -216,7 +218,9 @@ function patcher$1(fs = fs__namespace, roots) {
216
218
return str ;
217
219
} ;
218
220
fs . readdir = ( ...args ) => {
219
- const p = path__namespace . resolve ( args [ 0 ] ) ;
221
+ const p = path__namespace . resolve (
222
+ // node 20.12 tightened the constraints and requires the input to be a string
223
+ String ( args [ 0 ] ) ) ;
220
224
let cb = args [ args . length - 1 ] ;
221
225
if ( typeof cb !== 'function' ) {
222
226
// this will likely throw callback required error.
@@ -229,8 +233,7 @@ function patcher$1(fs = fs__namespace, roots) {
229
233
}
230
234
// user requested withFileTypes
231
235
if ( result [ 0 ] && result [ 0 ] . isSymbolicLink ) {
232
- Promise
233
- . all ( result . map ( ( v ) => handleDirent ( p , v ) ) )
236
+ Promise . all ( result . map ( ( v ) => handleDirent ( p , v ) ) )
234
237
. then ( ( ) => {
235
238
cb ( null , result ) ;
236
239
} )
@@ -247,7 +250,9 @@ function patcher$1(fs = fs__namespace, roots) {
247
250
} ;
248
251
fs . readdirSync = ( ...args ) => {
249
252
const res = origReaddirSync ( ...args ) ;
250
- const p = path__namespace . resolve ( args [ 0 ] ) ;
253
+ const p = path__namespace . resolve (
254
+ // node 20.12 tightened the constraints and requires the input to be a string
255
+ String ( args [ 0 ] ) ) ;
251
256
res . forEach ( ( v ) => {
252
257
handleDirentSync ( p , v ) ;
253
258
} ) ;
@@ -561,21 +566,22 @@ const runfilesPathMatcher = '.runfiles';
561
566
function inferRunfilesDirFromPath ( maybeRunfilesSource ) {
562
567
while ( maybeRunfilesSource !== '/' ) {
563
568
if ( maybeRunfilesSource . endsWith ( runfilesPathMatcher ) ) {
564
- return maybeRunfilesSource + '/' ;
569
+ return ( maybeRunfilesSource + '/' ) ;
565
570
}
566
571
maybeRunfilesSource = path__namespace . dirname ( maybeRunfilesSource ) ;
567
572
}
568
573
throw new Error ( 'Path does not contain a runfiles parent directory.' ) ;
569
574
}
570
- const removeNulls = ( value ) => value != null ;
575
+ function removeNulls ( value ) {
576
+ return value != null ;
577
+ }
571
578
function runfilesLocator ( ) {
572
579
// Sometimes cwd is under runfiles
573
580
const cwd = process . cwd ( ) ;
574
581
// Runfiles environment variables are the preferred reference point, but can fail
575
- const envRunfilesCanidates = [
576
- process . env . RUNFILES_DIR ,
577
- process . env . RUNFILES ,
578
- ] . filter ( removeNulls ) . map ( runfilesDir => {
582
+ const envRunfilesCanidates = [ process . env . RUNFILES_DIR , process . env . RUNFILES ]
583
+ . filter ( removeNulls )
584
+ . map ( runfilesDir => {
579
585
const adjustedRunfilesDir = fs__namespace . realpathSync ( runfilesDir ) ;
580
586
if ( runfilesDir !== adjustedRunfilesDir ) {
581
587
return adjustedRunfilesDir ;
@@ -625,8 +631,7 @@ VERBOSE_LOGS, } = process.env;
625
631
if ( BAZEL_PATCH_ROOTS ) {
626
632
const roots = BAZEL_PATCH_ROOTS ? BAZEL_PATCH_ROOTS . split ( ',' ) : [ ] ;
627
633
if ( VERBOSE_LOGS ) {
628
- console
629
- . error ( `bazel node patches enabled. roots: ${ roots } symlinks in these directories will not escape` ) ;
634
+ console . error ( `bazel node patches enabled. roots: ${ roots } symlinks in these directories will not escape` ) ;
630
635
}
631
636
const fs = require ( 'fs' ) ;
632
637
patcher$1 ( fs , roots ) ;
0 commit comments