File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 1
1
/// <reference path="./types.d.ts" />
2
2
3
- import { readAll } from "./deps.ts" ;
4
- import { join } from "./deps.ts" ;
3
+ import { join , readAll } from "./deps.ts" ;
5
4
import { ProcessError } from "./src/process_error.ts" ;
6
5
import { $ } from "./mod.ts" ;
7
6
8
7
window . $ = $ ;
9
8
10
- let script : string | undefined = Deno . args [ 0 ] ;
9
+ const script : string | undefined = Deno . args [ 0 ] ;
11
10
12
11
try {
13
12
if ( ! script ) {
14
13
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 ) {
17
16
await import (
18
- `data:application/typescript,${ encodeURIComponent ( script ) } `
17
+ `data:application/typescript,${ encodeURIComponent ( data ) } `
19
18
) ;
20
19
} else {
21
20
console . error ( `usage: dzx <script>` ) ;
25
24
} else if ( script . startsWith ( "http://" ) || script . startsWith ( "https://" ) ) {
26
25
await import ( script ) ;
27
26
} else if ( script ) {
27
+ // await import(join($.cwd, script));
28
28
const data = await Deno . readTextFile ( join ( $ . cwd , script ) ) ;
29
29
await import ( `data:application/typescript,${ encodeURIComponent ( data ) } ` ) ;
30
30
} else {
You can’t perform that action at this time.
0 commit comments