Fold modulegraphs sourcemap file into metro-source-map

Reviewed By: rafeca

Differential Revision: D6711210

fbshipit-source-id: 1d91df189607c032045f604df75b119a87794ca6
This commit is contained in:
Peter van der Zee 2018-01-12 05:25:27 -08:00 committed by Facebook Github Bot
parent 199b51892b
commit 1152a69432
3 changed files with 14 additions and 30 deletions

View File

@ -167,7 +167,19 @@ function countLines(string) {
return string.split('\n').length;
}
function createIndexMap(
file: string,
sections: Array<IndexMapSection>,
): IndexMap {
return {
version: 3,
file,
sections,
};
}
module.exports = {
createIndexMap,
fromRawMappings,
toBabelSegments,
toSegmentTuple,

View File

@ -14,8 +14,8 @@
const meta = require('../../shared/output/meta');
const {createIndexMap} = require('./source-map');
const {getModuleCode, concat} = require('./util');
const {createIndexMap} = require('metro-source-map');
import type {OutputFn} from '../types.flow';
@ -52,7 +52,7 @@ function asPlainBundle({
return {
code,
extraFiles: [[`${filename}.meta`, meta(code)]],
map: createIndexMap({file: filename, sections}),
map: createIndexMap(filename, sections),
};
}

View File

@ -1,28 +0,0 @@
/**
* Copyright (c) 2016-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @flow
* @format
*/
'use strict';
import type {FBSourceMap, IndexMap, IndexMapSection} from 'metro-source-map';
export type {FBSourceMap};
type CreateIndexMapOptions = {|
file?: string,
sections?: Array<IndexMapSection>,
|};
exports.createIndexMap = (opts?: CreateIndexMapOptions): IndexMap => ({
version: 3,
file: opts && opts.file,
sections: (opts && opts.sections) || [],
});