Skip to content

Commit

Permalink
Merge pull request #232 from iambumblehead/simplify-loaderisverified
Browse files Browse the repository at this point in the history
simplify loaderIsVerified
  • Loading branch information
iambumblehead authored Aug 15, 2023
2 parents facd5b1 + c55fd7a commit 9df7b5b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# changelog

* 2.3.8 _unreleased_
* 2.3.8 _Aug.15.2023_
* [reuse moduleid regexp](https://github.com/iambumblehead/esmock/pull/231) replacing separately created regexps
* [remove esmockIsLoader.js](https://github.com/iambumblehead/esmock/pull/231) export from esmockLoader.js instead
* [simplify esmockIsLoader,](https://github.com/iambumblehead/esmock/pull/232) per review @koshic
* 2.3.7 _Aug.15.2023_
* [normalize package.json url](https://github.com/iambumblehead/esmock/pull/225) and [reduce loc for loader verification](https://github.com/iambumblehead/esmock/pull/226)
* [small adjustments](https://github.com/iambumblehead/esmock/pull/228) reducing lines of code
Expand Down
8 changes: 4 additions & 4 deletions src/esmockLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ const resolve = async (specifier, context, nextResolve) => {
return resolved
}

const loaderVerificationUrl = urlDummy + '?esmock-loader=true'
const loaderIsVerified = (memo => () => memo = memo || (
import(loaderVerificationUrl).then(m => m.default === true)))()
const loaderVerifyUrl = urlDummy + '?esmock-loader=true'
const loaderIsVerified = (memo => async () => memo = memo || (
(await import(loaderVerifyUrl)).default === true))()
const load = async (url, context, nextLoad) => {
if (url === loaderVerificationUrl) {
if (url === loaderVerifyUrl) {
return {
format: 'module',
shortCircuit: true,
Expand Down

0 comments on commit 9df7b5b

Please sign in to comment.