This repository was archived by the owner on Dec 4, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +31
-1
lines changed
src/dependency-builder/dependency-tree Expand file tree Collapse file tree 4 files changed +31
-1
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 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" ,
Original file line number Diff line number Diff 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 ) ;
Original file line number Diff line number Diff 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} ) ;
You can’t perform that action at this time.
0 commit comments