metro-cache
Advanced tools
| /** | ||
| * 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 | ||
| * @oncall react_native | ||
| * @generated SignedSource<<1fe6ca4aa9f1f410281edf1b8f9adea2>> | ||
| * | ||
| * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js | ||
| * Original file: packages/metro-cache/src/Cache.js | ||
| * To regenerate, run: | ||
| * js1 build metro-ts-defs (internal) OR | ||
| * yarn run build-ts-defs (OSS) | ||
| */ | ||
| import type {CacheStore} from './types'; | ||
| /** | ||
| * Main cache class. Receives an array of cache instances, and sequentially | ||
| * traverses them to return a previously stored value. It also ensures setting | ||
| * the value in all instances. | ||
| * | ||
| * All get/set operations are logged via Metro's logger. | ||
| */ | ||
| declare class Cache<T> { | ||
| constructor(stores: ReadonlyArray<CacheStore<T>>); | ||
| get(key: Buffer): Promise<null | undefined | T>; | ||
| set(key: Buffer, value: T): Promise<void>; | ||
| get isDisabled(): boolean; | ||
| } | ||
| export default Cache; |
| /** | ||
| * 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 | ||
| * @oncall react_native | ||
| * @generated SignedSource<<2bb72546f80164eb8c0068f9de3a1487>> | ||
| * | ||
| * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js | ||
| * Original file: packages/metro-cache/src/index.js | ||
| * To regenerate, run: | ||
| * js1 build metro-ts-defs (internal) OR | ||
| * yarn run build-ts-defs (OSS) | ||
| */ | ||
| import Cache from './Cache'; | ||
| import stableHash from './stableHash'; | ||
| import AutoCleanFileStore from './stores/AutoCleanFileStore'; | ||
| import FileStore from './stores/FileStore'; | ||
| import HttpGetStore from './stores/HttpGetStore'; | ||
| import HttpStore from './stores/HttpStore'; | ||
| export type {Options as FileOptions} from './stores/FileStore'; | ||
| export type {Options as HttpOptions} from './stores/HttpStore'; | ||
| export type {CacheStore} from './types'; | ||
| export { | ||
| AutoCleanFileStore, | ||
| Cache, | ||
| FileStore, | ||
| HttpGetStore, | ||
| HttpStore, | ||
| stableHash, | ||
| }; | ||
| export interface MetroCache { | ||
| readonly AutoCleanFileStore: typeof AutoCleanFileStore; | ||
| readonly Cache: typeof Cache; | ||
| readonly FileStore: typeof FileStore; | ||
| readonly HttpGetStore: typeof HttpGetStore; | ||
| readonly HttpStore: typeof HttpStore; | ||
| readonly stableHash: typeof stableHash; | ||
| } | ||
| /** | ||
| * Backwards-compatibility with CommonJS consumers using interopRequireDefault. | ||
| * Do not add to this list. | ||
| * | ||
| * @deprecated Default import from 'metro-cache' is deprecated, use named exports. | ||
| */ | ||
| declare const $$EXPORT_DEFAULT_DECLARATION$$: MetroCache; | ||
| declare type $$EXPORT_DEFAULT_DECLARATION$$ = | ||
| typeof $$EXPORT_DEFAULT_DECLARATION$$; | ||
| export default $$EXPORT_DEFAULT_DECLARATION$$; |
| /** | ||
| * 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 | ||
| * @oncall react_native | ||
| * @generated SignedSource<<36e0de65be0930a61b8ff46232052ea7>> | ||
| * | ||
| * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js | ||
| * Original file: packages/metro-cache/src/stableHash.js | ||
| * To regenerate, run: | ||
| * js1 build metro-ts-defs (internal) OR | ||
| * yarn run build-ts-defs (OSS) | ||
| */ | ||
| declare function stableHash(value: unknown): Buffer; | ||
| export default stableHash; |
| /** | ||
| * 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 | ||
| * @oncall react_native | ||
| * @generated SignedSource<<b48a572e322053f43ea91adf8f8a2bdb>> | ||
| * | ||
| * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js | ||
| * Original file: packages/metro-cache/src/stores/AutoCleanFileStore.js | ||
| * To regenerate, run: | ||
| * js1 build metro-ts-defs (internal) OR | ||
| * yarn run build-ts-defs (OSS) | ||
| */ | ||
| import type {Options} from './FileStore'; | ||
| import FileStore from './FileStore'; | ||
| type CleanOptions = Readonly< | ||
| Omit<Options, keyof {intervalMs?: number; cleanupThresholdMs?: number}> & { | ||
| intervalMs?: number; | ||
| 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; |
| /** | ||
| * 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 | ||
| * @oncall react_native | ||
| * @generated SignedSource<<7de501c6653d300c594fcf37ce3b56f4>> | ||
| * | ||
| * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js | ||
| * Original file: packages/metro-cache/src/stores/FileStore.js | ||
| * To regenerate, run: | ||
| * js1 build metro-ts-defs (internal) OR | ||
| * yarn run build-ts-defs (OSS) | ||
| */ | ||
| export type 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; |
| /** | ||
| * 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 | ||
| * @generated SignedSource<<7a0b4b83fb44651820333ade6a980ef7>> | ||
| * | ||
| * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js | ||
| * Original file: packages/metro-cache/src/stores/HttpError.js | ||
| * To regenerate, run: | ||
| * js1 build metro-ts-defs (internal) OR | ||
| * yarn run build-ts-defs (OSS) | ||
| */ | ||
| declare class HttpError extends Error { | ||
| code: number; | ||
| constructor(message: string, code: number); | ||
| } | ||
| export default HttpError; |
| /** | ||
| * 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 | ||
| * @oncall react_native | ||
| * @generated SignedSource<<12106d5e641e2402d71f229ec168a8ec>> | ||
| * | ||
| * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js | ||
| * Original file: packages/metro-cache/src/stores/HttpGetStore.js | ||
| * To regenerate, run: | ||
| * js1 build metro-ts-defs (internal) OR | ||
| * yarn run build-ts-defs (OSS) | ||
| */ | ||
| 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; |
| /** | ||
| * 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 | ||
| * @oncall react_native | ||
| * @generated SignedSource<<05ef02cd1f35e98055791237d573dc5a>> | ||
| * | ||
| * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js | ||
| * Original file: packages/metro-cache/src/stores/HttpStore.js | ||
| * To regenerate, run: | ||
| * js1 build metro-ts-defs (internal) OR | ||
| * yarn run build-ts-defs (OSS) | ||
| */ | ||
| import HttpError from './HttpError'; | ||
| import NetworkError from './NetworkError'; | ||
| export type Options = | ||
| | EndpointOptions | ||
| | {getOptions: EndpointOptions; setOptions: EndpointOptions}; | ||
| type 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?: {[$$Key$$: string]: string}; | ||
| 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; |
| /** | ||
| * 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 | ||
| * @generated SignedSource<<9a68fe7766e376b8525c589673853e54>> | ||
| * | ||
| * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js | ||
| * Original file: packages/metro-cache/src/stores/NetworkError.js | ||
| * To regenerate, run: | ||
| * js1 build metro-ts-defs (internal) OR | ||
| * yarn run build-ts-defs (OSS) | ||
| */ | ||
| declare class NetworkError extends Error { | ||
| code: string; | ||
| constructor(message: string, code: string); | ||
| } | ||
| export default NetworkError; |
| /** | ||
| * 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 | ||
| * @oncall react_native | ||
| * @generated SignedSource<<80dd2674720fe89c7a90a649a922cb1d>> | ||
| * | ||
| * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js | ||
| * Original file: packages/metro-cache/src/types.js | ||
| * To regenerate, run: | ||
| * js1 build metro-ts-defs (internal) OR | ||
| * yarn run build-ts-defs (OSS) | ||
| */ | ||
| export interface CacheStore<T> { | ||
| name?: string; | ||
| get(key: Buffer): (null | undefined | T) | Promise<null | undefined | T>; | ||
| set(key: Buffer, value: T): void | Promise<void>; | ||
| clear(): void | Promise<void>; | ||
| } |
+2
-2
| { | ||
| "name": "metro-cache", | ||
| "version": "0.84.1", | ||
| "version": "0.84.2", | ||
| "description": "🚇 Cache layers for Metro.", | ||
@@ -24,3 +24,3 @@ "main": "src/index.js", | ||
| "https-proxy-agent": "^7.0.5", | ||
| "metro-core": "0.84.1" | ||
| "metro-core": "0.84.2" | ||
| }, | ||
@@ -27,0 +27,0 @@ "devDependencies": { |
55449
22.5%31
47.62%990
43.27%+ Added
+ Added
- Removed
- Removed
Updated