vitest-pool-assemblyscript 0.6.0 → 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.
Files changed (47) hide show
  1. package/README.md +67 -12
  2. package/dist/{addon-interface-7FPjYh7J.mjs → addon-interface-_pNXcbib.mjs} +2 -2
  3. package/dist/addon-interface-_pNXcbib.mjs.map +1 -0
  4. package/dist/{compile-runner-C-05LdGX.mjs → compile-runner-DOMhsLQE.mjs} +2 -2
  5. package/dist/{compile-runner-C-05LdGX.mjs.map → compile-runner-DOMhsLQE.mjs.map} +1 -1
  6. package/dist/{compiler-YMrl5MY_.mjs → compiler-CIXpfKq0.mjs} +3 -3
  7. package/dist/{compiler-YMrl5MY_.mjs.map → compiler-CIXpfKq0.mjs.map} +1 -1
  8. package/dist/config/index-v3.d.mts +2 -2
  9. package/dist/config/index.d.mts +3 -3
  10. package/dist/config/index.mjs +2 -2
  11. package/dist/coverage-provider/index.mjs +2 -2
  12. package/dist/{custom-provider-options-YTk1m7At.d.mts → custom-provider-options-BZg2Trd5.d.mts} +2 -2
  13. package/dist/{custom-provider-options-YTk1m7At.d.mts.map → custom-provider-options-BZg2Trd5.d.mts.map} +1 -1
  14. package/dist/{feature-check-CNyjFX9M.mjs → feature-check-ELxw_Mji.mjs} +2 -2
  15. package/dist/{feature-check-CNyjFX9M.mjs.map → feature-check-ELxw_Mji.mjs.map} +1 -1
  16. package/dist/index-internal.d.mts +1 -1
  17. package/dist/index-internal.mjs +2 -2
  18. package/dist/index-v3.mjs +12 -9
  19. package/dist/index-v3.mjs.map +1 -1
  20. package/dist/index.d.mts +2 -2
  21. package/dist/index.mjs +2 -2
  22. package/dist/{pool-runner-init-D8Ei957C.mjs → pool-runner-init-BDQtAGwQ.mjs} +3 -3
  23. package/dist/pool-runner-init-BDQtAGwQ.mjs.map +1 -0
  24. package/dist/{pool-runner-init-CvnB0-iN.d.mts → pool-runner-init-BLvrW28n.d.mts} +2 -2
  25. package/dist/pool-runner-init-BLvrW28n.d.mts.map +1 -0
  26. package/dist/pool-thread/compile-worker-thread.d.mts +3 -3
  27. package/dist/pool-thread/compile-worker-thread.d.mts.map +1 -1
  28. package/dist/pool-thread/compile-worker-thread.mjs +5 -5
  29. package/dist/pool-thread/compile-worker-thread.mjs.map +1 -1
  30. package/dist/pool-thread/test-worker-thread.d.mts +1 -1
  31. package/dist/pool-thread/test-worker-thread.mjs +1 -1
  32. package/dist/pool-thread/v3-tinypool-thread.d.mts +1 -1
  33. package/dist/pool-thread/v3-tinypool-thread.mjs +3 -3
  34. package/dist/{resolve-config-BFNr7LW7.mjs → resolve-config-DhZ4lOSK.mjs} +17 -12
  35. package/dist/{resolve-config-BFNr7LW7.mjs.map → resolve-config-DhZ4lOSK.mjs.map} +1 -1
  36. package/dist/{types-D0nprJo1.d.mts → types-CnJC7Ydg.d.mts} +2 -1
  37. package/dist/types-CnJC7Ydg.d.mts.map +1 -0
  38. package/package.json +44 -17
  39. package/prebuilds/darwin-arm64/vitest-pool-assemblyscript.glibc.node +0 -0
  40. package/prebuilds/darwin-x64/vitest-pool-assemblyscript.glibc.node +0 -0
  41. package/prebuilds/win32-arm64/vitest-pool-assemblyscript.glibc.node +0 -0
  42. package/prebuilds/win32-x64/vitest-pool-assemblyscript.glibc.node +0 -0
  43. package/scripts/{install.js → install-native-addon.js} +12 -2
  44. package/dist/addon-interface-7FPjYh7J.mjs.map +0 -1
  45. package/dist/pool-runner-init-CvnB0-iN.d.mts.map +0 -1
  46. package/dist/pool-runner-init-D8Ei957C.mjs.map +0 -1
  47. package/dist/types-D0nprJo1.d.mts.map +0 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  <p align="center">
4
4
  <img src="docs/images/as-icon.svg" height="50" align="middle">
5
- &nbsp;&nbsp;&nbsp;&nbsp;&#10133;&nbsp;&nbsp;&nbsp;&nbsp;
5
+ &nbsp;&nbsp;&#10133;&nbsp;&nbsp;
6
6
  <picture>
7
7
  <source media="(prefers-color-scheme: dark)" srcset="docs/images/vitest-light.svg">
8
8
  <source media="(prefers-color-scheme: light)" srcset="docs/images/vitest-dark.svg">
@@ -11,7 +11,7 @@
11
11
  </p>
12
12
 
13
13
  <p align="center">
14
- AssemblyScript unit testing for your Vitest workflow: Simple, fast, familiar, AS-native.
14
+ AssemblyScript unit testing in Vitest: Simple, fast, familiar, AS-native.
15
15
  <br/>
16
16
  <br/>
17
17
  <a href="LICENSE"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat"/></a>
@@ -24,7 +24,7 @@
24
24
  <br/>
25
25
 
26
26
  <p align="center">
27
- This <a href="https://vitest.dev/guide/advanced/pool.html">custom pool</a> plugs into <a href="https://vitest.dev">Vitest</a>, giving it the ability to compile AssemblyScript, run isolated WASM tests, and report with Vitest's reporters. It co-exists alongside your existing JavaScript/TypeScript tests and coverage reports, and is designed for simple incremental adoption.
27
+ This <a href="https://vitest.dev/guide/advanced/pool.html">custom pool</a> plugs into <a href="https://vitest.dev">Vitest</a>, giving it the ability to compile AssemblyScript, run isolated WASM tests, and report results with Vitest's reporters. It coexists with your existing JavaScript/TypeScript tests and coverage reporting, and is designed for easy incremental adoption.
28
28
  </p>
29
29
 
30
30
  <p align="center">
@@ -43,11 +43,18 @@
43
43
  <p align="center">
44
44
  Dig in:
45
45
  <br/>
46
- <a href="#writing-tests">Writing Tests</a> |
47
- <a href="docs/matchers-api.md">Matchers API</a> |
48
- <a href="docs/configuration-guide.md">Configuration Guide</a> |
46
+ <a href="#writing-tests">Writing Tests</a> |
47
+ <a href="docs/matchers-api.md">Matchers API</a> |
48
+ <a href="docs/configuration-guide.md">Configuration Guide</a> |
49
49
  <a href="docs/providing-wasm-imports.md">Providing WASM Imports</a>
50
50
  </p>
51
+ <p align="center">
52
+ Dig deeper:
53
+ <br/>
54
+ <a href="docs/pool-architecture.md">Pool Architecture</a> |
55
+ <a href="docs/coverage-architecture.md">Coverage Architecture</a> |
56
+ <a href="docs/developer-guide.md">Developer Guide</a>
57
+ </p>
51
58
 
52
59
  ---
53
60
 
@@ -58,16 +65,16 @@
58
65
 
59
66
  ## Status
60
67
 
61
- This project is relatively new to the scene, but is being improved every day. Please give it a try!
68
+ This project is relatively new to the scene, but is stable and is being improved every day. Please give it a try!
62
69
 
