MCPcopy Index your code
hub / github.com/nodejs/node / createNewProgram

Function createNewProgram

test/fixtures/snapshot/typescript.js:123539–123579  ·  view source on GitHub ↗
(hasInvalidatedResolution)

Source from the content-addressed store, hash-verified

123537 return builderProgram;
123538 }
123539 function createNewProgram(hasInvalidatedResolution) {
123540 // Compile the program
123541 writeLog("CreatingProgramWith::");
123542 writeLog(" roots: ".concat(JSON.stringify(rootFileNames)));
123543 writeLog(" options: ".concat(JSON.stringify(compilerOptions)));
123544 if (projectReferences)
123545 writeLog(" projectReferences: ".concat(JSON.stringify(projectReferences)));
123546 var needsUpdateInTypeRootWatch = hasChangedCompilerOptions || !getCurrentProgram();
123547 hasChangedCompilerOptions = false;
123548 hasChangedConfigFileParsingErrors = false;
123549 resolutionCache.startCachingPerDirectoryResolution();
123550 compilerHost.hasInvalidatedResolution = hasInvalidatedResolution;
123551 compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
123552 builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
123553 // map package json cache entries to their realpaths so we don't try to watch across symlinks
123554 var packageCacheEntries = ts.map(resolutionCache.getModuleResolutionCache().getPackageJsonInfoCache().entries(), function (_a) {
123555 var path = _a[0], data = _a[1];
123556 return [compilerHost.realpath ? toPath(compilerHost.realpath(path)) : path, data];
123557 });
123558 resolutionCache.finishCachingPerDirectoryResolution();
123559 // Update watches
123560 ts.updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = new ts.Map()), watchMissingFilePath);
123561 ts.updatePackageJsonWatch(packageCacheEntries, packageJsonMap || (packageJsonMap = new ts.Map()), watchPackageJsonLookupPath);
123562 if (needsUpdateInTypeRootWatch) {
123563 resolutionCache.updateTypeRootsWatch();
123564 }
123565 if (missingFilePathsRequestedForRelease) {
123566 // These are the paths that program creater told us as not in use any more but were missing on the disk.
123567 // We didnt remove the entry for them from sourceFiles cache so that we dont have to do File IO,
123568 // if there is already watcher for it (for missing files)
123569 // At this point our watches were updated, hence now we know that these paths are not tracked and need to be removed
123570 // so that at later time we have correct result of their presence
123571 for (var _i = 0, missingFilePathsRequestedForRelease_1 = missingFilePathsRequestedForRelease; _i < missingFilePathsRequestedForRelease_1.length; _i++) {
123572 var missingFilePath = missingFilePathsRequestedForRelease_1[_i];
123573 if (!missingFilesMap.has(missingFilePath)) {
123574 sourceFilesCache.delete(missingFilePath);
123575 }
123576 }
123577 missingFilePathsRequestedForRelease = undefined;
123578 }
123579 }
123580 function updateRootFileNames(files) {
123581 ts.Debug.assert(!configFileName, "Cannot update root file names with config file watch mode");
123582 rootFileNames = files;

Callers 1

synchronizeProgramFunction · 0.85

Calls 9

getCurrentProgramFunction · 0.85
createProgramFunction · 0.85
toPathFunction · 0.85
concatMethod · 0.80
mapMethod · 0.65
hasMethod · 0.65
deleteMethod · 0.65
entriesMethod · 0.45
realpathMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…