MCPcopy
hub / github.com/rollup/rollup / resolve

Function resolve

browser/src/path.ts:87–103  ·  view source on GitHub ↗
(...paths: string[])

Source from the content-addressed store, hash-verified

85}
86
87export function resolve(...paths: string[]): string {
88 let parts: string[] = [];
89 let isAbsoluteResult = false;
90 for (const path of paths) {
91 if (isAbsolute(path)) {
92 parts = path.split(ANY_SLASH_REGEX);
93 isAbsoluteResult = true;
94 } else {
95 parts.push(...path.split(ANY_SLASH_REGEX));
96 }
97 }
98 const normalized = normalizePathSegments(parts, isAbsoluteResult);
99 if (!isAbsoluteResult) return normalized || '/';
100 // Windows absolute paths (e.g. "C:/path") must not get a leading "/" prepended.
101 // Unix absolute paths must start with "/".
102 return /^[A-Za-z]:/.test(normalized) ? normalized : '/' + normalized;
103}
104
105// Used for running the browser build locally in Vite
106export const win32 = {};

Callers 14

rollup.config.mjsFile · 0.90
rollup.config.mjsFile · 0.90
loadFunction · 0.90
relativeIdFunction · 0.90
getMatcherStringFunction · 0.90
getCollapsedSourcemapFunction · 0.90
resolveIdFunction · 0.90
transformChunkFunction · 0.90
getModuleContextFunction · 0.90
getPreserveModulesRootFunction · 0.90

Calls 4

normalizePathSegmentsFunction · 0.85
pushMethod · 0.80
isAbsoluteFunction · 0.70
testMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…