import-in-the-middle 1.4.0 → 1.4.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/hook.js +2 -2
- package/package.json +5 -7
- package/test/low-level/sanitized-url.mjs +11 -0
- package/test/runtest.bat +0 -1
package/hook.js
CHANGED
|
@@ -122,7 +122,7 @@ function createHook (meta) {
|
|
|
122
122
|
return {
|
|
123
123
|
source: `
|
|
124
124
|
import { register } from '${iitmURL}'
|
|
125
|
-
import * as namespace from
|
|
125
|
+
import * as namespace from ${JSON.stringify(url)}
|
|
126
126
|
const set = {}
|
|
127
127
|
${exportNames.map((n) => `
|
|
128
128
|
let $${n} = namespace.${n}
|
|
@@ -132,7 +132,7 @@ set.${n} = (v) => {
|
|
|
132
132
|
return true
|
|
133
133
|
}
|
|
134
134
|
`).join('\n')}
|
|
135
|
-
register(
|
|
135
|
+
register(${JSON.stringify(realUrl)}, namespace, set, ${JSON.stringify(specifiers.get(realUrl))})
|
|
136
136
|
`
|
|
137
137
|
}
|
|
138
138
|
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "import-in-the-middle",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"description": "Intercept imports in Node.js",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "c8 --check-coverage --lines 85 imhotap --runner test/runtest --files test/{hook,low-level,other,get-esm-exports}/*",
|
|
8
|
-
"test
|
|
9
|
-
"
|
|
10
|
-
"test-win:ts": "c8 imhotap --runner test\\runtest.bat --files test/typescript/*.test.mts",
|
|
11
|
-
"coverage": "c8 --reporter html imhotap --runner test/runtest --files test/{hook,low-level,other,get-esm-exports}/* && echo '\nNow open coverage/index.html\n'"
|
|
7
|
+
"test": "c8 --check-coverage --lines 85 imhotap --runner 'node test/runtest' --files test/{hook,low-level,other,get-esm-exports}/*",
|
|
8
|
+
"test:ts": "c8 imhotap --runner 'node test/runtest' --files test/typescript/*.test.mts",
|
|
9
|
+
"coverage": "c8 --reporter html imhotap --runner 'node test/runtest' --files test/{hook,low-level,other,get-esm-exports}/* && echo '\nNow open coverage/index.html\n'"
|
|
12
10
|
},
|
|
13
11
|
"repository": {
|
|
14
12
|
"type": "git",
|
|
@@ -31,7 +29,7 @@
|
|
|
31
29
|
"devDependencies": {
|
|
32
30
|
"@types/node": "^18.0.6",
|
|
33
31
|
"c8": "^7.8.0",
|
|
34
|
-
"imhotap": "^2.
|
|
32
|
+
"imhotap": "^2.1.0",
|
|
35
33
|
"ts-node": "^10.9.1",
|
|
36
34
|
"typescript": "^4.7.4"
|
|
37
35
|
},
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2.0 License.
|
|
2
|
+
//
|
|
3
|
+
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
|
|
4
|
+
|
|
5
|
+
import { addHook } from '../../index.js'
|
|
6
|
+
|
|
7
|
+
addHook(() => {})
|
|
8
|
+
|
|
9
|
+
;(async () => {
|
|
10
|
+
await import("../fixtures/something.mjs#*/'/*';eval('process.exit\x281\x29\x0A')")
|
|
11
|
+
})()
|
package/test/runtest.bat
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
node test/runtest %*
|