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.

76 lines (68 loc) 3.17 kB
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/utilities/task-graph.ts var _createtaskgraph = require('nx/src/tasks-runner/create-task-graph'); function getAllWorkspaceTaskGraphs(nxJson, projectGraph) { const defaultDependencyConfigs = _createtaskgraph.mapTargetDefaultsToDependencies.call(void 0, nxJson.targetDefaults ); const taskGraphs = {}; const taskGraphErrors = {}; for (const projectName in projectGraph.nodes) { const project = projectGraph.nodes[projectName]; const targets = Object.keys(_nullishCoalesce(_optionalChain([project, 'optionalAccess', _ => _.data, 'access', _2 => _2.targets]), () => ( {}))); for (const target of targets) { const taskId = createTaskId(projectName, target); try { taskGraphs[taskId] = _createtaskgraph.createTaskGraph.call(void 0, projectGraph, defaultDependencyConfigs, [projectName], [target], void 0, {} ); } catch (err) { taskGraphs[taskId] = { tasks: {}, dependencies: {}, continuousDependencies: {}, roots: [] }; taskGraphErrors[taskId] = err.message; } const configurations = Object.keys( _optionalChain([project, 'optionalAccess', _3 => _3.data, 'optionalAccess', _4 => _4.targets, 'optionalAccess', _5 => _5[target], 'optionalAccess', _6 => _6.configurations]) || {} ); if (configurations.length > 0) { for (const configuration of configurations) { const taskId2 = createTaskId(projectName, target, configuration); try { taskGraphs[taskId2] = _createtaskgraph.createTaskGraph.call(void 0, projectGraph, defaultDependencyConfigs, [projectName], [target], configuration, {} ); } catch (err) { taskGraphs[taskId2] = { tasks: {}, dependencies: {}, continuousDependencies: {}, roots: [] }; taskGraphErrors[taskId2] = err.message; } } } } } return { taskGraphs, errors: taskGraphErrors }; } function createTaskId(projectId, targetId, configurationId) { if (configurationId) { return `${projectId}:${targetId}:${configurationId}`; } return `${projectId}:${targetId}`; } exports.getAllWorkspaceTaskGraphs = getAllWorkspaceTaskGraphs; exports.createTaskId = createTaskId;