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

65
node_modules/@expo/metro/metro-file-map/Watcher.d.ts generated vendored Normal file
View File

@@ -0,0 +1,65 @@
/**
* 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
*
*/
import type { Console, CrawlerOptions, FileData, Path, PerfLogger, WatcherBackend, WatcherBackendChangeEvent, WatchmanClocks } from "./flow-types";
import EventEmitter from "node:events";
export interface CrawlResult {
changedFiles: FileData;
clocks?: WatchmanClocks;
removedFiles: Set<Path>;
}
export interface WatcherOptions {
abortSignal: AbortSignal;
computeSha1: boolean;
console: Console;
enableSymlinks: boolean;
extensions: ReadonlyArray<string>;
forceNodeFilesystemAPI: boolean;
healthCheckFilePrefix: string;
ignoreForCrawl: ($$PARAM_0$$: string) => boolean;
ignorePatternForWatch: RegExp;
previousState: CrawlerOptions["previousState"];
perfLogger?: null | PerfLogger;
roots: ReadonlyArray<string>;
rootDir: string;
useWatchman: boolean;
watch: boolean;
watchmanDeferStates: ReadonlyArray<string>;
}
export type HealthCheckResult = {
type: "error";
timeout: number;
error: Error;
watcher?: null | string;
} | {
type: "success";
timeout: number;
timeElapsed: number;
watcher?: null | string;
} | {
type: "timeout";
timeout: number;
watcher?: null | string;
pauseReason?: null | string;
};
export declare class Watcher extends EventEmitter {
_options: WatcherOptions;
_backends: ReadonlyArray<WatcherBackend>;
_instanceId: number;
_nextHealthCheckId: number;
_pendingHealthChecks: Map<string, () => void>;
_activeWatcher: null | undefined | string;
constructor(options: WatcherOptions);
crawl(): Promise<CrawlResult>;
watch(onChange: (change: WatcherBackendChangeEvent) => void): Promise<void>;
_handleHealthCheckObservation(basename: string): void;
close(): Promise<void>;
checkHealth(timeout: number): Promise<HealthCheckResult>;
}

2
node_modules/@expo/metro/metro-file-map/Watcher.js generated vendored Normal file
View File

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

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
*/
import type { BuildParameters, CacheData, CacheManager, CacheManagerFactoryOptions, CacheManagerWriteOptions } from "../flow-types";
export interface AutoSaveOptions {
readonly debounceMs: number;
}
export interface DiskCacheConfig {
readonly autoSave?: Partial<AutoSaveOptions> | boolean;
readonly cacheFilePrefix?: null | undefined | string;
readonly cacheDirectory?: null | undefined | string;
}
export declare class DiskCacheManager implements CacheManager {
constructor($$PARAM_0$$: CacheManagerFactoryOptions, $$PARAM_1$$: DiskCacheConfig);
static getCacheFilePath(buildParameters: BuildParameters, cacheFilePrefix?: null | undefined | string, cacheDirectory?: null | undefined | string): string;
getCacheFilePath(): string;
read(): Promise<null | undefined | CacheData>;
write(getSnapshot: () => CacheData, $$PARAM_1$$: CacheManagerWriteOptions): Promise<void>;
end(): Promise<void>;
}

View File

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

13
node_modules/@expo/metro/metro-file-map/constants.d.ts generated vendored Normal file
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.
*
*
* @noformat - Flow comment syntax
*/
import type { HType } from "./flow-types";
declare const constants: HType;
export default constants;

1
node_modules/@expo/metro/metro-file-map/constants.js generated vendored Normal file
View File

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

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
*/
declare function hasNativeFindSupport(): Promise<boolean>;
export default hasNativeFindSupport;

View File

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

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 { CanonicalPath, CrawlerOptions, FileData } from "../../flow-types";
declare function nodeCrawl(options: CrawlerOptions): Promise<{
removedFiles: Set<CanonicalPath>;
changedFiles: FileData;
}>;
export default nodeCrawl;

View File

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

View File

@@ -0,0 +1,18 @@
/**
* 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 { CanonicalPath, CrawlerOptions, FileData, WatchmanClocks } from "../../flow-types";
declare function watchmanCrawl($$PARAM_0$$: CrawlerOptions): Promise<{
changedFiles: FileData;
removedFiles: Set<CanonicalPath>;
clocks: WatchmanClocks;
}>;
export default watchmanCrawl;

View File

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

View File

@@ -0,0 +1,21 @@
/**
* 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
*
*/
import type { WatchmanQuery, WatchmanQuerySince } from "fb-watchman";
export declare function planQuery($$PARAM_0$$: {
readonly since?: null | WatchmanQuerySince;
readonly directoryFilters: ReadonlyArray<string>;
readonly extensions: ReadonlyArray<string>;
readonly includeSha1: boolean;
readonly includeSymlinks: boolean;
}): {
query: WatchmanQuery;
queryGenerator: string;
};

