| 
									
										
										
										
											2019-08-13 04:59:09 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 	MIT License http://www.opensource.org/licenses/mit-license.php
 | 
					
						
							|  |  |  | 	Author Tobias Koppers @sokra | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | "use strict"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** @typedef {import("../Compiler")} Compiler */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class AddManagedPathsPlugin { | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2021-10-18 22:07:41 +08:00
										 |  |  | 	 * @param {Iterable<string | RegExp>} managedPaths list of managed paths | 
					
						
							|  |  |  | 	 * @param {Iterable<string | RegExp>} immutablePaths list of immutable paths | 
					
						
							| 
									
										
										
										
											2023-10-05 05:28:11 +08:00
										 |  |  | 	 * @param {Iterable<string | RegExp>} unmanagedPaths list of unmanaged paths | 
					
						
							| 
									
										
										
										
											2019-08-13 04:59:09 +08:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2023-10-05 05:28:11 +08:00
										 |  |  | 	constructor(managedPaths, immutablePaths, unmanagedPaths) { | 
					
						
							| 
									
										
										
										
											2019-08-13 04:59:09 +08:00
										 |  |  | 		this.managedPaths = new Set(managedPaths); | 
					
						
							| 
									
										
										
										
											2019-08-16 17:55:10 +08:00
										 |  |  | 		this.immutablePaths = new Set(immutablePaths); | 
					
						
							| 
									
										
										
										
											2023-10-05 05:28:11 +08:00
										 |  |  | 		this.unmanagedPaths = new Set(unmanagedPaths); | 
					
						
							| 
									
										
										
										
											2019-08-13 04:59:09 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2020-04-23 16:48:36 +08:00
										 |  |  | 	 * Apply the plugin | 
					
						
							|  |  |  | 	 * @param {Compiler} compiler the compiler instance | 
					
						
							| 
									
										
										
										
											2019-08-13 04:59:09 +08:00
										 |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	apply(compiler) { | 
					
						
							|  |  |  | 		for (const managedPath of this.managedPaths) { | 
					
						
							|  |  |  | 			compiler.managedPaths.add(managedPath); | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-08-16 17:55:10 +08:00
										 |  |  | 		for (const immutablePath of this.immutablePaths) { | 
					
						
							|  |  |  | 			compiler.immutablePaths.add(immutablePath); | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2023-10-05 05:28:11 +08:00
										 |  |  | 		for (const unmanagedPath of this.unmanagedPaths) { | 
					
						
							|  |  |  | 			compiler.unmanagedPaths.add(unmanagedPath); | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-08-13 04:59:09 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module.exports = AddManagedPathsPlugin; |