refactor: remove pack

This commit is contained in:
Karl-Philipp Wulfert
2019-01-17 11:23:05 +01:00
parent 27b18bec89
commit ab19086400
6 changed files with 0 additions and 499 deletions

View File

@@ -18,10 +18,8 @@ import {Logger} from '@openstapps/logger';
import {asyncPool} from 'async-pool-native/dist/async-pool';
import {readFile, unlink, writeFile} from 'fs';
import * as glob from 'glob';
import {basename} from 'path';
import {promisify} from 'util';
import {PACK_IDENTIFIER} from './configuration';
import {JavaScriptModule} from './pack/types';
/**
* Instantiated logger
@@ -129,33 +127,3 @@ export function getAllInternalDependecies(moduleContent: string): string[] {
return [];
}
/**
* Sort modules by their dependencies
*
* @param modules Modules to sort
*/
export function topologicalSort(modules: JavaScriptModule[]): JavaScriptModule[] {
const topoSort = require('toposort');
// vertices are modules, an edge from a to b means that b depends on a
const edges: string[][] = [];
const nodes: string[] = [];
// add all edges
modules.forEach((module) => {
module.dependencies.forEach((dependenciePath) => {
// add edge from dependency to our module
edges.push([basename(dependenciePath), module.name]);
});
nodes.push(module.name);
});
// sort graph and return as an array of sorted modules
return topoSort.array(nodes, edges).map((moduleName: string) => {
return modules.find((module) => {
return module.name === moduleName;
});
});
}