UNPKG

@storm-software/build-tools

Version:

A comprehensive set of tools for building and managing projects within a Storm workspace. Includes builders such as rollup, rolldown, tsup, and unbuild, along with various utilities.

70 lines (68 loc) 1.71 kB
// src/utilities/get-project-deps.ts function getExtraDependencies(projectName, graph) { const deps = /* @__PURE__ */ new Map(); recur(projectName); function recur(currProjectName) { 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()); } function getInternalDependencies(projectName, graph) { const allDeps = graph.dependencies[projectName] ?? []; return Array.from( allDeps.reduce( (acc, node) => { const found = graph.nodes[node.target]; if (found) acc.push(found); return acc; }, [] ) ); } function getExternalDependencies(projectName, graph) { const allDeps = graph.dependencies[projectName]; return Array.from( allDeps?.reduce( (acc, node) => { const found = graph.externalNodes?.[node.target]; if (found) acc.push(found); return acc; }, [] ) ?? [] ) ?? []; } export { getExtraDependencies, getInternalDependencies, getExternalDependencies };