Skip to content

Commit

Permalink
feat(cli): hotreload support for frontend static files, closes #2173 (#…
Browse files Browse the repository at this point in the history
…5256)

Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
  • Loading branch information
amrbashir and lucasfernog committed Sep 28, 2022
1 parent e8e2853 commit 54c337e
Show file tree
Hide file tree
Showing 13 changed files with 471 additions and 30 deletions.
5 changes: 5 additions & 0 deletions .changes/cli-static-files-hot-reload.md
@@ -0,0 +1,5 @@
---
"cli.rs": "minor"
---

Hot-reload the frontend when `tauri.conf.json > build > devPath` points to a directory.
5 changes: 5 additions & 0 deletions .changes/utils-mimetype.md
@@ -0,0 +1,5 @@
---
"tauri-utils": "patch"
---

Add `mime_type` module.
1 change: 0 additions & 1 deletion core/tauri-runtime/Cargo.toml
Expand Up @@ -30,7 +30,6 @@ tauri-utils = { version = "1.1.1", path = "../tauri-utils" }
uuid = { version = "1", features = [ "v4" ] }
http = "0.2.4"
http-range = "0.1.4"
infer = "0.7"
raw-window-handle = "0.5"
rand = "0.8"

Expand Down
4 changes: 2 additions & 2 deletions core/tauri-runtime/src/http/mod.rs
Expand Up @@ -3,16 +3,16 @@
// SPDX-License-Identifier: MIT

// custom wry types
mod mime_type;
mod request;
mod response;

pub use self::{
mime_type::MimeType,
request::{Request, RequestParts},
response::{Builder as ResponseBuilder, Response, ResponseParts},
};

pub use tauri_utils::mime_type::MimeType;

// re-expose default http types
pub use http::{header, method, status, uri::InvalidUri, version, Uri};

Expand Down
1 change: 1 addition & 0 deletions core/tauri-utils/Cargo.toml
Expand Up @@ -35,6 +35,7 @@ glob = { version = "0.3.0", optional = true }
walkdir = { version = "2", optional = true }
memchr = "2.4"
semver = "1"
infer = "0.7"

[target."cfg(target_os = \"linux\")".dependencies]
heck = "0.4"
Expand Down
1 change: 1 addition & 0 deletions core/tauri-utils/src/lib.rs
Expand Up @@ -14,6 +14,7 @@ pub mod assets;
pub mod config;
pub mod html;
pub mod io;
pub mod mime_type;
pub mod platform;
/// Prepare application resources and sidecars.
#[cfg(feature = "resources")]
Expand Down
Expand Up @@ -2,11 +2,14 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

//! Determine a mime type from a URI or file contents.

use std::fmt;

const MIMETYPE_PLAIN: &str = "text/plain";

/// [Web Compatible MimeTypes](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#important_mime_types_for_web_developers)
#[allow(missing_docs)]
pub enum MimeType {
Css,
Csv,
Expand Down

0 comments on commit 54c337e

Please sign in to comment.