Skip to content

Commit

Permalink
refactor(core): remove window endpoints (#6947)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed May 12, 2023
1 parent 5a9307d commit 9a79dc0
Show file tree
Hide file tree
Showing 29 changed files with 76 additions and 3,893 deletions.
6 changes: 6 additions & 0 deletions .changes/ipc-scope-remove-enable-tauri-api.md
@@ -0,0 +1,6 @@
---
"tauri": patch
"tauri-utils": patch
---

Remove `enable_tauri_api` from the IPC scope.
5 changes: 5 additions & 0 deletions .changes/remove-macros-command-module.md
@@ -0,0 +1,5 @@
---
"tauri-macros": patch
---

Removed the module command macros.
6 changes: 6 additions & 0 deletions .changes/remove-window.md
@@ -0,0 +1,6 @@
---
"tauri": patch
"api": patch
---

Moved the `window` JS APIs to its own plugin in the plugins-workspace repository.
5 changes: 0 additions & 5 deletions core/tauri-config-schema/schema.json
Expand Up @@ -2508,11 +2508,6 @@
"items": {
"type": "string"
}
},
"enableTauriAPI": {
"description": "Enables access to the Tauri API.",
"default": false,
"type": "boolean"
}
},
"additionalProperties": false
Expand Down
303 changes: 0 additions & 303 deletions core/tauri-macros/src/command_module.rs

This file was deleted.

40 changes: 1 addition & 39 deletions core/tauri-macros/src/lib.rs
Expand Up @@ -4,10 +4,9 @@

use crate::context::ContextItems;
use proc_macro::TokenStream;
use syn::{parse_macro_input, DeriveInput, ItemFn};
use syn::{parse_macro_input, DeriveInput};

mod command;
mod command_module;
mod mobile;
mod runtime;

Expand Down Expand Up @@ -81,40 +80,3 @@ pub fn default_runtime(attributes: TokenStream, input: TokenStream) -> TokenStre
let input = parse_macro_input!(input as DeriveInput);
runtime::default_runtime(attributes, input).into()
}

/// Prepares the command module enum.
#[doc(hidden)]
#[proc_macro_derive(CommandModule, attributes(cmd))]
pub fn derive_command_module(input: TokenStream) -> TokenStream {
let input = parse_macro_input!(input as DeriveInput);
command_module::generate_run_fn(input)
}

/// Adds a `run` method to an enum (one of the tauri endpoint modules).
/// The `run` method takes a `tauri::endpoints::InvokeContext`
/// and returns a `tauri::Result<tauri::endpoints::InvokeResponse>`.
/// It matches on each enum variant and call a method with name equal to the variant name, lowercased and snake_cased,
/// passing the context and the variant's fields as arguments.
/// That function must also return the same `Result<InvokeResponse>`.
#[doc(hidden)]
#[proc_macro_attribute]
pub fn command_enum(_: TokenStream, input: TokenStream) -> TokenStream {
let input = parse_macro_input!(input as DeriveInput);
command_module::generate_command_enum(input)
}

#[doc(hidden)]
#[proc_macro_attribute]
pub fn module_command_handler(attributes: TokenStream, input: TokenStream) -> TokenStream {
let attributes = parse_macro_input!(attributes as command_module::HandlerAttributes);
let input = parse_macro_input!(input as ItemFn);
command_module::command_handler(attributes, input).into()
}

#[doc(hidden)]
#[proc_macro_attribute]
pub fn module_command_test(attributes: TokenStream, input: TokenStream) -> TokenStream {
let attributes = parse_macro_input!(attributes as command_module::HandlerTestAttributes);
let input = parse_macro_input!(input as ItemFn);
command_module::command_test(attributes, input).into()
}

0 comments on commit 9a79dc0

Please sign in to comment.