View File

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

342
node_modules/@expo/metro/metro-file-map/flow-types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,342 @@
/**
* 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 { PerfLogger, PerfLoggerFactory, RootPerfLogger } from "../metro-config";
export type { PerfLoggerFactory, PerfLogger };
export interface BuildParameters {
readonly computeDependencies: boolean;
readonly computeSha1: boolean;
readonly enableHastePackages: boolean;
readonly enableSymlinks: boolean;
readonly extensions: ReadonlyArray<string>;
readonly forceNodeFilesystemAPI: boolean;
readonly ignorePattern: RegExp;
readonly plugins: ReadonlyArray<FileMapPlugin>;
readonly retainAllFiles: boolean;
readonly rootDir: string;
readonly roots: ReadonlyArray<string>;
readonly skipPackageJson: boolean;
readonly dependencyExtractor?: null | string;
readonly hasteImplModulePath?: null | string;
readonly cacheBreaker: string;
}
export interface BuildResult {
fileSystem: FileSystem;
hasteMap: HasteMap;
mockMap?: null | MockMap;
}
export interface CacheData {
readonly clocks: WatchmanClocks;
readonly fileSystemData: any;
readonly plugins: ReadonlyMap<string, V8Serializable>;
}
export interface CacheManager {
/**
* Called during startup to load initial state, if available. Provided to
* a crawler, which will return the delta between the initial state and the
* current file system state.
*/
read(): Promise<null | undefined | CacheData>;
/**
* Called when metro-file-map `build()` has applied changes returned by the
* crawler - i.e. internal state reflects the current file system state.
*
* getSnapshot may be retained and called at any time before end(), such as
* in response to eventSource 'change' events.
*/
write(getSnapshot: () => CacheData, opts: CacheManagerWriteOptions): Promise<void>;
/**
* The last call that will be made to this CacheManager. Any handles should
* be closed by the time this settles.
*/
end(): Promise<void>;
}
export interface CacheManagerEventSource {
onChange(listener: () => void): () => void;
}
export type CacheManagerFactory = (options: CacheManagerFactoryOptions) => CacheManager;
export interface CacheManagerFactoryOptions {
readonly buildParameters: BuildParameters;
}
export interface CacheManagerWriteOptions {
readonly changedSinceCacheRead: boolean;
readonly eventSource: CacheManagerEventSource;
readonly onWriteError: ($$PARAM_0$$: Error) => void;
}
export type CanonicalPath = string;
export interface ChangeEvent {
logger?: null | RootPerfLogger;
eventsQueue: EventsQueue;
}
export interface ChangeEventMetadata {
modifiedTime?: null | number;
size?: null | number;
type?: "f" | "d" | "l";
}
export type Console = typeof global.console;
export interface _CrawlerOptions_previousState {
readonly clocks: ReadonlyMap<CanonicalPath, WatchmanClockSpec>;
readonly fileSystem: FileSystem;
}
export interface CrawlerOptions {
abortSignal?: null | AbortSignal;
computeSha1: boolean;
console: Console;
extensions: ReadonlyArray<string>;
forceNodeFilesystemAPI: boolean;
ignore: IgnoreMatcher;
includeSymlinks: boolean;
perfLogger?: null | undefined | PerfLogger;
previousState: _CrawlerOptions_previousState;
rootDir: string;
roots: ReadonlyArray<string>;
onStatus: (status: WatcherStatus) => void;
}
export interface DependencyExtractor {
extract: (content: string, absoluteFilePath: string, defaultExtractor?: DependencyExtractor["extract"]) => Set<string>;
getCacheKey: () => string;
}
export type WatcherStatus = {
type: "watchman_slow_command";
timeElapsed: number;
command?: "watch-project" | "query";
} | {
type: "watchman_slow_command_complete";
timeElapsed: number;
command?: "watch-project" | "query";
} | {
type: "watchman_warning";
warning: any;
command?: "watch-project" | "query";
};
export type DuplicatesSet = Map<string, number>;
export type DuplicatesIndex = Map<string, Map<string, DuplicatesSet>>;
export type EventsQueue = Array<{
filePath: Path;
metadata: ChangeEventMetadata;
type: string;
}>;
export interface FileMapDelta {
readonly removed: Iterable<[CanonicalPath, FileMetadata]>;
readonly addedOrModified: Iterable<[CanonicalPath, FileMetadata]>;
}
export interface FileSystemState {
metadataIterator(opts: {
readonly includeNodeModules: boolean;
readonly includeSymlinks: boolean;
}): Iterable<{
baseName: string;
canonicalPath: string;
metadata: FileMetadata;
}>;
}
export interface FileMapPluginInitOptions<SerializableState> {
readonly files: FileSystemState;
readonly pluginState?: null | SerializableState;
}
type V8Serializable = {};
export interface FileMapPlugin<SerializableState = V8Serializable> {
readonly name: string;
initialize(initOptions: FileMapPluginInitOptions<SerializableState>): Promise<void>;
assertValid(): void;
bulkUpdate(delta: FileMapDelta): Promise<void>;
getSerializableSnapshot(): SerializableState;
onRemovedFile(relativeFilePath: string, fileMetadata: FileMetadata): void;
onNewOrModifiedFile(relativeFilePath: string, fileMetadata: FileMetadata): void;
getCacheKey(): string;
}
export interface HType {
MTIME: 0;
SIZE: 1;
VISITED: 2;
DEPENDENCIES: 3;
SHA1: 4;
SYMLINK: 5;
ID: 6;
PATH: 0;
TYPE: 1;
MODULE: 0;
PACKAGE: 1;
GENERIC_PLATFORM: "g";
NATIVE_PLATFORM: "native";
DEPENDENCY_DELIM: "\0";
}
export type HTypeValue = HType[keyof HType];
export type IgnoreMatcher = (item: string) => boolean;
export type FileData = Map<CanonicalPath, FileMetadata>;
export type FileMetadata = [null | undefined | number, number, 0 | 1, string, null | undefined | string, 0 | 1 | string, string];
export interface FileStats {
readonly fileType?: "f" | "l";
readonly modifiedTime?: null | number;
readonly size?: null | number;
}
export interface FileSystem {
exists(file: Path): boolean;
getAllFiles(): Array<Path>;
getDependencies(file: Path): null | undefined | Array<string>;
getDifference(files: FileData): {
changedFiles: FileData;
removedFiles: Set<string>;
};
getModuleName(file: Path): null | undefined | string;
getSerializableSnapshot(): CacheData["fileSystemData"];
getSha1(file: Path): null | undefined | string;
getOrComputeSha1(file: Path): Promise<null | undefined | {
sha1: string;
content?: Buffer;
}>;
/**
* Given a start path (which need not exist), a subpath and type, and
* optionally a 'breakOnSegment', performs the following:
*
* X = mixedStartPath
* do
* if basename(X) === opts.breakOnSegment
* return null
* if X + subpath exists and has type opts.subpathType
* return {
* absolutePath: realpath(X + subpath)
* containerRelativePath: relative(mixedStartPath, X)
* }
* X = dirname(X)
* while X !== dirname(X)
*
* If opts.invalidatedBy is given, collects all absolute, real paths that if
* added or removed may invalidate this result.
*
* Useful for finding the closest package scope (subpath: package.json,
* type f, breakOnSegment: node_modules) or closest potential package root
* (subpath: node_modules/pkg, type: d) in Node.js resolution.
*/
hierarchicalLookup(mixedStartPath: string, subpath: string, opts: {
breakOnSegment?: null | string;
invalidatedBy?: null | Set<string>;
subpathType?: "f" | "d";
}): null | undefined | {
absolutePath: string;
containerRelativePath: string;
};
/**
* Analogous to posix lstat. If the file at `file` is a symlink, return
* information about the symlink without following it.
*/
linkStats(file: Path): null | undefined | FileStats;
/**
* Return information about the given path, whether a directory or file.
* Always follow symlinks, and return a real path if it exists.
*/
lookup(mixedPath: Path): LookupResult;
matchFiles(opts: {
filter?: RegExp | null;
filterCompareAbsolute?: boolean;
filterComparePosix?: boolean;
follow?: boolean;
recursive?: boolean;
rootDir?: Path | null;
}): Iterable<Path>;
}
export type Glob = string;
export type LookupResult = {
exists: false;
links: ReadonlySet<string>;
missing: string;
} | {
exists: true;
links: ReadonlySet<string>;
realPath: string;
type?: "d" | "f";
};
export interface MockMap {
getMockModule(name: string): null | undefined | Path;
}
export interface HasteConflict {
id: string;
platform?: string | null;
absolutePaths: Array<string>;
type?: "duplicate" | "shadowing";
}
export interface HasteMap {
getModule(name: string, platform?: null | undefined | string, supportsNativePlatform?: null | undefined | boolean, type?: null | undefined | HTypeValue): null | undefined | Path;
getPackage(name: string, platform: null | undefined | string, _supportsNativePlatform: null | undefined | boolean): null | undefined | Path;
computeConflicts(): Array<HasteConflict>;
}
export type HasteMapData = Map<string, HasteMapItem>;
export interface HasteMapItem {
[platform: string]: HasteMapItemMetadata;
}
export type HasteMapItemMetadata = [string, number];
export interface MutableFileSystem extends FileSystem {
remove(filePath: Path): null | undefined | FileMetadata;
addOrModify(filePath: Path, fileMetadata: FileMetadata): void;
bulkAddOrModify(addedOrModifiedFiles: FileData): void;
}
export type Path = string;
export type ProcessFileFunction = (absolutePath: string, metadata: FileMetadata, request: {
readonly computeSha1: boolean;
}) => null | undefined | Buffer;
export interface RawMockMap {
readonly duplicates: Map<string, Set<string>>;
readonly mocks: Map<string, Path>;
readonly version: number;
}
export interface ReadOnlyRawMockMap {
readonly duplicates: ReadonlyMap<string, ReadonlySet<string>>;
readonly mocks: ReadonlyMap<string, Path>;
readonly version: number;
}
export interface WatcherBackend {
getPauseReason(): null | undefined | string;
onError($$PARAM_0$$: (error: Error) => void): () => void;
onFileEvent($$PARAM_0$$: (event: WatcherBackendChangeEvent) => void): () => void;
startWatching(): Promise<void>;
stopWatching(): Promise<void>;
}
export type ChangeEventClock = [string, string];
export type WatcherBackendChangeEvent = {
readonly event: "touch";
readonly clock?: ChangeEventClock;
readonly relativePath: string;
readonly root: string;
readonly metadata: ChangeEventMetadata;
} | {
readonly event: "delete";
readonly clock?: ChangeEventClock;
readonly relativePath: string;
readonly root: string;
readonly metadata?: void;
};
export interface WatcherBackendOptions {
readonly ignored?: null | RegExp;
readonly globs: ReadonlyArray<string>;
readonly dot: boolean;
}
export type WatchmanClockSpec = string | {
readonly scm: {
readonly "mergebase-with": string;
};
};
export type WatchmanClocks = Map<Path, WatchmanClockSpec>;
export interface WorkerMessage {
readonly computeDependencies: boolean;
readonly computeSha1: boolean;
readonly dependencyExtractor?: null | undefined | string;
readonly enableHastePackages: boolean;
readonly filePath: string;
readonly hasteImplModulePath?: null | undefined | string;
readonly maybeReturnContent: boolean;
}
export interface WorkerMetadata {
readonly dependencies?: null | undefined | ReadonlyArray<string>;
readonly id?: null | undefined | string;
readonly sha1?: null | undefined | string;
readonly content?: null | undefined | Buffer;
}
export interface WorkerSetupArgs {}

