mirror of https://github.com/status-im/metro.git
Fold modulegraphs sourcemap file into metro-source-map
Reviewed By: rafeca Differential Revision: D6711210 fbshipit-source-id: 1d91df189607c032045f604df75b119a87794ca6
This commit is contained in:
parent
199b51892b
commit
1152a69432
|
@ -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,
|
||||
|
|
|
@ -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),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -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) || [],
|
||||
});
|
Loading…
Reference in New Issue