63
- All [listed features](#features) are working and assumed to be bug-free ([please report any](https://github.com/themattspiral/vitest-pool-assemblyscript/issues/new))
70
+ All [listed features](#features) are working and assumed to be bug-free ([please report any](https://github.com/themattspiral/vitest-pool-assemblyscript/issues/new)).
64
71
 
65
- | Function | Status |
72
+ | Item | Status |
66
73
  |---|---|
67
74
  | [`describe()` and `test()` APIs](#writing-tests) | - stable<br/>- no breaking changes expected |
68
- | [`expect()` API](docs/matchers-api.md) | - stable<br/>- no breaking changes expected<br/>- more coming soon |
75
+ | [`expect()` API](docs/matchers-api.md) | - stable<br/>- no breaking changes expected<br/>- more matchers coming soon |
69
76
  | Code Coverage / Instrumentation | - function coverage stable [across platforms](#compatibility)<br/>- branch & line coverage coming soon |
70
- | Hybrid Coverage Provider | - stable<br/>- v8 delegation, side-by-side JS coverage<br/>- istanbul delegation coming soon
77
+ | Hybrid Coverage Provider | - stable<br/>- v8 JS delegation, side-by-side JS coverage<br/>- istanbul JS delegation coming soon
71
78
 
72
79
  See Also:
73
80
  - [Current Limitations & Roadmap](#current-limitations--roadmap)
@@ -186,6 +193,52 @@ npx vitest run
186
193
  - Configurable test memory size
187
194
  - User-provided WASM imports with access to test memory
188
195
 
196
+
197
+ <table>
198
+ <tr>
199
+ <td align="center">
200
+ <figure>
201
+ <img src="docs/images/demo-compiler-error.png" alt="AS Compiler Error Output" width="200" /><br/>
202
+ <figcaption>AS compiler error</figcaption>
203
+ </figure>
204
+ </td>
205
+ <td align="center">
206
+ <figure>
207
+ <img src="docs/images/demo-runtime-errors.png" alt="WASM Runtime Error Output" width="200" /><br/>
208
+ <figcaption>Source-mapped, highlighted runtime errors</figcaption>
209
+ </figure>
210
+ </td>
211
+ </tr>
212
+ <tr>
213
+ <td align="center">
214
+ <figure>
215
+ <img src="docs/images/demo-diffs-array.png" alt="Assertion Error Diff Output" width="200" /><br/>
216
+ <figcaption>Assertion diff output</figcaption>
217
+ </figure>
218
+ </td>
219
+ <td align="center">
220
+ <figure>
221
+ <img src="docs/images/demo-timeout-and-fails.png" alt="Timeout and Fails Outputs" width="200" /><br/>
222
+ <figcaption>Timeout and fails outputs</figcaption>
223
+ </figure>
224
+ </td>
225
+ </tr>
226
+ <tr>
227
+ <td align="center">
228
+ <figure>
229
+ <img src="docs/images/demo-coverage.png" alt="Coverage Summary Output" width="200" /><br/>
230
+ <figcaption>AS and JS coverage summary</figcaption>
231
+ </figure>
232
+ </td>
233
+ <td align="center">
234
+ <figure>
235
+ <img src="docs/images/demo-coverage-html.png" alt="Coverage HTML Report" width="200" /><br/>
236
+ <figcaption>AS coverage HTML report</figcaption>
237
+ </figure>
238
+ </td>
239
+ </tr>
240
+ </table>
241
+
189
242
  ---
190
243
 
191
244
  ## Frequently Asked Questions
@@ -194,6 +247,8 @@ npx vitest run
194
247
  <br/>
195
248
  **A:** Vitest has a [custom pool API](https://vitest.dev/guide/advanced/pool.html) that lets you define the execution environment for the tests it runs (internally, vitest uses its own pools to run JavaScript and TypeScript tests). This custom pool uses the [AssemblyScript compiler](https://www.assemblyscript.org/compiler.html) to compile each test file to WASM, instruments the WASM binary for code coverage, then runs each test in an isolated WASM instance and reports results back to vitest through its standard RPC reporting mechanism.
196
249
 
250
+ More detailed information can be found in [Pool Architecture](docs/pool-architecture.md) and [Coverage Architecture](docs/coverage-architecture.md)
251
+
197
252
  **Q: So it is really using vitest?**
198
253
  <br/>
199
254
  **A:** Yes! It's a real vitest pool, not a clone of vitest - it hooks directly into the framework, receiving tests to run from vitest and reporting results back. The pool implements its own compilation, test execution, and [matchers in AS](docs/matchers-api.md), designed to mirror the [vitest expect() API](https://vitest.dev/api/expect.html). We don't use vite build integration, but that's the tradeoff of a custom pool - you can bring any execution environment to vitest.
@@ -214,7 +269,7 @@ The overall goal is tight vitest experience integration - most CLI commands, rep
214
269
 
215
270
  **Q: Are you a company? A bot?**
216
271
  <br/>
217
- **A:** Just [a person](https://github.com/themattspiral)! This started as a hobby project to improve my own AssemblyScript testing workflow and learn something about WASM internals, and it's grown from there. I use Claude Code for initial scaffolding and to help dig into the native instrumentation side in particular, but everything goes through me, and my intention is to contribute something useful and high-quality to the community. Feedback and contributions are welcome.
272
+ **A:** Just [a person](https://github.com/themattspiral)! This started as a hobby project to improve my own AssemblyScript testing workflow and to learn something about deep WASM internals, and it's grown from there. I used Claude Code for initial scaffolding and to help dig into the native instrumentation side, but everything goes through me, and my intention is to contribute something useful and high-quality to the community. Feedback and contributions are welcome.
218
273
 
219
274
  ---
220
275
 
@@ -28,7 +28,7 @@ try {
28
28
  try {
29
29
  addon = nodeGypBuild(rootFromSrc);
30
30
  } catch (err) {
31
- throw createPoolError(`vitest-pool-assemblyscript native instrumentation addon not found. Searched from ${rootFromDist} and ${rootFromSrc}. Ensure prebuilds are available or run 'node node_modules/vitest-pool-assemblyscript/scripts/install.js' to compile from source. Original error: ${err instanceof Error ? err.message : String(err)}`, POOL_ERROR_NAMES.WASMInstrumentationError);
31
+ throw createPoolError(`vitest-pool-assemblyscript native instrumentation addon not found. Searched from ${rootFromDist} and ${rootFromSrc}. Ensure prebuilds are available or run 'node node_modules/vitest-pool-assemblyscript/scripts/install-native-addon.js' to compile from source. Original error: ${err instanceof Error ? err.message : String(err)}`, POOL_ERROR_NAMES.WASMInstrumentationError);
32
32
  }
33
33
  }
34
34
  /**
@@ -203,4 +203,4 @@ const instrumentForCoverage = (wasmBuffer, sourceMapBuffer, instrumentationOptio
203
203
 
204
204
  //#endregion
205
205
  export { instrumentForCoverage };
206
- //# sourceMappingURL=addon-interface-7FPjYh7J.mjs.map
206
+ //# sourceMappingURL=addon-interface-_pNXcbib.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addon-interface-_pNXcbib.mjs","names":[],"sources":["../src/instrumentation/addon-interface.ts"],"sourcesContent":["/**\n * Native addon interface for extracting debug information from WebAssembly binaries\n *\n * This module wraps Binaryen's C++ API to provide expression-level debug locations\n * and basic block information that the JavaScript API doesn't expose.\n *\n * The native addon outputs raw data (0-based columns, relative paths) which this\n * wrapper transforms into the final BinaryDebugInfo format (1-based columns,\n * absolute paths, grouped by file and position).\n */\n\nimport { createRequire } from 'node:module';\nimport { resolve, dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport type {\n NativeAddon,\n NativeInstrumentationResult,\n NativeDebugInfoOutput,\n NativeFunctionDebugInfo,\n NativeExpressionDebugInfo,\n NativeSourceLocation,\n BinaryDebugInfo,\n FunctionDebugInfo,\n SourceLocation,\n ExpressionDebugInfo,\n InstrumentationResult,\n NativeInstrumentationOptions,\n InstrumentationOptions,\n InstrumentForCoverageFunc,\n} from '../types/types.js';\nimport { POOL_ERROR_NAMES, INTERNAL_PATH_LIB_PREFIX } from '../types/constants.js';\nimport { debug } from '../util/debug.js';\nimport { toForwardSlash } from '../util/path-utils.js';\nimport { createPoolError } from '../util/pool-errors.js';\nimport { getShortFunctionName } from '../wasm-executor/wasm-names.js';\n\n// Load the native addon via node-gyp-build\n// node-gyp-build checks: prebuilds/ first, then build/Release/\n// It searches from the given directory for a package.json to find the package root.\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\nconst rootFromDist = resolve(__dirname, '..');\n// TODO: Verify if this src fallback is still needed — pool always runs from dist/ even locally.\n// If confirmed dead code, remove this and simplify to a single nodeGypBuild call.\nconst rootFromSrc = resolve(__dirname, '../..');\n\nconst require = createRequire(import.meta.url);\nconst nodeGypBuild: (dir: string) => NativeAddon = require('node-gyp-build');\n\nlet addon: NativeAddon;\ntry {\n addon = nodeGypBuild(rootFromDist);\n} catch {\n try {\n addon = nodeGypBuild(rootFromSrc);\n } catch (err) {\n throw createPoolError(\n `vitest-pool-assemblyscript native instrumentation addon not found. Searched from ${rootFromDist} and ${rootFromSrc}. `\n + `Ensure prebuilds are available or run 'node node_modules/vitest-pool-assemblyscript/scripts/install-native-addon.js'`\n + ` to compile from source. Original error: ${err instanceof Error ? err.message : String(err)}`,\n POOL_ERROR_NAMES.WASMInstrumentationError\n );\n }\n}\n\n/**\n * Convert a raw location (0-indexed columns, path indexes) to\n * processed location (1-indexed columns, absolute path strings)\n *\n * Source map paths vary by import style and project structure:\n * - Relative imports: \"assembly/compare.ts\"\n * - Bare package imports: \"~lib/vitest-pool-assemblyscript/assembly/compare.ts\"\n * - Source outside project root: \"../assembly/compare.ts\" (e.g. test-external importing parent sources)\n *\n * All are normalized to absolute filesystem paths for consistent coverage key matching.\n */\nfunction convertLocation(\n rawLocation: NativeSourceLocation,\n debugSourceFiles: string[],\n projectRoot: string\n): SourceLocation {\n let filePath = debugSourceFiles[rawLocation.fileIndex];\n\n if (!filePath) {\n throw createPoolError(\n `No debug source file with index: ${rawLocation.fileIndex}}`,\n POOL_ERROR_NAMES.WASMInstrumentationError\n );\n }\n\n // Normalize to absolute path for consistent coverage key matching\n if (filePath.startsWith(INTERNAL_PATH_LIB_PREFIX)) {\n // ~lib/vitest-pool-assemblyscript/assembly/X.ts -> projectRoot/assembly/X.ts\n const relativePart = filePath.slice(INTERNAL_PATH_LIB_PREFIX.length);\n filePath = toForwardSlash(resolve(projectRoot, 'assembly', relativePart));\n } else {\n // Resolve relative path (handles both 'assembly/X.ts' and '../assembly/X.ts')\n filePath = toForwardSlash(resolve(projectRoot, filePath));\n }\n\n return {\n filePath,\n line: rawLocation.line,\n column: rawLocation.column + 1, // convert from 0-indexed to 1-indexed\n };\n}\n\n/**\n * Convert a raw expression to processed format\n */\nfunction convertExpression(\n rawExpr: NativeExpressionDebugInfo,\n debugSourceFiles: string[],\n projectRoot: string\n): ExpressionDebugInfo {\n const converted: ExpressionDebugInfo = {\n type: rawExpr.type,\n isBranch: rawExpr.isBranch,\n };\n\n if (rawExpr.branchPaths !== undefined) {\n converted.branchPaths = rawExpr.branchPaths;\n }\n\n if (rawExpr.location) {\n const convertedLocation = convertLocation(rawExpr.location, debugSourceFiles, projectRoot);\n if (convertedLocation) {\n converted.location = convertedLocation;\n }\n }\n\n return converted;\n}\n\n/**\n * Generate a position key to identify the SourceLocation uniquely\n * within a file. Does NOT include the file identifier.\n */\nfunction getPositionKey(location: SourceLocation) {\n return `${location.line}:${location.column}`;\n}\n\n/**\n * Convert a raw function to processed format and compute position key\n * Returns undefined if function has no valid representative location\n */\nfunction convertFunction(\n rawFunc: NativeFunctionDebugInfo,\n debugSourceFiles: string[],\n projectRoot: string\n): { func: FunctionDebugInfo; filePath: string; positionKey: string } | undefined {\n const representativeLocation = convertLocation(rawFunc.representativeLocation, debugSourceFiles, projectRoot);\n\n // Convert expressions\n const expressions: ExpressionDebugInfo[] = [];\n if (rawFunc.expressions) {\n for (const expr of rawFunc.expressions) {\n expressions.push(convertExpression(expr, debugSourceFiles, projectRoot));\n }\n }\n\n const converted: FunctionDebugInfo = {\n wasmIndex: rawFunc.wasmIndex,\n name: rawFunc.name,\n representativeLocation,\n coverageMemoryIndex: rawFunc.coverageMemoryIndex,\n expressions,\n basicBlocks: rawFunc.basicBlocks,\n };\n\n const filePath = representativeLocation.filePath;\n const positionKey = getPositionKey(representativeLocation);\n\n return { func: converted, filePath, positionKey };\n}\n\n/**\n * Check if two WASM function names are monomorphizations of the same generic function.\n * Generic monomorphizations share the same base name and suffix, differing only in\n * the type parameters inside angle brackets.\n *\n * e.g. \"assembly/compare/closeTo<bool\\2cbool>\" and \"assembly/compare/closeTo<bool\\2cu8>\"\n * e.g. \"assembly/expect/BaseExpectMatcher<bool>#constructor\" and \"assembly/expect/BaseExpectMatcher<i8>#constructor\"\n */\nfunction isGenericMonomorphizationMatch(nameA: string, nameB: string): boolean {\n const openA = nameA.indexOf('<');\n const openB = nameB.indexOf('<');\n\n // Both must contain generic type parameters\n if (openA === -1 || openB === -1) return false;\n\n const lastCloseA = nameA.lastIndexOf('>');\n const lastCloseB = nameB.lastIndexOf('>');\n\n if (lastCloseA === -1 || lastCloseB === -1) return false;\n\n // Prefix before '<' must match (includes module path, class, function name)\n const prefixA = nameA.substring(0, openA);\n const prefixB = nameB.substring(0, openB);\n if (prefixA !== prefixB) return false;\n\n // Suffix after last '>' must match (e.g. \"#constructor\", or empty)\n const suffixA = nameA.substring(lastCloseA + 1);\n const suffixB = nameB.substring(lastCloseB + 1);\n if (suffixA !== suffixB) return false;\n\n return true;\n}\n\n/**\n * Transform raw native addon output to processed BinaryDebugInfo\n */\nfunction transformDebugInfo(\n raw: NativeDebugInfoOutput,\n logPrefix: string,\n projectRoot: string,\n): BinaryDebugInfo {\n const functionsByFileAndPosition: Record<string, Record<string, FunctionDebugInfo[]>> = {};\n\n debug(`${logPrefix} - Converting ${raw.functions.length} functions`);\n\n let genericCollisionCount = 0;\n let skippedCount = 0;\n let instrumentedFunctionCount = 0;\n\n for (const rawFunc of raw.functions) {\n const result = convertFunction(rawFunc, raw.debugSourceFiles, projectRoot);\n if (!result) {\n debug(`${logPrefix} - WARNING: Skipped function (bad conversion): \"${rawFunc.name}\"`);\n skippedCount++;\n continue;\n }\n\n const { func, filePath, positionKey } = result;\n\n // Check for position collisions\n const existingAtPosition = functionsByFileAndPosition[filePath]?.[positionKey];\n if (existingAtPosition) {\n const existingName = existingAtPosition[0]!.name;\n\n // Only allow collision if both are monomorphizations of the same generic\n if (isGenericMonomorphizationMatch(existingName, func.name)) {\n existingAtPosition.push(func);\n genericCollisionCount++;\n instrumentedFunctionCount++;\n debug(\n `${logPrefix} - Generic monomorphization at ${filePath}:${positionKey}:`\n + ` \"${getShortFunctionName(func.name)}\" grouped with \"${getShortFunctionName(existingName)}\"`\n );\n continue;\n }\n\n throw createPoolError(\n `ERROR - Function Debug Position Collision at ${filePath}:${positionKey}: \"${getShortFunctionName(existingName)}\"`\n + ` will be replaced by \"${getShortFunctionName(func.name)}\". This is a bug. Please report it at:`\n + ` https://github.com/themattspiral/vitest-pool-assemblyscript/issues/new`,\n POOL_ERROR_NAMES.WASMInstrumentationError\n );\n }\n\n instrumentedFunctionCount++;\n\n // Group by file and position\n if (!functionsByFileAndPosition[filePath]) {\n functionsByFileAndPosition[filePath] = {};\n }\n\n functionsByFileAndPosition[filePath][positionKey] = [func];\n }\n\n debug(\n `${logPrefix} - BinaryDebugInfo transform complete: ${instrumentedFunctionCount} instrumented functions`\n + ` (${genericCollisionCount} generic collisions, ${skippedCount} skipped)`\n );\n\n return {\n debugSourceFiles: raw.debugSourceFiles,\n functionsByFileAndPosition,\n instrumentedFunctionCount,\n };\n}\n\n/**\n * Instrument a WASM binary for coverage collection and regenerate source map\n *\n * This function:\n * 1. Adds __coverage_memory import (multi-memory for coverage counters)\n * 2. Injects coverage counter increments at each function entry\n * 3. Regenerates source map with correct offsets after instrumentation\n * 4. Extracts debug info with coverageMemoryIndex assigned\n *\n * @param wasmBuffer - Buffer containing the clean WASM binary\n * @param sourceMapBuffer - Buffer containing the source map JSON\n * @returns Instrumented binary, regenerated source map, and debug info\n *\n * @throws {TypeError} If wasmBuffer or sourceMapBuffer are not Buffers\n * @throws {Error} If WASM binary or source map is invalid\n */\nexport const instrumentForCoverage: InstrumentForCoverageFunc = (\n wasmBuffer: Buffer,\n sourceMapBuffer: Buffer,\n instrumentationOptions: InstrumentationOptions,\n logModule: string,\n logLabel: string,\n): InstrumentationResult => {\n if (!Buffer.isBuffer(wasmBuffer)) {\n throw createPoolError(\n 'instrumentForCoverage - wasmBuffer must be a Buffer',\n POOL_ERROR_NAMES.WASMInstrumentationError\n );\n }\n if (!Buffer.isBuffer(sourceMapBuffer)) {\n throw createPoolError(\n 'instrumentForCoverage - sourceMapBuffer must be a Buffer',\n POOL_ERROR_NAMES.WASMInstrumentationError\n );\n }\n\n const interfaceLogPrefix = `[${logModule} Inst] ${logLabel}`;\n const nativeLogPrefix = `[${logModule} InstNative] ${logLabel}`;\n\n debug(`${interfaceLogPrefix} - Calling native instrumentForCoverage`);\n const startTime = performance.now();\n\n const options: NativeInstrumentationOptions = {\n coverageMemoryPagesMin: instrumentationOptions.coverageMemoryPagesMin,\n coverageMemoryPagesMax: instrumentationOptions.coverageMemoryPagesMax,\n excludedFiles: instrumentationOptions.relativeExcludedFiles,\n excludedLibraryFilePrefix: instrumentationOptions.excludedLibraryFilePrefix,\n excludedLibraryFileOverridePrefix: instrumentationOptions.excludedLibraryFileOverridePrefix,\n debug: instrumentationOptions.debug,\n logPrefix: nativeLogPrefix\n };\n const nativeResult: NativeInstrumentationResult = addon.instrumentForCoverage(wasmBuffer, sourceMapBuffer, options);\n const addonTime = performance.now();\n debug(`${interfaceLogPrefix} - TIMING Native addon: ${(addonTime - startTime).toFixed(2)} ms`);\n\n if (nativeResult.errors?.length) {\n throw createPoolError(\n `Errors encountered duriing native instrumentation: ${nativeResult.errors.join('\\n')}`,\n POOL_ERROR_NAMES.WASMInstrumentationError,\n );\n }\n\n const debugInfo = transformDebugInfo(nativeResult.debugInfo, interfaceLogPrefix, instrumentationOptions.projectRoot);\n \n const transformTime = performance.now();\n debug(`${interfaceLogPrefix} - TIMING DebugInfo Transform: ${(transformTime - addonTime).toFixed(2)} ms`);\n debug(`${interfaceLogPrefix} - Binary size: ${nativeResult.instrumentedWasm.length} bytes | Source map size: ${nativeResult.sourceMap.length * 2} bytes`);\n\n return {\n instrumentedWasm: nativeResult.instrumentedWasm,\n sourceMap: nativeResult.sourceMap,\n debugInfo,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAyCA,MAAM,YAAY,QADC,cAAc,OAAO,KAAK,IAAI,CACZ;AACrC,MAAM,eAAe,QAAQ,WAAW,KAAK;AAG7C,MAAM,cAAc,QAAQ,WAAW,QAAQ;AAG/C,MAAM,eADU,cAAc,OAAO,KAAK,IAAI,CACa,iBAAiB;AAE5E,IAAI;AACJ,IAAI;AACF,SAAQ,aAAa,aAAa;QAC5B;AACN,KAAI;AACF,UAAQ,aAAa,YAAY;UAC1B,KAAK;AACZ,QAAM,gBACJ,oFAAoF,aAAa,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AACzG,OAAM,GAAG,mBAAmB,kBAAkB,aAAa,iBAAiB,OAAO,4BAA4B,aAAa,UAAU,SAAS,EAAE,QAAQ;AAEzJ,QAAO;EACL,kBAAkB,aAAa;EAC/B,WAAW,aAAa;EACxB;EACD"}
@@ -4,7 +4,7 @@ import { toForwardSlash } from "./path-utils-t9OzjXYF.mjs";
4
4
  import { failFile, getFullTaskHierarchy, prepareFileTaskForCollection } from "./vitest-file-tasks-Bn9CrWt_.mjs";
5
5
  import { getTaskLogLabel, getTaskLogPrefix } from "./vitest-tasks--ow4pacR.mjs";
6
6
  import { executeWASMDiscovery, flushRpcUpdates, reportFileCollected, reportFileError, reportFileQueued, reportUserConsoleLogs } from "./load-user-imports-B3Iy_K8k.mjs";
7
- import { compileAssemblyScript } from "./compiler-YMrl5MY_.mjs";
7
+ import { compileAssemblyScript } from "./compiler-CIXpfKq0.mjs";
8
8
  import { basename, relative } from "node:path";
9
9
 
10
10
  //#region src/pool-thread/runner/compile-runner.ts
@@ -81,4 +81,4 @@ async function runCompileAndDiscover(file, logModule, rpc, poolOptions, projectR
81
81
 
82
82
  //#endregion
83
83
  export { runCompileAndDiscover };
84
- //# sourceMappingURL=compile-runner-C-05LdGX.mjs.map
84
+ //# sourceMappingURL=compile-runner-DOMhsLQE.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"compile-runner-C-05LdGX.mjs","names":[],"sources":["../src/pool-thread/runner/compile-runner.ts"],"sourcesContent":["/**\n * Worker thread test runner logic for AssemblyScript Pool\n */\n\nimport { basename, relative } from 'node:path';\nimport type { File } from '@vitest/runner/types';\nimport type { SerializedDiffOptions } from '@vitest/utils/diff';\n\nimport { toForwardSlash } from '../../util/path-utils.js';\n\nimport type {\n AssemblyScriptCompilerOptions,\n AssemblyScriptConsoleLog,\n AssemblyScriptConsoleLogHandler,\n InstrumentationOptions,\n ResolvedAssemblyScriptPoolOptions,\n ThreadImports,\n WASMCompilation,\n WorkerRPC,\n} from '../../types/types.js';\nimport {\n ASSEMBLYSCRIPT_LIB_PREFIX,\n INTERNAL_PATH_LIB_PREFIX,\n POOL_ERROR_NAMES,\n POOL_INTERNAL_PATHS,\n} from '../../types/constants.js';\nimport { executeWASMDiscovery } from '../../wasm-executor/index.js';\nimport { debug } from '../../util/debug.js';\nimport {\n reportFileQueued,\n reportFileCollected,\n reportUserConsoleLogs,\n flushRpcUpdates,\n reportFileError,\n} from '../rpc-reporter.js';\nimport { createPoolErrorFromAnyError, getTestErrorFromPoolError } from '../../util/pool-errors.js';\nimport { compileAssemblyScript } from '../../compiler/index.js';\nimport {\n getTaskLogLabel,\n getTaskLogPrefix,\n} from '../../util/vitest-tasks.js';\nimport {\n failFile,\n getFullTaskHierarchy,\n prepareFileTaskForCollection,\n} from '../../util/vitest-file-tasks.js';\n\nlet threadCompilationCount: number = 0;\n\nexport async function runCompileAndDiscover(\n file: File,\n logModule: string,\n rpc: WorkerRPC,\n poolOptions: ResolvedAssemblyScriptPoolOptions,\n projectRoot: string,\n collectCoverage: boolean,\n relativeUserCoverageExclusions: string[],\n threadImports: ThreadImports,\n diffOptions?: SerializedDiffOptions,\n testNamePattern?: RegExp,\n allowOnly?: boolean,\n): Promise<WASMCompilation | undefined> {\n const base = basename(file.filepath);\n const fileLogPrefix = getTaskLogPrefix(logModule, base, file);\n const fileLogLabel = getTaskLogLabel(base, file);\n\n debug(`${fileLogPrefix} - Beginning runCompileAndDiscover for \"${file.filepath}\" at ${Date.now()}`);\n\n const runStart = performance.now();\n let compilation: WASMCompilation | undefined;\n\n try {\n await reportFileQueued(rpc, file, logModule, fileLogLabel);\n\n const relativeTestFilePath = toForwardSlash(relative(projectRoot, file.filepath));\n const instrumentationOptions: InstrumentationOptions = {\n projectRoot,\n relativeExcludedFiles: [\n relativeTestFilePath,\n ...(poolOptions._instrumentPoolInternals ? [] : POOL_INTERNAL_PATHS),\n ...relativeUserCoverageExclusions,\n ],\n excludedLibraryFilePrefix: ASSEMBLYSCRIPT_LIB_PREFIX,\n excludedLibraryFileOverridePrefix: poolOptions._instrumentPoolInternals ? INTERNAL_PATH_LIB_PREFIX : undefined,\n coverageMemoryPagesMin: poolOptions.coverageMemoryPagesInitial,\n coverageMemoryPagesMax: poolOptions.coverageMemoryPagesMax,\n debug: poolOptions.debugNative,\n };\n const compilerOptions: AssemblyScriptCompilerOptions = {\n stripInline: poolOptions.stripInline,\n projectRoot: projectRoot,\n shouldInstrument: collectCoverage,\n instrumentationOptions,\n extraFlags: poolOptions.extraCompilerFlags\n };\n\n const { binary, sourceMap, debugInfo, compileTiming } = await compileAssemblyScript(\n file.filepath,\n compilerOptions,\n logModule,\n fileLogLabel\n );\n file.setupDuration = compileTiming;\n threadCompilationCount++;\n\n debug(`${fileLogPrefix} - TIMING compileAssemblyScript total `\n + `(thread comp # ${threadCompilationCount}): ${compileTiming.toFixed(2)} ms`\n );\n \n const logMessages: AssemblyScriptConsoleLog[] = [];\n const handleLog: AssemblyScriptConsoleLogHandler = (msg: string, isError: boolean = false): void => {\n logMessages.push({ msg, time: Date.now(), isError });\n };\n \n const discoverStart = performance.now();\n\n await executeWASMDiscovery(\n binary,\n sourceMap,\n base,\n poolOptions,\n collectCoverage,\n handleLog,\n file,\n logModule,\n threadImports,\n diffOptions\n );\n\n // set skips when using only and/or user test name pattern, skip file task if all tests skipped\n prepareFileTaskForCollection(file, testNamePattern, allowOnly);\n\n file.collectDuration = performance.now() - discoverStart;\n debug(`${fileLogPrefix} - TIMING Discovery Phase: ${file.collectDuration.toFixed(2)} ms`);\n\n // vitest collect - report discovery results\n await Promise.all([\n // Report user console logs\n reportUserConsoleLogs(rpc, logMessages, logModule, base, file),\n\n // Report onCollected with collected and filtered tasks\n reportFileCollected(rpc, file, logModule, fileLogLabel),\n ]);\n\n debug(() => `${fileLogPrefix} - Collected Test Suite Hierarchy:\\n${getFullTaskHierarchy(file)}`);\n\n const totalTime = performance.now() - runStart;\n debug(`${fileLogPrefix} - TIMING Compilation and Discovery: ${totalTime.toFixed(2)} ms`);\n\n compilation = {\n filePath: file.filepath,\n binary,\n sourceMap,\n debugInfo,\n };\n } catch (error) {\n const poolError = createPoolErrorFromAnyError(\n `${fileLogLabel} - runCompileAndDiscover failure in worker`,\n POOL_ERROR_NAMES.WASMExecutionHarnessError,\n error\n );\n const testError = getTestErrorFromPoolError(poolError);\n\n failFile(file, testError, runStart);\n\n await reportFileQueued(rpc, file, logModule, fileLogLabel);\n await reportFileError(rpc, file, logModule, fileLogLabel);\n\n debug(`${fileLogPrefix} - Reported file error`);\n } finally {\n await flushRpcUpdates(rpc);\n debug(`${fileLogPrefix} - runCompileAndDiscover Completed`);\n }\n\n return compilation;\n}\n"],"mappings":";;;;;;;;;;;;;AA+CA,IAAI,yBAAiC;AAErC,eAAsB,sBACpB,MACA,WACA,KACA,aACA,aACA,iBACA,gCACA,eACA,aACA,iBACA,WACsC;CACtC,MAAM,OAAO,SAAS,KAAK,SAAS;CACpC,MAAM,gBAAgB,iBAAiB,WAAW,MAAM,KAAK;CAC7D,MAAM,eAAe,gBAAgB,MAAM,KAAK;AAEhD,OAAM,GAAG,cAAc,0CAA0C,KAAK,SAAS,OAAO,KAAK,KAAK,GAAG;CAEnG,MAAM,WAAW,YAAY,KAAK;CAClC,IAAI;AAEJ,KAAI;AACF,QAAM,iBAAiB,KAAK,MAAM,WAAW,aAAa;EAG1D,MAAM,yBAAiD;GACrD;GACA,uBAAuB;IAHI,eAAe,SAAS,aAAa,KAAK,SAAS,CAAC;IAK7E,GAAI,YAAY,2BAA2B,EAAE,GAAG;IAChD,GAAG;IACJ;GACD;GACA,mCAAmC,YAAY,2BAA2B,2BAA2B;GACrG,wBAAwB,YAAY;GACpC,wBAAwB,YAAY;GACpC,OAAO,YAAY;GACpB;EACD,MAAM,kBAAiD;GACrD,aAAa,YAAY;GACZ;GACb,kBAAkB;GAClB;GACA,YAAY,YAAY;GACzB;EAED,MAAM,EAAE,QAAQ,WAAW,WAAW,kBAAkB,MAAM,sBAC5D,KAAK,UACL,iBACA,WACA,aACD;AACD,OAAK,gBAAgB;AACrB;AAEA,QAAM,GAAG,cAAc,uDACD,uBAAuB,KAAK,cAAc,QAAQ,EAAE,CAAC,KAC1E;EAED,MAAM,cAA0C,EAAE;EAClD,MAAM,aAA8C,KAAa,UAAmB,UAAgB;AAClG,eAAY,KAAK;IAAE;IAAK,MAAM,KAAK,KAAK;IAAE;IAAS,CAAC;;EAGtD,MAAM,gBAAgB,YAAY,KAAK;AAEvC,QAAM,qBACJ,QACA,WACA,MACA,aACA,iBACA,WACA,MACA,WACA,eACA,YACD;AAGD,+BAA6B,MAAM,iBAAiB,UAAU;AAE9D,OAAK,kBAAkB,YAAY,KAAK,GAAG;AAC3C,QAAM,GAAG,cAAc,6BAA6B,KAAK,gBAAgB,QAAQ,EAAE,CAAC,KAAK;AAGzF,QAAM,QAAQ,IAAI,CAEhB,sBAAsB,KAAK,aAAa,WAAW,MAAM,KAAK,EAG9D,oBAAoB,KAAK,MAAM,WAAW,aAAa,CACxD,CAAC;AAEF,cAAY,GAAG,cAAc,sCAAsC,qBAAqB,KAAK,GAAG;AAGhG,QAAM,GAAG,cAAc,wCADL,YAAY,KAAK,GAAG,UACkC,QAAQ,EAAE,CAAC,KAAK;AAExF,gBAAc;GACZ,UAAU,KAAK;GACf;GACA;GACA;GACD;UACM,OAAO;AAQd,WAAS,MAFS,0BALA,4BAChB,GAAG,aAAa,6CAChB,iBAAiB,2BACjB,MACD,CACqD,EAE5B,SAAS;AAEnC,QAAM,iBAAiB,KAAK,MAAM,WAAW,aAAa;AAC1D,QAAM,gBAAgB,KAAK,MAAM,WAAW,aAAa;AAEzD,QAAM,GAAG,cAAc,wBAAwB;WACvC;AACR,QAAM,gBAAgB,IAAI;AAC1B,QAAM,GAAG,cAAc,oCAAoC;;AAG7D,QAAO"}
1
+ {"version":3,"file":"compile-runner-DOMhsLQE.mjs","names":[],"sources":["../src/pool-thread/runner/compile-runner.ts"],"sourcesContent":["/**\n * Worker thread test runner logic for AssemblyScript Pool\n */\n\nimport { basename, relative } from 'node:path';\nimport type { File } from '@vitest/runner/types';\nimport type { SerializedDiffOptions } from '@vitest/utils/diff';\n\nimport { toForwardSlash } from '../../util/path-utils.js';\n\nimport type {\n AssemblyScriptCompilerOptions,\n AssemblyScriptConsoleLog,\n AssemblyScriptConsoleLogHandler,\n InstrumentationOptions,\n ResolvedAssemblyScriptPoolOptions,\n ThreadImports,\n WASMCompilation,\n WorkerRPC,\n} from '../../types/types.js';\nimport {\n ASSEMBLYSCRIPT_LIB_PREFIX,\n INTERNAL_PATH_LIB_PREFIX,\n POOL_ERROR_NAMES,\n POOL_INTERNAL_PATHS,\n} from '../../types/constants.js';\nimport { executeWASMDiscovery } from '../../wasm-executor/index.js';\nimport { debug } from '../../util/debug.js';\nimport {\n reportFileQueued,\n reportFileCollected,\n reportUserConsoleLogs,\n flushRpcUpdates,\n reportFileError,\n} from '../rpc-reporter.js';\nimport { createPoolErrorFromAnyError, getTestErrorFromPoolError } from '../../util/pool-errors.js';\nimport { compileAssemblyScript } from '../../compiler/index.js';\nimport {\n getTaskLogLabel,\n getTaskLogPrefix,\n} from '../../util/vitest-tasks.js';\nimport {\n failFile,\n getFullTaskHierarchy,\n prepareFileTaskForCollection,\n} from '../../util/vitest-file-tasks.js';\n\nlet threadCompilationCount: number = 0;\n\nexport async function runCompileAndDiscover(\n file: File,\n logModule: string,\n rpc: WorkerRPC,\n poolOptions: ResolvedAssemblyScriptPoolOptions,\n projectRoot: string,\n collectCoverage: boolean,\n relativeUserCoverageExclusions: string[],\n threadImports: ThreadImports,\n diffOptions?: SerializedDiffOptions,\n testNamePattern?: RegExp,\n allowOnly?: boolean,\n): Promise<WASMCompilation | undefined> {\n const base = basename(file.filepath);\n const fileLogPrefix = getTaskLogPrefix(logModule, base, file);\n const fileLogLabel = getTaskLogLabel(base, file);\n\n debug(`${fileLogPrefix} - Beginning runCompileAndDiscover for \"${file.filepath}\" at ${Date.now()}`);\n\n const runStart = performance.now();\n let compilation: WASMCompilation | undefined;\n\n try {\n await reportFileQueued(rpc, file, logModule, fileLogLabel);\n\n const relativeTestFilePath = toForwardSlash(relative(projectRoot, file.filepath));\n const instrumentationOptions: InstrumentationOptions = {\n projectRoot,\n relativeExcludedFiles: [\n relativeTestFilePath,\n ...(poolOptions._instrumentPoolInternals ? [] : POOL_INTERNAL_PATHS),\n ...relativeUserCoverageExclusions,\n ],\n excludedLibraryFilePrefix: ASSEMBLYSCRIPT_LIB_PREFIX,\n excludedLibraryFileOverridePrefix: poolOptions._instrumentPoolInternals ? INTERNAL_PATH_LIB_PREFIX : undefined,\n coverageMemoryPagesMin: poolOptions.coverageMemoryPagesInitial,\n coverageMemoryPagesMax: poolOptions.coverageMemoryPagesMax,\n debug: poolOptions.debugNative,\n };\n const compilerOptions: AssemblyScriptCompilerOptions = {\n stripInline: poolOptions.stripInline,\n projectRoot: projectRoot,\n shouldInstrument: collectCoverage,\n instrumentationOptions,\n extraFlags: poolOptions.extraCompilerFlags\n };\n\n const { binary, sourceMap, debugInfo, compileTiming } = await compileAssemblyScript(\n file.filepath,\n compilerOptions,\n logModule,\n fileLogLabel\n );\n file.setupDuration = compileTiming;\n threadCompilationCount++;\n\n debug(`${fileLogPrefix} - TIMING compileAssemblyScript total `\n + `(thread comp # ${threadCompilationCount}): ${compileTiming.toFixed(2)} ms`\n );\n \n const logMessages: AssemblyScriptConsoleLog[] = [];\n const handleLog: AssemblyScriptConsoleLogHandler = (msg: string, isError: boolean = false): void => {\n logMessages.push({ msg, time: Date.now(), isError });\n };\n \n const discoverStart = performance.now();\n\n await executeWASMDiscovery(\n binary,\n sourceMap,\n base,\n poolOptions,\n collectCoverage,\n handleLog,\n file,\n logModule,\n threadImports,\n diffOptions\n );\n\n // set skips when using only and/or user test name pattern, skip file task if all tests skipped\n prepareFileTaskForCollection(file, testNamePattern, allowOnly);\n\n file.collectDuration = performance.now() - discoverStart;\n debug(`${fileLogPrefix} - TIMING Discovery Phase: ${file.collectDuration.toFixed(2)} ms`);\n\n // vitest collect - report discovery results\n await Promise.all([\n // Report user console logs\n reportUserConsoleLogs(rpc, logMessages, logModule, base, file),\n\n // Report onCollected with collected and filtered tasks\n reportFileCollected(rpc, file, logModule, fileLogLabel),\n ]);\n\n debug(() => `${fileLogPrefix} - Collected Test Suite Hierarchy:\\n${getFullTaskHierarchy(file)}`);\n\n const totalTime = performance.now() - runStart;\n debug(`${fileLogPrefix} - TIMING Compilation and Discovery: ${totalTime.toFixed(2)} ms`);\n\n compilation = {\n filePath: file.filepath,\n binary,\n sourceMap,\n debugInfo,\n };\n } catch (error) {\n const poolError = createPoolErrorFromAnyError(\n `${fileLogLabel} - runCompileAndDiscover failure in worker`,\n POOL_ERROR_NAMES.WASMExecutionHarnessError,\n error\n );\n const testError = getTestErrorFromPoolError(poolError);\n\n failFile(file, testError, runStart);\n\n await reportFileQueued(rpc, file, logModule, fileLogLabel);\n await reportFileError(rpc, file, logModule, fileLogLabel);\n\n debug(`${fileLogPrefix} - Reported file error`);\n } finally {\n await flushRpcUpdates(rpc);\n debug(`${fileLogPrefix} - runCompileAndDiscover Completed`);\n }\n\n return compilation;\n}\n"],"mappings":";;;;;;;;;;;;;AA+CA,IAAI,yBAAiC;AAErC,eAAsB,sBACpB,MACA,WACA,KACA,aACA,aACA,iBACA,gCACA,eACA,aACA,iBACA,WACsC;CACtC,MAAM,OAAO,SAAS,KAAK,SAAS;CACpC,MAAM,gBAAgB,iBAAiB,WAAW,MAAM,KAAK;CAC7D,MAAM,eAAe,gBAAgB,MAAM,KAAK;AAEhD,OAAM,GAAG,cAAc,0CAA0C,KAAK,SAAS,OAAO,KAAK,KAAK,GAAG;CAEnG,MAAM,WAAW,YAAY,KAAK;CAClC,IAAI;AAEJ,KAAI;AACF,QAAM,iBAAiB,KAAK,MAAM,WAAW,aAAa;EAG1D,MAAM,yBAAiD;GACrD;GACA,uBAAuB;IAHI,eAAe,SAAS,aAAa,KAAK,SAAS,CAAC;IAK7E,GAAI,YAAY,2BAA2B,EAAE,GAAG;IAChD,GAAG;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AM,gBAAgB,KAAK,MAAM,WAAW,aAAa;AAEzD,QAAM,GAAG,cAAc,wBAAwB;WACvC;AACR,QAAM,gBAAgB,IAAI;AAC1B,QAAM,GAAG,cAAc,oCAAoC;;AAG7D,QAAO"}
@@ -1,6 +1,6 @@
1
1
  import { POOL_ERROR_NAMES } from "./constants-DuBLuMjt.mjs";
2
2
  import { createPoolError, debug, throwPoolErrorIfAborted } from "./debug-Cm1VFmaz.mjs";
3
- import { clearNativeBuildError, hasNativeBuildError, warnASInstrumentationNotLoaded } from "./feature-check-CNyjFX9M.mjs";
3
+ import { clearNativeBuildError, hasNativeBuildError, warnASInstrumentationNotLoaded } from "./feature-check-ELxw_Mji.mjs";
4
4
  import { basename, resolve } from "node:path";
5
5
  import { access, readFile } from "node:fs/promises";
6
6
  import { main } from "assemblyscript/asc";
@@ -14,7 +14,7 @@ import { main } from "assemblyscript/asc";
14
14
  */
15
15
  let nativeAddon;
16
16
  try {
17
- nativeAddon = await import("./addon-interface-7FPjYh7J.mjs");
17
+ nativeAddon = await import("./addon-interface-_pNXcbib.mjs");
18
18
  clearNativeBuildError();
19
19
  } catch (err) {
20
20
  if (await hasNativeBuildError()) debug(`[Compiler] Native instrumentation addon not loaded (known build failure): ${err?.message ?? String(err)}`);
@@ -144,4 +144,4 @@ async function compileAssemblyScript(filename, options, logModule, logLabel, sig
144
144
 
145
145
  //#endregion
146
146
  export { compileAssemblyScript };
147
- //# sourceMappingURL=compiler-YMrl5MY_.mjs.map
147
+ //# sourceMappingURL=compiler-CIXpfKq0.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"compiler-YMrl5MY_.mjs","names":["ascMain"],"sources":["../src/compiler/index.ts"],"sourcesContent":["/**\n * AssemblyScript Compiler\n *\n * Handles compilation of AssemblyScript source code to WASM binaries.\n * Manages compiler options, transforms, and in-memory compilation.\n */\n\nimport { main as ascMain } from 'assemblyscript/asc';\nimport { basename, resolve } from 'node:path';\nimport { access, readFile, writeFile, mkdir } from 'node:fs/promises';\n\nimport type {\n AssemblyScriptCompilerResult,\n AssemblyScriptCompilerOptions,\n NativeAddonInterface\n} from '../types/types.js';\nimport { POOL_ERROR_NAMES } from '../types/constants.js';\nimport { debug } from '../util/debug.js';\nimport { createPoolError, throwPoolErrorIfAborted } from '../util/pool-errors.js';\nimport { clearNativeBuildError, hasNativeBuildError, warnASInstrumentationNotLoaded } from '../util/feature-check.js';\n\nlet nativeAddon: NativeAddonInterface | undefined;\ntry {\n nativeAddon = await import('../instrumentation/addon-interface.js');\n // Addon loaded successfully — clear any stale build error marker (fire and forget)\n clearNativeBuildError();\n} catch (err: any) {\n const knownBuildFailure = await hasNativeBuildError();\n if (knownBuildFailure) {\n // Marker file exists — coverage provider will warn the user, just debug log here\n debug(`[Compiler] Native instrumentation addon not loaded (known build failure): ${err?.message ?? String(err)}`);\n } else {\n // Unexpected failure — no marker file, warn the user\n warnASInstrumentationNotLoaded(err?.message ?? String(err));\n }\n}\n\nconst DEBUG_WRITE_FILES = false;\n\n// Path prefix the AS compiler uses when resolving bare `vitest-pool-assemblyscript/assembly` imports\n// via node_modules. Used to detect self-imports and redirect to local assembly/ dir when running in-tree.\nconst POOL_ASSEMBLY_NODE_MODULES_PREFIX = 'node_modules/vitest-pool-assemblyscript/assembly/';\n\n// path assumes that we're running from dist/\nconst STRIP_INLINE_TRANSFORM = resolve(import.meta.dirname, './compiler/transforms/strip-inline.mjs');\n\nsetImmediate(async () => {\n try {\n await access(STRIP_INLINE_TRANSFORM);\n } catch {\n throw createPoolError(\n `AS Compiler strip inline transform file not found at \"${STRIP_INLINE_TRANSFORM}\"`,\n POOL_ERROR_NAMES.CompilationError\n );\n }\n});\n\n/**\n * Compile AssemblyScript source code to WASM binary\n */\nexport async function compileAssemblyScript(\n filename: string,\n options: AssemblyScriptCompilerOptions,\n logModule: string,\n logLabel: string,\n signal?: AbortSignal\n): Promise<AssemblyScriptCompilerResult> {\n throwPoolErrorIfAborted(signal);\n\n const compileStart = performance.now();\n const logPrefix = `[${logModule} ASC] ${logLabel}`;\n\n const { shouldInstrument, instrumentationOptions, extraFlags } = options;\n\n if (shouldInstrument && !instrumentationOptions) {\n throw createPoolError(\n 'Instrumentation options are required for coverage instrumentation',\n POOL_ERROR_NAMES.CompilationError\n );\n }\n\n const stdoutLines: string[] = [];\n const stderrLines: string[] = [];\n let binary: Uint8Array | undefined;\n let sourceMap: string | undefined;\n\n // Use full path as entry file so AS compiler can resolve relative imports\n const entryFile = filename;\n // Use simple output name to avoid AS compiler prepending it to source map paths\n const outputFile = 'output.wasm';\n\n debug(`${logPrefix} - Compiling: \"${filename}\"`);\n\n // Capture stdout/stderr (for potential error reporting)\n const stdout = {\n write: (text: string) => {\n stdoutLines.push(text);\n return true;\n }\n };\n\n const stderr = {\n write: (text: string) => {\n stderrLines.push(text);\n return true;\n }\n };\n\n // Build compiler flags\n const compilerFlags = [\n entryFile,\n\n // overrideable, though not recommended\n '--optimizeLevel', '0', // No optimization for easier debugging\n '--shrinkLevel', '0', // No shrink\n '--runtime', 'stub', // stub runtime (no GC)\n\n ...(extraFlags || []),\n\n // non-overrideable\n '--outFile', outputFile,\n '--importMemory', // Import memory from JS (enables imports during WASM start)\n '--debug', // Include debug info\n '--sourceMap', // Generate source maps for error reporting\n '--exportStart', '_start', // Export start function for explicit initialization control\n '--exportTable' // Export function table for direct test execution\n ];\n\n // Add transform to strip @inline decorators if requested\n // This improves coverage accuracy by preventing functions from being inlined,\n // and enables correct source-mapped error reporting for errors originating\n // inside inlined functions.\n if (options.stripInline === true) {\n compilerFlags.push(\n '--transform', STRIP_INLINE_TRANSFORM\n );\n debug(`${logPrefix} - Added Transform - Stripping @inline decorators`);\n }\n\n // Compile with AssemblyScript compiler\n const ascStart = performance.now();\n const result = await ascMain(compilerFlags, {\n stdout,\n stderr,\n // Let AS read from filesystem for import resolution\n // WASM binary and source map are captured in memory via writeFile callback\n writeFile: (name: string, contents: string | Uint8Array, _baseDir: string) => {\n throwPoolErrorIfAborted(signal);\n\n if (name.endsWith('.wasm') && contents instanceof Uint8Array) {\n binary = contents;\n debug(`${logPrefix} - Captured binary in memory: \"${name}\"`);\n } else if (name.endsWith('.wasm.map') && typeof contents === 'string') {\n debug(`${logPrefix} - Captured source map in memory: \"${name}\"`);\n sourceMap = contents;\n } else {\n debug(`${logPrefix} - WARNING - Captured Unexpected File: \"${name}\" at baseDir: \"${_baseDir}\"`);\n }\n },\n \n // Custom readFile enables in-tree resolution of bare pool assembly imports.\n // When a test file imports 'vitest-pool-assemblyscript/assembly', the AS compiler\n // resolves it to a node_modules path. This works when the package is installed,\n // but fails in-tree (the package isn't in its own node_modules). The fallback\n // redirects these to the local assembly/ directory when the normal path isn't found.\n readFile: async (filename, baseDir): Promise<string | null> => {\n const filePath = resolve(baseDir, filename);\n\n try {\n return await readFile(filePath, { encoding: 'utf-8' });\n } catch {\n // Fallback: when running in-tree, redirect pool assembly imports to local assembly/ dir\n if (filename.startsWith(POOL_ASSEMBLY_NODE_MODULES_PREFIX)) {\n const localSubpath = filename.substring(POOL_ASSEMBLY_NODE_MODULES_PREFIX.length);\n const localPath = resolve(baseDir, 'assembly', localSubpath);\n\n try {\n return await readFile(localPath, { encoding: 'utf-8' });\n } catch {\n return null;\n }\n }\n\n return null;\n }\n },\n });\n\n debug(`${logPrefix} - TIMING asc.main: ${(performance.now() - ascStart).toFixed(2)} ms`);\n\n if (result.error) {\n const errorMessage = stderrLines.length > 0\n ? `${result.error.message}\\n\\n${stderrLines.join('')}`\n : result.error.message;\n\n throw createPoolError(errorMessage, POOL_ERROR_NAMES.CompilationError, errorMessage);\n }\n\n if (!binary) {\n const errorMessage = stderrLines.length > 0\n ? `No WASM binary was generated\\n\\nAS Compiler output:\\n${stderrLines.join('')}`\n : 'No WASM binary was generated';\n\n throw createPoolError(errorMessage, POOL_ERROR_NAMES.CompilationError);\n }\n\n if (!sourceMap) {\n throw createPoolError('Source map not captured from AssemblyScript Compiler', POOL_ERROR_NAMES.CompilationError);\n }\n\n const cleanBinary: Uint8Array = binary;\n const wasmSourceMap: string = sourceMap;\n\n debug(`${logPrefix} - Compilation successful, clean binary size: ${cleanBinary.length} bytes`);\n debug(`${logPrefix} - Source map generated, size: ${wasmSourceMap.length * 2} bytes`);\n \n if (DEBUG_WRITE_FILES) {\n // Write source map for debugging\n const dir = './debug';\n // TODO - handle non-.ts extensions\n const sourceMapFileName = `${basename(filename, '.ts')}.ts.map`;\n const sourceMapPath = `${dir}/${sourceMapFileName}`;\n\n // Create directory if it doesn't exist\n try {\n await mkdir(dir, { recursive: true });\n } catch {\n // Directory already exists or creation failed, continue\n }\n\n // Format as well-formed JSON\n const formattedSourceMap = JSON.stringify(JSON.parse(wasmSourceMap), null, 2);\n\n writeFile(sourceMapPath, formattedSourceMap, { encoding: 'utf8' });\n debug(`${logPrefix} - Wrote source map to: \"${sourceMapPath}\"`);\n\n // Also write WASM binary for inspection\n const wasmPath = sourceMapPath.replace('.map', '.wasm');\n writeFile(wasmPath, cleanBinary);\n debug(`${logPrefix} - Wrote WASM binary to: \"${wasmPath}\"`);\n }\n\n // Instrument binary for coverage if requested and available\n if (options.shouldInstrument && nativeAddon) {\n throwPoolErrorIfAborted(signal);\n\n const instrumentStart = performance.now();\n const wasmBuffer = Buffer.from(cleanBinary);\n const sourceMapBuffer = Buffer.from(wasmSourceMap);\n\n const instrumentResult = nativeAddon.instrumentForCoverage(wasmBuffer, sourceMapBuffer, options.instrumentationOptions!, logModule, logLabel);\n const instCount = instrumentResult.debugInfo.instrumentedFunctionCount;\n\n const instrumentEnd = performance.now();\n debug(`${logPrefix} - TIMING Instrumented ${instCount} functions: ${(performance.now() - instrumentStart).toFixed(2)} ms`);\n\n return {\n binary: instrumentResult.instrumentedWasm,\n sourceMap: instrumentResult.sourceMap,\n debugInfo: instrumentResult.debugInfo,\n isInstrumented: true,\n compileTiming: instrumentEnd - compileStart,\n };\n }\n\n // No instrumentation requested\n return {\n binary: cleanBinary,\n sourceMap: wasmSourceMap,\n isInstrumented: false,\n compileTiming: performance.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;CAGlH,MAAM,cAA0B;CAChC,MAAM,gBAAwB;AAE9B,OAAM,GAAG,UAAU,gDAAgD,YAAY,OAAO,QAAQ;AAC9F,OAAM,GAAG,UAAU,iCAAiC,cAAc,SAAS,EAAE,QAAQ;AA6BrF,KAAI,QAAQ,oBAAoB,aAAa;AAC3C,0BAAwB,OAAO;EAE/B,MAAM,kBAAkB,YAAY,KAAK;EACzC,MAAM,aAAa,OAAO,KAAK,YAAY;EAC3C,MAAM,kBAAkB,OAAO,KAAK,cAAc;EAElD,MAAM,mBAAmB,YAAY,sBAAsB,YAAY,iBAAiB,QAAQ,wBAAyB,WAAW,SAAS;EAC7I,MAAM,YAAY,iBAAiB,UAAU;EAE7C,MAAM,gBAAgB,YAAY,KAAK;AACvC,QAAM,GAAG,UAAU,yBAAyB,UAAU,eAAe,YAAY,KAAK,GAAG,iBAAiB,QAAQ,EAAE,CAAC,KAAK;AAE1H,SAAO;GACL,QAAQ,iBAAiB;GACzB,WAAW,iBAAiB;GAC5B,WAAW,iBAAiB;GAC5B,gBAAgB;GAChB,eAAe,gBAAgB;GAChC;;AAIH,QAAO;EACL,QAAQ;EACR,WAAW;EACX,gBAAgB;EAChB,eAAe,YAAY,KAAK,GAAG;EACpC"}
1
+ {"version":3,"file":"compiler-CIXpfKq0.mjs","names":["ascMain"],"sources":["../src/compiler/index.ts"],"sourcesContent":["/**\n * AssemblyScript Compiler\n *\n * Handles compilation of AssemblyScript source code to WASM binaries.\n * Manages compiler options, transforms, and in-memory compilation.\n */\n\nimport { main as ascMain } from 'assemblyscript/asc';\nimport { basename, resolve } from 'node:path';\nimport { access, readFile, writeFile, mkdir } from 'node:fs/promises';\n\nimport type {\n AssemblyScriptCompilerResult,\n AssemblyScriptCompilerOptions,\n NativeAddonInterface\n} from '../types/types.js';\nimport { POOL_ERROR_NAMES } from '../types/constants.js';\nimport { debug } from '../util/debug.js';\nimport { createPoolError, throwPoolErrorIfAborted } from '../util/pool-errors.js';\nimport { clearNativeBuildError, hasNativeBuildError, warnASInstrumentationNotLoaded } from '../util/feature-check.js';\n\nlet nativeAddon: NativeAddonInterface | undefined;\ntry {\n nativeAddon = await import('../instrumentation/addon-interface.js');\n // Addon loaded successfully — clear any stale build error marker (fire and forget)\n clearNativeBuildError();\n} catch (err: any) {\n const knownBuildFailure = await hasNativeBuildError();\n if (knownBuildFailure) {\n // Marker file exists — coverage provider will warn the user, just debug log here\n debug(`[Compiler] Native instrumentation addon not loaded (known build failure): ${err?.message ?? String(err)}`);\n } else {\n // Unexpected failure — no marker file, warn the user\n warnASInstrumentationNotLoaded(err?.message ?? String(err));\n }\n}\n\nconst DEBUG_WRITE_FILES = false;\n\n// Path prefix the AS compiler uses when resolving bare `vitest-pool-assemblyscript/assembly` imports\n// via node_modules. Used to detect self-imports and redirect to local assembly/ dir when running in-tree.\nconst POOL_ASSEMBLY_NODE_MODULES_PREFIX = 'node_modules/vitest-pool-assemblyscript/assembly/';\n\n// path assumes that we're running from dist/\nconst STRIP_INLINE_TRANSFORM = resolve(import.meta.dirname, './compiler/transforms/strip-inline.mjs');\n\nsetImmediate(async () => {\n try {\n await access(STRIP_INLINE_TRANSFORM);\n } catch {\n throw createPoolError(\n `AS Compiler strip inline transform file not found at \"${STRIP_INLINE_TRANSFORM}\"`,\n POOL_ERROR_NAMES.CompilationError\n );\n }\n});\n\n/**\n * Compile AssemblyScript source code to WASM binary\n */\nexport async function compileAssemblyScript(\n filename: string,\n options: AssemblyScriptCompilerOptions,\n logModule: string,\n logLabel: string,\n signal?: AbortSignal\n): Promise<AssemblyScriptCompilerResult> {\n throwPoolErrorIfAborted(signal);\n\n const compileStart = performance.now();\n const logPrefix = `[${logModule} ASC] ${logLabel}`;\n\n const { shouldInstrument, instrumentationOptions, extraFlags } = options;\n\n if (shouldInstrument && !instrumentationOptions) {\n throw createPoolError(\n 'Instrumentation options are required for coverage instrumentation',\n POOL_ERROR_NAMES.CompilationError\n );\n }\n\n const stdoutLines: string[] = [];\n const stderrLines: string[] = [];\n let binary: Uint8Array | undefined;\n let sourceMap: string | undefined;\n\n // Use full path as entry file so AS compiler can resolve relative imports\n const entryFile = filename;\n // Use simple output name to avoid AS compiler prepending it to source map paths\n const outputFile = 'output.wasm';\n\n debug(`${logPrefix} - Compiling: \"${filename}\"`);\n\n // Capture stdout/stderr (for potential error reporting)\n const stdout = {\n write: (text: string) => {\n stdoutLines.push(text);\n return true;\n }\n };\n\n const stderr = {\n write: (text: string) => {\n stderrLines.push(text);\n return true;\n }\n };\n\n // Build compiler flags\n const compilerFlags = [\n entryFile,\n\n // overrideable, though not recommended\n '--optimizeLevel', '0', // No optimization for easier debugging\n '--shrinkLevel', '0', // No shrink\n '--runtime', 'stub', // stub runtime (no GC)\n\n ...(extraFlags || []),\n\n // non-overrideable\n '--outFile', outputFile,\n '--importMemory', // Import memory from JS (enables imports during WASM start)\n '--debug', // Include debug info\n '--sourceMap', // Generate source maps for error reporting\n '--exportStart', '_start', // Export start function for explicit initialization control\n '--exportTable' // Export function table for direct test execution\n ];\n\n // Add transform to strip @inline decorators if requested\n // This improves coverage accuracy by preventing functions from being inlined,\n // and enables correct source-mapped error reporting for errors originating\n // inside inlined functions.\n if (options.stripInline === true) {\n compilerFlags.push(\n '--transform', STRIP_INLINE_TRANSFORM\n );\n debug(`${logPrefix} - Added Transform - Stripping @inline decorators`);\n }\n\n // Compile with AssemblyScript compiler\n const ascStart = performance.now();\n const result = await ascMain(compilerFlags, {\n stdout,\n stderr,\n // Let AS read from filesystem for import resolution\n // WASM binary and source map are captured in memory via writeFile callback\n writeFile: (name: string, contents: string | Uint8Array, _baseDir: string) => {\n throwPoolErrorIfAborted(signal);\n\n if (name.endsWith('.wasm') && contents instanceof Uint8Array) {\n binary = contents;\n debug(`${logPrefix} - Captured binary in memory: \"${name}\"`);\n } else if (name.endsWith('.wasm.map') && typeof contents === 'string') {\n debug(`${logPrefix} - Captured source map in memory: \"${name}\"`);\n sourceMap = contents;\n } else {\n debug(`${logPrefix} - WARNING - Captured Unexpected File: \"${name}\" at baseDir: \"${_baseDir}\"`);\n }\n },\n \n // Custom readFile enables in-tree resolution of bare pool assembly imports.\n // When a test file imports 'vitest-pool-assemblyscript/assembly', the AS compiler\n // resolves it to a node_modules path. This works when the package is installed,\n // but fails in-tree (the package isn't in its own node_modules). The fallback\n // redirects these to the local assembly/ directory when the normal path isn't found.\n readFile: async (filename, baseDir): Promise<string | null> => {\n const filePath = resolve(baseDir, filename);\n\n try {\n return await readFile(filePath, { encoding: 'utf-8' });\n } catch {\n // Fallback: when running in-tree, redirect pool assembly imports to local assembly/ dir\n if (filename.startsWith(POOL_ASSEMBLY_NODE_MODULES_PREFIX)) {\n const localSubpath = filename.substring(POOL_ASSEMBLY_NODE_MODULES_PREFIX.length);\n const localPath = resolve(baseDir, 'assembly', localSubpath);\n\n try {\n return await readFile(localPath, { encoding: 'utf-8' });\n } catch {\n return null;\n }\n }\n\n return null;\n }\n },\n });\n\n debug(`${logPrefix} - TIMING asc.main: ${(performance.now() - ascStart).toFixed(2)} ms`);\n\n if (result.error) {\n const errorMessage = stderrLines.length > 0\n ? `${result.error.message}\\n\\n${stderrLines.join('')}`\n : result.error.message;\n\n throw createPoolError(errorMessage, POOL_ERROR_NAMES.CompilationError, errorMessage);\n }\n\n if (!binary) {\n const errorMessage = stderrLines.length > 0\n ? `No WASM binary was generated\\n\\nAS Compiler output:\\n${stderrLines.join('')}`\n : 'No WASM binary was generated';\n\n throw createPoolError(errorMessage, POOL_ERROR_NAMES.CompilationError);\n }\n\n if (!sourceMap) {\n throw createPoolError('Source map not captured from AssemblyScript Compiler', POOL_ERROR_NAMES.CompilationError);\n }\n\n const cleanBinary: Uint8Array = binary;\n const wasmSourceMap: string = sourceMap;\n\n debug(`${logPrefix} - Compilation successful, clean binary size: ${cleanBinary.length} bytes`);\n debug(`${logPrefix} - Source map generated, size: ${wasmSourceMap.length * 2} bytes`);\n \n if (DEBUG_WRITE_FILES) {\n // Write source map for debugging\n const dir = './debug';\n // TODO - handle non-.ts extensions\n const sourceMapFileName = `${basename(filename, '.ts')}.ts.map`;\n const sourceMapPath = `${dir}/${sourceMapFileName}`;\n\n // Create directory if it doesn't exist\n try {\n await mkdir(dir, { recursive: true });\n } catch {\n // Directory already exists or creation failed, continue\n }\n\n // Format as well-formed JSON\n const formattedSourceMap = JSON.stringify(JSON.parse(wasmSourceMap), null, 2);\n\n writeFile(sourceMapPath, formattedSourceMap, { encoding: 'utf8' });\n debug(`${logPrefix} - Wrote source map to: \"${sourceMapPath}\"`);\n\n // Also write WASM binary for inspection\n const wasmPath = sourceMapPath.replace('.map', '.wasm');\n writeFile(wasmPath, cleanBinary);\n debug(`${logPrefix} - Wrote WASM binary to: \"${wasmPath}\"`);\n }\n\n // Instrument binary for coverage if requested and available\n if (options.shouldInstrument && nativeAddon) {\n throwPoolErrorIfAborted(signal);\n\n const instrumentStart = performance.now();\n const wasmBuffer = Buffer.from(cleanBinary);\n const sourceMapBuffer = Buffer.from(wasmSourceMap);\n\n const instrumentResult = nativeAddon.instrumentForCoverage(wasmBuffer, sourceMapBuffer, options.instrumentationOptions!, logModule, logLabel);\n const instCount = instrumentResult.debugInfo.instrumentedFunctionCount;\n\n const instrumentEnd = performance.now();\n debug(`${logPrefix} - TIMING Instrumented ${instCount} functions: ${(performance.now() - instrumentStart).toFixed(2)} ms`);\n\n return {\n binary: instrumentResult.instrumentedWasm,\n sourceMap: instrumentResult.sourceMap,\n debugInfo: instrumentResult.debugInfo,\n isInstrumented: true,\n compileTiming: instrumentEnd - compileStart,\n };\n }\n\n // No instrumentation requested\n return {\n binary: cleanBinary,\n sourceMap: wasmSourceMap,\n isInstrumented: false,\n compileTiming: performance.now() - compileStart,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAqBA,IAAI;AACJ,IAAI;AACF,eAAc,MAAM,OAAO;AAE3B,wBAAuB;SAChB,KAAU;AAEjB,KAD0B,MAAM,qBAAqB,CAGnD,OAAM,6EAA6E,KAAK,WAAW,OAAO,IAAI,GAAG;KAGjH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AAO;EAE/B,MAAM,kBAAkB,YAAY,KAAK;EACzC,MAAM,aAAa,OAAO,KAAK,YAAY;EAC3C,MAAM,kBAAkB,OAAO,KAAK,cAAc;EAElD,MAAM,mBAAmB,YAAY,sBAAsB,YAAY,iBAAiB,QAAQ,wBAAyB,WAAW,SAAS;EAC7I,MAAM,YAAY,iBAAiB,UAAU;EAE7C,MAAM,gBAAgB,YAAY,KAAK;AACvC,QAAM,GAAG,UAAU,yBAAyB,UAAU,eAAe,YAAY,KAAK,GAAG,iBAAiB,QAAQ,EAAE,CAAC,KAAK;AAE1H,SAAO;GACL,QAAQ,iBAAiB;GACzB,WAAW,iBAAiB;GAC5B,WAAW,iBAAiB;GAC5B,gBAAgB;GAChB,eAAe,gBAAgB;GAChC;;AAIH,QAAO;EACL,QAAQ;EACR,WAAW;EACX,gBAAgB;EAChB,eAAe,YAAY,KAAK,GAAG;EACpC"}
@@ -1,5 +1,5 @@
1
- import { AssemblyScriptPoolOptions, WasmImportsFactory, WasmImportsFactoryInfo } from "../types-D0nprJo1.mjs";
2
- import "../custom-provider-options-YTk1m7At.mjs";
1
+ import { AssemblyScriptPoolOptions, WasmImportsFactory, WasmImportsFactoryInfo } from "../types-CnJC7Ydg.mjs";
2
+ import "../custom-provider-options-BZg2Trd5.mjs";
3
3
  import { ConfigEnv, UserWorkspaceConfig, ViteUserConfig } from "vitest/config";
4
4
 
5
5
  //#region src/config/config-helpers-v3.d.ts
@@ -1,4 +1,4 @@
1
- import { AssemblyScriptPoolOptions, WasmImportsFactory, WasmImportsFactoryInfo } from "../types-D0nprJo1.mjs";
2
- import "../custom-provider-options-YTk1m7At.mjs";
3
- import { createAssemblyScriptPool } from "../pool-runner-init-CvnB0-iN.mjs";
1
+ import { AssemblyScriptPoolOptions, WasmImportsFactory, WasmImportsFactoryInfo } from "../types-CnJC7Ydg.mjs";
2
+ import "../custom-provider-options-BZg2Trd5.mjs";
3
+ import { createAssemblyScriptPool } from "../pool-runner-init-BLvrW28n.mjs";
4
4
  export { type AssemblyScriptPoolOptions, type WasmImportsFactory, type WasmImportsFactoryInfo, createAssemblyScriptPool };
@@ -1,9 +1,9 @@
1
1
  import "../constants-DuBLuMjt.mjs";
2
- import "../resolve-config-BFNr7LW7.mjs";
2
+ import "../resolve-config-DhZ4lOSK.mjs";
3
3
  import "../debug-Cm1VFmaz.mjs";
4
4
  import "../vitest-file-tasks-Bn9CrWt_.mjs";
5
5
  import "../vitest-tasks--ow4pacR.mjs";
6
6
  import "../worker-rpc-channel-CZZIxtv5.mjs";
7
- import { createAssemblyScriptPool } from "../pool-runner-init-D8Ei957C.mjs";
7
+ import { createAssemblyScriptPool } from "../pool-runner-init-BDQtAGwQ.mjs";
8
8
 
9
9
  export { createAssemblyScriptPool };
@@ -1,8 +1,8 @@
1
1
  import { ASCommonFlags, ASNodeKind, COVERAGE_PAYLOAD_FORMATS, POOL_ERROR_NAMES } from "../constants-DuBLuMjt.mjs";
2
- import { getProjectSerializedOrGlobalConfig } from "../resolve-config-BFNr7LW7.mjs";
2
+ import { getProjectSerializedOrGlobalConfig } from "../resolve-config-DhZ4lOSK.mjs";
3
3
  import { createPoolError, debug, debugOverride } from "../debug-Cm1VFmaz.mjs";
4
4
  import { toForwardSlash } from "../path-utils-t9OzjXYF.mjs";
5
- import { warnIfASCoverageNotSupportedByNode, warnIfNativeBuildFailed } from "../feature-check-CNyjFX9M.mjs";
5
+ import { warnIfASCoverageNotSupportedByNode, warnIfNativeBuildFailed } from "../feature-check-ELxw_Mji.mjs";
6
6
  import { mergeCoverageData } from "../coverage-merge-CBXkpM1O.mjs";
7
7
  import { ASTVisitor } from "../ast-visitor-C5gQqWD2.mjs";
8
8
  import { basename, parse, relative } from "node:path";
@@ -1,4 +1,4 @@
1
- import { HybridProviderOptions } from "./types-D0nprJo1.mjs";
1
+ import { HybridProviderOptions } from "./types-CnJC7Ydg.mjs";
2
2
  import { CoverageV8Options } from "vitest/node";
3
3
 
4
4
  //#region src/config/custom-provider-options.d.ts
@@ -23,4 +23,4 @@ declare module "vitest/node" {
23
23
  customProviderModule: string;
24
24
  }
25
25
  }
26
- //# sourceMappingURL=custom-provider-options-YTk1m7At.d.mts.map
26
+ //# sourceMappingURL=custom-provider-options-BZg2Trd5.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"custom-provider-options-YTk1m7At.d.mts","names":[],"sources":["../src/config/custom-provider-options.ts"],"mappings":";;;;;;AAE2C;;;;;;;;;;;;;YAiB/B,qBAAA,SAA8B,qBAAA,EAAuB,IAAA,CAAK,iBAAA;IAClE,QAAA;IAGD;IAAA,oBAAA;EAAA;AAAA"}
1
+ {"version":3,"file":"custom-provider-options-BZg2Trd5.d.mts","names":[],"sources":["../src/config/custom-provider-options.ts"],"mappings":";;;;;;AAE2C;;;;;;;;;;;;;YAiB/B,qBAAA,SAA8B,qBAAA,EAAuB,IAAA,CAAK,iBAAA;IAClE,QAAA;IAGD;IAAA,oBAAA;EAAA;AAAA"}
@@ -66,7 +66,7 @@ async function warnIfNativeBuildFailed() {
66
66
  const buildError = await readNativeBuildError();
67
67
  if (!buildError) return;
68
68
  try {
69
- await import("./addon-interface-7FPjYh7J.mjs");
69
+ await import("./addon-interface-_pNXcbib.mjs");
70
70
  await clearNativeBuildError();
71
71
  return;
72
72
  } catch {}
@@ -79,4 +79,4 @@ async function warnIfNativeBuildFailed() {
79
79
 
80
80
  //#endregion
81
81
  export { clearNativeBuildError, hasNativeBuildError, isNodeVersionSupportedForCoverage, warnASInstrumentationNotLoaded, warnIfASCoverageNotSupportedByNode, warnIfNativeBuildFailed };
82
- //# sourceMappingURL=feature-check-CNyjFX9M.mjs.map
82
+ //# sourceMappingURL=feature-check-ELxw_Mji.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"feature-check-CNyjFX9M.mjs","names":[],"sources":["../src/util/feature-check.ts"],"sourcesContent":["import { versions } from 'node:process';\nimport { access, readFile, unlink } from 'node:fs/promises';\nimport { resolve, dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport c from 'tinyrainbow';\n\nimport type { NativeBuildError } from '../types/types.js';\n\n// Marker file written by install script when native build fails\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\nconst packageRoot = resolve(__dirname, '..');\nconst NATIVE_BUILD_ERROR_FILE = resolve(packageRoot, '.native-build-error');\n\n/**\n * Read the native build error marker file if it exists.\n * Returns undefined if file doesn't exist or can't be parsed.\n */\nasync function readNativeBuildError(): Promise<NativeBuildError | undefined> {\n try {\n const content = await readFile(NATIVE_BUILD_ERROR_FILE, 'utf8');\n return JSON.parse(content) as NativeBuildError;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Check if a native build error marker file exists.\n * Used by compiler threads to distinguish known build failures (marker present,\n * user already warned by coverage provider) from unexpected addon load failures.\n */\nexport async function hasNativeBuildError(): Promise<boolean> {\n try {\n await access(NATIVE_BUILD_ERROR_FILE);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Remove the native build error marker file.\n * Called when the addon loads successfully at runtime, clearing any stale marker\n * left from a previous failed install (e.g. after a manual rebuild).\n */\nexport async function clearNativeBuildError(): Promise<void> {\n try {\n await unlink(NATIVE_BUILD_ERROR_FILE);\n } catch {\n // File doesn't exist or can't be removed — non-critical\n }\n}\n\nconst NODE_VERSION = versions.node;\nconst NODE_MAJOR_VERSION = parseInt(NODE_VERSION.split('.')[0]!, 10);\n\nexport function isNodeVersionSupportedForCoverage(): boolean {\n return NODE_MAJOR_VERSION >= 22;\n}\n\nexport function warnIfASCoverageNotSupportedByNode(): void {\n if (!isNodeVersionSupportedForCoverage()) {\n console.warn(`\\n`\n + c.yellow(`Warning:`)\n + c.gray(` Coverage config is enabled, but current Node version (${versions.node})\\n`\n + ` does not support required WASM multi-memory features.\\n`\n + ` Coverage collection will be `) + c.yellow(`disabled`) + c.gray(` for AssemblyScript WASM.\\n`\n + ` Please upgrade to Node 22 or above if you need WASM coverage support.`)\n );\n }\n}\n\n/**\n * Warn that the native instrumentation addon could not be loaded.\n * Used by compiler threads for unexpected failures (no marker file present).\n */\nexport function warnASInstrumentationNotLoaded(errorMessage: string): void {\n console.warn(`\\n`\n + c.yellow(`Warning:`)\n + c.gray(` Coverage config is enabled, but instrumentation native addon module\\n`\n + ` was not loaded. Tests will run with ` + c.yellow(`coverage disabled`) + `. Error:\\n\\n`\n + `${errorMessage}`)\n );\n}\n\nconst ERROR_PREVIEW_MAX_LINES = 10;\n\n/**\n * Check for a native build error marker file and warn if present.\n * Called once from the coverage provider (main process), so the warning\n * is not duplicated across compiler threads.\n */\nexport async function warnIfNativeBuildFailed(): Promise<void> {\n const buildError = await readNativeBuildError();\n if (!buildError) return;\n\n // Before warning, check if the addon actually loads (e.g. after a manual rebuild).\n // If it loads, the marker file is stale — clear it and skip the warning.\n try {\n await import('../instrumentation/addon-interface.js');\n await clearNativeBuildError();\n return;\n } catch {\n // Addon still can't load — proceed with warning\n }\n\n const stageName = buildError.stage === 'binaryen-download'\n ? 'Binaryen dependency download'\n : 'native addon compilation';\n\n // Truncate error for display, point to file for full details\n const errorLines = buildError.error.split('\\n');\n const truncated = errorLines.length > ERROR_PREVIEW_MAX_LINES;\n const preview = errorLines.slice(-ERROR_PREVIEW_MAX_LINES).join('\\n');\n\n console.warn(`\\n`\n + c.yellow(`Warning:`) + c.gray(` Build failed during \"${stageName}\" while installing.\\n`)\n + c.gray(` vitest-pool-assemblyscript. AssemblyScript tests will run,\\n`)\n + c.gray(` but `) + c.yellow(`coverage will be disabled`) + c.gray(`. Platform: `)\n + c.yellowBright(`${buildError.platform}\\n`)\n + c.gray(` Build Error Message:\\n`)\n + `\\n`\n + (truncated ? c.gray(`... (truncated)\\n`) : ``)+ c.redBright(`${preview}`) + `\\n`\n + `\\n`\n + c.gray(` Full error details: `) + c.cyan(`${NATIVE_BUILD_ERROR_FILE}`) + `\\n`\n + `\\n`\n + c.gray(` To resolve, inspect the error above, ensure a C++ compiler toolchain\\n`)\n + c.gray(` is installed (`) + c.cyan(`https://github.com/nodejs/node-g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AK;CAC/C,MAAM,YAAY,WAAW,SAAS;CACtC,MAAM,UAAU,WAAW,MAAM,CAAC,wBAAwB,CAAC,KAAK,KAAK;AAErE,SAAQ,KAAK,OACT,EAAE,OAAO,WAAW,GAAG,EAAE,KAAK,yBAAyB,UAAU,uBAAuB,GACxF,EAAE,KAAK,sEAAsE,GAC7E,EAAE,KAAK,cAAc,GAAG,EAAE,OAAO,4BAA4B,GAAG,EAAE,KAAK,eAAe,GACtF,EAAE,aAAa,GAAG,WAAW,SAAS,IAAI,GAC1C,EAAE,KAAK,gCAAgC,GACvC,QACC,YAAY,EAAE,KAAK,oBAAoB,GAAG,MAAK,EAAE,UAAU,GAAG,UAAU,GAAG,SAE5E,EAAE,KAAK,8BAA8B,GAAG,EAAE,KAAK,GAAG,0BAA0B,GAAG,SAE/E,EAAE,KAAK,gFAAgF,GACvF,EAAE,KAAK,wBAAwB,GAAG,EAAE,KAAK,kDAAkD,GAAG,EAAE,KAAK,MAAM,GAC3G,EAAE,KAAK,8BAA8B,GAAG,EAAE,KAAK,yCAAyC,GACxF,KACH"}
1
+ {"version":3,"file":"feature-check-ELxw_Mji.mjs","names":[],"sources":["../src/util/feature-check.ts"],"sourcesContent":["import { versions } from 'node:process';\nimport { access, readFile, unlink } from 'node:fs/promises';\nimport { resolve, dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport c from 'tinyrainbow';\n\nimport type { NativeBuildError } from '../types/types.js';\n\n// Marker file written by install script when native build fails\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\nconst packageRoot = resolve(__dirname, '..');\nconst NATIVE_BUILD_ERROR_FILE = resolve(packageRoot, '.native-build-error');\n\n/**\n * Read the native build error marker file if it exists.\n * Returns undefined if file doesn't exist or can't be parsed.\n */\nasync function readNativeBuildError(): Promise<NativeBuildError | undefined> {\n try {\n const content = await readFile(NATIVE_BUILD_ERROR_FILE, 'utf8');\n return JSON.parse(content) as NativeBuildError;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Check if a native build error marker file exists.\n * Used by compiler threads to distinguish known build failures (marker present,\n * user already warned by coverage provider) from unexpected addon load failures.\n */\nexport async function hasNativeBuildError(): Promise<boolean> {\n try {\n await access(NATIVE_BUILD_ERROR_FILE);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Remove the native build error marker file.\n * Called when the addon loads successfully at runtime, clearing any stale marker\n * left from a previous failed install (e.g. after a manual rebuild).\n */\nexport async function clearNativeBuildError(): Promise<void> {\n try {\n await unlink(NATIVE_BUILD_ERROR_FILE);\n } catch {\n // File doesn't exist or can't be removed — non-critical\n }\n}\n\nconst NODE_VERSION = versions.node;\nconst NODE_MAJOR_VERSION = parseInt(NODE_VERSION.split('.')[0]!, 10);\n\nexport function isNodeVersionSupportedForCoverage(): boolean {\n return NODE_MAJOR_VERSION >= 22;\n}\n\nexport function warnIfASCoverageNotSupportedByNode(): void {\n if (!isNodeVersionSupportedForCoverage()) {\n console.warn(`\\n`\n + c.yellow(`Warning:`)\n + c.gray(` Coverage config is enabled, but current Node version (${versions.node})\\n`\n + ` does not support required WASM multi-memory features.\\n`\n + ` Coverage collection will be `) + c.yellow(`disabled`) + c.gray(` for AssemblyScript WASM.\\n`\n + ` Please upgrade to Node 22 or above if you need WASM coverage support.`)\n );\n }\n}\n\n/**\n * Warn that the native instrumentation addon could not be loaded.\n * Used by compiler threads for unexpected failures (no marker file present).\n */\nexport function warnASInstrumentationNotLoaded(errorMessage: string): void {\n console.warn(`\\n`\n + c.yellow(`Warning:`)\n + c.gray(` Coverage config is enabled, but instrumentation native addon module\\n`\n + ` was not loaded. Tests will run with ` + c.yellow(`coverage disabled`) + `. Error:\\n\\n`\n + `${errorMessage}`)\n );\n}\n\nconst ERROR_PREVIEW_MAX_LINES = 10;\n\n/**\n * Check for a native build error marker file and warn if present.\n * Called once from the coverage provider (main process), so the warning\n * is not duplicated across compiler threads.\n */\nexport async function warnIfNativeBuildFailed(): Promise<void> {\n const buildError = await readNativeBuildError();\n if (!buildError) return;\n\n // Before warning, check if the addon actually loads (e.g. after a manual rebuild).\n // If it loads, the marker file is stale — clear it and skip the warning.\n try {\n await import('../instrumentation/addon-interface.js');\n await clearNativeBuildError();\n return;\n } catch {\n // Addon still can't load — proceed with warning\n }\n\n const stageName = buildError.stage === 'binaryen-download'\n ? 'Binaryen dependency download'\n : 'native addon compilation';\n\n // Truncate error for display, point to file for full details\n const errorLines = buildError.error.split('\\n');\n const truncated = errorLines.length > ERROR_PREVIEW_MAX_LINES;\n const preview = errorLines.slice(-ERROR_PREVIEW_MAX_LINES).join('\\n');\n\n console.warn(`\\n`\n + c.yellow(`Warning:`) + c.gray(` Build failed during \"${stageName}\" while installing.\\n`)\n + c.gray(` vitest-pool-assemblyscript. AssemblyScript tests will run,\\n`)\n + c.gray(` but `) + c.yellow(`coverage will be disabled`) + c.gray(`. Platform: `)\n + c.yellowBright(`${buildError.platform}\\n`)\n + c.gray(` Build Error Message:\\n`)\n + `\\n`\n + (truncated ? c.gray(`... (truncated)\\n`) : ``)+ c.redBright(`${preview}`) + `\\n`\n + `\\n`\n + c.gray(` Full error details: `) + c.cyan(`${NATIVE_BUILD_ERROR_FILE}`) + `\\n`\n + `\\n`\n + c.gray(` To resolve, inspect the error above, ensure a C++ compiler toolchain\\n`)\n + c.gray(` is installed (`) + c.cyan(`https://github.com/nodejs/node-gyp#installation`) + c.gray(`)\\n`)\n + c.gray(` and then reinstall: `) + c.cyan(`npm install vitest-pool-assemblyscript`)\n + `\\n`\n );\n}\n"],"mappings":";;;;;;;AAYA,MAAM,0BAA0B,QADZ,QADF,QADC,cAAc,OAAO,KAAK,IAAI,CACZ,EACE,KAAK,EACS,sBAAsB;;;;;AAM3E,eAAe,uBAA8D;AAC3E,KAAI;EACF,MAAM,UAAU,MAAM,SAAS,yBAAyB,OAAO;AAC/D,SAAO,KAAK,MAAM,QAAQ;SACpB;AACN;;;;;;;;AASJ,eAAsB,sBAAwC;AAC5D,KAAI;AACF,QAAM,OAAO,wBAA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,MAAK,EAAE,UAAU,GAAG,UAAU,GAAG,SAE5E,EAAE,KAAK,8BAA8B,GAAG,EAAE,KAAK,GAAG,0BAA0B,GAAG,SAE/E,EAAE,KAAK,gFAAgF,GACvF,EAAE,KAAK,wBAAwB,GAAG,EAAE,KAAK,kDAAkD,GAAG,EAAE,KAAK,MAAM,GAC3G,EAAE,KAAK,8BAA8B,GAAG,EAAE,KAAK,yCAAyC,GACxF,KACH"}
@@ -1,4 +1,4 @@
1
- import { AssemblyScriptCompilerOptions, AssemblyScriptCompilerResult, AssemblyScriptPoolOptions } from "./types-D0nprJo1.mjs";
1
+ import { AssemblyScriptCompilerOptions, AssemblyScriptCompilerResult, AssemblyScriptPoolOptions } from "./types-CnJC7Ydg.mjs";
2
2
 
3
3
  //#region src/compiler/index.d.ts
4
4
  /**
@@ -1,6 +1,6 @@
1
1
  import "./constants-DuBLuMjt.mjs";
2
2
  import "./debug-Cm1VFmaz.mjs";
3
- import "./feature-check-CNyjFX9M.mjs";
4
- import { compileAssemblyScript } from "./compiler-YMrl5MY_.mjs";
3
+ import "./feature-check-ELxw_Mji.mjs";
4
+ import { compileAssemblyScript } from "./compiler-CIXpfKq0.mjs";
5
5
 
6
6
  export { compileAssemblyScript };
package/dist/index-v3.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { POOL_ERROR_NAMES } from "./constants-DuBLuMjt.mjs";
2
- import { getProjectSerializedOrGlobalConfig, resolvePoolOptions } from "./resolve-config-BFNr7LW7.mjs";
2
+ import { getProjectSerializedOrGlobalConfig } from "./resolve-config-DhZ4lOSK.mjs";
3
3
  import { createPoolErrorFromAnyError, debug, isAbortError, setGlobalDebugMode } from "./debug-Cm1VFmaz.mjs";
4
4
  import { createInitialFileTask } from "./vitest-file-tasks-Bn9CrWt_.mjs";
5
5
  import { failTestWithTimeoutError, flagTestTerminated } from "./vitest-tasks--ow4pacR.mjs";
@@ -147,28 +147,31 @@ async function runTests(specs, isCollectTestsMode, pool, poolAbortController, _i
147
147
  debug(`[Pool] -------- ${mode} completed --------`);
148
148
  }
149
149
  function createAssemblyScriptProcessPool(ctx) {
150
- const { config, foundProjectSerializedConfig } = getProjectSerializedOrGlobalConfig(ctx);
151
- const poolOptions = resolvePoolOptions(config?.poolOptions);
152
- setGlobalDebugMode(poolOptions.debug);
150
+ const { config, foundProjectSerializedConfig, v3PoolOptions } = getProjectSerializedOrGlobalConfig(ctx);
151
+ if (!v3PoolOptions) throw {
152
+ name: POOL_ERROR_NAMES.PoolError,
153
+ message: `Could not parse poot options or generate defaults. This is a bug in vitest-pool-assemblyscript, please report it.`
154
+ };
155
+ setGlobalDebugMode(v3PoolOptions.debug);
153
156
  debug("[Pool] Initializing AssemblyScript Pool");
154
157
  if (foundProjectSerializedConfig) debug(`[Pool] Multi-project mode: Using config from project: "${config.name}"`);
155
158
  else debug("[Pool] Single-project mode: No project config found using vitest-pool-assemblyscript pool - Using global config with AssemblyScript pool defaults");
156
159
  debug(`[Pool] Worker thread path: "${WORKER_PATH}"`);
157
- debug(`[Pool] Worker thread configuration - maxThreads: ${poolOptions.maxThreadsV3}`);
160
+ debug(`[Pool] Worker thread configuration - maxThreads: ${v3PoolOptions.maxThreadsV3}`);
158
161
  setImmediate(async () => {
159
- const userImportsFactoryPath = resolve(config.root, poolOptions.wasmImportsFactory ?? "");
160
- const results = await Promise.allSettled([access(WORKER_PATH), poolOptions.wasmImportsFactory ? access(userImportsFactoryPath) : Promise.resolve()]);
162
+ const userImportsFactoryPath = resolve(config.root, v3PoolOptions.wasmImportsFactory ?? "");
163
+ const results = await Promise.allSettled([access(WORKER_PATH), v3PoolOptions.wasmImportsFactory ? access(userImportsFactoryPath) : Promise.resolve()]);
161
164
  if (results[0].status === "rejected") throw new Error(`Cannot access worker thread file at path: "${WORKER_PATH}"`);
162
165
  if (results[1].status === "rejected") throw new Error(`Cannot access user WasmImportsFactory at path: "${userImportsFactoryPath}". Ensure that your module path is relative to the project root (location of shallowest vitest config), and that it has a default export matching () => WebAssembly.Imports`);
163
166
  });
164
167
  const pool = new Tinypool({
165
168
  filename: WORKER_PATH,
166
169
  minThreads: 1,
167
- maxThreads: poolOptions.maxThreadsV3,
170
+ maxThreads: v3PoolOptions.maxThreadsV3,
168
171
  idleTimeout: POOL_THREAD_IDLE_TIMEOUT_MS,
169
172
  isolateWorkers: false,
170
173
  workerData: {
171
- asPoolOptions: poolOptions,
174
+ asPoolOptions: v3PoolOptions,
172
175
  asCoverageOptions: config.coverage,
173
176
  projectRoot: config.root
174
177
  }