use-js 0.0.1

Feature-gated facade crate for RustUse JavaScript ecosystem primitives
Documentation

use-js

Feature-gated facade crate for the focused RustUse JavaScript ecosystem primitives.

Experimental

use-js is experimental while the workspace remains below 0.3.0. Expect small API adjustments during the first release wave.

Example

# #[cfg(all(feature = "ecmascript", feature = "identifier", feature = "package-json", feature = "react", feature = "astro", feature = "next"))]
# {
use use_js::{AstroRenderingMode, EcmaScriptTarget, JsIdentifier, NextJsRouteSegment, PackageName, ReactComponentName};

let target: EcmaScriptTarget = "es2024".parse()?;
let identifier = JsIdentifier::new("createApp")?;
let package = PackageName::new("@rustuse/example")?;
let component = ReactComponentName::new("AppShell")?;
let route_segment = NextJsRouteSegment::new("blog")?;

assert_eq!(target.to_string(), "ES2024");
assert_eq!(identifier.as_str(), "createApp");
assert!(package.is_scoped());
assert_eq!(component.as_str(), "AppShell");
assert_eq!(AstroRenderingMode::Hybrid.as_str(), "hybrid");
assert_eq!(route_segment.as_str(), "blog");
# }
# Ok::<(), Box<dyn std::error::Error>>(())

Scope

  • Thin re-exports over the focused crates in this workspace.
  • Feature flags that map directly to child crates.
  • One dependency when consumer ergonomics matter more than the narrowest possible dependency graph.

Non-goals

  • JavaScript or TypeScript runtime behavior.
  • Full source parsing, bundling, transpilation, scaffolding, or package-manager execution.
  • A second abstraction layer over the focused crates.

License

Licensed under either Apache-2.0 or MIT.