| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 00668fc commit c19385c
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -287,17 +287,16 @@ class BuiltinModule { | |||
| 287 | 287 | } | |
| 288 | 288 | ||
| 289 | 289 | static normalizeRequirableId(id) { | |
| 290 | - let normalizedId = id; | ||
| 291 | 290 | if (StringPrototypeStartsWith(id, 'node:')) { | |
| 292 | - normalizedId = StringPrototypeSlice(id, 5); | ||
| 293 | - } | ||
| 294 | - | ||
| 295 | - if (!BuiltinModule.canBeRequiredByUsers(normalizedId) || | ||
| 296 | - (id === normalizedId && !BuiltinModule.canBeRequiredWithoutScheme(normalizedId))) { | ||
| 297 | - return undefined; | ||
| 291 | + const normalizedId = StringPrototypeSlice(id, 5); | ||
| 292 | + if (BuiltinModule.canBeRequiredByUsers(normalizedId)) { | ||
| 293 | + return normalizedId; | ||
| 294 | + } | ||
| 295 | + } else if (BuiltinModule.canBeRequiredWithoutScheme(id)) { | ||
| 296 | + return id; | ||
| 298 | 297 | } | |
| 299 | 298 | ||
| 300 | - return normalizedId; | ||
| 299 | + return undefined; | ||
| 301 | 300 | } | |
| 302 | 301 | ||
| 303 | 302 | static isBuiltin(id) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -792,12 +792,7 @@ if (isWindows) { | |||
| 792 | 792 | } | |
| 793 | 793 | ||
| 794 | 794 | Module._resolveLookupPaths = function(request, parent) { | |
| 795 | - if (( | ||
| 796 | - StringPrototypeStartsWith(request, 'node:') && | ||
| 797 | - BuiltinModule.canBeRequiredByUsers(StringPrototypeSlice(request, 5)) | ||
| 798 | - ) || ( | ||
| 799 | - BuiltinModule.canBeRequiredWithoutScheme(request) | ||
| 800 | - )) { | ||
| 795 | + if (BuiltinModule.normalizeRequirableId(request)) { | ||
| 801 | 796 | debug('looking for %j in []', request); | |
| 802 | 797 | return null; | |
| 803 | 798 | } | |
@@ -989,14 +984,7 @@ Module._load = function(request, parent, isMain) { | |||
| 989 | 984 | }; | |
| 990 | 985 | ||
| 991 | 986 | Module._resolveFilename = function(request, parent, isMain, options) { | |
| 992 | - if ( | ||
| 993 | - ( | ||
| 994 | - StringPrototypeStartsWith(request, 'node:') && | ||
| 995 | - BuiltinModule.canBeRequiredByUsers(StringPrototypeSlice(request, 5)) | ||
| 996 | - ) || ( | ||
| 997 | - BuiltinModule.canBeRequiredWithoutScheme(request) | ||
| 998 | - ) | ||
| 999 | - ) { | ||
| 987 | + if (BuiltinModule.normalizeRequirableId(request)) { | ||
| 1000 | 988 | return request; | |
| 1001 | 989 | } | |
| 1002 | 990 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments