pub struct PackageJson { /* private fields */ }Expand description
Immutable package.json metadata and pure export/import resolution.
Implementations§
Source§impl PackageJson
impl PackageJson
Sourcepub fn parse(
root: &ProjectRoot,
package_path: impl AsRef<Path>,
source: &str,
) -> Result<Self, PackageError>
pub fn parse( root: &ProjectRoot, package_path: impl AsRef<Path>, source: &str, ) -> Result<Self, PackageError>
Parses already-loaded package metadata without scripts, network access, or I/O.
pub fn path(&self) -> &Path
pub fn directory(&self) -> &Path
pub fn name(&self) -> Option<&str>
pub fn package_type(&self) -> Option<&str>
pub const fn raw(&self) -> &JsonObject
Sourcepub fn resolve_export(
&self,
root: &ProjectRoot,
subpath: &str,
mode: PackageMode,
conditions: &ResolutionConditions,
) -> Result<PathBuf, PackageError>
pub fn resolve_export( &self, root: &ProjectRoot, subpath: &str, mode: PackageMode, conditions: &ResolutionConditions, ) -> Result<PathBuf, PackageError>
Resolves an export map target or a legacy root entry. Targets are planned lexically and need not exist.
Sourcepub fn resolve_import(
&self,
root: &ProjectRoot,
specifier: &str,
conditions: &ResolutionConditions,
) -> Result<PackageTarget, PackageError>
pub fn resolve_import( &self, root: &ProjectRoot, specifier: &str, conditions: &ResolutionConditions, ) -> Result<PackageTarget, PackageError>
Resolves a package-local #imports map. Bare results remain explicit external
targets for a higher package locator; relative results are confined paths.
Trait Implementations§
Source§impl Clone for PackageJson
impl Clone for PackageJson
Source§fn clone(&self) -> PackageJson
fn clone(&self) -> PackageJson
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PackageJson
impl Debug for PackageJson
impl Eq for PackageJson
Source§impl PartialEq for PackageJson
impl PartialEq for PackageJson
impl StructuralPartialEq for PackageJson
Auto Trait Implementations§
impl Freeze for PackageJson
impl RefUnwindSafe for PackageJson
impl Send for PackageJson
impl Sync for PackageJson
impl Unpin for PackageJson
impl UnsafeUnpin for PackageJson
impl UnwindSafe for PackageJson
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more