Attempts to get the path to the file that called the function that called this function.
npm i gist:b82256d70c5d9bed769b94a8d72bb38a
Caller:
// /path/to/caller.ts
import { foo } from './path/to/callee.ts';
foo();
Callee:
// /path/to/callee.ts
import { getCallerPath } from 'get-caller-path';
export function foo() {
console.log(getCallerPath()); // /path/to/caller.ts
}