Skip to content

Commit

Permalink
FIX: v1.1.17 Issue with cycle dependencies (#42)
Browse files Browse the repository at this point in the history
* Ignore vscode files

* Fix tests

* Update dependencies and audit fix

* FIX: Issue with cycle dependencies

Using built-in circular dependencies support, rather than overriding methods, fixes issues with some output path strings resolving to root directory

* Update DependencyGraph.test.js

* Update index-tests.js

* Update utils.js

Co-authored-by: Vladimir Mikulic <35997844+VladimirMikulic@users.noreply.github.com>
  • Loading branch information
jamiegluk and VladimirMikulic committed Mar 20, 2021
1 parent 0e6b08d commit 5ac1ddd
Show file tree
Hide file tree
Showing 6 changed files with 2,059 additions and 1,249 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ dist*
.cache
coverage
node_modules
.history
.vscode
13 changes: 1 addition & 12 deletions lib/DependencyGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { isProjectJSCodeFile } = require('./Utils');

class DependencyGraph extends DepGraph {
constructor(bundle) {
super();
super({ circular: true });
this.bundle = bundle;

this.buildDependencyGraph();
Expand Down Expand Up @@ -95,17 +95,6 @@ class DependencyGraph extends DepGraph {
}
}

// @override
// original dependantsOf() would throw an error if we had a dependency cycle
// Classic example would be 2 html files linking to each other and using the same stylesheet/js
dependantsOf(file) {
return this.incomingEdges[file];
}

dependenciesOf(file) {
return this.outgoingEdges[file];
}

getFilesByType(fileType) {
return Object.values(this.nodes).reduce((files, filePath) => {
if (filePath.endsWith(`${fileType}`)) {
Expand Down
Loading

0 comments on commit 5ac1ddd

Please sign in to comment.