Skip to content

Build And Test ​

Use Node 24.17.0 (nvm use) and Rust 1.94.0 selected by rust-toolchain.toml. The root is an npm workspace and a Cargo virtual workspace.

sh
npm ci
npm run build:ts
npm run test:ts
npm run docs:ts
npm run check:package

These TypeScript tasks do not require Rust. Inside lib-ts, use npm run build, npm test and npm run typecheck after installing workspace dependencies.

sh
cargo build --workspace --locked
cargo test --workspace --locked
cargo clippy --workspace --all-targets -- -D warnings
cargo doc -p n3-lib --no-deps --locked

Rust does not require Node. Integrated checks require both:

sh
npm test
npm run verify:parity
npm run check:layouts
npm run lint
npm run format:check
npm run docs
npx playwright install chromium
npm run test:e2e

npm run demo starts the local inspector. Its deployment base is /n3-lib/demos/inspector/. The complete Pages artifact is .artifacts/pages.

For documentation development, run npm run docs:dev -- --port 4000 and open http://localhost:4000/n3-lib/. Opening http://localhost:4000/ redirects there. The workspace's Vite extension settings use this command and the site directory, so opening VS Code does not mistakenly serve the repository root as a docs site. After changing these settings, run Vite: Stop Vite Server, then Vite: Start Vite Server. Reloading VS Code alone can recover the old, incorrectly launched server instead of replacing it. Generated .vitepress caches and output are ignored at any depth; source files such as site/.vitepress/config.ts remain tracked.

Storage Values ​

ts
import { parseN3Sky, writeN3Sky, utf8, floatBits } from "n3-lib";

const record = parseN3Sky(bytes);
record.moon = utf8("misc\\moon.bmp");
const output = writeN3Sky(record);

Choose a named parser for each known format, for example parseN3Pmesh(bytes) or Rust parse_n3pmesh(&bytes). Libraries accept bytes, not filenames, paths or extensions. File selection and extension routing belong to application code.

Strings contain original hex bytes; f32 values contain unsigned bit patterns. text decodes without changing storage. utf8 explicitly encodes UTF-8; use the actual legacy code page for legacy non-ASCII edits. Numeric f32 edits use floatBits(value) in TS or value.to_bits() in Rust. Array count prefixes are derived by writers; fixed dimensions are validated.

npm run check:package installs the npm tarball into a clean temporary consumer and checks ESM execution and declarations. cargo package --locked verifies that the crate builds without private files or sibling packages.

MIT licensed. Game assets are not distributed.