jsii-reflect 1.114.1 → 1.115.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 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, { validate: options.validate })));
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) {
@@ -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;
@@ -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, { ...options, isRoot: true });
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
- const contents = (0, spec_1.loadAssemblyFromFile)(file, validate);
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.114.1",
3
+ "version": "1.115.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.114.1",
38
- "@jsii/spec": "1.114.1",
37
+ "@jsii/check-node": "1.115.0",
38
+ "@jsii/spec": "1.115.0",
39
39
  "chalk": "^4",
40
40
  "fs-extra": "^10.1.0",
41
- "oo-ascii-tree": "^1.114.1",
41
+ "oo-ascii-tree": "^1.115.0",
42
42
  "yargs": "^17.7.2"
43
43
  },
44
44
  "devDependencies": {
45
- "@scope/jsii-calc-lib": "^1.114.1",
45
+ "@scope/jsii-calc-lib": "^1.115.0",
46
46
  "@types/fs-extra": "^9.0.13",
47
47
  "@types/yargs": "^17.0.33",
48
- "jsii": "^5.9.1",
49
- "jsii-build-tools": "^1.114.1",
48
+ "jsii": "^5.9.6",
49
+ "jsii-build-tools": "^1.115.0",
50
50
  "jsii-calc": "^3.20.120"
51
51
  }
52
52
  }
@@ -1,4 +1,4 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
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,33 @@ 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
+ │ │ │ │ ├─┬ static acceptsIntersection(param) method (stable)
229
+ │ │ │ │ │ ├── static
230
+ │ │ │ │ │ ├─┬ parameters
231
+ │ │ │ │ │ │ └─┬ param
232
+ │ │ │ │ │ │ └── type: @scope/jsii-calc-lib.IFriendly & jsii-calc.intersection.ISomething
233
+ │ │ │ │ │ └── returns: void
234
+ │ │ │ │ └─┬ static acceptsPropWithIntersection(props) method (stable)
235
+ │ │ │ │ ├── static
236
+ │ │ │ │ ├─┬ parameters
237
+ │ │ │ │ │ └─┬ props
238
+ │ │ │ │ │ └── type: jsii-calc.intersection.IntersectionProps
239
+ │ │ │ │ └── returns: void
240
+ │ │ │ ├─┬ interface ISomething (stable)
241
+ │ │ │ │ └─┬ members
242
+ │ │ │ │ └─┬ something() method (stable)
243
+ │ │ │ │ ├── abstract
244
+ │ │ │ │ └── returns: any
245
+ │ │ │ └─┬ interface IntersectionProps (stable)
246
+ │ │ │ └─┬ members
247
+ │ │ │ └─┬ param property (stable)
248
+ │ │ │ ├── abstract
249
+ │ │ │ ├── immutable
250
+ │ │ │ └── type: @scope/jsii-calc-lib.IFriendly & jsii-calc.intersection.ISomething
224
251
  │ │ ├─┬ jsii3656
225
252
  │ │ │ └─┬ types
226
253
  │ │ │ ├─┬ class OverrideMe (stable)
@@ -526,6 +553,19 @@ exports[`jsii-tree --all 1`] = `
526
553
  │ │ │ └─┬ static staticMethod() method (stable)
527
554
  │ │ │ ├── static
528
555
  │ │ │ └── returns: string
556
+ │ │ ├─┬ pascalCaseName
557
+ │ │ │ └─┬ types
558
+ │ │ │ ├─┬ class SubSubclass (stable)
559
+ │ │ │ │ ├── base: Subclass
560
+ │ │ │ │ └─┬ members
561
+ │ │ │ │ └── <initializer>() initializer (stable)
562
+ │ │ │ ├─┬ class Subclass (stable)
563
+ │ │ │ │ ├── base: Superclass
564
+ │ │ │ │ └─┬ members
565
+ │ │ │ │ └── <initializer>() initializer (stable)
566
+ │ │ │ └─┬ class Superclass (stable)
567
+ │ │ │ └─┬ members
568
+ │ │ │ └── <initializer>() initializer (stable)
529
569
  │ │ ├─┬ submodule
530
570
  │ │ │ ├─┬ submodules
531
571
  │ │ │ │ ├─┬ back_references
@@ -3783,6 +3823,11 @@ exports[`jsii-tree --inheritance 1`] = `
3783
3823
  │ │ │ │ ├── interface ConsumerProps
