-
Notifications
You must be signed in to change notification settings - Fork 47
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
Fix broken transpile for in-memory files #212
Fix broken transpile for in-memory files #212
Conversation
…e entries, so generated files can be included in the build output
@georgejecook Looks good. Just add a few tests and fix the eslint errors and this will be good to go! |
add bsc protocol to src path for in-memory files
//this file has been added in-memory, from a plugin, for example | ||
filePathObj = { | ||
//add an interpolated src path (since it doesn't actually exist in memory) | ||
src: `bsc:/${file.pkgPath}`, |
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 how this will work with sourcemaps...since it will definitely use this path. @georgejecook can you test this out locally and see what happens when you try to debug one of these in-memory-only files with this branch?
I don't think there's anything else we can do....perhaps embed the entire source within the sourcemap for these files? We don't have support for that type of debugging in the extension right now, but I could see that being a future enhancement.
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, these files probably shouldn't have sourcemaps at all.
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.
oops - we didn't talk about this.
I think we should have sourcemaps; so that when errors are hit in generated code they can link back to annotations that created files, or the source code that was taken from one place and used in another. I'm already doing 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.
Yeah, you're right. We should have sourcemaps. However, there are certain situations where sourcemaps won't be valid. For example, adding a completely in-memory file will not point to a valid location on disk, but it would still derive a path for the sourcemap. I won't hold up this PR for this scenario, but it's something we will need to consider for the future.
Currently the debugger throws an error anytime it can't load a source file with the given path. So we need to handle that more gracefully.
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.
Tracked at rokucommunity/roku-debug#20
…e entries, so generated files can be included in the build output