View File

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

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

@@ -0,0 +1,184 @@
/**
* 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, BuildResult, CacheData, CacheManager, CacheManagerFactory, CanonicalPath, ChangeEventClock, ChangeEventMetadata, Console, CrawlerOptions, FileData, FileMapPlugin, FileMetadata, FileSystem, HasteMapData, HasteMapItem, HType, MutableFileSystem, Path, PerfLogger, PerfLoggerFactory, WatchmanClocks } from "./flow-types";
import { FileProcessor } from "./lib/FileProcessor";
import { RootPathUtils } from "./lib/RootPathUtils";
import { Watcher } from "./Watcher";
import EventEmitter from "node:events";
export type { BuildParameters, BuildResult, CacheData, ChangeEventMetadata, FileData, FileMap, FileSystem, HasteMapData, HasteMapItem };
export interface InputOptions {
readonly computeDependencies?: null | undefined | boolean;
readonly computeSha1?: null | undefined | boolean;
readonly enableHastePackages?: boolean;
readonly enableSymlinks?: null | undefined | boolean;
readonly enableWorkerThreads?: null | undefined | boolean;
readonly extensions: ReadonlyArray<string>;
readonly forceNodeFilesystemAPI?: null | undefined | boolean;
readonly ignorePattern?: null | undefined | RegExp;
readonly mocksPattern?: null | undefined | string;
readonly platforms: ReadonlyArray<string>;
readonly plugins?: ReadonlyArray<FileMapPlugin>;
readonly retainAllFiles: boolean;
readonly rootDir: string;
readonly roots: ReadonlyArray<string>;
readonly skipPackageJson?: null | undefined | boolean;
readonly dependencyExtractor?: null | undefined | string;
readonly hasteImplModulePath?: null | undefined | string;
readonly cacheManagerFactory?: null | undefined | CacheManagerFactory;
readonly console?: Console;
readonly healthCheck: HealthCheckOptions;
readonly maxFilesPerWorker?: null | undefined | number;
readonly maxWorkers: number;
readonly perfLoggerFactory?: null | undefined | PerfLoggerFactory;
readonly resetCache?: null | undefined | boolean;
readonly throwOnModuleCollision?: null | undefined | boolean;
readonly useWatchman?: null | undefined | boolean;
readonly watch?: null | undefined | boolean;
readonly watchmanDeferStates?: ReadonlyArray<string>;
}
export interface HealthCheckOptions {
readonly enabled: boolean;
readonly interval: number;
readonly timeout: number;
readonly filePrefix: string;
}
export interface InternalOptions extends BuildParameters {
readonly healthCheck: HealthCheckOptions;
readonly perfLoggerFactory?: null | PerfLoggerFactory;
readonly resetCache?: null | boolean;
readonly useWatchman: boolean;
readonly watch: boolean;
readonly watchmanDeferStates: ReadonlyArray<string>;
}
export { DiskCacheManager } from "./cache/DiskCacheManager";
export { DuplicateHasteCandidatesError } from "./plugins/haste/DuplicateHasteCandidatesError";
export { HasteConflictsError } from "./plugins/haste/HasteConflictsError";
export { default as HastePlugin } from "./plugins/HastePlugin";
export type { HasteMap } from "./flow-types";
export type { HealthCheckResult } from "./Watcher";
export type { CacheManager, CacheManagerFactory, CacheManagerFactoryOptions, CacheManagerWriteOptions, ChangeEvent, DependencyExtractor, WatcherStatus } from "./flow-types";
/**
* FileMap includes a JavaScript implementation of Facebook's haste module system.
*
* This implementation is inspired by https://github.com/facebook/node-haste
* and was built with for high-performance in large code repositories with
* hundreds of thousands of files. This implementation is scalable and provides
* predictable performance.
*
* Because the haste map creation and synchronization is critical to startup
* performance and most tasks are blocked by I/O this class makes heavy use of
* synchronous operations. It uses worker processes for parallelizing file
* access and metadata extraction.
*
* The data structures created by `metro-file-map` can be used directly from the
* cache without further processing. The metadata objects in the `files` and
* `map` objects contain cross-references: a metadata object from one can look
* up the corresponding metadata object in the other map. Note that in most
* projects, the number of files will be greater than the number of haste
* modules one module can refer to many files based on platform extensions.
*
* type CacheData = {
* clocks: WatchmanClocks,
* files: {[filepath: string]: FileMetadata},
* map: {[id: string]: HasteMapItem},
* mocks: {[id: string]: string},
* }
*
* // Watchman clocks are used for query synchronization and file system deltas.
* type WatchmanClocks = {[filepath: string]: string};
*
* type FileMetadata = {
* id: ?string, // used to look up module metadata objects in `map`.
* mtime: number, // check for outdated files.
* size: number, // size of the file in bytes.
* visited: boolean, // whether the file has been parsed or not.
* dependencies: Array<string>, // all relative dependencies of this file.
* sha1: ?string, // SHA-1 of the file, if requested via options.
* symlink: ?(1 | 0 | string), // Truthy if symlink, string is target
* };
*
* // Modules can be targeted to a specific platform based on the file name.
* // Example: platform.ios.js and Platform.android.js will both map to the same
* // `Platform` module. The platform should be specified during resolution.
* type HasteMapItem = {[platform: string]: ModuleMetadata};
*
* //
* type ModuleMetadata = {
* path: string, // the path to look up the file object in `files`.
* type: string, // the module type (either `package` or `module`).
* };
*
* Note that the data structures described above are conceptual only. The actual
* implementation uses arrays and constant keys for metadata storage. Instead of
* `{id: 'flatMap', mtime: 3421, size: 42, visited: true, dependencies: []}` the real
* representation is similar to `['flatMap', 3421, 42, 1, []]` to save storage space
* and reduce parse and write time of a big JSON blob.
*
* The HasteMap is created as follows:
* 1. read data from the cache or create an empty structure.
*
* 2. crawl the file system.
* * empty cache: crawl the entire file system.
* * cache available:
* * if watchman is available: get file system delta changes.
* * if watchman is unavailable: crawl the entire file system.
* * build metadata objects for every file. This builds the `files` part of
* the `HasteMap`.
*
* 3. parse and extract metadata from changed files.
* * this is done in parallel over worker processes to improve performance.
* * the worst case is to parse all files.
* * the best case is no file system access and retrieving all data from
* the cache.
* * the average case is a small number of changed files.
*
* 4. serialize the new `HasteMap` in a cache file.
*
*/
declare class FileMap extends EventEmitter {
_buildPromise: null | undefined | Promise<BuildResult>;
_canUseWatchmanPromise: Promise<boolean>;
_changeID: number;
_changeInterval: null | undefined | NodeJS.Timeout;
_fileProcessor: FileProcessor;
_console: Console;
_options: InternalOptions;
_pathUtils: RootPathUtils;
_watcher: null | undefined | Watcher;
_cacheManager: CacheManager;
_crawlerAbortController: AbortController;
_healthCheckInterval: null | undefined | NodeJS.Timeout;
_startupPerfLogger: null | undefined | PerfLogger;
static create(options: InputOptions): FileMap;
constructor(options: InputOptions);
build(): Promise<BuildResult>;
read(): Promise<null | undefined | CacheData>;
_buildFileDelta(previousState: CrawlerOptions["previousState"]): Promise<{
removedFiles: Set<CanonicalPath>;
changedFiles: FileData;
clocks?: WatchmanClocks;
}>;
_maybeReadLink(filePath: Path, fileMetadata: FileMetadata): null | undefined | Promise<void>;
_applyFileDelta(fileSystem: MutableFileSystem, plugins: ReadonlyArray<FileMapPlugin>, delta: {
readonly changedFiles: FileData;
readonly removedFiles: ReadonlySet<CanonicalPath>;
readonly clocks?: WatchmanClocks;
}): Promise<void>;
_takeSnapshotAndPersist(fileSystem: FileSystem, clocks: WatchmanClocks, plugins: ReadonlyArray<FileMapPlugin>, changed: FileData, removed: Set<CanonicalPath>): Promise<void>;
_watch(fileSystem: MutableFileSystem, clocks: WatchmanClocks, plugins: ReadonlyArray<FileMapPlugin>): Promise<void>;
end(): Promise<void>;
_shouldUseWatchman(): Promise<boolean>;
_getNextChangeID(): number;
_updateClock(clocks: WatchmanClocks, newClock?: null | undefined | ChangeEventClock): void;
static H: HType;
}
export default FileMap;

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

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

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;

