MCPcopy Create free account
hub / github.com/vercel/vercel / typescript

Function typescript

packages/backends/src/typescript.ts:32–58  ·  view source on GitHub ↗
(args: TypescriptOptions)

Source from the content-addressed store, hash-verified

30type TypeScriptModule = typeof import('typescript');
31
32export 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
60async function doTypeCheck(
61 args: { entrypoint: string; workPath: string },

Callers 2

buildFunction · 0.85
buildFunction · 0.85

Calls 5

resolveTypeScriptModuleFunction · 0.85
doTypeCheckFunction · 0.85
childMethod · 0.80
traceMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected