wickra-strategy-ci 0.1.2 → 0.1.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 +110 -71
- package/index.d.ts +9 -0
- package/index.js +160 -82
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<a href="https://wickra.org"><img src="https://raw.githubusercontent.com/wickra-lib/.github/main/profile/wickra-banner.webp?v=514" alt="Wickra Strategy-CI — golden-pin your strategy's backtest report, catch regressions in CI, and property-test against fuzzed data, in ten languages plus a reusable GitHub Action" width="100%"></a>
|
|
2
|
+
<a href="https://wickra.org"><img src="https://raw.githubusercontent.com/wickra-lib/.github/main/profile/wickra-banner.webp?v=514-7" alt="Wickra Strategy-CI — golden-pin your strategy's backtest report, catch regressions in CI, and property-test against fuzzed data, in ten languages plus a reusable GitHub Action" width="100%"></a>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
[](https://github.com/wickra-lib/wickra)
|
|
@@ -19,22 +19,24 @@
|
|
|
19
19
|
[](https://scorecard.dev/viewer/?uri=github.com/wickra-lib/wickra-strategy-ci)
|
|
20
20
|
[](https://www.bestpractices.dev)
|
|
21
21
|
[](https://github.com/wickra-lib/wickra-strategy-ci/attestations)
|
|
22
|
-
[](https://wickra.org)
|
|
22
|
+
[](https://strategy-ci.wickra.org)
|
|
23
23
|
[](golden/)
|
|
24
24
|
|
|
25
25
|
---
|
|
26
26
|
|
|
27
|
-
# Wickra Strategy-CI
|
|
28
|
-
|
|
29
27
|
**Jest for trading strategies.** Golden-pin your strategy's backtest report,
|
|
30
28
|
catch regressions in CI, and property-test it against fuzzed market data — in ten
|
|
31
29
|
languages, plus a reusable composite GitHub Action.
|
|
32
30
|
|
|
33
|
-
>
|
|
34
|
-
>
|
|
35
|
-
> [wickra
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
> **▶ Live demos:** the backtester compiled to WebAssembly, an equity curve building bar by bar — **[backtest-live.wickra.org](https://backtest-live.wickra.org)**;
|
|
32
|
+
> one StrategySpec side by side in Python, Rust, JS and Go — **[playground.wickra.org](https://playground.wickra.org)**;
|
|
33
|
+
> all 514 indicators of the core over a real Binance feed — **[live.wickra.org](https://live.wickra.org)**. Zero backend, all of them.
|
|
34
|
+
|
|
35
|
+
**Part of the [Wickra ecosystem](https://github.com/wickra-lib).** Strategy-CI
|
|
36
|
+
is the test harness for the deterministic
|
|
37
|
+
[wickra-backtest](https://github.com/wickra-lib/wickra-backtest) engine: it runs
|
|
38
|
+
a strategy through the engine, pins the resulting `BacktestReport`, and fails
|
|
39
|
+
the build when the numbers drift.
|
|
38
40
|
|
|
39
41
|
```bash
|
|
40
42
|
# Run a directory of strategy tests against a directory of OHLCV data.
|
|
@@ -45,6 +47,23 @@ wickra-strategy-ci run tests/ --data data/
|
|
|
45
47
|
wickra-strategy-ci bless tests/ --data data/
|
|
46
48
|
```
|
|
47
49
|
|
|
50
|
+
## Status
|
|
51
|
+
|
|
52
|
+
**0.1.4 — the current release.** The core, the CLI, all ten language bindings,
|
|
53
|
+
the byte-exact golden corpus, property + fuzz tests, benchmarks and one runnable
|
|
54
|
+
example per language are in place and green across the full CI matrix (10
|
|
55
|
+
languages × 3 OS). [ROADMAP.md](ROADMAP.md) has what is done, what is open and
|
|
56
|
+
what is not planned.
|
|
57
|
+
|
|
58
|
+
## Documentation
|
|
59
|
+
|
|
60
|
+
See [docs/](docs/) — [`TESTS.md`](docs/TESTS.md) for the test model,
|
|
61
|
+
[`TOLERANCES.md`](docs/TOLERANCES.md) for the golden diff,
|
|
62
|
+
[`PROPERTIES.md`](docs/PROPERTIES.md) for the invariants,
|
|
63
|
+
[`FUZZING.md`](docs/FUZZING.md) for the perturbations,
|
|
64
|
+
[`GITHUB_ACTION.md`](docs/GITHUB_ACTION.md) for the action, and
|
|
65
|
+
[`Cookbook.md`](docs/Cookbook.md) for task-shaped recipes.
|
|
66
|
+
|
|
48
67
|
## Why
|
|
49
68
|
|
|
50
69
|
A backtest is only trustworthy if it is reproducible. Wickra's engine is
|
|
@@ -60,6 +79,23 @@ snapshot test. Strategy-CI turns that into a workflow:
|
|
|
60
79
|
- **Fuzz tests** — perturb the input data with a seeded PRNG and re-run, catching
|
|
61
80
|
strategies that only work on one specific history.
|
|
62
81
|
|
|
82
|
+
## Quickstart
|
|
83
|
+
|
|
84
|
+
Install the CLI, point it at a directory of test files and a directory of
|
|
85
|
+
candle data, and pin the reports once:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
cargo install wickra-strategy-ci-cli # the crate; the binary is wickra-strategy-ci
|
|
89
|
+
|
|
90
|
+
wickra-strategy-ci list golden/tests/ # the test ids found under a path
|
|
91
|
+
wickra-strategy-ci bless golden/tests/ --data golden/data/ # pin every report (first run)
|
|
92
|
+
wickra-strategy-ci run golden/tests/ --data golden/data/ # fail when a report moves
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
`run` exits non-zero when any pinned report drifts further than its tolerances
|
|
96
|
+
allow, when a property check fails, or when a fuzzed re-run breaks — which is
|
|
97
|
+
what makes it a CI gate. The next section is what a test file looks like.
|
|
98
|
+
|
|
63
99
|
## A test is a file, not a function
|
|
64
100
|
|
|
65
101
|
There is no test API to learn. A test is JSON: which strategy, over which
|
|
@@ -99,7 +135,7 @@ wickra-strategy-ci bless tests/ --data data/ # re-pin after an intended chang
|
|
|
99
135
|
Run your strategy tests on every push — a failing test fails the workflow:
|
|
100
136
|
|
|
101
137
|
```yaml
|
|
102
|
-
- uses: wickra-lib/wickra-strategy-ci@v0.1.
|
|
138
|
+
- uses: wickra-lib/wickra-strategy-ci@v0.1.4
|
|
103
139
|
with:
|
|
104
140
|
tests: tests/
|
|
105
141
|
data: data/
|
|
@@ -110,25 +146,6 @@ across minor versions, which may break.
|
|
|
110
146
|
|
|
111
147
|
See [docs/GITHUB_ACTION.md](docs/GITHUB_ACTION.md) for the full inputs/outputs.
|
|
112
148
|
|
|
113
|
-
## Use in any language
|
|
114
|
-
|
|
115
|
-
The core is exposed as a JSON-over-C-ABI data API in ten languages: Rust, Python,
|
|
116
|
-
Node.js and WASM natively, plus C, C++, C#, Go, Java and R over the C ABI hub. A
|
|
117
|
-
`Session` handle plus `command(json) -> json` and `version` is the whole surface;
|
|
118
|
-
the same test JSON produces a byte-identical result in every binding.
|
|
119
|
-
|
|
120
|
-
```bash
|
|
121
|
-
cargo add wickra-strategy-ci-core # Rust
|
|
122
|
-
pip install wickra-strategy-ci # Python
|
|
123
|
-
npm install wickra-strategy-ci # Node.js
|
|
124
|
-
dotnet add package Wickra.StrategyCi # C#
|
|
125
|
-
go get github.com/wickra-lib/wickra-strategy-ci/bindings/go # Go
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
Java ships to Maven Central (`org.wickra:wickra-strategy-ci`), R to r-universe
|
|
129
|
-
(`wickrastrategyci`), and the C ABI ships as a per-platform library with a
|
|
130
|
-
vendored header. See each binding's `README.md` under [`bindings/`](bindings/).
|
|
131
|
-
|
|
132
149
|
## How it works
|
|
133
150
|
|
|
134
151
|
A `StrategyTest` is data, not code: a serde model carrying an opaque
|
|
@@ -145,40 +162,24 @@ compared field by field, reporting mismatches, fields that vanished and fields
|
|
|
145
162
|
that appeared. Strings, booleans and nulls are not pinned, so a report field that
|
|
146
163
|
is text is outside what a golden can catch.
|
|
147
164
|
|
|
148
|
-
##
|
|
149
|
-
|
|
150
|
-
A suite is cheap enough to gate every pull request. Median wall-clock for
|
|
151
|
-
`run_suite`, parallel path, from the `strategy-ci-bench` criterion suite:
|
|
152
|
-
|
|
153
|
-
| Dataset | Tests | Suite | Per test |
|
|
154
|
-
|---------|-------|-------|----------|
|
|
155
|
-
| small (200 bars) | 100 | 13.4 ms | ~134 µs |
|
|
156
|
-
| small (200 bars) | 1000 | 143 ms | ~143 µs |
|
|
157
|
-
| large (2000 bars) | 100 | 156 ms | ~1.56 ms |
|
|
158
|
-
| large (2000 bars) | 1000 | 1.24 s | ~1.24 ms |
|
|
159
|
-
|
|
160
|
-
Per-test cost is dominated by the engine walking the price history — roughly
|
|
161
|
-
linear in bar count, near-flat in test count once the rayon pool is saturated.
|
|
162
|
-
The golden diff and property checks are `O(fields)` on top. A `fuzz` axis
|
|
163
|
-
multiplies a test's cost by its `runs`. Full method and caveats in
|
|
164
|
-
[BENCHMARKS.md](BENCHMARKS.md); reproduce with `cargo bench -p strategy-ci-bench`.
|
|
165
|
+
## Use in any language
|
|
165
166
|
|
|
166
|
-
|
|
167
|
+
The core is exposed as a JSON-over-C-ABI data API in ten languages: Rust, Python,
|
|
168
|
+
Node.js and WASM natively, plus C, C++, C#, Go, Java and R over the C ABI hub. A
|
|
169
|
+
`Session` handle plus `command(json) -> json` and `version` is the whole surface;
|
|
170
|
+
the same test JSON produces a byte-identical result in every binding.
|
|
167
171
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
| Java | 22 or newer. |
|
|
176
|
-
| R | 3.5 or newer. |
|
|
177
|
-
| C / C++ / C# / R | The C ABI library plus its vendored header; see each binding's `README.md`. |
|
|
172
|
+
```bash
|
|
173
|
+
cargo add wickra-strategy-ci-core # Rust
|
|
174
|
+
pip install wickra-strategy-ci # Python
|
|
175
|
+
npm install wickra-strategy-ci # Node.js
|
|
176
|
+
dotnet add package Wickra.StrategyCi # C#
|
|
177
|
+
go get github.com/wickra-lib/wickra-strategy-ci/bindings/go # Go
|
|
178
|
+
```
|
|
178
179
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
Java ships to Maven Central (`org.wickra:wickra-strategy-ci`), R to r-universe
|
|
181
|
+
(`wickrastrategyci`), and the C ABI ships as a per-platform library with a
|
|
182
|
+
vendored header. See each binding's `README.md` under [`bindings/`](bindings/).
|
|
182
183
|
|
|
183
184
|
## Project layout
|
|
184
185
|
|
|
@@ -231,6 +232,41 @@ Every binding runs the **same** `golden/` fixtures through its own
|
|
|
231
232
|
languages agree byte-for-byte — not just that each one runs. The CLI is covered
|
|
232
233
|
end-to-end against `golden/tests` in CI.
|
|
233
234
|
|
|
235
|
+
## Requirements
|
|
236
|
+
|
|
237
|
+
| To use | You need |
|
|
238
|
+
|--------|----------|
|
|
239
|
+
| The CLI or the GitHub Action | Nothing — the action installs a prebuilt binary, or builds from git as a fallback. |
|
|
240
|
+
| Rust | 1.86 or newer (workspace MSRV). |
|
|
241
|
+
| Python | 3.9 or newer. |
|
|
242
|
+
| Node.js | 22 or newer. |
|
|
243
|
+
| Go | 1.23 or newer. |
|
|
244
|
+
| Java | 22 or newer. |
|
|
245
|
+
| R | 4.1 or newer. |
|
|
246
|
+
| C / C++ / C# / R | The C ABI library plus its vendored header; see each binding's `README.md`. |
|
|
247
|
+
|
|
248
|
+
Building from source additionally needs a Rust toolchain; the polyglot bindings
|
|
249
|
+
need their own toolchain (`maturin`, `napi`, `wasm-pack`, `dotnet`, `go`, Maven,
|
|
250
|
+
`R CMD`) only for the binding you are building.
|
|
251
|
+
|
|
252
|
+
## Benchmarks
|
|
253
|
+
|
|
254
|
+
A suite is cheap enough to gate every pull request. Median wall-clock for
|
|
255
|
+
`run_suite`, parallel path, from the `strategy-ci-bench` criterion suite:
|
|
256
|
+
|
|
257
|
+
| Dataset | Tests | Suite | Per test |
|
|
258
|
+
|---------|-------|-------|----------|
|
|
259
|
+
| small (200 bars) | 100 | 13.4 ms | ~134 µs |
|
|
260
|
+
| small (200 bars) | 1000 | 143 ms | ~143 µs |
|
|
261
|
+
| large (2000 bars) | 100 | 156 ms | ~1.56 ms |
|
|
262
|
+
| large (2000 bars) | 1000 | 1.24 s | ~1.24 ms |
|
|
263
|
+
|
|
264
|
+
Per-test cost is dominated by the engine walking the price history — roughly
|
|
265
|
+
linear in bar count, near-flat in test count once the rayon pool is saturated.
|
|
266
|
+
The golden diff and property checks are `O(fields)` on top. A `fuzz` axis
|
|
267
|
+
multiplies a test's cost by its `runs`. Full method and caveats in
|
|
268
|
+
[BENCHMARKS.md](BENCHMARKS.md); reproduce with `cargo bench -p strategy-ci-bench`.
|
|
269
|
+
|
|
234
270
|
## Ecosystem
|
|
235
271
|
|
|
236
272
|
Strategy-CI is one repo in the [Wickra](https://github.com/wickra-lib) family:
|
|
@@ -244,15 +280,6 @@ Strategy-CI is one repo in the [Wickra](https://github.com/wickra-lib) family:
|
|
|
244
280
|
| [wickra-synth](https://github.com/wickra-lib/wickra-synth) | Deterministic synthetic market data, useful as fuzz input. |
|
|
245
281
|
| [wickra-exchange](https://github.com/wickra-lib/wickra-exchange) | Live and historical exchange connectivity. |
|
|
246
282
|
|
|
247
|
-
## Documentation
|
|
248
|
-
|
|
249
|
-
See [docs/](docs/) — [`TESTS.md`](docs/TESTS.md) for the test model,
|
|
250
|
-
[`TOLERANCES.md`](docs/TOLERANCES.md) for the golden diff,
|
|
251
|
-
[`PROPERTIES.md`](docs/PROPERTIES.md) for the invariants,
|
|
252
|
-
[`FUZZING.md`](docs/FUZZING.md) for the perturbations,
|
|
253
|
-
[`GITHUB_ACTION.md`](docs/GITHUB_ACTION.md) for the action, and
|
|
254
|
-
[`Cookbook.md`](docs/Cookbook.md) for task-shaped recipes.
|
|
255
|
-
|
|
256
283
|
## Contributing
|
|
257
284
|
|
|
258
285
|
See [CONTRIBUTING.md](CONTRIBUTING.md) and the
|
|
@@ -264,8 +291,20 @@ Report vulnerabilities per [SECURITY.md](SECURITY.md).
|
|
|
264
291
|
|
|
265
292
|
## License
|
|
266
293
|
|
|
267
|
-
|
|
268
|
-
|
|
294
|
+
Licensed under either of
|
|
295
|
+
|
|
296
|
+
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
|
|
297
|
+
<http://www.apache.org/licenses/LICENSE-2.0>)
|
|
298
|
+
- MIT license ([LICENSE-MIT](LICENSE-MIT) or <http://opensource.org/licenses/MIT>)
|
|
299
|
+
|
|
300
|
+
at your option. Use it, fork it, modify it, redistribute it — commercially or
|
|
301
|
+
not — file issues, send pull requests; all welcome.
|
|
302
|
+
|
|
303
|
+
### Contribution
|
|
304
|
+
|
|
305
|
+
Unless you explicitly state otherwise, any contribution intentionally submitted
|
|
306
|
+
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
|
|
307
|
+
dual licensed as above, without any additional terms or conditions.
|
|
269
308
|
|
|
270
309
|
## Disclaimer
|
|
271
310
|
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Which binding artifact the generated loader actually loaded: `'native'` for
|
|
6
|
+
* a native addon, otherwise the `platformArchABI` of the WASI flavor. Every
|
|
7
|
+
* flavor napi-rs can build is listed, because `NAPI_RS_NATIVE_LIBRARY_PATH`
|
|
8
|
+
* can point the loader at a WASI artifact this package does not build itself.
|
|
9
|
+
*/
|
|
10
|
+
export declare const __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-wasip1'
|
|
11
|
+
|
|
3
12
|
/** A stateless strategy-test session. Tests and data are passed with each command. */
|
|
4
13
|
export declare class Session {
|
|
5
14
|
constructor()
|
package/index.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
// prettier-ignore
|
|
2
1
|
/* eslint-disable */
|
|
3
2
|
// @ts-nocheck
|
|
4
3
|
/* auto-generated by NAPI-RS */
|
|
5
4
|
|
|
6
5
|
const { readFileSync } = require('fs')
|
|
7
6
|
let nativeBinding = null
|
|
7
|
+
// Which artifact actually loaded. The WASI fallback chain overwrites it with
|
|
8
|
+
// the flavor it resolved; the late native retry below leaves it alone because
|
|
9
|
+
// it only runs while no WASI candidate has been loaded.
|
|
10
|
+
let __napiLoadedBindingTarget = 'native'
|
|
8
11
|
const loadErrors = []
|
|
9
12
|
|
|
10
13
|
const isMusl = () => {
|
|
@@ -63,7 +66,16 @@ const isMuslFromChildProcess = () => {
|
|
|
63
66
|
function requireNative() {
|
|
64
67
|
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
65
68
|
try {
|
|
66
|
-
|
|
69
|
+
const overrideBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH)
|
|
70
|
+
// The override may be a generated WASI loader, which already reports its
|
|
71
|
+
// own flavor. Adopt it: `module.exports` aliases this object, so claiming
|
|
72
|
+
// 'native' would both misreport the artifact and overwrite the loader's
|
|
73
|
+
// marker through the alias.
|
|
74
|
+
__napiLoadedBindingTarget =
|
|
75
|
+
overrideBinding && typeof overrideBinding.__napiBindingTarget === 'string'
|
|
76
|
+
? overrideBinding.__napiBindingTarget
|
|
77
|
+
: 'native'
|
|
78
|
+
return overrideBinding
|
|
67
79
|
} catch (err) {
|
|
68
80
|
loadErrors.push(err)
|
|
69
81
|
}
|
|
@@ -77,8 +89,8 @@ function requireNative() {
|
|
|
77
89
|
try {
|
|
78
90
|
const binding = require('wickra-strategy-ci-android-arm64')
|
|
79
91
|
const bindingPackageVersion = require('wickra-strategy-ci-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '0.1.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
92
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
93
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
94
|
}
|
|
83
95
|
return binding
|
|
84
96
|
} catch (e) {
|
|
@@ -93,8 +105,8 @@ function requireNative() {
|
|
|
93
105
|
try {
|
|
94
106
|
const binding = require('wickra-strategy-ci-android-arm-eabi')
|
|
95
107
|
const bindingPackageVersion = require('wickra-strategy-ci-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '0.1.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
108
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
109
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
110
|
}
|
|
99
111
|
return binding
|
|
100
112
|
} catch (e) {
|
|
@@ -107,36 +119,36 @@ function requireNative() {
|
|
|
107
119
|
if (process.arch === 'x64') {
|
|
108
120
|
if ((process.config && process.config.variables && process.config.variables.shlib_suffix === 'dll.a') || (process.config && process.config.variables && process.config.variables.node_target_type === 'shared_library')) {
|
|
109
121
|
try {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
122
|
+
return require('./wickra-strategy-ci.win32-x64-gnu.node')
|
|
123
|
+
} catch (e) {
|
|
124
|
+
loadErrors.push(e)
|
|
125
|
+
}
|
|
126
|
+
try {
|
|
127
|
+
const binding = require('wickra-strategy-ci-win32-x64-gnu')
|
|
128
|
+
const bindingPackageVersion = require('wickra-strategy-ci-win32-x64-gnu/package.json').version
|
|
129
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
130
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
131
|
+
}
|
|
132
|
+
return binding
|
|
133
|
+
} catch (e) {
|
|
134
|
+
loadErrors.push(e)
|
|
119
135
|
}
|
|
120
|
-
return binding
|
|
121
|
-
} catch (e) {
|
|
122
|
-
loadErrors.push(e)
|
|
123
|
-
}
|
|
124
136
|
} else {
|
|
125
137
|
try {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
138
|
+
return require('./wickra-strategy-ci.win32-x64-msvc.node')
|
|
139
|
+
} catch (e) {
|
|
140
|
+
loadErrors.push(e)
|
|
141
|
+
}
|
|
142
|
+
try {
|
|
143
|
+
const binding = require('wickra-strategy-ci-win32-x64-msvc')
|
|
144
|
+
const bindingPackageVersion = require('wickra-strategy-ci-win32-x64-msvc/package.json').version
|
|
145
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
146
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
147
|
+
}
|
|
148
|
+
return binding
|
|
149
|
+
} catch (e) {
|
|
150
|
+
loadErrors.push(e)
|
|
135
151
|
}
|
|
136
|
-
return binding
|
|
137
|
-
} catch (e) {
|
|
138
|
-
loadErrors.push(e)
|
|
139
|
-
}
|
|
140
152
|
}
|
|
141
153
|
} else if (process.arch === 'ia32') {
|
|
142
154
|
try {
|
|
@@ -147,8 +159,8 @@ function requireNative() {
|
|
|
147
159
|
try {
|
|
148
160
|
const binding = require('wickra-strategy-ci-win32-ia32-msvc')
|
|
149
161
|
const bindingPackageVersion = require('wickra-strategy-ci-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '0.1.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
162
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
163
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
164
|
}
|
|
153
165
|
return binding
|
|
154
166
|
} catch (e) {
|
|
@@ -163,8 +175,8 @@ function requireNative() {
|
|
|
163
175
|
try {
|
|
164
176
|
const binding = require('wickra-strategy-ci-win32-arm64-msvc')
|
|
165
177
|
const bindingPackageVersion = require('wickra-strategy-ci-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '0.1.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
178
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
179
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
180
|
}
|
|
169
181
|
return binding
|
|
170
182
|
} catch (e) {
|
|
@@ -182,8 +194,8 @@ function requireNative() {
|
|
|
182
194
|
try {
|
|
183
195
|
const binding = require('wickra-strategy-ci-darwin-universal')
|
|
184
196
|
const bindingPackageVersion = require('wickra-strategy-ci-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '0.1.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
197
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
198
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
199
|
}
|
|
188
200
|
return binding
|
|
189
201
|
} catch (e) {
|
|
@@ -198,8 +210,8 @@ function requireNative() {
|
|
|
198
210
|
try {
|
|
199
211
|
const binding = require('wickra-strategy-ci-darwin-x64')
|
|
200
212
|
const bindingPackageVersion = require('wickra-strategy-ci-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '0.1.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
213
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
214
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
215
|
}
|
|
204
216
|
return binding
|
|
205
217
|
} catch (e) {
|
|
@@ -214,8 +226,8 @@ function requireNative() {
|
|
|
214
226
|
try {
|
|
215
227
|
const binding = require('wickra-strategy-ci-darwin-arm64')
|
|
216
228
|
const bindingPackageVersion = require('wickra-strategy-ci-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '0.1.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
229
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
230
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
231
|
}
|
|
220
232
|
return binding
|
|
221
233
|
} catch (e) {
|
|
@@ -234,8 +246,8 @@ function requireNative() {
|
|
|
234
246
|
try {
|
|
235
247
|
const binding = require('wickra-strategy-ci-freebsd-x64')
|
|
236
248
|
const bindingPackageVersion = require('wickra-strategy-ci-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '0.1.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
249
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
250
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
251
|
}
|
|
240
252
|
return binding
|
|
241
253
|
} catch (e) {
|
|
@@ -250,8 +262,8 @@ function requireNative() {
|
|
|
250
262
|
try {
|
|
251
263
|
const binding = require('wickra-strategy-ci-freebsd-arm64')
|
|
252
264
|
const bindingPackageVersion = require('wickra-strategy-ci-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '0.1.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
265
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
266
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
267
|
}
|
|
256
268
|
return binding
|
|
257
269
|
} catch (e) {
|
|
@@ -271,8 +283,8 @@ function requireNative() {
|
|
|
271
283
|
try {
|
|
272
284
|
const binding = require('wickra-strategy-ci-linux-x64-musl')
|
|
273
285
|
const bindingPackageVersion = require('wickra-strategy-ci-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '0.1.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
286
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
287
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
288
|
}
|
|
277
289
|
return binding
|
|
278
290
|
} catch (e) {
|
|
@@ -287,8 +299,8 @@ function requireNative() {
|
|
|
287
299
|
try {
|
|
288
300
|
const binding = require('wickra-strategy-ci-linux-x64-gnu')
|
|
289
301
|
const bindingPackageVersion = require('wickra-strategy-ci-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '0.1.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
302
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
303
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
304
|
}
|
|
293
305
|
return binding
|
|
294
306
|
} catch (e) {
|
|
@@ -305,8 +317,8 @@ function requireNative() {
|
|
|
305
317
|
try {
|
|
306
318
|
const binding = require('wickra-strategy-ci-linux-arm64-musl')
|
|
307
319
|
const bindingPackageVersion = require('wickra-strategy-ci-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '0.1.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
320
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
321
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
322
|
}
|
|
311
323
|
return binding
|
|
312
324
|
} catch (e) {
|
|
@@ -321,8 +333,8 @@ function requireNative() {
|
|
|
321
333
|
try {
|
|
322
334
|
const binding = require('wickra-strategy-ci-linux-arm64-gnu')
|
|
323
335
|
const bindingPackageVersion = require('wickra-strategy-ci-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '0.1.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
336
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
337
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
338
|
}
|
|
327
339
|
return binding
|
|
328
340
|
} catch (e) {
|
|
@@ -339,8 +351,8 @@ function requireNative() {
|
|
|
339
351
|
try {
|
|
340
352
|
const binding = require('wickra-strategy-ci-linux-arm-musleabihf')
|
|
341
353
|
const bindingPackageVersion = require('wickra-strategy-ci-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '0.1.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
354
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
355
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
356
|
}
|
|
345
357
|
return binding
|
|
346
358
|
} catch (e) {
|
|
@@ -355,8 +367,8 @@ function requireNative() {
|
|
|
355
367
|
try {
|
|
356
368
|
const binding = require('wickra-strategy-ci-linux-arm-gnueabihf')
|
|
357
369
|
const bindingPackageVersion = require('wickra-strategy-ci-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '0.1.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
370
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
371
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
372
|
}
|
|
361
373
|
return binding
|
|
362
374
|
} catch (e) {
|
|
@@ -373,8 +385,8 @@ function requireNative() {
|
|
|
373
385
|
try {
|
|
374
386
|
const binding = require('wickra-strategy-ci-linux-loong64-musl')
|
|
375
387
|
const bindingPackageVersion = require('wickra-strategy-ci-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '0.1.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
388
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
389
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
390
|
}
|
|
379
391
|
return binding
|
|
380
392
|
} catch (e) {
|
|
@@ -389,8 +401,8 @@ function requireNative() {
|
|
|
389
401
|
try {
|
|
390
402
|
const binding = require('wickra-strategy-ci-linux-loong64-gnu')
|
|
391
403
|
const bindingPackageVersion = require('wickra-strategy-ci-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '0.1.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
404
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
405
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
406
|
}
|
|
395
407
|
return binding
|
|
396
408
|
} catch (e) {
|
|
@@ -407,8 +419,8 @@ function requireNative() {
|
|
|
407
419
|
try {
|
|
408
420
|
const binding = require('wickra-strategy-ci-linux-riscv64-musl')
|
|
409
421
|
const bindingPackageVersion = require('wickra-strategy-ci-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '0.1.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
422
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
423
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
424
|
}
|
|
413
425
|
return binding
|
|
414
426
|
} catch (e) {
|
|
@@ -423,8 +435,8 @@ function requireNative() {
|
|
|
423
435
|
try {
|
|
424
436
|
const binding = require('wickra-strategy-ci-linux-riscv64-gnu')
|
|
425
437
|
const bindingPackageVersion = require('wickra-strategy-ci-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '0.1.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
438
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
439
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
440
|
}
|
|
429
441
|
return binding
|
|
430
442
|
} catch (e) {
|
|
@@ -440,8 +452,8 @@ function requireNative() {
|
|
|
440
452
|
try {
|
|
441
453
|
const binding = require('wickra-strategy-ci-linux-ppc64-gnu')
|
|
442
454
|
const bindingPackageVersion = require('wickra-strategy-ci-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '0.1.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
455
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
456
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
457
|
}
|
|
446
458
|
return binding
|
|
447
459
|
} catch (e) {
|
|
@@ -456,8 +468,8 @@ function requireNative() {
|
|
|
456
468
|
try {
|
|
457
469
|
const binding = require('wickra-strategy-ci-linux-s390x-gnu')
|
|
458
470
|
const bindingPackageVersion = require('wickra-strategy-ci-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '0.1.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
471
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
472
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
473
|
}
|
|
462
474
|
return binding
|
|
463
475
|
} catch (e) {
|
|
@@ -476,8 +488,8 @@ function requireNative() {
|
|
|
476
488
|
try {
|
|
477
489
|
const binding = require('wickra-strategy-ci-openharmony-arm64')
|
|
478
490
|
const bindingPackageVersion = require('wickra-strategy-ci-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '0.1.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
491
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
492
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
493
|
}
|
|
482
494
|
return binding
|
|
483
495
|
} catch (e) {
|
|
@@ -492,8 +504,8 @@ function requireNative() {
|
|
|
492
504
|
try {
|
|
493
505
|
const binding = require('wickra-strategy-ci-openharmony-x64')
|
|
494
506
|
const bindingPackageVersion = require('wickra-strategy-ci-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '0.1.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
507
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
508
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
509
|
}
|
|
498
510
|
return binding
|
|
499
511
|
} catch (e) {
|
|
@@ -508,8 +520,8 @@ function requireNative() {
|
|
|
508
520
|
try {
|
|
509
521
|
const binding = require('wickra-strategy-ci-openharmony-arm')
|
|
510
522
|
const bindingPackageVersion = require('wickra-strategy-ci-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '0.1.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
523
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
524
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
525
|
}
|
|
514
526
|
return binding
|
|
515
527
|
} catch (e) {
|
|
@@ -550,7 +562,7 @@ function createLoadErrorChain(errors) {
|
|
|
550
562
|
//
|
|
551
563
|
// NAPI_RS_WASI_FLAVOR selects one exact generated flavor and implies strict
|
|
552
564
|
// WASI loading. It never crosses into another flavor or falls back to native.
|
|
553
|
-
const __napiWasiFlavors = [
|
|
565
|
+
const __napiWasiFlavors = ['wasm32-wasi']
|
|
554
566
|
const __napiWasiFlavor = process.env.NAPI_RS_WASI_FLAVOR
|
|
555
567
|
const __napiWasiFlavorRequested =
|
|
556
568
|
typeof __napiWasiFlavor === 'string' && __napiWasiFlavor.length > 0
|
|
@@ -619,15 +631,16 @@ if (!nativeBinding || forceWasi) {
|
|
|
619
631
|
}
|
|
620
632
|
return null
|
|
621
633
|
}
|
|
622
|
-
if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor ===
|
|
634
|
+
if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === 'wasm32-wasi')) {
|
|
623
635
|
let candidateError = null
|
|
624
636
|
let candidateFailed = false
|
|
625
637
|
try {
|
|
626
|
-
candidateError = __napiWasiResolveCandidate('./wickra-strategy-ci.wasi.cjs', false, [
|
|
638
|
+
candidateError = __napiWasiResolveCandidate('./wickra-strategy-ci.wasi.cjs', false, ['./wickra-strategy-ci.wasm32-wasi.debug.wasm', './wickra-strategy-ci.wasm32-wasi.wasm'])
|
|
627
639
|
candidateFailed = candidateError !== null
|
|
628
640
|
if (!candidateFailed) {
|
|
629
641
|
wasiBinding = require('./wickra-strategy-ci.wasi.cjs')
|
|
630
642
|
nativeBinding = wasiBinding
|
|
643
|
+
__napiLoadedBindingTarget = 'wasm32-wasi'
|
|
631
644
|
wasiBindingLoaded = true
|
|
632
645
|
}
|
|
633
646
|
} catch (err) {
|
|
@@ -639,7 +652,7 @@ if (!nativeBinding || forceWasi) {
|
|
|
639
652
|
loadErrors.push(candidateError)
|
|
640
653
|
}
|
|
641
654
|
}
|
|
642
|
-
if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor ===
|
|
655
|
+
if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === 'wasm32-wasi')) {
|
|
643
656
|
let candidateError = null
|
|
644
657
|
let candidateFailed = false
|
|
645
658
|
try {
|
|
@@ -648,12 +661,13 @@ if (!nativeBinding || forceWasi) {
|
|
|
648
661
|
if (!candidateFailed) {
|
|
649
662
|
if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
650
663
|
const bindingPackageVersion = require('wickra-strategy-ci-wasm32-wasi/package.json').version
|
|
651
|
-
if (bindingPackageVersion !== '0.1.
|
|
652
|
-
throw new Error(`WASI binding package version mismatch, expected 0.1.
|
|
664
|
+
if (bindingPackageVersion !== '0.1.4') {
|
|
665
|
+
throw new Error(`WASI binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
653
666
|
}
|
|
654
667
|
}
|
|
655
668
|
wasiBinding = require('wickra-strategy-ci-wasm32-wasi')
|
|
656
669
|
nativeBinding = wasiBinding
|
|
670
|
+
__napiLoadedBindingTarget = 'wasm32-wasi'
|
|
657
671
|
wasiBindingLoaded = true
|
|
658
672
|
}
|
|
659
673
|
} catch (err) {
|
|
@@ -699,5 +713,69 @@ if (!nativeBinding) {
|
|
|
699
713
|
throw new Error(`Failed to load native binding`)
|
|
700
714
|
}
|
|
701
715
|
|
|
716
|
+
function __napiStampBindingTarget(exportsObject, target) {
|
|
717
|
+
if (
|
|
718
|
+
Object.prototype.hasOwnProperty.call(exportsObject, '__napiBindingTarget')
|
|
719
|
+
) {
|
|
720
|
+
if (exportsObject.__napiBindingTarget === target) {
|
|
721
|
+
// Already ours: the root entry aliases the object it loaded, so a WASI
|
|
722
|
+
// fallback candidate — or a `NAPI_RS_NATIVE_LIBRARY_PATH` override that
|
|
723
|
+
// is a generated loader — arrives already stamped with this same value.
|
|
724
|
+
return target
|
|
725
|
+
}
|
|
726
|
+
const error = new Error(
|
|
727
|
+
'`__napiBindingTarget` is reserved by the generated binding loader, but the loaded binding already exports it. Rename the export, e.g. #[napi(js_name = "...")].',
|
|
728
|
+
)
|
|
729
|
+
error.code = 'ERR_NAPI_BINDING_TARGET_CONFLICT'
|
|
730
|
+
throw error
|
|
731
|
+
}
|
|
732
|
+
if (!Object.isExtensible(exportsObject)) {
|
|
733
|
+
// A `#[napi(module_exports)]` hook may seal or freeze this object
|
|
734
|
+
// (`Object::seal` / `Object::freeze`). Reporting the artifact is metadata,
|
|
735
|
+
// never a reason to fail an otherwise successful load, so the stamp is
|
|
736
|
+
// skipped. What a consumer still sees then follows the entry point: the
|
|
737
|
+
// browser and deferred loaders declare `__napiBindingTarget` at module
|
|
738
|
+
// level and go on reporting it, while the CommonJS entries hand back this
|
|
739
|
+
// very object as `module.exports`, so there the value is absent.
|
|
740
|
+
return target
|
|
741
|
+
}
|
|
742
|
+
try {
|
|
743
|
+
// [[Define]], not [[Set]]: an ordinary assignment walks the prototype
|
|
744
|
+
// chain, so an inherited accessor could swallow the value or throw and
|
|
745
|
+
// fail an otherwise successful load. The descriptor is what a successful
|
|
746
|
+
// assignment would have produced.
|
|
747
|
+
Object.defineProperty(exportsObject, '__napiBindingTarget', {
|
|
748
|
+
configurable: true,
|
|
749
|
+
enumerable: true,
|
|
750
|
+
value: target,
|
|
751
|
+
writable: true,
|
|
752
|
+
})
|
|
753
|
+
} catch {
|
|
754
|
+
// Same rule as the non-extensible skip above: reporting the artifact is
|
|
755
|
+
// metadata, never a reason to fail an otherwise successful load. An exotic
|
|
756
|
+
// object (a Proxy whose defineProperty trap refuses) is skipped, not
|
|
757
|
+
// thrown over.
|
|
758
|
+
}
|
|
759
|
+
// The CommonJS loaders assign this return value so `cjs-module-lexer` — and
|
|
760
|
+
// therefore Node's CJS -> ESM named export detection — can see
|
|
761
|
+
// `__napiBindingTarget` statically.
|
|
762
|
+
return target
|
|
763
|
+
}
|
|
764
|
+
// Stamp before the alias, not after. The guard only reads `nativeBinding`
|
|
765
|
+
// (`hasOwnProperty` plus a comparison), which is safe against any addon
|
|
766
|
+
// accessor; an assignment is not, because a `#[napi(module_exports)]` hook can
|
|
767
|
+
// expose a getter reporting this very value and a setter that throws. So the
|
|
768
|
+
// assignment lands on the loader's own `module.exports`, still the original
|
|
769
|
+
// object here, and the alias below replaces it.
|
|
770
|
+
//
|
|
771
|
+
// The assignment is what keeps the marker a statically visible CommonJS export:
|
|
772
|
+
// `cjs-module-lexer` is Node's CJS -> ESM named export detection, it cannot see
|
|
773
|
+
// a bare call, and the later `module.exports = nativeBinding` does not undo the
|
|
774
|
+
// detection. The assignment itself always succeeds — its target is this
|
|
775
|
+
// loader's own, still extensible `module.exports` — and the alias below then
|
|
776
|
+
// discards the value it wrote. What a consumer reads is whatever the guard put
|
|
777
|
+
// on `nativeBinding`, so on a frozen binding, where the guard skips, the
|
|
778
|
+
// linked import resolves to `undefined`.
|
|
779
|
+
module.exports.__napiBindingTarget = __napiStampBindingTarget(nativeBinding, __napiLoadedBindingTarget)
|
|
702
780
|
module.exports = nativeBinding
|
|
703
781
|
module.exports.Session = nativeBinding.Session
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wickra-strategy-ci",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Jest for trading strategies: golden-pin the backtest report, catch regressions in CI, property-test against fuzzed data. Node bindings powered by Rust.",
|
|
5
5
|
"author": "kingchenc <support@wickra.org>",
|
|
6
6
|
"main": "index.js",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"node": ">= 22"
|
|
47
47
|
},
|
|
48
48
|
"optionalDependencies": {
|
|
49
|
-
"wickra-strategy-ci-linux-x64-gnu": "0.1.
|
|
50
|
-
"wickra-strategy-ci-linux-arm64-gnu": "0.1.
|
|
51
|
-
"wickra-strategy-ci-darwin-x64": "0.1.
|
|
52
|
-
"wickra-strategy-ci-darwin-arm64": "0.1.
|
|
53
|
-
"wickra-strategy-ci-win32-x64-msvc": "0.1.
|
|
54
|
-
"wickra-strategy-ci-win32-arm64-msvc": "0.1.
|
|
49
|
+
"wickra-strategy-ci-linux-x64-gnu": "0.1.4",
|
|
50
|
+
"wickra-strategy-ci-linux-arm64-gnu": "0.1.4",
|
|
51
|
+
"wickra-strategy-ci-darwin-x64": "0.1.4",
|
|
52
|
+
"wickra-strategy-ci-darwin-arm64": "0.1.4",
|
|
53
|
+
"wickra-strategy-ci-win32-x64-msvc": "0.1.4",
|
|
54
|
+
"wickra-strategy-ci-win32-arm64-msvc": "0.1.4"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"build": "napi build --platform --release",
|
|
@@ -61,6 +61,6 @@
|
|
|
61
61
|
"test": "node --test"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@napi-rs/cli": "^3.
|
|
64
|
+
"@napi-rs/cli": "^3.9.0"
|
|
65
65
|
}
|
|
66
66
|
}
|