ts.ts

import { File, SourceFile } from "file/classes";
import JavascriptFile from "./js";

import { wrapFile } from "../classes/utils";
import type { PageSettings } from "../../types/site";

const transpiler = new Bun.Transpiler({
  loader: "ts",
});

const tsToJs = (tsFile: File, cfg: PageSettings) => {
  return transpiler.transformSync(tsFile.text(cfg));
};

class TypescriptFile extends SourceFile {
  public static filetypes = ["ts"];
  public static targets = ["js"];

  js(cfg: PageSettings) {
    return wrapFile(this, (f) => tsToJs(f, cfg), {
      extension: "js",
    }) as JavascriptFile;
  }
}

export default TypescriptFile;
Revisions
DateHash
2024-04-14
2024-04-14
2024-04-14
2024-04-14
2024-04-14
2024-04-14
2024-04-14
2024-04-14
2024-04-13
2024-04-13
2024-04-13
2024-04-01
2024-03-31
2024-03-31
Navigation
Previousact.ts
Nextcss.ts
Upfiletype