Skip to main content

Module package

Module package 

Source
Expand description

Step 6: turn a gated port into packages end users install, the way maturin and @napi-rs/cli lay them out. Writes files only: it never builds for other platforms (the generated GitHub Actions workflow does) and never publishes.

  • PyO3: a self-contained maturin project (abi3 wheel, importable under the original’s module name) and a workflow that builds wheels for macOS, Linux (manylinux) and Windows.
  • napi-rs: a main npm package whose loader picks <name>-<platform> from its optionalDependencies and falls back to the original JS, one package per platform holding one .node, and a workflow that builds and packs them.
  • wasm-bindgen: one npm package with the built pkg/, the same on every platform.
  • A CLI front door (rust/app) of an npm CLI: a main package whose command runs this platform’s front door binary, with the original pinned as a dependency for every case the port does not cover, and one package per platform holding the binary (cli.rs).

Structs§

Options
Outcome
Platform
A platform a napi port ships a binary for: the npm key napi-rs uses, the Rust target, and the runner that builds it.

Enums§

Layout
What a package folder holds.

Constants§

PLATFORMS
STAMP
Written into the output folder; lists what the last run wrote, so a rerun replaces only that.

Functions§

host_key
The napi key of the machine running rust-anything, if a package is built for it.
original_version
The version of the package the unit belongs to: the nearest package.json for JS, the pyproject.toml (or setup.cfg, or __version__) for Python.
package
python_module
The dotted module the original unit is imported as: src/textkit/ is textkit, src/textkit/words.py is textkit.words. Folders above count while they are packages (hold __init__.py); without the sources, a leading src/ or lib/ is dropped.