jsii-reflect 1.114.1 → 1.116.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.
- package/bin/jsii-tree.js +5 -1
- package/lib/assembly.d.ts +4 -0
- package/lib/assembly.js +6 -0
- package/lib/type-system.d.ts +10 -0
- package/lib/type-system.js +27 -6
- package/package.json +7 -7
- package/test/__snapshots__/jsii-tree.test.js.snap +95 -1
- package/test/__snapshots__/tree.test.js.snap +63 -1
- package/test/__snapshots__/type-system.test.js.snap +5 -1
- package/test/features.d.ts +3 -0
- package/test/features.js +5 -0
- package/test/tree.test.js +4 -1
- package/test/type-system.test.js +4 -1
package/bin/jsii-tree.js
CHANGED
|
@@ -4,6 +4,7 @@ require("@jsii/check-node/run");
|
|
|
4
4
|
const chalk = require("chalk");
|
|
5
5
|
const yargs = require("yargs");
|
|
6
6
|
const lib_1 = require("../lib");
|
|
7
|
+
const JSII_TREE_SUPPORTED_FEATURES = ['intersection-types'];
|
|
7
8
|
async function main() {
|
|
8
9
|
const options = await yargs
|
|
9
10
|
.usage('$0 [JSII-FILE | MODULE-DIR...]', 'Prints an ASCII tree representation of a jsii type system.', (args) => args
|
|
@@ -79,7 +80,10 @@ async function main() {
|
|
|
79
80
|
validate: options.validate,
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
|
-
await Promise.all((options.jsiiFile ?? []).map((fileOrDirectory) => typesys.load(fileOrDirectory, {
|
|
83
|
+
await Promise.all((options.jsiiFile ?? []).map((fileOrDirectory) => typesys.load(fileOrDirectory, {
|
|
84
|
+
validate: options.validate,
|
|
85
|
+
supportedFeatures: JSII_TREE_SUPPORTED_FEATURES,
|
|
86
|
+
})));
|
|
83
87
|
const tst = new lib_1.TypeSystemTree(typesys, {
|
|
84
88
|
dependencies: options.dependencies || options.all,
|
|
85
89
|
types: options.types || options.all || options.members || options.inheritance,
|
package/lib/assembly.d.ts
CHANGED
|
@@ -79,6 +79,10 @@ export declare class Assembly extends ModuleLike {
|
|
|
79
79
|
* Dependencies on other assemblies (with semver), the key is the JSII assembly name.
|
|
80
80
|
*/
|
|
81
81
|
get dependencies(): readonly Dependency[];
|
|
82
|
+
/**
|
|
83
|
+
* Return the features used in this assembly
|
|
84
|
+
*/
|
|
85
|
+
get usedFeatures(): readonly jsii.JsiiFeature[];
|
|
82
86
|
findDependency(name: string): Dependency;
|
|
83
87
|
/**
|
|
84
88
|
* List if bundled dependencies (these are not expected to be jsii assemblies).
|
package/lib/assembly.js
CHANGED
|
@@ -103,6 +103,12 @@ class Assembly extends module_like_1.ModuleLike {
|
|
|
103
103
|
get dependencies() {
|
|
104
104
|
return Array.from(this._dependencies.values());
|
|
105
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Return the features used in this assembly
|
|
108
|
+
*/
|
|
109
|
+
get usedFeatures() {
|
|
110
|
+
return this.spec.usedFeatures ?? [];
|
|
111
|
+
}
|
|
106
112
|
findDependency(name) {
|
|
107
113
|
const dep = this._dependencies.get(name);
|
|
108
114
|
if (!dep) {
|
package/lib/type-system.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { JsiiFeature } from '@jsii/spec';
|
|
1
2
|
import { Assembly } from './assembly';
|
|
2
3
|
import { ClassType } from './class';
|
|
3
4
|
import { EnumType } from './enum';
|
|
@@ -5,6 +6,12 @@ import { InterfaceType } from './interface';
|
|
|
5
6
|
import { Method } from './method';
|
|
6
7
|
import { Property } from './property';
|
|
7
8
|
import { Type } from './type';
|
|
9
|
+
/**
|
|
10
|
+
* The jsii features that supported (in principle) by jsii-reflect
|
|
11
|
+
*
|
|
12
|
+
* The features claimed by the user of jsii-reflect must be a subset of these.
|
|
13
|
+
*/
|
|
14
|
+
export declare const JSII_REFLECT_SUPPORTED_ASSEMBLY_FEATURES: JsiiFeature[];
|
|
8
15
|
export declare class TypeSystem {
|
|
9
16
|
/**
|
|
10
17
|
* The "root" assemblies (ones that loaded explicitly via a "load" call).
|
|
@@ -52,13 +59,16 @@ export declare class TypeSystem {
|
|
|
52
59
|
*/
|
|
53
60
|
load(fileOrDirectory: string, options?: {
|
|
54
61
|
validate?: boolean;
|
|
62
|
+
supportedFeatures?: JsiiFeature[];
|
|
55
63
|
}): Promise<Assembly>;
|
|
56
64
|
loadModule(dir: string, options?: {
|
|
57
65
|
validate?: boolean;
|
|
66
|
+
supportedFeatures?: JsiiFeature[];
|
|
58
67
|
}): Promise<Assembly>;
|
|
59
68
|
loadFile(file: string, options?: {
|
|
60
69
|
isRoot?: boolean;
|
|
61
70
|
validate?: boolean;
|
|
71
|
+
supportedFeatures?: JsiiFeature[];
|
|
62
72
|
}): Assembly;
|
|
63
73
|
addAssembly(asm: Assembly, options?: {
|
|
64
74
|
isRoot?: boolean;
|
package/lib/type-system.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TypeSystem = void 0;
|
|
3
|
+
exports.TypeSystem = exports.JSII_REFLECT_SUPPORTED_ASSEMBLY_FEATURES = void 0;
|
|
4
4
|
const spec_1 = require("@jsii/spec");
|
|
5
5
|
const fs = require("fs-extra");
|
|
6
6
|
const path = require("path");
|
|
@@ -9,6 +9,14 @@ const class_1 = require("./class");
|
|
|
9
9
|
const enum_1 = require("./enum");
|
|
10
10
|
const interface_1 = require("./interface");
|
|
11
11
|
const util_1 = require("./util");
|
|
12
|
+
/**
|
|
13
|
+
* The jsii features that supported (in principle) by jsii-reflect
|
|
14
|
+
*
|
|
15
|
+
* The features claimed by the user of jsii-reflect must be a subset of these.
|
|
16
|
+
*/
|
|
17
|
+
exports.JSII_REFLECT_SUPPORTED_ASSEMBLY_FEATURES = [
|
|
18
|
+
'intersection-types',
|
|
19
|
+
];
|
|
12
20
|
class TypeSystem {
|
|
13
21
|
constructor() {
|
|
14
22
|
/**
|
|
@@ -80,7 +88,10 @@ class TypeSystem {
|
|
|
80
88
|
if ((await fs.stat(fileOrDirectory)).isDirectory()) {
|
|
81
89
|
return this.loadModule(fileOrDirectory, options);
|
|
82
90
|
}
|
|
83
|
-
return this.loadFile(fileOrDirectory, {
|
|
91
|
+
return this.loadFile(fileOrDirectory, {
|
|
92
|
+
...options,
|
|
93
|
+
isRoot: true,
|
|
94
|
+
});
|
|
84
95
|
}
|
|
85
96
|
async loadModule(dir, options = {}) {
|
|
86
97
|
const out = await _loadModule.call(this, dir, true);
|
|
@@ -97,7 +108,7 @@ class TypeSystem {
|
|
|
97
108
|
// Load the assembly, but don't recurse if we already have an assembly with the same name.
|
|
98
109
|
// Validation is not an insignificant time sink, and loading IS insignificant, so do a
|
|
99
110
|
// load without validation first. This saves about 2/3rds of processing time.
|
|
100
|
-
const asm = this.loadAssembly((0, spec_1.findAssemblyFile)(moduleDirectory), false);
|
|
111
|
+
const asm = this.loadAssembly((0, spec_1.findAssemblyFile)(moduleDirectory), false, options.supportedFeatures);
|
|
101
112
|
if (this.includesAssembly(asm.name)) {
|
|
102
113
|
const existing = this.findAssembly(asm.name);
|
|
103
114
|
if (existing.version !== asm.version) {
|
|
@@ -129,7 +140,7 @@ class TypeSystem {
|
|
|
129
140
|
}
|
|
130
141
|
}
|
|
131
142
|
loadFile(file, options = {}) {
|
|
132
|
-
const assembly = this.loadAssembly(file, options.validate !== false);
|
|
143
|
+
const assembly = this.loadAssembly(file, options.validate !== false, options.supportedFeatures);
|
|
133
144
|
return this.addAssembly(assembly, options);
|
|
134
145
|
}
|
|
135
146
|
addAssembly(asm, options = {}) {
|
|
@@ -265,8 +276,9 @@ class TypeSystem {
|
|
|
265
276
|
* @param file Assembly file to load
|
|
266
277
|
* @param validate Whether to validate the assembly or just assume it matches the schema
|
|
267
278
|
*/
|
|
268
|
-
loadAssembly(file, validate = true) {
|
|
269
|
-
|
|
279
|
+
loadAssembly(file, validate = true, supportedFeatures) {
|
|
280
|
+
validateFeatureSubset(supportedFeatures);
|
|
281
|
+
const contents = (0, spec_1.loadAssemblyFromFile)(file, validate, supportedFeatures);
|
|
270
282
|
return new assembly_1.Assembly(this, contents);
|
|
271
283
|
}
|
|
272
284
|
addRoot(asm) {
|
|
@@ -295,4 +307,13 @@ function flatMap(collection, mapper) {
|
|
|
295
307
|
.map(mapper)
|
|
296
308
|
.reduce((acc, elt) => acc.concat(elt), new Array());
|
|
297
309
|
}
|
|
310
|
+
/**
|
|
311
|
+
* Check that all requested features are a subset of the features that jsii-reflect itself supports
|
|
312
|
+
*/
|
|
313
|
+
function validateFeatureSubset(fs) {
|
|
314
|
+
const unsupported = (fs ?? []).filter((f) => !exports.JSII_REFLECT_SUPPORTED_ASSEMBLY_FEATURES.includes(f));
|
|
315
|
+
if (unsupported.length > 0) {
|
|
316
|
+
throw new Error(`This version of jsii-reflect does not support the requested features: ${unsupported.join(',')}`);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
298
319
|
//# sourceMappingURL=type-system.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsii-reflect",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.116.0",
|
|
4
4
|
"description": "strongly-typed reflection library and tools for jsii",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -34,19 +34,19 @@
|
|
|
34
34
|
"package": "package-js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@jsii/check-node": "1.
|
|
38
|
-
"@jsii/spec": "1.
|
|
37
|
+
"@jsii/check-node": "1.116.0",
|
|
38
|
+
"@jsii/spec": "1.116.0",
|
|
39
39
|
"chalk": "^4",
|
|
40
40
|
"fs-extra": "^10.1.0",
|
|
41
|
-
"oo-ascii-tree": "^1.
|
|
41
|
+
"oo-ascii-tree": "^1.116.0",
|
|
42
42
|
"yargs": "^17.7.2"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@scope/jsii-calc-lib": "^1.
|
|
45
|
+
"@scope/jsii-calc-lib": "^1.116.0",
|
|
46
46
|
"@types/fs-extra": "^9.0.13",
|
|
47
47
|
"@types/yargs": "^17.0.33",
|
|
48
|
-
"jsii": "^5.9.
|
|
49
|
-
"jsii-build-tools": "^1.
|
|
48
|
+
"jsii": "^5.9.6",
|
|
49
|
+
"jsii-build-tools": "^1.116.0",
|
|
50
50
|
"jsii-calc": "^3.20.120"
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://
|
|
1
|
+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
2
|
|
|
3
3
|
exports[`jsii-tree --all 1`] = `
|
|
4
4
|
"assemblies
|
|
@@ -221,6 +221,37 @@ exports[`jsii-tree --all 1`] = `
|
|
|
221
221
|
│ │ │ │ ├── immutable
|
|
222
222
|
│ │ │ │ └── type: string
|
|
223
223
|
│ │ │ └── types
|
|
224
|
+
│ │ ├─┬ intersection
|
|
225
|
+
│ │ │ └─┬ types
|
|
226
|
+
│ │ │ ├─┬ class ConsumesIntersection (stable)
|
|
227
|
+
│ │ │ │ └─┬ members
|
|
228
|
+
│ │ │ │ ├─┬ <initializer>(props) initializer (stable)
|
|
229
|
+
│ │ │ │ │ └─┬ parameters
|
|
230
|
+
│ │ │ │ │ └─┬ props
|
|
231
|
+
│ │ │ │ │ └── type: jsii-calc.intersection.IntersectionProps
|
|
232
|
+
│ │ │ │ ├─┬ static acceptsIntersection(param) method (stable)
|
|
233
|
+
│ │ │ │ │ ├── static
|
|
234
|
+
│ │ │ │ │ ├─┬ parameters
|
|
235
|
+
│ │ │ │ │ │ └─┬ param
|
|
236
|
+
│ │ │ │ │ │ └── type: @scope/jsii-calc-lib.IFriendly & jsii-calc.intersection.ISomething
|
|
237
|
+
│ │ │ │ │ └── returns: void
|
|
238
|
+
│ │ │ │ └─┬ static acceptsPropWithIntersection(props) method (stable)
|
|
239
|
+
│ │ │ │ ├── static
|
|
240
|
+
│ │ │ │ ├─┬ parameters
|
|
241
|
+
│ │ │ │ │ └─┬ props
|
|
242
|
+
│ │ │ │ │ └── type: jsii-calc.intersection.IntersectionProps
|
|
243
|
+
│ │ │ │ └── returns: void
|
|
244
|
+
│ │ │ ├─┬ interface ISomething (stable)
|
|
245
|
+
│ │ │ │ └─┬ members
|
|
246
|
+
│ │ │ │ └─┬ something() method (stable)
|
|
247
|
+
│ │ │ │ ├── abstract
|
|
248
|
+
│ │ │ │ └── returns: any
|
|
249
|
+
│ │ │ └─┬ interface IntersectionProps (stable)
|
|
250
|
+
│ │ │ └─┬ members
|
|
251
|
+
│ │ │ └─┬ param property (stable)
|
|
252
|
+
│ │ │ ├── abstract
|
|
253
|
+
│ │ │ ├── immutable
|
|
254
|
+
│ │ │ └── type: @scope/jsii-calc-lib.IFriendly & jsii-calc.intersection.ISomething
|
|
224
255
|
│ │ ├─┬ jsii3656
|
|
225
256
|
│ │ │ └─┬ types
|
|
226
257
|
│ │ │ ├─┬ class OverrideMe (stable)
|
|
@@ -526,6 +557,19 @@ exports[`jsii-tree --all 1`] = `
|
|
|
526
557
|
│ │ │ └─┬ static staticMethod() method (stable)
|
|
527
558
|
│ │ │ ├── static
|
|
528
559
|
│ │ │ └── returns: string
|
|
560
|
+
│ │ ├─┬ pascalCaseName
|
|
561
|
+
│ │ │ └─┬ types
|
|
562
|
+
│ │ │ ├─┬ class SubSubclass (stable)
|
|
563
|
+
│ │ │ │ ├── base: Subclass
|
|
564
|
+
│ │ │ │ └─┬ members
|
|
565
|
+
│ │ │ │ └── <initializer>() initializer (stable)
|
|
566
|
+
│ │ │ ├─┬ class Subclass (stable)
|
|
567
|
+
│ │ │ │ ├── base: Superclass
|
|
568
|
+
│ │ │ │ └─┬ members
|
|
569
|
+
│ │ │ │ └── <initializer>() initializer (stable)
|
|
570
|
+
│ │ │ └─┬ class Superclass (stable)
|
|
571
|
+
│ │ │ └─┬ members
|
|
572
|
+
│ │ │ └── <initializer>() initializer (stable)
|
|
529
573
|
│ │ ├─┬ submodule
|
|
530
574
|
│ │ │ ├─┬ submodules
|
|
531
575
|
│ │ │ │ ├─┬ back_references
|
|
@@ -3783,6 +3827,11 @@ exports[`jsii-tree --inheritance 1`] = `
|
|
|
3783
3827
|
│ │ │ │ ├── interface ConsumerProps
|
|
3784
3828
|
│ │ │ │ └── interface Homonymous
|
|
3785
3829
|
│ │ │ └── types
|
|
3830
|
+
│ │ ├─┬ intersection
|
|
3831
|
+
│ │ │ └─┬ types
|
|
3832
|
+
│ │ │ ├── class ConsumesIntersection
|
|
3833
|
+
│ │ │ ├── interface ISomething
|
|
3834
|
+
│ │ │ └── interface IntersectionProps
|
|
3786
3835
|
│ │ ├─┬ jsii3656
|
|
3787
3836
|
│ │ │ └─┬ types
|
|
3788
3837
|
│ │ │ ├── class OverrideMe
|
|
@@ -3882,6 +3931,13 @@ exports[`jsii-tree --inheritance 1`] = `
|
|
|
3882
3931
|
│ │ ├─┬ onlystatic
|
|
3883
3932
|
│ │ │ └─┬ types
|
|
3884
3933
|
│ │ │ └── class OnlyStaticMethods
|
|
3934
|
+
│ │ ├─┬ pascalCaseName
|
|
3935
|
+
│ │ │ └─┬ types
|
|
3936
|
+
│ │ │ ├─┬ class SubSubclass
|
|
3937
|
+
│ │ │ │ └── base: Subclass
|
|
3938
|
+
│ │ │ ├─┬ class Subclass
|
|
3939
|
+
│ │ │ │ └── base: Superclass
|
|
3940
|
+
│ │ │ └── class Superclass
|
|
3885
3941
|
│ │ ├─┬ submodule
|
|
3886
3942
|
│ │ │ ├─┬ submodules
|
|
3887
3943
|
│ │ │ │ ├─┬ back_references
|
|
@@ -4388,6 +4444,19 @@ exports[`jsii-tree --members 1`] = `
|
|
|
4388
4444
|
│ │ │ │ └─┬ members
|
|
4389
4445
|
│ │ │ │ └── stringProperty property
|
|
4390
4446
|
│ │ │ └── types
|
|
4447
|
+
│ │ ├─┬ intersection
|
|
4448
|
+
│ │ │ └─┬ types
|
|
4449
|
+
│ │ │ ├─┬ class ConsumesIntersection
|
|
4450
|
+
│ │ │ │ └─┬ members
|
|
4451
|
+
│ │ │ │ ├── <initializer>(props) initializer
|
|
4452
|
+
│ │ │ │ ├── static acceptsIntersection(param) method
|
|
4453
|
+
│ │ │ │ └── static acceptsPropWithIntersection(props) method
|
|
4454
|
+
│ │ │ ├─┬ interface ISomething
|
|
4455
|
+
│ │ │ │ └─┬ members
|
|
4456
|
+
│ │ │ │ └── something() method
|
|
4457
|
+
│ │ │ └─┬ interface IntersectionProps
|
|
4458
|
+
│ │ │ └─┬ members
|
|
4459
|
+
│ │ │ └── param property
|
|
4391
4460
|
│ │ ├─┬ jsii3656
|
|
4392
4461
|
│ │ │ └─┬ types
|
|
4393
4462
|
│ │ │ ├─┬ class OverrideMe
|
|
@@ -4557,6 +4626,17 @@ exports[`jsii-tree --members 1`] = `
|
|
|
4557
4626
|
│ │ │ └─┬ class OnlyStaticMethods
|
|
4558
4627
|
│ │ │ └─┬ members
|
|
4559
4628
|
│ │ │ └── static staticMethod() method
|
|
4629
|
+
│ │ ├─┬ pascalCaseName
|
|
4630
|
+
│ │ │ └─┬ types
|
|
4631
|
+
│ │ │ ├─┬ class SubSubclass
|
|
4632
|
+
│ │ │ │ └─┬ members
|
|
4633
|
+
│ │ │ │ └── <initializer>() initializer
|
|
4634
|
+
│ │ │ ├─┬ class Subclass
|
|
4635
|
+
│ │ │ │ └─┬ members
|
|
4636
|
+
│ │ │ │ └── <initializer>() initializer
|
|
4637
|
+
│ │ │ └─┬ class Superclass
|
|
4638
|
+
│ │ │ └─┬ members
|
|
4639
|
+
│ │ │ └── <initializer>() initializer
|
|
4560
4640
|
│ │ ├─┬ submodule
|
|
4561
4641
|
│ │ │ ├─┬ submodules
|
|
4562
4642
|
│ │ │ │ ├─┬ back_references
|
|
@@ -5984,6 +6064,7 @@ exports[`jsii-tree --signatures 1`] = `
|
|
|
5984
6064
|
│ │ └─┬ submodules
|
|
5985
6065
|
│ │ ├── bar
|
|
5986
6066
|
│ │ └── foo
|
|
6067
|
+
│ ├── intersection
|
|
5987
6068
|
│ ├── jsii3656
|
|
5988
6069
|
│ ├── jsii4894
|
|
5989
6070
|
│ ├── module2530
|
|
@@ -6006,6 +6087,7 @@ exports[`jsii-tree --signatures 1`] = `
|
|
|
6006
6087
|
│ │ ├── sub1
|
|
6007
6088
|
│ │ └── sub2
|
|
6008
6089
|
│ ├── onlystatic
|
|
6090
|
+
│ ├── pascalCaseName
|
|
6009
6091
|
│ ├─┬ submodule
|
|
6010
6092
|
│ │ └─┬ submodules
|
|
6011
6093
|
│ │ ├── back_references
|
|
@@ -6080,6 +6162,11 @@ exports[`jsii-tree --types 1`] = `
|
|
|
6080
6162
|
│ │ │ │ ├── interface ConsumerProps
|
|
6081
6163
|
│ │ │ │ └── interface Homonymous
|
|
6082
6164
|
│ │ │ └── types
|
|
6165
|
+
│ │ ├─┬ intersection
|
|
6166
|
+
│ │ │ └─┬ types
|
|
6167
|
+
│ │ │ ├── class ConsumesIntersection
|
|
6168
|
+
│ │ │ ├── interface ISomething
|
|
6169
|
+
│ │ │ └── interface IntersectionProps
|
|
6083
6170
|
│ │ ├─┬ jsii3656
|
|
6084
6171
|
│ │ │ └─┬ types
|
|
6085
6172
|
│ │ │ ├── class OverrideMe
|
|
@@ -6153,6 +6240,11 @@ exports[`jsii-tree --types 1`] = `
|
|
|
6153
6240
|
│ │ ├─┬ onlystatic
|
|
6154
6241
|
│ │ │ └─┬ types
|
|
6155
6242
|
│ │ │ └── class OnlyStaticMethods
|
|
6243
|
+
│ │ ├─┬ pascalCaseName
|
|
6244
|
+
│ │ │ └─┬ types
|
|
6245
|
+
│ │ │ ├── class SubSubclass
|
|
6246
|
+
│ │ │ ├── class Subclass
|
|
6247
|
+
│ │ │ └── class Superclass
|
|
6156
6248
|
│ │ ├─┬ submodule
|
|
6157
6249
|
│ │ │ ├─┬ submodules
|
|
6158
6250
|
│ │ │ │ ├─┬ back_references
|
|
@@ -6483,6 +6575,7 @@ exports[`jsii-tree 1`] = `
|
|
|
6483
6575
|
│ │ └─┬ submodules
|
|
6484
6576
|
│ │ ├── bar
|
|
6485
6577
|
│ │ └── foo
|
|
6578
|
+
│ ├── intersection
|
|
6486
6579
|
│ ├── jsii3656
|
|
6487
6580
|
│ ├── jsii4894
|
|
6488
6581
|
│ ├── module2530
|
|
@@ -6505,6 +6598,7 @@ exports[`jsii-tree 1`] = `
|
|
|
6505
6598
|
│ │ ├── sub1
|
|
6506
6599
|
│ │ └── sub2
|
|
6507
6600
|
│ ├── onlystatic
|
|
6601
|
+
│ ├── pascalCaseName
|
|
6508
6602
|
│ ├─┬ submodule
|
|
6509
6603
|
│ │ └─┬ submodules
|
|
6510
6604
|
│ │ ├── back_references
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://
|
|
1
|
+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
2
|
|
|
3
3
|
exports[`defaults 1`] = `
|
|
4
4
|
"assemblies
|
|
@@ -18,6 +18,7 @@ exports[`defaults 1`] = `
|
|
|
18
18
|
│ │ └─┬ submodules
|
|
19
19
|
│ │ ├── bar
|
|
20
20
|
│ │ └── foo
|
|
21
|
+
│ ├── intersection
|
|
21
22
|
│ ├── jsii3656
|
|
22
23
|
│ ├── jsii4894
|
|
23
24
|
│ ├── module2530
|
|
@@ -40,6 +41,7 @@ exports[`defaults 1`] = `
|
|
|
40
41
|
│ │ ├── sub1
|
|
41
42
|
│ │ └── sub2
|
|
42
43
|
│ ├── onlystatic
|
|
44
|
+
│ ├── pascalCaseName
|
|
43
45
|
│ ├─┬ submodule
|
|
44
46
|
│ │ └─┬ submodules
|
|
45
47
|
│ │ ├── back_references
|
|
@@ -78,6 +80,7 @@ exports[`inheritance 1`] = `
|
|
|
78
80
|
│ │ └─┬ submodules
|
|
79
81
|
│ │ ├── bar
|
|
80
82
|
│ │ └── foo
|
|
83
|
+
│ ├── intersection
|
|
81
84
|
│ ├── jsii3656
|
|
82
85
|
│ ├── jsii4894
|
|
83
86
|
│ ├── module2530
|
|
@@ -100,6 +103,7 @@ exports[`inheritance 1`] = `
|
|
|
100
103
|
│ │ ├── sub1
|
|
101
104
|
│ │ └── sub2
|
|
102
105
|
│ ├── onlystatic
|
|
106
|
+
│ ├── pascalCaseName
|
|
103
107
|
│ ├─┬ submodule
|
|
104
108
|
│ │ └─┬ submodules
|
|
105
109
|
│ │ ├── back_references
|
|
@@ -138,6 +142,7 @@ exports[`members 1`] = `
|
|
|
138
142
|
│ │ └─┬ submodules
|
|
139
143
|
│ │ ├── bar
|
|
140
144
|
│ │ └── foo
|
|
145
|
+
│ ├── intersection
|
|
141
146
|
│ ├── jsii3656
|
|
142
147
|
│ ├── jsii4894
|
|
143
148
|
│ ├── module2530
|
|
@@ -160,6 +165,7 @@ exports[`members 1`] = `
|
|
|
160
165
|
│ │ ├── sub1
|
|
161
166
|
│ │ └── sub2
|
|
162
167
|
│ ├── onlystatic
|
|
168
|
+
│ ├── pascalCaseName
|
|
163
169
|
│ ├─┬ submodule
|
|
164
170
|
│ │ └─┬ submodules
|
|
165
171
|
│ │ ├── back_references
|
|
@@ -401,6 +407,37 @@ exports[`showAll 1`] = `
|
|
|
401
407
|
│ │ │ │ ├── immutable
|
|
402
408
|
│ │ │ │ └── type: string
|
|
403
409
|
│ │ │ └── types
|
|
410
|
+
│ │ ├─┬ intersection
|
|
411
|
+
│ │ │ └─┬ types
|
|
412
|
+
│ │ │ ├─┬ class ConsumesIntersection
|
|
413
|
+
│ │ │ │ └─┬ members
|
|
414
|
+
│ │ │ │ ├─┬ <initializer>(props) initializer
|
|
415
|
+
│ │ │ │ │ └─┬ parameters
|
|
416
|
+
│ │ │ │ │ └─┬ props
|
|
417
|
+
│ │ │ │ │ └── type: jsii-calc.intersection.IntersectionProps
|
|
418
|
+
│ │ │ │ ├─┬ static acceptsIntersection(param) method
|
|
419
|
+
│ │ │ │ │ ├── static
|
|
420
|
+
│ │ │ │ │ ├─┬ parameters
|
|
421
|
+
│ │ │ │ │ │ └─┬ param
|
|
422
|
+
│ │ │ │ │ │ └── type: @scope/jsii-calc-lib.IFriendly & jsii-calc.intersection.ISomething
|
|
423
|
+
│ │ │ │ │ └── returns: void
|
|
424
|
+
│ │ │ │ └─┬ static acceptsPropWithIntersection(props) method
|
|
425
|
+
│ │ │ │ ├── static
|
|
426
|
+
│ │ │ │ ├─┬ parameters
|
|
427
|
+
│ │ │ │ │ └─┬ props
|
|
428
|
+
│ │ │ │ │ └── type: jsii-calc.intersection.IntersectionProps
|
|
429
|
+
│ │ │ │ └── returns: void
|
|
430
|
+
│ │ │ ├─┬ interface ISomething
|
|
431
|
+
│ │ │ │ └─┬ members
|
|
432
|
+
│ │ │ │ └─┬ something() method
|
|
433
|
+
│ │ │ │ ├── abstract
|
|
434
|
+
│ │ │ │ └── returns: any
|
|
435
|
+
│ │ │ └─┬ interface IntersectionProps
|
|
436
|
+
│ │ │ └─┬ members
|
|
437
|
+
│ │ │ └─┬ param property
|
|
438
|
+
│ │ │ ├── abstract
|
|
439
|
+
│ │ │ ├── immutable
|
|
440
|
+
│ │ │ └── type: @scope/jsii-calc-lib.IFriendly & jsii-calc.intersection.ISomething
|
|
404
441
|
│ │ ├─┬ jsii3656
|
|
405
442
|
│ │ │ └─┬ types
|
|
406
443
|
│ │ │ ├─┬ class OverrideMe
|
|
@@ -706,6 +743,19 @@ exports[`showAll 1`] = `
|
|
|
706
743
|
│ │ │ └─┬ static staticMethod() method
|
|
707
744
|
│ │ │ ├── static
|
|
708
745
|
│ │ │ └── returns: string
|
|
746
|
+
│ │ ├─┬ pascalCaseName
|
|
747
|
+
│ │ │ └─┬ types
|
|
748
|
+
│ │ │ ├─┬ class SubSubclass
|
|
749
|
+
│ │ │ │ ├── base: Subclass
|
|
750
|
+
│ │ │ │ └─┬ members
|
|
751
|
+
│ │ │ │ └── <initializer>() initializer
|
|
752
|
+
│ │ │ ├─┬ class Subclass
|
|
753
|
+
│ │ │ │ ├── base: Superclass
|
|
754
|
+
│ │ │ │ └─┬ members
|
|
755
|
+
│ │ │ │ └── <initializer>() initializer
|
|
756
|
+
│ │ │ └─┬ class Superclass
|
|
757
|
+
│ │ │ └─┬ members
|
|
758
|
+
│ │ │ └── <initializer>() initializer
|
|
709
759
|
│ │ ├─┬ submodule
|
|
710
760
|
│ │ │ ├─┬ submodules
|
|
711
761
|
│ │ │ │ ├─┬ back_references
|
|
@@ -3924,6 +3974,7 @@ exports[`signatures 1`] = `
|
|
|
3924
3974
|
│ │ └─┬ submodules
|
|
3925
3975
|
│ │ ├── bar
|
|
3926
3976
|
│ │ └── foo
|
|
3977
|
+
│ ├── intersection
|
|
3927
3978
|
│ ├── jsii3656
|
|
3928
3979
|
│ ├── jsii4894
|
|
3929
3980
|
│ ├── module2530
|
|
@@ -3946,6 +3997,7 @@ exports[`signatures 1`] = `
|
|
|
3946
3997
|
│ │ ├── sub1
|
|
3947
3998
|
│ │ └── sub2
|
|
3948
3999
|
│ ├── onlystatic
|
|
4000
|
+
│ ├── pascalCaseName
|
|
3949
4001
|
│ ├─┬ submodule
|
|
3950
4002
|
│ │ └─┬ submodules
|
|
3951
4003
|
│ │ ├── back_references
|
|
@@ -4020,6 +4072,11 @@ exports[`types 1`] = `
|
|
|
4020
4072
|
│ │ │ │ ├── interface ConsumerProps
|
|
4021
4073
|
│ │ │ │ └── interface Homonymous
|
|
4022
4074
|
│ │ │ └── types
|
|
4075
|
+
│ │ ├─┬ intersection
|
|
4076
|
+
│ │ │ └─┬ types
|
|
4077
|
+
│ │ │ ├── class ConsumesIntersection
|
|
4078
|
+
│ │ │ ├── interface ISomething
|
|
4079
|
+
│ │ │ └── interface IntersectionProps
|
|
4023
4080
|
│ │ ├─┬ jsii3656
|
|
4024
4081
|
│ │ │ └─┬ types
|
|
4025
4082
|
│ │ │ ├── class OverrideMe
|
|
@@ -4093,6 +4150,11 @@ exports[`types 1`] = `
|
|
|
4093
4150
|
│ │ ├─┬ onlystatic
|
|
4094
4151
|
│ │ │ └─┬ types
|
|
4095
4152
|
│ │ │ └── class OnlyStaticMethods
|
|
4153
|
+
│ │ ├─┬ pascalCaseName
|
|
4154
|
+
│ │ │ └─┬ types
|
|
4155
|
+
│ │ │ ├── class SubSubclass
|
|
4156
|
+
│ │ │ ├── class Subclass
|
|
4157
|
+
│ │ │ └── class Superclass
|
|
4096
4158
|
│ │ ├─┬ submodule
|
|
4097
4159
|
│ │ │ ├─┬ submodules
|
|
4098
4160
|
│ │ │ │ ├─┬ back_references
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://
|
|
1
|
+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
2
|
|
|
3
3
|
exports[`TypeSystem.assemblies lists all the loaded assemblies 1`] = `
|
|
4
4
|
[
|
|
@@ -176,6 +176,7 @@ exports[`TypeSystem.classes lists all the classes in the typesystem 1`] = `
|
|
|
176
176
|
"jsii-calc.composition.CompositeOperation",
|
|
177
177
|
"jsii-calc.homonymousForwardReferences.bar.Consumer",
|
|
178
178
|
"jsii-calc.homonymousForwardReferences.foo.Consumer",
|
|
179
|
+
"jsii-calc.intersection.ConsumesIntersection",
|
|
179
180
|
"jsii-calc.jsii3656.OverrideMe",
|
|
180
181
|
"jsii-calc.jsii4894.NonPascalCaseTest",
|
|
181
182
|
"jsii-calc.module2530.MyClass",
|
|
@@ -196,6 +197,9 @@ exports[`TypeSystem.classes lists all the classes in the typesystem 1`] = `
|
|
|
196
197
|
"jsii-calc.nodirect.sub1.TypeFromSub1",
|
|
197
198
|
"jsii-calc.nodirect.sub2.TypeFromSub2",
|
|
198
199
|
"jsii-calc.onlystatic.OnlyStaticMethods",
|
|
200
|
+
"jsii-calc.pascalCaseName.SubSubclass",
|
|
201
|
+
"jsii-calc.pascalCaseName.Subclass",
|
|
202
|
+
"jsii-calc.pascalCaseName.Superclass",
|
|
199
203
|
"jsii-calc.submodule.MyClass",
|
|
200
204
|
"jsii-calc.submodule.child.InnerClass",
|
|
201
205
|
"jsii-calc.submodule.child.OuterClass",
|
package/test/features.js
ADDED
package/test/tree.test.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const path_1 = require("path");
|
|
4
|
+
const features_1 = require("./features");
|
|
4
5
|
const tree_1 = require("../lib/tree");
|
|
5
6
|
const type_system_1 = require("../lib/type-system");
|
|
6
7
|
const typeSystem = new type_system_1.TypeSystem();
|
|
7
|
-
beforeAll(() => typeSystem.loadModule((0, path_1.dirname)(require.resolve('jsii-calc/package.json'))
|
|
8
|
+
beforeAll(() => typeSystem.loadModule((0, path_1.dirname)(require.resolve('jsii-calc/package.json')), {
|
|
9
|
+
supportedFeatures: features_1.TEST_FEATURES,
|
|
10
|
+
}));
|
|
8
11
|
test('defaults', () => {
|
|
9
12
|
const stream = new StringWriter();
|
|
10
13
|
new tree_1.TypeSystemTree(typeSystem, { colors: false }).printTree(stream);
|
package/test/type-system.test.js
CHANGED
|
@@ -4,11 +4,14 @@ const spec = require("@jsii/spec");
|
|
|
4
4
|
const spec_1 = require("@jsii/spec");
|
|
5
5
|
const path = require("path");
|
|
6
6
|
const lib_1 = require("../lib");
|
|
7
|
+
const features_1 = require("./features");
|
|
7
8
|
const util_1 = require("./util");
|
|
8
9
|
let typesys;
|
|
9
10
|
beforeAll(async () => {
|
|
10
11
|
typesys = new lib_1.TypeSystem();
|
|
11
|
-
await typesys.loadModule(resolveModuleDir('jsii-calc')
|
|
12
|
+
await typesys.loadModule(resolveModuleDir('jsii-calc'), {
|
|
13
|
+
supportedFeatures: features_1.TEST_FEATURES,
|
|
14
|
+
});
|
|
12
15
|
});
|
|
13
16
|
test('TypeSystem.hasAssembly', () => {
|
|
14
17
|
expect(typesys.includesAssembly('@foo/bar')).toBeFalsy();
|