Skip to content

Commit 54c337e

Browse files
feat(cli): hotreload support for frontend static files, closes #2173 (#5256)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
1 parent e8e2853 commit 54c337e

13 files changed

Lines changed: 471 additions & 30 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"cli.rs": "minor"
3+
---
4+
5+
Hot-reload the frontend when `tauri.conf.json > build > devPath` points to a directory.

.changes/utils-mimetype.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri-utils": "patch"
3+
---
4+
5+
Add `mime_type` module.

core/tauri-runtime/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ tauri-utils = { version = "1.1.1", path = "../tauri-utils" }
3030
uuid = { version = "1", features = [ "v4" ] }
3131
http = "0.2.4"
3232
http-range = "0.1.4"
33-
infer = "0.7"
3433
raw-window-handle = "0.5"
3534
rand = "0.8"
3635

core/tauri-runtime/src/http/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
// SPDX-License-Identifier: MIT
44

55
// custom wry types
6-
mod mime_type;
76
mod request;
87
mod response;
98

109
pub use self::{
11-
mime_type::MimeType,
1210
request::{Request, RequestParts},
1311
response::{Builder as ResponseBuilder, Response, ResponseParts},
1412
};
1513

14+
pub use tauri_utils::mime_type::MimeType;
15+
1616
// re-expose default http types
1717
pub use http::{header, method, status, uri::InvalidUri, version, Uri};
1818

core/tauri-utils/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ glob = { version = "0.3.0", optional = true }
3535
walkdir = { version = "2", optional = true }
3636
memchr = "2.4"
3737
semver = "1"
38+
infer = "0.7"
3839

3940
[target."cfg(target_os = \"linux\")".dependencies]
4041
heck = "0.4"

core/tauri-utils/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pub mod assets;
1414
pub mod config;
1515
pub mod html;
1616
pub mod io;
17+
pub mod mime_type;
1718
pub mod platform;
1819
/// Prepare application resources and sidecars.
1920
#[cfg(feature = "resources")]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
// SPDX-License-Identifier: Apache-2.0
33
// SPDX-License-Identifier: MIT
44

5+
//! Determine a mime type from a URI or file contents.
6+
57
use std::fmt;
68

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

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

0 commit comments

Comments
 (0)