metro-source-map 0.84.0 → 0.84.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/B64Builder.d.ts +54 -0
- package/src/BundleBuilder.d.ts +50 -0
- package/src/Consumer/AbstractConsumer.d.ts +44 -0
- package/src/Consumer/DelegatingConsumer.d.ts +54 -0
- package/src/Consumer/MappingsConsumer.d.ts +50 -0
- package/src/Consumer/SectionsConsumer.d.ts +47 -0
- package/src/Consumer/constants.d.ts +46 -0
- package/src/Consumer/createConsumer.d.ts +22 -0
- package/src/Consumer/index.d.ts +23 -0
- package/src/Consumer/normalizeSourcePath.d.ts +22 -0
- package/src/Consumer/positionMath.d.ts +32 -0
- package/src/Consumer/search.d.ts +22 -0
- package/src/Consumer/types.d.ts +64 -0
- package/src/Generator.d.ts +114 -0
- package/src/composeSourceMaps.d.ts +23 -0
- package/src/encode.d.ts +73 -0
- package/src/generateFunctionMap.d.ts +52 -0
- package/src/source-map.d.ts +162 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "metro-source-map",
|
|
3
|
-
"version": "0.84.
|
|
3
|
+
"version": "0.84.2",
|
|
4
4
|
"description": "🚇 Source map generator for Metro.",
|
|
5
5
|
"main": "src/source-map.js",
|
|
6
6
|
"exports": {
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"@babel/types": "^7.29.0",
|
|
23
23
|
"flow-enums-runtime": "^0.0.6",
|
|
24
24
|
"invariant": "^2.2.4",
|
|
25
|
-
"metro-symbolicate": "0.84.
|
|
25
|
+
"metro-symbolicate": "0.84.2",
|
|
26
26
|
"nullthrows": "^1.1.1",
|
|
27
|
-
"ob1": "0.84.
|
|
27
|
+
"ob1": "0.84.2",
|
|
28
28
|
"source-map": "^0.5.6",
|
|
29
29
|
"vlq": "^1.0.0"
|
|
30
30
|
},
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @noformat
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
* @generated SignedSource<<26fabb3db2058dda9c2a6e56de4728ce>>
|
|
10
|
+
*
|
|
11
|
+
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
|
+
* Original file: packages/metro-source-map/src/B64Builder.js
|
|
13
|
+
* To regenerate, run:
|
|
14
|
+
* js1 build metro-ts-defs (internal) OR
|
|
15
|
+
* yarn run build-ts-defs (OSS)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Efficient builder for base64 VLQ mappings strings.
|
|
20
|
+
*
|
|
21
|
+
* This class uses a buffer that is preallocated with one megabyte and is
|
|
22
|
+
* reallocated dynamically as needed, doubling its size.
|
|
23
|
+
*
|
|
24
|
+
* Encoding never creates any complex value types (strings, objects), and only
|
|
25
|
+
* writes character values to the buffer.
|
|
26
|
+
*
|
|
27
|
+
* For details about source map terminology and specification, check
|
|
28
|
+
* https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit
|
|
29
|
+
*/
|
|
30
|
+
declare class B64Builder {
|
|
31
|
+
buffer: Buffer;
|
|
32
|
+
pos: number;
|
|
33
|
+
hasSegment: boolean;
|
|
34
|
+
constructor();
|
|
35
|
+
/**
|
|
36
|
+
* Adds `n` markers for generated lines to the mappings.
|
|
37
|
+
*/
|
|
38
|
+
markLines(n: number): this;
|
|
39
|
+
/**
|
|
40
|
+
* Starts a segment at the specified column offset in the current line.
|
|
41
|
+
*/
|
|
42
|
+
startSegment(column: number): this;
|
|
43
|
+
/**
|
|
44
|
+
* Appends a single number to the mappings.
|
|
45
|
+
*/
|
|
46
|
+
append(value: number): this;
|
|
47
|
+
/**
|
|
48
|
+
* Returns the string representation of the mappings.
|
|
49
|
+
*/
|
|
50
|
+
toString(): string;
|
|
51
|
+
_writeByte(byte: number): void;
|
|
52
|
+
_realloc(): void;
|
|
53
|
+
}
|
|
54
|
+
export default B64Builder;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @noformat
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
* @generated SignedSource<<c1cd2317d27c079743bc7c0e0fa4b379>>
|
|
10
|
+
*
|
|
11
|
+
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
|
+
* Original file: packages/metro-source-map/src/BundleBuilder.js
|
|
13
|
+
* To regenerate, run:
|
|
14
|
+
* js1 build metro-ts-defs (internal) OR
|
|
15
|
+
* yarn run build-ts-defs (OSS)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type {IndexMap, IndexMapSection, MixedSourceMap} from './source-map';
|
|
19
|
+
/**
|
|
20
|
+
* Builds a source-mapped bundle by concatenating strings and their
|
|
21
|
+
* corresponding source maps (if any).
|
|
22
|
+
*
|
|
23
|
+
* Usage:
|
|
24
|
+
*
|
|
25
|
+
* const builder = new BundleBuilder('bundle.js');
|
|
26
|
+
* builder
|
|
27
|
+
* .append('foo\n', fooMap)
|
|
28
|
+
* .append('bar\n')
|
|
29
|
+
* // ...
|
|
30
|
+
* const code = builder.getCode();
|
|
31
|
+
* const map = builder.getMap();
|
|
32
|
+
*/
|
|
33
|
+
export declare class BundleBuilder {
|
|
34
|
+
_file: string;
|
|
35
|
+
_sections: Array<IndexMapSection>;
|
|
36
|
+
_line: number;
|
|
37
|
+
_column: number;
|
|
38
|
+
_code: string;
|
|
39
|
+
_afterMappedContent: boolean;
|
|
40
|
+
constructor(file: string);
|
|
41
|
+
_pushMapSection(map: MixedSourceMap): void;
|
|
42
|
+
_endMappedContent(): void;
|
|
43
|
+
append(code: string, map: null | undefined | MixedSourceMap): this;
|
|
44
|
+
getMap(): MixedSourceMap;
|
|
45
|
+
getCode(): string;
|
|
46
|
+
}
|
|
47
|
+
export declare function createIndexMap(
|
|
48
|
+
file: string,
|
|
49
|
+
sections: Array<IndexMapSection>,
|
|
50
|
+
): IndexMap;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @noformat
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
* @generated SignedSource<<22565876862bd94effefabfc09cf8933>>
|
|
10
|
+
*
|
|
11
|
+
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
|
+
* Original file: packages/metro-source-map/src/Consumer/AbstractConsumer.js
|
|
13
|
+
* To regenerate, run:
|
|
14
|
+
* js1 build metro-ts-defs (internal) OR
|
|
15
|
+
* yarn run build-ts-defs (OSS)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type {
|
|
19
|
+
GeneratedPositionLookup,
|
|
20
|
+
IConsumer,
|
|
21
|
+
IterationOrder,
|
|
22
|
+
Mapping,
|
|
23
|
+
SourcePosition,
|
|
24
|
+
} from './types';
|
|
25
|
+
|
|
26
|
+
declare class AbstractConsumer implements IConsumer {
|
|
27
|
+
_sourceMap: {readonly file?: string};
|
|
28
|
+
constructor(sourceMap: {readonly file?: string});
|
|
29
|
+
originalPositionFor(
|
|
30
|
+
generatedPosition: GeneratedPositionLookup,
|
|
31
|
+
): SourcePosition;
|
|
32
|
+
generatedMappings(): Iterable<Mapping>;
|
|
33
|
+
eachMapping(
|
|
34
|
+
callback: (mapping: Mapping) => unknown,
|
|
35
|
+
context?: unknown,
|
|
36
|
+
order?: IterationOrder,
|
|
37
|
+
): void;
|
|
38
|
+
get file(): null | undefined | string;
|
|
39
|
+
sourceContentFor(
|
|
40
|
+
source: string,
|
|
41
|
+
nullOnMissing: true,
|
|
42
|
+
): null | undefined | string;
|
|
43
|
+
}
|
|
44
|
+
export default AbstractConsumer;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @noformat
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
* @generated SignedSource<<25b3906d78ba99d86fb91390016332ff>>
|
|
10
|
+
*
|
|
11
|
+
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
|
+
* Original file: packages/metro-source-map/src/Consumer/DelegatingConsumer.js
|
|
13
|
+
* To regenerate, run:
|
|
14
|
+
* js1 build metro-ts-defs (internal) OR
|
|
15
|
+
* yarn run build-ts-defs (OSS)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type {MixedSourceMap} from '../source-map';
|
|
19
|
+
import type {LookupBias} from './constants.js';
|
|
20
|
+
import type {
|
|
21
|
+
GeneratedPositionLookup,
|
|
22
|
+
IConsumer,
|
|
23
|
+
IterationOrder,
|
|
24
|
+
Mapping,
|
|
25
|
+
SourcePosition,
|
|
26
|
+
} from './types';
|
|
27
|
+
/**
|
|
28
|
+
* A source map consumer that supports both "basic" and "indexed" source maps.
|
|
29
|
+
* Uses `MappingsConsumer` and `SectionsConsumer` under the hood (via
|
|
30
|
+
* `createConsumer`).
|
|
31
|
+
*/
|
|
32
|
+
declare class DelegatingConsumer implements IConsumer {
|
|
33
|
+
static readonly GENERATED_ORDER: IterationOrder;
|
|
34
|
+
static readonly ORIGINAL_ORDER: IterationOrder;
|
|
35
|
+
static readonly GREATEST_LOWER_BOUND: LookupBias;
|
|
36
|
+
static readonly LEAST_UPPER_BOUND: LookupBias;
|
|
37
|
+
_rootConsumer: IConsumer;
|
|
38
|
+
constructor(sourceMap: MixedSourceMap);
|
|
39
|
+
originalPositionFor(
|
|
40
|
+
generatedPosition: GeneratedPositionLookup,
|
|
41
|
+
): SourcePosition;
|
|
42
|
+
generatedMappings(): Iterable<Mapping>;
|
|
43
|
+
eachMapping(
|
|
44
|
+
callback: (mapping: Mapping) => unknown,
|
|
45
|
+
context?: unknown,
|
|
46
|
+
order?: IterationOrder,
|
|
47
|
+
): void;
|
|
48
|
+
get file(): null | undefined | string;
|
|
49
|
+
sourceContentFor(
|
|
50
|
+
source: string,
|
|
51
|
+
nullOnMissing: true,
|
|
52
|
+
): null | undefined | string;
|
|
53
|
+
}
|
|
54
|
+
export default DelegatingConsumer;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @noformat
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
* @generated SignedSource<<e2a6c983e649fe98c57dec4cc2e0aa65>>
|
|
10
|
+
*
|
|
11
|
+
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
|
+
* Original file: packages/metro-source-map/src/Consumer/MappingsConsumer.js
|
|
13
|
+
* To regenerate, run:
|
|
14
|
+
* js1 build metro-ts-defs (internal) OR
|
|
15
|
+
* yarn run build-ts-defs (OSS)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type {BasicSourceMap} from '../source-map';
|
|
19
|
+
import type {
|
|
20
|
+
GeneratedPositionLookup,
|
|
21
|
+
IConsumer,
|
|
22
|
+
Mapping,
|
|
23
|
+
SourcePosition,
|
|
24
|
+
} from './types';
|
|
25
|
+
import type {Number0} from 'ob1';
|
|
26
|
+
|
|
27
|
+
import AbstractConsumer from './AbstractConsumer';
|
|
28
|
+
/**
|
|
29
|
+
* A source map consumer that supports "basic" source maps (that have a
|
|
30
|
+
* `mappings` field and no sections).
|
|
31
|
+
*/
|
|
32
|
+
declare class MappingsConsumer extends AbstractConsumer implements IConsumer {
|
|
33
|
+
_sourceMap: BasicSourceMap;
|
|
34
|
+
_decodedMappings: null | undefined | ReadonlyArray<Mapping>;
|
|
35
|
+
_normalizedSources: null | undefined | ReadonlyArray<string>;
|
|
36
|
+
constructor(sourceMap: BasicSourceMap);
|
|
37
|
+
originalPositionFor(
|
|
38
|
+
generatedPosition: GeneratedPositionLookup,
|
|
39
|
+
): SourcePosition;
|
|
40
|
+
_decodeMappings(): Generator<Mapping, void, void>;
|
|
41
|
+
_normalizeAndCacheSources(): ReadonlyArray<string>;
|
|
42
|
+
_decodeAndCacheMappings(): ReadonlyArray<Mapping>;
|
|
43
|
+
generatedMappings(): Iterable<Mapping>;
|
|
44
|
+
_indexOfSource(source: string): null | undefined | Number0;
|
|
45
|
+
sourceContentFor(
|
|
46
|
+
source: string,
|
|
47
|
+
nullOnMissing: true,
|
|
48
|
+
): null | undefined | string;
|
|
49
|
+
}
|
|
50
|
+
export default MappingsConsumer;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @noformat
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
* @generated SignedSource<<19e73dfc942bfc06b0a44f0488b16947>>
|
|
10
|
+
*
|
|
11
|
+
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
|
+
* Original file: packages/metro-source-map/src/Consumer/SectionsConsumer.js
|
|
13
|
+
* To regenerate, run:
|
|
14
|
+
* js1 build metro-ts-defs (internal) OR
|
|
15
|
+
* yarn run build-ts-defs (OSS)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type {IndexMap} from '../source-map';
|
|
19
|
+
import type {
|
|
20
|
+
GeneratedOffset,
|
|
21
|
+
GeneratedPositionLookup,
|
|
22
|
+
IConsumer,
|
|
23
|
+
Mapping,
|
|
24
|
+
SourcePosition,
|
|
25
|
+
} from './types';
|
|
26
|
+
|
|
27
|
+
import AbstractConsumer from './AbstractConsumer';
|
|
28
|
+
/**
|
|
29
|
+
* A source map consumer that supports "indexed" source maps (that have a
|
|
30
|
+
* `sections` field and no top-level mappings).
|
|
31
|
+
*/
|
|
32
|
+
declare class SectionsConsumer extends AbstractConsumer implements IConsumer {
|
|
33
|
+
_consumers: ReadonlyArray<[GeneratedOffset, IConsumer]>;
|
|
34
|
+
constructor(sourceMap: IndexMap);
|
|
35
|
+
originalPositionFor(
|
|
36
|
+
generatedPosition: GeneratedPositionLookup,
|
|
37
|
+
): SourcePosition;
|
|
38
|
+
generatedMappings(): Iterable<Mapping>;
|
|
39
|
+
_consumerForPosition(
|
|
40
|
+
generatedPosition: GeneratedPositionLookup,
|
|
41
|
+
): null | undefined | [GeneratedOffset, IConsumer];
|
|
42
|
+
sourceContentFor(
|
|
43
|
+
source: string,
|
|
44
|
+
nullOnMissing: true,
|
|
45
|
+
): null | undefined | string;
|
|
46
|
+
}
|
|
47
|
+
export default SectionsConsumer;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @noformat
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
* @generated SignedSource<<bcbe0a1f886534ee2f99a12da9c16270>>
|
|
10
|
+
*
|
|
11
|
+
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
|
+
* Original file: packages/metro-source-map/src/Consumer/constants.js
|
|
13
|
+
* To regenerate, run:
|
|
14
|
+
* js1 build metro-ts-defs (internal) OR
|
|
15
|
+
* yarn run build-ts-defs (OSS)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type {Number0, Number1} from 'ob1';
|
|
19
|
+
|
|
20
|
+
declare const FIRST_COLUMN: Number0;
|
|
21
|
+
declare const FIRST_LINE: Number1;
|
|
22
|
+
export declare type IterationOrder = symbol & {__IterationOrder__: string};
|
|
23
|
+
declare const GENERATED_ORDER: IterationOrder;
|
|
24
|
+
declare const ORIGINAL_ORDER: IterationOrder;
|
|
25
|
+
export declare type LookupBias = symbol & {__LookupBias__: string};
|
|
26
|
+
declare const GREATEST_LOWER_BOUND: LookupBias;
|
|
27
|
+
declare const LEAST_UPPER_BOUND: LookupBias;
|
|
28
|
+
declare const EMPTY_POSITION: Readonly<{
|
|
29
|
+
source: null;
|
|
30
|
+
name: null;
|
|
31
|
+
line: null;
|
|
32
|
+
column: null;
|
|
33
|
+
}>;
|
|
34
|
+
declare function iterationOrderToString(x: IterationOrder): string;
|
|
35
|
+
declare function lookupBiasToString(x: LookupBias): string;
|
|
36
|
+
export {
|
|
37
|
+
FIRST_COLUMN,
|
|
38
|
+
FIRST_LINE,
|
|
39
|
+
GENERATED_ORDER,
|
|
40
|
+
ORIGINAL_ORDER,
|
|
41
|
+
GREATEST_LOWER_BOUND,
|
|
42
|
+
LEAST_UPPER_BOUND,
|
|
43
|
+
EMPTY_POSITION,
|
|
44
|
+
iterationOrderToString,
|
|
45
|
+
lookupBiasToString,
|
|
46
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @noformat
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
* @generated SignedSource<<3628df6a457f3d3d7c15f9e248338e4e>>
|
|
10
|
+
*
|
|
11
|
+
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
|
+
* Original file: packages/metro-source-map/src/Consumer/createConsumer.js
|
|
13
|
+
* To regenerate, run:
|
|
14
|
+
* js1 build metro-ts-defs (internal) OR
|
|
15
|
+
* yarn run build-ts-defs (OSS)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type {MixedSourceMap} from '../source-map';
|
|
19
|
+
import type {IConsumer} from './types';
|
|
20
|
+
|
|
21
|
+
declare function createConsumer(sourceMap: MixedSourceMap): IConsumer;
|
|
22
|
+
export default createConsumer;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @noformat
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
* @generated SignedSource<<62d8c1b54e47245bd0ef831be2b7049d>>
|
|
10
|
+
*
|
|
11
|
+
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
|
+
* Original file: packages/metro-source-map/src/Consumer/index.js
|
|
13
|
+
* To regenerate, run:
|
|
14
|
+
* js1 build metro-ts-defs (internal) OR
|
|
15
|
+
* yarn run build-ts-defs (OSS)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import DelegatingConsumer from './DelegatingConsumer';
|
|
19
|
+
|
|
20
|
+
declare const $$EXPORT_DEFAULT_DECLARATION$$: typeof DelegatingConsumer;
|
|
21
|
+
declare type $$EXPORT_DEFAULT_DECLARATION$$ =
|
|
22
|
+
typeof $$EXPORT_DEFAULT_DECLARATION$$;
|
|
23
|
+
export default $$EXPORT_DEFAULT_DECLARATION$$;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @noformat
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
* @generated SignedSource<<f0cb08627027adbc9cc7b4b9c8caa208>>
|
|
10
|
+
*
|
|
11
|
+
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
|
+
* Original file: packages/metro-source-map/src/Consumer/normalizeSourcePath.js
|
|
13
|
+
* To regenerate, run:
|
|
14
|
+
* js1 build metro-ts-defs (internal) OR
|
|
15
|
+
* yarn run build-ts-defs (OSS)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
declare function normalizeSourcePath(
|
|
19
|
+
sourceInput: string,
|
|
20
|
+
map: {readonly sourceRoot?: null | undefined | string},
|
|
21
|
+
): string;
|
|
22
|
+
export default normalizeSourcePath;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @noformat
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
* @generated SignedSource<<6db8c7c1cbb86a47de92e1b9565dd624>>
|
|
10
|
+
*
|
|
11
|
+
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
|
+
* Original file: packages/metro-source-map/src/Consumer/positionMath.js
|
|
13
|
+
* To regenerate, run:
|
|
14
|
+
* js1 build metro-ts-defs (internal) OR
|
|
15
|
+
* yarn run build-ts-defs (OSS)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type {GeneratedOffset} from './types';
|
|
19
|
+
import type {Number0, Number1} from 'ob1';
|
|
20
|
+
|
|
21
|
+
export declare function shiftPositionByOffset<
|
|
22
|
+
T extends {
|
|
23
|
+
readonly line: null | undefined | Number1;
|
|
24
|
+
readonly column: null | undefined | Number0;
|
|
25
|
+
},
|
|
26
|
+
>(pos: T, offset: GeneratedOffset): T;
|
|
27
|
+
export declare function subtractOffsetFromPosition<
|
|
28
|
+
T extends {
|
|
29
|
+
readonly line: null | undefined | Number1;
|
|
30
|
+
readonly column: null | undefined | Number0;
|
|
31
|
+
},
|
|
32
|
+
>(pos: T, offset: GeneratedOffset): T;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @noformat
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
* @generated SignedSource<<c44d93a454a950171d9456512714303b>>
|
|
10
|
+
*
|
|
11
|
+
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
|
+
* Original file: packages/metro-source-map/src/Consumer/search.js
|
|
13
|
+
* To regenerate, run:
|
|
14
|
+
* js1 build metro-ts-defs (internal) OR
|
|
15
|
+
* yarn run build-ts-defs (OSS)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export declare function greatestLowerBound<T, U>(
|
|
19
|
+
elements: ReadonlyArray<T>,
|
|
20
|
+
target: U,
|
|
21
|
+
comparator: ($$PARAM_0$$: U, $$PARAM_1$$: T) => number,
|
|
22
|
+
): null | undefined | number;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @noformat
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
* @generated SignedSource<<5fbef54d757c6130889a1889f7d71255>>
|
|
10
|
+
*
|
|
11
|
+
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
|
+
* Original file: packages/metro-source-map/src/Consumer/types.js
|
|
13
|
+
* To regenerate, run:
|
|
14
|
+
* js1 build metro-ts-defs (internal) OR
|
|
15
|
+
* yarn run build-ts-defs (OSS)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type {IterationOrder, LookupBias} from './constants';
|
|
19
|
+
import type {Number0, Number1} from 'ob1';
|
|
20
|
+
|
|
21
|
+
export type {IterationOrder, LookupBias};
|
|
22
|
+
export type GeneratedOffset = {
|
|
23
|
+
readonly lines: Number0;
|
|
24
|
+
readonly columns: Number0;
|
|
25
|
+
};
|
|
26
|
+
export type SourcePosition = {
|
|
27
|
+
source: null | undefined | string;
|
|
28
|
+
line: null | undefined | Number1;
|
|
29
|
+
column: null | undefined | Number0;
|
|
30
|
+
name: null | undefined | string;
|
|
31
|
+
};
|
|
32
|
+
export type GeneratedPosition = {
|
|
33
|
+
readonly line: Number1;
|
|
34
|
+
readonly column: Number0;
|
|
35
|
+
};
|
|
36
|
+
export type GeneratedPositionLookup = {
|
|
37
|
+
readonly line: null | undefined | Number1;
|
|
38
|
+
readonly column: null | undefined | Number0;
|
|
39
|
+
readonly bias?: LookupBias;
|
|
40
|
+
};
|
|
41
|
+
export type Mapping = Readonly<{
|
|
42
|
+
source: null | undefined | string;
|
|
43
|
+
generatedLine: Number1;
|
|
44
|
+
generatedColumn: Number0;
|
|
45
|
+
originalLine: null | undefined | Number1;
|
|
46
|
+
originalColumn: null | undefined | Number0;
|
|
47
|
+
name: null | undefined | string;
|
|
48
|
+
}>;
|
|
49
|
+
export interface IConsumer {
|
|
50
|
+
originalPositionFor(
|
|
51
|
+
generatedPosition: GeneratedPositionLookup,
|
|
52
|
+
): SourcePosition;
|
|
53
|
+
generatedMappings(): Iterable<Mapping>;
|
|
54
|
+
eachMapping(
|
|
55
|
+
callback: (mapping: Mapping) => unknown,
|
|
56
|
+
context?: unknown,
|
|
57
|
+
order?: IterationOrder,
|
|
58
|
+
): void;
|
|
59
|
+
get file(): null | undefined | string;
|
|
60
|
+
sourceContentFor(
|
|
61
|
+
source: string,
|
|
62
|
+
nullOnMissing: true,
|
|
63
|
+
): null | undefined | string;
|
|
64
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @noformat
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
* @generated SignedSource<<c584261d0556139618e3485bed0b3348>>
|
|
10
|
+
*
|
|
11
|
+
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
|
+
* Original file: packages/metro-source-map/src/Generator.js
|
|
13
|
+
* To regenerate, run:
|
|
14
|
+
* js1 build metro-ts-defs (internal) OR
|
|
15
|
+
* yarn run build-ts-defs (OSS)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type {
|
|
19
|
+
BasicSourceMap,
|
|
20
|
+
FBSourceFunctionMap,
|
|
21
|
+
FBSourceMetadata,
|
|
22
|
+
} from './source-map';
|
|
23
|
+
|
|
24
|
+
import B64Builder from './B64Builder';
|
|
25
|
+
|
|
26
|
+
type FileFlags = Readonly<{addToIgnoreList?: boolean}>;
|
|
27
|
+
/**
|
|
28
|
+
* Generates a source map from raw mappings.
|
|
29
|
+
*
|
|
30
|
+
* Raw mappings are a set of 2, 4, or five elements:
|
|
31
|
+
*
|
|
32
|
+
* - line and column number in the generated source
|
|
33
|
+
* - line and column number in the original source
|
|
34
|
+
* - symbol name in the original source
|
|
35
|
+
*
|
|
36
|
+
* Mappings have to be passed in the order appearance in the generated source.
|
|
37
|
+
*/
|
|
38
|
+
declare class Generator {
|
|
39
|
+
builder: B64Builder;
|
|
40
|
+
last: {
|
|
41
|
+
generatedColumn: number;
|
|
42
|
+
generatedLine: number;
|
|
43
|
+
name: number;
|
|
44
|
+
source: number;
|
|
45
|
+
sourceColumn: number;
|
|
46
|
+
sourceLine: number;
|
|
47
|
+
};
|
|
48
|
+
names: IndexedSet;
|
|
49
|
+
source: number;
|
|
50
|
+
sources: Array<string>;
|
|
51
|
+
sourcesContent: Array<null | undefined | string>;
|
|
52
|
+
x_facebook_sources: Array<null | undefined | FBSourceMetadata>;
|
|
53
|
+
x_google_ignoreList: Array<number>;
|
|
54
|
+
constructor();
|
|
55
|
+
/**
|
|
56
|
+
* Mark the beginning of a new source file.
|
|
57
|
+
*/
|
|
58
|
+
startFile(
|
|
59
|
+
file: string,
|
|
60
|
+
code: string,
|
|
61
|
+
functionMap: null | undefined | FBSourceFunctionMap,
|
|
62
|
+
flags?: FileFlags,
|
|
63
|
+
): void;
|
|
64
|
+
/**
|
|
65
|
+
* Mark the end of the current source file
|
|
66
|
+
*/
|
|
67
|
+
endFile(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Adds a mapping for generated code without a corresponding source location.
|
|
70
|
+
*/
|
|
71
|
+
addSimpleMapping(generatedLine: number, generatedColumn: number): void;
|
|
72
|
+
/**
|
|
73
|
+
* Adds a mapping for generated code with a corresponding source location.
|
|
74
|
+
*/
|
|
75
|
+
addSourceMapping(
|
|
76
|
+
generatedLine: number,
|
|
77
|
+
generatedColumn: number,
|
|
78
|
+
sourceLine: number,
|
|
79
|
+
sourceColumn: number,
|
|
80
|
+
): void;
|
|
81
|
+
/**
|
|
82
|
+
* Adds a mapping for code with a corresponding source location + symbol name.
|
|
83
|
+
*/
|
|
84
|
+
addNamedSourceMapping(
|
|
85
|
+
generatedLine: number,
|
|
86
|
+
generatedColumn: number,
|
|
87
|
+
sourceLine: number,
|
|
88
|
+
sourceColumn: number,
|
|
89
|
+
name: string,
|
|
90
|
+
): void;
|
|
91
|
+
/**
|
|
92
|
+
* Return the source map as object.
|
|
93
|
+
*/
|
|
94
|
+
toMap(file?: string, options?: {excludeSource?: boolean}): BasicSourceMap;
|
|
95
|
+
/**
|
|
96
|
+
* Return the source map as string.
|
|
97
|
+
*
|
|
98
|
+
* This is ~2.5x faster than calling `JSON.stringify(generator.toMap())`
|
|
99
|
+
*/
|
|
100
|
+
toString(file?: string, options?: {excludeSource?: boolean}): string;
|
|
101
|
+
/**
|
|
102
|
+
* Determine whether we need to write the `x_facebook_sources` field.
|
|
103
|
+
* If the metadata is all `null`s, we can omit the field entirely.
|
|
104
|
+
*/
|
|
105
|
+
hasSourcesMetadata(): boolean;
|
|
106
|
+
}
|
|
107
|
+
export default Generator;
|
|
108
|
+
declare class IndexedSet {
|
|
109
|
+
map: Map<string, number>;
|
|
110
|
+
nextIndex: number;
|
|
111
|
+
constructor();
|
|
112
|
+
indexFor(x: string): number;
|
|
113
|
+
items(): Array<string>;
|
|
114
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @noformat
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
* @generated SignedSource<<bf83602f3e958b1e38787cb0c322993f>>
|
|
10
|
+
*
|
|
11
|
+
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
|
+
* Original file: packages/metro-source-map/src/composeSourceMaps.js
|
|
13
|
+
* To regenerate, run:
|
|
14
|
+
* js1 build metro-ts-defs (internal) OR
|
|
15
|
+
* yarn run build-ts-defs (OSS)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type {MixedSourceMap} from './source-map';
|
|
19
|
+
|
|
20
|
+
declare function composeSourceMaps(
|
|
21
|
+
maps: ReadonlyArray<MixedSourceMap>,
|
|
22
|
+
): MixedSourceMap;
|
|
23
|
+
export default composeSourceMaps;
|
package/src/encode.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Portions Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @noformat
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
* @generated SignedSource<<e31ac8f472e7aa09b837bf36083edf6c>>
|
|
10
|
+
*
|
|
11
|
+
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
|
+
* Original file: packages/metro-source-map/src/encode.js
|
|
13
|
+
* To regenerate, run:
|
|
14
|
+
* js1 build metro-ts-defs (internal) OR
|
|
15
|
+
* yarn run build-ts-defs (OSS)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Copyright 2011 Mozilla Foundation and contributors
|
|
20
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
21
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
22
|
+
*
|
|
23
|
+
* Based on the Base 64 VLQ implementation in Closure Compiler:
|
|
24
|
+
* https://git.io/vymuA
|
|
25
|
+
*
|
|
26
|
+
* Copyright 2011 The Closure Compiler Authors. All rights reserved.
|
|
27
|
+
* Redistribution and use in source and binary forms, with or without
|
|
28
|
+
* modification, are permitted provided that the following conditions are
|
|
29
|
+
* met:
|
|
30
|
+
*
|
|
31
|
+
* * Redistributions of source code must retain the above copyright
|
|
32
|
+
* notice, this list of conditions and the following disclaimer.
|
|
33
|
+
* * Redistributions in binary form must reproduce the above
|
|
34
|
+
* copyright notice, this list of conditions and the following
|
|
35
|
+
* disclaimer in the documentation and/or other materials provided
|
|
36
|
+
* with the distribution.
|
|
37
|
+
* * Neither the name of Google Inc. nor the names of its
|
|
38
|
+
* contributors may be used to endorse or promote products derived
|
|
39
|
+
* from this software without specific prior written permission.
|
|
40
|
+
*
|
|
41
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
42
|
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
43
|
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
44
|
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
45
|
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
46
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
47
|
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
48
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
49
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
50
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
51
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
52
|
+
*
|
|
53
|
+
* @copyright
|
|
54
|
+
*
|
|
55
|
+
* Associate this with the THIRD_PARTY_LICENCE type to ensure it isn't
|
|
56
|
+
* stripped by flow-api-translator.
|
|
57
|
+
*/
|
|
58
|
+
export type THIRD_PARTY_LICENSE = unknown;
|
|
59
|
+
/**
|
|
60
|
+
* Encodes a number to base64 VLQ format and appends it to the passed-in buffer
|
|
61
|
+
*
|
|
62
|
+
* DON'T USE COMPOUND OPERATORS (eg `>>>=`) ON `let`-DECLARED VARIABLES!
|
|
63
|
+
* V8 WILL DEOPTIMIZE THIS FUNCTION AND MAP CREATION WILL BE 25% SLOWER!
|
|
64
|
+
*
|
|
65
|
+
* DON'T ADD MORE COMMENTS TO THIS FUNCTION TO KEEP ITS LENGTH SHORT ENOUGH FOR
|
|
66
|
+
* V8 OPTIMIZATION!
|
|
67
|
+
*/
|
|
68
|
+
declare function encode(
|
|
69
|
+
value: number,
|
|
70
|
+
buffer: Buffer,
|
|
71
|
+
position: number,
|
|
72
|
+
): number;
|
|
73
|
+
export default encode;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @noformat
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
* @generated SignedSource<<6f37d9027ca5bd3db3a9752a9498ab11>>
|
|
10
|
+
*
|
|
11
|
+
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
|
+
* Original file: packages/metro-source-map/src/generateFunctionMap.js
|
|
13
|
+
* To regenerate, run:
|
|
14
|
+
* js1 build metro-ts-defs (internal) OR
|
|
15
|
+
* yarn run build-ts-defs (OSS)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type {FBSourceFunctionMap} from './source-map';
|
|
19
|
+
import type {PluginObj} from '@babel/core';
|
|
20
|
+
import type {Node as BabelNode} from '@babel/types';
|
|
21
|
+
|
|
22
|
+
type Position = {line: number; column: number};
|
|
23
|
+
type RangeMapping = {name: string; start: Position};
|
|
24
|
+
export type Context = {filename?: null | undefined | string};
|
|
25
|
+
/**
|
|
26
|
+
* Generate a map of source positions to function names. The names are meant to
|
|
27
|
+
* describe the stack frame in an error trace and may contain more contextual
|
|
28
|
+
* information than just the actual name of the function.
|
|
29
|
+
*
|
|
30
|
+
* The output is encoded for use in a source map. For details about the format,
|
|
31
|
+
* see MappingEncoder below.
|
|
32
|
+
*/
|
|
33
|
+
declare function generateFunctionMap(
|
|
34
|
+
ast: BabelNode,
|
|
35
|
+
context?: Context,
|
|
36
|
+
): FBSourceFunctionMap;
|
|
37
|
+
/**
|
|
38
|
+
* Same as generateFunctionMap, but returns the raw array of mappings instead
|
|
39
|
+
* of encoding it for use in a source map.
|
|
40
|
+
*
|
|
41
|
+
* Lines are 1-based and columns are 0-based.
|
|
42
|
+
*/
|
|
43
|
+
declare function generateFunctionMappingsArray(
|
|
44
|
+
ast: BabelNode,
|
|
45
|
+
context?: Context,
|
|
46
|
+
): ReadonlyArray<RangeMapping>;
|
|
47
|
+
declare function functionMapBabelPlugin(): PluginObj;
|
|
48
|
+
export {
|
|
49
|
+
functionMapBabelPlugin,
|
|
50
|
+
generateFunctionMap,
|
|
51
|
+
generateFunctionMappingsArray,
|
|
52
|
+
};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @noformat
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
* @generated SignedSource<<7303fe7149cb12d764c6106cdf4f49ee>>
|
|
10
|
+
*
|
|
11
|
+
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
|
+
* Original file: packages/metro-source-map/src/source-map.js
|
|
13
|
+
* To regenerate, run:
|
|
14
|
+
* js1 build metro-ts-defs (internal) OR
|
|
15
|
+
* yarn run build-ts-defs (OSS)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type {IConsumer} from './Consumer/types';
|
|
19
|
+
|
|
20
|
+
import {BundleBuilder, createIndexMap} from './BundleBuilder';
|
|
21
|
+
import composeSourceMaps from './composeSourceMaps';
|
|
22
|
+
import Consumer from './Consumer';
|
|
23
|
+
import normalizeSourcePath from './Consumer/normalizeSourcePath';
|
|
24
|
+
import {
|
|
25
|
+
functionMapBabelPlugin,
|
|
26
|
+
generateFunctionMap,
|
|
27
|
+
} from './generateFunctionMap';
|
|
28
|
+
import Generator from './Generator';
|
|
29
|
+
|
|
30
|
+
export type {IConsumer};
|
|
31
|
+
type GeneratedCodeMapping = [number, number];
|
|
32
|
+
type SourceMapping = [number, number, number, number];
|
|
33
|
+
type SourceMappingWithName = [number, number, number, number, string];
|
|
34
|
+
export type MetroSourceMapSegmentTuple =
|
|
35
|
+
| SourceMappingWithName
|
|
36
|
+
| SourceMapping
|
|
37
|
+
| GeneratedCodeMapping;
|
|
38
|
+
export type HermesFunctionOffsets = {
|
|
39
|
+
[$$Key$$: number]: ReadonlyArray<number>;
|
|
40
|
+
};
|
|
41
|
+
export type FBSourcesArray = ReadonlyArray<null | undefined | FBSourceMetadata>;
|
|
42
|
+
export type FBSourceMetadata = [null | undefined | FBSourceFunctionMap];
|
|
43
|
+
export type FBSourceFunctionMap = {
|
|
44
|
+
readonly names: ReadonlyArray<string>;
|
|
45
|
+
readonly mappings: string;
|
|
46
|
+
};
|
|
47
|
+
export type BabelSourceMapSegment = Readonly<{
|
|
48
|
+
generated: Readonly<{column: number; line: number}>;
|
|
49
|
+
original?: Readonly<{column: number; line: number}>;
|
|
50
|
+
source?: null | undefined | string;
|
|
51
|
+
name?: null | undefined | string;
|
|
52
|
+
}>;
|
|
53
|
+
export type FBSegmentMap = {[id: string]: MixedSourceMap};
|
|
54
|
+
export type BasicSourceMap = {
|
|
55
|
+
readonly file?: string;
|
|
56
|
+
readonly mappings: string;
|
|
57
|
+
readonly names: Array<string>;
|
|
58
|
+
readonly sourceRoot?: string;
|
|
59
|
+
readonly sources: Array<string>;
|
|
60
|
+
readonly sourcesContent?: Array<null | undefined | string>;
|
|
61
|
+
readonly version: number;
|
|
62
|
+
readonly x_facebook_offsets?: Array<number>;
|
|
63
|
+
readonly x_metro_module_paths?: Array<string>;
|
|
64
|
+
readonly x_facebook_sources?: FBSourcesArray;
|
|
65
|
+
readonly x_facebook_segments?: FBSegmentMap;
|
|
66
|
+
readonly x_hermes_function_offsets?: HermesFunctionOffsets;
|
|
67
|
+
readonly x_google_ignoreList?: Array<number>;
|
|
68
|
+
};
|
|
69
|
+
export type IndexMapSection = {
|
|
70
|
+
map: IndexMap | BasicSourceMap;
|
|
71
|
+
offset: {line: number; column: number};
|
|
72
|
+
};
|
|
73
|
+
export type IndexMap = {
|
|
74
|
+
readonly file?: string;
|
|
75
|
+
readonly mappings?: void;
|
|
76
|
+
readonly sourcesContent?: void;
|
|
77
|
+
readonly sections: Array<IndexMapSection>;
|
|
78
|
+
readonly version: number;
|
|
79
|
+
readonly x_facebook_offsets?: Array<number>;
|
|
80
|
+
readonly x_metro_module_paths?: Array<string>;
|
|
81
|
+
readonly x_facebook_sources?: void;
|
|
82
|
+
readonly x_facebook_segments?: FBSegmentMap;
|
|
83
|
+
readonly x_hermes_function_offsets?: HermesFunctionOffsets;
|
|
84
|
+
readonly x_google_ignoreList?: void;
|
|
85
|
+
};
|
|
86
|
+
export type MixedSourceMap = IndexMap | BasicSourceMap;
|
|
87
|
+
/**
|
|
88
|
+
* Creates a source map from modules with "raw mappings", i.e. an array of
|
|
89
|
+
* tuples with either 2, 4, or 5 elements:
|
|
90
|
+
* generated line, generated column, source line, source line, symbol name.
|
|
91
|
+
* Accepts an `offsetLines` argument in case modules' code is to be offset in
|
|
92
|
+
* the resulting bundle, e.g. by some prefix code.
|
|
93
|
+
*/
|
|
94
|
+
declare function fromRawMappings(
|
|
95
|
+
modules: ReadonlyArray<{
|
|
96
|
+
readonly map: null | undefined | ReadonlyArray<MetroSourceMapSegmentTuple>;
|
|
97
|
+
readonly functionMap: null | undefined | FBSourceFunctionMap;
|
|
98
|
+
readonly path: string;
|
|
99
|
+
readonly source: string;
|
|
100
|
+
readonly code: string;
|
|
101
|
+
readonly isIgnored: boolean;
|
|
102
|
+
readonly lineCount?: number;
|
|
103
|
+
}>,
|
|
104
|
+
offsetLines?: number,
|
|
105
|
+
): Generator;
|
|
106
|
+
declare function fromRawMappingsNonBlocking(
|
|
107
|
+
modules: ReadonlyArray<{
|
|
108
|
+
readonly map: null | undefined | ReadonlyArray<MetroSourceMapSegmentTuple>;
|
|
109
|
+
readonly functionMap: null | undefined | FBSourceFunctionMap;
|
|
110
|
+
readonly path: string;
|
|
111
|
+
readonly source: string;
|
|
112
|
+
readonly code: string;
|
|
113
|
+
readonly isIgnored: boolean;
|
|
114
|
+
readonly lineCount?: number;
|
|
115
|
+
}>,
|
|
116
|
+
offsetLines?: number,
|
|
117
|
+
): Promise<Generator>;
|
|
118
|
+
/**
|
|
119
|
+
* Transforms a standard source map object into a Raw Mappings object, to be
|
|
120
|
+
* used across the bundler.
|
|
121
|
+
*/
|
|
122
|
+
declare function toBabelSegments(
|
|
123
|
+
sourceMap: BasicSourceMap,
|
|
124
|
+
): Array<BabelSourceMapSegment>;
|
|
125
|
+
declare function toSegmentTuple(
|
|
126
|
+
mapping: BabelSourceMapSegment,
|
|
127
|
+
): MetroSourceMapSegmentTuple;
|
|
128
|
+
export {
|
|
129
|
+
BundleBuilder,
|
|
130
|
+
composeSourceMaps,
|
|
131
|
+
Consumer,
|
|
132
|
+
createIndexMap,
|
|
133
|
+
generateFunctionMap,
|
|
134
|
+
fromRawMappings,
|
|
135
|
+
fromRawMappingsNonBlocking,
|
|
136
|
+
functionMapBabelPlugin,
|
|
137
|
+
normalizeSourcePath,
|
|
138
|
+
toBabelSegments,
|
|
139
|
+
toSegmentTuple,
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Backwards-compatibility with CommonJS consumers using interopRequireDefault.
|
|
143
|
+
* Do not add to this list.
|
|
144
|
+
*
|
|
145
|
+
* @deprecated Default import from 'metro-source-map' is deprecated, use named exports.
|
|
146
|
+
*/
|
|
147
|
+
declare const $$EXPORT_DEFAULT_DECLARATION$$: {
|
|
148
|
+
BundleBuilder: typeof BundleBuilder;
|
|
149
|
+
composeSourceMaps: typeof composeSourceMaps;
|
|
150
|
+
Consumer: typeof Consumer;
|
|
151
|
+
createIndexMap: typeof createIndexMap;
|
|
152
|
+
generateFunctionMap: typeof generateFunctionMap;
|
|
153
|
+
fromRawMappings: typeof fromRawMappings;
|
|
154
|
+
fromRawMappingsNonBlocking: typeof fromRawMappingsNonBlocking;
|
|
155
|
+
functionMapBabelPlugin: typeof functionMapBabelPlugin;
|
|
156
|
+
normalizeSourcePath: typeof normalizeSourcePath;
|
|
157
|
+
toBabelSegments: typeof toBabelSegments;
|
|
158
|
+
toSegmentTuple: typeof toSegmentTuple;
|
|
159
|
+
};
|
|
160
|
+
declare type $$EXPORT_DEFAULT_DECLARATION$$ =
|
|
161
|
+
typeof $$EXPORT_DEFAULT_DECLARATION$$;
|
|
162
|
+
export default $$EXPORT_DEFAULT_DECLARATION$$;
|