diff --git a/lib/slim/checks/circular_dependencies.js b/lib/slim/checks/circular_dependencies.js deleted file mode 100644 index 414d3b29..00000000 --- a/lib/slim/checks/circular_dependencies.js +++ /dev/null @@ -1,40 +0,0 @@ -var some = require("lodash/some"); -var values = require("lodash/values"); -var includes = require("lodash/includes"); - -/** - * Checks whether there are circular dependencies in the graph - * @param {Object} steal - The dependency graph object - * @throws if circular dependencies are found - */ -module.exports = function(graph) { - var nodes = values(graph); - - if (some(nodes, hasCircularDependencies)) { - throw new Error( - `Cannot create slim build. Circular dependencies are not supported` - ); - } -}; - -/** - * Whether the node has a circular dependency - * @param {Object} - A node from the dependency graph - * @param {number} - The index of the node in the (array) graph - * @param {Array.[Object]} - A list of nodes - * @return `true` if a circular dependency is found - */ -function hasCircularDependencies(node, index, nodes) { - for (var i = index + 1; i < nodes.length; i += 1) { - var nextNode = nodes[i]; - - if ( - includes(node.dependencies, nextNode.load.name) && - includes(nextNode.dependencies, node.load.name) - ) { - return true; - } - } - - return false; -} diff --git a/lib/stream/check_slim_support.js b/lib/stream/check_slim_support.js index 376d091a..833c40b2 100644 --- a/lib/stream/check_slim_support.js +++ b/lib/stream/check_slim_support.js @@ -4,7 +4,6 @@ var through = require("through2"); var checkStealAndLoader = require("../slim/checks/steal_and_loader"); var checkStealConditional = require("../slim/checks/steal_conditional"); var checkProductionEnvConfig = require("../slim/checks/production_env_config"); -var checkCircularDependencies = require("../slim/checks/circular_dependencies"); module.exports = function() { return through.obj(function(data, enc, done) { @@ -22,7 +21,6 @@ function checkSupport(data) { checkStealAndLoader(configMain, data.graph); checkStealConditional(data.graph[configMain]); checkProductionEnvConfig(data.steal); - checkCircularDependencies(data.graph); return data; } diff --git a/package.json b/package.json index a1f5b96f..17e10ead 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "through2": "^2.0.0", "tmp": "0.0.31", "traceur": "0.0.111", - "transpile": "2.4.0-pre.0", + "transpile": "^2.4.0-pre.1", "uglify-js": "~2.8.22", "urix": "^0.1.0", "winston": "^2.2.0", diff --git a/test/circular/slim.html b/test/circular/slim.html new file mode 100644 index 00000000..8fd79007 --- /dev/null +++ b/test/circular/slim.html @@ -0,0 +1,10 @@ + + +
+ +