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

Commit

Permalink
fix(parser): configure babel to be as permissive as possible
Browse files Browse the repository at this point in the history
  • Loading branch information
marionebl authored and KnisterPeter committed Apr 9, 2016
1 parent 9785484 commit 586b5ec
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export type InstanceOfResolver = (name: string) => string;
export interface IOptions {
/**
* Resolves type names to import paths.
*
*
* @return Path to given name if resolveable, undefined otherwise
*/
instanceOfResolver?: InstanceOfResolver;
Expand Down Expand Up @@ -61,6 +61,9 @@ export function generateFromFile(name: string, path: string, options?: IOptions)
export function generateFromSource(name: string, code: string, options: IOptions = {}): string {
const ast: any = babylon.parse(code, {
sourceType: 'module',
allowReturnOutsideFunction: true,
allowImportExportEverywhere: true,
allowSuperOutsideMethod: true,
plugins: [
'jsx',
'flow',
Expand All @@ -74,6 +77,7 @@ export function generateFromSource(name: string, code: string, options: IOptions
'exportExtensions',
'exponentiationOperator',
'asyncGenerators',
'functionBind',
'functionSent'
]
});
Expand Down

0 comments on commit 586b5ec

Please sign in to comment.