import-in-the-middle 1.13.1 → 1.13.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.
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "1.13.1"
2
+ ".": "1.13.2"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.13.2](https://github.com/nodejs/import-in-the-middle/compare/import-in-the-middle-v1.13.1...import-in-the-middle-v1.13.2) (2025-05-12)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * Don't attempt to wrap TypeScript modules ([#191](https://github.com/nodejs/import-in-the-middle/issues/191)) ([6deb87e](https://github.com/nodejs/import-in-the-middle/commit/6deb87ea069ec2ee749ce2297ea47ce071d18cf9))
9
+
3
10
  ## [1.13.1](https://github.com/nodejs/import-in-the-middle/compare/import-in-the-middle-v1.13.0...import-in-the-middle-v1.13.1) (2025-02-28)
4
11
 
5
12
 
package/hook.js CHANGED
@@ -14,6 +14,7 @@ const EXTENSION_RE = /\.(js|mjs|cjs|ts|mts|cts)$/
14
14
  const NODE_VERSION = process.versions.node.split('.')
15
15
  const NODE_MAJOR = Number(NODE_VERSION[0])
16
16
  const NODE_MINOR = Number(NODE_VERSION[1])
17
+ const HANDLED_FORMATS = new Set(['builtin', 'module', 'commonjs'])
17
18
 
18
19
  let entrypoint
19
20
 
@@ -349,6 +350,10 @@ function createHook (meta) {
349
350
  return each === specifier || each === result.url || (result.url.startsWith('file:') && each === fileURLToPath(result.url))
350
351
  }
351
352
 
353
+ if (result.format && !HANDLED_FORMATS.has(result.format)) {
354
+ return result
355
+ }
356
+
352
357
  if (includeModules && !includeModules.some(match)) {
353
358
  return result
354
359
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "import-in-the-middle",
3
- "version": "1.13.1",
3
+ "version": "1.13.2",
4
4
  "description": "Intercept imports in Node.js",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -50,7 +50,7 @@
50
50
  "eslint-plugin-promise": "^6.1.1",
51
51
  "got": "^14.3.0",
52
52
  "imhotap": "^2.1.0",
53
- "openai": "^4.47.2",
53
+ "openai": "4.47.2",
54
54
  "ts-node": "^10.9.1",
55
55
  "typescript": "^4.7.4",
56
56
  "vue": "^3.4.31"
@@ -0,0 +1,7 @@
1
+ export type { Debugger } from 'node:inspector'
2
+
3
+ export const foo: number = 42
4
+
5
+ export function bar(): number {
6
+ return foo
7
+ }
@@ -0,0 +1,8 @@
1
+ import { strictEqual } from 'assert'
2
+
3
+ const mod = await import('../fixtures/something.mts')
4
+
5
+ strictEqual(mod.foo, 42)
6
+ strictEqual(typeof mod.bar, 'function')
7
+ strictEqual(mod.bar(), 42)
8
+ strictEqual(Object.keys(mod).length, 2)