View File

@@ -0,0 +1,39 @@
/**
* 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 { Console, DuplicatesSet, FileMapDelta, FileMapPlugin, FileMapPluginInitOptions, FileMetadata, HasteConflict, HasteMap, HasteMapItemMetadata, HTypeValue, Path, PerfLogger } from "../flow-types";
export interface HasteMapOptions {
readonly console?: null | undefined | Console;
readonly enableHastePackages: boolean;
readonly perfLogger?: null | PerfLogger;
readonly platforms: ReadonlySet<string>;
readonly rootDir: Path;
readonly failValidationOnConflicts: boolean;
}
declare class HastePlugin implements HasteMap, FileMapPlugin<null> {
readonly name: any;
constructor(options: HasteMapOptions);
initialize($$PARAM_0$$: FileMapPluginInitOptions<null>): Promise<void>;
getSerializableSnapshot(): null;
getModule(name: string, platform?: null | undefined | string, supportsNativePlatform?: null | undefined | boolean, type?: null | undefined | HTypeValue): null | undefined | Path;
getPackage(name: string, platform: null | undefined | string, _supportsNativePlatform?: null | undefined | boolean): null | undefined | Path;
_getModuleMetadata(name: string, platform: null | undefined | string, supportsNativePlatform: boolean): HasteMapItemMetadata | null;
_assertNoDuplicates(name: string, platform: string, supportsNativePlatform: boolean, relativePathSet: null | undefined | DuplicatesSet): void;
bulkUpdate(delta: FileMapDelta): Promise<void>;
onNewOrModifiedFile(relativeFilePath: string, fileMetadata: FileMetadata): void;
setModule(id: string, module: HasteMapItemMetadata): void;
onRemovedFile(relativeFilePath: string, fileMetadata: FileMetadata): void;
assertValid(): void;
_recoverDuplicates(moduleName: string, relativeFilePath: string): void;
computeConflicts(): Array<HasteConflict>;
getCacheKey(): string;
}
export default HastePlugin;

View File

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

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 { FileMapDelta, FileMapPlugin, FileMapPluginInitOptions, MockMap as IMockMap, Path, RawMockMap } from "../flow-types";
export declare const CACHE_VERSION: 2;
declare class MockPlugin implements FileMapPlugin<RawMockMap>, IMockMap {
readonly name: any;
constructor($$PARAM_0$$: {
readonly console: typeof console;
readonly mocksPattern: RegExp;
readonly rawMockMap?: RawMockMap;
readonly rootDir: Path;
readonly throwOnModuleCollision: boolean;
});
initialize($$PARAM_0$$: FileMapPluginInitOptions<RawMockMap>): Promise<void>;
getMockModule(name: string): null | undefined | Path;
bulkUpdate(delta: FileMapDelta): Promise<void>;
onNewOrModifiedFile(relativeFilePath: Path): void;
onRemovedFile(relativeFilePath: Path): void;
getSerializableSnapshot(): RawMockMap;
assertValid(): void;
getCacheKey(): string;
}
export default MockPlugin;

View File

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

View File

@@ -0,0 +1,19 @@
/**
* 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 { DuplicatesSet } from "../../flow-types";
export declare class DuplicateHasteCandidatesError extends Error {
hasteName: string;
platform: string | null;
supportsNativePlatform: boolean;
duplicatesSet: DuplicatesSet;
constructor(name: string, platform: string, supportsNativePlatform: boolean, duplicatesSet: DuplicatesSet);
}

View File

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

View File

@@ -0,0 +1,16 @@
/**
* 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 { HasteConflict } from "../../flow-types";
export declare class HasteConflictsError extends Error {
constructor(conflicts: ReadonlyArray<HasteConflict>);
getDetailedMessage(pathsRelativeToRoot: null | undefined | string): string;
}

View File

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

View File

@@ -0,0 +1,22 @@
/**
* 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
*/
import type { HasteMapItem } from "../../flow-types";
export interface Conflict {
id: string;
platform?: string | null;
absolutePaths: Array<string>;
type?: "duplicate" | "shadowing";
}
export declare function computeHasteConflicts($$PARAM_0$$: {
readonly duplicates: ReadonlyMap<string, ReadonlyMap<string, ReadonlyMap<string, number>>>;
readonly map: ReadonlyMap<string, HasteMapItem>;
readonly rootDir: string;
}): Array<Conflict>;

