Skip to content

Commit 67abf6e

Browse files
committed
chore: move code in javascript
1 parent abf884e commit 67abf6e

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

lib/grammars/javascript.js

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,45 @@ function JavaScriptArgs({ filepath }) {
1717
return GrammarUtils.formatArgs(cmd)
1818
}
1919

20-
const Dart = {
20+
const JavaScript = {
2121
"Selection Based": {
22-
command: "dart",
22+
command: GrammarUtils.command,
2323
args: (context) => {
2424
const code = context.getCode()
25-
const tmpFile = GrammarUtils.createTempFileWithCode(code, ".dart")
26-
return [tmpFile]
25+
const filepath = GrammarUtils.createTempFileWithCode(code, ".js")
26+
return JavaScriptArgs({ filepath })
2727
},
2828
},
29+
"File Based": { command: GrammarUtils.command, args: JavaScriptArgs },
30+
}
31+
const Babel = JavaScript
32+
const JSX = JavaScript
33+
34+
const TypeScript = {
35+
"Selection Based": {
36+
command: "ts-node",
37+
args: (context) => ["-e", context.getCode()],
38+
},
2939
"File Based": {
30-
command: "dart",
40+
command: "ts-node",
3141
args: ({ filepath }) => [filepath],
3242
},
3343
}
34-
const JavaScript = {
44+
45+
const Dart = {
3546
"Selection Based": {
36-
command: GrammarUtils.command,
47+
command: "dart",
3748
args: (context) => {
3849
const code = context.getCode()
39-
const filepath = GrammarUtils.createTempFileWithCode(code, ".js")
40-
return JavaScriptArgs({ filepath })
50+
const tmpFile = GrammarUtils.createTempFileWithCode(code, ".dart")
51+
return [tmpFile]
4152
},
4253
},
43-
"File Based": { command: GrammarUtils.command, args: JavaScriptArgs },
54+
"File Based": {
55+
command: "dart",
56+
args: ({ filepath }) => [filepath],
57+
},
4458
}
45-
const Babel = JavaScript
46-
const JSX = JavaScript
4759

4860
const JXA = {
4961
"Selection Based": {
@@ -55,16 +67,6 @@ const JXA = {
5567
args: ({ filepath }) => ["-l", "JavaScript", filepath],
5668
},
5769
}
58-
const TypeScript = {
59-
"Selection Based": {
60-
command: "ts-node",
61-
args: (context) => ["-e", context.getCode()],
62-
},
63-
"File Based": {
64-
command: "ts-node",
65-
args: ({ filepath }) => [filepath],
66-
},
67-
}
6870

6971
const JavaScriptGrammars = {
7072
JavaScript,

0 commit comments

Comments
 (0)