Skip to content

Commit ab57f95

Browse files
committed
chore: run pnpm format on the repo
1 parent 88a1dd1 commit ab57f95

File tree

22 files changed

+448
-398
lines changed

22 files changed

+448
-398
lines changed

.changes/config.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,7 @@
216216
"tauri-plugin": {
217217
"path": "./core/tauri-plugin",
218218
"manager": "rust",
219-
"dependencies": [
220-
"tauri-utils"
221-
],
219+
"dependencies": ["tauri-utils"],
222220
"postversion": "node ../../.scripts/covector/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }"
223221
},
224222
"tauri-build": {

.devcontainer/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ To do this, open your project with VS Code and run **Remote-Containers: Clone Re
3333
Docker Desktop provides facilities for [allowing the development container to connect to a service on the Docker host](https://docs.docker.com/desktop/windows/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host). So long as you have an X window server running on your Docker host, the devcontainer can connect to it and expose your Tauri GUI via an X window.
3434

3535
**Export the `DISPLAY` variable within the devcontainer terminal you launch your Tauri application from to expose your GUI outside of the devcontainer**.
36+
3637
```bash
3738
export DISPLAY="host.docker.internal:0"
3839
```

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ dist
1111
/tooling/cli/schema.json
1212
/core/tauri-config-schema/schema.json
1313
CHANGELOG.md
14+
*.wxs
15+
**/reference.md
16+
*schema.json

.scripts/covector/package-latest-version.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ https.get(url, options, (response) => {
4545
response.on('end', function () {
4646
const data = JSON.parse(chunks.join(''))
4747
if (kind === 'cargo') {
48-
const versions = data.versions?.filter((v) => v.num.startsWith(target)) ?? []
48+
const versions =
49+
data.versions?.filter((v) => v.num.startsWith(target)) ?? []
4950
console.log(versions.length ? versions[0].num : '0.0.0')
5051
} else if (kind === 'npm') {
5152
const versions = Object.keys(data.versions).filter((v) =>

ARCHITECTURE.md

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,132 @@
11
# The Tauri Architecture
2+
23
https://tauri.app
34

45
https://github.com/tauri-apps/tauri
56

67
## Introduction
8+
79
Tauri is a polyglot and generic toolkit that is very composable and allows engineers to make a wide variety of applications. It is used for building applications for Desktop Computers using a combination of Rust tools and HTML rendered in a Webview. Apps built with Tauri can ship with any number of pieces of an optional JS API / Rust API so that webviews can control the system via message passing. In fact, developers can extend the default API with their own functionality and bridge the Webview and Rust-based backend easily.
810

911
Tauri apps can have custom menus and have tray-type interfaces. They can be updated, and are managed by the user's operating system as expected. They are very small, because they use the OS's webview. They do not ship a runtime, since the final binary is compiled from Rust. This makes the reversing of Tauri apps not a trivial task.
1012

1113
## What Tauri is NOT
14+
1215
- Tauri is not a lightweight kernel wrapper...instead it directly uses [WRY](#wry) and [TAO](#tao) to do the heavy-lifting in making system calls to the OS.
1316
- Tauri is not a VM or virtualized environment...instead it is an application toolkit that allows making Webview OS applications.
1417

1518
## Major Components
19+
1620
The following section briefly describes the roles of the various parts of Tauri.
21+
1722
### Tauri Core [STABLE RUST]
23+
1824
#### [tauri](https://github.com/tauri-apps/tauri/tree/dev/core/tauri)
25+
1926
This is the major crate that holds everything together. It brings the runtimes, macros, utilities and API into one final product. It reads the `tauri.conf.json` file at compile time in order to bring in features and undertake actual configuration of the app (and even the `Cargo.toml` file in the project's folder). It handles script injection (for polyfills / prototype revision) at runtime, hosts the API for systems interaction, and even manages updating.
2027

2128
#### [tauri-build](https://github.com/tauri-apps/tauri/tree/dev/core/tauri-build)
29+
2230
Apply the macros at build-time in order to rig some special features needed by `cargo`.
2331

2432
#### [tauri-codegen](https://github.com/tauri-apps/tauri/tree/dev/core/tauri-codegen)
33+
2534
- Embed, hash, and compress assets, including icons for the app as well as the system-tray.
2635
- Parse `tauri.conf.json` at compile time and generate the Config struct.
2736

2837
#### [tauri-macros](https://github.com/tauri-apps/tauri/tree/dev/core/tauri-macros)
38+
2939
Create macros for the context, handler, and commands by leveraging the `tauri-codegen` crate.
3040

3141
#### [tauri-runtime](https://github.com/tauri-apps/tauri/tree/dev/core/tauri-runtime)
42+
3243
This is the glue layer between tauri itself and lower level webview libraries.
3344

3445
#### [tauri-runtime-wry](https://github.com/tauri-apps/tauri/tree/dev/core/tauri-runtime-wry)
46+
3547
This crate opens up direct systems-level interactions specifically for WRY, such as printing, monitor detection, and other windowing related tasks. `tauri-runtime` implementation for WRY.
3648

3749
#### [tauri-utils](https://github.com/tauri-apps/tauri/tree/dev/core/tauri-utils)
38-
This is common code that is reused in many places and offers useful utilities like parsing configuration files, detecting platform triples, injecting the CSP, and managing assets.
3950

51+
This is common code that is reused in many places and offers useful utilities like parsing configuration files, detecting platform triples, injecting the CSP, and managing assets.
4052

4153
### Tauri Tooling
54+
4255
#### [@tauri-apps/api](https://github.com/tauri-apps/tauri/tree/dev/tooling/api) [TS -> JS]
56+
4357
A TypeScript library that creates `cjs` and `esm` JavaScript endpoints for you to import into your Frontend framework so that the Webview can call and listen to backend activity. We also ship the pure TypeScript, because for some frameworks this is more optimal. It uses the message passing of webviews to their hosts.
4458

4559
#### [bundler](https://github.com/tauri-apps/tauri/tree/dev/tooling/bundler) [RUST / SHELL]
60+
4661
The bundler is a library that builds a Tauri App for the platform triple it detects / is told. At the moment it currently supports macOS, Windows and Linux - but in the near future will support mobile platforms as well. May be used outside of Tauri projects.
4762

4863
#### [@tauri-apps/cli](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli/node) [JS]
64+
4965
It is a wrapper around [tauri-cli](https://github.com/tauri-apps/tauri/blob/dev/tooling/cli) using [napi-rs](https://github.com/napi-rs/napi-rs) to produce NPM packages for each platform.
5066

5167
#### [tauri-cli](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli) [RUST]
68+
5269
This rust executable provides the full interface to all of the required activities for which the CLI is required. It will run on macOS, Windows, and Linux.
5370

5471
#### [create-tauri-app](https://github.com/tauri-apps/create-tauri-app) [JS]
72+
5573
This is a toolkit that will enable engineering teams to rapidly scaffold out a new tauri-apps project using the frontend framework of their choice (as long as it has been configured).
5674

5775
# External Crates
76+
5877
The Tauri-Apps organisation maintains two "upstream" crates from Tauri, namely TAO for creating and managing application windows, and WRY for interfacing with the Webview that lives within the window.
5978

6079
## [TAO](https://github.com/tauri-apps/tao)
61-
Cross-platform application window creation library in Rust that supports all major platforms like Windows, macOS, Linux, iOS and Android. Written in Rust, it is a fork of [winit](https://github.com/rust-windowing/winit) that we have extended for our own needs like menu bar and system tray.
6280

81+
Cross-platform application window creation library in Rust that supports all major platforms like Windows, macOS, Linux, iOS and Android. Written in Rust, it is a fork of [winit](https://github.com/rust-windowing/winit) that we have extended for our own needs like menu bar and system tray.
6382

6483
## [WRY](https://github.com/tauri-apps/wry)
84+
6585
WRY is a cross-platform WebView rendering library in Rust that supports all major desktop platforms like Windows, macOS, and Linux.
6686
Tauri uses WRY as the abstract layer responsible to determine which webview is used (and how interactions are made).
6787

6888
# Additional tooling
6989

7090
## [tauri-action](https://github.com/tauri-apps/tauri-action)
91+
7192
This is a github workflow that builds tauri binaries for all platforms. It is not the fastest out there, but it gets the job done and is highly configurable. Even allowing you to create a (very basic) tauri app even if tauri is not setup.
7293

7394
## [create-pull-request](https://github.com/tauri-apps/create-pull-request)
95+
7496
Because this is a very risky (potentially destructive) github action, we forked it in order to have strong guarantees that the code we think is running is actually the code that is running.
7597

7698
## [vue-cli-plugin-tauri](https://github.com/tauri-apps/vue-cli-plugin-tauri)
99+
77100
This plugin allows you to very quickly install tauri in a vue-cli project.
78101

79102
## [tauri-vscode](https://github.com/tauri-apps/tauri-vscode)
103+
80104
This project enhances the VS Code interface with several nice-to-have features.
81105

82106
# Tauri Plugins [documentation](https://tauri.app/v1/guides/features/plugin/)
83107

84108
Generally speaking, plugins are authored by third parties (even though there may be official, supported plugins). A plugin generally does 3 things:
109+
85110
1. It provides rust code to do "something".
86111
2. It provides interface glue to make it easy to integrate into an app.
87112
3. It provides a JS API for interfacing with the rust code.
88113

89114
Here are several examples of Tauri Plugins:
115+
90116
- https://github.com/tauri-apps/tauri-plugin-sql
91117
- https://github.com/tauri-apps/tauri-plugin-stronghold
92118
- https://github.com/tauri-apps/tauri-plugin-authenticator
93119

94120
# Workflows
121+
95122
## What does the Development flow look like?
123+
96124
A developer must first install the prerequisite toolchains for creating a Tauri app. At the very least this will entail installing rust & cargo, and most likely also a modern version of node.js and potentially another package manager. Some platforms may also require other tooling and libraries, but this has been documented carefully in the respective platform docs.
97125

98126
Because of the many ways to build front-ends, we will stick with a common node.js based approach for development. (Note: Tauri does not by default ship a node.js runtime.)
99127

100128
The easiest way to do this is to run the following:
129+
101130
```
102131
npx create-tauri-app
103132
```
@@ -107,12 +136,15 @@ Which will ask you a bunch of questions about the framework you want to install
107136
> If you don't use this process, you will have to manually install the tauri cli, initialise tauri and manually configure the `tauri.conf.json` file.
108137
109138
Once everything is installed, you can run:
139+
110140
```
111141
yarn tauri dev
112142
-or-
113143
npm run tauri dev
114144
```
145+
115146
This will do several things:
147+
116148
1. start the JS Framework devserver
117149
2. begin the long process of downloading and compiling the rust libraries
118150
3. open an application window with devtools enabled
@@ -128,29 +160,32 @@ If you need to get deeper insight into your current project, or triage requires
128160
yarn tauri info
129161
```
130162

131-
132163
## What does the Release flow look like?
133164

134165
The release flow begins with proper configuration in the `tauri.conf.json` file. In this file, the developer can configure not only the basic behaviour of the application (like window size and decoration), they can also provide settings for signing and updating.
135166

136167
Depending upon the operating system that the developer (or CI) is building the application on, there will be an app built for them for that system. (Cross compilation is not currently available, however there is an official [GitHub Action](https://github.com/tauri-apps/tauri-action) that can be used to build for all platforms.)
137168

138169
To kick off this process, just:
170+
139171
```
140172
yarn tauri build
141173
```
142174

143175
After some time, the process will end and you can see the results in the `./src-tauri/target/release` folder.
144176

145177
## What does the End-User flow look like?
178+
146179
End users will be provided with binaries in ways that are appropriate for their systems. Whether macOS, Linux, or Windows, direct download or store installations - they will be able to follow procedures for installing and removing that they are used to.
147180

148181
## What does the Updating flow look like?
182+
149183
When a new version is ready, the developer publishes the new signed artifacts to a server (that they have configured within `tauri.conf.json`).
150184

151185
The application can poll this server to see if there is a new release. When there is a new release, the user is prompted to update. The application update is downloaded, verified (checksum & signature), updated, closed, and restarted.
152186

153187
## License
188+
154189
Tauri itself is licensed under MIT or Apache-2.0. If you repackage it and modify any source code, it is your responsibility to verify that you are complying with all upstream licenses. Tauri is provided AS-IS with no explicit claim for suitability for any purpose.
155190

156191
Here you may peruse our [Software Bill of Materials](https://app.fossa.com/projects/git%2Bgithub.com%2Ftauri-apps%2Ftauri).

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ Additionally, we may ask you to independently verify our patch, which will be av
2424

2525
Depending on your decision to accept or deny credit for the vulnerability, you will be publicly attributed to the vulnerability and may be mentioned in our announcements.
2626

27-
At the current time we do not have the financial ability to reward bounties,
27+
At the current time we do not have the financial ability to reward bounties,
2828
but in extreme cases will at our discretion consider a reward.

core/tauri-runtime-wry/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,32 @@
1212
[![https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg](https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg)](https://good-labs.github.io/greater-good-affirmation)
1313
[![support](https://img.shields.io/badge/sponsor-Opencollective-blue.svg)](https://opencollective.com/tauri)
1414

15-
| Component | Version |
16-
| --------- | ------------------------------------------- |
17-
| tauri-runtime-wry | [![](https://img.shields.io/crates/v/tauri-runtime-wry?style=flat-square)](https://crates.io/crates/tauri-runtime-wry) |
15+
| Component | Version |
16+
| ----------------- | ---------------------------------------------------------------------------------------------------------------------- |
17+
| tauri-runtime-wry | [![](https://img.shields.io/crates/v/tauri-runtime-wry?style=flat-square)](https://crates.io/crates/tauri-runtime-wry) |
1818

1919
## About Tauri
20+
2021
Tauri is a polyglot and generic system that is very composable and allows engineers to make a wide variety of applications. It is used for building applications for Desktop Computers using a combination of Rust tools and HTML rendered in a Webview. Apps built with Tauri can ship with any number of pieces of an optional JS API / Rust API so that webviews can control the system via message passing. In fact, developers can extend the default API with their own functionality and bridge the Webview and Rust-based backend easily.
2122

2223
Tauri apps can have custom menus and have tray-type interfaces. They can be updated, and are managed by the user's operating system as expected. They are very small, because they use the system's webview. They do not ship a runtime, since the final binary is compiled from rust. This makes the reversing of Tauri apps not a trivial task.
2324

2425
## This module
26+
2527
This crate opens up direct systems-level interactions specifically for WRY, such as printing, monitor detection, and other windowing related tasks. `tauri-runtime` implementation for WRY.
2628

2729
To learn more about the details of how all of these pieces fit together, please consult this [ARCHITECTURE.md](https://github.com/tauri-apps/tauri/blob/dev/ARCHITECTURE.md) document.
2830

2931
## Semver
32+
3033
**tauri** is following [Semantic Versioning 2.0](https://semver.org/).
34+
3135
## Licenses
36+
3237
Code: (c) 2021 - The Tauri Programme within The Commons Conservancy.
3338

3439
MIT or MIT/Apache 2.0 where applicable.
3540

3641
Logo: CC-BY-NC-ND
42+
3743
- Original Tauri Logo Designs by [Daniel Thompson-Yvetot](https://github.com/nothingismagick) and [Guillaume Chau](https://github.com/akryum)

core/tauri/scripts/process-ipc-message-fn.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
// this is a function and not an iife so use it carefully
66

7-
(function (message) {
7+
;(function (message) {
88
if (
99
message instanceof ArrayBuffer ||
1010
ArrayBuffer.isView(message) ||

core/tauri/src/window/scripts/drag.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
// while macOS macos maximization should be on mouseup and if the mouse
1111
// moves after the double click, it should be cancelled (see https://github.com/tauri-apps/tauri/issues/8306)
1212
//-----------------------//
13-
const TAURI_DRAG_REGION_ATTR = 'data-tauri-drag-region';
14-
let x = 0, y = 0;
13+
const TAURI_DRAG_REGION_ATTR = 'data-tauri-drag-region'
14+
let x = 0,
15+
y = 0
1516
document.addEventListener('mousedown', (e) => {
1617
if (
1718
// element has the magic data attribute
@@ -20,8 +21,7 @@
2021
e.button === 0 &&
2122
// and was normal click to drag or double click to maximize
2223
(e.detail === 1 || e.detail === 2)
23-
) {
24-
24+
) {
2525
// macOS maximization happens on `mouseup`,
2626
// so we save needed state and early return
2727
if (osName === 'macos' && e.detail == 2) {
@@ -44,7 +44,7 @@
4444
})
4545
// on macOS we maximze on mouseup instead, to match the system behavior where maximization can be canceled
4646
// if the mouse moves outside the data-tauri-drag-region
47-
if (osName === "macos") {
47+
if (osName === 'macos') {
4848
document.addEventListener('mouseup', (e) => {
4949
if (
5050
// element has the magic data attribute
@@ -54,9 +54,12 @@
5454
// and was double click
5555
e.detail === 2 &&
5656
// and the cursor hasn't moved from initial mousedown
57-
e.clientX === x && e.clientY === y
57+
e.clientX === x &&
58+
e.clientY === y
5859
) {
59-
window.__TAURI_INTERNALS__.invoke('plugin:window|internal_toggle_maximize')
60+
window.__TAURI_INTERNALS__.invoke(
61+
'plugin:window|internal_toggle_maximize'
62+
)
6063
}
6164
})
6265
}

core/tests/acl/fixtures/capabilities/scope-extended/cap.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
{
22
"identifier": "run-app",
33
"description": "app capability",
4-
"windows": [
5-
"main"
6-
],
4+
"windows": ["main"],
75
"permissions": [
86
{
97
"identifier": "fs:read",
@@ -38,4 +36,4 @@
3836
},
3937
"fs:read-download-dir"
4038
]
41-
}
39+
}

examples/api/src-tauri/capabilities/run-app.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
"$schema": "./schemas/desktop-schema.json",
33
"identifier": "run-app",
44
"description": "permissions to run the app",
5-
"windows": [
6-
"main",
7-
"main-*"
8-
],
5+
"windows": ["main", "main-*"],
96
"permissions": [
107
"sample:allow-ping-scoped",
118
"sample:global-scope",
@@ -88,4 +85,4 @@
8885
"tray:allow-set-icon-as-template",
8986
"tray:allow-set-show-menu-on-left-click"
9087
]
91-
}
88+
}

0 commit comments

Comments
 (0)