View File

@@ -0,0 +1,2 @@
module.exports = require("metro-file-map/private/plugins/haste/computeConflicts");
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
*
*/
declare function getPlatformExtension(file: string, platforms: ReadonlySet<string>): null | undefined | string;
export default getPlatformExtension;

View File

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

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 const getMockName: (filePath: string) => string;
export default getMockName;

View File

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

View File

@@ -0,0 +1,30 @@
/**
* 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
*
*/
import type { WatcherBackend, WatcherBackendChangeEvent, WatcherBackendOptions } from "../flow-types";
export interface Listeners {
readonly onFileEvent: (event: WatcherBackendChangeEvent) => void;
readonly onError: (error: Error) => void;
}
export declare class AbstractWatcher implements WatcherBackend {
readonly root: string;
readonly ignored: null | undefined | RegExp;
readonly globs: ReadonlyArray<string>;
readonly dot: boolean;
readonly doIgnore: (path: string) => boolean;
constructor(dir: string, $$PARAM_1$$: WatcherBackendOptions);
onFileEvent(listener: (event: WatcherBackendChangeEvent) => void): () => void;
onError(listener: (error: Error) => void): () => void;
startWatching(): Promise<void>;
stopWatching(): Promise<void>;
emitFileEvent(event: Omit<WatcherBackendChangeEvent, "root">): void;
emitError(error: Error): void;
getPauseReason(): null | undefined | string;
}

