Эх сурвалжийг харах

chore: remove v1 references on documentation and benchmark (#7258)

Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
Lucas Fernandes Nogueira 2 жил өмнө
parent
commit
e63111b65a

+ 1 - 1
core/tauri/src/window.rs

@@ -2084,7 +2084,7 @@ impl<R: Runtime> Window<R> {
   ///
   /// 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.
+  /// the `emit` function from the window plugin (`@tauri-apps/plugin-window` package).
   ///
   /// # Examples
   /// ```

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
tooling/api/docs/js-api.json


+ 4 - 12
tooling/api/src/mocks.ts

@@ -125,21 +125,13 @@ export function mockIPC(
  * mockWindows("main", "second", "third");
  *
  * mockIPC((cmd, args) => {
- *  if (cmd === "tauri") {
- *    if (
- *      args?.__tauriModule === "Window" &&
- *      args?.message?.cmd === "manage" &&
- *      args?.message?.data?.cmd?.type === "close"
- *    ) {
- *      console.log('closing window!');
- *    }
+ *  if (cmd === "plugin:event|emit") {
+ *    console.log('emit event', args?.event, args?.payload);
  *  }
  * });
  *
- * const { getCurrent } = await import("@tauri-apps/api/window");
- *
- * const win = getCurrent();
- * await win.close(); // this will cause the mocked IPC handler to log to the console.
+ * const { emit } = await import("@tauri-apps/api/event");
+ * await emit('loaded'); // this will cause the mocked IPC handler to log to the console.
  * ```
  *
  * @param current Label of window this JavaScript context is running in.

+ 2 - 2
tooling/api/typedoc.json

@@ -2,8 +2,8 @@
   "entryPoints": [
     "src/event.ts",
     "src/mocks.ts",
-    "src/tauri.ts",
-    "src/window.ts"
+    "src/path.ts",
+    "src/tauri.ts"
   ],
   "githubPages": false,
   "readme": "none",

+ 5 - 1
tooling/bench/src/utils.rs

@@ -37,7 +37,11 @@ pub struct StraceOutput {
 
 pub fn get_target() -> &'static str {
   #[cfg(target_os = "macos")]
-  return "x86_64-apple-darwin";
+  return if cfg!(target_arch = "aarch64") {
+    "aarch64-apple-darwin"
+  } else {
+    "x86_64-apple-darwin"
+  };
   #[cfg(target_os = "linux")]
   return "x86_64-unknown-linux-gnu";
   #[cfg(target_os = "windows")]

+ 1 - 24
tooling/bench/tests/Cargo.toml

@@ -2,6 +2,7 @@
 members = [
   "./*/src-tauri/",
 ]
+resolver = "2"
 
 [profile.release]
 panic = "abort"
@@ -9,27 +10,3 @@ codegen-units = 1
 lto = true
 incremental = false
 opt-level = "s"
-
-# See https://github.com/rust-lang/cargo/issues/10118#issuecomment-1006000210
-# And https://github.com/rust-lang/rust/issues/96486
-[profile.release.package.compiler_builtins]
-# The compiler-builtins crate cannot reference libcore, and it's own CI will
-# verify that this is the case. This requires, however, that the crate is built
-# without overflow checks and debug assertions. Forcefully disable debug
-# assertions and overflow checks here which should ensure that even if these
-# assertions are enabled for libstd we won't enable then for compiler_builtins
-# which should ensure we still link everything correctly.
-debug-assertions = false
-overflow-checks = false
-
-# For compiler-builtins we always use a high number of codegen units.
-# The goal here is to place every single intrinsic into its own object
-# file to avoid symbol clashes with the system libgcc if possible. Note
-# that this number doesn't actually produce this many object files, we
-# just don't create more than this number of object files.
-#
-# It's a bit of a bummer that we have to pass this here, unfortunately.
-# Ideally this would be specified through an env var to Cargo so Cargo
-# knows how many CGUs are for this specific crate, but for now
-# per-crate configuration isn't specifiable in the environment.
-codegen-units = 10000

+ 1 - 12
tooling/bench/tests/files_transfer/public/index.html

@@ -10,18 +10,7 @@
 
     <script>
       window.addEventListener('DOMContentLoaded', (event) => {
-        window.__TAURI__
-          .invoke('tauri', {
-            __tauriModule: 'Fs',
-            message: {
-              cmd: 'readFile',
-              path: '.tauri_3mb.json',
-              options: {
-                // home folder
-                dir: 11
-              }
-            }
-          })
+        window.__TAURI__.invoke('read_file')
           .then((_data) => {
             // success
             window.__TAURI__.invoke('app_should_close', { exitCode: 0 })

+ 1 - 1
tooling/bench/tests/files_transfer/src-tauri/Cargo.toml

@@ -11,7 +11,7 @@ tauri-build = { path = "../../../../../core/tauri-build", features = [ "codegen"
 [dependencies]
 serde_json = "1.0"
 serde = { version = "1.0", features = [ "derive" ] }
-tauri = { path = "../../../../../core/tauri", features = ["fs-read-file"] }
+tauri = { path = "../../../../../core/tauri", features = [] }
 
 [features]
 custom-protocol = [ "tauri/custom-protocol" ]

+ 15 - 2
tooling/bench/tests/files_transfer/src-tauri/src/main.rs

@@ -4,14 +4,27 @@
 
 #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
 
-#[tauri::command]
+use std::fs::read;
+use tauri::{command, path::BaseDirectory, AppHandle, Manager, Runtime};
+
+#[command]
 fn app_should_close(exit_code: i32) {
   std::process::exit(exit_code);
 }
 
+#[command]
+async fn read_file<R: Runtime>(app: AppHandle<R>) -> Result<Vec<u8>, String> {
+  let path = app
+    .path()
+    .resolve(".tauri_3mb.json", BaseDirectory::Home)
+    .map_err(|e| e.to_string())?;
+  let contents = read(&path).map_err(|e| e.to_string())?;
+  Ok(contents)
+}
+
 fn main() {
   tauri::Builder::default()
-    .invoke_handler(tauri::generate_handler![app_should_close])
+    .invoke_handler(tauri::generate_handler![app_should_close, read_file])
     .run(tauri::generate_context!())
     .expect("error while running tauri application");
 }

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно