feat(unstable): support bytes and text imports in deno compile (#29924)

Also includes:

- https://github.com/denoland/deno_graph/pull/593

Closes https://github.com/denoland/deno/issues/29903
Closes https://github.com/denoland/deno/issues/29927
This commit is contained in:
David Sherret 2025-06-28 12:24:07 -04:00 committed by GitHub
parent b5e41f605d
commit 8fcbb0fa43
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 328 additions and 24 deletions

View file

@ -3,6 +3,10 @@
use std::borrow::Cow;
use std::sync::Arc;
pub fn is_valid_utf8(bytes: &[u8]) -> bool {
matches!(String::from_utf8_lossy(bytes), Cow::Borrowed(_))
}
#[inline(always)]
pub fn from_utf8_lossy_owned(bytes: Vec<u8>) -> String {
match String::from_utf8_lossy(&bytes) {