View File

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

View File

@@ -0,0 +1,44 @@
/**
* 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
*/
/**
* Originally vendored from https://github.com/amasad/sane/blob/64ff3a870c42e84f744086884bf55a4f9c22d376/src/node_watcher.js
*/
import type { ChangeEventMetadata, WatcherBackendChangeEvent } from "../flow-types";
import type { FSWatcher } from "node:fs";
import { AbstractWatcher } from "./AbstractWatcher";
declare class FallbackWatcher extends AbstractWatcher {
readonly _changeTimers: Map<string, NodeJS.Timeout>;
readonly _dirRegistry: {
[directory: string]: {
[file: string]: true;
};
};
readonly watched: {
[key: string]: FSWatcher;
};
startWatching(): Promise<void>;
_register(filepath: string, type: ChangeEventMetadata["type"]): boolean;
_unregister(filepath: string): void;
_unregisterDir(dirpath: string): void;
_registered(fullpath: string): boolean;
_checkedEmitError: (error: Error) => void;
_watchdir: ($$PARAM_0$$: string) => boolean;
_stopWatching(dir: string): Promise<void>;
stopWatching(): Promise<void>;
_detectChangedFile(dir: string, event: string, callback: (file: string) => void): void;
_normalizeChange(dir: string, event: string, file: string): void;
_processChange(dir: string, event: string, file: string): Promise<void>;
_emitEvent(change: Omit<WatcherBackendChangeEvent, "root">): void;
getPauseReason(): null | undefined | string;
}
export default FallbackWatcher;

