Update kuchikiki, html5ever, tao, wry, webview2-com (#13629)

* fix: dont depend on private schemars api

* tauri-cli/deps: update kuchikiki and html5ever
tauri-utils/deps: update kuchikiki and html5ever
tauri-runtime-wry/deps: update wry to match kuchikiki and html5ever versions

* fix: specify exact patch version of schemars

Without this, cargo resolves the patch version of schemars to one that
does not include the _private module on which tauri-utils v1 depends,
which is a dependency of tauri-cli. As a result of this, the build breaks.

* tauri-utils/fix: inline tauri-utils v1 config module

* deps: upgrade and pin schemars 0.8.21 to pick up crate patch in Cargo.toml

* update tao, wry

* lint, license

* lint

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
This commit is contained in:
sftse
2025-06-24 19:39:20 +02:00
committed by GitHub
parent 3242e1c946
commit 9c16eefa31
22 changed files with 3609 additions and 208 deletions

View File

@@ -0,0 +1,7 @@
---
"tauri-cli": minor:deps
"@tauri-apps/cli": minor:deps
"tauri-utils": minor:deps
---
Update html5ever to 0.29 and kuchikiki to version 0.8.8-speedreader.

6
.changes/tao-wry-bump.md Normal file
View File

@@ -0,0 +1,6 @@
---
"tauri": minor:deps
"tauri-runtime-wry": minor:deps
---
Updated tao to 0.34, wry to 0.52 and webview2-com to 0.38.

7
.changes/x11-feature.md Normal file
View File

@@ -0,0 +1,7 @@
---
"tauri": minor:feat
"tauri-runtime-wry": minor:feat
---
Added `x11` Cargo feature (enabled by default). Disabling it is useful for apps that only support Wayland, reducing its size.
**NOTE**: When manually disabling tauri default features, you must enable the `x11` feature to support it.

248
Cargo.lock generated
View File

@@ -14,7 +14,7 @@ version = "0.1.0"
dependencies = [
"insta",
"serde_json",
"tauri-utils 2.4.0",
"tauri-utils",
]
[[package]]
@@ -569,7 +569,7 @@ dependencies = [
"http-body-util",
"hyper 1.5.2",
"hyper-util",
"itoa 1.0.14",
"itoa",
"matchit",
"memchr",
"mime",
@@ -1084,7 +1084,7 @@ dependencies = [
"serde_json",
"textwrap",
"thiserror 2.0.10",
"toml 0.8.19",
"toml",
"ureq",
"which",
"windows 0.61.1",
@@ -1121,7 +1121,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02260d489095346e5cafd04dea8e8cb54d1d74fcd759022a9b72986ebe9a1257"
dependencies = [
"serde",
"toml 0.8.19",
"toml",
]
[[package]]
@@ -1347,7 +1347,7 @@ checksum = "3b79c4069c6cad78e2e0cdfcbd26275770669fb39fd308a752dc110e83b9af32"
dependencies = [
"castaway",
"cfg-if",
"itoa 1.0.14",
"itoa",
"rustversion",
"ryu",
"static_assertions",
@@ -1617,15 +1617,15 @@ checksum = "42aaeae719fd78ce501d77c6cdf01f7e96f26bcd5617a4903a1c2b97e388543a"
[[package]]
name = "cssparser"
version = "0.27.2"
version = "0.29.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "754b69d351cdc2d8ee09ae203db831e005560fc6030da058f86ad60c92a9cb0a"
checksum = "f93d03419cb5950ccfd3daf3ff1c7a36ace64609a1a8746d493df1ca0afde0fa"
dependencies = [
"cssparser-macros",
"dtoa-short",
"itoa 0.4.8",
"itoa",
"matches",
"phf 0.8.0",
"phf 0.10.1",
"proc-macro2",
"quote",
"smallvec",
@@ -1957,7 +1957,7 @@ dependencies = [
"libc",
"option-ext",
"redox_users 0.5.0",
"windows-sys 0.59.0",
"windows-sys 0.60.2",
]
[[package]]
@@ -2183,7 +2183,7 @@ dependencies = [
"cc",
"memchr",
"rustc_version",
"toml 0.8.19",
"toml",
"vswhom",
"winreg 0.52.0",
]
@@ -2406,7 +2406,7 @@ dependencies = [
"atomic",
"pear",
"serde",
"toml 0.8.19",
"toml",
"uncased",
"version_check",
]
@@ -3179,16 +3179,14 @@ dependencies = [
[[package]]
name = "html5ever"
version = "0.26.0"
version = "0.29.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bea68cab48b8459f17cf1c944c67ddc572d272d9f2b274140f223ecb1da4a3b7"
checksum = "3b7410cae13cbc75623c98ac4cbfd1f0bedddf3227afc24f370cf0f50a44a11c"
dependencies = [
"log",
"mac",
"markup5ever",
"proc-macro2",
"quote",
"syn 1.0.109",
"match_token",
]
[[package]]
@@ -3199,7 +3197,7 @@ checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1"
dependencies = [
"bytes",
"fnv",
"itoa 1.0.14",
"itoa",
]
[[package]]
@@ -3210,7 +3208,7 @@ checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea"
dependencies = [
"bytes",
"fnv",
"itoa 1.0.14",
"itoa",
]
[[package]]
@@ -3286,7 +3284,7 @@ dependencies = [
"http-body 0.4.6",
"httparse",
"httpdate",
"itoa 1.0.14",
"itoa",
"pin-project-lite",
"socket2",
"tokio",
@@ -3309,7 +3307,7 @@ dependencies = [
"http-body 1.0.1",
"httparse",
"httpdate",
"itoa 1.0.14",
"itoa",
"pin-project-lite",
"smallvec",
"tokio",
@@ -3672,15 +3670,6 @@ dependencies = [
"serde",
]
[[package]]
name = "infer"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f551f8c3a39f68f986517db0d1759de85881894fdc7db798bd2a9df9cb04b7fc"
dependencies = [
"cfb",
]
[[package]]
name = "infer"
version = "0.19.0"
@@ -3825,12 +3814,6 @@ dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
[[package]]
name = "itoa"
version = "1.0.14"
@@ -3918,17 +3901,6 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "json-patch"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec9ad60d674508f3ca8f380a928cfe7b096bc729c4e2dbfe3852bc45da3ab30b"
dependencies = [
"serde",
"serde_json",
"thiserror 1.0.69",
]
[[package]]
name = "json-patch"
version = "3.0.1"
@@ -4084,7 +4056,7 @@ dependencies = [
"fancy-regex",
"fraction",
"idna",
"itoa 1.0.14",
"itoa",
"num-cmp",
"num-traits",
"once_cell",
@@ -4180,14 +4152,13 @@ dependencies = [
[[package]]
name = "kuchikiki"
version = "0.8.2"
version = "0.8.8-speedreader"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f29e4755b7b995046f510a7520c42b2fed58b77bd94d5a87a8eb43d2fd126da8"
checksum = "02cb977175687f33fa4afa0c95c112b987ea1443e5a51c8f8ff27dc618270cc2"
dependencies = [
"cssparser",
"html5ever",
"indexmap 1.9.3",
"matches",
"indexmap 2.7.0",
"selectors",
]
@@ -4423,18 +4394,29 @@ dependencies = [
[[package]]
name = "markup5ever"
version = "0.11.0"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a2629bb1404f3d34c2e921f21fd34ba00b206124c81f65c50b43b6aaefeb016"
checksum = "c7a7213d12e1864c0f002f52c2923d4556935a43dec5e71355c2760e0f6e7a18"
dependencies = [
"log",
"phf 0.10.1",
"phf_codegen 0.10.0",
"phf 0.11.3",
"phf_codegen 0.11.3",
"string_cache",
"string_cache_codegen",
"tendril",
]
[[package]]
name = "match_token"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88a9689d8d44bf9964484516275f5cd4c9b59457a6940c1d5d0ecbb94510a36b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.95",
]
[[package]]
name = "matches"
version = "0.1.10"
@@ -5814,9 +5796,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12"
dependencies = [
"phf_macros 0.8.0",
"phf_shared 0.8.0",
"proc-macro-hack",
]
[[package]]
@@ -5825,7 +5805,9 @@ version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259"
dependencies = [
"phf_macros 0.10.0",
"phf_shared 0.10.0",
"proc-macro-hack",
]
[[package]]
@@ -5850,12 +5832,12 @@ dependencies = [
[[package]]
name = "phf_codegen"
version = "0.10.0"
version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd"
checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a"
dependencies = [
"phf_generator 0.10.0",
"phf_shared 0.10.0",
"phf_generator 0.11.3",
"phf_shared 0.11.3",
]
[[package]]
@@ -5890,12 +5872,12 @@ dependencies = [
[[package]]
name = "phf_macros"
version = "0.8.0"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f6fde18ff429ffc8fe78e2bf7f8b7a5a5a6e2a8b58bc5a9ac69198bbda9189c"
checksum = "58fdf3184dd560f160dd73922bea2d5cd6e8f064bf4b13110abd81b03697b4e0"
dependencies = [
"phf_generator 0.8.0",
"phf_shared 0.8.0",
"phf_generator 0.10.0",
"phf_shared 0.10.0",
"proc-macro-hack",
"proc-macro2",
"quote",
@@ -7345,22 +7327,20 @@ dependencies = [
[[package]]
name = "selectors"
version = "0.22.0"
version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df320f1889ac4ba6bc0cdc9c9af7af4bd64bb927bccdf32d81140dc1f9be12fe"
checksum = "0c37578180969d00692904465fb7f6b3d50b9a2b952b87c23d0e2e5cb5013416"
dependencies = [
"bitflags 1.3.2",
"cssparser",
"derive_more 0.99.18",
"fxhash",
"log",
"matches",
"phf 0.8.0",
"phf_codegen 0.8.0",
"precomputed-hash",
"servo_arc",
"smallvec",
"thin-slice",
]
[[package]]
@@ -7480,7 +7460,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b0d7ba2887406110130a978386c4e1befb98c674b4fba677954e4db976630d9"
dependencies = [
"indexmap 2.7.0",
"itoa 1.0.14",
"itoa",
"memchr",
"ryu",
"serde",
@@ -7492,7 +7472,7 @@ version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6"
dependencies = [
"itoa 1.0.14",
"itoa",
"serde",
]
@@ -7523,7 +7503,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
dependencies = [
"form_urlencoded",
"itoa 1.0.14",
"itoa",
"ryu",
"serde",
]
@@ -7565,7 +7545,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47"
dependencies = [
"indexmap 2.7.0",
"itoa 1.0.14",
"itoa",
"ryu",
"serde",
"unsafe-libyaml",
@@ -7620,9 +7600,9 @@ dependencies = [
[[package]]
name = "servo_arc"
version = "0.1.1"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d98238b800e0d1576d8b6e3de32827c2d74bee68bb97748dcf5071fb53965432"
checksum = "d52aa42f8fdf0fed91e5ce7f23d8138441002fa31dca008acf47e6fd4721f741"
dependencies = [
"nodrop",
"stable_deref_trait",
@@ -8097,7 +8077,7 @@ version = "2.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c01c27a80b6151b0557f9ccbe89c11db571dc5f68113690c1e028d7e974bae94"
dependencies = [
"itoa 1.0.14",
"itoa",
"ryu",
"sval",
]
@@ -8108,7 +8088,7 @@ version = "2.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0deef63c70da622b2a8069d8600cf4b05396459e665862e7bdb290fd6cf3f155"
dependencies = [
"itoa 1.0.14",
"itoa",
"ryu",
"sval",
]
@@ -8268,15 +8248,15 @@ dependencies = [
"cfg-expr",
"heck 0.5.0",
"pkg-config",
"toml 0.8.19",
"toml",
"version-compare",
]
[[package]]
name = "tao"
version = "0.33.0"
version = "0.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e59c1f38e657351a2e822eadf40d6a2ad4627b9c25557bc1180ec1b3295ef82"
checksum = "49c380ca75a231b87b6c9dd86948f035012e7171d1a7c40a9c2890489a7ffd8a"
dependencies = [
"bitflags 2.7.0",
"core-foundation 0.10.0",
@@ -8391,7 +8371,7 @@ dependencies = [
"tauri-macros",
"tauri-runtime",
"tauri-runtime-wry",
"tauri-utils 2.4.0",
"tauri-utils",
"thiserror 2.0.10",
"tokio",
"tracing",
@@ -8414,16 +8394,16 @@ dependencies = [
"dirs 6.0.0",
"glob",
"heck 0.5.0",
"json-patch 3.0.1",
"json-patch",
"quote",
"schemars",
"semver",
"serde",
"serde_json",
"tauri-codegen",
"tauri-utils 2.4.0",
"tauri-utils",
"tauri-winres",
"toml 0.8.19",
"toml",
"walkdir",
]
@@ -8458,7 +8438,7 @@ dependencies = [
"tar",
"tauri-icns",
"tauri-macos-sign",
"tauri-utils 2.4.0",
"tauri-utils",
"tempfile",
"thiserror 2.0.10",
"time",
@@ -8501,7 +8481,7 @@ dependencies = [
"include_dir",
"insta",
"itertools 0.13.0",
"json-patch 3.0.1",
"json-patch",
"json5",
"jsonrpsee",
"jsonrpsee-client-transport",
@@ -8539,11 +8519,10 @@ dependencies = [
"tauri-bundler",
"tauri-icns",
"tauri-macos-sign",
"tauri-utils 1.6.0",
"tauri-utils 2.4.0",
"tauri-utils",
"tempfile",
"tokio",
"toml 0.8.19",
"toml",
"toml_edit 0.22.22",
"ureq",
"url",
@@ -8570,7 +8549,7 @@ dependencies = [
"base64 0.22.1",
"brotli",
"ico",
"json-patch 3.0.1",
"json-patch",
"plist",
"png",
"proc-macro2",
@@ -8580,7 +8559,7 @@ dependencies = [
"serde_json",
"sha2",
"syn 2.0.95",
"tauri-utils 2.4.0",
"tauri-utils",
"thiserror 2.0.10",
"time",
"url",
@@ -8658,7 +8637,7 @@ dependencies = [
"quote",
"syn 2.0.95",
"tauri-codegen",
"tauri-utils 2.4.0",
"tauri-utils",
]
[[package]]
@@ -8671,8 +8650,8 @@ dependencies = [
"schemars",
"serde",
"serde_json",
"tauri-utils 2.4.0",
"toml 0.8.19",
"tauri-utils",
"toml",
"walkdir",
]
@@ -8723,7 +8702,7 @@ dependencies = [
"raw-window-handle",
"serde",
"serde_json",
"tauri-utils 2.4.0",
"tauri-utils",
"thiserror 2.0.10",
"url",
"windows 0.61.1",
@@ -8746,7 +8725,7 @@ dependencies = [
"softbuffer",
"tao",
"tauri-runtime",
"tauri-utils 2.4.0",
"tauri-utils",
"tracing",
"url",
"webkit2gtk",
@@ -8762,7 +8741,7 @@ dependencies = [
"schemars",
"serde",
"serde_json",
"tauri-utils 2.4.0",
"tauri-utils",
"url",
]
@@ -8780,37 +8759,6 @@ dependencies = [
"worker-macros",
]
[[package]]
name = "tauri-utils"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2826db448309d382dac14d520f0c0a40839b87b57b977e59cf5f296b3ace6a93"
dependencies = [
"aes-gcm",
"ctor",
"dunce",
"getrandom 0.2.15",
"heck 0.5.0",
"html5ever",
"infer 0.13.0",
"json-patch 1.4.0",
"json5",
"kuchikiki",
"log",
"memchr",
"phf 0.11.3",
"schemars",
"semver",
"serde",
"serde_json",
"serde_with",
"serialize-to-javascript",
"thiserror 1.0.69",
"toml 0.7.8",
"url",
"windows-version",
]
[[package]]
name = "tauri-utils"
version = "2.4.0"
@@ -8825,8 +8773,8 @@ dependencies = [
"glob",
"html5ever",
"http 1.2.0",
"infer 0.19.0",
"json-patch 3.0.1",
"infer",
"json-patch",
"json5",
"kuchikiki",
"log",
@@ -8845,7 +8793,7 @@ dependencies = [
"serialize-to-javascript",
"swift-rs",
"thiserror 2.0.10",
"toml 0.8.19",
"toml",
"url",
"urlpattern",
"uuid",
@@ -8859,7 +8807,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56eaa45f707bedf34d19312c26d350bc0f3c59a47e58e8adbeecdc850d2c13a0"
dependencies = [
"embed-resource",
"toml 0.8.19",
"toml",
]
[[package]]
@@ -8929,12 +8877,6 @@ dependencies = [
"unicode-width 0.1.14",
]
[[package]]
name = "thin-slice"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c"
[[package]]
name = "thiserror"
version = "1.0.69"
@@ -8993,7 +8935,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21"
dependencies = [
"deranged",
"itoa 1.0.14",
"itoa",
"libc",
"num-conv",
"num_threads",
@@ -9180,18 +9122,6 @@ dependencies = [
"tokio",
]
[[package]]
name = "toml"
version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257"
dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
"toml_edit 0.19.15",
]
[[package]]
name = "toml"
version = "0.8.19"
@@ -9221,8 +9151,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
dependencies = [
"indexmap 2.7.0",
"serde",
"serde_spanned",
"toml_datetime",
"winnow 0.5.40",
]
@@ -10065,9 +9993,9 @@ dependencies = [
[[package]]
name = "webview2-com"
version = "0.37.0"
version = "0.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b542b5cfbd9618c46c2784e4d41ba218c336ac70d44c55e47b251033e7d85601"
checksum = "d4ba622a989277ef3886dd5afb3e280e3dd6d974b766118950a08f8f678ad6a4"
dependencies = [
"webview2-com-macros",
"webview2-com-sys",
@@ -10090,9 +10018,9 @@ dependencies = [
[[package]]
name = "webview2-com-sys"
version = "0.37.0"
version = "0.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ae2d11c4a686e4409659d7891791254cf9286d3cfe0eef54df1523533d22295"
checksum = "36695906a1b53a3bf5c4289621efedac12b73eeb0b89e7e1a89b517302d5d75c"
dependencies = [
"thiserror 2.0.10",
"windows 0.61.1",
@@ -10778,9 +10706,9 @@ checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51"
[[package]]
name = "wry"
version = "0.51.2"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c886a0a9d2a94fd90cfa1d929629b79cfefb1546e2c7430c63a47f0664c0e4e2"
checksum = "b08db04817a654a7e3339647d9cf8b497ed9ddcd4ec7cfda5a3a220c10a3bba3"
dependencies = [
"base64 0.22.1",
"block2 0.6.0",

View File

@@ -44,8 +44,8 @@ semver = "1"
dirs = "6"
glob = "0.3"
toml = "0.8"
# Our code requires at least 0.8.18 so don't simplify this to 0.8
schemars = { version = "0.8.18", features = ["preserve_order"] }
# Our code requires at least 0.8.21 so don't simplify this to 0.8
schemars = { version = "0.8.21", features = ["preserve_order"] }
[features]
default = ["config-json"]

View File

@@ -65,12 +65,6 @@ tauri-utils = { version = "2.4.0", path = "../tauri-utils", features = [
"config-toml",
"html-manipulation",
] }
tauri-utils-v1 = { version = "1", package = "tauri-utils", features = [
"isolation",
"schema",
"config-json5",
"config-toml",
] }
toml = "0.8"
jsonschema = "0.30"
handlebars = "6"
@@ -92,8 +86,8 @@ env_logger = "0.11"
icns = { package = "tauri-icns", version = "0.1" }
image = { version = "0.25", default-features = false, features = ["ico"] }
axum = { version = "0.7", features = ["ws"] }
html5ever = "0.26"
kuchiki = { package = "kuchikiki", version = "0.8" }
html5ever = "0.29"
kuchiki = { package = "kuchikiki", version = "=0.8.8-speedreader" }
tokio = { version = "1", features = ["macros", "sync"] }
common-path = "1"
serde-value = "0.7"

View File

@@ -138,7 +138,9 @@ fn inject_address(html_bytes: Vec<u8>, address: &SocketAddr) -> Vec<u8> {
}
}
let mut document = kuchiki::parse_html().one(String::from_utf8_lossy(&html_bytes).into_owned());
let mut document = kuchiki::parse_html()
.one(String::from_utf8_lossy(&html_bytes).into_owned())
.document_node;
with_html_head(&mut document, |head| {
let script = RELOAD_SCRIPT.replace("{{reload_url}}", &format!("ws://{address}/__tauri_cli"));
let script_el = NodeRef::new_element(QualName::new(None, ns!(html), "script".into()), None);

View File

@@ -18,7 +18,7 @@ use std::{
pub fn migrate(tauri_dir: &Path) -> Result<MigratedConfig> {
if let Ok((mut config, config_path)) =
tauri_utils_v1::config::parse::parse_value(tauri_dir.join("tauri.conf.json"))
tauri_utils::config_v1::parse::parse_value(tauri_dir.join("tauri.conf.json"))
{
let migrated = migrate_config(&mut config)?;
if config_path.extension().is_some_and(|ext| ext == "toml") {
@@ -375,16 +375,16 @@ fn process_security(security: &mut Map<String, Value>) -> Result<()> {
let csp = if csp_value.is_null() {
csp_value
} else {
let mut csp: tauri_utils_v1::config::Csp = serde_json::from_value(csp_value)?;
let mut csp: tauri_utils::config_v1::Csp = serde_json::from_value(csp_value)?;
match &mut csp {
tauri_utils_v1::config::Csp::Policy(csp) => {
tauri_utils::config_v1::Csp::Policy(csp) => {
if csp.contains("connect-src") {
*csp = csp.replace("connect-src", "connect-src ipc: http://ipc.localhost");
} else {
*csp = format!("{csp}; connect-src ipc: http://ipc.localhost");
}
}
tauri_utils_v1::config::Csp::DirectiveMap(csp) => {
tauri_utils::config_v1::Csp::DirectiveMap(csp) => {
if let Some(connect_src) = csp.get_mut("connect-src") {
if !connect_src.contains("ipc: http://ipc.localhost") {
connect_src.push("ipc: http://ipc.localhost");
@@ -392,7 +392,7 @@ fn process_security(security: &mut Map<String, Value>) -> Result<()> {
} else {
csp.insert(
"connect-src".into(),
tauri_utils_v1::config::CspDirectiveSources::List(vec![
tauri_utils::config_v1::CspDirectiveSources::List(vec![
"ipc: http://ipc.localhost".to_string()
]),
);
@@ -422,8 +422,8 @@ fn process_security(security: &mut Map<String, Value>) -> Result<()> {
fn process_allowlist(
tauri_config: &mut Map<String, Value>,
allowlist: Value,
) -> Result<tauri_utils_v1::config::AllowlistConfig> {
let allowlist: tauri_utils_v1::config::AllowlistConfig = serde_json::from_value(allowlist)?;
) -> Result<tauri_utils::config_v1::AllowlistConfig> {
let allowlist: tauri_utils::config_v1::AllowlistConfig = serde_json::from_value(allowlist)?;
if allowlist.protocol.asset_scope != Default::default() {
let security = tauri_config
@@ -447,7 +447,7 @@ fn process_allowlist(
}
fn allowlist_to_permissions(
allowlist: tauri_utils_v1::config::AllowlistConfig,
allowlist: tauri_utils::config_v1::AllowlistConfig,
) -> Vec<PermissionEntry> {
macro_rules! permissions {
($allowlist: ident, $permissions_list: ident, $object: ident, $field: ident => $associated_permission: expr) => {{
@@ -475,8 +475,8 @@ fn allowlist_to_permissions(
permissions!(allowlist, permissions, fs, rename_file => "fs:allow-rename");
permissions!(allowlist, permissions, fs, exists => "fs:allow-exists");
let (fs_allowed, fs_denied) = match allowlist.fs.scope {
tauri_utils_v1::config::FsAllowlistScope::AllowedPaths(paths) => (paths, Vec::new()),
tauri_utils_v1::config::FsAllowlistScope::Scope { allow, deny, .. } => (allow, deny),
tauri_utils::config_v1::FsAllowlistScope::AllowedPaths(paths) => (paths, Vec::new()),
tauri_utils::config_v1::FsAllowlistScope::Scope { allow, deny, .. } => (allow, deny),
};
if !(fs_allowed.is_empty() && fs_denied.is_empty()) {
let fs_allowed = fs_allowed
@@ -568,7 +568,7 @@ fn allowlist_to_permissions(
|| allowlist.shell.all
|| !matches!(
allowlist.shell.open,
tauri_utils_v1::config::ShellAllowlistOpen::Flag(false)
tauri_utils::config_v1::ShellAllowlistOpen::Flag(false)
)
{
permissions.push(PermissionEntry::PermissionRef(
@@ -990,7 +990,7 @@ mod test {
#[test]
fn can_migrate_default_config() {
let original = serde_json::to_value(tauri_utils_v1::config::Config::default()).unwrap();
let original = serde_json::to_value(tauri_utils::config_v1::Config::default()).unwrap();
migrate(&original);
}

View File

@@ -8,7 +8,7 @@ use crate::{
};
use anyhow::Context;
use tauri_utils_v1::config::Allowlist;
use tauri_utils::config_v1::Allowlist;
use toml_edit::{DocumentMut, Entry, Item, TableLike, Value};
use std::path::Path;
@@ -163,7 +163,7 @@ fn features_to_rename() -> Vec<(&'static str, &'static str)> {
}
fn features_to_remove() -> Vec<&'static str> {
let mut features_to_remove = tauri_utils_v1::config::AllowlistConfig::all_features();
let mut features_to_remove = tauri_utils::config_v1::AllowlistConfig::all_features();
features_to_remove.extend(&[
"reqwest-client",
"http-multipart",

View File

@@ -36,8 +36,8 @@ tauri-utils = { version = "2.4.0", default-features = false, features = [
serde_json = { version = "1", optional = true }
glob = { version = "0.3", optional = true }
toml = { version = "0.8", optional = true }
# Our code requires at least 0.8.18 so don't simplify this to 0.8
schemars = { version = "0.8.18", features = ["preserve_order"] }
# Our code requires at least 0.8.21 so don't simplify this to 0.8
schemars = { version = "0.8.21", features = ["preserve_order"] }
walkdir = { version = "2", optional = true }
[target."cfg(target_os = \"macos\")".dependencies]

View File

@@ -17,13 +17,13 @@ rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
wry = { version = "0.51.2", default-features = false, features = [
wry = { version = "0.52", default-features = false, features = [
"drag-drop",
"protocol",
"os-webview",
"linux-body",
] }
tao = { version = "0.33", default-features = false, features = ["rwh_06"] }
tao = { version = "0.34", default-features = false, features = ["rwh_06"] }
tauri-runtime = { version = "2.6.0", path = "../tauri-runtime" }
tauri-utils = { version = "2.4.0", path = "../tauri-utils" }
raw-window-handle = "0.6"
@@ -33,7 +33,7 @@ tracing = { version = "0.1", optional = true }
log = "0.4.21"
[target."cfg(windows)".dependencies]
webview2-com = "0.37"
webview2-com = "0.38"
softbuffer = { version = "0.4", default-features = false }
once_cell = "1.20"
@@ -65,7 +65,9 @@ objc2-app-kit = { version = "0.3", features = [
jni = "0.21"
[features]
default = ["x11"]
devtools = ["wry/devtools", "tauri-runtime/devtools"]
x11 = ["tao/x11", "wry/x11"]
macos-private-api = [
"wry/fullscreen",
"wry/transparent",

View File

@@ -4473,7 +4473,7 @@ You may have it installed on another user account, but it is not available for t
}
};
let mut webview_builder = WebViewBuilder::with_web_context(&mut web_context.inner)
let mut webview_builder = WebViewBuilder::new_with_web_context(&mut web_context.inner)
.with_id(&label)
.with_focused(webview_attributes.focus)
.with_url(&url)

View File

@@ -6,7 +6,7 @@ publish = false
[build-dependencies]
tauri-utils = { features = ["schema"], path = "../tauri-utils" }
schemars = { version = "0.8.18", features = ["url", "preserve_order"] }
schemars = { version = "0.8.21", features = ["url", "preserve_order"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
url = { version = "2", features = ["serde"] }

View File

@@ -22,12 +22,12 @@ brotli = { version = "8", optional = true, default-features = false, features =
"std",
] }
url = { version = "2", features = ["serde"] }
html5ever = { version = "0.26", optional = true }
kuchiki = { package = "kuchikiki", version = "0.8", optional = true }
html5ever = { version = "0.29", optional = true }
kuchiki = { package = "kuchikiki", version = "0.8.8-speedreader", optional = true }
proc-macro2 = { version = "1", optional = true }
quote = { version = "1", optional = true }
# Our code requires at least 0.8.18 so don't change this to 0.8
schemars = { version = "0.8.18", features = ["url", "uuid1"], optional = true }
# Our code requires at least 0.8.21 so don't change this to 0.8
schemars = { version = "0.8.21", features = ["url", "uuid1"], optional = true }
serde_with = "3"
aes-gcm = { version = "0.10", optional = true }
getrandom = { version = "0.2", optional = true, features = ["std"] }

View File

@@ -25,6 +25,8 @@
use http::response::Builder;
#[cfg(feature = "schema")]
use schemars::schema::Schema;
#[cfg(feature = "schema")]
use schemars::JsonSchema;
use semver::Version;
use serde::{
@@ -44,6 +46,18 @@ use std::{
str::FromStr,
};
#[cfg(feature = "schema")]
fn add_description(schema: Schema, description: impl Into<String>) -> Schema {
let value = description.into();
if value.is_empty() {
schema
} else {
let mut schema_obj = schema.into_object();
schema_obj.metadata().description = value.into();
Schema::Object(schema_obj)
}
}
/// Items to help with parsing content into a [`Config`].
pub mod parse;
@@ -221,14 +235,11 @@ impl schemars::JsonSchema for BundleTarget {
..Default::default()
}
.into(),
schemars::_private::metadata::add_description(
add_description(
gen.subschema_for::<Vec<BundleType>>(),
"A list of bundle targets.",
),
schemars::_private::metadata::add_description(
gen.subschema_for::<BundleType>(),
"A single bundle target.",
),
add_description(gen.subschema_for::<BundleType>(), "A single bundle target."),
];
schemars::schema::SchemaObject {

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,253 @@
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use serde::de::DeserializeOwned;
use serde_json::Value;
use std::ffi::OsStr;
use std::path::{Path, PathBuf};
use thiserror::Error;
/// All extensions that are possibly supported, but perhaps not enabled.
const EXTENSIONS_SUPPORTED: &[&str] = &["json", "json5", "toml"];
/// All configuration formats that are currently enabled.
const ENABLED_FORMATS: &[ConfigFormat] = &[
ConfigFormat::Json,
#[cfg(feature = "config-json5")]
ConfigFormat::Json5,
#[cfg(feature = "config-toml")]
ConfigFormat::Toml,
];
/// The available configuration formats.
#[derive(Debug, Copy, Clone)]
enum ConfigFormat {
/// The default JSON (tauri.conf.json) format.
Json,
/// The JSON5 (tauri.conf.json5) format.
Json5,
/// The TOML (Tauri.toml file) format.
Toml,
}
impl ConfigFormat {
/// Maps the config format to its file name.
fn into_file_name(self) -> &'static str {
match self {
Self::Json => "tauri.conf.json",
Self::Json5 => "tauri.conf.json5",
Self::Toml => "Tauri.toml",
}
}
fn into_platform_file_name(self) -> &'static str {
match self {
Self::Json => {
if cfg!(target_os = "macos") {
"tauri.macos.conf.json"
} else if cfg!(windows) {
"tauri.windows.conf.json"
} else {
"tauri.linux.conf.json"
}
}
Self::Json5 => {
if cfg!(target_os = "macos") {
"tauri.macos.conf.json5"
} else if cfg!(windows) {
"tauri.windows.conf.json5"
} else {
"tauri.linux.conf.json5"
}
}
Self::Toml => {
if cfg!(target_os = "macos") {
"Tauri.macos.toml"
} else if cfg!(windows) {
"Tauri.windows.toml"
} else {
"Tauri.linux.toml"
}
}
}
}
}
/// Represents all the errors that can happen while reading the config.
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum ConfigError {
/// Failed to parse from JSON.
#[error("unable to parse JSON Tauri config file at {path} because {error}")]
FormatJson {
/// The path that failed to parse into JSON.
path: PathBuf,
/// The parsing [`serde_json::Error`].
error: serde_json::Error,
},
/// Failed to parse from JSON5.
#[cfg(feature = "config-json5")]
#[error("unable to parse JSON5 Tauri config file at {path} because {error}")]
FormatJson5 {
/// The path that failed to parse into JSON5.
path: PathBuf,
/// The parsing [`json5::Error`].
error: ::json5::Error,
},
/// Failed to parse from TOML.
#[cfg(feature = "config-toml")]
#[error("unable to parse toml Tauri config file at {path} because {error}")]
FormatToml {
/// The path that failed to parse into TOML.
path: PathBuf,
/// The parsing [`toml::Error`].
error: ::toml::de::Error,
},
/// Unknown config file name encountered.
#[error("unsupported format encountered {0}")]
UnsupportedFormat(String),
/// Known file extension encountered, but corresponding parser is not enabled (cargo features).
#[error("supported (but disabled) format encountered {extension} - try enabling `{feature}` ")]
DisabledFormat {
/// The extension encountered.
extension: String,
/// The cargo feature to enable it.
feature: String,
},
/// A generic IO error with context of what caused it.
#[error("unable to read Tauri config file at {path} because {error}")]
Io {
/// The path the IO error occurred on.
path: PathBuf,
/// The [`std::io::Error`].
error: std::io::Error,
},
}
/// See [`parse`] for specifics, returns a JSON [`Value`] instead of [`Config`].
pub fn parse_value(path: impl Into<PathBuf>) -> Result<(Value, PathBuf), ConfigError> {
do_parse(path.into())
}
fn do_parse<D: DeserializeOwned>(path: PathBuf) -> Result<(D, PathBuf), ConfigError> {
let file_name = path
.file_name()
.map(OsStr::to_string_lossy)
.unwrap_or_default();
let lookup_platform_config = ENABLED_FORMATS
.iter()
.any(|format| file_name == format.into_platform_file_name());
let json5 = path.with_file_name(if lookup_platform_config {
ConfigFormat::Json5.into_platform_file_name()
} else {
ConfigFormat::Json5.into_file_name()
});
let toml = path.with_file_name(if lookup_platform_config {
ConfigFormat::Toml.into_platform_file_name()
} else {
ConfigFormat::Toml.into_file_name()
});
let path_ext = path
.extension()
.map(OsStr::to_string_lossy)
.unwrap_or_default();
if path.exists() {
let raw = read_to_string(&path)?;
// to allow us to easily use the compile-time #[cfg], we always bind
#[allow(clippy::let_and_return)]
let json = do_parse_json(&raw, &path);
// we also want to support **valid** json5 in the .json extension if the feature is enabled.
// if the json5 is not valid the serde_json error for regular json will be returned.
// this could be a bit confusing, so we may want to encourage users using json5 to use the
// .json5 extension instead of .json
#[cfg(feature = "config-json5")]
let json = {
match do_parse_json5(&raw, &path) {
json5 @ Ok(_) => json5,
// assume any errors from json5 in a .json file is because it's not json5
Err(_) => json,
}
};
json.map(|j| (j, path))
} else if json5.exists() {
#[cfg(feature = "config-json5")]
{
let raw = read_to_string(&json5)?;
do_parse_json5(&raw, &path).map(|config| (config, json5))
}
#[cfg(not(feature = "config-json5"))]
Err(ConfigError::DisabledFormat {
extension: ".json5".into(),
feature: "config-json5".into(),
})
} else if toml.exists() {
#[cfg(feature = "config-toml")]
{
let raw = read_to_string(&toml)?;
do_parse_toml(&raw, &path).map(|config| (config, toml))
}
#[cfg(not(feature = "config-toml"))]
Err(ConfigError::DisabledFormat {
extension: ".toml".into(),
feature: "config-toml".into(),
})
} else if !EXTENSIONS_SUPPORTED.contains(&path_ext.as_ref()) {
Err(ConfigError::UnsupportedFormat(path_ext.to_string()))
} else {
Err(ConfigError::Io {
path,
error: std::io::ErrorKind::NotFound.into(),
})
}
}
fn do_parse_json<D: DeserializeOwned>(raw: &str, path: &Path) -> Result<D, ConfigError> {
serde_json::from_str(raw).map_err(|error| ConfigError::FormatJson {
path: path.into(),
error,
})
}
#[cfg(feature = "config-json5")]
fn do_parse_json5<D: DeserializeOwned>(raw: &str, path: &Path) -> Result<D, ConfigError> {
::json5::from_str(raw).map_err(|error| ConfigError::FormatJson5 {
path: path.into(),
error,
})
}
#[cfg(feature = "config-toml")]
fn do_parse_toml<D: DeserializeOwned>(raw: &str, path: &Path) -> Result<D, ConfigError> {
::toml::from_str(raw).map_err(|error| ConfigError::FormatToml {
path: path.into(),
error,
})
}
/// Helper function to wrap IO errors from [`std::fs::read_to_string`] into a [`ConfigError`].
fn read_to_string(path: &Path) -> Result<String, ConfigError> {
std::fs::read_to_string(path).map_err(|error| ConfigError::Io {
path: path.into(),
error,
})
}

View File

@@ -112,7 +112,7 @@ pub fn serialize_node(node: &NodeRef) -> Vec<u8> {
/// Parses the given HTML string.
pub fn parse(html: String) -> NodeRef {
kuchiki::parse_html().one(html)
kuchiki::parse_html().one(html).document_node
}
fn with_head<F: FnOnce(&NodeRef)>(document: &NodeRef, f: F) {
@@ -288,7 +288,6 @@ pub fn inline_isolation(document: &NodeRef, dir: &Path) {
#[cfg(test)]
mod tests {
use kuchiki::traits::*;
#[test]
fn csp() {
@@ -297,7 +296,7 @@ mod tests {
"<html></html>".to_string(),
];
for html in htmls {
let document = kuchiki::parse_html().one(html);
let document = super::parse(html);
let csp = "csp-string";
super::inject_csp(&document, csp);
assert_eq!(

View File

@@ -23,6 +23,7 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};
pub mod acl;
pub mod assets;
pub mod config;
pub mod config_v1;
#[cfg(feature = "html-manipulation")]
pub mod html;
pub mod io;

View File

@@ -61,7 +61,7 @@ tauri-macros = { version = "2.2.0", path = "../tauri-macros" }
tauri-utils = { version = "2.4.0", features = [
"resources",
], path = "../tauri-utils" }
tauri-runtime-wry = { version = "2.6.0", path = "../tauri-runtime-wry", optional = true }
tauri-runtime-wry = { version = "2.6.0", path = "../tauri-runtime-wry", default-features = false, optional = true }
getrandom = "0.2"
serde_repr = "0.1"
http = "1"
@@ -122,7 +122,7 @@ window-vibrancy = "0.6"
# windows
[target."cfg(windows)".dependencies]
webview2-com = { version = "0.37", optional = true }
webview2-com = { version = "0.38", optional = true }
window-vibrancy = "0.6"
windows = { version = "0.61", features = [
"Win32_Foundation",
@@ -179,8 +179,9 @@ objc2-web-kit = { version = "0.3", features = [
] }
[features]
default = ["wry", "compression", "common-controls-v6", "dynamic-acl"]
default = ["wry", "compression", "common-controls-v6", "dynamic-acl", "x11"]
unstable = ["tauri-runtime-wry?/unstable"]
x11 = ["tauri-runtime-wry?/x11"]
common-controls-v6 = [
"tray-icon?/common-controls-v6",
"muda/common-controls-v6",

View File

@@ -12,6 +12,7 @@
//!
//! - **wry** *(enabled by default)*: Enables the [wry](https://github.com/tauri-apps/wry) runtime. Only disable it if you want a custom runtime.
//! - **common-controls-v6** *(enabled by default)*: Enables [Common Controls v6](https://learn.microsoft.com/en-us/windows/win32/controls/common-control-versions) support on Windows, mainly for the predefined `about` menu item.
//! - **x11** *(enabled by default)*: Enables X11 support. Disable this if you only target Wayland.
//! - **unstable**: Enables unstable features. Be careful, it might introduce breaking changes in future minor releases.
//! - **tracing**: Enables [`tracing`](https://docs.rs/tracing/latest/tracing) for window startup, plugins, `Window::eval`, events, IPC, updater and custom protocol request handlers.
//! - **test**: Enables the [`mod@test`] module exposing unit test helpers.

View File

@@ -461,7 +461,7 @@ impl<R: Runtime> WebviewManager<R> {
if html.contains('<') && html.contains('>') {
let document = tauri_utils::html::parse(html);
tauri_utils::html::inject_csp(&document, &csp.to_string());
url.set_path(&format!("{},{}", mime::TEXT_HTML, document.to_string()));
url.set_path(&format!("{},{document}", mime::TEXT_HTML));
}
}
}