Expand description
Generate the npm publish tree that ships a prebuilt Rust binary.
The tree follows the “platform packages” pattern: a meta package whose
optionalDependencies point at one @scope/name-<os>-<cpu> package per
platform, each carrying the binary and filtered by npm os/cpu. Package
identity is read from the target crate via cargo metadata; targets, payload
and foreign manifests are declared under [package.metadata.npmgen] (or
[workspace.metadata.npmgen]).
Obtain a Project with Project::builder (in-memory) or Project::load
(from a manifest), then run Generator::new.
Re-exports§
pub use compile::BuildDriver;pub use compile::CargoDriver;pub use compile::CompileError;pub use config::Config;pub use config::ConfigError;pub use config::Launcher;pub use config::ManifestSpec;pub use config::TargetSpec;pub use npm::NpmError;pub use project::Author;pub use project::DEFAULT_MANIFEST_PATH;pub use project::Identity;pub use project::Overrides;pub use project::Project;pub use project::ProjectBuilder;pub use project::ProjectError;pub use project::Workspace;pub use target::Target;pub use target::TargetError;
Modules§
- compile
- Phase 1: cross-build the binary for each target.
- config
- The
[package.metadata.npmgen](or[workspace.metadata.npmgen]) schema. - npm
- Phases 2 and 3: assemble the publish tree and place the binaries.
- project
- The target crate(s), resolved via
cargo metadata. - target
- Build targets: the resolved
Targetdomain type and theTargetResolverthat derives the target set by precedence.
Structs§
- Generator
- Generates the publish tree for one or more
Projects into a shared output root, atomically. Construct withGenerator::new(single) orGenerator::for_projects(a workspace’s bins) and configure with the chained setters.
Enums§
- Error
- Any failure of the generation pipeline.
Constants§
- DEFAULT_
DRIVER - Default build driver command.
- DEFAULT_
OUT - Default output root for the generated tree.