Skip to content
This repository was archived by the owner on Dec 4, 2022. It is now read-only.

Commit 2a4d73e

Browse files
author
David First
authored
fix "Maximum call stack" error when resolving js files after css file… (#89)
* fix "Maximum call stack" error when resolving js files after css files. see teambit/bit#1431 for more info * bump version
1 parent 84ea29a commit 2a4d73e

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [unreleased]
99

10+
## [2.0.2] - 2019-02-08
11+
12+
- fix "Maximum call stack" error when resolving js files after css files
13+
1014
## [2.0.1] - 2019-02-04
1115

1216
- fix parsing `.tsx` files

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bit-javascript",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"scripts": {
55
"flow": "flow; test $? -eq 0 -o $? -eq 2",
66
"lint": "eslint src && flow check || true",

src/dependency-builder/dependency-tree/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ module.exports._getDependencies = function (config) {
6666
let dependenciesRaw; // from some detectives it comes as an array, from some it is an object
6767
const precinctOptions = config.detectiveConfig;
6868
precinctOptions.includeCore = false;
69+
delete precinct.ast;
6970

7071
try {
7172
dependenciesRaw = precinct.paperwork(config.filename, precinctOptions);

src/dependency-builder/dependency-tree/index.spec.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,4 +835,29 @@ describe('dependencyTree', function () {
835835
expect(nonExistent[bazFile]).to.deep.equal(['non-exist-baz-pkg']);
836836
});
837837
});
838+
describe('passing css files and then javascript files', () => {
839+
beforeEach(() => {
840+
mockfs({
841+
[`${__dirname}/baz`]: {
842+
'base.scss': 'li {} a {}', // don't change the content. it crash only with this for some reason
843+
'index.jsx': "require('some-module');"
844+
}
845+
});
846+
});
847+
it('should not crash with "RangeError: Maximum call stack size exceeded" error', () => {
848+
const directory = path.normalize(`${__dirname}/baz`);
849+
const baseFile = path.normalize(`${directory}/base.scss`);
850+
const indexFile = path.normalize(`${directory}/index.jsx`);
851+
const config = {
852+
directory
853+
};
854+
855+
config.filename = baseFile;
856+
dependencyTree(config);
857+
858+
config.filename = indexFile;
859+
const dependencies = dependencyTree(config);
860+
expect(dependencies).to.be.ok;
861+
});
862+
});
838863
});

0 commit comments

Comments
 (0)