From e515046941ceb2d8d9cf6c95e4fd05911efce4cb Mon Sep 17 00:00:00 2001 From: Livia Medeiros Date: Sun, 10 Sep 2023 19:27:37 +0900 Subject: [PATCH] lib: use internal `pathToFileURL` PR-URL: https://github.com/nodejs/node/pull/49553 Reviewed-By: Antoine du Hamel Reviewed-By: Jacob Smith --- lib/internal/process/execution.js | 2 +- lib/repl.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/internal/process/execution.js b/lib/internal/process/execution.js index afe2ba2c2c977b..4b77aa47c2cb35 100644 --- a/lib/internal/process/execution.js +++ b/lib/internal/process/execution.js @@ -54,7 +54,7 @@ function evalModule(source, print) { function evalScript(name, body, breakFirstLine, print, shouldLoadESM = false) { const CJSModule = require('internal/modules/cjs/loader').Module; const { kVmBreakFirstLineSymbol } = require('internal/util'); - const { pathToFileURL } = require('url'); + const { pathToFileURL } = require('internal/url'); const cwd = tryGetCwd(); const origModule = globalThis.module; // Set e.g. when called from the REPL. diff --git a/lib/repl.js b/lib/repl.js index 2a63050923b198..afb86b18ad1d89 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -467,7 +467,7 @@ function REPLServer(prompt, if (e.name === 'SyntaxError') { let parentURL; try { - const { pathToFileURL } = require('url'); + const { pathToFileURL } = require('internal/url'); // Adding `/repl` prevents dynamic imports from loading relative // to the parent of `process.cwd()`. parentURL = pathToFileURL(path.join(process.cwd(), 'repl')).href; @@ -508,7 +508,7 @@ function REPLServer(prompt, if (err === null) { let parentURL; try { - const { pathToFileURL } = require('url'); + const { pathToFileURL } = require('internal/url'); // Adding `/repl` prevents dynamic imports from loading relative // to the parent of `process.cwd()`. parentURL = pathToFileURL(path.join(process.cwd(), 'repl')).href;