@@ -66,16 +66,46 @@ process.on('unhandledRejection', handleUncaughtException);
66
66
program . storeOptionsAsProperties ( ) ;
67
67
program . version ( version ) ;
68
68
69
+ // Only display choices available to callers OS
70
+ let watcherBackendChoices = [ 'brute-force' ] ;
71
+ switch ( process . platform ) {
72
+ case 'darwin' : {
73
+ watcherBackendChoices . push ( 'watchman' , 'fs-events' ) ;
74
+ break ;
75
+ }
76
+ case 'linux' : {
77
+ watcherBackendChoices . push ( 'watchman' , 'inotify' ) ;
78
+ break ;
79
+ }
80
+ case 'win32' : {
81
+ watcherBackendChoices . push ( 'watchman' , 'windows' ) ;
82
+ break ;
83
+ }
84
+ case 'freebsd' || 'openbsd' : {
85
+ watcherBackendChoices . push ( 'watchman' ) ;
86
+ break ;
87
+ }
88
+ default :
89
+ break ;
90
+ }
91
+
69
92
// --no-cache, --cache-dir, --no-source-maps, --no-autoinstall, --global?, --public-url, --log-level
70
93
// --no-content-hash, --experimental-scope-hoisting, --detailed-report
71
-
72
94
const commonOptions = {
73
95
'--no-cache' : 'disable the filesystem cache' ,
74
96
'--config <path>' :
75
97
'specify which config to use. can be a path or a package name' ,
76
98
'--cache-dir <path>' : 'set the cache directory. defaults to ".parcel-cache"' ,
77
99
'--watch-dir <path>' :
78
100
'set the root watch directory. defaults to nearest lockfile or source control dir.' ,
101
+ '--watch-ignore [path]' : [
102
+ `list of directories watcher should not be tracking for changes. defaults to ['.git', '.hg']` ,
103
+ dirs => dirs . split ( ',' ) ,
104
+ ] ,
105
+ '--watch-backend' : new commander . Option (
106
+ '--watch-backend <name>' ,
107
+ 'set watcher backend' ,
108
+ ) . choices ( watcherBackendChoices ) ,
79
109
'--no-source-maps' : 'disable sourcemaps' ,
80
110
'--target [name]' : [
81
111
'only build given target(s)' ,
@@ -497,10 +527,13 @@ async function normalizeOptions(
497
527
if ( typeof input !== 'string' ) return [ ] ;
498
528
return input . split ( ',' ) . map ( value => value . trim ( ) ) ;
499
529
} ;
530
+
500
531
return {
501
532
shouldDisableCache : command . cache === false ,
502
533
cacheDir : command . cacheDir ,
503
534
watchDir : command . watchDir ,
535
+ watchBackend : command . watchBackend ,
536
+ watchIgnore : command . watchIgnore ,
504
537
config : command . config ,
505
538
mode,
506
539
hmrOptions,
0 commit comments