vitest-pool-assemblyscript 0.5.1 → 0.6.1
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/README.md +162 -37
- package/binding.gyp +6 -6
- package/dist/{compiler-CBBHCPAU.mjs → addon-interface-_pNXcbib.mjs} +8 -138
- package/dist/addon-interface-_pNXcbib.mjs.map +1 -0
- package/dist/{compile-runner-DrDjhdPG.mjs → compile-runner-DOMhsLQE.mjs} +3 -3
- package/dist/{compile-runner-DrDjhdPG.mjs.map → compile-runner-DOMhsLQE.mjs.map} +1 -1
- package/dist/compiler/transforms/strip-inline.mjs +1 -2
- package/dist/compiler/transforms/strip-inline.mjs.map +1 -1
- package/dist/compiler-CIXpfKq0.mjs +147 -0
- package/dist/compiler-CIXpfKq0.mjs.map +1 -0
- package/dist/config/index-v3.d.mts +2 -2
- package/dist/config/index.d.mts +3 -3
- package/dist/config/index.mjs +2 -2
- package/dist/coverage-provider/index.mjs +5 -5
- package/dist/coverage-provider/index.mjs.map +1 -1
- package/dist/{custom-provider-options-39YrzdqD.d.mts → custom-provider-options-BZg2Trd5.d.mts} +2 -2
- package/dist/{custom-provider-options-39YrzdqD.d.mts.map → custom-provider-options-BZg2Trd5.d.mts.map} +1 -1
- package/dist/feature-check-ELxw_Mji.mjs +82 -0
- package/dist/feature-check-ELxw_Mji.mjs.map +1 -0
- package/dist/index-internal.d.mts +1 -1
- package/dist/index-internal.d.mts.map +1 -1
- package/dist/index-internal.mjs +2 -1
- package/dist/index-v3.mjs +12 -9
- package/dist/index-v3.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{load-user-imports-BIQvqM7K.mjs → load-user-imports-B3Iy_K8k.mjs} +2 -3
- package/dist/{load-user-imports-BIQvqM7K.mjs.map → load-user-imports-B3Iy_K8k.mjs.map} +1 -1
- package/dist/{pool-runner-init-D8Ei957C.mjs → pool-runner-init-BDQtAGwQ.mjs} +3 -3
- package/dist/pool-runner-init-BDQtAGwQ.mjs.map +1 -0
- package/dist/{pool-runner-init-DVk4hB5d.d.mts → pool-runner-init-BLvrW28n.d.mts} +2 -2
- package/dist/pool-runner-init-BLvrW28n.d.mts.map +1 -0
- package/dist/pool-thread/compile-worker-thread.d.mts +3 -3
- package/dist/pool-thread/compile-worker-thread.d.mts.map +1 -1
- package/dist/pool-thread/compile-worker-thread.mjs +7 -7
- package/dist/pool-thread/compile-worker-thread.mjs.map +1 -1
- package/dist/pool-thread/test-worker-thread.d.mts +1 -1
- package/dist/pool-thread/test-worker-thread.mjs +4 -4
- package/dist/pool-thread/test-worker-thread.mjs.map +1 -1
- package/dist/pool-thread/v3-tinypool-thread.d.mts +1 -1
- package/dist/pool-thread/v3-tinypool-thread.mjs +6 -6
- package/dist/pool-thread/v3-tinypool-thread.mjs.map +1 -1
- package/dist/{resolve-config-BFNr7LW7.mjs → resolve-config-DhZ4lOSK.mjs} +17 -12
- package/dist/resolve-config-DhZ4lOSK.mjs.map +1 -0
- package/dist/{test-runner-DNGLk7lx.mjs → test-runner-WF857_Bk.mjs} +2 -2
- package/dist/{test-runner-DNGLk7lx.mjs.map → test-runner-WF857_Bk.mjs.map} +1 -1
- package/dist/{types-6ta3lLJM.d.mts → types-CnJC7Ydg.d.mts} +2 -1
- package/dist/types-CnJC7Ydg.d.mts.map +1 -0
- package/package.json +52 -24
- package/prebuilds/darwin-arm64/vitest-pool-assemblyscript.glibc.node +0 -0
- package/prebuilds/darwin-x64/vitest-pool-assemblyscript.glibc.node +0 -0
- package/prebuilds/linux-arm64/vitest-pool-assemblyscript.glibc.node +0 -0
- package/prebuilds/linux-x64/vitest-pool-assemblyscript.glibc.node +0 -0
- package/prebuilds/linux-x64/vitest-pool-assemblyscript.musl.node +0 -0
- package/prebuilds/win32-arm64/vitest-pool-assemblyscript.glibc.node +0 -0
- package/prebuilds/win32-x64/vitest-pool-assemblyscript.glibc.node +0 -0
- package/scripts/install-native-addon.js +138 -0
- package/src/{native-instrumentation → instrumentation/native}/addon.cpp +8 -8
- package/dist/compiler-CBBHCPAU.mjs.map +0 -1
- package/dist/node-check-CcKfvjM4.mjs +0 -16
- package/dist/node-check-CcKfvjM4.mjs.map +0 -1
- package/dist/pool-runner-init-D8Ei957C.mjs.map +0 -1
- package/dist/pool-runner-init-DVk4hB5d.d.mts.map +0 -1
- package/dist/resolve-config-BFNr7LW7.mjs.map +0 -1
- package/dist/types-6ta3lLJM.d.mts.map +0 -1
- package/scripts/install.js +0 -91
package/scripts/install.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Custom install script for vitest-pool-assemblyscript native addon.
|
|
3
|
-
*
|
|
4
|
-
* Flow:
|
|
5
|
-
* 1. Try to load a prebuilt or locally-built native addon via node-gyp-build
|
|
6
|
-
* 2. If found → clean up non-matching prebuilds to save disk space, then exit
|
|
7
|
-
* 3. If not found → download Binaryen dependencies, then compile from source
|
|
8
|
-
*
|
|
9
|
-
* This makes installation seamless for users on unsupported platforms:
|
|
10
|
-
* they only need a C++ compiler toolchain (standard for native Node.js addons).
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { execSync } from 'child_process';
|
|
14
|
-
import { createRequire } from 'node:module';
|
|
15
|
-
import { resolve, dirname, join } from 'node:path';
|
|
16
|
-
import { fileURLToPath } from 'node:url';
|
|
17
|
-
import { readdirSync, rmSync, existsSync } from 'node:fs';
|
|
18
|
-
|
|
19
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
20
|
-
const __dirname = dirname(__filename);
|
|
21
|
-
const packageRoot = resolve(__dirname, '..');
|
|
22
|
-
|
|
23
|
-
const require = createRequire(import.meta.url);
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Remove prebuild directories that don't match the current platform.
|
|
27
|
-
* Prebuilds ship for all 6 platforms (~21 MB each uncompressed), but only
|
|
28
|
-
* the current platform's prebuild is needed at runtime.
|
|
29
|
-
*/
|
|
30
|
-
function cleanUnusedPrebuilds() {
|
|
31
|
-
const prebuildsDir = join(packageRoot, 'prebuilds');
|
|
32
|
-
if (!existsSync(prebuildsDir)) return;
|
|
33
|
-
|
|
34
|
-
const currentPlatformDir = `${process.platform}-${process.arch}`;
|
|
35
|
-
|
|
36
|
-
try {
|
|
37
|
-
const entries = readdirSync(prebuildsDir);
|
|
38
|
-
for (const entry of entries) {
|
|
39
|
-
if (entry !== currentPlatformDir) {
|
|
40
|
-
rmSync(join(prebuildsDir, entry), { recursive: true, force: true });
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
} catch {
|
|
44
|
-
// Non-critical — don't fail install over cleanup
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Step 1: Check if a prebuild or local build already exists
|
|
49
|
-
try {
|
|
50
|
-
const nodeGypBuild = require('node-gyp-build');
|
|
51
|
-
nodeGypBuild(packageRoot);
|
|
52
|
-
// Addon loaded successfully — clean up unused prebuilds and exit
|
|
53
|
-
cleanUnusedPrebuilds();
|
|
54
|
-
process.exit(0);
|
|
55
|
-
} catch {
|
|
56
|
-
// No prebuild or local build found — fall through to source build
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Step 2: Download Binaryen headers and static library
|
|
60
|
-
console.log('No prebuilt native addon found for this platform. Building from source...');
|
|
61
|
-
console.log('');
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
console.log('Downloading Binaryen dependencies...');
|
|
65
|
-
execSync('node scripts/setup-binaryen.js', {
|
|
66
|
-
cwd: packageRoot,
|
|
67
|
-
stdio: 'inherit',
|
|
68
|
-
});
|
|
69
|
-
} catch (err) {
|
|
70
|
-
console.error('Failed to download Binaryen dependencies.');
|
|
71
|
-
console.error('The native addon is required for vitest-pool-assemblyscript.');
|
|
72
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
73
|
-
process.exit(1);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Step 3: Compile native addon from source
|
|
77
|
-
try {
|
|
78
|
-
console.log('');
|
|
79
|
-
console.log('Compiling native addon...');
|
|
80
|
-
execSync('node-gyp rebuild', {
|
|
81
|
-
cwd: packageRoot,
|
|
82
|
-
stdio: 'inherit',
|
|
83
|
-
});
|
|
84
|
-
console.log('');
|
|
85
|
-
console.log('Native addon compiled successfully.');
|
|
86
|
-
} catch (err) {
|
|
87
|
-
console.error('Failed to compile native addon from source.');
|
|
88
|
-
console.error('Ensure a C++ compiler toolchain is installed (see https://github.com/nodejs/node-gyp#installation).');
|
|
89
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
90
|
-
process.exit(1);
|
|
91
|
-
}
|