Skip to content

Commit

Permalink
update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
bumblehead committed Sep 9, 2023
1 parent 07af9d6 commit 7763bd8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
5 changes: 2 additions & 3 deletions src/esmock.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions src/esmockRegister.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tests/tests-no-loader/esmock.noloader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if (isLT206) {
await assert.rejects(() => esmock('./to/module.js'), {
message: esmockErr.errMissingLoader().message
})
})
})
}

if (!isLT206) {
Expand Down

0 comments on commit 7763bd8

Please sign in to comment.