Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

import-in-the-middle

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

import-in-the-middle - npm Package Compare versions

Comparing version 1.3.5 to 1.4.0

lib/get-esm-exports.js

19

hook.js

@@ -17,2 +17,8 @@ // Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2.0 License.

if (NODE_MAJOR >= 20) {
getExports = require('./lib/get-exports.js')
} else {
getExports = (url) => import(url).then(Object.keys)
}
function hasIitm (url) {

@@ -107,3 +113,4 @@ try {

url: addIitm(url.url),
shortCircuit: true
shortCircuit: true,
format: url.format
}

@@ -116,4 +123,3 @@ }

const realUrl = deleteIitm(url)
const realModule = await import(realUrl)
const exportNames = Object.keys(realModule)
const exportNames = await getExports(realUrl, context, parentGetSource)
return {

@@ -143,3 +149,3 @@ source: `

if (hasIitm(url)) {
const { source } = await getSource(url, context)
const { source } = await getSource(url, context, parentLoad)
return {

@@ -155,6 +161,3 @@ source,

if (NODE_MAJOR >= 20) {
process.emitWarning('import-in-the-middle is currently unsupported on Node.js v20 and has been disabled.')
return {} // TODO: Add support for Node >=20
} else if (NODE_MAJOR >= 17 || (NODE_MAJOR === 16 && NODE_MINOR >= 12)) {
if (NODE_MAJOR >= 17 || (NODE_MAJOR === 16 && NODE_MINOR >= 12)) {
return { load, resolve }

@@ -161,0 +164,0 @@ } else {

{
"name": "import-in-the-middle",
"version": "1.3.5",
"version": "1.4.0",
"description": "Intercept imports in Node.js",
"main": "index.js",
"scripts": {
"test": "c8 --check-coverage --lines 85 imhotap --runner test/runtest --files test/{hook,low-level,other}/*",
"test:unsupported": "imhotap --runner test/runtest --files test/hook/loader.mjs",
"test-win": "c8 --check-coverage --lines 85 imhotap --runner test\\runtest.bat --files test/{hook,low-level,other}/*",
"test": "c8 --check-coverage --lines 85 imhotap --runner test/runtest --files test/{hook,low-level,other,get-esm-exports}/*",
"test-win": "c8 --check-coverage --lines 85 imhotap --runner test\\runtest.bat --files test/{hook,low-level,other,get-esm-exports}/*",
"test:ts": "c8 imhotap --runner test/runtest --files test/typescript/*.test.mts",
"test-win:ts": "c8 imhotap --runner test\\runtest.bat --files test/typescript/*.test.mts",
"coverage": "c8 --reporter html imhotap --runner test/runtest --files test/{hook,low-level,other}/* && echo '\nNow open coverage/index.html\n'"
"coverage": "c8 --reporter html imhotap --runner test/runtest --files test/{hook,low-level,other,get-esm-exports}/* && echo '\nNow open coverage/index.html\n'"
},

@@ -40,4 +39,7 @@ "repository": {

"dependencies": {
"acorn": "^8.8.2",
"acorn-import-assertions": "^1.9.0",
"cjs-module-lexer": "^1.2.2",
"module-details-from-path": "^1.0.3"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc