jsii 5.9.36-dev.1 → 5.9.37-dev.0
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.
|
@@ -7,9 +7,31 @@ export declare class DeprecationWarningsInjector {
|
|
|
7
7
|
private readonly typeChecker;
|
|
8
8
|
private readonly typeTracker;
|
|
9
9
|
private transformers;
|
|
10
|
+
private shouldRenderValidatorCache;
|
|
11
|
+
private validatorCacheSeenSet;
|
|
10
12
|
constructor(typeChecker: ts.TypeChecker, typeTracker: TypeTracker);
|
|
11
13
|
process(assembly: Assembly, projectInfo: ProjectInfo): void;
|
|
12
14
|
get customTransformers(): ts.CustomTransformers;
|
|
13
15
|
private buildTypeIndex;
|
|
16
|
+
/**
|
|
17
|
+
* Whether the validator for the given type should be rendered
|
|
18
|
+
*
|
|
19
|
+
* A validator should be rendered if:
|
|
20
|
+
*
|
|
21
|
+
* - It contains any deprecated members (base case).
|
|
22
|
+
* - It references any other types whose validators should be rendered.
|
|
23
|
+
* - It inherits from other types whose validators should be rendered.
|
|
24
|
+
* - It references types that reference this type (recursive types).
|
|
25
|
+
* - It references types from another assembly.
|
|
26
|
+
*
|
|
27
|
+
* For the last one we technically return `true`, indicating that a validator
|
|
28
|
+
* *should* be rendered, but when we get to rendering no statements are
|
|
29
|
+
* actually produced and the validator function is never rendered. This was
|
|
30
|
+
* pre-existing behavior that I didn't change because introducing calls into
|
|
31
|
+
* other assemblies out of the blue introduces risk.
|
|
32
|
+
*/
|
|
33
|
+
private shouldRenderValidator;
|
|
34
|
+
private generateTypeValidation;
|
|
35
|
+
private processInterfaceType;
|
|
14
36
|
}
|
|
15
37
|
//# sourceMappingURL=deprecation-warnings.d.ts.map
|
|
@@ -14,6 +14,7 @@ const NAMESPACE = 'jsiiDeprecationWarnings';
|
|
|
14
14
|
const VISITED_OBJECTS_SET_NAME = 'visitedObjects';
|
|
15
15
|
const DEPRECATION_ERROR = 'DeprecationError';
|
|
16
16
|
const GET_PROPERTY_DESCRIPTOR = 'getPropertyDescriptor';
|
|
17
|
+
const VALIDATORS_OBJ = 'VALIDATORS';
|
|
17
18
|
class DeprecationWarningsInjector {
|
|
18
19
|
constructor(typeChecker, typeTracker) {
|
|
19
20
|
this.typeChecker = typeChecker;
|
|
@@ -21,70 +22,27 @@ class DeprecationWarningsInjector {
|
|
|
21
22
|
this.transformers = {
|
|
22
23
|
before: [],
|
|
23
24
|
};
|
|
25
|
+
this.shouldRenderValidatorCache = {};
|
|
26
|
+
this.validatorCacheSeenSet = new Set();
|
|
24
27
|
}
|
|
25
28
|
process(assembly, projectInfo) {
|
|
26
29
|
const projectRoot = projectInfo.projectRoot;
|
|
27
|
-
const
|
|
30
|
+
const validationFunctions = [];
|
|
28
31
|
const types = assembly.types ?? {};
|
|
29
32
|
for (const type of Object.values(types)) {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
statements.push(ts.factory.createExpressionStatement(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(VISITED_OBJECTS_SET_NAME), 'add'), undefined, [ts.factory.createIdentifier(PARAMETER_NAME)])));
|
|
34
|
-
const tryStatements = [];
|
|
35
|
-
if (spec.isDeprecated(type) && spec.isEnumType(type)) {
|
|
36
|
-
// The type is deprecated
|
|
37
|
-
tryStatements.push(createWarningFunctionCall(type.fqn, type.docs?.deprecated));
|
|
38
|
-
isEmpty = false;
|
|
39
|
-
}
|
|
40
|
-
if (spec.isEnumType(type) && type.locationInModule?.filename) {
|
|
41
|
-
// Check for deprecated enum members
|
|
42
|
-
//
|
|
43
|
-
// We need to compare to the value of the deprecated enum. We can do that in one of 2 ways:
|
|
44
|
-
//
|
|
45
|
-
// - Compare against `require('./actual-file').EnumType.SOME_ENUM_MEMBER`
|
|
46
|
-
// - Look up the enum member value and compare against `'some-enum-member'`.
|
|
47
|
-
//
|
|
48
|
-
// The first one introduces a circular dependency between this file and `actual-file.js`, so we
|
|
49
|
-
// will go with the second.
|
|
50
|
-
//
|
|
51
|
-
// One complication: two enum members can have the same value (shouldn't, but can!) where
|
|
52
|
-
// one symbolic name is deprecated but the other isn't. In that case we don't treat it as deprecated.
|
|
53
|
-
const memDecls = this.typeTracker.getEnumMembers(type.fqn);
|
|
54
|
-
const nonDeprecatedValues = new Set((type.members ?? [])
|
|
55
|
-
.filter((m) => !spec.isDeprecated(m))
|
|
56
|
-
.map((m) => this.typeChecker.getConstantValue(memDecls[m.name])));
|
|
57
|
-
const deprecatedMembers = (type.members ?? []).filter(spec.isDeprecated);
|
|
58
|
-
for (const member of deprecatedMembers) {
|
|
59
|
-
const constantValue = this.typeChecker.getConstantValue(memDecls[member.name]);
|
|
60
|
-
if (nonDeprecatedValues.has(constantValue)) {
|
|
61
|
-
// Collission with non-deprecated enum member
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
const condition = ts.factory.createBinaryExpression(ts.factory.createIdentifier(PARAMETER_NAME), ts.SyntaxKind.EqualsEqualsEqualsToken, typeof constantValue === 'string'
|
|
65
|
-
? ts.factory.createStringLiteral(constantValue)
|
|
66
|
-
: ts.factory.createNumericLiteral(constantValue));
|
|
67
|
-
tryStatements.push(createWarningFunctionCall(`${type.fqn}#${member.name}`, member.docs?.deprecated, condition));
|
|
68
|
-
isEmpty = false;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
else if (spec.isInterfaceType(type) && type.datatype) {
|
|
72
|
-
const { statementsByProp, excludedProps } = processInterfaceType(type, types, assembly, projectInfo, undefined, undefined);
|
|
73
|
-
for (const [name, statement] of statementsByProp.entries()) {
|
|
74
|
-
if (!excludedProps.has(name)) {
|
|
75
|
-
tryStatements.push(statement);
|
|
76
|
-
isEmpty = false;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
33
|
+
const fnStatements = this.generateTypeValidation(type, assembly, projectInfo, types);
|
|
34
|
+
if (fnStatements.length === 0) {
|
|
35
|
+
continue;
|
|
79
36
|
}
|
|
80
|
-
statements.push(ts.factory.createTryStatement(ts.factory.createBlock(tryStatements), undefined, ts.factory.createBlock([
|
|
81
|
-
ts.factory.createExpressionStatement(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(VISITED_OBJECTS_SET_NAME), 'delete'), undefined, [ts.factory.createIdentifier(PARAMETER_NAME)])),
|
|
82
|
-
])));
|
|
83
37
|
const paramValue = ts.factory.createParameterDeclaration(undefined, undefined, PARAMETER_NAME);
|
|
84
38
|
const functionName = fnName(type.fqn);
|
|
85
|
-
const
|
|
86
|
-
|
|
39
|
+
const functionExpr = ts.factory.createFunctionExpression(undefined, undefined, ts.factory.createIdentifier(functionName), [], [paramValue], undefined, createFunctionBlock(fnStatements));
|
|
40
|
+
validationFunctions.push(ts.factory.createPropertyAssignment(functionName, functionExpr));
|
|
87
41
|
}
|
|
42
|
+
const fileStatements = [];
|
|
43
|
+
fileStatements.push(ts.factory.createVariableStatement(undefined, ts.factory.createVariableDeclarationList([
|
|
44
|
+
ts.factory.createVariableDeclaration(VALIDATORS_OBJ, undefined, undefined, ts.factory.createObjectLiteralExpression(validationFunctions)),
|
|
45
|
+
], ts.NodeFlags.Const)));
|
|
88
46
|
this.transformers = {
|
|
89
47
|
before: [
|
|
90
48
|
(context) => {
|
|
@@ -93,7 +51,7 @@ class DeprecationWarningsInjector {
|
|
|
93
51
|
},
|
|
94
52
|
],
|
|
95
53
|
};
|
|
96
|
-
generateWarningsFile(projectRoot,
|
|
54
|
+
generateWarningsFile(projectRoot, fileStatements);
|
|
97
55
|
}
|
|
98
56
|
get customTransformers() {
|
|
99
57
|
return this.transformers;
|
|
@@ -108,58 +66,199 @@ class DeprecationWarningsInjector {
|
|
|
108
66
|
}
|
|
109
67
|
return result;
|
|
110
68
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Whether the validator for the given type should be rendered
|
|
71
|
+
*
|
|
72
|
+
* A validator should be rendered if:
|
|
73
|
+
*
|
|
74
|
+
* - It contains any deprecated members (base case).
|
|
75
|
+
* - It references any other types whose validators should be rendered.
|
|
76
|
+
* - It inherits from other types whose validators should be rendered.
|
|
77
|
+
* - It references types that reference this type (recursive types).
|
|
78
|
+
* - It references types from another assembly.
|
|
79
|
+
*
|
|
80
|
+
* For the last one we technically return `true`, indicating that a validator
|
|
81
|
+
* *should* be rendered, but when we get to rendering no statements are
|
|
82
|
+
* actually produced and the validator function is never rendered. This was
|
|
83
|
+
* pre-existing behavior that I didn't change because introducing calls into
|
|
84
|
+
* other assemblies out of the blue introduces risk.
|
|
85
|
+
*/
|
|
86
|
+
shouldRenderValidator(type, assembly) {
|
|
87
|
+
if (this.shouldRenderValidatorCache[type.fqn] !== undefined) {
|
|
88
|
+
return this.shouldRenderValidatorCache[type.fqn];
|
|
121
89
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
even if another property with the same name is deprecated in another
|
|
125
|
-
super-interface. */
|
|
126
|
-
excludedProps.add(prop.name);
|
|
90
|
+
if (type.fqn === '@scope/jsii-calc-base.TypeToContainVeryBaseProps') {
|
|
91
|
+
debugger;
|
|
127
92
|
}
|
|
128
|
-
if (
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
93
|
+
if (this.validatorCacheSeenSet.has(type.fqn)) {
|
|
94
|
+
// To be safe we need to say this is true.
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
if (!type.fqn.startsWith(`${assembly.name}.`)) {
|
|
98
|
+
// Foreign type, always check
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
this.validatorCacheSeenSet.add(type.fqn);
|
|
102
|
+
this.shouldRenderValidatorCache[type.fqn] = calculate.call(this);
|
|
103
|
+
this.validatorCacheSeenSet.delete(type.fqn);
|
|
104
|
+
return this.shouldRenderValidatorCache[type.fqn];
|
|
105
|
+
function calculate() {
|
|
106
|
+
if (spec.isDeprecated(type)) {
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
if (spec.isEnumType(type)) {
|
|
110
|
+
return (type.members ?? []).some(spec.isDeprecated);
|
|
111
|
+
}
|
|
112
|
+
if (spec.isInterfaceType(type) && type.datatype) {
|
|
113
|
+
for (const prop of type.properties ?? []) {
|
|
114
|
+
if (spec.isDeprecated(prop)) {
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
const typesToInspect = spec.isCollectionTypeReference(prop.type)
|
|
118
|
+
? [prop.type.collection.elementtype]
|
|
119
|
+
: spec.isUnionTypeReference(prop.type)
|
|
120
|
+
? prop.type.union.types
|
|
121
|
+
: [prop.type];
|
|
122
|
+
for (const typeToInspect of typesToInspect) {
|
|
123
|
+
if (!spec.isNamedTypeReference(typeToInspect)) {
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
// Is from a different assembly?
|
|
127
|
+
const typeObj = findType2(typeToInspect.fqn, assembly);
|
|
128
|
+
if (typeObj === 'other-assembly') {
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
if (this.shouldRenderValidator(typeObj, assembly)) {
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
for (const interfaceName of type.interfaces ?? []) {
|
|
137
|
+
const typeObj = findType2(interfaceName, assembly);
|
|
138
|
+
if (typeObj === 'other-assembly') {
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
if (this.shouldRenderValidator(typeObj, assembly)) {
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
133
145
|
}
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
generateTypeValidation(type, assembly, projectInfo, types) {
|
|
150
|
+
if (!this.shouldRenderValidator(type, assembly)) {
|
|
151
|
+
return [];
|
|
134
152
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
153
|
+
const statements = [];
|
|
154
|
+
let isEmpty = true;
|
|
155
|
+
// This will add the parameter to the set of visited objects, to prevent infinite recursion
|
|
156
|
+
statements.push(ts.factory.createExpressionStatement(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(VISITED_OBJECTS_SET_NAME), 'add'), undefined, [ts.factory.createIdentifier(PARAMETER_NAME)])));
|
|
157
|
+
const tryStatements = [];
|
|
158
|
+
if (spec.isDeprecated(type) && spec.isEnumType(type)) {
|
|
159
|
+
// The type is deprecated
|
|
160
|
+
tryStatements.push(createWarningFunctionCall(type.fqn, type.docs?.deprecated));
|
|
161
|
+
isEmpty = false;
|
|
162
|
+
}
|
|
163
|
+
if (spec.isEnumType(type) && type.locationInModule?.filename) {
|
|
164
|
+
// Check for deprecated enum members
|
|
165
|
+
//
|
|
166
|
+
// We need to compare to the value of the deprecated enum. We can do that in one of 2 ways:
|
|
167
|
+
//
|
|
168
|
+
// - Compare against `require('./actual-file').EnumType.SOME_ENUM_MEMBER`
|
|
169
|
+
// - Look up the enum member value and compare against `'some-enum-member'`.
|
|
170
|
+
//
|
|
171
|
+
// The first one introduces a circular dependency between this file and `actual-file.js`, so we
|
|
172
|
+
// will go with the second.
|
|
173
|
+
//
|
|
174
|
+
// One complication: two enum members can have the same value (shouldn't, but can!) where
|
|
175
|
+
// one symbolic name is deprecated but the other isn't. In that case we don't treat it as deprecated.
|
|
176
|
+
const memDecls = this.typeTracker.getEnumMembers(type.fqn);
|
|
177
|
+
const nonDeprecatedValues = new Set((type.members ?? [])
|
|
178
|
+
.filter((m) => !spec.isDeprecated(m))
|
|
179
|
+
.map((m) => this.typeChecker.getConstantValue(memDecls[m.name])));
|
|
180
|
+
const deprecatedMembers = (type.members ?? []).filter(spec.isDeprecated);
|
|
181
|
+
for (const member of deprecatedMembers) {
|
|
182
|
+
const constantValue = this.typeChecker.getConstantValue(memDecls[member.name]);
|
|
183
|
+
if (nonDeprecatedValues.has(constantValue)) {
|
|
184
|
+
// Collission with non-deprecated enum member
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
const condition = ts.factory.createBinaryExpression(ts.factory.createIdentifier(PARAMETER_NAME), ts.SyntaxKind.EqualsEqualsEqualsToken, typeof constantValue === 'string'
|
|
188
|
+
? ts.factory.createStringLiteral(constantValue)
|
|
189
|
+
: ts.factory.createNumericLiteral(constantValue));
|
|
190
|
+
tryStatements.push(createWarningFunctionCall(`${type.fqn}#${member.name}`, member.docs?.deprecated, condition));
|
|
191
|
+
isEmpty = false;
|
|
141
192
|
}
|
|
142
193
|
}
|
|
143
|
-
else if (spec.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
194
|
+
else if (spec.isInterfaceType(type) && type.datatype) {
|
|
195
|
+
const { statementsByProp, excludedProps } = this.processInterfaceType(type, types, assembly, projectInfo, undefined, undefined);
|
|
196
|
+
for (const [name, statement] of statementsByProp.entries()) {
|
|
197
|
+
if (!excludedProps.has(name)) {
|
|
198
|
+
tryStatements.push(statement);
|
|
199
|
+
isEmpty = false;
|
|
200
|
+
}
|
|
150
201
|
}
|
|
151
202
|
}
|
|
203
|
+
statements.push(ts.factory.createTryStatement(ts.factory.createBlock(tryStatements), undefined, ts.factory.createBlock([
|
|
204
|
+
ts.factory.createExpressionStatement(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(VISITED_OBJECTS_SET_NAME), 'delete'), undefined, [ts.factory.createIdentifier(PARAMETER_NAME)])),
|
|
205
|
+
])));
|
|
206
|
+
return isEmpty ? [] : statements;
|
|
152
207
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
208
|
+
processInterfaceType(type, types, assembly, projectInfo, statementsByProp = new Map(), excludedProps = new Set()) {
|
|
209
|
+
for (const prop of Object.values(type.properties ?? {})) {
|
|
210
|
+
const fqn = `${type.fqn}#${prop.name}`;
|
|
211
|
+
if (spec.isDeprecated(prop) || spec.isDeprecated(type)) {
|
|
212
|
+
// If the property individually is deprecated, or the entire type is deprecated
|
|
213
|
+
const deprecatedDocs = prop.docs?.deprecated ?? type.docs?.deprecated;
|
|
214
|
+
const statement = createWarningFunctionCall(fqn, deprecatedDocs, ts.factory.createBinaryExpression(ts.factory.createStringLiteral(prop.name), ts.SyntaxKind.InKeyword, ts.factory.createIdentifier(PARAMETER_NAME)), undefined);
|
|
215
|
+
statementsByProp.set(prop.name, statement);
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
/* If a prop is not deprecated, we don't want to generate a warning for it,
|
|
219
|
+
even if another property with the same name is deprecated in another
|
|
220
|
+
super-interface. */
|
|
221
|
+
excludedProps.add(prop.name);
|
|
222
|
+
}
|
|
223
|
+
if (spec.isNamedTypeReference(prop.type) && Object.keys(types).includes(prop.type.fqn)) {
|
|
224
|
+
if (this.shouldRenderValidator(types[prop.type.fqn], assembly)) {
|
|
225
|
+
const functionName = importedFunctionName(prop.type.fqn, assembly, projectInfo);
|
|
226
|
+
if (functionName) {
|
|
227
|
+
const statement = createTypeHandlerCall(functionName, `${PARAMETER_NAME}.${prop.name}`);
|
|
228
|
+
statementsByProp.set(`${prop.name}_`, statement);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
else if (spec.isCollectionTypeReference(prop.type) &&
|
|
233
|
+
spec.isNamedTypeReference(prop.type.collection.elementtype)) {
|
|
234
|
+
const functionName = importedFunctionName(prop.type.collection.elementtype.fqn, assembly, projectInfo);
|
|
235
|
+
if (functionName) {
|
|
236
|
+
const statement = createTypeHandlerCall(functionName, `${PARAMETER_NAME}.${prop.name}`, prop.type.collection.kind);
|
|
237
|
+
statementsByProp.set(`${prop.name}_`, statement);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
else if (spec.isUnionTypeReference(prop.type) &&
|
|
241
|
+
spec.isNamedTypeReference(prop.type.union.types[0]) &&
|
|
242
|
+
Object.keys(types).includes(prop.type.union.types[0].fqn)) {
|
|
243
|
+
const functionName = importedFunctionName(prop.type.union.types[0].fqn, assembly, projectInfo);
|
|
244
|
+
if (functionName) {
|
|
245
|
+
const statement = createTypeHandlerCall(functionName, `${PARAMETER_NAME}.${prop.name}`);
|
|
246
|
+
statementsByProp.set(`${prop.name}_`, statement);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
// We also generate calls to all the supertypes
|
|
251
|
+
for (const interfaceName of type.interfaces ?? []) {
|
|
252
|
+
const assemblies = projectInfo.dependencyClosure.concat(assembly);
|
|
253
|
+
const superType = findType(interfaceName, assemblies);
|
|
254
|
+
if (superType.type) {
|
|
255
|
+
this.processInterfaceType(superType.type, types, assembly, projectInfo, statementsByProp, excludedProps);
|
|
256
|
+
}
|
|
159
257
|
}
|
|
258
|
+
return { statementsByProp, excludedProps };
|
|
160
259
|
}
|
|
161
|
-
return { statementsByProp, excludedProps };
|
|
162
260
|
}
|
|
261
|
+
exports.DeprecationWarningsInjector = DeprecationWarningsInjector;
|
|
163
262
|
function fnName(fqn) {
|
|
164
263
|
return fqn.replace(/[^\w\d]/g, '_');
|
|
165
264
|
}
|
|
@@ -178,9 +277,7 @@ function createWarningFunctionCall(fqn, message = '', condition, includeNamespac
|
|
|
178
277
|
]));
|
|
179
278
|
return condition ? ts.factory.createIfStatement(condition, mainStatement) : mainStatement;
|
|
180
279
|
}
|
|
181
|
-
function generateWarningsFile(projectRoot,
|
|
182
|
-
const names = [...functionDeclarations].map((d) => d.name?.text).filter(Boolean);
|
|
183
|
-
const exportedSymbols = [WARNING_FUNCTION_NAME, GET_PROPERTY_DESCRIPTOR, DEPRECATION_ERROR, ...names].join(',');
|
|
280
|
+
function generateWarningsFile(projectRoot, validatorStatements) {
|
|
184
281
|
const functionText = `function ${WARNING_FUNCTION_NAME}(name, deprecationMessage) {
|
|
185
282
|
const deprecated = process.env.JSII_DEPRECATED;
|
|
186
283
|
const deprecationMode = ['warn', 'fail', 'quiet'].includes(deprecated) ? deprecated : 'warn';
|
|
@@ -221,11 +318,22 @@ class ${DEPRECATION_ERROR} extends Error {
|
|
|
221
318
|
}
|
|
222
319
|
}
|
|
223
320
|
|
|
224
|
-
|
|
321
|
+
function nop() {
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
module.exports = new Proxy({}, {
|
|
325
|
+
get(target, prop, receiver) {
|
|
326
|
+
if (prop === '${WARNING_FUNCTION_NAME}') return ${WARNING_FUNCTION_NAME};
|
|
327
|
+
if (prop === '${GET_PROPERTY_DESCRIPTOR}') return ${GET_PROPERTY_DESCRIPTOR};
|
|
328
|
+
if (prop === '${DEPRECATION_ERROR}') return ${DEPRECATION_ERROR};
|
|
329
|
+
|
|
330
|
+
return ${VALIDATORS_OBJ}[prop] ?? nop;
|
|
331
|
+
},
|
|
332
|
+
});
|
|
225
333
|
`;
|
|
226
334
|
const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed });
|
|
227
335
|
const resultFile = ts.createSourceFile(path.join(projectRoot, exports.WARNINGSCODE_FILE_NAME), functionText, ts.ScriptTarget.Latest, false, ts.ScriptKind.JS);
|
|
228
|
-
const declarations =
|
|
336
|
+
const declarations = validatorStatements.map((st) => printer.printNode(ts.EmitHint.Unspecified, st, resultFile));
|
|
229
337
|
const content = declarations.concat(printer.printFile(resultFile)).join('\n');
|
|
230
338
|
fs.writeFileSync(path.join(projectRoot, exports.WARNINGSCODE_FILE_NAME), content);
|
|
231
339
|
}
|
|
@@ -332,6 +440,17 @@ class Transformer {
|
|
|
332
440
|
return statements;
|
|
333
441
|
}
|
|
334
442
|
}
|
|
443
|
+
function findType2(fqn, assembly) {
|
|
444
|
+
// Is from a different assembly?
|
|
445
|
+
if (!fqn.startsWith(`${assembly.name}.`)) {
|
|
446
|
+
return 'other-assembly';
|
|
447
|
+
}
|
|
448
|
+
const type = (assembly.types ?? {})[fqn];
|
|
449
|
+
if (!type) {
|
|
450
|
+
throw new Error(`Could not find type in same assembly: ${fqn}`);
|
|
451
|
+
}
|
|
452
|
+
return type;
|
|
453
|
+
}
|
|
335
454
|
function createWarningStatementForElement(element, classType) {
|
|
336
455
|
if (spec.isDeprecated(element)) {
|
|
337
456
|
const elementName = element.name;
|
|
@@ -407,9 +526,7 @@ function createTypeHandlerCall(functionName, parameter, collectionKind) {
|
|
|
407
526
|
case spec.CollectionKind.Map:
|
|
408
527
|
return ts.factory.createIfStatement(ts.factory.createBinaryExpression(ts.factory.createIdentifier(parameter), ts.SyntaxKind.ExclamationEqualsToken, ts.factory.createNull()), ts.factory.createForOfStatement(undefined, ts.factory.createVariableDeclarationList([ts.factory.createVariableDeclaration(FOR_LOOP_ITEM_NAME)], ts.NodeFlags.Const), ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('Object'), 'values'), undefined, [ts.factory.createIdentifier(parameter)]), createTypeHandlerCall(functionName, FOR_LOOP_ITEM_NAME)));
|
|
409
528
|
case undefined:
|
|
410
|
-
return ts.factory.createIfStatement(ts.factory.createPrefixUnaryExpression(ts.SyntaxKind.ExclamationToken, ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(VISITED_OBJECTS_SET_NAME), ts.factory.createIdentifier('has')), undefined, [ts.factory.createIdentifier(parameter)])), ts.factory.createExpressionStatement(ts.factory.createCallExpression(ts.factory.createIdentifier(functionName), undefined, [
|
|
411
|
-
ts.factory.createIdentifier(parameter),
|
|
412
|
-
])));
|
|
529
|
+
return ts.factory.createIfStatement(ts.factory.createPrefixUnaryExpression(ts.SyntaxKind.ExclamationToken, ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(VISITED_OBJECTS_SET_NAME), ts.factory.createIdentifier('has')), undefined, [ts.factory.createIdentifier(parameter)])), ts.factory.createExpressionStatement(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('module.exports'), functionName), undefined, [ts.factory.createIdentifier(parameter)])));
|
|
413
530
|
}
|
|
414
531
|
}
|
|
415
532
|
// We try-then-rethrow exceptions to avoid runtimes displaying an uncanny wall of text if the place
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deprecation-warnings.js","sourceRoot":"","sources":["../../src/transforms/deprecation-warnings.ts"],"names":[],"mappings":";;;AAAA,8BAA8B;AAC9B,kCAAkC;AAClC,mCAAmC;AAEnC,iCAAiC;AAEjC,mDAAuD;AAI1C,QAAA,sBAAsB,GAAG,mBAAmB,CAAC;AAC1D,MAAM,qBAAqB,GAAG,OAAO,CAAC;AACtC,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,SAAS,GAAG,yBAAyB,CAAC;AAC5C,MAAM,wBAAwB,GAAG,gBAAgB,CAAC;AAClD,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;AAC7C,MAAM,uBAAuB,GAAG,uBAAuB,CAAC;AAExD,MAAa,2BAA2B;IAKtC,YAAoC,WAA2B,EAAmB,WAAwB;QAAtE,gBAAW,GAAX,WAAW,CAAgB;QAAmB,gBAAW,GAAX,WAAW,CAAa;QAJlG,iBAAY,GAA0B;YAC5C,MAAM,EAAE,EAAE;SACX,CAAC;IAE2G,CAAC;IAEvG,OAAO,CAAC,QAAkB,EAAE,WAAwB;QACzD,MAAM,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC;QAC5C,MAAM,oBAAoB,GAA6B,EAAE,CAAC;QAE1D,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,IAAI,EAAE,CAAC;QACnC,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YACxC,MAAM,UAAU,GAAmB,EAAE,CAAC;YACtC,IAAI,OAAO,GAAG,IAAI,CAAC;YAEnB,2FAA2F;YAC3F,UAAU,CAAC,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AC,sBAAsB,CAC/B,EAAE,CAAC,OAAO,CAAC,8BAA8B,CAAC,EAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,EACvF,EAAE,CAAC,UAAU,CAAC,uBAAuB,EACrC,EAAE,CAAC,OAAO,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,CAClD,CACF,EACD,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC;gBACrB,EAAE,CAAC,OAAO,CAAC,yBAAyB,CAClC,EAAE,CAAC,OAAO,CAAC,oBAAoB,CAC7B,EAAE,CAAC,OAAO,CAAC,8BAA8B,CAAC,EAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAC,EACpG,SAAS,EACT,CAAC,EAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAC/C,CACF;aACF,CAAC,CACH;YACD,EAAE,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;SACtE,CAAC,CACH,EACD,SAAS,CACV;KACF,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAS,QAAQ,CAAC,QAAgB;IAChC,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;QACtB,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport * as spec from '@jsii/spec';\nimport { Assembly } from '@jsii/spec';\nimport * as ts from 'typescript';\n\nimport { symbolIdentifier } from '../common/symbol-id';\nimport { ProjectInfo } from '../project-info';\nimport { TypeTracker } from '../type-tracker';\n\nexport const WARNINGSCODE_FILE_NAME = '.warnings.jsii.js';\nconst WARNING_FUNCTION_NAME = 'print';\nconst PARAMETER_NAME = 'p';\nconst FOR_LOOP_ITEM_NAME = 'o';\nconst NAMESPACE = 'jsiiDeprecationWarnings';\nconst VISITED_OBJECTS_SET_NAME = 'visitedObjects';\nconst DEPRECATION_ERROR = 'DeprecationError';\nconst GET_PROPERTY_DESCRIPTOR = 'getPropertyDescriptor';\n\nexport class DeprecationWarningsInjector {\n private transformers: ts.CustomTransformers = {\n before: [],\n };\n\n public constructor(private readonly typeChecker: ts.TypeChecker, private readonly typeTracker: TypeTracker) {}\n\n public process(assembly: Assembly, projectInfo: ProjectInfo) {\n const projectRoot = projectInfo.projectRoot;\n const functionDeclarations: ts.FunctionDeclaration[] = [];\n\n const types = assembly.types ?? {};\n for (const type of Object.values(types)) {\n const statements: ts.Statement[] = [];\n let isEmpty = true;\n\n // This will add the parameter to the set of visited objects, to prevent infinite recursion\n statements.push(\n ts.factory.createExpressionStatement(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(VISITED_OBJECTS_SET_NAME), 'add'),\n undefined,\n [ts.factory.createIdentifier(PARAMETER_NAME)],\n ),\n ),\n );\n\n const tryStatements = [];\n if (spec.isDeprecated(type) && spec.isEnumType(type)) {\n // The type is deprecated\n tryStatements.push(createWarningFunctionCall(type.fqn, type.docs?.deprecated));\n isEmpty = false;\n }\n\n if (spec.isEnumType(type) && type.locationInModule?.filename) {\n // Check for deprecated enum members\n //\n // We need to compare to the value of the deprecated enum. We can do that in one of 2 ways:\n //\n // - Compare against `require('./actual-file').EnumType.SOME_ENUM_MEMBER`\n // - Look up the enum member value and compare against `'some-enum-member'`.\n //\n // The first one introduces a circular dependency between this file and `actual-file.js`, so we\n // will go with the second.\n //\n // One complication: two enum members can have the same value (shouldn't, but can!) where\n // one symbolic name is deprecated but the other isn't. In that case we don't treat it as deprecated.\n const memDecls = this.typeTracker.getEnumMembers(type.fqn);\n\n const nonDeprecatedValues = new Set(\n (type.members ?? [])\n .filter((m) => !spec.isDeprecated(m))\n .map((m) => this.typeChecker.getConstantValue(memDecls[m.name])!),\n );\n const deprecatedMembers = (type.members ?? []).filter(spec.isDeprecated);\n\n for (const member of deprecatedMembers) {\n const constantValue = this.typeChecker.getConstantValue(memDecls[member.name])!;\n if (nonDeprecatedValues.has(constantValue)) {\n // Collission with non-deprecated enum member\n continue;\n }\n\n const condition = ts.factory.createBinaryExpression(\n ts.factory.createIdentifier(PARAMETER_NAME),\n ts.SyntaxKind.EqualsEqualsEqualsToken,\n typeof constantValue === 'string'\n ? ts.factory.createStringLiteral(constantValue)\n : ts.factory.createNumericLiteral(constantValue),\n );\n tryStatements.push(\n createWarningFunctionCall(`${type.fqn}#${member.name}`, member.docs?.deprecated, condition),\n );\n isEmpty = false;\n }\n } else if (spec.isInterfaceType(type) && type.datatype) {\n const { statementsByProp, excludedProps } = processInterfaceType(\n type,\n types,\n assembly,\n projectInfo,\n undefined,\n undefined,\n );\n\n for (const [name, statement] of statementsByProp.entries()) {\n if (!excludedProps.has(name)) {\n tryStatements.push(statement);\n isEmpty = false;\n }\n }\n }\n\n statements.push(\n ts.factory.createTryStatement(\n ts.factory.createBlock(tryStatements),\n undefined,\n ts.factory.createBlock([\n ts.factory.createExpressionStatement(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(\n ts.factory.createIdentifier(VISITED_OBJECTS_SET_NAME),\n 'delete',\n ),\n undefined,\n [ts.factory.createIdentifier(PARAMETER_NAME)],\n ),\n ),\n ]),\n ),\n );\n\n const paramValue = ts.factory.createParameterDeclaration(undefined, undefined, PARAMETER_NAME);\n const functionName = fnName(type.fqn);\n const functionDeclaration = ts.factory.createFunctionDeclaration(\n undefined,\n undefined,\n ts.factory.createIdentifier(functionName),\n [],\n [paramValue],\n undefined,\n createFunctionBlock(isEmpty ? [] : statements),\n );\n functionDeclarations.push(functionDeclaration);\n }\n this.transformers = {\n before: [\n (context) => {\n const transformer = new Transformer(\n this.typeChecker,\n context,\n projectRoot,\n this.buildTypeIndex(assembly),\n assembly,\n );\n return transformer.transform.bind(transformer);\n },\n ],\n };\n generateWarningsFile(projectRoot, functionDeclarations);\n }\n\n public get customTransformers(): ts.CustomTransformers {\n return this.transformers;\n }\n\n private buildTypeIndex(assembly: Assembly): Map<string, spec.Type> {\n const result = new Map<string, spec.Type>();\n\n for (const type of Object.values(assembly.types ?? {})) {\n const symbolId = type.symbolId;\n if (symbolId) {\n result.set(symbolId, type);\n }\n }\n\n return result;\n }\n}\n\nfunction processInterfaceType(\n type: spec.InterfaceType,\n types: { [p: string]: spec.Type },\n assembly: Assembly,\n projectInfo: ProjectInfo,\n statementsByProp: Map<string, ts.Statement> = new Map<string, ts.Statement>(),\n excludedProps: Set<string> = new Set<string>(),\n) {\n for (const prop of Object.values(type.properties ?? {})) {\n const fqn = `${type.fqn}#${prop.name}`;\n if (spec.isDeprecated(prop) || spec.isDeprecated(type)) {\n // If the property individually is deprecated, or the entire type is deprecated\n const deprecatedDocs = prop.docs?.deprecated ?? type.docs?.deprecated;\n const statement = createWarningFunctionCall(\n fqn,\n deprecatedDocs,\n ts.factory.createBinaryExpression(\n ts.factory.createStringLiteral(prop.name),\n ts.SyntaxKind.InKeyword,\n ts.factory.createIdentifier(PARAMETER_NAME),\n ),\n undefined,\n );\n statementsByProp.set(prop.name, statement);\n } else {\n /* If a prop is not deprecated, we don't want to generate a warning for it,\n even if another property with the same name is deprecated in another\n super-interface. */\n excludedProps.add(prop.name);\n }\n\n if (spec.isNamedTypeReference(prop.type) && Object.keys(types).includes(prop.type.fqn)) {\n const functionName = importedFunctionName(prop.type.fqn, assembly, projectInfo);\n if (functionName) {\n const statement = createTypeHandlerCall(functionName, `${PARAMETER_NAME}.${prop.name}`);\n statementsByProp.set(`${prop.name}_`, statement);\n }\n } else if (\n spec.isCollectionTypeReference(prop.type) &&\n spec.isNamedTypeReference(prop.type.collection.elementtype)\n ) {\n const functionName = importedFunctionName(prop.type.collection.elementtype.fqn, assembly, projectInfo);\n if (functionName) {\n const statement = createTypeHandlerCall(\n functionName,\n `${PARAMETER_NAME}.${prop.name}`,\n prop.type.collection.kind,\n );\n statementsByProp.set(`${prop.name}_`, statement);\n }\n } else if (\n spec.isUnionTypeReference(prop.type) &&\n spec.isNamedTypeReference(prop.type.union.types[0]) &&\n Object.keys(types).includes(prop.type.union.types[0].fqn)\n ) {\n const functionName = importedFunctionName(prop.type.union.types[0].fqn, assembly, projectInfo);\n if (functionName) {\n const statement = createTypeHandlerCall(functionName, `${PARAMETER_NAME}.${prop.name}`);\n statementsByProp.set(`${prop.name}_`, statement);\n }\n }\n }\n\n // We also generate calls to all the supertypes\n for (const interfaceName of type.interfaces ?? []) {\n const assemblies = projectInfo.dependencyClosure.concat(assembly);\n const superType = findType(interfaceName, assemblies);\n if (superType.type) {\n processInterfaceType(\n superType.type as spec.InterfaceType,\n types,\n assembly,\n projectInfo,\n statementsByProp,\n excludedProps,\n );\n }\n }\n return { statementsByProp, excludedProps };\n}\n\nfunction fnName(fqn: string): string {\n return fqn.replace(/[^\\w\\d]/g, '_');\n}\n\nfunction createFunctionBlock(statements: ts.Statement[]): ts.Block {\n if (statements.length > 0) {\n const validation = ts.factory.createIfStatement(\n ts.factory.createBinaryExpression(\n ts.factory.createIdentifier(PARAMETER_NAME),\n ts.SyntaxKind.EqualsEqualsToken,\n ts.factory.createNull(),\n ),\n ts.factory.createReturnStatement(),\n );\n return ts.factory.createBlock([validation, ...statements], true);\n }\n return ts.factory.createBlock([], true);\n}\n\nfunction createWarningFunctionCall(\n fqn: string,\n message = '',\n condition?: ts.Expression,\n includeNamespace = false,\n): ts.Statement {\n const functionName = includeNamespace ? `${NAMESPACE}.${WARNING_FUNCTION_NAME}` : WARNING_FUNCTION_NAME;\n\n const mainStatement = ts.factory.createExpressionStatement(\n ts.factory.createCallExpression(ts.factory.createIdentifier(functionName), undefined, [\n ts.factory.createStringLiteral(fqn),\n ts.factory.createStringLiteral(message),\n ]),\n );\n\n return condition ? ts.factory.createIfStatement(condition, mainStatement) : mainStatement;\n}\n\nfunction generateWarningsFile(projectRoot: string, functionDeclarations: ts.FunctionDeclaration[]) {\n const names = [...functionDeclarations].map((d) => d.name?.text).filter(Boolean);\n const exportedSymbols = [WARNING_FUNCTION_NAME, GET_PROPERTY_DESCRIPTOR, DEPRECATION_ERROR, ...names].join(',');\n\n const functionText = `function ${WARNING_FUNCTION_NAME}(name, deprecationMessage) {\n const deprecated = process.env.JSII_DEPRECATED;\n const deprecationMode = ['warn', 'fail', 'quiet'].includes(deprecated) ? deprecated : 'warn';\n const message = \\`\\${name} is deprecated.\\\\n \\${deprecationMessage.trim()}\\\\n This API will be removed in the next major release.\\`;\n switch (deprecationMode) {\n case \"fail\":\n throw new ${DEPRECATION_ERROR}(message);\n case \"warn\":\n console.warn(\"[WARNING]\", message);\n break;\n }\n}\n\nfunction ${GET_PROPERTY_DESCRIPTOR}(obj, prop) {\n const descriptor = Object.getOwnPropertyDescriptor(obj, prop);\n if (descriptor) {\n return descriptor;\n }\n const proto = Object.getPrototypeOf(obj);\n const prototypeDescriptor = proto && getPropertyDescriptor(proto, prop);\n if (prototypeDescriptor) {\n return prototypeDescriptor;\n }\n return {};\n}\n\nconst ${VISITED_OBJECTS_SET_NAME} = new Set();\n\nclass ${DEPRECATION_ERROR} extends Error {\n constructor(...args) {\n super(...args);\n Object.defineProperty(this, 'name', {\n configurable: false,\n enumerable: true,\n value: '${DEPRECATION_ERROR}',\n writable: false,\n });\n }\n}\n\nmodule.exports = {${exportedSymbols}}\n`;\n\n const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed });\n const resultFile = ts.createSourceFile(\n path.join(projectRoot, WARNINGSCODE_FILE_NAME),\n functionText,\n ts.ScriptTarget.Latest,\n false,\n ts.ScriptKind.JS,\n );\n\n const declarations = functionDeclarations.map((declaration) =>\n printer.printNode(ts.EmitHint.Unspecified, declaration, resultFile),\n );\n\n const content = declarations.concat(printer.printFile(resultFile)).join('\\n');\n\n fs.writeFileSync(path.join(projectRoot, WARNINGSCODE_FILE_NAME), content);\n}\n\nclass Transformer {\n private warningCallsWereInjected = false;\n\n public constructor(\n private readonly typeChecker: ts.TypeChecker,\n private readonly context: ts.TransformationContext,\n private readonly projectRoot: string,\n private readonly typeIndex: Map<string, spec.Type>,\n private readonly assembly: Assembly,\n ) {}\n\n public transform<T extends ts.Node>(node: T): T {\n this.warningCallsWereInjected = false;\n\n const result = this.visitEachChild(node);\n\n if (ts.isSourceFile(result) && this.warningCallsWereInjected) {\n const importDir = path.relative(path.dirname(result.fileName), this.projectRoot);\n const importPath = importDir.startsWith('..')\n ? unixPath(path.join(importDir, WARNINGSCODE_FILE_NAME))\n : `./${WARNINGSCODE_FILE_NAME}`;\n\n return ts.factory.updateSourceFile(result, [\n createRequireStatement(NAMESPACE, importPath),\n ...result.statements,\n ]) as any;\n }\n return result;\n }\n\n private visitEachChild<T extends ts.Node>(node: T): T {\n return ts.visitEachChild(node, this.visitor.bind(this), this.context);\n }\n\n private visitor<T extends ts.Node>(node: T): ts.VisitResult<T> {\n if (ts.isMethodDeclaration(node) && node.body != null) {\n const statements = this.getStatementsForDeclaration(node);\n this.warningCallsWereInjected = this.warningCallsWereInjected || statements.length > 0;\n return ts.factory.updateMethodDeclaration(\n node,\n node.modifiers,\n node.asteriskToken,\n node.name,\n node.questionToken,\n node.typeParameters,\n node.parameters,\n node.type,\n ts.factory.updateBlock(node.body, [\n ...wrapWithRethrow(\n statements,\n ts.factory.createPropertyAccessExpression(ts.factory.createThis(), node.name.getText(node.getSourceFile())),\n ),\n ...node.body.statements,\n ]),\n ) as any;\n } else if (ts.isGetAccessorDeclaration(node) && node.body != null) {\n const statements = this.getStatementsForDeclaration(node);\n this.warningCallsWereInjected = this.warningCallsWereInjected || statements.length > 0;\n return ts.factory.updateGetAccessorDeclaration(\n node,\n node.modifiers,\n node.name,\n node.parameters,\n node.type,\n ts.factory.updateBlock(node.body, [\n ...wrapWithRethrow(\n statements,\n ts.factory.createPropertyAccessExpression(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(\n ts.factory.createIdentifier(NAMESPACE),\n GET_PROPERTY_DESCRIPTOR,\n ),\n undefined,\n [ts.factory.createThis(), ts.factory.createStringLiteral(node.name.getText(node.getSourceFile()))],\n ),\n 'get',\n ),\n ),\n ...node.body.statements,\n ]),\n ) as any;\n } else if (ts.isSetAccessorDeclaration(node) && node.body != null) {\n const statements = this.getStatementsForDeclaration(node);\n this.warningCallsWereInjected = this.warningCallsWereInjected || statements.length > 0;\n return ts.factory.updateSetAccessorDeclaration(\n node,\n node.modifiers,\n node.name,\n node.parameters,\n ts.factory.updateBlock(node.body, [\n ...wrapWithRethrow(\n statements,\n ts.factory.createPropertyAccessExpression(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(\n ts.factory.createIdentifier(NAMESPACE),\n GET_PROPERTY_DESCRIPTOR,\n ),\n undefined,\n [ts.factory.createThis(), ts.factory.createStringLiteral(node.name.getText(node.getSourceFile()))],\n ),\n 'set',\n ),\n ),\n ...node.body.statements,\n ]),\n ) as any;\n } else if (ts.isConstructorDeclaration(node) && node.body != null) {\n const statements = this.getStatementsForDeclaration(node);\n this.warningCallsWereInjected = this.warningCallsWereInjected || statements.length > 0;\n return ts.factory.updateConstructorDeclaration(\n node,\n node.modifiers,\n node.parameters,\n ts.factory.updateBlock(node.body, insertStatements(node.body, wrapWithRethrow(statements, node.parent.name!))),\n ) as any;\n }\n\n return this.visitEachChild(node);\n }\n\n /**\n * @param getOrSet for property accessors, determines which of the getter or\n * setter should be used to get the caller function value.\n */\n private getStatementsForDeclaration(\n node: ts.MethodDeclaration | ts.GetAccessorDeclaration | ts.SetAccessorDeclaration | ts.ConstructorDeclaration,\n ): ts.Statement[] {\n const klass = node.parent;\n const classSymbolId = symbolIdentifier(this.typeChecker, this.typeChecker.getTypeAtLocation(klass).symbol);\n if (classSymbolId && this.typeIndex.has(classSymbolId)) {\n const classType = this.typeIndex.get(classSymbolId)! as spec.ClassType;\n\n if (ts.isConstructorDeclaration(node)) {\n const initializer = classType?.initializer;\n if (initializer) {\n return this.getStatements(classType, initializer);\n }\n }\n\n const methods = classType?.methods ?? [];\n const method = methods.find((m) => m.name === node.name?.getText());\n if (method) {\n return this.getStatements(classType, method);\n }\n\n const properties = classType?.properties ?? [];\n const property = properties.find((p) => p.name === node.name?.getText());\n if (property) {\n return createWarningStatementForElement(property, classType);\n }\n }\n return [];\n }\n\n private getStatements(classType: spec.ClassType, method: spec.Method | spec.Initializer) {\n const statements = createWarningStatementForElement(method, classType);\n for (const parameter of Object.values(method.parameters ?? {})) {\n const parameterType =\n this.assembly.types && spec.isNamedTypeReference(parameter.type)\n ? this.assembly.types[parameter.type.fqn]\n : undefined;\n\n if (parameterType) {\n const functionName = `${NAMESPACE}.${fnName(parameterType.fqn)}`;\n statements.push(\n ts.factory.createExpressionStatement(\n ts.factory.createCallExpression(ts.factory.createIdentifier(functionName), undefined, [\n ts.factory.createIdentifier(parameter.name),\n ]),\n ),\n );\n }\n }\n\n return statements;\n }\n}\n\nfunction createWarningStatementForElement(\n element: spec.Callable | spec.Property,\n classType: spec.ClassType,\n): ts.Statement[] {\n if (spec.isDeprecated(element)) {\n const elementName = (element as spec.Method | spec.Property).name;\n const fqn = elementName ? `${classType.fqn}#${elementName}` : classType.fqn;\n const message = element.docs?.deprecated ?? classType.docs?.deprecated;\n return [createWarningFunctionCall(fqn, message, undefined, true)];\n }\n return [];\n}\n\n/**\n * Inserts a list of statements in the correct position inside a block of statements.\n * If there is a `super` call, It inserts the statements just after it. Otherwise,\n * insert the statements right at the beginning of the block.\n */\nfunction insertStatements(block: ts.Block, newStatements: ts.Statement[]) {\n function splicePoint(statement: ts.Statement | undefined) {\n if (statement == null) {\n return 0;\n }\n let isSuper = false;\n statement.forEachChild((node) => {\n if (ts.isCallExpression(node) && node.expression.kind === ts.SyntaxKind.SuperKeyword) {\n isSuper = true;\n }\n });\n return isSuper ? 1 : 0;\n }\n\n const result = [...block.statements];\n result.splice(splicePoint(block.statements[0]), 0, ...newStatements);\n return ts.factory.createNodeArray(result);\n}\n\nfunction createRequireStatement(name: string, importPath: string): ts.Statement {\n return ts.factory.createVariableStatement(\n undefined,\n ts.factory.createVariableDeclarationList(\n [\n ts.factory.createVariableDeclaration(\n name,\n undefined,\n undefined,\n ts.factory.createCallExpression(ts.factory.createIdentifier('require'), undefined, [\n ts.factory.createStringLiteral(importPath),\n ]),\n ),\n ],\n ts.NodeFlags.Const,\n ),\n );\n}\n\n/**\n * Returns a ready-to-used function name (including a `require`, if necessary)\n */\nfunction importedFunctionName(typeName: string, assembly: Assembly, projectInfo: ProjectInfo) {\n const assemblies = projectInfo.dependencyClosure.concat(assembly);\n const { type, moduleName } = findType(typeName, assemblies);\n if (type) {\n return moduleName !== assembly.name\n ? `require(\"${moduleName}/${WARNINGSCODE_FILE_NAME}\").${fnName(type.fqn)}`\n : fnName(type.fqn);\n }\n return undefined;\n}\n\n/**\n * Find the type and module name in an array of assemblies\n * matching a given type name\n */\nfunction findType(typeName: string, assemblies: Assembly[]) {\n for (const asm of assemblies) {\n if (asm.metadata?.jsii?.compiledWithDeprecationWarnings) {\n const types = asm.types ?? {};\n for (const name of Object.keys(types)) {\n if (typeName === name) {\n return { type: types[name], moduleName: asm.name };\n }\n }\n }\n }\n return {};\n}\n\nfunction createTypeHandlerCall(\n functionName: string,\n parameter: string,\n collectionKind?: spec.CollectionKind,\n): ts.Statement {\n switch (collectionKind) {\n case spec.CollectionKind.Array:\n return ts.factory.createIfStatement(\n ts.factory.createBinaryExpression(\n ts.factory.createIdentifier(parameter),\n ts.SyntaxKind.ExclamationEqualsToken,\n ts.factory.createNull(),\n ),\n ts.factory.createForOfStatement(\n undefined,\n ts.factory.createVariableDeclarationList(\n [ts.factory.createVariableDeclaration(FOR_LOOP_ITEM_NAME)],\n ts.NodeFlags.Const,\n ),\n ts.factory.createIdentifier(parameter),\n createTypeHandlerCall(functionName, FOR_LOOP_ITEM_NAME),\n ),\n );\n case spec.CollectionKind.Map:\n return ts.factory.createIfStatement(\n ts.factory.createBinaryExpression(\n ts.factory.createIdentifier(parameter),\n ts.SyntaxKind.ExclamationEqualsToken,\n ts.factory.createNull(),\n ),\n ts.factory.createForOfStatement(\n undefined,\n ts.factory.createVariableDeclarationList(\n [ts.factory.createVariableDeclaration(FOR_LOOP_ITEM_NAME)],\n ts.NodeFlags.Const,\n ),\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('Object'), 'values'),\n undefined,\n [ts.factory.createIdentifier(parameter)],\n ),\n createTypeHandlerCall(functionName, FOR_LOOP_ITEM_NAME),\n ),\n );\n case undefined:\n return ts.factory.createIfStatement(\n ts.factory.createPrefixUnaryExpression(\n ts.SyntaxKind.ExclamationToken,\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(\n ts.factory.createIdentifier(VISITED_OBJECTS_SET_NAME),\n ts.factory.createIdentifier('has'),\n ),\n undefined,\n [ts.factory.createIdentifier(parameter)],\n ),\n ),\n ts.factory.createExpressionStatement(\n ts.factory.createCallExpression(ts.factory.createIdentifier(functionName), undefined, [\n ts.factory.createIdentifier(parameter),\n ]),\n ),\n );\n }\n}\n\n// We try-then-rethrow exceptions to avoid runtimes displaying an uncanny wall of text if the place\n// where the error was thrown is webpacked. For example, jest somehow manages to capture the throw\n// location and renders the source line (which may be the whole file) when bundled.\nfunction wrapWithRethrow(statements: ts.Statement[], caller: ts.Expression): ts.Statement[] {\n if (statements.length === 0) {\n return statements;\n }\n return [\n ts.factory.createTryStatement(\n ts.factory.createBlock(statements),\n ts.factory.createCatchClause(\n ts.factory.createVariableDeclaration('error'),\n ts.factory.createBlock([\n // If this is a DeprecationError, trim its stack trace to surface level before re-throwing,\n // so we don't carry out possibly confusing frames from injected code. That can be toggled\n // off by setting JSII_DEBUG=1, so we can also diagnose in-injected code faults.\n ts.factory.createIfStatement(\n ts.factory.createBinaryExpression(\n ts.factory.createBinaryExpression(\n ts.factory.createPropertyAccessExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('process'), 'env'),\n 'JSII_DEBUG',\n ),\n ts.SyntaxKind.ExclamationEqualsEqualsToken,\n ts.factory.createStringLiteral('1'),\n ),\n ts.SyntaxKind.AmpersandAmpersandToken,\n ts.factory.createBinaryExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('error'), 'name'),\n ts.SyntaxKind.EqualsEqualsEqualsToken,\n ts.factory.createStringLiteral(DEPRECATION_ERROR),\n ),\n ),\n ts.factory.createBlock([\n ts.factory.createExpressionStatement(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('Error'), 'captureStackTrace'),\n undefined,\n [ts.factory.createIdentifier('error'), caller],\n ),\n ),\n ]),\n ),\n ts.factory.createThrowStatement(ts.factory.createIdentifier('error')),\n ]),\n ),\n undefined,\n ),\n ];\n}\n\n/**\n * Force a path to be UNIXy (use `/` as a separator)\n *\n * `path.join()` etc. will use the system-dependent path separator (either `/` or `\\`\n * depending on your platform).\n *\n * However, if we actually emit the path-dependent separator to the `.js` files, then\n * files compiled with jsii on Windows cannot be used on any other platform. That seems\n * like an unnecessary restriction, especially since a `/` will work fine on Windows,\n * so make sure to always emit `/`.\n *\n * TSC itself always strictly emits `/` (or at least, emits the same what you put in).\n */\nfunction unixPath(filePath: string) {\n if (path.sep === '\\\\') {\n return filePath.replace(/\\\\/g, '/');\n }\n return filePath;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"deprecation-warnings.js","sourceRoot":"","sources":["../../src/transforms/deprecation-warnings.ts"],"names":[],"mappings":";;;AAAA,8BAA8B;AAC9B,kCAAkC;AAClC,mCAAmC;AAEnC,iCAAiC;AAEjC,mDAAuD;AAI1C,QAAA,sBAAsB,GAAG,mBAAmB,CAAC;AAC1D,MAAM,qBAAqB,GAAG,OAAO,CAAC;AACtC,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,SAAS,GAAG,yBAAyB,CAAC;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AC,mBAAmB,CAAC,iBAAiB,CAAC,CAClD,CACF,EACD,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC;gBACrB,EAAE,CAAC,OAAO,CAAC,yBAAyB,CAClC,EAAE,CAAC,OAAO,CAAC,oBAAoB,CAC7B,EAAE,CAAC,OAAO,CAAC,8BAA8B,CAAC,EAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAC,EACpG,SAAS,EACT,CAAC,EAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAC/C,CACF;aACF,CAAC,CACH;YACD,EAAE,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;SACtE,CAAC,CACH,EACD,SAAS,CACV;KACF,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAS,QAAQ,CAAC,QAAgB;IAChC,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;QACtB,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport * as spec from '@jsii/spec';\nimport { Assembly } from '@jsii/spec';\nimport * as ts from 'typescript';\n\nimport { symbolIdentifier } from '../common/symbol-id';\nimport { ProjectInfo } from '../project-info';\nimport { TypeTracker } from '../type-tracker';\n\nexport const WARNINGSCODE_FILE_NAME = '.warnings.jsii.js';\nconst WARNING_FUNCTION_NAME = 'print';\nconst PARAMETER_NAME = 'p';\nconst FOR_LOOP_ITEM_NAME = 'o';\nconst NAMESPACE = 'jsiiDeprecationWarnings';\nconst VISITED_OBJECTS_SET_NAME = 'visitedObjects';\nconst DEPRECATION_ERROR = 'DeprecationError';\nconst GET_PROPERTY_DESCRIPTOR = 'getPropertyDescriptor';\nconst VALIDATORS_OBJ = 'VALIDATORS';\n\nexport class DeprecationWarningsInjector {\n private transformers: ts.CustomTransformers = {\n before: [],\n };\n\n private shouldRenderValidatorCache: Record<string, boolean> = {};\n private validatorCacheSeenSet = new Set<string>();\n\n public constructor(private readonly typeChecker: ts.TypeChecker, private readonly typeTracker: TypeTracker) {}\n\n public process(assembly: Assembly, projectInfo: ProjectInfo) {\n const projectRoot = projectInfo.projectRoot;\n const validationFunctions: ts.ObjectLiteralElementLike[] = [];\n\n const types = assembly.types ?? {};\n for (const type of Object.values(types)) {\n const fnStatements = this.generateTypeValidation(type, assembly, projectInfo, types);\n if (fnStatements.length === 0) {\n continue;\n }\n\n const paramValue = ts.factory.createParameterDeclaration(undefined, undefined, PARAMETER_NAME);\n const functionName = fnName(type.fqn);\n const functionExpr = ts.factory.createFunctionExpression(\n undefined,\n undefined,\n ts.factory.createIdentifier(functionName),\n [],\n [paramValue],\n undefined,\n createFunctionBlock(fnStatements),\n );\n validationFunctions.push(ts.factory.createPropertyAssignment(functionName, functionExpr));\n }\n\n const fileStatements: ts.Statement[] = [];\n fileStatements.push(\n ts.factory.createVariableStatement(\n undefined,\n ts.factory.createVariableDeclarationList(\n [\n ts.factory.createVariableDeclaration(\n VALIDATORS_OBJ,\n undefined,\n undefined,\n ts.factory.createObjectLiteralExpression(validationFunctions),\n ),\n ],\n ts.NodeFlags.Const,\n ),\n ),\n );\n\n this.transformers = {\n before: [\n (context) => {\n const transformer = new Transformer(\n this.typeChecker,\n context,\n projectRoot,\n this.buildTypeIndex(assembly),\n assembly,\n );\n return transformer.transform.bind(transformer);\n },\n ],\n };\n\n generateWarningsFile(projectRoot, fileStatements);\n }\n\n public get customTransformers(): ts.CustomTransformers {\n return this.transformers;\n }\n\n private buildTypeIndex(assembly: Assembly): Map<string, spec.Type> {\n const result = new Map<string, spec.Type>();\n\n for (const type of Object.values(assembly.types ?? {})) {\n const symbolId = type.symbolId;\n if (symbolId) {\n result.set(symbolId, type);\n }\n }\n\n return result;\n }\n\n /**\n * Whether the validator for the given type should be rendered\n *\n * A validator should be rendered if:\n *\n * - It contains any deprecated members (base case).\n * - It references any other types whose validators should be rendered.\n * - It inherits from other types whose validators should be rendered.\n * - It references types that reference this type (recursive types).\n * - It references types from another assembly.\n *\n * For the last one we technically return `true`, indicating that a validator\n * *should* be rendered, but when we get to rendering no statements are\n * actually produced and the validator function is never rendered. This was\n * pre-existing behavior that I didn't change because introducing calls into\n * other assemblies out of the blue introduces risk.\n */\n private shouldRenderValidator(type: spec.Type, assembly: Assembly): boolean {\n if (this.shouldRenderValidatorCache[type.fqn] !== undefined) {\n return this.shouldRenderValidatorCache[type.fqn];\n }\n\n if (type.fqn === '@scope/jsii-calc-base.TypeToContainVeryBaseProps') {\n debugger;\n }\n\n if (this.validatorCacheSeenSet.has(type.fqn)) {\n // To be safe we need to say this is true.\n return true;\n }\n if (!type.fqn.startsWith(`${assembly.name}.`)) {\n // Foreign type, always check\n return true;\n }\n this.validatorCacheSeenSet.add(type.fqn);\n\n this.shouldRenderValidatorCache[type.fqn] = calculate.call(this);\n this.validatorCacheSeenSet.delete(type.fqn);\n\n return this.shouldRenderValidatorCache[type.fqn];\n\n function calculate(this: DeprecationWarningsInjector): boolean {\n if (spec.isDeprecated(type)) {\n return true;\n }\n if (spec.isEnumType(type)) {\n return (type.members ?? []).some(spec.isDeprecated);\n }\n if (spec.isInterfaceType(type) && type.datatype) {\n for (const prop of type.properties ?? []) {\n if (spec.isDeprecated(prop)) {\n return true;\n }\n\n const typesToInspect = spec.isCollectionTypeReference(prop.type)\n ? [prop.type.collection.elementtype]\n : spec.isUnionTypeReference(prop.type)\n ? prop.type.union.types\n : [prop.type];\n\n for (const typeToInspect of typesToInspect) {\n if (!spec.isNamedTypeReference(typeToInspect)) {\n continue;\n }\n\n // Is from a different assembly?\n const typeObj = findType2(typeToInspect.fqn, assembly);\n if (typeObj === 'other-assembly') {\n return true;\n }\n if (this.shouldRenderValidator(typeObj, assembly)) {\n return true;\n }\n }\n }\n\n for (const interfaceName of type.interfaces ?? []) {\n const typeObj = findType2(interfaceName, assembly);\n if (typeObj === 'other-assembly') {\n return true;\n }\n if (this.shouldRenderValidator(typeObj, assembly)) {\n return true;\n }\n }\n }\n\n return false;\n }\n }\n\n private generateTypeValidation(\n type: spec.Type,\n assembly: Assembly,\n projectInfo: ProjectInfo,\n types: Record<string, spec.Type>,\n ): ts.Statement[] {\n if (!this.shouldRenderValidator(type, assembly)) {\n return [];\n }\n\n const statements: ts.Statement[] = [];\n let isEmpty = true;\n\n // This will add the parameter to the set of visited objects, to prevent infinite recursion\n statements.push(\n ts.factory.createExpressionStatement(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(VISITED_OBJECTS_SET_NAME), 'add'),\n undefined,\n [ts.factory.createIdentifier(PARAMETER_NAME)],\n ),\n ),\n );\n\n const tryStatements = [];\n if (spec.isDeprecated(type) && spec.isEnumType(type)) {\n // The type is deprecated\n tryStatements.push(createWarningFunctionCall(type.fqn, type.docs?.deprecated));\n isEmpty = false;\n }\n\n if (spec.isEnumType(type) && type.locationInModule?.filename) {\n // Check for deprecated enum members\n //\n // We need to compare to the value of the deprecated enum. We can do that in one of 2 ways:\n //\n // - Compare against `require('./actual-file').EnumType.SOME_ENUM_MEMBER`\n // - Look up the enum member value and compare against `'some-enum-member'`.\n //\n // The first one introduces a circular dependency between this file and `actual-file.js`, so we\n // will go with the second.\n //\n // One complication: two enum members can have the same value (shouldn't, but can!) where\n // one symbolic name is deprecated but the other isn't. In that case we don't treat it as deprecated.\n const memDecls = this.typeTracker.getEnumMembers(type.fqn);\n\n const nonDeprecatedValues = new Set(\n (type.members ?? [])\n .filter((m) => !spec.isDeprecated(m))\n .map((m) => this.typeChecker.getConstantValue(memDecls[m.name])!),\n );\n const deprecatedMembers = (type.members ?? []).filter(spec.isDeprecated);\n\n for (const member of deprecatedMembers) {\n const constantValue = this.typeChecker.getConstantValue(memDecls[member.name])!;\n if (nonDeprecatedValues.has(constantValue)) {\n // Collission with non-deprecated enum member\n continue;\n }\n\n const condition = ts.factory.createBinaryExpression(\n ts.factory.createIdentifier(PARAMETER_NAME),\n ts.SyntaxKind.EqualsEqualsEqualsToken,\n typeof constantValue === 'string'\n ? ts.factory.createStringLiteral(constantValue)\n : ts.factory.createNumericLiteral(constantValue),\n );\n tryStatements.push(createWarningFunctionCall(`${type.fqn}#${member.name}`, member.docs?.deprecated, condition));\n isEmpty = false;\n }\n } else if (spec.isInterfaceType(type) && type.datatype) {\n const { statementsByProp, excludedProps } = this.processInterfaceType(\n type,\n types,\n assembly,\n projectInfo,\n undefined,\n undefined,\n );\n\n for (const [name, statement] of statementsByProp.entries()) {\n if (!excludedProps.has(name)) {\n tryStatements.push(statement);\n isEmpty = false;\n }\n }\n }\n\n statements.push(\n ts.factory.createTryStatement(\n ts.factory.createBlock(tryStatements),\n undefined,\n ts.factory.createBlock([\n ts.factory.createExpressionStatement(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(\n ts.factory.createIdentifier(VISITED_OBJECTS_SET_NAME),\n 'delete',\n ),\n undefined,\n [ts.factory.createIdentifier(PARAMETER_NAME)],\n ),\n ),\n ]),\n ),\n );\n\n return isEmpty ? [] : statements;\n }\n\n private processInterfaceType(\n type: spec.InterfaceType,\n types: { [p: string]: spec.Type },\n assembly: Assembly,\n projectInfo: ProjectInfo,\n statementsByProp: Map<string, ts.Statement> = new Map<string, ts.Statement>(),\n excludedProps: Set<string> = new Set<string>(),\n ) {\n for (const prop of Object.values(type.properties ?? {})) {\n const fqn = `${type.fqn}#${prop.name}`;\n if (spec.isDeprecated(prop) || spec.isDeprecated(type)) {\n // If the property individually is deprecated, or the entire type is deprecated\n const deprecatedDocs = prop.docs?.deprecated ?? type.docs?.deprecated;\n const statement = createWarningFunctionCall(\n fqn,\n deprecatedDocs,\n ts.factory.createBinaryExpression(\n ts.factory.createStringLiteral(prop.name),\n ts.SyntaxKind.InKeyword,\n ts.factory.createIdentifier(PARAMETER_NAME),\n ),\n undefined,\n );\n statementsByProp.set(prop.name, statement);\n } else {\n /* If a prop is not deprecated, we don't want to generate a warning for it,\n even if another property with the same name is deprecated in another\n super-interface. */\n excludedProps.add(prop.name);\n }\n\n if (spec.isNamedTypeReference(prop.type) && Object.keys(types).includes(prop.type.fqn)) {\n if (this.shouldRenderValidator(types[prop.type.fqn], assembly)) {\n const functionName = importedFunctionName(prop.type.fqn, assembly, projectInfo);\n if (functionName) {\n const statement = createTypeHandlerCall(functionName, `${PARAMETER_NAME}.${prop.name}`);\n statementsByProp.set(`${prop.name}_`, statement);\n }\n }\n } else if (\n spec.isCollectionTypeReference(prop.type) &&\n spec.isNamedTypeReference(prop.type.collection.elementtype)\n ) {\n const functionName = importedFunctionName(prop.type.collection.elementtype.fqn, assembly, projectInfo);\n if (functionName) {\n const statement = createTypeHandlerCall(\n functionName,\n `${PARAMETER_NAME}.${prop.name}`,\n prop.type.collection.kind,\n );\n statementsByProp.set(`${prop.name}_`, statement);\n }\n } else if (\n spec.isUnionTypeReference(prop.type) &&\n spec.isNamedTypeReference(prop.type.union.types[0]) &&\n Object.keys(types).includes(prop.type.union.types[0].fqn)\n ) {\n const functionName = importedFunctionName(prop.type.union.types[0].fqn, assembly, projectInfo);\n if (functionName) {\n const statement = createTypeHandlerCall(functionName, `${PARAMETER_NAME}.${prop.name}`);\n statementsByProp.set(`${prop.name}_`, statement);\n }\n }\n }\n\n // We also generate calls to all the supertypes\n for (const interfaceName of type.interfaces ?? []) {\n const assemblies = projectInfo.dependencyClosure.concat(assembly);\n const superType = findType(interfaceName, assemblies);\n if (superType.type) {\n this.processInterfaceType(\n superType.type as spec.InterfaceType,\n types,\n assembly,\n projectInfo,\n statementsByProp,\n excludedProps,\n );\n }\n }\n return { statementsByProp, excludedProps };\n }\n}\n\nfunction fnName(fqn: string): string {\n return fqn.replace(/[^\\w\\d]/g, '_');\n}\n\nfunction createFunctionBlock(statements: ts.Statement[]): ts.Block {\n if (statements.length > 0) {\n const validation = ts.factory.createIfStatement(\n ts.factory.createBinaryExpression(\n ts.factory.createIdentifier(PARAMETER_NAME),\n ts.SyntaxKind.EqualsEqualsToken,\n ts.factory.createNull(),\n ),\n ts.factory.createReturnStatement(),\n );\n return ts.factory.createBlock([validation, ...statements], true);\n }\n return ts.factory.createBlock([], true);\n}\n\nfunction createWarningFunctionCall(\n fqn: string,\n message = '',\n condition?: ts.Expression,\n includeNamespace = false,\n): ts.Statement {\n const functionName = includeNamespace ? `${NAMESPACE}.${WARNING_FUNCTION_NAME}` : WARNING_FUNCTION_NAME;\n\n const mainStatement = ts.factory.createExpressionStatement(\n ts.factory.createCallExpression(ts.factory.createIdentifier(functionName), undefined, [\n ts.factory.createStringLiteral(fqn),\n ts.factory.createStringLiteral(message),\n ]),\n );\n\n return condition ? ts.factory.createIfStatement(condition, mainStatement) : mainStatement;\n}\n\nfunction generateWarningsFile(projectRoot: string, validatorStatements: ts.Statement[]) {\n const functionText = `function ${WARNING_FUNCTION_NAME}(name, deprecationMessage) {\n const deprecated = process.env.JSII_DEPRECATED;\n const deprecationMode = ['warn', 'fail', 'quiet'].includes(deprecated) ? deprecated : 'warn';\n const message = \\`\\${name} is deprecated.\\\\n \\${deprecationMessage.trim()}\\\\n This API will be removed in the next major release.\\`;\n switch (deprecationMode) {\n case \"fail\":\n throw new ${DEPRECATION_ERROR}(message);\n case \"warn\":\n console.warn(\"[WARNING]\", message);\n break;\n }\n}\n\nfunction ${GET_PROPERTY_DESCRIPTOR}(obj, prop) {\n const descriptor = Object.getOwnPropertyDescriptor(obj, prop);\n if (descriptor) {\n return descriptor;\n }\n const proto = Object.getPrototypeOf(obj);\n const prototypeDescriptor = proto && getPropertyDescriptor(proto, prop);\n if (prototypeDescriptor) {\n return prototypeDescriptor;\n }\n return {};\n}\n\nconst ${VISITED_OBJECTS_SET_NAME} = new Set();\n\nclass ${DEPRECATION_ERROR} extends Error {\n constructor(...args) {\n super(...args);\n Object.defineProperty(this, 'name', {\n configurable: false,\n enumerable: true,\n value: '${DEPRECATION_ERROR}',\n writable: false,\n });\n }\n}\n\nfunction nop() {\n}\n\nmodule.exports = new Proxy({}, {\n get(target, prop, receiver) {\n if (prop === '${WARNING_FUNCTION_NAME}') return ${WARNING_FUNCTION_NAME};\n if (prop === '${GET_PROPERTY_DESCRIPTOR}') return ${GET_PROPERTY_DESCRIPTOR};\n if (prop === '${DEPRECATION_ERROR}') return ${DEPRECATION_ERROR};\n\n return ${VALIDATORS_OBJ}[prop] ?? nop;\n },\n});\n`;\n\n const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed });\n const resultFile = ts.createSourceFile(\n path.join(projectRoot, WARNINGSCODE_FILE_NAME),\n functionText,\n ts.ScriptTarget.Latest,\n false,\n ts.ScriptKind.JS,\n );\n\n const declarations = validatorStatements.map((st) => printer.printNode(ts.EmitHint.Unspecified, st, resultFile));\n\n const content = declarations.concat(printer.printFile(resultFile)).join('\\n');\n\n fs.writeFileSync(path.join(projectRoot, WARNINGSCODE_FILE_NAME), content);\n}\n\nclass Transformer {\n private warningCallsWereInjected = false;\n\n public constructor(\n private readonly typeChecker: ts.TypeChecker,\n private readonly context: ts.TransformationContext,\n private readonly projectRoot: string,\n private readonly typeIndex: Map<string, spec.Type>,\n private readonly assembly: Assembly,\n ) {}\n\n public transform<T extends ts.Node>(node: T): T {\n this.warningCallsWereInjected = false;\n\n const result = this.visitEachChild(node);\n\n if (ts.isSourceFile(result) && this.warningCallsWereInjected) {\n const importDir = path.relative(path.dirname(result.fileName), this.projectRoot);\n const importPath = importDir.startsWith('..')\n ? unixPath(path.join(importDir, WARNINGSCODE_FILE_NAME))\n : `./${WARNINGSCODE_FILE_NAME}`;\n\n return ts.factory.updateSourceFile(result, [\n createRequireStatement(NAMESPACE, importPath),\n ...result.statements,\n ]) as any;\n }\n return result;\n }\n\n private visitEachChild<T extends ts.Node>(node: T): T {\n return ts.visitEachChild(node, this.visitor.bind(this), this.context);\n }\n\n private visitor<T extends ts.Node>(node: T): ts.VisitResult<T> {\n if (ts.isMethodDeclaration(node) && node.body != null) {\n const statements = this.getStatementsForDeclaration(node);\n this.warningCallsWereInjected = this.warningCallsWereInjected || statements.length > 0;\n return ts.factory.updateMethodDeclaration(\n node,\n node.modifiers,\n node.asteriskToken,\n node.name,\n node.questionToken,\n node.typeParameters,\n node.parameters,\n node.type,\n ts.factory.updateBlock(node.body, [\n ...wrapWithRethrow(\n statements,\n ts.factory.createPropertyAccessExpression(ts.factory.createThis(), node.name.getText(node.getSourceFile())),\n ),\n ...node.body.statements,\n ]),\n ) as any;\n } else if (ts.isGetAccessorDeclaration(node) && node.body != null) {\n const statements = this.getStatementsForDeclaration(node);\n this.warningCallsWereInjected = this.warningCallsWereInjected || statements.length > 0;\n return ts.factory.updateGetAccessorDeclaration(\n node,\n node.modifiers,\n node.name,\n node.parameters,\n node.type,\n ts.factory.updateBlock(node.body, [\n ...wrapWithRethrow(\n statements,\n ts.factory.createPropertyAccessExpression(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(\n ts.factory.createIdentifier(NAMESPACE),\n GET_PROPERTY_DESCRIPTOR,\n ),\n undefined,\n [ts.factory.createThis(), ts.factory.createStringLiteral(node.name.getText(node.getSourceFile()))],\n ),\n 'get',\n ),\n ),\n ...node.body.statements,\n ]),\n ) as any;\n } else if (ts.isSetAccessorDeclaration(node) && node.body != null) {\n const statements = this.getStatementsForDeclaration(node);\n this.warningCallsWereInjected = this.warningCallsWereInjected || statements.length > 0;\n return ts.factory.updateSetAccessorDeclaration(\n node,\n node.modifiers,\n node.name,\n node.parameters,\n ts.factory.updateBlock(node.body, [\n ...wrapWithRethrow(\n statements,\n ts.factory.createPropertyAccessExpression(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(\n ts.factory.createIdentifier(NAMESPACE),\n GET_PROPERTY_DESCRIPTOR,\n ),\n undefined,\n [ts.factory.createThis(), ts.factory.createStringLiteral(node.name.getText(node.getSourceFile()))],\n ),\n 'set',\n ),\n ),\n ...node.body.statements,\n ]),\n ) as any;\n } else if (ts.isConstructorDeclaration(node) && node.body != null) {\n const statements = this.getStatementsForDeclaration(node);\n this.warningCallsWereInjected = this.warningCallsWereInjected || statements.length > 0;\n return ts.factory.updateConstructorDeclaration(\n node,\n node.modifiers,\n node.parameters,\n ts.factory.updateBlock(node.body, insertStatements(node.body, wrapWithRethrow(statements, node.parent.name!))),\n ) as any;\n }\n\n return this.visitEachChild(node);\n }\n\n /**\n * @param getOrSet for property accessors, determines which of the getter or\n * setter should be used to get the caller function value.\n */\n private getStatementsForDeclaration(\n node: ts.MethodDeclaration | ts.GetAccessorDeclaration | ts.SetAccessorDeclaration | ts.ConstructorDeclaration,\n ): ts.Statement[] {\n const klass = node.parent;\n const classSymbolId = symbolIdentifier(this.typeChecker, this.typeChecker.getTypeAtLocation(klass).symbol);\n if (classSymbolId && this.typeIndex.has(classSymbolId)) {\n const classType = this.typeIndex.get(classSymbolId)! as spec.ClassType;\n\n if (ts.isConstructorDeclaration(node)) {\n const initializer = classType?.initializer;\n if (initializer) {\n return this.getStatements(classType, initializer);\n }\n }\n\n const methods = classType?.methods ?? [];\n const method = methods.find((m) => m.name === node.name?.getText());\n if (method) {\n return this.getStatements(classType, method);\n }\n\n const properties = classType?.properties ?? [];\n const property = properties.find((p) => p.name === node.name?.getText());\n if (property) {\n return createWarningStatementForElement(property, classType);\n }\n }\n return [];\n }\n\n private getStatements(classType: spec.ClassType, method: spec.Method | spec.Initializer) {\n const statements = createWarningStatementForElement(method, classType);\n for (const parameter of Object.values(method.parameters ?? {})) {\n const parameterType =\n this.assembly.types && spec.isNamedTypeReference(parameter.type)\n ? this.assembly.types[parameter.type.fqn]\n : undefined;\n\n if (parameterType) {\n const functionName = `${NAMESPACE}.${fnName(parameterType.fqn)}`;\n statements.push(\n ts.factory.createExpressionStatement(\n ts.factory.createCallExpression(ts.factory.createIdentifier(functionName), undefined, [\n ts.factory.createIdentifier(parameter.name),\n ]),\n ),\n );\n }\n }\n\n return statements;\n }\n}\n\nfunction findType2(fqn: string, assembly: Assembly): spec.Type | 'other-assembly' {\n // Is from a different assembly?\n if (!fqn.startsWith(`${assembly.name}.`)) {\n return 'other-assembly';\n }\n\n const type = (assembly.types ?? {})[fqn];\n if (!type) {\n throw new Error(`Could not find type in same assembly: ${fqn}`);\n }\n return type;\n}\n\nfunction createWarningStatementForElement(\n element: spec.Callable | spec.Property,\n classType: spec.ClassType,\n): ts.Statement[] {\n if (spec.isDeprecated(element)) {\n const elementName = (element as spec.Method | spec.Property).name;\n const fqn = elementName ? `${classType.fqn}#${elementName}` : classType.fqn;\n const message = element.docs?.deprecated ?? classType.docs?.deprecated;\n return [createWarningFunctionCall(fqn, message, undefined, true)];\n }\n return [];\n}\n\n/**\n * Inserts a list of statements in the correct position inside a block of statements.\n * If there is a `super` call, It inserts the statements just after it. Otherwise,\n * insert the statements right at the beginning of the block.\n */\nfunction insertStatements(block: ts.Block, newStatements: ts.Statement[]) {\n function splicePoint(statement: ts.Statement | undefined) {\n if (statement == null) {\n return 0;\n }\n let isSuper = false;\n statement.forEachChild((node) => {\n if (ts.isCallExpression(node) && node.expression.kind === ts.SyntaxKind.SuperKeyword) {\n isSuper = true;\n }\n });\n return isSuper ? 1 : 0;\n }\n\n const result = [...block.statements];\n result.splice(splicePoint(block.statements[0]), 0, ...newStatements);\n return ts.factory.createNodeArray(result);\n}\n\nfunction createRequireStatement(name: string, importPath: string): ts.Statement {\n return ts.factory.createVariableStatement(\n undefined,\n ts.factory.createVariableDeclarationList(\n [\n ts.factory.createVariableDeclaration(\n name,\n undefined,\n undefined,\n ts.factory.createCallExpression(ts.factory.createIdentifier('require'), undefined, [\n ts.factory.createStringLiteral(importPath),\n ]),\n ),\n ],\n ts.NodeFlags.Const,\n ),\n );\n}\n\n/**\n * Returns a ready-to-used function name (including a `require`, if necessary)\n */\nfunction importedFunctionName(typeName: string, assembly: Assembly, projectInfo: ProjectInfo) {\n const assemblies = projectInfo.dependencyClosure.concat(assembly);\n const { type, moduleName } = findType(typeName, assemblies);\n if (type) {\n return moduleName !== assembly.name\n ? `require(\"${moduleName}/${WARNINGSCODE_FILE_NAME}\").${fnName(type.fqn)}`\n : fnName(type.fqn);\n }\n return undefined;\n}\n\n/**\n * Find the type and module name in an array of assemblies\n * matching a given type name\n */\nfunction findType(typeName: string, assemblies: Assembly[]) {\n for (const asm of assemblies) {\n if (asm.metadata?.jsii?.compiledWithDeprecationWarnings) {\n const types = asm.types ?? {};\n for (const name of Object.keys(types)) {\n if (typeName === name) {\n return { type: types[name], moduleName: asm.name };\n }\n }\n }\n }\n return {};\n}\n\nfunction createTypeHandlerCall(\n functionName: string,\n parameter: string,\n collectionKind?: spec.CollectionKind,\n): ts.Statement {\n switch (collectionKind) {\n case spec.CollectionKind.Array:\n return ts.factory.createIfStatement(\n ts.factory.createBinaryExpression(\n ts.factory.createIdentifier(parameter),\n ts.SyntaxKind.ExclamationEqualsToken,\n ts.factory.createNull(),\n ),\n ts.factory.createForOfStatement(\n undefined,\n ts.factory.createVariableDeclarationList(\n [ts.factory.createVariableDeclaration(FOR_LOOP_ITEM_NAME)],\n ts.NodeFlags.Const,\n ),\n ts.factory.createIdentifier(parameter),\n createTypeHandlerCall(functionName, FOR_LOOP_ITEM_NAME),\n ),\n );\n case spec.CollectionKind.Map:\n return ts.factory.createIfStatement(\n ts.factory.createBinaryExpression(\n ts.factory.createIdentifier(parameter),\n ts.SyntaxKind.ExclamationEqualsToken,\n ts.factory.createNull(),\n ),\n ts.factory.createForOfStatement(\n undefined,\n ts.factory.createVariableDeclarationList(\n [ts.factory.createVariableDeclaration(FOR_LOOP_ITEM_NAME)],\n ts.NodeFlags.Const,\n ),\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('Object'), 'values'),\n undefined,\n [ts.factory.createIdentifier(parameter)],\n ),\n createTypeHandlerCall(functionName, FOR_LOOP_ITEM_NAME),\n ),\n );\n case undefined:\n return ts.factory.createIfStatement(\n ts.factory.createPrefixUnaryExpression(\n ts.SyntaxKind.ExclamationToken,\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(\n ts.factory.createIdentifier(VISITED_OBJECTS_SET_NAME),\n ts.factory.createIdentifier('has'),\n ),\n undefined,\n [ts.factory.createIdentifier(parameter)],\n ),\n ),\n ts.factory.createExpressionStatement(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('module.exports'), functionName),\n undefined,\n [ts.factory.createIdentifier(parameter)],\n ),\n ),\n );\n }\n}\n\n// We try-then-rethrow exceptions to avoid runtimes displaying an uncanny wall of text if the place\n// where the error was thrown is webpacked. For example, jest somehow manages to capture the throw\n// location and renders the source line (which may be the whole file) when bundled.\nfunction wrapWithRethrow(statements: ts.Statement[], caller: ts.Expression): ts.Statement[] {\n if (statements.length === 0) {\n return statements;\n }\n return [\n ts.factory.createTryStatement(\n ts.factory.createBlock(statements),\n ts.factory.createCatchClause(\n ts.factory.createVariableDeclaration('error'),\n ts.factory.createBlock([\n // If this is a DeprecationError, trim its stack trace to surface level before re-throwing,\n // so we don't carry out possibly confusing frames from injected code. That can be toggled\n // off by setting JSII_DEBUG=1, so we can also diagnose in-injected code faults.\n ts.factory.createIfStatement(\n ts.factory.createBinaryExpression(\n ts.factory.createBinaryExpression(\n ts.factory.createPropertyAccessExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('process'), 'env'),\n 'JSII_DEBUG',\n ),\n ts.SyntaxKind.ExclamationEqualsEqualsToken,\n ts.factory.createStringLiteral('1'),\n ),\n ts.SyntaxKind.AmpersandAmpersandToken,\n ts.factory.createBinaryExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('error'), 'name'),\n ts.SyntaxKind.EqualsEqualsEqualsToken,\n ts.factory.createStringLiteral(DEPRECATION_ERROR),\n ),\n ),\n ts.factory.createBlock([\n ts.factory.createExpressionStatement(\n ts.factory.createCallExpression(\n ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('Error'), 'captureStackTrace'),\n undefined,\n [ts.factory.createIdentifier('error'), caller],\n ),\n ),\n ]),\n ),\n ts.factory.createThrowStatement(ts.factory.createIdentifier('error')),\n ]),\n ),\n undefined,\n ),\n ];\n}\n\n/**\n * Force a path to be UNIXy (use `/` as a separator)\n *\n * `path.join()` etc. will use the system-dependent path separator (either `/` or `\\`\n * depending on your platform).\n *\n * However, if we actually emit the path-dependent separator to the `.js` files, then\n * files compiled with jsii on Windows cannot be used on any other platform. That seems\n * like an unnecessary restriction, especially since a `/` will work fine on Windows,\n * so make sure to always emit `/`.\n *\n * TSC itself always strictly emits `/` (or at least, emits the same what you put in).\n */\nfunction unixPath(filePath: string) {\n if (path.sep === '\\\\') {\n return filePath.replace(/\\\\/g, '/');\n }\n return filePath;\n}\n"]}
|
package/lib/version.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** The short version number for this JSII compiler (e.g: `X.Y.Z`) */
|
|
2
|
-
export declare const SHORT_VERSION = "5.9.
|
|
2
|
+
export declare const SHORT_VERSION = "5.9.37-dev.0";
|
|
3
3
|
/** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */
|
|
4
|
-
export declare const VERSION = "5.9.
|
|
4
|
+
export declare const VERSION = "5.9.37-dev.0 (build 4886180)";
|
|
5
5
|
/** The release line identifier for this JSII compiler (e.g: `X.Y`) */
|
|
6
6
|
export declare const RELEASE_LINE = "5.9";
|
|
7
7
|
//# sourceMappingURL=version.d.ts.map
|
package/lib/version.js
CHANGED
|
@@ -4,9 +4,9 @@ exports.RELEASE_LINE = exports.VERSION = exports.SHORT_VERSION = void 0;
|
|
|
4
4
|
const typescript_1 = require("typescript");
|
|
5
5
|
// GENERATED: This file is generated by build-tools/code-gen.ts -- Do not edit by hand!
|
|
6
6
|
/** The short version number for this JSII compiler (e.g: `X.Y.Z`) */
|
|
7
|
-
exports.SHORT_VERSION = '5.9.
|
|
7
|
+
exports.SHORT_VERSION = '5.9.37-dev.0';
|
|
8
8
|
/** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */
|
|
9
|
-
exports.VERSION = '5.9.
|
|
9
|
+
exports.VERSION = '5.9.37-dev.0 (build 4886180)';
|
|
10
10
|
/** The release line identifier for this JSII compiler (e.g: `X.Y`) */
|
|
11
11
|
exports.RELEASE_LINE = typescript_1.versionMajorMinor;
|
|
12
12
|
//# sourceMappingURL=version.js.map
|
package/lib/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAE/C,uFAAuF;AAEvF,qEAAqE;AACxD,QAAA,aAAa,GAAG,cAAc,CAAC;AAE5C,yFAAyF;AAC5E,QAAA,OAAO,GAAG,8BAA8B,CAAC;AAEtD,sEAAsE;AACzD,QAAA,YAAY,GAAG,8BAAiB,CAAC","sourcesContent":["import { versionMajorMinor } from 'typescript';\n\n// GENERATED: This file is generated by build-tools/code-gen.ts -- Do not edit by hand!\n\n/** The short version number for this JSII compiler (e.g: `X.Y.Z`) */\nexport const SHORT_VERSION = '5.9.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAE/C,uFAAuF;AAEvF,qEAAqE;AACxD,QAAA,aAAa,GAAG,cAAc,CAAC;AAE5C,yFAAyF;AAC5E,QAAA,OAAO,GAAG,8BAA8B,CAAC;AAEtD,sEAAsE;AACzD,QAAA,YAAY,GAAG,8BAAiB,CAAC","sourcesContent":["import { versionMajorMinor } from 'typescript';\n\n// GENERATED: This file is generated by build-tools/code-gen.ts -- Do not edit by hand!\n\n/** The short version number for this JSII compiler (e.g: `X.Y.Z`) */\nexport const SHORT_VERSION = '5.9.37-dev.0';\n\n/** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */\nexport const VERSION = '5.9.37-dev.0 (build 4886180)';\n\n/** The release line identifier for this JSII compiler (e.g: `X.Y`) */\nexport const RELEASE_LINE = versionMajorMinor;\n"]}
|
package/package.json
CHANGED
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
"npm": "^9.9.4",
|
|
65
65
|
"npm-check-updates": "^16",
|
|
66
66
|
"prettier": "^2.8.8",
|
|
67
|
-
"projen": "^0.99.
|
|
67
|
+
"projen": "^0.99.33",
|
|
68
68
|
"tar": "^7.5.13",
|
|
69
|
-
"ts-jest": "^29.4.
|
|
69
|
+
"ts-jest": "^29.4.9",
|
|
70
70
|
"ts-node": "^10.9.2"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"publishConfig": {
|
|
93
93
|
"access": "public"
|
|
94
94
|
},
|
|
95
|
-
"version": "5.9.
|
|
95
|
+
"version": "5.9.37-dev.0",
|
|
96
96
|
"types": "lib/index.d.ts",
|
|
97
97
|
"exports": {
|
|
98
98
|
".": "./lib/index.js",
|