The JS bindings currently assume the wasm can be located via the default
Emscripten path resolution, which can force Deno users into
`--allow-read`. This change lets callers provide a custom wasm load path
through `init(...)`, so Deno can resolve the packaged wasm asset without
filesystem reads.
- **Public init API**
- Extend the JS entrypoints (`node` and `browser`) so `init(...)`
accepts optional Emscripten module overrides.
- Surface a typed `Z3ModuleOverrides` shape with explicit support for
`locateFile(path, prefix)`.
- **Low-level initialization**
- Thread module overrides through the generated low-level wrapper
instead of always calling the Emscripten module factory with no
arguments.
- Keep the default behavior unchanged when no overrides are provided.
- **Docs**
- Document the Deno usage pattern in the published JS README.
- Clarify the `locateFile` signature and show the intended Deno 2.1+
`import.meta.resolve(...)` flow.
- **Focused coverage**
- Add unit tests for `node` and `browser` init to verify module
overrides are forwarded correctly.
Example:
```ts
import { init } from 'npm:z3-solver';
const api = await init({
locateFile: (file, _prefix): string =>
import.meta.resolve(`npm:z3-solver/build/${file}`),
});
```
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
* fixes for newer emscripten thread handling behavior
* fix return type for async wrapper functions
* update prettier
* update typescript and fix errors
* update emscripten version in CI
* update js readme about tests
* implement Optimize class for the high level Typescript API
* javascript and wasm: add _malloc to exported functions
fix the bug https://github.com/Z3Prover/z3/issues/6709
* javascript: add tests for the Optimize class
* javascript: no reason that minimize and optimize must be constants
* feat: basic quantfier support
* feat: added isQuantifier
* feat: expanded functions
* wip: (lambda broken)
* temp fix to LambdaImpl typing issue
* feat: function type inference
* formatting with prettier
* fix: imported from invalid module
* fix isBool bug and dumping to smtlib
* substitution and model.updateValue
* api to add custom func interps to model
* fix: building
* properly handling uint32 -> number conversion in z3 TS wrapper
* added simplify
* remame Add->Sum and Mul->Product
* formatting
* [Draft] Added unfinished code for high level bindings for js
* * Rewrote structure of js api files
* Added more high level apis
* Minor fixes
* Fixed wasm github action
* Fix JS test
* Removed ContextOptions type
* * Added Ints to JS Api
* Added tests to JS Api
* Added run-time checks for contexts
* Removed default contexts
* Merged Context and createContext so that the api behaves the sames as in other constructors
* Added a test for Solver
* Added Reals
* Added classes for IntVals and RealVals
* Added abillity to specify logic for solver
* Try to make CI tests not fail
* Changed APIs after a round of review
* Fix test
* Added BitVectors
* Made sort into getter
* Added initial JS docs
* Added more coercible types
* Removed done TODOs