@@ -34,7 +34,6 @@ import { startRepl } from './repl.ts'
34
34
import { randomId } from './util.ts'
35
35
import { transformMarkdown } from './md.ts'
36
36
import { createRequire , type minimist } from './vendor.ts'
37
- import { unlinkSync } from 'fs'
38
37
39
38
const EXT = '.mjs'
40
39
const EXT_RE = / ^ \. [ m c ] ? [ j t ] s x ? $ /
@@ -82,6 +81,7 @@ export function printUsage() {
82
81
83
82
// prettier-ignore
84
83
export const argv : minimist . ParsedArgs = parseArgv ( process . argv . slice ( 2 ) , {
84
+ default : { [ 'prefer-local' ] : false } ,
85
85
// exclude 'prefer-local' to let minimist infer the type
86
86
string : [ 'shell' , 'prefix' , 'postfix' , 'eval' , 'cwd' , 'ext' , 'registry' , 'env' ] ,
87
87
boolean : [ 'version' , 'help' , 'quiet' , 'verbose' , 'install' , 'repl' , 'experimental' ] ,
@@ -130,17 +130,15 @@ async function runScript(
130
130
) : Promise < void > {
131
131
let nm = ''
132
132
const rmTemp = ( ) => {
133
- const rmOpts = { force : true , recursive : true }
134
- fs . rmSync ( tempPath , rmOpts )
135
- nm && fs . rmSync ( nm , rmOpts )
133
+ fs . rmSync ( tempPath , { force : true , recursive : true } )
134
+ nm && fs . rmSync ( nm , { force : true , recursive : true } )
136
135
}
137
136
try {
138
137
if ( tempPath ) {
139
138
scriptPath = tempPath
140
139
await fs . writeFile ( tempPath , script )
141
140
}
142
141
const cwd = path . dirname ( scriptPath )
143
-
144
142
if ( typeof argv . preferLocal === 'string' ) {
145
143
nm = linkNodeModules ( cwd , argv . preferLocal )
146
144
}
0 commit comments