Unify source map types

Summary: deduplicates / unifies types for source maps across the code base

Reviewed By: jeanlauliac

Differential Revision: D4955924

fbshipit-source-id: 25cb71031dce835dd7d2bc1c27d6b20050906e81
This commit is contained in:
David Aurelio
2017-04-28 12:25:44 -07:00
committed by Facebook Github Bot
parent 6202e02326
commit 58ba7fc075
19 changed files with 92 additions and 110 deletions

View File

@@ -17,7 +17,8 @@ const meta = require('./meta');
const relativizeSourceMap = require('../../../packager/src//lib/relativizeSourceMap');
const writeFile = require('./writeFile');
import type Bundle from '../../../packager/src//Bundler/Bundle';
import type Bundle from '../../../packager/src/Bundler/Bundle';
import type {SourceMap} from '../../../packager/src/lib/SourceMap';
import type {OutputOptions, RequestOptions} from '../types.flow';
function buildBundle(packagerClient: Server, requestOptions: RequestOptions) {
@@ -31,7 +32,7 @@ function buildBundle(packagerClient: Server, requestOptions: RequestOptions) {
function createCodeWithMap(bundle: Bundle, dev: boolean, sourceMapSourcesRoot?: string): * {
const map = bundle.getSourceMap({dev});
const sourceMap = relativizeSourceMap(
typeof map === 'string' ? JSON.parse(map) : map,
typeof map === 'string' ? (JSON.parse(map): SourceMap) : map,
sourceMapSourcesRoot);
return {
code: bundle.getSource({dev}),