MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / resolve

Function resolve

packages/core/src/utils/path.ts:67–93  ·  view source on GitHub ↗
(...args: string[])

Source from the content-addressed store, hash-verified

65// posix version
66/** JSDoc */
67export function resolve(...args: string[]): string {
68 let resolvedPath = '';
69 let resolvedAbsolute = false;
70
71 for (let i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {
72 const path = i >= 0 ? args[i] : '/';
73
74 // Skip empty entries
75 if (!path) {
76 continue;
77 }
78
79 resolvedPath = `${path}/${resolvedPath}`;
80 resolvedAbsolute = path.charAt(0) === '/';
81 }
82
83 // At this point the path should be resolved to a full absolute path, but
84 // handle relative paths to be safe (might happen when process.cwd() fails)
85
86 // Normalize the path
87 resolvedPath = normalizeArray(
88 resolvedPath.split('/').filter(p => !!p),
89 !resolvedAbsolute,
90 ).join('/');
91
92 return (resolvedAbsolute ? '/' : '') + resolvedPath || '.';
93}
94
95/** JSDoc */
96function trim(arr: string[]): string[] {

Callers 15

vite.config.tsFile · 0.90
asyncExecFunction · 0.90
runFunction · 0.90
fixPackageJsonFunction · 0.90
fixFileLinkDependenciesFunction · 0.90
drainFunction · 0.70
resolvedSyncPromiseFunction · 0.70
thenMethod · 0.70
finallyMethod · 0.70
relativeFunction · 0.70
index.test.tsFile · 0.50

Calls 1

normalizeArrayFunction · 0.85

Tested by 15

deleteDatabaseFunction · 0.40
createTestTransportFunction · 0.40
handleEventFunction · 0.40
funcFunction · 0.40
handleCloudEventFunction · 0.40
funcFunction · 0.40
fpFunction · 0.40
fFunction · 0.40
createTestTransportFunction · 0.40
createTestTransportFunction · 0.40
fnFunction · 0.40
flushFunction · 0.40