View File

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

View File

@@ -0,0 +1,43 @@
/**
* 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
*
*/
import { AbstractWatcher } from "./AbstractWatcher";
/**
* NativeWatcher uses Node's native fs.watch API with recursive: true.
*
* Supported on macOS (and potentially Windows), because both natively have a
* concept of recurisve watching, via FSEvents and ReadDirectoryChangesW
* respectively. Notably Linux lacks this capability at the OS level.
*
* Node.js has at times supported the `recursive` option to fs.watch on Linux
* by walking the directory tree and creating a watcher on each directory, but
* this fits poorly with the synchronous `watch` API - either it must block for
* arbitrarily large IO, or it may drop changes after `watch` returns. See:
* https://github.com/nodejs/node/issues/48437
*
* Therefore, we retain a fallback to our own application-level recursive
* FallbackWatcher for Linux, which has async `startWatching`.
*
* On Windows, this watcher could be used in principle, but needs work around
* some Windows-specific edge cases handled in FallbackWatcher, like
* deduping file change events, ignoring directory changes, and handling EPERM.
*/
declare class NativeWatcher extends AbstractWatcher {
static isSupported(): boolean;
constructor(dir: string, opts: {
readonly ignored?: null | RegExp;
readonly globs: ReadonlyArray<string>;
readonly dot: boolean;
});
startWatching(): Promise<void>;
stopWatching(): Promise<void>;
_handleEvent(relativePath: string): Promise<void>;
}
export default NativeWatcher;

