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

Function compileTypeScript

packages/node/src/build.ts:192–210  ·  view source on GitHub ↗
(path: string, source: string)

Source from the content-addressed store, hash-verified

190
191 let tsCompile: Register;
192 function compileTypeScript(path: string, source: string): string {
193 const relPath = relative(baseDir, path);
194 if (!tsCompile) {
195 tsCompile = register({
196 basePath: workPath, // The base is the same as root now.json dir
197 project: path, // Resolve tsconfig.json from entrypoint dir
198 files: true, // Include all files such as global `.d.ts`
199 nodeVersionMajor: nodeVersion.major,
200 });
201 }
202 const { code, map } = tsCompile(source, path);
203 tsCompiled.add(relPath);
204 preparedFiles[renameTStoJS(relPath) + '.map'] = new FileBlob({
205 data: JSON.stringify(map),
206 });
207 source = code;
208 shouldAddSourcemapSupport = true;
209 return source;
210 }
211 const isBun = isBunVersion(nodeVersion);
212
213 const conditions = isEdgeFunction

Callers 1

readFileFunction · 0.85

Calls 4

relativeFunction · 0.90
registerFunction · 0.90
renameTStoJSFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected