diff --git a/deps.ts b/deps.ts index d193c78..64e7902 100644 --- a/deps.ts +++ b/deps.ts @@ -1,3 +1,4 @@ export { join } from "https://deno.land/std@0.95.0/path/mod.ts"; export { colors } from "https://deno.land/x/cliffy@v0.18.2/ansi/colors.ts"; export { iter } from "https://deno.land/std@0.95.0/io/util.ts"; +export { encode } from "https://deno.land/std@0.84.0/encoding/base64.ts"; diff --git a/dzx.ts b/dzx.ts index 708217e..2ddbe77 100755 --- a/dzx.ts +++ b/dzx.ts @@ -1,3 +1,4 @@ +import { encode } from "./deps.ts"; import { DZX } from "./types.d.ts"; import { colors, iter, join } from "./deps.ts"; import { ProcessResult } from "./process_result.ts"; @@ -12,7 +13,9 @@ window.$ = $; const script: string | undefined = Deno.args[0]; if (script) { - await import(join(Deno.cwd(), script)); + const url = join(Deno.cwd(), script); + const content = await Deno.readTextFile(url); + await import(`data:application/typescript;base64,${encode(content)}`); } else { console.error("missing script"); Deno.exit(0);