metro-source-map 0.83.0 → 0.83.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 +4 -4
- package/src/B64Builder.d.ts +47 -0
- package/src/B64Builder.js +10 -3
- package/src/B64Builder.js.flow +2 -6
- package/src/BundleBuilder.d.ts +43 -0
- package/src/BundleBuilder.js +6 -4
- package/src/BundleBuilder.js.flow +2 -6
- package/src/Consumer/AbstractConsumer.d.ts +37 -0
- package/src/Consumer/AbstractConsumer.js +17 -10
- package/src/Consumer/AbstractConsumer.js.flow +4 -8
- package/src/Consumer/DelegatingConsumer.d.ts +47 -0
- package/src/Consumer/DelegatingConsumer.js +15 -13
- package/src/Consumer/DelegatingConsumer.js.flow +6 -9
- package/src/Consumer/MappingsConsumer.d.ts +43 -0
- package/src/Consumer/MappingsConsumer.js +68 -51
- package/src/Consumer/MappingsConsumer.js.flow +14 -15
- package/src/Consumer/SectionsConsumer.d.ts +40 -0
- package/src/Consumer/SectionsConsumer.js +38 -24
- package/src/Consumer/SectionsConsumer.js.flow +11 -12
- package/src/Consumer/constants.d.ts +39 -0
- package/src/Consumer/constants.js +23 -20
- package/src/Consumer/constants.js.flow +8 -5
- package/src/Consumer/createConsumer.d.ts +15 -0
- package/src/Consumer/createConsumer.js +14 -8
- package/src/Consumer/createConsumer.js.flow +5 -9
- package/src/Consumer/index.d.ts +16 -0
- package/src/Consumer/index.js +11 -2
- package/src/Consumer/index.js.flow +2 -4
- package/src/Consumer/normalizeSourcePath.d.ts +15 -0
- package/src/Consumer/normalizeSourcePath.js +13 -5
- package/src/Consumer/normalizeSourcePath.js.flow +2 -6
- package/src/Consumer/positionMath.d.ts +25 -0
- package/src/Consumer/positionMath.js +14 -12
- package/src/Consumer/positionMath.js.flow +4 -8
- package/src/Consumer/search.d.ts +15 -0
- package/src/Consumer/search.js +4 -3
- package/src/Consumer/search.js.flow +1 -5
- package/src/Consumer/types.d.ts +57 -0
- package/src/Consumer/{types.flow.js.flow → types.js.flow} +0 -2
- package/src/Generator.d.ts +107 -0
- package/src/Generator.js +16 -13
- package/src/Generator.js.flow +2 -6
- package/src/composeSourceMaps.d.ts +16 -0
- package/src/composeSourceMaps.js +19 -11
- package/src/composeSourceMaps.js.flow +11 -11
- package/src/encode.d.ts +66 -0
- package/src/encode.js +4 -1
- package/src/encode.js.flow +9 -5
- package/src/generateFunctionMap.d.ts +45 -0
- package/src/generateFunctionMap.js +52 -30
- package/src/generateFunctionMap.js.flow +21 -22
- package/src/source-map.d.ts +130 -36
- package/src/source-map.js +77 -25
- package/src/source-map.js.flow +42 -17
- /package/src/Consumer/{types.flow.js → types.js} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "metro-source-map",
|
|
3
|
-
"version": "0.83.
|
|
3
|
+
"version": "0.83.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.25.2",
|
|
23
23
|
"flow-enums-runtime": "^0.0.6",
|
|
24
24
|
"invariant": "^2.2.4",
|
|
25
|
-
"metro-symbolicate": "0.83.
|
|
25
|
+
"metro-symbolicate": "0.83.2",
|
|
26
26
|
"nullthrows": "^1.1.1",
|
|
27
|
-
"ob1": "0.83.
|
|
27
|
+
"ob1": "0.83.2",
|
|
28
28
|
"source-map": "^0.5.6",
|
|
29
29
|
"vlq": "^1.0.0"
|
|
30
30
|
},
|
|
@@ -35,6 +35,6 @@
|
|
|
35
35
|
"terser": "^5.15.0"
|
|
36
36
|
},
|
|
37
37
|
"engines": {
|
|
38
|
-
"node": ">=
|
|
38
|
+
"node": ">=20.19.4"
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -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
|
+
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Efficient builder for base64 VLQ mappings strings.
|
|
13
|
+
*
|
|
14
|
+
* This class uses a buffer that is preallocated with one megabyte and is
|
|
15
|
+
* reallocated dynamically as needed, doubling its size.
|
|
16
|
+
*
|
|
17
|
+
* Encoding never creates any complex value types (strings, objects), and only
|
|
18
|
+
* writes character values to the buffer.
|
|
19
|
+
*
|
|
20
|
+
* For details about source map terminology and specification, check
|
|
21
|
+
* https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit
|
|
22
|
+
*/
|
|
23
|
+
declare class B64Builder {
|
|
24
|
+
buffer: Buffer;
|
|
25
|
+
pos: number;
|
|
26
|
+
hasSegment: boolean;
|
|
27
|
+
constructor();
|
|
28
|
+
/**
|
|
29
|
+
* Adds `n` markers for generated lines to the mappings.
|
|
30
|
+
*/
|
|
31
|
+
markLines(n: number): this;
|
|
32
|
+
/**
|
|
33
|
+
* Starts a segment at the specified column offset in the current line.
|
|
34
|
+
*/
|
|
35
|
+
startSegment(column: number): this;
|
|
36
|
+
/**
|
|
37
|
+
* Appends a single number to the mappings.
|
|
38
|
+
*/
|
|
39
|
+
append(value: number): this;
|
|
40
|
+
/**
|
|
41
|
+
* Returns the string representation of the mappings.
|
|
42
|
+
*/
|
|
43
|
+
toString(): string;
|
|
44
|
+
_writeByte(byte: number): void;
|
|
45
|
+
_realloc(): void;
|
|
46
|
+
}
|
|
47
|
+
export default B64Builder;
|
package/src/B64Builder.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true,
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _encode = _interopRequireDefault(require("./encode"));
|
|
8
|
+
function _interopRequireDefault(e) {
|
|
9
|
+
return e && e.__esModule ? e : { default: e };
|
|
10
|
+
}
|
|
4
11
|
const MAX_SEGMENT_LENGTH = 7;
|
|
5
12
|
const ONE_MEG = 1024 * 1024;
|
|
6
13
|
const COMMA = 0x2c;
|
|
@@ -37,7 +44,7 @@ class B64Builder {
|
|
|
37
44
|
if (this.pos + MAX_SEGMENT_LENGTH >= this.buffer.length) {
|
|
38
45
|
this._realloc();
|
|
39
46
|
}
|
|
40
|
-
this.pos =
|
|
47
|
+
this.pos = (0, _encode.default)(value, this.buffer, this.pos);
|
|
41
48
|
return this;
|
|
42
49
|
}
|
|
43
50
|
toString() {
|
|
@@ -55,4 +62,4 @@ class B64Builder {
|
|
|
55
62
|
buffer.copy(this.buffer);
|
|
56
63
|
}
|
|
57
64
|
}
|
|
58
|
-
|
|
65
|
+
exports.default = B64Builder;
|
package/src/B64Builder.js.flow
CHANGED
|
@@ -9,9 +9,7 @@
|
|
|
9
9
|
* @oncall react_native
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const encode = require('./encode');
|
|
12
|
+
import encode from './encode';
|
|
15
13
|
|
|
16
14
|
const MAX_SEGMENT_LENGTH = 7;
|
|
17
15
|
const ONE_MEG = 1024 * 1024;
|
|
@@ -30,7 +28,7 @@ const SEMICOLON = 0x3b;
|
|
|
30
28
|
* For details about source map terminology and specification, check
|
|
31
29
|
* https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit
|
|
32
30
|
*/
|
|
33
|
-
class B64Builder {
|
|
31
|
+
export default class B64Builder {
|
|
34
32
|
buffer: Buffer;
|
|
35
33
|
pos: number;
|
|
36
34
|
hasSegment: boolean;
|
|
@@ -104,5 +102,3 @@ class B64Builder {
|
|
|
104
102
|
buffer.copy(this.buffer);
|
|
105
103
|
}
|
|
106
104
|
}
|
|
107
|
-
|
|
108
|
-
module.exports = B64Builder;
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {IndexMap, IndexMapSection, MixedSourceMap} from './source-map';
|
|
12
|
+
/**
|
|
13
|
+
* Builds a source-mapped bundle by concatenating strings and their
|
|
14
|
+
* corresponding source maps (if any).
|
|
15
|
+
*
|
|
16
|
+
* Usage:
|
|
17
|
+
*
|
|
18
|
+
* const builder = new BundleBuilder('bundle.js');
|
|
19
|
+
* builder
|
|
20
|
+
* .append('foo\n', fooMap)
|
|
21
|
+
* .append('bar\n')
|
|
22
|
+
* // ...
|
|
23
|
+
* const code = builder.getCode();
|
|
24
|
+
* const map = builder.getMap();
|
|
25
|
+
*/
|
|
26
|
+
export declare class BundleBuilder {
|
|
27
|
+
_file: string;
|
|
28
|
+
_sections: Array<IndexMapSection>;
|
|
29
|
+
_line: number;
|
|
30
|
+
_column: number;
|
|
31
|
+
_code: string;
|
|
32
|
+
_afterMappedContent: boolean;
|
|
33
|
+
constructor(file: string);
|
|
34
|
+
_pushMapSection(map: MixedSourceMap): void;
|
|
35
|
+
_endMappedContent(): void;
|
|
36
|
+
append(code: string, map: null | undefined | MixedSourceMap): this;
|
|
37
|
+
getMap(): MixedSourceMap;
|
|
38
|
+
getCode(): string;
|
|
39
|
+
}
|
|
40
|
+
export declare function createIndexMap(
|
|
41
|
+
file: string,
|
|
42
|
+
sections: Array<IndexMapSection>,
|
|
43
|
+
): IndexMap;
|
package/src/BundleBuilder.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true,
|
|
5
|
+
});
|
|
6
|
+
exports.BundleBuilder = void 0;
|
|
7
|
+
exports.createIndexMap = createIndexMap;
|
|
3
8
|
const EMPTY_MAP = {
|
|
4
9
|
version: 3,
|
|
5
10
|
sources: [],
|
|
@@ -59,6 +64,7 @@ class BundleBuilder {
|
|
|
59
64
|
return this._code;
|
|
60
65
|
}
|
|
61
66
|
}
|
|
67
|
+
exports.BundleBuilder = BundleBuilder;
|
|
62
68
|
const reLineBreak = /\r\n|\r|\n/g;
|
|
63
69
|
function measureString(str) {
|
|
64
70
|
let lineBreaks = 0;
|
|
@@ -81,7 +87,3 @@ function createIndexMap(file, sections) {
|
|
|
81
87
|
sections,
|
|
82
88
|
};
|
|
83
89
|
}
|
|
84
|
-
module.exports = {
|
|
85
|
-
BundleBuilder,
|
|
86
|
-
createIndexMap,
|
|
87
|
-
};
|
|
@@ -9,8 +9,6 @@
|
|
|
9
9
|
* @oncall react_native
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
12
|
import type {IndexMap, IndexMapSection, MixedSourceMap} from './source-map';
|
|
15
13
|
|
|
16
14
|
const EMPTY_MAP = {
|
|
@@ -34,7 +32,7 @@ const EMPTY_MAP = {
|
|
|
34
32
|
* const code = builder.getCode();
|
|
35
33
|
* const map = builder.getMap();
|
|
36
34
|
*/
|
|
37
|
-
class BundleBuilder {
|
|
35
|
+
export class BundleBuilder {
|
|
38
36
|
_file: string;
|
|
39
37
|
_sections: Array<IndexMapSection>;
|
|
40
38
|
_line: number;
|
|
@@ -114,7 +112,7 @@ function measureString(str: string): {
|
|
|
114
112
|
return {lineBreaks, lastLineColumns};
|
|
115
113
|
}
|
|
116
114
|
|
|
117
|
-
function createIndexMap(
|
|
115
|
+
export function createIndexMap(
|
|
118
116
|
file: string,
|
|
119
117
|
sections: Array<IndexMapSection>,
|
|
120
118
|
): IndexMap {
|
|
@@ -124,5 +122,3 @@ function createIndexMap(
|
|
|
124
122
|
sections,
|
|
125
123
|
};
|
|
126
124
|
}
|
|
127
|
-
|
|
128
|
-
module.exports = {BundleBuilder, createIndexMap};
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {
|
|
12
|
+
GeneratedPositionLookup,
|
|
13
|
+
IConsumer,
|
|
14
|
+
IterationOrder,
|
|
15
|
+
Mapping,
|
|
16
|
+
SourcePosition,
|
|
17
|
+
} from './types';
|
|
18
|
+
|
|
19
|
+
declare class AbstractConsumer implements IConsumer {
|
|
20
|
+
_sourceMap: {readonly file?: string};
|
|
21
|
+
constructor(sourceMap: {readonly file?: string});
|
|
22
|
+
originalPositionFor(
|
|
23
|
+
generatedPosition: GeneratedPositionLookup,
|
|
24
|
+
): SourcePosition;
|
|
25
|
+
generatedMappings(): Iterable<Mapping>;
|
|
26
|
+
eachMapping(
|
|
27
|
+
callback: (mapping: Mapping) => unknown,
|
|
28
|
+
context?: unknown,
|
|
29
|
+
order?: IterationOrder,
|
|
30
|
+
): void;
|
|
31
|
+
get file(): null | undefined | string;
|
|
32
|
+
sourceContentFor(
|
|
33
|
+
source: string,
|
|
34
|
+
nullOnMissing: true,
|
|
35
|
+
): null | undefined | string;
|
|
36
|
+
}
|
|
37
|
+
export default AbstractConsumer;
|
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true,
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _constants = require("./constants");
|
|
8
|
+
var _invariant = _interopRequireDefault(require("invariant"));
|
|
9
|
+
function _interopRequireDefault(e) {
|
|
10
|
+
return e && e.__esModule ? e : { default: e };
|
|
11
|
+
}
|
|
5
12
|
class AbstractConsumer {
|
|
6
13
|
constructor(sourceMap) {
|
|
7
14
|
this._sourceMap = sourceMap;
|
|
8
15
|
}
|
|
9
16
|
originalPositionFor(generatedPosition) {
|
|
10
|
-
|
|
17
|
+
(0, _invariant.default)(false, "Not implemented");
|
|
11
18
|
}
|
|
12
19
|
generatedMappings() {
|
|
13
|
-
|
|
20
|
+
(0, _invariant.default)(false, "Not implemented");
|
|
14
21
|
}
|
|
15
|
-
eachMapping(callback, context = null, order = GENERATED_ORDER) {
|
|
16
|
-
|
|
17
|
-
order === GENERATED_ORDER,
|
|
18
|
-
`Iteration order not implemented: ${iterationOrderToString(order)}
|
|
22
|
+
eachMapping(callback, context = null, order = _constants.GENERATED_ORDER) {
|
|
23
|
+
(0, _invariant.default)(
|
|
24
|
+
order === _constants.GENERATED_ORDER,
|
|
25
|
+
`Iteration order not implemented: ${(0, _constants.iterationOrderToString)(order)}`,
|
|
19
26
|
);
|
|
20
27
|
for (const mapping of this.generatedMappings()) {
|
|
21
28
|
callback.call(context, mapping);
|
|
@@ -25,7 +32,7 @@ class AbstractConsumer {
|
|
|
25
32
|
return this._sourceMap.file;
|
|
26
33
|
}
|
|
27
34
|
sourceContentFor(source, nullOnMissing) {
|
|
28
|
-
|
|
35
|
+
(0, _invariant.default)(false, "Not implemented");
|
|
29
36
|
}
|
|
30
37
|
}
|
|
31
|
-
|
|
38
|
+
exports.default = AbstractConsumer;
|
|
@@ -9,21 +9,19 @@
|
|
|
9
9
|
* @oncall react_native
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
12
|
import type {
|
|
15
13
|
GeneratedPositionLookup,
|
|
16
14
|
IConsumer,
|
|
17
15
|
IterationOrder,
|
|
18
16
|
Mapping,
|
|
19
17
|
SourcePosition,
|
|
20
|
-
} from './types
|
|
18
|
+
} from './types';
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
import {GENERATED_ORDER, iterationOrderToString} from './constants';
|
|
21
|
+
import invariant from 'invariant';
|
|
24
22
|
|
|
25
23
|
// Implementation details shared between MappingsConsumer and SectionsConsumer
|
|
26
|
-
class AbstractConsumer implements IConsumer {
|
|
24
|
+
export default class AbstractConsumer implements IConsumer {
|
|
27
25
|
_sourceMap: {+file?: string, ...};
|
|
28
26
|
|
|
29
27
|
constructor(sourceMap: {+file?: string, ...}) {
|
|
@@ -63,5 +61,3 @@ class AbstractConsumer implements IConsumer {
|
|
|
63
61
|
invariant(false, 'Not implemented');
|
|
64
62
|
}
|
|
65
63
|
}
|
|
66
|
-
|
|
67
|
-
module.exports = AbstractConsumer;
|
|
@@ -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
|
+
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {MixedSourceMap} from '../source-map';
|
|
12
|
+
import type {LookupBias} from './constants.js';
|
|
13
|
+
import type {
|
|
14
|
+
GeneratedPositionLookup,
|
|
15
|
+
IConsumer,
|
|
16
|
+
IterationOrder,
|
|
17
|
+
Mapping,
|
|
18
|
+
SourcePosition,
|
|
19
|
+
} from './types';
|
|
20
|
+
/**
|
|
21
|
+
* A source map consumer that supports both "basic" and "indexed" source maps.
|
|
22
|
+
* Uses `MappingsConsumer` and `SectionsConsumer` under the hood (via
|
|
23
|
+
* `createConsumer`).
|
|
24
|
+
*/
|
|
25
|
+
declare class DelegatingConsumer implements IConsumer {
|
|
26
|
+
static readonly GENERATED_ORDER: IterationOrder;
|
|
27
|
+
static readonly ORIGINAL_ORDER: IterationOrder;
|
|
28
|
+
static readonly GREATEST_LOWER_BOUND: LookupBias;
|
|
29
|
+
static readonly LEAST_UPPER_BOUND: LookupBias;
|
|
30
|
+
_rootConsumer: IConsumer;
|
|
31
|
+
constructor(sourceMap: MixedSourceMap);
|
|
32
|
+
originalPositionFor(
|
|
33
|
+
generatedPosition: GeneratedPositionLookup,
|
|
34
|
+
): SourcePosition;
|
|
35
|
+
generatedMappings(): Iterable<Mapping>;
|
|
36
|
+
eachMapping(
|
|
37
|
+
callback: (mapping: Mapping) => unknown,
|
|
38
|
+
context?: unknown,
|
|
39
|
+
order?: IterationOrder,
|
|
40
|
+
): void;
|
|
41
|
+
get file(): null | undefined | string;
|
|
42
|
+
sourceContentFor(
|
|
43
|
+
source: string,
|
|
44
|
+
nullOnMissing: true,
|
|
45
|
+
): null | undefined | string;
|
|
46
|
+
}
|
|
47
|
+
export default DelegatingConsumer;
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true,
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _constants = require("./constants");
|
|
8
|
+
var _createConsumer = _interopRequireDefault(require("./createConsumer"));
|
|
9
|
+
function _interopRequireDefault(e) {
|
|
10
|
+
return e && e.__esModule ? e : { default: e };
|
|
11
|
+
}
|
|
10
12
|
class DelegatingConsumer {
|
|
11
|
-
static GENERATED_ORDER = GENERATED_ORDER;
|
|
12
|
-
static ORIGINAL_ORDER = ORIGINAL_ORDER;
|
|
13
|
-
static GREATEST_LOWER_BOUND = GREATEST_LOWER_BOUND;
|
|
14
|
-
static LEAST_UPPER_BOUND = LEAST_UPPER_BOUND;
|
|
13
|
+
static GENERATED_ORDER = _constants.GENERATED_ORDER;
|
|
14
|
+
static ORIGINAL_ORDER = _constants.ORIGINAL_ORDER;
|
|
15
|
+
static GREATEST_LOWER_BOUND = _constants.GREATEST_LOWER_BOUND;
|
|
16
|
+
static LEAST_UPPER_BOUND = _constants.LEAST_UPPER_BOUND;
|
|
15
17
|
constructor(sourceMap) {
|
|
16
|
-
this._rootConsumer =
|
|
18
|
+
this._rootConsumer = (0, _createConsumer.default)(sourceMap);
|
|
17
19
|
return this._rootConsumer;
|
|
18
20
|
}
|
|
19
21
|
originalPositionFor(generatedPosition) {
|
|
@@ -32,4 +34,4 @@ class DelegatingConsumer {
|
|
|
32
34
|
return this._rootConsumer.sourceContentFor(source, nullOnMissing);
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
|
-
|
|
37
|
+
exports.default = DelegatingConsumer;
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
* @oncall react_native
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
'use strict';
|
|
13
12
|
import type {MixedSourceMap} from '../source-map';
|
|
14
13
|
import type {LookupBias} from './constants.js';
|
|
15
14
|
import type {
|
|
@@ -18,22 +17,22 @@ import type {
|
|
|
18
17
|
IterationOrder,
|
|
19
18
|
Mapping,
|
|
20
19
|
SourcePosition,
|
|
21
|
-
} from './types
|
|
20
|
+
} from './types';
|
|
22
21
|
|
|
23
|
-
|
|
22
|
+
import {
|
|
24
23
|
GENERATED_ORDER,
|
|
25
24
|
GREATEST_LOWER_BOUND,
|
|
26
25
|
LEAST_UPPER_BOUND,
|
|
27
26
|
ORIGINAL_ORDER,
|
|
28
|
-
}
|
|
29
|
-
|
|
27
|
+
} from './constants';
|
|
28
|
+
import createConsumer from './createConsumer';
|
|
30
29
|
|
|
31
30
|
/**
|
|
32
31
|
* A source map consumer that supports both "basic" and "indexed" source maps.
|
|
33
32
|
* Uses `MappingsConsumer` and `SectionsConsumer` under the hood (via
|
|
34
33
|
* `createConsumer`).
|
|
35
34
|
*/
|
|
36
|
-
class DelegatingConsumer implements IConsumer {
|
|
35
|
+
export default class DelegatingConsumer implements IConsumer {
|
|
37
36
|
static +GENERATED_ORDER: IterationOrder = GENERATED_ORDER;
|
|
38
37
|
static +ORIGINAL_ORDER: IterationOrder = ORIGINAL_ORDER;
|
|
39
38
|
static +GREATEST_LOWER_BOUND: LookupBias = GREATEST_LOWER_BOUND;
|
|
@@ -41,7 +40,7 @@ class DelegatingConsumer implements IConsumer {
|
|
|
41
40
|
|
|
42
41
|
_rootConsumer: IConsumer;
|
|
43
42
|
|
|
44
|
-
// $FlowFixMe[incompatible-
|
|
43
|
+
// $FlowFixMe[incompatible-type]
|
|
45
44
|
constructor(sourceMap: MixedSourceMap): IConsumer {
|
|
46
45
|
this._rootConsumer = createConsumer(sourceMap);
|
|
47
46
|
return this._rootConsumer;
|
|
@@ -74,5 +73,3 @@ class DelegatingConsumer implements IConsumer {
|
|
|
74
73
|
return this._rootConsumer.sourceContentFor(source, nullOnMissing);
|
|
75
74
|
}
|
|
76
75
|
}
|
|
77
|
-
|
|
78
|
-
module.exports = DelegatingConsumer;
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {BasicSourceMap} from '../source-map';
|
|
12
|
+
import type {
|
|
13
|
+
GeneratedPositionLookup,
|
|
14
|
+
IConsumer,
|
|
15
|
+
Mapping,
|
|
16
|
+
SourcePosition,
|
|
17
|
+
} from './types';
|
|
18
|
+
import type {Number0} from 'ob1';
|
|
19
|
+
|
|
20
|
+
import AbstractConsumer from './AbstractConsumer';
|
|
21
|
+
/**
|
|
22
|
+
* A source map consumer that supports "basic" source maps (that have a
|
|
23
|
+
* `mappings` field and no sections).
|
|
24
|
+
*/
|
|
25
|
+
declare class MappingsConsumer extends AbstractConsumer implements IConsumer {
|
|
26
|
+
_sourceMap: BasicSourceMap;
|
|
27
|
+
_decodedMappings: null | undefined | ReadonlyArray<Mapping>;
|
|
28
|
+
_normalizedSources: null | undefined | ReadonlyArray<string>;
|
|
29
|
+
constructor(sourceMap: BasicSourceMap);
|
|
30
|
+
originalPositionFor(
|
|
31
|
+
generatedPosition: GeneratedPositionLookup,
|
|
32
|
+
): SourcePosition;
|
|
33
|
+
_decodeMappings(): Generator<Mapping, void, void>;
|
|
34
|
+
_normalizeAndCacheSources(): ReadonlyArray<string>;
|
|
35
|
+
_decodeAndCacheMappings(): ReadonlyArray<Mapping>;
|
|
36
|
+
generatedMappings(): Iterable<Mapping>;
|
|
37
|
+
_indexOfSource(source: string): null | undefined | Number0;
|
|
38
|
+
sourceContentFor(
|
|
39
|
+
source: string,
|
|
40
|
+
nullOnMissing: true,
|
|
41
|
+
): null | undefined | string;
|
|
42
|
+
}
|
|
43
|
+
export default MappingsConsumer;
|