Skip to content

Commit 1e7e9d8

Browse files
committed
fix: fix the JavaScript exports
1 parent 6a64fff commit 1e7e9d8

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

lib/grammars.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import doc from "./grammars/doc"
1010
import fortran from "./grammars/fortran"
1111
import haskell from "./grammars/haskell"
1212
import * as java from "./grammars/java"
13-
import * as js from "./grammars/javascript"
13+
import js from "./grammars/javascript"
1414
import lisp from "./grammars/lisp"
1515
import * as lua from "./grammars/lua"
1616
import ml from "./grammars/ml"

lib/grammars/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const os = OperatingSystem.platform()
1818
const arch = OperatingSystem.architecture()
1919
const windows = OperatingSystem.isWindows()
2020

21-
export default {
21+
const OtherGrammars = {
2222
"1C (BSL)": {
2323
"File Based": {
2424
command: "oscript",
@@ -610,6 +610,7 @@ export default {
610610
},
611611
},
612612
}
613+
export default OtherGrammars
613614

614615
function __guardMethod__(obj, methodName, transform) {
615616
if (typeof obj !== "undefined" && obj !== null && typeof obj[methodName] === "function") {

lib/grammars/javascript.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const args = ({ filepath }) => {
1616
const cmd = `'${babel}' --filename '${filepath}' --config-file ${babelConfig} < '${filepath}'| node`
1717
return GrammarUtils.formatArgs(cmd)
1818
}
19-
export const Dart = {
19+
const Dart = {
2020
"Selection Based": {
2121
command: "dart",
2222
args: (context) => {
@@ -30,7 +30,7 @@ export const Dart = {
3030
args: ({ filepath }) => [filepath],
3131
},
3232
}
33-
export const JavaScript = {
33+
const JavaScript = {
3434
"Selection Based": {
3535
command: GrammarUtils.command,
3636
args: (context) => {
@@ -41,11 +41,10 @@ export const JavaScript = {
4141
},
4242
"File Based": { command: GrammarUtils.command, args },
4343
}
44-
// TODO respect ES6 exporting
45-
exports["Babel ES6 JavaScript"] = JavaScript
46-
exports["JavaScript with JSX"] = JavaScript
44+
const Babel = JavaScript
45+
const JSX = JavaScript
4746

48-
exports["JavaScript for Automation (JXA)"] = {
47+
const JXA = {
4948
"Selection Based": {
5049
command: "osascript",
5150
args: (context) => ["-l", "JavaScript", "-e", context.getCode()],
@@ -55,7 +54,7 @@ exports["JavaScript for Automation (JXA)"] = {
5554
args: ({ filepath }) => ["-l", "JavaScript", filepath],
5655
},
5756
}
58-
export const TypeScript = {
57+
const TypeScript = {
5958
"Selection Based": {
6059
command: "ts-node",
6160
args: (context) => ["-e", context.getCode()],
@@ -65,3 +64,13 @@ export const TypeScript = {
6564
args: ({ filepath }) => [filepath],
6665
},
6766
}
67+
68+
const JavaScriptGrammars = {
69+
JavaScript,
70+
"Babel ES6 JavaScript": Babel,
71+
"JavaScript with JSX": JSX,
72+
Dart,
73+
"JavaScript for Automation (JXA)": JXA,
74+
TypeScript,
75+
}
76+
export default JavaScriptGrammars

0 commit comments

Comments
 (0)