fix: typescript transpiler misbehaving

This commit is contained in:
2025-05-22 12:08:41 +03:00
parent a1a2293af4
commit ecfd80f36a
2 changed files with 7 additions and 7 deletions

View File

@@ -79,9 +79,9 @@ public class Reading {
if (bytes == null) return null; if (bytes == null) return null;
else return new String(bytes); else return new String(bytes);
} }
public static InputStream resourceToStream(String name) { public static InputStream resourceToStream(String name) {
return Reading.class.getResourceAsStream("/" + name); return Reading.class.getResourceAsStream("/" + name.replaceAll("//", "/"));
} }
public static String resourceToString(String name) { public static String resourceToString(String name) {
return streamToString(resourceToStream(name)); return streamToString(resourceToStream(name));

View File

@@ -16,10 +16,10 @@ export default function typescript(next: Compiler): Compiler {
const settings: CompilerOptions = { const settings: CompilerOptions = {
target: ScriptTarget.ES5, target: ScriptTarget.ES5,
module: ModuleKind.Preserve, module: ModuleKind.Preserve,
allowImportingTsExtensions: true, allowImportingTsExtensions: true,
verbatimModuleSyntax: true, verbatimModuleSyntax: false,
strict: false, strict: false,
skipLibCheck: true, skipLibCheck: true,
forceConsistentCasingInFileNames: true, forceConsistentCasingInFileNames: true,
@@ -52,7 +52,7 @@ export default function typescript(next: Compiler): Compiler {
} }
}, },
getScriptVersion: (filename) => String(versions[filename] || 0), getScriptVersion: (filename) => String(versions[filename] || 0),
readFile: () => { throw "no"; }, readFile: () => { throw "no"; },
writeFile: () => { throw "no"; }, writeFile: () => { throw "no"; },
}, createDocumentRegistry()); }, createDocumentRegistry());
@@ -61,7 +61,7 @@ export default function typescript(next: Compiler): Compiler {
service.getEmitOutput("/lib.d.ts"); service.getEmitOutput("/lib.d.ts");
}); });
print("Loaded typescript!"); print("Loaded typescript!");
return (filename, code, prevMap) => { return (filename, code, prevMap) => {
files["/src.ts"] = ScriptSnapshot.fromString(code); files["/src.ts"] = ScriptSnapshot.fromString(code);
versions["/src.ts"] ??= 0; versions["/src.ts"] ??= 0;