File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ export function dzx() {
70
70
) => {
71
71
if ( script ) {
72
72
script = addProtocool ( script ) ;
73
+ $ . mainModule = script ;
73
74
if ( worker ) {
74
75
spawnWorker ( script , perms ) ;
75
76
} else {
@@ -96,6 +97,7 @@ export function dzx() {
96
97
`data:application/typescript,${
97
98
encodeURIComponent ( `
98
99
import "${ new URL ( "./src/runtime/mod.ts" , Deno . mainModule ) } ";
100
+ $.mainModule = "${ script } ";
99
101
await import("${ script } ");
100
102
if ($.verbose) {
101
103
const end = Date.now();
@@ -125,9 +127,8 @@ export function dzx() {
125
127
async function importFromStdin ( ) : Promise < void > {
126
128
const data = new TextDecoder ( ) . decode ( await io . readAll ( Deno . stdin ) ) ;
127
129
if ( data ) {
128
- await import (
129
- `data:application/typescript,${ encodeURIComponent ( data ) } `
130
- ) ;
130
+ $ . mainModule = `data:application/typescript,${ encodeURIComponent ( data ) } ` ;
131
+ await import ( $ . mainModule ) ;
131
132
} else {
132
133
// @TODO : add support for exit code in ValidationError
133
134
// throw new ValidationError(`Failed to read from stdin.`, 2);
Original file line number Diff line number Diff line change @@ -4,9 +4,10 @@ import { exec } from "./exec.ts";
4
4
import { quote } from "./quote.ts" ;
5
5
6
6
export type $ = typeof exec & typeof colors & {
7
+ shell : string ;
8
+ mainModule : string ;
7
9
verbose : boolean ;
8
10
cwd : string ;
9
- shell : string ;
10
11
quote : typeof shq ;
11
12
throwErors : boolean ;
12
13
} ;
@@ -17,6 +18,7 @@ Object.setPrototypeOf($, Object.getPrototypeOf(colors));
17
18
18
19
$ . _stack = [ ] ;
19
20
$ . shell = "/bin/sh" ;
21
+ $ . mainModule = "" ;
20
22
$ . verbose = false ;
21
23
$ . cwd = Deno . cwd ( ) ;
22
24
$ . quote = shq ;
You can’t perform that action at this time.
0 commit comments