siderust-js 0.1.0
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/.github/workflows/ci.yml +166 -0
- package/.gitmodules +9 -0
- package/CHANGELOG.md +26 -0
- package/LICENSE +661 -0
- package/README.md +138 -0
- package/package.json +12 -0
- package/qtty-js/.github/workflows/ci.yml +151 -0
- package/qtty-js/.gitmodules +3 -0
- package/qtty-js/CHANGELOG.md +31 -0
- package/qtty-js/LICENSE +661 -0
- package/qtty-js/README.md +132 -0
- package/qtty-js/package.json +20 -0
- package/qtty-js/qtty/.github/workflows/ci.yml +155 -0
- package/qtty-js/qtty/CHANGELOG.md +120 -0
- package/qtty-js/qtty/Cargo.lock +1462 -0
- package/qtty-js/qtty/Cargo.toml +12 -0
- package/qtty-js/qtty/LICENSE +661 -0
- package/qtty-js/qtty/README.md +9 -0
- package/qtty-js/qtty/qtty/Cargo.toml +41 -0
- package/qtty-js/qtty/qtty/README.md +8 -0
- package/qtty-js/qtty/qtty/examples/angles.rs +14 -0
- package/qtty-js/qtty/qtty/examples/astronomy.rs +17 -0
- package/qtty-js/qtty/qtty/examples/dimensional_arithmetic.rs +83 -0
- package/qtty-js/qtty/qtty/examples/python_integration.rs +61 -0
- package/qtty-js/qtty/qtty/examples/quickstart.rs +15 -0
- package/qtty-js/qtty/qtty/examples/ratios.rs +12 -0
- package/qtty-js/qtty/qtty/examples/serde_with_unit.rs +234 -0
- package/qtty-js/qtty/qtty/examples/serialization.rs +141 -0
- package/qtty-js/qtty/qtty/examples/serialization_advanced.rs +155 -0
- package/qtty-js/qtty/qtty/src/f32.rs +108 -0
- package/qtty-js/qtty/qtty/src/f64.rs +30 -0
- package/qtty-js/qtty/qtty/src/i128.rs +111 -0
- package/qtty-js/qtty/qtty/src/i16.rs +111 -0
- package/qtty-js/qtty/qtty/src/i32.rs +111 -0
- package/qtty-js/qtty/qtty/src/i64.rs +111 -0
- package/qtty-js/qtty/qtty/src/i8.rs +111 -0
- package/qtty-js/qtty/qtty/src/lib.rs +238 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-no-std/Cargo.lock +83 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-no-std/Cargo.toml +10 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-no-std/src/lib.rs +7 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-no-std-alloc/Cargo.lock +83 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-no-std-alloc/Cargo.toml +10 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-no-std-alloc/src/lib.rs +7 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-std/Cargo.lock +83 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-std/Cargo.toml +10 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-std/src/lib.rs +5 -0
- package/qtty-js/qtty/qtty/tests/integration_tests.rs +529 -0
- package/qtty-js/qtty/qtty/tests/qtty_vec_feature_matrix.rs +58 -0
- package/qtty-js/qtty/qtty-core/Cargo.toml +41 -0
- package/qtty-js/qtty/qtty-core/README.md +8 -0
- package/qtty-js/qtty/qtty-core/examples/diesel_integration.rs +145 -0
- package/qtty-js/qtty/qtty-core/examples/quantity_db_serde.rs +215 -0
- package/qtty-js/qtty/qtty-core/src/dimension.rs +249 -0
- package/qtty-js/qtty/qtty-core/src/feature_diesel.rs +318 -0
- package/qtty-js/qtty/qtty-core/src/feature_pyo3.rs +27 -0
- package/qtty-js/qtty/qtty-core/src/feature_serde.rs +203 -0
- package/qtty-js/qtty/qtty-core/src/feature_tiberius.rs +28 -0
- package/qtty-js/qtty/qtty-core/src/lib.rs +744 -0
- package/qtty-js/qtty/qtty-core/src/macros.rs +93 -0
- package/qtty-js/qtty/qtty-core/src/quantity.rs +810 -0
- package/qtty-js/qtty/qtty-core/src/scalar.rs +1742 -0
- package/qtty-js/qtty/qtty-core/src/unit.rs +332 -0
- package/qtty-js/qtty/qtty-core/src/units/angular.rs +1228 -0
- package/qtty-js/qtty/qtty-core/src/units/area.rs +243 -0
- package/qtty-js/qtty/qtty-core/src/units/frequency.rs +179 -0
- package/qtty-js/qtty/qtty-core/src/units/length.rs +1270 -0
- package/qtty-js/qtty/qtty-core/src/units/mass.rs +488 -0
- package/qtty-js/qtty/qtty-core/src/units/mod.rs +26 -0
- package/qtty-js/qtty/qtty-core/src/units/power.rs +324 -0
- package/qtty-js/qtty/qtty-core/src/units/time.rs +667 -0
- package/qtty-js/qtty/qtty-core/src/units/unitless.rs +212 -0
- package/qtty-js/qtty/qtty-core/src/units/velocity.rs +210 -0
- package/qtty-js/qtty/qtty-core/src/units/volume.rs +269 -0
- package/qtty-js/qtty/qtty-core/tests/core.rs +628 -0
- package/qtty-js/qtty/qtty-core/tests/diesel.rs +461 -0
- package/qtty-js/qtty/qtty-core/tests/integers.rs +632 -0
- package/qtty-js/qtty/qtty-core/tests/no_cross_unit_ops.rs +35 -0
- package/qtty-js/qtty/qtty-core/tests/pyo3.rs +334 -0
- package/qtty-js/qtty/qtty-core/tests/quantity_f32.rs +276 -0
- package/qtty-js/qtty/qtty-core/tests/scalar_decimal.rs +258 -0
- package/qtty-js/qtty/qtty-core/tests/scalar_f32.rs +286 -0
- package/qtty-js/qtty/qtty-core/tests/scalar_f64_real.rs +287 -0
- package/qtty-js/qtty/qtty-core/tests/scalar_rational.rs +260 -0
- package/qtty-js/qtty/qtty-core/tests/serde.rs +256 -0
- package/qtty-js/qtty/qtty-core/tests/tiberius.rs +208 -0
- package/qtty-js/qtty/qtty-derive/Cargo.toml +23 -0
- package/qtty-js/qtty/qtty-derive/README.md +8 -0
- package/qtty-js/qtty/qtty-derive/src/lib.rs +340 -0
- package/qtty-js/qtty/qtty-ffi/ARCHITECTURE.md +3 -0
- package/qtty-js/qtty/qtty-ffi/Cargo.toml +31 -0
- package/qtty-js/qtty/qtty-ffi/README.md +9 -0
- package/qtty-js/qtty/qtty-ffi/build.rs +326 -0
- package/qtty-js/qtty/qtty-ffi/cbindgen.toml +105 -0
- package/qtty-js/qtty/qtty-ffi/include/qtty_ffi.h +1126 -0
- package/qtty-js/qtty/qtty-ffi/src/ffi.rs +1251 -0
- package/qtty-js/qtty/qtty-ffi/src/ffi_serde.rs +294 -0
- package/qtty-js/qtty/qtty-ffi/src/helpers.rs +310 -0
- package/qtty-js/qtty/qtty-ffi/src/lib.rs +229 -0
- package/qtty-js/qtty/qtty-ffi/src/macros.rs +121 -0
- package/qtty-js/qtty/qtty-ffi/src/registry.rs +274 -0
- package/qtty-js/qtty/qtty-ffi/src/types.rs +620 -0
- package/qtty-js/qtty/qtty-ffi/tests/integration_tests.rs +842 -0
- package/qtty-js/qtty/qtty-ffi/units.csv +156 -0
- package/qtty-js/qtty/qtty-ffi/units.csv.md +3 -0
- package/qtty-js/qtty-node/.prettierignore +6 -0
- package/qtty-js/qtty-node/.prettierrc.json +6 -0
- package/qtty-js/qtty-node/README.md +250 -0
- package/qtty-js/qtty-node/c8.config.json +11 -0
- package/qtty-js/qtty-node/eslint.config.js +31 -0
- package/qtty-js/qtty-node/examples/arithmetic.mjs +64 -0
- package/qtty-js/qtty-node/examples/astronomy.mjs +90 -0
- package/qtty-js/qtty-node/examples/quickstart.mjs +36 -0
- package/qtty-js/qtty-node/examples/serialization.mjs +125 -0
- package/qtty-js/qtty-node/examples/unit_factories.mjs +74 -0
- package/qtty-js/qtty-node/index.d.ts +219 -0
- package/qtty-js/qtty-node/index.js +323 -0
- package/qtty-js/qtty-node/lib/DerivedQuantity.js +122 -0
- package/qtty-js/qtty-node/lib/Quantity.js +151 -0
- package/qtty-js/qtty-node/lib/backend.js +25 -0
- package/qtty-js/qtty-node/native.cjs +306 -0
- package/qtty-js/qtty-node/package-lock.json +3223 -0
- package/qtty-js/qtty-node/package.json +70 -0
- package/qtty-js/qtty-node/units.d.ts +299 -0
- package/qtty-js/qtty-node/units.js +210 -0
- package/qtty-js/qtty-web/Cargo.lock +767 -0
- package/qtty-js/qtty-web/Cargo.toml +21 -0
- package/qtty-js/qtty-web/index.d.ts +140 -0
- package/qtty-js/qtty-web/index.js +20 -0
- package/qtty-js/qtty-web/lib/DerivedQuantity.js +58 -0
- package/qtty-js/qtty-web/lib/Quantity.js +75 -0
- package/qtty-js/qtty-web/lib/backend.js +80 -0
- package/qtty-js/qtty-web/package.json +45 -0
- package/qtty-js/qtty-web/src/lib.rs +111 -0
- package/qtty-js/scripts/ci.sh +73 -0
- package/scripts/ci.sh +123 -0
- package/siderust-core/Cargo.lock +787 -0
- package/siderust-core/Cargo.toml +18 -0
- package/siderust-core/DEDUPLICATION.md +124 -0
- package/siderust-core/src/body.rs +120 -0
- package/siderust-core/src/events.rs +184 -0
- package/siderust-core/src/lib.rs +20 -0
- package/siderust-core/src/observer.rs +55 -0
- package/siderust-core/src/position.rs +213 -0
- package/siderust-node/.prettierignore +7 -0
- package/siderust-node/.prettierrc.json +6 -0
- package/siderust-node/Cargo.lock +906 -0
- package/siderust-node/Cargo.toml +29 -0
- package/siderust-node/README.md +109 -0
- package/siderust-node/__test__/index.test.mjs +248 -0
- package/siderust-node/build.rs +5 -0
- package/siderust-node/c8.config.json +3 -0
- package/siderust-node/eslint.config.js +31 -0
- package/siderust-node/examples/01_basic_coordinates.mjs +24 -0
- package/siderust-node/examples/02_coordinate_transformations.mjs +25 -0
- package/siderust-node/examples/03_all_frames_conversions.mjs +26 -0
- package/siderust-node/examples/04_all_center_conversions.mjs +24 -0
- package/siderust-node/examples/05_target_tracking.mjs +22 -0
- package/siderust-node/examples/06_night_events.mjs +18 -0
- package/siderust-node/examples/07_moon_properties.mjs +21 -0
- package/siderust-node/examples/08_solar_system.mjs +19 -0
- package/siderust-node/examples/09_star_observability.mjs +22 -0
- package/siderust-node/examples/10_time_periods.mjs +9 -0
- package/siderust-node/examples/11_serialization.mjs +31 -0
- package/siderust-node/examples/12_runtime_ephemeris.mjs +27 -0
- package/siderust-node/examples/13_coordinate_operations.mjs +20 -0
- package/siderust-node/index.d.ts +623 -0
- package/siderust-node/index.js +79 -0
- package/siderust-node/lib/Observer.js +112 -0
- package/siderust-node/lib/Star.js +118 -0
- package/siderust-node/lib/backend.js +63 -0
- package/siderust-node/lib/wrappers.js +566 -0
- package/siderust-node/main.js +20 -0
- package/siderust-node/native.cjs +360 -0
- package/siderust-node/package-lock.json +3261 -0
- package/siderust-node/package.json +71 -0
- package/siderust-node/src/body.rs +74 -0
- package/siderust-node/src/coordinates.rs +372 -0
- package/siderust-node/src/ephemeris.rs +462 -0
- package/siderust-node/src/events.rs +577 -0
- package/siderust-node/src/lib.rs +43 -0
- package/siderust-node/src/observer.rs +132 -0
- package/siderust-node/src/phase.rs +218 -0
- package/siderust-node/src/position.rs +292 -0
- package/siderust-node/src/star.rs +200 -0
- package/siderust-web/Cargo.lock +855 -0
- package/siderust-web/Cargo.toml +34 -0
- package/siderust-web/README.md +100 -0
- package/siderust-web/__test__/index.test.mjs +118 -0
- package/siderust-web/examples/github-pages/README.md +31 -0
- package/siderust-web/examples/github-pages/index.html +135 -0
- package/siderust-web/index.d.ts +311 -0
- package/siderust-web/index.js +66 -0
- package/siderust-web/lib/Observer.js +103 -0
- package/siderust-web/lib/Star.js +116 -0
- package/siderust-web/lib/backend.js +400 -0
- package/siderust-web/lib/wrappers.js +512 -0
- package/siderust-web/package.json +55 -0
- package/siderust-web/src/body.rs +69 -0
- package/siderust-web/src/coordinates.rs +302 -0
- package/siderust-web/src/ephemeris.rs +456 -0
- package/siderust-web/src/events.rs +520 -0
- package/siderust-web/src/lib.rs +51 -0
- package/siderust-web/src/observer.rs +117 -0
- package/siderust-web/src/phase.rs +190 -0
- package/siderust-web/src/position.rs +291 -0
- package/siderust-web/src/star.rs +178 -0
- package/tempoch-js/.github/workflows/ci.yml +142 -0
- package/tempoch-js/.gitmodules +3 -0
- package/tempoch-js/CHANGELOG.md +25 -0
- package/tempoch-js/LICENSE +661 -0
- package/tempoch-js/README.md +126 -0
- package/tempoch-js/package.json +20 -0
- package/tempoch-js/scripts/ci.sh +73 -0
- package/tempoch-js/tempoch/.github/workflows/ci.yml +113 -0
- package/tempoch-js/tempoch/CHANGELOG.md +82 -0
- package/tempoch-js/tempoch/Cargo.lock +947 -0
- package/tempoch-js/tempoch/Cargo.toml +3 -0
- package/tempoch-js/tempoch/LICENSE +661 -0
- package/tempoch-js/tempoch/README.md +76 -0
- package/tempoch-js/tempoch/tempoch/Cargo.toml +27 -0
- package/tempoch-js/tempoch/tempoch/examples/periods.rs +45 -0
- package/tempoch-js/tempoch/tempoch/examples/quickstart.rs +13 -0
- package/tempoch-js/tempoch/tempoch/src/lib.rs +49 -0
- package/tempoch-js/tempoch/tempoch/tests/integration.rs +57 -0
- package/tempoch-js/tempoch/tempoch-core/Cargo.toml +24 -0
- package/tempoch-js/tempoch/tempoch-core/src/delta_t.rs +345 -0
- package/tempoch-js/tempoch/tempoch-core/src/instant.rs +811 -0
- package/tempoch-js/tempoch/tempoch-core/src/julian_date_ext.rs +142 -0
- package/tempoch-js/tempoch/tempoch-core/src/lib.rs +81 -0
- package/tempoch-js/tempoch/tempoch-core/src/period.rs +1168 -0
- package/tempoch-js/tempoch/tempoch-core/src/scales.rs +779 -0
- package/tempoch-js/tempoch/tempoch-ffi/Cargo.lock +889 -0
- package/tempoch-js/tempoch/tempoch-ffi/Cargo.toml +26 -0
- package/tempoch-js/tempoch/tempoch-ffi/build.rs +24 -0
- package/tempoch-js/tempoch/tempoch-ffi/cbindgen.toml +30 -0
- package/tempoch-js/tempoch/tempoch-ffi/src/error.rs +19 -0
- package/tempoch-js/tempoch/tempoch-ffi/src/lib.rs +82 -0
- package/tempoch-js/tempoch/tempoch-ffi/src/period.rs +101 -0
- package/tempoch-js/tempoch/tempoch-ffi/src/time.rs +711 -0
- package/tempoch-js/tempoch/tempoch-ffi/tests/ffi.rs +265 -0
- package/tempoch-js/tempoch-node/.prettierignore +6 -0
- package/tempoch-js/tempoch-node/.prettierrc.json +6 -0
- package/tempoch-js/tempoch-node/Cargo.lock +496 -0
- package/tempoch-js/tempoch-node/Cargo.toml +29 -0
- package/tempoch-js/tempoch-node/README.md +265 -0
- package/tempoch-js/tempoch-node/__test__/index.test.mjs +598 -0
- package/tempoch-js/tempoch-node/build.rs +5 -0
- package/tempoch-js/tempoch-node/c8.config.json +3 -0
- package/tempoch-js/tempoch-node/eslint.config.js +31 -0
- package/tempoch-js/tempoch-node/examples/periods.mjs +79 -0
- package/tempoch-js/tempoch-node/examples/quickstart.mjs +71 -0
- package/tempoch-js/tempoch-node/examples/timescales.mjs +92 -0
- package/tempoch-js/tempoch-node/index.d.ts +280 -0
- package/tempoch-js/tempoch-node/index.js +32 -0
- package/tempoch-js/tempoch-node/lib/JulianDate.js +176 -0
- package/tempoch-js/tempoch-node/lib/ModifiedJulianDate.js +156 -0
- package/tempoch-js/tempoch-node/lib/Period.js +133 -0
- package/tempoch-js/tempoch-node/lib/backend.js +38 -0
- package/tempoch-js/tempoch-node/lib/qttyCompat.js +92 -0
- package/tempoch-js/tempoch-node/native.cjs +317 -0
- package/tempoch-js/tempoch-node/package-lock.json +3223 -0
- package/tempoch-js/tempoch-node/package.json +56 -0
- package/tempoch-js/tempoch-node/src/lib.rs +573 -0
- package/tempoch-js/tempoch-web/Cargo.toml +23 -0
- package/tempoch-js/tempoch-web/index.d.ts +95 -0
- package/tempoch-js/tempoch-web/index.js +27 -0
- package/tempoch-js/tempoch-web/lib/JulianDate.js +170 -0
- package/tempoch-js/tempoch-web/lib/ModifiedJulianDate.js +145 -0
- package/tempoch-js/tempoch-web/lib/Period.js +121 -0
- package/tempoch-js/tempoch-web/lib/backend.js +118 -0
- package/tempoch-js/tempoch-web/package.json +46 -0
- package/tempoch-js/tempoch-web/src/lib.rs +184 -0
package/README.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# siderust-js workspace
|
|
2
|
+
|
|
3
|
+
JavaScript and WebAssembly bindings for Siderust astronomy.
|
|
4
|
+
|
|
5
|
+
This repository is the publishable JS workspace. It contains the npm packages,
|
|
6
|
+
the shared Rust binding core used by both targets, and the Node/Web transport
|
|
7
|
+
layers that expose the public JS API.
|
|
8
|
+
|
|
9
|
+
The public surface is strongly typed around `qtty-js` and `tempoch-js`:
|
|
10
|
+
quantities must be passed as `@siderust/qtty` or `@siderust/qtty-web`
|
|
11
|
+
`Quantity` objects, and times and windows must be passed as
|
|
12
|
+
`@siderust/tempoch` or `@siderust/tempoch-web` `JulianDate`,
|
|
13
|
+
`ModifiedJulianDate`, and `Period` objects.
|
|
14
|
+
|
|
15
|
+
## Packages
|
|
16
|
+
|
|
17
|
+
| Package | Target | Status | Notes |
|
|
18
|
+
| --- | --- | --- | --- |
|
|
19
|
+
| [`@siderust/siderust`](./siderust-node/README.md) | Node.js | `0.1.0` | Native addon built with `napi-rs`; requires `@siderust/qtty` and `@siderust/tempoch` objects at the public API boundary. |
|
|
20
|
+
| [`@siderust/siderust-web`](./siderust-web/README.md) | 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. |
|
|
21
|
+
|
|
22
|
+
The Node and Web packages are intended to stay aligned. Platform differences
|
|
23
|
+
are transport details, not separate domain models.
|
|
24
|
+
|
|
25
|
+
## Repository layout
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
siderust-js/
|
|
29
|
+
├── siderust-core/ Shared Rust binding logic used by both targets
|
|
30
|
+
├── siderust-node/ Node package: @siderust/siderust
|
|
31
|
+
├── siderust-web/ Browser package: @siderust/siderust-web
|
|
32
|
+
└── scripts/ CI helpers for the Node package
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## What ships in 0.1.0
|
|
36
|
+
|
|
37
|
+
- A Node package exposing observer and star models, coordinate transforms,
|
|
38
|
+
ephemerides, altitude/azimuth event search, time-window intersection, and
|
|
39
|
+
lunar phase helpers.
|
|
40
|
+
- A browser/WASM package exposing the same astronomy surface with explicit
|
|
41
|
+
asynchronous initialization via `init()`.
|
|
42
|
+
- A strict typed JS API that uses `Quantity`, `JulianDate`,
|
|
43
|
+
`ModifiedJulianDate`, and `Period` at the public boundary rather than raw
|
|
44
|
+
numbers or `*Like` aliases.
|
|
45
|
+
- TypeScript declarations for both packages matching the runtime surface.
|
|
46
|
+
- Node and Web tests, examples, and package-level READMEs for the current API.
|
|
47
|
+
|
|
48
|
+
## Install
|
|
49
|
+
|
|
50
|
+
### Node.js
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm install @siderust/siderust @siderust/qtty @siderust/tempoch
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
const { Quantity } = require('@siderust/qtty');
|
|
58
|
+
const { JulianDate } = require('@siderust/tempoch');
|
|
59
|
+
const { Observer, bodyAltitudeAt } = require('@siderust/siderust');
|
|
60
|
+
|
|
61
|
+
const observer = new Observer(
|
|
62
|
+
new Quantity(-17.8925, 'Degree'),
|
|
63
|
+
new Quantity(28.7543, 'Degree'),
|
|
64
|
+
new Quantity(2396, 'Meter'),
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const altitude = bodyAltitudeAt(
|
|
68
|
+
'Sun',
|
|
69
|
+
observer,
|
|
70
|
+
new JulianDate(2451545.0).toModifiedJulianDate(),
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
console.log(altitude.value, altitude.unit);
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Browser / WebAssembly
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npm install @siderust/siderust-web @siderust/qtty-web @siderust/tempoch-web
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
```js
|
|
83
|
+
import { init as initQtty, Quantity } from '@siderust/qtty-web';
|
|
84
|
+
import { init as initTempoch, JulianDate } from '@siderust/tempoch-web';
|
|
85
|
+
import { init, vsop87Heliocentric } from '@siderust/siderust-web';
|
|
86
|
+
|
|
87
|
+
await initQtty();
|
|
88
|
+
await initTempoch();
|
|
89
|
+
await init();
|
|
90
|
+
|
|
91
|
+
const mars = vsop87Heliocentric('Mars', new JulianDate(2451545.0));
|
|
92
|
+
console.log(mars.x.to('Kilometer').value);
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Development
|
|
96
|
+
|
|
97
|
+
Clone the repository:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
git clone git@github.com:Siderust/siderust-js.git
|
|
101
|
+
cd siderust-js
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Node package workflow
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
cd siderust-node
|
|
108
|
+
npm ci
|
|
109
|
+
npm run build:debug
|
|
110
|
+
npm test
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The repository also exposes CI helpers:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
./scripts/ci.sh all
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Web package workflow
|
|
120
|
+
|
|
121
|
+
`siderust-web` uses `wasm-pack`:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
cd siderust-web
|
|
125
|
+
wasm-pack build --target web --out-dir pkg --release --scope siderust
|
|
126
|
+
npm test
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Related documentation
|
|
130
|
+
|
|
131
|
+
- [`siderust-node/README.md`](./siderust-node/README.md) for the Node package
|
|
132
|
+
API and examples.
|
|
133
|
+
- [`siderust-web/README.md`](./siderust-web/README.md) for the Web package API
|
|
134
|
+
and examples.
|
|
135
|
+
|
|
136
|
+
## License
|
|
137
|
+
|
|
138
|
+
AGPL-3.0. See [LICENSE](./LICENSE).
|
package/package.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "siderust-js",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": " Precision astronomy & satellite mechanics in safe, fast Rust. ",
|
|
5
|
+
"license": "AGPL-3.0-or-later",
|
|
6
|
+
"author": "VPRamon",
|
|
7
|
+
"type": "commonjs",
|
|
8
|
+
"main": "index.js",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
name: Qtty JS CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
pull_request:
|
|
7
|
+
types: [opened, synchronize, reopened, ready_for_review]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
checks: write
|
|
12
|
+
pull-requests: write
|
|
13
|
+
|
|
14
|
+
concurrency:
|
|
15
|
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
16
|
+
cancel-in-progress: true
|
|
17
|
+
|
|
18
|
+
env:
|
|
19
|
+
NODE_VERSION: '20'
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
format:
|
|
23
|
+
name: Format
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v4
|
|
27
|
+
with:
|
|
28
|
+
submodules: recursive
|
|
29
|
+
fetch-depth: 0
|
|
30
|
+
- uses: actions/setup-node@v4
|
|
31
|
+
with:
|
|
32
|
+
node-version: ${{ env.NODE_VERSION }}
|
|
33
|
+
cache: npm
|
|
34
|
+
cache-dependency-path: qtty-node/package-lock.json
|
|
35
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
36
|
+
- uses: Swatinem/rust-cache@v2
|
|
37
|
+
with:
|
|
38
|
+
workspaces: |
|
|
39
|
+
qtty-node -> qtty-node/target
|
|
40
|
+
- run: ./scripts/ci.sh install
|
|
41
|
+
- run: ./scripts/ci.sh format
|
|
42
|
+
|
|
43
|
+
lint:
|
|
44
|
+
name: Lint
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
steps:
|
|
47
|
+
- uses: actions/checkout@v4
|
|
48
|
+
with:
|
|
49
|
+
submodules: recursive
|
|
50
|
+
fetch-depth: 0
|
|
51
|
+
- uses: actions/setup-node@v4
|
|
52
|
+
with:
|
|
53
|
+
node-version: ${{ env.NODE_VERSION }}
|
|
54
|
+
cache: npm
|
|
55
|
+
cache-dependency-path: qtty-node/package-lock.json
|
|
56
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
57
|
+
- uses: Swatinem/rust-cache@v2
|
|
58
|
+
with:
|
|
59
|
+
workspaces: |
|
|
60
|
+
qtty-node -> qtty-node/target
|
|
61
|
+
- run: ./scripts/ci.sh install
|
|
62
|
+
- run: ./scripts/ci.sh lint
|
|
63
|
+
|
|
64
|
+
build:
|
|
65
|
+
name: Build
|
|
66
|
+
runs-on: ubuntu-latest
|
|
67
|
+
steps:
|
|
68
|
+
- uses: actions/checkout@v4
|
|
69
|
+
with:
|
|
70
|
+
submodules: recursive
|
|
71
|
+
fetch-depth: 0
|
|
72
|
+
- uses: actions/setup-node@v4
|
|
73
|
+
with:
|
|
74
|
+
node-version: ${{ env.NODE_VERSION }}
|
|
75
|
+
cache: npm
|
|
76
|
+
cache-dependency-path: qtty-node/package-lock.json
|
|
77
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
78
|
+
- uses: Swatinem/rust-cache@v2
|
|
79
|
+
with:
|
|
80
|
+
workspaces: |
|
|
81
|
+
qtty-node -> qtty-node/target
|
|
82
|
+
- run: ./scripts/ci.sh install
|
|
83
|
+
- run: BUILD_MODE=release ./scripts/ci.sh build
|
|
84
|
+
|
|
85
|
+
test:
|
|
86
|
+
name: Test
|
|
87
|
+
runs-on: ubuntu-latest
|
|
88
|
+
steps:
|
|
89
|
+
- uses: actions/checkout@v4
|
|
90
|
+
with:
|
|
91
|
+
submodules: recursive
|
|
92
|
+
fetch-depth: 0
|
|
93
|
+
- uses: actions/setup-node@v4
|
|
94
|
+
with:
|
|
95
|
+
node-version: ${{ env.NODE_VERSION }}
|
|
96
|
+
cache: npm
|
|
97
|
+
cache-dependency-path: qtty-node/package-lock.json
|
|
98
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
99
|
+
- uses: Swatinem/rust-cache@v2
|
|
100
|
+
with:
|
|
101
|
+
workspaces: |
|
|
102
|
+
qtty-node -> qtty-node/target
|
|
103
|
+
- run: ./scripts/ci.sh install
|
|
104
|
+
- run: ./scripts/ci.sh build
|
|
105
|
+
- run: ./scripts/ci.sh test
|
|
106
|
+
|
|
107
|
+
coverage:
|
|
108
|
+
name: Test & Coverage
|
|
109
|
+
if: ${{ github.event_name == 'push' || github.event.pull_request.draft == false }}
|
|
110
|
+
runs-on: ubuntu-latest
|
|
111
|
+
steps:
|
|
112
|
+
- uses: actions/checkout@v4
|
|
113
|
+
with:
|
|
114
|
+
submodules: recursive
|
|
115
|
+
fetch-depth: 0
|
|
116
|
+
- uses: actions/setup-node@v4
|
|
117
|
+
with:
|
|
118
|
+
node-version: ${{ env.NODE_VERSION }}
|
|
119
|
+
cache: npm
|
|
120
|
+
cache-dependency-path: qtty-node/package-lock.json
|
|
121
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
122
|
+
- uses: Swatinem/rust-cache@v2
|
|
123
|
+
with:
|
|
124
|
+
workspaces: |
|
|
125
|
+
qtty-node -> qtty-node/target
|
|
126
|
+
- run: ./scripts/ci.sh install
|
|
127
|
+
- run: ./scripts/ci.sh build
|
|
128
|
+
- run: ./scripts/ci.sh coverage
|
|
129
|
+
- name: Build coverage summary
|
|
130
|
+
uses: irongut/CodeCoverageSummary@v1.3.0
|
|
131
|
+
with:
|
|
132
|
+
filename: qtty-node/coverage/cobertura-coverage.xml
|
|
133
|
+
badge: true
|
|
134
|
+
format: markdown
|
|
135
|
+
output: file
|
|
136
|
+
- name: Publish to job summary
|
|
137
|
+
run: cat code-coverage-results.md >> "$GITHUB_STEP_SUMMARY"
|
|
138
|
+
- name: Post coverage as PR comment
|
|
139
|
+
if: github.event_name == 'pull_request'
|
|
140
|
+
uses: mshick/add-pr-comment@v2
|
|
141
|
+
with:
|
|
142
|
+
message-id: qtty-js-coverage
|
|
143
|
+
message-path: code-coverage-results.md
|
|
144
|
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
145
|
+
- name: Upload coverage report
|
|
146
|
+
if: always()
|
|
147
|
+
uses: actions/upload-artifact@v4
|
|
148
|
+
with:
|
|
149
|
+
name: qtty-js-coverage
|
|
150
|
+
path: qtty-node/coverage
|
|
151
|
+
retention-days: 7
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the JavaScript workspace are documented here.
|
|
4
|
+
|
|
5
|
+
The vendored Rust workspace keeps its own history in
|
|
6
|
+
[`qtty/CHANGELOG.md`](./qtty/CHANGELOG.md).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-03-08
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Initial `qtty-js` release repository with the vendored `qtty` submodule as
|
|
12
|
+
the canonical Rust backend.
|
|
13
|
+
- `@siderust/qtty` for Node.js, exposing `Quantity`, `DerivedQuantity`,
|
|
14
|
+
`convert`, compatibility helpers, unit metadata helpers, `listUnits()`, and a
|
|
15
|
+
typed `Unit` constant map.
|
|
16
|
+
- `@siderust/qtty/units` factory exports for ergonomic quantity construction in
|
|
17
|
+
Node.js, including named factories, dynamic `unit(name)` lookup, and the
|
|
18
|
+
`units` registry.
|
|
19
|
+
- `@siderust/qtty-web` for browsers and bundlers, exposing the same core
|
|
20
|
+
quantity model over WebAssembly with explicit async initialization via
|
|
21
|
+
`init()`.
|
|
22
|
+
- TypeScript declaration files for the Node and Web packages.
|
|
23
|
+
- Node examples covering quickstart usage, arithmetic, serialization, unit
|
|
24
|
+
factories, and astronomy-oriented conversions.
|
|
25
|
+
- Node automated tests and GitHub Actions CI for format, lint, build, test, and
|
|
26
|
+
coverage.
|
|
27
|
+
- Repository versioning is now centered on the JavaScript workspace release
|
|
28
|
+
line, starting at `1.0.0`, while the internal native crate in `qtty-node`
|
|
29
|
+
continues to track the Rust backend line separately.
|
|
30
|
+
- Conversion rules, unit metadata, and FFI semantics are inherited from the
|
|
31
|
+
vendored `qtty` workspace and `qtty-ffi`.
|