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

Fix broken transpile for in-memory files #212

Merged
merged 6 commits into from
Oct 14, 2020

Conversation

georgejecook
Copy link
Contributor

…e entries, so generated files can be included in the build output

…e entries, so generated files can be included in the build output
@TwitchBronBron
Copy link
Member

@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}`,
Copy link
Member

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

@TwitchBronBron TwitchBronBron Oct 14, 2020

Choose a reason for hiding this comment

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

@TwitchBronBron TwitchBronBron merged commit 0102ef6 into master Oct 14, 2020
@TwitchBronBron TwitchBronBron deleted the fix/can-transpile-runtime-created-files branch October 14, 2020 03:18
@TwitchBronBron TwitchBronBron changed the title Allows transpilation of files that do not come from roku deploy's fil… Fix broken transpile for in-memory files Oct 14, 2020
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

Successfully merging this pull request may close these issues.

2 participants