Skip to content

Commit 4ee4800

Browse files
committed
Revert "refactor: import from path instead of data url"
1 parent b99669e commit 4ee4800

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

dzx.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
/// <reference path="./types.d.ts" />
22

3-
import { readAll } from "./deps.ts";
4-
import { join } from "./deps.ts";
3+
import { join, readAll } from "./deps.ts";
54
import { ProcessError } from "./src/process_error.ts";
65
import { $ } from "./mod.ts";
76

87
window.$ = $;
98

10-
let script: string | undefined = Deno.args[0];
9+
const script: string | undefined = Deno.args[0];
1110

1211
try {
1312
if (!script) {
1413
if (!Deno.isatty(Deno.stdin.rid)) {
15-
script = new TextDecoder().decode(await readAll(Deno.stdin));
16-
if (script) {
14+
const data = new TextDecoder().decode(await readAll(Deno.stdin));
15+
if (data) {
1716
await import(
18-
`data:application/typescript,${encodeURIComponent(script)}`
17+
`data:application/typescript,${encodeURIComponent(data)}`
1918
);
2019
} else {
2120
console.error(`usage: dzx <script>`);
@@ -25,6 +24,7 @@ try {
2524
} else if (script.startsWith("http://") || script.startsWith("https://")) {
2625
await import(script);
2726
} else if (script) {
27+
// await import(join($.cwd, script));
2828
const data = await Deno.readTextFile(join($.cwd, script));
2929
await import(`data:application/typescript,${encodeURIComponent(data)}`);
3030
} else {

0 commit comments

Comments
 (0)