@@ -173,7 +173,7 @@ function stat(filename) {
173173 filename = path . toNamespacedPath ( filename ) ;
174174 if ( statCache !== null ) {
175175 const result = statCache . get ( filename ) ;
176- if ( result !== undefined ) return result ;
176+ if ( result !== undefined ) { return result ; }
177177 }
178178 const result = internalModuleStat ( filename ) ;
179179 if ( statCache !== null && result >= 0 ) {
@@ -197,8 +197,7 @@ ObjectDefineProperty(Module, '_stat', {
197197
198198function updateChildren ( parent , child , scan ) {
199199 const children = parent ?. children ;
200- if ( children && ! ( scan && ArrayPrototypeIncludes ( children , child ) ) )
201- ArrayPrototypePush ( children , child ) ;
200+ if ( children && ! ( scan && ArrayPrototypeIncludes ( children , child ) ) ) { ArrayPrototypePush ( children , child ) ; }
202201}
203202
204203function reportModuleToWatchMode ( filename ) {
@@ -386,13 +385,14 @@ function readPackageScope(checkPath) {
386385 if ( enabledPermission && ! permission . has ( 'fs.read' , checkPath + sep ) ) {
387386 return false ;
388387 }
389- if ( StringPrototypeEndsWith ( checkPath , sep + 'node_modules' ) )
390- return false ;
388+ if ( StringPrototypeEndsWith ( checkPath , sep + 'node_modules' ) ) { return false ; }
391389 const pjson = _readPackage ( checkPath + sep ) ;
392- if ( pjson . exists ) return {
393- data : pjson ,
394- path : checkPath ,
395- } ;
390+ if ( pjson . exists ) {
391+ return {
392+ data : pjson ,
393+ path : checkPath ,
394+ } ;
395+ }
396396 } while ( separatorIndex > rootSeparatorIndex ) ;
397397 return false ;
398398}
@@ -445,7 +445,7 @@ const realpathCache = new SafeMap();
445445// absolute realpath.
446446function tryFile ( requestPath , isMain ) {
447447 const rc = _stat ( requestPath ) ;
448- if ( rc !== 0 ) return ;
448+ if ( rc !== 0 ) { return ; }
449449 if ( getOptionValue ( '--preserve-symlinks' ) && ! isMain ) {
450450 return path . resolve ( requestPath ) ;
451451 }
@@ -479,15 +479,15 @@ function findLongestRegisteredExtension(filename) {
479479 let startIndex = 0 ;
480480 while ( ( index = StringPrototypeIndexOf ( name , '.' , startIndex ) ) !== - 1 ) {
481481 startIndex = index + 1 ;
482- if ( index === 0 ) continue ; // Skip dotfiles like .gitignore
482+ if ( index === 0 ) { continue ; } // Skip dotfiles like .gitignore
483483 currentExtension = StringPrototypeSlice ( name , index ) ;
484- if ( Module . _extensions [ currentExtension ] ) return currentExtension ;
484+ if ( Module . _extensions [ currentExtension ] ) { return currentExtension ; }
485485 }
486486 return '.js' ;
487487}
488488
489489function trySelfParentPath ( parent ) {
490- if ( ! parent ) return false ;
490+ if ( ! parent ) { return false ; }
491491
492492 if ( parent . filename ) {
493493 return parent . filename ;
@@ -501,7 +501,7 @@ function trySelfParentPath(parent) {
501501}
502502
503503function trySelf ( parentPath , request ) {
504- if ( ! parentPath ) return false ;
504+ if ( ! parentPath ) { return false ; }
505505
506506 const { data : pkg , path : pkgPath } = readPackageScope ( parentPath ) ;
507507 if ( ! pkg || pkg . exports == null || pkg . name === undefined ) {
@@ -523,8 +523,7 @@ function trySelf(parentPath, request) {
523523 pathToFileURL ( pkgPath + '/package.json' ) , expansion , pkg ,
524524 pathToFileURL ( parentPath ) , getCjsConditions ( ) ) , parentPath , pkgPath ) ;
525525 } catch ( e ) {
526- if ( e . code === 'ERR_MODULE_NOT_FOUND' )
527- throw createEsmNotFoundErr ( request , pkgPath + '/package.json' ) ;
526+ if ( e . code === 'ERR_MODULE_NOT_FOUND' ) { throw createEsmNotFoundErr ( request , pkgPath + '/package.json' ) ; }
528527 throw e ;
529528 }
530529}
@@ -537,8 +536,7 @@ function resolveExports(nmPath, request) {
537536 // The implementation's behavior is meant to mirror resolution in ESM.
538537 const { 1 : name , 2 : expansion = '' } =
539538 RegExpPrototypeExec ( EXPORTS_PATTERN , request ) || kEmptyObject ;
540- if ( ! name )
541- return ;
539+ if ( ! name ) { return ; }
542540 const pkgPath = path . resolve ( nmPath , name ) ;
543541 const pkg = _readPackage ( pkgPath ) ;
544542 if ( pkg . exists && pkg . exports != null ) {
@@ -548,8 +546,7 @@ function resolveExports(nmPath, request) {
548546 pathToFileURL ( pkgPath + '/package.json' ) , '.' + expansion , pkg , null ,
549547 getCjsConditions ( ) ) , null , pkgPath ) ;
550548 } catch ( e ) {
551- if ( e . code === 'ERR_MODULE_NOT_FOUND' )
552- throw createEsmNotFoundErr ( request , pkgPath + '/package.json' ) ;
549+ if ( e . code === 'ERR_MODULE_NOT_FOUND' ) { throw createEsmNotFoundErr ( request , pkgPath + '/package.json' ) ; }
553550 throw e ;
554551 }
555552 }
@@ -571,8 +568,7 @@ Module._findPath = function(request, paths, isMain) {
571568
572569 const cacheKey = request + '\x00' + ArrayPrototypeJoin ( paths , '\x00' ) ;
573570 const entry = Module . _pathCache [ cacheKey ] ;
574- if ( entry )
575- return entry ;
571+ if ( entry ) { return entry ; }
576572
577573 let exts ;
578574 const trailingSlash = request . length > 0 &&
@@ -619,8 +615,7 @@ Module._findPath = function(request, paths, isMain) {
619615
620616 if ( ! absoluteRequest ) {
621617 const exportsResolved = resolveExports ( curPath , request ) ;
622- if ( exportsResolved )
623- return exportsResolved ;
618+ if ( exportsResolved ) { return exportsResolved ; }
624619 }
625620
626621 const basePath = path . resolve ( curPath , request ) ;
@@ -652,16 +647,14 @@ Module._findPath = function(request, paths, isMain) {
652647
653648 if ( ! filename ) {
654649 // Try it with each of the extensions
655- if ( exts === undefined )
656- exts = ObjectKeys ( Module . _extensions ) ;
650+ if ( exts === undefined ) { exts = ObjectKeys ( Module . _extensions ) ; }
657651 filename = tryExtensions ( basePath , exts , isMain ) ;
658652 }
659653 }
660654
661655 if ( ! filename && rc === 1 ) { // Directory.
662656 // try it with each of the extensions at "index"
663- if ( exts === undefined )
664- exts = ObjectKeys ( Module . _extensions ) ;
657+ if ( exts === undefined ) { exts = ObjectKeys ( Module . _extensions ) ; }
665658 filename = tryPackage ( basePath , exts , isMain , request ) ;
666659 }
667660
@@ -697,8 +690,7 @@ if (isWindows) {
697690 // path.resolve will make sure from.length >=3 in Windows.
698691 if ( StringPrototypeCharCodeAt ( from , from . length - 1 ) ===
699692 CHAR_BACKWARD_SLASH &&
700- StringPrototypeCharCodeAt ( from , from . length - 2 ) === CHAR_COLON )
701- return [ from + 'node_modules' ] ;
693+ StringPrototypeCharCodeAt ( from , from . length - 2 ) === CHAR_COLON ) { return [ from + 'node_modules' ] ; }
702694
703695 const paths = [ ] ;
704696 for ( let i = from . length - 1 , p = 0 , last = from . length ; i >= 0 ; -- i ) {
@@ -711,11 +703,12 @@ if (isWindows) {
711703 if ( code === CHAR_BACKWARD_SLASH ||
712704 code === CHAR_FORWARD_SLASH ||
713705 code === CHAR_COLON ) {
714- if ( p !== nmLen )
706+ if ( p !== nmLen ) {
715707 ArrayPrototypePush (
716708 paths ,
717709 StringPrototypeSlice ( from , 0 , last ) + '\\node_modules' ,
718710 ) ;
711+ }
719712 last = i ;
720713 p = 0 ;
721714 } else if ( p !== - 1 ) {
@@ -736,8 +729,7 @@ if (isWindows) {
736729 from = path . resolve ( from ) ;
737730 // Return early not only to avoid unnecessary work, but to *avoid* returning
738731 // an array of two items for a root: [ '//node_modules', '/node_modules' ]
739- if ( from === '/' )
740- return [ '/node_modules' ] ;
732+ if ( from === '/' ) { return [ '/node_modules' ] ; }
741733
742734 // note: this approach *only* works when the path is guaranteed
743735 // to be absolute. Doing a fully-edge-case-correct path.split
@@ -746,11 +738,12 @@ if (isWindows) {
746738 for ( let i = from . length - 1 , p = 0 , last = from . length ; i >= 0 ; -- i ) {
747739 const code = StringPrototypeCharCodeAt ( from , i ) ;
748740 if ( code === CHAR_FORWARD_SLASH ) {
749- if ( p !== nmLen )
741+ if ( p !== nmLen ) {
750742 ArrayPrototypePush (
751743 paths ,
752744 StringPrototypeSlice ( from , 0 , last ) + '/node_modules' ,
753745 ) ;
746+ }
754747 last = i ;
755748 p = 0 ;
756749 } else if ( p !== - 1 ) {
@@ -827,14 +820,15 @@ const CircularRequirePrototypeWarningProxy = new Proxy({}, {
827820 // Allow __esModule access in any case because it is used in the output
828821 // of transpiled code to determine whether something comes from an
829822 // ES module, and is not used as a regular key of `module.exports`.
830- if ( prop in target || prop === '__esModule' ) return target [ prop ] ;
823+ if ( prop in target || prop === '__esModule' ) { return target [ prop ] ; }
831824 emitCircularRequireWarning ( prop ) ;
832825 return undefined ;
833826 } ,
834827
835828 getOwnPropertyDescriptor ( target , prop ) {
836- if ( ObjectPrototypeHasOwnProperty ( target , prop ) || prop === '__esModule' )
829+ if ( ObjectPrototypeHasOwnProperty ( target , prop ) || prop === '__esModule' ) {
837830 return ObjectGetOwnPropertyDescriptor ( target , prop ) ;
831+ }
838832 emitCircularRequireWarning ( prop ) ;
839833 return undefined ;
840834 } ,
@@ -878,8 +872,7 @@ Module._load = function(request, parent, isMain) {
878872 const cachedModule = Module . _cache [ filename ] ;
879873 if ( cachedModule !== undefined ) {
880874 updateChildren ( parent , cachedModule , true ) ;
881- if ( ! cachedModule . loaded )
882- return getExportsForCircularRequire ( cachedModule ) ;
875+ if ( ! cachedModule . loaded ) { return getExportsForCircularRequire ( cachedModule ) ; }
883876 return cachedModule . exports ;
884877 }
885878 delete relativeResolveCache [ relResolveCacheIdentifier ] ;
@@ -904,8 +897,7 @@ Module._load = function(request, parent, isMain) {
904897 updateChildren ( parent , cachedModule , true ) ;
905898 if ( ! cachedModule . loaded ) {
906899 const parseCachedModule = cjsParseCache . get ( cachedModule ) ;
907- if ( ! parseCachedModule || parseCachedModule . loaded )
908- return getExportsForCircularRequire ( cachedModule ) ;
900+ if ( ! parseCachedModule || parseCachedModule . loaded ) { return getExportsForCircularRequire ( cachedModule ) ; }
909901 parseCachedModule . loaded = true ;
910902 } else {
911903 return cachedModule . exports ;
@@ -988,8 +980,7 @@ Module._resolveFilename = function(request, parent, isMain, options) {
988980 const lookupPaths = Module . _resolveLookupPaths ( request , fakeParent ) ;
989981
990982 for ( let j = 0 ; j < lookupPaths . length ; j ++ ) {
991- if ( ! ArrayPrototypeIncludes ( paths , lookupPaths [ j ] ) )
992- ArrayPrototypePush ( paths , lookupPaths [ j ] ) ;
983+ if ( ! ArrayPrototypeIncludes ( paths , lookupPaths [ j ] ) ) { ArrayPrototypePush ( paths , lookupPaths [ j ] ) ; }
993984 }
994985 }
995986 }
@@ -1013,8 +1004,7 @@ Module._resolveFilename = function(request, parent, isMain, options) {
10131004 getCjsConditions ( ) ) , parentPath ,
10141005 pkg . path ) ;
10151006 } catch ( e ) {
1016- if ( e . code === 'ERR_MODULE_NOT_FOUND' )
1017- throw createEsmNotFoundErr ( request ) ;
1007+ if ( e . code === 'ERR_MODULE_NOT_FOUND' ) { throw createEsmNotFoundErr ( request ) ; }
10181008 throw e ;
10191009 }
10201010 }
@@ -1032,7 +1022,7 @@ Module._resolveFilename = function(request, parent, isMain, options) {
10321022
10331023 // Look up the filename first, since that's the cache key.
10341024 const filename = Module . _findPath ( request , paths , isMain ) ;
1035- if ( filename ) return filename ;
1025+ if ( filename ) { return filename ; }
10361026 const requireStack = [ ] ;
10371027 for ( let cursor = parent ;
10381028 cursor ;
@@ -1053,13 +1043,13 @@ Module._resolveFilename = function(request, parent, isMain, options) {
10531043
10541044function finalizeEsmResolution ( resolved , parentPath , pkgPath ) {
10551045 const { encodedSepRegEx } = require ( 'internal/modules/esm/resolve' ) ;
1056- if ( RegExpPrototypeExec ( encodedSepRegEx , resolved ) !== null )
1046+ if ( RegExpPrototypeExec ( encodedSepRegEx , resolved ) !== null ) {
10571047 throw new ERR_INVALID_MODULE_SPECIFIER (
10581048 resolved , 'must not include encoded "/" or "\\" characters' , parentPath ) ;
1049+ }
10591050 const filename = fileURLToPath ( resolved ) ;
10601051 const actual = tryFile ( filename ) ;
1061- if ( actual )
1062- return actual ;
1052+ if ( actual ) { return actual ; }
10631053 const err = createEsmNotFoundErr ( filename ,
10641054 path . resolve ( pkgPath , 'package.json' ) ) ;
10651055 throw err ;
@@ -1069,8 +1059,7 @@ function createEsmNotFoundErr(request, path) {
10691059 // eslint-disable-next-line no-restricted-syntax
10701060 const err = new Error ( `Cannot find module '${ request } '` ) ;
10711061 err . code = 'MODULE_NOT_FOUND' ;
1072- if ( path )
1073- err . path = path ;
1062+ if ( path ) { err . path = path ; }
10741063 // TODO(BridgeAR): Add the requireStack as well.
10751064 return err ;
10761065}
@@ -1085,8 +1074,9 @@ Module.prototype.load = function(filename) {
10851074
10861075 const extension = findLongestRegisteredExtension ( filename ) ;
10871076 // allow .mjs to be overridden
1088- if ( StringPrototypeEndsWith ( filename , '.mjs' ) && ! Module . _extensions [ '.mjs' ] )
1077+ if ( StringPrototypeEndsWith ( filename , '.mjs' ) && ! Module . _extensions [ '.mjs' ] ) {
10891078 throw new ERR_REQUIRE_ESM ( filename , true ) ;
1079+ }
10901080
10911081 Module . _extensions [ extension ] ( this , filename ) ;
10921082 this . loaded = true ;
@@ -1097,8 +1087,7 @@ Module.prototype.load = function(filename) {
10971087 // Preemptively cache
10981088 if ( ( module ?. module === undefined ||
10991089 module . module . getStatus ( ) < kEvaluated ) &&
1100- ! cascadedLoader . cjsCache . has ( this ) )
1101- cascadedLoader . cjsCache . set ( this , exports ) ;
1090+ ! cascadedLoader . cjsCache . has ( this ) ) { cascadedLoader . cjsCache . set ( this , exports ) ; }
11021091} ;
11031092
11041093// Loads a module at the given file path. Returns that module's
@@ -1233,7 +1222,7 @@ Module.prototype._compile = function(content, filename) {
12331222 const exports = this . exports ;
12341223 const thisValue = exports ;
12351224 const module = this ;
1236- if ( requireDepth === 0 ) statCache = new SafeMap ( ) ;
1225+ if ( requireDepth === 0 ) { statCache = new SafeMap ( ) ; }
12371226 if ( inspectorWrapper ) {
12381227 result = inspectorWrapper ( compiledWrapper , thisValue , exports ,
12391228 require , module , filename , dirname ) ;
@@ -1242,7 +1231,7 @@ Module.prototype._compile = function(content, filename) {
12421231 [ exports , require , module , filename , dirname ] ) ;
12431232 }
12441233 hasLoadedAnyUserCJSModule = true ;
1245- if ( requireDepth === 0 ) statCache = null ;
1234+ if ( requireDepth === 0 ) { statCache = null ; }
12461235 return result ;
12471236} ;
12481237
@@ -1399,8 +1388,7 @@ Module._initPaths = function() {
13991388} ;
14001389
14011390Module . _preloadModules = function ( requests ) {
1402- if ( ! ArrayIsArray ( requests ) )
1403- return ;
1391+ if ( ! ArrayIsArray ( requests ) ) { return ; }
14041392
14051393 isPreloading = true ;
14061394
@@ -1416,8 +1404,7 @@ Module._preloadModules = function(requests) {
14161404 throw e ;
14171405 }
14181406 }
1419- for ( let n = 0 ; n < requests . length ; n ++ )
1420- internalRequire ( parent , requests [ n ] ) ;
1407+ for ( let n = 0 ; n < requests . length ; n ++ ) { internalRequire ( parent , requests [ n ] ) ; }
14211408 isPreloading = false ;
14221409} ;
14231410
0 commit comments