import * as miniflare0 from "miniflare"; import { LegacyWorkerOptions, Miniflare, Request, Response, V4ModuleRule } from "miniflare"; import { z } from "zod"; import { PoolRunnerInitializer, TestProject, Vite, Vitest } from "vitest/node"; import { ProvidedContext } from "vitest"; //#region src/pool/config.d.ts declare const WorkersPoolOptionsSchema: z.ZodObject<{ main: z.ZodOptional; remoteBindings: z.ZodDefault; verbose: z.ZodOptional; additionalExports: z.ZodDefault, z.ZodLiteral<"DurableObject">, z.ZodLiteral<"WorkflowEntrypoint">]>>>; miniflare: z.ZodOptional>>; }, z.core.$loose>>; wrangler: z.ZodOptional; environment: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; type CompatibleWorkerOptions = LegacyWorkerOptions & { /** @deprecated Use `cacheAPI` instead. */ cache?: LegacyWorkerOptions["cacheAPI"]; }; type SourcelessWorkerOptions = Omit & { modulesRules?: V4ModuleRule[]; }; type WorkersPoolOptions = z.input & { miniflare?: SourcelessWorkerOptions & { workers?: CompatibleWorkerOptions[]; }; }; type WorkersPoolOptionsWithDefines = WorkersPoolOptions & { defines?: Record; moduleRules?: V4ModuleRule[]; }; //#endregion //#region src/pool/plugin.d.ts type ProvidedContextKeys = keyof ProvidedContext & string; declare const explicitInjectTypeArgumentRequired: unique symbol; type ExplicitInjectTypeArgumentRequired = { readonly [explicitInjectTypeArgumentRequired]: never; }; type WorkerPoolOptionsContextInject = [ProvidedContextKeys] extends [never] ? (key: string) => T : { (key: K): ProvidedContext[K]; (key: string & (T extends ExplicitInjectTypeArgumentRequired ? never : unknown)): T; }; interface WorkerPoolOptionsContext { /** * Access values provided by `globalSetup()` (e.g. ports of servers started * during setup) for use in Miniflare options (e.g. bindings, upstream, * hyperdrives, ...). * * Known `ProvidedContext` keys preserve Vitest's inference and key checking * when the consuming project's augmentation is visible. Use an explicit type * argument for keys provided at runtime but not declared in `ProvidedContext`. * If pnpm resolves a separate Vitest copy and the keys collapse to `never`, * fall back to the wider inject signature instead. */ inject: WorkerPoolOptionsContextInject; } declare function cloudflareTest(options: WorkersPoolOptions | ((ctx: WorkerPoolOptionsContext) => Promise | WorkersPoolOptions)): Vite.Plugin; //#endregion //#region src/pool/pool.d.ts declare function cloudflarePool(poolOptions: WorkersPoolOptions | ((ctx: WorkerPoolOptionsContext) => Promise | WorkersPoolOptions)): PoolRunnerInitializer; //#endregion //#region src/shared/d1.d.ts type D1Migration = { name: string; queries: string[]; }; //#endregion //#region src/pool/d1.d.ts /** * Reads all migrations in `migrationsPath`, ordered by migration number. * Each migration will have its contents split into an array of SQL queries. */ declare function readD1Migrations(migrationsPath: string): Promise; //#endregion //#region src/pool/pages.d.ts declare function poolWorkerStarted(): void; declare function poolWorkerStopped(): void; declare function buildPagesASSETSBinding(assetsPath: string): Promise<(request: Request) => Promise>; //#endregion //#region src/pool/index.d.ts declare function structuredSerializableStringify(value: unknown): string; declare function structuredSerializableParse(value: string): unknown; declare function getRunnerName(project: TestProject, testFile?: string): string; interface DurableObjectDesignator { className: string; scriptName?: string; unsafeUniqueKey?: string; } /** * Returns a map of Durable Objects bindings' bound names to the designators of * the objects they point to. */ declare function getDurableObjectDesignators(options: WorkersPoolOptions): Map; declare function getProjectMiniflare(ctx: Vitest, project: TestProject, poolOptions: WorkersPoolOptionsWithDefines, main: string | undefined): Promise; declare function maybeGetResolvedMainPath(project: TestProject, options: WorkersPoolOptionsWithDefines): string | undefined; declare function connectToMiniflareSocket(mf: Miniflare, workerName: string): Promise; declare function assertCompatibleVitestVersion(ctx: Vitest): void; //#endregion export { type D1Migration, assertCompatibleVitestVersion, buildPagesASSETSBinding, cloudflarePool, cloudflareTest, connectToMiniflareSocket, getDurableObjectDesignators, getProjectMiniflare, getRunnerName, maybeGetResolvedMainPath, poolWorkerStarted, poolWorkerStopped, readD1Migrations, structuredSerializableParse, structuredSerializableStringify }; //# sourceMappingURL=index.d.mts.map