| 
									
										
										
										
											2013-02-14 00:00:07 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 	MIT License http://www.opensource.org/licenses/mit-license.php
 | 
					
						
							|  |  |  | 	Author Tobias Koppers @sokra | 
					
						
							|  |  |  | */ | 
					
						
							| 
									
										
										
										
											2018-07-30 23:08:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-11 20:09:19 +08:00
										 |  |  | "use strict"; | 
					
						
							| 
									
										
										
										
											2013-02-14 00:00:07 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-11 20:09:19 +08:00
										 |  |  | const ExternalsPlugin = require("../ExternalsPlugin"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-09 05:59:19 +08:00
										 |  |  | /** @typedef {import("../Compiler")} Compiler */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-28 07:09:12 +08:00
										 |  |  | const builtins = [ | 
					
						
							|  |  |  | 	"assert", | 
					
						
							|  |  |  | 	"async_hooks", | 
					
						
							|  |  |  | 	"buffer", | 
					
						
							|  |  |  | 	"child_process", | 
					
						
							|  |  |  | 	"cluster", | 
					
						
							|  |  |  | 	"console", | 
					
						
							|  |  |  | 	"constants", | 
					
						
							|  |  |  | 	"crypto", | 
					
						
							|  |  |  | 	"dgram", | 
					
						
							|  |  |  | 	"dns", | 
					
						
							| 
									
										
										
										
											2020-12-15 02:17:39 +08:00
										 |  |  | 	"dns/promises", | 
					
						
							| 
									
										
										
										
											2020-08-28 07:09:12 +08:00
										 |  |  | 	"domain", | 
					
						
							|  |  |  | 	"events", | 
					
						
							|  |  |  | 	"fs", | 
					
						
							|  |  |  | 	"fs/promises", | 
					
						
							|  |  |  | 	"http", | 
					
						
							|  |  |  | 	"http2", | 
					
						
							|  |  |  | 	"https", | 
					
						
							|  |  |  | 	"inspector", | 
					
						
							|  |  |  | 	"module", | 
					
						
							|  |  |  | 	"net", | 
					
						
							|  |  |  | 	"os", | 
					
						
							|  |  |  | 	"path", | 
					
						
							|  |  |  | 	"perf_hooks", | 
					
						
							|  |  |  | 	"process", | 
					
						
							|  |  |  | 	"punycode", | 
					
						
							|  |  |  | 	"querystring", | 
					
						
							|  |  |  | 	"readline", | 
					
						
							|  |  |  | 	"repl", | 
					
						
							|  |  |  | 	"stream", | 
					
						
							| 
									
										
										
										
											2020-12-15 02:17:39 +08:00
										 |  |  | 	"stream/promises", | 
					
						
							| 
									
										
										
										
											2020-08-28 07:09:12 +08:00
										 |  |  | 	"string_decoder", | 
					
						
							|  |  |  | 	"sys", | 
					
						
							|  |  |  | 	"timers", | 
					
						
							| 
									
										
										
										
											2020-12-15 02:17:39 +08:00
										 |  |  | 	"timers/promises", | 
					
						
							| 
									
										
										
										
											2020-08-28 07:09:12 +08:00
										 |  |  | 	"tls", | 
					
						
							|  |  |  | 	"trace_events", | 
					
						
							|  |  |  | 	"tty", | 
					
						
							|  |  |  | 	"url", | 
					
						
							|  |  |  | 	"util", | 
					
						
							|  |  |  | 	"v8", | 
					
						
							|  |  |  | 	"vm", | 
					
						
							| 
									
										
										
										
											2021-02-16 12:21:04 +08:00
										 |  |  | 	"wasi", | 
					
						
							| 
									
										
										
										
											2020-08-28 07:09:12 +08:00
										 |  |  | 	"worker_threads", | 
					
						
							|  |  |  | 	"zlib" | 
					
						
							|  |  |  | ]; | 
					
						
							| 
									
										
										
										
											2020-08-26 04:16:50 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-11 20:09:19 +08:00
										 |  |  | class NodeTargetPlugin { | 
					
						
							| 
									
										
										
										
											2018-11-09 05:59:19 +08:00
										 |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2020-04-23 16:48:36 +08:00
										 |  |  | 	 * Apply the plugin | 
					
						
							| 
									
										
										
										
											2018-11-09 05:59:19 +08:00
										 |  |  | 	 * @param {Compiler} compiler the compiler instance | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2017-01-11 20:09:19 +08:00
										 |  |  | 	apply(compiler) { | 
					
						
							| 
									
										
										
										
											2018-01-28 05:05:15 +08:00
										 |  |  | 		new ExternalsPlugin("commonjs", builtins).apply(compiler); | 
					
						
							| 
									
										
										
										
											2017-01-11 20:09:19 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2014-03-06 02:56:53 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-14 00:00:07 +08:00
										 |  |  | module.exports = NodeTargetPlugin; |