first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @format
* @oncall react_native
*/
import type { GeneratedPositionLookup, IConsumer, IterationOrder, Mapping, SourcePosition } from "./types";
declare class AbstractConsumer implements IConsumer {
_sourceMap: {
readonly file?: string;
};
constructor(sourceMap: {
readonly file?: string;
});
originalPositionFor(generatedPosition: GeneratedPositionLookup): SourcePosition;
generatedMappings(): Iterable<Mapping>;
eachMapping(callback: (mapping: Mapping) => any, context?: any, order?: IterationOrder): void;
get file(): null | undefined | string;
sourceContentFor(source: string, nullOnMissing: true): null | undefined | string;
}
export default AbstractConsumer;

View File

@@ -0,0 +1 @@
module.exports = require("metro-source-map/private/Consumer/AbstractConsumer");

View File

@@ -0,0 +1,33 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @format
* @oncall react_native
*/
import type { MixedSourceMap } from "../source-map";
import type { LookupBias } from "./constants.js";
import type { GeneratedPositionLookup, IConsumer, IterationOrder, Mapping, SourcePosition } from "./types";
/**
* A source map consumer that supports both "basic" and "indexed" source maps.
* Uses `MappingsConsumer` and `SectionsConsumer` under the hood (via
* `createConsumer`).
*/
declare class DelegatingConsumer implements IConsumer {
static readonly GENERATED_ORDER: IterationOrder;
static readonly ORIGINAL_ORDER: IterationOrder;
static readonly GREATEST_LOWER_BOUND: LookupBias;
static readonly LEAST_UPPER_BOUND: LookupBias;
_rootConsumer: IConsumer;
constructor(sourceMap: MixedSourceMap);
originalPositionFor(generatedPosition: GeneratedPositionLookup): SourcePosition;
generatedMappings(): Iterable<Mapping>;
eachMapping(callback: (mapping: Mapping) => any, context?: any, order?: IterationOrder): void;
get file(): null | undefined | string;
sourceContentFor(source: string, nullOnMissing: true): null | undefined | string;
}
export default DelegatingConsumer;

View File

@@ -0,0 +1 @@
module.exports = require("metro-source-map/private/Consumer/DelegatingConsumer");

View File

@@ -0,0 +1,32 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @format
* @oncall react_native
*/
import type { BasicSourceMap } from "../source-map";
import type { GeneratedPositionLookup, IConsumer, Mapping, SourcePosition } from "./types";
import AbstractConsumer from "./AbstractConsumer";
/**
* A source map consumer that supports "basic" source maps (that have a
* `mappings` field and no sections).
*/
declare class MappingsConsumer extends AbstractConsumer implements IConsumer {
_sourceMap: BasicSourceMap;
_decodedMappings: null | undefined | ReadonlyArray<Mapping>;
_normalizedSources: null | undefined | ReadonlyArray<string>;
constructor(sourceMap: BasicSourceMap);
originalPositionFor(generatedPosition: GeneratedPositionLookup): SourcePosition;
_decodeMappings(): Generator<Mapping, void, void>;
_normalizeAndCacheSources(): ReadonlyArray<string>;
_decodeAndCacheMappings(): ReadonlyArray<Mapping>;
generatedMappings(): Iterable<Mapping>;
_indexOfSource(source: string): null | undefined | number;
sourceContentFor(source: string, nullOnMissing: true): null | undefined | string;
}
export default MappingsConsumer;

View File

@@ -0,0 +1 @@
module.exports = require("metro-source-map/private/Consumer/MappingsConsumer");

View File

@@ -0,0 +1,27 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @format
* @oncall react_native
*/
import type { IndexMap } from "../source-map";
import type { GeneratedOffset, GeneratedPositionLookup, IConsumer, Mapping, SourcePosition } from "./types";
import AbstractConsumer from "./AbstractConsumer";
/**
* A source map consumer that supports "indexed" source maps (that have a
* `sections` field and no top-level mappings).
*/
declare class SectionsConsumer extends AbstractConsumer implements IConsumer {
_consumers: ReadonlyArray<[GeneratedOffset, IConsumer]>;
constructor(sourceMap: IndexMap);
originalPositionFor(generatedPosition: GeneratedPositionLookup): SourcePosition;
generatedMappings(): Iterable<Mapping>;
_consumerForPosition(generatedPosition: GeneratedPositionLookup): null | undefined | [GeneratedOffset, IConsumer];
sourceContentFor(source: string, nullOnMissing: true): null | undefined | string;
}
export default SectionsConsumer;

View File

