mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
url: provide pathToFileURL and fileURLToPath
PR-URL: https://github.com/nodejs/node/pull/22506 Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
This commit is contained in:
1 parent
0d3da39f57
commit
eef072fa08
13 files changed
+208
-112
No files matched your search
@@ -6,7 +6,7 @@ const http = require('http');
|
||||
const fixtures = require('../common/fixtures');
|
||||
const { spawn } = require('child_process');
|
||||
const { parse: parseURL } = require('url');
|
||||
const { getURLFromFilePath } = require('internal/url');
|
||||
const { pathToFileURL } = require('internal/url');
|
||||
const { EventEmitter } = require('events');
|
||||
|
||||
const _MAINSCRIPT = fixtures.path('loop.js');
|
||||
@@ -174,7 +174,7 @@ class InspectorSession {
|
||||
const { scriptId, url } = message.params;
|
||||
this._scriptsIdsByUrl.set(scriptId, url);
|
||||
const fileUrl = url.startsWith('file:') ?
|
||||
url : getURLFromFilePath(url).toString();
|
||||
url : pathToFileURL(url).toString();
|
||||
if (fileUrl === this.scriptURL().toString()) {
|
||||
this.mainScriptId = scriptId;
|
||||
}
|
||||
@@ -309,7 +309,7 @@ class InspectorSession {
|
||||
}
|
||||
|
||||
scriptURL() {
|
||||
return getURLFromFilePath(this.scriptPath());
|
||||
return pathToFileURL(this.scriptPath());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user