swisseph_rs 0.3.2
swisseph_rs: ^0.3.2 copied to clipboard
Idiomatic Dart transliteration of the swisseph-rs Rust API — typed, stateless, isolate-safe Swiss Ephemeris bindings via FFI.
0.3.2 #
-
Apple platform (macOS/iOS) native builds now work out of the box. Two gaps blocked them:
_rustTargetreturnednullforOS.macOS, so a macOS build never cross-compiled to a Rust target. It now mapsarm64/x64toaarch64-apple-darwin/x86_64-apple-darwin, mirroring the existing iOS handling.cargoandrustupwere invoked by bare name, resolved viaPATH. Xcode's build-phase sandbox runs with a minimalPATHthat excludes~/.cargo/bin, so the toolchain was "not found" mid-build even when installed. Both are now resolved through_rustTool, which prefers the rustup default install location (~/.cargo/bin/<name>) and falls back to the bare name (PATH) elsewhere, so non-Apple builds are unaffected.
This removes the need for downstream apps to carry a
dependency_overridesfork of this package just to build for Apple platforms.
0.3.1 #
-
The native build no longer requires SSH credentials.
rust/Cargo.tomlreached itsswisseph-ffidependency overssh://git@github.com/..., which demands a key even thoughninthhousestudios/swisseph-rsis a public repository — so on any machine without a GitHub SSH key on the agent (a fresh Windows box, a CI runner), the native assets build died withspurious network error ... exit code 128followed byfailed to get 'swisseph-ffi' as a dependency. The dependency now useshttps://github.com/ninthhousestudios/swisseph-rsat the same pinned revd8ef3bb, which fetches anonymously via both cargo's bundled libgit2 and thegitCLI.No API change and no rebuilt binary — the compiled Rust is byte-for-byte the same revision. If you hit the build failure above on 0.3.0, upgrading is the whole fix; no
.cargo/config.toml, gitinsteadOfrewrite, or deploy key is needed.
0.3.0 #
-
The web WASM artifacts now ship as Flutter package assets.
wasm/swisseph_ffi.jsandwasm/swisseph_ffi.wasmare declared under aflutter: assets:block, so a Flutter consumer receives both files from the resolvedswisseph_rsversion with no copy step, and the newwasmAssetPathconstant names where the bundler puts them:await initializeWasm(wasmAssetPath).Delete any vendored
web/swisseph_ffi.js/web/swisseph_ffi.wasmfrom your app. Hand-copied glue was the only delivery mechanism through 0.2.9 and it had no link to the version inpubspec.yaml: bumping the dependency updated the Dart loader inlib/and left the copied binaries untouched. That is why the 0.2.8 fix for the resizable-ArrayBufferclass of bug (Web Crypto andTextDecoderboth reject views onto a growableWebAssembly.Memory) did not reach an app whose pubspec already said^0.2.9— the pubspec bump was never the delivery path. The failure is web-only, release-only and browser-version-dependent (older embedded Chromium still hands out a non-resizable buffer), and the.wasmis byte-identical across 0.2.7–0.2.9 because the fixes are glue-only, so "the wasm didn't change" is true and useless as a diagnostic. Bundled assets make the skew unrepresentable instead of detectable.Cost: Flutter's asset system has no per-platform filtering, so every consumer carries ~924 KB on every platform, including native builds that never load it.
Non-Flutter web consumers (plain
package:webapps, no asset bundler) still copy both files and pass their own path;initializeWasmis unchanged.
0.2.9 #
- Bumped swisseph-ffi to
d8ef3bb(swisseph-rs 0.1.8), which fixes an infinite Newton loop in crossing refinement against DE441 ephemeris files. 0.1.6 introduced that fix along withswisseph::Error::NoConvergence, which the FFI now maps to the new append-only code-17, surfaced in Dart asNoConvergenceException. 0.1.7 and 0.1.8 carry that mapping plus a correction to the generated C header'sswisseph_azaltsignature; neither changes an ABI this package consumes. - Added
NoConvergenceException, the counterpart toswisseph::Error::NoConvergence. It joins theSweExceptionhierarchy, so exhaustive switches overSweExceptionneed a new arm.
0.2.8 #
- Fixed web builds throwing
TypeError: The provided ArrayBufferView value must not be resizableon everyEphemerisconstruction in current Chrome. UnderALLOW_MEMORY_GROWTH, WASM memory is exposed as a resizable ArrayBuffer, and Web Crypto rejects views backed by one — so the engine's first entropy request (16 bytes, insideswisseph_new) threw. The WASM module loaded fine, so the failure landed on first use rather than at startup. Fixed at the source via an--js-libraryoverride of Emscripten's$initRandomFill(wasm/lib-random-fill.js), so generated glue fills a plain buffer and copies. The.wasmbinary is unchanged. - Fixed
initializeWasm()hanging forever instead of throwing when the glue script fails to load. The pre-load usedmodulePathverbatim whilewasm_ffiresolves an extensionless path to<path>.js, so the documented default ('swisseph_ffi') fetched a 404; awaiting onlyonLoadthen hung indefinitely. The pre-load now mirrors the extension resolution and rejects on load error. - Fixed
initializeWasm()appending a second.jsto glue URLs that carry a query string, e.g. a cache-bustedswisseph_ffi.js?v=1. The extension is now resolved from the parsed URI's last path segment, matching howwasm_ffidecides. - Fixed
loadEpheFile()/MEMFS being silently dead wheninitializeWasm()was given a..-relativemodulePath.wasm_ffi's script dedup compares a tag's resolved URL against the raw string withendsWith, so any relative path got a second glue tag injected; the re-executed glue stripped the module-capture wrapper and every MEMFS call threwStateError('Emscripten module not available.'). The capture is now an accessor property onglobalThisthat survives any number of glue executions, and only the active initialization attempt may publish a module — a post-initialization consumer instantiating the glue for its own purposes can no longer redirect this package's filesystem handle. - Fixed the glue's string decoding throwing
TypeError: The provided ArrayBuffer value must not be resizablefor strings longer than 16 bytes (same Chrome resizable-memory change as above —TextDecoderrefuses views into a resizable heap). The Swiss-file path was the first to return a string that long. Patched via an idempotent post-processing step inwasm/build.sh(.slice()instead of.subarray()when the heap is resizable), matching what newer Emscripten does upstream. initializeWasm()is now bounded end to end: 30 s for the glue script load and 60 s for module instantiation (which includes the sibling.wasmfetch), each failing with aTimeoutExceptioninstead of hanging on a server that accepts the connection and never responds. A failed initialization releases the single-flight latch, so it may be retried.
Web consumers who added a crypto.getRandomValues workaround to their
index.html for the resizable-buffer error can remove it after upgrading;
the fix now ships inside the package's WASM glue.
Note for anyone else shipping an Emscripten module: this is not specific to
this package. emcc 6.0.2 still emits an unguarded
crypto.getRandomValues(HEAPU8.subarray(...)) for non-SHARED_MEMORY
builds, so any module built with ALLOW_MEMORY_GROWTH hits it on current
Chrome. Bumping the Emscripten SDK does not fix it.
0.2.7 #
- Fixed
nodAps/nodApsUtfor numbered asteroids (e.g. Eros 433) with the Swiss ephemeris backend. The internal position provider was constructed with empty asteroid and planet-moon file lists, causingEphemerisNotAvailableerrors. Also includescalcPctralias normalization for asteroid bodies. Bumped swisseph-ffi toa4cf744.
0.2.6 #
- Fixed
calcPctrfor main asteroid bodies (Chiron, Pholus, Ceres, Pallas, Juno, Vesta). The internal position provider was missing the main asteroid file set, causingBeyondEphemerisLimitserrors for these bodies even when.se1files were present. Bumped swisseph-ffi toc3c27cb.
0.2.5 #
- Fixed asteroid file parsing for MPC numbers > 22767 (e.g. Quaoar 50000).
2-byte
ipl[]entries were sign-extended from i16, wrapping body IDs above 32767 to negative values and causing "ephemeris not available" errors despite valid files on disk. Bumped swisseph-ffi tob6a9f82.
0.2.4 #
- Breaking:
getAyanamsaEx,getAyanamsaExWithConfig, andgetAyanamsaUtnow return({double ayanamsa, CalcFlags flagsUsed})instead of baredouble, exposing ephemeris-fallback information.
0.2.3 #
- Added
siderealTimeandsiderealTime0methods onEphemerisfor Greenwich Apparent Sidereal Time (GAST). - Added
cotransandcotransWithSpeedfree functions for ecliptic ↔ equatorial coordinate transformation. - Bumped swisseph-ffi to
64bc1533(addsswisseph_cotrans/swisseph_cotrans_spFFI exports).
0.2.2 #
- Build hook: Android and iOS cross-compilation support. Maps
targetOS/targetArchitectureto Rust target triples, wires the NDK clang linker for Android, and fails early with an actionable message when arustuptarget is missing. Desktop path unchanged.
0.2.1 #
- Fixed web:
loadEpheFilethrew "Emscripten module not available" because the raw Emscripten module instance was never stored forgetEmscriptenFS().initializeWasmnow pre-loads the glue script and wraps the factory to capture the module in__swissephRsModulebeforeDynamicLibrary.openconsumes it. - Added
webdependency (used byloader_web.dartfor script injection).
0.2.0 #
- Added
fixstar2WithConfigandfixstar2UtWithConfigfor per-call sidereal and topocentric overrides on fixed-star computations.
0.1.1 #
- Added proper copyright notes to LICENSE and source files.
0.0.1-dev #
- Initial development release.
- Full transliteration of the swisseph-rs Rust API: positions, houses, ayanamsa, eclipses, occultations, rise/set, crossings, fixed stars, heliacal, phenomena, nodes/orbits, horizon, refraction, date/time.
- Native platforms via Cargo build hook.
- Web platform via prebuilt wasm artifact.
- Cross-isolate engine sharing via
Ephemeris.share().