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 — module: use kNodeModulesRE to detect node_modules · nodejs/node@cf8701c

File tree

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

‎lib/internal/modules/esm/load.js‎

Copy file name to clipboardExpand all lines: lib/internal/modules/esm/load.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ const {
55
RegExpPrototypeExec,
66
decodeURIComponent,
77
} = primordials;
8-
const { kEmptyObject } = require('internal/util');
8+
const {
9+
kEmptyObject,
10+
} = require('internal/util');
911

1012
const { defaultGetFormat } = require('internal/modules/esm/get_format');
1113
const { validateAttributes, emitImportAssertionWarning } = require('internal/modules/esm/assert');
Collapse file

‎lib/internal/util.js‎

Copy file name to clipboardExpand all lines: lib/internal/util.js
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,10 @@ function spliceOne(list, index) {
477477

478478
const kNodeModulesRE = /^(?:.*)[\\/]node_modules[\\/]/;
479479

480+
function isUnderNodeModules(filename) {
481+
return filename && (RegExpPrototypeExec(kNodeModulesRE, filename) !== null);
482+
}
483+
480484
let getStructuredStackImpl;
481485

482486
function lazyGetStructuredStack() {
@@ -524,7 +528,7 @@ function isInsideNodeModules() {
524528
) {
525529
continue;
526530
}
527-
return RegExpPrototypeExec(kNodeModulesRE, filename) !== null;
531+
return isUnderNodeModules(filename);
528532
}
529533
}
530534
return false;
@@ -913,6 +917,7 @@ module.exports = {
913917
isArrayBufferDetached,
914918
isError,
915919
isInsideNodeModules,
920+
isUnderNodeModules,
916921
join,
917922
lazyDOMException,
918923
lazyDOMExceptionClass,

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.