diff --git a/.changes/specta-feature.md b/.changes/specta-feature.md new file mode 100644 index 00000000..86e0f2e8 --- /dev/null +++ b/.changes/specta-feature.md @@ -0,0 +1,8 @@ +--- +geolocation: patch +geolocation-js: patch +haptics: patch +haptics-js: patch +--- + +**Breaking change:** `specta` integration is now behind a `specta` feature flag like in Tauri. diff --git a/.changes/specta.md b/.changes/specta.md new file mode 100644 index 00000000..3542780f --- /dev/null +++ b/.changes/specta.md @@ -0,0 +1,8 @@ +--- +geolocation: patch +geolocation-js: patch +haptics: patch +haptics-js: patch +--- + +Unlock and widen `specta` version range to match Tauri. No API changes. diff --git a/Cargo.lock b/Cargo.lock index 729d187e..108bf8ad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -876,9 +876,9 @@ dependencies = [ [[package]] name = "cargo_toml" -version = "0.17.2" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a969e13a7589e9e3e4207e153bae624ade2b5622fb4684a4923b23ec3d57719" +checksum = "5fbd1fe9db3ebf71b89060adaf7b0504c2d6a425cf061313099547e382c2e472" dependencies = [ "serde", "toml 0.8.19", @@ -3370,7 +3370,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -3859,7 +3859,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate 3.2.0", "proc-macro2", "quote", "syn 2.0.90", @@ -5793,18 +5793,6 @@ dependencies = [ "syn 2.0.90", ] -[[package]] -name = "specta-util" -version = "0.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8113d65b58a6de3184b01d6df9e50b6d4bbe7f724251f576d84f23228824456" -dependencies = [ - "ctor", - "serde", - "specta", - "specta-macros", -] - [[package]] name = "spin" version = "0.9.8" @@ -6324,9 +6312,9 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tauri" -version = "2.2.0" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e2e3349fbb2be7af9fad1b43d61ac83ba55ab48d47fbe1b2732f0c8211610a9" +checksum = "2979ec5ec5a9310b15d1548db3b8de98d8f75abf2b5b00fec9cd5c0553ecc09c" dependencies = [ "anyhow", "bytes", @@ -6358,7 +6346,6 @@ dependencies = [ "serde_repr", "serialize-to-javascript", "specta", - "specta-util", "swift-rs", "tauri-build", "tauri-macros", @@ -6379,9 +6366,9 @@ dependencies = [ [[package]] name = "tauri-build" -version = "2.0.4" +version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b274ec7239ada504deb615f1c8abd7ba99631e879709e6f10e5d17217058d976" +checksum = "8e950124f6779c6cf98e3260c7a6c8488a74aa6350dd54c6950fdaa349bca2df" dependencies = [ "anyhow", "cargo_toml", @@ -6587,7 +6574,6 @@ dependencies = [ "serde", "serde_json", "specta", - "specta-util", "tauri", "tauri-plugin", "thiserror 2.0.9", @@ -6614,7 +6600,6 @@ dependencies = [ "serde", "serde_json", "specta", - "specta-util", "tauri", "tauri-plugin", "thiserror 2.0.9", @@ -8101,7 +8086,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index e31c9867..d85be889 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,14 +21,9 @@ thiserror = "2" url = "2" schemars = "0.8" dunce = "1" -specta = "=2.0.0-rc.20" -# TODO: remove when specta releases rc.21 -specta-util = { version = "^0.0.7", default-features = false, features = [ - "export", -] } +specta = "^2.0.0-rc.16" glob = "0.3" zbus = "5" -#tauri-specta = "=2.0.0-rc.11" [workspace.package] edition = "2021" diff --git a/plugins/geolocation/Cargo.toml b/plugins/geolocation/Cargo.toml index 86b8e461..5c5537c0 100644 --- a/plugins/geolocation/Cargo.toml +++ b/plugins/geolocation/Cargo.toml @@ -26,11 +26,13 @@ tauri-plugin = { workspace = true, features = ["build"] } [dependencies] serde = { workspace = true } serde_json = { workspace = true } -tauri = { workspace = true, features = ["specta"] } +tauri = { workspace = true } log = { workspace = true } thiserror = { workspace = true } -specta = { workspace = true } -specta-util = { workspace = true } +specta = { workspace = true, optional = true } [target.'cfg(target_os = "ios")'.dependencies] tauri = { workspace = true, features = ["wry"] } + +[features] +specta = ["dep:specta", "tauri/specta"] diff --git a/plugins/geolocation/src/lib.rs b/plugins/geolocation/src/lib.rs index eed4a475..55f50aa0 100644 --- a/plugins/geolocation/src/lib.rs +++ b/plugins/geolocation/src/lib.rs @@ -7,8 +7,6 @@ use tauri::{ Manager, Runtime, }; -//use tauri_specta::*; - pub use models::*; #[cfg(desktop)] @@ -27,24 +25,6 @@ use desktop::Geolocation; #[cfg(mobile)] use mobile::Geolocation; -/* macro_rules! specta_builder { - () => { - ts::builder() - .commands(collect_commands![ - commands::get_current_position, - commands::watch_position, - commands::clear_watch, - commands::check_permissions, - commands::request_permissions - ]) - .header("// @ts-nocheck") - .config( - specta::ts::ExportConfig::default() - .bigint(specta::ts::BigIntExportBehavior::Number), - ) - }; -} */ - /// Extensions to [`tauri::App`], [`tauri::AppHandle`], [`tauri::WebviewWindow`], [`tauri::Webview`] and [`tauri::Window`] to access the geolocation APIs. pub trait GeolocationExt { fn geolocation(&self) -> &Geolocation; @@ -58,9 +38,6 @@ impl> crate::GeolocationExt for T { /// Initializes the plugin. pub fn init() -> TauriPlugin { - /* let (invoke_handler, register_events) = - specta_builder!().build_plugin_utils("geolocation").unwrap(); */ - Builder::new("geolocation") .invoke_handler(tauri::generate_handler![ commands::get_current_position, @@ -79,22 +56,3 @@ pub fn init() -> TauriPlugin { }) .build() } - -/* #[cfg(test)] -mod test { - use super::*; - - #[test] - fn export_types() { - specta_builder!() - .path("./guest-js/bindings.ts") - .config( - specta::ts::ExportConfig::default() - .formatter(specta::ts::formatter::prettier) - .bigint(specta::ts::BigIntExportBehavior::Number), - ) - .export_for_plugin("geolocation") - .expect("failed to export specta types"); - } -} - */ diff --git a/plugins/haptics/Cargo.toml b/plugins/haptics/Cargo.toml index f18672f9..924f1830 100644 --- a/plugins/haptics/Cargo.toml +++ b/plugins/haptics/Cargo.toml @@ -26,11 +26,13 @@ tauri-plugin = { workspace = true, features = ["build"] } [dependencies] serde = { workspace = true } serde_json = { workspace = true } -tauri = { workspace = true, features = ["specta"] } +tauri = { workspace = true } log = { workspace = true } thiserror = { workspace = true } -specta = { workspace = true } -specta-util = { workspace = true } +specta = { workspace = true, optional = true } [target.'cfg(target_os = "ios")'.dependencies] tauri = { workspace = true, features = ["wry"] } + +[features] +specta = ["dep:specta", "tauri/specta"] diff --git a/plugins/haptics/src/lib.rs b/plugins/haptics/src/lib.rs index 0a727e14..f56e5212 100644 --- a/plugins/haptics/src/lib.rs +++ b/plugins/haptics/src/lib.rs @@ -7,8 +7,6 @@ use tauri::{ Manager, Runtime, }; -//use tauri_specta::*; - pub use models::*; #[cfg(desktop)] @@ -27,23 +25,6 @@ use desktop::Haptics; #[cfg(mobile)] use mobile::Haptics; -/* macro_rules! specta_builder { - () => { - ts::builder() - .commands(collect_commands![ - commands::vibrate, - commands::impact_feedback, - commands::notification_feedback, - commands::selection_feedback - ]) - .header("// @ts-nocheck") - .config( - specta::ts::ExportConfig::default() - .bigint(specta::ts::BigIntExportBehavior::Number), - ) - }; -} */ - /// Extensions to [`tauri::App`], [`tauri::AppHandle`], [`tauri::WebviewWindow`], [`tauri::Webview`] and [`tauri::Window`] to access the haptics APIs. pub trait HapticsExt { fn haptics(&self) -> &Haptics; @@ -57,9 +38,6 @@ impl> crate::HapticsExt for T { /// Initializes the plugin. pub fn init() -> TauriPlugin { - /* let (invoke_handler, register_events) = - specta_builder!().build_plugin_utils("haptics").unwrap(); */ - Builder::new("haptics") .invoke_handler(tauri::generate_handler![ commands::vibrate, @@ -77,22 +55,3 @@ pub fn init() -> TauriPlugin { }) .build() } - -/* #[cfg(test)] -mod test { - use super::*; - - #[test] - fn export_types() { - specta_builder!() - .path("./guest-js/bindings.ts") - .config( - specta::ts::ExportConfig::default() - .formatter(specta::ts::formatter::prettier) - .bigint(specta::ts::BigIntExportBehavior::Number), - ) - .export_for_plugin("haptics") - .expect("failed to export specta types"); - } -} - */