jsii-reflect 1.118.0 → 1.119.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/lib/jsii-query.js +6 -0
- package/package.json +8 -7
- package/test/jsii-query.test.js +6 -0
package/lib/jsii-query.js
CHANGED
|
@@ -152,28 +152,33 @@ function matches(el, kind, pred) {
|
|
|
152
152
|
if (!['type', 'class'].includes(kind))
|
|
153
153
|
return false;
|
|
154
154
|
context.kind = 'class';
|
|
155
|
+
context.fqn = el.fqn;
|
|
155
156
|
}
|
|
156
157
|
if (el instanceof lib_1.InterfaceType) {
|
|
157
158
|
const moreSpecificInterfaceType = el.datatype ? 'struct' : 'interface';
|
|
158
159
|
if (!['type', moreSpecificInterfaceType].includes(kind))
|
|
159
160
|
return false;
|
|
160
161
|
context.kind = moreSpecificInterfaceType;
|
|
162
|
+
context.fqn = el.fqn;
|
|
161
163
|
}
|
|
162
164
|
if (el instanceof lib_1.EnumType) {
|
|
163
165
|
if (!['type', 'enum'].includes(kind))
|
|
164
166
|
return false;
|
|
165
167
|
context.kind = 'enum';
|
|
168
|
+
context.fqn = el.fqn;
|
|
166
169
|
}
|
|
167
170
|
if (el instanceof lib_1.Property) {
|
|
168
171
|
if (!['member', 'property'].includes(kind))
|
|
169
172
|
return false;
|
|
170
173
|
context.kind = 'property';
|
|
174
|
+
context.fqn = `${el.parentType.fqn}#${el.name}`;
|
|
171
175
|
}
|
|
172
176
|
if (el instanceof lib_1.Callable) {
|
|
173
177
|
const moreSpecificCallable = el instanceof lib_1.Initializer ? 'initializer' : 'method';
|
|
174
178
|
if (!['member', moreSpecificCallable].includes(kind))
|
|
175
179
|
return false;
|
|
176
180
|
context.kind = moreSpecificCallable;
|
|
181
|
+
context.fqn = `${el.parentType.fqn}#${el.name}`;
|
|
177
182
|
}
|
|
178
183
|
Object.assign(context, Object.fromEntries(API_ELEMENT_ATTRIBUTES.map((attr) => [attr, el[attr]])));
|
|
179
184
|
const ret = pred.apply(context);
|
|
@@ -285,6 +290,7 @@ const VALID_KINDS = [
|
|
|
285
290
|
];
|
|
286
291
|
const API_ELEMENT_ATTRIBUTES = [
|
|
287
292
|
'kind',
|
|
293
|
+
'fqn',
|
|
288
294
|
// Types
|
|
289
295
|
'ancestors',
|
|
290
296
|
'abstract',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsii-reflect",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.119.0",
|
|
4
4
|
"description": "strongly-typed reflection library and tools for jsii",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"main": "lib/index.js",
|
|
23
23
|
"types": "lib/index.d.ts",
|
|
24
24
|
"bin": {
|
|
25
|
-
"jsii-tree": "bin/jsii-tree"
|
|
25
|
+
"jsii-tree": "bin/jsii-tree",
|
|
26
|
+
"jsii-query": "bin/jsii-query"
|
|
26
27
|
},
|
|
27
28
|
"scripts": {
|
|
28
29
|
"build": "tsc --build && chmod +x bin/jsii-tree && yarn lint",
|
|
@@ -34,19 +35,19 @@
|
|
|
34
35
|
"package": "package-js"
|
|
35
36
|
},
|
|
36
37
|
"dependencies": {
|
|
37
|
-
"@jsii/check-node": "1.
|
|
38
|
-
"@jsii/spec": "1.
|
|
38
|
+
"@jsii/check-node": "1.119.0",
|
|
39
|
+
"@jsii/spec": "1.119.0",
|
|
39
40
|
"chalk": "^4",
|
|
40
41
|
"fs-extra": "^10.1.0",
|
|
41
|
-
"oo-ascii-tree": "^1.
|
|
42
|
+
"oo-ascii-tree": "^1.119.0",
|
|
42
43
|
"yargs": "^17.7.2"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
|
-
"@scope/jsii-calc-lib": "^1.
|
|
46
|
+
"@scope/jsii-calc-lib": "^1.119.0",
|
|
46
47
|
"@types/fs-extra": "^9.0.13",
|
|
47
48
|
"@types/yargs": "^17.0.33",
|
|
48
49
|
"jsii": "^5.9.10",
|
|
49
|
-
"jsii-build-tools": "^1.
|
|
50
|
+
"jsii-build-tools": "^1.119.0",
|
|
50
51
|
"jsii-calc": "^3.20.120"
|
|
51
52
|
}
|
|
52
53
|
}
|
package/test/jsii-query.test.js
CHANGED
|
@@ -74,6 +74,12 @@ describe('filtering', () => {
|
|
|
74
74
|
], 'members');
|
|
75
75
|
expect(result).toContainEqual('static @scope/jsii-calc-base-of-base.StaticConsumer#consume(..._args: any[]): void');
|
|
76
76
|
});
|
|
77
|
+
test('fqn is available to filter on', async () => {
|
|
78
|
+
const result = await query([
|
|
79
|
+
(0, jsii_query_1.parseExpression)('class:fqn.includes("base.StaticConsumer")'),
|
|
80
|
+
]);
|
|
81
|
+
expect(result).toContainEqual('static @scope/jsii-calc-base-of-base.StaticConsumer#consume(..._args: any[]): void');
|
|
82
|
+
});
|
|
77
83
|
});
|
|
78
84
|
async function query(exp, what = 'all') {
|
|
79
85
|
const jsiiCalcDir = path.dirname(require.resolve('jsii-calc/package.json'));
|