mirror of
https://github.com/status-im/react-native.git
synced 2025-02-22 06:08:24 +00:00
Add source map helper
Summary: Adds a helper to produce index source maps for Buck builds Reviewed By: cpojer Differential Revision: D4265911 fbshipit-source-id: 9ca3c49876df5db039bae823c0458c98e6e05619
This commit is contained in:
parent
6df804c8b0
commit
c74f00e78c
48
packager/react-packager/src/ModuleGraph/output/source-map.js
vendored
Normal file
48
packager/react-packager/src/ModuleGraph/output/source-map.js
vendored
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
type CreateIndexMapOptions = {|
|
||||||
|
file?: string,
|
||||||
|
sections?: Array<IndexMapSection>
|
||||||
|
|};
|
||||||
|
|
||||||
|
type IndexMap = MapBase & {
|
||||||
|
sections: Array<IndexMapSection>,
|
||||||
|
};
|
||||||
|
|
||||||
|
type IndexMapSection = {
|
||||||
|
map: IndexMap | MappingsMap,
|
||||||
|
offset: {line: number, column: number},
|
||||||
|
};
|
||||||
|
|
||||||
|
type MapBase = {
|
||||||
|
// always the first entry in the source map entry object per
|
||||||
|
// https://fburl.com/source-map-spec#heading=h.qz3o9nc69um5
|
||||||
|
version: 3,
|
||||||
|
file?: string,
|
||||||
|
};
|
||||||
|
|
||||||
|
type MappingsMap = MapBase & {
|
||||||
|
mappings: string,
|
||||||
|
names: Array<string>,
|
||||||
|
sourceRoot?: string,
|
||||||
|
sources: Array<string>,
|
||||||
|
sourcesContent?: Array<?string>,
|
||||||
|
};
|
||||||
|
|
||||||
|
export type SourceMap = IndexMap | MappingsMap;
|
||||||
|
|
||||||
|
exports.createIndexMap = (opts?: CreateIndexMapOptions): IndexMap => ({
|
||||||
|
version: 3,
|
||||||
|
file: opts && opts.file,
|
||||||
|
sections: opts && opts.sections || [],
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user