@@ -153,7 +153,7 @@ function stat(filename) {
153
153
}
154
154
155
155
function updateChildren ( parent , child , scan ) {
156
- const children = parent && parent . children ;
156
+ const children = parent ? .children ;
157
157
if ( children && ! ( scan && ArrayPrototypeIncludes ( children , child ) ) )
158
158
ArrayPrototypePush ( children , child ) ;
159
159
}
@@ -467,7 +467,7 @@ function resolveExports(nmPath, request) {
467
467
return ;
468
468
const pkgPath = path . resolve ( nmPath , name ) ;
469
469
const pkg = readPackage ( pkgPath ) ;
470
- if ( pkg && pkg . exports !== null && pkg . exports !== undefined ) {
470
+ if ( pkg ? .exports != null ) {
471
471
try {
472
472
return finalizeEsmResolution ( packageExportsResolve (
473
473
pathToFileURL ( pkgPath + '/package.json' ) , '.' + expansion , pkg , null ,
@@ -668,7 +668,7 @@ Module._resolveLookupPaths = function(request, parent) {
668
668
( ! isWindows || StringPrototypeCharAt ( request , 1 ) !== '\\' ) ) ) {
669
669
670
670
let paths = modulePaths ;
671
- if ( parent != null && parent . paths && parent . paths . length ) {
671
+ if ( parent ? .paths ? .length ) {
672
672
paths = ArrayPrototypeConcat ( parent . paths , paths ) ;
673
673
}
674
674
@@ -781,7 +781,7 @@ Module._load = function(request, parent, isMain) {
781
781
}
782
782
783
783
const mod = loadNativeModule ( filename , request ) ;
784
- if ( mod && mod . canBeRequiredByUsers ) return mod . exports ;
784
+ if ( mod ? .canBeRequiredByUsers ) return mod . exports ;
785
785
786
786
// Don't call updateChildren(), Module constructor already does.
787
787
const module = cachedModule || new Module ( filename , parent ) ;
@@ -817,7 +817,7 @@ Module._load = function(request, parent, isMain) {
817
817
delete Module . _cache [ filename ] ;
818
818
if ( parent !== undefined ) {
819
819
delete relativeResolveCache [ relResolveCacheIdentifier ] ;
820
- const children = parent && parent . children ;
820
+ const children = parent ? .children ;
821
821
if ( ArrayIsArray ( children ) ) {
822
822
const index = ArrayPrototypeIndexOf ( children , module ) ;
823
823
if ( index !== - 1 ) {
@@ -877,11 +877,10 @@ Module._resolveFilename = function(request, parent, isMain, options) {
877
877
paths = Module . _resolveLookupPaths ( request , parent ) ;
878
878
}
879
879
880
- if ( parent && parent . filename ) {
880
+ if ( parent ? .filename ) {
881
881
if ( request [ 0 ] === '#' ) {
882
882
const pkg = readPackageScope ( parent . filename ) || { } ;
883
- if ( pkg . data && pkg . data . imports !== null &&
884
- pkg . data . imports !== undefined ) {
883
+ if ( pkg . data ?. imports != null ) {
885
884
try {
886
885
return finalizeEsmResolution (
887
886
packageImportsResolve ( request , pathToFileURL ( parent . filename ) ,
@@ -1102,17 +1101,17 @@ Module._extensions['.js'] = function(module, filename) {
1102
1101
if ( StringPrototypeEndsWith ( filename , '.js' ) ) {
1103
1102
const pkg = readPackageScope ( filename ) ;
1104
1103
// Function require shouldn't be used in ES modules.
1105
- if ( pkg && pkg . data && pkg . data . type === 'module' ) {
1104
+ if ( pkg ? .data ? .type === 'module' ) {
1106
1105
const parent = moduleParentCache . get ( module ) ;
1107
- const parentPath = parent && parent . filename ;
1106
+ const parentPath = parent ? .filename ;
1108
1107
const packageJsonPath = path . resolve ( pkg . path , 'package.json' ) ;
1109
1108
throw new ERR_REQUIRE_ESM ( filename , parentPath , packageJsonPath ) ;
1110
1109
}
1111
1110
}
1112
1111
// If already analyzed the source, then it will be cached.
1113
1112
const cached = cjsParseCache . get ( module ) ;
1114
1113
let content ;
1115
- if ( cached && cached . source ) {
1114
+ if ( cached ? .source ) {
1116
1115
content = cached . source ;
1117
1116
cached . source = undefined ;
1118
1117
} else {
0 commit comments