summaryrefslogtreecommitdiff
path: root/cli/standalone/binary.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-05-01 14:35:23 -0400
committerGitHub <noreply@github.com>2023-05-01 14:35:23 -0400
commit9efed4c7a3d32de62e9c9b5e0c6712ce97637abb (patch)
treeaa370f95df93c71f6c57d6a01a50b4df1955ee57 /cli/standalone/binary.rs
parent30628288ce2b411ca3def46129a4606073e16bac (diff)
refactor(cli): remove ProcState - add CliFactory (#18900)
This removes `ProcState` and replaces it with a new `CliFactory` which initializes our "service structs" on demand. This isn't a performance improvement at the moment for `deno run`, but might unlock performance improvements in the future.
Diffstat (limited to 'cli/standalone/binary.rs')
-rw-r--r--cli/standalone/binary.rs19
1 files changed, 9 insertions, 10 deletions
diff --git a/cli/standalone/binary.rs b/cli/standalone/binary.rs
index bca0aff2b..51d8db79e 100644
--- a/cli/standalone/binary.rs
+++ b/cli/standalone/binary.rs
@@ -5,7 +5,6 @@ use std::io::Seek;
use std::io::SeekFrom;
use std::io::Write;
use std::path::Path;
-use std::sync::Arc;
use deno_ast::ModuleSpecifier;
use deno_core::anyhow::Context;
@@ -150,17 +149,17 @@ fn u64_from_bytes(arr: &[u8]) -> Result<u64, AnyError> {
Ok(u64::from_be_bytes(*fixed_arr))
}
-pub struct DenoCompileBinaryWriter {
- file_fetcher: Arc<FileFetcher>,
- client: HttpClient,
- deno_dir: DenoDir,
+pub struct DenoCompileBinaryWriter<'a> {
+ file_fetcher: &'a FileFetcher,
+ client: &'a HttpClient,
+ deno_dir: &'a DenoDir,
}
-impl DenoCompileBinaryWriter {
+impl<'a> DenoCompileBinaryWriter<'a> {
pub fn new(
- file_fetcher: Arc<FileFetcher>,
- client: HttpClient,
- deno_dir: DenoDir,
+ file_fetcher: &'a FileFetcher,
+ client: &'a HttpClient,
+ deno_dir: &'a DenoDir,
) -> Self {
Self {
file_fetcher,
@@ -282,7 +281,7 @@ impl DenoCompileBinaryWriter {
None => None,
};
let maybe_import_map = cli_options
- .resolve_import_map(&self.file_fetcher)
+ .resolve_import_map(self.file_fetcher)
.await?
.map(|import_map| (import_map.base_url().clone(), import_map.to_json()));
let metadata = Metadata {