pub enum LocalSource {
Directory(PathBuf),
Tarball(PathBuf),
Link(PathBuf),
Portal(PathBuf),
Exec(PathBuf),
Git(GitSource),
RemoteTarball(RemoteTarballSource),
}Expand description
Non-registry source for a locked package.
When a package comes from a local path (via file: or link: in
package.json) it doesn’t have a tarball URL or integrity hash, so we
record the source separately and let the linker materialize it
on-the-fly.
Variants§
Directory(PathBuf)
file:<dir> — a directory on disk whose contents should be
hardlink-copied into the virtual store like a normal package.
Path is stored relative to the project root.
Tarball(PathBuf)
file:<tarball> — a .tgz on disk, extracted into the virtual
store the same way we extract registry tarballs.
Link(PathBuf)
link:<dir> — a plain symlink into node_modules/<name>, never
materialized into the virtual store. Transitive deps are the
target’s responsibility.
Portal(PathBuf)
portal:<dir> — a Yarn Berry package portal. The target is a
package on disk, but unlike link: its dependencies are still
modeled in the lockfile graph.
Exec(PathBuf)
exec:<script> — a Yarn Berry generator script. The script is
executed at fetch time and writes the package files into a
generated build directory.
Git(GitSource)
git+https://, git+ssh://, github:user/repo, etc. — a
remote git repo. Cloned at fetch time and imported like a
file: directory. url is the normalized clone URL (what
gets passed to git clone). committish is the user-written
ref after # (branch, tag, or commit; None means HEAD).
resolved is the 40-char commit SHA that git ls-remote
pinned the ref to — the lockfile records this so repeat
installs reproduce bit-for-bit.
RemoteTarball(RemoteTarballSource)
https://example.com/pkg.tgz — a remote tarball URL. Fetched
once at resolve time so the resolver can read the enclosed
package.json for version + transitive deps and pin the
sha512 integrity. integrity stays empty on freshly-parsed
specifiers and is filled in by the resolver after download.
Implementations§
Source§impl LocalSource
impl LocalSource
Sourcepub fn path(&self) -> Option<&Path>
pub fn path(&self) -> Option<&Path>
The original path (relative to the project root) the user wrote
in package.json. None for non-path sources like git.
Whether this source is pinned to immutable, globally reproducible content and can therefore be shared across projects inside aube’s global virtual store, exactly like a registry package.
Git is pinned to a 40-char commit SHA and RemoteTarball to
a fetched URL (and, once resolved, an integrity hash), so two
projects that depend on the same one resolve to the same files.
file: / link: / portal: / exec: all resolve against a
path inside the depending project, so they stay per-project and
are never promoted into the shared store.
Load-bearing for global-virtual-store correctness: a registry
package materialized into the shared store points its
dependency siblings at the hashed global path
(virtual_store_subdir(dep_path)). If one of those deps were a
git/tarball source that only ever landed in the per-project
.aube/, the sibling symlink would dangle and Node’s module
walk would silently fall back to some unrelated <name> found
higher up the tree.
Sourcepub fn path_posix(&self) -> String
pub fn path_posix(&self) -> String
The path as a POSIX-style string with forward-slash separators.
Path::display() and to_string_lossy() honor the host’s
separator (backslash on Windows), which would make dep_path
hashes and lockfile specifier: strings non-portable: the
same file:./some/dir would render as some\dir on Windows
and some/dir on Unix, producing two different hashes for
the same logical target. Always rendering with / keeps
lockfiles cross-platform identical.
Sourcepub fn specifier(&self) -> String
pub fn specifier(&self) -> String
Canonical specifier string as pnpm writes it in the packages:
and snapshots: keys (post-<name>@ part). For file: /
link: this is file:./vendor/foo / link:../sibling. For
git, pnpm uses the resolved form <url>#<commit> (no
git+ prefix) because the lockfile pins to the exact commit
regardless of what the user wrote. Always emits POSIX
separators so the resulting lockfile is portable.
Sourcepub fn dep_path(&self, name: &str) -> String
pub fn dep_path(&self, name: &str) -> String
Internal FS-safe dep_path used as the key in
LockfileGraph.packages and as the .aube/ subdir name.
Distinct paths must map to distinct keys (otherwise the
linker would silently mix files between two local packages),
and the result must be a single filesystem component — no
/, \, :, or ... Ad-hoc character substitution trips
over cases like ../vendor vs __/vendor or a.b vs a_b
collapsing to the same string, so we hash the raw path bytes
and suffix the first 16 hex chars (64 bits — more than enough
to avoid collisions inside a single project).
The hash input is the POSIX-form path string so a checked-in
lockfile resolves to the same key regardless of which
platform ran aube install.
Sourcepub fn parse(spec: &str, project_root: &Path) -> Option<Self>
pub fn parse(spec: &str, project_root: &Path) -> Option<Self>
Classify a user-written file: / link: specifier against the
project root. Returns None if spec isn’t a local specifier.
Resolves the target path relative to project_root; a file:
target that resolves to a .tgz / .tar.gz on disk is treated
as a tarball, anything else as a directory.
Sourcepub fn looks_like_remote_tarball_url(spec: &str) -> bool
pub fn looks_like_remote_tarball_url(spec: &str) -> bool
Whether a specifier looks like a direct HTTP(S) URL that should
be fetched as a tarball. Per npm semantics, any http:// or
https:// URL in a dependency value is a tarball URL — services
like pkg.pr.new, GitHub codeload, and private registries with
auth-token query strings serve tarballs from URLs that don’t
carry a .tgz extension. Git URLs must already have been
ruled out by the caller (see parse_git_spec) so a
.git-suffixed URL doesn’t get misclassified here.
pub fn path_looks_like_tarball(path: &Path) -> bool
Trait Implementations§
Source§impl Clone for LocalSource
impl Clone for LocalSource
Source§fn clone(&self) -> LocalSource
fn clone(&self) -> LocalSource
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LocalSource
impl Debug for LocalSource
impl Eq for LocalSource
Source§impl PartialEq for LocalSource
impl PartialEq for LocalSource
Source§fn eq(&self, other: &LocalSource) -> bool
fn eq(&self, other: &LocalSource) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for LocalSource
Auto Trait Implementations§
impl Freeze for LocalSource
impl RefUnwindSafe for LocalSource
impl Send for LocalSource
impl Sync for LocalSource
impl Unpin for LocalSource
impl UnsafeUnpin for LocalSource
impl UnwindSafe for LocalSource
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more