-
Notifications
You must be signed in to change notification settings - Fork 225
Improves relative path handling for urls #126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -3,7 +3,7 @@ | |||
"file": "script.js", | |||
"sourceRoot": "..", | |||
"sources": [ | |||
"browser-test/script.coffee" | |||
"browser-test\\script.coffee" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work on unix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't notice that. script.map
is a build output, but I can revert the incidental change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it looks like script.map is not excluded via the .gitignore as is the case for the other tests.
Is there more work to be done here? This looks like a more comprehensive approach to #133; can we move this forward and close that attempt? |
I need a single small commit to get better printing locally: ncalexan@bbfcde4 |
…ces. The source-map-support package doesn't appreciate absolute file:// URLs. I tried to address this in evanw/node-source-map-support#133 and made some progress before discovering evanw/node-source-map-support#126. I pushed that work, and a small follow-up, to my local version used here. With this, I get stack traces that referring to app/.
…ces. The source-map-support package doesn't appreciate absolute file:// URLs. I tried to address this in evanw/node-source-map-support#133 and made some progress before discovering evanw/node-source-map-support#126. I pushed that work, and a small follow-up, to my local version used here. With this, I get stack traces that referring to app/.
…ces. The source-map-support package doesn't appreciate absolute file:// URLs. I tried to address this in evanw/node-source-map-support#133 and made some progress before discovering evanw/node-source-map-support#126. I pushed that work, and a small follow-up, to my local version used here. With this, I get stack traces that referring to app/.
…ces. The source-map-support package doesn't appreciate absolute file:// URLs. I tried to address this in evanw/node-source-map-support#133 and made some progress before discovering evanw/node-source-map-support#126. I pushed that work, and a small follow-up, to my local version used here. With this, I get stack traces that referring to app/.
The source-map-support package doesn't appreciate absolute file:// URLs. I tried to address this in evanw/node-source-map-support#133 and made some progress before discovering evanw/node-source-map-support#126. I pushed that work, and a small follow-up, to my local version used here. With this, I get stack traces that referring to app/.
The source-map-support package doesn't appreciate absolute file:// URLs. I tried to address this in evanw/node-source-map-support#133 and made some progress before discovering evanw/node-source-map-support#126. I pushed that work, and a small follow-up, to my local version used here. With this, I get stack traces that referring to app/.
…es. r=Mossop,rnewman. (#289) The source-map-support package doesn't appreciate absolute file:// URLs. I tried to address this in evanw/node-source-map-support#133 and made some progress before discovering evanw/node-source-map-support#126. I pushed that work, and a small follow-up, to my local version used here. With this, I get stack traces that referring to app/.
I don't know why let path = url.parse(uri).pathname;
// strip the trailing slash from Windows paths (indicated by a drive letter with a colon)
if (/^\/[a-zA-Z]:\//.test(path)) {
path = path.substr(1);
} |
@felixfbecker |
Can't wait to get this merged... |
What's the progress on this? |
What I noticed is that when using an absolute file uri as sourceRoot, the file path in the stack trace is also reported as a URL, while it should be converted to a path. |
Example:
but this could be solved in a different PR, my team is currently depending on this from your fork and it works fine so far. Would really like to see this get merged. |
Hi folks, sorry I've been out of this loop. The project consuming this (https://github.com/mozilla/tofino) may not really need the fork anymore; I'd need to evaluate. My guess is we'd revert to mainline immediately after merge, and re-open if necessary. We're not interested in maintaining forks long term. |
So can we merge this? |
I have no further changes at this time, so I feel it is ready to merge. |
file = path.resolve(file); | ||
file = file.replace(/\\/g, '/'); | ||
file = file[0] !== '/' ? '/' + file : file; | ||
return encodeURI('file://' + file); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update this (and the other new functions) to follow the 2 space indentation that the rest of the project uses?
@@ -110,7 +147,7 @@ function compareStdout(done, sourceMap, source, expected) { | |||
compareLines( | |||
(stdout + stderr) | |||
.trim() | |||
.split('\n') | |||
.split(/\r\n|\r|\n/g) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Standalone \r
is only used on Mac OS classic which no one uses today. How about /\r?\n/g
?
ping @rbuckton |
Why close this? |
It's been over two years since I opened it and I haven't had the time to update the PR or determine if it is still needed. |
Fixes #84.
Adds two utility functions to better manage path handling:
isURI
andtoPath
.isURI
- Determines whether a file path is a URI using the following rules:A path is a URI if it starts with an alpha character followed by one or more of either an alpha character, digit,
+
,-
, or-
, followed by a colon. For example:A path is NOT a URI if it starts with a single alpha character and a colon is, instead it is treated as a DOS path. For example:
Any other sequence of characters is not considered a URI.
toPath
- Tries to convert a URI to a local path. If the URI is a file URI (file://
), it is converted into a local path format that NodeJS understands using the following rules:A file URI with a host name is treated as a UNC path:
A file URI without a host name, whose first path segment is a single alpha character followed by either a colon (
:
) or pipe (|
) is treated as a rooted DOS path:A file URI without a hostname that is not treated as a DOS path is treated as a rooted POSIX path:
Querystring (
?
) and fragments (#
) are removed.URI handling is designed to conform to RFC 3986, with exceptions for DOS path handling.
Also fixes the tests so that they also run on Windows.