Merge pull request #1791 from ealmloff/breaking

Remove scope, use_state, use_ref, bump allocator and make everything 'static
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2024-02-05 14:19:47 -08:00
commit 4f8868d43d
517 files changed
+17126 -20669

No files matched your search

+4
View File
@@ -157,6 +157,10 @@ async fn autoformat_project(check: bool, split_line_attributes: bool) -> Result<
return Ok(());
}
if files_to_format.is_empty() {
return Ok(());
}
let indent = indentation_for(&files_to_format[0], split_line_attributes)?;
let counts = files_to_format
+4 -4
View File
@@ -45,8 +45,8 @@ pub struct ConfigOptsBuild {
#[clap(long, default_value_t = { "web".to_string() })]
pub client_feature: String,
/// The feature to use for the server in a fullstack app [default: "ssr"]
#[clap(long, default_value_t = { "ssr".to_string() })]
/// The feature to use for the server in a fullstack app [default: "server"]
#[clap(long, default_value_t = { "server".to_string() })]
pub server_feature: String,
/// Rustc platform triple
@@ -142,8 +142,8 @@ pub struct ConfigOptsServe {
#[clap(long, default_value_t = { "web".to_string() })]
pub client_feature: String,
/// The feature to use for the server in a fullstack app [default: "ssr"]
#[clap(long, default_value_t = { "ssr".to_string() })]
/// The feature to use for the server in a fullstack app [default: "server"]
#[clap(long, default_value_t = { "server".to_string() })]
pub server_feature: String,
/// Rustc platform triple
+2 -2
View File
@@ -71,7 +71,7 @@ fn write_callbody_with_icon_section(mut callbody: CallBody) -> String {
}
fn write_component_body(raw: String) -> String {
let mut out = String::from("fn component(cx: Scope) -> Element {\n cx.render(rsx! {");
let mut out = String::from("fn component() -> Element {\n rsx! {");
indent_and_write(&raw, 1, &mut out);
out.push_str(" })\n}");
out
@@ -84,7 +84,7 @@ fn write_svg_section(out: &mut String, svgs: Vec<BodyNode>) {
let raw = dioxus_autofmt::write_block_out(CallBody { roots: vec![icon] }).unwrap();
out.push_str("\n\n pub fn icon_");
out.push_str(&idx.to_string());
out.push_str("(cx: Scope) -> Element {\n cx.render(rsx! {");
out.push_str("() -> Element {\n rsx! {");
indent_and_write(&raw, 2, out);
out.push_str(" })\n }");
}
+2 -5
View File
@@ -4,14 +4,11 @@ use std::{
sync::Mutex,
};
use crate::tools::{app_path, clone_repo};
use dioxus_cli_config::CrateConfig;
use mlua::{Lua, Table};
use serde_json::json;
use crate::{
tools::{app_path, clone_repo},
CrateConfig,
};
use self::{
interface::{
command::PluginCommander, dirs::PluginDirs, fs::PluginFileSystem, log::PluginLogger,
+1 -1
View File
@@ -21,7 +21,7 @@ use std::{
use tokio::sync::broadcast::{self};
#[cfg(feature = "plugin")]
use plugin::PluginManager;
use crate::plugin::PluginManager;
use super::HotReloadState;
+2 -2
View File
@@ -40,7 +40,7 @@ async fn setup_file_watcher<F: Fn() -> Result<BuildResult> + Send + 'static>(
if let Some(hot_reload) = &hot_reload {
// find changes to the rsx in the file
let mut rsx_file_map = hot_reload.file_map.lock().unwrap();
let mut messages: Vec<Template<'static>> = Vec::new();
let mut messages: Vec<Template> = Vec::new();
// In hot reload mode, we only need to rebuild if non-rsx code is changed
needs_full_rebuild = false;
@@ -153,6 +153,6 @@ pub(crate) trait Platform {
#[derive(Clone)]
pub struct HotReloadState {
pub messages: broadcast::Sender<Template<'static>>,
pub messages: broadcast::Sender<Template>,
pub file_map: Arc<Mutex<FileMap<HtmlCtx>>>,
}
+5 -4
View File
@@ -39,7 +39,7 @@ use tower_http::{
};
#[cfg(feature = "plugin")]
use plugin::PluginManager;
use crate::plugin::PluginManager;
mod proxy;
@@ -159,10 +159,10 @@ pub async fn serve(
);
// Router
let router = setup_router(config, ws_reload_state, hot_reload_state).await?;
let router = setup_router(config.clone(), ws_reload_state, hot_reload_state).await?;
// Start server
start_server(port, router, start_browser, rustls_config).await?;
start_server(port, router, start_browser, rustls_config, &config).await?;
Ok(())
}
@@ -366,10 +366,11 @@ async fn start_server(
router: Router,
start_browser: bool,
rustls: Option<RustlsConfig>,
_config: &CrateConfig,
) -> Result<()> {
// If plugins, call on_serve_start event
#[cfg(feature = "plugin")]
PluginManager::on_serve_start(&config)?;
PluginManager::on_serve_start(_config)?;
// Parse address
let addr = format!("0.0.0.0:{}", port).parse().unwrap();