From 7763bd843da17b20f4efde001483c47b35b180df Mon Sep 17 00:00:00 2001 From: chris Date: Sat, 9 Sep 2023 13:21:16 -0700 Subject: [PATCH] update comment --- src/esmock.js | 5 ++--- src/esmockRegister.js | 3 --- tests/tests-no-loader/esmock.noloader.test.js | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/esmock.js b/src/esmock.js index 5115ed68..d5a28164 100644 --- a/src/esmock.js +++ b/src/esmock.js @@ -36,12 +36,11 @@ const esmock = Object.assign(esmockGo(), { export {esmock as default, strict, strictest} - // for older node versions, to support "--loader=esmock" rather than // "--loader=esmock/loader", esmock.js exported loader hook definitions here // -// for newer node versions 20.6+, exported hook definitions here cause -// problems when --loader called and esmock initializes newer message channels +// for newer node versions 20.6+, exporting hook definitions here causes +// problems when --loader is ued and esmock initializes newer message channels const isMessageChannel = Boolean(module.register && threads.MessageChannel) const hooksFinal = isMessageChannel ? {} : hooks const { load, resolve, getSource, initialize, globalPreload } = hooksFinal diff --git a/src/esmockRegister.js b/src/esmockRegister.js index 6c897b9a..75f376e2 100644 --- a/src/esmockRegister.js +++ b/src/esmockRegister.js @@ -8,9 +8,6 @@ const register = (res => () => { if (typeof res === 'boolean') return res - // if (!(res = global.shouldRegister === true)) - // return res - if ((res = Boolean(channel && module.register))) { module.register('./esmockLoader.js', { parentURL: import.meta.url, diff --git a/tests/tests-no-loader/esmock.noloader.test.js b/tests/tests-no-loader/esmock.noloader.test.js index df0dfc28..c5d24294 100644 --- a/tests/tests-no-loader/esmock.noloader.test.js +++ b/tests/tests-no-loader/esmock.noloader.test.js @@ -13,7 +13,7 @@ if (isLT206) { await assert.rejects(() => esmock('./to/module.js'), { message: esmockErr.errMissingLoader().message }) - }) + }) } if (!isLT206) {