Skip to content

Commit

Permalink
Add babel6 syntax preset. (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
STRML authored and fkling committed May 5, 2016
1 parent 09ab43f commit 6f9ff8c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"babel-preset-es2015": "^6.1.18",
"babel-preset-react": "^6.1.18",
"babel-preset-stage-0": "^6.1.18",
"babel-preset-syntax-from-presets": "^1.0.0",
"babel-runtime": "^5.8.19",
"babel6": "file:packages/babel6",
"babylon": "^5.8.22",
Expand Down
7 changes: 4 additions & 3 deletions src/parsers/js/transformers/babel6/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@ export default {
loadTransformer(callback) {
require([
'babel6',
'babel-preset-syntax-from-presets',
'babel-preset-es2015',
'babel-preset-stage-0',
'babel-preset-react',
], (babel, ...presets) => callback({ babel, presets }));
], (babel, syntaxPreset, ...presets) => callback({ babel, syntaxPreset, presets }));
},

transform({ babel, presets }, transformCode, code) {
transform({ babel, syntaxPreset, presets }, transformCode, code) {
let transform = compileModule( // eslint-disable-line no-shadow
babel.transform(transformCode, { presets }).code
);

return babel.transform(code, {
presets: [],
presets: [syntaxPreset],
plugins: [(transform.default || transform)(babel)],
sourceMaps: true,
});
Expand Down

0 comments on commit 6f9ff8c

Please sign in to comment.