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

Function createBuildOrder

test/fixtures/snapshot/typescript.js:124277–124316  ·  view source on GitHub ↗
(state, roots)

Source from the content-addressed store, hash-verified

124275 return ts.resolveConfigFileProjectName(ts.resolvePath(state.currentDirectory, name));
124276 }
124277 function createBuildOrder(state, roots) {
124278 var temporaryMarks = new ts.Map();
124279 var permanentMarks = new ts.Map();
124280 var circularityReportStack = [];
124281 var buildOrder;
124282 var circularDiagnostics;
124283 for (var _i = 0, roots_1 = roots; _i < roots_1.length; _i++) {
124284 var root = roots_1[_i];
124285 visit(root);
124286 }
124287 return circularDiagnostics ?
124288 { buildOrder: buildOrder || ts.emptyArray, circularDiagnostics: circularDiagnostics } :
124289 buildOrder || ts.emptyArray;
124290 function visit(configFileName, inCircularContext) {
124291 var projPath = toResolvedConfigFilePath(state, configFileName);
124292 // Already visited
124293 if (permanentMarks.has(projPath))
124294 return;
124295 // Circular
124296 if (temporaryMarks.has(projPath)) {
124297 if (!inCircularContext) {
124298 (circularDiagnostics || (circularDiagnostics = [])).push(ts.createCompilerDiagnostic(ts.Diagnostics.Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0, circularityReportStack.join("\r\n")));
124299 }
124300 return;
124301 }
124302 temporaryMarks.set(projPath, true);
124303 circularityReportStack.push(configFileName);
124304 var parsed = parseConfigFile(state, configFileName, projPath);
124305 if (parsed && parsed.projectReferences) {
124306 for (var _i = 0, _a = parsed.projectReferences; _i < _a.length; _i++) {
124307 var ref = _a[_i];
124308 var resolvedRefPath = resolveProjectName(state, ref.path);
124309 visit(resolvedRefPath, inCircularContext || ref.circular);
124310 }
124311 }
124312 circularityReportStack.pop();
124313 permanentMarks.set(projPath, true);
124314 (buildOrder || (buildOrder = [])).push(configFileName);
124315 }
124316 }
124317 function getBuildOrder(state) {
124318 return state.buildOrder || createStateBuildOrder(state);
124319 }

Callers 2

createStateBuildOrderFunction · 0.85
getBuildOrderForFunction · 0.85

Calls 1

visitFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…