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
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/* prettier-ignore */
|
|
4
|
+
|
|
5
|
+
/* auto-generated by NAPI-RS */
|
|
6
|
+
|
|
7
|
+
const { existsSync, readFileSync } = require('fs')
|
|
8
|
+
const { join } = require('path');
|
|
9
|
+
|
|
10
|
+
const { platform, arch } = process;
|
|
11
|
+
|
|
12
|
+
let nativeBinding = null;
|
|
13
|
+
let localFileExisted = false;
|
|
14
|
+
let loadError = null;
|
|
15
|
+
|
|
16
|
+
function isMusl() {
|
|
17
|
+
// For Node 10
|
|
18
|
+
if (!process.report || typeof process.report.getReport !== 'function') {
|
|
19
|
+
try {
|
|
20
|
+
const lddPath = require('child_process').execSync('which ldd').toString().trim();
|
|
21
|
+
return readFileSync(lddPath, 'utf8').includes('musl');
|
|
22
|
+
} catch (e) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
const { glibcVersionRuntime } = process.report.getReport().header;
|
|
27
|
+
return !glibcVersionRuntime;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
switch (platform) {
|
|
32
|
+
case 'android':
|
|
33
|
+
switch (arch) {
|
|
34
|
+
case 'arm64':
|
|
35
|
+
localFileExisted = existsSync(join(__dirname, 'tempoch.android-arm64.node'));
|
|
36
|
+
try {
|
|
37
|
+
if (localFileExisted) {
|
|
38
|
+
nativeBinding = require('./tempoch.android-arm64.node');
|
|
39
|
+
} else {
|
|
40
|
+
nativeBinding = require('@siderust/tempoch-android-arm64');
|
|
41
|
+
}
|
|
42
|
+
} catch (e) {
|
|
43
|
+
loadError = e;
|
|
44
|
+
}
|
|
45
|
+
break;
|
|
46
|
+
case 'arm':
|
|
47
|
+
localFileExisted = existsSync(join(__dirname, 'tempoch.android-arm-eabi.node'));
|
|
48
|
+
try {
|
|
49
|
+
if (localFileExisted) {
|
|
50
|
+
nativeBinding = require('./tempoch.android-arm-eabi.node');
|
|
51
|
+
} else {
|
|
52
|
+
nativeBinding = require('@siderust/tempoch-android-arm-eabi');
|
|
53
|
+
}
|
|
54
|
+
} catch (e) {
|
|
55
|
+
loadError = e;
|
|
56
|
+
}
|
|
57
|
+
break;
|
|
58
|
+
default:
|
|
59
|
+
throw new Error(`Unsupported architecture on Android ${arch}`);
|
|
60
|
+
}
|
|
61
|
+
break;
|
|
62
|
+
case 'win32':
|
|
63
|
+
switch (arch) {
|
|
64
|
+
case 'x64':
|
|
65
|
+
localFileExisted = existsSync(join(__dirname, 'tempoch.win32-x64-msvc.node'));
|
|
66
|
+
try {
|
|
67
|
+
if (localFileExisted) {
|
|
68
|
+
nativeBinding = require('./tempoch.win32-x64-msvc.node');
|
|
69
|
+
} else {
|
|
70
|
+
nativeBinding = require('@siderust/tempoch-win32-x64-msvc');
|
|
71
|
+
}
|
|
72
|
+
} catch (e) {
|
|
73
|
+
loadError = e;
|
|
74
|
+
}
|
|
75
|
+
break;
|
|
76
|
+
case 'ia32':
|
|
77
|
+
localFileExisted = existsSync(join(__dirname, 'tempoch.win32-ia32-msvc.node'));
|
|
78
|
+
try {
|
|
79
|
+
if (localFileExisted) {
|
|
80
|
+
nativeBinding = require('./tempoch.win32-ia32-msvc.node');
|
|
81
|
+
} else {
|
|
82
|
+
nativeBinding = require('@siderust/tempoch-win32-ia32-msvc');
|
|
83
|
+
}
|
|
84
|
+
} catch (e) {
|
|
85
|
+
loadError = e;
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
case 'arm64':
|
|
89
|
+
localFileExisted = existsSync(join(__dirname, 'tempoch.win32-arm64-msvc.node'));
|
|
90
|
+
try {
|
|
91
|
+
if (localFileExisted) {
|
|
92
|
+
nativeBinding = require('./tempoch.win32-arm64-msvc.node');
|
|
93
|
+
} else {
|
|
94
|
+
nativeBinding = require('@siderust/tempoch-win32-arm64-msvc');
|
|
95
|
+
}
|
|
96
|
+
} catch (e) {
|
|
97
|
+
loadError = e;
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
100
|
+
default:
|
|
101
|
+
throw new Error(`Unsupported architecture on Windows: ${arch}`);
|
|
102
|
+
}
|
|
103
|
+
break;
|
|
104
|
+
case 'darwin':
|
|
105
|
+
localFileExisted = existsSync(join(__dirname, 'tempoch.darwin-universal.node'));
|
|
106
|
+
try {
|
|
107
|
+
if (localFileExisted) {
|
|
108
|
+
nativeBinding = require('./tempoch.darwin-universal.node');
|
|
109
|
+
} else {
|
|
110
|
+
nativeBinding = require('@siderust/tempoch-darwin-universal');
|
|
111
|
+
}
|
|
112
|
+
break;
|
|
113
|
+
} catch {}
|
|
114
|
+
switch (arch) {
|
|
115
|
+
case 'x64':
|
|
116
|
+
localFileExisted = existsSync(join(__dirname, 'tempoch.darwin-x64.node'));
|
|
117
|
+
try {
|
|
118
|
+
if (localFileExisted) {
|
|
119
|
+
nativeBinding = require('./tempoch.darwin-x64.node');
|
|
120
|
+
} else {
|
|
121
|
+
nativeBinding = require('@siderust/tempoch-darwin-x64');
|
|
122
|
+
}
|
|
123
|
+
} catch (e) {
|
|
124
|
+
loadError = e;
|
|
125
|
+
}
|
|
126
|
+
break;
|
|
127
|
+
case 'arm64':
|
|
128
|
+
localFileExisted = existsSync(join(__dirname, 'tempoch.darwin-arm64.node'));
|
|
129
|
+
try {
|
|
130
|
+
if (localFileExisted) {
|
|
131
|
+
nativeBinding = require('./tempoch.darwin-arm64.node');
|
|
132
|
+
} else {
|
|
133
|
+
nativeBinding = require('@siderust/tempoch-darwin-arm64');
|
|
134
|
+
}
|
|
135
|
+
} catch (e) {
|
|
136
|
+
loadError = e;
|
|
137
|
+
}
|
|
138
|
+
break;
|
|
139
|
+
default:
|
|
140
|
+
throw new Error(`Unsupported architecture on macOS: ${arch}`);
|
|
141
|
+
}
|
|
142
|
+
break;
|
|
143
|
+
case 'freebsd':
|
|
144
|
+
if (arch !== 'x64') {
|
|
145
|
+
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`);
|
|
146
|
+
}
|
|
147
|
+
localFileExisted = existsSync(join(__dirname, 'tempoch.freebsd-x64.node'));
|
|
148
|
+
try {
|
|
149
|
+
if (localFileExisted) {
|
|
150
|
+
nativeBinding = require('./tempoch.freebsd-x64.node');
|
|
151
|
+
} else {
|
|
152
|
+
nativeBinding = require('@siderust/tempoch-freebsd-x64');
|
|
153
|
+
}
|
|
154
|
+
} catch (e) {
|
|
155
|
+
loadError = e;
|
|
156
|
+
}
|
|
157
|
+
break;
|
|
158
|
+
case 'linux':
|
|
159
|
+
switch (arch) {
|
|
160
|
+
case 'x64':
|
|
161
|
+
if (isMusl()) {
|
|
162
|
+
localFileExisted = existsSync(join(__dirname, 'tempoch.linux-x64-musl.node'));
|
|
163
|
+
try {
|
|
164
|
+
if (localFileExisted) {
|
|
165
|
+
nativeBinding = require('./tempoch.linux-x64-musl.node');
|
|
166
|
+
} else {
|
|
167
|
+
nativeBinding = require('@siderust/tempoch-linux-x64-musl');
|
|
168
|
+
}
|
|
169
|
+
} catch (e) {
|
|
170
|
+
loadError = e;
|
|
171
|
+
}
|
|
172
|
+
} else {
|
|
173
|
+
localFileExisted = existsSync(join(__dirname, 'tempoch.linux-x64-gnu.node'));
|
|
174
|
+
try {
|
|
175
|
+
if (localFileExisted) {
|
|
176
|
+
nativeBinding = require('./tempoch.linux-x64-gnu.node');
|
|
177
|
+
} else {
|
|
178
|
+
nativeBinding = require('@siderust/tempoch-linux-x64-gnu');
|
|
179
|
+
}
|
|
180
|
+
} catch (e) {
|
|
181
|
+
loadError = e;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
break;
|
|
185
|
+
case 'arm64':
|
|
186
|
+
if (isMusl()) {
|
|
187
|
+
localFileExisted = existsSync(join(__dirname, 'tempoch.linux-arm64-musl.node'));
|
|
188
|
+
try {
|
|
189
|
+
if (localFileExisted) {
|
|
190
|
+
nativeBinding = require('./tempoch.linux-arm64-musl.node');
|
|
191
|
+
} else {
|
|
192
|
+
nativeBinding = require('@siderust/tempoch-linux-arm64-musl');
|
|
193
|
+
}
|
|
194
|
+
} catch (e) {
|
|
195
|
+
loadError = e;
|
|
196
|
+
}
|
|
197
|
+
} else {
|
|
198
|
+
localFileExisted = existsSync(join(__dirname, 'tempoch.linux-arm64-gnu.node'));
|
|
199
|
+
try {
|
|
200
|
+
if (localFileExisted) {
|
|
201
|
+
nativeBinding = require('./tempoch.linux-arm64-gnu.node');
|
|
202
|
+
} else {
|
|
203
|
+
nativeBinding = require('@siderust/tempoch-linux-arm64-gnu');
|
|
204
|
+
}
|
|
205
|
+
} catch (e) {
|
|
206
|
+
loadError = e;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
break;
|
|
210
|
+
case 'arm':
|
|
211
|
+
if (isMusl()) {
|
|
212
|
+
localFileExisted = existsSync(join(__dirname, 'tempoch.linux-arm-musleabihf.node'));
|
|
213
|
+
try {
|
|
214
|
+
if (localFileExisted) {
|
|
215
|
+
nativeBinding = require('./tempoch.linux-arm-musleabihf.node');
|
|
216
|
+
} else {
|
|
217
|
+
nativeBinding = require('@siderust/tempoch-linux-arm-musleabihf');
|
|
218
|
+
}
|
|
219
|
+
} catch (e) {
|
|
220
|
+
loadError = e;
|
|
221
|
+
}
|
|
222
|
+
} else {
|
|
223
|
+
localFileExisted = existsSync(join(__dirname, 'tempoch.linux-arm-gnueabihf.node'));
|
|
224
|
+
try {
|
|
225
|
+
if (localFileExisted) {
|
|
226
|
+
nativeBinding = require('./tempoch.linux-arm-gnueabihf.node');
|
|
227
|
+
} else {
|
|
228
|
+
nativeBinding = require('@siderust/tempoch-linux-arm-gnueabihf');
|
|
229
|
+
}
|
|
230
|
+
} catch (e) {
|
|
231
|
+
loadError = e;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
break;
|
|
235
|
+
case 'riscv64':
|
|
236
|
+
if (isMusl()) {
|
|
237
|
+
localFileExisted = existsSync(join(__dirname, 'tempoch.linux-riscv64-musl.node'));
|
|
238
|
+
try {
|
|
239
|
+
if (localFileExisted) {
|
|
240
|
+
nativeBinding = require('./tempoch.linux-riscv64-musl.node');
|
|
241
|
+
} else {
|
|
242
|
+
nativeBinding = require('@siderust/tempoch-linux-riscv64-musl');
|
|
243
|
+
}
|
|
244
|
+
} catch (e) {
|
|
245
|
+
loadError = e;
|
|
246
|
+
}
|
|
247
|
+
} else {
|
|
248
|
+
localFileExisted = existsSync(join(__dirname, 'tempoch.linux-riscv64-gnu.node'));
|
|
249
|
+
try {
|
|
250
|
+
if (localFileExisted) {
|
|
251
|
+
nativeBinding = require('./tempoch.linux-riscv64-gnu.node');
|
|
252
|
+
} else {
|
|
253
|
+
nativeBinding = require('@siderust/tempoch-linux-riscv64-gnu');
|
|
254
|
+
}
|
|
255
|
+
} catch (e) {
|
|
256
|
+
loadError = e;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
break;
|
|
260
|
+
case 's390x':
|
|
261
|
+
localFileExisted = existsSync(join(__dirname, 'tempoch.linux-s390x-gnu.node'));
|
|
262
|
+
try {
|
|
263
|
+
if (localFileExisted) {
|
|
264
|
+
nativeBinding = require('./tempoch.linux-s390x-gnu.node');
|
|
265
|
+
} else {
|
|
266
|
+
nativeBinding = require('@siderust/tempoch-linux-s390x-gnu');
|
|
267
|
+
}
|
|
268
|
+
} catch (e) {
|
|
269
|
+
loadError = e;
|
|
270
|
+
}
|
|
271
|
+
break;
|
|
272
|
+
default:
|
|
273
|
+
throw new Error(`Unsupported architecture on Linux: ${arch}`);
|
|
274
|
+
}
|
|
275
|
+
break;
|
|
276
|
+
default:
|
|
277
|
+
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
if (!nativeBinding) {
|
|
281
|
+
if (loadError) {
|
|
282
|
+
throw loadError;
|
|
283
|
+
}
|
|
284
|
+
throw new Error(`Failed to load native binding`);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
const {
|
|
288
|
+
JulianDate,
|
|
289
|
+
ModifiedJulianDate,
|
|
290
|
+
Period,
|
|
291
|
+
jdToMjd,
|
|
292
|
+
mjdToJd,
|
|
293
|
+
julianCenturies,
|
|
294
|
+
julianYears,
|
|
295
|
+
jdFromDate,
|
|
296
|
+
mjdFromDate,
|
|
297
|
+
jdToDate,
|
|
298
|
+
mjdToDate,
|
|
299
|
+
jdDifference,
|
|
300
|
+
mjdDifference,
|
|
301
|
+
version,
|
|
302
|
+
} = nativeBinding;
|
|
303
|
+
|
|
304
|
+
module.exports.JulianDate = JulianDate;
|
|
305
|
+
module.exports.ModifiedJulianDate = ModifiedJulianDate;
|
|
306
|
+
module.exports.Period = Period;
|
|
307
|
+
module.exports.jdToMjd = jdToMjd;
|
|
308
|
+
module.exports.mjdToJd = mjdToJd;
|
|
309
|
+
module.exports.julianCenturies = julianCenturies;
|
|
310
|
+
module.exports.julianYears = julianYears;
|
|
311
|
+
module.exports.jdFromDate = jdFromDate;
|
|
312
|
+
module.exports.mjdFromDate = mjdFromDate;
|
|
313
|
+
module.exports.jdToDate = jdToDate;
|
|
314
|
+
module.exports.mjdToDate = mjdToDate;
|
|
315
|
+
module.exports.jdDifference = jdDifference;
|
|
316
|
+
module.exports.mjdDifference = mjdDifference;
|
|
317
|
+
module.exports.version = version;
|