-
-
Notifications
You must be signed in to change notification settings - Fork 87
feat: ensure module paths in source map include full path from current working directory #26
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
@bryanforbes - To trigger the CLA assistant now that it's actually turned on, close & open the pull request again ( this one ) and please rebase with current master to pick up the Travis build. |
463701b
to
5f1f223
Compare
The latest |
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.
@bryanforbes Thx
@bryanforbes A quick note in the docs before merging would be appreciated :) |
@bryanforbes In #9 was implemented without adding an extra option, so my question is would it be possible without an extra options ( Off topic but could you bump the async dependency on the fly? 🙃 #7 |
I was trying to maintain backwards compatibility with the flag so people could opt-into the new behavior (in case there were problems or someone liked all of their source mapped files strewn about). If that's not a concern, I can remove the flag and we won't need Yes, I can bump the |
cc @bebraw @d3viant0ne
Thx 👍 . I think (believe) not :D .If there is the smallest problem coming up, don't bother with (it's not really your problem) 😛 |
I guess ideally there would be no flag. The problem is that if we drop the flag, then it's a breaking change (major version bump). |
@bebraw Isn't this slated for 1.0.0 which would be a major version bump anyway? |
@bryanforbes - Here's the thing with a major, we are standardizing all of the loaders & plugins which is going to require a bit of coordination so we don't have to release back to back majors. One answer here is this lands without a flag as a non-backwards compatible feature ( both for the lack of flag & the loader-utils bump ) and is done conjunction with the update to When all of that is in master, it will be published as |
I agree with @d3viant0ne here, but @bryanforbes please feel free to express your opinion here also, since it would again require changes to your PR, we would appreciate it though if we could tag this for |
That said, this does have benefits to the Release it as a |
if (params.includeModulePaths) { | ||
// Ensure module paths include full path from current working directory | ||
var pwd = process.cwd(); | ||
if (context.substring(0, pwd.length) === pwd) { |
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.
The if
bit feels like a helper function. Probably cleaner after extracting it.
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'm not sure what you mean. Would the if
be in the helper function? Is extracting ~10 lines of code to another function going to add clarity?
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.
if (context.substring(0, pwd.length) === pwd) {
felt like a helper based on the code below. Probably better wait on someone else's comment on this.
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.
Oh, I see what you're saying. I didn't extract it out because I don't see it being used anywhere else. IMO, anonymous functions in that case. But I can extract it out if need be.
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.
Yeah, anonymous at tops. 👍
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.
Do you mean turn it into a named function and place it at the top of the loader function (after line 20)?
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.
That would work. Just extracting is enough for me. 👍
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 just looked again. Extracting it to line 20 isn't possible. It's using the map
and context
arguments from processMap()
. It's similar to the callbacks passed to async.map()
at line 63.
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.
Ok, let's leave it as is. No need to get stuck here.
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.
👍 Sounds good
test/index.test.js
Outdated
@@ -3,7 +3,7 @@ var fs = require("fs"); | |||
var should = require("should"); | |||
var loader = require("../"); | |||
|
|||
function execLoader(filename, callback) { | |||
function execLoader(filename, callback, includeModulePaths) { |
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 am not so sure about the flag. It would feel better to have another function (exec???Loader
).
@d3viant0ne I want to be sure I'm reading what you said right:
|
Status ? :) |
See also #50 which includes this + adds a 'quiet' option to disable emitting of warnings. |
@bryanforbes - FYI i'm going to try and get this into a |
Can't up vote this enough. This is a major use case and major pain for any package author/consumer who uses TypeScript. |
@bryanforbes - Can you give this a quick rebase when you have a moment please. |
I can resolve the package.json conflict if necassary ;) really hankering for this release! |
This module is installed directly from a github URL pending resolution of webpack-contrib/source-map-loader#26. Signed-off-by: Neal Granger <neal@nealg.com>
Fixed in the master |
This pull request is similar to #9. If the loader is configured with
includeModulePaths
set totrue
, the path of the source file will be computed relative to the current working directory if possible. This maintains the default behavior for most users but allows users to opt-into this behavior.