* Tell the watch mode that a module was required, from within a worker thread. * @param {string} filename Absolute path of the module * @returns {void}
(filename)
| 340 | * @returns {void} |
| 341 | */ |
| 342 | function reportModuleToWatchModeFromWorker(filename) { |
| 343 | if (!shouldReportRequiredModules()) { |
| 344 | return; |
| 345 | } |
| 346 | const { isMainThread } = internalBinding('worker'); |
| 347 | if (isMainThread) { |
| 348 | return; |
| 349 | } |
| 350 | // Lazy require to avoid circular dependency: worker_threads is loaded after |
| 351 | // the CJS loader is fully set up. |
| 352 | const { parentPort } = require('worker_threads'); |
| 353 | if (!parentPort) { |
| 354 | return; |
| 355 | } |
| 356 | parentPort.postMessage({ 'watch:require': [filename] }); |
| 357 | } |
| 358 | |
| 359 | /** |
| 360 | * Create a new module instance. |
no test coverage detected
searching dependent graphs…