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,52 @@
/**
* 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 { FileMetadata, PerfLogger } from "../flow-types";
export interface ProcessFileRequest {
/**
* Populate metadata[H.SHA1] with the SHA1 of the file's contents.
*/
readonly computeSha1: boolean;
/**
* Populate metadata[H.DEPENDENCIES] with unresolved dependency specifiers
* using the dependencyExtractor provided to the constructor.
*/
readonly computeDependencies: boolean;
/**
* Only if processing has already required reading the file's contents, return
* the contents as a Buffer - null otherwise. Not supported for batches.
*/
readonly maybeReturnContent: boolean;
}
export interface MaybeCodedError extends Error {
code?: string;
}
export declare class FileProcessor {
constructor(opts: {
readonly dependencyExtractor?: null | string;
readonly enableHastePackages: boolean;
readonly enableWorkerThreads: boolean;
readonly hasteImplModulePath?: null | string;
readonly maxFilesPerWorker?: null | undefined | number;
readonly maxWorkers: number;
readonly perfLogger?: null | PerfLogger;
});
processBatch(files: ReadonlyArray<[string, FileMetadata]>, req: ProcessFileRequest): Promise<{
errors: Array<{
absolutePath: string;
error: MaybeCodedError;
}>;
}>;
processRegularFile(absolutePath: string, fileMetadata: FileMetadata, req: ProcessFileRequest): null | undefined | {
content?: null | Buffer;
};
end(): Promise<void>;
}

View File

@@ -0,0 +1,2 @@
module.exports = require("metro-file-map/private/lib/FileProcessor");
module.exports.default = module.exports;

View File

@@ -0,0 +1,24 @@
/**
* 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
*
*/
export declare class RootPathUtils {
constructor(rootDir: string);
getBasenameOfNthAncestor(n: number): string;
getParts(): ReadonlyArray<string>;
absoluteToNormal(absolutePath: string): string;
normalToAbsolute(normalPath: string): string;
relativeToNormal(relativePath: string): string;
getAncestorOfRootIdx(normalPath: string): null | undefined | number;
joinNormalToRelative(normalPath: string, relativePath: string): {
normalPath: string;
collapsedSegments: number;
};
relative(from: string, to: string): string;
}

View File

@@ -0,0 +1,2 @@
module.exports = require("metro-file-map/private/lib/RootPathUtils");
module.exports.default = module.exports;

121
node_modules/@expo/metro/metro-file-map/lib/TreeFS.d.ts generated vendored Normal file
View File

