Skip to content

Commit 7ef1f4c

Browse files
authored
Merge pull request #2341 from atom-ide-community/@babel
2 parents a344c30 + a7d48ff commit 7ef1f4c

File tree

4 files changed

+23
-6
lines changed

4 files changed

+23
-6
lines changed

lib/grammars/babel.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
presets: [
3+
[
4+
'@babel/preset-env',
5+
{
6+
targets: {
7+
node: 'current',
8+
},
9+
},
10+
'@babel/preset-react',
11+
],
12+
],
13+
};

lib/grammars/coffeescript.coffee

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ path = require 'path'
44
bin = path.join __dirname, '../..', 'node_modules', '.bin'
55
coffee = path.join bin, 'coffee'
66
babel = path.join bin, 'babel'
7+
babelConfig = path.join __dirname, 'babel.config.js'
78

89
args = ({filepath}) ->
9-
cmd = "'#{coffee}' -p '#{filepath}'|'#{babel}' --filename '#{bin}'| node"
10+
cmd = "'#{coffee}' -p '#{filepath}'|'#{babel}' --filename '#{bin} --config-file #{babelConfig}'| node"
1011
return GrammarUtils.formatArgs(cmd)
1112

1213
exports.CoffeeScript =

lib/grammars/javascript.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
'use babel';
22

33
import path from 'path';
4-
import GrammarUtils, { command } from '../grammar-utils';
4+
import GrammarUtils, { command, OperatingSystem } from '../grammar-utils';
55

6-
const babel = path.join(__dirname, '../..', 'node_modules', '.bin', 'babel');
6+
const babel = path.join(__dirname, '../..', 'node_modules', '.bin', OperatingSystem.isWindows() ? 'babel.cmd' : 'babel');
7+
const babelConfig = path.join(__dirname, 'babel.config.js');
78

89
const args = ({ filepath }) => {
9-
const cmd = `'${babel}' --filename '${babel}' < '${filepath}'| node`;
10+
const cmd = `'${babel}' --filename '${filepath}' --config-file ${babelConfig} < '${filepath}'| node`;
1011
return GrammarUtils.formatArgs(cmd);
1112
};
1213
exports.Dart = {

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,18 @@
1919
]
2020
},
2121
"dependencies": {
22+
"@babel/cli": "^7.12.10",
23+
"@babel/core": "^7.12.10",
24+
"@babel/preset-env": "^7.12.11",
25+
"@babel/preset-react": "^7.12.10",
2226
"ansi-to-html": "^0.4.2",
2327
"atom-message-panel": "1.3.1",
2428
"atom-space-pen-views-plus": "^3.0.4",
25-
"babel-preset-env": "^1.6.0",
2629
"strip-ansi": "^3.0.0",
2730
"underscore": "^1.8.3",
2831
"uuid": "^8.3.2"
2932
},
3033
"optionalDependencies": {
31-
"babel-cli": "^6.26.0",
3234
"coffeescript": "^2"
3335
},
3436
"devDependencies": {

0 commit comments

Comments
 (0)