1 | import * as ts from 'typescript';
|
2 | import { Emitter } from './emitter';
|
3 | import { ProjectInfo } from './project-info';
|
4 | import { TypeScriptConfigValidationRuleSet } from './tsconfig';
|
5 | export declare const DIAGNOSTICS = "diagnostics";
|
6 | export declare const JSII_DIAGNOSTICS_CODE = 9999;
|
7 | export interface CompilerOptions {
|
8 |
|
9 | projectInfo: ProjectInfo;
|
10 |
|
11 | watch?: boolean;
|
12 |
|
13 | projectReferences?: boolean;
|
14 |
|
15 | failOnWarnings?: boolean;
|
16 |
|
17 | stripDeprecated?: boolean;
|
18 |
|
19 | stripDeprecatedAllowListFile?: string;
|
20 |
|
21 | addDeprecationWarnings?: boolean;
|
22 | |
23 |
|
24 |
|
25 |
|
26 |
|
27 | generateTypeScriptConfig?: string;
|
28 | |
29 |
|
30 |
|
31 |
|
32 |
|
33 | typeScriptConfig?: string;
|
34 | |
35 |
|
36 |
|
37 |
|
38 |
|
39 | validateTypeScriptConfig?: TypeScriptConfigValidationRuleSet;
|
40 | |
41 |
|
42 |
|
43 |
|
44 | compressAssembly?: boolean;
|
45 | }
|
46 | export declare class Compiler implements Emitter {
|
47 | private readonly options;
|
48 | private readonly system;
|
49 | private readonly compilerHost;
|
50 | private readonly userProvidedTypeScriptConfig;
|
51 | private readonly tsconfig;
|
52 | private rootFiles;
|
53 | private readonly configPath;
|
54 | private readonly projectRoot;
|
55 | constructor(options: CompilerOptions);
|
56 | /**
|
57 | * Compiles the configured program.
|
58 | *
|
59 | * @param files can be specified to override the standard source code location logic. Useful for example when testing "negatives".
|
60 | */
|
61 | emit(...files: string[]): ts.EmitResult;
|
62 | /**
|
63 | * Watches for file-system changes and dynamically recompiles the project as needed. In blocking mode, this results
|
64 | * in a never-resolving promise.
|
65 | */
|
66 | watch(): Promise<never>;
|
67 | /**
|
68 | * Prepares the project for build, by creating the necessary configuration
|
69 | * file(s), and assigning the relevant root file(s).
|
70 | *
|
71 | * @param files the files that were specified as input in the CLI invocation.
|
72 | */
|
73 | private configureTypeScript;
|
74 | /**
|
75 | * Final preparations of the project for build.
|
76 | *
|
77 | * These are preparations that either
|
78 | * - must happen immediately before the build, or
|
79 | * - can be different for every build like assigning the relevant root file(s).
|
80 | *
|
81 | * @param files the files that were specified as input in the CLI invocation.
|
82 | */
|
83 | private prepareForBuild;
|
84 | /**
|
85 | * Do a single build
|
86 | */
|
87 | private buildOnce;
|
88 | private consumeProgram;
|
89 | /**
|
90 | * Build the TypeScript config object from jsii config
|
91 | *
|
92 | * This is the object that will be written to disk
|
93 | * unless an existing tsconfig was provided.
|
94 | */
|
95 | private buildTypeScriptConfig;
|
96 | /**
|
97 | * Load the TypeScript config object from a provided file
|
98 | */
|
99 | private readTypeScriptConfig;
|
100 | /**
|
101 | * Creates a `tsconfig.json` file to improve the IDE experience.
|
102 | *
|
103 | * @return the fully qualified path to the `tsconfig.json` file
|
104 | */
|
105 | private writeTypeScriptConfig;
|
106 | /**
|
107 | * Find all dependencies that look like TypeScript projects.
|
108 | *
|
109 | * Enumerate all dependencies, if they have a tsconfig.json file with
|
110 | * "composite: true" we consider them project references.
|
111 | *
|
112 | * (Note: TypeScript seems to only correctly find transitive project references
|
113 | * if there's an "index" tsconfig.json of all projects somewhere up the directory
|
114 | * tree)
|
115 | */
|
116 | private findProjectReferences;
|
117 | /**
|
118 | * Find source files using the same mechanism that the TypeScript compiler itself uses.
|
119 | *
|
120 | * Respects includes/excludes/etc.
|
121 | *
|
122 | * This makes it so that running 'typescript' and running 'jsii' has the same behavior.
|
123 | */
|
124 | private determineSources;
|
125 | /**
|
126 | * Resolve the given dependency name from the current package, and find the associated tsconfig.json location
|
127 | *
|
128 | * Because we have the following potential directory layout:
|
129 | *
|
130 | * package/node_modules/some_dependency
|
131 | * package/tsconfig.json
|
132 | *
|
133 | * We resolve symlinks and only find a "TypeScript" dependency if doesn't have 'node_modules' in
|
134 | * the path after resolving symlinks (i.e., if it's a peer package in the same monorepo).
|
135 | *
|
136 | * Returns undefined if no such tsconfig could be found.
|
137 | */
|
138 | private findMonorepoPeerTsconfig;
|
139 | private diagsHaveAbortableErrors;
|
140 | }
|
141 | //# sourceMappingURL=compiler.d.ts.map |
\ | No newline at end of file |