View File

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

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
*/
/**
* Originally vendored from
* https://github.com/amasad/sane/blob/64ff3a870c42e84f744086884bf55a4f9c22d376/src/utils/recrawl-warning-dedupe.js
*/
declare class RecrawlWarning {
static RECRAWL_WARNINGS: Array<RecrawlWarning>;
static REGEXP: RegExp;
root: string;
count: number;
constructor(root: string, count: number);
static findByRoot(root: string): null | undefined | RecrawlWarning;
static isRecrawlWarningDupe(warningMessage: any): boolean;
}
export default RecrawlWarning;

View File

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

View File

@@ -0,0 +1,34 @@
/**
* 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 { WatcherOptions } from "./common";
import type { Client, WatchmanFileChange, WatchmanSubscriptionEvent } from "fb-watchman";
import { AbstractWatcher } from "./AbstractWatcher";
/**
* Watches `dir`.
*/
declare class WatchmanWatcher extends AbstractWatcher {
client: Client;
readonly subscriptionName: string;
watchProjectInfo: null | undefined | {
readonly relativePath: string;
readonly root: string;
};
readonly watchmanDeferStates: ReadonlyArray<string>;
constructor(dir: string, $$PARAM_1$$: WatcherOptions);
startWatching(): Promise<void>;
_init(onReady: () => void, onError: (error: Error) => void): void;
_handleChangeEvent(resp: WatchmanSubscriptionEvent): void;
_handleFileChange(changeDescriptor: WatchmanFileChange, rawClock: WatchmanSubscriptionEvent["clock"]): void;
stopWatching(): Promise<void>;
getPauseReason(): null | undefined | string;
}
export default WatchmanWatcher;

View File

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

View File

@@ -0,0 +1,48 @@
/**
* 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
*/
/**
* Originally vendored from
* https://github.com/amasad/sane/blob/64ff3a870c42e84f744086884bf55a4f9c22d376/src/common.js
*/
import type { ChangeEventMetadata } from "../flow-types";
import type { Stats } from "node:fs";
/**
* Constants
*/
export declare const DELETE_EVENT: "delete";
export declare const TOUCH_EVENT: "touch";
export declare const ALL_EVENT: "all";
export interface WatcherOptions {
readonly globs: ReadonlyArray<string>;
readonly dot: boolean;
readonly ignored?: null | RegExp;
readonly watchmanDeferStates: ReadonlyArray<string>;
readonly watchman?: any;
readonly watchmanPath?: string;
}
/**
* Checks a file relative path against the globs array.
*/
export declare function includedByGlob(type: null | undefined | ("f" | "l" | "d"), globs: ReadonlyArray<string>, dot: boolean, relativePath: string): boolean;
/**
* Whether the given filePath matches the given RegExp, after converting
* (on Windows only) system separators to posix separators.
*
* Conversion to posix is for backwards compatibility with the previous
* anymatch matcher, which normlises all inputs[1]. This may not be consistent
* with other parts of metro-file-map.
*
* [1]: https://github.com/micromatch/anymatch/blob/3.1.1/index.js#L50
*/
export declare const posixPathMatchesPattern: (pattern: RegExp, filePath: string) => boolean;
export declare function typeFromStat(stat: Stats): null | undefined | ChangeEventMetadata["type"];

View File

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

17
node_modules/@expo/metro/metro-file-map/worker.d.ts generated vendored Normal file
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
*/
import type { WorkerMessage, WorkerMetadata, WorkerSetupArgs } from "./flow-types";
export declare function setup(args: WorkerSetupArgs): void;
export declare function processFile(data: WorkerMessage): WorkerMetadata;
export declare class Worker {
constructor(args: WorkerSetupArgs);
processFile(data: WorkerMessage): WorkerMetadata;
}

1
node_modules/@expo/metro/metro-file-map/worker.js generated vendored Normal file
View File

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

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 const extensions: ReadonlySet<string>;
export default extensions;

View File

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