FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

errors: do not call resolve on URLs with schemes by bcoe · Pull Request #35903 · nodejs/node · GitHub

/ node Public

errors: do not call resolve on URLs with schemes - #35903

Closed
bcoe wants to merge 10 commits into
nodejs:masterfrom
bcoe:webpack-fix
Closed

errors: do not call resolve on URLs with schemes#35903
bcoe wants to merge 10 commits into
nodejs:masterfrom
bcoe:webpack-fix

Conversation

bcoe commented Oct 31, 2020
edited
Loading

Copy link
Copy Markdown
Contributor

Based on advice from webpack project, this PR stops trying to resolve
sources with a webpack:// scheme (or other schemes, as they represent
absolute URLs). Source content is now loaded from the sourcesContent
lookup, if it is populated (allowing for non file:// schemes).

stack-trace:

webpack:///./webpack.js:14
  throw new Error('oh no!')
        ^

Error: oh no!
    at o (/Users/bencoe/oss/node-1/test/fixtures/source-map/webpack.js:1:970)
        -> webpack:///./webpack.js:14:9
    at n (/Users/bencoe/oss/node-1/test/fixtures/source-map/webpack.js:1:952)
        -> webpack:///./webpack.js:10:3

This work is in pursuit of #35325

Refs webpack/webpack#9601

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

CC: @sokra, @nodejs/tooling

bcoe requested review from boneskull and devsnek October 31, 2020 17:19
mscdex previously requested changes Oct 31, 2020

mscdex left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I do not think we should start including explicit special cases in node core for third party libraries like this. We should be solving this in a more generic way if there is not already some generic API/interface that suffices for webpack.

bcoe requested a review from mscdex October 31, 2020 20:58

bcoe commented Oct 31, 2020

Copy link
Copy Markdown
Contributor Author

@mscdex take another look, I abstracted the logic so that it should apply to any paths with a scheme; I think the resolve logic would have potentially been broken for file:// paths prior to this.

bcoe changed the title process: handle webpack:// scheme for source-maps process: handle alternative schemes in source-maps Oct 31, 2020

bcoe commented Oct 31, 2020

Copy link
Copy Markdown
Contributor Author

@mscdex based on @sokra's reading of the Source Map v3 language, I cleaned up the logic further. If we have scheme:// we shouldn't need to ever resolve.

bcoe changed the title process: handle alternative schemes in source-maps errors: handle alternative schemes in source-maps Oct 31, 2020
bcoe changed the title errors: handle alternative schemes in source-maps errors: do not call resolve on URLs with schemes Oct 31, 2020
Based on advice from webpack project, this PR stops trying to resolve
sources with a webpack:// scheme (or other schemes, as they represent
absolute URLs). Source content is now loaded from the sourcesContent
lookup, if it is populated (allowing for non file:// schemes).

Refs: nodejs#35325

Copy link
Copy Markdown
Collaborator

Co-authored-by: devsnek <me@gus.host>
Benjamin E. Coe and others added 5 commits November 1, 2020 10:38
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
bcoe requested review from aduh95 and devsnek November 1, 2020 16:17
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>

nodejs-github-bot commented Nov 2, 2020
edited by bcoe
Loading

Copy link
Copy Markdown
Collaborator

bcoe added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Nov 2, 2020
bcoe requested a review from aduh95 November 2, 2020 14:40

bcoe commented Nov 2, 2020

Copy link
Copy Markdown
Contributor Author

👋 if no one objects, I'd like to land this towards the end of the day, since there are a few additional fixes I'd like to make to source-map handling which build on this.

mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

lgtm

bcoe commented Nov 3, 2020

Copy link
Copy Markdown
Contributor Author

Landed in 26fcdb6

bcoe closed this Nov 3, 2020
bcoe deleted the webpack-fix branch November 3, 2020 00:31
bcoe pushed a commit that referenced this pull request Nov 3, 2020
We were incorrectly trying to run path.resolve on absolute
sources URLs. This was breaking webpack:// URLs in stack
trace output.

Refs: #35325

PR-URL: #35903
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
targos pushed a commit that referenced this pull request Nov 3, 2020
We were incorrectly trying to run path.resolve on absolute
sources URLs. This was breaking webpack:// URLs in stack
trace output.

Refs: #35325

PR-URL: #35903
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
targos mentioned this pull request Nov 3, 2020
targos pushed a commit to bcoe/node-1 that referenced this pull request Apr 24, 2021
We were incorrectly trying to run path.resolve on absolute
sources URLs. This was breaking webpack:// URLs in stack
trace output.

Refs: nodejs#35325

PR-URL: nodejs#35903
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
targos pushed a commit that referenced this pull request Apr 25, 2021
We were incorrectly trying to run path.resolve on absolute
sources URLs. This was breaking webpack:// URLs in stack
trace output.

Refs: #35325

PR-URL: #35903
Backport-PR-URL: #37717
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
targos added backported-to-v14.x errors Issues and PRs related to JavaScript errors originated in Node.js core. and removed author ready PRs that have at least one approval, no outstanding review comments, and a CI started. backport-open-v14.x labels Apr 25, 2021
danielleadams mentioned this pull request May 3, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

errors Issues and PRs related to JavaScript errors originated in Node.js core.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants


Back | FazBrowse Home | New Git URL