MCPcopy
hub / github.com/TypeStrong/ts-node / phase2

Function phase2

src/bin.ts:276–340  ·  view source on GitHub ↗
(payload: BootstrapState)

Source from the content-addressed store, hash-verified

274}
275
276function phase2(payload: BootstrapState) {
277 const { help, version, cwdArg, esm } = payload.parseArgvResult;
278
279 if (help) {
280 console.log(`
281Usage: ts-node [options] [ -e script | script.ts ] [arguments]
282
283Options:
284
285 -e, --eval [code] Evaluate code
286 -p, --print Print result of \`--eval\`
287 -r, --require [path] Require a node module before execution
288 -i, --interactive Opens the REPL even if stdin does not appear to be a terminal
289
290 --esm Bootstrap with the ESM loader, enabling full ESM support
291 --swc Use the faster swc transpiler
292
293 -h, --help Print CLI usage
294 -v, --version Print module version information. -vvv to print additional information
295 --showConfig Print resolved configuration and exit
296
297 -T, --transpileOnly Use TypeScript's faster \`transpileModule\` or a third-party transpiler
298 -H, --compilerHost Use TypeScript's compiler host API
299 -I, --ignore [pattern] Override the path patterns to skip compilation
300 -P, --project [path] Path to TypeScript JSON project file
301 -C, --compiler [name] Specify a custom TypeScript compiler
302 --transpiler [name] Specify a third-party, non-typechecking transpiler
303 -D, --ignoreDiagnostics [code] Ignore TypeScript warnings by diagnostic code
304 -O, --compilerOptions [opts] JSON object to merge with compiler options
305
306 --cwd Behave as if invoked within this working directory.
307 --files Load \`files\`, \`include\` and \`exclude\` from \`tsconfig.json\` on startup
308 --pretty Use pretty diagnostic formatter (usually enabled by default)
309 --cwdMode Use current directory instead of <script.ts> for config resolution
310 --skipProject Skip reading \`tsconfig.json\`
311 --skipIgnore Skip \`--ignore\` checks
312 --emit Emit output files into \`.ts-node\` directory
313 --scope Scope compiler to files within \`scopeDir\`. Anything outside this directory is ignored.
314 --scopeDir Directory for \`--scope\`
315 --preferTsExts Prefer importing TypeScript files over JavaScript files
316 --logError Logs TypeScript errors to stderr instead of throwing exceptions
317 --noExperimentalReplAwait Disable top-level await in REPL. Equivalent to node's --no-experimental-repl-await
318 --experimentalSpecifierResolution [node|explicit]
319 Equivalent to node's --experimental-specifier-resolution
320`);
321
322 process.exit(0);
323 }
324
325 // Output project information.
326 if (version === 1) {
327 console.log(`v${VERSION}`);
328 process.exit(0);
329 }
330
331 const cwd = cwdArg ? resolve(cwdArg) : process.cwd();
332
333 // If ESM is explicitly enabled through the flag, stage3 should be run in a child process

Callers 1

bootstrapFunction · 0.85

Calls 1

resolveFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…