Skip to content

Commit 12a2b6f

Browse files
committed
Fix?
1 parent c6aa032 commit 12a2b6f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
matrix:
1919
os: [ubuntu, windows]
2020
node:
21+
- 18
22+
- 17
2123
- 16
2224
- 14
2325
- 12

source-map-support.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const { TraceMap, originalPositionFor, AnyMap } = require('@jridgewell/trace-mapping');
22
var path = require('path');
3+
const { fileURLToPath } = require('url');
34
var util = require('util');
45

56
var fs;
@@ -187,16 +188,22 @@ sharedData.internalRetrieveFileHandlers.push(function(path) {
187188
// in case we are in the browser (i.e. directories may start with "http://" or "file:///")
188189
function supportRelativeURL(file, url) {
189190
if (!file) return url;
191+
let targetPath = url;
192+
try {
193+
const urlParsed = new URL(url);
194+
if(urlParsed.protocol !== 'file:') return url;
195+
targetPath = fileURLToPath(urlParsed);
196+
} catch(e) {}
190197
var dir = path.dirname(file);
191198
var match = /^\w+:\/\/[^\/]*/.exec(dir);
192199
var protocol = match ? match[0] : '';
193200
var startPath = dir.slice(protocol.length);
194201
if (protocol && /^\/\w\:/.test(startPath)) {
195202
// handle file:///C:/ paths
196203
protocol += '/';
197-
return protocol + path.resolve(dir.slice(protocol.length), url).replace(/\\/g, '/');
204+
return protocol + path.resolve(dir.slice(protocol.length), targetPath).replace(/\\/g, '/');
198205
}
199-
return protocol + path.resolve(dir.slice(protocol.length), url);
206+
return protocol + path.resolve(dir.slice(protocol.length), targetPath);
200207
}
201208

202209
function retrieveSourceMapURL(source) {

0 commit comments

Comments
 (0)