prisma-zod-generator
Version:
Prisma 2+ generator to emit Zod schemas from your Prisma schema
20 lines (19 loc) • 946 B
TypeScript
import type { BuiltInParserName } from 'prettier';
/**
* Pick a Prettier parser from the target file name.
*
* Returns `undefined` for formats Prettier has no parser for (`.sql`, `.py`,
* `.txt`, …). Callers must treat that as "write this content verbatim" — it is
* not an error. Historically every write was parsed as TypeScript, so any
* non-TS artefact threw and was dropped by writeFileSafely's catch.
*/
export declare function parserForFile(filePath: string): BuiltInParserName | undefined;
/**
* Format `content` with Prettier.
*
* `filePath` selects the parser. When it is omitted the content is parsed as
* TypeScript, preserving the original behaviour for the core schema writers.
* Content that Prettier cannot parse is returned unchanged rather than throwing,
* so a formatting problem can never cost the caller its file.
*/
export declare const formatFile: (content: string, filePath?: string) => Promise<string>;