-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When transpiling required files we need to be pretty liberal about what syntax we allow, otherwise we can end up in a situation where the current node version can actually parse more natively than babylon is allowed to by `@babel/preset-env`. This should fix that. Fixes #102
- Loading branch information
1 parent
f56ff4b
commit e3f0341
Showing
5 changed files
with
42 additions
and
16 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import * as Babel from '@babel/core'; | ||
import { BabelOptions, ParseOptions } from './TransformRunner'; | ||
|
||
export const ALL_PLUGINS = [ | ||
'flow', | ||
'jsx', | ||
'asyncGenerators', | ||
'classProperties', | ||
'doExpressions', | ||
'exportExtensions', | ||
'functionBind', | ||
'functionSent', | ||
'objectRestSpread', | ||
'dynamicImport', | ||
'decorators' | ||
]; | ||
|
||
export default function(babel: typeof Babel) { | ||
return { | ||
manipulateOptions(opts: BabelOptions, parserOpts: ParseOptions) { | ||
for (let plugin of ALL_PLUGINS) { | ||
if (plugin !== 'flow' || !opts.filename.endsWith('.ts')) { | ||
parserOpts.plugins.push(plugin); | ||
} | ||
} | ||
} | ||
}; | ||
} |
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
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
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
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