@@ -0,0 +1,121 @@
import type { FileData, FileMetadata, FileStats, LookupResult, MutableFileSystem, Path, ProcessFileFunction } from "../flow-types";
type DirectoryNode = Map<string, MixedNode>;
type FileNode = FileMetadata;
type MixedNode = FileNode | DirectoryNode;
export interface NormalizedSymlinkTarget {
ancestorOfRootIdx?: null | number;
normalPath: string;
startOfBasenameIdx: number;
}
declare class TreeFS implements MutableFileSystem {
constructor($$PARAM_0$$: {
rootDir: Path;
files?: FileData;
processFile: ProcessFileFunction;
});
getSerializableSnapshot(): any;
static fromDeserializedSnapshot($$PARAM_0$$: {
rootDir: string;
fileSystemData: DirectoryNode;
processFile: ProcessFileFunction;
}): TreeFS;
getModuleName(mixedPath: Path): null | undefined | string;
getSize(mixedPath: Path): null | undefined | number;
getDependencies(mixedPath: Path): null | undefined | Array<string>;
getDifference(files: FileData): {
changedFiles: FileData;
removedFiles: Set<string>;
};
getSha1(mixedPath: Path): null | undefined | string;
getOrComputeSha1(mixedPath: Path): Promise<null | undefined | {
sha1: string;
content?: Buffer;
}>;
exists(mixedPath: Path): boolean;
lookup(mixedPath: Path): LookupResult;
getAllFiles(): Array<Path>;
linkStats(mixedPath: Path): null | undefined | FileStats;
matchFiles($$PARAM_0$$: {
readonly filter?: null | undefined | RegExp;
readonly filterCompareAbsolute?: boolean;
readonly filterComparePosix?: boolean;
readonly follow?: boolean;
readonly recursive?: boolean;
readonly rootDir?: null | undefined | Path;
}): Iterable<Path>;
addOrModify(mixedPath: Path, metadata: FileMetadata): void;
bulkAddOrModify(addedOrModifiedFiles: FileData): void;
remove(mixedPath: Path): null | undefined | FileMetadata;
_lookupByNormalPath(requestedNormalPath: string, opts: {
collectAncestors?: Array<{
ancestorOfRootIdx?: null | number;
node: DirectoryNode;
normalPath: string;
segmentName: string;
}>;
collectLinkPaths?: null | undefined | Set<string>;
followLeaf?: boolean;
makeDirectories?: boolean;
startPathIdx?: number;
startNode?: DirectoryNode;
start?: {
ancestorOfRootIdx?: null | number;
node: DirectoryNode;
pathIdx: number;
};
}): {
ancestorOfRootIdx?: null | number;
canonicalPath: string;
exists: true;
node: MixedNode;
parentNode: DirectoryNode;
} | {
ancestorOfRootIdx?: null | number;
canonicalPath: string;
exists: true;
node: DirectoryNode;
parentNode: null;
} | {
canonicalMissingPath: string;
missingSegmentName: string;
exists: false;
};
hierarchicalLookup(mixedStartPath: string, subpath: string, opts: {
breakOnSegment?: null | string;
invalidatedBy?: null | Set<string>;
subpathType?: "f" | "d";
}): null | undefined | {
absolutePath: string;
containerRelativePath: string;
};
metadataIterator(opts: {
readonly includeSymlinks: boolean;
readonly includeNodeModules: boolean;
}): Iterable<{
baseName: string;
canonicalPath: string;
metadata: FileMetadata;
}>;
_metadataIterator(rootNode: DirectoryNode, opts: {
readonly includeSymlinks: boolean;
readonly includeNodeModules: boolean;
}, prefix: string): Iterable<{
baseName: string;
canonicalPath: string;
metadata: FileMetadata;
}>;
_normalizePath(relativeOrAbsolutePath: Path): string;
_pathIterator(iterationRootNode: DirectoryNode, iterationRootParentNode: null | undefined | DirectoryNode, ancestorOfRootIdx: null | undefined | number, opts: {
readonly alwaysYieldPosix: boolean;
readonly canonicalPathOfRoot: string;
readonly follow: boolean;
readonly recursive: boolean;
readonly subtreeOnly: boolean;
}, pathPrefix: string, followedLinks: ReadonlySet<FileMetadata>): Iterable<Path>;
_resolveSymlinkTargetToNormalPath(symlinkNode: FileMetadata, canonicalPathOfSymlink: Path): NormalizedSymlinkTarget;
_getFileData(filePath: Path, opts: {
followLeaf: boolean;
}): null | undefined | FileMetadata;
_cloneTree(root: DirectoryNode): DirectoryNode;
}
export default TreeFS;

View File

@@ -0,0 +1 @@
module.exports = require("metro-file-map/private/lib/TreeFS");

View File

@@ -0,0 +1,14 @@
/**
* 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
*
*/
declare function checkWatchmanCapabilities(requiredCapabilities: ReadonlyArray<string>): Promise<{
version: string;
}>;
export default checkWatchmanCapabilities;

View File

@@ -0,0 +1 @@
module.exports = require("metro-file-map/private/lib/checkWatchmanCapabilities");

View File

@@ -0,0 +1,11 @@
/**
* 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
*
*/
export declare function extract(code: string): Set<string>;

View File

@@ -0,0 +1 @@
module.exports = require("metro-file-map/private/lib/dependencyExtractor");

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
*
*/
declare let normalizePathSeparatorsToPosix: (string: string) => string;
export default normalizePathSeparatorsToPosix;

View File

@@ -0,0 +1 @@
module.exports = require("metro-file-map/private/lib/normalizePathSeparatorsToPosix");

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
*
*/
declare let normalizePathSeparatorsToSystem: (string: string) => string;
export default normalizePathSeparatorsToSystem;

View File

@@ -0,0 +1 @@
module.exports = require("metro-file-map/private/lib/normalizePathSeparatorsToSystem");

View File

@@ -0,0 +1,17 @@
/**
* 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 { BuildParameters } from "../flow-types";
declare function rootRelativeCacheKeys(buildParameters: BuildParameters): {
rootDirHash: string;
relativeConfigHash: string;
};
export default rootRelativeCacheKeys;

View File

@@ -0,0 +1 @@
module.exports = require("metro-file-map/private/lib/rootRelativeCacheKeys");

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
*/
export declare function compareStrings(a: null | string, b: null | string): number;
export declare function chainComparators<T>(...comparators: Array<(a: T, b: T) => number>): (a: T, b: T) => number;

View File

@@ -0,0 +1,2 @@
module.exports = require("metro-file-map/private/lib/sorting");
module.exports.default = module.exports;