1 | import ts from 'typescript';
|
2 | import type { Commands, KeysOf, SourceTemplateData, TemplateHelper } from './types';
|
3 | export declare class TsWriter<H extends readonly TemplateHelper[] | undefined = readonly TemplateHelper[] | undefined> {
|
4 | readonly helpers?: H | undefined;
|
5 | |
6 |
|
7 |
|
8 |
|
9 |
|
10 | readonly sources: Record<string, string[]>;
|
11 | private outputs;
|
12 | readonly host: ts.CompilerHost;
|
13 | readonly compilerOptions: ts.CompilerOptions;
|
14 | |
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 | constructor(optionsOrTsconfigPath: ts.CompilerOptions | string, helpers?: H | undefined);
|
21 | /**
|
22 | * Collects all the written files and uses typescript to transpile them.
|
23 | *
|
24 | * @returns The result of the transpilation from typescript.
|
25 | */
|
26 | transpile(): Record<string, string>;
|
27 | /**
|
28 | * Generates the code to be written in the provided file. The first argument is an
|
29 | * object with the variables to be used in the template, as well the filename. The rest
|
30 | * of the arguments are the templates to be written in the file.
|
31 | */
|
32 | write<D extends SourceTemplateData<H>, P extends KeysOf<Omit<D, 'helpers'>>[]>(template: TemplateStringsArray, data: D, ...keys: Commands<P[number], D & {
|
33 | helpers: H;
|
34 | }>[]): void;
|
35 | /**
|
36 | * Generates the code to be written **ON TOP** in the provided file. The first argument
|
37 | * is an object with the variables to be used in the template, as well the filename. The
|
38 | * rest of the arguments are the templates to be written in the file.
|
39 | */
|
40 | head<D extends SourceTemplateData<H>, P extends KeysOf<Omit<D, 'helpers'>>[]>(template: TemplateStringsArray, data: D, ...keys: Commands<P[number], D & {
|
41 | helpers: H;
|
42 | }>[]): void;
|
43 | /**
|
44 | * Generates the code to be written in the provided file **ONLY IF NOT ALREADY
|
45 | * WRITTEN**. The first argument is an object with the variables to be used in the
|
46 | * template, as well the filename. The rest of the arguments are the templates to be
|
47 | * written in the file.
|
48 | */
|
49 | writeUnique<D extends SourceTemplateData<H>, P extends KeysOf<Omit<D, 'helpers'>>[]>(template: TemplateStringsArray, data: D, ...keys: Commands<P[number], D & {
|
50 | helpers: H;
|
51 | }>[]): void;
|
52 | /**
|
53 | * Generates the code to be written **ON TOP** in the provided file **ONLY IF NOT
|
54 | * ALREADY WRITTEN**. The first argument is an object with the variables to be used in
|
55 | * the template, as well the filename. The rest of the arguments are the templates to be
|
56 | * written in the file.
|
57 | */
|
58 | headUnique<D extends SourceTemplateData<H>, P extends KeysOf<Omit<D, 'helpers'>>[]>(template: TemplateStringsArray, data: D, ...keys: Commands<P[number], D & {
|
59 | helpers: H;
|
60 | }>[]): void;
|
61 | }
|
62 | //# sourceMappingURL=writer.d.ts.map |
\ | No newline at end of file |