import-in-the-middle 1.3.3 → 1.3.4
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.mjs +5 -0
- package/package.json +1 -1
- package/test/fixtures/json.mjs +9 -0
- package/test/fixtures/something.json +3 -0
- package/test/hook/v18-static-import-assert.mjs +15 -0
- package/test/runtest +12 -0
package/hook.mjs
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
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 coolFile from './something.json' assert { type: 'json' };
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
data: coolFile.data
|
|
9
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
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 Hook from '../../index.js'
|
|
6
|
+
import jsonMjs from '../fixtures/json.mjs'
|
|
7
|
+
import { strictEqual } from 'assert'
|
|
8
|
+
|
|
9
|
+
Hook((exports, name) => {
|
|
10
|
+
if (name.match(/json\.mjs/)) {
|
|
11
|
+
exports.default.data += '-dawg'
|
|
12
|
+
}
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
strictEqual(jsonMjs.data, 'dog-dawg')
|
package/test/runtest
CHANGED
|
@@ -15,6 +15,18 @@ const args = [
|
|
|
15
15
|
'--unhandled-rejections=strict',
|
|
16
16
|
...process.argv.slice(2)
|
|
17
17
|
]
|
|
18
|
+
|
|
19
|
+
const [processMajor] = process.versions.node.split('.').map(Number)
|
|
20
|
+
|
|
21
|
+
const match = filename.match(/v([0-9]+)/)
|
|
22
|
+
|
|
23
|
+
const versionRequirement = match ? match[1] : 0;
|
|
24
|
+
|
|
25
|
+
if (processMajor < versionRequirement) {
|
|
26
|
+
console.log(`skipping ${filename} as this is Node.js v${processMajor} and test wants v${versionRequirement}`);
|
|
27
|
+
process.exit(0);
|
|
28
|
+
}
|
|
29
|
+
|
|
18
30
|
if (!filename.includes('disabled')) {
|
|
19
31
|
const isTypescript = path.extname(filename).slice(-2) === 'ts'
|
|
20
32
|
const loaderPath = isTypescript
|