Compare commits

...

20 Commits

Author SHA1 Message Date
github-actions[bot]
a8aca70151 Apply Version Updates From Current Changes (#12355)
Co-authored-by: FabianLars <30730186+FabianLars@users.noreply.github.com>
2025-01-11 18:13:55 +01:00
Fabian-Lars
cad5504455 fix(cli): Fix npm package name in tauri add (#12354) 2025-01-11 17:28:54 +01:00
renovate[bot]
f8e50e8e5b chore(deps): update rust crate tauri-winres to 0.2 (dev) (#12341)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-10 20:19:48 +01:00
renovate[bot]
cfe1af2848 chore(deps): update rust crate notify to v8 (dev) (#12342)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: FabianLars <fabianlars@fabianlars.de>
2025-01-10 20:02:53 +01:00
github-actions[bot]
89c6f08e82 Apply Version Updates From Current Changes (#12218)
Co-authored-by: FabianLars <30730186+FabianLars@users.noreply.github.com>
2025-01-10 15:08:21 +01:00
Fabian-Lars
cde0ff7798 chore: Fix clippy 1.84 warnings (#12328) 2025-01-10 13:47:37 +01:00
renovate[bot]
b0d7527250 chore(deps): update rust crate windows-registry to 0.4 (dev) (#12301)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-07 23:04:03 +01:00
renovate[bot]
a28b5013c5 chore(deps): update rust crate ico to 0.4 (dev) (#12298)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-07 22:38:43 +01:00
Fabian-Lars
b9a99a5c69 fix(cli): Skip File Access events in dev server (#12297) 2025-01-07 21:11:24 +01:00
Marco Mengelkoch
98f62e65a2 fix(cli): tauri add NPM packages for community plugins (#12246)
It currently isn't possible to simply add a community plugin the same was as adding official plugins.
Trying to perform  `npm run tauri add tauri-plugin-python` is trying to install npm package `@tauri-apps/plugin-python`.
But the npm scope `@tauri-apps/` is reserved for official tauri plugins.

The official documentation recommends to name the npm package `tauri-plugin-{name}-api` and it should be possible to have a parameter that makes it possible to install that package.

- closes #12217

This changes the command to check if the plugin is an official tauri plugin or not, using the appropriate npm package name format

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2025-01-07 10:16:35 -03:00
renovate[bot]
c130af6b06 chore(deps): update dependency rollup to v4.30.1 (dev) (#12291)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-07 13:48:40 +01:00
Lucas Fernandes Nogueira
ef21ed9ac1 fix(cli): iOS build crashing when development team has spaces (#12290)
Even though I couldn't even get the build to succeed when using the team name as the "developmentTeam" configuration (instead of the team ID), I've received reports that our processing of that value is broken and only works when it is escaped using `\"`.
2025-01-07 09:41:56 -03:00
Tony
cd1d026f97 fix: fails to build if the project path contains glob characters (#11961)
* Escape glob patterns

* Add change file

* Reword the change
2025-01-07 09:22:43 -03:00
Aurélien Jacobs
848d0e060e chore(deps): update cargo_toml for edition 2024 [fix #10412] (#12270)
Co-authored-by: Fabian-Lars <github@fabianlars.de>
2025-01-06 20:34:49 +01:00
Max Katz
ae75a353d0 chore: update copyright year (#12170)
Co-authored-by: Max Katz <zrxmax@icloud.com>
2025-01-06 13:46:06 +01:00
gerald
70f96e3222 chore(deps/driver): update hyper to version 1 (#12240)
Co-authored-by: Fabian-Lars <github@fabianlars.de>
2025-01-06 11:12:08 +01:00
renovate[bot]
3acf679c87 chore(deps): update dependency rollup to v4.30.0 (dev) (#12263)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-06 10:47:03 +01:00
renovate[bot]
22d5852208 chore(deps): update dependency rollup to v4.29.2 (dev) (#12238)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-05 14:58:18 +01:00
renovate[bot]
701778a195 chore(deps): update dependency fast-glob to v3.3.3 (dev) (#12233)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-05 12:46:30 +01:00
Patrick F.
a0f2c84d51 feat(cli): Add 64x64 png to default tauri icon command (#12204) 2025-01-04 23:26:18 +01:00
44 changed files with 1241 additions and 1377 deletions

1687
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,7 @@ PackageSupplier: Organization: The Tauri Programme in the Commons Conservancy
PackageHomePage: https://tauri.app
PackageLicenseDeclared: Apache-2.0
PackageLicenseDeclared: MIT
PackageCopyrightText: 2019-2024, The Tauri Programme in the Commons Conservancy
PackageCopyrightText: 2019-2025, The Tauri Programme in the Commons Conservancy
PackageSummary: <text>Tauri is a rust project that enables developers to make secure
and small desktop applications using a web frontend.
</text>

View File

@@ -1,5 +1,12 @@
# Changelog
## \[2.0.5]
### Bug Fixes
- [`848d0e060`](https://www.github.com/tauri-apps/tauri/commit/848d0e060e6eb3c8e9e8175adc7896587b5a947d) ([#12270](https://www.github.com/tauri-apps/tauri/pull/12270) by [@aurelj](https://www.github.com/tauri-apps/tauri/../../aurelj)) Update `cargo_toml` to `0.21.0`. This adds compatibility with Rust's 2024 Edition.
- [`cd1d026f9`](https://www.github.com/tauri-apps/tauri/commit/cd1d026f9799c26b04acb64f49e7ee0a8b193049) ([#11961](https://www.github.com/tauri-apps/tauri/pull/11961) by [@Legend-Master](https://www.github.com/tauri-apps/tauri/../../Legend-Master)) Fix tauri fails to build if the project path contains glob characters
## \[2.0.4]
### Dependencies

View File

@@ -1,6 +1,6 @@
[package]
name = "tauri-build"
version = "2.0.4"
version = "2.0.5"
description = "build time code to pair with https://crates.io/crates/tauri"
exclude = ["CHANGELOG.md", "/target"]
readme = "README.md"
@@ -33,13 +33,13 @@ tauri-utils = { version = "2.1.1", path = "../tauri-utils", features = [
"build",
"resources",
] }
cargo_toml = "0.17"
cargo_toml = "0.21"
serde = "1"
serde_json = "1"
heck = "0.5"
json-patch = "3"
walkdir = "2"
tauri-winres = "0.1"
tauri-winres = "0.2"
semver = "1"
dirs = "5"
glob = "0.3"

View File

@@ -199,7 +199,9 @@ permissions = [{default_permissions}]
}
tauri_utils::acl::build::define_permissions(
&plugin_out_dir.join("*").to_string_lossy(),
&PathBuf::from(glob::Pattern::escape(&plugin_out_dir.to_string_lossy()))
.join("*")
.to_string_lossy(),
name,
&plugin_out_dir,
|_| true,
@@ -222,10 +224,12 @@ permissions = [{default_permissions}]
);
}
permission_files.extend(tauri_utils::acl::build::define_permissions(
&default_permissions_path
.join("**")
.join("*")
.to_string_lossy(),
&PathBuf::from(glob::Pattern::escape(
&default_permissions_path.to_string_lossy(),
))
.join("**")
.join("*")
.to_string_lossy(),
name,
&plugin_out_dir,
|_| true,

View File

@@ -68,7 +68,7 @@ fn copy_binaries(
.to_string_lossy()
.replace(&format!("-{target_triple}"), "");
if package_name.map_or(false, |n| n == &file_name) {
if package_name == Some(&file_name) {
return Err(anyhow::anyhow!(
"Cannot define a sidecar with the same name as the Cargo package name `{}`. Please change the sidecar name in the filesystem and the Tauri configuration.",
file_name
@@ -506,19 +506,8 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
cfg_alias("dev", is_dev());
let ws_path = get_workspace_dir()?;
let mut manifest =
Manifest::<cargo_toml::Value>::from_slice_with_metadata(&fs::read("Cargo.toml")?)?;
if let Ok(ws_manifest) = Manifest::from_path(ws_path.join("Cargo.toml")) {
Manifest::complete_from_path_and_workspace(
&mut manifest,
Path::new("Cargo.toml"),
Some((&ws_manifest, ws_path.as_path())),
)?;
} else {
Manifest::complete_from_path(&mut manifest, Path::new("Cargo.toml"))?;
}
let cargo_toml_path = Path::new("Cargo.toml").canonicalize()?;
let mut manifest = Manifest::<cargo_toml::Value>::from_path_with_metadata(cargo_toml_path)?;
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
@@ -686,7 +675,7 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
}
}
"msvc" => {
if env::var("STATIC_VCRUNTIME").map_or(false, |v| v == "true") {
if env::var("STATIC_VCRUNTIME").is_ok_and(|v| v == "true") {
static_vcruntime::build();
}
}
@@ -701,23 +690,3 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
Ok(())
}
#[derive(serde::Deserialize)]
struct CargoMetadata {
workspace_root: PathBuf,
}
fn get_workspace_dir() -> Result<PathBuf> {
let output = std::process::Command::new("cargo")
.args(["metadata", "--no-deps", "--format-version", "1"])
.output()?;
if !output.status.success() {
return Err(anyhow::anyhow!(
"cargo metadata command exited with a non zero exit code: {}",
String::from_utf8(output.stderr)?
));
}
Ok(serde_json::from_slice::<CargoMetadata>(&output.stdout)?.workspace_root)
}

View File

@@ -1,5 +1,11 @@
# Changelog
## \[2.2.1]
### Bug Fixes
- [`cd1d026f9`](https://www.github.com/tauri-apps/tauri/commit/cd1d026f9799c26b04acb64f49e7ee0a8b193049) ([#11961](https://www.github.com/tauri-apps/tauri/pull/11961) by [@Legend-Master](https://www.github.com/tauri-apps/tauri/../../Legend-Master)) Fix tauri fails to build if the project path contains glob characters
## \[2.2.0]
### New Features

View File

@@ -1,6 +1,6 @@
[package]
name = "tauri-bundler"
version = "2.2.0"
version = "2.2.1"
authors = [
"George Burton <burtonageo@gmail.com>",
"Tauri Programme within The Commons Conservancy",
@@ -46,7 +46,7 @@ regex = "1"
[target."cfg(target_os = \"windows\")".dependencies]
bitness = "0.4"
windows-registry = "0.3"
windows-registry = "0.4"
glob = "0.3"
[target."cfg(target_os = \"windows\")".dependencies.windows-sys]

View File

@@ -70,8 +70,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<Bundle>> {
// Sign the sidecar binaries
for bin in settings.external_binaries() {
let path = bin?;
let skip =
std::env::var("TAURI_SKIP_SIDECAR_SIGNATURE_CHECK").map_or(false, |v| v == "true");
let skip = std::env::var("TAURI_SKIP_SIDECAR_SIGNATURE_CHECK").is_ok_and(|v| v == "true");
if skip {
continue;
}

View File

@@ -929,12 +929,11 @@ fn get_merge_modules(settings: &Settings) -> crate::Result<Vec<MergeModule>> {
let mut merge_modules = Vec::new();
let regex = Regex::new(r"[^\w\d\.]")?;
for msm in glob::glob(
settings
.project_out_directory()
.join("*.msm")
.to_string_lossy()
.to_string()
.as_str(),
&PathBuf::from(glob::Pattern::escape(
&settings.project_out_directory().to_string_lossy(),
))
.join("*.msm")
.to_string_lossy(),
)? {
let path = msm?;
let filename = path
@@ -1042,7 +1041,11 @@ fn generate_resource_data(settings: &Settings) -> crate::Result<ResourceMap> {
let mut dlls = Vec::new();
let out_dir = settings.project_out_directory();
for dll in glob::glob(out_dir.join("*.dll").to_string_lossy().to_string().as_str())? {
for dll in glob::glob(
&PathBuf::from(glob::Pattern::escape(&out_dir.to_string_lossy()))
.join("*.dll")
.to_string_lossy(),
)? {
let path = dll?;
let resource_path = dunce::simplified(&path);
let relative_path = path

View File

@@ -1,5 +1,27 @@
# Changelog
## \[2.2.4]
### Bug Fixes
- [`cad550445`](https://www.github.com/tauri-apps/tauri/commit/cad5504455ffa53e297cebff473c113b1afa5d29) ([#12354](https://www.github.com/tauri-apps/tauri/pull/12354) by [@FabianLars](https://www.github.com/tauri-apps/tauri/../../FabianLars)) Fixed and issue that caused `tauri add` to try to install incorrect npm packages.
## \[2.2.3]
### Enhancements
- [`a0f2c84d5`](https://www.github.com/tauri-apps/tauri/commit/a0f2c84d51f5086c5055867d6f61ea90c463a26c) ([#12204](https://www.github.com/tauri-apps/tauri/pull/12204) by [@pjf-dev](https://www.github.com/tauri-apps/tauri/../../pjf-dev)) Enhance `tauri icon` command by including 64x64 png size in default icon sizes.
### Bug Fixes
- [`98f62e65a`](https://www.github.com/tauri-apps/tauri/commit/98f62e65a27a375272c6b4d9f34c23e142b9d3a6) ([#12246](https://www.github.com/tauri-apps/tauri/pull/12246) by [@marcomq](https://www.github.com/tauri-apps/tauri/../../marcomq)) Properly add NPM packages for community plugins when using the `tauri add` command.
- [`b9a99a5c6`](https://www.github.com/tauri-apps/tauri/commit/b9a99a5c69d8a2a1a3ff30e500b46872258dca15) ([#12297](https://www.github.com/tauri-apps/tauri/pull/12297) by [@FabianLars](https://www.github.com/tauri-apps/tauri/../../FabianLars)) Fixed an issue that caused the built-in dev server to constantly refresh on Linux. This only affected users who do not have `devUrl` point to a URL.
- [`ef21ed9ac`](https://www.github.com/tauri-apps/tauri/commit/ef21ed9ac1c045c38b0c04e3d71a441694abc257) ([#12290](https://www.github.com/tauri-apps/tauri/pull/12290) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Fix iOS build failing when the development team contains spaces.
### Dependencies
- Upgraded to `tauri-bundler@2.2.1`
## \[2.2.2]
### Bug Fixes

View File

@@ -1,6 +1,6 @@
[package]
name = "tauri-cli"
version = "2.2.2"
version = "2.2.4"
authors = ["Tauri Programme within The Commons Conservancy"]
edition = "2021"
rust-version = "1.77.2"
@@ -47,12 +47,12 @@ sublime_fuzzy = "0.7"
clap_complete = "4"
clap = { version = "4", features = ["derive", "env"] }
anyhow = "1"
tauri-bundler = { version = "2.2.0", default-features = false, path = "../tauri-bundler" }
tauri-bundler = { version = "2.2.1", default-features = false, path = "../tauri-bundler" }
colored = "2"
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1", features = ["preserve_order"] }
notify = "7"
notify-debouncer-full = "0.4"
notify = "8"
notify-debouncer-full = "0.5"
shared_child = "1"
duct = "0.13"
toml_edit = { version = "0.22", features = ["serde"] }

View File

@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schema.tauri.app/config/2.2.0",
"$id": "https://schema.tauri.app/config/2.2.1",
"title": "Config",
"description": "The Tauri configuration object.\n It is read from a file where you can define your frontend assets,\n configure the bundler and define a tray icon.\n\n The configuration file is generated by the\n [`tauri init`](https://v2.tauri.app/reference/cli/#init) command that lives in\n your Tauri application source directory (src-tauri).\n\n Once generated, you may modify it at will to customize your Tauri application.\n\n ## File Formats\n\n By default, the configuration is defined as a JSON file named `tauri.conf.json`.\n\n Tauri also supports JSON5 and TOML files via the `config-json5` and `config-toml` Cargo features, respectively.\n The JSON5 file name must be either `tauri.conf.json` or `tauri.conf.json5`.\n The TOML file name is `Tauri.toml`.\n\n ## Platform-Specific Configuration\n\n In addition to the default configuration file, Tauri can\n read a platform-specific configuration from `tauri.linux.conf.json`,\n `tauri.windows.conf.json`, `tauri.macos.conf.json`, `tauri.android.conf.json` and `tauri.ios.conf.json`\n (or `Tauri.linux.toml`, `Tauri.windows.toml`, `Tauri.macos.toml`, `Tauri.android.toml` and `Tauri.ios.toml` if the `Tauri.toml` format is used),\n which gets merged with the main configuration object.\n\n ## Configuration Structure\n\n The configuration is composed of the following objects:\n\n - [`app`](#appconfig): The Tauri configuration\n - [`build`](#buildconfig): The build configuration\n - [`bundle`](#bundleconfig): The bundle configurations\n - [`plugins`](#pluginconfig): The plugins configuration\n\n Example tauri.config.json file:\n\n ```json\n {\n \"productName\": \"tauri-app\",\n \"version\": \"0.1.0\",\n \"build\": {\n \"beforeBuildCommand\": \"\",\n \"beforeDevCommand\": \"\",\n \"devUrl\": \"../dist\",\n \"frontendDist\": \"../dist\"\n },\n \"app\": {\n \"security\": {\n \"csp\": null\n },\n \"windows\": [\n {\n \"fullscreen\": false,\n \"height\": 600,\n \"resizable\": true,\n \"title\": \"Tauri App\",\n \"width\": 800\n }\n ]\n },\n \"bundle\": {},\n \"plugins\": {}\n }\n ```",
"type": "object",

View File

@@ -1,9 +1,9 @@
{
"cli.js": {
"version": "2.2.2",
"version": "2.2.4",
"node": ">= 10.0.0"
},
"tauri": "2.2.0",
"tauri-build": "2.0.3",
"tauri": "2.2.1",
"tauri-build": "2.0.4",
"tauri-plugin": "2.0.3"
}

View File

@@ -166,16 +166,15 @@ pub fn command(options: Options) -> Result<()> {
let capabilities = if let Some((expected_platforms, target_name)) = expected_capability_config {
let mut capabilities = capabilities_iter
.filter(|(capability, _path)| {
capability.platforms().map_or(
false, /* allows any target, so we should skip it since we're adding a target-specific plugin */
|platforms| {
// all platforms must be in the expected platforms list
platforms.iter().all(|p| expected_platforms.contains(&p.to_string()))
},
)
.filter(|(capability, _path)| {
capability.platforms().is_some_and(|platforms| {
// all platforms must be in the expected platforms list
platforms
.iter()
.all(|p| expected_platforms.contains(&p.to_string()))
})
.collect::<Vec<_>>();
})
.collect::<Vec<_>>();
if capabilities.is_empty() {
let identifier = format!("{target_name}-capability");

View File

@@ -49,12 +49,25 @@ pub fn run(options: Options) -> Result<()> {
.map(|(p, v)| (p, Some(v)))
.unwrap_or((&options.plugin, None));
let mut plugins = crate::helpers::plugins::known_plugins();
let (metadata, is_known) = plugins
.remove(plugin)
.map(|metadata| (metadata, true))
.unwrap_or_default();
let plugin_snake_case = plugin.replace('-', "_");
let crate_name = format!("tauri-plugin-{plugin}");
let npm_name = format!("@tauri-apps/plugin-{plugin}");
let npm_name = if is_known {
format!("@tauri-apps/plugin-{plugin}")
} else {
format!("tauri-plugin-{plugin}-api")
};
let mut plugins = crate::helpers::plugins::known_plugins();
let metadata = plugins.remove(plugin).unwrap_or_default();
if !is_known && (options.tag.is_some() || options.rev.is_some() || options.branch.is_some()) {
anyhow::bail!(
"Git options --tag, --rev and --branch can only be used with official Tauri plugins"
);
}
let frontend_dir = resolve_frontend_dir();
let tauri_dir = tauri_dir();

View File

@@ -170,8 +170,12 @@ fn watch<F: Fn() + Send + 'static>(dir: PathBuf, handler: F) {
.expect("builtin server failed to watch dir");
loop {
if rx.recv().is_ok() {
handler();
if let Ok(Ok(event)) = rx.recv() {
if let Some(event) = event.first() {
if !event.kind.is_access() {
handler();
}
}
}
}
});

View File

@@ -93,7 +93,7 @@ pub fn wix_settings(config: WixConfig) -> tauri_bundler::WixSettings {
enable_elevated_update_task: config.enable_elevated_update_task,
banner_path: config.banner_path,
dialog_image_path: config.dialog_image_path,
fips_compliant: var_os("TAURI_BUNDLER_WIX_FIPS_COMPLIANT").map_or(false, |v| v == "true"),
fips_compliant: var_os("TAURI_BUNDLER_WIX_FIPS_COMPLIANT").is_some_and(|v| v == "true"),
}
}

View File

@@ -267,7 +267,7 @@ mod sys {
}
pub(super) fn error_contended(err: &Error) -> bool {
err.raw_os_error().map_or(false, |x| x == libc::EWOULDBLOCK)
err.raw_os_error() == Some(libc::EWOULDBLOCK)
}
pub(super) fn error_unsupported(err: &Error) -> bool {

View File

@@ -52,7 +52,7 @@ pub fn parse<P: AsRef<Path>>(path: P) -> crate::Result<Pbxproj> {
State::XCBuildConfigurationObject { id } => {
if line.contains("buildSettings") {
state = State::XCBuildConfigurationObjectBuildSettings { id: id.clone() };
} else if split_at_identation(line).map_or(false, |(_ident, token)| token == "};") {
} else if split_at_identation(line).is_some_and(|(_ident, token)| token == "};") {
state = State::XCBuildConfiguration;
}
}
@@ -122,7 +122,7 @@ pub fn parse<P: AsRef<Path>>(path: P) -> crate::Result<Pbxproj> {
State::XCConfigurationListObject { id } => {
if line.contains("buildConfigurations") {
state = State::XCConfigurationListObjectBuildConfigurations { id: id.clone() };
} else if split_at_identation(line).map_or(false, |(_ident, token)| token == "};") {
} else if split_at_identation(line).is_some_and(|(_ident, token)| token == "};") {
state = State::XCConfigurationList;
}
}

View File

@@ -69,6 +69,7 @@ pub fn known_plugins() -> HashMap<&'static str, PluginMetadata> {
"shell",
"upload",
"websocket",
"opener",
] {
plugins.entry(p).or_default();
}

View File

@@ -267,13 +267,13 @@ fn ico(source: &Source, out_dir: &Path) -> Result<()> {
Ok(())
}
// Generate .png files in 32x32, 128x128, 256x256, 512x512 (icon.png)
// Generate .png files in 32x32, 64x64, 128x128, 256x256, 512x512 (icon.png)
// Main target: Linux
fn png(source: &Source, out_dir: &Path, ios_color: Rgba<u8>) -> Result<()> {
fn desktop_entries(out_dir: &Path) -> Vec<PngEntry> {
let mut entries = Vec::new();
for size in [32, 128, 256, 512] {
for size in [32, 64, 128, 256, 512] {
let file_name = match size {
256 => "128x128@2x.png".to_string(),
512 => "icon.png".to_string(),

View File

@@ -145,9 +145,9 @@ impl Interface for Rust {
manifest
};
let target_ios = target.as_ref().map_or(false, |target| {
target.ends_with("ios") || target.ends_with("ios-sim")
});
let target_ios = target
.as_ref()
.is_some_and(|target| target.ends_with("ios") || target.ends_with("ios-sim"));
if target_ios {
std::env::set_var(
"IPHONEOS_DEPLOYMENT_TARGET",

View File

@@ -156,7 +156,7 @@ pub fn build(
let out_dir = app_settings.out_dir(&options)?;
let bin_path = app_settings.app_binary_path(&options)?;
if !std::env::var("STATIC_VCRUNTIME").map_or(false, |v| v == "false") {
if !std::env::var("STATIC_VCRUNTIME").is_ok_and(|v| v == "false") {
std::env::set_var("STATIC_VCRUNTIME", "true");
}

View File

@@ -21,7 +21,7 @@ pub fn migrate(tauri_dir: &Path) -> Result<MigratedConfig> {
tauri_utils_v1::config::parse::parse_value(tauri_dir.join("tauri.conf.json"))
{
let migrated = migrate_config(&mut config)?;
if config_path.extension().map_or(false, |ext| ext == "toml") {
if config_path.extension().is_some_and(|ext| ext == "toml") {
fs::write(&config_path, toml::to_string_pretty(&config)?)?;
} else {
fs::write(&config_path, serde_json::to_string_pretty(&config)?)?;

View File

@@ -143,7 +143,7 @@ fn migrate_imports<'a>(
let has_partial_js = path
.extension()
.map_or(false, |ext| ext == "vue" || ext == "svelte");
.is_some_and(|ext| ext == "vue" || ext == "svelte");
let sources = if !has_partial_js {
vec![(SourceType::from_path(path).unwrap(), js_source, 0i64)]

View File

@@ -99,7 +99,7 @@ fn migrate_permissions(tauri_dir: &Path) -> Result<()> {
for entry in walkdir::WalkDir::new(tauri_dir.join("capabilities")) {
let entry = entry?;
let path = entry.path();
if path.extension().map_or(false, |ext| ext == "json") {
if path.extension().is_some_and(|ext| ext == "json") {
let mut capability = read_to_string(path).context("failed to read capability")?;
for plugin in core_plugins {
capability = capability.replace(&format!("\"{plugin}:"), &format!("\"core:{plugin}:"));

View File

@@ -452,7 +452,8 @@ pub fn synchronize_project_config(
}
if let Some(team) = config.development_team() {
pbxproj.set_build_settings(&build_configuration_ref.id, "DEVELOPMENT_TEAM", team);
let team = format!("\"{team}\"");
pbxproj.set_build_settings(&build_configuration_ref.id, "DEVELOPMENT_TEAM", &team);
}
pbxproj.set_build_settings(
@@ -472,11 +473,12 @@ pub fn synchronize_project_config(
}
if let Some(id) = &project_config.team_id {
pbxproj.set_build_settings(&build_configuration_ref.id, "DEVELOPMENT_TEAM", id);
let id = format!("\"{id}\"");
pbxproj.set_build_settings(&build_configuration_ref.id, "DEVELOPMENT_TEAM", &id);
pbxproj.set_build_settings(
&build_configuration_ref.id,
"\"DEVELOPMENT_TEAM[sdk=iphoneos*]\"",
id,
&id,
);
}

View File

@@ -68,7 +68,7 @@ pub fn command(options: Options) -> Result<()> {
// `xcode-script` is ran from the `gen/apple` folder when not using NPM.
// so we must change working directory to the src-tauri folder to resolve the tauri dir
if (var_os("npm_lifecycle_event").is_none() && var_os("PNPM_PACKAGE_NAME").is_none())
|| var("npm_config_user_agent").map_or(false, |agent| agent.starts_with("bun"))
|| var("npm_config_user_agent").is_ok_and(|agent| agent.starts_with("bun"))
{
set_current_dir(current_dir()?.parent().unwrap().parent().unwrap()).unwrap();
}

View File

@@ -31,7 +31,7 @@ brotli = { version = "7", optional = true, default-features = false, features =
regex = { version = "1", optional = true }
uuid = { version = "1", features = ["v4"] }
semver = "1"
ico = "0.3"
ico = "0.4"
png = "0.17"
json-patch = "3"
url = "2"

View File

@@ -1,5 +1,11 @@
# Changelog
## \[2.0.2]
### Enhancements
- [`70f96e322`](https://www.github.com/tauri-apps/tauri/commit/70f96e3222871a1931a18d6093d7efcbc59e7fee) ([#12240](https://www.github.com/tauri-apps/tauri/pull/12240) by [@getong](https://www.github.com/tauri-apps/tauri/../../getong)) Updated `hyper` to version 1. This won't affect the user facing API.
## \[2.0.1]
### What's Changed

View File

@@ -1,6 +1,6 @@
[package]
name = "tauri-driver"
version = "2.0.1"
version = "2.0.2"
authors = ["Tauri Programme within The Commons Conservancy"]
categories = ["gui", "web-programming"]
license = "Apache-2.0 OR MIT"
@@ -13,16 +13,17 @@ rust-version = "1.77.2"
[dependencies]
anyhow = "1"
hyper = { version = "0.14", features = [
"client",
"http1",
"runtime",
"server",
"stream",
"tcp",
] }
futures = "0.3"
futures-util = "0.3"
http-body-util = "0.1"
hyper = { version = "1", features = ["client", "http1", "server"] }
hyper-util = { version = "0.1", features = [
"client",
"client-legacy",
"http1",
"server",
"tokio",
] }
pico-args = "0.5"
serde = { version = "1", features = ["derive"] }
serde_json = "1"

View File

@@ -5,17 +5,24 @@
use crate::cli::Args;
use anyhow::Error;
use futures_util::TryFutureExt;
use hyper::header::CONTENT_LENGTH;
use hyper::http::uri::Authority;
use hyper::service::{make_service_fn, service_fn};
use hyper::{Body, Client, Method, Request, Response, Server};
use http_body_util::{BodyExt, Full};
use hyper::{
body::{Bytes, Incoming},
header::CONTENT_LENGTH,
http::uri::Authority,
service::service_fn,
Method, Request, Response,
};
use hyper_util::{
client::legacy::{connect::HttpConnector, Client},
rt::{TokioExecutor, TokioIo},
server::conn::auto,
};
use serde::Deserialize;
use serde_json::{json, Map, Value};
use std::convert::Infallible;
use std::path::PathBuf;
use std::process::Child;
type HttpClient = Client<hyper::client::HttpConnector>;
use tokio::net::TcpListener;
const TAURI_OPTIONS: &str = "tauri:options";
@@ -55,36 +62,46 @@ impl TauriOptions {
}
async fn handle(
client: HttpClient,
mut req: Request<Body>,
client: Client<HttpConnector, Full<Bytes>>,
req: Request<Incoming>,
args: Args,
) -> Result<Response<Body>, Error> {
) -> Result<Response<Incoming>, Error> {
// manipulate a new session to convert options to the native driver format
if let (&Method::POST, "/session") = (req.method(), req.uri().path()) {
let (mut parts, body) = req.into_parts();
let new_req: Request<Full<Bytes>> =
if let (&Method::POST, "/session") = (req.method(), req.uri().path()) {
let (mut parts, body) = req.into_parts();
// get the body from the future stream and parse it as json
let body = hyper::body::to_bytes(body).await?;
let json: Value = serde_json::from_slice(&body)?;
// get the body from the future stream and parse it as json
let body = body.collect().await?.to_bytes().to_vec();
let json: Value = serde_json::from_slice(&body)?;
// manipulate the json to convert from tauri option to native driver options
let json = map_capabilities(json);
// manipulate the json to convert from tauri option to native driver options
let json = map_capabilities(json);
// serialize json and update the content-length header to be accurate
let bytes = serde_json::to_vec(&json)?;
parts.headers.insert(CONTENT_LENGTH, bytes.len().into());
// serialize json and update the content-length header to be accurate
let bytes = serde_json::to_vec(&json)?;
parts.headers.insert(CONTENT_LENGTH, bytes.len().into());
req = Request::from_parts(parts, bytes.into());
}
Request::from_parts(parts, Full::new(bytes.into()))
} else {
let (parts, body) = req.into_parts();
let body = body.collect().await?.to_bytes().to_vec();
Request::from_parts(parts, Full::new(body.into()))
};
client
.request(forward_to_native_driver(req, args)?)
.request(forward_to_native_driver(new_req, args)?)
.err_into()
.await
}
/// Transform the request to a request for the native webdriver server.
fn forward_to_native_driver(mut req: Request<Body>, args: Args) -> Result<Request<Body>, Error> {
fn forward_to_native_driver(
mut req: Request<Full<Bytes>>,
args: Args,
) -> Result<Request<Full<Bytes>>, Error> {
let host: Authority = {
let headers = req.headers_mut();
headers.remove("host").expect("hyper request has host")
@@ -171,30 +188,44 @@ pub async fn run(args: Args, mut _driver: Child) -> Result<(), Error> {
let address = std::net::SocketAddr::from(([127, 0, 0, 1], args.port));
// the client we use to proxy requests to the native webdriver
let client = Client::builder()
let client = Client::builder(TokioExecutor::new())
.http1_preserve_header_case(true)
.http1_title_case_headers(true)
.retry_canceled_requests(false)
.build_http();
// pass a copy of the client to the http request handler
let service = make_service_fn(move |_| {
let client = client.clone();
let args = args.clone();
async move {
Ok::<_, Infallible>(service_fn(move |request| {
handle(client.clone(), request, args.clone())
}))
}
});
// set up a http1 server that uses the service we just created
Server::bind(&address)
.http1_title_case_headers(true)
.http1_preserve_header_case(true)
.http1_only(true)
.serve(service)
.await?;
let srv = async move {
if let Ok(listener) = TcpListener::bind(address).await {
loop {
let client = client.clone();
let args = args.clone();
if let Ok((stream, _)) = listener.accept().await {
let io = TokioIo::new(stream);
tokio::task::spawn(async move {
if let Err(err) = auto::Builder::new(TokioExecutor::new())
.http1()
.title_case_headers(true)
.preserve_header_case(true)
.serve_connection(
io,
service_fn(|request| handle(client.clone(), request, args.clone())),
)
.await
{
println!("Error serving connection: {:?}", err);
}
});
} else {
println!("accept new stream fail, ignore here");
}
}
} else {
println!("can not listen to address: {:?}", address);
}
};
srv.await;
#[cfg(unix)]
{

View File

@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schema.tauri.app/config/2.2.0",
"$id": "https://schema.tauri.app/config/2.2.1",
"title": "Config",
"description": "The Tauri configuration object.\n It is read from a file where you can define your frontend assets,\n configure the bundler and define a tray icon.\n\n The configuration file is generated by the\n [`tauri init`](https://v2.tauri.app/reference/cli/#init) command that lives in\n your Tauri application source directory (src-tauri).\n\n Once generated, you may modify it at will to customize your Tauri application.\n\n ## File Formats\n\n By default, the configuration is defined as a JSON file named `tauri.conf.json`.\n\n Tauri also supports JSON5 and TOML files via the `config-json5` and `config-toml` Cargo features, respectively.\n The JSON5 file name must be either `tauri.conf.json` or `tauri.conf.json5`.\n The TOML file name is `Tauri.toml`.\n\n ## Platform-Specific Configuration\n\n In addition to the default configuration file, Tauri can\n read a platform-specific configuration from `tauri.linux.conf.json`,\n `tauri.windows.conf.json`, `tauri.macos.conf.json`, `tauri.android.conf.json` and `tauri.ios.conf.json`\n (or `Tauri.linux.toml`, `Tauri.windows.toml`, `Tauri.macos.toml`, `Tauri.android.toml` and `Tauri.ios.toml` if the `Tauri.toml` format is used),\n which gets merged with the main configuration object.\n\n ## Configuration Structure\n\n The configuration is composed of the following objects:\n\n - [`app`](#appconfig): The Tauri configuration\n - [`build`](#buildconfig): The build configuration\n - [`bundle`](#bundleconfig): The bundle configurations\n - [`plugins`](#pluginconfig): The plugins configuration\n\n Example tauri.config.json file:\n\n ```json\n {\n \"productName\": \"tauri-app\",\n \"version\": \"0.1.0\",\n \"build\": {\n \"beforeBuildCommand\": \"\",\n \"beforeDevCommand\": \"\",\n \"devUrl\": \"../dist\",\n \"frontendDist\": \"../dist\"\n },\n \"app\": {\n \"security\": {\n \"csp\": null\n },\n \"windows\": [\n {\n \"fullscreen\": false,\n \"height\": 600,\n \"resizable\": true,\n \"title\": \"Tauri App\",\n \"width\": 800\n }\n ]\n },\n \"bundle\": {},\n \"plugins\": {}\n }\n ```",
"type": "object",

View File

@@ -16,3 +16,8 @@ tower-service = "0.3"
semver = { version = "1", features = ["serde"] }
serde = { version = "1", features = ["derive"] }
anyhow = "1"
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(wasm_bindgen_unstable_test_coverage)',
] }

View File

@@ -237,10 +237,7 @@ impl ResourcePathsIter<'_> {
self.current_path = None;
let pattern = match &mut self.pattern_iter {
PatternIter::Slice(iter) => match iter.next() {
Some(pattern) => pattern,
None => return None,
},
PatternIter::Slice(iter) => iter.next()?,
PatternIter::Map(iter) => match iter.next() {
Some((pattern, dest)) => {
self.current_pattern = Some(pattern.clone());

View File

@@ -1,5 +1,15 @@
# Changelog
## \[2.2.1]
### Bug Fixes
- [`cd1d026f9`](https://www.github.com/tauri-apps/tauri/commit/cd1d026f9799c26b04acb64f49e7ee0a8b193049) ([#11961](https://www.github.com/tauri-apps/tauri/pull/11961) by [@Legend-Master](https://www.github.com/tauri-apps/tauri/../../Legend-Master)) Fix tauri fails to build if the project path contains glob characters
### Dependencies
- Upgraded to `tauri-build@2.0.5`
## \[2.2.0]
### New Features

View File

@@ -1,6 +1,6 @@
[package]
name = "tauri"
version = "2.2.0"
version = "2.2.1"
description = "Make tiny, secure apps for all desktop platforms with Tauri"
exclude = ["/test", "/.scripts", "CHANGELOG.md", "/target"]
readme = "README.md"
@@ -136,8 +136,9 @@ libc = "0.2"
swift-rs = "1"
[build-dependencies]
glob = "0.3"
heck = "0.5"
tauri-build = { path = "../tauri-build/", default-features = false, version = "2.0.4" }
tauri-build = { path = "../tauri-build/", default-features = false, version = "2.0.5" }
tauri-utils = { path = "../tauri-utils/", version = "2.1.1", features = [
"build",
] }
@@ -150,7 +151,7 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1"
tauri = { path = ".", default-features = false, features = ["wry"] }
tokio = { version = "1", features = ["full"] }
cargo_toml = "0.17"
cargo_toml = "0.21"
http-range = "0.1.5"
# macOS

View File

@@ -259,7 +259,7 @@ fn main() {
// workaround needed to prevent `STATUS_ENTRYPOINT_NOT_FOUND` error in tests
// see https://github.com/tauri-apps/tauri/pull/4383#issuecomment-1212221864
let target_env = std::env::var("CARGO_CFG_TARGET_ENV");
let is_tauri_workspace = std::env::var("__TAURI_WORKSPACE__").map_or(false, |v| v == "true");
let is_tauri_workspace = std::env::var("__TAURI_WORKSPACE__").is_ok_and(|v| v == "true");
if is_tauri_workspace && target_os == "windows" && Ok("msvc") == target_env.as_deref() {
embed_manifest_for_tests();
}
@@ -376,10 +376,12 @@ permissions = [{default_permissions}]
.unwrap_or_else(|_| panic!("unable to autogenerate default permissions"));
let permissions = tauri_utils::acl::build::define_permissions(
&permissions_out_dir
.join("**")
.join("*.toml")
.to_string_lossy(),
&PathBuf::from(glob::Pattern::escape(
&permissions_out_dir.to_string_lossy(),
))
.join("**")
.join("*.toml")
.to_string_lossy(),
&format!("tauri:{plugin}"),
out_dir,
|_| true,
@@ -432,7 +434,11 @@ permissions = [{}]
.unwrap_or_else(|_| panic!("unable to autogenerate core:default set"));
let _ = tauri_utils::acl::build::define_permissions(
&permissions_out_dir.join("*.toml").to_string_lossy(),
&PathBuf::from(glob::Pattern::escape(
&permissions_out_dir.to_string_lossy(),
))
.join("*.toml")
.to_string_lossy(),
"tauri:core",
out_dir,
|_| true,

View File

@@ -26,7 +26,7 @@ fn main() {
// see https://github.com/tauri-apps/tauri/pull/4383#issuecomment-1212221864
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap();
let target_env = std::env::var("CARGO_CFG_TARGET_ENV");
let is_tauri_workspace = std::env::var("__TAURI_WORKSPACE__").map_or(false, |v| v == "true");
let is_tauri_workspace = std::env::var("__TAURI_WORKSPACE__").is_ok_and(|v| v == "true");
if is_tauri_workspace && target_os == "windows" && Ok("msvc") == target_env.as_deref() {
embed_manifest_for_tests();
}

View File

@@ -52,9 +52,9 @@
"eslint": "^9.4.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-security": "3.0.1",
"fast-glob": "3.3.2",
"fast-glob": "3.3.3",
"globals": "^15.4.0",
"rollup": "4.29.1",
"rollup": "4.30.1",
"tslib": "^2.6.3",
"typescript-eslint": "^8.1.0"
}

View File

@@ -1,5 +1,31 @@
# Changelog
## \[2.2.4]
### Bug Fixes
- [`cad550445`](https://www.github.com/tauri-apps/tauri/commit/cad5504455ffa53e297cebff473c113b1afa5d29) ([#12354](https://www.github.com/tauri-apps/tauri/pull/12354) by [@FabianLars](https://www.github.com/tauri-apps/tauri/../../FabianLars)) Fixed and issue that caused `tauri add` to try to install incorrect npm packages.
### Dependencies
- Upgraded to `tauri-cli@2.2.4`
## \[2.2.3]
### Enhancements
- [`a0f2c84d5`](https://www.github.com/tauri-apps/tauri/commit/a0f2c84d51f5086c5055867d6f61ea90c463a26c) ([#12204](https://www.github.com/tauri-apps/tauri/pull/12204) by [@pjf-dev](https://www.github.com/tauri-apps/tauri/../../pjf-dev)) Enhance `tauri icon` command by including 64x64 png size in default icon sizes.
### Bug Fixes
- [`98f62e65a`](https://www.github.com/tauri-apps/tauri/commit/98f62e65a27a375272c6b4d9f34c23e142b9d3a6) ([#12246](https://www.github.com/tauri-apps/tauri/pull/12246) by [@marcomq](https://www.github.com/tauri-apps/tauri/../../marcomq)) Properly add NPM packages for community plugins when using the `tauri add` command.
- [`b9a99a5c6`](https://www.github.com/tauri-apps/tauri/commit/b9a99a5c69d8a2a1a3ff30e500b46872258dca15) ([#12297](https://www.github.com/tauri-apps/tauri/pull/12297) by [@FabianLars](https://www.github.com/tauri-apps/tauri/../../FabianLars)) Fixed an issue that caused the built-in dev server to constantly refresh on Linux. This only affected users who do not have `devUrl` point to a URL.
- [`ef21ed9ac`](https://www.github.com/tauri-apps/tauri/commit/ef21ed9ac1c045c38b0c04e3d71a441694abc257) ([#12290](https://www.github.com/tauri-apps/tauri/pull/12290) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Fix iOS build failing when the development team contains spaces.
### Dependencies
- Upgraded to `tauri-cli@2.2.3`
## \[2.2.2]
### Bug Fixes

View File

@@ -1,6 +1,6 @@
{
"name": "@tauri-apps/cli",
"version": "2.2.2",
"version": "2.2.4",
"description": "Command line interface for building Tauri apps",
"funding": {
"type": "opencollective",

491
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff