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
source mapping tweaks #106
Conversation
One thing to note with inlined source maps is that we did not specify an absolute path to the input source file, so the generated map just reports a path like |
So I'm still trying to make iOS/Web Inspector happy here. The notable thing is that pointing to an external source map does not seem to work with iOS - maybe it can't handle file: URIs or is building up the path to the .map file inside the app incorrectly? The existing approach of using inlined source maps fails due entirely to the way iOS blindly does it's require implementation which injects a So far, Android is happiest with an external .map file and pointing at it with an absolute file URI. I don't have an Android device handy to know if using external .map files would work in that case or we'd have to move to inlined source maps... |
Note that with the latest PR here, we no longer need tidev/titanium-sdk#10954 |
relates to tidev/titanium-sdk#10951 and appcelerator/titanium_studio#1134 |
@sgtcoolguy, is tidev/alloy#893 relevant here too? If so we'll need to pull it into Aloy 1.14.0/CLI 7.1.0 |
@ewanharris They are related, but there's so many "moving parts" that I wanted to nail down this PR and the Studio one first and get those working, then we can see if we can fix the Alloy |
…ent on Android, do not inject sourceURL
On iOS, if source basename matches generated file basename, just report basename as source, not a path or else Safari/Web Inspector will not show the file. This can lead to original source files not being shown at all if their basename matches that of another source. It also means the source entries in iOS source maps may be "wrong" in that they strip the full path. Consumers trying to resolve back to original filepaths will need to have some knowledge of how we copy files. The only way to get around this is to try and avoid matching basenames between multiple sources and between source and generated filename.
OK, latest update:
I do not know why iOS/Safari acts this way. We can help avoid part of the side-effect it if we report a different base name for the template source (maybe even just dummy up a name like template.js). Note that a related thing here is that for Android it's debugger can mostly look up source contents from the sources entries, so I wipe the |
Changing iOS to report urls like "/app.js" didn't help any - so long as the generated file's base name matches the source file's base name, it shows a folder for the source path but no child file with the source file. Safari is just... not right in the head. |
Manually rebased and merged to master |
JIRA: https://jira.appcelerator.org/browse/TIMOB-27098
Description
Modifies our behavior with source maps.
The net result of all my testing is this:
"sources: ["filename.js"]"
name is not the base name of the JS file. Presumably because it has to match the script name it shows for the generated/in-app file (which is just the base name). If they don't match but it's able to load the source map, it'll show a folder child for the script, but it will be empty and the source mapping is busted. There's probably some more work to do digging here. We report full file URIs with absolute paths to the JS engine under the hood for iOS. Maybe using relative (to app root) paths would fix that? We report URI paths that looks absolute but are relative to the app's Resources folder on Android.;
right after it, which is why it couldn't load the inlined source maps as-is. I worked around this by writing the inlined source maps ourselves with extra newlines around it.//# sourceURL=file:///path/to/source.js
value even if the source map has just the base name of the file (as iOS needs). It then organizes the sources!I tested this on Android Emulator and iOS Simulator, but not devices