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

Commit 586b5ec

Browse files
marioneblKnisterPeter
authored andcommitted
fix(parser): configure babel to be as permissive as possible
1 parent 9785484 commit 586b5ec

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: index.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export type InstanceOfResolver = (name: string) => string;
66
export interface IOptions {
77
/**
88
* Resolves type names to import paths.
9-
*
9+
*
1010
* @return Path to given name if resolveable, undefined otherwise
1111
*/
1212
instanceOfResolver?: InstanceOfResolver;
@@ -61,6 +61,9 @@ export function generateFromFile(name: string, path: string, options?: IOptions)
6161
export function generateFromSource(name: string, code: string, options: IOptions = {}): string {
6262
const ast: any = babylon.parse(code, {
6363
sourceType: 'module',
64+
allowReturnOutsideFunction: true,
65+
allowImportExportEverywhere: true,
66+
allowSuperOutsideMethod: true,
6467
plugins: [
6568
'jsx',
6669
'flow',
@@ -74,6 +77,7 @@ export function generateFromSource(name: string, code: string, options: IOptions
7477
'exportExtensions',
7578
'exponentiationOperator',
7679
'asyncGenerators',
80+
'functionBind',
7781
'functionSent'
7882
]
7983
});

0 commit comments

Comments
 (0)