@@ -2,19 +2,14 @@ import { VERSION } from "../../version.ts";
2
2
import { path } from "../runtime/mod.ts" ;
3
3
import { bundleCommand } from "./bundle.ts" ;
4
4
import { compileCommand } from "./compile.ts" ;
5
- import {
6
- Command ,
7
- DenoLandProvider ,
8
- UpgradeCommand ,
9
- ValidationError ,
10
- } from "./deps.ts" ;
5
+ import { Command , DenoLandProvider , UpgradeCommand } from "./deps.ts" ;
11
6
import { addProtocol } from "../_utils.ts" ;
12
7
import { evalCommand } from "./eval.ts" ;
13
8
import { importModule } from "./lib/bootstrap.ts" ;
14
9
import { getModuleFromStdin } from "./lib/stream.ts" ;
15
10
import { getMarkdownModule } from "./lib/markdown.ts" ;
16
11
import { spawnWorker } from "./lib/worker.ts" ;
17
- import { replCommand } from "./repl.ts" ;
12
+ import { repl , replCommand } from "./repl.ts" ;
18
13
19
14
export function dzx ( ) {
20
15
return new Command ( )
@@ -62,9 +57,21 @@ export function dzx() {
62
57
"Allow file system write access." ,
63
58
{ depends : [ "worker" ] } ,
64
59
)
60
+ . option (
61
+ "--compat" ,
62
+ "Node compatibility mode. Currently only enables built-in node modules like 'fs' and globals like 'process'." ,
63
+ )
64
+ . option (
65
+ "--inspect <host:string>" ,
66
+ "Activate inspector on host:port. (default: 127.0.0.1:9229)" ,
67
+ )
68
+ . option (
69
+ "--inspect-brk <host:string>" ,
70
+ "Activate inspector on host:port and break at start of user script." ,
71
+ )
65
72
. option (
66
73
"-w, --worker" ,
67
- "Run script in an isolated web worker with it's own permissions." ,
74
+ "Run script in an isolated web worker with it's own permissions. (experimental) " ,
68
75
)
69
76
. option (
70
77
"-v, --verbose" ,
@@ -83,12 +90,13 @@ export function dzx() {
83
90
. stopEarly ( )
84
91
. action (
85
92
async (
86
- { worker, verbose, ...perms } ,
93
+ { worker, verbose, ...options } ,
87
94
script ?: string ,
88
95
args : Array < string > = [ ] ,
89
96
) => {
90
97
if ( ! script && Deno . isatty ( Deno . stdin . rid ) ) {
91
- throw new ValidationError ( `Missing argument(s): script` ) ;
98
+ await repl ( { ...options , verbose } ) ;
99
+ return ;
92
100
}
93
101
94
102
let mainModule : string ;
@@ -103,7 +111,7 @@ export function dzx() {
103
111
104
112
if ( worker ) {
105
113
spawnWorker ( {
106
- perms,
114
+ perms : options ,
107
115
mainModule,
108
116
args,
109
117
verbose,
0 commit comments