pub struct PackageJson {
pub path: InternedPath,
pub realpath: PathBuf,
pub name: Option<String>,
pub type: Option<ModuleType>,
pub side_effects: Option<SideEffects>,
/* private fields */
}Expand description
Deserialized package.json
Fields§
§path: InternedPathPath to package.json. Contains the package.json filename.
Stored interned: dependency tracking registers the file on every resolution that walks through its directory, so a handle turns that into a refcount bump instead of a rehash and re-intern.
realpath: PathBufRealpath to package.json. Contains the package.json filename.
name: Option<String>The “name” field defines your package’s name. The “name” field can be used in addition to the “exports” field to self-reference a package using its name.
type: Option<ModuleType>The “type” field.
side_effects: Option<SideEffects>The “sideEffects” field.
Implementations§
Source§impl PackageJson
impl PackageJson
Sourcepub fn raw_json(&self) -> &Arc<Value> ⓘ
Available on crate feature package_json_raw_json_api only.
pub fn raw_json(&self) -> &Arc<Value> ⓘ
package_json_raw_json_api only.Raw serde json value of package.json.
This is currently used in Rspack for:
- getting the
sideEffectsfield - query in https://www.rspack.dev/config/module.html#ruledescriptiondata - search on GitHub indicates query on the
typefield.
To reduce overall memory consumption, large fields that useless for pragmatic use are removed.
They are: description, keywords, scripts,
dependencies and devDependencies, peerDependencies, optionalDependencies.