@@ -64,6 +64,7 @@ type Options = {
6464 retainAllFiles : boolean ;
6565 rootDir : string ;
6666 roots : Array < string > ;
67+ skipPackageJson ?: boolean ;
6768 throwOnModuleCollision ?: boolean ;
6869 useWatchman ?: boolean ;
6970 watch ?: boolean ;
@@ -87,6 +88,7 @@ type InternalOptions = {
8788 retainAllFiles : boolean ;
8889 rootDir : string ;
8990 roots : Array < string > ;
91+ skipPackageJson : boolean ;
9092 throwOnModuleCollision : boolean ;
9193 useWatchman : boolean ;
9294 watch : boolean ;
@@ -108,6 +110,7 @@ namespace HasteMap {
108110const CHANGE_INTERVAL = 30 ;
109111const MAX_WAIT_TIME = 240000 ;
110112const NODE_MODULES = path . sep + 'node_modules' + path . sep ;
113+ const PACKAGE_JSON = path . sep + 'package.json' ;
111114
112115// TypeScript doesn't like us importing from outside `rootDir`, but it doesn't
113116// understand `require`.
@@ -256,6 +259,7 @@ class HasteMap extends EventEmitter {
256259 retainAllFiles : options . retainAllFiles ,
257260 rootDir : options . rootDir ,
258261 roots : Array . from ( new Set ( options . roots ) ) ,
262+ skipPackageJson : ! ! options . skipPackageJson ,
259263 throwOnModuleCollision : ! ! options . throwOnModuleCollision ,
260264 useWatchman : options . useWatchman == null ? true : options . useWatchman ,
261265 watch : ! ! options . watch ,
@@ -623,6 +627,12 @@ class HasteMap extends EventEmitter {
623627 }
624628
625629 for ( const relativeFilePath of hasteMap . files . keys ( ) ) {
630+ if (
631+ this . _options . skipPackageJson &&
632+ relativeFilePath . endsWith ( PACKAGE_JSON )
633+ ) {
634+ continue ;
635+ }
626636 // SHA-1, if requested, should already be present thanks to the crawler.
627637 const filePath = fastPath . resolve (
628638 this . _options . rootDir ,
0 commit comments