(dependencies, dispatchError, config)
| 669 | } |
| 670 | |
| 671 | export function computeGraphs(dependencies, dispatchError, config) { |
| 672 | // multiGraph is just for finding circular deps |
| 673 | const multiGraph = new DepGraph(); |
| 674 | const start = performance.now(); |
| 675 | |
| 676 | const wildcardPlaceholders = {}; |
| 677 | |
| 678 | const fixIds = map(evolve({id: parseIfWildcard})); |
| 679 | const parsedDependencies = map(dep => { |
| 680 | const {output, no_output} = dep; |
| 681 | const out = evolve({inputs: fixIds, state: fixIds}, dep); |
| 682 | if (no_output) { |
| 683 | // No output case |
| 684 | out.outputs = []; |
| 685 | out.noOutput = true; |
| 686 | } else { |
| 687 | out.outputs = map( |
| 688 | outi => assoc('out', true, splitIdAndProp(outi)), |
| 689 | isMultiOutputProp(output) |
| 690 | ? parseMultipleOutputs(output) |
| 691 | : [output] |
| 692 | ); |
| 693 | } |
| 694 | |
| 695 | return out; |
| 696 | }, dependencies); |
| 697 | |
| 698 | let hasError = false; |
| 699 | const wrappedDE = (message, lines) => { |
| 700 | hasError = true; |
| 701 | dispatchError(message, lines); |
| 702 | }; |
| 703 | if (config.validate_callbacks) { |
| 704 | validateDependencies(parsedDependencies, wrappedDE); |
| 705 | } |
| 706 | |
| 707 | /* |
| 708 | * For regular ids, outputMap and inputMap are: |
| 709 | * {[id]: {[prop]: [callback, ...]}} |
| 710 | * where callbacks are the matching specs from the original |
| 711 | * dependenciesRequest, but with outputs parsed to look like inputs, |
| 712 | * and a list matchKeys added if the outputs have MATCH wildcards. |
| 713 | * For outputMap there should only ever be one callback per id/prop |
| 714 | * but for inputMap there may be many. |
| 715 | * |
| 716 | * For wildcard ids, outputPatterns and inputPatterns are: |
| 717 | * { |
| 718 | * [keystr]: { |
| 719 | * [prop]: [ |
| 720 | * {keys: [...], values: [...], callbacks: [callback, ...]}, |
| 721 | * {...} |
| 722 | * ] |
| 723 | * } |
| 724 | * } |
| 725 | * keystr is a stringified ordered list of keys in the id |
| 726 | * keys is the same ordered list (just copied for convenience) |
| 727 | * values is an array of explicit or wildcard values for each key in keys |
| 728 | */ |
no test coverage detected
searching dependent graphs…