mirror of
https://git.pumpin.online/funkpower/typikon.git
synced 2026-10-22 18:57:13 +00:00
WebAssembly rather than a native Node addon: one artifact serves Node, Deno, Bun, a browser and anything built on them, where napi would have meant a prebuilt binary per platform and a source build for whoever the matrix missed. The engine is pure computation and the menologion is already compiled in, so there is nothing for it to give up. A day comes back as a plain object, not a handle. A wasm class would have meant a .free() that every caller eventually forgets, and this way JSON.stringify works and the thing spreads into state. Two serializer defaults had to be overridden to keep the promise that it is the same document --json emits: maps as objects, and an absent field as null rather than undefined, which stringify would otherwise drop entirely. The TypeScript is hand-written, because the generated types for a value crossing as JsValue are `any`, and a binding that types its whole return as `any` is a binding TypeScript cannot check. tsc --strict is a release gate now, the way mypy --strict already is, and the check includes three lines that must fail to compile. The one place this differs from every other binding: no remembered default jurisdiction, because a browser has nowhere to keep one. It is called out in the README, in the types and in docs/versioning.md. The test resolves typikon through a staged node_modules rather than a relative path, so what it exercises is the exports map, and it compares a year of days field by field against the command line for four jurisdictions.
50 lines
1.7 KiB
TOML
50 lines
1.7 KiB
TOML
[package]
|
|
name = "typikon"
|
|
version = "1.0.0"
|
|
edition = "2021"
|
|
rust-version = "1.85"
|
|
description = "The Orthodox liturgical day: feasts, seasons and the fast, computed rather than fetched"
|
|
license = "GPL-2.0-only"
|
|
repository = "https://git.pumpin.online/funkpower/typikon"
|
|
readme = "README.md"
|
|
keywords = ["orthodox", "liturgical", "calendar", "byzantine", "pascha"]
|
|
categories = ["command-line-utilities", "date-and-time"]
|
|
|
|
[dependencies]
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_json = "1"
|
|
clap = { version = "4", features = ["derive"] }
|
|
pyo3 = { version = "0.27.2", features = ["extension-module", "abi3-py39"], optional = true }
|
|
|
|
# The JavaScript build. `js-sys` is here only for the clock: WebAssembly has no
|
|
# time of its own, so `today()` has to ask the host what day it is.
|
|
wasm-bindgen = { version = "0.2", optional = true }
|
|
serde-wasm-bindgen = { version = "0.6", optional = true }
|
|
js-sys = { version = "0.3", optional = true }
|
|
|
|
[profile.release]
|
|
strip = true
|
|
lto = true
|
|
codegen-units = 1
|
|
|
|
[[bin]]
|
|
name = "typikon"
|
|
path = "src/main.rs"
|
|
|
|
[lib]
|
|
name = "typikon"
|
|
path = "src/lib.rs"
|
|
crate-type = ["cdylib", "rlib"]
|
|
|
|
[features]
|
|
# Only maturin turns this on. pyo3's extension-module feature leaves the Python
|
|
# symbols to be resolved by the interpreter at load time, so a normal `cargo
|
|
# build` of the CLI would fail to link if it were on by default.
|
|
python = ["dep:pyo3"]
|
|
# The C ABI. Off by default so an ordinary `cargo build` of the CLI does not
|
|
# also compile and link a shared library nobody asked for.
|
|
capi = []
|
|
# The JavaScript and TypeScript build, via WebAssembly. Only ever compiled for
|
|
# a wasm32 target.
|
|
wasm = ["dep:wasm-bindgen", "dep:serde-wasm-bindgen", "dep:js-sys"]
|