MCPcopy Index your code
hub / github.com/nodejs/node / reportModuleToWatchModeFromWorker

Function reportModuleToWatchModeFromWorker

lib/internal/modules/cjs/loader.js:342–357  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

340 * @returns {void}
341 */
342function 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.

Callers 1

loader.jsFile · 0.85

Calls 2

requireFunction · 0.50
postMessageMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…