3784
3824
  │ │ │ │ └── interface Homonymous
3785
3825
  │ │ │ └── types
3826
+ │ │ ├─┬ intersection
3827
+ │ │ │ └─┬ types
3828
+ │ │ │ ├── class ConsumesIntersection
3829
+ │ │ │ ├── interface ISomething
3830
+ │ │ │ └── interface IntersectionProps
3786
3831
  │ │ ├─┬ jsii3656
3787
3832
  │ │ │ └─┬ types
3788
3833
  │ │ │ ├── class OverrideMe
@@ -3882,6 +3927,13 @@ exports[`jsii-tree --inheritance 1`] = `
3882
3927
  │ │ ├─┬ onlystatic
3883
3928
  │ │ │ └─┬ types
3884
3929
  │ │ │ └── class OnlyStaticMethods
3930
+ │ │ ├─┬ pascalCaseName
3931
+ │ │ │ └─┬ types
3932
+ │ │ │ ├─┬ class SubSubclass
3933
+ │ │ │ │ └── base: Subclass
3934
+ │ │ │ ├─┬ class Subclass
3935
+ │ │ │ │ └── base: Superclass
3936
+ │ │ │ └── class Superclass
3885
3937
  │ │ ├─┬ submodule
3886
3938
  │ │ │ ├─┬ submodules
3887
3939
  │ │ │ │ ├─┬ back_references
@@ -4388,6 +4440,18 @@ exports[`jsii-tree --members 1`] = `
4388
4440
  │ │ │ │ └─┬ members
4389
4441
  │ │ │ │ └── stringProperty property
4390
4442
  │ │ │ └── types
4443
+ │ │ ├─┬ intersection
4444
+ │ │ │ └─┬ types
4445
+ │ │ │ ├─┬ class ConsumesIntersection
4446
+ │ │ │ │ └─┬ members
4447
+ │ │ │ │ ├── static acceptsIntersection(param) method
4448
+ │ │ │ │ └── static acceptsPropWithIntersection(props) method
4449
+ │ │ │ ├─┬ interface ISomething
4450
+ │ │ │ │ └─┬ members
4451
+ │ │ │ │ └── something() method
4452
+ │ │ │ └─┬ interface IntersectionProps
4453
+ │ │ │ └─┬ members
4454
+ │ │ │ └── param property
4391
4455
  │ │ ├─┬ jsii3656
4392
4456
  │ │ │ └─┬ types
4393
4457
  │ │ │ ├─┬ class OverrideMe
@@ -4557,6 +4621,17 @@ exports[`jsii-tree --members 1`] = `
4557
4621
  │ │ │ └─┬ class OnlyStaticMethods
4558
4622
  │ │ │ └─┬ members
4559
4623
  │ │ │ └── static staticMethod() method
4624
+ │ │ ├─┬ pascalCaseName
4625
+ │ │ │ └─┬ types
4626
+ │ │ │ ├─┬ class SubSubclass
4627
+ │ │ │ │ └─┬ members
4628
+ │ │ │ │ └── <initializer>() initializer
4629
+ │ │ │ ├─┬ class Subclass
4630
+ │ │ │ │ └─┬ members
4631
+ │ │ │ │ └── <initializer>() initializer
4632
+ │ │ │ └─┬ class Superclass
4633
+ │ │ │ └─┬ members
4634
+ │ │ │ └── <initializer>() initializer
4560
4635
  │ │ ├─┬ submodule
4561
4636
  │ │ │ ├─┬ submodules
4562
4637
  │ │ │ │ ├─┬ back_references
@@ -5984,6 +6059,7 @@ exports[`jsii-tree --signatures 1`] = `
5984
6059
  │ │ └─┬ submodules
5985
6060
  │ │ ├── bar
5986
6061
  │ │ └── foo
6062
+ │ ├── intersection
5987
6063
  │ ├── jsii3656
5988
6064
  │ ├── jsii4894
5989
6065
  │ ├── module2530
