(cwd, getCanonicalFileName)
| 20402 | } |
| 20403 | ts.hasZeroOrOneAsteriskCharacter = hasZeroOrOneAsteriskCharacter; |
| 20404 | function createSymlinkCache(cwd, getCanonicalFileName) { |
| 20405 | var symlinkedDirectories; |
| 20406 | var symlinkedDirectoriesByRealpath; |
| 20407 | var symlinkedFiles; |
| 20408 | var hasProcessedResolutions = false; |
| 20409 | return { |
| 20410 | getSymlinkedFiles: function () { return symlinkedFiles; }, |
| 20411 | getSymlinkedDirectories: function () { return symlinkedDirectories; }, |
| 20412 | getSymlinkedDirectoriesByRealpath: function () { return symlinkedDirectoriesByRealpath; }, |
| 20413 | setSymlinkedFile: function (path, real) { return (symlinkedFiles || (symlinkedFiles = new ts.Map())).set(path, real); }, |
| 20414 | setSymlinkedDirectory: function (symlink, real) { |
| 20415 | // Large, interconnected dependency graphs in pnpm will have a huge number of symlinks |
| 20416 | // where both the realpath and the symlink path are inside node_modules/.pnpm. Since |
| 20417 | // this path is never a candidate for a module specifier, we can ignore it entirely. |
| 20418 | var symlinkPath = ts.toPath(symlink, cwd, getCanonicalFileName); |
| 20419 | if (!containsIgnoredPath(symlinkPath)) { |
| 20420 | symlinkPath = ts.ensureTrailingDirectorySeparator(symlinkPath); |
| 20421 | if (real !== false && !(symlinkedDirectories === null || symlinkedDirectories === void 0 ? void 0 : symlinkedDirectories.has(symlinkPath))) { |
| 20422 | (symlinkedDirectoriesByRealpath || (symlinkedDirectoriesByRealpath = ts.createMultiMap())).add(ts.ensureTrailingDirectorySeparator(real.realPath), symlink); |
| 20423 | } |
| 20424 | (symlinkedDirectories || (symlinkedDirectories = new ts.Map())).set(symlinkPath, real); |
| 20425 | } |
| 20426 | }, |
| 20427 | setSymlinksFromResolutions: function (files, typeReferenceDirectives) { |
| 20428 | var _this = this; |
| 20429 | var _a; |
| 20430 | ts.Debug.assert(!hasProcessedResolutions); |
| 20431 | hasProcessedResolutions = true; |
| 20432 | for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { |
| 20433 | var file = files_1[_i]; |
| 20434 | (_a = file.resolvedModules) === null || _a === void 0 ? void 0 : _a.forEach(function (resolution) { return processResolution(_this, resolution); }); |
| 20435 | } |
| 20436 | typeReferenceDirectives === null || typeReferenceDirectives === void 0 ? void 0 : typeReferenceDirectives.forEach(function (resolution) { return processResolution(_this, resolution); }); |
| 20437 | }, |
| 20438 | hasProcessedResolutions: function () { return hasProcessedResolutions; }, |
| 20439 | }; |
| 20440 | function processResolution(cache, resolution) { |
| 20441 | if (!resolution || !resolution.originalPath || !resolution.resolvedFileName) |
| 20442 | return; |
| 20443 | var resolvedFileName = resolution.resolvedFileName, originalPath = resolution.originalPath; |
| 20444 | cache.setSymlinkedFile(ts.toPath(originalPath, cwd, getCanonicalFileName), resolvedFileName); |
| 20445 | var _a = guessDirectorySymlink(resolvedFileName, originalPath, cwd, getCanonicalFileName) || ts.emptyArray, commonResolved = _a[0], commonOriginal = _a[1]; |
| 20446 | if (commonResolved && commonOriginal) { |
| 20447 | cache.setSymlinkedDirectory(commonOriginal, { real: commonResolved, realPath: ts.toPath(commonResolved, cwd, getCanonicalFileName) }); |
| 20448 | } |
| 20449 | } |
| 20450 | } |
| 20451 | ts.createSymlinkCache = createSymlinkCache; |
| 20452 | function guessDirectorySymlink(a, b, cwd, getCanonicalFileName) { |
| 20453 | var aParts = ts.getPathComponents(ts.getNormalizedAbsolutePath(a, cwd)); |
nothing calls this directly
no test coverage detected