Skip to content

Commit

Permalink
feat: Support ESM declaration imports; add an AcornJsxParser class …
Browse files Browse the repository at this point in the history
…and `tokTypes` const
  • Loading branch information
brettz9 committed Feb 12, 2022
1 parent f5c107b commit 67f0988
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
import { Parser } from 'acorn'
import acorn from 'acorn';

declare const jsx: (options?: jsx.Options) => (BaseParser: typeof Parser) => typeof Parser;
export const jsx: (options?: jsx.Options) => (BaseParser: typeof acorn.Parser) => typeof acorn.Parser;

declare namespace jsx {
interface Options {
allowNamespacedObjects?: boolean;
allowNamespaces?: boolean;
}
export interface Options {
allowNamespacedObjects?: boolean;
allowNamespaces?: boolean;
}

export = jsx;
export const tokTypes: {
jsxName: acorn.TokenType,
jsxText: acorn.TokenType,
jsxTagEnd: acorn.TokenType,
jsxTagStart: acorn.TokenType
} & typeof acorn.tokTypes;

export class AcornJsxParser extends acorn.Parser {
static readonly acornJsx: {
tokTypes: typeof tokTypes
};

jsx_readString(quote: number): void;
}

export as namespace jsx;
export default jsx;

0 comments on commit 67f0988

Please sign in to comment.