| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e2f3ed1 commit 5d682c5
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -87,19 +87,17 @@ function makeRequireFunction(mod, redirects) { | |||
| 87 | 87 | if (destination === true) { | |
| 88 | 88 | missing = false; | |
| 89 | 89 | } else if (destination) { | |
| 90 | - const href = destination.href; | ||
| 91 | - if (destination.protocol === 'node:') { | ||
| 90 | + const { href, protocol } = destination; | ||
| 91 | + if (protocol === 'node:') { | ||
| 92 | 92 | const specifier = destination.pathname; | |
| 93 | 93 | const mod = loadBuiltinModule(specifier, href); | |
| 94 | 94 | if (mod && mod.canBeRequiredByUsers) { | |
| 95 | 95 | return mod.exports; | |
| 96 | 96 | } | |
| 97 | 97 | throw new ERR_UNKNOWN_BUILTIN_MODULE(specifier); | |
| 98 | - } else if (destination.protocol === 'file:') { | ||
| 99 | - let filepath; | ||
| 100 | - if (urlToFileCache.has(href)) { | ||
| 101 | - filepath = urlToFileCache.get(href); | ||
| 102 | - } else { | ||
| 98 | + } else if (protocol === 'file:') { | ||
| 99 | + let filepath = urlToFileCache.get(href); | ||
| 100 | + if (!filepath) { | ||
| 103 | 101 | filepath = fileURLToPath(destination); | |
| 104 | 102 | urlToFileCache.set(href, filepath); | |
| 105 | 103 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments