UNPKG

@nx/esbuild

Version:

The Nx Plugin for esbuild contains executors and generators that support building applications using esbuild

38 lines (37 loc) 1.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getExtraDependencies = getExtraDependencies; function getExtraDependencies(projectName, graph) { const deps = new Map(); const visited = new Set(); // Track visited projects recur(projectName); function recur(currProjectName) { if (visited.has(currProjectName)) return; // Check if project already visited visited.add(currProjectName); // Mark project as visited const allDeps = graph.dependencies[currProjectName]; const externalDeps = allDeps.reduce((acc, node) => { const found = graph.externalNodes[node.target]; if (found) acc.push(found); return acc; }, []); const internalDeps = allDeps.reduce((acc, node) => { const found = graph.nodes[node.target]; if (found) acc.push(found); return acc; }, []); for (const externalDep of externalDeps) { deps.set(externalDep.name, { name: externalDep.name, outputs: [], node: externalDep, }); } for (const internalDep of internalDeps) { recur(internalDep.name); } } return Array.from(deps.values()); }