(args: TypescriptOptions)
| 30 | type TypeScriptModule = typeof import('typescript'); |
| 31 | |
| 32 | export const typescript = (args: TypescriptOptions) => { |
| 33 | const { span } = args; |
| 34 | const tsSpan = span.child('vc.builder.backends.tsCompile'); |
| 35 | |
| 36 | return tsSpan.trace(async () => { |
| 37 | const extension = extname(args.entrypoint); |
| 38 | const isTypeScript = ['.ts', '.mts', '.cts'].includes(extension); |
| 39 | |
| 40 | if (!isTypeScript) { |
| 41 | return; |
| 42 | } |
| 43 | |
| 44 | const ts = resolveTypeScriptModule(args.workPath); |
| 45 | if (!ts) { |
| 46 | console.log( |
| 47 | c.gray( |
| 48 | `${c.bold(c.cyan('✓'))} Typecheck skipped ${c.gray( |
| 49 | '(TypeScript not found)' |
| 50 | )}` |
| 51 | ) |
| 52 | ); |
| 53 | return null; |
| 54 | } |
| 55 | |
| 56 | return doTypeCheck(args, ts); |
| 57 | }); |
| 58 | }; |
| 59 | |
| 60 | async function doTypeCheck( |
| 61 | args: { entrypoint: string; workPath: string }, |
no test coverage detected