GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — lib: reduce url getters on `makeRequireFunction` · nodejs/node@32bda81

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/modules
    • helpers.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/modules/helpers.js‎

Copy file name to clipboardExpand all lines: lib/internal/modules/helpers.js
+5-7Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,18 @@ function makeRequireFunction(mod, redirects) {
8686
if (destination === true) {
8787
missing = false;
8888
} else if (destination) {
89-
const href = destination.href;
90-
if (destination.protocol === 'node:') {
89+
const { href, protocol } = destination;
90+
if (protocol === 'node:') {
9191
const specifier = destination.pathname;
9292

9393
if (BuiltinModule.canBeRequiredByUsers(specifier)) {
9494
const mod = loadBuiltinModule(specifier, href);
9595
return mod.exports;
9696
}
9797
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) {
103101
filepath = fileURLToPath(destination);
104102
urlToFileCache.set(href, filepath);
105103
}

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.