import-in-the-middle 1.11.1 → 1.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +7 -0
- package/lib/register.js +6 -1
- package/package.json +1 -1
- package/test/hook/v14-double-hook.mjs +11 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.11.2](https://github.com/nodejs/import-in-the-middle/compare/import-in-the-middle-v1.11.1...import-in-the-middle-v1.11.2) (2024-09-30)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* do nothing if target does not exist in getters map ([#155](https://github.com/nodejs/import-in-the-middle/issues/155)) ([5f6be49](https://github.com/nodejs/import-in-the-middle/commit/5f6be494fc11caf8dcf900807c5b6b646fcd8d74))
|
|
9
|
+
|
|
3
10
|
## [1.11.1](https://github.com/nodejs/import-in-the-middle/compare/import-in-the-middle-v1.11.0...import-in-the-middle-v1.11.1) (2024-09-26)
|
|
4
11
|
|
|
5
12
|
|
package/lib/register.js
CHANGED
|
@@ -17,7 +17,12 @@ const proxyHandler = {
|
|
|
17
17
|
if (name === Symbol.toStringTag) {
|
|
18
18
|
return 'Module'
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
const getter = getters.get(target)[name]
|
|
22
|
+
|
|
23
|
+
if (typeof getter === 'function') {
|
|
24
|
+
return getter()
|
|
25
|
+
}
|
|
21
26
|
},
|
|
22
27
|
|
|
23
28
|
defineProperty (target, property, descriptor) {
|
package/package.json
CHANGED
|
@@ -19,6 +19,15 @@ Hook([toWrap], (exports) => {
|
|
|
19
19
|
}
|
|
20
20
|
})
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
Hook([toWrap], (exports) => {
|
|
23
|
+
const shouldNotExist = exports.default
|
|
24
|
+
exports = function () {
|
|
25
|
+
return shouldNotExist()
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const imp = await import('../fixtures/foo.mjs')
|
|
23
30
|
|
|
24
|
-
strictEqual(foo(), 'foo-first-second')
|
|
31
|
+
strictEqual(imp.foo(), 'foo-first-second')
|
|
32
|
+
// This should not throw!
|
|
33
|
+
strictEqual(imp.default, undefined)
|