Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit db5a2f9

Browse files
renrizzoloKnisterPeter
authored andcommitted
fix: upgrade astq
1 parent 4d0c535 commit db5a2f9

File tree

6 files changed

+951
-980
lines changed

6 files changed

+951
-980
lines changed

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"typescript": "4.7.3"
6565
},
6666
"dependencies": {
67-
"astq": "2.3.6",
67+
"astq": "2.7.8",
6868
"babel-generator": "6.26.1",
6969
"babylon": "7.0.0-beta.47",
7070
"chalk": "4.1.2",

Diff for: src/analyzer.ts

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export function parsePropTypes(
2424
instanceOfResolver?: InstanceOfResolver
2525
): IPropTypes {
2626
const astq = new ASTQ();
27+
astq.adapter('mozast', true);
2728
return astq
2829
.query(node, `/ObjectProperty`)
2930
.reduce((propTypes: IPropTypes, propertyNode: IASTNode) => {

Diff for: src/deprecated.ts

+2
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ function parseAst(
152152

153153
function getClassName(ast: any): string | undefined {
154154
const astq = new ASTQ();
155+
astq.adapter('mozast', true);
155156
const classDeclarationNodes = astq.query(
156157
ast,
157158
`
@@ -190,6 +191,7 @@ function getClassExportType(
190191
classname: string
191192
): ExportType | undefined {
192193
const astq = new ASTQ();
194+
astq.adapter('mozast', true);
193195
const exportTypeNodes = astq.query(
194196
ast,
195197
`

Diff for: src/typings.ts

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export function createTypings(
3030
dom.config.outputEol = options.eol || '\r\n';
3131

3232
const astq = new ASTQ();
33+
astq.adapter('mozast', true);
3334
const ast = {
3435
ast: programAst,
3536
query(query: string): any[] {

Diff for: typings/astq.d.ts

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
11
declare module 'astq' {
22
namespace ASTQ {}
33
class ASTQ {
4-
public query(ast: any, query: string): any[];
4+
public adapter(
5+
adapter:
6+
| 'mozast'
7+
| 'graphql'
8+
| 'xmldom'
9+
| 'parse5'
10+
| 'json'
11+
| 'cheero'
12+
| 'unist'
13+
| 'asty',
14+
force: boolean
15+
): void;
16+
public query(
17+
ast: any,
18+
query: string,
19+
options?: any,
20+
trace?: boolean
21+
): any[];
522
}
623

724
export = ASTQ;

0 commit comments

Comments
 (0)