Skip to content

Commit 7ba5564

Browse files
committed
chore: run fmt
Signed-off-by: Sam Gammon <[email protected]>
1 parent eb22eda commit 7ba5564

File tree

2 files changed

+36
-42
lines changed

2 files changed

+36
-42
lines changed

tools/tsc/build.mjs

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@
1313

1414
import esbuild from "esbuild";
1515

16-
export const mode = 'esm'
16+
export const mode = "esm";
1717

1818
async function buildTypescriptEntrypoint() {
1919
await esbuild.build({
2020
entryPoints: ["src/main/js/entry.mjs"],
21-
outfile: `src/main/resources/META-INF/elide/embedded/tools/tsc/entry.${mode === 'esm' ? 'mjs' : 'cjs'}`,
21+
outfile: `src/main/resources/META-INF/elide/embedded/tools/tsc/entry.${mode === "esm" ? "mjs" : "cjs"}`,
2222
format: mode,
2323
bundle: true,
2424
platform: "neutral",
2525
external: ["fs", "node:fs", "path", "node:path", "os", "node:os", "inspector", "node:inspector"],
26-
mainFields: ["module", "main"]
27-
})
26+
mainFields: ["module", "main"],
27+
});
2828

29-
console.info("TypeScript entrypoint build complete.")
29+
console.info("TypeScript entrypoint build complete.");
3030
}
3131

3232
console.info("Building TypeScript entrypoint...");

tools/tsc/src/main/js/entry.mjs

+31-37
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,41 @@
1-
import * as tsvfs from "@typescript/vfs"
2-
import ts from "typescript"
3-
import { readFileSync } from "fs"
4-
import { join } from "path"
1+
import * as tsvfs from "@typescript/vfs";
2+
import ts from "typescript";
3+
import { readFileSync } from "fs";
4+
import { join } from "path";
55

66
const getLib = (name) => {
7-
const lib = dirname(require.resolve("typescript"))
8-
return readFileSync(join(lib, name), "utf8")
9-
}
7+
const lib = dirname(require.resolve("typescript"));
8+
return readFileSync(join(lib, name), "utf8");
9+
};
1010

1111
const addLib = (name, map) => {
12-
map.set("/" + name, getLib(name))
13-
}
12+
map.set("/" + name, getLib(name));
13+
};
1414

1515
const createDefaultMap2015 = () => {
16-
const fsMap = new Map()
17-
addLib("lib.es2015.d.ts", fsMap)
18-
addLib("lib.es2015.collection.d.ts", fsMap)
19-
addLib("lib.es2015.core.d.ts", fsMap)
20-
addLib("lib.es2015.generator.d.ts", fsMap)
21-
addLib("lib.es2015.iterable.d.ts", fsMap)
22-
addLib("lib.es2015.promise.d.ts", fsMap)
23-
addLib("lib.es2015.proxy.d.ts", fsMap)
24-
addLib("lib.es2015.reflect.d.ts", fsMap)
25-
addLib("lib.es2015.symbol.d.ts", fsMap)
26-
addLib("lib.es2015.symbol.wellknown.d.ts", fsMap)
27-
addLib("lib.es5.d.ts", fsMap)
28-
return fsMap
29-
}
16+
const fsMap = new Map();
17+
addLib("lib.es2015.d.ts", fsMap);
18+
addLib("lib.es2015.collection.d.ts", fsMap);
19+
addLib("lib.es2015.core.d.ts", fsMap);
20+
addLib("lib.es2015.generator.d.ts", fsMap);
21+
addLib("lib.es2015.iterable.d.ts", fsMap);
22+
addLib("lib.es2015.promise.d.ts", fsMap);
23+
addLib("lib.es2015.proxy.d.ts", fsMap);
24+
addLib("lib.es2015.reflect.d.ts", fsMap);
25+
addLib("lib.es2015.symbol.d.ts", fsMap);
26+
addLib("lib.es2015.symbol.wellknown.d.ts", fsMap);
27+
addLib("lib.es5.d.ts", fsMap);
28+
return fsMap;
29+
};
3030

3131
function compile(fsMap, compilerOptions) {
32-
const baseMap = createDefaultMap2015()
32+
const baseMap = createDefaultMap2015();
3333
fsMap.keys.forEach((key) => {
34-
baseMap.set(key, fsMap.get(key))
34+
baseMap.set(key, fsMap.get(key));
3535
});
3636

37-
const system = tsvfs.createSystem(fsMap)
38-
const host = tsvfs.createVirtualCompilerHost(
39-
system,
40-
compilerOptions,
41-
ts,
42-
)
37+
const system = tsvfs.createSystem(fsMap);
38+
const host = tsvfs.createVirtualCompilerHost(system, compilerOptions, ts);
4339

4440
const program = ts.createProgram({
4541
rootNames: [...fsMap.keys()],
@@ -49,11 +45,9 @@ function compile(fsMap, compilerOptions) {
4945

5046
const emitResult = program.emit();
5147

52-
const allDiagnostics = ts
53-
.getPreEmitDiagnostics(program)
54-
.concat(emitResult.diagnostics);
48+
const allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
5549

56-
allDiagnostics.forEach(diagnostic => {
50+
allDiagnostics.forEach((diagnostic) => {
5751
if (diagnostic.file) {
5852
let { line, character } = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
5953
let message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
@@ -69,10 +63,10 @@ function compile(fsMap, compilerOptions) {
6963
}
7064

7165
export default function entry(args) {
72-
console.log("Running `tsc`...", JSON.stringify({args: args[0]}));
66+
console.log("Running `tsc`...", JSON.stringify({ args: args[0] }));
7367
const fsMap = new Map();
7468
const exitCode = compile(args[0], {});
75-
console.log("Result of `tsc`:", {exitCode});
69+
console.log("Result of `tsc`:", { exitCode });
7670
return exitCode;
7771
}
7872

0 commit comments

Comments
 (0)