UNPKG
import-in-the-middle
Version:
latest (3.2.0)
3.2.0
3.1.0
3.0.2
3.0.1
3.0.0
2.0.6
2.0.5
2.0.4
2.0.3
2.0.2
2.0.1
2.0.0
1.15.0
1.14.4
1.14.3
1.14.2
1.14.1
1.14.0
1.13.2
1.13.1
1.13.0
1.12.0
1.11.3
1.11.2
1.11.1
1.11.0
1.10.0
1.9.1
1.9.0
1.8.1
1.8.0
1.7.4
1.7.3
1.7.2
1.7.1
1.7.0
1.6.0
1.5.0
1.4.2
1.4.1
1.4.0
1.3.5
1.3.4
1.3.3
1.3.2
1.3.1
1.3.0
1.2.3
1.2.2
1.2.1
1.2.0
1.1.2
1.1.1
1.1.0
1.0.1
1.0.0
Intercept imports in Node.js
github.com/nodejs/import-in-the-middle
nodejs/import-in-the-middle
import-in-the-middle
/
test
/
hook
/
circular-imports.mjs
12 lines
(9 loc)
•
237 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
import
{ foo }
from
'../fixtures/circular-b.js'
import
Hook
from
'../../index.js'
import
{ strictEqual }
from
'assert'
Hook
(
(
exports
, name
) =>
{
if
(name.
match
(
/circular-[ab].js/
)) {
exports
.
foo
+=
15
} })
strictEqual
(foo,
57
)