| 518 | #isReady = false; |
| 519 | |
| 520 | constructor() { |
| 521 | const { InternalWorker } = require('internal/worker'); |
| 522 | MessageChannel ??= require('internal/worker/io').MessageChannel; |
| 523 | |
| 524 | const lock = constructSharedArrayBuffer(SHARED_MEMORY_BYTE_LENGTH); |
| 525 | this.#lock = new Int32Array(lock); |
| 526 | |
| 527 | this.#worker = new InternalWorker('internal/modules/esm/worker', { |
| 528 | stderr: false, |
| 529 | stdin: false, |
| 530 | stdout: false, |
| 531 | trackUnmanagedFds: false, |
| 532 | workerData: { |
| 533 | lock, |
| 534 | }, |
| 535 | }); |
| 536 | this.#worker.unref(); // ! Allows the process to eventually exit. |
| 537 | this.#worker.on('exit', process.exit); |
| 538 | } |
| 539 | |
| 540 | waitForWorker() { |
| 541 | if (!this.#isReady) { |