import-in-the-middle 1.3.0 → 1.3.1

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.
Files changed (2) hide show
  1. package/hook.mjs +6 -2
  2. package/package.json +1 -1
package/hook.mjs CHANGED
@@ -45,12 +45,16 @@ function deleteIitm (url) {
45
45
  function addIitm (url) {
46
46
  const urlObj = new URL(url)
47
47
  urlObj.searchParams.set('iitm', 'true')
48
- return urlObj.protocol !== 'file:' && NODE_MAJOR < 18 ? 'file:' + urlObj.href : urlObj.href
48
+ if (NODE_MAJOR === 17) {
49
+ return urlObj.protocol !== 'file:' ? 'file:' + urlObj.href : urlObj.href
50
+ }
51
+ return urlObj.protocol !== 'file:' && urlObj.protocol !== 'node:' && NODE_MAJOR < 18
52
+ ? 'file:' + urlObj.href
53
+ : urlObj.href
49
54
  }
50
55
 
51
56
  export async function resolve (specifier, context, parentResolve) {
52
57
  const { parentURL = '' } = context
53
-
54
58
  const url = await parentResolve(deleteIitm(specifier), context, parentResolve)
55
59
 
56
60
  if (parentURL === '' && !EXTENSION_RE.test(url.url)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "import-in-the-middle",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Intercept imports in Node.js",
5
5
  "main": "index.js",
6
6
  "scripts": {