Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/pm/cli/install.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ bun install --offline

An install is only certain to cache the packages that it places in `node_modules`. To warm the cache for an `--offline` install, run an install on the same platform that places at least the same packages. An install with `--production` or `--omit` does not cache the groups it leaves out.

`--offline` skips an optional dependency that is not cached, and anything below it that is not cached either. A package that an installed package requires is still an error.

See [lockfile](/pm/lockfile) for more on `bun.lock`.

---
Expand Down
2 changes: 1 addition & 1 deletion src/install/NetworkTask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ pub enum ForTarballError {
OutOfMemory,
#[error("InvalidURL")]
InvalidURL,
/// `--offline` and the tarball is not in the cache. Already reported (once per
/// `--offline` and the tarball is not in the cache. Reported or recorded already (once per
/// package); callers treat it like `AlreadyFailed`.
#[error("TarballFailedToDownload")]
Offline,
Expand Down
3 changes: 3 additions & 0 deletions src/install/PackageInstaller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1612,6 +1612,7 @@ impl<'a> PackageInstaller<'a> {
if package_manager::enqueue_git_for_checkout(
self.manager_mut(),
dependency_id,
package_id,
alias.slice(string_buf!()),
resolution,
context,
Expand Down Expand Up @@ -1907,6 +1908,7 @@ impl<'a> PackageInstaller<'a> {
let is_duplicate = self.successfully_installed.is_set(package_id as usize);
self.summary.success += (!is_duplicate) as u32;
self.successfully_installed.set(package_id as usize);
self.manager_mut().note_package_present(package_id);

if log_level.show_progress() {
self.node.complete_one();
Expand Down Expand Up @@ -2213,6 +2215,7 @@ impl<'a> PackageInstaller<'a> {
}

self.summary.skipped += 1;
self.manager_mut().note_package_present(package_id);

if self.bins[package_id as usize].tag != bin::Tag::None {
self.trees[self.current_tree_id as usize]
Expand Down
5 changes: 5 additions & 0 deletions src/install/PackageManager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,9 @@ pub struct PackageManager {
// `bun update <name>`: packages reachable from the workspaces in scope, see update_scope::plan_named.
pub(crate) named_update_reachable: Option<bun_collections::DynamicBitSet>,

// --offline: what the install phase found; drained by enqueue::report_offline_misses.
pub(crate) offline_install: enqueue::OfflineInstall,

// bun update: patched packages a move was held back for; drained by update_transitive::print_kept_patched.
pub(crate) kept_patched: Vec<PackageID>,
pub kept_patched_text: Vec<u8>,
Expand Down Expand Up @@ -2139,6 +2142,7 @@ pub fn init(
wr!(updating_catalogs, Vec::new());
wr!(update_target_workspaces, None);
wr!(named_update_reachable, None);
wr!(offline_install, enqueue::OfflineInstall::default());
wr!(kept_patched, Vec::new());
wr!(kept_patched_text, Vec::new());
wr!(dedupe_report, None);
Expand Down Expand Up @@ -2607,6 +2611,7 @@ fn init_with_runtime_once(
wr!(updating_catalogs, Vec::new());
wr!(update_target_workspaces, None);
wr!(named_update_reachable, None);
wr!(offline_install, enqueue::OfflineInstall::default());
wr!(kept_patched, Vec::new());
wr!(kept_patched_text, Vec::new());
wr!(dedupe_report, None);
Expand Down
Loading
Loading