@happy-dom/jest-environment 17.1.1 → 17.1.3
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/bin/copy-tsdef-for-lit.cjs +20 -20
- package/package.json +2 -2
@@ -2,7 +2,7 @@
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-var-requires*/
|
3
3
|
|
4
4
|
const Path = require('path');
|
5
|
-
const
|
5
|
+
const fsp = require('fs/promises');
|
6
6
|
|
7
7
|
const LIBS = ['@lit/reactive-element', 'lit', 'lit-element', 'lit-html'];
|
8
8
|
|
@@ -16,26 +16,26 @@ function getLibPath(lib) {
|
|
16
16
|
return Path.join(split[0], 'node_modules', modulePath);
|
17
17
|
}
|
18
18
|
|
19
|
+
async function copyTsDefFiles(lib) {
|
20
|
+
const srcDir = getLibPath(lib);
|
21
|
+
const destDir = Path.resolve(Path.join('lib', 'node_modules', lib));
|
22
|
+
|
23
|
+
await fsp.mkdir(destDir, { recursive: true });
|
24
|
+
|
25
|
+
const files = await fsp.readdir(srcDir);
|
26
|
+
|
27
|
+
const tsDefFiles = files.filter((file) => file.endsWith('.d.ts'));
|
28
|
+
|
29
|
+
const copyPromises = tsDefFiles.map((file) => {
|
30
|
+
const srcFile = Path.join(srcDir, file);
|
31
|
+
const destFile = Path.join(destDir, file);
|
32
|
+
return fsp.copyFile(srcFile, destFile);
|
33
|
+
});
|
34
|
+
await Promise.all(copyPromises);
|
35
|
+
}
|
36
|
+
|
19
37
|
async function main() {
|
20
|
-
await Promise.all(
|
21
|
-
LIBS.map(
|
22
|
-
(lib) =>
|
23
|
-
new Promise((resolve, reject) => {
|
24
|
-
ChildProcess.exec(
|
25
|
-
`cp ${Path.join(getLibPath(lib), '*.d.ts')} ${Path.resolve(
|
26
|
-
Path.join('lib', 'node_modules', lib)
|
27
|
-
)}`,
|
28
|
-
(error, stdout, stderr) => {
|
29
|
-
if (error || stderr) {
|
30
|
-
reject(error || new Error(stderr));
|
31
|
-
return;
|
32
|
-
}
|
33
|
-
resolve(stdout);
|
34
|
-
}
|
35
|
-
);
|
36
|
-
})
|
37
|
-
)
|
38
|
-
);
|
38
|
+
await Promise.all(LIBS.map((lib) => copyTsDefFiles(lib)));
|
39
39
|
}
|
40
40
|
|
41
41
|
process.on('unhandledRejection', (reason) => {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@happy-dom/jest-environment",
|
3
|
-
"version": "17.1.
|
3
|
+
"version": "17.1.3",
|
4
4
|
"license": "MIT",
|
5
5
|
"homepage": "https://github.com/capricorn86/happy-dom/tree/master/packages/jest-environment",
|
6
6
|
"repository": "https://github.com/capricorn86/happy-dom",
|
@@ -50,7 +50,7 @@
|
|
50
50
|
"@jest/environment": "^29.4.0",
|
51
51
|
"@jest/fake-timers": "^29.4.0",
|
52
52
|
"@jest/types": "^29.4.0",
|
53
|
-
"happy-dom": "^17.1.
|
53
|
+
"happy-dom": "^17.1.3",
|
54
54
|
"jest-mock": "^29.4.0",
|
55
55
|
"jest-util": "^29.4.0"
|
56
56
|
},
|