@@ -0,0 +1 @@
module.exports = require("metro-source-map/private/Consumer/SectionsConsumer");

View File

@@ -0,0 +1,28 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @format
* @oncall react_native
*/
declare const FIRST_COLUMN: number;
declare const FIRST_LINE: number;
export declare type IterationOrder = unknown;
declare const GENERATED_ORDER: IterationOrder;
declare const ORIGINAL_ORDER: IterationOrder;
export declare type LookupBias = unknown;
declare const GREATEST_LOWER_BOUND: LookupBias;
declare const LEAST_UPPER_BOUND: LookupBias;
declare const EMPTY_POSITION: {
readonly source: null;
readonly name: null;
readonly line: null;
readonly column: null;
};
declare function iterationOrderToString(x: IterationOrder): string;
declare function lookupBiasToString(x: LookupBias): string;
export { FIRST_COLUMN, FIRST_LINE, GENERATED_ORDER, ORIGINAL_ORDER, GREATEST_LOWER_BOUND, LEAST_UPPER_BOUND, EMPTY_POSITION, iterationOrderToString, lookupBiasToString };

View File

@@ -0,0 +1,2 @@
module.exports = require("metro-source-map/private/Consumer/constants");
module.exports.default = module.exports;

View File

@@ -0,0 +1,15 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @format
* @oncall react_native
*/
import type { MixedSourceMap } from "../source-map";
import type { IConsumer } from "./types";
declare function createConsumer(sourceMap: MixedSourceMap): IConsumer;
export default createConsumer;

View File

@@ -0,0 +1 @@
module.exports = require("metro-source-map/private/Consumer/createConsumer");

View File

@@ -0,0 +1,13 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @format
* @oncall react_native
*/
import DelegatingConsumer from "./DelegatingConsumer";
export default DelegatingConsumer;

View File

@@ -0,0 +1 @@
module.exports = require("metro-source-map/private/Consumer/index");

View File

@@ -0,0 +1,15 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @format
* @oncall react_native
*/
declare function normalizeSourcePath(sourceInput: string, map: {
readonly sourceRoot?: null | undefined | string;
}): string;
export default normalizeSourcePath;

View File

@@ -0,0 +1 @@
module.exports = require("metro-source-map/private/Consumer/normalizeSourcePath");

View File

@@ -0,0 +1,20 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @format
* @oncall react_native
*/
import type { GeneratedOffset } from "./types";
export declare function shiftPositionByOffset<T extends {
readonly line?: null | number;
readonly column?: null | number;
}>(pos: T, offset: GeneratedOffset): T;
export declare function subtractOffsetFromPosition<T extends {
readonly line?: null | number;
readonly column?: null | number;
}>(pos: T, offset: GeneratedOffset): T;

View File

@@ -0,0 +1,2 @@
module.exports = require("metro-source-map/private/Consumer/positionMath");
module.exports.default = module.exports;

View File

@@ -0,0 +1,12 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @format
* @oncall react_native
*/
export declare function greatestLowerBound<T, U>(elements: ReadonlyArray<T>, target: U, comparator: ($$PARAM_0$$: U, $$PARAM_1$$: T) => number): null | undefined | number;

View File

@@ -0,0 +1,2 @@
module.exports = require("metro-source-map/private/Consumer/search");
module.exports.default = module.exports;

View File

@@ -0,0 +1,47 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @format
* @oncall react_native
*/
import type { IterationOrder, LookupBias } from "./constants";
export type { IterationOrder, LookupBias };
export interface GeneratedOffset {
readonly lines: number;
readonly columns: number;
}
export interface SourcePosition {
source?: null | string;
line?: null | number;
column?: null | number;
name?: null | string;
}
export interface GeneratedPosition {
readonly line: number;
readonly column: number;
}
export interface GeneratedPositionLookup {
readonly line?: null | number;
readonly column?: null | number;
readonly bias?: LookupBias;
}
export interface Mapping {
readonly source?: null | string;
readonly generatedLine: number;
readonly generatedColumn: number;
readonly originalLine?: null | number;
readonly originalColumn?: null | number;
readonly name?: null | string;
}
export interface IConsumer {
originalPositionFor(generatedPosition: GeneratedPositionLookup): SourcePosition;
generatedMappings(): Iterable<Mapping>;
eachMapping(callback: (mapping: Mapping) => any, context?: any, order?: IterationOrder): void;
get file(): null | undefined | string;
sourceContentFor(source: string, nullOnMissing: true): null | undefined | string;
}

View File

@@ -0,0 +1 @@
module.exports = require("metro-source-map/private/Consumer/types");