diff --git a/.changes/add-mobile-to-plugin.md b/.changes/add-mobile-to-plugin.md index fcb3d854d..e3c15a50d 100644 --- a/.changes/add-mobile-to-plugin.md +++ b/.changes/add-mobile-to-plugin.md @@ -1,6 +1,6 @@ --- -"tauri-cli": minor -"@tauri-apps/cli": minor +"tauri-cli": 'minor:feat' +"@tauri-apps/cli": 'minor:feat' --- Added `plugin android add` and `plugin ios add` commands to add mobile plugin functionality to existing projects. diff --git a/.changes/add-tauri-get-version.md b/.changes/add-tauri-get-version.md index 03e8cd04d..2e5013db6 100644 --- a/.changes/add-tauri-get-version.md +++ b/.changes/add-tauri-get-version.md @@ -1,5 +1,5 @@ --- -'tauri': minor:feat +'tauri': 'minor:feat' --- Added `tauri::VERSION` const to get Tauri's version from Rust. diff --git a/.changes/add-webview-version.md b/.changes/add-webview-version.md index 0ec104eaf..71808812d 100644 --- a/.changes/add-webview-version.md +++ b/.changes/add-webview-version.md @@ -1,5 +1,5 @@ --- -'tauri': minor:feat +'tauri': 'minor:feat' --- Added `tauri::webview_version` , to get webview version. diff --git a/.changes/android-apis-runtime.md b/.changes/android-apis-runtime.md index fe424fc4f..fe14fb143 100644 --- a/.changes/android-apis-runtime.md +++ b/.changes/android-apis-runtime.md @@ -1,6 +1,6 @@ --- -"tauri-runtime": minor -"tauri-runtime-wry": minor +"tauri-runtime": 'minor:feat' +"tauri-runtime-wry": 'minor:feat' --- Add `find_class`, `run_on_android_context` on `RuntimeHandle`. diff --git a/.changes/android-buildsrc-gitignore.md b/.changes/android-buildsrc-gitignore.md index 93b811aa2..9f0ee5f4c 100644 --- a/.changes/android-buildsrc-gitignore.md +++ b/.changes/android-buildsrc-gitignore.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Do not gitignore the Android project's `buildSrc` folder by default since we removed absolute paths from it. diff --git a/.changes/android-enhance-method-parse.md b/.changes/android-enhance-method-parse.md index 0c53b4c56..165f6868d 100644 --- a/.changes/android-enhance-method-parse.md +++ b/.changes/android-enhance-method-parse.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Enhance parsing of annotated Android plugin methods to support private functions. diff --git a/.changes/android-load-config.md b/.changes/android-load-config.md index 0130d2a32..021322029 100644 --- a/.changes/android-load-config.md +++ b/.changes/android-load-config.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Added static function `loadConfig` on the Android `PluginManager` class. diff --git a/.changes/android-plugin-command-exception.md b/.changes/android-plugin-command-exception.md index 47285619f..40ccb8135 100644 --- a/.changes/android-plugin-command-exception.md +++ b/.changes/android-plugin-command-exception.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Adjust Android plugin exception error. diff --git a/.changes/api-js-os-locale.md b/.changes/api-js-os-locale.md index a75d0579e..a9616e0b3 100644 --- a/.changes/api-js-os-locale.md +++ b/.changes/api-js-os-locale.md @@ -1,5 +1,5 @@ --- -'@tauri-apps/api': 'patch' +'@tauri-apps/api': 'patch:enhance' --- Add `locale` function in the `os` module to get the system locale. diff --git a/.changes/api-rs-os-locale.md b/.changes/api-rs-os-locale.md index 0677de797..434f43eb9 100644 --- a/.changes/api-rs-os-locale.md +++ b/.changes/api-rs-os-locale.md @@ -1,5 +1,5 @@ --- -"tauri": "patch" +"tauri": "patch:enhance" --- Add `tauri::api::os::locale` function to get the system locale. diff --git a/.changes/appimage-follow-symlinks.md b/.changes/appimage-follow-symlinks.md index 891390347..a2f27051c 100644 --- a/.changes/appimage-follow-symlinks.md +++ b/.changes/appimage-follow-symlinks.md @@ -1,5 +1,5 @@ --- -'tauri-bundler': patch:bug +'tauri-bundler': 'patch:bug' --- - Updated the AppImage bundler to follow symlinks for `/usr/lib*`. diff --git a/.changes/build-android-env-vars.md b/.changes/build-android-env-vars.md index 7091ba159..a5402774a 100644 --- a/.changes/build-android-env-vars.md +++ b/.changes/build-android-env-vars.md @@ -1,5 +1,5 @@ --- -"tauri-build": patch +"tauri-build": 'patch:enhance' --- Set environment variables used by `tauri::mobile_entry_point`. diff --git a/.changes/bump-1.3.md b/.changes/bump-1.3.md index cf65e1935..47dabadd5 100644 --- a/.changes/bump-1.3.md +++ b/.changes/bump-1.3.md @@ -1,10 +1,10 @@ --- -"tauri-bundler": patch -"tauri-codegen": patch -"tauri-macros": patch -"tauri-utils": patch -"tauri-runtime": patch -"tauri-runtime-wry": patch +"tauri-bundler": 'patch:enhance' +"tauri-codegen": 'patch:enhance' +"tauri-macros": 'patch:enhance' +"tauri-utils": 'patch:enhance' +"tauri-runtime": 'patch:enhance' +"tauri-runtime-wry": 'patch:enhance' --- Pull changes from Tauri 1.3 release. diff --git a/.changes/bundler-remove-dialog-option.md b/.changes/bundler-remove-dialog-option.md index 054f44332..9ee8f8e02 100644 --- a/.changes/bundler-remove-dialog-option.md +++ b/.changes/bundler-remove-dialog-option.md @@ -1,5 +1,5 @@ --- -"tauri-bundler": patch +"tauri-bundler": 'patch:enhance' --- Removed the `UpdaterSettings::dialog` field. diff --git a/.changes/channel-api.md b/.changes/channel-api.md index 852b90707..716eca43a 100644 --- a/.changes/channel-api.md +++ b/.changes/channel-api.md @@ -1,6 +1,6 @@ --- -"api": patch -"tauri": patch +"api": 'patch:enhance' +"tauri": 'patch:enhance' --- Add channel API for sending data across the IPC. diff --git a/.changes/cli-android-build.md b/.changes/cli-android-build.md index 535a98e6c..708a482db 100644 --- a/.changes/cli-android-build.md +++ b/.changes/cli-android-build.md @@ -1,6 +1,6 @@ --- -"tauri-cli": minor -"@tauri-apps/cli": minor +"tauri-cli": 'minor:feat' +"@tauri-apps/cli": 'minor:feat' --- Added `android build` command. diff --git a/.changes/cli-android-dev-release.md b/.changes/cli-android-dev-release.md index e45ca93d4..638c01305 100644 --- a/.changes/cli-android-dev-release.md +++ b/.changes/cli-android-dev-release.md @@ -1,6 +1,6 @@ --- -'tauri-cli': 'patch' -'@tauri-apps/cli': 'patch' +'tauri-cli': 'patch:enhance' +'@tauri-apps/cli': 'patch:enhance' --- Add `--release` flag for `tauri android dev` however you will need to sign your Android app, see https://next--tauri.netlify.app/next/guides/distribution/sign-android diff --git a/.changes/cli-android-specified-targets-only.md b/.changes/cli-android-specified-targets-only.md index 5d83b54fa..3eace2f7e 100644 --- a/.changes/cli-android-specified-targets-only.md +++ b/.changes/cli-android-specified-targets-only.md @@ -1,6 +1,6 @@ --- -'tauri-cli': 'patch' -'@tauri-apps/cli': 'patch' +'tauri-cli': 'patch:enhance' +'@tauri-apps/cli': 'patch:enhance' --- Build only specified rust targets for `tauri android build` instead of all. diff --git a/.changes/cli-autoreload-mime-type.md b/.changes/cli-autoreload-mime-type.md index b341d6e73..3b0fe2601 100644 --- a/.changes/cli-autoreload-mime-type.md +++ b/.changes/cli-autoreload-mime-type.md @@ -1,6 +1,6 @@ --- -'tauri-cli': patch:bug -'@tauri-apps/cli': patch:bug +'tauri-cli': 'patch:bug' +'@tauri-apps/cli': 'patch:bug' --- Fix built-in devserver adding hot-reload code to non-html files. diff --git a/.changes/cli-built-in-dev-server-mobile.md b/.changes/cli-built-in-dev-server-mobile.md index 41aab33a6..5ad54dfa0 100644 --- a/.changes/cli-built-in-dev-server-mobile.md +++ b/.changes/cli-built-in-dev-server-mobile.md @@ -1,6 +1,6 @@ --- -'tauri-cli': 'patch' -'@tauri-apps/cli': 'patch' +'tauri-cli': 'patch:enhance' +'@tauri-apps/cli': 'patch:enhance' --- Use local ip address for built-in dev server on mobile. diff --git a/.changes/cli-ios-build.md b/.changes/cli-ios-build.md index 5fcf50409..bb0a39b95 100644 --- a/.changes/cli-ios-build.md +++ b/.changes/cli-ios-build.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Added `ios build` command. diff --git a/.changes/cli-key-properties.md b/.changes/cli-key-properties.md index 8a792e3d8..1ccb6623e 100644 --- a/.changes/cli-key-properties.md +++ b/.changes/cli-key-properties.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Add `key.properties` file to android's `.gitignore`. diff --git a/.changes/cli-libname-dashes.md b/.changes/cli-libname-dashes.md index de87ca32d..c341ca92c 100644 --- a/.changes/cli-libname-dashes.md +++ b/.changes/cli-libname-dashes.md @@ -1,6 +1,6 @@ --- -'tauri-cli': 'patch' -'@tauri-apps/cli': 'patch' +'tauri-cli': 'patch:enhance' +'@tauri-apps/cli': 'patch:enhance' --- On mobile, fix regression introduced in `tauri-cli` version `2.0.0-alpha.3` where library not found error was thrown. diff --git a/.changes/cli-mobile-auto-ip.md b/.changes/cli-mobile-auto-ip.md index e4aa1a05f..6a21831f7 100644 --- a/.changes/cli-mobile-auto-ip.md +++ b/.changes/cli-mobile-auto-ip.md @@ -1,5 +1,5 @@ --- -'tauri-cli': 'patch' +'tauri-cli': 'patch:enhance' --- Auto select an external IP for mobile development and fallback to prompting the user. Use `--force-ip-prompt` to force prompting. diff --git a/.changes/cli-mobile-dev.md b/.changes/cli-mobile-dev.md index 6e52ff08f..395680aad 100644 --- a/.changes/cli-mobile-dev.md +++ b/.changes/cli-mobile-dev.md @@ -1,6 +1,6 @@ --- -"tauri-cli": minor -"@tauri-apps/cli": minor +"tauri-cli": 'minor:feat' +"@tauri-apps/cli": 'minor:feat' --- Added `android dev` and `ios dev` commands. diff --git a/.changes/cli-mobile-plugin.md b/.changes/cli-mobile-plugin.md index 481b166bd..31e8538dc 100644 --- a/.changes/cli-mobile-plugin.md +++ b/.changes/cli-mobile-plugin.md @@ -1,6 +1,6 @@ --- -"tauri-cli": minor -"@tauri-apps/cli": minor +"tauri-cli": 'minor:feat' +"@tauri-apps/cli": 'minor:feat' --- Add commands to add native Android and iOS functionality to plugins. diff --git a/.changes/cli-nodejs-detection.md b/.changes/cli-nodejs-detection.md index c61f85c32..1bd8ddc60 100644 --- a/.changes/cli-nodejs-detection.md +++ b/.changes/cli-nodejs-detection.md @@ -1,5 +1,5 @@ --- -'tauri-cli': 'patch' +'tauri-cli': 'patch:enhance' --- In mobile commands, correctly detect when nodejs binary has the version in its name, for example `node-18` diff --git a/.changes/cli-pnpm.md b/.changes/cli-pnpm.md index 1e9609120..c22fa2baa 100644 --- a/.changes/cli-pnpm.md +++ b/.changes/cli-pnpm.md @@ -1,6 +1,6 @@ --- -'tauri-cli': 'patch' -'@tauri-apps/cli': 'patch' +'tauri-cli': 'patch:enhance' +'@tauri-apps/cli': 'patch:enhance' --- Fix android project build crashing when using `pnpm` caused by extra `--`. diff --git a/.changes/cli-profile.md b/.changes/cli-profile.md index a9f5f48aa..7c0d4da94 100644 --- a/.changes/cli-profile.md +++ b/.changes/cli-profile.md @@ -1,5 +1,5 @@ --- -'tauri-cli': patch:bug +'tauri-cli': 'patch:bug' --- Fix building with a custom cargo profile diff --git a/.changes/cli-refactor-ipc-mobile.md b/.changes/cli-refactor-ipc-mobile.md index ac2005096..2494371aa 100644 --- a/.changes/cli-refactor-ipc-mobile.md +++ b/.changes/cli-refactor-ipc-mobile.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Use temp file instead of environment variable to pass CLI IPC websocket address to the IDE. diff --git a/.changes/cli-windows-arm64.md b/.changes/cli-windows-arm64.md index a4e6244dc..0347ef8e6 100644 --- a/.changes/cli-windows-arm64.md +++ b/.changes/cli-windows-arm64.md @@ -1,6 +1,6 @@ --- -'tauri-cli': minor -'@tauri-apps/cli': minor +'tauri-cli': 'minor:feat' +'@tauri-apps/cli': 'minor:feat' --- Provide prebuilt CLIs for Windows ARM64 targets. diff --git a/.changes/cli-wry-0-28.md b/.changes/cli-wry-0-28.md index 798f5aa79..b6a0210f3 100644 --- a/.changes/cli-wry-0-28.md +++ b/.changes/cli-wry-0-28.md @@ -1,6 +1,6 @@ --- -'tauri-cli': 'patch' -'@tauri-apps/cli': 'patch' +'tauri-cli': 'patch:enhance' +'@tauri-apps/cli': 'patch:enhance' --- Update mobile template to `wry@0.28` diff --git a/.changes/clijs-node-version-20.md b/.changes/clijs-node-version-20.md index f47ab315d..7a09bd17f 100644 --- a/.changes/clijs-node-version-20.md +++ b/.changes/clijs-node-version-20.md @@ -1,5 +1,5 @@ --- -'@tauri-apps/cli': patch:bug +'@tauri-apps/cli': 'patch:bug' --- Fix nodejs binary regex when `0` is in the version name, for example `node-20` diff --git a/.changes/codegen-mobile-devurl.md b/.changes/codegen-mobile-devurl.md index da7c8812d..ba3854744 100644 --- a/.changes/codegen-mobile-devurl.md +++ b/.changes/codegen-mobile-devurl.md @@ -1,5 +1,5 @@ --- -"tauri-codegen": patch +"tauri-codegen": 'patch:enhance' --- Change `devPath` URL to use the local IP address on iOS and Android. diff --git a/.changes/config-require-literal_leading_dot.md b/.changes/config-require-literal_leading_dot.md index 68a22cc73..eddfd480d 100644 --- a/.changes/config-require-literal_leading_dot.md +++ b/.changes/config-require-literal_leading_dot.md @@ -1,5 +1,5 @@ --- -'tauri-utils': 'minor' +'tauri-utils': 'minor:feat' --- Add option to configure `require_literal_leading_dot` on `fs` and `asset` protcol scopes. diff --git a/.changes/core-android-proxy-method.md b/.changes/core-android-proxy-method.md index 89a33aedd..8d81a2dfd 100644 --- a/.changes/core-android-proxy-method.md +++ b/.changes/core-android-proxy-method.md @@ -1,5 +1,5 @@ --- -'tauri': 'patch' +'tauri': 'patch:enhance' --- Use correct HTTP method when making requests to the proxied server on mobile. diff --git a/.changes/core-channel-clone.md b/.changes/core-channel-clone.md index c9c86a965..d4446fc60 100644 --- a/.changes/core-channel-clone.md +++ b/.changes/core-channel-clone.md @@ -1,5 +1,5 @@ --- -'tauri': 'patch' +'tauri': 'patch:enhance' --- Implement `Clone` for `Channel` diff --git a/.changes/core-window-config.md b/.changes/core-window-config.md index 0ebdf3673..9f3ae01af 100644 --- a/.changes/core-window-config.md +++ b/.changes/core-window-config.md @@ -1,5 +1,5 @@ --- -'tauri': 'patch' +'tauri': 'patch:enhance' --- Fix some configurations not applied when creating the window through Javascript. diff --git a/.changes/core-windows-notification-sound.md b/.changes/core-windows-notification-sound.md index 9057e5c49..8c3499ffa 100644 --- a/.changes/core-windows-notification-sound.md +++ b/.changes/core-windows-notification-sound.md @@ -1,5 +1,5 @@ --- -"tauri": "patch" +"tauri": "patch:enhance" --- Play a sound when showing a notification on Windows. diff --git a/.changes/core-wry-0-28.md b/.changes/core-wry-0-28.md index ab90557fb..00542fa26 100644 --- a/.changes/core-wry-0-28.md +++ b/.changes/core-wry-0-28.md @@ -1,5 +1,5 @@ --- -'tauri': 'patch' +'tauri': 'patch:enhance' --- On Android, update proguard rules. diff --git a/.changes/deb-custom-desktop-file-config.md b/.changes/deb-custom-desktop-file-config.md index 96f0d81b9..a9505970f 100644 --- a/.changes/deb-custom-desktop-file-config.md +++ b/.changes/deb-custom-desktop-file-config.md @@ -1,7 +1,7 @@ --- -"tauri-utils": patch -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-utils": 'patch:enhance' +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Added the `desktop_template` option on `tauri.conf.json > tauri > bundle > deb`. diff --git a/.changes/default-tls-features.md b/.changes/default-tls-features.md index 549ead9ea..5ad707dfe 100644 --- a/.changes/default-tls-features.md +++ b/.changes/default-tls-features.md @@ -1,5 +1,5 @@ --- -"tauri": major +"tauri": major:feat --- Added the `default-tls` and `reqwest-default-tls` Cargo features for enabling TLS suppport to connect over HTTPS. diff --git a/.changes/default-window-icon.md b/.changes/default-window-icon.md index e90fb02e3..b1d13172e 100644 --- a/.changes/default-window-icon.md +++ b/.changes/default-window-icon.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Add `default_window_icon` getter on `App` and `AppHandle`. diff --git a/.changes/dev-proxy-response-cache.md b/.changes/dev-proxy-response-cache.md index f6327c336..53f662316 100644 --- a/.changes/dev-proxy-response-cache.md +++ b/.changes/dev-proxy-response-cache.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Implement response cache on the dev server proxy, used when the server responds with status 304. diff --git a/.changes/dev-proxy.md b/.changes/dev-proxy.md index 3e4e88316..86d86fea4 100644 --- a/.changes/dev-proxy.md +++ b/.changes/dev-proxy.md @@ -1,5 +1,5 @@ --- -"tauri": major +"tauri": major:feat --- **Breaking change:** Use the custom protocol as a proxy to the development server on all platforms except Linux. diff --git a/.changes/downgrade-min-sdk-version.md b/.changes/downgrade-min-sdk-version.md index 137260ea7..98b033b1f 100644 --- a/.changes/downgrade-min-sdk-version.md +++ b/.changes/downgrade-min-sdk-version.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"tauri": patch +"tauri-cli": 'patch:enhance' +"tauri": 'patch:enhance' --- Change minimum Android SDK version to 21 for the plugin library. diff --git a/.changes/dynamic-wry-plugin.md b/.changes/dynamic-wry-plugin.md index feef1406d..cdcf95ed4 100644 --- a/.changes/dynamic-wry-plugin.md +++ b/.changes/dynamic-wry-plugin.md @@ -1,6 +1,6 @@ --- -"tauri-runtime-wry": patch -"tauri": patch +"tauri-runtime-wry": 'patch:enhance' +"tauri": 'patch:enhance' --- Allow a wry plugin to be registered at runtime. diff --git a/.changes/enable-minify.md b/.changes/enable-minify.md index e6d5fdb45..0535a886a 100644 --- a/.changes/enable-minify.md +++ b/.changes/enable-minify.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Change the Android template to enable minification on release and pull ProGuard rules from proguard-tauri.pro. diff --git a/.changes/enable-path-commands.md b/.changes/enable-path-commands.md index 28e4d1570..522441c61 100644 --- a/.changes/enable-path-commands.md +++ b/.changes/enable-path-commands.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Fixes path commands not being added. diff --git a/.changes/enhance-jsobject-return-types.md b/.changes/enhance-jsobject-return-types.md index 47717614e..d70bdbdb7 100644 --- a/.changes/enhance-jsobject-return-types.md +++ b/.changes/enhance-jsobject-return-types.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Enhance Android's `JSObject` return types. diff --git a/.changes/error-on-identifier-change.md b/.changes/error-on-identifier-change.md index e09d787a4..9229a370b 100644 --- a/.changes/error-on-identifier-change.md +++ b/.changes/error-on-identifier-change.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Print an error if the Android project was generated with an older bundle identifier or package name. diff --git a/.changes/event-api-window-label.md b/.changes/event-api-window-label.md index e316ee6d8..d84aa7b3e 100644 --- a/.changes/event-api-window-label.md +++ b/.changes/event-api-window-label.md @@ -1,5 +1,5 @@ --- -"@tauri-apps/api": patch +"@tauri-apps/api": 'patch:enhance' --- Expose the window target option on event APIs. diff --git a/.changes/fix-build-script-mobile-runner-npm.md b/.changes/fix-build-script-mobile-runner-npm.md index 255b84445..db7700583 100644 --- a/.changes/fix-build-script-mobile-runner-npm.md +++ b/.changes/fix-build-script-mobile-runner-npm.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Fixes the generated mobile build script when using an NPM runner. diff --git a/.changes/fix-dev-server-proxy-path.md b/.changes/fix-dev-server-proxy-path.md index 40fc18d04..eb8fd9f26 100644 --- a/.changes/fix-dev-server-proxy-path.md +++ b/.changes/fix-dev-server-proxy-path.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Properly proxy dev server requests with query strings and fragments. diff --git a/.changes/fix-empty-identifier.md b/.changes/fix-empty-identifier.md index 86326c6a5..e929844ef 100644 --- a/.changes/fix-empty-identifier.md +++ b/.changes/fix-empty-identifier.md @@ -1,7 +1,7 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch -"tauri-macros": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' +"tauri-macros": 'patch:enhance' --- Resolve Android package name from single word bundle identifiers. diff --git a/.changes/fix-ios-plugin-throws-command.md b/.changes/fix-ios-plugin-throws-command.md index 97c74bf53..01d302107 100644 --- a/.changes/fix-ios-plugin-throws-command.md +++ b/.changes/fix-ios-plugin-throws-command.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Use actual iOS plugin instance to run command with `throws`. diff --git a/.changes/fix-ios-run-xcode14.md b/.changes/fix-ios-run-xcode14.md index cb2f8ab32..0774a5cff 100644 --- a/.changes/fix-ios-run-xcode14.md +++ b/.changes/fix-ios-run-xcode14.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Fixes running on device using Xcode 14. diff --git a/.changes/fix-ios-template.md b/.changes/fix-ios-template.md index 924210e23..f8f1df92d 100644 --- a/.changes/fix-ios-template.md +++ b/.changes/fix-ios-template.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Fixes the iOS project script to build the Rust library. diff --git a/.changes/fix-mobile-env-vars.md b/.changes/fix-mobile-env-vars.md index 365d34afd..1433afd99 100644 --- a/.changes/fix-mobile-env-vars.md +++ b/.changes/fix-mobile-env-vars.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Fixes `TAURI_*` environment variables for hook scripts on mobile commands. diff --git a/.changes/fix-nodejs-android-cmds.md b/.changes/fix-nodejs-android-cmds.md index b1cda1788..41c62ca0d 100644 --- a/.changes/fix-nodejs-android-cmds.md +++ b/.changes/fix-nodejs-android-cmds.md @@ -1,5 +1,5 @@ --- -"@tauri-apps/cli": patch +"@tauri-apps/cli": 'patch:enhance' --- Update tauri-mobile to fix running ADB scripts. diff --git a/.changes/fix-orientation-crash.md b/.changes/fix-orientation-crash.md index 98b1c0170..ad181f56b 100644 --- a/.changes/fix-orientation-crash.md +++ b/.changes/fix-orientation-crash.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Update Android project template with fix to crash on orientation change. diff --git a/.changes/fix-plugin-ios-bool.md b/.changes/fix-plugin-ios-bool.md index 0386f1b58..37a13079b 100644 --- a/.changes/fix-plugin-ios-bool.md +++ b/.changes/fix-plugin-ios-bool.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Fixes boolean plugin parameters freezing the application. diff --git a/.changes/fix-plugin-removal.md b/.changes/fix-plugin-removal.md index fe1f6b254..6cf606b7e 100644 --- a/.changes/fix-plugin-removal.md +++ b/.changes/fix-plugin-removal.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Clear Android plugin JSON file before building Rust library to ensure removed plugins are propagated to the Android project. diff --git a/.changes/fix-plugin-template-cargotoml.md b/.changes/fix-plugin-template-cargotoml.md index 30d97f891..e3ccd5b7a 100644 --- a/.changes/fix-plugin-template-cargotoml.md +++ b/.changes/fix-plugin-template-cargotoml.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Readd the Cargo.toml file to the plugin template. diff --git a/.changes/fix-proguard-rules.md b/.changes/fix-proguard-rules.md index eb4adc862..31e67486b 100644 --- a/.changes/fix-proguard-rules.md +++ b/.changes/fix-proguard-rules.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Fixes ProGuard rules. diff --git a/.changes/fix-shell-build.md b/.changes/fix-shell-build.md index 4b765c3fd..ce7c3dc67 100644 --- a/.changes/fix-shell-build.md +++ b/.changes/fix-shell-build.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Fix compilation issues without the shell API features. diff --git a/.changes/fix-tauri-binary-windows.md b/.changes/fix-tauri-binary-windows.md index 6ba7d7ba1..8e932906a 100644 --- a/.changes/fix-tauri-binary-windows.md +++ b/.changes/fix-tauri-binary-windows.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Fixes the Android build gradle plugin implementation on Windows. diff --git a/.changes/fix-xcodescript-lib-path.md b/.changes/fix-xcodescript-lib-path.md index d9d8dc6d1..99b7bfab5 100644 --- a/.changes/fix-xcodescript-lib-path.md +++ b/.changes/fix-xcodescript-lib-path.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Fixes iOS build script using the wrong path for the app library file. diff --git a/.changes/force-colored-logs.md b/.changes/force-colored-logs.md index a2bf87b05..27d48e4b0 100644 --- a/.changes/force-colored-logs.md +++ b/.changes/force-colored-logs.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Force colored logs on mobile commands. diff --git a/.changes/generate-tauri-activity.md b/.changes/generate-tauri-activity.md index 000c44a2b..3be10eafc 100644 --- a/.changes/generate-tauri-activity.md +++ b/.changes/generate-tauri-activity.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Generate `TauriActivity` Kotlin class on the build script. diff --git a/.changes/gradle-8.md b/.changes/gradle-8.md index e7eab5ab1..845db01db 100644 --- a/.changes/gradle-8.md +++ b/.changes/gradle-8.md @@ -1,6 +1,6 @@ --- -'tauri-cli': 'patch' -'@tauri-apps/cli': 'patch' +'tauri-cli': 'patch:enhance' +'@tauri-apps/cli': 'patch:enhance' --- Update android template to gradle 8.0 diff --git a/.changes/gtk16.md b/.changes/gtk16.md index 035f8c1d2..4ca4359b7 100644 --- a/.changes/gtk16.md +++ b/.changes/gtk16.md @@ -1,7 +1,7 @@ --- -"tauri-runtime": minor -"tauri-runtime-wry": minor -"tauri": minor +"tauri-runtime": 'minor:feat' +"tauri-runtime-wry": 'minor:feat' +"tauri": 'minor:feat' --- Update gtk to 0.16. diff --git a/.changes/improve-local-ip-detection.md b/.changes/improve-local-ip-detection.md index b755cc9bf..5668e53ab 100644 --- a/.changes/improve-local-ip-detection.md +++ b/.changes/improve-local-ip-detection.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Improve local IP address detection with user selection. diff --git a/.changes/improve-mobile-plugin-error-handling.md b/.changes/improve-mobile-plugin-error-handling.md index 71c57af54..a819ad07e 100644 --- a/.changes/improve-mobile-plugin-error-handling.md +++ b/.changes/improve-mobile-plugin-error-handling.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Improve the `run_mobile_plugin` function error handling. diff --git a/.changes/inject-config.md b/.changes/inject-config.md index 6f93ac59b..735e86f2d 100644 --- a/.changes/inject-config.md +++ b/.changes/inject-config.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Inject Tauri configuration in the Android assets. diff --git a/.changes/inject-proguard.md b/.changes/inject-proguard.md index 489ce1ea6..f9eae0c5d 100644 --- a/.changes/inject-proguard.md +++ b/.changes/inject-proguard.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Inject `proguard-tauri.pro` file in the Android project. diff --git a/.changes/invoke-handler-attributes.md b/.changes/invoke-handler-attributes.md index bf7dd63ba..35cedd052 100644 --- a/.changes/invoke-handler-attributes.md +++ b/.changes/invoke-handler-attributes.md @@ -1,6 +1,6 @@ --- -"tauri-macros": patch -"tauri": patch +"tauri-macros": 'patch:enhance' +"tauri": 'patch:enhance' --- Added support to attibutes for each command path in the `generate_handler` macro. diff --git a/.changes/invoke-return-bool.md b/.changes/invoke-return-bool.md index 604ea92c4..5e475c5aa 100644 --- a/.changes/invoke-return-bool.md +++ b/.changes/invoke-return-bool.md @@ -1,7 +1,7 @@ --- -"tauri-macros": major -"tauri-codegen": major -"tauri": major +"tauri-macros": major:feat +"tauri-codegen": major:feat +"tauri": major:feat --- Return `bool` in the invoke handler. diff --git a/.changes/ios-deployment-target.md b/.changes/ios-deployment-target.md index 99c676e28..e66aec4e7 100644 --- a/.changes/ios-deployment-target.md +++ b/.changes/ios-deployment-target.md @@ -1,5 +1,5 @@ --- -"tauri-build": patch +"tauri-build": 'patch:enhance' --- Read the `IPHONEOS_DEPLOYMENT_TARGET` environment variable to set the Swift iOS target version, defaults to 13. diff --git a/.changes/ios-icon-color.md b/.changes/ios-icon-color.md index 396e234c1..7cfb8802e 100644 --- a/.changes/ios-icon-color.md +++ b/.changes/ios-icon-color.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Added `--ios-color` option to the `tauri icon` command. diff --git a/.changes/ios-keep-alive.md b/.changes/ios-keep-alive.md index 9687fed89..0d2829aa3 100644 --- a/.changes/ios-keep-alive.md +++ b/.changes/ios-keep-alive.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Keep the process alive even when the iOS application is closed. diff --git a/.changes/ios-logs.md b/.changes/ios-logs.md index 000786309..cfaa27570 100644 --- a/.changes/ios-logs.md +++ b/.changes/ios-logs.md @@ -1,7 +1,7 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch -"tauri": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' +"tauri": 'patch:enhance' --- Show all application logs on iOS. diff --git a/.changes/ipc-scope-remove-enable-tauri-api.md b/.changes/ipc-scope-remove-enable-tauri-api.md index a18968c84..3e0a77095 100644 --- a/.changes/ipc-scope-remove-enable-tauri-api.md +++ b/.changes/ipc-scope-remove-enable-tauri-api.md @@ -1,6 +1,6 @@ --- -"tauri": patch -"tauri-utils": patch +"tauri": 'patch:enhance' +"tauri-utils": 'patch:enhance' --- Remove `enable_tauri_api` from the IPC scope. diff --git a/.changes/lib-name-xcode.md b/.changes/lib-name-xcode.md index ed3d8ec6e..5af4eb4b3 100644 --- a/.changes/lib-name-xcode.md +++ b/.changes/lib-name-xcode.md @@ -1,5 +1,5 @@ --- -'tauri': 'patch' +'tauri': 'patch:enhance' --- Use correct lib name in xcode project. diff --git a/.changes/local-dev-path-mobile.md b/.changes/local-dev-path-mobile.md index ae5542542..5a1381323 100644 --- a/.changes/local-dev-path-mobile.md +++ b/.changes/local-dev-path-mobile.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Fixes HMR on mobile when devPath is configured to load a filesystem path. diff --git a/.changes/log-file-fix-for-linux-and-windows.md b/.changes/log-file-fix-for-linux-and-windows.md index 6bcbc8e21..4949b3d2d 100644 --- a/.changes/log-file-fix-for-linux-and-windows.md +++ b/.changes/log-file-fix-for-linux-and-windows.md @@ -1,5 +1,5 @@ --- -'tauri': minor:bug +'tauri': 'minor:bug' --- Fix default log path for linux and windows diff --git a/.changes/logcat-all-tags.md b/.changes/logcat-all-tags.md index 64e4427e0..8d40bcfe7 100644 --- a/.changes/logcat-all-tags.md +++ b/.changes/logcat-all-tags.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Print log output for all tags on Android development. diff --git a/.changes/mime-type.md b/.changes/mime-type.md index 0b43e79e4..5b05f6199 100644 --- a/.changes/mime-type.md +++ b/.changes/mime-type.md @@ -1,5 +1,5 @@ --- -'tauri-utils': 'patch' +'tauri-utils': 'patch:enhance' --- Add `MimeType::parse_with_fallback` and `MimeType::parse_from_uri_with_fallback` diff --git a/.changes/min-sdk-version.md b/.changes/min-sdk-version.md index 883da6600..633247f34 100644 --- a/.changes/min-sdk-version.md +++ b/.changes/min-sdk-version.md @@ -1,5 +1,5 @@ --- -"tauri-utils": patch +"tauri-utils": 'patch:enhance' --- Added `android` configuration object under `tauri > bundle`. diff --git a/.changes/mobile-config.md b/.changes/mobile-config.md index 97417e249..85026f10e 100644 --- a/.changes/mobile-config.md +++ b/.changes/mobile-config.md @@ -1,5 +1,5 @@ --- -"tauri-utils": minor +"tauri-utils": 'minor:feat' --- Parse `android` and `ios` Tauri configuration files. diff --git a/.changes/mobile-dev-watcher-ignore-gen.md b/.changes/mobile-dev-watcher-ignore-gen.md index 4c78e0890..96ca550d8 100644 --- a/.changes/mobile-dev-watcher-ignore-gen.md +++ b/.changes/mobile-dev-watcher-ignore-gen.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Ignore the `gen` folder on the dev watcher. diff --git a/.changes/mobile-entry-point-macro.md b/.changes/mobile-entry-point-macro.md index 8b39085e8..5f428bdc4 100644 --- a/.changes/mobile-entry-point-macro.md +++ b/.changes/mobile-entry-point-macro.md @@ -1,5 +1,5 @@ --- -"tauri-macros": minor +"tauri-macros": 'minor:feat' --- Added the `mobile_entry_point` macro. diff --git a/.changes/mobile-env-vars-rename.md b/.changes/mobile-env-vars-rename.md index d977243e1..7067ce7ba 100644 --- a/.changes/mobile-env-vars-rename.md +++ b/.changes/mobile-env-vars-rename.md @@ -1,6 +1,6 @@ --- -"tauri-build": patch -"tauri-macros": patch +"tauri-build": 'patch:enhance' +"tauri-macros": 'patch:enhance' --- Refactor mobile environment variables. diff --git a/.changes/mobile-init.md b/.changes/mobile-init.md index a2996b3cb..7b47ed16c 100644 --- a/.changes/mobile-init.md +++ b/.changes/mobile-init.md @@ -1,6 +1,6 @@ --- -"tauri-cli": minor -"@tauri-apps/cli": minor +"tauri-cli": 'minor:feat' +"@tauri-apps/cli": 'minor:feat' --- Added `android init` and `ios init` commands. diff --git a/.changes/mobile-lib-name.md b/.changes/mobile-lib-name.md index c6c51e2b8..496d4e7f8 100644 --- a/.changes/mobile-lib-name.md +++ b/.changes/mobile-lib-name.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Add support to custom and kebab case library names for mobile apps. diff --git a/.changes/mobile-open.md b/.changes/mobile-open.md index 5e515a0ad..007eafe53 100644 --- a/.changes/mobile-open.md +++ b/.changes/mobile-open.md @@ -1,6 +1,6 @@ --- -"tauri-cli": minor -"@tauri-apps/cli": minor +"tauri-cli": 'minor:feat' +"@tauri-apps/cli": 'minor:feat' --- Added `android open` and `ios open` commands. diff --git a/.changes/mobile-plugin-config.md b/.changes/mobile-plugin-config.md index 593262cb3..6eb4f772b 100644 --- a/.changes/mobile-plugin-config.md +++ b/.changes/mobile-plugin-config.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Expose plugin configuration on the Android and iOS plugin classes. diff --git a/.changes/mobile-plugins.md b/.changes/mobile-plugins.md index 11187072e..03a673a0e 100644 --- a/.changes/mobile-plugins.md +++ b/.changes/mobile-plugins.md @@ -1,5 +1,5 @@ --- -"tauri": minor +"tauri": 'minor:feat' --- Run Android and iOS native plugins on the invoke handler if a Rust plugin command is not found. diff --git a/.changes/mobile-webview-access.md b/.changes/mobile-webview-access.md index 9d7fd65ad..be725d5e7 100644 --- a/.changes/mobile-webview-access.md +++ b/.changes/mobile-webview-access.md @@ -1,6 +1,6 @@ --- -"tauri-runtime-wry": minor -"tauri": minor +"tauri-runtime-wry": 'minor:feat' +"tauri": 'minor:feat' --- -Support `with_webview` for Android platform alowing execution of JNI code in context. +Support `with_webview` for Android platform alowing execution of JNI code in context. diff --git a/.changes/mobile.md b/.changes/mobile.md index 2a8dfbe96..e494dfd85 100644 --- a/.changes/mobile.md +++ b/.changes/mobile.md @@ -1,13 +1,13 @@ --- -"api": major -"tauri-utils": major -"tauri-bundler": major -"tauri-codegen": major -"tauri-macros": major -"tauri-build": major -"tauri": major -"tauri-cli": major -"@tauri-apps/cli": major +"api": major:feat +"tauri-utils": major:feat +"tauri-bundler": major:feat +"tauri-codegen": major:feat +"tauri-macros": major:feat +"tauri-build": major:feat +"tauri": major:feat +"tauri-cli": major:feat +"@tauri-apps/cli": major:feat --- First mobile alpha release! diff --git a/.changes/move-app.md b/.changes/move-app.md index 8bc5d10af..746c84ab4 100644 --- a/.changes/move-app.md +++ b/.changes/move-app.md @@ -1,6 +1,6 @@ --- -"api": patch -"tauri": patch +"api": 'patch:enhance' +"tauri": 'patch:enhance' --- Moved the `app` feature to its own plugin in the plugins-workspace repository. diff --git a/.changes/move-cli.md b/.changes/move-cli.md index 6492a86b2..0cd3ac386 100644 --- a/.changes/move-cli.md +++ b/.changes/move-cli.md @@ -1,7 +1,7 @@ --- -"api": patch -"tauri": patch -"tauri-utils": patch +"api": 'patch:enhance' +"tauri": 'patch:enhance' +"tauri-utils": 'patch:enhance' --- Moved the `cli` feature to its own plugin in the plugins-workspace repository. diff --git a/.changes/move-dialog-plugin.md b/.changes/move-dialog-plugin.md index e15185c3a..16a7e4040 100644 --- a/.changes/move-dialog-plugin.md +++ b/.changes/move-dialog-plugin.md @@ -1,6 +1,6 @@ --- -"tauri": patch -"api": patch +"tauri": 'patch:enhance' +"api": 'patch:enhance' --- Moved the dialog APIs to its own plugin in the plugins-workspace repository. diff --git a/.changes/move-event.md b/.changes/move-event.md index 6594578f1..40509a43b 100644 --- a/.changes/move-event.md +++ b/.changes/move-event.md @@ -1,8 +1,8 @@ --- -"api": patch -"tauri": patch -"tauri-runtime": patch -"tauri-runtime-wry": patch +"api": 'patch:enhance' +"tauri": 'patch:enhance' +"tauri-runtime": 'patch:enhance' +"tauri-runtime-wry": 'patch:enhance' --- Moved the `event` JS APIs to a plugin. diff --git a/.changes/move-fs.md b/.changes/move-fs.md index 1ec71c50a..b468af4e1 100644 --- a/.changes/move-fs.md +++ b/.changes/move-fs.md @@ -1,6 +1,6 @@ --- -"api": patch -"tauri": patch +"api": 'patch:enhance' +"tauri": 'patch:enhance' --- Moved the file system APIs to its own plugin in the plugins-workspace repository. diff --git a/.changes/move-http-api.md b/.changes/move-http-api.md index 5c0e0a15b..98dde1732 100644 --- a/.changes/move-http-api.md +++ b/.changes/move-http-api.md @@ -1,6 +1,6 @@ --- -"api": patch -"tauri": patch +"api": 'patch:enhance' +"tauri": 'patch:enhance' --- Moved the `http` feature to its own plugin in the plugins-workspace repository. diff --git a/.changes/move-os.md b/.changes/move-os.md index bf0a457ab..b1dfd4ae8 100644 --- a/.changes/move-os.md +++ b/.changes/move-os.md @@ -1,6 +1,6 @@ --- -"api": patch -"tauri": patch +"api": 'patch:enhance' +"tauri": 'patch:enhance' --- Moved the `os` feature to its own plugin in the plugins-workspace repository. diff --git a/.changes/move-process.md b/.changes/move-process.md index e6d3ba23e..637d13e07 100644 --- a/.changes/move-process.md +++ b/.changes/move-process.md @@ -1,6 +1,6 @@ --- -"api": patch -"tauri": patch +"api": 'patch:enhance' +"tauri": 'patch:enhance' --- Moved the `process` feature to its own plugin in the plugins-workspace repository. diff --git a/.changes/move-protocol-asset.md b/.changes/move-protocol-asset.md index 8f7ca5ffe..3dd27fbf0 100644 --- a/.changes/move-protocol-asset.md +++ b/.changes/move-protocol-asset.md @@ -1,6 +1,6 @@ --- -"tauri": patch -"tauri-utils": patch +"tauri": 'patch:enhance' +"tauri-utils": 'patch:enhance' --- Moved the `protocol` scope configuration to the `asset_protocol` field in `SecurityConfig`. diff --git a/.changes/move-shell.md b/.changes/move-shell.md index a9316c716..0bd1264df 100644 --- a/.changes/move-shell.md +++ b/.changes/move-shell.md @@ -1,8 +1,8 @@ --- -"api": patch -"tauri": patch -"tauri-codegen": patch -"tauri-macros": patch +"api": 'patch:enhance' +"tauri": 'patch:enhance' +"tauri-codegen": 'patch:enhance' +"tauri-macros": 'patch:enhance' --- Moved the `shell` functionality to its own plugin in the plugins-workspace repository. diff --git a/.changes/move-updater-config.md b/.changes/move-updater-config.md index 5428d95f2..279834d9f 100644 --- a/.changes/move-updater-config.md +++ b/.changes/move-updater-config.md @@ -1,8 +1,8 @@ --- -"tauri": patch -"tauri-utils": patch -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri": 'patch:enhance' +"tauri-utils": 'patch:enhance' +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Moved the updater configuration to the `BundleConfig`. diff --git a/.changes/move-updater.md b/.changes/move-updater.md index e4d682392..9a9b1df02 100644 --- a/.changes/move-updater.md +++ b/.changes/move-updater.md @@ -1,7 +1,7 @@ --- -"api": patch -"tauri": patch -"tauri-utils": patch +"api": 'patch:enhance' +"tauri": 'patch:enhance' +"tauri-utils": 'patch:enhance' --- Moved the `updater` feature to its own plugin in the plugins-workspace repository. diff --git a/.changes/msrv-1.64.md b/.changes/msrv-1.64.md index 7ee098be2..2a6186c6b 100644 --- a/.changes/msrv-1.64.md +++ b/.changes/msrv-1.64.md @@ -1,13 +1,13 @@ --- -"tauri-cli": minor -"tauri-bundler": minor -"tauri": minor -"tauri-build": minor -"tauri-codegen": minor -"tauri-macros": minor -"tauri-utils": minor -"tauri-runtime": minor -"tauri-runtime-wry": minor +"tauri-cli": 'minor:feat' +"tauri-bundler": 'minor:feat' +"tauri": 'minor:feat' +"tauri-build": 'minor:feat' +"tauri-codegen": 'minor:feat' +"tauri-macros": 'minor:feat' +"tauri-utils": 'minor:feat' +"tauri-runtime": 'minor:feat' +"tauri-runtime-wry": 'minor:feat' --- Bump the MSRV to 1.64. diff --git a/.changes/msrv-1.65.md b/.changes/msrv-1.65.md index fcf612dd8..911372072 100644 --- a/.changes/msrv-1.65.md +++ b/.changes/msrv-1.65.md @@ -1,13 +1,13 @@ --- -"tauri-cli": minor -"tauri-bundler": minor -"tauri": minor -"tauri-build": minor -"tauri-codegen": minor -"tauri-macros": minor -"tauri-utils": minor -"tauri-runtime": minor -"tauri-runtime-wry": minor +"tauri-cli": 'minor:feat' +"tauri-bundler": 'minor:feat' +"tauri": 'minor:feat' +"tauri-build": 'minor:feat' +"tauri-codegen": 'minor:feat' +"tauri-macros": 'minor:feat' +"tauri-utils": 'minor:feat' +"tauri-runtime": 'minor:feat' +"tauri-runtime-wry": 'minor:feat' --- Bump the MSRV to 1.65. diff --git a/.changes/napi-rs.md b/.changes/napi-rs.md index 5b59d3026..165a06339 100644 --- a/.changes/napi-rs.md +++ b/.changes/napi-rs.md @@ -1,5 +1,5 @@ --- -'@tauri-apps/cli': 'patch' +'@tauri-apps/cli': 'patch:enhance' --- Update `napi-rs` dependencies to latest to fix CLI hanging up forever. diff --git a/.changes/npm-pass-args.md b/.changes/npm-pass-args.md index 9718cdb10..6496d32f5 100644 --- a/.changes/npm-pass-args.md +++ b/.changes/npm-pass-args.md @@ -1,6 +1,6 @@ --- -'tauri-cli': 'patch' -"@tauri-apps/cli": patch +'tauri-cli': 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Correctly pass arguments from `npm run` to `tauri`. diff --git a/.changes/nsis-custom-language-files.md b/.changes/nsis-custom-language-files.md index 325147db5..3e0077901 100644 --- a/.changes/nsis-custom-language-files.md +++ b/.changes/nsis-custom-language-files.md @@ -1,6 +1,6 @@ --- 'tauri-bundler': 'minor:feat' -'tauri-utils': 'minor' +'tauri-utils': 'minor:feat' 'tauri-cli': 'minor:feat' --- diff --git a/.changes/nsis-custom-template.md b/.changes/nsis-custom-template.md index 67a0b10bc..fdf7db88e 100644 --- a/.changes/nsis-custom-template.md +++ b/.changes/nsis-custom-template.md @@ -1,5 +1,5 @@ --- -'tauri-utils': 'minor' +'tauri-utils': 'minor:feat' 'tauri-bundler': 'minor:feat' 'tauri-cli': 'minor:feat' '@tauri-apps/cli': 'minor:feat' diff --git a/.changes/nsis-downgrades.md b/.changes/nsis-downgrades.md deleted file mode 100644 index b0a297758..000000000 --- a/.changes/nsis-downgrades.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'tauri-bundler': 'patch' ---- - -Fix NSIS installer disabling `do not uninstall` button and silent installer aborting, if `allowDowngrades` was disabled even when we are not downgrading. diff --git a/.changes/nsis-install-mode-args.md b/.changes/nsis-install-mode-args.md index 71927fd9d..2a449223c 100644 --- a/.changes/nsis-install-mode-args.md +++ b/.changes/nsis-install-mode-args.md @@ -1,5 +1,5 @@ --- -'tauri-utils': 'patch' +'tauri-utils': 'patch:enhance' --- Add `WindowsUpdateInstallMode::nsis_args` diff --git a/.changes/nsis-passive-mode.md b/.changes/nsis-passive-mode.md index 8f90fd5ac..59bddb737 100644 --- a/.changes/nsis-passive-mode.md +++ b/.changes/nsis-passive-mode.md @@ -1,5 +1,5 @@ --- -'tauri': 'minor' +'tauri': 'minor:feat' --- Support `passive` mode for NSIS updater. diff --git a/.changes/nsis-restart-flag.md b/.changes/nsis-restart-flag.md index 889aa4fdb..e80b0c2ba 100644 --- a/.changes/nsis-restart-flag.md +++ b/.changes/nsis-restart-flag.md @@ -1,5 +1,5 @@ --- -'tauri-bundler': 'minor' +'tauri-bundler': 'minor:feat' --- For NSIS, Add support for `/P` to install or uninstall in passive mode, `/R` to (re)start the app and `/NS` to disable creating shortcuts in `silent` and `passive` modes. diff --git a/.changes/nsis-silent-kill.md b/.changes/nsis-silent-kill.md index ee1e30ef4..c0a5c3ebb 100644 --- a/.changes/nsis-silent-kill.md +++ b/.changes/nsis-silent-kill.md @@ -1,5 +1,5 @@ --- -'tauri-bundler': 'minor' +'tauri-bundler': 'minor:feat' --- NSIS `silent` and `passive` installer/updater will auto-kill the app if its running. diff --git a/.changes/nsis-silent-shortcuts.md b/.changes/nsis-silent-shortcuts.md deleted file mode 100644 index b9cf4ec53..000000000 --- a/.changes/nsis-silent-shortcuts.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'tauri-bundler': 'patch' ---- - -Fix NSIS silent installer not creating Desktop and StartMenu shortcuts. Pass `/NS` to disable creating them. diff --git a/.changes/nsis-uninstall-wix.md b/.changes/nsis-uninstall-wix.md index a76841744..0431d639e 100644 --- a/.changes/nsis-uninstall-wix.md +++ b/.changes/nsis-uninstall-wix.md @@ -1,5 +1,5 @@ --- -'tauri-bundler': 'minor' +'tauri-bundler': 'minor:feat' --- NSIS installer will now check if a previous WiX `.msi` installation exist and will prompt users to uninstall it. diff --git a/.changes/on-new-intent.md b/.changes/on-new-intent.md index bdb769ea7..c7c89f80f 100644 --- a/.changes/on-new-intent.md +++ b/.changes/on-new-intent.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Added the `onNewIntent` Plugin hook on Android. diff --git a/.changes/only-proxy-on-mobile.md b/.changes/only-proxy-on-mobile.md index a8558d2b4..299816918 100644 --- a/.changes/only-proxy-on-mobile.md +++ b/.changes/only-proxy-on-mobile.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Only proxy the dev server on mobile to simplify desktop usage. diff --git a/.changes/open-ts-overload.md b/.changes/open-ts-overload.md index d1c7dde58..6ea100f34 100644 --- a/.changes/open-ts-overload.md +++ b/.changes/open-ts-overload.md @@ -1,5 +1,5 @@ --- -"api": patch +"api": 'patch:enhance' --- Overload the dialog `open` function to have better TS result types. diff --git a/.changes/package-info-crate-name.md b/.changes/package-info-crate-name.md index 4fab428bb..c4d3aa930 100644 --- a/.changes/package-info-crate-name.md +++ b/.changes/package-info-crate-name.md @@ -1,6 +1,6 @@ --- -"tauri-utils": patch -"tauri-codegen": patch +"tauri-utils": 'patch:enhance' +"tauri-codegen": 'patch:enhance' --- Added `crate_name` field on `PackageInfo`. diff --git a/.changes/plugin-android-project-refactor.md b/.changes/plugin-android-project-refactor.md index 0ba0a844a..d79965d73 100644 --- a/.changes/plugin-android-project-refactor.md +++ b/.changes/plugin-android-project-refactor.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"tauri-build": patch +"tauri-cli": 'patch:enhance' +"tauri-build": 'patch:enhance' --- Use absolute path to each Android plugin project instead of copying the files to enhance developer experience. diff --git a/.changes/plugin-api-handle.md b/.changes/plugin-api-handle.md index 3ec26bc98..8a02043df 100644 --- a/.changes/plugin-api-handle.md +++ b/.changes/plugin-api-handle.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Add `app` method for the `PluginApi` struct. diff --git a/.changes/plugin-handle-clone.md b/.changes/plugin-handle-clone.md index 580dc158c..7863ad762 100644 --- a/.changes/plugin-handle-clone.md +++ b/.changes/plugin-handle-clone.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Implement `Clone` for `plugin::PluginHandle`. diff --git a/.changes/plugin-init-fns.md b/.changes/plugin-init-fns.md index f679e6413..ad85adf94 100644 --- a/.changes/plugin-init-fns.md +++ b/.changes/plugin-init-fns.md @@ -1,5 +1,5 @@ --- -"tauri": minor +"tauri": 'minor:feat' --- Added `initialize_android_plugin` and `initialize_ios_plugin` APIs on `AppHandle`. diff --git a/.changes/plugin-init-refactor.md b/.changes/plugin-init-refactor.md index 567bd7b09..b2cbbafd7 100644 --- a/.changes/plugin-init-refactor.md +++ b/.changes/plugin-init-refactor.md @@ -1,6 +1,6 @@ --- -"tauri-cli": minor -"@tauri-apps/cli": minor +"tauri-cli": 'minor:feat' +"@tauri-apps/cli": 'minor:feat' --- Changed the `--api` flag on `plugin init` to `--no-api`. diff --git a/.changes/plugin-setup-refactor.md b/.changes/plugin-setup-refactor.md index d68597a32..6e8afa6fb 100644 --- a/.changes/plugin-setup-refactor.md +++ b/.changes/plugin-setup-refactor.md @@ -1,5 +1,5 @@ --- -"tauri": major +"tauri": major:feat --- Changed the plugin setup hook to take a second argument of type `PluginApi`. diff --git a/.changes/plugin-template-examples-manifest.md b/.changes/plugin-template-examples-manifest.md index f3f2a7d93..fd082fe3f 100644 --- a/.changes/plugin-template-examples-manifest.md +++ b/.changes/plugin-template-examples-manifest.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Add Cargo manifest files for the plugin example templates. diff --git a/.changes/pnpm-android.md b/.changes/pnpm-android.md index 98302b1ef..d91a2b4ef 100644 --- a/.changes/pnpm-android.md +++ b/.changes/pnpm-android.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Fix `tauri android build/dev` crashing when used with standalone `pnpm` executable on Windows. diff --git a/.changes/process-mod-refactor.md b/.changes/process-mod-refactor.md index 9da8b61ef..47517cff7 100644 --- a/.changes/process-mod-refactor.md +++ b/.changes/process-mod-refactor.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Moved the `tauri::api::process` module to `tauri::process`. diff --git a/.changes/raw-encoding.md b/.changes/raw-encoding.md index 414107701..8c43cfa78 100644 --- a/.changes/raw-encoding.md +++ b/.changes/raw-encoding.md @@ -1,6 +1,6 @@ --- -"api": minor -"tauri": minor +"api": 'minor:feat' +"tauri": 'minor:feat' --- Added `raw` encoding option to read stdout and stderr raw bytes. diff --git a/.changes/readme.md b/.changes/readme.md index 73ee22d97..318eea024 100644 --- a/.changes/readme.md +++ b/.changes/readme.md @@ -10,8 +10,8 @@ Use the following format: ```md --- -'package-a': patch -'package-b': patch +'package-a': 'patch:enhance' +'package-b': 'patch:enhance' --- Change summary goes here @@ -33,7 +33,7 @@ Additionally you could specify a tag for the change file to group it with other ```md --- -'package-a': patch:bug +'package-a': 'patch:enhance' --- Change summary goes here diff --git a/.changes/refactor-macros.md b/.changes/refactor-macros.md index 831f32160..49b3fb4ed 100644 --- a/.changes/refactor-macros.md +++ b/.changes/refactor-macros.md @@ -1,6 +1,6 @@ --- -"tauri-macros": patch -"tauri": patch +"tauri-macros": 'patch:enhance' +"tauri": 'patch:enhance' --- Refactored the implementation of the `mobile_entry_point` macro. diff --git a/.changes/refactor-setup.md b/.changes/refactor-setup.md index 657cf32d2..584392242 100644 --- a/.changes/refactor-setup.md +++ b/.changes/refactor-setup.md @@ -1,5 +1,5 @@ --- -"tauri": major +"tauri": major:feat --- **Breaking change:** The window creation and setup hook are now called when the event loop is ready. diff --git a/.changes/refactor-tauri-android-dependency.md b/.changes/refactor-tauri-android-dependency.md index 728445eeb..a0bd094ab 100644 --- a/.changes/refactor-tauri-android-dependency.md +++ b/.changes/refactor-tauri-android-dependency.md @@ -1,6 +1,6 @@ --- -"tauri": patch -"tauri-build": patch +"tauri": 'patch:enhance' +"tauri-build": 'patch:enhance' --- Changed how the `tauri-android` dependency is injected. This requires the `gen/android` project to be recreated. diff --git a/.changes/remove-allowlist.md b/.changes/remove-allowlist.md index c0e007213..55cf32fb8 100644 --- a/.changes/remove-allowlist.md +++ b/.changes/remove-allowlist.md @@ -1,8 +1,8 @@ --- -"tauri": patch -"tauri-utils": patch -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri": 'patch:enhance' +"tauri-utils": 'patch:enhance' +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Removed the allowlist configuration. diff --git a/.changes/remove-attohttpc.md b/.changes/remove-attohttpc.md index bd53ef00d..239701a7f 100644 --- a/.changes/remove-attohttpc.md +++ b/.changes/remove-attohttpc.md @@ -1,5 +1,5 @@ --- -"tauri": major +"tauri": major:feat --- Removed the attohttpc client. The `reqwest-*` Cargo features were also removed. diff --git a/.changes/remove-clipboard.md b/.changes/remove-clipboard.md index 3a40254c5..4469be99a 100644 --- a/.changes/remove-clipboard.md +++ b/.changes/remove-clipboard.md @@ -1,8 +1,8 @@ --- -"tauri": patch -"tauri-runtime": patch -"tauri-runtime-wry": patch -"api": patch +"tauri": 'patch:enhance' +"tauri-runtime": 'patch:enhance' +"tauri-runtime-wry": 'patch:enhance' +"api": 'patch:enhance' --- Moved the `clipboard` feature to its own plugin in the plugins-workspace repository. diff --git a/.changes/remove-fs-apis.md b/.changes/remove-fs-apis.md index 832923e17..4c684e941 100644 --- a/.changes/remove-fs-apis.md +++ b/.changes/remove-fs-apis.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Removed extract and move APIs from `tauri::api::file`. diff --git a/.changes/remove-global-shortcut.md b/.changes/remove-global-shortcut.md index 07fac9925..67017fd1e 100644 --- a/.changes/remove-global-shortcut.md +++ b/.changes/remove-global-shortcut.md @@ -1,8 +1,8 @@ --- -"api": patch -"tauri": patch -"tauri-runtime": patch -"tauri-runtime-wry": patch +"api": 'patch:enhance' +"tauri": 'patch:enhance' +"tauri-runtime": 'patch:enhance' +"tauri-runtime-wry": 'patch:enhance' --- Moved the `global-shortcut` feature to its own plugin in the plugins-workspace repository. diff --git a/.changes/remove-macros-command-module.md b/.changes/remove-macros-command-module.md index c5a5e1eef..fdf720267 100644 --- a/.changes/remove-macros-command-module.md +++ b/.changes/remove-macros-command-module.md @@ -1,5 +1,5 @@ --- -"tauri-macros": patch +"tauri-macros": 'patch:enhance' --- Removed the module command macros. diff --git a/.changes/remove-mobile-log.md b/.changes/remove-mobile-log.md index b0391e288..3f02355e8 100644 --- a/.changes/remove-mobile-log.md +++ b/.changes/remove-mobile-log.md @@ -1,7 +1,7 @@ --- -"tauri": patch -"tauri-macros": patch -"tauri-build": patch +"tauri": 'patch:enhance' +"tauri-macros": 'patch:enhance' +"tauri-build": 'patch:enhance' --- Removed mobile logging initialization, which will be handled by `tauri-plugin-log`. diff --git a/.changes/remove-sdk-dir.md b/.changes/remove-sdk-dir.md index 5b65898bb..c4150a925 100644 --- a/.changes/remove-sdk-dir.md +++ b/.changes/remove-sdk-dir.md @@ -1,5 +1,5 @@ --- -"tauri-build": patch +"tauri-build": 'patch:enhance' --- Remove `WindowsAttributes::sdk_dir`. diff --git a/.changes/remove-shell-constructor.md b/.changes/remove-shell-constructor.md index 0100d13e0..c8c4b0bbd 100644 --- a/.changes/remove-shell-constructor.md +++ b/.changes/remove-shell-constructor.md @@ -1,5 +1,5 @@ --- -"api": minor +"api": 'minor:feat' --- Removed shell's `Command` constructor and added the `Command.create` static function instead. diff --git a/.changes/remove-tray-icon-mobile.md b/.changes/remove-tray-icon-mobile.md index f18cd3779..2ab793e0e 100644 --- a/.changes/remove-tray-icon-mobile.md +++ b/.changes/remove-tray-icon-mobile.md @@ -1,6 +1,6 @@ --- -"tauri-codegen": patch -"tauri": patch +"tauri-codegen": 'patch:enhance' +"tauri": 'patch:enhance' --- Refactor the `Context` conditional fields and only parse the tray icon on desktop. diff --git a/.changes/remove-updater-dialog.md b/.changes/remove-updater-dialog.md index 00d2767a4..bf12438c4 100644 --- a/.changes/remove-updater-dialog.md +++ b/.changes/remove-updater-dialog.md @@ -1,6 +1,6 @@ --- -"tauri": patch -"tauri-utils": patch +"tauri": 'patch:enhance' +"tauri-utils": 'patch:enhance' --- Remove the updater's dialog option. diff --git a/.changes/remove-updater-event.md b/.changes/remove-updater-event.md index 77dffd141..fcaa80e4e 100644 --- a/.changes/remove-updater-event.md +++ b/.changes/remove-updater-event.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Removed `UpdaterEvent`. See `tauri-plugin-updater` for new usage. diff --git a/.changes/remove-window.md b/.changes/remove-window.md index e83dd99a2..15662c88e 100644 --- a/.changes/remove-window.md +++ b/.changes/remove-window.md @@ -1,6 +1,6 @@ --- -"tauri": patch -"api": patch +"tauri": 'patch:enhance' +"api": 'patch:enhance' --- Moved the `window` JS APIs to its own plugin in the plugins-workspace repository. diff --git a/.changes/rfd101.md b/.changes/rfd101.md index ef230029a..78feeb53d 100644 --- a/.changes/rfd101.md +++ b/.changes/rfd101.md @@ -1,5 +1,5 @@ --- -"tauri": minor +"tauri": 'minor:feat' --- Update rfd to 0.11. diff --git a/.changes/run-mobile-plugin.md b/.changes/run-mobile-plugin.md index f5cf06d39..1d18a0b48 100644 --- a/.changes/run-mobile-plugin.md +++ b/.changes/run-mobile-plugin.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Added `App::run_mobile_plugin` and `AppHandle::run_mobile_plugin`. diff --git a/.changes/rustls-default.md b/.changes/rustls-default.md index 56d4c54b2..19fd4de43 100644 --- a/.changes/rustls-default.md +++ b/.changes/rustls-default.md @@ -1,6 +1,6 @@ --- -'tauri-cli': patch -'@tauri-apps/cli': patch +'tauri-cli': 'patch:enhance' +'@tauri-apps/cli': 'patch:enhance' --- Add `rustls` as default Cargo feature. diff --git a/.changes/safepathbuf-refactor.md b/.changes/safepathbuf-refactor.md index f80182d8c..c915f3634 100644 --- a/.changes/safepathbuf-refactor.md +++ b/.changes/safepathbuf-refactor.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Expose `SafePathBuf` type in `tauri::path`. diff --git a/.changes/shadow-config.md b/.changes/shadow-config.md index 9b922b9df..6d01ed00d 100644 --- a/.changes/shadow-config.md +++ b/.changes/shadow-config.md @@ -1,5 +1,5 @@ --- -'tauri-utils': minor +'tauri-utils': 'minor:feat' --- Added the `shadow` option to the window configuration and `set_shadow` option to the `window` allow list. diff --git a/.changes/shadow.md b/.changes/shadow.md index 439213262..1eb40dda0 100644 --- a/.changes/shadow.md +++ b/.changes/shadow.md @@ -1,7 +1,7 @@ --- -'tauri': minor -'tauri-runtime-wry': minor -'tauri-runtime': minor +'tauri': 'minor:feat' +'tauri-runtime-wry': 'minor:feat' +'tauri-runtime': 'minor:feat' --- Added the `shadow` option when creating a window and `Window::set_shadow`. diff --git a/.changes/shadows-default-on.md b/.changes/shadows-default-on.md index 23586d7a7..e46ed93a8 100644 --- a/.changes/shadows-default-on.md +++ b/.changes/shadows-default-on.md @@ -1,5 +1,5 @@ --- -'tauri': 'patch' +'tauri': 'patch:enhance' --- Enable shadows by default. diff --git a/.changes/simplify-ios-plugin-init-fn.md b/.changes/simplify-ios-plugin-init-fn.md index f6afed50b..099d9e118 100644 --- a/.changes/simplify-ios-plugin-init-fn.md +++ b/.changes/simplify-ios-plugin-init-fn.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Change iOS plugin init function signature to `func init_plugin() -> Plugin`. diff --git a/.changes/target-dir-detection.md b/.changes/target-dir-detection.md index d1bd99f8c..c77b1adb7 100644 --- a/.changes/target-dir-detection.md +++ b/.changes/target-dir-detection.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Fix target directory detection when compiling for Android. diff --git a/.changes/tauri-build-mobile.md b/.changes/tauri-build-mobile.md index 06498274e..4e55d09cf 100644 --- a/.changes/tauri-build-mobile.md +++ b/.changes/tauri-build-mobile.md @@ -1,5 +1,5 @@ --- -"tauri-build": minor +"tauri-build": 'minor:feat' --- Add `mobile::PluginBuilder` for running build tasks related to Tauri plugins. diff --git a/.changes/tauri-mobile-entry-point.md b/.changes/tauri-mobile-entry-point.md index 6e57b9767..35e06db71 100644 --- a/.changes/tauri-mobile-entry-point.md +++ b/.changes/tauri-mobile-entry-point.md @@ -1,5 +1,5 @@ --- -"tauri": minor +"tauri": 'minor:feat' --- Export types required by the `mobile_entry_point` macro. diff --git a/.changes/tauri-runtime-wry-wry-0-28.md b/.changes/tauri-runtime-wry-wry-0-28.md index b36f4b20f..6225b352b 100644 --- a/.changes/tauri-runtime-wry-wry-0-28.md +++ b/.changes/tauri-runtime-wry-wry-0-28.md @@ -1,5 +1,5 @@ --- -'tauri-runtime-wry': 'patch' +'tauri-runtime-wry': 'patch:enhance' --- Update `wry` to `0.28` diff --git a/.changes/tempdir-api.md b/.changes/tempdir-api.md index 0c064a802..6a16a157a 100644 --- a/.changes/tempdir-api.md +++ b/.changes/tempdir-api.md @@ -1,5 +1,5 @@ --- -'@tauri-apps/api': 'patch' +'@tauri-apps/api': 'patch:enhance' --- Add `tempDir` function to `path` module diff --git a/.changes/tempdir-core.md b/.changes/tempdir-core.md index 6d7e661cf..e16b80f12 100644 --- a/.changes/tempdir-core.md +++ b/.changes/tempdir-core.md @@ -1,5 +1,5 @@ --- -'tauri': 'patch' +'tauri': 'patch:enhance' --- Add `temp_dir` method to `PathResolver` diff --git a/.changes/tls-features-automatically-enabled.md b/.changes/tls-features-automatically-enabled.md index ce2cf0002..e8629a839 100644 --- a/.changes/tls-features-automatically-enabled.md +++ b/.changes/tls-features-automatically-enabled.md @@ -1,6 +1,6 @@ --- -"tauri-cli": patch -"@tauri-apps/cli": patch +"tauri-cli": 'patch:enhance' +"@tauri-apps/cli": 'patch:enhance' --- Automatically enable the `rustls-tls` tauri feature on mobile and `native-tls` on desktop if `rustls-tls` is not enabled. diff --git a/.changes/tls-features-refactor.md b/.changes/tls-features-refactor.md index 3b16b5c65..8dd54f548 100644 --- a/.changes/tls-features-refactor.md +++ b/.changes/tls-features-refactor.md @@ -1,5 +1,5 @@ --- -"tauri": patch +"tauri": 'patch:enhance' --- Renamed the `default-tls` feature to `native-tls` and added `rustls-tls` feature. diff --git a/.changes/tray_get_item.md b/.changes/tray_get_item.md index c4f02dc8c..4d60ca1a3 100644 --- a/.changes/tray_get_item.md +++ b/.changes/tray_get_item.md @@ -1,5 +1,5 @@ --- -'tauri': minor:feat +'tauri': 'minor:feat' --- Add `MenuHandle::try_get_item` and `SystemTrayHandle::try_get_item` which returns a `Option` instead of panicking. diff --git a/.changes/ubuntu-20.04-cli.js.md b/.changes/ubuntu-20.04-cli.js.md index 18f06f6cc..640558ce4 100644 --- a/.changes/ubuntu-20.04-cli.js.md +++ b/.changes/ubuntu-20.04-cli.js.md @@ -1,5 +1,5 @@ --- -"@tauri-apps/cli": patch +"@tauri-apps/cli": 'patch:enhance' --- Use Ubuntu 20.04 to compile the CLI, increasing the minimum libc version required. diff --git a/.changes/ubuntu-20.04-cli.rs.md b/.changes/ubuntu-20.04-cli.rs.md index f17d1df01..58f0adc76 100644 --- a/.changes/ubuntu-20.04-cli.rs.md +++ b/.changes/ubuntu-20.04-cli.rs.md @@ -1,6 +1,5 @@ --- -"tauri-cli": patch +"tauri-cli": 'patch:enhance' --- - Use Ubuntu 20.04 to compile the CLI for cargo-binstall, increasing the minimum libc required. -- diff --git a/.changes/unpin-deps.md b/.changes/unpin-deps.md index 29a88af13..b269aed34 100644 --- a/.changes/unpin-deps.md +++ b/.changes/unpin-deps.md @@ -1,9 +1,9 @@ --- -'tauri': patch:enhance -'tauri-build': patch:enhance -'tauri-codegen': patch:enhance -'tauri-runtime': patch:enhance -'tauri-runtime-wry': patch:enhance +'tauri': 'patch:enhance' +'tauri-build': 'patch:enhance' +'tauri-codegen': 'patch:enhance' +'tauri-runtime': 'patch:enhance' +'tauri-runtime-wry': 'patch:enhance' --- Unpin `time`, `ignore`, `winnow`, and `ignore` crate versions. Developers now have to pin crates if needed themselves. A list of crates that need pinning to adhere to Tauri's MSRV will be visible in Tauri's GitHub workflow: https://github.com/tauri-apps/tauri/blob/dev/.github/workflows/test-core.yml#L85. diff --git a/.changes/webview-attributes-from-window-config-impl.md b/.changes/webview-attributes-from-window-config-impl.md index 3adaa2e92..aca7fe220 100644 --- a/.changes/webview-attributes-from-window-config-impl.md +++ b/.changes/webview-attributes-from-window-config-impl.md @@ -1,5 +1,5 @@ --- -'tauri-runtime': 'patch' +'tauri-runtime': 'patch:enhance' --- impl `From<&WindowConfig>` for `WebviewAttributes`. diff --git a/.changes/with-webview.md b/.changes/with-webview.md index 8bfbef82a..4b1e8a575 100644 --- a/.changes/with-webview.md +++ b/.changes/with-webview.md @@ -1,7 +1,7 @@ --- -"tauri": minor -"tauri-runtime": minor -"tauri-runtime-wry": minor +"tauri": 'minor:feat' +"tauri-runtime": 'minor:feat' +"tauri-runtime-wry": 'minor:feat' --- Implemented `with_webview` on Android and iOS. diff --git a/.changes/wry26.md b/.changes/wry26.md index 2775757c5..dee422188 100644 --- a/.changes/wry26.md +++ b/.changes/wry26.md @@ -1,5 +1,5 @@ --- -"tauri-runtime-wry": minor +"tauri-runtime-wry": 'minor:feat' --- Update wry to 0.26. diff --git a/.github/workflows/check-change-tags.yml b/.github/workflows/check-change-tags.yml new file mode 100644 index 000000000..8a947760b --- /dev/null +++ b/.github/workflows/check-change-tags.yml @@ -0,0 +1,32 @@ +# Copyright 2019-2023 Tauri Programme within The Commons Conservancy +# SPDX-License-Identifier: Apache-2.0 +# SPDX-License-Identifier: MIT + +name: check change tags + +on: + pull_request: + paths: + - '.changes/*.md' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: dorny/paths-filter@v2 + id: filter + with: + list-files: shell + filters: | + changes: + - '.changes/*.md' + + - name: check + run: node ./.scripts/ci/check-change-tags.js ${{ steps.filter.outputs.changes_files }} + if: ${{ steps.filter.outputs.changes == 'true' }} diff --git a/.github/workflows/check-generated-files.yml b/.github/workflows/check-generated-files.yml index 2fc6b7fea..0f5b6ecc6 100644 --- a/.github/workflows/check-generated-files.yml +++ b/.github/workflows/check-generated-files.yml @@ -13,16 +13,6 @@ on: - 'core/tauri-utils/src/config.rs' - 'tooling/cli/schema.json' - 'core/tauri-config-schema/schema.json' - push: - branches: - - dev - paths: - - '.github/workflows/check-generated-files.yml' - - 'tooling/api/src/**' - - 'core/tauri/scripts/bundle.global.js' - - 'core/tauri-utils/src/config.rs' - - 'tooling/cli/schema.json' - - 'core/tauri-config-schema/schema.json' concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/check-license-header.yml b/.github/workflows/check-license-header.yml index 61a83af07..00893dc0c 100644 --- a/.github/workflows/check-license-header.yml +++ b/.github/workflows/check-license-header.yml @@ -25,4 +25,4 @@ jobs: - added: '**' - name: check header license on new files if: ${{ steps.filter.outputs.added == 'true' }} - run: node check-license-header.js ${{ steps.filter.outputs.added_files }} + run: node ./.scripts/ci/check-license-header.js ${{ steps.filter.outputs.added_files }} diff --git a/.github/workflows/covector-version-or-publish.yml b/.github/workflows/covector-version-or-publish.yml index 27b8e57b6..16b3eb0f5 100644 --- a/.github/workflows/covector-version-or-publish.yml +++ b/.github/workflows/covector-version-or-publish.yml @@ -121,7 +121,9 @@ jobs: steps.covector.outputs.successfulPublish == 'true' && contains(steps.covector.outputs.packagesPublished, '@tauri-apps/cli') run: | - id=$(jq '.-tauri-apps-cli-releaseId' <<< "${{ steps.covector.outputs }}") + echo '${{ steps.covector.outputs }}' > output.json + id=$(jq '.["-tauri-apps-cli-releaseId"]' < output.json) + rm output.json echo "cliReleaseId=$id" >> "$GITHUB_OUTPUT" - name: Trigger `@tauri-apps/cli` publishing workflow diff --git a/.github/workflows/lint-core.yml b/.github/workflows/lint-core.yml index 68b01ea6b..06c62a115 100644 --- a/.github/workflows/lint-core.yml +++ b/.github/workflows/lint-core.yml @@ -50,7 +50,7 @@ jobs: clippy: - { args: '', key: 'empty' } - { - args: '--features compression,wry,linux-protocol-headers,isolation,custom-protocol,system-tray', + args: '--features compression,wry,linux-protocol-headers,isolation,custom-protocol,system-tray,test', key: 'all' } - { args: '--features custom-protocol', key: 'custom-protocol' } diff --git a/.github/workflows/test-core.yml b/.github/workflows/test-core.yml index 39d5c16d0..6d1376684 100644 --- a/.github/workflows/test-core.yml +++ b/.github/workflows/test-core.yml @@ -72,7 +72,7 @@ jobs: key: no-default } - { - args: --features compression,wry,linux-protocol-headers,isolation,custom-protocol,system-tray, + args: --features compression,wry,linux-protocol-headers,isolation,custom-protocol,system-tray,test, key: all } diff --git a/.scripts/cargo-check.ps1 b/.scripts/cargo-check.ps1 index d6a7e2a47..bf67d2511 100755 --- a/.scripts/cargo-check.ps1 +++ b/.scripts/cargo-check.ps1 @@ -1,4 +1,5 @@ #!/usr/bin/env pwsh + # Copyright 2019-2023 Tauri Programme within The Commons Conservancy # SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: MIT diff --git a/.scripts/cargo-check.sh b/.scripts/cargo-check.sh index e274df4ea..9c1134247 100755 --- a/.scripts/cargo-check.sh +++ b/.scripts/cargo-check.sh @@ -1,4 +1,5 @@ #!/usr/bin/env sh + # Copyright 2019-2023 Tauri Programme within The Commons Conservancy # SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: MIT diff --git a/.scripts/ci/check-change-tags.js b/.scripts/ci/check-change-tags.js new file mode 100644 index 000000000..d49c7c54c --- /dev/null +++ b/.scripts/ci/check-change-tags.js @@ -0,0 +1,79 @@ +#!/usr/bin/env node + +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +const fs = require('fs') +const path = require('path') +const ignorePackages = [ + 'tauri-macros', + 'tauri-codegen', + 'tauri-runtime', + 'tauri-runtime-wry', + 'tauri-driver' +] + +const covectorConfig = JSON.parse( + fs.readFileSync('.changes/config.json', 'utf8') +) +const tags = Object.keys(covectorConfig.changeTags) + +const missingTagsFiles = {} +const unknownTagsFiles = {} + +function checkChangeFiles(changeFiles) { + for (const file of changeFiles) { + const content = fs.readFileSync(file, 'utf8') + const [frontMatter] = /^---[\s\S.]*---\n/i.exec(content) + const packages = frontMatter + .split('\n') + .filter((l) => !(l === '---' || !l)) + .map((l) => l.replace(/('|")/g, '').split(':')) + + for (const [package, _, tag] of packages) { + if (!tag) { + if (ignorePackages.includes(package)) continue + + if (!missingTagsFiles[file]) missingTagsFiles[file] = [] + missingTagsFiles[file].push(package) + } else if (!tags.includes(tag)) { + if (!unknownTagsFiles[file]) unknownTagsFiles[file] = [] + unknownTagsFiles[file].push({ package, tag }) + } + } + } + const missingTagsEntries = Object.entries(missingTagsFiles) + const unknownTagsEntries = Object.entries(unknownTagsFiles) + if (missingTagsEntries.length > 0 || unknownTagsEntries.length > 0) { + for (const [file, packages] of missingTagsEntries) { + for (const package of packages) { + console.error( + `Package \`${package}\` is missing a change tag in ${file} ` + ) + } + } + + for (const [file, packages] of unknownTagsEntries) { + for (const { package, tag } of packages) { + console.error( + `Package \`${package}\` has an uknown change tag ${tag} in ${file} ` + ) + } + } + + process.exit(1) + } +} + +const [_bin, _script, ...files] = process.argv + +if (files.length > 0) { + checkChangeFiles(files.filter((f) => f.toLowerCase() !== 'readme.md')) +} else { + const changeFiles = fs + .readdirSync('.changes') + .filter((f) => f.endsWith('.md') && f.toLowerCase() !== 'readme.md') + .map((p) => path.join('.changes', p)) + checkChangeFiles(changeFiles) +} diff --git a/check-license-header.js b/.scripts/ci/check-license-header.js similarity index 78% rename from check-license-header.js rename to .scripts/ci/check-license-header.js index a79c0e54b..ce6458b7c 100644 --- a/check-license-header.js +++ b/.scripts/ci/check-license-header.js @@ -1,3 +1,5 @@ +#!/usr/bin/env node + // Copyright 2019-2023 Tauri Programme within The Commons Conservancy // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT @@ -9,13 +11,22 @@ const readline = require('readline') const header = `Copyright 2019-2023 Tauri Programme within The Commons Conservancy SPDX-License-Identifier: Apache-2.0 SPDX-License-Identifier: MIT` -const bundlerLicense = '// Copyright 2016-2019 Cargo-Bundle developers ' +const bundlerLicense = + '// Copyright 2016-2019 Cargo-Bundle developers ' const extensions = ['.rs', '.js', '.ts', '.yml', '.swift', '.kt'] -const ignore = ['target', 'templates', 'node_modules', 'gen', 'dist', 'bundle.js', 'bundle.global.js'] +const ignore = [ + 'target', + 'templates', + 'node_modules', + 'gen', + 'dist', + 'bundle.js', + 'bundle.global.js' +] async function checkFile(file) { - if (extensions.some(e => file.endsWith(e))) { + if (extensions.some((e) => file.endsWith(e))) { const fileStream = fs.createReadStream(file) const rl = readline.createInterface({ input: fileStream, @@ -25,8 +36,13 @@ async function checkFile(file) { let contents = `` let i = 0 for await (let line of rl) { - // ignore empty lines, allow shebang, swift-tools-version and bundler license - if (line.length === 0 || line.startsWith("#!") || line.startsWith('// swift-tools-version:') || line === bundlerLicense) { + // ignore empty lines, allow shebang and bundler license + if ( + line.length === 0 || + line.startsWith('#!') || + line.startsWith('// swift-tools-version:') || + line === bundlerLicense + ) { continue } @@ -93,7 +109,7 @@ if (files.length > 0) { run() } else { - check('.').then(missing => { + check('.').then((missing) => { if (missing.length > 0) { console.log(missing.join('\n')) process.exit(1) diff --git a/.scripts/ci/has-diff.sh b/.scripts/ci/has-diff.sh index dd40c06fd..30c19d4f1 100755 --- a/.scripts/ci/has-diff.sh +++ b/.scripts/ci/has-diff.sh @@ -1,5 +1,9 @@ #!/bin/bash +# Copyright 2019-2023 Tauri Programme within The Commons Conservancy +# SPDX-License-Identifier: Apache-2.0 +# SPDX-License-Identifier: MIT + if git diff --quiet --ignore-submodules HEAD then echo "working directory is clean" diff --git a/.scripts/ci/pack-cli.sh b/.scripts/ci/pack-cli.sh index 4b54bf02a..1cef91b9d 100755 --- a/.scripts/ci/pack-cli.sh +++ b/.scripts/ci/pack-cli.sh @@ -1,4 +1,9 @@ #!/bin/bash + +# Copyright 2019-2023 Tauri Programme within The Commons Conservancy +# SPDX-License-Identifier: Apache-2.0 +# SPDX-License-Identifier: MIT + set -euxo pipefail for o in outputs/*; do diff --git a/.scripts/covector/package-latest-version.js b/.scripts/covector/package-latest-version.js index 3988a926e..53430e6db 100644 --- a/.scripts/covector/package-latest-version.js +++ b/.scripts/covector/package-latest-version.js @@ -1,4 +1,5 @@ #!/usr/bin/env node + // Copyright 2019-2023 Tauri Programme within The Commons Conservancy // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT diff --git a/.scripts/covector/sync-cli-metadata.js b/.scripts/covector/sync-cli-metadata.js index 707837ddd..4edef073a 100644 --- a/.scripts/covector/sync-cli-metadata.js +++ b/.scripts/covector/sync-cli-metadata.js @@ -1,4 +1,5 @@ #!/usr/bin/env node + // Copyright 2019-2023 Tauri Programme within The Commons Conservancy // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT diff --git a/.scripts/docker/build.sh b/.scripts/docker/build.sh index cac4ba70a..10f61e7f0 100755 --- a/.scripts/docker/build.sh +++ b/.scripts/docker/build.sh @@ -1,3 +1,7 @@ #!/bin/sh +# Copyright 2019-2023 Tauri Programme within The Commons Conservancy +# SPDX-License-Identifier: Apache-2.0 +# SPDX-License-Identifier: MIT + docker build -t aarch64-unknown-linux-gnu:latest --file .docker/cross/aarch64.Dockerfile .docker/cross diff --git a/.scripts/setup.ps1 b/.scripts/setup.ps1 index d63202084..a841c5f99 100644 --- a/.scripts/setup.ps1 +++ b/.scripts/setup.ps1 @@ -1,4 +1,5 @@ #!/usr/bin/env pwsh + # Copyright 2019-2023 Tauri Programme within The Commons Conservancy # SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: MIT diff --git a/.scripts/setup.sh b/.scripts/setup.sh index e1d075f29..5e2f91743 100755 --- a/.scripts/setup.sh +++ b/.scripts/setup.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash + # Copyright 2019-2023 Tauri Programme within The Commons Conservancy # SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: MIT diff --git a/.scripts/update-lockfiles.sh b/.scripts/update-lockfiles.sh index c9d9bc2da..961d0fb4c 100755 --- a/.scripts/update-lockfiles.sh +++ b/.scripts/update-lockfiles.sh @@ -1,4 +1,5 @@ #!/usr/bin/env sh + # Copyright 2019-2023 Tauri Programme within The Commons Conservancy # SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: MIT diff --git a/.scripts/utils/batch_to_exe.cmd b/.scripts/utils/batch_to_exe.cmd index 6f65c1a93..3d5ffa6d8 100644 --- a/.scripts/utils/batch_to_exe.cmd +++ b/.scripts/utils/batch_to_exe.cmd @@ -1,3 +1,7 @@ +: Copyright 2019-2023 Tauri Programme within The Commons Conservancy +: SPDX-License-Identifier: Apache-2.0 +: SPDX-License-Identifier: MIT + @ECHO OFF REM Copyright 2019-2023 Tauri Programme within The Commons Conservancy diff --git a/core/tauri-build/CHANGELOG.md b/core/tauri-build/CHANGELOG.md index 00977d0ef..5eda582b7 100644 --- a/core/tauri-build/CHANGELOG.md +++ b/core/tauri-build/CHANGELOG.md @@ -39,6 +39,14 @@ - First mobile alpha release! - [fa3a1098](https://www.github.com/tauri-apps/tauri/commit/fa3a10988a03aed1b66fb17d893b1a9adb90f7cd) feat(ci): prepare 2.0.0-alpha.0 ([#5786](https://www.github.com/tauri-apps/tauri/pull/5786)) on 2022-12-08 +## \[1.4.0] + +### Enhancements + +- [`52474e47`](https://www.github.com/tauri-apps/tauri/commit/52474e479d695865299d8c8d868fb98b99731020)([#7141](https://www.github.com/tauri-apps/tauri/pull/7141)) Enhance Cargo features check. +- [`af937290`](https://www.github.com/tauri-apps/tauri/commit/af93729031565a69d1fde6cf16bea3b9b6e43a65)([#6676](https://www.github.com/tauri-apps/tauri/pull/6676)) On Windows, set `LegalCopyright` and `FileDescription` file properties on the executable from `tauri.bundle.copyright` and `tauri.bundle.shortDescription`, +- [`d2710e9d`](https://www.github.com/tauri-apps/tauri/commit/d2710e9d2e8fd93975ef6494512370faa8cb3b7e)([#6944](https://www.github.com/tauri-apps/tauri/pull/6944)) Unpin `time`, `ignore`, and `winnow` crate versions. Developers now have to pin crates if needed themselves. A list of crates that need pinning to adhere to Tauri's MSRV will be visible in Tauri's GitHub workflow: https://github.com/tauri-apps/tauri/blob/dev/.github/workflows/test-core.yml#L85. + ## \[1.3.0] - Bump minimum supported Rust version to 1.60. diff --git a/core/tauri-build/src/allowlist.rs b/core/tauri-build/src/allowlist.rs new file mode 100644 index 000000000..34654f689 --- /dev/null +++ b/core/tauri-build/src/allowlist.rs @@ -0,0 +1,211 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use anyhow::{anyhow, Result}; +use cargo_toml::{Dependency, Manifest}; +use tauri_utils::config::{Config, PatternKind, TauriConfig}; + +#[derive(Debug, Default, PartialEq, Eq)] +struct Diff { + remove: Vec, + add: Vec, +} + +#[derive(Debug, Clone, Copy)] +enum DependencyKind { + Build, + Normal, +} + +#[derive(Debug)] +struct AllowlistedDependency { + name: String, + alias: Option, + kind: DependencyKind, + all_cli_managed_features: Option>, + expected_features: Vec, +} + +pub fn check(config: &Config, manifest: &mut Manifest) -> Result<()> { + let dependencies = vec![ + AllowlistedDependency { + name: "tauri-build".into(), + alias: None, + kind: DependencyKind::Build, + all_cli_managed_features: Some(vec!["isolation"]), + expected_features: match config.tauri.pattern { + PatternKind::Isolation { .. } => vec!["isolation".to_string()], + _ => vec![], + }, + }, + AllowlistedDependency { + name: "tauri".into(), + alias: None, + kind: DependencyKind::Normal, + all_cli_managed_features: Some(TauriConfig::all_features()), + expected_features: config + .tauri + .features() + .into_iter() + .map(|f| f.to_string()) + .collect::>(), + }, + ]; + + for metadata in dependencies { + let mut name = metadata.name.clone(); + let mut deps = find_dependency(manifest, &metadata.name, metadata.kind); + if deps.is_empty() { + if let Some(alias) = &metadata.alias { + deps = find_dependency(manifest, alias, metadata.kind); + name = alias.clone(); + } + } + + for dep in deps { + if let Err(error) = check_features(dep, &metadata) { + return Err(anyhow!(" + The `{}` dependency features on the `Cargo.toml` file does not match the allowlist defined under `tauri.conf.json`. + Please run `tauri dev` or `tauri build` or {}. + ", name, error)); + } + } + } + + Ok(()) +} + +fn find_dependency(manifest: &mut Manifest, name: &str, kind: DependencyKind) -> Vec { + let dep = match kind { + DependencyKind::Build => manifest.build_dependencies.remove(name), + DependencyKind::Normal => manifest.dependencies.remove(name), + }; + + if let Some(dep) = dep { + vec![dep] + } else { + let mut deps = Vec::new(); + for target in manifest.target.values_mut() { + if let Some(dep) = match kind { + DependencyKind::Build => target.build_dependencies.remove(name), + DependencyKind::Normal => target.dependencies.remove(name), + } { + deps.push(dep); + } + } + deps + } +} + +fn features_diff(current: &[String], expected: &[String]) -> Diff { + let mut remove = Vec::new(); + let mut add = Vec::new(); + for feature in current { + if !expected.contains(feature) { + remove.push(feature.clone()); + } + } + + for feature in expected { + if !current.contains(feature) { + add.push(feature.clone()); + } + } + + Diff { remove, add } +} + +fn check_features(dependency: Dependency, metadata: &AllowlistedDependency) -> Result<(), String> { + let features = match dependency { + Dependency::Simple(_) => Vec::new(), + Dependency::Detailed(dep) => dep.features, + Dependency::Inherited(dep) => dep.features, + }; + + let diff = if let Some(all_cli_managed_features) = &metadata.all_cli_managed_features { + features_diff( + &features + .into_iter() + .filter(|f| all_cli_managed_features.contains(&f.as_str())) + .collect::>(), + &metadata.expected_features, + ) + } else { + features_diff( + &features + .into_iter() + .filter(|f| f.starts_with("allow-")) + .collect::>(), + &metadata.expected_features, + ) + }; + + let mut error_message = String::new(); + if !diff.remove.is_empty() { + error_message.push_str("remove the `"); + error_message.push_str(&diff.remove.join(", ")); + error_message.push_str(if diff.remove.len() == 1 { + "` feature" + } else { + "` features" + }); + if !diff.add.is_empty() { + error_message.push_str(" and "); + } + } + if !diff.add.is_empty() { + error_message.push_str("add the `"); + error_message.push_str(&diff.add.join(", ")); + error_message.push_str(if diff.add.len() == 1 { + "` feature" + } else { + "` features" + }); + } + + if error_message.is_empty() { + Ok(()) + } else { + Err(error_message) + } +} + +#[cfg(test)] +mod tests { + use super::Diff; + + #[test] + fn array_diff() { + for (current, expected, result) in [ + (vec![], vec![], Default::default()), + ( + vec!["a".into()], + vec![], + Diff { + remove: vec!["a".into()], + add: vec![], + }, + ), + (vec!["a".into()], vec!["a".into()], Default::default()), + ( + vec!["a".into(), "b".into()], + vec!["a".into()], + Diff { + remove: vec!["b".into()], + add: vec![], + }, + ), + ( + vec!["a".into(), "b".into()], + vec!["a".into(), "c".into()], + Diff { + remove: vec!["b".into()], + add: vec!["c".into()], + }, + ), + ] { + assert_eq!(super::features_diff(¤t, &expected), result); + } + } +} diff --git a/core/tauri-build/src/lib.rs b/core/tauri-build/src/lib.rs index 47881f63b..35539de45 100644 --- a/core/tauri-build/src/lib.rs +++ b/core/tauri-build/src/lib.rs @@ -6,7 +6,7 @@ use anyhow::Context; pub use anyhow::Result; -use cargo_toml::{Dependency, Manifest}; +use cargo_toml::Manifest; use heck::AsShoutySnakeCase; use tauri_utils::{ @@ -19,6 +19,7 @@ use std::{ path::{Path, PathBuf}, }; +mod allowlist; #[cfg(feature = "codegen")] mod codegen; /// Mobile build functions. @@ -323,27 +324,7 @@ pub fn try_build(attributes: Attributes) -> Result<()> { Manifest::complete_from_path(&mut manifest, Path::new("Cargo.toml"))?; } - if let Some(tauri_build) = manifest.build_dependencies.remove("tauri-build") { - let error_message = check_features(&config, tauri_build, true); - - if !error_message.is_empty() { - return Err(anyhow!(" - The `tauri-build` dependency features on the `Cargo.toml` file does not match the allowlist defined under `tauri.conf.json`. - Please run `tauri dev` or `tauri build` or {}. - ", error_message)); - } - } - - if let Some(tauri) = manifest.dependencies.remove("tauri") { - let error_message = check_features(&config, tauri, false); - - if !error_message.is_empty() { - return Err(anyhow!(" - The `tauri` dependency features on the `Cargo.toml` file does not match the `tauri.conf.json` config. - Please run `tauri dev` or `tauri build` or {}. - ", error_message)); - } - } + allowlist::check(&config, &mut manifest)?; let target_triple = std::env::var("TARGET").unwrap(); @@ -424,24 +405,23 @@ pub fn try_build(attributes: Attributes) -> Result<()> { } res.set("FileVersion", version_str); res.set("ProductVersion", version_str); - - if let Some(product_name) = &config.package.product_name { - res.set("ProductName", product_name); - } - if let Some(short_description) = &config.tauri.bundle.short_description { - res.set("FileDescription", short_description); - } - if let Some(copyright) = &config.tauri.bundle.copyright { - res.set("LegalCopyright", copyright); - } - res.set_icon_with_id(&window_icon_path.display().to_string(), "32512"); - res.compile().with_context(|| { - format!( - "failed to compile `{}` into a Windows Resource file during tauri-build", - window_icon_path.display() - ) - })?; } + if let Some(product_name) = &config.package.product_name { + res.set("ProductName", product_name); + } + if let Some(short_description) = &config.tauri.bundle.short_description { + res.set("FileDescription", short_description); + } + if let Some(copyright) = &config.tauri.bundle.copyright { + res.set("LegalCopyright", copyright); + } + res.set_icon_with_id(&window_icon_path.display().to_string(), "32512"); + res.compile().with_context(|| { + format!( + "failed to compile `{}` into a Windows Resource file during tauri-build", + window_icon_path.display() + ) + })?; } else { return Err(anyhow!(format!( "`{}` not found; required for generating a Windows Resource file during tauri-build", @@ -486,93 +466,6 @@ pub fn try_build(attributes: Attributes) -> Result<()> { Ok(()) } -#[derive(Debug, Default, PartialEq, Eq)] -struct Diff { - remove: Vec, - add: Vec, -} - -fn features_diff(current: &[String], expected: &[String]) -> Diff { - let mut remove = Vec::new(); - let mut add = Vec::new(); - for feature in current { - if !expected.contains(feature) { - remove.push(feature.clone()); - } - } - - for feature in expected { - if !current.contains(feature) { - add.push(feature.clone()); - } - } - - Diff { remove, add } -} - -fn check_features(config: &Config, dependency: Dependency, is_tauri_build: bool) -> String { - use tauri_utils::config::{PatternKind, TauriConfig}; - - let features = match dependency { - Dependency::Simple(_) => Vec::new(), - Dependency::Detailed(dep) => dep.features, - Dependency::Inherited(dep) => dep.features, - }; - - let all_cli_managed_features = if is_tauri_build { - vec!["isolation"] - } else { - TauriConfig::all_features() - }; - - let expected = if is_tauri_build { - match config.tauri.pattern { - PatternKind::Isolation { .. } => vec!["isolation".to_string()], - _ => vec![], - } - } else { - config - .tauri - .features() - .into_iter() - .map(|f| f.to_string()) - .collect::>() - }; - - let diff = features_diff( - &features - .into_iter() - .filter(|f| all_cli_managed_features.contains(&f.as_str())) - .collect::>(), - &expected, - ); - - let mut error_message = String::new(); - if !diff.remove.is_empty() { - error_message.push_str("remove the `"); - error_message.push_str(&diff.remove.join(", ")); - error_message.push_str(if diff.remove.len() == 1 { - "` feature" - } else { - "` features" - }); - if !diff.add.is_empty() { - error_message.push_str(" and "); - } - } - if !diff.add.is_empty() { - error_message.push_str("add the `"); - error_message.push_str(&diff.add.join(", ")); - error_message.push_str(if diff.add.len() == 1 { - "` feature" - } else { - "` features" - }); - } - - error_message -} - #[derive(serde::Deserialize)] struct CargoMetadata { workspace_root: PathBuf, @@ -592,42 +485,3 @@ fn get_workspace_dir() -> Result { Ok(serde_json::from_slice::(&output.stdout)?.workspace_root) } - -#[cfg(test)] -mod tests { - use super::Diff; - - #[test] - fn array_diff() { - for (current, expected, result) in [ - (vec![], vec![], Default::default()), - ( - vec!["a".into()], - vec![], - Diff { - remove: vec!["a".into()], - add: vec![], - }, - ), - (vec!["a".into()], vec!["a".into()], Default::default()), - ( - vec!["a".into(), "b".into()], - vec!["a".into()], - Diff { - remove: vec!["b".into()], - add: vec![], - }, - ), - ( - vec!["a".into(), "b".into()], - vec!["a".into(), "c".into()], - Diff { - remove: vec!["b".into()], - add: vec!["c".into()], - }, - ), - ] { - assert_eq!(super::features_diff(¤t, &expected), result); - } - } -} diff --git a/core/tauri-codegen/CHANGELOG.md b/core/tauri-codegen/CHANGELOG.md index 0fcb947e0..37ed4158f 100644 --- a/core/tauri-codegen/CHANGELOG.md +++ b/core/tauri-codegen/CHANGELOG.md @@ -36,6 +36,13 @@ - First mobile alpha release! - [fa3a1098](https://www.github.com/tauri-apps/tauri/commit/fa3a10988a03aed1b66fb17d893b1a9adb90f7cd) feat(ci): prepare 2.0.0-alpha.0 ([#5786](https://www.github.com/tauri-apps/tauri/pull/5786)) on 2022-12-08 +## \[1.4.0] + +### Enhancements + +- [`17d5a4f5`](https://www.github.com/tauri-apps/tauri/commit/17d5a4f51f244d3ff42014b5d1b075fad7c636a5)([#6706](https://www.github.com/tauri-apps/tauri/pull/6706)) Early panic if the PNG icon is not RGBA. +- [`d2710e9d`](https://www.github.com/tauri-apps/tauri/commit/d2710e9d2e8fd93975ef6494512370faa8cb3b7e)([#6944](https://www.github.com/tauri-apps/tauri/pull/6944)) Unpin `time`, `ignore`, and `winnow` crate versions. Developers now have to pin crates if needed themselves. A list of crates that need pinning to adhere to Tauri's MSRV will be visible in Tauri's GitHub workflow: https://github.com/tauri-apps/tauri/blob/dev/.github/workflows/test-core.yml#L85. + ## \[1.3.0] - Bump minimum supported Rust version to 1.60. diff --git a/core/tauri-macros/CHANGELOG.md b/core/tauri-macros/CHANGELOG.md index 9d0f972f7..acda17970 100644 --- a/core/tauri-macros/CHANGELOG.md +++ b/core/tauri-macros/CHANGELOG.md @@ -43,6 +43,12 @@ - First mobile alpha release! - [fa3a1098](https://www.github.com/tauri-apps/tauri/commit/fa3a10988a03aed1b66fb17d893b1a9adb90f7cd) feat(ci): prepare 2.0.0-alpha.0 ([#5786](https://www.github.com/tauri-apps/tauri/pull/5786)) on 2022-12-08 +## \[1.4.0] + +### Enhancements + +- [`d68a25e3`](https://www.github.com/tauri-apps/tauri/commit/d68a25e32e012e57a9e5225b589b9ecbea70a887)([#6124](https://www.github.com/tauri-apps/tauri/pull/6124)) Improve compiler error message when generating an async command that has a reference input and don't return a Result. + ## \[1.3.0] - Bump minimum supported Rust version to 1.60. diff --git a/core/tauri-runtime-wry/CHANGELOG.md b/core/tauri-runtime-wry/CHANGELOG.md index 839036a4a..ced4eff90 100644 --- a/core/tauri-runtime-wry/CHANGELOG.md +++ b/core/tauri-runtime-wry/CHANGELOG.md @@ -44,6 +44,26 @@ - Support `with_webview` for Android platform alowing execution of JNI code in context. - [8ea87e9c](https://www.github.com/tauri-apps/tauri/commit/8ea87e9c9ca8ba4c7017c8281f78aacd08f45785) feat(android): with_webview access for jni execution ([#5148](https://www.github.com/tauri-apps/tauri/pull/5148)) on 2022-09-08 +## \[0.14.0] + +### New Features + +- [`c4d6fb4b`](https://www.github.com/tauri-apps/tauri/commit/c4d6fb4b1ea8acf02707a9fe5dcab47c1c5bae7b)([#2353](https://www.github.com/tauri-apps/tauri/pull/2353)) Added the `maximizable`, `minimizable` and `closable` methods to `WindowBuilder`. +- [`c4d6fb4b`](https://www.github.com/tauri-apps/tauri/commit/c4d6fb4b1ea8acf02707a9fe5dcab47c1c5bae7b)([#2353](https://www.github.com/tauri-apps/tauri/pull/2353)) Added `set_maximizable`, `set_minimizable`, `set_closable`, `is_maximizable`, `is_minimizable` and `is_closable` methods to the `Dispatch` trait. +- [`000104bc`](https://www.github.com/tauri-apps/tauri/commit/000104bc3bc0c9ff3d20558ab9cf2080f126e9e0)([#6472](https://www.github.com/tauri-apps/tauri/pull/6472)) Add `Window::is_focused` getter. + +### Enhancements + +- [`d2710e9d`](https://www.github.com/tauri-apps/tauri/commit/d2710e9d2e8fd93975ef6494512370faa8cb3b7e)([#6944](https://www.github.com/tauri-apps/tauri/pull/6944)) Unpin `time`, `ignore`, and `winnow` crate versions. Developers now have to pin crates if needed themselves. A list of crates that need pinning to adhere to Tauri's MSRV will be visible in Tauri's GitHub workflow: https://github.com/tauri-apps/tauri/blob/dev/.github/workflows/test-core.yml#L85. + +### Bug Fixes + +- [`b41b57eb`](https://www.github.com/tauri-apps/tauri/commit/b41b57ebb27befd366db5befaafb6043c18fdfef)([#7105](https://www.github.com/tauri-apps/tauri/pull/7105)) Fix panics when registering an invalid global shortcuts or checking it is registered and return proper errors instead. + +### What's Changed + +- [`076e1a81`](https://www.github.com/tauri-apps/tauri/commit/076e1a81a50468e3dfb34ae9ca7e77c5e1758daa)([#7119](https://www.github.com/tauri-apps/tauri/pull/7119)) Use `u32` instead of `u64` for js event listener ids + ## \[0.13.0] - Added the `additional_browser_args` option when creating a window. diff --git a/core/tauri-runtime/CHANGELOG.md b/core/tauri-runtime/CHANGELOG.md index 384e4606f..589748c30 100644 --- a/core/tauri-runtime/CHANGELOG.md +++ b/core/tauri-runtime/CHANGELOG.md @@ -43,6 +43,27 @@ - Bumped due to a bump in tauri-utils. - [fa3a1098](https://www.github.com/tauri-apps/tauri/commit/fa3a10988a03aed1b66fb17d893b1a9adb90f7cd) feat(ci): prepare 2.0.0-alpha.0 ([#5786](https://www.github.com/tauri-apps/tauri/pull/5786)) on 2022-12-08 +## \[0.14.0] + +### New Features + +- [`c4d6fb4b`](https://www.github.com/tauri-apps/tauri/commit/c4d6fb4b1ea8acf02707a9fe5dcab47c1c5bae7b)([#2353](https://www.github.com/tauri-apps/tauri/pull/2353)) Added the `maximizable`, `minimizable` and `closable` methods to `WindowBuilder`. +- [`c4d6fb4b`](https://www.github.com/tauri-apps/tauri/commit/c4d6fb4b1ea8acf02707a9fe5dcab47c1c5bae7b)([#2353](https://www.github.com/tauri-apps/tauri/pull/2353)) Added `set_maximizable`, `set_minimizable`, `set_closable`, `is_maximizable`, `is_minimizable` and `is_closable` methods to the `Dispatch` trait. +- [`000104bc`](https://www.github.com/tauri-apps/tauri/commit/000104bc3bc0c9ff3d20558ab9cf2080f126e9e0)([#6472](https://www.github.com/tauri-apps/tauri/pull/6472)) Add `Window::is_focused` getter. + +### Enhancements + +- [`d2710e9d`](https://www.github.com/tauri-apps/tauri/commit/d2710e9d2e8fd93975ef6494512370faa8cb3b7e)([#6944](https://www.github.com/tauri-apps/tauri/pull/6944)) Unpin `time`, `ignore`, and `winnow` crate versions. Developers now have to pin crates if needed themselves. A list of crates that need pinning to adhere to Tauri's MSRV will be visible in Tauri's GitHub workflow: https://github.com/tauri-apps/tauri/blob/dev/.github/workflows/test-core.yml#L85. + +### Bug Fixes + +- [`2b487c94`](https://www.github.com/tauri-apps/tauri/commit/2b487c946737352187d7e042dd6142873e62a4ca)([#7012](https://www.github.com/tauri-apps/tauri/pull/7012)) Fixes typo in `CursorIcon` deserialization of the `ZoomIn` variant. + +### What's Changed + +- [`076e1a81`](https://www.github.com/tauri-apps/tauri/commit/076e1a81a50468e3dfb34ae9ca7e77c5e1758daa)([#7119](https://www.github.com/tauri-apps/tauri/pull/7119)) Use `u32` instead of `u64` for js event listener ids +- [`ff5e4dbb`](https://www.github.com/tauri-apps/tauri/commit/ff5e4dbbb01bf3fc9c5143df732c75eef6fd98cb)([#6794](https://www.github.com/tauri-apps/tauri/pull/6794)) impl `From<&WindowConfig>` for `WebviewAttributes`. + ## \[0.13.0] - Added the `additional_browser_args` option when creating a window. diff --git a/core/tauri-utils/CHANGELOG.md b/core/tauri-utils/CHANGELOG.md index 2a910a61e..ad110dde0 100644 --- a/core/tauri-utils/CHANGELOG.md +++ b/core/tauri-utils/CHANGELOG.md @@ -40,6 +40,19 @@ - First mobile alpha release! - [fa3a1098](https://www.github.com/tauri-apps/tauri/commit/fa3a10988a03aed1b66fb17d893b1a9adb90f7cd) feat(ci): prepare 2.0.0-alpha.0 ([#5786](https://www.github.com/tauri-apps/tauri/pull/5786)) on 2022-12-08 +## \[1.4.0] + +### New Features + +- [`acc36fe1`](https://www.github.com/tauri-apps/tauri/commit/acc36fe1176cc8aa9063bde932abeb94796c5c72)([#6158](https://www.github.com/tauri-apps/tauri/pull/6158)) Add option to configure `require_literal_leading_dot` on `fs` and `asset` protcol scopes. +- [`35cd751a`](https://www.github.com/tauri-apps/tauri/commit/35cd751adc6fef1f792696fa0cfb471b0bf99374)([#5176](https://www.github.com/tauri-apps/tauri/pull/5176)) Added the `desktop_template` option on `tauri.conf.json > tauri > bundle > deb`. +- [`c4d6fb4b`](https://www.github.com/tauri-apps/tauri/commit/c4d6fb4b1ea8acf02707a9fe5dcab47c1c5bae7b)([#2353](https://www.github.com/tauri-apps/tauri/pull/2353)) Added the `maximizable`, `minimizable` and `closable` options to the window configuration. +- [`3cb7a3e6`](https://www.github.com/tauri-apps/tauri/commit/3cb7a3e642bb10ee90dc1d24daa48b8c8c15c9ce)([#6997](https://www.github.com/tauri-apps/tauri/pull/6997)) Add `MimeType::parse_with_fallback` and `MimeType::parse_from_uri_with_fallback` +- [`29488205`](https://www.github.com/tauri-apps/tauri/commit/2948820579d20dfaa0861c2f0a58bd7737a7ffd1)([#6867](https://www.github.com/tauri-apps/tauri/pull/6867)) Allow specifying custom language files of Tauri's custom messages for the NSIS installer +- [`e092f799`](https://www.github.com/tauri-apps/tauri/commit/e092f799469ff32c7d1595d0f07d06fd2dab5c29)([#6887](https://www.github.com/tauri-apps/tauri/pull/6887)) Add `nsis > template` option to specify custom NSIS installer template. +- [`cd3846c8`](https://www.github.com/tauri-apps/tauri/commit/cd3846c8ce61ab2879b3911e831525e6242aaab2)([#6955](https://www.github.com/tauri-apps/tauri/pull/6955)) Add `WindowsUpdateInstallMode::nsis_args` +- [`85e77fb7`](https://www.github.com/tauri-apps/tauri/commit/85e77fb797ec17882f55d0944578d929fc6c9c1f)([#6762](https://www.github.com/tauri-apps/tauri/pull/6762)) Correctly determine MIME type of `.txt` files. + ## \[1.3.0] - Added the `additional_browser_args` option to the window configuration. diff --git a/core/tauri-utils/Cargo.toml b/core/tauri-utils/Cargo.toml index dda6ad6dc..271628a05 100644 --- a/core/tauri-utils/Cargo.toml +++ b/core/tauri-utils/Cargo.toml @@ -39,6 +39,7 @@ walkdir = { version = "2", optional = true } memchr = "2" semver = "1" infer = "0.12" +dunce = "1" [target."cfg(target_os = \"linux\")".dependencies] heck = "0.4" diff --git a/core/tauri-utils/src/config.rs b/core/tauri-utils/src/config.rs index 5d7c046f9..b8a179293 100644 --- a/core/tauri-utils/src/config.rs +++ b/core/tauri-utils/src/config.rs @@ -1348,7 +1348,6 @@ pub struct TauriConfig { impl TauriConfig { /// Returns all Cargo features. - #[allow(dead_code)] pub fn all_features() -> Vec<&'static str> { vec![ "system-tray", @@ -1359,7 +1358,6 @@ impl TauriConfig { } /// Returns the enabled Cargo features. - #[allow(dead_code)] pub fn features(&self) -> Vec<&str> { let mut features = Vec::new(); if self.system_tray.is_some() { diff --git a/core/tauri-utils/src/lib.rs b/core/tauri-utils/src/lib.rs index 7b22dc686..8d50acf24 100644 --- a/core/tauri-utils/src/lib.rs +++ b/core/tauri-utils/src/lib.rs @@ -390,11 +390,9 @@ macro_rules! debug_eprintln { }; } -/// Reconstructs a path from its components using the platform separator then converts it to String +/// Reconstructs a path from its components using the platform separator then converts it to String and removes UNC prefixes on Windows if it exists. pub fn display_path>(p: P) -> String { - p.as_ref() - .components() - .collect::() + dunce::simplified(&p.as_ref().components().collect::()) .display() .to_string() } diff --git a/core/tauri-utils/src/mime_type.rs b/core/tauri-utils/src/mime_type.rs index ba8a2571b..6b51335e6 100644 --- a/core/tauri-utils/src/mime_type.rs +++ b/core/tauri-utils/src/mime_type.rs @@ -18,10 +18,11 @@ pub enum MimeType { Js, Json, Jsonld, + Mp4, OctetStream, Rtf, Svg, - Mp4, + Txt, } impl std::fmt::Display for MimeType { @@ -34,10 +35,11 @@ impl std::fmt::Display for MimeType { MimeType::Js => "text/javascript", MimeType::Json => "application/json", MimeType::Jsonld => "application/ld+json", + MimeType::Mp4 => "video/mp4", MimeType::OctetStream => "application/octet-stream", MimeType::Rtf => "application/rtf", MimeType::Svg => "image/svg+xml", - MimeType::Mp4 => "video/mp4", + MimeType::Txt => MIMETYPE_PLAIN, }; write!(f, "{mime}") } @@ -62,9 +64,10 @@ impl MimeType { Some("json") => Self::Json, Some("jsonld") => Self::Jsonld, Some("mjs") => Self::Js, + Some("mp4") => Self::Mp4, Some("rtf") => Self::Rtf, Some("svg") => Self::Svg, - Some("mp4") => Self::Mp4, + Some("txt") => Self::Txt, // Assume HTML when a TLD is found for eg. `wry:://tauri.app` | `wry://hello.com` Some(_) => fallback, // using octet stream according to this: @@ -133,14 +136,17 @@ mod tests { let mjs: String = MimeType::parse_from_uri("https://example.com/bundled.mjs").to_string(); assert_eq!(mjs, String::from("text/javascript")); + let mp4: String = MimeType::parse_from_uri("https://example.com/video.mp4").to_string(); + assert_eq!(mp4, String::from("video/mp4")); + let rtf: String = MimeType::parse_from_uri("https://example.com/document.rtf").to_string(); assert_eq!(rtf, String::from("application/rtf")); let svg: String = MimeType::parse_from_uri("https://example.com/picture.svg").to_string(); assert_eq!(svg, String::from("image/svg+xml")); - let mp4: String = MimeType::parse_from_uri("https://example.com/video.mp4").to_string(); - assert_eq!(mp4, String::from("video/mp4")); + let txt: String = MimeType::parse_from_uri("https://example.com/file.txt").to_string(); + assert_eq!(txt, String::from("text/plain")); let custom_scheme = MimeType::parse_from_uri("wry://tauri.app").to_string(); assert_eq!(custom_scheme, String::from("text/html")); diff --git a/core/tauri/CHANGELOG.md b/core/tauri/CHANGELOG.md index 515cf3e83..b024eb05e 100644 --- a/core/tauri/CHANGELOG.md +++ b/core/tauri/CHANGELOG.md @@ -140,6 +140,41 @@ - Export types required by the `mobile_entry_point` macro. - [98904863](https://www.github.com/tauri-apps/tauri/commit/9890486321c9c79ccfb7c547fafee85b5c3ffa71) feat(core): add `mobile_entry_point` macro ([#4983](https://www.github.com/tauri-apps/tauri/pull/4983)) on 2022-08-21 +## \[1.4.0] + +### New Features + +- [`7c237209`](https://www.github.com/tauri-apps/tauri/commit/7c237209207cd2938df660b6fd87d3b7d728bd03)([#6546](https://www.github.com/tauri-apps/tauri/pull/6546)) Added `tauri::VERSION` const to get Tauri's version from Rust. +- [`4c39e46a`](https://www.github.com/tauri-apps/tauri/commit/4c39e46a3b438d007f139166ab2a0ba34291a10a)([#7026](https://www.github.com/tauri-apps/tauri/pull/7026)) Added `tauri::webview_version` , to get webview version. +- [`359058ce`](https://www.github.com/tauri-apps/tauri/commit/359058cecca44a9c30b65140c44a8bb3a6dd3be8)([#5939](https://www.github.com/tauri-apps/tauri/pull/5939)) Add `tauri::api::os::locale` function to get the system locale. +- [`c4d6fb4b`](https://www.github.com/tauri-apps/tauri/commit/c4d6fb4b1ea8acf02707a9fe5dcab47c1c5bae7b)([#2353](https://www.github.com/tauri-apps/tauri/pull/2353)) Added the `maximizable`, `minimizable` and `closable` options to the window builder. +- [`c4d6fb4b`](https://www.github.com/tauri-apps/tauri/commit/c4d6fb4b1ea8acf02707a9fe5dcab47c1c5bae7b)([#2353](https://www.github.com/tauri-apps/tauri/pull/2353)) Added the `set_maximizable`, `set_minimizable`, `set_closable`, `is_maximizable`, `is_minimizable` and `is_closable` methods on `Window`. +- [`1d99f8a3`](https://www.github.com/tauri-apps/tauri/commit/1d99f8a3c2f989d1a5ba4d805e3a40b07a3ca8a5)([#4752](https://www.github.com/tauri-apps/tauri/pull/4752)) Expose the `test` module behind the `test` Cargo feature. +- [`000104bc`](https://www.github.com/tauri-apps/tauri/commit/000104bc3bc0c9ff3d20558ab9cf2080f126e9e0)([#6472](https://www.github.com/tauri-apps/tauri/pull/6472)) Add `Window::is_focused` and `Manager::get_focused_window` getters. +- [`441f9646`](https://www.github.com/tauri-apps/tauri/commit/441f96465488a4f8a5731cc51b8ac97b685898c7)([#5491](https://www.github.com/tauri-apps/tauri/pull/5491)) Add `MenuHandle::try_get_item` and `SystemTrayHandle::try_get_item` which returns a `Option` instead of panicking. + +### Enhancements + +- [`45330e38`](https://www.github.com/tauri-apps/tauri/commit/45330e38193d0b2a01aa926aec433acc6b8f6597)([#6375](https://www.github.com/tauri-apps/tauri/pull/6375)) Enhance the `asset` protocol to support streaming of large files. +- [`df89ccc1`](https://www.github.com/tauri-apps/tauri/commit/df89ccc1912db6b81d43d56c9e6d66980ece2e8d)([#6955](https://www.github.com/tauri-apps/tauri/pull/6955)) Support `passive` mode for NSIS updater. +- [`cd3846c8`](https://www.github.com/tauri-apps/tauri/commit/cd3846c8ce61ab2879b3911e831525e6242aaab2)([#6955](https://www.github.com/tauri-apps/tauri/pull/6955)) Restart the app after the NSIS updater is finished. +- [`db7c5fbf`](https://www.github.com/tauri-apps/tauri/commit/db7c5fbf2e86f3694720f65834eb2c258b7c1291)([#7143](https://www.github.com/tauri-apps/tauri/pull/7143)) Remove `attohttpc` in favor of `reqwest`. +- [`d2710e9d`](https://www.github.com/tauri-apps/tauri/commit/d2710e9d2e8fd93975ef6494512370faa8cb3b7e)([#6944](https://www.github.com/tauri-apps/tauri/pull/6944)) Unpin `time`, `ignore`, and `winnow` crate versions. Developers now have to pin crates if needed themselves. A list of crates that need pinning to adhere to Tauri's MSRV will be visible in Tauri's GitHub workflow: https://github.com/tauri-apps/tauri/blob/dev/.github/workflows/test-core.yml#L85. +- [`5d85d099`](https://www.github.com/tauri-apps/tauri/commit/5d85d0990cd13a1446953a58633edc24eda55afe)([#7128](https://www.github.com/tauri-apps/tauri/pull/7128)) Send updater status events even if default dialog is enabled. + +### Bug Fixes + +- [`82169e69`](https://www.github.com/tauri-apps/tauri/commit/82169e69fc904d2c7980534c4479bb6f38259fb4)([#5208](https://www.github.com/tauri-apps/tauri/pull/5208)) Fix parsing `allowlist > http > scope` urls that added a trailing slash which broke matching the incoming requests url. +- [`b41b57eb`](https://www.github.com/tauri-apps/tauri/commit/b41b57ebb27befd366db5befaafb6043c18fdfef)([#7105](https://www.github.com/tauri-apps/tauri/pull/7105)) Fix panics when registering an invalid global shortcuts or checking it is registered and return proper errors instead. +- [`aecf1469`](https://www.github.com/tauri-apps/tauri/commit/aecf14690947d109745b4ad823a3e8f4338de47a)([#6889](https://www.github.com/tauri-apps/tauri/pull/6889)) Fix IPC failing after a failed navigation to an external URL. +- [`076e1a81`](https://www.github.com/tauri-apps/tauri/commit/076e1a81a50468e3dfb34ae9ca7e77c5e1758daa)([#7119](https://www.github.com/tauri-apps/tauri/pull/7119)) Fix unlistening to window events failing sometimes. +- [`3f35b452`](https://www.github.com/tauri-apps/tauri/commit/3f35b452637ef1c794a423f1eda62a15d2ddaf42)([#4080](https://www.github.com/tauri-apps/tauri/pull/4080)) Fix `WindowBuilder::on_navigation` handler not registered properly. +- [`0503eb69`](https://www.github.com/tauri-apps/tauri/commit/0503eb69ce7df6b4ed8f5249fdb519b86cd57d8d)([#7078](https://www.github.com/tauri-apps/tauri/pull/7078)) On macOS and Linux, fix app crashing when creating a window with `data:` uri. +- [`3700793a`](https://www.github.com/tauri-apps/tauri/commit/3700793a2f1ea3686b1889c345d73007bb622a29)([#6934](https://www.github.com/tauri-apps/tauri/pull/6934)) Emit `UPTODATE` update status to javascript when the updater server returns status code `204` +- [`ff5e4dbb`](https://www.github.com/tauri-apps/tauri/commit/ff5e4dbbb01bf3fc9c5143df732c75eef6fd98cb)([#6794](https://www.github.com/tauri-apps/tauri/pull/6794)) Fix some configurations not applied when creating the window through Javascript. +- [`65fd674f`](https://www.github.com/tauri-apps/tauri/commit/65fd674f50ba0395d5cea23daf9d2f49f95647fe)([#6652](https://www.github.com/tauri-apps/tauri/pull/6652)) Play a sound when showing a notification on Windows. +- [`696d77c3`](https://www.github.com/tauri-apps/tauri/commit/696d77c3ce480f4a3b4c1c57dae64ff2bb7842ce)([#4493](https://www.github.com/tauri-apps/tauri/pull/4493)) Fixes global events not being received on window-specific event listeners. + ## \[1.3.0] - Added the `additional_browser_args` option when creating a window. diff --git a/core/tauri/Cargo.toml b/core/tauri/Cargo.toml index 3145ce8fa..edf2b03eb 100644 --- a/core/tauri/Cargo.toml +++ b/core/tauri/Cargo.toml @@ -24,6 +24,7 @@ features = [ "devtools", "icon-png", "protocol-asset", + "test", "dox" ] rustdoc-args = [ "--cfg", "doc_cfg" ] @@ -117,6 +118,7 @@ cargo_toml = "0.15" [features] default = [ "wry", "compression", "objc-exception" ] +test = [ ] compression = [ "tauri-macros/compression", "tauri-utils/compression" ] wry = [ "tauri-runtime-wry" ] objc-exception = [ "tauri-runtime-wry/objc-exception" ] diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index a277246c3..7128c8c0c 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -764,7 +764,7 @@ pub struct Builder { invoke_handler: Box>, /// The JS message responder. - invoke_responder: Arc>, + pub(crate) invoke_responder: Arc>, /// The script that initializes the `window.__TAURI_POST_MESSAGE__` function. invoke_initialization_script: String, diff --git a/core/tauri/src/lib.rs b/core/tauri/src/lib.rs index a68f2bcd4..43a5b5da8 100644 --- a/core/tauri/src/lib.rs +++ b/core/tauri/src/lib.rs @@ -11,6 +11,7 @@ //! The following are a list of [Cargo features](https://doc.rust-lang.org/stable/cargo/reference/manifest.html#the-features-section) that can be enabled or disabled: //! //! - **wry** *(enabled by default)*: Enables the [wry](https://github.com/tauri-apps/wry) runtime. Only disable it if you want a custom runtime. +//! - **test**: Enables the [`test`] module exposing unit test helpers. //! - **dox**: Internal feature to generate Rust documentation without linking on Linux. //! - **objc-exception**: Wrap each msg_send! in a @try/@catch and panics if an exception is caught, preventing Objective-C from unwinding into Rust. //! - **linux-protocol-headers**: Enables headers support for custom protocol requests on Linux. Requires webkit2gtk v2.36 or above. @@ -528,18 +529,66 @@ pub trait Manager: sealed::ManagerBase { } /// Emits a event to all windows. + /// + /// Only the webviews receives this event. + /// To trigger Rust listeners, use [`Self::trigger_global`], [`Window::trigger`] or [`Window::emit_and_trigger`]. + /// + /// # Examples + /// ``` + /// use tauri::Manager; + /// + /// #[tauri::command] + /// fn synchronize(app: tauri::AppHandle) { + /// // emits the synchronized event to all windows + /// app.emit_all("synchronized", ()); + /// } + /// ``` fn emit_all(&self, event: &str, payload: S) -> Result<()> { self.manager().emit_filter(event, None, payload, |_| true) } - /// Emits an event to a window with the specified label. + /// Emits an event to the window with the specified label. + /// + /// # Examples + /// ``` + /// use tauri::Manager; + /// + /// #[tauri::command] + /// fn download(app: tauri::AppHandle) { + /// for i in 1..100 { + /// std::thread::sleep(std::time::Duration::from_millis(150)); + /// // emit a download progress event to the updater window + /// app.emit_to("updater", "download-progress", i); + /// } + /// } + /// ``` fn emit_to(&self, label: &str, event: &str, payload: S) -> Result<()> { self .manager() .emit_filter(event, None, payload, |w| label == w.label()) } - /// Listen to a global event. + /// Listen to a event triggered on any window ([`Window::trigger`] or [`Window::emit_and_trigger`]) or with [`Self::trigger_global`]. + /// + /// # Examples + /// ``` + /// use tauri::Manager; + /// + /// #[tauri::command] + /// fn synchronize(window: tauri::Window) { + /// // emits the synchronized event to all windows + /// window.emit_and_trigger("synchronized", ()); + /// } + /// + /// tauri::Builder::default() + /// .setup(|app| { + /// app.listen_global("synchronized", |event| { + /// println!("app is in sync"); + /// }); + /// Ok(()) + /// }) + /// .invoke_handler(tauri::generate_handler![synchronize]); + /// ``` fn listen_global(&self, event: impl Into, handler: F) -> EventHandler where F: Fn(Event) + Send + 'static, @@ -548,6 +597,8 @@ pub trait Manager: sealed::ManagerBase { } /// Listen to a global event only once. + /// + /// See [`Self::listen_global`] for more information. fn once_global(&self, event: impl Into, handler: F) -> EventHandler where F: FnOnce(Event) + Send + 'static, @@ -555,12 +606,54 @@ pub trait Manager: sealed::ManagerBase { self.manager().once(event.into(), None, handler) } - /// Trigger a global event. + /// Trigger a global event to Rust listeners. + /// To send the events to the webview, see [`Self::emit_all`] and [`Self::emit_to`]. + /// To trigger listeners registed on an specific window, see [`Window::trigger`]. + /// To trigger all listeners, see [`Window::emit_and_trigger`]. + /// + /// A global event does not have a source or target window attached. + /// + /// # Examples + /// ``` + /// use tauri::Manager; + /// + /// #[tauri::command] + /// fn download(app: tauri::AppHandle) { + /// for i in 1..100 { + /// std::thread::sleep(std::time::Duration::from_millis(150)); + /// // emit a download progress event to all listeners registed in Rust + /// app.trigger_global("download-progress", Some(i.to_string())); + /// } + /// } + /// ``` fn trigger_global(&self, event: &str, data: Option) { self.manager().trigger(event, None, data) } /// Remove an event listener. + /// + /// # Examples + /// ``` + /// use tauri::Manager; + /// + /// tauri::Builder::default() + /// .setup(|app| { + /// let handle = app.handle(); + /// let handler = app.listen_global("ready", move |event| { + /// println!("app is ready"); + /// + /// // we no longer need to listen to the event + /// // we also could have used `app.once_global` instead + /// handle.unlisten(event.id()); + /// }); + /// + /// // stop listening to the event when you do not need it anymore + /// app.unlisten(handler); + /// + /// + /// Ok(()) + /// }); + /// ``` fn unlisten(&self, handler_id: EventHandler) { self.manager().unlisten(handler_id) } @@ -751,8 +844,8 @@ pub(crate) mod sealed { } } -/// Utilities for unit testing on Tauri applications. -#[cfg(test)] +#[cfg(any(test, feature = "test"))] +#[cfg_attr(doc_cfg, doc(cfg(feature = "test")))] pub mod test; #[cfg(test)] diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index 64a43a566..416692f55 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -481,21 +481,21 @@ impl WindowManager { } let window_url = Url::parse(&pending.url).unwrap(); - let window_origin = - if cfg!(windows) && window_url.scheme() != "http" && window_url.scheme() != "https" { - format!("https://{}.localhost", window_url.scheme()) - } else { - format!( - "{}://{}{}", - window_url.scheme(), - window_url.host().unwrap(), - if let Some(port) = window_url.port() { - format!(":{port}") - } else { - "".into() - } - ) - }; + let window_origin = if window_url.scheme() == "data" { + "null".into() + } else if cfg!(windows) && window_url.scheme() != "http" && window_url.scheme() != "https" { + format!("https://{}.localhost", window_url.scheme()) + } else { + format!( + "{}://{}{}", + window_url.scheme(), + window_url.host().unwrap(), + window_url + .port() + .map(|p| format!(":{p}")) + .unwrap_or_default() + ) + }; if !registered_scheme_protocols.contains(&"tauri".into()) { let web_resource_request_handler = pending.web_resource_request_handler.take(); @@ -891,7 +891,7 @@ impl WindowManager { for (let i = listeners.length - 1; i >= 0; i--) {{ const listener = listeners[i] - if (listener.windowLabel === null || listener.windowLabel === eventData.windowLabel) {{ + if (listener.windowLabel === null || eventData.windowLabel === null || listener.windowLabel === eventData.windowLabel) {{ eventData.id = listener.id listener.handler(eventData) }} diff --git a/core/tauri/src/scope/ipc.rs b/core/tauri/src/scope/ipc.rs index b9540a81e..5a0f6db27 100644 --- a/core/tauri/src/scope/ipc.rs +++ b/core/tauri/src/scope/ipc.rs @@ -166,16 +166,20 @@ impl Scope { #[cfg(test)] mod tests { - use serde::Serialize; - use super::RemoteDomainAccessScope; - use crate::{api::ipc::CallbackFn, test::MockRuntime, App, InvokePayload, Manager, Window}; + use crate::{ + api::ipc::CallbackFn, + test::{assert_ipc_response, mock_app, MockRuntime}, + App, InvokePayload, Manager, Window, WindowBuilder, + }; const PLUGIN_NAME: &str = "test"; fn test_context(scopes: Vec) -> (App, Window) { - let app = crate::test::mock_app(); - let window = app.get_window("main").unwrap(); + let app = mock_app(); + let window = WindowBuilder::new(&app, "main", Default::default()) + .build() + .unwrap(); for scope in scopes { app.ipc_scope().configure_remote_access(scope); @@ -184,44 +188,6 @@ mod tests { (app, window) } - fn assert_ipc_response( - window: &Window, - payload: InvokePayload, - expected: Result, - ) { - let callback = payload.callback; - let error = payload.error; - window.clone().on_message(payload).unwrap(); - - let mut num_tries = 0; - let evaluated_script = loop { - std::thread::sleep(std::time::Duration::from_millis(50)); - let evaluated_script = window.dispatcher().last_evaluated_script(); - if let Some(s) = evaluated_script { - break s; - } - num_tries += 1; - if num_tries == 20 { - panic!("Response script not evaluated"); - } - }; - let (expected_response, fn_name) = match expected { - Ok(payload) => (serde_json::to_value(payload).unwrap(), callback), - Err(payload) => (serde_json::to_value(payload).unwrap(), error), - }; - let expected = format!( - "window[\"_{}\"]({})", - fn_name.0, - crate::api::ipc::serialize_js(&expected_response).unwrap() - ); - - println!("Last evaluated script:"); - println!("{evaluated_script}"); - println!("Expected:"); - println!("{expected}"); - assert!(evaluated_script.contains(&expected)); - } - fn path_is_absolute_payload() -> InvokePayload { let callback = CallbackFn(0); let error = CallbackFn(1); @@ -259,7 +225,7 @@ mod tests { .add_plugin("path")]); window.navigate("https://tauri.app".parse().unwrap()); - assert_ipc_response::<()>( + assert_ipc_response( &window, path_is_absolute_payload(), Err(&crate::window::ipc_scope_not_found_error_message( @@ -276,7 +242,7 @@ mod tests { .add_plugin("path")]); window.navigate("https://tauri.app".parse().unwrap()); - assert_ipc_response::<()>( + assert_ipc_response( &window, path_is_absolute_payload(), Err(&crate::window::ipc_scope_window_error_message("main")), @@ -290,7 +256,7 @@ mod tests { .add_plugin("path")]); window.navigate("https://tauri.app".parse().unwrap()); - assert_ipc_response::<()>( + assert_ipc_response( &window, path_is_absolute_payload(), Err(&crate::window::ipc_scope_domain_error_message( @@ -314,7 +280,7 @@ mod tests { assert_ipc_response(&window, path_is_absolute_payload(), Ok(true)); window.navigate("https://blog.tauri.app".parse().unwrap()); - assert_ipc_response::<()>( + assert_ipc_response( &window, path_is_absolute_payload(), Err(&crate::window::ipc_scope_domain_error_message( @@ -327,7 +293,7 @@ mod tests { window.window.label = "test".into(); window.navigate("https://dev.tauri.app".parse().unwrap()); - assert_ipc_response::<()>( + assert_ipc_response( &window, path_is_absolute_payload(), Err(&crate::window::ipc_scope_not_found_error_message( @@ -354,7 +320,7 @@ mod tests { ]); window.navigate("https://tauri.app".parse().unwrap()); - assert_ipc_response::<()>( + assert_ipc_response( &window, path_is_absolute_payload(), Err(crate::window::IPC_SCOPE_DOES_NOT_ALLOW), @@ -368,7 +334,7 @@ mod tests { .add_plugin(PLUGIN_NAME)]); window.navigate("https://tauri.app".parse().unwrap()); - assert_ipc_response::<()>( + assert_ipc_response( &window, plugin_test_payload(), Err(&format!("plugin {PLUGIN_NAME} not found")), @@ -382,7 +348,7 @@ mod tests { ]); window.navigate("https://tauri.app".parse().unwrap()); - assert_ipc_response::<()>( + assert_ipc_response( &window, plugin_test_payload(), Err(crate::window::IPC_SCOPE_DOES_NOT_ALLOW), diff --git a/core/tauri/src/test/mock_runtime.rs b/core/tauri/src/test/mock_runtime.rs index 9073435eb..f00737325 100644 --- a/core/tauri/src/test/mock_runtime.rs +++ b/core/tauri/src/test/mock_runtime.rs @@ -3,6 +3,7 @@ // SPDX-License-Identifier: MIT #![allow(dead_code)] +#![allow(missing_docs)] use tauri_runtime::{ menu::{Menu, MenuUpdate}, @@ -12,8 +13,8 @@ use tauri_runtime::{ dpi::{PhysicalPosition, PhysicalSize, Position, Size}, CursorIcon, DetachedWindow, MenuEvent, PendingWindow, WindowEvent, }, - DeviceEventFilter, Dispatch, EventLoopProxy, Icon, Result, RunEvent, Runtime, RuntimeHandle, - UserAttentionType, UserEvent, + DeviceEventFilter, Dispatch, Error, EventLoopProxy, ExitRequestedEventAction, Icon, Result, + RunEvent, Runtime, RuntimeHandle, UserAttentionType, UserEvent, }; #[cfg(all(desktop, feature = "system-tray"))] use tauri_runtime::{ @@ -29,16 +30,59 @@ use uuid::Uuid; use windows::Win32::Foundation::HWND; use std::{ + cell::RefCell, collections::HashMap, fmt, - sync::{Arc, Mutex}, + sync::{ + atomic::{AtomicBool, Ordering}, + mpsc::{channel, sync_channel, Receiver, SyncSender}, + Arc, Mutex, + }, }; type ShortcutMap = HashMap>; +type WindowId = usize; + +enum Message { + Task(Box), + CloseWindow(WindowId), +} + +struct Window; #[derive(Clone)] pub struct RuntimeContext { + is_running: Arc, + windows: Arc>>, shortcuts: Arc>, + run_tx: SyncSender, +} + +// SAFETY: we ensure this type is only used on the main thread. +#[allow(clippy::non_send_fields_in_send_ty)] +unsafe impl Send for RuntimeContext {} + +// SAFETY: we ensure this type is only used on the main thread. +#[allow(clippy::non_send_fields_in_send_ty)] +unsafe impl Sync for RuntimeContext {} + +impl RuntimeContext { + fn send_message(&self, message: Message) -> Result<()> { + if self.is_running.load(Ordering::Relaxed) { + self + .run_tx + .send(message) + .map_err(|_| Error::FailedToSendMessage) + } else { + match message { + Message::Task(task) => task(), + Message::CloseWindow(id) => { + self.windows.borrow_mut().remove(&id); + } + } + Ok(()) + } + } } impl fmt::Debug for RuntimeContext { @@ -56,7 +100,7 @@ impl RuntimeHandle for MockRuntimeHandle { type Runtime = MockRuntime; fn create_proxy(&self) -> EventProxy { - unimplemented!() + EventProxy {} } /// Create a new webview window. @@ -64,11 +108,15 @@ impl RuntimeHandle for MockRuntimeHandle { &self, pending: PendingWindow, ) -> Result> { + let id = rand::random(); + self.context.windows.borrow_mut().insert(id, Window); Ok(DetachedWindow { label: pending.label, dispatcher: MockDispatcher { + id, context: self.context.clone(), last_evaluated_script: Default::default(), + url: pending.url, }, menu_ids: Default::default(), }) @@ -76,7 +124,7 @@ impl RuntimeHandle for MockRuntimeHandle { /// Run a task on the main thread. fn run_on_main_thread(&self, f: F) -> Result<()> { - unimplemented!() + self.context.send_message(Message::Task(Box::new(f))) } #[cfg(all(desktop, feature = "system-tray"))] @@ -85,11 +133,24 @@ impl RuntimeHandle for MockRuntimeHandle { &self, system_tray: SystemTray, ) -> Result<>::TrayHandler> { - unimplemented!() + Ok(MockTrayHandler { + context: self.context.clone(), + }) } fn raw_display_handle(&self) -> raw_window_handle::RawDisplayHandle { - unimplemented!() + #[cfg(target_os = "linux")] + return raw_window_handle::RawDisplayHandle::Xlib(raw_window_handle::XlibDisplayHandle::empty()); + #[cfg(target_os = "macos")] + return raw_window_handle::RawDisplayHandle::AppKit( + raw_window_handle::AppKitDisplayHandle::empty(), + ); + #[cfg(windows)] + return raw_window_handle::RawDisplayHandle::Windows( + raw_window_handle::WindowsDisplayHandle::empty(), + ); + #[cfg(not(any(target_os = "linux", target_os = "macos", windows)))] + return unimplemented!(); } /// Shows the application, but does not automatically focus it. @@ -127,7 +188,9 @@ impl RuntimeHandle for MockRuntimeHandle { #[derive(Debug, Clone)] pub struct MockDispatcher { + id: WindowId, context: RuntimeContext, + url: String, last_evaluated_script: Arc>>, } @@ -293,7 +356,7 @@ impl Dispatch for MockDispatcher { type WindowBuilder = MockWindowBuilder; fn run_on_main_thread(&self, f: F) -> Result<()> { - Ok(()) + self.context.send_message(Message::Task(Box::new(f))) } fn on_window_event(&self, f: F) -> Uuid { @@ -320,7 +383,7 @@ impl Dispatch for MockDispatcher { } fn url(&self) -> Result { - todo!() + self.url.parse().map_err(|_| Error::FailedToReceiveMessage) } fn scale_factor(&self) -> Result { @@ -425,7 +488,20 @@ impl Dispatch for MockDispatcher { } fn raw_window_handle(&self) -> Result { - unimplemented!() + #[cfg(target_os = "linux")] + return Ok(raw_window_handle::RawWindowHandle::Xlib( + raw_window_handle::XlibWindowHandle::empty(), + )); + #[cfg(target_os = "macos")] + return Ok(raw_window_handle::RawWindowHandle::AppKit( + raw_window_handle::AppKitWindowHandle::empty(), + )); + #[cfg(windows)] + return Ok(raw_window_handle::RawWindowHandle::Win32( + raw_window_handle::Win32WindowHandle::empty(), + )); + #[cfg(not(any(target_os = "linux", target_os = "macos", windows)))] + return unimplemented!(); } fn center(&self) -> Result<()> { @@ -444,7 +520,18 @@ impl Dispatch for MockDispatcher { &mut self, pending: PendingWindow, ) -> Result> { - unimplemented!() + let id = rand::random(); + self.context.windows.borrow_mut().insert(id, Window); + Ok(DetachedWindow { + label: pending.label, + dispatcher: MockDispatcher { + id, + context: self.context.clone(), + last_evaluated_script: Default::default(), + url: pending.url, + }, + menu_ids: Default::default(), + }) } fn set_resizable(&self, resizable: bool) -> Result<()> { @@ -500,6 +587,7 @@ impl Dispatch for MockDispatcher { } fn close(&self) -> Result<()> { + self.context.send_message(Message::CloseWindow(self.id))?; Ok(()) } @@ -636,22 +724,31 @@ impl EventLoopProxy for EventProxy { #[derive(Debug)] pub struct MockRuntime { + is_running: Arc, pub context: RuntimeContext, #[cfg(all(desktop, feature = "system-tray"))] tray_handler: MockTrayHandler, + run_rx: Receiver, } impl MockRuntime { fn init() -> Self { + let is_running = Arc::new(AtomicBool::new(false)); + let (tx, rx) = sync_channel(1); let context = RuntimeContext { + is_running: is_running.clone(), + windows: Default::default(), shortcuts: Default::default(), + run_tx: tx, }; Self { + is_running, #[cfg(all(desktop, feature = "system-tray"))] tray_handler: MockTrayHandler { context: context.clone(), }, context, + run_rx: rx, } } } @@ -673,7 +770,7 @@ impl Runtime for MockRuntime { } fn create_proxy(&self) -> EventProxy { - unimplemented!() + EventProxy {} } fn handle(&self) -> Self::Handle { @@ -683,11 +780,15 @@ impl Runtime for MockRuntime { } fn create_window(&self, pending: PendingWindow) -> Result> { + let id = rand::random(); + self.context.windows.borrow_mut().insert(id, Window); Ok(DetachedWindow { label: pending.label, dispatcher: MockDispatcher { + id, context: self.context.clone(), last_evaluated_script: Default::default(), + url: pending.url, }, menu_ids: Default::default(), }) @@ -733,9 +834,39 @@ impl Runtime for MockRuntime { Default::default() } - fn run) + 'static>(self, callback: F) { + fn run) + 'static>(self, mut callback: F) { + self.is_running.store(true, Ordering::Relaxed); + callback(RunEvent::Ready); + loop { + if let Ok(m) = self.run_rx.try_recv() { + match m { + Message::Task(p) => p(), + Message::CloseWindow(id) => { + let removed = self.context.windows.borrow_mut().remove(&id).is_some(); + if removed { + let is_empty = self.context.windows.borrow().is_empty(); + if is_empty { + let (tx, rx) = channel(); + callback(RunEvent::ExitRequested { tx }); + + let recv = rx.try_recv(); + let should_prevent = matches!(recv, Ok(ExitRequestedEventAction::Prevent)); + + if !should_prevent { + break; + } + } + } + } + } + } + + callback(RunEvent::MainEventsCleared); + std::thread::sleep(std::time::Duration::from_secs(1)); } + + callback(RunEvent::Exit); } } diff --git a/core/tauri/src/test/mod.rs b/core/tauri/src/test/mod.rs index 90ea8d625..84b06e1b8 100644 --- a/core/tauri/src/test/mod.rs +++ b/core/tauri/src/test/mod.rs @@ -2,19 +2,99 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT +//! Utilities for unit testing on Tauri applications. +//! +//! # Stability +//! +//! This module is unstable. +//! +//! # Examples +//! +//! ```rust +//! #[tauri::command] +//! fn my_cmd() {} +//! +//! fn create_app(mut builder: tauri::Builder) -> tauri::App { +//! builder +//! .setup(|app| { +//! // do something +//! Ok(()) +//! }) +//! .invoke_handler(tauri::generate_handler![my_cmd]) +//! // remove the string argument on your app +//! .build(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json")) +//! .expect("failed to build app") +//! } +//! +//! fn main() { +//! let app = create_app(tauri::Builder::default()); +//! // app.run(|_handle, _event| {}); +//! } +//! +//! //#[cfg(test)] +//! mod tests { +//! use tauri::Manager; +//! //#[cfg(test)] +//! fn something() { +//! let app = super::create_app(tauri::test::mock_builder()); +//! let window = app.get_window("main").unwrap(); +//! // do something with the app and window +//! // in this case we'll run the my_cmd command with no arguments +//! tauri::test::assert_ipc_response( +//! &window, +//! tauri::InvokePayload { +//! cmd: "my_cmd".into(), +//! callback: tauri::api::ipc::CallbackFn(0), +//! error: tauri::api::ipc::CallbackFn(1), +//! inner: serde_json::Value::Null, +//! }, +//! Ok(()) +//! ); +//! } +//! } +//! ``` + #![allow(unused_variables)] mod mock_runtime; pub use mock_runtime::*; +use serde::Serialize; +use serde_json::Value as JsonValue; -use std::{borrow::Cow, sync::Arc}; - -use crate::{Pattern, WindowBuilder}; -use tauri_utils::{ - assets::{AssetKey, Assets, CspHash}, - config::{Config, PatternKind, TauriConfig, WindowUrl}, +use std::{ + borrow::Cow, + collections::HashMap, + fmt::Debug, + hash::{Hash, Hasher}, + sync::{ + mpsc::{channel, Sender}, + Arc, Mutex, + }, }; +use crate::hooks::window_invoke_responder; +use crate::{api::ipc::CallbackFn, App, Builder, Context, InvokePayload, Manager, Pattern, Window}; +use tauri_utils::{ + assets::{AssetKey, Assets, CspHash}, + config::{Config, PatternKind, TauriConfig}, +}; + +#[derive(Eq, PartialEq)] +struct IpcKey { + callback: CallbackFn, + error: CallbackFn, +} + +impl Hash for IpcKey { + fn hash(&self, state: &mut H) { + self.callback.0.hash(state); + self.error.0.hash(state); + } +} + +struct Ipc(Mutex>>>); + +/// An empty [`Assets`] implementation. pub struct NoopAsset { csp_hashes: Vec>, } @@ -29,14 +109,16 @@ impl Assets for NoopAsset { } } +/// Creates a new empty [`Assets`] implementation. pub fn noop_assets() -> NoopAsset { NoopAsset { csp_hashes: Default::default(), } } +/// Creates a new [`crate::Context`] for testing. pub fn mock_context(assets: A) -> crate::Context { - crate::Context { + Context { config: Config { schema: None, package: Default::default(), @@ -68,14 +150,131 @@ pub fn mock_context(assets: A) -> crate::Context { } } -pub fn mock_app() -> crate::App { - let app = crate::Builder::::new() - .build(mock_context(noop_assets())) - .unwrap(); +/// Creates a new [`Builder`] using the [`MockRuntime`]. +/// +/// To use a dummy [`Context`], see [`mock_app`]. +/// +/// # Examples +/// +/// ```rust +/// #[cfg(test)] +/// fn do_something() { +/// let app = tauri::test::mock_builder() +/// // remove the string argument to use your app's config file +/// .build(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json")) +/// .unwrap(); +/// } +/// ``` +pub fn mock_builder() -> Builder { + let mut builder = Builder::::new().manage(Ipc(Default::default())); - WindowBuilder::new(&app, "main", WindowUrl::App("index.html".into())) - .build() - .unwrap(); + builder.invoke_responder = Arc::new(|window, response, callback, error| { + let window_ = window.clone(); + let ipc = window_.state::(); + let mut ipc_ = ipc.0.lock().unwrap(); + if let Some(tx) = ipc_.remove(&IpcKey { callback, error }) { + tx.send(response.into_result()).unwrap(); + } else { + window_invoke_responder(window, response, callback, error) + } + }); - app + builder +} + +/// Creates a new [`App`] for testing using the [`mock_context`] with a [`noop_assets`]. +pub fn mock_app() -> App { + mock_builder().build(mock_context(noop_assets())).unwrap() +} + +/// Executes the given IPC message and assert the response matches the expected value. +/// +/// # Examples +/// +/// ```rust +/// #[tauri::command] +/// fn ping() -> &'static str { +/// "pong" +/// } +/// +/// fn create_app(mut builder: tauri::Builder) -> tauri::App { +/// builder +/// .invoke_handler(tauri::generate_handler![ping]) +/// // remove the string argument on your app +/// .build(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json")) +/// .expect("failed to build app") +/// } +/// +/// fn main() { +/// let app = create_app(tauri::Builder::default()); +/// // app.run(|_handle, _event| {});} +/// } +/// +/// //#[cfg(test)] +/// mod tests { +/// use tauri::Manager; +/// +/// //#[cfg(test)] +/// fn something() { +/// let app = super::create_app(tauri::test::mock_builder()); +/// let window = app.get_window("main").unwrap(); +/// +/// // run the `ping` command and assert it returns `pong` +/// tauri::test::assert_ipc_response( +/// &window, +/// tauri::InvokePayload { +/// cmd: "ping".into(), +/// callback: tauri::api::ipc::CallbackFn(0), +/// error: tauri::api::ipc::CallbackFn(1), +/// inner: serde_json::Value::Null, +/// }, +/// // the expected response is a success with the "pong" payload +/// // we could also use Err("error message") here to ensure the command failed +/// Ok("pong") +/// ); +/// } +/// } +/// ``` +pub fn assert_ipc_response( + window: &Window, + payload: InvokePayload, + expected: Result, +) { + let callback = payload.callback; + let error = payload.error; + let ipc = window.state::(); + let (tx, rx) = channel(); + ipc.0.lock().unwrap().insert(IpcKey { callback, error }, tx); + window.clone().on_message(payload).unwrap(); + + assert_eq!( + rx.recv().unwrap(), + expected + .map(|e| serde_json::to_value(e).unwrap()) + .map_err(|e| serde_json::to_value(e).unwrap()) + ); +} + +#[cfg(test)] +mod tests { + use crate::WindowBuilder; + use std::time::Duration; + + use super::mock_app; + + #[test] + fn run_app() { + let app = mock_app(); + let window = WindowBuilder::new(&app, "main", Default::default()) + .build() + .unwrap(); + std::thread::spawn(move || { + std::thread::sleep(Duration::from_secs(1)); + window.close().unwrap(); + }); + + app.run(|_app, event| { + println!("{:?}", event); + }); + } } diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index e7b87a92a..788cdba8d 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -2013,6 +2013,24 @@ impl Window { /// Event system APIs. impl Window { /// Emits an event to both the JavaScript and the Rust listeners. + /// + /// This API is a combination of [`Self::trigger`] and [`Self::emit`]. + /// + /// # Examples + /// ``` + /// use tauri::Manager; + /// + /// #[tauri::command] + /// fn download(window: tauri::Window) { + /// window.emit_and_trigger("download-started", ()); + /// + /// for i in 1..100 { + /// std::thread::sleep(std::time::Duration::from_millis(150)); + /// // emit a download progress event to all listeners + /// window.emit_and_trigger("download-progress", i); + /// } + /// } + /// ``` pub fn emit_and_trigger( &self, event: &str, @@ -2038,9 +2056,21 @@ impl Window { Ok(()) } - /// Emits an event to the JavaScript listeners on the current window. + /// Emits an event to the JavaScript listeners on the current window or globally. /// - /// The event is only delivered to listeners that used the `WebviewWindow#listen` method on the @tauri-apps/api `window` module. + /// # Examples + /// ``` + /// use tauri::Manager; + /// + /// #[tauri::command] + /// fn download(window: tauri::Window) { + /// for i in 1..100 { + /// std::thread::sleep(std::time::Duration::from_millis(150)); + /// // emit a download progress event to all listeners registed in the webview + /// window.emit("download-progress", i); + /// } + /// } + /// ``` pub fn emit(&self, event: &str, payload: S) -> crate::Result<()> { self .manager @@ -2055,6 +2085,21 @@ impl Window { /// This listener only receives events that are triggered using the /// [`trigger`](Window#method.trigger) and [`emit_and_trigger`](Window#method.emit_and_trigger) methods or /// the `appWindow.emit` function from the @tauri-apps/api `window` module. + /// + /// # Examples + /// ``` + /// use tauri::Manager; + /// + /// tauri::Builder::default() + /// .setup(|app| { + /// let window = app.get_window("main").unwrap(); + /// window.listen("component-loaded", move |event| { + /// println!("window just loaded a component"); + /// }); + /// + /// Ok(()) + /// }); + /// ``` pub fn listen(&self, event: impl Into, handler: F) -> EventHandler where F: Fn(Event) + Send + 'static, @@ -2064,11 +2109,37 @@ impl Window { } /// Unlisten to an event on this window. + /// + /// # Examples + /// ``` + /// use tauri::Manager; + /// + /// tauri::Builder::default() + /// .setup(|app| { + /// let window = app.get_window("main").unwrap(); + /// let window_ = window.clone(); + /// let handler = window.listen("component-loaded", move |event| { + /// println!("window just loaded a component"); + /// + /// // we no longer need to listen to the event + /// // we also could have used `window.once` instead + /// window_.unlisten(event.id()); + /// }); + /// + /// // stop listening to the event when you do not need it anymore + /// window.unlisten(handler); + /// + /// + /// Ok(()) + /// }); + /// ``` pub fn unlisten(&self, handler_id: EventHandler) { self.manager.unlisten(handler_id) } /// Listen to an event on this window a single time. + /// + /// See [`Self::listen`] for more information. pub fn once(&self, event: impl Into, handler: F) -> EventHandler where F: FnOnce(Event) + Send + 'static, @@ -2077,9 +2148,21 @@ impl Window { self.manager.once(event.into(), Some(label), handler) } - /// Triggers an event to the Rust listeners on this window. + /// Triggers an event to the Rust listeners on this window or global listeners. /// - /// The event is only delivered to listeners that used the [`listen`](Window#method.listen) method. + /// # Examples + /// ``` + /// use tauri::Manager; + /// + /// #[tauri::command] + /// fn download(window: tauri::Window) { + /// for i in 1..100 { + /// std::thread::sleep(std::time::Duration::from_millis(150)); + /// // emit a download progress event to all listeners registed on `window` in Rust + /// window.trigger("download-progress", Some(i.to_string())); + /// } + /// } + /// ``` pub fn trigger(&self, event: &str, data: Option) { let label = self.window.label.clone(); self.manager.trigger(event, Some(label), data) diff --git a/examples/api/dist/assets/index.js b/examples/api/dist/assets/index.js index b3f209165..0ee0c82e2 100644 --- a/examples/api/dist/assets/index.js +++ b/examples/api/dist/assets/index.js @@ -1,9 +1,9 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const h of a.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&i(h)}).observe(document,{childList:!0,subtree:!0});function n(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerpolicy&&(a.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?a.credentials="include":r.crossorigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(r){if(r.ep)return;r.ep=!0;const a=n(r);fetch(r.href,a)}})();function $(){}function rt(e){return e()}function Ge(){return Object.create(null)}function F(e){e.forEach(rt)}function pt(e){return typeof e=="function"}function ue(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let be;function gt(e,t){return be||(be=document.createElement("a")),be.href=t,e===be.href}function _t(e){return Object.keys(e).length===0}function vt(e,...t){if(e==null)return $;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function bt(e,t,n){e.$$.on_destroy.push(vt(t,n))}function o(e,t){e.appendChild(t)}function k(e,t,n){e.insertBefore(t,n||null)}function w(e){e.parentNode.removeChild(e)}function Xe(e,t){for(let n=0;ne.removeEventListener(t,n,i)}function l(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function wt(e){return Array.from(e.childNodes)}function kt(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}class Et{constructor(t=!1){this.is_svg=!1,this.is_svg=t,this.e=this.n=null}c(t){this.h(t)}m(t,n,i=null){this.e||(this.is_svg?this.e=yt(n.nodeName):this.e=f(n.nodeName),this.t=n,this.c(t)),this.i(i)}h(t){this.e.innerHTML=t,this.n=Array.from(this.e.childNodes)}i(t){for(let n=0;n{ke.delete(e),i&&(n&&e.d(1),i())}),e.o(t)}else i&&i()}function Ke(e){e&&e.c()}function Ne(e,t,n,i){const{fragment:r,on_mount:a,on_destroy:h,after_update:c}=e.$$;r&&r.m(t,n),i||We(()=>{const u=a.map(rt).filter(pt);h?h.push(...u):F(u),e.$$.on_mount=[]}),c.forEach(We)}function Ae(e,t){const n=e.$$;n.fragment!==null&&(F(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Dt(e,t){e.$$.dirty[0]===-1&&(le.push(e),xt(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const S=R.length?R[0]:O;return d.ctx&&r(d.ctx[v],d.ctx[v]=S)&&(!d.skip_bound&&d.bound[v]&&d.bound[v](S),E&&Dt(e,v)),O}):[],d.update(),E=!0,F(d.before_update),d.fragment=i?i(d.ctx):!1,t.target){if(t.hydrate){const v=wt(t.target);d.fragment&&d.fragment.l(v),v.forEach(w)}else d.fragment&&d.fragment.c();t.intro&&Ie(e.$$.fragment),Ne(e,t.target,t.anchor,t.customElement),ct()}ce(u)}class Oe{$destroy(){Ae(this,1),this.$destroy=$}$on(t,n){const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(t){this.$$set&&!_t(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const J=[];function Tt(e,t=$){let n;const i=new Set;function r(c){if(ue(e,c)&&(e=c,n)){const u=!J.length;for(const d of i)d[1](),J.push(d,e);if(u){for(let d=0;d{i.delete(d),i.size===0&&(n(),n=null)}}return{set:r,update:a,subscribe:h}}function Ct(e){let t;return{c(){t=f("p"),t.innerHTML=`This is a demo of Tauri's API capabilities using the @tauri-apps/api package. It's used as the main validation app, serving as the test bed of our +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const m of a.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&i(m)}).observe(document,{childList:!0,subtree:!0});function n(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerpolicy&&(a.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?a.credentials="include":r.crossorigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(r){if(r.ep)return;r.ep=!0;const a=n(r);fetch(r.href,a)}})();function $(){}function st(e){return e()}function Xe(){return Object.create(null)}function V(e){e.forEach(st)}function vt(e){return typeof e=="function"}function he(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let ke;function bt(e,t){return ke||(ke=document.createElement("a")),ke.href=t,e===ke.href}function yt(e){return Object.keys(e).length===0}function wt(e,...t){if(e==null)return $;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function kt(e,t,n){e.$$.on_destroy.push(wt(t,n))}function o(e,t){e.appendChild(t)}function k(e,t,n){e.insertBefore(t,n||null)}function w(e){e.parentNode.removeChild(e)}function Ye(e,t){for(let n=0;ne.removeEventListener(t,n,i)}function l(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function $t(e){return Array.from(e.childNodes)}function Lt(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}class xt{constructor(t=!1){this.is_svg=!1,this.is_svg=t,this.e=this.n=null}c(t){this.h(t)}m(t,n,i=null){this.e||(this.is_svg?this.e=Et(n.nodeName):this.e=f(n.nodeName),this.t=n,this.c(t)),this.i(i)}h(t){this.e.innerHTML=t,this.n=Array.from(this.e.childNodes)}i(t){for(let n=0;n{Le.delete(e),i&&(n&&e.d(1),i())}),e.o(t)}else i&&i()}function Qe(e){e&&e.c()}function Me(e,t,n,i){const{fragment:r,on_mount:a,on_destroy:m,after_update:c}=e.$$;r&&r.m(t,n),i||We(()=>{const u=a.map(st).filter(vt);m?m.push(...u):V(u),e.$$.on_mount=[]}),c.forEach(We)}function Re(e,t){const n=e.$$;n.fragment!==null&&(V(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Nt(e,t){e.$$.dirty[0]===-1&&(ce.push(e),Ot(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const O=H.length?H[0]:S;return d.ctx&&r(d.ctx[v],d.ctx[v]=O)&&(!d.skip_bound&&d.bound[v]&&d.bound[v](O),E&&Nt(e,v)),S}):[],d.update(),E=!0,V(d.before_update),d.fragment=i?i(d.ctx):!1,t.target){if(t.hydrate){const v=$t(t.target);d.fragment&&d.fragment.l(v),v.forEach(w)}else d.fragment&&d.fragment.c();t.intro&&Ae(e.$$.fragment),Me(e,t.target,t.anchor,t.customElement),ut()}ue(u)}class Oe{$destroy(){Re(this,1),this.$destroy=$}$on(t,n){const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(t){this.$$set&&!yt(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const K=[];function It(e,t=$){let n;const i=new Set;function r(c){if(he(e,c)&&(e=c,n)){const u=!K.length;for(const d of i)d[1](),K.push(d,e);if(u){for(let d=0;d{i.delete(d),i.size===0&&(n(),n=null)}}return{set:r,update:a,subscribe:m}}function Wt(e){let t;return{c(){t=f("p"),t.innerHTML=`This is a demo of Tauri's API capabilities using the @tauri-apps/api package. It's used as the main validation app, serving as the test bed of our development process. In the future, this app will be used on Tauri's integration - tests.`},m(n,i){k(n,t,i)},p:$,i:$,o:$,d(n){n&&w(t)}}}class Mt extends Oe{constructor(t){super(),Le(this,t,null,Ct,ue,{})}}var Wt=Object.defineProperty,at=(e,t)=>{for(var n in t)Wt(e,n,{get:t[n],enumerable:!0})},It={};at(It,{convertFileSrc:()=>At,invoke:()=>xe,transformCallback:()=>$e});function Nt(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function $e(e,t=!1){let n=Nt(),i=`_${n}`;return Object.defineProperty(window,i,{value:r=>(t&&Reflect.deleteProperty(window,i),e==null?void 0:e(r)),writable:!1,configurable:!0}),n}async function xe(e,t={}){return new Promise((n,i)=>{let r=$e(h=>{n(h),Reflect.deleteProperty(window,`_${a}`)},!0),a=$e(h=>{i(h),Reflect.deleteProperty(window,`_${r}`)},!0);window.__TAURI_IPC__({cmd:e,callback:r,error:a,...t})})}function At(e,t="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${t}.localhost/${n}`:`${t}://localhost/${n}`}var Pt={};at(Pt,{TauriEvent:()=>ft,emit:()=>ht,listen:()=>mt,once:()=>qt});async function Pe(e){return xe("tauri",e)}async function ut(e,t){return Pe({__tauriModule:"Event",message:{cmd:"unlisten",event:e,eventId:t}})}async function Rt(e,t,n){await Pe({__tauriModule:"Event",message:{cmd:"emit",event:e,windowLabel:t,payload:n}})}async function dt(e,t,n){return Pe({__tauriModule:"Event",message:{cmd:"listen",event:e,windowLabel:t,handler:$e(n)}}).then(i=>async()=>ut(e,i))}async function Ht(e,t,n){return dt(e,t,i=>{n(i),ut(e,i.id).catch(()=>{})})}var ft=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e))(ft||{});async function mt(e,t){return dt(e,null,t)}async function qt(e,t){return Ht(e,null,t)}async function ht(e,t){return Rt(e,void 0,t)}function jt(e){let t,n,i,r,a,h,c,u;return{c(){t=f("div"),n=f("button"),n.textContent="Call Log API",i=g(),r=f("button"),r.textContent="Call Request (async) API",a=g(),h=f("button"),h.textContent="Send event to Rust",l(n,"class","btn"),l(n,"id","log"),l(r,"class","btn"),l(r,"id","request"),l(h,"class","btn"),l(h,"id","event")},m(d,E){k(d,t,E),o(t,n),o(t,i),o(t,r),o(t,a),o(t,h),c||(u=[z(n,"click",e[0]),z(r,"click",e[1]),z(h,"click",e[2])],c=!0)},p:$,i:$,o:$,d(d){d&&w(t),c=!1,F(u)}}}function Ut(e,t,n){let{onMessage:i}=t,r;Ee(async()=>{r=await mt("rust-event",i)}),lt(()=>{r&&r()});function a(){xe("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})}function h(){xe("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(i).catch(i)}function c(){ht("js-event","this is the payload string")}return e.$$set=u=>{"onMessage"in u&&n(3,i=u.onMessage)},[a,h,c,i]}class zt extends Oe{constructor(t){super(),Le(this,t,Ut,jt,ue,{onMessage:3})}}function Ft(e){let t;return{c(){t=f("div"),t.innerHTML=`
Not available for Linux
- `,l(t,"class","flex flex-col gap-2")},m(n,i){k(n,t,i)},p:$,i:$,o:$,d(n){n&&w(t)}}}function Vt(e,t,n){let{onMessage:i}=t;const r=window.constraints={audio:!0,video:!0};function a(c){const u=document.querySelector("video"),d=c.getVideoTracks();i("Got stream with constraints:",r),i(`Using video device: ${d[0].label}`),window.stream=c,u.srcObject=c}function h(c){if(c.name==="ConstraintNotSatisfiedError"){const u=r.video;i(`The resolution ${u.width.exact}x${u.height.exact} px is not supported by your device.`)}else c.name==="PermissionDeniedError"&&i("Permissions have not been granted to use your camera and microphone, you need to allow the page access to your devices in order for the demo to work.");i(`getUserMedia error: ${c.name}`,c)}return Ee(async()=>{try{const c=await navigator.mediaDevices.getUserMedia(r);a(c)}catch(c){h(c)}}),lt(()=>{window.stream.getTracks().forEach(function(c){c.stop()})}),e.$$set=c=>{"onMessage"in c&&n(0,i=c.onMessage)},[i]}class Bt extends Oe{constructor(t){super(),Le(this,t,Vt,Ft,ue,{onMessage:0})}}function Qe(e,t,n){const i=e.slice();return i[25]=t[n],i}function Ze(e,t,n){const i=e.slice();return i[28]=t[n],i}function Gt(e){let t;return{c(){t=f("span"),l(t,"class","i-codicon-menu animate-duration-300ms animate-fade-in")},m(n,i){k(n,t,i)},d(n){n&&w(t)}}}function Xt(e){let t;return{c(){t=f("span"),l(t,"class","i-codicon-close animate-duration-300ms animate-fade-in")},m(n,i){k(n,t,i)},d(n){n&&w(t)}}}function Yt(e){let t,n;return{c(){t=K(`Switch to Dark mode - `),n=f("div"),l(n,"class","i-ph-moon")},m(i,r){k(i,t,r),k(i,n,r)},d(i){i&&w(t),i&&w(n)}}}function Jt(e){let t,n;return{c(){t=K(`Switch to Light mode - `),n=f("div"),l(n,"class","i-ph-sun")},m(i,r){k(i,t,r),k(i,n,r)},d(i){i&&w(t),i&&w(n)}}}function Kt(e){let t,n,i,r,a=e[28].label+"",h,c,u,d;function E(){return e[14](e[28])}return{c(){t=f("a"),n=f("div"),i=g(),r=f("p"),h=K(a),l(n,"class",e[28].icon+" mr-2"),l(t,"href","##"),l(t,"class",c="nv "+(e[1]===e[28]?"nv_selected":""))},m(v,O){k(v,t,O),o(t,n),o(t,i),o(t,r),o(r,h),u||(d=z(t,"click",E),u=!0)},p(v,O){e=v,O&2&&c!==(c="nv "+(e[1]===e[28]?"nv_selected":""))&&l(t,"class",c)},d(v){v&&w(t),u=!1,d()}}}function et(e){let t,n=e[28]&&Kt(e);return{c(){n&&n.c(),t=ot()},m(i,r){n&&n.m(i,r),k(i,t,r)},p(i,r){i[28]&&n.p(i,r)},d(i){n&&n.d(i),i&&w(t)}}}function tt(e){let t,n=e[25].html+"",i;return{c(){t=new Et(!1),i=ot(),t.a=i},m(r,a){t.m(n,r,a),k(r,i,a)},p(r,a){a&16&&n!==(n=r[25].html+"")&&t.p(n)},d(r){r&&w(i),r&&t.d()}}}function Qt(e){let t,n,i,r,a,h,c,u,d,E,v,O,R,S,Q,W,de,b,H,T,q,V,Z,ee,fe,me,p,_,C,I,N,te,j=e[1].label+"",Se,Re,he,ne,y,He,M,pe,qe,B,ge,je,ie,Ue,re,oe,De,ze;function Fe(s,D){return s[0]?Xt:Gt}let _e=Fe(e),A=_e(e);function Ve(s,D){return s[2]?Jt:Yt}let ve=Ve(e),P=ve(e),G=e[5],x=[];for(let s=0;s`,de=g(),b=f("a"),b.innerHTML=`GitHub - `,H=g(),T=f("a"),T.innerHTML=`Source - `,q=g(),V=f("br"),Z=g(),ee=f("div"),fe=g(),me=f("br"),p=g(),_=f("div");for(let s=0;s',Ue=g(),re=f("div");for(let s=0;s{Ae(m,1)}),St()}X?(y=new X(Be(s)),Ke(y.$$.fragment),Ie(y.$$.fragment,1),Ne(y,ne,null)):y=null}if(D&16){Y=s[4];let m;for(m=0;m{n(2,u=localStorage&&localStorage.getItem("theme")=="dark"),it(u)});function d(){n(2,u=!u),it(u)}let E=Tt([]);bt(e,E,p=>n(4,i=p));function v(p){E.update(_=>[{html:`
[${new Date().toLocaleTimeString()}]: `+(typeof p=="string"?p:JSON.stringify(p,null,1))+"
"},..._])}function O(p){E.update(_=>[{html:`
[${new Date().toLocaleTimeString()}]: `+p+"
"},..._])}function R(){E.update(()=>[])}let S,Q,W;function de(p){W=p.clientY;const _=window.getComputedStyle(S);Q=parseInt(_.height,10);const C=N=>{const te=N.clientY-W,j=Q-te;n(3,S.style.height=`${j{document.removeEventListener("mouseup",I),document.removeEventListener("mousemove",C)};document.addEventListener("mouseup",I),document.addEventListener("mousemove",C)}let b=!1,H,T,q=!1,V=0,Z=0;const ee=(p,_,C)=>Math.min(Math.max(_,p),C);Ee(()=>{n(13,H=document.querySelector("#sidebar")),T=document.querySelector("#sidebarToggle"),document.addEventListener("click",p=>{T.contains(p.target)?n(0,b=!b):b&&!H.contains(p.target)&&n(0,b=!1)}),document.addEventListener("touchstart",p=>{if(T.contains(p.target))return;const _=p.touches[0].clientX;(0<_&&_<20&&!b||b)&&(q=!0,V=_)}),document.addEventListener("touchmove",p=>{if(q){const _=p.touches[0].clientX;Z=_;const C=(_-V)/10;H.style.setProperty("--translate-x",`-${ee(0,b?0-C:18.75-C,18.75)}rem`)}}),document.addEventListener("touchend",()=>{if(q){const p=(Z-V)/10;n(0,b=b?p>-(18.75/2):p>18.75/2)}q=!1})});const fe=p=>{c(p),n(0,b=!1)};function me(p){Ce[p?"unshift":"push"](()=>{S=p,n(3,S)})}return e.$$.update=()=>{if(e.$$.dirty&1){const p=document.querySelector("#sidebar");p&&Zt(p,b)}},[b,h,u,S,i,a,c,d,E,v,O,R,de,H,fe,me]}class tn extends Oe{constructor(t){super(),Le(this,t,en,Qt,ue,{})}}new tn({target:document.querySelector("#app")}); + tests.`},m(n,i){k(n,t,i)},p:$,i:$,o:$,d(n){n&&w(t)}}}class At extends Oe{constructor(t){super(),Se(this,t,null,Wt,he,{})}}var Mt=Object.defineProperty,dt=(e,t)=>{for(var n in t)Mt(e,n,{get:t[n],enumerable:!0})},ft=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Ze=(e,t,n)=>(ft(e,t,"read from private field"),n?n.call(e):t.get(e)),Rt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Pt=(e,t,n,i)=>(ft(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),Ht={};dt(Ht,{Channel:()=>ht,PluginListener:()=>mt,addPluginListener:()=>qt,convertFileSrc:()=>Ut,invoke:()=>P,transformCallback:()=>fe});function jt(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function fe(e,t=!1){let n=jt(),i=`_${n}`;return Object.defineProperty(window,i,{value:r=>(t&&Reflect.deleteProperty(window,i),e==null?void 0:e(r)),writable:!1,configurable:!0}),n}var ae,ht=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,Rt(this,ae,()=>{}),this.id=fe(e=>{Ze(this,ae).call(this,e)})}set onmessage(e){Pt(this,ae,e)}get onmessage(){return Ze(this,ae)}toJSON(){return`__CHANNEL__:${this.id}`}};ae=new WeakMap;var mt=class{constructor(e,t,n){this.plugin=e,this.event=t,this.channelId=n}async unregister(){return P(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function qt(e,t,n){let i=new ht;return i.onmessage=n,P(`plugin:${e}|register_listener`,{event:t,handler:i}).then(()=>new mt(e,t,i.id))}async function P(e,t={}){return new Promise((n,i)=>{let r=fe(m=>{n(m),Reflect.deleteProperty(window,`_${a}`)},!0),a=fe(m=>{i(m),Reflect.deleteProperty(window,`_${r}`)},!0);window.__TAURI_IPC__({cmd:e,callback:r,error:a,...t})})}function Ut(e,t="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${t}.localhost/${n}`:`${t}://localhost/${n}`}var zt={};dt(zt,{TauriEvent:()=>pt,emit:()=>_t,listen:()=>Pe,once:()=>Ft});var pt=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e))(pt||{});async function gt(e,t){await P("plugin:event|unlisten",{event:e,eventId:t})}async function Pe(e,t,n){return P("plugin:event|listen",{event:e,windowLabel:n==null?void 0:n.target,handler:fe(t)}).then(i=>async()=>gt(e,i))}async function Ft(e,t,n){return Pe(e,i=>{t(i),gt(e,i.id).catch(()=>{})},n)}async function _t(e,t,n){await P("plugin:event|emit",{event:e,windowLabel:n==null?void 0:n.target,payload:t})}function Vt(e){let t,n,i,r,a,m,c,u;return{c(){t=f("div"),n=f("button"),n.textContent="Call Log API",i=g(),r=f("button"),r.textContent="Call Request (async) API",a=g(),m=f("button"),m.textContent="Send event to Rust",l(n,"class","btn"),l(n,"id","log"),l(r,"class","btn"),l(r,"id","request"),l(m,"class","btn"),l(m,"id","event")},m(d,E){k(d,t,E),o(t,n),o(t,i),o(t,r),o(t,a),o(t,m),c||(u=[F(n,"click",e[0]),F(r,"click",e[1]),F(m,"click",e[2])],c=!0)},p:$,i:$,o:$,d(d){d&&w(t),c=!1,V(u)}}}function Bt(e,t,n){let{onMessage:i}=t,r;xe(async()=>{r=await Pe("rust-event",i)}),at(()=>{r&&r()});function a(){P("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})}function m(){P("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(i).catch(i)}function c(){_t("js-event","this is the payload string")}return e.$$set=u=>{"onMessage"in u&&n(3,i=u.onMessage)},[a,m,c,i]}class Gt extends Oe{constructor(t){super(),Se(this,t,Bt,Vt,he,{onMessage:3})}}function Xt(e){let t;return{c(){t=f("div"),t.innerHTML=`
Not available for Linux
+ `,l(t,"class","flex flex-col gap-2")},m(n,i){k(n,t,i)},p:$,i:$,o:$,d(n){n&&w(t)}}}function Yt(e,t,n){let{onMessage:i}=t;const r=window.constraints={audio:!0,video:!0};function a(c){const u=document.querySelector("video"),d=c.getVideoTracks();i("Got stream with constraints:",r),i(`Using video device: ${d[0].label}`),window.stream=c,u.srcObject=c}function m(c){if(c.name==="ConstraintNotSatisfiedError"){const u=r.video;i(`The resolution ${u.width.exact}x${u.height.exact} px is not supported by your device.`)}else c.name==="PermissionDeniedError"&&i("Permissions have not been granted to use your camera and microphone, you need to allow the page access to your devices in order for the demo to work.");i(`getUserMedia error: ${c.name}`,c)}return xe(async()=>{try{const c=await navigator.mediaDevices.getUserMedia(r);a(c)}catch(c){m(c)}}),at(()=>{window.stream.getTracks().forEach(function(c){c.stop()})}),e.$$set=c=>{"onMessage"in c&&n(0,i=c.onMessage)},[i]}class Jt extends Oe{constructor(t){super(),Se(this,t,Yt,Xt,he,{onMessage:0})}}function et(e,t,n){const i=e.slice();return i[25]=t[n],i}function tt(e,t,n){const i=e.slice();return i[28]=t[n],i}function Kt(e){let t;return{c(){t=f("span"),l(t,"class","i-codicon-menu animate-duration-300ms animate-fade-in")},m(n,i){k(n,t,i)},d(n){n&&w(t)}}}function Qt(e){let t;return{c(){t=f("span"),l(t,"class","i-codicon-close animate-duration-300ms animate-fade-in")},m(n,i){k(n,t,i)},d(n){n&&w(t)}}}function Zt(e){let t,n;return{c(){t=Q(`Switch to Dark mode + `),n=f("div"),l(n,"class","i-ph-moon")},m(i,r){k(i,t,r),k(i,n,r)},d(i){i&&w(t),i&&w(n)}}}function en(e){let t,n;return{c(){t=Q(`Switch to Light mode + `),n=f("div"),l(n,"class","i-ph-sun")},m(i,r){k(i,t,r),k(i,n,r)},d(i){i&&w(t),i&&w(n)}}}function tn(e){let t,n,i,r,a=e[28].label+"",m,c,u,d;function E(){return e[14](e[28])}return{c(){t=f("a"),n=f("div"),i=g(),r=f("p"),m=Q(a),l(n,"class",e[28].icon+" mr-2"),l(t,"href","##"),l(t,"class",c="nv "+(e[1]===e[28]?"nv_selected":""))},m(v,S){k(v,t,S),o(t,n),o(t,i),o(t,r),o(r,m),u||(d=F(t,"click",E),u=!0)},p(v,S){e=v,S&2&&c!==(c="nv "+(e[1]===e[28]?"nv_selected":""))&&l(t,"class",c)},d(v){v&&w(t),u=!1,d()}}}function nt(e){let t,n=e[28]&&tn(e);return{c(){n&&n.c(),t=lt()},m(i,r){n&&n.m(i,r),k(i,t,r)},p(i,r){i[28]&&n.p(i,r)},d(i){n&&n.d(i),i&&w(t)}}}function it(e){let t,n=e[25].html+"",i;return{c(){t=new xt(!1),i=lt(),t.a=i},m(r,a){t.m(n,r,a),k(r,i,a)},p(r,a){a&16&&n!==(n=r[25].html+"")&&t.p(n)},d(r){r&&w(i),r&&t.d()}}}function nn(e){let t,n,i,r,a,m,c,u,d,E,v,S,H,O,Z,I,me,b,j,C,q,B,ee,te,pe,ge,p,_,D,W,A,ne,U=e[1].label+"",Te,He,_e,ie,y,je,N,ve,qe,G,be,Ue,re,ze,oe,se,Ce,Fe;function Ve(s,T){return s[0]?Qt:Kt}let ye=Ve(e),M=ye(e);function Be(s,T){return s[2]?en:Zt}let we=Be(e),R=we(e),X=e[5],L=[];for(let s=0;s`,me=g(),b=f("a"),b.innerHTML=`GitHub + `,j=g(),C=f("a"),C.innerHTML=`Source + `,q=g(),B=f("br"),ee=g(),te=f("div"),pe=g(),ge=f("br"),p=g(),_=f("div");for(let s=0;s',ze=g(),oe=f("div");for(let s=0;s{Re(h,1)}),Dt()}Y?(y=new Y(Ge(s)),Qe(y.$$.fragment),Ae(y.$$.fragment,1),Me(y,ie,null)):y=null}if(T&16){J=s[4];let h;for(h=0;h{n(2,u=localStorage&&localStorage.getItem("theme")=="dark"),ot(u)});function d(){n(2,u=!u),ot(u)}let E=It([]);kt(e,E,p=>n(4,i=p));function v(p){E.update(_=>[{html:`
[${new Date().toLocaleTimeString()}]: `+(typeof p=="string"?p:JSON.stringify(p,null,1))+"
"},..._])}function S(p){E.update(_=>[{html:`
[${new Date().toLocaleTimeString()}]: `+p+"
"},..._])}function H(){E.update(()=>[])}let O,Z,I;function me(p){I=p.clientY;const _=window.getComputedStyle(O);Z=parseInt(_.height,10);const D=A=>{const ne=A.clientY-I,U=Z-ne;n(3,O.style.height=`${U{document.removeEventListener("mouseup",W),document.removeEventListener("mousemove",D)};document.addEventListener("mouseup",W),document.addEventListener("mousemove",D)}let b=!1,j,C,q=!1,B=0,ee=0;const te=(p,_,D)=>Math.min(Math.max(_,p),D);xe(()=>{n(13,j=document.querySelector("#sidebar")),C=document.querySelector("#sidebarToggle"),document.addEventListener("click",p=>{C.contains(p.target)?n(0,b=!b):b&&!j.contains(p.target)&&n(0,b=!1)}),document.addEventListener("touchstart",p=>{if(C.contains(p.target))return;const _=p.touches[0].clientX;(0<_&&_<20&&!b||b)&&(q=!0,B=_)}),document.addEventListener("touchmove",p=>{if(q){const _=p.touches[0].clientX;ee=_;const D=(_-B)/10;j.style.setProperty("--translate-x",`-${te(0,b?0-D:18.75-D,18.75)}rem`)}}),document.addEventListener("touchend",()=>{if(q){const p=(ee-B)/10;n(0,b=b?p>-(18.75/2):p>18.75/2)}q=!1})});const pe=p=>{c(p),n(0,b=!1)};function ge(p){Ne[p?"unshift":"push"](()=>{O=p,n(3,O)})}return e.$$.update=()=>{if(e.$$.dirty&1){const p=document.querySelector("#sidebar");p&&rn(p,b)}},[b,m,u,O,i,a,c,d,E,v,S,H,me,j,pe,ge]}class sn extends Oe{constructor(t){super(),Se(this,t,on,nn,he,{})}}new sn({target:document.querySelector("#app")}); diff --git a/examples/api/src-tauri/Cargo.lock b/examples/api/src-tauri/Cargo.lock index 2659cfdc3..5bae8f32d 100644 --- a/examples/api/src-tauri/Cargo.lock +++ b/examples/api/src-tauri/Cargo.lock @@ -3092,6 +3092,7 @@ dependencies = [ "aes-gcm", "brotli", "ctor", + "dunce", "getrandom 0.2.10", "glob", "heck", diff --git a/examples/api/src-tauri/Cargo.toml b/examples/api/src-tauri/Cargo.toml index e3d1d23a1..8bd1e1163 100644 --- a/examples/api/src-tauri/Cargo.toml +++ b/examples/api/src-tauri/Cargo.toml @@ -43,6 +43,10 @@ features = [ "system-tray" ] +[dev-dependencies.tauri] +path = "../../../core/tauri" +features = ["test"] + [target."cfg(target_os = \"windows\")".dependencies] window-shadows= "0.2" diff --git a/examples/api/src-tauri/src/lib.rs b/examples/api/src-tauri/src/lib.rs index 8578b5c50..13e428037 100644 --- a/examples/api/src-tauri/src/lib.rs +++ b/examples/api/src-tauri/src/lib.rs @@ -12,7 +12,7 @@ mod cmd; mod tray; use serde::Serialize; -use tauri::{window::WindowBuilder, App, AppHandle, RunEvent, WindowUrl}; +use tauri::{window::WindowBuilder, App, AppHandle, RunEvent, Runtime, WindowUrl}; use tauri_plugin_sample::{PingRequest, SampleExt}; #[derive(Clone, Serialize)] @@ -25,8 +25,15 @@ pub type OnEvent = Box; #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { + run_app(tauri::Builder::default(), |_app| {}) +} + +pub fn run_app) + Send + 'static>( + builder: tauri::Builder, + setup: F, +) { #[allow(unused_mut)] - let mut builder = tauri::Builder::default() + let mut builder = builder .plugin( tauri_plugin_log::Builder::default() .level(log::LevelFilter::Info) @@ -90,6 +97,8 @@ pub fn run() { } }); + setup(app); + Ok(()) }) .on_page_load(|window, _| { @@ -124,7 +133,7 @@ pub fn run() { app.set_activation_policy(tauri::ActivationPolicy::Regular); app.run(move |_app_handle, _event| { - #[cfg(desktop)] + #[cfg(all(desktop, not(test)))] if let RunEvent::ExitRequested { api, .. } = &_event { // Keep the event loop running even if all windows are closed // This allow us to catch system tray events when there is no window @@ -132,3 +141,19 @@ pub fn run() { } }) } + +#[cfg(test)] +mod tests { + use tauri::Manager; + + #[test] + fn run_app() { + super::run_app(tauri::test::mock_builder(), |app| { + let window = app.get_window("main").unwrap(); + std::thread::spawn(move || { + std::thread::sleep(std::time::Duration::from_secs(1)); + window.close().unwrap(); + }); + }) + } +} diff --git a/examples/api/src-tauri/src/tray.rs b/examples/api/src-tauri/src/tray.rs index 2a1e07951..96a8bbd9a 100644 --- a/examples/api/src-tauri/src/tray.rs +++ b/examples/api/src-tauri/src/tray.rs @@ -4,10 +4,11 @@ use std::sync::atomic::{AtomicBool, Ordering}; use tauri::{ - CustomMenuItem, Manager, SystemTray, SystemTrayEvent, SystemTrayMenu, WindowBuilder, WindowUrl, + CustomMenuItem, Manager, Runtime, SystemTray, SystemTrayEvent, SystemTrayMenu, WindowBuilder, + WindowUrl, }; -pub fn create_tray(app: &tauri::App) -> tauri::Result<()> { +pub fn create_tray(app: &tauri::App) -> tauri::Result<()> { let mut tray_menu1 = SystemTrayMenu::new() .add_item(CustomMenuItem::new("toggle", "Toggle")) .add_item(CustomMenuItem::new("new", "New window")) diff --git a/examples/streaming/index.html b/examples/streaming/index.html index 30f8af1c3..edcc5f020 100644 --- a/examples/streaming/index.html +++ b/examples/streaming/index.html @@ -4,6 +4,10 @@