Skip to content

Commit

Permalink
Merge pull request #778 from stealjs/circular
Browse files Browse the repository at this point in the history
Support circular dependencies (slim loader)
  • Loading branch information
Manuel Mujica committed Jul 6, 2017
2 parents 986db2c + 7c8f782 commit 70494c5
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 53 deletions.
40 changes: 0 additions & 40 deletions lib/slim/checks/circular_dependencies.js

This file was deleted.

2 changes: 0 additions & 2 deletions lib/stream/check_slim_support.js
Expand Up @@ -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) {
Expand All @@ -22,7 +21,6 @@ function checkSupport(data) {
checkStealAndLoader(configMain, data.graph);
checkStealConditional(data.graph[configMain]);
checkProductionEnvConfig(data.steal);
checkCircularDependencies(data.graph);

return data;
}
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -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",
Expand Down
10 changes: 10 additions & 0 deletions test/circular/slim.html
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script src="./dist/bundles/circular/main.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion test/slim/progressive/baz-size.snap
@@ -1 +1 @@
module.exports = 159;
module.exports = 158;
29 changes: 20 additions & 9 deletions test/slim_build_test.js
Expand Up @@ -342,20 +342,23 @@ describe("slim builds", function() {
});
});

it("errors out with circular dependencies", function(done) {
it("*supports circular dependencies", function() {
var base = path.join(__dirname, "circular");
var config = { config: path.join(base, "package.json!npm") };

rmdir(path.join(base, "dist"))
return rmdir(path.join(base, "dist"))
.then(function() {
return optimize(config, { minify: false, quiet: true });
})
.then(function() {
done(new Error("should not build the app"));
return open(path.join("test", "circular", "slim.html"));
})
.catch(function(err) {
assert(/Cannot create slim build/.test(err.message));
done();
.then(function(args) {
return Promise.all([args.close, find(args.browser, "circularWorks")]);
})
.then(function(data) {
assert.ok(data[1], "circularWork should be true");
data[0](); // close();
});
});

Expand Down Expand Up @@ -386,8 +389,14 @@ describe("slim builds", function() {
})
.then(function() {
return Promise.all([
checkSizeSnapshot(path.join(base, "dist", "bundles", "main.js"), base),
checkSizeSnapshot(path.join(base, "dist", "bundles", "baz.js"), base)
checkSizeSnapshot(
path.join(base, "dist", "bundles", "main.js"),
base
),
checkSizeSnapshot(
path.join(base, "dist", "bundles", "baz.js"),
base
)
]);
});
});
Expand Down Expand Up @@ -421,7 +430,9 @@ describe("slim builds", function() {
return optimize(config, { minify: false, quiet: true });
})
.then(function() {
return open(path.join("test", "slim", "esm_named_imports", "index.html"));
return open(
path.join("test", "slim", "esm_named_imports", "index.html")
);
})
.then(function(args) {
return Promise.all([args.close, find(args.browser, "result")]);
Expand Down

0 comments on commit 70494c5

Please sign in to comment.