pub struct PackageJson {
pub path: PathBuf,
pub realpath: PathBuf,
/* private fields */
}Expand description
Serde implementation for the deserialized package.json.
This implementation is used by the crate::Cache and enabled through the
fs_cache feature.
Fields§
§path: PathBufPath to package.json. Contains the package.json filename.
realpath: PathBufRealpath to package.json. Contains the package.json filename.
Implementations§
Source§impl PackageJson
impl PackageJson
Sourcepub fn path(&self) -> &Path
pub fn path(&self) -> &Path
Returns the path where the package.json was found.
Contains the package.json filename.
This does not need to be the path where the file is stored on disk. See Self::realpath().
Sourcepub fn realpath(&self) -> &Path
pub fn realpath(&self) -> &Path
Returns the path where the package.json file was stored on disk.
Contains the package.json filename.
This is the canonicalized version of Self::path(), where all symbolic links are resolved.
Sourcepub fn name(&self) -> Option<&str>
pub fn name(&self) -> Option<&str>
Name of the package.
The “name” field can be used together with the “exports” field to self-reference a package using its name.
Sourcepub fn type(&self) -> Option<PackageType>
pub fn type(&self) -> Option<PackageType>
Returns the package type, if one is configured in the package.json.
Sourcepub fn side_effects(&self) -> Option<SideEffects<'_>>
pub fn side_effects(&self) -> Option<SideEffects<'_>>
The “sideEffects” field.
Sourcepub fn exports(&self) -> Option<ImportsExportsEntry<'_>>
pub fn exports(&self) -> Option<ImportsExportsEntry<'_>>
The “exports” field allows defining the entry points of a package.