Add sourcemap support for asset-based random access bundles

Summary:This adds support for source maps that can be used for “random access modules” / “unbundles”

- source maps contain an extra custom field: `x_facebook_offsets`
- this field maps module IDs to line offsets
- the source map is built as if all files were concatenated

Decoding/symbolication works as follows:
- when decoding a stack trace, and a stack frame comes from a filename that contains only numbers and ends with `.js`, look up the additionally needed line offset in the offset map and add it to the original line of the stack frame.
- consume the source map as usual

Reviewed By: martinbigio

Differential Revision: D3072426

fb-gh-sync-id: 827e6dc13b1959f02903baafa7f9e4fc2e0d4bb9
shipit-source-id: 827e6dc13b1959f02903baafa7f9e4fc2e0d4bb9
This commit is contained in:
David Aurelio 2016-03-21 12:31:52 -07:00 committed by Facebook Github Bot 5
parent 8a860a01c5
commit f361f99f53
1 changed files with 1 additions and 3 deletions

View File

@ -115,9 +115,7 @@ class Bundle extends BundleBase {
return {
startupCode,
modules: modules.map(({name, code, polyfill}) =>
({name, code, polyfill})
),
startupModules: allModules,
modules,
};
}