jsii 6.0.22-dev.0 → 7.1.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/assembler.d.ts +254 -196
- package/lib/assembler.js +2105 -2327
- package/lib/assembler.js.map +1 -1
- package/lib/case.js.map +1 -1
- package/lib/common/find-utils.js.map +1 -1
- package/lib/common/index.d.ts +1 -1
- package/lib/common/index.js +2 -1
- package/lib/common/index.js.map +1 -1
- package/lib/common/symbol-id.d.ts +23 -4
- package/lib/common/symbol-id.js +13 -9
- package/lib/common/symbol-id.js.map +1 -1
- package/lib/compiler-host.d.ts +60 -0
- package/lib/compiler-host.js +201 -0
- package/lib/compiler-host.js.map +1 -0
- package/lib/compiler.d.ts +74 -62
- package/lib/compiler.js +332 -254
- package/lib/compiler.js.map +1 -1
- package/lib/diagnostic.d.ts +34 -0
- package/lib/diagnostic.js +141 -0
- package/lib/diagnostic.js.map +1 -0
- package/lib/emitter.d.ts +40 -10
- package/lib/emitter.js +188 -0
- package/lib/emitter.js.map +1 -1
- package/lib/helpers.d.ts +1 -1
- package/lib/helpers.js +2 -2
- package/lib/helpers.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/jsii-diagnostic.d.ts +27 -22
- package/lib/jsii-diagnostic.js +22 -38
- package/lib/jsii-diagnostic.js.map +1 -1
- package/lib/literate.js.map +1 -1
- package/lib/main.js +3 -2
- package/lib/main.js.map +1 -1
- package/lib/project-info.d.ts +23 -4
- package/lib/project-info.js +5 -5
- package/lib/project-info.js.map +1 -1
- package/lib/support-types.d.ts +2 -0
- package/lib/support-types.js +3 -0
- package/lib/support-types.js.map +1 -0
- package/lib/support.js.map +1 -1
- package/lib/tsconfig/compiler-options.d.ts +12 -46
- package/lib/tsconfig/compiler-options.js +45 -87
- package/lib/tsconfig/compiler-options.js.map +1 -1
- package/lib/tsconfig/index.d.ts +24 -5
- package/lib/tsconfig/index.js.map +1 -1
- package/lib/tsconfig/read.d.ts +15 -0
- package/lib/tsconfig/read.js +196 -0
- package/lib/tsconfig/read.js.map +1 -0
- package/lib/tsconfig/rule-set-format.js.map +1 -1
- package/lib/tsconfig/rulesets/configurable-options.js.map +1 -1
- package/lib/tsconfig/rulesets/deprecated-options.js.map +1 -1
- package/lib/tsconfig/rulesets/generated.public.js.map +1 -1
- package/lib/tsconfig/rulesets/incompatible-options.js.map +1 -1
- package/lib/tsconfig/rulesets/jsii-configured-options.js.map +1 -1
- package/lib/tsconfig/rulesets/minimal.public.js.map +1 -1
- package/lib/tsconfig/rulesets/strict-family-options.js.map +1 -1
- package/lib/tsconfig/rulesets/strict.public.js.map +1 -1
- package/lib/tsconfig/tsconfig-validator.js +2 -50
- package/lib/tsconfig/tsconfig-validator.js.map +1 -1
- package/lib/tsconfig/validator.js.map +1 -1
- package/lib/type-analysis.js.map +1 -1
- package/lib/type-reference.js.map +1 -1
- package/lib/type-visitor.js.map +1 -1
- package/lib/utils.d.ts +6 -6
- package/lib/utils.js +8 -13
- package/lib/utils.js.map +1 -1
- package/lib/version.d.ts +3 -3
- package/lib/version.js +4 -4
- package/lib/version.js.map +1 -1
- package/lib/warnings.d.ts +2 -2
- package/lib/warnings.js +3 -77
- package/lib/warnings.js.map +1 -1
- package/package.json +15 -11
- package/scripts/ts7-compare-jsii.mjs +101 -0
- package/lib/directives.d.ts +0 -24
- package/lib/directives.js +0 -139
- package/lib/directives.js.map +0 -1
- package/lib/docs.d.ts +0 -64
- package/lib/docs.js +0 -293
- package/lib/docs.js.map +0 -1
- package/lib/node-bindings.d.ts +0 -19
- package/lib/node-bindings.js +0 -49
- package/lib/node-bindings.js.map +0 -1
- package/lib/reserved-words.d.ts +0 -6
- package/lib/reserved-words.js +0 -258
- package/lib/reserved-words.js.map +0 -1
- package/lib/sets.d.ts +0 -16
- package/lib/sets.js +0 -41
- package/lib/sets.js.map +0 -1
- package/lib/transforms/deprecated-remover.d.ts +0 -44
- package/lib/transforms/deprecated-remover.js +0 -545
- package/lib/transforms/deprecated-remover.js.map +0 -1
- package/lib/transforms/deprecation-warnings.d.ts +0 -37
- package/lib/transforms/deprecation-warnings.js +0 -616
- package/lib/transforms/deprecation-warnings.js.map +0 -1
- package/lib/transforms/runtime-info.d.ts +0 -39
- package/lib/transforms/runtime-info.js +0 -128
- package/lib/transforms/runtime-info.js.map +0 -1
- package/lib/transforms/utils.d.ts +0 -11
- package/lib/transforms/utils.js +0 -31
- package/lib/transforms/utils.js.map +0 -1
- package/lib/type-tracker.d.ts +0 -13
- package/lib/type-tracker.js +0 -67
- package/lib/type-tracker.js.map +0 -1
- package/lib/validator.d.ts +0 -19
- package/lib/validator.js +0 -602
- package/lib/validator.js.map +0 -1
package/lib/compiler.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
1
|
+
import * as spec from '@jsii/spec';
|
|
2
|
+
import { Diagnostic } from './diagnostic';
|
|
3
3
|
import { ProjectInfo } from './project-info';
|
|
4
4
|
import { TypeScriptConfigValidationRuleSet } from './tsconfig';
|
|
5
5
|
export declare const DIAGNOSTICS = "diagnostics";
|
|
@@ -7,7 +7,12 @@ export declare const JSII_DIAGNOSTICS_CODE = 9999;
|
|
|
7
7
|
export interface CompilerOptions {
|
|
8
8
|
/** The information about the project to be built */
|
|
9
9
|
projectInfo: ProjectInfo;
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Whether the compiler should watch for changes or just compile once.
|
|
12
|
+
*
|
|
13
|
+
* Watch mode is not available on the TypeScript 7 backend; setting this to
|
|
14
|
+
* `true` makes `emit()` fail with an explicit error.
|
|
15
|
+
*/
|
|
11
16
|
watch?: boolean;
|
|
12
17
|
/** Whether to detect and generate TypeScript project references */
|
|
13
18
|
projectReferences?: boolean;
|
|
@@ -17,7 +22,13 @@ export interface CompilerOptions {
|
|
|
17
22
|
stripDeprecated?: boolean;
|
|
18
23
|
/** The path to an allowlist of FQNs to strip if stripDeprecated is set */
|
|
19
24
|
stripDeprecatedAllowListFile?: string;
|
|
20
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Whether to add warnings for deprecated elements.
|
|
27
|
+
*
|
|
28
|
+
* Not implemented on the TypeScript 7 backend yet; requesting it fails with
|
|
29
|
+
* an explicit error instead of silently producing an assembly without the
|
|
30
|
+
* `.warnings.jsii.js` module.
|
|
31
|
+
*/
|
|
21
32
|
addDeprecationWarnings?: boolean;
|
|
22
33
|
/**
|
|
23
34
|
* The name of the tsconfig file to generate.
|
|
@@ -43,64 +54,50 @@ export interface CompilerOptions {
|
|
|
43
54
|
*/
|
|
44
55
|
compressAssembly?: boolean;
|
|
45
56
|
}
|
|
46
|
-
export
|
|
57
|
+
export interface EmitResult {
|
|
58
|
+
readonly emitSkipped: boolean;
|
|
59
|
+
readonly diagnostics: readonly Diagnostic[];
|
|
60
|
+
/** The files written by the compiler (absolute paths). */
|
|
61
|
+
readonly emittedFiles?: readonly string[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Compiles a jsii project with the TypeScript 7 programmatic API.
|
|
65
|
+
*
|
|
66
|
+
* The compiler owns the `tsconfig.json` handling (generating one from the
|
|
67
|
+
* project's `package.json`, or validating a user-provided one) and delegates the
|
|
68
|
+
* type analysis, assembly generation and emit to `buildProject`, which drives the
|
|
69
|
+
* out-of-process TypeScript 7 compiler.
|
|
70
|
+
*/
|
|
71
|
+
export declare class Compiler {
|
|
47
72
|
private readonly options;
|
|
48
|
-
private readonly system;
|
|
49
|
-
private readonly compilerHost;
|
|
50
73
|
private readonly userProvidedTypeScriptConfig;
|
|
51
74
|
private readonly tsconfig;
|
|
52
|
-
private rootFiles;
|
|
53
75
|
private readonly configPath;
|
|
54
76
|
private readonly projectRoot;
|
|
55
77
|
constructor(options: CompilerOptions);
|
|
78
|
+
/** The name of the tsconfig file this compiler builds from (relative to the project root). */
|
|
79
|
+
get configFileName(): string;
|
|
56
80
|
/**
|
|
57
|
-
* Compiles the configured
|
|
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.
|
|
81
|
+
* Compiles the configured project once.
|
|
65
82
|
*/
|
|
66
|
-
watch(): Promise<never>;
|
|
67
83
|
/**
|
|
68
|
-
*
|
|
69
|
-
* file(s), and assigning the relevant root file(s).
|
|
84
|
+
* Compiles the configured project once.
|
|
70
85
|
*
|
|
71
|
-
* @param files
|
|
86
|
+
* @param files can be specified to override the standard source code location
|
|
87
|
+
* logic (the generated tsconfig then lists exactly these files).
|
|
88
|
+
* Useful for example when testing "negatives".
|
|
72
89
|
*/
|
|
90
|
+
emit(...files: string[]): EmitResult;
|
|
73
91
|
private configureTypeScript;
|
|
74
92
|
/**
|
|
75
|
-
*
|
|
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
|
|
93
|
+
* Builds the TypeScript config object from jsii config.
|
|
91
94
|
*
|
|
92
|
-
* This is the object that will be written to disk
|
|
93
|
-
*
|
|
95
|
+
* This is the object that will be written to disk unless an existing tsconfig
|
|
96
|
+
* is passed in.
|
|
94
97
|
*/
|
|
95
98
|
private buildTypeScriptConfig;
|
|
96
|
-
/**
|
|
97
|
-
* Load the TypeScript config object from a provided file
|
|
98
|
-
*/
|
|
99
|
-
private readTypeScriptConfig;
|
|
100
99
|
/**
|
|
101
100
|
* Creates a `tsconfig.json` file to improve the IDE experience.
|
|
102
|
-
*
|
|
103
|
-
* @return the fully qualified path to the `tsconfig.json` file
|
|
104
101
|
*/
|
|
105
102
|
private writeTypeScriptConfig;
|
|
106
103
|
/**
|
|
@@ -115,27 +112,42 @@ export declare class Compiler implements Emitter {
|
|
|
115
112
|
*/
|
|
116
113
|
private findProjectReferences;
|
|
117
114
|
/**
|
|
118
|
-
* Find source files
|
|
119
|
-
*
|
|
120
|
-
* Respects includes/excludes/etc.
|
|
115
|
+
* Find source files for a dependency that is also a sibling in a monorepo.
|
|
121
116
|
*
|
|
122
|
-
* This
|
|
117
|
+
* This method is used to find project references.
|
|
123
118
|
*/
|
|
124
|
-
private
|
|
119
|
+
private findMonorepoPeerTsconfig;
|
|
120
|
+
}
|
|
121
|
+
export interface BuildProjectOptions {
|
|
122
|
+
readonly projectRoot: string;
|
|
123
|
+
readonly projectInfo: ProjectInfo;
|
|
124
|
+
/** The tsconfig file to open, relative to `projectRoot` (default `tsconfig.json`). */
|
|
125
|
+
readonly tsconfigFileName?: string;
|
|
125
126
|
/**
|
|
126
|
-
*
|
|
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.
|
|
127
|
+
* Whether the tsconfig was generated by jsii (as opposed to user-provided).
|
|
128
|
+
* A generated config may be amended with an inferred `rootDir`.
|
|
137
129
|
*/
|
|
138
|
-
|
|
139
|
-
|
|
130
|
+
readonly generatedTsconfig?: boolean;
|
|
131
|
+
readonly stripDeprecated?: boolean;
|
|
132
|
+
readonly stripDeprecatedAllowListFile?: string;
|
|
133
|
+
readonly compressAssembly?: boolean;
|
|
134
|
+
}
|
|
135
|
+
export interface BuildProjectResult {
|
|
136
|
+
readonly assembly?: spec.Assembly;
|
|
137
|
+
readonly typeCount: number;
|
|
138
|
+
readonly emittedFiles: string[];
|
|
139
|
+
readonly emitSkipped: boolean;
|
|
140
|
+
readonly diagnostics: readonly Diagnostic[];
|
|
140
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Run the ts backend for a package: produce and write the `.jsii` assembly.
|
|
144
|
+
*/
|
|
145
|
+
export declare function buildProject(options: BuildProjectOptions): BuildProjectResult;
|
|
146
|
+
/**
|
|
147
|
+
* Map one TypeScript 7 API diagnostic (`{ fileName, pos, end, code, category, text }`)
|
|
148
|
+
* to jsii's `Diagnostic`. The file text is attached so the formatter renders the
|
|
149
|
+
* same `file:line:col - error TSxxxx:` layout, with source context, that the
|
|
150
|
+
* classic compiler produced. Exported for unit tests.
|
|
151
|
+
*/
|
|
152
|
+
export declare function toDiagnostic(d: any, readSource: (fileName: string) => string | undefined): Diagnostic;
|
|
141
153
|
//# sourceMappingURL=compiler.d.ts.map
|