first pass of merging in warp (doesn't build)

This commit is contained in:
Ryan Ward
2026-07-01 16:08:58 -05:00
parent 2f64909469
commit 4770ac06b5
3662 changed files with 414574 additions and 89772 deletions
+20
View File
@@ -0,0 +1,20 @@
[package]
name = "warp_assets"
version = "0.0.0"
edition = "2024"
authors.workspace = true
license.workspace = true
publish.workspace = true
[features]
standalone = []
[dependencies]
anyhow.workspace = true
rust-embed.workspace = true
warpui_core.workspace = true
[target.'cfg(target_family = "wasm")'.dependencies]
# Make sure we embed the data into the wasm binary even when running in debug
# mode, as it cannot be read directly from the filesystem.
rust-embed = { workspace = true, features = ["debug-embed"] }
+26
View File
@@ -0,0 +1,26 @@
use std::borrow::Cow;
use anyhow::{Result, anyhow};
use rust_embed::RustEmbed;
use warpui_core::AssetProvider;
#[derive(Clone, Copy, RustEmbed)]
#[folder = "../../app/assets"]
#[include = "bundled/**"] // Should be kept in sync with BUNDLED_ASSETS_DIR.
#[include = "async/**"] // Should be kept in sync with ASYNC_ASSETS_DIR.
#[cfg_attr(target_family = "wasm", exclude = "async/**")]
// Excludes take precedence.
// Standalone CLI builds (the `oz` tarball) are headless and never render the
// onboarding/theme imagery in `async/`, so we exclude those bytes from the
// embedded asset set to keep the CLI binary small — mirroring the carve-out
// already applied for the WASM target above.
#[cfg_attr(feature = "standalone", exclude = "async/**")]
pub struct Assets;
impl AssetProvider for Assets {
fn get(&self, path: &str) -> Result<Cow<'_, [u8]>> {
<Assets as RustEmbed>::get(path)
.map(|f| f.data)
.ok_or_else(|| anyhow!("no asset exists at path {}", path))
}
}