miniflare
Version:
Fun, full-featured, fully-local simulator for Cloudflare Workers
1,130 lines (1,083 loc) • 376 kB
TypeScript
import type { Abortable } from 'node:events';
import type { AbortSignal as AbortSignal_2 } from '@cloudflare/workers-types/experimental';
import { Awaitable as Awaitable_2 } from '..';
import type { Blob as Blob_2 } from '@cloudflare/workers-types/experimental';
import { Blob as Blob_3 } from 'node:buffer';
import { BodyInit } from 'undici';
import type { CacheStorage } from '@cloudflare/workers-types/experimental';
import { cspotcodeSourceMapSupport } from '@cspotcode/source-map-support';
import type { D1Database } from '@cloudflare/workers-types/experimental';
import type { DurableObjectNamespace } from '@cloudflare/workers-types/experimental';
import { ExternalServer as ExternalServer_2 } from '../..';
import { ExternalServer as ExternalServer_3 } from '..';
import type { Fetcher } from '@cloudflare/workers-types/experimental';
import type { File as File_2 } from '@cloudflare/workers-types/experimental';
import type { Flagship } from '@cloudflare/workers-types/experimental';
import { FormData as FormData_2 } from 'undici';
import { Headers as Headers_2 } from 'undici';
import type { Headers as Headers_3 } from '@cloudflare/workers-types/experimental';
import { HeadersInit } from 'undici';
import type http from 'node:http';
import type { ImagesBinding } from '@cloudflare/workers-types/experimental';
import { IncomingMessage } from 'http';
import type { IncomingRequestCfProperties } from '@cloudflare/workers-types/experimental';
import { Json as Json_2 } from '..';
import { kCurrentWorker as kCurrentWorker_2 } from './core';
import { kUnsafeEphemeralUniqueKey as kUnsafeEphemeralUniqueKey_2 } from './shared';
import type { KVNamespace } from '@cloudflare/workers-types/experimental';
import type { KVNamespaceListKey } from '@cloudflare/workers-types/experimental';
import { Log as Log_2 } from '..';
import { Miniflare as Miniflare_2 } from '../..';
import { Miniflare as Miniflare_3 } from '..';
import { MockAgent } from 'undici';
import NodeWebSocket from 'ws';
import type { ParseParams } from 'zod';
import { PeriodType as PeriodType_2 } from './ratelimit';
import { Plugin as Plugin_2 } from './shared';
import { Process } from '@puppeteer/browsers';
import type { Queue } from '@cloudflare/workers-types/experimental';
import type { R2Bucket } from '@cloudflare/workers-types/experimental';
import { Readable } from 'node:stream';
import { Readable as Readable_2 } from 'stream';
import type { ReadableStream as ReadableStream_2 } from '@cloudflare/workers-types/experimental';
import { ReadableStream as ReadableStream_3 } from 'node:stream/web';
import { ReferrerPolicy } from 'undici';
import { RemoteProxyConnectionString as RemoteProxyConnectionString_2 } from '..';
import { RemoteProxyConnectionString as RemoteProxyConnectionString_3 } from './shared';
import { Request as Request_3 } from '../..';
import { Request as Request_4 } from 'undici';
import type { Request as Request_5 } from '@cloudflare/workers-types/experimental';
import { Request as Request_6 } from '..';
import { RequestCache } from 'undici';
import { RequestCredentials } from 'undici';
import { RequestDestination } from 'undici';
import { RequestDuplex } from 'undici';
import type { RequestInfo as RequestInfo_2 } from 'undici';
import type { RequestInit as RequestInit_3 } from 'undici';
import type { RequestInit as RequestInit_4 } from '@cloudflare/workers-types/experimental';
import type { RequestInitCfProperties } from '@cloudflare/workers-types/experimental';
import { RequestMode } from 'undici';
import { RequestRedirect } from 'undici';
import { Response as Response_3 } from '../..';
import { Response as Response_4 } from 'undici';
import type { Response as Response_5 } from '@cloudflare/workers-types/experimental';
import { Response as Response_6 } from '..';
import type { ResponseInit as ResponseInit_3 } from 'undici';
import { ResponseRedirectStatus } from 'undici';
import { ResponseType } from 'undici';
import { ServerResponse } from 'http';
import type { ServiceWorkerGlobalScope } from '@cloudflare/workers-types/experimental';
import type { StreamBinding } from '@cloudflare/workers-types/experimental';
import type { Transform } from 'node:stream';
import * as undici from 'undici';
import { URL as URL_2 } from 'url';
import { WorkerRegistry as WorkerRegistry_2 } from '..';
import { z } from 'zod';
export declare class __MiniflareFunctionWrapper {
constructor(fnWithProps: ((...args: unknown[]) => unknown) & {
[key: string | symbol]: unknown;
});
}
export declare const AGENT_MEMORY_PLUGIN: Plugin<typeof AgentMemoryOptionsSchema>;
export declare const AGENT_MEMORY_PLUGIN_NAME = "agent-memory";
export declare const AgentMemoryOptionsSchema: z.ZodObject<{
agentMemory: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
namespace: z.ZodString;
remoteProxyConnectionString: z.ZodOptional<z.ZodType<RemoteProxyConnectionString, z.ZodTypeDef, RemoteProxyConnectionString>>;
}, "strip", z.ZodTypeAny, {
namespace: string;
remoteProxyConnectionString?: RemoteProxyConnectionString | undefined;
}, {
namespace: string;
remoteProxyConnectionString?: RemoteProxyConnectionString | undefined;
}>>>;
}, "strip", z.ZodTypeAny, {
agentMemory?: Record<string, {
namespace: string;
remoteProxyConnectionString?: RemoteProxyConnectionString | undefined;
}> | undefined;
}, {
agentMemory?: Record<string, {
namespace: string;
remoteProxyConnectionString?: RemoteProxyConnectionString | undefined;
}> | undefined;
}>;
export declare const AI_PLUGIN: Plugin<typeof AIOptionsSchema>;
export declare const AI_PLUGIN_NAME = "ai";
export declare const AI_SEARCH_PLUGIN: Plugin<typeof AISearchOptionsSchema>;
export declare const AI_SEARCH_PLUGIN_NAME = "ai-search";
export declare const AIOptionsSchema: z.ZodObject<{
ai: z.ZodOptional<z.ZodObject<{
binding: z.ZodString;
remoteProxyConnectionString: z.ZodOptional<z.ZodType<RemoteProxyConnectionString, z.ZodTypeDef, RemoteProxyConnectionString>>;
}, "strip", z.ZodTypeAny, {
binding: string;
remoteProxyConnectionString?: RemoteProxyConnectionString | undefined;
}, {
binding: string;
remoteProxyConnectionString?: RemoteProxyConnectionString | undefined;
}>>;
}, "strip", z.ZodTypeAny, {
ai?: {
binding: string;
remoteProxyConnectionString?: RemoteProxyConnectionString | undefined;
} | undefined;
}, {
ai?: {
binding: string;
remoteProxyConnectionString?: RemoteProxyConnectionString | undefined;
} | undefined;
}>;
export declare const AISearchOptionsSchema: z.ZodObject<{
aiSearchNamespaces: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
namespace: z.ZodOptional<z.ZodString>;
instance_name: z.ZodOptional<z.ZodString>;
remoteProxyConnectionString: z.ZodOptional<z.ZodType<RemoteProxyConnectionString, z.ZodTypeDef, RemoteProxyConnectionString>>;
}, "strip", z.ZodTypeAny, {
namespace?: string | undefined;
remoteProxyConnectionString?: RemoteProxyConnectionString | undefined;
instance_name?: string | undefined;
}, {
namespace?: string | undefined;
remoteProxyConnectionString?: RemoteProxyConnectionString | undefined;
instance_name?: string | undefined;
}>>>;
aiSearchInstances: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
namespace: z.ZodOptional<z.ZodString>;
instance_name: z.ZodOptional<z.ZodString>;
remoteProxyConnectionString: z.ZodOptional<z.ZodType<RemoteProxyConnectionString, z.ZodTypeDef, RemoteProxyConnectionString>>;
}, "strip", z.ZodTypeAny, {
namespace?: string | undefined;
remoteProxyConnectionString?: RemoteProxyConnectionString | undefined;
instance_name?: string | undefined;
}, {
namespace?: string | undefined;
remoteProxyConnectionString?: RemoteProxyConnectionString | undefined;
instance_name?: string | undefined;
}>>>;
}, "strip", z.ZodTypeAny, {
aiSearchNamespaces?: Record<string, {
namespace?: string | undefined;
remoteProxyConnectionString?: RemoteProxyConnectionString | undefined;
instance_name?: string | undefined;
}> | undefined;
aiSearchInstances?: Record<string, {
namespace?: string | undefined;
remoteProxyConnectionString?: RemoteProxyConnectionString | undefined;
instance_name?: string | undefined;
}> | undefined;
}, {
aiSearchNamespaces?: Record<string, {
namespace?: string | undefined;
remoteProxyConnectionString?: RemoteProxyConnectionString | undefined;
instance_name?: string | undefined;
}> | undefined;
aiSearchInstances?: Record<string, {
namespace?: string | undefined;
remoteProxyConnectionString?: RemoteProxyConnectionString | undefined;
instance_name?: string | undefined;
}> | undefined;
}>;
export declare const ANALYTICS_ENGINE_PLUGIN: Plugin<typeof AnalyticsEngineSchemaOptionsSchema, typeof AnalyticsEngineSchemaSharedOptionsSchema>;
export declare const ANALYTICS_ENGINE_PLUGIN_NAME = "analytics-engine";
export declare const AnalyticsEngineSchemaOptionsSchema: z.ZodObject<{
analyticsEngineDatasets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
dataset: z.ZodString;
}, "strip", z.ZodTypeAny, {
dataset: string;
}, {
dataset: string;
}>>>;
}, "strip", z.ZodTypeAny, {
analyticsEngineDatasets?: Record<string, {
dataset: string;
}> | undefined;
}, {
analyticsEngineDatasets?: Record<string, {
dataset: string;
}> | undefined;
}>;
export declare const AnalyticsEngineSchemaSharedOptionsSchema: z.ZodObject<{
analyticsEngineDatasetsPersist: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodString, z.ZodEffects<z.ZodString, string, string>]>>;
}, "strip", z.ZodTypeAny, {
analyticsEngineDatasetsPersist?: string | boolean | undefined;
}, {
analyticsEngineDatasetsPersist?: string | boolean | undefined;
}>;
export declare type AnyHeaders = http.IncomingHttpHeaders | string[];
export declare const ARTIFACTS_PLUGIN: Plugin<typeof ArtifactsOptionsSchema>;
export declare const ARTIFACTS_PLUGIN_NAME = "artifacts";
export declare const ArtifactsOptionsSchema: z.ZodObject<{
artifacts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
namespace: z.ZodString;
remoteProxyConnectionString: z.ZodOptional<z.ZodType<RemoteProxyConnectionString, z.ZodTypeDef, RemoteProxyConnectionString>>;
}, "strip", z.ZodTypeAny, {
namespace: string;
remoteProxyConnectionString?: RemoteProxyConnectionString | undefined;
}, {
namespace: string;
remoteProxyConnectionString?: RemoteProxyConnectionString | undefined;
}>>>;
}, "strip", z.ZodTypeAny, {
artifacts?: Record<string, {
namespace: string;
remoteProxyConnectionString?: RemoteProxyConnectionString | undefined;
}> | undefined;
}, {
artifacts?: Record<string, {
namespace: string;
remoteProxyConnectionString?: RemoteProxyConnectionString | undefined;
}> | undefined;
}>;
export declare type AssetReverseMap = {
[pathHash: string]: {
filePath: string;
contentType: string | null;
};
};
export declare const ASSETS_PLUGIN: Plugin<typeof AssetsOptionsSchema>;
export declare const AssetsOptionsSchema: z.ZodObject<{
assets: z.ZodOptional<z.ZodObject<{
workerName: z.ZodOptional<z.ZodString>;
directory: z.ZodEffects<z.ZodString, string, string>;
binding: z.ZodOptional<z.ZodString>;
routerConfig: z.ZodOptional<z.ZodObject<{
account_id: z.ZodOptional<z.ZodNumber>;
script_id: z.ZodOptional<z.ZodNumber>;
debug: z.ZodOptional<z.ZodBoolean>;
invoke_user_worker_ahead_of_assets: z.ZodOptional<z.ZodBoolean>;
static_routing: z.ZodOptional<z.ZodObject<{
user_worker: z.ZodArray<z.ZodString, "many">;
asset_worker: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
}, "strip", z.ZodTypeAny, {
user_worker: string[];
asset_worker?: string[] | undefined;
}, {
user_worker: string[];
asset_worker?: string[] | undefined;
}>>;
has_user_worker: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
account_id?: number | undefined;
script_id?: number | undefined;
debug?: boolean | undefined;
invoke_user_worker_ahead_of_assets?: boolean | undefined;
static_routing?: {
user_worker: string[];
asset_worker?: string[] | undefined;
} | undefined;
has_user_worker?: boolean | undefined;
}, {
account_id?: number | undefined;
script_id?: number | undefined;
debug?: boolean | undefined;
invoke_user_worker_ahead_of_assets?: boolean | undefined;
static_routing?: {
user_worker: string[];
asset_worker?: string[] | undefined;
} | undefined;
has_user_worker?: boolean | undefined;
}>>;
assetConfig: z.ZodOptional<z.ZodObject<Omit<{
account_id: z.ZodOptional<z.ZodNumber>;
script_id: z.ZodOptional<z.ZodNumber>;
debug: z.ZodOptional<z.ZodBoolean>;
compatibility_date: z.ZodOptional<z.ZodString>;
compatibility_flags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
html_handling: z.ZodOptional<z.ZodEnum<["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"]>>;
not_found_handling: z.ZodOptional<z.ZodEnum<["single-page-application", "404-page", "none"]>>;
redirects: z.ZodOptional<z.ZodObject<{
version: z.ZodLiteral<1>;
staticRules: z.ZodRecord<z.ZodString, z.ZodObject<{
status: z.ZodNumber;
to: z.ZodString;
lineNumber: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
status: number;
to: string;
lineNumber: number;
}, {
status: number;
to: string;
lineNumber: number;
}>>;
rules: z.ZodRecord<z.ZodString, z.ZodObject<{
status: z.ZodNumber;
to: z.ZodString;
}, "strip", z.ZodTypeAny, {
status: number;
to: string;
}, {
status: number;
to: string;
}>>;
}, "strip", z.ZodTypeAny, {
version: 1;
staticRules: Record<string, {
status: number;
to: string;
lineNumber: number;
}>;
rules: Record<string, {
status: number;
to: string;
}>;
}, {
version: 1;
staticRules: Record<string, {
status: number;
to: string;
lineNumber: number;
}>;
rules: Record<string, {
status: number;
to: string;
}>;
}>>;
headers: z.ZodOptional<z.ZodObject<{
version: z.ZodLiteral<2>;
rules: z.ZodRecord<z.ZodString, z.ZodObject<{
set: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
unset: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
}, "strip", z.ZodTypeAny, {
set?: Record<string, string> | undefined;
unset?: string[] | undefined;
}, {
set?: Record<string, string> | undefined;
unset?: string[] | undefined;
}>>;
}, "strip", z.ZodTypeAny, {
version: 2;
rules: Record<string, {
set?: Record<string, string> | undefined;
unset?: string[] | undefined;
}>;
}, {
version: 2;
rules: Record<string, {
set?: Record<string, string> | undefined;
unset?: string[] | undefined;
}>;
}>>;
has_static_routing: z.ZodOptional<z.ZodBoolean>;
}, "compatibility_date" | "compatibility_flags">, "strip", z.ZodTypeAny, {
account_id?: number | undefined;
script_id?: number | undefined;
debug?: boolean | undefined;
html_handling?: "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash" | "none" | undefined;
not_found_handling?: "none" | "single-page-application" | "404-page" | undefined;
redirects?: {
version: 1;
staticRules: Record<string, {
status: number;
to: string;
lineNumber: number;
}>;
rules: Record<string, {
status: number;
to: string;
}>;
} | undefined;
headers?: {
version: 2;
rules: Record<string, {
set?: Record<string, string> | undefined;
unset?: string[] | undefined;
}>;
} | undefined;
has_static_routing?: boolean | undefined;
}, {
account_id?: number | undefined;
script_id?: number | undefined;
debug?: boolean | undefined;
html_handling?: "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash" | "none" | undefined;
not_found_handling?: "none" | "single-page-application" | "404-page" | undefined;
redirects?: {
version: 1;
staticRules: Record<string, {
status: number;
to: string;
lineNumber: number;
}>;
rules: Record<string, {
status: number;
to: string;
}>;
} | undefined;
headers?: {
version: 2;
rules: Record<string, {
set?: Record<string, string> | undefined;
unset?: string[] | undefined;
}>;
} | undefined;
has_static_routing?: boolean | undefined;
}>>;
}, "strip", z.ZodTypeAny, {
directory: string;
workerName?: string | undefined;
binding?: string | undefined;
routerConfig?: {
account_id?: number | undefined;
script_id?: number | undefined;
debug?: boolean | undefined;
invoke_user_worker_ahead_of_assets?: boolean | undefined;
static_routing?: {
user_worker: string[];
asset_worker?: string[] | undefined;
} | undefined;
has_user_worker?: boolean | undefined;
} | undefined;
assetConfig?: {
account_id?: number | undefined;
script_id?: number | undefined;
debug?: boolean | undefined;
html_handling?: "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash" | "none" | undefined;
not_found_handling?: "none" | "single-page-application" | "404-page" | undefined;
redirects?: {
version: 1;
staticRules: Record<string, {
status: number;
to: string;
lineNumber: number;
}>;
rules: Record<string, {
status: number;
to: string;
}>;
} | undefined;
headers?: {
version: 2;
rules: Record<string, {
set?: Record<string, string> | undefined;
unset?: string[] | undefined;
}>;
} | undefined;
has_static_routing?: boolean | undefined;
} | undefined;
}, {
directory: string;
workerName?: string | undefined;
binding?: string | undefined;
routerConfig?: {
account_id?: number | undefined;
script_id?: number | undefined;
debug?: boolean | undefined;
invoke_user_worker_ahead_of_assets?: boolean | undefined;
static_routing?: {
user_worker: string[];
asset_worker?: string[] | undefined;
} | undefined;
has_user_worker?: boolean | undefined;
} | undefined;
assetConfig?: {
account_id?: number | undefined;
script_id?: number | undefined;
debug?: boolean | undefined;
html_handling?: "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash" | "none" | undefined;
not_found_handling?: "none" | "single-page-application" | "404-page" | undefined;
redirects?: {
version: 1;
staticRules: Record<string, {
status: number;
to: string;
lineNumber: number;
}>;
rules: Record<string, {
status: number;
to: string;
}>;
} | undefined;
headers?: {
version: 2;
rules: Record<string, {
set?: Record<string, string> | undefined;
unset?: string[] | undefined;
}>;
} | undefined;
has_static_routing?: boolean | undefined;
} | undefined;
}>>;
compatibilityDate: z.ZodOptional<z.ZodString>;
compatibilityFlags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
}, "strip", z.ZodTypeAny, {
compatibilityDate?: string | undefined;
compatibilityFlags?: string[] | undefined;
assets?: {
directory: string;
workerName?: string | undefined;
binding?: string | undefined;
routerConfig?: {
account_id?: number | undefined;
script_id?: number | undefined;
debug?: boolean | undefined;
invoke_user_worker_ahead_of_assets?: boolean | undefined;
static_routing?: {
user_worker: string[];
asset_worker?: string[] | undefined;
} | undefined;
has_user_worker?: boolean | undefined;
} | undefined;
assetConfig?: {
account_id?: number | undefined;
script_id?: number | undefined;
debug?: boolean | undefined;
html_handling?: "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash" | "none" | undefined;
not_found_handling?: "none" | "single-page-application" | "404-page" | undefined;
redirects?: {
version: 1;
staticRules: Record<string, {
status: number;
to: string;
lineNumber: number;
}>;
rules: Record<string, {
status: number;
to: string;
}>;
} | undefined;
headers?: {
version: 2;
rules: Record<string, {
set?: Record<string, string> | undefined;
unset?: string[] | undefined;
}>;
} | undefined;
has_static_routing?: boolean | undefined;
} | undefined;
} | undefined;
}, {
compatibilityDate?: string | undefined;
compatibilityFlags?: string[] | undefined;
assets?: {
directory: string;
workerName?: string | undefined;
binding?: string | undefined;
routerConfig?: {
account_id?: number | undefined;
script_id?: number | undefined;
debug?: boolean | undefined;
invoke_user_worker_ahead_of_assets?: boolean | undefined;
static_routing?: {
user_worker: string[];
asset_worker?: string[] | undefined;
} | undefined;
has_user_worker?: boolean | undefined;
} | undefined;
assetConfig?: {
account_id?: number | undefined;
script_id?: number | undefined;
debug?: boolean | undefined;
html_handling?: "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash" | "none" | undefined;
not_found_handling?: "none" | "single-page-application" | "404-page" | undefined;
redirects?: {
version: 1;
staticRules: Record<string, {
status: number;
to: string;
lineNumber: number;
}>;
rules: Record<string, {
status: number;
to: string;
}>;
} | undefined;
headers?: {
version: 2;
rules: Record<string, {
set?: Record<string, string> | undefined;
unset?: string[] | undefined;
}>;
} | undefined;
has_static_routing?: boolean | undefined;
} | undefined;
} | undefined;
}>;
export declare type Awaitable<T> = T | Promise<T>;
export declare function base64Decode(encoded: string): string;
export declare function base64Encode(value: string): string;
export { BodyInit }
export declare const BROWSER_RENDERING_PLUGIN: Plugin<typeof BrowserRenderingOptionsSchema>;
export declare const BROWSER_RENDERING_PLUGIN_NAME = "browser-rendering";
export declare const BrowserRenderingOptionsSchema: z.ZodObject<{
browserRendering: z.ZodOptional<z.ZodObject<{
binding: z.ZodString;
remoteProxyConnectionString: z.ZodOptional<z.ZodType<RemoteProxyConnectionString, z.ZodTypeDef, RemoteProxyConnectionString>>;
headful: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
binding: string;
remoteProxyConnectionString?: RemoteProxyConnectionString | undefined;
headful?: boolean | undefined;
}, {
binding: string;
remoteProxyConnectionString?: RemoteProxyConnectionString | undefined;
headful?: boolean | undefined;
}>>;
}, "strip", z.ZodTypeAny, {
browserRendering?: {
binding: string;
remoteProxyConnectionString?: RemoteProxyConnectionString | undefined;
headful?: boolean | undefined;
} | undefined;
}, {
browserRendering?: {
binding: string;
remoteProxyConnectionString?: RemoteProxyConnectionString | undefined;
headful?: boolean | undefined;
} | undefined;
}>;
/**
* The Asset Manifest and Asset Reverse Map are used to map a request path to an asset.
* 1. Hash path of request
* 2. Use this path hash to find the manifest entry
* 3. Get content hash from manifest entry
* 4a. In prod, use content hash to get asset from KV
* 4b. In dev, we fake out the KV store and use the file system instead.
* Use content hash to get file path from asset reverse map.
*/
export declare const buildAssetManifest: (dir: string) => Promise<{
encodedAssetManifest: Uint8Array<ArrayBuffer>;
assetsReverseMap: AssetReverseMap;
}>;
/**
* Builds a client-reachable URL for a local server given host, port, and
* secure flag. Handles IPv6 bracketing and wildcard-address normalization
* so the resulting string is always a valid URL.
*/
export declare function buildPublicUrl(options: {
hostname?: string;
port: number;
secure?: boolean;
}): string;
export declare const CACHE_PLUGIN: Plugin<typeof CacheOptionsSchema, typeof CacheSharedOptionsSchema>;
export declare const CACHE_PLUGIN_NAME = "cache";
export declare const CacheBindings: {
readonly MAYBE_JSON_CACHE_WARN_USAGE: "MINIFLARE_CACHE_WARN_USAGE";
};
export declare const CacheHeaders: {
readonly NAMESPACE: "cf-cache-namespace";
readonly STATUS: "cf-cache-status";
};
export declare interface CacheObjectCf {
miniflare?: {
cacheWarnUsage?: boolean;
};
}
export declare const CacheOptionsSchema: z.ZodObject<{
cache: z.ZodOptional<z.ZodBoolean>;
cacheWarnUsage: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
cache?: boolean | undefined;
cacheWarnUsage?: boolean | undefined;
}, {
cache?: boolean | undefined;
cacheWarnUsage?: boolean | undefined;
}>;
export declare const CacheSharedOptionsSchema: z.ZodObject<{
cachePersist: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodString, z.ZodEffects<z.ZodString, string, string>]>>;
}, "strip", z.ZodTypeAny, {
cachePersist?: string | boolean | undefined;
}, {
cachePersist?: string | boolean | undefined;
}>;
export declare class CloseEvent extends Event {
readonly code: number;
readonly reason: string;
readonly wasClean: boolean;
constructor(type: "close", init?: {
code?: number;
reason?: string;
wasClean?: boolean;
});
}
export declare interface CompiledModuleRule {
type: ModuleRuleType;
include: MatcherRegExps;
}
export declare function compileModuleRules(rules: ModuleRule[]): CompiledModuleRule[];
export declare interface Config {
services?: Service[];
sockets?: Socket[];
v8Flags?: string[];
extensions?: Extension[];
autogates?: string[];
structuredLogging?: boolean;
}
export declare const CORE_PLUGIN: Plugin<typeof CoreOptionsSchema, typeof CoreSharedOptionsSchema>;
export declare const CORE_PLUGIN_NAME = "core";
export declare const CoreBindings: {
readonly SERVICE_LOOPBACK: "MINIFLARE_LOOPBACK";
readonly SERVICE_USER_ROUTE_PREFIX: "MINIFLARE_USER_ROUTE_";
readonly SERVICE_USER_FALLBACK: "MINIFLARE_USER_FALLBACK";
readonly TEXT_CUSTOM_SERVICE: "MINIFLARE_CUSTOM_SERVICE";
readonly IMAGES_BINDING_SERVICE: "MINIFLARE_IMAGES_BINDING_SERVICE";
readonly IMAGES_FETCH_SERVICE: "MINIFLARE_IMAGES_FETCH_SERVICE";
readonly TEXT_UPSTREAM_URL: "MINIFLARE_UPSTREAM_URL";
readonly JSON_CF_BLOB: "CF_BLOB";
readonly JSON_ROUTES: "MINIFLARE_ROUTES";
readonly JSON_LOG_LEVEL: "MINIFLARE_LOG_LEVEL";
readonly DATA_LIVE_RELOAD_SCRIPT: "MINIFLARE_LIVE_RELOAD_SCRIPT";
readonly DURABLE_OBJECT_NAMESPACE_PROXY: "MINIFLARE_PROXY";
readonly DATA_PROXY_SECRET: "MINIFLARE_PROXY_SECRET";
readonly DATA_PROXY_SHARED_SECRET: "MINIFLARE_PROXY_SHARED_SECRET";
readonly TRIGGER_HANDLERS: "TRIGGER_HANDLERS";
readonly LOG_REQUESTS: "LOG_REQUESTS";
readonly STRIP_DISABLE_PRETTY_ERROR: "STRIP_DISABLE_PRETTY_ERROR";
readonly SERVICE_LOCAL_EXPLORER: "MINIFLARE_LOCAL_EXPLORER";
readonly EXPLORER_DISK: "MINIFLARE_EXPLORER_DISK";
readonly JSON_LOCAL_EXPLORER_BINDING_MAP: "LOCAL_EXPLORER_BINDING_MAP";
readonly JSON_LOCAL_EXPLORER_WORKER_NAMES: "LOCAL_EXPLORER_WORKER_NAMES";
readonly JSON_EXPLORER_WORKER_OPTS: "MINIFLARE_EXPLORER_WORKER_OPTS";
readonly SERVICE_CACHE: "MINIFLARE_CACHE";
readonly SERVICE_DEV_REGISTRY_PROXY: "MINIFLARE_DEV_REGISTRY_PROXY";
readonly JSON_TELEMETRY_CONFIG: "MINIFLARE_TELEMETRY_CONFIG";
readonly DEV_REGISTRY_DEBUG_PORT: "DEV_REGISTRY_DEBUG_PORT";
readonly SERVICE_STREAM: "MINIFLARE_STREAM";
readonly SERVICE_IMAGES_DELIVERY: "MINIFLARE_IMAGES_DELIVERY";
readonly SERVICE_R2_PUBLIC: "MINIFLARE_R2_PUBLIC";
};
export declare const CoreHeaders: {
readonly CUSTOM_FETCH_SERVICE: "MF-Custom-Fetch-Service";
readonly CUSTOM_NODE_SERVICE: "MF-Custom-Node-Service";
readonly ORIGINAL_URL: "MF-Original-URL";
/**
* Stores the original hostname when using the `upstream` option.
* When requests are proxied to an upstream, the `Host` header is rewritten
* to match the upstream. This header preserves the original hostname
* so Workers can access it if needed.
*/
readonly ORIGINAL_HOSTNAME: "MF-Original-Hostname";
readonly PROXY_SHARED_SECRET: "MF-Proxy-Shared-Secret";
readonly DISABLE_PRETTY_ERROR: "MF-Disable-Pretty-Error";
readonly ERROR_STACK: "MF-Experimental-Error-Stack";
readonly ROUTE_OVERRIDE: "MF-Route-Override";
readonly CF_BLOB: "MF-CF-Blob";
/** Used by the Vite plugin to pass through the original `sec-fetch-mode` header */
readonly SEC_FETCH_MODE: "MF-Sec-Fetch-Mode";
readonly OP_SECRET: "MF-Op-Secret";
readonly OP: "MF-Op";
readonly OP_TARGET: "MF-Op-Target";
readonly OP_KEY: "MF-Op-Key";
readonly OP_SYNC: "MF-Op-Sync";
readonly OP_STRINGIFIED_SIZE: "MF-Op-Stringified-Size";
readonly OP_RESULT_TYPE: "MF-Op-Result-Type";
readonly OP_ORIGINAL_URL: "MF-Op-Original-URL";
};
export declare const CoreOptionsSchema: z.ZodEffects<z.ZodIntersection<z.ZodUnion<[z.ZodObject<{
modules: z.ZodArray<z.ZodObject<{
type: z.ZodEnum<["ESModule", "CommonJS", "Text", "Data", "CompiledWasm", "PythonModule", "PythonRequirement"]>;
path: z.ZodEffects<z.ZodString, string, string>;
contents: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>]>>;
}, "strip", z.ZodTypeAny, {
path: string;
type: "ESModule" | "CommonJS" | "Text" | "Data" | "CompiledWasm" | "PythonModule" | "PythonRequirement";
contents?: string | Uint8Array<ArrayBuffer> | undefined;
}, {
path: string;
type: "ESModule" | "CommonJS" | "Text" | "Data" | "CompiledWasm" | "PythonModule" | "PythonRequirement";
contents?: string | Uint8Array<ArrayBuffer> | undefined;
}>, "many">;
modulesRoot: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
}, "strip", z.ZodTypeAny, {
modules: {
path: string;
type: "ESModule" | "CommonJS" | "Text" | "Data" | "CompiledWasm" | "PythonModule" | "PythonRequirement";
contents?: string | Uint8Array<ArrayBuffer> | undefined;
}[];
modulesRoot?: string | undefined;
}, {
modules: {
path: string;
type: "ESModule" | "CommonJS" | "Text" | "Data" | "CompiledWasm" | "PythonModule" | "PythonRequirement";
contents?: string | Uint8Array<ArrayBuffer> | undefined;
}[];
modulesRoot?: string | undefined;
}>, z.ZodObject<{
script: z.ZodString;
scriptPath: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
modules: z.ZodOptional<z.ZodBoolean>;
modulesRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
type: z.ZodEnum<["ESModule", "CommonJS", "Text", "Data", "CompiledWasm", "PythonModule", "PythonRequirement"]>;
include: z.ZodArray<z.ZodString, "many">;
fallthrough: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
type: "ESModule" | "CommonJS" | "Text" | "Data" | "CompiledWasm" | "PythonModule" | "PythonRequirement";
include: string[];
fallthrough?: boolean | undefined;
}, {
type: "ESModule" | "CommonJS" | "Text" | "Data" | "CompiledWasm" | "PythonModule" | "PythonRequirement";
include: string[];
fallthrough?: boolean | undefined;
}>, "many">>;
modulesRoot: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
}, "strip", z.ZodTypeAny, {
script: string;
modules?: boolean | undefined;
modulesRoot?: string | undefined;
scriptPath?: string | undefined;
modulesRules?: {
type: "ESModule" | "CommonJS" | "Text" | "Data" | "CompiledWasm" | "PythonModule" | "PythonRequirement";
include: string[];
fallthrough?: boolean | undefined;
}[] | undefined;
}, {
script: string;
modules?: boolean | undefined;
modulesRoot?: string | undefined;
scriptPath?: string | undefined;
modulesRules?: {
type: "ESModule" | "CommonJS" | "Text" | "Data" | "CompiledWasm" | "PythonModule" | "PythonRequirement";
include: string[];
fallthrough?: boolean | undefined;
}[] | undefined;
}>, z.ZodObject<{
scriptPath: z.ZodEffects<z.ZodString, string, string>;
modules: z.ZodOptional<z.ZodBoolean>;
modulesRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
type: z.ZodEnum<["ESModule", "CommonJS", "Text", "Data", "CompiledWasm", "PythonModule", "PythonRequirement"]>;
include: z.ZodArray<z.ZodString, "many">;
fallthrough: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
type: "ESModule" | "CommonJS" | "Text" | "Data" | "CompiledWasm" | "PythonModule" | "PythonRequirement";
include: string[];
fallthrough?: boolean | undefined;
}, {
type: "ESModule" | "CommonJS" | "Text" | "Data" | "CompiledWasm" | "PythonModule" | "PythonRequirement";
include: string[];
fallthrough?: boolean | undefined;
}>, "many">>;
modulesRoot: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
}, "strip", z.ZodTypeAny, {
scriptPath: string;
modules?: boolean | undefined;
modulesRoot?: string | undefined;
modulesRules?: {
type: "ESModule" | "CommonJS" | "Text" | "Data" | "CompiledWasm" | "PythonModule" | "PythonRequirement";
include: string[];
fallthrough?: boolean | undefined;
}[] | undefined;
}, {
scriptPath: string;
modules?: boolean | undefined;
modulesRoot?: string | undefined;
modulesRules?: {
type: "ESModule" | "CommonJS" | "Text" | "Data" | "CompiledWasm" | "PythonModule" | "PythonRequirement";
include: string[];
fallthrough?: boolean | undefined;
}[] | undefined;
}>]>, z.ZodObject<{
name: z.ZodOptional<z.ZodString>;
rootPath: z.ZodOptional<z.ZodEffects<z.ZodString, undefined, string>>;
compatibilityDate: z.ZodOptional<z.ZodString>;
compatibilityFlags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
unsafeInspectorProxy: z.ZodOptional<z.ZodBoolean>;
routes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
bindings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<Json, z.ZodTypeDef, Json>>>;
wasmBindings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>]>>>;
textBlobBindings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>>;
dataBlobBindings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>]>>>;
serviceBindings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodLiteral<typeof kCurrentWorker>, z.ZodObject<{
name: z.ZodUnion<[z.ZodString, z.ZodLiteral<typeof kCurrentWorker>]>;
entrypoint: z.ZodOptional<z.ZodString>;
props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
remoteProxyConnectionString: z.ZodOptional<z.ZodType<RemoteProxyConnectionString_2, z.ZodTypeDef, RemoteProxyConnectionString_2>>;
}, "strip", z.ZodTypeAny, {
name: string | typeof kCurrentWorker;
entrypoint?: string | undefined;
props?: Record<string, unknown> | undefined;
remoteProxyConnectionString?: RemoteProxyConnectionString_2 | undefined;
}, {
name: string | typeof kCurrentWorker;
entrypoint?: string | undefined;
props?: Record<string, unknown> | undefined;
remoteProxyConnectionString?: RemoteProxyConnectionString_2 | undefined;
}>, z.ZodObject<{
network: z.ZodObject<{
allow: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
deny: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
tlsOptions: z.ZodOptional<z.ZodObject<{
keypair: z.ZodOptional<z.ZodObject<{
privateKey: z.ZodOptional<z.ZodString>;
certificateChain: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
privateKey?: string | undefined;
certificateChain?: string | undefined;
}, {
privateKey?: string | undefined;
certificateChain?: string | undefined;
}>>;
requireClientCerts: z.ZodOptional<z.ZodBoolean>;
trustBrowserCas: z.ZodOptional<z.ZodBoolean>;
trustedCertificates: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
minVersion: z.ZodOptional<z.ZodNativeEnum<{
readonly GOOD_DEFAULT: 0;
readonly SSL3: 1;
readonly TLS1DOT0: 2;
readonly TLS1DOT1: 3;
readonly TLS1DOT2: 4;
readonly TLS1DOT3: 5;
}>>;
cipherList: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
keypair?: {
privateKey?: string | undefined;
certificateChain?: string | undefined;
} | undefined;
requireClientCerts?: boolean | undefined;
trustBrowserCas?: boolean | undefined;
trustedCertificates?: string[] | undefined;
minVersion?: 0 | 1 | 2 | 4 | 3 | 5 | undefined;
cipherList?: string | undefined;
}, {
keypair?: {
privateKey?: string | undefined;
certificateChain?: string | undefined;
} | undefined;
requireClientCerts?: boolean | undefined;
trustBrowserCas?: boolean | undefined;
trustedCertificates?: string[] | undefined;
minVersion?: 0 | 1 | 2 | 4 | 3 | 5 | undefined;
cipherList?: string | undefined;
}>>;
}, "strip", z.ZodTypeAny, {
allow?: string[] | undefined;
deny?: string[] | undefined;
tlsOptions?: {
keypair?: {
privateKey?: string | undefined;
certificateChain?: string | undefined;
} | undefined;
requireClientCerts?: boolean | undefined;
trustBrowserCas?: boolean | undefined;
trustedCertificates?: string[] | undefined;
minVersion?: 0 | 1 | 2 | 4 | 3 | 5 | undefined;
cipherList?: string | undefined;
} | undefined;
}, {
allow?: string[] | undefined;
deny?: string[] | undefined;
tlsOptions?: {
keypair?: {
privateKey?: string | undefined;
certificateChain?: string | undefined;
} | undefined;
requireClientCerts?: boolean | undefined;
trustBrowserCas?: boolean | undefined;
trustedCertificates?: string[] | undefined;
minVersion?: 0 | 1 | 2 | 4 | 3 | 5 | undefined;
cipherList?: string | undefined;
} | undefined;
}>;
}, "strip", z.ZodTypeAny, {
network: {
allow?: string[] | undefined;
deny?: string[] | undefined;
tlsOptions?: {
keypair?: {
privateKey?: string | undefined;
certificateChain?: string | undefined;
} | undefined;
requireClientCerts?: boolean | undefined;
trustBrowserCas?: boolean | undefined;
trustedCertificates?: string[] | undefined;
minVersion?: 0 | 1 | 2 | 4 | 3 | 5 | undefined;
cipherList?: string | undefined;
} | undefined;
};
}, {
network: {
allow?: string[] | undefined;
deny?: string[] | undefined;
tlsOptions?: {
keypair?: {
privateKey?: string | undefined;
certificateChain?: string | undefined;
} | undefined;
requireClientCerts?: boolean | undefined;
trustBrowserCas?: boolean | undefined;
trustedCertificates?: string[] | undefined;
minVersion?: 0 | 1 | 2 | 4 | 3 | 5 | undefined;
cipherList?: string | undefined;
} | undefined;
};
}>, z.ZodObject<{
external: z.ZodType<ExternalServer_2, z.ZodTypeDef, ExternalServer_2>;
}, "strip", z.ZodTypeAny, {
external: ExternalServer_2;
}, {
external: ExternalServer_2;
}>, z.ZodObject<{
disk: z.ZodObject<{
path: z.ZodString;
writable: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
path: string;
writable?: boolean | undefined;
}, {
path: string;
writable?: boolean | undefined;
}>;
}, "strip", z.ZodTypeAny, {
disk: {
path: string;
writable?: boolean | undefined;
};
}, {
disk: {
path: string;
writable?: boolean | undefined;
};
}>, z.ZodObject<{
node: z.ZodType<(req: IncomingMessage, res: ServerResponse, miniflare: Miniflare_2) => Awaitable<void>, z.ZodTypeDef, (req: IncomingMessage, res: ServerResponse, miniflare: Miniflare_2) => Awaitable<void>>;
}, "strip", z.ZodTypeAny, {
node: (req: IncomingMessage, res: ServerResponse, miniflare: Miniflare_2) => Awaitable<void>;
}, {
node: (req: IncomingMessage, res: ServerResponse, miniflare: Miniflare_2) => Awaitable<void>;
}>, z.ZodType<(request: Request_3, miniflare: Miniflare_2) => Awaitable<Response_3>, z.ZodTypeDef, (request: Request_3, miniflare: Miniflare_2) => Awaitable<Response_3>>]>>>;
wrappedBindings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodObject<{
scriptName: z.ZodString;
entrypoint: z.ZodOptional<z.ZodString>;
bindings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<Json, z.ZodTypeDef, Json>>>;
}, "strip", z.ZodTypeAny, {
scriptName: string;
bindings?: Record<string, Json> | undefined;
entrypoint?: string | undefined;
}, {
scriptName: string;
bindings?: Record<string, Json> | undefined;
entrypoint?: string | undefined;
}>]>>>;
outboundService: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodLiteral<typeof kCurrentWorker>, z.ZodObject<{
name: z.ZodUnion<[z.ZodString, z.ZodLiteral<typeof kCurrentWorker>]>;
entrypoint: z.ZodOptional<z.ZodString>;
props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
remoteProxyConnectionString: z.ZodOptional<z.ZodType<RemoteProxyConnectionString_2, z.ZodTypeDef, RemoteProxyConnectionString_2>>;
}, "strip", z.ZodTypeAny, {
name: string | typeof kCurrentWorker;
entrypoint?: string | undefined;
props?: Record<string, unknown> | undefined;
remoteProxyConnectionString?: RemoteProxyConnectionString_2 | undefined;
}, {
name: string | typeof kCurrentWorker;
entrypoint?: string | undefined;
props?: Record<string, unknown> | undefined;
remoteProxyConnectionString?: RemoteProxyConnectionString_2 | undefined;
}>, z.ZodObject<{
network: z.ZodObject<{
allow: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
deny: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
tlsOptions: z.ZodOptional<z.ZodObject<{
keypair: z.ZodOptional<z.ZodObject<{
privateKey: z.ZodOptional<z.ZodString>;
certificateChain: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
privateKey?: string | undefined;
certificateChain?: string | undefined;
}, {
privateKey?: string | undefined;
certificateChain?: string | undefined;
}>>;
requireClientCerts: z.ZodOptional<z.ZodBoolean>;
trustBrowserCas: z.ZodOptional<z.ZodBoolean>;
trustedCertificates: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
minVersion: z.ZodOptional<z.ZodNativeEnum<{