Skip to content
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

Questions about file, sources, and sourceRoot #340

Closed
npetruzzelli opened this issue May 23, 2018 · 2 comments
Closed

Questions about file, sources, and sourceRoot #340

npetruzzelli opened this issue May 23, 2018 · 2 comments

Comments

@npetruzzelli
Copy link

I had a look at https://github.com/mozilla/source-map/blob/master/CONTRIBUTING.md#filing-issues but couldn't find any guidelines for simply asking questions. I'll try to be as thorough as I can.

I've been looking at the following:

In trying to determine why it is so difficult to get source maps to work in an expected way with webpack, I noticed a few things about some of these node packages. I'd like to confirm that I understand how source maps work before I open up issues in these repos or attempt putting the time into creating pull requests of my own for them.

Basically, I don't want to criticize someone else if I might be wrong.

My reference is: Source Map Revision 3 Proposal


Question 1: Types for sourceRoot and sources

Can you confirm that both the sourceRoot string and sources array are intended to contain URLs, and NOT file system paths (POSIX, Windows, or otherwise)? If not, what am I missing?

Question 2: Is sourceRoot optional? Always?

  • Is sourceRoot being undefined or an empty string, valid? It just means that nothing is prepended to sources, correct?
  • No plugin/module/software working with source maps should define this field if the developer left it empty, correct?

Question 3: Is null a valid value for sourceRoot?

For my own reference. Is it treated the same as being undefined?

Question 4: Is file intended to be just the file name?

Meaning no path information. Just the name and extension.

Question 5: Is there a central registry for extensions?

Extra properties on a map whose property names begin with x_.


Primarily, I intend to dive deeper into sass-loader and postcss-loader as they seem to be using file system paths instead of URLs, and that could be the source of some of the problems I'm running into.

I'm trying to contribute to: webpack-contrib/css-loader#652 (comment), which I don't have enough information to do properly and my existing post is not as well informed as I'd like it to be.

@npetruzzelli
Copy link
Author

Related to question 1: #91 (comment)

@fitzgen
Copy link
Contributor

fitzgen commented May 29, 2018

Can you confirm that both the sourceRoot string and sources array are intended to contain URLs, and NOT file system paths (POSIX, Windows, or otherwise)? If not, what am I missing?

They are URLs, but many pure-node enviromnents will use paths, and if it works for them that's fine.

Is sourceRoot being undefined or an empty string, valid? It just means that nothing is prepended to sources, correct?

Yes, sourceRoot is optional.

No plugin/module/software working with source maps should define this field if the developer left it empty, correct?

That depends on the tool and how much it knows/dictates about what is happening.

Is null a valid value for sourceRoot?

Yeah, it is treated as the lack of a sourceRoot.

Is file intended to be just the file name?

It can be either.

Is there a central registry for extensions?

There aren't any extensions in widespread use, AFAIK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants