JavaScript and WebAssembly bindings for Siderust astronomy.
This repository is the publishable JS workspace. It contains the npm packages, the shared Rust binding core used by both targets, and the Node/Web transport layers that expose the public JS API.
The public surface is strongly typed around qtty-js and tempoch-js:
quantities must be passed as @siderust/qtty or @siderust/qtty-web
Quantity objects, and times and windows must be passed as
@siderust/tempoch or @siderust/tempoch-web JulianDate,
ModifiedJulianDate, and Period objects.
| Package | Target | Status | Notes |
|---|---|---|---|
@siderust/siderust |
Node.js | 0.1.0 |
Native addon built with napi-rs; requires @siderust/qtty and @siderust/tempoch objects at the public API boundary. |
@siderust/siderust-web |
Browsers / bundlers | 0.1.0 |
WebAssembly build with wasm-bindgen; requires await init() plus @siderust/qtty-web and @siderust/tempoch-web objects in the API. |
The Node and Web packages are intended to stay aligned. Platform differences are transport details, not separate domain models.
siderust-js/
├── siderust-core/ Shared Rust binding logic used by both targets
├── siderust-node/ Node package: @siderust/siderust
├── siderust-web/ Browser package: @siderust/siderust-web
└── scripts/ CI helpers for the Node package
- A Node package exposing observer and star models, coordinate transforms, ephemerides, altitude/azimuth event search, time-window intersection, and lunar phase helpers.
- A browser/WASM package exposing the same astronomy surface with explicit
asynchronous initialization via
init(). - A strict typed JS API that uses
Quantity,JulianDate,ModifiedJulianDate, andPeriodat the public boundary rather than raw numbers or*Likealiases. - TypeScript declarations for both packages matching the runtime surface.
- Node and Web tests, examples, and package-level READMEs for the current API.
npm install @siderust/siderust @siderust/qtty @siderust/tempochconst { Quantity } = require('@siderust/qtty');
const { JulianDate } = require('@siderust/tempoch');
const { Observer, bodyAltitudeAt } = require('@siderust/siderust');
const observer = new Observer(
new Quantity(-17.8925, 'Degree'),
new Quantity(28.7543, 'Degree'),
new Quantity(2396, 'Meter'),
);
const altitude = bodyAltitudeAt(
'Sun',
observer,
new JulianDate(2451545.0).toModifiedJulianDate(),
);
console.log(altitude.value, altitude.unit);npm install @siderust/siderust-web @siderust/qtty-web @siderust/tempoch-webimport { init as initQtty, Quantity } from '@siderust/qtty-web';
import { init as initTempoch, JulianDate } from '@siderust/tempoch-web';
import { init, vsop87Heliocentric } from '@siderust/siderust-web';
await initQtty();
await initTempoch();
await init();
const mars = vsop87Heliocentric('Mars', new JulianDate(2451545.0));
console.log(mars.x.to('Kilometer').value);Clone the repository:
git clone git@github.com:Siderust/siderust-js.git
cd siderust-jscd siderust-node
npm ci
npm run build:debug
npm testThe repository also exposes CI helpers:
./scripts/ci.sh allsiderust-web uses wasm-pack:
cd siderust-web
wasm-pack build --target web --out-dir pkg --release --scope siderust
npm testsiderust-node/README.mdfor the Node package API and examples.siderust-web/README.mdfor the Web package API and examples.
AGPL-3.0. See LICENSE.