MCPcopy
hub / github.com/webpack/webpack / getCallingFile

Function getCallingFile

test/BenchmarkTestCases.benchmark.mjs:478–489  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

476}
477
478function getCallingFile() {
479 const stack = getStackTrace();
480 let callingFile = /** @type {string} */ (stack[2].getFileName()); // [here, withCodSpeed, actual caller]
481 const gitDir = getGitDir(callingFile);
482 if (gitDir === undefined) {
483 throw new Error("Could not find a git repository");
484 }
485 if (callingFile.startsWith("file://")) {
486 callingFile = fileURLToPath(callingFile);
487 }
488 return path.relative(gitDir, callingFile);
489}
490
491/** @typedef {{ uri: string, fn: Fn, options: FnOptions | undefined }} TaskMeta */
492/** @typedef {Map<string, TaskMeta>} URIMap */

Callers 1

withCodSpeedFunction · 0.85

Calls 1

getStackTraceFunction · 0.85

Tested by

no test coverage detected