@@ -206,17 +206,17 @@ class Snapshot {
206
206
this . _flags = 0 ;
207
207
/** @type {number | undefined } */
208
208
this . startTime = undefined ;
209
- /** @type {Map<string, FileSystemInfoEntry> | undefined } */
209
+ /** @type {Map<string, FileSystemInfoEntry | null > | undefined } */
210
210
this . fileTimestamps = undefined ;
211
- /** @type {Map<string, string> | undefined } */
211
+ /** @type {Map<string, string | null > | undefined } */
212
212
this . fileHashes = undefined ;
213
- /** @type {Map<string, TimestampAndHash | string> | undefined } */
213
+ /** @type {Map<string, TimestampAndHash | string | null > | undefined } */
214
214
this . fileTshs = undefined ;
215
- /** @type {Map<string, ResolvedContextFileSystemInfoEntry> | undefined } */
215
+ /** @type {Map<string, ResolvedContextFileSystemInfoEntry | null > | undefined } */
216
216
this . contextTimestamps = undefined ;
217
- /** @type {Map<string, string> | undefined } */
217
+ /** @type {Map<string, string | null > | undefined } */
218
218
this . contextHashes = undefined ;
219
- /** @type {Map<string, ResolvedContextTimestampAndHash> | undefined } */
219
+ /** @type {Map<string, ResolvedContextTimestampAndHash | null > | undefined } */
220
220
this . contextTshs = undefined ;
221
221
/** @type {Map<string, boolean> | undefined } */
222
222
this . missingExistence = undefined ;
@@ -823,11 +823,10 @@ const getManagedItem = (managedPath, path) => {
823
823
824
824
/**
825
825
* @template {ContextFileSystemInfoEntry | ContextTimestampAndHash} T
826
- * @param {T | "ignore" } entry entry
826
+ * @param {T } entry entry
827
827
* @returns {T["resolved"] | undefined } the resolved entry
828
828
*/
829
829
const getResolvedTimestamp = entry => {
830
- if ( entry === "ignore" ) return undefined ;
831
830
if ( entry === null ) return null ;
832
831
if ( entry . resolved !== undefined ) return entry . resolved ;
833
832
return entry . symlinks === undefined ? entry : undefined ;
@@ -1191,6 +1190,7 @@ class FileSystemInfo {
1191
1190
getContextTimestamp ( path , callback ) {
1192
1191
const cache = this . _contextTimestamps . get ( path ) ;
1193
1192
if ( cache !== undefined ) {
1193
+ if ( cache === "ignore" ) return callback ( null , "ignore" ) ;
1194
1194
const resolved = getResolvedTimestamp ( cache ) ;
1195
1195
if ( resolved !== undefined ) return callback ( null , resolved ) ;
1196
1196
return this . _resolveContextTimestamp ( cache , callback ) ;
@@ -1876,17 +1876,17 @@ class FileSystemInfo {
1876
1876
* @returns {void }
1877
1877
*/
1878
1878
createSnapshot ( startTime , files , directories , missing , options , callback ) {
1879
- /** @type {Map<string, FileSystemInfoEntry> } */
1879
+ /** @type {Map<string, FileSystemInfoEntry | null > } */
1880
1880
const fileTimestamps = new Map ( ) ;
1881
- /** @type {Map<string, string> } */
1881
+ /** @type {Map<string, string | null > } */
1882
1882
const fileHashes = new Map ( ) ;
1883
- /** @type {Map<string, TimestampAndHash | string> } */
1883
+ /** @type {Map<string, TimestampAndHash | string | null > } */
1884
1884
const fileTshs = new Map ( ) ;
1885
- /** @type {Map<string, FileSystemInfoEntry> } */
1885
+ /** @type {Map<string, FileSystemInfoEntry | null > } */
1886
1886
const contextTimestamps = new Map ( ) ;
1887
- /** @type {Map<string, string> } */
1887
+ /** @type {Map<string, string | null > } */
1888
1888
const contextHashes = new Map ( ) ;
1889
- /** @type {Map<string, TimestampAndHash | string > } */
1889
+ /** @type {Map<string, ResolvedContextTimestampAndHash | null > } */
1890
1890
const contextTshs = new Map ( ) ;
1891
1891
/** @type {Map<string, boolean> } */
1892
1892
const missingExistence = new Map ( ) ;
@@ -2080,6 +2080,7 @@ class FileSystemInfo {
2080
2080
this . _contextTshsOptimization . optimize ( snapshot , capturedDirectories ) ;
2081
2081
for ( const path of capturedDirectories ) {
2082
2082
const cache = this . _contextTshs . get ( path ) ;
2083
+ /** @type {ResolvedContextTimestampAndHash } */
2083
2084
let resolved ;
2084
2085
if (
2085
2086
cache !== undefined &&
@@ -2088,6 +2089,11 @@ class FileSystemInfo {
2088
2089
contextTshs . set ( path , resolved ) ;
2089
2090
} else {
2090
2091
jobs ++ ;
2092
+ /**
2093
+ * @param {Error= } err error
2094
+ * @param {ResolvedContextTimestampAndHash= } entry entry
2095
+ * @returns {void }
2096
+ */
2091
2097
const callback = ( err , entry ) => {
2092
2098
if ( err ) {
2093
2099
if ( this . logger ) {
@@ -2152,14 +2158,20 @@ class FileSystemInfo {
2152
2158
) ;
2153
2159
for ( const path of capturedDirectories ) {
2154
2160
const cache = this . _contextTimestamps . get ( path ) ;
2161
+ if ( cache === "ignore" ) continue ;
2155
2162
let resolved ;
2156
2163
if (
2157
2164
cache !== undefined &&
2158
2165
( resolved = getResolvedTimestamp ( cache ) ) !== undefined
2159
2166
) {
2160
2167
contextTimestamps . set ( path , resolved ) ;
2161
- } else if ( cache !== "ignore" ) {
2168
+ } else {
2162
2169
jobs ++ ;
2170
+ /**
2171
+ * @param {Error= } err error
2172
+ * @param {ResolvedContextFileSystemInfoEntry= } entry entry
2173
+ * @returns {void }
2174
+ */
2163
2175
const callback = ( err , entry ) => {
2164
2176
if ( err ) {
2165
2177
if ( this . logger ) {
@@ -2572,14 +2584,14 @@ class FileSystemInfo {
2572
2584
const cache = this . _fileTimestamps . get ( path ) ;
2573
2585
if ( cache !== undefined ) {
2574
2586
if ( cache === "ignore" || ! checkFile ( path , cache , tsh , false ) ) {
2575
- processFileHashSnapshot ( path , tsh . hash ) ;
2587
+ processFileHashSnapshot ( path , tsh && tsh . hash ) ;
2576
2588
}
2577
2589
} else {
2578
2590
jobs ++ ;
2579
2591
this . fileTimestampQueue . add ( path , ( err , entry ) => {
2580
2592
if ( err ) return invalidWithError ( path , err ) ;
2581
2593
if ( ! checkFile ( path , entry , tsh , false ) ) {
2582
- processFileHashSnapshot ( path , tsh . hash ) ;
2594
+ processFileHashSnapshot ( path , tsh && tsh . hash ) ;
2583
2595
}
2584
2596
jobDone ( ) ;
2585
2597
} ) ;
@@ -2592,6 +2604,7 @@ class FileSystemInfo {
2592
2604
this . _statTestedEntries += contextTimestamps . size ;
2593
2605
for ( const [ path , ts ] of contextTimestamps ) {
2594
2606
const cache = this . _contextTimestamps . get ( path ) ;
2607
+ if ( cache === "ignore" ) continue ;
2595
2608
let resolved ;
2596
2609
if (
2597
2610
cache !== undefined &&
@@ -2601,8 +2614,13 @@ class FileSystemInfo {
2601
2614
invalid ( ) ;
2602
2615
return ;
2603
2616
}
2604
- } else if ( cache !== "ignore" ) {
2617
+ } else {
2605
2618
jobs ++ ;
2619
+ /**
2620
+ * @param {Error= } err error
2621
+ * @param {ResolvedContextFileSystemInfoEntry= } entry entry
2622
+ * @returns {void }
2623
+ */
2606
2624
const callback = ( err , entry ) => {
2607
2625
if ( err ) return invalidWithError ( path , err ) ;
2608
2626
if ( ! checkContext ( path , entry , ts ) ) {
@@ -2662,27 +2680,33 @@ class FileSystemInfo {
2662
2680
processContextHashSnapshot ( path , tsh ) ;
2663
2681
} else {
2664
2682
const cache = this . _contextTimestamps . get ( path ) ;
2683
+ if ( cache === "ignore" ) continue ;
2665
2684
let resolved ;
2666
2685
if (
2667
2686
cache !== undefined &&
2668
2687
( resolved = getResolvedTimestamp ( cache ) ) !== undefined
2669
2688
) {
2670
2689
if ( ! checkContext ( path , resolved , tsh , false ) ) {
2671
- processContextHashSnapshot ( path , tsh . hash ) ;
2690
+ processContextHashSnapshot ( path , tsh && tsh . hash ) ;
2672
2691
}
2673
- } else if ( cache !== "ignore" ) {
2692
+ } else {
2674
2693
jobs ++ ;
2694
+ /**
2695
+ * @param {Error= } err error
2696
+ * @param {ResolvedContextFileSystemInfoEntry= } entry entry
2697
+ * @returns {void }
2698
+ */
2675
2699
const callback = ( err , entry ) => {
2676
2700
if ( err ) return invalidWithError ( path , err ) ;
2677
2701
if ( ! checkContext ( path , entry , tsh , false ) ) {
2678
- processContextHashSnapshot ( path , tsh . hash ) ;
2702
+ processContextHashSnapshot ( path , tsh && tsh . hash ) ;
2679
2703
}
2680
2704
jobDone ( ) ;
2681
2705
} ;
2682
2706
if ( cache !== undefined ) {
2683
- this . _resolveContextTsh ( cache , callback ) ;
2707
+ this . _resolveContextTimestamp ( cache , callback ) ;
2684
2708
} else {
2685
- this . getContextTsh ( path , callback ) ;
2709
+ this . getContextTimestamp ( path , callback ) ;
2686
2710
}
2687
2711
}
2688
2712
}
@@ -3032,6 +3056,11 @@ class FileSystemInfo {
3032
3056
) ;
3033
3057
}
3034
3058
3059
+ /**
3060
+ * @param {ContextFileSystemInfoEntry } entry entry
3061
+ * @param {function(Error=, ResolvedContextFileSystemInfoEntry=): void } callback callback
3062
+ * @returns {void }
3063
+ */
3035
3064
_resolveContextTimestamp ( entry , callback ) {
3036
3065
const hashes = [ ] ;
3037
3066
let safeTime = 0 ;
@@ -3135,6 +3164,11 @@ class FileSystemInfo {
3135
3164
) ;
3136
3165
}
3137
3166
3167
+ /**
3168
+ * @param {ContextHash } entry context hash
3169
+ * @param {function(Error=, string=): void } callback callback
3170
+ * @returns {void }
3171
+ */
3138
3172
_resolveContextHash ( entry , callback ) {
3139
3173
const hashes = [ ] ;
3140
3174
processAsyncTree (
@@ -3286,6 +3320,11 @@ class FileSystemInfo {
3286
3320
}
3287
3321
}
3288
3322
3323
+ /**
3324
+ * @param {ContextTimestampAndHash } entry entry
3325
+ * @param {function(Error=, ResolvedContextTimestampAndHash=): void } callback callback
3326
+ * @returns {void }
3327
+ */
3289
3328
_resolveContextTsh ( entry , callback ) {
3290
3329
const hashes = [ ] ;
3291
3330
const tsHashes = [ ] ;
0 commit comments