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

Function getBuild

packages/node/src/typescript.ts:187–362  ·  view source on GitHub ↗
(
    configFileName = '',
    skipTypeCheck?: boolean
  )

Source from the content-addressed store, hash-verified

185 }
186
187 function getBuild(
188 configFileName = '',
189 skipTypeCheck?: boolean
190 ): GetOutputFunction {
191 const cachedGetOutput = configFileToBuildMap.get(configFileName);
192
193 if (cachedGetOutput) {
194 return cachedGetOutput;
195 }
196
197 const outFiles = new Map<string, SourceOutput>();
198 const config = readConfig(configFileName);
199
200 /**
201 * Create the basic function for transpile only (ts-node --transpileOnly)
202 */
203 const getOutputTranspile: GetOutputFunction = (
204 code: string,
205 fileName: string
206 ) => {
207 const outFile = outFiles.get(fileName);
208 if (outFile) {
209 return outFile;
210 }
211 const result = ts.transpileModule(code, {
212 fileName,
213 transformers,
214 compilerOptions: config.options,
215 reportDiagnostics: true,
216 });
217
218 const diagnosticList = result.diagnostics
219 ? filterDiagnostics(result.diagnostics, ignoreDiagnostics)
220 : [];
221
222 reportTSError(diagnosticList, config.options.noEmitOnError);
223
224 const file = {
225 code: result.outputText,
226 map: result.sourceMapText as string,
227 };
228 outFiles.set(fileName, file);
229 return file;
230 };
231
232 const memoryCache = new MemoryCache(config.fileNames);
233 const cachedReadFile = cachedLookup(readFile);
234
235 // Create the compiler host for type checking.
236 const serviceHost: _ts.LanguageServiceHost = {
237 getScriptFileNames: () => Array.from(memoryCache.fileVersions.keys()),
238 getScriptVersion: (fileName: string) => {
239 const version = memoryCache.fileVersions.get(fileName);
240 return version === undefined ? '' : version.toString();
241 },
242 getScriptSnapshot(fileName: string) {
243 let contents = memoryCache.fileContents.get(fileName);
244

Callers 1

compileFunction · 0.85

Calls 6

cachedLookupFunction · 0.85
readConfigFunction · 0.70
getMethod · 0.65
keysMethod · 0.45
toStringMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected