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,92 @@
/**
* 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
*/
type RawBuffer = Array<number | RawBuffer>;
export interface _ChromeHeapSnapshot_snapshot {
meta: {
trace_function_info_fields: Array<string>;
location_fields: Array<string>;
edge_fields: Array<string>;
edge_types: Array<string | Array<string>>;
node_fields: Array<string>;
node_types: Array<string | Array<string>>;
trace_node_fields: Array<string>;
};
}
export interface ChromeHeapSnapshot {
snapshot: _ChromeHeapSnapshot_snapshot;
trace_function_infos: Array<number>;
locations: Array<number>;
edges: Array<number>;
nodes: Array<number>;
strings: Array<string>;
trace_tree: RawBuffer;
}
export declare class ChromeHeapSnapshotProcessor {
readonly _snapshotData: ChromeHeapSnapshot;
readonly _globalStringTable: ChromeHeapSnapshotStringTable;
constructor(snapshotData: ChromeHeapSnapshot);
traceFunctionInfos(): ChromeHeapSnapshotRecordIterator;
locations(): ChromeHeapSnapshotRecordIterator;
nodes(): ChromeHeapSnapshotRecordIterator;
edges(): ChromeHeapSnapshotRecordIterator;
traceTree(): ChromeHeapSnapshotRecordIterator;
}
declare class ChromeHeapSnapshotStringTable {
readonly _strings: Array<string>;
readonly _indexCache: Map<string, number>;
constructor(strings: Array<string>);
add(value: string): number;
get(index: number): string;
_syncIndexCache(): void;
}
type ChromeHeapSnapshotFieldType = Array<string> | string;
export interface DenormalizedRecordInput {
readonly [field: string]: string | number | ReadonlyArray<DenormalizedRecordInput>;
}
declare class ChromeHeapSnapshotRecordAccessor {
readonly _fieldToOffset: ReadonlyMap<string, number>;
readonly _fieldToType: ReadonlyMap<string, ChromeHeapSnapshotFieldType>;
readonly _recordSize: number;
readonly _buffer: RawBuffer;
readonly _globalStringTable: ChromeHeapSnapshotStringTable;
_position: number;
constructor(buffer: RawBuffer, recordFields: Array<string>, recordTypes: Array<ChromeHeapSnapshotFieldType> | {
readonly [$$Key$$: string]: ChromeHeapSnapshotFieldType;
} | null, globalStringTable: ChromeHeapSnapshotStringTable, position: number, parent?: ChromeHeapSnapshotRecordAccessor);
getString(field: string): string;
getNumber(field: string): number;
getChildren(field: string): ChromeHeapSnapshotRecordIterator;
setString(field: string, value: string): void;
setNumber(field: string, value: number): void;
moveToRecord(recordIndex: number): void;
append(record: DenormalizedRecordInput): number;
moveAndInsert(recordIndex: number, record: DenormalizedRecordInput): number;
protectedHasNext(): boolean;
protectedTryMoveNext(): void;
_getRaw(field: string): number | RawBuffer;
_getScalar(field: string): string | number;
_setRaw(field: string, rawValue: number | RawBuffer): void;
_set(field: string, value: string | number | ReadonlyArray<DenormalizedRecordInput>): void;
_setChildren(field: string, value: ReadonlyArray<DenormalizedRecordInput>): void;
_encodeString(field: string, value: string): number;
_validatePosition(allowEnd?: boolean, position?: number): void;
_moveToPosition(nextPosition: number, allowEnd: boolean): void;
}
declare class ChromeHeapSnapshotRecordIterator extends ChromeHeapSnapshotRecordAccessor implements Iterable<ChromeHeapSnapshotRecordAccessor> {
constructor(buffer: RawBuffer, recordFields: Array<string>, recordTypes: Array<ChromeHeapSnapshotFieldType> | {
readonly [$$Key$$: string]: ChromeHeapSnapshotFieldType;
} | null, globalStringTable: ChromeHeapSnapshotStringTable, position: number, parent?: ChromeHeapSnapshotRecordAccessor);
next(): {
done: boolean;
readonly value: ChromeHeapSnapshotRecordIterator;
};
}

View File

@@ -0,0 +1,2 @@
module.exports = require("metro-symbolicate/private/ChromeHeapSnapshot");
module.exports.default = module.exports;

View File

@@ -0,0 +1,42 @@
/**
* 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 "../metro-source-map";
type SourceNameNormalizer = ($$PARAM_0$$: string, $$PARAM_1$$: {
readonly sourceRoot?: null | undefined | string;
}) => string;
/**
* Consumes the `x_google_ignoreList` metadata field from a source map and
* exposes various queries on it.
*
* By default, source names are normalized using the same logic that the
* `source-map@0.5.6` package uses internally. This is crucial for keeping the
* sources list in sync with a `SourceMapConsumer` instance.
* If you're using this with a different source map reader (e.g. one that
* doesn't normalize source names at all), you can switch out the normalization
* function in the constructor, e.g.
*
* new GoogleIgnoreListConsumer(map, source => source) // Don't normalize
*/
declare class GoogleIgnoreListConsumer {
constructor(map: MixedSourceMap, normalizeSourceFn: SourceNameNormalizer);
_sourceMap: MixedSourceMap;
_normalizeSource: SourceNameNormalizer;
_ignoredSourceSet: null | undefined | Set<string>;
isIgnored($$PARAM_0$$: {
readonly source?: null | string;
}): boolean;
toArray(sources: ReadonlyArray<null | undefined | string>): Array<number>;
_getIgnoredSourceSet(): ReadonlySet<string>;
_buildIgnoredSourceSet(map: MixedSourceMap, ignoredSourceSet: Set<string>): void;
}
export default GoogleIgnoreListConsumer;

View File

@@ -0,0 +1 @@
module.exports = require("metro-symbolicate/private/GoogleIgnoreListConsumer");

View File

@@ -0,0 +1,56 @@
/**
* 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 { FBSourceMetadata, FBSourcesArray, MixedSourceMap } from "../metro-source-map";
export interface Position {
readonly line: number;
readonly column: number;
}
export interface FunctionMapping {
readonly line: number;
readonly column: number;
readonly name: string;
}
type SourceNameNormalizer = ($$PARAM_0$$: string, $$PARAM_1$$: {
readonly sourceRoot?: null | undefined | string;
}) => string;
export interface MetadataMap {
[source: string]: null | undefined | FBSourceMetadata;
}
/**
* Consumes the `x_facebook_sources` metadata field from a source map and
* exposes various queries on it.
*
* By default, source names are normalized using the same logic that the
* `source-map@0.5.6` package uses internally. This is crucial for keeping the
* sources list in sync with a `SourceMapConsumer` instance.
* If you're using this with a different source map reader (e.g. one that
* doesn't normalize source names at all), you can switch out the normalization
* function in the constructor, e.g.
*
* new SourceMetadataMapConsumer(map, source => source) // Don't normalize
*/
declare class SourceMetadataMapConsumer {
constructor(map: MixedSourceMap, normalizeSourceFn: SourceNameNormalizer);
_sourceMap: MixedSourceMap;
_decodedFunctionMapCache: Map<string, null | undefined | ReadonlyArray<FunctionMapping>>;
_normalizeSource: SourceNameNormalizer;
_metadataBySource: null | undefined | MetadataMap;
functionNameFor($$PARAM_0$$: Position & {
readonly source?: null | string;
}): null | undefined | string;
toArray(sources: ReadonlyArray<string>): FBSourcesArray;
_getMetadataBySource(): MetadataMap;
_getFunctionMappings(source: string): null | undefined | ReadonlyArray<FunctionMapping>;
_getMetadataObjectsBySourceNames(map: MixedSourceMap): MetadataMap;
}
export default SourceMetadataMapConsumer;

View File

@@ -0,0 +1 @@
module.exports = require("metro-symbolicate/private/SourceMetadataMapConsumer");

View File

