Repository: denoland/deno
File: cli/standalone/binary.rs (Rust)

Code before:
      None => None,
    };
    let mut vfs = VfsBuilder::new();
    let mut remote_modules_size = 0.0;
    let npm_snapshot = match self.npm_resolver.as_inner() {
      InnerCliNpmResolverRef::Managed(managed) => {
        let snapshot =
          managed.serialized_valid_snapshot_for_system(&self.npm_system_info);
        if !snapshot.as_serialized().packages.is_empty() {
          let npm_snapshot = managed.snapshot();
          // make sure that graph.npm_packages.is_empty() isn't empty
          if !graph.npm_packages.is_empty() {
            for module in graph.modules() {
              if let deno_graph::Module::Npm(module) = module {
                let nv = module.nv_reference.nv();
                if let Ok(package) =
                  npm_snapshot.resolve_package_from_deno_module(nv)
                {
                  // package.id.clone() is found now
                  if let Ok(size) = managed.package_size(&package.id) {
                    remote_modules_size += size as f64;
                  }
                }
              }
            }
          }
          self.fill_npm_vfs(&mut vfs).context("Building npm vfs.")?;
          Some(snapshot)
        } else {
          None
        }
      }
      InnerCliNpmResolverRef::Byonm(_) => {
        self.fill_npm_vfs(&mut vfs)?;
        None
      }
    };
    for include_file in include_files {
      let path = deno_path_util::url_to_file_path(include_file)?;
      vfs
        .add_file_at_path(&path)
        .with_context(|| format!("Including {}", path.display()))?;
    }
    let mut remote_modules_store = RemoteModulesStoreBuilder::default();
    let mut code_cache_key_hasher = if self.cli_options.code_cache_enabled() {
      Some(FastInsecureHasher::new_deno_versioned())
    } else {
      None
    };
    for module in graph.modules() {
      if module.specifier().scheme() == "data" {

Review comment (suggestion):
We shouldn't output this because npm packages are stored in the file system whose size is already displayed.

Let's wait for https://github.com/denoland/deno/pull/27395 to land because implementing this after that will basically just be getting the size from the `RemoteModulesStoreBuilder`.

Code after:
    let root_dir_url = match &root_dir_url {
      Some(url) => StandaloneRelativeFileBaseUrl::Path(url),
      None => StandaloneRelativeFileBaseUrl::WindowsSystemRoot,
    };

    let code_cache_key = if self.cli_options.code_cache_enabled() {
      let mut hasher = FastInsecureHasher::new_deno_versioned();
      for module in graph.modules() {
        if let Some(source) = module.source() {
          hasher
            .write(root_dir_url.specifier_key(module.specifier()).as_bytes());
          hasher.write(source.as_bytes());
        }
      }
      Some(hasher.finish())
    } else {
      None
    };

    let node_modules = match &self.npm_resolver {
      CliNpmResolver::Managed(_) => {
        npm_snapshot.as_ref().map(|_| NodeModules::Managed {
          node_modules_dir: self.npm_resolver.root_node_modules_path().map(
            |path| {
              root_dir_url
                .specifier_key(
                  &ModuleSpecifier::from_directory_path(path).unwrap(),
                )
                .into_owned()
            },
          ),
        })
      }
      CliNpmResolver::Byonm(resolver) => Some(NodeModules::Byonm {
        root_node_modules_dir: resolver.root_node_modules_path().map(
          |node_modules_dir| {
            root_dir_url
              .specifier_key(
                &ModuleSpecifier::from_directory_path(node_modules_dir)
                  .unwrap(),
              )
              .into_owned()
          },
        ),
      }),
    };

    let env_vars_from_env_file = match self.cli_options.env_file_name() {
      Some(env_filenames) => {
        let mut aggregated_env_vars = IndexMap::new();
        for env_filename in env_filenames.iter().rev() {