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: avoid memory allocation on nodeprecation flag · nodejs/node@0a0b416

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal
    • modules/esm
      • resolve.js
    • process
      • warning.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: lib/internal/modules/esm/resolve.js
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ const emittedPackageWarnings = new SafeSet();
7575
* @param {string} base - The URL of the module that imported the package.
7676
*/
7777
function emitTrailingSlashPatternDeprecation(match, pjsonUrl, base) {
78+
if (process.noDeprecation) {
79+
return;
80+
}
7881
const pjsonPath = fileURLToPath(pjsonUrl);
7982
if (emittedPackageWarnings.has(pjsonPath + '|' + match)) { return; }
8083
emittedPackageWarnings.add(pjsonPath + '|' + match);
@@ -101,6 +104,9 @@ const doubleSlashRegEx = /[/\\][/\\]/;
101104
* @param {boolean} isTarget - Whether the target is a module.
102105
*/
103106
function emitInvalidSegmentDeprecation(target, request, match, pjsonUrl, internal, base, isTarget) {
107+
if (process.noDeprecation) {
108+
return;
109+
}
104110
const pjsonPath = fileURLToPath(pjsonUrl);
105111
const double = RegExpPrototypeExec(doubleSlashRegEx, isTarget ? target : request) !== null;
106112
process.emitWarning(
@@ -123,6 +129,9 @@ function emitInvalidSegmentDeprecation(target, request, match, pjsonUrl, interna
123129
* @param {string} [main] - The "main" field from the package.json file.
124130
*/
125131
function emitLegacyIndexDeprecation(url, packageJSONUrl, base, main) {
132+
if (process.noDeprecation) {
133+
return;
134+
}
126135
const format = defaultGetFormatWithoutErrors(url);
127136
if (format !== 'module') { return; }
128137
const path = fileURLToPath(url);
Collapse file

‎lib/internal/process/warning.js‎

Copy file name to clipboardExpand all lines: lib/internal/process/warning.js
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ function onWarning(warning) {
127127
// process.emitWarning(str[, type[, code]][, ctor])
128128
// process.emitWarning(str[, options])
129129
function emitWarning(warning, type, code, ctor) {
130+
// Fast path to avoid memory allocation,
131+
// this doesn't eliminate the other if a few lines below
132+
if (process.noDeprecation && type === 'DeprecationWarning') {
133+
return;
134+
}
130135
let detail;
131136
if (type !== null && typeof type === 'object' && !ArrayIsArray(type)) {
132137
ctor = type.ctor;

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.