@@ -6006,6 +6082,7 @@ exports[`jsii-tree --signatures 1`] = `
6006
6082
  │ │ ├── sub1
6007
6083
  │ │ └── sub2
6008
6084
  │ ├── onlystatic
6085
+ │ ├── pascalCaseName
6009
6086
  │ ├─┬ submodule
6010
6087
  │ │ └─┬ submodules
6011
6088
  │ │ ├── back_references
@@ -6080,6 +6157,11 @@ exports[`jsii-tree --types 1`] = `
6080
6157
  │ │ │ │ ├── interface ConsumerProps
6081
6158
  │ │ │ │ └── interface Homonymous
6082
6159
  │ │ │ └── types
6160
+ │ │ ├─┬ intersection
6161
+ │ │ │ └─┬ types
6162
+ │ │ │ ├── class ConsumesIntersection
6163
+ │ │ │ ├── interface ISomething
6164
+ │ │ │ └── interface IntersectionProps
6083
6165
  │ │ ├─┬ jsii3656
6084
6166
  │ │ │ └─┬ types
6085
6167
  │ │ │ ├── class OverrideMe
@@ -6153,6 +6235,11 @@ exports[`jsii-tree --types 1`] = `
6153
6235
  │ │ ├─┬ onlystatic
6154
6236
  │ │ │ └─┬ types
6155
6237
  │ │ │ └── class OnlyStaticMethods
6238
+ │ │ ├─┬ pascalCaseName
6239
+ │ │ │ └─┬ types
6240
+ │ │ │ ├── class SubSubclass
6241
+ │ │ │ ├── class Subclass
6242
+ │ │ │ └── class Superclass
6156
6243
  │ │ ├─┬ submodule
6157
6244
  │ │ │ ├─┬ submodules
6158
6245
  │ │ │ │ ├─┬ back_references
@@ -6483,6 +6570,7 @@ exports[`jsii-tree 1`] = `
6483
6570
  │ │ └─┬ submodules
6484
6571
  │ │ ├── bar
6485
6572
  │ │ └── foo
6573
+ │ ├── intersection
6486
6574
  │ ├── jsii3656
6487
6575
  │ ├── jsii4894
6488
6576
  │ ├── module2530
@@ -6505,6 +6593,7 @@ exports[`jsii-tree 1`] = `
6505
6593
  │ │ ├── sub1
6506
6594
  │ │ └── sub2
6507
6595
  │ ├── onlystatic
6596
+ │ ├── pascalCaseName
6508
6597
  │ ├─┬ submodule
6509
6598
  │ │ └─┬ submodules
6510
6599
  │ │ ├── back_references
@@ -1,4 +1,4 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
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,33 @@ exports[`showAll 1`] = `
401
407
  │ │ │ │ ├── immutable
402
408
  │ │ │ │ └── type: string
403
409
  │ │ │ └── types
410
+ │ │ ├─┬ intersection
411
+ │ │ │ └─┬ types
412
+ │ │ │ ├─┬ class ConsumesIntersection
413
+ │ │ │ │ └─┬ members
414
+ │ │ │ │ ├─┬ static acceptsIntersection(param) method
415
+ │ │ │ │ │ ├── static
416
+ │ │ │ │ │ ├─┬ parameters
417
+ │ │ │ │ │ │ └─┬ param
418
+ │ │ │ │ │ │ └── type: @scope/jsii-calc-lib.IFriendly & jsii-calc.intersection.ISomething
419
+ │ │ │ │ │ └── returns: void
420
+ │ │ │ │ └─┬ static acceptsPropWithIntersection(props) method
421
+ │ │ │ │ ├── static
422
+ │ │ │ │ ├─┬ parameters
423
+ │ │ │ │ │ └─┬ props
424
+ │ │ │ │ │ └── type: jsii-calc.intersection.IntersectionProps
425
+ │ │ │ │ └── returns: void
426
+ │ │ │ ├─┬ interface ISomething
427
+ │ │ │ │ └─┬ members
428
+ │ │ │ │ └─┬ something() method
429
+ │ │ │ │ ├── abstract
430
+ │ │ │ │ └── returns: any
431
+ │ │ │ └─┬ interface IntersectionProps
432
+ │ │ │ └─┬ members
433
+ │ │ │ └─┬ param property
434
+ │ │ │ ├── abstract
435
+ │ │ │ ├── immutable
436
+ │ │ │ └── type: @scope/jsii-calc-lib.IFriendly & jsii-calc.intersection.ISomething
404
437
  │ │ ├─┬ jsii3656
