JavaScript and WebAssembly bindings for tempoch, the Siderust astronomical time library.
This repository is the publishable JS workspace. It contains the npm packages,
the thin Rust transport layers for Node and Web, and the vendored tempoch
workspace that provides the canonical time-scale, epoch, and period logic.
| Package | Target | Status | Notes |
|---|---|---|---|
@siderust/tempoch |
Node.js | 0.1.0 |
Native addon built with napi-rs; uses @siderust/qtty@^0.1.0 for quantity objects in the JS API. |
@siderust/tempoch-web |
Browsers / bundlers | 0.1.0 |
WebAssembly build with wasm-bindgen; requires await init() and uses @siderust/qtty-web@^0.1.0 for quantity objects in the API. |
The Rust crates under tempoch-node/ and tempoch-web/ are transport layers
only. All astronomical time semantics come from the vendored
tempoch workspace.
tempoch-js/
├── tempoch/ Vendored Rust workspace (canonical time logic)
├── tempoch-node/ Node package: @siderust/tempoch
├── tempoch-web/ Browser package: @siderust/tempoch-web
└── scripts/ CI helpers for the Node package
- A Node package exposing
JulianDate,ModifiedJulianDate,Period, UTC conversion helpers, and epoch arithmetic utilities. - A browser/WASM package exposing the same core time model with explicit async
initialization via
init(). - JS APIs that interoperate with the published
qtty-js0.1.0line, using@siderust/qttyand@siderust/qtty-webquantity objects for durations and day-count results. - TypeScript declarations for both packages matching the runtime surface.
- Node examples, tests, and CI for format, lint, build, test, and coverage.
npm install @siderust/tempoch @siderust/qttyconst { JulianDate } = require('@siderust/tempoch');
const { Hours } = require('@siderust/qtty/units');
const jd = JulianDate.j2000();
const later = jd.add(Hours(6));
console.log(later.toDate().toISOString());npm install @siderust/tempoch-web @siderust/qtty-webimport { init, JulianDate } from '@siderust/tempoch-web';
import { Quantity } from '@siderust/qtty-web';
await init();
const jd = JulianDate.j2000();
const later = jd.add(new Quantity(6, 'Hour'));
console.log(later.toDate().toISOString());Clone the repository with submodules so the vendored Rust workspace is present:
git clone --recurse-submodules git@github.com:Siderust/tempoch-js.git
cd tempoch-jsIf you already cloned without submodules:
git submodule update --init --recursivecd tempoch-node
npm ci
npm run build:debug
npm testThe repository also exposes CI helpers:
./scripts/ci.sh alltempoch-web uses wasm-pack:
cd tempoch-web
wasm-pack build --target web --out-dir pkg --release --scope siderusttempoch-node/README.mdfor the Node package API and examples.tempoch/README.mdfor the vendored Rust workspace.tempoch/CHANGELOG.mdfor backend/library changes that feed these bindings.
AGPL-3.0. See LICENSE.