Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(core): remove window endpoints #6947

Merged
merged 5 commits into from May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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()
}