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

Commit

Permalink
fix: upgrade astq
Browse files Browse the repository at this point in the history
  • Loading branch information
renrizzolo authored and KnisterPeter committed Jun 7, 2022
1 parent 4d0c535 commit db5a2f9
Show file tree
Hide file tree
Showing 6 changed files with 951 additions and 980 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"typescript": "4.7.3"
},
"dependencies": {
"astq": "2.3.6",
"astq": "2.7.8",
"babel-generator": "6.26.1",
"babylon": "7.0.0-beta.47",
"chalk": "4.1.2",
Expand Down
1 change: 1 addition & 0 deletions src/analyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export function parsePropTypes(
instanceOfResolver?: InstanceOfResolver
): IPropTypes {
const astq = new ASTQ();
astq.adapter('mozast', true);
return astq
.query(node, `/ObjectProperty`)
.reduce((propTypes: IPropTypes, propertyNode: IASTNode) => {
Expand Down
2 changes: 2 additions & 0 deletions src/deprecated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ function parseAst(

function getClassName(ast: any): string | undefined {
const astq = new ASTQ();
astq.adapter('mozast', true);
const classDeclarationNodes = astq.query(
ast,
`
Expand Down Expand Up @@ -190,6 +191,7 @@ function getClassExportType(
classname: string
): ExportType | undefined {
const astq = new ASTQ();
astq.adapter('mozast', true);
const exportTypeNodes = astq.query(
ast,
`
Expand Down
1 change: 1 addition & 0 deletions src/typings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function createTypings(
dom.config.outputEol = options.eol || '\r\n';

const astq = new ASTQ();
astq.adapter('mozast', true);
const ast = {
ast: programAst,
query(query: string): any[] {
Expand Down
19 changes: 18 additions & 1 deletion typings/astq.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
declare module 'astq' {
namespace ASTQ {}
class ASTQ {
public query(ast: any, query: string): any[];
public adapter(
adapter:
| 'mozast'
| 'graphql'
| 'xmldom'
| 'parse5'
| 'json'
| 'cheero'
| 'unist'
| 'asty',
force: boolean
): void;
public query(
ast: any,
query: string,
options?: any,
trace?: boolean
): any[];
}

export = ASTQ;
Expand Down

0 comments on commit db5a2f9

Please sign in to comment.