-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support ESM declaration imports; add an
AcornJsxParser
class …
…and `tokTypes` const
- Loading branch information
Showing
1 changed file
with
22 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |