vitest-pool-assemblyscript 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +114 -314
- package/dist/{ast-visitor-DC3SuTzs.mjs → ast-visitor-lTahoS9R.mjs} +2 -2
- package/dist/{ast-visitor-DC3SuTzs.mjs.map → ast-visitor-lTahoS9R.mjs.map} +1 -1
- package/dist/{compile-runner-xGvQwgNf.mjs → compile-runner-C9TJrfCl.mjs} +6 -6
- package/dist/{compile-runner-xGvQwgNf.mjs.map → compile-runner-C9TJrfCl.mjs.map} +1 -1
- package/dist/compiler/transforms/strip-inline.mjs +2 -2
- package/dist/{compiler-CN6BRK_N.mjs → compiler-BaNECXMW.mjs} +3 -3
- package/dist/{compiler-CN6BRK_N.mjs.map → compiler-BaNECXMW.mjs.map} +1 -1
- package/dist/config/index.mjs +5 -4
- package/dist/{constants-CA50WBdr.mjs → constants-DX9yo-el.mjs} +11 -2
- package/dist/constants-DX9yo-el.mjs.map +1 -0
- package/dist/coverage-provider/index.mjs +6 -5
- package/dist/coverage-provider/index.mjs.map +1 -1
- package/dist/{debug-IeEHsxy0.mjs → debug-Cf2jt1kg.mjs} +2 -2
- package/dist/{debug-IeEHsxy0.mjs.map → debug-Cf2jt1kg.mjs.map} +1 -1
- package/dist/index-internal.mjs +3 -2
- package/dist/index-v3.mjs +4 -4
- package/dist/index.mjs +5 -4
- package/dist/{load-user-imports-Bbmpaciu.mjs → load-user-imports-CcIdE4_0.mjs} +4 -4
- package/dist/{load-user-imports-Bbmpaciu.mjs.map → load-user-imports-CcIdE4_0.mjs.map} +1 -1
- package/dist/{pool-runner-init-d5qScS41.mjs → pool-runner-init-Cdpz_B-F.mjs} +6 -6
- package/dist/pool-runner-init-Cdpz_B-F.mjs.map +1 -0
- package/dist/pool-thread/compile-worker-thread.mjs +6 -5
- package/dist/pool-thread/compile-worker-thread.mjs.map +1 -1
- package/dist/pool-thread/test-worker-thread.mjs +5 -4
- package/dist/pool-thread/test-worker-thread.mjs.map +1 -1
- package/dist/pool-thread/v3-tinypool-thread.mjs +7 -6
- package/dist/pool-thread/v3-tinypool-thread.mjs.map +1 -1
- package/dist/{resolve-config-as1w-Qyz.mjs → resolve-config-BKjJQyy5.mjs} +3 -3
- package/dist/{resolve-config-as1w-Qyz.mjs.map → resolve-config-BKjJQyy5.mjs.map} +1 -1
- package/dist/{test-runner-BR4XyhMA.mjs → test-runner-DZd3SxEc.mjs} +4 -4
- package/dist/{test-runner-BR4XyhMA.mjs.map → test-runner-DZd3SxEc.mjs.map} +1 -1
- package/dist/{vitest-tasks-BKS7689f.mjs → vitest-tasks-Cbri6MWZ.mjs} +3 -3
- package/dist/{vitest-tasks-BKS7689f.mjs.map → vitest-tasks-Cbri6MWZ.mjs.map} +1 -1
- package/package.json +1 -1
- package/dist/constants-CA50WBdr.mjs.map +0 -1
- package/dist/pool-runner-init-d5qScS41.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -2,305 +2,160 @@
|
|
|
2
2
|
|
|
3
3
|
AssemblyScript unit testing for your Vitest workflow: Simple, fast, familiar, AS-native.
|
|
4
4
|
|
|
5
|
-
This is a [Vitest](https://vitest.dev) [
|
|
5
|
+
This is a [Vitest](https://vitest.dev) [custom pool](https://vitest.dev/guide/advanced/pool.html) which can compile AssemblyScript to WASM, harness WASM to run tests, and report those results to vitest. It co-exists with existing JavaScript/TypeScript tests, and is designed for incremental adoption.
|
|
6
6
|
|
|
7
|
-
- [
|
|
7
|
+
- [Quick Start](#quick-start)
|
|
8
|
+
- [Compatibility](#compatibility)
|
|
8
9
|
- [Features](#features)
|
|
9
|
-
- [Configuration](
|
|
10
|
-
- [
|
|
10
|
+
- [Configuration Guide](docs/configuration-guide.md)
|
|
11
|
+
- [Providing WASM Imports](docs/providing-wasm-imports.md)
|
|
12
|
+
- [Writing Tests Guide](#writing-tests-guide)
|
|
11
13
|
- [Matcher API](#matcher-api)
|
|
12
14
|
- [Project Status & Expectations](#project-status--expectations)
|
|
13
|
-
- [
|
|
15
|
+
- [License](#license)
|
|
14
16
|
|
|
15
|
-
**Note: 🚧 This project is
|
|
16
|
-
-
|
|
17
|
+
**Note: 🚧 This project is still early-stage and currently *Under Active Development* 🚧**
|
|
18
|
+
- All features listed in the [Features](#features) section are stable and assumed to be bug-free
|
|
19
|
+
- Native instrumentation prebuilds are available cross-platform
|
|
20
|
+
- Expect matchers are stable (except where noted below), with more coming soon
|
|
21
|
+
- See [Project Status & Expectations](#project-status--expectations) to see what's still planned!
|
|
17
22
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
## Quickstart
|
|
21
|
-
|
|
22
|
-
Coming Soon!
|
|
23
|
+
Please [report a bug / request a feature](https://github.com/themattspiral/vitest-pool-assemblyscript/issues/new) if you encounter something you'd like to share!
|
|
23
24
|
|
|
24
25
|
---
|
|
25
26
|
|
|
26
|
-
##
|
|
27
|
-
|
|
28
|
-
### Vitest Integration
|
|
29
|
-
- Use familiar `vitest` commands, CLI spec and test filtering, watch mode
|
|
30
|
-
- Works with Vitest UI, reporters, and coverage tools
|
|
31
|
-
- Project (workspace) config allows coexisting AssemblyScript pools and JavaScript pools
|
|
32
|
-
- Hybrid Coverage Provider unifies test reports from multiple pools (delegating to v8 for JS/TS coverage)
|
|
33
|
-
- Coverage reporting using any vitest reporter (`html`, `lcov`, `json`, etc)
|
|
34
|
-
- Dual vitest 3.x / 4.x support
|
|
35
|
-
|
|
36
|
-
### Per-Test WASM Isolation
|
|
37
|
-
- Each AssemblyScript test file is compiled to a WASM binary once
|
|
38
|
-
- Each test case runs in a fresh WASM instance (reusing the compiled binary)
|
|
39
|
-
- One crashing test doesn't kill the rest within the same suite
|
|
40
|
-
- `toThrowError()` matcher can be used to catch and expect specific errors (which trap and abort)
|
|
41
|
-
|
|
42
|
-
### Familiar Developer Experience
|
|
43
|
-
- Suite and test definition using `describe()` and `test()` in AssemblyScript
|
|
44
|
-
- Inline test option configuration for common vitest options: `timeout`, `retry`, `skip`, `only`, `fails`
|
|
45
|
-
- Assertion matching API based on vitest/jest `expect()` API. See [Matcher API](#matcher-api) for the set of supported matchers and differences from JavaScript
|
|
46
|
-
- Highlighted diffs for assertion and runtime failures, which point to source code
|
|
47
|
-
- Source-mapped WASM error stack traces (accurate source `function file:line:column`)
|
|
48
|
-
- AssemblyScript console output captured and provided to vitest for display
|
|
49
|
-
- No boilerplate patterns for: `run()`, `endTest()`, `fs.readFile`, `WebAssembly.Instance`, etc
|
|
50
|
-
|
|
51
|
-
### Performance & Customization
|
|
52
|
-
- Parallel execution thread pool
|
|
53
|
-
- Lightweight coverage instrumentation using separate memory
|
|
54
|
-
- In-memory binaries and source maps for minimal file I/O
|
|
55
|
-
- Coverage for inlined (`@inline`) code
|
|
56
|
-
- Enforced hard timeouts for long-running WASM via thread termination, with intelligent resume
|
|
57
|
-
- Configurable AssemblyScript compiler options
|
|
58
|
-
- Configurable test memory size
|
|
59
|
-
- Configurable WASM imports with access to memory
|
|
60
|
-
|
|
61
|
-
### Why This Over [Alternative]?
|
|
27
|
+
## Quick Start
|
|
62
28
|
|
|
63
|
-
|
|
64
|
-
- [assemblyscript-unittest-framework](https://github.com/wasm-ecosystem/assemblyscript-unittest-framework): A full-featured AS test framework
|
|
65
|
-
- Many thanks owed to this project for inspiring parts of our discovery and instrumentation approach
|
|
66
|
-
- [as-test](https://github.com/JairusSW/as-test): A minimal and fast AssemblyScript test framework and runner
|
|
67
|
-
- [Built with AssemblyScript - Testing & Benchmarking](https://www.assemblyscript.org/built-with-assemblyscript.html#testing-benchmarking) may track more
|
|
29
|
+
### 1. Install
|
|
68
30
|
|
|
69
|
-
|
|
31
|
+
```bash
|
|
32
|
+
npm install -D vitest vitest-pool-assemblyscript assemblyscript
|
|
33
|
+
```
|
|
70
34
|
|
|
71
|
-
|
|
35
|
+
### 2. Configure Vitest
|
|
72
36
|
|
|
73
|
-
|
|
74
|
-
- The `test` project configuration helpers needed depend on which version of vitest you're using.
|
|
75
|
-
- The `coverage` configuration is the same across versions (shown in the first example below).
|
|
37
|
+
Create or update `vitest.config.ts`. See the [Configuration Guide](docs/configuration-guide.md) for all supported vitest options, pool options, coverage configuration, and multi-project setups.
|
|
76
38
|
|
|
77
|
-
|
|
39
|
+
**vitest 4.x:**
|
|
78
40
|
```typescript
|
|
79
|
-
import { defineConfig
|
|
41
|
+
import { defineConfig } from 'vitest/config';
|
|
80
42
|
import { createAssemblyScriptPool } from 'vitest-pool-assemblyscript/config';
|
|
81
43
|
|
|
82
44
|
export default defineConfig({
|
|
83
45
|
test: {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
defineProject({
|
|
87
|
-
test: {
|
|
88
|
-
name: {
|
|
89
|
-
label: 'assemblyscript-tests',
|
|
90
|
-
color: 'yellow'
|
|
91
|
-
},
|
|
92
|
-
include: ['test/assembly/**/*.as.{test,spec}.ts'],
|
|
93
|
-
|
|
94
|
-
// supported vitest options
|
|
95
|
-
bail: 2, // stop test run after this many failures
|
|
96
|
-
retry: 0, // number of retries to attempt after initial failure
|
|
97
|
-
testTimeout: 500, // ms to wait before terminating test
|
|
98
|
-
// allowOnly: true, // whether or not to respect test.only and describe.only
|
|
99
|
-
// maxWorkers: 8, // concurrent file execution threads (default: available parallelism)
|
|
100
|
-
|
|
101
|
-
// configure vitest to use this custom pool for test files in `include`
|
|
102
|
-
pool: createAssemblyScriptPool({
|
|
103
|
-
stripInline: true, // true to remove @inline decorators for coverage (default: true)
|
|
104
|
-
testMemoryPagesInitial: 2, // initial WASM memory size in pages (default: 1)
|
|
105
|
-
testMemoryPagesMax: 4, // maximum WASM memory size in pages (default: undefined)
|
|
106
|
-
extraCompilerFlags: ['--runtime', 'incremental'], // additional asc flags to customize AS compilation
|
|
107
|
-
wasmImportsFactory: 'test-helpers/create-imports.js', // factory function to create your own WASM imports
|
|
108
|
-
}),
|
|
109
|
-
}
|
|
110
|
-
}),
|
|
111
|
-
|
|
112
|
-
// JavaScript/TypeScript project
|
|
113
|
-
defineProject({
|
|
114
|
-
test: {
|
|
115
|
-
name: {
|
|
116
|
-
label: 'javascript-typescript-tests',
|
|
117
|
-
color: 'blue'
|
|
118
|
-
},
|
|
119
|
-
include: ['test/js/*.{test,spec}.{ts,js}'],
|
|
120
|
-
}
|
|
121
|
-
}),
|
|
122
|
-
]
|
|
46
|
+
include: ['test/assembly/**/*.as.test.ts'],
|
|
47
|
+
pool: createAssemblyScriptPool(),
|
|
123
48
|
},
|
|
124
|
-
|
|
125
|
-
// Coverage config must be at root level (applies to all projects).
|
|
126
|
-
// The "hybrid" provider delegates JS to v8, and merges AS coverage into the final report
|
|
127
49
|
coverage: {
|
|
128
50
|
provider: 'custom',
|
|
129
51
|
customProviderModule: 'vitest-pool-assemblyscript/coverage',
|
|
130
|
-
assemblyScriptInclude: ['assembly/**/*.ts'],
|
|
131
|
-
assemblyScriptExclude: ['assembly/helpers/*.ts'], // example, exclude AS sources from reporting
|
|
132
|
-
|
|
133
|
-
// all other v8 coverage options will be passed through to delegated v8 provider
|
|
52
|
+
assemblyScriptInclude: ['assembly/**/*.ts'],
|
|
134
53
|
enabled: true,
|
|
135
|
-
cleanOnRerun: true,
|
|
136
|
-
reportsDirectory: './coverage',
|
|
137
|
-
reporter: ['text', 'lcov', 'html'],
|
|
138
|
-
include: ['src/**/*.ts'], // example, include JS/TS sources to report on
|
|
139
54
|
},
|
|
140
55
|
});
|
|
141
56
|
```
|
|
142
57
|
|
|
143
|
-
|
|
58
|
+
**vitest 3.x:**
|
|
144
59
|
```typescript
|
|
145
|
-
import {
|
|
146
|
-
import { createAssemblyScriptPool } from 'vitest-pool-assemblyscript/config';
|
|
60
|
+
import { defineAssemblyScriptConfig } from 'vitest-pool-assemblyscript/v3/config';
|
|
147
61
|
|
|
148
|
-
export default
|
|
62
|
+
export default defineAssemblyScriptConfig({
|
|
149
63
|
test: {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}),
|
|
64
|
+
include: ['test/assembly/**/*.as.test.ts'],
|
|
65
|
+
pool: 'vitest-pool-assemblyscript/v3',
|
|
153
66
|
},
|
|
154
|
-
coverage
|
|
155
|
-
// no change to available options
|
|
156
|
-
}
|
|
67
|
+
// coverage configuration mirrors v4
|
|
157
68
|
});
|
|
158
69
|
```
|
|
159
70
|
|
|
160
|
-
###
|
|
71
|
+
### 3. Write a Test
|
|
72
|
+
|
|
73
|
+
Create a test file (e.g. `test/assembly/example-file.as.test.ts`):
|
|
74
|
+
|
|
161
75
|
```typescript
|
|
162
|
-
import {
|
|
163
|
-
import { defineAssemblyScriptProject } from 'vitest-pool-assemblyscript/v3/config';
|
|
76
|
+
import { test, describe, expect } from "vitest-pool-assemblyscript/assembly";
|
|
164
77
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
test: {
|
|
175
|
-
// AS project config... (standard name/label, include, etc)
|
|
176
|
-
|
|
177
|
-
pool: 'vitest-pool-assemblyscript/v3', // in v3, point to the module
|
|
178
|
-
poolOptions: {
|
|
179
|
-
assemblyScript: {
|
|
180
|
-
// same available options as v4 createAssemblyScriptPool are passed here
|
|
181
|
-
|
|
182
|
-
// Additonal - v3 Only
|
|
183
|
-
// maxThreadsV3: 8 // concurrent test file threads to execute (default: availableParallelism - 1)
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
})
|
|
188
|
-
]
|
|
189
|
-
},
|
|
190
|
-
|
|
78
|
+
test("basic math", () => {
|
|
79
|
+
expect(2 + 2).toBe(4);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
describe("an example suite", () => {
|
|
83
|
+
test("string equality", () => {
|
|
84
|
+
expect("hello").toBe("hello");
|
|
85
|
+
expect("hello").not.toBe("world");
|
|
86
|
+
});
|
|
191
87
|
});
|
|
192
88
|
```
|
|
193
89
|
|
|
194
|
-
###
|
|
195
|
-
```typescript
|
|
196
|
-
import { defineAssemblyScriptConfig } from 'vitest-pool-assemblyscript/v3/config';
|
|
90
|
+
### 4. Run
|
|
197
91
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
pool: 'vitest-pool-assemblyscript/v3',
|
|
201
|
-
poolOptions: {
|
|
202
|
-
assemblyScript: {
|
|
203
|
-
// same available options as v4 createAssemblyScriptPool and v3 multi-project
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
});
|
|
92
|
+
```bash
|
|
93
|
+
npx vitest run
|
|
208
94
|
```
|
|
209
95
|
|
|
210
|
-
|
|
96
|
+
---
|
|
211
97
|
|
|
212
|
-
|
|
213
|
-
The pool provides the full implementation of the [AssemblyScript `console` interface](https://www.assemblyscript.org/stdlib/console.html). This means you can transparently use `console.log("some string")` in your tests, and the output will be fed to vitest and displayed with the test results.
|
|
98
|
+
## Compatibility
|
|
214
99
|
|
|
215
|
-
|
|
100
|
+
| Dependency | Supported Versions |
|
|
101
|
+
|---|---|
|
|
102
|
+
| Node.js | 20, 22, 24+ |
|
|
103
|
+
| Vitest | 3.2.x, 4.x |
|
|
104
|
+
| AssemblyScript | 0.28+ |
|
|
216
105
|
|
|
217
|
-
|
|
218
|
-
The pool also provides an implementation for `trace`, which passes through to Node `console.trace()` immediately for debugging.
|
|
106
|
+
**Platforms with prebuilt native binaries:**
|
|
219
107
|
|
|
220
|
-
|
|
221
|
-
|
|
108
|
+
| | x64 | arm64 |
|
|
109
|
+
|---|---|---|
|
|
110
|
+
| Linux (glibc) | ✓ | ✓ |
|
|
111
|
+
| Linux (musl/Alpine) | ✓ | |
|
|
112
|
+
| macOS | ✓ | ✓ |
|
|
113
|
+
| Windows | ✓ | ✓ |
|
|
222
114
|
|
|
115
|
+
---
|
|
223
116
|
|
|
224
|
-
|
|
225
|
-
To provide your own WebAssembly imports, configure `wasmImportsFactory` to point to an ES module which exports a factory function to create your imports:
|
|
226
|
-
```typescript
|
|
227
|
-
// v4
|
|
228
|
-
// ...
|
|
229
|
-
pool: createAssemblyScriptPool({
|
|
230
|
-
wasmImportsFactory: 'test-helpers/create-imports.js',
|
|
231
|
-
})
|
|
232
|
-
// ...
|
|
233
|
-
|
|
234
|
-
// v3
|
|
235
|
-
// ...
|
|
236
|
-
poolOptions: {
|
|
237
|
-
assemblyScript: {
|
|
238
|
-
wasmImportsFactory: 'test-helpers/create-imports.js',
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
// ...
|
|
242
|
-
```
|
|
117
|
+
## Features
|
|
243
118
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
119
|
+
### Vitest Integration
|
|
120
|
+
- Use familiar `vitest` commands, CLI spec and test filtering, watch mode
|
|
121
|
+
- Works with Vitest UI, reporters, and coverage tools
|
|
122
|
+
- Project (workspace) config allows coexisting AssemblyScript pools and JavaScript pools
|
|
123
|
+
- Hybrid Coverage Provider unifies test reports from multiple pools (delegating to v8 for JS/TS coverage)
|
|
124
|
+
- Coverage reporting using any vitest reporter (`html`, `lcov`, `json`, etc)
|
|
125
|
+
- Dual vitest 3.x / 4.x support
|
|
248
126
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
utils: {
|
|
255
|
-
// convenience function for extracting returned strings from WASM memory
|
|
256
|
-
liftString: (stringPtr: number) => string | undefined;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
```
|
|
127
|
+
### Per-Test WASM Isolation
|
|
128
|
+
- Each AssemblyScript test file is compiled to a WASM binary once
|
|
129
|
+
- Each test case runs in a fresh WASM instance (reusing the compiled binary)
|
|
130
|
+
- One crashing test doesn't kill the rest within the same suite
|
|
131
|
+
- `toThrowError()` matcher can be used to catch and expect specific errors (which trap and abort)
|
|
260
132
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
```
|
|
133
|
+
### Familiar Developer Experience
|
|
134
|
+
- Suite and test definition using `describe()` and `test()` in AssemblyScript
|
|
135
|
+
- Inline test option configuration for common vitest options: `timeout`, `retry`, `skip`, `only`, `fails`
|
|
136
|
+
- Assertion matching API based on vitest/jest `expect()` API. See [Matcher API](#matcher-api) for the set of supported matchers and differences from JavaScript
|
|
137
|
+
- Highlighted diffs for assertion and runtime failures, which point to source code
|
|
138
|
+
- Source-mapped WASM error stack traces (accurate source `function file:line:column`)
|
|
139
|
+
- AssemblyScript console output captured and provided to vitest for display
|
|
140
|
+
- No boilerplate patterns for: `run()`, `endTest()`, `fs.readFile`, `WebAssembly.Instance`, etc
|
|
273
141
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
142
|
+
### Performance & Customization
|
|
143
|
+
- Parallel execution thread pool
|
|
144
|
+
- Lightweight coverage instrumentation using separate memory
|
|
145
|
+
- In-memory binaries and source maps for minimal file I/O
|
|
146
|
+
- Coverage for inlined (`@inline`) code
|
|
147
|
+
- Enforced hard timeouts for long-running WASM via thread termination, with intelligent resume
|
|
148
|
+
- Configurable AssemblyScript compiler options
|
|
149
|
+
- Configurable test memory size
|
|
150
|
+
- Configurable WASM imports with access to memory
|
|
278
151
|
|
|
279
|
-
|
|
280
|
-
return parseIntStringFunction(input);
|
|
281
|
-
}
|
|
282
|
-
```
|
|
152
|
+
---
|
|
283
153
|
|
|
284
|
-
|
|
285
|
-
If you omit the module name in `@external` (e.g. `@external("parseIntStringFunction")`) or omit `@external` entirely, AssemblyScript uses the source file's own name (without the last file extension) as the module name, making it impractical to provide matching imports to every source file independently if you use imported functions across multiple places in your source. It is recommended to always specify a shared module name (such as "env") for this reason.
|
|
286
|
-
|
|
287
|
-
Conversely, if you need to provide imports targeted to a specific source file, this behavior provides a way to do that as well. For example, if you have a source AS file called `my-file.as.ts` with `declare function myFunc(input: string): i32;` in it and omit the `@external` decorator, then you can import the function *only to this file* with:
|
|
288
|
-
```js
|
|
289
|
-
export default function createWasmImports({ utils }) {
|
|
290
|
-
return {
|
|
291
|
-
// default source file module name (omits the .ts extension)
|
|
292
|
-
'my-file.as': {
|
|
293
|
-
myFunc: (inputStrPtr) => {
|
|
294
|
-
return parseInt(utils.liftString(inputStrPtr));
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
```
|
|
154
|
+
See also: **[Configuration Guide](docs/configuration-guide.md)** | **[Providing WASM Imports](docs/providing-wasm-imports.md)**
|
|
300
155
|
|
|
301
156
|
---
|
|
302
157
|
|
|
303
|
-
## Writing Tests
|
|
158
|
+
## Writing Tests Guide
|
|
304
159
|
|
|
305
160
|
Import `test`, `describe`, `expect` (and `TestOptions` if needed) from `vitest-pool-assemblyscript/assembly`.
|
|
306
161
|
|
|
@@ -372,6 +227,10 @@ test.fails("expected failure with retry", TestOptions.retry(3), () => {
|
|
|
372
227
|
});
|
|
373
228
|
```
|
|
374
229
|
|
|
230
|
+
### Lifecycle Hooks (Setup & Teardown)
|
|
231
|
+
|
|
232
|
+
Coming Soon!
|
|
233
|
+
|
|
375
234
|
---
|
|
376
235
|
|
|
377
236
|
## Matcher API
|
|
@@ -503,13 +362,12 @@ expect(() => { throw new Error("boom"); }).toThrowError("boom");
|
|
|
503
362
|
|
|
504
363
|
## Project Status & Expectations
|
|
505
364
|
|
|
506
|
-
**This is
|
|
507
|
-
|
|
508
|
-
|
|
365
|
+
**This is an early-stage project** being developed in the open by an interested individual with a career of experience shipping production code.
|
|
366
|
+
- All features listed in the [Features](#features) section are stable and assumed to be bug-free
|
|
367
|
+
- Native instrumentation prebuilds are available cross-platform
|
|
368
|
+
- Expect matchers are stable (except where noted above), with more coming soon
|
|
509
369
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
All features listed in the [Features](#features) section are working and assumed to be bug-free. Please [report a bug](https://github.com/themattspiral/vitest-pool-assemblyscript/issues/new) if you encounter one.
|
|
370
|
+
Please [report a bug / request a feature](https://github.com/themattspiral/vitest-pool-assemblyscript/issues/new) if you encounter something you'd like to share!
|
|
513
371
|
|
|
514
372
|
**⚠️ Known Limitations - Coming Soon:**
|
|
515
373
|
- **Function-level coverage only**: No statement, branch, or line coverage yet
|
|
@@ -540,82 +398,24 @@ All features listed in the [Features](#features) section are working and assumed
|
|
|
540
398
|
- TBD
|
|
541
399
|
|
|
542
400
|
**✖️ Out of Scope (Currently):**
|
|
543
|
-
- Compiler integration with other compile-to-WASM languages (Rust, C++)
|
|
544
|
-
- I would LOVE to expand this project to a more generic wasm pool, supporting pluggable compilers and ast parsing for different WASM ecosystems and toolchains
|
|
545
|
-
- Not in scope now because of time and effort. If you want to pay me to work on this [get in touch](https://github.com/themattspiral)!
|
|
546
401
|
- Generic JS-harness testing of any precompiled WASM binary
|
|
402
|
+
- Compiler & matcher integration with other compile-to-WASM languages (e.g. Rust and C++ with Emscripten)
|
|
403
|
+
- I would LOVE to expand this project to cover additional cases, supporting pluggable compilers, ast parsing, and matchers for different WASM ecosystems and toolchains
|
|
404
|
+
- Not in scope now because of time and effort
|
|
405
|
+
- If you want to pay me to work on this, please [get in touch](https://github.com/themattspiral)!
|
|
547
406
|
|
|
548
407
|
---
|
|
549
408
|
|
|
550
|
-
##
|
|
551
|
-
|
|
552
|
-
**⚠️ Important:** This project is under active development. Features and APIs may change without notice. No guarantees are made about stability or functionality.
|
|
409
|
+
## Prior Work
|
|
553
410
|
|
|
554
|
-
|
|
411
|
+
There are other (standalone) testing frameworks for AssemblyScript testing which have inspired this project. In particular, many thanks are owed to [assemblyscript-unittest-framework](https://github.com/wasm-ecosystem/assemblyscript-unittest-framework) for inspiring parts of our test discovery and instrumentation walking approaches.
|
|
555
412
|
|
|
556
|
-
|
|
557
|
-
- Node.js 20.0.0+ (required due to our multi-memory coverage approach)
|
|
558
|
-
- Vitest 3.2.0+ or 4.0.0+
|
|
559
|
-
- AssemblyScript 0.28+
|
|
560
|
-
- C++ build tools (dev only - distributed package will include prebuilds):
|
|
561
|
-
- GCC 7+ or Clang 5+ (C++17 support required)
|
|
562
|
-
- Python 3.x (required by node-gyp)
|
|
563
|
-
|
|
564
|
-
### Setup
|
|
565
|
-
|
|
566
|
-
1. **Clone the repository:**
|
|
567
|
-
```bash
|
|
568
|
-
git clone https://github.com/themattspiral/vitest-pool-assemblyscript.git
|
|
569
|
-
cd vitest-pool-assemblyscript
|
|
570
|
-
```
|
|
571
|
-
|
|
572
|
-
2. **Install Binaryen C++ dependencies, then npm deps**
|
|
573
|
-
```bash
|
|
574
|
-
npm run setup-binaryen
|
|
575
|
-
npm install
|
|
576
|
-
```
|
|
577
|
-
The `setup-binaryen` script downloads prebuilt Binaryen libraries and C++ headers to `third_party/binaryen/`. These are used to build the native addon that extracts debug info from WASM binaries.
|
|
578
|
-
|
|
579
|
-
3. **Build Native Addon**
|
|
580
|
-
```bash
|
|
581
|
-
npm run build:native
|
|
582
|
-
```
|
|
583
|
-
|
|
584
|
-
4. **Build Pool**
|
|
585
|
-
```bash
|
|
586
|
-
npm run build
|
|
587
|
-
```
|
|
588
|
-
|
|
589
|
-
5. **Link the pool to your project:**
|
|
590
|
-
```bash
|
|
591
|
-
# In vitest-pool-assemblyscript:
|
|
592
|
-
npm link
|
|
593
|
-
|
|
594
|
-
# In your project directory:
|
|
595
|
-
npm link vitest-pool-assemblyscript
|
|
596
|
-
```
|
|
597
|
-
|
|
598
|
-
6. **Configure Vitest**
|
|
599
|
-
|
|
600
|
-
See the [Configuration](#configuration) section.
|
|
601
|
-
|
|
602
|
-
7. **Write your tests**
|
|
603
|
-
See the [Writing Tests](#writing-tests) section.
|
|
604
|
-
|
|
605
|
-
8. **Run your tests:**
|
|
606
|
-
```bash
|
|
607
|
-
# Run all tests once
|
|
608
|
-
npx vitest run
|
|
609
|
-
|
|
610
|
-
# Run specific test file
|
|
611
|
-
npx vitest run example.as.test.ts
|
|
612
|
-
|
|
613
|
-
# Run specific test in specific file
|
|
614
|
-
npx vitest run example.as.test.ts -t "my test name"
|
|
615
|
-
```
|
|
413
|
+
See [Built with AssemblyScript - Testing & Benchmarking](https://www.assemblyscript.org/built-with-assemblyscript.html#testing-benchmarking) for other related work.
|
|
616
414
|
|
|
617
415
|
---
|
|
618
416
|
|
|
619
417
|
## License
|
|
620
418
|
|
|
621
419
|
[MIT](LICENSE)
|
|
420
|
+
- Portions of this software have been derived from third-party works which are licenced under different terms. Individual code contributions have been noted where applicable and are accompanied by their respective licenses.
|
|
421
|
+
- See the license file and source code for details
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ASNodeKind } from "./constants-
|
|
1
|
+
import { ASNodeKind } from "./constants-DX9yo-el.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/util/ast-visitor.ts
|
|
4
4
|
/**
|
|
@@ -307,4 +307,4 @@ var ASTVisitor = class {
|
|
|
307
307
|
|
|
308
308
|
//#endregion
|
|
309
309
|
export { ASTVisitor };
|
|
310
|
-
//# sourceMappingURL=ast-visitor-
|
|
310
|
+
//# sourceMappingURL=ast-visitor-lTahoS9R.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast-visitor-DC3SuTzs.mjs","names":[],"sources":["../src/util/ast-visitor.ts"],"sourcesContent":["/**\n * Base AST Visitor for AssemblyScript\n *\n * Provides reusable walking logic for traversing AS AST nodes.\n * Subclasses override hook methods to perform specific tasks.\n *\n * Used by:\n * - ast-parser.ts: Extract function metadata for coverage\n * - strip-inline.mts: Strip @inline decorators\n */\n\nimport {\n Node,\n Source,\n BlockStatement,\n FunctionDeclaration,\n MethodDeclaration,\n ClassDeclaration,\n NamespaceDeclaration,\n VariableStatement,\n VariableDeclaration,\n FunctionExpression,\n ExpressionStatement,\n BinaryExpression,\n PropertyAccessExpression,\n IfStatement,\n WhileStatement,\n DoStatement,\n ForStatement,\n ForOfStatement,\n SwitchStatement,\n SwitchCase,\n TryStatement,\n ThrowStatement,\n ReturnStatement,\n CallExpression,\n NewExpression,\n ParenthesizedExpression,\n TernaryExpression,\n CommaExpression,\n AssertionExpression,\n InstanceOfExpression,\n ElementAccessExpression,\n UnaryPostfixExpression,\n UnaryPrefixExpression,\n ClassExpression,\n ParameterNode,\n EnumDeclaration,\n EnumValueDeclaration,\n FieldDeclaration,\n InterfaceDeclaration,\n VoidStatement,\n} from 'assemblyscript';\n\nimport { ASNodeKind } from '../types/constants.js';\n\n/**\n * Abstract base class for AST visitors.\n *\n * Subclasses override hook methods to perform tasks during traversal:\n * - beforeVisit: Called before visiting each node (e.g., strip decorators)\n * - onFunctionDeclaration: Called when visiting a function declaration\n * - onMethodDeclaration: Called when visiting a method declaration\n * - onVariableDeclaration: Called when visiting a variable declaration\n * - onClassEnter/onClassExit: Called when entering/exiting a class\n */\nexport abstract class ASTVisitor {\n /**\n * Visit all statements in a source file\n */\n visitSource(source: Source): void {\n for (const stmt of source.statements) {\n this.visitNode(stmt);\n }\n }\n\n /**\n * Hook called before visiting each node.\n * Override to perform pre-visit tasks (e.g., stripping decorators).\n */\n protected beforeVisit(_node: Node): void {}\n\n /**\n * Hook called when entering a class declaration.\n * Override to track class context.\n */\n protected onClassEnter(_node: ClassDeclaration): void {}\n\n /**\n * Hook called when exiting a class declaration.\n * Override to restore class context.\n */\n protected onClassExit(_node: ClassDeclaration): void {}\n\n /**\n * Hook called when visiting a function declaration.\n * Override to extract function info or perform other tasks.\n * Return false to skip recursing into the function body.\n */\n protected onFunctionDeclaration(_node: FunctionDeclaration): boolean {\n return true; // Continue recursion by default\n }\n\n /**\n * Hook called when visiting a method declaration.\n * Override to extract method info or perform other tasks.\n * Return false to skip recursing into the method body.\n */\n protected onMethodDeclaration(_node: MethodDeclaration): boolean {\n return true; // Continue recursion by default\n }\n\n /**\n * Hook called when visiting a variable declaration.\n * Override to handle variable declarations (e.g., arrow functions).\n * Return false to skip recursing into the initializer.\n */\n protected onVariableDeclaration(_node: VariableDeclaration): boolean {\n return true; // Continue recursion by default\n }\n\n /**\n * Main visitor dispatch - routes to specific handler based on node kind\n */\n visitNode(node: Node): void {\n // Call pre-visit hook\n this.beforeVisit(node);\n\n // Recurse into children based on node kind\n switch (node.kind) {\n // Type nodes - no children to visit\n case ASNodeKind.NamedType:\n case ASNodeKind.FunctionType:\n case ASNodeKind.TypeName:\n case ASNodeKind.TypeParameter:\n break;\n\n // Parameter - may have default value\n case ASNodeKind.Parameter: {\n const param = node as ParameterNode;\n if (param.initializer) this.visitNode(param.initializer);\n break;\n }\n\n // Simple expressions - no children\n case ASNodeKind.Identifier:\n case ASNodeKind.False:\n case ASNodeKind.Literal:\n case ASNodeKind.Null:\n case ASNodeKind.Omitted:\n case ASNodeKind.Super:\n case ASNodeKind.This:\n case ASNodeKind.True:\n case ASNodeKind.Constructor:\n case ASNodeKind.Compiled:\n break;\n\n // Expressions with children\n case ASNodeKind.Assertion: {\n const expr = node as AssertionExpression;\n this.visitNode(expr.expression);\n break;\n }\n case ASNodeKind.Binary: {\n const expr = node as BinaryExpression;\n this.visitNode(expr.left);\n this.visitNode(expr.right);\n break;\n }\n case ASNodeKind.Call: {\n const expr = node as CallExpression;\n this.visitNode(expr.expression);\n for (const arg of expr.args) this.visitNode(arg);\n break;\n }\n case ASNodeKind.Class: {\n const expr = node as ClassExpression;\n this.visitNode(expr.declaration);\n break;\n }\n case ASNodeKind.Comma: {\n const expr = node as CommaExpression;\n for (const e of expr.expressions) this.visitNode(e);\n break;\n }\n case ASNodeKind.ElementAccess: {\n const expr = node as ElementAccessExpression;\n this.visitNode(expr.expression);\n this.visitNode(expr.elementExpression);\n break;\n }\n case ASNodeKind.Function: {\n const expr = node as FunctionExpression;\n this.visitNode(expr.declaration);\n break;\n }\n case ASNodeKind.InstanceOf: {\n const expr = node as InstanceOfExpression;\n this.visitNode(expr.expression);\n break;\n }\n case ASNodeKind.New: {\n const expr = node as NewExpression;\n for (const arg of expr.args) this.visitNode(arg);\n break;\n }\n case ASNodeKind.Parenthesized: {\n const expr = node as ParenthesizedExpression;\n this.visitNode(expr.expression);\n break;\n }\n case ASNodeKind.PropertyAccess: {\n const expr = node as PropertyAccessExpression;\n this.visitNode(expr.expression);\n break;\n }\n case ASNodeKind.Ternary: {\n const expr = node as TernaryExpression;\n this.visitNode(expr.condition);\n this.visitNode(expr.ifThen);\n this.visitNode(expr.ifElse);\n break;\n }\n case ASNodeKind.UnaryPostfix: {\n const expr = node as UnaryPostfixExpression;\n this.visitNode(expr.operand);\n break;\n }\n case ASNodeKind.UnaryPrefix: {\n const expr = node as UnaryPrefixExpression;\n this.visitNode(expr.operand);\n break;\n }\n\n // Statements with no interesting children\n case ASNodeKind.Break:\n case ASNodeKind.Continue:\n case ASNodeKind.Empty:\n case ASNodeKind.Export:\n case ASNodeKind.ExportDefault:\n case ASNodeKind.ExportImport:\n case ASNodeKind.Import:\n case ASNodeKind.Module:\n break;\n\n // Statements with children\n case ASNodeKind.Block: {\n const stmt = node as BlockStatement;\n for (const s of stmt.statements) this.visitNode(s);\n break;\n }\n case ASNodeKind.Do: {\n const stmt = node as DoStatement;\n this.visitNode(stmt.body);\n this.visitNode(stmt.condition);\n break;\n }\n case ASNodeKind.Expression: {\n const stmt = node as ExpressionStatement;\n this.visitNode(stmt.expression);\n break;\n }\n case ASNodeKind.For: {\n const stmt = node as ForStatement;\n if (stmt.initializer) this.visitNode(stmt.initializer);\n if (stmt.condition) this.visitNode(stmt.condition);\n if (stmt.incrementor) this.visitNode(stmt.incrementor);\n this.visitNode(stmt.body);\n break;\n }\n case ASNodeKind.ForOf: {\n const stmt = node as ForOfStatement;\n this.visitNode(stmt.variable);\n this.visitNode(stmt.iterable);\n this.visitNode(stmt.body);\n break;\n }\n case ASNodeKind.If: {\n const stmt = node as IfStatement;\n this.visitNode(stmt.condition);\n this.visitNode(stmt.ifTrue);\n if (stmt.ifFalse) this.visitNode(stmt.ifFalse);\n break;\n }\n case ASNodeKind.Return: {\n const stmt = node as ReturnStatement;\n if (stmt.value) this.visitNode(stmt.value);\n break;\n }\n case ASNodeKind.Switch: {\n const stmt = node as SwitchStatement;\n this.visitNode(stmt.condition);\n for (const switchCase of stmt.cases) this.visitNode(switchCase);\n break;\n }\n case ASNodeKind.Throw: {\n const stmt = node as ThrowStatement;\n this.visitNode(stmt.value);\n break;\n }\n case ASNodeKind.Try: {\n const stmt = node as TryStatement;\n for (const s of stmt.bodyStatements) this.visitNode(s);\n if (stmt.catchStatements) {\n for (const s of stmt.catchStatements) this.visitNode(s);\n }\n if (stmt.finallyStatements) {\n for (const s of stmt.finallyStatements) this.visitNode(s);\n }\n break;\n }\n case ASNodeKind.Variable: {\n const stmt = node as VariableStatement;\n for (const decl of stmt.declarations) this.visitNode(decl);\n break;\n }\n case ASNodeKind.Void: {\n const stmt = node as VoidStatement;\n this.visitNode(stmt.expression);\n break;\n }\n case ASNodeKind.While: {\n const stmt = node as WhileStatement;\n this.visitNode(stmt.condition);\n this.visitNode(stmt.body);\n break;\n }\n case ASNodeKind.SwitchCase: {\n const stmt = node as SwitchCase;\n if (stmt.label) this.visitNode(stmt.label);\n for (const s of stmt.statements) this.visitNode(s);\n break;\n }\n\n // Declaration statements\n case ASNodeKind.ImportDeclaration:\n case ASNodeKind.TypeDeclaration:\n break;\n\n case ASNodeKind.ClassDeclaration: {\n const decl = node as ClassDeclaration;\n this.onClassEnter(decl);\n for (const member of decl.members) this.visitNode(member);\n this.onClassExit(decl);\n break;\n }\n case ASNodeKind.EnumDeclaration: {\n const decl = node as EnumDeclaration;\n for (const value of decl.values) this.visitNode(value);\n break;\n }\n case ASNodeKind.EnumValueDeclaration: {\n const decl = node as EnumValueDeclaration;\n if (decl.initializer) this.visitNode(decl.initializer);\n break;\n }\n case ASNodeKind.FieldDeclaration: {\n const decl = node as FieldDeclaration;\n if (decl.initializer) this.visitNode(decl.initializer);\n break;\n }\n case ASNodeKind.FunctionDeclaration: {\n const decl = node as FunctionDeclaration;\n const shouldRecurse = this.onFunctionDeclaration(decl);\n if (shouldRecurse && decl.body) this.visitNode(decl.body);\n break;\n }\n case ASNodeKind.InterfaceDeclaration: {\n const decl = node as InterfaceDeclaration;\n for (const member of decl.members) this.visitNode(member);\n break;\n }\n case ASNodeKind.MethodDeclaration: {\n const decl = node as MethodDeclaration;\n const shouldRecurse = this.onMethodDeclaration(decl);\n if (shouldRecurse && decl.body) this.visitNode(decl.body);\n break;\n }\n case ASNodeKind.NamespaceDeclaration: {\n const decl = node as NamespaceDeclaration;\n for (const member of decl.members) this.visitNode(member);\n break;\n }\n case ASNodeKind.VariableDeclaration: {\n const decl = node as VariableDeclaration;\n const shouldRecurse = this.onVariableDeclaration(decl);\n if (shouldRecurse && decl.initializer) this.visitNode(decl.initializer);\n break;\n }\n\n // Special nodes - no action needed\n case ASNodeKind.ExportMember:\n case ASNodeKind.IndexSignature:\n case ASNodeKind.Comment:\n case ASNodeKind.Decorator:\n break;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAkEA,IAAsB,aAAtB,MAAiC;;;;CAI/B,YAAY,QAAsB;AAChC,OAAK,MAAM,QAAQ,OAAO,WACxB,MAAK,UAAU,KAAK;;;;;;CAQxB,AAAU,YAAY,OAAmB;;;;;CAMzC,AAAU,aAAa,OAA+B;;;;;CAMtD,AAAU,YAAY,OAA+B;;;;;;CAOrD,AAAU,sBAAsB,OAAqC;AACnE,SAAO;;;;;;;CAQT,AAAU,oBAAoB,OAAmC;AAC/D,SAAO;;;;;;;CAQT,AAAU,sBAAsB,OAAqC;AACnE,SAAO;;;;;CAMT,UAAU,MAAkB;AAE1B,OAAK,YAAY,KAAK;AAGtB,UAAQ,KAAK,MAAb;GAEE,KAAK,WAAW;GAChB,KAAK,WAAW;GAChB,KAAK,WAAW;GAChB,KAAK,WAAW,cACd;GAGF,KAAK,WAAW,WAAW;IACzB,MAAM,QAAQ;AACd,QAAI,MAAM,YAAa,MAAK,UAAU,MAAM,YAAY;AACxD;;GAIF,KAAK,WAAW;GAChB,KAAK,WAAW;GAChB,KAAK,WAAW;GAChB,KAAK,WAAW;GAChB,KAAK,WAAW;GACh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,MAAK,UAAU,MAAM;AACtD;;GAEF,KAAK,WAAW,sBAAsB;IACpC,MAAM,OAAO;AACb,QAAI,KAAK,YAAa,MAAK,UAAU,KAAK,YAAY;AACtD;;GAEF,KAAK,WAAW,kBAAkB;IAChC,MAAM,OAAO;AACb,QAAI,KAAK,YAAa,MAAK,UAAU,KAAK,YAAY;AACtD;;GAEF,KAAK,WAAW,qBAAqB;IACnC,MAAM,OAAO;AAEb,QADsB,KAAK,sBAAsB,KAAK,IACjC,KAAK,KAAM,MAAK,UAAU,KAAK,KAAK;AACzD;;GAEF,KAAK,WAAW,sBAAsB;IACpC,MAAM,OAAO;AACb,SAAK,MAAM,UAAU,KAAK,QAAS,MAAK,UAAU,OAAO;AACzD;;GAEF,KAAK,WAAW,mBAAmB;IACjC,MAAM,OAAO;AAEb,QADsB,KAAK,oBAAoB,KAAK,IAC/B,KAAK,KAAM,MAAK,UAAU,KAAK,KAAK;AACzD;;GAEF,KAAK,WAAW,sBAAsB;IACpC,MAAM,OAAO;AACb,SAAK,MAAM,UAAU,KAAK,QAAS,MAAK,UAAU,OAAO;AACzD;;GAEF,KAAK,WAAW,qBAAqB;IACnC,MAAM,OAAO;AAEb,QADsB,KAAK,sBAAsB,KAAK,IACjC,KAAK,YAAa,MAAK,UAAU,KAAK,YAAY;AACvE;;GAIF,KAAK,WAAW;GAChB,KAAK,WAAW;GAChB,KAAK,WAAW;GAChB,KAAK,WAAW,UACd"}
|
|
1
|
+
{"version":3,"file":"ast-visitor-lTahoS9R.mjs","names":[],"sources":["../src/util/ast-visitor.ts"],"sourcesContent":["/**\n * Base AST Visitor for AssemblyScript\n *\n * Provides reusable walking logic for traversing AS AST nodes.\n * Subclasses override hook methods to perform specific tasks.\n *\n * Used by:\n * - ast-parser.ts: Extract function metadata for coverage\n * - strip-inline.mts: Strip @inline decorators\n */\n\nimport {\n Node,\n Source,\n BlockStatement,\n FunctionDeclaration,\n MethodDeclaration,\n ClassDeclaration,\n NamespaceDeclaration,\n VariableStatement,\n VariableDeclaration,\n FunctionExpression,\n ExpressionStatement,\n BinaryExpression,\n PropertyAccessExpression,\n IfStatement,\n WhileStatement,\n DoStatement,\n ForStatement,\n ForOfStatement,\n SwitchStatement,\n SwitchCase,\n TryStatement,\n ThrowStatement,\n ReturnStatement,\n CallExpression,\n NewExpression,\n ParenthesizedExpression,\n TernaryExpression,\n CommaExpression,\n AssertionExpression,\n InstanceOfExpression,\n ElementAccessExpression,\n UnaryPostfixExpression,\n UnaryPrefixExpression,\n ClassExpression,\n ParameterNode,\n EnumDeclaration,\n EnumValueDeclaration,\n FieldDeclaration,\n InterfaceDeclaration,\n VoidStatement,\n} from 'assemblyscript';\n\nimport { ASNodeKind } from '../types/constants.js';\n\n/**\n * Abstract base class for AST visitors.\n *\n * Subclasses override hook methods to perform tasks during traversal:\n * - beforeVisit: Called before visiting each node (e.g., strip decorators)\n * - onFunctionDeclaration: Called when visiting a function declaration\n * - onMethodDeclaration: Called when visiting a method declaration\n * - onVariableDeclaration: Called when visiting a variable declaration\n * - onClassEnter/onClassExit: Called when entering/exiting a class\n */\nexport abstract class ASTVisitor {\n /**\n * Visit all statements in a source file\n */\n visitSource(source: Source): void {\n for (const stmt of source.statements) {\n this.visitNode(stmt);\n }\n }\n\n /**\n * Hook called before visiting each node.\n * Override to perform pre-visit tasks (e.g., stripping decorators).\n */\n protected beforeVisit(_node: Node): void {}\n\n /**\n * Hook called when entering a class declaration.\n * Override to track class context.\n */\n protected onClassEnter(_node: ClassDeclaration): void {}\n\n /**\n * Hook called when exiting a class declaration.\n * Override to restore class context.\n */\n protected onClassExit(_node: ClassDeclaration): void {}\n\n /**\n * Hook called when visiting a function declaration.\n * Override to extract function info or perform other tasks.\n * Return false to skip recursing into the function body.\n */\n protected onFunctionDeclaration(_node: FunctionDeclaration): boolean {\n return true; // Continue recursion by default\n }\n\n /**\n * Hook called when visiting a method declaration.\n * Override to extract method info or perform other tasks.\n * Return false to skip recursing into the method body.\n */\n protected onMethodDeclaration(_node: MethodDeclaration): boolean {\n return true; // Continue recursion by default\n }\n\n /**\n * Hook called when visiting a variable declaration.\n * Override to handle variable declarations (e.g., arrow functions).\n * Return false to skip recursing into the initializer.\n */\n protected onVariableDeclaration(_node: VariableDeclaration): boolean {\n return true; // Continue recursion by default\n }\n\n /**\n * Main visitor dispatch - routes to specific handler based on node kind\n */\n visitNode(node: Node): void {\n // Call pre-visit hook\n this.beforeVisit(node);\n\n // Recurse into children based on node kind\n switch (node.kind) {\n // Type nodes - no children to visit\n case ASNodeKind.NamedType:\n case ASNodeKind.FunctionType:\n case ASNodeKind.TypeName:\n case ASNodeKind.TypeParameter:\n break;\n\n // Parameter - may have default value\n case ASNodeKind.Parameter: {\n const param = node as ParameterNode;\n if (param.initializer) this.visitNode(param.initializer);\n break;\n }\n\n // Simple expressions - no children\n case ASNodeKind.Identifier:\n case ASNodeKind.False:\n case ASNodeKind.Literal:\n case ASNodeKind.Null:\n case ASNodeKind.Omitted:\n case ASNodeKind.Super:\n case ASNodeKind.This:\n case ASNodeKind.True:\n case ASNodeKind.Constructor:\n case ASNodeKind.Compiled:\n break;\n\n // Expressions with children\n case ASNodeKind.Assertion: {\n const expr = node as AssertionExpression;\n this.visitNode(expr.expression);\n break;\n }\n case ASNodeKind.Binary: {\n const expr = node as BinaryExpression;\n this.visitNode(expr.left);\n this.visitNode(expr.right);\n break;\n }\n case ASNodeKind.Call: {\n const expr = node as CallExpression;\n this.visitNode(expr.expression);\n for (const arg of expr.args) this.visitNode(arg);\n break;\n }\n case ASNodeKind.Class: {\n const expr = node as ClassExpression;\n this.visitNode(expr.declaration);\n break;\n }\n case ASNodeKind.Comma: {\n const expr = node as CommaExpression;\n for (const e of expr.expressions) this.visitNode(e);\n break;\n }\n case ASNodeKind.ElementAccess: {\n const expr = node as ElementAccessExpression;\n this.visitNode(expr.expression);\n this.visitNode(expr.elementExpression);\n break;\n }\n case ASNodeKind.Function: {\n const expr = node as FunctionExpression;\n this.visitNode(expr.declaration);\n break;\n }\n case ASNodeKind.InstanceOf: {\n const expr = node as InstanceOfExpression;\n this.visitNode(expr.expression);\n break;\n }\n case ASNodeKind.New: {\n const expr = node as NewExpression;\n for (const arg of expr.args) this.visitNode(arg);\n break;\n }\n case ASNodeKind.Parenthesized: {\n const expr = node as ParenthesizedExpression;\n this.visitNode(expr.expression);\n break;\n }\n case ASNodeKind.PropertyAccess: {\n const expr = node as PropertyAccessExpression;\n this.visitNode(expr.expression);\n break;\n }\n case ASNodeKind.Ternary: {\n const expr = node as TernaryExpression;\n this.visitNode(expr.condition);\n this.visitNode(expr.ifThen);\n this.visitNode(expr.ifElse);\n break;\n }\n case ASNodeKind.UnaryPostfix: {\n const expr = node as UnaryPostfixExpression;\n this.visitNode(expr.operand);\n break;\n }\n case ASNodeKind.UnaryPrefix: {\n const expr = node as UnaryPrefixExpression;\n this.visitNode(expr.operand);\n break;\n }\n\n // Statements with no interesting children\n case ASNodeKind.Break:\n case ASNodeKind.Continue:\n case ASNodeKind.Empty:\n case ASNodeKind.Export:\n case ASNodeKind.ExportDefault:\n case ASNodeKind.ExportImport:\n case ASNodeKind.Import:\n case ASNodeKind.Module:\n break;\n\n // Statements with children\n case ASNodeKind.Block: {\n const stmt = node as BlockStatement;\n for (const s of stmt.statements) this.visitNode(s);\n break;\n }\n case ASNodeKind.Do: {\n const stmt = node as DoStatement;\n this.visitNode(stmt.body);\n this.visitNode(stmt.condition);\n break;\n }\n case ASNodeKind.Expression: {\n const stmt = node as ExpressionStatement;\n this.visitNode(stmt.expression);\n break;\n }\n case ASNodeKind.For: {\n const stmt = node as ForStatement;\n if (stmt.initializer) this.visitNode(stmt.initializer);\n if (stmt.condition) this.visitNode(stmt.condition);\n if (stmt.incrementor) this.visitNode(stmt.incrementor);\n this.visitNode(stmt.body);\n break;\n }\n case ASNodeKind.ForOf: {\n const stmt = node as ForOfStatement;\n this.visitNode(stmt.variable);\n this.visitNode(stmt.iterable);\n this.visitNode(stmt.body);\n break;\n }\n case ASNodeKind.If: {\n const stmt = node as IfStatement;\n this.visitNode(stmt.condition);\n this.visitNode(stmt.ifTrue);\n if (stmt.ifFalse) this.visitNode(stmt.ifFalse);\n break;\n }\n case ASNodeKind.Return: {\n const stmt = node as ReturnStatement;\n if (stmt.value) this.visitNode(stmt.value);\n break;\n }\n case ASNodeKind.Switch: {\n const stmt = node as SwitchStatement;\n this.visitNode(stmt.condition);\n for (const switchCase of stmt.cases) this.visitNode(switchCase);\n break;\n }\n case ASNodeKind.Throw: {\n const stmt = node as ThrowStatement;\n this.visitNode(stmt.value);\n break;\n }\n case ASNodeKind.Try: {\n const stmt = node as TryStatement;\n for (const s of stmt.bodyStatements) this.visitNode(s);\n if (stmt.catchStatements) {\n for (const s of stmt.catchStatements) this.visitNode(s);\n }\n if (stmt.finallyStatements) {\n for (const s of stmt.finallyStatements) this.visitNode(s);\n }\n break;\n }\n case ASNodeKind.Variable: {\n const stmt = node as VariableStatement;\n for (const decl of stmt.declarations) this.visitNode(decl);\n break;\n }\n case ASNodeKind.Void: {\n const stmt = node as VoidStatement;\n this.visitNode(stmt.expression);\n break;\n }\n case ASNodeKind.While: {\n const stmt = node as WhileStatement;\n this.visitNode(stmt.condition);\n this.visitNode(stmt.body);\n break;\n }\n case ASNodeKind.SwitchCase: {\n const stmt = node as SwitchCase;\n if (stmt.label) this.visitNode(stmt.label);\n for (const s of stmt.statements) this.visitNode(s);\n break;\n }\n\n // Declaration statements\n case ASNodeKind.ImportDeclaration:\n case ASNodeKind.TypeDeclaration:\n break;\n\n case ASNodeKind.ClassDeclaration: {\n const decl = node as ClassDeclaration;\n this.onClassEnter(decl);\n for (const member of decl.members) this.visitNode(member);\n this.onClassExit(decl);\n break;\n }\n case ASNodeKind.EnumDeclaration: {\n const decl = node as EnumDeclaration;\n for (const value of decl.values) this.visitNode(value);\n break;\n }\n case ASNodeKind.EnumValueDeclaration: {\n const decl = node as EnumValueDeclaration;\n if (decl.initializer) this.visitNode(decl.initializer);\n break;\n }\n case ASNodeKind.FieldDeclaration: {\n const decl = node as FieldDeclaration;\n if (decl.initializer) this.visitNode(decl.initializer);\n break;\n }\n case ASNodeKind.FunctionDeclaration: {\n const decl = node as FunctionDeclaration;\n const shouldRecurse = this.onFunctionDeclaration(decl);\n if (shouldRecurse && decl.body) this.visitNode(decl.body);\n break;\n }\n case ASNodeKind.InterfaceDeclaration: {\n const decl = node as InterfaceDeclaration;\n for (const member of decl.members) this.visitNode(member);\n break;\n }\n case ASNodeKind.MethodDeclaration: {\n const decl = node as MethodDeclaration;\n const shouldRecurse = this.onMethodDeclaration(decl);\n if (shouldRecurse && decl.body) this.visitNode(decl.body);\n break;\n }\n case ASNodeKind.NamespaceDeclaration: {\n const decl = node as NamespaceDeclaration;\n for (const member of decl.members) this.visitNode(member);\n break;\n }\n case ASNodeKind.VariableDeclaration: {\n const decl = node as VariableDeclaration;\n const shouldRecurse = this.onVariableDeclaration(decl);\n if (shouldRecurse && decl.initializer) this.visitNode(decl.initializer);\n break;\n }\n\n // Special nodes - no action needed\n case ASNodeKind.ExportMember:\n case ASNodeKind.IndexSignature:\n case ASNodeKind.Comment:\n case ASNodeKind.Decorator:\n break;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAkEA,IAAsB,aAAtB,MAAiC;;;;CAI/B,YAAY,QAAsB;AAChC,OAAK,MAAM,QAAQ,OAAO,WACxB,MAAK,UAAU,KAAK;;;;;;CAQxB,AAAU,YAAY,OAAmB;;;;;CAMzC,AAAU,aAAa,OAA+B;;;;;CAMtD,AAAU,YAAY,OAA+B;;;;;;CAOrD,AAAU,sBAAsB,OAAqC;AACnE,SAAO;;;;;;;CAQT,AAAU,oBAAoB,OAAmC;AAC/D,SAAO;;;;;;;CAQT,AAAU,sBAAsB,OAAqC;AACnE,SAAO;;;;;CAMT,UAAU,MAAkB;AAE1B,OAAK,YAAY,KAAK;AAGtB,UAAQ,KAAK,MAAb;GAEE,KAAK,WAAW;GAChB,KAAK,WAAW;GAChB,KAAK,WAAW;GAChB,KAAK,WAAW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M,OAAO;AACb,SAAK,aAAa,KAAK;AACvB,SAAK,MAAM,UAAU,KAAK,QAAS,MAAK,UAAU,OAAO;AACzD,SAAK,YAAY,KAAK;AACtB;;GAEF,KAAK,WAAW,iBAAiB;IAC/B,MAAM,OAAO;AACb,SAAK,MAAM,SAAS,KAAK,OAAQ,MAAK,UAAU,MAAM;AACtD;;GAEF,KAAK,WAAW,sBAAsB;IACpC,MAAM,OAAO;AACb,QAAI,KAAK,YAAa,MAAK,UAAU,KAAK,YAAY;AACtD;;GAEF,KAAK,WAAW,kBAAkB;IAChC,MAAM,OAAO;AACb,QAAI,KAAK,YAAa,MAAK,UAAU,KAAK,YAAY;AACtD;;GAEF,KAAK,WAAW,qBAAqB;IACnC,MAAM,OAAO;AAEb,QADsB,KAAK,sBAAsB,KAAK,IACjC,KAAK,KAAM,MAAK,UAAU,KAAK,KAAK;AACzD;;GAEF,KAAK,WAAW,sBAAsB;IACpC,MAAM,OAAO;AACb,SAAK,MAAM,UAAU,KAAK,QAAS,MAAK,UAAU,OAAO;AACzD;;GAEF,KAAK,WAAW,mBAAmB;IACjC,MAAM,OAAO;AAEb,QADsB,KAAK,oBAAoB,KAAK,IAC/B,KAAK,KAAM,MAAK,UAAU,KAAK,KAAK;AACzD;;GAEF,KAAK,WAAW,sBAAsB;IACpC,MAAM,OAAO;AACb,SAAK,MAAM,UAAU,KAAK,QAAS,MAAK,UAAU,OAAO;AACzD;;GAEF,KAAK,WAAW,qBAAqB;IACnC,MAAM,OAAO;AAEb,QADsB,KAAK,sBAAsB,KAAK,IACjC,KAAK,YAAa,MAAK,UAAU,KAAK,YAAY;AACvE;;GAIF,KAAK,WAAW;GAChB,KAAK,WAAW;GAChB,KAAK,WAAW;GAChB,KAAK,WAAW,UACd"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { POOL_ERROR_NAMES, POOL_INTERNAL_PATHS } from "./constants-
|
|
2
|
-
import { createPoolErrorFromAnyError, debug, getTestErrorFromPoolError } from "./debug-
|
|
1
|
+
import { POOL_ERROR_NAMES, POOL_INTERNAL_PATHS } from "./constants-DX9yo-el.mjs";
|
|
2
|
+
import { createPoolErrorFromAnyError, debug, getTestErrorFromPoolError } from "./debug-Cf2jt1kg.mjs";
|
|
3
3
|
import { failFile, getFullTaskHierarchy, prepareFileTaskForCollection } from "./vitest-file-tasks-BUwzh375.mjs";
|
|
4
|
-
import { getTaskLogLabel, getTaskLogPrefix } from "./vitest-tasks-
|
|
5
|
-
import { executeWASMDiscovery, flushRpcUpdates, reportFileCollected, reportFileError, reportFileQueued, reportUserConsoleLogs } from "./load-user-imports-
|
|
6
|
-
import { compileAssemblyScript } from "./compiler-
|
|
4
|
+
import { getTaskLogLabel, getTaskLogPrefix } from "./vitest-tasks-Cbri6MWZ.mjs";
|
|
5
|
+
import { executeWASMDiscovery, flushRpcUpdates, reportFileCollected, reportFileError, reportFileQueued, reportUserConsoleLogs } from "./load-user-imports-CcIdE4_0.mjs";
|
|
6
|
+
import { compileAssemblyScript } from "./compiler-BaNECXMW.mjs";
|
|
7
7
|
import { basename, relative } from "node:path";
|
|
8
8
|
|
|
9
9
|
//#region src/pool-thread/runner/compile-runner.ts
|
|
@@ -77,4 +77,4 @@ async function runCompileAndDiscover(file, logModule, rpc, poolOptions, projectR
|
|
|
77
77
|
|
|
78
78
|
//#endregion
|
|
79
79
|
export { runCompileAndDiscover };
|
|
80
|
-
//# sourceMappingURL=compile-runner-
|
|
80
|
+
//# sourceMappingURL=compile-runner-C9TJrfCl.mjs.map
|