405
438
  │ │ │ └─┬ types
406
439
  │ │ │ ├─┬ class OverrideMe
@@ -706,6 +739,19 @@ exports[`showAll 1`] = `
706
739
  │ │ │ └─┬ static staticMethod() method
707
740
  │ │ │ ├── static
708
741
  │ │ │ └── returns: string
742
+ │ │ ├─┬ pascalCaseName
743
+ │ │ │ └─┬ types
744
+ │ │ │ ├─┬ class SubSubclass
745
+ │ │ │ │ ├── base: Subclass
746
+ │ │ │ │ └─┬ members
747
+ │ │ │ │ └── <initializer>() initializer
748
+ │ │ │ ├─┬ class Subclass
749
+ │ │ │ │ ├── base: Superclass
750
+ │ │ │ │ └─┬ members
751
+ │ │ │ │ └── <initializer>() initializer
752
+ │ │ │ └─┬ class Superclass
753
+ │ │ │ └─┬ members
754
+ │ │ │ └── <initializer>() initializer
709
755
  │ │ ├─┬ submodule
710
756
  │ │ │ ├─┬ submodules
711
757
  │ │ │ │ ├─┬ back_references
@@ -3924,6 +3970,7 @@ exports[`signatures 1`] = `
3924
3970
  │ │ └─┬ submodules
3925
3971
  │ │ ├── bar
3926
3972
  │ │ └── foo
3973
+ │ ├── intersection
3927
3974
  │ ├── jsii3656
3928
3975
  │ ├── jsii4894
3929
3976
  │ ├── module2530
@@ -3946,6 +3993,7 @@ exports[`signatures 1`] = `
3946
3993
  │ │ ├── sub1
3947
3994
  │ │ └── sub2
3948
3995
  │ ├── onlystatic
3996
+ │ ├── pascalCaseName
3949
3997
  │ ├─┬ submodule
3950
3998
  │ │ └─┬ submodules
3951
3999
  │ │ ├── back_references
@@ -4020,6 +4068,11 @@ exports[`types 1`] = `
4020
4068
  │ │ │ │ ├── interface ConsumerProps
4021
4069
  │ │ │ │ └── interface Homonymous
4022
4070
  │ │ │ └── types
4071
+ │ │ ├─┬ intersection
4072
+ │ │ │ └─┬ types
4073
+ │ │ │ ├── class ConsumesIntersection
4074
+ │ │ │ ├── interface ISomething
4075
+ │ │ │ └── interface IntersectionProps
4023
4076
  │ │ ├─┬ jsii3656
4024
4077
  │ │ │ └─┬ types
4025
4078
  │ │ │ ├── class OverrideMe
@@ -4093,6 +4146,11 @@ exports[`types 1`] = `
4093
4146
  │ │ ├─┬ onlystatic
4094
4147
  │ │ │ └─┬ types
4095
4148
  │ │ │ └── class OnlyStaticMethods
4149
+ │ │ ├─┬ pascalCaseName
4150
+ │ │ │ └─┬ types
4151
+ │ │ │ ├── class SubSubclass
4152
+ │ │ │ ├── class Subclass
4153
+ │ │ │ └── class Superclass
4096
4154
  │ │ ├─┬ submodule
4097
4155
  │ │ │ ├─┬ submodules
4098
4156
  │ │ │ │ ├─┬ back_references
@@ -1,4 +1,4 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
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",
@@ -0,0 +1,3 @@
1
+ import { JsiiFeature } from '@jsii/spec';
2
+ export declare const TEST_FEATURES: JsiiFeature[];
3
+ //# sourceMappingURL=features.d.ts.map
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TEST_FEATURES = void 0;
4
+ exports.TEST_FEATURES = ['intersection-types'];
5
+ //# sourceMappingURL=features.js.map
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);
@@ -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();