MCPcopy
hub / github.com/prisma/prisma / File

Class File

packages/ts-builders/src/File.ts:9–35  ·  packages/ts-builders/src/File.ts::File

Source from the content-addressed store, hash-verified

7
8export type FileItem = AnyDeclarationBuilder | Export<any> | ExportFrom
9export class File implements BasicBuilder {
10 private imports: Import[] = []
11 private declarations: FileItem[] = []
12
13 addImport(moduleImport: Import) {
14 this.imports.push(moduleImport)
15 return this
16 }
17 add(declaration: FileItem) {
18 this.declarations.push(declaration)
19 }
20
21 write(writer: Writer<undefined>): void {
22 for (const moduleImport of this.imports) {
23 writer.writeLine(moduleImport)
24 }
25 if (this.imports.length > 0) {
26 writer.newLine()
27 }
28 for (const [i, declaration] of this.declarations.entries()) {
29 writer.writeLine(declaration)
30 if (i < this.declarations.length - 1) {
31 writer.newLine()
32 }
33 }
34 }
35}
36
37export function file(): File {
38 return new File()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected