vitest-pool-assemblyscript 0.5.0 → 0.6.0

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 (76) hide show
  1. package/README.md +110 -36
  2. package/binding.gyp +6 -6
  3. package/dist/{compiler-CscxCJw3.mjs → addon-interface-7FPjYh7J.mjs} +12 -141
  4. package/dist/addon-interface-7FPjYh7J.mjs.map +1 -0
  5. package/dist/{ast-visitor-DJLJd5dt.mjs → ast-visitor-C5gQqWD2.mjs} +1 -1
  6. package/dist/{ast-visitor-DJLJd5dt.mjs.map → ast-visitor-C5gQqWD2.mjs.map} +1 -1
  7. package/dist/{compile-runner-BJ_ZF3Ma.mjs → compile-runner-C-05LdGX.mjs} +7 -6
  8. package/dist/compile-runner-C-05LdGX.mjs.map +1 -0
  9. package/dist/compiler/transforms/strip-inline.mjs +2 -3
  10. package/dist/compiler/transforms/strip-inline.mjs.map +1 -1
  11. package/dist/compiler-YMrl5MY_.mjs +147 -0
  12. package/dist/compiler-YMrl5MY_.mjs.map +1 -0
  13. package/dist/config/index-v3.d.mts +2 -2
  14. package/dist/config/index.d.mts +3 -3
  15. package/dist/config/index.mjs +4 -4
  16. package/dist/{coverage-merge-DCEwyjMy.mjs → coverage-merge-CBXkpM1O.mjs} +1 -1
  17. package/dist/{coverage-merge-DCEwyjMy.mjs.map → coverage-merge-CBXkpM1O.mjs.map} +1 -1
  18. package/dist/coverage-provider/index.mjs +11 -11
  19. package/dist/coverage-provider/index.mjs.map +1 -1
  20. package/dist/{custom-provider-options-i_O0OSTV.d.mts → custom-provider-options-YTk1m7At.d.mts} +2 -2
  21. package/dist/{custom-provider-options-i_O0OSTV.d.mts.map → custom-provider-options-YTk1m7At.d.mts.map} +1 -1
  22. package/dist/feature-check-CNyjFX9M.mjs +82 -0
  23. package/dist/feature-check-CNyjFX9M.mjs.map +1 -0
  24. package/dist/index-internal.d.mts +1 -1
  25. package/dist/index-internal.d.mts.map +1 -1
  26. package/dist/index-internal.mjs +2 -1
  27. package/dist/index-v3.mjs +3 -3
  28. package/dist/index.d.mts +2 -2
  29. package/dist/index.mjs +4 -4
  30. package/dist/{load-user-imports-CYTTU22Q.mjs → load-user-imports-B3Iy_K8k.mjs} +4 -5
  31. package/dist/{load-user-imports-CYTTU22Q.mjs.map → load-user-imports-B3Iy_K8k.mjs.map} +1 -1
  32. package/dist/path-utils-t9OzjXYF.mjs +24 -0
  33. package/dist/path-utils-t9OzjXYF.mjs.map +1 -0
  34. package/dist/{pool-runner-init-D56aVMMD.d.mts → pool-runner-init-CvnB0-iN.d.mts} +2 -2
  35. package/dist/pool-runner-init-CvnB0-iN.d.mts.map +1 -0
  36. package/dist/{pool-runner-init-D1QamWkS.mjs → pool-runner-init-D8Ei957C.mjs} +6 -5
  37. package/dist/pool-runner-init-D8Ei957C.mjs.map +1 -0
  38. package/dist/pool-thread/compile-worker-thread.d.mts +1 -1
  39. package/dist/pool-thread/compile-worker-thread.mjs +7 -7
  40. package/dist/pool-thread/compile-worker-thread.mjs.map +1 -1
  41. package/dist/pool-thread/test-worker-thread.d.mts +1 -1
  42. package/dist/pool-thread/test-worker-thread.mjs +5 -5
  43. package/dist/pool-thread/test-worker-thread.mjs.map +1 -1
  44. package/dist/pool-thread/v3-tinypool-thread.d.mts +1 -1
  45. package/dist/pool-thread/v3-tinypool-thread.mjs +8 -8
  46. package/dist/pool-thread/v3-tinypool-thread.mjs.map +1 -1
  47. package/dist/resolve-config-BFNr7LW7.mjs.map +1 -1
  48. package/dist/{test-runner-CfhzcYNS.mjs → test-runner-WF857_Bk.mjs} +4 -4
  49. package/dist/{test-runner-CfhzcYNS.mjs.map → test-runner-WF857_Bk.mjs.map} +1 -1
  50. package/dist/{types-DmyeERkL.d.mts → types-D0nprJo1.d.mts} +1 -1
  51. package/dist/types-D0nprJo1.d.mts.map +1 -0
  52. package/dist/{vitest-file-tasks-BUwzh375.mjs → vitest-file-tasks-Bn9CrWt_.mjs} +1 -1
  53. package/dist/{vitest-file-tasks-BUwzh375.mjs.map → vitest-file-tasks-Bn9CrWt_.mjs.map} +1 -1
  54. package/dist/{vitest-tasks-ByPK8DvF.mjs → vitest-tasks--ow4pacR.mjs} +1 -1
  55. package/dist/{vitest-tasks-ByPK8DvF.mjs.map → vitest-tasks--ow4pacR.mjs.map} +1 -1
  56. package/dist/{wasm-names-CydfYzQK.mjs → wasm-names-BFtzQCH4.mjs} +1 -1
  57. package/dist/{wasm-names-CydfYzQK.mjs.map → wasm-names-BFtzQCH4.mjs.map} +1 -1
  58. package/dist/{worker-rpc-channel-lbhK7Qz8.mjs → worker-rpc-channel-CZZIxtv5.mjs} +1 -1
  59. package/dist/{worker-rpc-channel-lbhK7Qz8.mjs.map → worker-rpc-channel-CZZIxtv5.mjs.map} +1 -1
  60. package/package.json +17 -16
  61. package/prebuilds/darwin-arm64/vitest-pool-assemblyscript.glibc.node +0 -0
  62. package/prebuilds/darwin-x64/vitest-pool-assemblyscript.glibc.node +0 -0
  63. package/prebuilds/linux-arm64/vitest-pool-assemblyscript.glibc.node +0 -0
  64. package/prebuilds/linux-x64/vitest-pool-assemblyscript.glibc.node +0 -0
  65. package/prebuilds/linux-x64/vitest-pool-assemblyscript.musl.node +0 -0
  66. package/prebuilds/win32-arm64/vitest-pool-assemblyscript.glibc.node +0 -0
  67. package/prebuilds/win32-x64/vitest-pool-assemblyscript.glibc.node +0 -0
  68. package/scripts/install.js +53 -16
  69. package/src/{native-instrumentation → instrumentation/native}/addon.cpp +8 -8
  70. package/dist/compile-runner-BJ_ZF3Ma.mjs.map +0 -1
  71. package/dist/compiler-CscxCJw3.mjs.map +0 -1
  72. package/dist/node-check-CooGQMLH.mjs +0 -16
  73. package/dist/node-check-CooGQMLH.mjs.map +0 -1
  74. package/dist/pool-runner-init-D1QamWkS.mjs.map +0 -1
  75. package/dist/pool-runner-init-D56aVMMD.d.mts.map +0 -1
  76. package/dist/types-DmyeERkL.d.mts.map +0 -1
@@ -1,9 +1,10 @@
1
1
  import { INTERNAL_PATH_LIB_PREFIX, POOL_ERROR_NAMES, POOL_INTERNAL_PATHS } from "./constants-DuBLuMjt.mjs";
2
2
  import { createPoolErrorFromAnyError, debug, getTestErrorFromPoolError } from "./debug-Cm1VFmaz.mjs";
3
- import { failFile, getFullTaskHierarchy, prepareFileTaskForCollection } from "./vitest-file-tasks-BUwzh375.mjs";
4
- import { getTaskLogLabel, getTaskLogPrefix } from "./vitest-tasks-ByPK8DvF.mjs";
5
- import { executeWASMDiscovery, flushRpcUpdates, reportFileCollected, reportFileError, reportFileQueued, reportUserConsoleLogs } from "./load-user-imports-CYTTU22Q.mjs";
6
- import { compileAssemblyScript } from "./compiler-CscxCJw3.mjs";
3
+ import { toForwardSlash } from "./path-utils-t9OzjXYF.mjs";
4
+ import { failFile, getFullTaskHierarchy, prepareFileTaskForCollection } from "./vitest-file-tasks-Bn9CrWt_.mjs";
5
+ import { getTaskLogLabel, getTaskLogPrefix } from "./vitest-tasks--ow4pacR.mjs";
6
+ import { executeWASMDiscovery, flushRpcUpdates, reportFileCollected, reportFileError, reportFileQueued, reportUserConsoleLogs } from "./load-user-imports-B3Iy_K8k.mjs";
7
+ import { compileAssemblyScript } from "./compiler-YMrl5MY_.mjs";
7
8
  import { basename, relative } from "node:path";
8
9
 
9
10
  //#region src/pool-thread/runner/compile-runner.ts
@@ -23,7 +24,7 @@ async function runCompileAndDiscover(file, logModule, rpc, poolOptions, projectR
23
24
  const instrumentationOptions = {
24
25
  projectRoot,
25
26
  relativeExcludedFiles: [
26
- relative(projectRoot, file.filepath),
27
+ toForwardSlash(relative(projectRoot, file.filepath)),
27
28
  ...poolOptions._instrumentPoolInternals ? [] : POOL_INTERNAL_PATHS,
28
29
  ...relativeUserCoverageExclusions
29
30
  ],
@@ -80,4 +81,4 @@ async function runCompileAndDiscover(file, logModule, rpc, poolOptions, projectR
80
81
 
81
82
  //#endregion
82
83
  export { runCompileAndDiscover };
83
- //# sourceMappingURL=compile-runner-BJ_ZF3Ma.mjs.map
84
+ //# sourceMappingURL=compile-runner-C-05LdGX.mjs.map
@@ -0,0 +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,IAA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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,5 +1,5 @@
1
1
  import { ASDecoratorKind, ASSourceKind } from "../../constants-DuBLuMjt.mjs";
2
- import { ASTVisitor } from "../../ast-visitor-DJLJd5dt.mjs";
2
+ import { ASTVisitor } from "../../ast-visitor-C5gQqWD2.mjs";
3
3
  import { Transform } from "assemblyscript/transform";
4
4
 
5
5
  //#region src/compiler/transforms/strip-inline.mts
@@ -31,8 +31,7 @@ var StripInlineTransform = class extends Transform {
31
31
  for (const source of userSources) this.visitor.visitSource(source);
32
32
  }
33
33
  };
34
- var strip_inline_default = StripInlineTransform;
35
34
 
36
35
  //#endregion
37
- export { strip_inline_default as default };
36
+ export { StripInlineTransform as default };
38
37
  //# sourceMappingURL=strip-inline.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"strip-inline.mjs","names":[],"sources":["../../../src/compiler/transforms/strip-inline.mts"],"sourcesContent":["/**\n * AssemblyScript Transform to strip @inline decorators\n *\n * Production code uses @inline decorators for performance. When functions are inlined,\n * coverage instrumentation can't track their execution. This transform removes @inline\n * decorators from the AST during test compilation, allowing coverage instrumentation\n * to properly track function calls.\n * \n * - Hooks into the AssemblyScript compiler's `afterParse` lifecycle\n * - Walks through all parsed source files before compilation begins\n * - Uses shared ASTVisitor to recurse into ALL node types\n * - Strips @inline decorators from any node that has them in user code\n *\n * @see https://www.assemblyscript.org/compiler.html#transforms\n * @see https://github.com/AssemblyScript/assemblyscript/blob/main/src/ast.ts\n */\n\nimport { Node, Parser, Source, DecoratorNode } from 'assemblyscript';\nimport { Transform } from 'assemblyscript/transform';\n\nimport { ASTVisitor } from '../../util/ast-visitor.js';\nimport {\n ASSEMBLYSCRIPT_LIB_PREFIX,\n ASDecoratorKind,\n ASSourceKind,\n} from '../../types/constants.js';\n\n/**\n * Visitor that strips @inline decorators from nodes\n */\nclass StripInlineVisitor extends ASTVisitor {\n /**\n * Strip @inline decorator from a node if present\n */\n protected beforeVisit(node: Node): void {\n if ('decorators' in node && node.decorators) {\n const filtered = (node.decorators as DecoratorNode[]).filter(\n (decorator: DecoratorNode) => decorator.decoratorKind !== ASDecoratorKind.Inline\n );\n node.decorators = filtered.length > 0 ? filtered : null;\n }\n }\n}\n\n/**\n * AssemblyScript compiler transform that strips @inline decorators\n */\nclass StripInlineTransform extends Transform {\n private visitor = new StripInlineVisitor();\n\n /**\n * Called after parsing is complete, before the program is initialized.\n * This is the ideal time to modify the AST.\n */\n afterParse(_parser: Parser): void {\n const sources = (this as Transform).program.sources;\n\n // Filter to user source files only\n const userSources = sources.filter((source: Source) =>\n (source.sourceKind === ASSourceKind.User || source.sourceKind === ASSourceKind.UserEntry)\n && !source.normalizedPath.startsWith(ASSEMBLYSCRIPT_LIB_PREFIX)\n );\n\n for (const source of userSources) {\n this.visitor.visitSource(source);\n }\n }\n}\n\nexport default StripInlineTransform;\n"],"mappings":";;;;;;;;AA8BA,IAAM,qBAAN,cAAiC,WAAW;;;;CAI1C,AAAU,YAAY,MAAkB;AACtC,MAAI,gBAAgB,QAAQ,KAAK,YAAY;GAC3C,MAAM,WAAY,KAAK,WAA+B,QACnD,cAA6B,UAAU,kBAAkB,gBAAgB,OAC3E;AACD,QAAK,aAAa,SAAS,SAAS,IAAI,WAAW;;;;;;;AAQzD,IAAM,uBAAN,cAAmC,UAAU;CAC3C,AAAQ,UAAU,IAAI,oBAAoB;;;;;CAM1C,WAAW,SAAuB;EAIhC,MAAM,cAHW,KAAmB,QAAQ,QAGhB,QAAQ,YACjC,OAAO,eAAe,aAAa,QAAQ,OAAO,eAAe,aAAa,cAC5E,CAAC,OAAO,eAAe,mBAAqC,CAChE;AAED,OAAK,MAAM,UAAU,YACnB,MAAK,QAAQ,YAAY,OAAO;;;AAKtC,2BAAe"}
1
+ {"version":3,"file":"strip-inline.mjs","names":[],"sources":["../../../src/compiler/transforms/strip-inline.mts"],"sourcesContent":["/**\n * AssemblyScript Transform to strip @inline decorators\n *\n * Production code uses @inline decorators for performance. When functions are inlined,\n * coverage instrumentation can't track their execution. This transform removes @inline\n * decorators from the AST during test compilation, allowing coverage instrumentation\n * to properly track function calls.\n * \n * - Hooks into the AssemblyScript compiler's `afterParse` lifecycle\n * - Walks through all parsed source files before compilation begins\n * - Uses shared ASTVisitor to recurse into ALL node types\n * - Strips @inline decorators from any node that has them in user code\n *\n * @see https://www.assemblyscript.org/compiler.html#transforms\n * @see https://github.com/AssemblyScript/assemblyscript/blob/main/src/ast.ts\n */\n\nimport { Node, Parser, Source, DecoratorNode } from 'assemblyscript';\nimport { Transform } from 'assemblyscript/transform';\n\nimport { ASTVisitor } from '../../util/ast-visitor.js';\nimport {\n ASSEMBLYSCRIPT_LIB_PREFIX,\n ASDecoratorKind,\n ASSourceKind,\n} from '../../types/constants.js';\n\n/**\n * Visitor that strips @inline decorators from nodes\n */\nclass StripInlineVisitor extends ASTVisitor {\n /**\n * Strip @inline decorator from a node if present\n */\n protected beforeVisit(node: Node): void {\n if ('decorators' in node && node.decorators) {\n const filtered = (node.decorators as DecoratorNode[]).filter(\n (decorator: DecoratorNode) => decorator.decoratorKind !== ASDecoratorKind.Inline\n );\n node.decorators = filtered.length > 0 ? filtered : null;\n }\n }\n}\n\n/**\n * AssemblyScript compiler transform that strips @inline decorators\n */\nclass StripInlineTransform extends Transform {\n private visitor = new StripInlineVisitor();\n\n /**\n * Called after parsing is complete, before the program is initialized.\n * This is the ideal time to modify the AST.\n */\n afterParse(_parser: Parser): void {\n const sources = (this as Transform).program.sources;\n\n // Filter to user source files only\n const userSources = sources.filter((source: Source) =>\n (source.sourceKind === ASSourceKind.User || source.sourceKind === ASSourceKind.UserEntry)\n && !source.normalizedPath.startsWith(ASSEMBLYSCRIPT_LIB_PREFIX)\n );\n\n for (const source of userSources) {\n this.visitor.visitSource(source);\n }\n }\n}\n\nexport default StripInlineTransform;\n"],"mappings":";;;;;;;;AA8BA,IAAM,qBAAN,cAAiC,WAAW;;;;CAI1C,AAAU,YAAY,MAAkB;AACtC,MAAI,gBAAgB,QAAQ,KAAK,YAAY;GAC3C,MAAM,WAAY,KAAK,WAA+B,QACnD,cAA6B,UAAU,kBAAkB,gBAAgB,OAC3E;AACD,QAAK,aAAa,SAAS,SAAS,IAAI,WAAW;;;;;;;AAQzD,IAAM,uBAAN,cAAmC,UAAU;CAC3C,AAAQ,UAAU,IAAI,oBAAoB;;;;;CAM1C,WAAW,SAAuB;EAIhC,MAAM,cAHW,KAAmB,QAAQ,QAGhB,QAAQ,YACjC,OAAO,eAAe,aAAa,QAAQ,OAAO,eAAe,aAAa,cAC5E,CAAC,OAAO,eAAe,mBAAqC,CAChE;AAED,OAAK,MAAM,UAAU,YACnB,MAAK,QAAQ,YAAY,OAAO"}
@@ -0,0 +1,147 @@
1
+ import { POOL_ERROR_NAMES } from "./constants-DuBLuMjt.mjs";
2
+ import { createPoolError, debug, throwPoolErrorIfAborted } from "./debug-Cm1VFmaz.mjs";
3
+ import { clearNativeBuildError, hasNativeBuildError, warnASInstrumentationNotLoaded } from "./feature-check-CNyjFX9M.mjs";
4
+ import { basename, resolve } from "node:path";
5
+ import { access, readFile } from "node:fs/promises";
6
+ import { main } from "assemblyscript/asc";
7
+
8
+ //#region src/compiler/index.ts
9
+ /**
10
+ * AssemblyScript Compiler
11
+ *
12
+ * Handles compilation of AssemblyScript source code to WASM binaries.
13
+ * Manages compiler options, transforms, and in-memory compilation.
14
+ */
15
+ let nativeAddon;
16
+ try {
17
+ nativeAddon = await import("./addon-interface-7FPjYh7J.mjs");
18
+ clearNativeBuildError();
19
+ } catch (err) {
20
+ if (await hasNativeBuildError()) debug(`[Compiler] Native instrumentation addon not loaded (known build failure): ${err?.message ?? String(err)}`);
21
+ else warnASInstrumentationNotLoaded(err?.message ?? String(err));
22
+ }
23
+ const POOL_ASSEMBLY_NODE_MODULES_PREFIX = "node_modules/vitest-pool-assemblyscript/assembly/";
24
+ const STRIP_INLINE_TRANSFORM = resolve(import.meta.dirname, "./compiler/transforms/strip-inline.mjs");
25
+ setImmediate(async () => {
26
+ try {
27
+ await access(STRIP_INLINE_TRANSFORM);
28
+ } catch {
29
+ throw createPoolError(`AS Compiler strip inline transform file not found at "${STRIP_INLINE_TRANSFORM}"`, POOL_ERROR_NAMES.CompilationError);
30
+ }
31
+ });
32
+ /**
33
+ * Compile AssemblyScript source code to WASM binary
34
+ */
35
+ async function compileAssemblyScript(filename, options, logModule, logLabel, signal) {
36
+ throwPoolErrorIfAborted(signal);
37
+ const compileStart = performance.now();
38
+ const logPrefix = `[${logModule} ASC] ${logLabel}`;
39
+ const { shouldInstrument, instrumentationOptions, extraFlags } = options;
40
+ if (shouldInstrument && !instrumentationOptions) throw createPoolError("Instrumentation options are required for coverage instrumentation", POOL_ERROR_NAMES.CompilationError);
41
+ const stdoutLines = [];
42
+ const stderrLines = [];
43
+ let binary;
44
+ let sourceMap;
45
+ const entryFile = filename;
46
+ const outputFile = "output.wasm";
47
+ debug(`${logPrefix} - Compiling: "${filename}"`);
48
+ const stdout = { write: (text) => {
49
+ stdoutLines.push(text);
50
+ return true;
51
+ } };
52
+ const stderr = { write: (text) => {
53
+ stderrLines.push(text);
54
+ return true;
55
+ } };
56
+ const compilerFlags = [
57
+ entryFile,
58
+ "--optimizeLevel",
59
+ "0",
60
+ "--shrinkLevel",
61
+ "0",
62
+ "--runtime",
63
+ "stub",
64
+ ...extraFlags || [],
65
+ "--outFile",
66
+ outputFile,
67
+ "--importMemory",
68
+ "--debug",
69
+ "--sourceMap",
70
+ "--exportStart",
71
+ "_start",
72
+ "--exportTable"
73
+ ];
74
+ if (options.stripInline === true) {
75
+ compilerFlags.push("--transform", STRIP_INLINE_TRANSFORM);
76
+ debug(`${logPrefix} - Added Transform - Stripping @inline decorators`);
77
+ }
78
+ const ascStart = performance.now();
79
+ const result = await main(compilerFlags, {
80
+ stdout,
81
+ stderr,
82
+ writeFile: (name, contents, _baseDir) => {
83
+ throwPoolErrorIfAborted(signal);
84
+ if (name.endsWith(".wasm") && contents instanceof Uint8Array) {
85
+ binary = contents;
86
+ debug(`${logPrefix} - Captured binary in memory: "${name}"`);
87
+ } else if (name.endsWith(".wasm.map") && typeof contents === "string") {
88
+ debug(`${logPrefix} - Captured source map in memory: "${name}"`);
89
+ sourceMap = contents;
90
+ } else debug(`${logPrefix} - WARNING - Captured Unexpected File: "${name}" at baseDir: "${_baseDir}"`);
91
+ },
92
+ readFile: async (filename, baseDir) => {
93
+ const filePath = resolve(baseDir, filename);
94
+ try {
95
+ return await readFile(filePath, { encoding: "utf-8" });
96
+ } catch {
97
+ if (filename.startsWith(POOL_ASSEMBLY_NODE_MODULES_PREFIX)) {
98
+ const localPath = resolve(baseDir, "assembly", filename.substring(49));
99
+ try {
100
+ return await readFile(localPath, { encoding: "utf-8" });
101
+ } catch {
102
+ return null;
103
+ }
104
+ }
105
+ return null;
106
+ }
107
+ }
108
+ });
109
+ debug(`${logPrefix} - TIMING asc.main: ${(performance.now() - ascStart).toFixed(2)} ms`);
110
+ if (result.error) {
111
+ const errorMessage = stderrLines.length > 0 ? `${result.error.message}\n\n${stderrLines.join("")}` : result.error.message;
112
+ throw createPoolError(errorMessage, POOL_ERROR_NAMES.CompilationError, errorMessage);
113
+ }
114
+ if (!binary) throw createPoolError(stderrLines.length > 0 ? `No WASM binary was generated\n\nAS Compiler output:\n${stderrLines.join("")}` : "No WASM binary was generated", POOL_ERROR_NAMES.CompilationError);
115
+ if (!sourceMap) throw createPoolError("Source map not captured from AssemblyScript Compiler", POOL_ERROR_NAMES.CompilationError);
116
+ const cleanBinary = binary;
117
+ const wasmSourceMap = sourceMap;
118
+ debug(`${logPrefix} - Compilation successful, clean binary size: ${cleanBinary.length} bytes`);
119
+ debug(`${logPrefix} - Source map generated, size: ${wasmSourceMap.length * 2} bytes`);
120
+ if (options.shouldInstrument && nativeAddon) {
121
+ throwPoolErrorIfAborted(signal);
122
+ const instrumentStart = performance.now();
123
+ const wasmBuffer = Buffer.from(cleanBinary);
124
+ const sourceMapBuffer = Buffer.from(wasmSourceMap);
125
+ const instrumentResult = nativeAddon.instrumentForCoverage(wasmBuffer, sourceMapBuffer, options.instrumentationOptions, logModule, logLabel);
126
+ const instCount = instrumentResult.debugInfo.instrumentedFunctionCount;
127
+ const instrumentEnd = performance.now();
128
+ debug(`${logPrefix} - TIMING Instrumented ${instCount} functions: ${(performance.now() - instrumentStart).toFixed(2)} ms`);
129
+ return {
130
+ binary: instrumentResult.instrumentedWasm,
131
+ sourceMap: instrumentResult.sourceMap,
132
+ debugInfo: instrumentResult.debugInfo,
133
+ isInstrumented: true,
134
+ compileTiming: instrumentEnd - compileStart
135
+ };
136
+ }
137
+ return {
138
+ binary: cleanBinary,
139
+ sourceMap: wasmSourceMap,
140
+ isInstrumented: false,
141
+ compileTiming: performance.now() - compileStart
142
+ };
143
+ }
144
+
145
+ //#endregion
146
+ export { compileAssemblyScript };
147
+ //# sourceMappingURL=compiler-YMrl5MY_.mjs.map
@@ -0,0 +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.now() - compileStart,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAqBA,IAAI;AACJ,IAAI;AACF,eAAc,MAAM,OAAO;AAE3B,wB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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,5 +1,5 @@
1
- import { AssemblyScriptPoolOptions, WasmImportsFactory, WasmImportsFactoryInfo } from "../types-DmyeERkL.mjs";
2
- import "../custom-provider-options-i_O0OSTV.mjs";
1
+ import { AssemblyScriptPoolOptions, WasmImportsFactory, WasmImportsFactoryInfo } from "../types-D0nprJo1.mjs";
2
+ import "../custom-provider-options-YTk1m7At.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-DmyeERkL.mjs";
2
- import "../custom-provider-options-i_O0OSTV.mjs";
3
- import { createAssemblyScriptPool } from "../pool-runner-init-D56aVMMD.mjs";
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";
4
4
  export { type AssemblyScriptPoolOptions, type WasmImportsFactory, type WasmImportsFactoryInfo, createAssemblyScriptPool };
@@ -1,9 +1,9 @@
1
1
  import "../constants-DuBLuMjt.mjs";
2
2
  import "../resolve-config-BFNr7LW7.mjs";
3
3
  import "../debug-Cm1VFmaz.mjs";
4
- import "../vitest-file-tasks-BUwzh375.mjs";
5
- import "../vitest-tasks-ByPK8DvF.mjs";
6
- import "../worker-rpc-channel-lbhK7Qz8.mjs";
7
- import { createAssemblyScriptPool } from "../pool-runner-init-D1QamWkS.mjs";
4
+ import "../vitest-file-tasks-Bn9CrWt_.mjs";
5
+ import "../vitest-tasks--ow4pacR.mjs";
6
+ import "../worker-rpc-channel-CZZIxtv5.mjs";
7
+ import { createAssemblyScriptPool } from "../pool-runner-init-D8Ei957C.mjs";
8
8
 
9
9
  export { createAssemblyScriptPool };
@@ -19,4 +19,4 @@ function mergeCoverageData(accumulated, incoming) {
19
19
 
20
20
  //#endregion
21
21
  export { mergeCoverageData };
22
- //# sourceMappingURL=coverage-merge-DCEwyjMy.mjs.map
22
+ //# sourceMappingURL=coverage-merge-CBXkpM1O.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"coverage-merge-DCEwyjMy.mjs","names":[],"sources":["../src/coverage-provider/coverage-merge.ts"],"sourcesContent":["/**\n * Coverage Data Merge Utilities\n *\n * Functions for merging CoverageData objects\n */\n\nimport type { CoverageData } from '../types/types.js';\n\n/**\n * Merge incoming CoverageData into accumulated CoverageData\n *\n * Combines by filepath + position, summing hit counts.\n * Mutates the accumulated object in place.\n *\n * @param accumulated - Accumulated coverage data (mutated)\n * @param incoming - New coverage data to merge in\n */\nexport function mergeCoverageData(\n accumulated: CoverageData,\n incoming: CoverageData\n): void {\n for (const [filePath, positions] of Object.entries(incoming.hitCountsByFileAndPosition)) {\n // Ensure file exists in accumulated\n if (!accumulated.hitCountsByFileAndPosition[filePath]) {\n accumulated.hitCountsByFileAndPosition[filePath] = {};\n }\n\n const accumulatedPositions = accumulated.hitCountsByFileAndPosition[filePath];\n\n for (const [positionKey, hitCount] of Object.entries(positions)) {\n if (accumulatedPositions[positionKey] !== undefined) {\n // Position exists - sum hit counts\n accumulatedPositions[positionKey] += hitCount;\n } else {\n // New position - set hit count\n accumulatedPositions[positionKey] = hitCount;\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;AAiBA,SAAgB,kBACd,aACA,UACM;AACN,MAAK,MAAM,CAAC,UAAU,cAAc,OAAO,QAAQ,SAAS,2BAA2B,EAAE;AAEvF,MAAI,CAAC,YAAY,2BAA2B,UAC1C,aAAY,2BAA2B,YAAY,EAAE;EAGvD,MAAM,uBAAuB,YAAY,2BAA2B;AAEpE,OAAK,MAAM,CAAC,aAAa,aAAa,OAAO,QAAQ,UAAU,CAC7D,KAAI,qBAAqB,iBAAiB,OAExC,sBAAqB,gBAAgB;MAGrC,sBAAqB,eAAe"}
1
+ {"version":3,"file":"coverage-merge-CBXkpM1O.mjs","names":[],"sources":["../src/coverage-provider/coverage-merge.ts"],"sourcesContent":["/**\n * Coverage Data Merge Utilities\n *\n * Functions for merging CoverageData objects\n */\n\nimport type { CoverageData } from '../types/types.js';\n\n/**\n * Merge incoming CoverageData into accumulated CoverageData\n *\n * Combines by filepath + position, summing hit counts.\n * Mutates the accumulated object in place.\n *\n * @param accumulated - Accumulated coverage data (mutated)\n * @param incoming - New coverage data to merge in\n */\nexport function mergeCoverageData(\n accumulated: CoverageData,\n incoming: CoverageData\n): void {\n for (const [filePath, positions] of Object.entries(incoming.hitCountsByFileAndPosition)) {\n // Ensure file exists in accumulated\n if (!accumulated.hitCountsByFileAndPosition[filePath]) {\n accumulated.hitCountsByFileAndPosition[filePath] = {};\n }\n\n const accumulatedPositions = accumulated.hitCountsByFileAndPosition[filePath];\n\n for (const [positionKey, hitCount] of Object.entries(positions)) {\n if (accumulatedPositions[positionKey] !== undefined) {\n // Position exists - sum hit counts\n accumulatedPositions[positionKey] += hitCount;\n } else {\n // New position - set hit count\n accumulatedPositions[positionKey] = hitCount;\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;AAiBA,SAAgB,kBACd,aACA,UACM;AACN,MAAK,MAAM,CAAC,UAAU,cAAc,OAAO,QAAQ,SAAS,2BAA2B,EAAE;AAEvF,MAAI,CAAC,YAAY,2BAA2B,UAC1C,aAAY,2BAA2B,YAAY,EAAE;EAGvD,MAAM,uBAAuB,YAAY,2BAA2B;AAEpE,OAAK,MAAM,CAAC,aAAa,aAAa,OAAO,QAAQ,UAAU,CAC7D,KAAI,qBAAqB,iBAAiB,OAExC,sBAAqB,gBAAgB;MAGrC,sBAAqB,eAAe"}
@@ -1,15 +1,15 @@
1
1
  import { ASCommonFlags, ASNodeKind, COVERAGE_PAYLOAD_FORMATS, POOL_ERROR_NAMES } from "../constants-DuBLuMjt.mjs";
2
2
  import { getProjectSerializedOrGlobalConfig } from "../resolve-config-BFNr7LW7.mjs";
3
3
  import { createPoolError, debug, debugOverride } from "../debug-Cm1VFmaz.mjs";
4
- import { warnIfASCoverageNotSupported } from "../node-check-CooGQMLH.mjs";
5
- import { mergeCoverageData } from "../coverage-merge-DCEwyjMy.mjs";
6
- import { ASTVisitor } from "../ast-visitor-DJLJd5dt.mjs";
4
+ import { toForwardSlash } from "../path-utils-t9OzjXYF.mjs";
5
+ import { warnIfASCoverageNotSupportedByNode, warnIfNativeBuildFailed } from "../feature-check-CNyjFX9M.mjs";
6
+ import { mergeCoverageData } from "../coverage-merge-CBXkpM1O.mjs";
7
+ import { ASTVisitor } from "../ast-visitor-C5gQqWD2.mjs";
7
8
  import { basename, parse, relative } from "node:path";
8
9
  import { readFile } from "node:fs/promises";
9
10
  import v8CoverageModule from "@vitest/coverage-v8";
10
11
  import istanbulCoverage from "istanbul-lib-coverage";
11
12
  import { Parser } from "assemblyscript";
12
- import { relative as relative$1 } from "path";
13
13
  import { globSync } from "tinyglobby";
14
14
 
15
15
  //#region src/coverage-provider/containment-matcher.ts
@@ -343,8 +343,8 @@ function globFiles(include, exclude, projectRoot) {
343
343
  ignore: [NODE_MODULES_GLOB, ...exclude],
344
344
  absolute: true
345
345
  }).map((absolute) => ({
346
- absolute,
347
- projectRootRelative: relative$1(projectRoot, absolute)
346
+ absolute: toForwardSlash(absolute),
347
+ projectRootRelative: toForwardSlash(relative(projectRoot, absolute))
348
348
  }));
349
349
  }
350
350
 
@@ -376,7 +376,8 @@ var HybridCoverageProvider = class {
376
376
  await this.v8Provider.initialize(ctx);
377
377
  this.v8Provider.name = "hybrid-assemblyscript-v8 (delegated v8 reporter)";
378
378
  debug("[HybridCoverageProvider] Initialized with delegated v8 provider");
379
- warnIfASCoverageNotSupported();
379
+ warnIfASCoverageNotSupportedByNode();
380
+ await warnIfNativeBuildFailed();
380
381
  }
381
382
  /**
382
383
  * Handle suite completion - delegate based on coverage format marker
@@ -430,9 +431,9 @@ var HybridCoverageProvider = class {
430
431
  return `[HybridCoverageProvider] Accumulated coverage data has ${Object.values(this.accumulatedCoverageData.hitCountsByFileAndPosition).reduce((sum, positions) => sum + Object.keys(positions)?.length, 0)} unique positions hit across ${Object.keys(this.accumulatedCoverageData.hitCountsByFileAndPosition).length} debug source files`;
431
432
  });
432
433
  const fileProcessingPromises = this.coverageOptions.globbedAssemblyScriptInclude.map(async (include) => {
433
- debug(`[HybridCoverageProvider] Parsing AS source for expected coverage: "${include.absolute}" (file key: "${include.projectRootRelative}")`);
434
+ debug(`[HybridCoverageProvider] Parsing AS source for expected coverage: "${include.absolute}"`);
434
435
  const functionsByStartLine = await parseFunctionsFromFile(include.absolute, include.projectRootRelative) || {};
435
- debug(`[HybridCoverageProvider] Parsed ${Object.keys(functionsByStartLine).length} AS source functions in "${include.projectRootRelative}"`);
436
+ debug(`[HybridCoverageProvider] Parsed ${Object.keys(functionsByStartLine).length} AS source functions in "${include.absolute}"`);
436
437
  const fileHitCountsByPosition = this.accumulatedCoverageData.hitCountsByFileAndPosition[include.absolute] ?? {};
437
438
  debug(`[HybridCoverageProvider] Accumulated AS coverage has ${Object.keys(fileHitCountsByPosition).length} positions for "${include.absolute}"`);
438
439
  return convertToIstanbulFormat(functionsByStartLine, fileHitCountsByPosition, include.absolute, this.coverageOptions.debugIstanbul);
@@ -536,8 +537,7 @@ const hybridProviderModule = {
536
537
  else throw createPoolError("HybridCoverageProvider - v8 coverage module does not provide `stopCoverage`", POOL_ERROR_NAMES.HybridCoverageProviderError);
537
538
  }
538
539
  };
539
- var coverage_provider_default = hybridProviderModule;
540
540
 
541
541
  //#endregion
542
- export { coverage_provider_default as default };
542
+ export { hybridProviderModule as default };
543
543
  //# sourceMappingURL=index.mjs.map