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,29 @@
/**
* 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 { Options } from "./FileStore";
import FileStore from "./FileStore";
export interface CleanOptions extends Options {
readonly intervalMs?: number;
readonly cleanupThresholdMs?: number;
}
/**
* A FileStore that, at a given interval, stats the content of the cache root
* and deletes any file last modified a set threshold in the past.
*
* @deprecated This is not efficiently implemented and may cause significant
* redundant I/O when caches are large. Prefer your own cleanup scripts, or a
* custom Metro cache that uses watches, hooks get/set, and/or implements LRU.
*/
declare class AutoCleanFileStore<T> extends FileStore<T> {
constructor(opts: CleanOptions);
}
export default AutoCleanFileStore;

View File

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

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
* @oncall react_native
*/
export interface Options {
readonly root: string;
}
declare class FileStore<T> {
constructor(options: Options);
get(key: Buffer): Promise<null | undefined | T>;
set(key: Buffer, value: T): Promise<void>;
clear(): void;
}
export default FileStore;

View File

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

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
*/
declare class HttpError extends Error {
code: number;
constructor(message: string, code: number);
}
export default HttpError;

View File

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

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 { Options as HttpOptions } from "./HttpStore";
import HttpStore from "./HttpStore";
declare class HttpGetStore<T> extends HttpStore<T> {
constructor(options: HttpOptions);
get(key: Buffer): Promise<null | undefined | T>;
set(_key: Buffer, _value: T): Promise<void>;
}
export default HttpGetStore;

View File

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

View File

@@ -0,0 +1,41 @@
import HttpError from "./HttpError";
import NetworkError from "./NetworkError";
export type Options = EndpointOptions | {
getOptions: EndpointOptions;
setOptions: EndpointOptions;
};
export interface _EndpointOptions_headers {
[$$Key$$: string]: string;
}
export interface EndpointOptions {
endpoint: string;
family?: 4 | 6;
timeout?: number;
key?: string | ReadonlyArray<string> | Buffer | ReadonlyArray<Buffer>;
cert?: string | ReadonlyArray<string> | Buffer | ReadonlyArray<Buffer>;
ca?: string | ReadonlyArray<string> | Buffer | ReadonlyArray<Buffer>;
params?: URLSearchParams;
headers?: _EndpointOptions_headers;
additionalSuccessStatuses?: ReadonlyArray<number>;
/**
* Whether to include additional debug information in error messages.
*/
debug?: boolean;
/**
* Retry configuration
*/
maxAttempts?: number;
retryNetworkErrors?: boolean;
retryStatuses?: ReadonlySet<number>;
socketPath?: string;
proxy?: string;
}
declare class HttpStore<T> {
static HttpError: typeof HttpError;
static NetworkError: typeof NetworkError;
constructor(options: Options);
get(key: Buffer): Promise<null | undefined | T>;
set(key: Buffer, value: T): Promise<void>;
clear(): void;
}
export default HttpStore;

View File

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

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
*/
declare class NetworkError extends Error {
code: string;
constructor(message: string, code: string);
}
export default NetworkError;

View File

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