@@ -0,0 +1,135 @@
import type * as _nodeStream from "node:stream";
import type { ChromeHeapSnapshot } from "./ChromeHeapSnapshot";
import type { HermesFunctionOffsets, MixedSourceMap } from "../metro-source-map";
import GoogleIgnoreListConsumer from "./GoogleIgnoreListConsumer";
import SourceMetadataMapConsumer from "./SourceMetadataMapConsumer";
import { type SourceMapConsumer as $$IMPORT_TYPEOF_1$$ } from "source-map";
type SourceMapConsumer = typeof $$IMPORT_TYPEOF_1$$;
export interface SingleMapModuleIds {
segmentId: number;
localId?: null | number;
}
export interface ContextOptionsInput {
readonly nameSource?: "function_names" | "identifier_names";
readonly inputLineStart?: number;
readonly inputColumnStart?: number;
readonly outputLineStart?: number;
readonly outputColumnStart?: number;
}
export interface _SizeAttributionMap_location {
file?: null | string;
filename?: string;
bytecodeSize?: number;
virtualOffset?: number;
line?: null | number;
column?: null | number;
}
export interface SizeAttributionMap {
location: _SizeAttributionMap_location;
}
export interface HermesMinidumpCrashInfo {
readonly callstack: ReadonlyArray<HermesMinidumpStackFrame | NativeCodeStackFrame>;
}
export interface HermesMinidumpStackFrame {
readonly ByteCodeOffset: number;
readonly FunctionID: number;
readonly CJSModuleOffset?: number;
readonly SegmentID?: number;
readonly SourceURL: string;
readonly StackFrameRegOffs: string;
readonly SourceLocation?: string;
}
export interface HermesCoverageInfo {
readonly executedFunctions: ReadonlyArray<HermesCoverageStackFrame>;
}
export interface HermesCoverageStackFrame {
readonly line: number;
readonly column: number;
readonly SourceURL?: null | string;
}
export interface NativeCodeStackFrame {
readonly NativeCode: true;
readonly StackFrameRegOffs: string;
}
type SymbolicatedStackTrace = ReadonlyArray<SymbolicatedStackFrame | NativeCodeStackFrame>;
export interface SymbolicatedStackFrame {
readonly line?: null | number;
readonly column?: null | number;
readonly source?: null | string;
readonly functionName?: null | string;
readonly name?: null | string;
readonly isIgnored: boolean;
}
declare class SymbolicationContext<ModuleIdsT> {
readonly options: {
readonly nameSource?: "function_names" | "identifier_names";
readonly inputLineStart: number;
readonly inputColumnStart: number;
readonly outputLineStart: number;
readonly outputColumnStart: number;
};
constructor(options: ContextOptionsInput);
symbolicate(stackTrace: string): string;
symbolicateProfilerMap(mapFile: string): string;
symbolicateAttribution(obj: SizeAttributionMap): void;
symbolicateChromeTrace(traceFile: string, $$PARAM_1$$: {
stdout: _nodeStream.Writable;
stderr: _nodeStream.Writable;
}): void;
getOriginalPositionFor(lineNumber: null | undefined | number, columnNumber: null | undefined | number, moduleIds: null | undefined | ModuleIdsT): {
line?: null | number;
column?: null | number;
source?: null | string;
name?: null | string;
};
symbolicateHermesMinidumpTrace(crashInfo: HermesMinidumpCrashInfo): SymbolicatedStackTrace;
symbolicateHeapSnapshot(snapshotContents: string | ChromeHeapSnapshot): ChromeHeapSnapshot;
symbolicateHermesCoverageTrace(coverageInfo: HermesCoverageInfo): SymbolicatedStackTrace;
getOriginalPositionDetailsFor(lineNumber: null | undefined | number, columnNumber: null | undefined | number, moduleIds: null | undefined | ModuleIdsT): SymbolicatedStackFrame;
parseFileName(str: string): ModuleIdsT;
}
declare class SingleMapSymbolicationContext extends SymbolicationContext<SingleMapModuleIds> {
readonly _segments: {
readonly [id: string]: {
readonly consumer: SourceMapConsumer;
readonly moduleOffsets: ReadonlyArray<number>;
readonly sourceFunctionsConsumer?: null | SourceMetadataMapConsumer;
readonly hermesOffsets?: null | HermesFunctionOffsets;
readonly googleIgnoreListConsumer: GoogleIgnoreListConsumer;
};
};
readonly _legacyFormat: boolean;
readonly _SourceMapConsumer: SourceMapConsumer;
constructor(SourceMapConsumer: SourceMapConsumer, sourceMapContent: string | MixedSourceMap, options: ContextOptionsInput);
_initSegment(map: MixedSourceMap): void;
symbolicateHermesMinidumpTrace(crashInfo: HermesMinidumpCrashInfo): SymbolicatedStackTrace;
symbolicateHermesCoverageTrace(coverageInfo: HermesCoverageInfo): SymbolicatedStackTrace;
getOriginalPositionDetailsFor(lineNumber: null | undefined | number, columnNumber: null | undefined | number, moduleIds: null | undefined | SingleMapModuleIds): SymbolicatedStackFrame;
parseFileName(str: string): SingleMapModuleIds;
}
declare class DirectorySymbolicationContext extends SymbolicationContext<string> {
readonly _fileMaps: Map<string, SingleMapSymbolicationContext>;
readonly _rootDir: string;
readonly _SourceMapConsumer: SourceMapConsumer;
constructor(SourceMapConsumer: SourceMapConsumer, rootDir: string, options: ContextOptionsInput);
_loadMap(mapFilename: string): SingleMapSymbolicationContext;
getOriginalPositionDetailsFor(lineNumber: null | undefined | number, columnNumber: null | undefined | number, filename: null | undefined | string): SymbolicatedStackFrame;
parseFileName(str: string): string;
}
declare function parseSingleMapFileName(str: string): SingleMapModuleIds;
declare function createContext(SourceMapConsumer: SourceMapConsumer, sourceMapContent: string | MixedSourceMap, options?: ContextOptionsInput): SingleMapSymbolicationContext;
declare function unstable_createDirectoryContext(SourceMapConsumer: SourceMapConsumer, rootDir: string, options?: ContextOptionsInput): DirectorySymbolicationContext;
declare function getOriginalPositionFor<ModuleIdsT>(lineNumber: null | undefined | number, columnNumber: null | undefined | number, moduleIds: null | undefined | ModuleIdsT, context: SymbolicationContext<ModuleIdsT>): {
line?: null | number;
column?: null | number;
source?: null | string;
name?: null | string;
};
declare function symbolicate<ModuleIdsT>(stackTrace: string, context: SymbolicationContext<ModuleIdsT>): string;
declare function symbolicateProfilerMap<ModuleIdsT>(mapFile: string, context: SymbolicationContext<ModuleIdsT>): string;
declare function symbolicateAttribution<ModuleIdsT>(obj: SizeAttributionMap, context: SymbolicationContext<ModuleIdsT>): void;
declare function symbolicateChromeTrace<ModuleIdsT>(traceFile: string, $$PARAM_1$$: {
stdout: _nodeStream.Writable;
stderr: _nodeStream.Writable;
}, context: SymbolicationContext<ModuleIdsT>): void;
export { createContext, unstable_createDirectoryContext, getOriginalPositionFor, parseSingleMapFileName as parseFileName, symbolicate, symbolicateProfilerMap, symbolicateAttribution, symbolicateChromeTrace, SourceMetadataMapConsumer };

View File

@@ -0,0 +1,2 @@
module.exports = require("metro-symbolicate/private/Symbolication");
module.exports.default = module.exports;

10
node_modules/@expo/metro/metro-symbolicate/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* 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
*/

1
node_modules/@expo/metro/metro-symbolicate/index.js generated vendored Normal file
View File

@@ -0,0 +1 @@
module.exports = require("metro-symbolicate");

View File

@@ -0,0 +1,8 @@
import type * as _nodeTty from "node:tty";
import type * as _nodeStream from "node:stream";
declare function main(argvInput?: Array<string>, _optionalArg?: {
readonly stdin?: _nodeStream.Readable | _nodeTty.ReadStream;
readonly stderr: _nodeStream.Writable;
readonly stdout: _nodeStream.Writable;
}): Promise<number>;
export default main;

View File

@@ -0,0 +1 @@
module.exports = require("metro-symbolicate/private/symbolicate");