mirror of https://github.com/webpack/webpack.git
				
				
				
			fix lost file timestamps due to snapshot deduplication
fix missing startTime in deduped snapshots
This commit is contained in:
		
							parent
							
								
									255ae13f59
								
							
						
					
					
						commit
						beb58fd23d
					
				|  | @ -835,6 +835,13 @@ class FileSystemInfo { | |||
| 					if (optimizationEntry.shared > 0) { | ||||
| 						// It's a shared snapshot
 | ||||
| 						// We can't change it, so we can only use it when all files match
 | ||||
| 						// and startTime is compatible
 | ||||
| 						if ( | ||||
| 							startTime && | ||||
| 							(!snapshot.startTime || snapshot.startTime > startTime) | ||||
| 						) { | ||||
| 							continue; | ||||
| 						} | ||||
| 						const nonSharedFiles = new Set(); | ||||
| 						for (const path of optimizationEntry.snapshotContent) { | ||||
| 							if (!capturedFiles.has(path)) { | ||||
|  | @ -864,7 +871,13 @@ class FileSystemInfo { | |||
| 							} | ||||
| 							// Create and attach snapshot
 | ||||
| 							/** @type {Snapshot} */ | ||||
| 							const commonSnapshot = { fileTimestamps: commonMap }; | ||||
| 							const commonSnapshot = { | ||||
| 								startTime: | ||||
| 									startTime && snapshot.startTime | ||||
| 										? Math.min(startTime, snapshot.startTime) | ||||
| 										: startTime || snapshot.startTime, | ||||
| 								fileTimestamps: commonMap | ||||
| 							}; | ||||
| 							children.add(commonSnapshot); | ||||
| 							if (!snapshot.children) snapshot.children = new Set(); | ||||
| 							snapshot.children.add(commonSnapshot); | ||||
|  | @ -889,7 +902,6 @@ class FileSystemInfo { | |||
| 							const ts = snapshot.fileTimestamps.get(path); | ||||
| 							if (ts === undefined) continue; | ||||
| 							commonMap.set(path, ts); | ||||
| 							snapshot.fileTimestamps.delete(path); | ||||
| 						} | ||||
| 						if (commonMap.size < 2) { | ||||
| 							// Common part it too small
 | ||||
|  | @ -897,7 +909,13 @@ class FileSystemInfo { | |||
| 						} | ||||
| 						// Create and attach snapshot
 | ||||
| 						/** @type {Snapshot} */ | ||||
| 						const commonSnapshot = { fileTimestamps: commonMap }; | ||||
| 						const commonSnapshot = { | ||||
| 							startTime: | ||||
| 								startTime && snapshot.startTime | ||||
| 									? Math.min(startTime, snapshot.startTime) | ||||
| 									: startTime || snapshot.startTime, | ||||
| 							fileTimestamps: commonMap | ||||
| 						}; | ||||
| 						children.add(commonSnapshot); | ||||
| 						if (!snapshot.children) snapshot.children = new Set(); | ||||
| 						snapshot.children.add(commonSnapshot); | ||||
|  | @ -1243,7 +1261,7 @@ class FileSystemInfo { | |||
| 			} | ||||
| 			if (current) { | ||||
| 				// For existing items only
 | ||||
| 				if (current.safeTime > startTime) { | ||||
| 				if (typeof startTime === "number" && current.safeTime > startTime) { | ||||
| 					// If a change happened after starting reading the item
 | ||||
| 					// this may no longer be valid
 | ||||
| 					if (this._remainingLogs > 0) { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue