mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
perf(compile): read embedded files as static references when UTF-8 and reading as strings (#27033)
This commit is contained in:
parent
76daa03aa9
commit
f161adf19e
19 changed files with 158 additions and 61 deletions
|
@ -282,14 +282,13 @@ impl StandaloneModules {
|
|||
.vfs
|
||||
.read_file_all(entry, VfsFileSubDataKind::ModuleGraph)?,
|
||||
Err(err) if err.kind() == ErrorKind::NotFound => {
|
||||
let bytes = match RealFs.read_file_sync(&path, None) {
|
||||
match RealFs.read_file_sync(&path, None) {
|
||||
Ok(bytes) => bytes,
|
||||
Err(FsError::Io(err)) if err.kind() == ErrorKind::NotFound => {
|
||||
return Ok(None)
|
||||
}
|
||||
Err(err) => return Err(err.into()),
|
||||
};
|
||||
Cow::Owned(bytes)
|
||||
}
|
||||
}
|
||||
Err(err) => return Err(err.into()),
|
||||
};
|
||||
|
@ -694,7 +693,7 @@ impl<'a> DenoCompileBinaryWriter<'a> {
|
|||
&file_path,
|
||||
match maybe_source {
|
||||
Some(source) => source,
|
||||
None => RealFs.read_file_sync(&file_path, None)?,
|
||||
None => RealFs.read_file_sync(&file_path, None)?.into_owned(),
|
||||
},
|
||||
VfsFileSubDataKind::ModuleGraph,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue