mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-05-01 12:08:06 +02:00
Merge branch 'dev' into ci/actions-rs
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
# Order is important; the last matching pattern takes the most precedence.
|
||||
* @tauri-apps/plugin-maintainers
|
||||
|
||||
# Currently CI/CD for plugins are in heavy flux, and the plugin team manages it themselves.
|
||||
# .github @tauri-apps/wg-devops
|
||||
@@ -1,6 +1,7 @@
|
||||
name: Sync
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
@@ -14,7 +15,21 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# potentially a build step here
|
||||
- name: Cache pnpm modules
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
- uses: pnpm/action-setup@v2.2.4
|
||||
with:
|
||||
run_install: true
|
||||
- name: Build packages
|
||||
run: pnpm build
|
||||
- name: Sync
|
||||
run: .github/sync-to-mirrors.sh
|
||||
env:
|
||||
|
||||
+2
-1
@@ -1,2 +1,3 @@
|
||||
target
|
||||
node_modules
|
||||
node_modules
|
||||
dist
|
||||
Generated
+53
-53
@@ -149,7 +149,7 @@ dependencies = [
|
||||
"devd-rs",
|
||||
"libc",
|
||||
"libudev",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"rand 0.7.3",
|
||||
"runloop",
|
||||
"winapi 0.3.9",
|
||||
@@ -993,7 +993,7 @@ version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3bdd7b0849075e79ee9a1836df22c717d1eba30451796fdc631b04565dd11e2a"
|
||||
dependencies = [
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1304,7 +1304,7 @@ checksum = "d266041a359dfa931b370ef684cceb84b166beb14f7f0421f4a6a3d0c446d12e"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"rustversion",
|
||||
"windows",
|
||||
]
|
||||
@@ -1443,7 +1443,7 @@ dependencies = [
|
||||
"aho-corasick",
|
||||
"bstr",
|
||||
"fnv",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"regex",
|
||||
]
|
||||
|
||||
@@ -1607,7 +1607,7 @@ version = "0.25.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5c13fb08e5d4dfc151ee5e88bae63f7773d61852f3bdc73c9f4b9e1bde03148"
|
||||
dependencies = [
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"mac",
|
||||
"markup5ever",
|
||||
"proc-macro2",
|
||||
@@ -1751,7 +1751,7 @@ dependencies = [
|
||||
"crossbeam-utils",
|
||||
"globset",
|
||||
"lazy_static",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"memchr",
|
||||
"regex",
|
||||
"same-file",
|
||||
@@ -1948,7 +1948,7 @@ dependencies = [
|
||||
"cesu8",
|
||||
"combine",
|
||||
"jni-sys",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"thiserror",
|
||||
"walkdir",
|
||||
]
|
||||
@@ -2026,7 +2026,7 @@ dependencies = [
|
||||
"gtk",
|
||||
"gtk-sys",
|
||||
"libappindicator-sys",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2133,20 +2133,6 @@ dependencies = [
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"byte-unit",
|
||||
"fern",
|
||||
"log 0.4.17",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_repr",
|
||||
"tauri",
|
||||
"time 0.3.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.17"
|
||||
@@ -2193,7 +2179,7 @@ version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a24f40fb03852d1cdd84330cddcaf98e9ec08a7b7768e952fad3b4cf048ec8fd"
|
||||
dependencies = [
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"phf 0.8.0",
|
||||
"phf_codegen",
|
||||
"string_cache",
|
||||
@@ -2273,7 +2259,7 @@ dependencies = [
|
||||
"iovec",
|
||||
"kernel32-sys",
|
||||
"libc",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"miow",
|
||||
"net2",
|
||||
"slab",
|
||||
@@ -2287,7 +2273,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||
"windows-sys 0.42.0",
|
||||
]
|
||||
@@ -2299,7 +2285,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19"
|
||||
dependencies = [
|
||||
"lazycell",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"mio 0.6.23",
|
||||
"slab",
|
||||
]
|
||||
@@ -2324,7 +2310,7 @@ checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"openssl",
|
||||
"openssl-probe",
|
||||
"openssl-sys",
|
||||
@@ -3186,7 +3172,7 @@ dependencies = [
|
||||
"hyper-tls",
|
||||
"ipnet",
|
||||
"js-sys",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"mime",
|
||||
"native-tls",
|
||||
"once_cell",
|
||||
@@ -3271,7 +3257,7 @@ version = "0.20.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "539a2bfe908f471bfa933876bd1eb6a19cf2176d375f82ef7f99530a40e48c2c"
|
||||
dependencies = [
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"ring",
|
||||
"sct",
|
||||
"webpki",
|
||||
@@ -3396,7 +3382,7 @@ dependencies = [
|
||||
"cssparser",
|
||||
"derive_more",
|
||||
"fxhash",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"matches",
|
||||
"phf 0.8.0",
|
||||
"phf_codegen",
|
||||
@@ -3735,7 +3721,7 @@ dependencies = [
|
||||
"itoa 1.0.4",
|
||||
"libc",
|
||||
"libsqlite3-sys",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"md-5",
|
||||
"memchr",
|
||||
"num-bigint",
|
||||
@@ -3862,7 +3848,7 @@ checksum = "8b00fbacafc4ef96fb95fac07d86cc3ec5e21c8efa94785374ad7913a4a216ba"
|
||||
dependencies = [
|
||||
"atom",
|
||||
"lazy_static",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"thiserror",
|
||||
"zeroize",
|
||||
]
|
||||
@@ -4000,7 +3986,7 @@ dependencies = [
|
||||
"lazy_static",
|
||||
"libappindicator",
|
||||
"libc",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"ndk",
|
||||
"ndk-context",
|
||||
"ndk-sys",
|
||||
@@ -4121,7 +4107,7 @@ dependencies = [
|
||||
"authenticator",
|
||||
"base64 0.13.1",
|
||||
"chrono",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"once_cell",
|
||||
"rand 0.8.5",
|
||||
"rusty-fork",
|
||||
@@ -4138,7 +4124,7 @@ name = "tauri-plugin-autostart"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"auto-launch",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
@@ -4149,7 +4135,7 @@ dependencies = [
|
||||
name = "tauri-plugin-fs-extra"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
@@ -4160,7 +4146,7 @@ dependencies = [
|
||||
name = "tauri-plugin-fs-watch"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"notify",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -4173,7 +4159,7 @@ name = "tauri-plugin-localhost"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"http",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
@@ -4181,12 +4167,26 @@ dependencies = [
|
||||
"tiny_http",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-log"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"byte-unit",
|
||||
"fern",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_repr",
|
||||
"tauri",
|
||||
"time 0.3.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-persisted-scope"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
@@ -4197,7 +4197,7 @@ dependencies = [
|
||||
name = "tauri-plugin-positioner"
|
||||
version = "0.2.7"
|
||||
dependencies = [
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_repr",
|
||||
@@ -4210,7 +4210,7 @@ name = "tauri-plugin-sql"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sqlx",
|
||||
@@ -4223,7 +4223,7 @@ dependencies = [
|
||||
name = "tauri-plugin-store"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
@@ -4237,7 +4237,7 @@ dependencies = [
|
||||
"hex",
|
||||
"iota-crypto 0.14.3",
|
||||
"iota_stronghold",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"rand 0.8.5",
|
||||
"rusty-fork",
|
||||
"serde",
|
||||
@@ -4252,7 +4252,7 @@ name = "tauri-plugin-upload"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"read-progress-stream",
|
||||
"reqwest",
|
||||
"serde",
|
||||
@@ -4268,7 +4268,7 @@ name = "tauri-plugin-websocket"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"futures-util",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"rand 0.8.5",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -4283,7 +4283,7 @@ name = "tauri-plugin-window-state"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
@@ -4473,7 +4473,7 @@ checksum = "e0d6ef4e10d23c1efb862eecad25c5054429a71958b4eeef85eb5e7170b477ca"
|
||||
dependencies = [
|
||||
"ascii",
|
||||
"chunked_transfer",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"time 0.3.17",
|
||||
"url",
|
||||
]
|
||||
@@ -4549,7 +4549,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f714dd15bead90401d77e04243611caec13726c2408afd5b31901dfcdcb3b181"
|
||||
dependencies = [
|
||||
"futures-util",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"native-tls",
|
||||
"tokio",
|
||||
"tokio-native-tls",
|
||||
@@ -4625,7 +4625,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"tracing-core",
|
||||
]
|
||||
|
||||
@@ -4673,7 +4673,7 @@ dependencies = [
|
||||
"bytes 1.3.0",
|
||||
"http",
|
||||
"httparse",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"native-tls",
|
||||
"rand 0.8.5",
|
||||
"sha-1",
|
||||
@@ -4877,7 +4877,7 @@ version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0"
|
||||
dependencies = [
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"try-lock",
|
||||
]
|
||||
|
||||
@@ -4916,7 +4916,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -5338,7 +5338,7 @@ dependencies = [
|
||||
"http",
|
||||
"kuchiki",
|
||||
"libc",
|
||||
"log 0.4.17",
|
||||
"log",
|
||||
"objc",
|
||||
"objc_id",
|
||||
"once_cell",
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
@@ -1,17 +1,86 @@
|
||||

|
||||
|
||||
<!-- description -->
|
||||
Use Hardware Security-keys in your Tauri App.
|
||||
|
||||
## Install
|
||||
|
||||
There are three general methods of installation that we can recommend.
|
||||
|
||||
1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked)
|
||||
2. Pull sources directly from Github using git tags / revision hashes (most secure)
|
||||
3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use)
|
||||
|
||||
Install the Core plugin by adding the following to your `Cargo.toml` file:
|
||||
|
||||
`src-tauri/Cargo.toml`
|
||||
```toml
|
||||
[dependencies]
|
||||
tauri-plugin-authenticator = "0.1"
|
||||
# or through git
|
||||
tauri-plugin-authenticator = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
||||
```
|
||||
|
||||
You can install the JavaScript Guest bindings using your preferred JavaScript package manager:
|
||||
|
||||
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
|
||||
|
||||
```sh
|
||||
pnpm add https://github.com/tauri-apps/tauri-plugin-authenticator
|
||||
# or
|
||||
npm add https://github.com/tauri-apps/tauri-plugin-authenticator
|
||||
# or
|
||||
yarn add https://github.com/tauri-apps/tauri-plugin-authenticator
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
First you need to register the core plugin with Tauri:
|
||||
|
||||
`src-tauri/src/main.rs`
|
||||
```rust
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_authenticator::init())
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
```
|
||||
|
||||
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
|
||||
|
||||
```javascript
|
||||
import { Authenticator } from 'tauri-plugin-authenticator-api'
|
||||
|
||||
const auth = new Authenticator()
|
||||
auth.init() // initialize transports
|
||||
|
||||
// generate a 32-bytes long random challenge
|
||||
const arr = new Uint32Array(32)
|
||||
window.crypto.getRandomValues(arr)
|
||||
const b64 = btoa(String.fromCharCode.apply(null, arr))
|
||||
// web-safe base64
|
||||
const challenge = b64.replace(/\+/g, '-').replace(/\//g, '_')
|
||||
|
||||
const domain = 'https://tauri.app'
|
||||
|
||||
// attempt to register with the security key
|
||||
const json = await auth.register(challenge, domain)
|
||||
const registerResult = JSON.parse(json)
|
||||
|
||||
// verify te registration was successfull
|
||||
const r2 = await auth.verifyRegistration(challenge, app, registerResult.registerData, registerResult.clientData)
|
||||
const j2 = JSON.parse(r2)
|
||||
|
||||
// sign some data
|
||||
const json = await auth.sign(challenge, app, keyHandle)
|
||||
const signData = JSON.parse(json)
|
||||
|
||||
// verify the signature again
|
||||
const counter = await auth.verifySignature(challenge, app, signData.signData, clientData, keyHandle, pubkey)
|
||||
|
||||
if(counter && counter>0) {
|
||||
console.log('SUCCESS!')
|
||||
}
|
||||
```
|
||||
|
||||
## Contributing
|
||||
@@ -20,6 +89,6 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu
|
||||
|
||||
## License
|
||||
|
||||
Code: (c) 2015 - 2021 - The Tauri Programme within The Commons Conservancy.
|
||||
Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
|
||||
|
||||
MIT or MIT/Apache 2.0 where applicable.
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
export declare class Authenticator {
|
||||
init(): Promise<void>;
|
||||
register(challenge: string, application: string): Promise<string>;
|
||||
verifyRegistration(challenge: string, application: string, registerData: string, clientData: string): Promise<string>;
|
||||
sign(challenge: string, application: string, keyHandle: string): Promise<string>;
|
||||
verifySignature(challenge: string, application: string, signData: string, clientData: string, keyHandle: string, pubkey: string): Promise<number>;
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0});};
|
||||
|
||||
var f={};e(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`);},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`);},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r});})}function w(e,r="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}
|
||||
|
||||
class Authenticator {
|
||||
async init() {
|
||||
return await c("plugin:authenticator|init");
|
||||
}
|
||||
async register(challenge, application) {
|
||||
return await c("plugin:authenticator|register", {
|
||||
timeout: 10000,
|
||||
challenge,
|
||||
application,
|
||||
});
|
||||
}
|
||||
async verifyRegistration(challenge, application, registerData, clientData) {
|
||||
return await c("plugin:authenticator|verify_registration", {
|
||||
challenge,
|
||||
application,
|
||||
registerData,
|
||||
clientData,
|
||||
});
|
||||
}
|
||||
async sign(challenge, application, keyHandle) {
|
||||
return await c("plugin:authenticator|sign", {
|
||||
timeout: 10000,
|
||||
challenge,
|
||||
application,
|
||||
keyHandle,
|
||||
});
|
||||
}
|
||||
async verifySignature(challenge, application, signData, clientData, keyHandle, pubkey) {
|
||||
return await c("plugin:authenticator|verify_signature", {
|
||||
challenge,
|
||||
application,
|
||||
signData,
|
||||
clientData,
|
||||
keyHandle,
|
||||
pubkey,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export { Authenticator };
|
||||
//# sourceMappingURL=index.min.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.min.js","sources":["../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-FEIY7W7S.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-RCPA6UVN.js","../index.ts"],"sourcesContent":["var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0})};export{e as a};\n","import{a as d}from\"./chunk-FEIY7W7S.js\";var f={};d(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`)},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`)},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r})})}function w(e,r=\"asset\"){let n=encodeURIComponent(e);return navigator.userAgent.includes(\"Windows\")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}export{s as a,c as b,w as c,f as d};\n",null],"names":["d","invoke"],"mappings":"AAAA,IAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC;;ACAjD,IAAI,CAAC,CAAC,EAAE,CAACA,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,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AAM,IAAI,GAAA;AACR,QAAA,OAAO,MAAMC,CAAM,CAAC,2BAA2B,CAAC,CAAC;KAClD;AAED,IAAA,MAAM,QAAQ,CAAC,SAAiB,EAAE,WAAmB,EAAA;AACnD,QAAA,OAAO,MAAMA,CAAM,CAAC,+BAA+B,EAAE;AACnD,YAAA,OAAO,EAAE,KAAK;YACd,SAAS;YACT,WAAW;AACZ,SAAA,CAAC,CAAC;KACJ;IAED,MAAM,kBAAkB,CACtB,SAAiB,EACjB,WAAmB,EACnB,YAAoB,EACpB,UAAkB,EAAA;AAElB,QAAA,OAAO,MAAMA,CAAM,CAAC,0CAA0C,EAAE;YAC9D,SAAS;YACT,WAAW;YACX,YAAY;YACZ,UAAU;AACX,SAAA,CAAC,CAAC;KACJ;AAED,IAAA,MAAM,IAAI,CACR,SAAiB,EACjB,WAAmB,EACnB,SAAiB,EAAA;AAEjB,QAAA,OAAO,MAAMA,CAAM,CAAC,2BAA2B,EAAE;AAC/C,YAAA,OAAO,EAAE,KAAK;YACd,SAAS;YACT,WAAW;YACX,SAAS;AACV,SAAA,CAAC,CAAC;KACJ;AAED,IAAA,MAAM,eAAe,CACnB,SAAiB,EACjB,WAAmB,EACnB,QAAgB,EAChB,UAAkB,EAClB,SAAiB,EACjB,MAAc,EAAA;AAEd,QAAA,OAAO,MAAMA,CAAM,CAAC,uCAAuC,EAAE;YAC3D,SAAS;YACT,WAAW;YACX,QAAQ;YACR,UAAU;YACV,SAAS;YACT,MAAM;AACP,SAAA,CAAC,CAAC;KACJ;AACF;;;;"}
|
||||
-43
@@ -1,43 +0,0 @@
|
||||
import { invoke } from '@tauri-apps/api/tauri';
|
||||
|
||||
class Authenticator {
|
||||
async init() {
|
||||
return await invoke("plugin:authenticator|init");
|
||||
}
|
||||
async register(challenge, application) {
|
||||
return await invoke("plugin:authenticator|register", {
|
||||
timeout: 10000,
|
||||
challenge,
|
||||
application,
|
||||
});
|
||||
}
|
||||
async verifyRegistration(challenge, application, registerData, clientData) {
|
||||
return await invoke("plugin:authenticator|verify_registration", {
|
||||
challenge,
|
||||
application,
|
||||
registerData,
|
||||
clientData,
|
||||
});
|
||||
}
|
||||
async sign(challenge, application, keyHandle) {
|
||||
return await invoke("plugin:authenticator|sign", {
|
||||
timeout: 10000,
|
||||
challenge,
|
||||
application,
|
||||
keyHandle,
|
||||
});
|
||||
}
|
||||
async verifySignature(challenge, application, signData, clientData, keyHandle, pubkey) {
|
||||
return await invoke("plugin:authenticator|verify_signature", {
|
||||
challenge,
|
||||
application,
|
||||
signData,
|
||||
clientData,
|
||||
keyHandle,
|
||||
pubkey,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export { Authenticator };
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;MAEa,aAAa,CAAA;AACxB,IAAA,MAAM,IAAI,GAAA;AACR,QAAA,OAAO,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC;KAClD;AAED,IAAA,MAAM,QAAQ,CAAC,SAAiB,EAAE,WAAmB,EAAA;AACnD,QAAA,OAAO,MAAM,MAAM,CAAC,+BAA+B,EAAE;AACnD,YAAA,OAAO,EAAE,KAAK;YACd,SAAS;YACT,WAAW;AACZ,SAAA,CAAC,CAAC;KACJ;IAED,MAAM,kBAAkB,CACtB,SAAiB,EACjB,WAAmB,EACnB,YAAoB,EACpB,UAAkB,EAAA;AAElB,QAAA,OAAO,MAAM,MAAM,CAAC,0CAA0C,EAAE;YAC9D,SAAS;YACT,WAAW;YACX,YAAY;YACZ,UAAU;AACX,SAAA,CAAC,CAAC;KACJ;AAED,IAAA,MAAM,IAAI,CACR,SAAiB,EACjB,WAAmB,EACnB,SAAiB,EAAA;AAEjB,QAAA,OAAO,MAAM,MAAM,CAAC,2BAA2B,EAAE;AAC/C,YAAA,OAAO,EAAE,KAAK;YACd,SAAS;YACT,WAAW;YACX,SAAS;AACV,SAAA,CAAC,CAAC;KACJ;AAED,IAAA,MAAM,eAAe,CACnB,SAAiB,EACjB,WAAmB,EACnB,QAAgB,EAChB,UAAkB,EAClB,SAAiB,EACjB,MAAc,EAAA;AAEd,QAAA,OAAO,MAAM,MAAM,CAAC,uCAAuC,EAAE;YAC3D,SAAS;YACT,WAAW;YACX,QAAQ;YACR,UAAU;YACV,SAAS;YACT,MAAM;AACP,SAAA,CAAC,CAAC;KACJ;AACF;;;;"}
|
||||
@@ -1 +0,0 @@
|
||||
../../../shared/tsconfig.json
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "tauri-plugin-authenticator-api",
|
||||
"version": "0.0.0",
|
||||
"license": "MIT or APACHE-2.0",
|
||||
"authors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"type": "module",
|
||||
"browser": "guest-js/dist/index.min.js",
|
||||
"module": "guest-js/dist/index.mjs",
|
||||
"types": "guest-js/dist/index.d.ts",
|
||||
"exports": {
|
||||
"import": "./guest-js/dist/index.mjs",
|
||||
"types": "./guest-js/dist/index.d.ts",
|
||||
"browser": "./guest-js/dist/index.min.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup -c"
|
||||
},
|
||||
"files": [
|
||||
"guest-js/dist",
|
||||
"!guest-js/dist/**/*.map",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
"devDependencies": {
|
||||
"tslib": "^2.4.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^1.2.0"
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -1,8 +1,9 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
import { createConfig } from "../../../shared/rollup.config.mjs";
|
||||
import { createConfig } from "../../shared/rollup.config.mjs";
|
||||
|
||||
export default createConfig({
|
||||
input: "guest-js/index.ts",
|
||||
pkg: JSON.parse(
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8")
|
||||
),
|
||||
@@ -75,8 +75,8 @@ pub fn register(application: String, timeout: u64, challenge: String) -> crate::
|
||||
|
||||
let (key_handle, public_key) =
|
||||
_u2f_get_key_handle_and_public_key_from_register_response(®ister_data).unwrap();
|
||||
let key_handle_base64 = encode_config(&key_handle, URL_SAFE_NO_PAD);
|
||||
let public_key_base64 = encode_config(&public_key, URL_SAFE_NO_PAD);
|
||||
let key_handle_base64 = encode_config(key_handle, URL_SAFE_NO_PAD);
|
||||
let public_key_base64 = encode_config(public_key, URL_SAFE_NO_PAD);
|
||||
let register_data_base64 = encode_config(®ister_data, URL_SAFE_NO_PAD);
|
||||
println!("Key Handle: {}", &key_handle_base64);
|
||||
println!("Public Key: {}", &public_key_base64);
|
||||
@@ -108,7 +108,7 @@ pub fn sign(
|
||||
challenge: String,
|
||||
key_handle: String,
|
||||
) -> crate::Result<String> {
|
||||
let credential = match decode_config(&key_handle, URL_SAFE_NO_PAD) {
|
||||
let credential = match decode_config(key_handle, URL_SAFE_NO_PAD) {
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
return Err(e.into());
|
||||
@@ -152,7 +152,7 @@ pub fn sign(
|
||||
|
||||
let (_, handle_used, sign_data, device_info) = sign_result.unwrap();
|
||||
|
||||
let sig = encode_config(&sign_data, URL_SAFE_NO_PAD);
|
||||
let sig = encode_config(sign_data, URL_SAFE_NO_PAD);
|
||||
|
||||
println!("Sign result: {}", sig);
|
||||
println!(
|
||||
|
||||
@@ -15,7 +15,7 @@ static VERSION: &str = "U2F_V2";
|
||||
pub fn make_challenge(app_id: &str, challenge_bytes: Vec<u8>) -> Challenge {
|
||||
let utc: DateTime<Utc> = Utc::now();
|
||||
Challenge {
|
||||
challenge: encode_config(&challenge_bytes, URL_SAFE_NO_PAD),
|
||||
challenge: encode_config(challenge_bytes, URL_SAFE_NO_PAD),
|
||||
timestamp: format!("{:?}", utc),
|
||||
app_id: app_id.to_string(),
|
||||
}
|
||||
@@ -35,10 +35,10 @@ pub fn verify_registration(
|
||||
register_data: String,
|
||||
client_data: String,
|
||||
) -> crate::Result<String> {
|
||||
let challenge_bytes = decode_config(&challenge, URL_SAFE_NO_PAD)?;
|
||||
let challenge_bytes = decode_config(challenge, URL_SAFE_NO_PAD)?;
|
||||
let challenge = make_challenge(&app_id, challenge_bytes);
|
||||
let client_data_bytes: Vec<u8> = client_data.as_bytes().into();
|
||||
let client_data_base64 = encode_config(&client_data_bytes, URL_SAFE_NO_PAD);
|
||||
let client_data_base64 = encode_config(client_data_bytes, URL_SAFE_NO_PAD);
|
||||
let client = U2f::new(app_id);
|
||||
match client.register_response(
|
||||
challenge,
|
||||
@@ -74,12 +74,12 @@ pub fn verify_signature(
|
||||
key_handle: String,
|
||||
pub_key: String,
|
||||
) -> crate::Result<u32> {
|
||||
let challenge_bytes = decode_config(&challenge, URL_SAFE_NO_PAD)?;
|
||||
let challenge_bytes = decode_config(challenge, URL_SAFE_NO_PAD)?;
|
||||
let chal = make_challenge(&app_id, challenge_bytes);
|
||||
let client_data_bytes: Vec<u8> = client_data.as_bytes().into();
|
||||
let client_data_base64 = encode_config(&client_data_bytes, URL_SAFE_NO_PAD);
|
||||
let client_data_base64 = encode_config(client_data_bytes, URL_SAFE_NO_PAD);
|
||||
let key_handle_bytes = decode_config(&key_handle, URL_SAFE_NO_PAD)?;
|
||||
let pubkey_bytes = decode_config(&pub_key, URL_SAFE_NO_PAD)?;
|
||||
let pubkey_bytes = decode_config(pub_key, URL_SAFE_NO_PAD)?;
|
||||
let client = U2f::new(app_id);
|
||||
let mut _counter: u32 = 0;
|
||||
match client.sign_response(
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../shared/tsconfig.json
|
||||
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
@@ -1,17 +1,59 @@
|
||||

|
||||
|
||||
<!-- description -->
|
||||
Automatically launch your application at startup. Supports Windows, Mac (via AppleScript or Launch Agent), and Linux.
|
||||
|
||||
## Install
|
||||
|
||||
There are three general methods of installation that we can recommend.
|
||||
|
||||
1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked)
|
||||
2. Pull sources directly from Github using git tags / revision hashes (most secure)
|
||||
3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use)
|
||||
|
||||
Install the Core plugin by adding the following to your `Cargo.toml` file:
|
||||
|
||||
`src-tauri/Cargo.toml`
|
||||
```toml
|
||||
[dependencies]
|
||||
tauri-plugin-autostart = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
||||
```
|
||||
|
||||
You can install the JavaScript Guest bindings using your preferred JavaScript package manager:
|
||||
|
||||
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
|
||||
|
||||
```sh
|
||||
pnpm add https://github.com/tauri-apps/tauri-plugin-autostart
|
||||
# or
|
||||
npm add https://github.com/tauri-apps/tauri-plugin-autostart
|
||||
# or
|
||||
yarn add https://github.com/tauri-apps/tauri-plugin-autostart
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
First you need to register the core plugin with Tauri:
|
||||
|
||||
`src-tauri/src/main.rs`
|
||||
```rust
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_autostart::init(MacosLauncher::LaunchAgent, Some(vec!["--flag1", "--flag2"]) /* arbitrary number of args to pass to your app */))
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
```
|
||||
|
||||
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
|
||||
|
||||
```javascript
|
||||
import { enable, isEnabled, disable } from 'tauri-plugin-autostart-api'
|
||||
|
||||
await enable()
|
||||
|
||||
console.log(`registered for autostart? ${await isEnabled()}`)
|
||||
|
||||
disable()
|
||||
```
|
||||
|
||||
## Contributing
|
||||
@@ -20,6 +62,6 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu
|
||||
|
||||
## License
|
||||
|
||||
Code: (c) 2015 - 2021 - The Tauri Programme within The Commons Conservancy.
|
||||
Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
|
||||
|
||||
MIT or MIT/Apache 2.0 where applicable.
|
||||
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
export declare function isEnabled(): Promise<boolean>;
|
||||
export declare function enable(): Promise<void>;
|
||||
export declare function disable(): Promise<void>;
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0});};
|
||||
|
||||
var f={};e(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`);},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`);},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r});})}function w(e,r="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}
|
||||
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
async function isEnabled() {
|
||||
return await c("plugin:autostart|is_enabled");
|
||||
}
|
||||
async function enable() {
|
||||
await c("plugin:autostart|enable");
|
||||
}
|
||||
async function disable() {
|
||||
await c("plugin:autostart|disable");
|
||||
}
|
||||
|
||||
export { disable, enable, isEnabled };
|
||||
//# sourceMappingURL=index.min.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.min.js","sources":["../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-FEIY7W7S.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-RCPA6UVN.js","../index.ts"],"sourcesContent":["var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0})};export{e as a};\n","import{a as d}from\"./chunk-FEIY7W7S.js\";var f={};d(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`)},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`)},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r})})}function w(e,r=\"asset\"){let n=encodeURIComponent(e);return navigator.userAgent.includes(\"Windows\")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}export{s as a,c as b,w as c,f as d};\n",null],"names":["d","invoke"],"mappings":"AAAA,IAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC;;ACAjD,IAAI,CAAC,CAAC,EAAE,CAACA,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAA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AQ,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;;ACAtuB;AAMO,eAAe,SAAS,GAAA;AAC7B,IAAA,OAAO,MAAMC,CAAM,CAAC,6BAA6B,CAAC,CAAC;AACrD,CAAC;AAEM,eAAe,MAAM,GAAA;AAC1B,IAAA,MAAMA,CAAM,CAAC,yBAAyB,CAAC,CAAC;AAC1C,CAAC;AAEM,eAAe,OAAO,GAAA;AAC3B,IAAA,MAAMA,CAAM,CAAC,0BAA0B,CAAC,CAAC;AAC3C;;;;"}
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
import { invoke } from '@tauri-apps/api/tauri';
|
||||
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
async function isEnabled() {
|
||||
return await invoke("plugin:autostart|is_enabled");
|
||||
}
|
||||
async function enable() {
|
||||
await invoke("plugin:autostart|enable");
|
||||
}
|
||||
async function disable() {
|
||||
await invoke("plugin:autostart|disable");
|
||||
}
|
||||
|
||||
export { disable, enable, isEnabled };
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AAMO,eAAe,SAAS,GAAA;AAC7B,IAAA,OAAO,MAAM,MAAM,CAAC,6BAA6B,CAAC,CAAC;AACrD,CAAC;AAEM,eAAe,MAAM,GAAA;AAC1B,IAAA,MAAM,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAC1C,CAAC;AAEM,eAAe,OAAO,GAAA;AAC3B,IAAA,MAAM,MAAM,CAAC,0BAA0B,CAAC,CAAC;AAC3C;;;;"}
|
||||
@@ -1 +0,0 @@
|
||||
../../../shared/tsconfig.json
|
||||
@@ -6,20 +6,20 @@
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"type": "module",
|
||||
"browser": "dist/index.min.js",
|
||||
"module": "dist/index.mjs",
|
||||
"types": "dist/index.d.ts",
|
||||
"browser": "guest-js/dist/index.min.js",
|
||||
"module": "guest-js/dist/index.mjs",
|
||||
"types": "guest-js/dist/index.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"browser": "./dist/index.min.js"
|
||||
"import": "./guest-js/dist/index.mjs",
|
||||
"types": "./guest-js/dist/index.d.ts",
|
||||
"browser": "./guest-js/dist/index.min.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup -c"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"!dist/**/*.map",
|
||||
"guest-js/dist",
|
||||
"!guest-js/dist/**/*.map",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
@@ -1,8 +1,9 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
import { createConfig } from "../../../shared/rollup.config.mjs";
|
||||
import { createConfig } from "../../shared/rollup.config.mjs";
|
||||
|
||||
export default createConfig({
|
||||
input: "guest-js/index.ts",
|
||||
pkg: JSON.parse(
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8")
|
||||
),
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../shared/tsconfig.json
|
||||
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
@@ -1,17 +1,53 @@
|
||||

|
||||
|
||||
<!-- description -->
|
||||
|
||||
## Install
|
||||
|
||||
There are three general methods of installation that we can recommend.
|
||||
|
||||
1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked)
|
||||
2. Pull sources directly from Github using git tags / revision hashes (most secure)
|
||||
3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use)
|
||||
|
||||
Install the Core plugin by adding the following to your `Cargo.toml` file:
|
||||
|
||||
`src-tauri/Cargo.toml`
|
||||
```toml
|
||||
[dependencies]
|
||||
tauri-plugin-fs-extra = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
||||
```
|
||||
|
||||
You can install the JavaScript Guest bindings using your preferred JavaScript package manager:
|
||||
|
||||
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
|
||||
|
||||
```sh
|
||||
pnpm add https://github.com/tauri-apps/tauri-plugin-fs-extra
|
||||
# or
|
||||
npm add https://github.com/tauri-apps/tauri-plugin-fs-extra
|
||||
# or
|
||||
yarn add https://github.com/tauri-apps/tauri-plugin-fs-extra
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
First you need to register the core plugin with Tauri:
|
||||
|
||||
`src-tauri/src/main.rs`
|
||||
```rust
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_fs_extra::init())
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
```
|
||||
|
||||
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
|
||||
|
||||
```javascript
|
||||
import { metadata } from 'tauri-plugin-fs-extra-api'
|
||||
|
||||
await metadata('/path/to/file')
|
||||
```
|
||||
|
||||
## Contributing
|
||||
@@ -20,6 +56,6 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu
|
||||
|
||||
## License
|
||||
|
||||
Code: (c) 2015 - 2021 - The Tauri Programme within The Commons Conservancy.
|
||||
Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
|
||||
|
||||
MIT or MIT/Apache 2.0 where applicable.
|
||||
MIT or MIT/Apache 2.0 where applicable.
|
||||
-87
@@ -1,87 +0,0 @@
|
||||
export interface Permissions {
|
||||
/**
|
||||
* `true` if these permissions describe a readonly (unwritable) file.
|
||||
*/
|
||||
readonly: boolean;
|
||||
/**
|
||||
* The underlying raw `st_mode` bits that contain the standard Unix permissions for this file.
|
||||
*/
|
||||
mode: number | undefined;
|
||||
}
|
||||
/**
|
||||
* Metadata information about a file.
|
||||
* This structure is returned from the `metadata` function or method
|
||||
* and represents known metadata about a file such as its permissions, size, modification times, etc.
|
||||
*/
|
||||
export interface Metadata {
|
||||
/**
|
||||
* The last access time of this metadata.
|
||||
*/
|
||||
accessedAt: Date;
|
||||
/**
|
||||
* The creation time listed in this metadata.
|
||||
*/
|
||||
createdAt: Date;
|
||||
/**
|
||||
* The last modification time listed in this metadata.
|
||||
*/
|
||||
modifiedAt: Date;
|
||||
/**
|
||||
* `true` if this metadata is for a directory.
|
||||
*/
|
||||
isDir: boolean;
|
||||
/**
|
||||
* `true` if this metadata is for a regular file.
|
||||
*/
|
||||
isFile: boolean;
|
||||
/**
|
||||
* `true` if this metadata is for a symbolic link.
|
||||
*/
|
||||
isSymlink: boolean;
|
||||
/**
|
||||
* The size of the file, in bytes, this metadata is for.
|
||||
*/
|
||||
size: number;
|
||||
/**
|
||||
* The permissions of the file this metadata is for.
|
||||
*/
|
||||
permissions: Permissions;
|
||||
/**
|
||||
* The ID of the device containing the file. Only available on Unix.
|
||||
*/
|
||||
dev: number | undefined;
|
||||
/**
|
||||
* The inode number. Only available on Unix.
|
||||
*/
|
||||
ino: number | undefined;
|
||||
/**
|
||||
* The rights applied to this file. Only available on Unix.
|
||||
*/
|
||||
mode: number | undefined;
|
||||
/**
|
||||
* The number of hard links pointing to this file. Only available on Unix.
|
||||
*/
|
||||
nlink: number | undefined;
|
||||
/**
|
||||
* The user ID of the owner of this file. Only available on Unix.
|
||||
*/
|
||||
uid: number | undefined;
|
||||
/**
|
||||
* The group ID of the owner of this file. Only available on Unix.
|
||||
*/
|
||||
gid: number | undefined;
|
||||
/**
|
||||
* The device ID of this file (if it is a special one). Only available on Unix.
|
||||
*/
|
||||
rdev: number | undefined;
|
||||
/**
|
||||
* The block size for filesystem I/O. Only available on Unix.
|
||||
*/
|
||||
blksize: number | undefined;
|
||||
/**
|
||||
* The number of blocks allocated to the file, in 512-byte units. Only available on Unix.
|
||||
*/
|
||||
blocks: number | undefined;
|
||||
}
|
||||
export declare function metadata(path: string): Promise<Metadata>;
|
||||
export declare function exists(path: string): Promise<boolean>;
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0});};
|
||||
|
||||
var f={};e(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`);},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`);},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r});})}function w(e,r="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}
|
||||
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
async function metadata(path) {
|
||||
return await c("plugin:fs-extra|metadata", {
|
||||
path,
|
||||
}).then((metadata) => {
|
||||
const { accessedAtMs, createdAtMs, modifiedAtMs, ...data } = metadata;
|
||||
return {
|
||||
accessedAt: new Date(accessedAtMs),
|
||||
createdAt: new Date(createdAtMs),
|
||||
modifiedAt: new Date(modifiedAtMs),
|
||||
...data,
|
||||
};
|
||||
});
|
||||
}
|
||||
async function exists(path) {
|
||||
return await c("plugin:fs-extra|exists", { path });
|
||||
}
|
||||
|
||||
export { exists, metadata };
|
||||
//# sourceMappingURL=index.min.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.min.js","sources":["../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-FEIY7W7S.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-RCPA6UVN.js","../index.ts"],"sourcesContent":["var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0})};export{e as a};\n","import{a as d}from\"./chunk-FEIY7W7S.js\";var f={};d(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`)},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`)},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r})})}function w(e,r=\"asset\"){let n=encodeURIComponent(e);return navigator.userAgent.includes(\"Windows\")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}export{s as a,c as b,w as c,f as d};\n",null],"names":["d","invoke"],"mappings":"AAAA,IAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC;;ACAjD,IAAI,CAAC,CAAC,EAAE,CAACA,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CA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AAQ,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;;ACAtuB;AAiHO,eAAe,QAAQ,CAAC,IAAY,EAAA;AACzC,IAAA,OAAO,MAAMC,CAAM,CAAkB,0BAA0B,EAAE;QAC/D,IAAI;AACL,KAAA,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,KAAI;AACnB,QAAA,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,CAAC;QACtE,OAAO;AACL,YAAA,UAAU,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC;AAClC,YAAA,SAAS,EAAE,IAAI,IAAI,CAAC,WAAW,CAAC;AAChC,YAAA,UAAU,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC;AAClC,YAAA,GAAG,IAAI;SACR,CAAC;AACJ,KAAC,CAAC,CAAC;AACL,CAAC;AAEM,eAAe,MAAM,CAAC,IAAY,EAAA;IACvC,OAAO,MAAMA,CAAM,CAAC,wBAAwB,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1D;;;;"}
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
import { invoke } from '@tauri-apps/api/tauri';
|
||||
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
async function metadata(path) {
|
||||
return await invoke("plugin:fs-extra|metadata", {
|
||||
path,
|
||||
}).then((metadata) => {
|
||||
const { accessedAtMs, createdAtMs, modifiedAtMs, ...data } = metadata;
|
||||
return {
|
||||
accessedAt: new Date(accessedAtMs),
|
||||
createdAt: new Date(createdAtMs),
|
||||
modifiedAt: new Date(modifiedAtMs),
|
||||
...data,
|
||||
};
|
||||
});
|
||||
}
|
||||
async function exists(path) {
|
||||
return await invoke("plugin:fs-extra|exists", { path });
|
||||
}
|
||||
|
||||
export { exists, metadata };
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AAiHO,eAAe,QAAQ,CAAC,IAAY,EAAA;AACzC,IAAA,OAAO,MAAM,MAAM,CAAkB,0BAA0B,EAAE;QAC/D,IAAI;AACL,KAAA,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,KAAI;AACnB,QAAA,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,CAAC;QACtE,OAAO;AACL,YAAA,UAAU,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC;AAClC,YAAA,SAAS,EAAE,IAAI,IAAI,CAAC,WAAW,CAAC;AAChC,YAAA,UAAU,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC;AAClC,YAAA,GAAG,IAAI;SACR,CAAC;AACJ,KAAC,CAAC,CAAC;AACL,CAAC;AAEM,eAAe,MAAM,CAAC,IAAY,EAAA;IACvC,OAAO,MAAM,MAAM,CAAC,wBAAwB,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1D;;;;"}
|
||||
@@ -1 +0,0 @@
|
||||
../../../shared/tsconfig.json
|
||||
@@ -6,13 +6,13 @@
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"type": "module",
|
||||
"browser": "dist/index.min.js",
|
||||
"module": "dist/index.mjs",
|
||||
"types": "dist/index.d.ts",
|
||||
"browser": "guest-js/dist/index.min.js",
|
||||
"module": "guest-js/dist/index.mjs",
|
||||
"types": "guest-js/dist/index.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"browser": "./dist/index.min.js"
|
||||
"import": "./guest-js/dist/index.mjs",
|
||||
"types": "./guest-js/dist/index.d.ts",
|
||||
"browser": "./guest-js/dist/index.min.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup -c"
|
||||
@@ -1,8 +1,9 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
import { createConfig } from "../../../shared/rollup.config.mjs";
|
||||
import { createConfig } from "../../shared/rollup.config.mjs";
|
||||
|
||||
export default createConfig({
|
||||
input: "guest-js/index.ts",
|
||||
pkg: JSON.parse(
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8")
|
||||
),
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../shared/tsconfig.json
|
||||
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
@@ -1,17 +1,62 @@
|
||||

|
||||
|
||||
<!-- description -->
|
||||
Watch changes on files and directories through [notify](https://github.com/notify-rs/notify).
|
||||
|
||||
## Install
|
||||
|
||||
There are three general methods of installation that we can recommend.
|
||||
|
||||
1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked)
|
||||
2. Pull sources directly from Github using git tags / revision hashes (most secure)
|
||||
3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use)
|
||||
|
||||
Install the Core plugin by adding the following to your `Cargo.toml` file:
|
||||
|
||||
`src-tauri/Cargo.toml`
|
||||
```toml
|
||||
[dependencies]
|
||||
tauri-plugin-fs-watch = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
||||
```
|
||||
|
||||
You can install the JavaScript Guest bindings using your preferred JavaScript package manager:
|
||||
|
||||
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
|
||||
|
||||
```sh
|
||||
pnpm add https://github.com/tauri-apps/tauri-plugin-fs-watch
|
||||
# or
|
||||
npm add https://github.com/tauri-apps/tauri-plugin-fs-watch
|
||||
# or
|
||||
yarn add https://github.com/tauri-apps/tauri-plugin-fs-watch
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
First you need to register the core plugin with Tauri:
|
||||
|
||||
`src-tauri/src/main.rs`
|
||||
```rust
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_fs_watch::init())
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
```
|
||||
|
||||
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
|
||||
|
||||
```javascript
|
||||
import { watch, watchImmediate } from 'tauri-plugin-fs-watch-api'
|
||||
|
||||
// can also watch an array of paths
|
||||
const stopWatching = await watch('/path/to/something', { recursive: true }, event => {
|
||||
const { type, payload } = event
|
||||
})
|
||||
|
||||
const stopRawWatcher = await watchImmediate(['/path/a', '/path/b'], {}, event => {
|
||||
const { path, operation, cookie } = event
|
||||
})
|
||||
```
|
||||
|
||||
## Contributing
|
||||
@@ -20,6 +65,6 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu
|
||||
|
||||
## License
|
||||
|
||||
Code: (c) 2015 - 2021 - The Tauri Programme within The Commons Conservancy.
|
||||
Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
|
||||
|
||||
MIT or MIT/Apache 2.0 where applicable.
|
||||
|
||||
-45
@@ -1,45 +0,0 @@
|
||||
import { UnlistenFn } from "@tauri-apps/api/event";
|
||||
export interface WatchOptions {
|
||||
recursive?: boolean;
|
||||
}
|
||||
export interface DebouncedWatchOptions extends WatchOptions {
|
||||
delayMs?: number;
|
||||
}
|
||||
export interface RawEvent {
|
||||
path: string | null;
|
||||
operation: number;
|
||||
cookie: number | null;
|
||||
}
|
||||
export type DebouncedEvent = {
|
||||
type: "NoticeWrite";
|
||||
payload: string;
|
||||
} | {
|
||||
type: "NoticeRemove";
|
||||
payload: string;
|
||||
} | {
|
||||
type: "Create";
|
||||
payload: string;
|
||||
} | {
|
||||
type: "Write";
|
||||
payload: string;
|
||||
} | {
|
||||
type: "Chmod";
|
||||
payload: string;
|
||||
} | {
|
||||
type: "Remove";
|
||||
payload: string;
|
||||
} | {
|
||||
type: "Rename";
|
||||
payload: string;
|
||||
} | {
|
||||
type: "Rescan";
|
||||
payload: null;
|
||||
} | {
|
||||
type: "Error";
|
||||
payload: {
|
||||
error: string;
|
||||
path: string | null;
|
||||
};
|
||||
};
|
||||
export declare function watch(paths: string | string[], options: DebouncedWatchOptions, cb: (event: DebouncedEvent) => void): Promise<UnlistenFn>;
|
||||
export declare function watchImmediate(paths: string | string[], options: WatchOptions, cb: (event: RawEvent) => void): Promise<UnlistenFn>;
|
||||
-72
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-64
@@ -1,64 +0,0 @@
|
||||
import { invoke } from '@tauri-apps/api/tauri';
|
||||
import { appWindow } from '@tauri-apps/api/window';
|
||||
|
||||
const w = appWindow;
|
||||
async function unwatch(id) {
|
||||
await invoke("plugin:fs-watch|unwatch", { id });
|
||||
}
|
||||
async function watch(paths, options, cb) {
|
||||
const opts = {
|
||||
recursive: false,
|
||||
delayMs: 2000,
|
||||
...options,
|
||||
};
|
||||
let watchPaths;
|
||||
if (typeof paths === "string") {
|
||||
watchPaths = [paths];
|
||||
}
|
||||
else {
|
||||
watchPaths = paths;
|
||||
}
|
||||
const id = window.crypto.getRandomValues(new Uint32Array(1))[0];
|
||||
await invoke("plugin:fs-watch|watch", {
|
||||
id,
|
||||
paths: watchPaths,
|
||||
options: opts,
|
||||
});
|
||||
const unlisten = await w.listen(`watcher://debounced-event/${id}`, (event) => {
|
||||
cb(event.payload);
|
||||
});
|
||||
return () => {
|
||||
void unwatch(id);
|
||||
unlisten();
|
||||
};
|
||||
}
|
||||
async function watchImmediate(paths, options, cb) {
|
||||
const opts = {
|
||||
recursive: false,
|
||||
...options,
|
||||
delayMs: null,
|
||||
};
|
||||
let watchPaths;
|
||||
if (typeof paths === "string") {
|
||||
watchPaths = [paths];
|
||||
}
|
||||
else {
|
||||
watchPaths = paths;
|
||||
}
|
||||
const id = window.crypto.getRandomValues(new Uint32Array(1))[0];
|
||||
await invoke("plugin:fs-watch|watch", {
|
||||
id,
|
||||
paths: watchPaths,
|
||||
options: opts,
|
||||
});
|
||||
const unlisten = await w.listen(`watcher://raw-event/${id}`, (event) => {
|
||||
cb(event.payload);
|
||||
});
|
||||
return () => {
|
||||
void unwatch(id);
|
||||
unlisten();
|
||||
};
|
||||
}
|
||||
|
||||
export { watch, watchImmediate };
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAIA,MAAM,CAAC,GAAkB,SAAS,CAAC;AA2BnC,eAAe,OAAO,CAAC,EAAU,EAAA;IAC/B,MAAM,MAAM,CAAC,yBAAyB,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAClD,CAAC;AAEM,eAAe,KAAK,CACzB,KAAwB,EACxB,OAA8B,EAC9B,EAAmC,EAAA;AAEnC,IAAA,MAAM,IAAI,GAAG;AACX,QAAA,SAAS,EAAE,KAAK;AAChB,QAAA,OAAO,EAAE,IAAI;AACb,QAAA,GAAG,OAAO;KACX,CAAC;AACF,IAAA,IAAI,UAAU,CAAC;AACf,IAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AAC7B,QAAA,UAAU,GAAG,CAAC,KAAK,CAAC,CAAC;AACtB,KAAA;AAAM,SAAA;QACL,UAAU,GAAG,KAAK,CAAC;AACpB,KAAA;AAED,IAAA,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhE,MAAM,MAAM,CAAC,uBAAuB,EAAE;QACpC,EAAE;AACF,QAAA,KAAK,EAAE,UAAU;AACjB,QAAA,OAAO,EAAE,IAAI;AACd,KAAA,CAAC,CAAC;AAEH,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,MAAM,CAC7B,CAA6B,0BAAA,EAAA,EAAE,CAAE,CAAA,EACjC,CAAC,KAAK,KAAI;AACR,QAAA,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACpB,KAAC,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": "module",
|
||||
"browser": "dist/index.min.js",
|
||||
"module": "dist/index.mjs",
|
||||
"types": "dist/index.d.ts",
|
||||
"browser": "guest-js/dist/index.min.js",
|
||||
"module": "guest-js/dist/index.mjs",
|
||||
"types": "guest-js/dist/index.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"browser": "./dist/index.min.js"
|
||||
"import": "./guest-js/dist/index.mjs",
|
||||
"types": "./guest-js/dist/index.d.ts",
|
||||
"browser": "./guest-js/dist/index.min.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup -c"
|
||||
@@ -1,8 +1,9 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
import { createConfig } from "../../../shared/rollup.config.mjs";
|
||||
import { createConfig } from "../../shared/rollup.config.mjs";
|
||||
|
||||
export default createConfig({
|
||||
input: "guest-js/index.ts",
|
||||
pkg: JSON.parse(
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8")
|
||||
),
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../shared/tsconfig.json
|
||||
@@ -1,17 +1,55 @@
|
||||

|
||||
|
||||
<!-- description -->
|
||||
Expose your apps assets through a localhost server instead of the default custom protocol.
|
||||
|
||||
> Note: This plugins brings considerable security risks and you should only use it if you know what your are doing. If in doubt, use the default custom protocol implementation.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
There are three general methods of installation that we can recommend.
|
||||
|
||||
1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked)
|
||||
2. Pull sources directly from Github using git tags / revision hashes (most secure)
|
||||
3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use)
|
||||
|
||||
Install the Core plugin by adding the following to your `Cargo.toml` file:
|
||||
|
||||
`src-tauri/Cargo.toml`
|
||||
```toml
|
||||
[dependencies]
|
||||
tauri-plugin-localhost = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
||||
portpicker = "0.1" # used in the example to pick a random free port
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
First you need to register the core plugin with Tauri:
|
||||
|
||||
`src-tauri/src/main.rs`
|
||||
```rust
|
||||
use tauri::{utils::config::AppUrl, window::WindowBuilder, WindowUrl};
|
||||
|
||||
fn main() {
|
||||
let port = portpicker::pick_unused_port().expect("failed to find unused port");
|
||||
|
||||
let mut context = tauri::generate_context!();
|
||||
let url = format!("http://localhost:{}", port).parse().unwrap();
|
||||
let window_url = WindowUrl::External(url);
|
||||
// rewrite the config so the IPC is enabled on this URL
|
||||
context.config_mut().build.dist_dir = AppUrl::Url(window_url.clone());
|
||||
context.config_mut().build.dev_path = AppUrl::Url(window_url.clone());
|
||||
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_localhost::Builder::new(port).build())
|
||||
.setup(move |app| {
|
||||
WindowBuilder::new(app, "main".to_string(), window_url)
|
||||
.title("Localhost Example")
|
||||
.build()?;
|
||||
Ok(())
|
||||
})
|
||||
.run(context)
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
```
|
||||
|
||||
## Contributing
|
||||
@@ -20,6 +58,6 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu
|
||||
|
||||
## License
|
||||
|
||||
Code: (c) 2015 - 2021 - The Tauri Programme within The Commons Conservancy.
|
||||
Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
|
||||
|
||||
MIT or MIT/Apache 2.0 where applicable.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "log"
|
||||
name = "tauri-plugin-log"
|
||||
version = "0.1.0"
|
||||
edition.workspace = true
|
||||
authors.workspace = true
|
||||
|
||||
+63
-2
@@ -1,25 +1,86 @@
|
||||

|
||||
|
||||
<!-- description -->
|
||||
Configurable logging for your Tauri app.
|
||||
|
||||
## Install
|
||||
|
||||
There are three general methods of installation that we can recommend.
|
||||
|
||||
1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked)
|
||||
2. Pull sources directly from Github using git tags / revision hashes (most secure)
|
||||
3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use)
|
||||
|
||||
Install the Core plugin by adding the following to your `Cargo.toml` file:
|
||||
|
||||
`src-tauri/Cargo.toml`
|
||||
```toml
|
||||
[dependencies]
|
||||
tauri-plugin-log = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
||||
```
|
||||
|
||||
You can install the JavaScript Guest bindings using your preferred JavaScript package manager:
|
||||
|
||||
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
|
||||
|
||||
```sh
|
||||
pnpm add https://github.com/tauri-apps/tauri-plugin-log
|
||||
# or
|
||||
npm add https://github.com/tauri-apps/tauri-plugin-log
|
||||
# or
|
||||
yarn add https://github.com/tauri-apps/tauri-plugin-log
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
First you need to register the core plugin with Tauri:
|
||||
|
||||
`src-tauri/src/main.rs`
|
||||
```rust
|
||||
use tauri_plugin_log::{LogTarget};
|
||||
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_log::Builder::default().targets([
|
||||
LogTarget::LogDir,
|
||||
LogTarget::Stdout,
|
||||
LogTarget::Webview,
|
||||
]).build())
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
```
|
||||
|
||||
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
|
||||
|
||||
```javascript
|
||||
import { trace, info, error, attachConsole } from 'tauri-plugin-log-api'
|
||||
|
||||
// with LogTarget::Webview enabled this function will print logs to the browser console
|
||||
const detach = await attachConsole()
|
||||
|
||||
trace("Trace")
|
||||
info("Info")
|
||||
error("Error")
|
||||
|
||||
// detach the browser console from the log stream
|
||||
detach()
|
||||
```
|
||||
|
||||
To log from rust code, add the log crate to your `Cargo.toml`:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
log = "^0.4"
|
||||
```
|
||||
|
||||
Now, you can use the macros provided by the log crate to log messages from your backend. See the [docs](https://docs.rs/log/latest) for more details.
|
||||
|
||||
## Contributing
|
||||
|
||||
PRs accepted. Please make sure to read the Contributing Guide before making a pull request.
|
||||
|
||||
## License
|
||||
|
||||
Code: (c) 2015 - 2021 - The Tauri Programme within The Commons Conservancy.
|
||||
Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
|
||||
|
||||
MIT or MIT/Apache 2.0 where applicable.
|
||||
|
||||
Vendored
-87
@@ -1,87 +0,0 @@
|
||||
import { UnlistenFn } from "@tauri-apps/api/event";
|
||||
export type LogOptions = {
|
||||
file?: string;
|
||||
line?: number;
|
||||
} & Record<string, string | undefined>;
|
||||
/**
|
||||
* Logs a message at the error level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { error } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* const err_info = "No connection";
|
||||
* const port = 22;
|
||||
*
|
||||
* error(`Error: ${err_info} on port ${port}`);
|
||||
* ```
|
||||
*/
|
||||
export declare function error(message: string, options?: LogOptions): Promise<void>;
|
||||
/**
|
||||
* Logs a message at the warn level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { warn } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* const warn_description = "Invalid Input";
|
||||
*
|
||||
* warn(`Warning! {warn_description}!`);
|
||||
* ```
|
||||
*/
|
||||
export declare function warn(message: string, options?: LogOptions): Promise<void>;
|
||||
/**
|
||||
* Logs a message at the info level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { info } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* const conn_info = { port: 40, speed: 3.20 };
|
||||
*
|
||||
* info(`Connected to port {conn_info.port} at {conn_info.speed} Mb/s`);
|
||||
* ```
|
||||
*/
|
||||
export declare function info(message: string, options?: LogOptions): Promise<void>;
|
||||
/**
|
||||
* Logs a message at the debug level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { debug } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* const pos = { x: 3.234, y: -1.223 };
|
||||
*
|
||||
* debug(`New position: x: {pos.x}, y: {pos.y}`);
|
||||
* ```
|
||||
*/
|
||||
export declare function debug(message: string, options?: LogOptions): Promise<void>;
|
||||
/**
|
||||
* Logs a message at the trace level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { trace } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* let pos = { x: 3.234, y: -1.223 };
|
||||
*
|
||||
* trace(`Position is: x: {pos.x}, y: {pos.y}`);
|
||||
* ```
|
||||
*/
|
||||
export declare function trace(message: string, options?: LogOptions): Promise<void>;
|
||||
export declare function attachConsole(): Promise<UnlistenFn>;
|
||||
-180
@@ -1,180 +0,0 @@
|
||||
var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0});};
|
||||
|
||||
var f={};e(f,{convertFileSrc:()=>w,invoke:()=>c$1,transformCallback:()=>s$1});function u$1(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s$1(e,r=!1){let n=u$1(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c$1(e,r={}){return new Promise((n,t)=>{let o=s$1(i=>{n(i),Reflect.deleteProperty(window,`_${a}`);},!0),a=s$1(i=>{t(i),Reflect.deleteProperty(window,`_${o}`);},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r});})}function w(e,r="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}
|
||||
|
||||
async function a(i){return c$1("tauri",i)}
|
||||
|
||||
var W={};e(W,{TauriEvent:()=>c,emit:()=>D,listen:()=>E,once:()=>_});async function s(n,t){return a({__tauriModule:"Event",message:{cmd:"unlisten",event:n,eventId:t}})}async function m(n,t,i){await a({__tauriModule:"Event",message:{cmd:"emit",event:n,windowLabel:t,payload:i}});}async function o(n,t,i){return a({__tauriModule:"Event",message:{cmd:"listen",event:n,windowLabel:t,handler:s$1(i)}}).then(r=>async()=>s(n,r))}async function u(n,t,i){return o(n,t,r=>{i(r),s(n,r.id).catch(()=>{});})}var c=(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.CHECK_UPDATE="tauri://update",e.UPDATE_AVAILABLE="tauri://update-available",e.INSTALL_UPDATE="tauri://update-install",e.STATUS_UPDATE="tauri://update-status",e.DOWNLOAD_PROGRESS="tauri://update-download-progress",e))(c||{});async function E(n,t){return o(n,null,t)}async function _(n,t){return u(n,null,t)}async function D(n,t){return m(n,void 0,t)}
|
||||
|
||||
var LogLevel;
|
||||
(function (LogLevel) {
|
||||
/**
|
||||
* The "trace" level.
|
||||
*
|
||||
* Designates very low priority, often extremely verbose, information.
|
||||
*/
|
||||
LogLevel[LogLevel["Trace"] = 1] = "Trace";
|
||||
/**
|
||||
* The "debug" level.
|
||||
*
|
||||
* Designates lower priority information.
|
||||
*/
|
||||
LogLevel[LogLevel["Debug"] = 2] = "Debug";
|
||||
/**
|
||||
* The "info" level.
|
||||
*
|
||||
* Designates useful information.
|
||||
*/
|
||||
LogLevel[LogLevel["Info"] = 3] = "Info";
|
||||
/**
|
||||
* The "warn" level.
|
||||
*
|
||||
* Designates hazardous situations.
|
||||
*/
|
||||
LogLevel[LogLevel["Warn"] = 4] = "Warn";
|
||||
/**
|
||||
* The "error" level.
|
||||
*
|
||||
* Designates very serious errors.
|
||||
*/
|
||||
LogLevel[LogLevel["Error"] = 5] = "Error";
|
||||
})(LogLevel || (LogLevel = {}));
|
||||
async function log(level, message, options) {
|
||||
var _a, _b;
|
||||
const traces = (_a = new Error().stack) === null || _a === void 0 ? void 0 : _a.split("\n").map((line) => line.split("@"));
|
||||
const filtered = traces === null || traces === void 0 ? void 0 : traces.filter(([name, location]) => {
|
||||
return name.length > 0 && location !== "[native code]";
|
||||
});
|
||||
const { file, line, ...keyValues } = options !== null && options !== void 0 ? options : {};
|
||||
await c$1("plugin:log|log", {
|
||||
level,
|
||||
message,
|
||||
location: (_b = filtered === null || filtered === void 0 ? void 0 : filtered[0]) === null || _b === void 0 ? void 0 : _b.filter((v) => v.length > 0).join("@"),
|
||||
file,
|
||||
line,
|
||||
keyValues,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Logs a message at the error level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { error } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* const err_info = "No connection";
|
||||
* const port = 22;
|
||||
*
|
||||
* error(`Error: ${err_info} on port ${port}`);
|
||||
* ```
|
||||
*/
|
||||
async function error(message, options) {
|
||||
await log(LogLevel.Error, message, options);
|
||||
}
|
||||
/**
|
||||
* Logs a message at the warn level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { warn } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* const warn_description = "Invalid Input";
|
||||
*
|
||||
* warn(`Warning! {warn_description}!`);
|
||||
* ```
|
||||
*/
|
||||
async function warn(message, options) {
|
||||
await log(LogLevel.Warn, message, options);
|
||||
}
|
||||
/**
|
||||
* Logs a message at the info level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { info } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* const conn_info = { port: 40, speed: 3.20 };
|
||||
*
|
||||
* info(`Connected to port {conn_info.port} at {conn_info.speed} Mb/s`);
|
||||
* ```
|
||||
*/
|
||||
async function info(message, options) {
|
||||
await log(LogLevel.Info, message, options);
|
||||
}
|
||||
/**
|
||||
* Logs a message at the debug level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { debug } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* const pos = { x: 3.234, y: -1.223 };
|
||||
*
|
||||
* debug(`New position: x: {pos.x}, y: {pos.y}`);
|
||||
* ```
|
||||
*/
|
||||
async function debug(message, options) {
|
||||
await log(LogLevel.Debug, message, options);
|
||||
}
|
||||
/**
|
||||
* Logs a message at the trace level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { trace } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* let pos = { x: 3.234, y: -1.223 };
|
||||
*
|
||||
* trace(`Position is: x: {pos.x}, y: {pos.y}`);
|
||||
* ```
|
||||
*/
|
||||
async function trace(message, options) {
|
||||
await log(LogLevel.Trace, message, options);
|
||||
}
|
||||
async function attachConsole() {
|
||||
return await E("log://log", (event) => {
|
||||
const payload = event.payload;
|
||||
// Strip ANSI escape codes
|
||||
const message = payload.message.replace(
|
||||
// eslint-disable-next-line no-control-regex
|
||||
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, "");
|
||||
switch (payload.level) {
|
||||
case LogLevel.Trace:
|
||||
console.log(message);
|
||||
break;
|
||||
case LogLevel.Debug:
|
||||
console.debug(message);
|
||||
break;
|
||||
case LogLevel.Info:
|
||||
console.info(message);
|
||||
break;
|
||||
case LogLevel.Warn:
|
||||
console.warn(message);
|
||||
break;
|
||||
case LogLevel.Error:
|
||||
console.error(message);
|
||||
break;
|
||||
default:
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
throw new Error(`unknown log level ${payload.level}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export { attachConsole, debug, error, info, trace, warn };
|
||||
//# sourceMappingURL=index.min.js.map
|
||||
-1
File diff suppressed because one or more lines are too long
Vendored
-175
@@ -1,175 +0,0 @@
|
||||
import { invoke } from '@tauri-apps/api/tauri';
|
||||
import { listen } from '@tauri-apps/api/event';
|
||||
|
||||
var LogLevel;
|
||||
(function (LogLevel) {
|
||||
/**
|
||||
* The "trace" level.
|
||||
*
|
||||
* Designates very low priority, often extremely verbose, information.
|
||||
*/
|
||||
LogLevel[LogLevel["Trace"] = 1] = "Trace";
|
||||
/**
|
||||
* The "debug" level.
|
||||
*
|
||||
* Designates lower priority information.
|
||||
*/
|
||||
LogLevel[LogLevel["Debug"] = 2] = "Debug";
|
||||
/**
|
||||
* The "info" level.
|
||||
*
|
||||
* Designates useful information.
|
||||
*/
|
||||
LogLevel[LogLevel["Info"] = 3] = "Info";
|
||||
/**
|
||||
* The "warn" level.
|
||||
*
|
||||
* Designates hazardous situations.
|
||||
*/
|
||||
LogLevel[LogLevel["Warn"] = 4] = "Warn";
|
||||
/**
|
||||
* The "error" level.
|
||||
*
|
||||
* Designates very serious errors.
|
||||
*/
|
||||
LogLevel[LogLevel["Error"] = 5] = "Error";
|
||||
})(LogLevel || (LogLevel = {}));
|
||||
async function log(level, message, options) {
|
||||
var _a, _b;
|
||||
const traces = (_a = new Error().stack) === null || _a === void 0 ? void 0 : _a.split("\n").map((line) => line.split("@"));
|
||||
const filtered = traces === null || traces === void 0 ? void 0 : traces.filter(([name, location]) => {
|
||||
return name.length > 0 && location !== "[native code]";
|
||||
});
|
||||
const { file, line, ...keyValues } = options !== null && options !== void 0 ? options : {};
|
||||
await invoke("plugin:log|log", {
|
||||
level,
|
||||
message,
|
||||
location: (_b = filtered === null || filtered === void 0 ? void 0 : filtered[0]) === null || _b === void 0 ? void 0 : _b.filter((v) => v.length > 0).join("@"),
|
||||
file,
|
||||
line,
|
||||
keyValues,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Logs a message at the error level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { error } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* const err_info = "No connection";
|
||||
* const port = 22;
|
||||
*
|
||||
* error(`Error: ${err_info} on port ${port}`);
|
||||
* ```
|
||||
*/
|
||||
async function error(message, options) {
|
||||
await log(LogLevel.Error, message, options);
|
||||
}
|
||||
/**
|
||||
* Logs a message at the warn level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { warn } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* const warn_description = "Invalid Input";
|
||||
*
|
||||
* warn(`Warning! {warn_description}!`);
|
||||
* ```
|
||||
*/
|
||||
async function warn(message, options) {
|
||||
await log(LogLevel.Warn, message, options);
|
||||
}
|
||||
/**
|
||||
* Logs a message at the info level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { info } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* const conn_info = { port: 40, speed: 3.20 };
|
||||
*
|
||||
* info(`Connected to port {conn_info.port} at {conn_info.speed} Mb/s`);
|
||||
* ```
|
||||
*/
|
||||
async function info(message, options) {
|
||||
await log(LogLevel.Info, message, options);
|
||||
}
|
||||
/**
|
||||
* Logs a message at the debug level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { debug } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* const pos = { x: 3.234, y: -1.223 };
|
||||
*
|
||||
* debug(`New position: x: {pos.x}, y: {pos.y}`);
|
||||
* ```
|
||||
*/
|
||||
async function debug(message, options) {
|
||||
await log(LogLevel.Debug, message, options);
|
||||
}
|
||||
/**
|
||||
* Logs a message at the trace level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { trace } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* let pos = { x: 3.234, y: -1.223 };
|
||||
*
|
||||
* trace(`Position is: x: {pos.x}, y: {pos.y}`);
|
||||
* ```
|
||||
*/
|
||||
async function trace(message, options) {
|
||||
await log(LogLevel.Trace, message, options);
|
||||
}
|
||||
async function attachConsole() {
|
||||
return await listen("log://log", (event) => {
|
||||
const payload = event.payload;
|
||||
// Strip ANSI escape codes
|
||||
const message = payload.message.replace(
|
||||
// eslint-disable-next-line no-control-regex
|
||||
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, "");
|
||||
switch (payload.level) {
|
||||
case LogLevel.Trace:
|
||||
console.log(message);
|
||||
break;
|
||||
case LogLevel.Debug:
|
||||
console.debug(message);
|
||||
break;
|
||||
case LogLevel.Info:
|
||||
console.info(message);
|
||||
break;
|
||||
case LogLevel.Warn:
|
||||
console.warn(message);
|
||||
break;
|
||||
case LogLevel.Error:
|
||||
console.error(message);
|
||||
break;
|
||||
default:
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
throw new Error(`unknown log level ${payload.level}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export { attachConsole, debug, error, info, trace, warn };
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"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I,eAAe,KAAK,CACzB,OAAe,EACf,OAAoB,EAAA;IAEpB,MAAM,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;AAOM,eAAe,aAAa,GAAA;IACjC,OAAO,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC,KAAK,KAAI;AACzC,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,OAAwB,CAAC;;AAG/C,QAAA,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO;;QAErC,6EAA6E,EAC7E,EAAE,CACH,CAAC;QAEF,QAAQ,OAAO,CAAC,KAAK;YACnB,KAAK,QAAQ,CAAC,KAAK;AACjB,gBAAA,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACrB,MAAM;YACR,KAAK,QAAQ,CAAC,KAAK;AACjB,gBAAA,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACvB,MAAM;YACR,KAAK,QAAQ,CAAC,IAAI;AAChB,gBAAA,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACtB,MAAM;YACR,KAAK,QAAQ,CAAC,IAAI;AAChB,gBAAA,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACtB,MAAM;YACR,KAAK,QAAQ,CAAC,KAAK;AACjB,gBAAA,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACvB,MAAM;AACR,YAAA;;gBAEE,MAAM,IAAI,KAAK,CAAC,CAAA,kBAAA,EAAqB,OAAO,CAAC,KAAK,CAAE,CAAA,CAAC,CAAC;AACzD,SAAA;AACH,KAAC,CAAC,CAAC;AACL;;;;"}
|
||||
@@ -1,32 +0,0 @@
|
||||
{
|
||||
"name": "tauri-plugin-log",
|
||||
"version": "0.0.0",
|
||||
"license": "MIT or APACHE-2.0",
|
||||
"authors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"type": "module",
|
||||
"browser": "dist/index.min.js",
|
||||
"module": "dist/index.mjs",
|
||||
"types": "dist/index.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"browser": "./dist/index.min.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup -c"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"!dist/**/*.map",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
"devDependencies": {
|
||||
"tslib": "^2.4.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^1.2.0"
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
import { createConfig } from "../../../shared/rollup.config.mjs";
|
||||
|
||||
export default createConfig({
|
||||
pkg: JSON.parse(
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8")
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
@@ -1 +0,0 @@
|
||||
../../../shared/tsconfig.json
|
||||
@@ -1,18 +1,18 @@
|
||||
{
|
||||
"name": "tauri-plugin-authenticator-api",
|
||||
"name": "tauri-plugin-log-api",
|
||||
"version": "0.0.0",
|
||||
"license": "MIT or APACHE-2.0",
|
||||
"authors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"type": "module",
|
||||
"browser": "dist/index.min.js",
|
||||
"module": "dist/index.mjs",
|
||||
"types": "dist/index.d.ts",
|
||||
"browser": "guest-js/dist/index.min.js",
|
||||
"module": "guest-js/dist/index.mjs",
|
||||
"types": "guest-js/dist/index.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"browser": "./dist/index.min.js"
|
||||
"import": "./guest-js/dist/index.mjs",
|
||||
"types": "./guest-js/dist/index.d.ts",
|
||||
"browser": "./guest-js/dist/index.min.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup -c"
|
||||
@@ -0,0 +1,11 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
import { createConfig } from "../../shared/rollup.config.mjs";
|
||||
|
||||
export default createConfig({
|
||||
input: "guest-js/index.ts",
|
||||
pkg: JSON.parse(
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8")
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
@@ -142,14 +142,14 @@ fn log(
|
||||
logger().log(&builder.args(format_args!("{message}")).build());
|
||||
}
|
||||
|
||||
pub struct LoggerBuilder {
|
||||
pub struct Builder {
|
||||
dispatch: fern::Dispatch,
|
||||
rotation_strategy: RotationStrategy,
|
||||
max_file_size: u128,
|
||||
targets: Vec<LogTarget>,
|
||||
}
|
||||
|
||||
impl Default for LoggerBuilder {
|
||||
impl Default for Builder {
|
||||
fn default() -> Self {
|
||||
let format =
|
||||
time::format_description::parse("[[[year]-[month]-[day]][[[hour]:[minute]:[second]]")
|
||||
@@ -172,7 +172,7 @@ impl Default for LoggerBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
impl LoggerBuilder {
|
||||
impl Builder {
|
||||
pub fn new() -> Self {
|
||||
Default::default()
|
||||
}
|
||||
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../shared/tsconfig.json
|
||||
@@ -1,18 +1,38 @@
|
||||

|
||||
|
||||
<!-- description -->
|
||||
Save filesystem and asset scopes and restore them when the app is reopened.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
There are three general methods of installation that we can recommend.
|
||||
|
||||
1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked)
|
||||
2. Pull sources directly from Github using git tags / revision hashes (most secure)
|
||||
3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use)
|
||||
|
||||
Install the Core plugin by adding the following to your `Cargo.toml` file:
|
||||
|
||||
`src-tauri/Cargo.toml`
|
||||
```toml
|
||||
[dependencies]
|
||||
tauri-plugin-persisted-scope = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
First you need to register the core plugin with Tauri:
|
||||
|
||||
`src-tauri/src/main.rs`
|
||||
```rust
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_persisted_scope::init())
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
```
|
||||
|
||||
```
|
||||
Afterwards the plugin will automatically save and restore filesystem and asset scopes.
|
||||
|
||||
## Contributing
|
||||
|
||||
@@ -20,6 +40,6 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu
|
||||
|
||||
## License
|
||||
|
||||
Code: (c) 2015 - 2021 - The Tauri Programme within The Commons Conservancy.
|
||||
Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
|
||||
|
||||
MIT or MIT/Apache 2.0 where applicable.
|
||||
|
||||
@@ -56,13 +56,13 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
|
||||
.unwrap_or_default();
|
||||
for allowed in scope.allowed_paths {
|
||||
// allows the path as is
|
||||
let _ = fs_scope.allow_file(&allowed);
|
||||
let _ = fs_scope.allow_file(allowed);
|
||||
#[cfg(feature = "protocol-asset")]
|
||||
let _ = asset_protocol_scope.allow_file(allowed);
|
||||
}
|
||||
for forbidden in scope.forbidden_patterns {
|
||||
// forbid the path as is
|
||||
let _ = fs_scope.forbid_file(&forbidden);
|
||||
let _ = fs_scope.forbid_file(forbidden);
|
||||
#[cfg(feature = "protocol-asset")]
|
||||
let _ = asset_protocol_scope.forbid_file(forbidden);
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
@@ -1,17 +1,82 @@
|
||||

|
||||
|
||||
<!-- description -->
|
||||
Position your windows at well-known locations.
|
||||
|
||||
This plugin is a port of [electron-positioner](https://github.com/jenslind/electron-positioner) for Tauri.
|
||||
|
||||
## Install
|
||||
|
||||
There are three general methods of installation that we can recommend.
|
||||
|
||||
1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked)
|
||||
2. Pull sources directly from Github using git tags / revision hashes (most secure)
|
||||
3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use)
|
||||
|
||||
Install the Core plugin by adding the following to your `Cargo.toml` file:
|
||||
|
||||
`src-tauri/Cargo.toml`
|
||||
```toml
|
||||
[dependencies]
|
||||
tauri-plugin-positioner = "1.0"
|
||||
# or through git
|
||||
tauri-plugin-positioner = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
||||
```
|
||||
|
||||
You can install the JavaScript Guest bindings using your preferred JavaScript package manager:
|
||||
|
||||
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
|
||||
|
||||
```sh
|
||||
pnpm add tauri-plugin-positioner
|
||||
# or
|
||||
npm add tauri-plugin-positioner
|
||||
# or
|
||||
yarn add tauri-plugin-positioner
|
||||
```
|
||||
|
||||
Or through git:
|
||||
|
||||
```sh
|
||||
pnpm add https://github.com/tauri-apps/tauri-plugin-positioner
|
||||
# or
|
||||
npm add https://github.com/tauri-apps/tauri-plugin-positioner
|
||||
# or
|
||||
yarn add https://github.com/tauri-apps/tauri-plugin-positioner
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
First you need to register the core plugin with Tauri:
|
||||
|
||||
`src-tauri/src/main.rs`
|
||||
```rust
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_positioner::init())
|
||||
// This is required to get tray-relative positions to work
|
||||
.on_system_tray_event(|app, event| {
|
||||
tauri_plugin_positioner::on_tray_event(app, &event);
|
||||
})
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
```
|
||||
|
||||
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
|
||||
|
||||
```javascript
|
||||
import { move_window, Position } from 'tauri-plugin-positioner-api'
|
||||
|
||||
move_window(Position.TopRight)
|
||||
```
|
||||
|
||||
If you only intend on moving the window from rust code, you can import the Window trait extension instead of registering the plugin:
|
||||
|
||||
```rust
|
||||
use tauri_plugin_positioner::{WindowExt, Position};
|
||||
|
||||
let mut win = app.get_window("main").unwrap();
|
||||
let _ = win.move_window(Position::TopRight);
|
||||
```
|
||||
|
||||
## Contributing
|
||||
@@ -20,6 +85,7 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu
|
||||
|
||||
## License
|
||||
|
||||
Code: (c) 2015 - 2021 - The Tauri Programme within The Commons Conservancy.
|
||||
Code: (c) 2021 - Jonas Kruckenberg. 2021 - Present - The Tauri Programme within The Commons Conservancy.
|
||||
|
||||
MIT or MIT/Apache 2.0 where applicable.
|
||||
|
||||
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
/**
|
||||
* Well known window positions.
|
||||
*/
|
||||
export declare enum Position {
|
||||
TopLeft = 0,
|
||||
TopRight = 1,
|
||||
BottomLeft = 2,
|
||||
BottomRight = 3,
|
||||
TopCenter = 4,
|
||||
BottomCenter = 5,
|
||||
LeftCenter = 6,
|
||||
RightCenter = 7,
|
||||
Center = 8,
|
||||
TrayLeft = 9,
|
||||
TrayBottomLeft = 10,
|
||||
TrayRight = 11,
|
||||
TrayBottomRight = 12,
|
||||
TrayCenter = 13,
|
||||
TrayBottomCenter = 14
|
||||
}
|
||||
/**
|
||||
* Moves the `Window` to the given {@link Position} using `WindowExt.move_window()`
|
||||
* All positions are relative to the **current** screen.
|
||||
*
|
||||
* @param to The {@link Position} to move to.
|
||||
*/
|
||||
export declare function moveWindow(to: Position): Promise<void>;
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0});};
|
||||
|
||||
var f={};e(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`);},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`);},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r});})}function w(e,r="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}
|
||||
|
||||
// Copyright 2021 Jonas Kruckenberg
|
||||
/**
|
||||
* Well known window positions.
|
||||
*/
|
||||
var Position;
|
||||
(function (Position) {
|
||||
Position[Position["TopLeft"] = 0] = "TopLeft";
|
||||
Position[Position["TopRight"] = 1] = "TopRight";
|
||||
Position[Position["BottomLeft"] = 2] = "BottomLeft";
|
||||
Position[Position["BottomRight"] = 3] = "BottomRight";
|
||||
Position[Position["TopCenter"] = 4] = "TopCenter";
|
||||
Position[Position["BottomCenter"] = 5] = "BottomCenter";
|
||||
Position[Position["LeftCenter"] = 6] = "LeftCenter";
|
||||
Position[Position["RightCenter"] = 7] = "RightCenter";
|
||||
Position[Position["Center"] = 8] = "Center";
|
||||
Position[Position["TrayLeft"] = 9] = "TrayLeft";
|
||||
Position[Position["TrayBottomLeft"] = 10] = "TrayBottomLeft";
|
||||
Position[Position["TrayRight"] = 11] = "TrayRight";
|
||||
Position[Position["TrayBottomRight"] = 12] = "TrayBottomRight";
|
||||
Position[Position["TrayCenter"] = 13] = "TrayCenter";
|
||||
Position[Position["TrayBottomCenter"] = 14] = "TrayBottomCenter";
|
||||
})(Position || (Position = {}));
|
||||
/**
|
||||
* Moves the `Window` to the given {@link Position} using `WindowExt.move_window()`
|
||||
* All positions are relative to the **current** screen.
|
||||
*
|
||||
* @param to The {@link Position} to move to.
|
||||
*/
|
||||
async function moveWindow(to) {
|
||||
await c("plugin:positioner|move_window", {
|
||||
position: to,
|
||||
});
|
||||
}
|
||||
|
||||
export { Position, moveWindow };
|
||||
//# sourceMappingURL=index.min.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.min.js","sources":["../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-FEIY7W7S.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-RCPA6UVN.js","../index.ts"],"sourcesContent":["var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0})};export{e as a};\n","import{a as d}from\"./chunk-FEIY7W7S.js\";var f={};d(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`)},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`)},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r})})}function w(e,r=\"asset\"){let n=encodeURIComponent(e);return navigator.userAgent.includes(\"Windows\")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}export{s as a,c as b,w as c,f as d};\n",null],"names":["d","invoke"],"mappings":"AAAA,IAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC;;ACAjD,IAAI,CAAC,CAAC,EAAE,CAACA,CAAC,CAAC,CAAC,CAAC,C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ACN,IAAA,QAAA,CAAA,QAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAQ,CAAA;AACR,IAAA,QAAA,CAAA,QAAA,CAAA,gBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,gBAAc,CAAA;AACd,IAAA,QAAA,CAAA,QAAA,CAAA,WAAA,CAAA,GAAA,EAAA,CAAA,GAAA,WAAS,CAAA;AACT,IAAA,QAAA,CAAA,QAAA,CAAA,iBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,iBAAe,CAAA;AACf,IAAA,QAAA,CAAA,QAAA,CAAA,YAAA,CAAA,GAAA,EAAA,CAAA,GAAA,YAAU,CAAA;AACV,IAAA,QAAA,CAAA,QAAA,CAAA,kBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,kBAAgB,CAAA;AAClB,CAAC,EAhBW,QAAQ,KAAR,QAAQ,GAgBnB,EAAA,CAAA,CAAA,CAAA;AAED;;;;;AAKG;AACI,eAAe,UAAU,CAAC,EAAY,EAAA;IAC3C,MAAMC,CAAM,CAAC,+BAA+B,EAAE;AAC5C,QAAA,QAAQ,EAAE,EAAE;AACb,KAAA,CAAC,CAAC;AACL;;;;"}
|
||||
-38
@@ -1,38 +0,0 @@
|
||||
import { invoke } from '@tauri-apps/api/tauri';
|
||||
|
||||
// Copyright 2021 Jonas Kruckenberg
|
||||
/**
|
||||
* Well known window positions.
|
||||
*/
|
||||
var Position;
|
||||
(function (Position) {
|
||||
Position[Position["TopLeft"] = 0] = "TopLeft";
|
||||
Position[Position["TopRight"] = 1] = "TopRight";
|
||||
Position[Position["BottomLeft"] = 2] = "BottomLeft";
|
||||
Position[Position["BottomRight"] = 3] = "BottomRight";
|
||||
Position[Position["TopCenter"] = 4] = "TopCenter";
|
||||
Position[Position["BottomCenter"] = 5] = "BottomCenter";
|
||||
Position[Position["LeftCenter"] = 6] = "LeftCenter";
|
||||
Position[Position["RightCenter"] = 7] = "RightCenter";
|
||||
Position[Position["Center"] = 8] = "Center";
|
||||
Position[Position["TrayLeft"] = 9] = "TrayLeft";
|
||||
Position[Position["TrayBottomLeft"] = 10] = "TrayBottomLeft";
|
||||
Position[Position["TrayRight"] = 11] = "TrayRight";
|
||||
Position[Position["TrayBottomRight"] = 12] = "TrayBottomRight";
|
||||
Position[Position["TrayCenter"] = 13] = "TrayCenter";
|
||||
Position[Position["TrayBottomCenter"] = 14] = "TrayBottomCenter";
|
||||
})(Position || (Position = {}));
|
||||
/**
|
||||
* Moves the `Window` to the given {@link Position} using `WindowExt.move_window()`
|
||||
* All positions are relative to the **current** screen.
|
||||
*
|
||||
* @param to The {@link Position} to move to.
|
||||
*/
|
||||
async function moveWindow(to) {
|
||||
await invoke("plugin:positioner|move_window", {
|
||||
position: to,
|
||||
});
|
||||
}
|
||||
|
||||
export { Position, moveWindow };
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AAKA;;AAEG;IACS,SAgBX;AAhBD,CAAA,UAAY,QAAQ,EAAA;AAClB,IAAA,QAAA,CAAA,QAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAW,CAAA;AACX,IAAA,QAAA,CAAA,QAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAQ,CAAA;AACR,IAAA,QAAA,CAAA,QAAA,CAAA,YAAA,CAAA,GAAA,CAAA,CAAA,GAAA,YAAU,CAAA;AACV,IAAA,QAAA,CAAA,QAAA,CAAA,aAAA,CAAA,GAAA,CAAA,CAAA,GAAA,aAAW,CAAA;AACX,IAAA,QAAA,CAAA,QAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAS,CAAA;AACT,IAAA,QAAA,CAAA,QAAA,CAAA,cAAA,CAAA,GAAA,CAAA,CAAA,GAAA,cAAY,CAAA;AACZ,IAAA,QAAA,CAAA,QAAA,CAAA,YAAA,CAAA,GAAA,CAAA,CAAA,GAAA,YAAU,CAAA;AACV,IAAA,QAAA,CAAA,QAAA,CAAA,aAAA,CAAA,GAAA,CAAA,CAAA,GAAA,aAAW,CAAA;AACX,IAAA,QAAA,CAAA,QAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAM,CAAA;AACN,IAAA,QAAA,CAAA,QAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAQ,CAAA;AACR,IAAA,QAAA,CAAA,QAAA,CAAA,gBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,gBAAc,CAAA;AACd,IAAA,QAAA,CAAA,QAAA,CAAA,WAAA,CAAA,GAAA,EAAA,CAAA,GAAA,WAAS,CAAA;AACT,IAAA,QAAA,CAAA,QAAA,CAAA,iBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,iBAAe,CAAA;AACf,IAAA,QAAA,CAAA,QAAA,CAAA,YAAA,CAAA,GAAA,EAAA,CAAA,GAAA,YAAU,CAAA;AACV,IAAA,QAAA,CAAA,QAAA,CAAA,kBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,kBAAgB,CAAA;AAClB,CAAC,EAhBW,QAAQ,KAAR,QAAQ,GAgBnB,EAAA,CAAA,CAAA,CAAA;AAED;;;;;AAKG;AACI,eAAe,UAAU,CAAC,EAAY,EAAA;IAC3C,MAAM,MAAM,CAAC,+BAA+B,EAAE;AAC5C,QAAA,QAAQ,EAAE,EAAE;AACb,KAAA,CAAC,CAAC;AACL;;;;"}
|
||||
@@ -1,10 +0,0 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
import { createConfig } from "../../../shared/rollup.config.mjs";
|
||||
|
||||
export default createConfig({
|
||||
pkg: JSON.parse(
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8")
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
@@ -1 +0,0 @@
|
||||
../../../shared/tsconfig.json
|
||||
@@ -6,13 +6,13 @@
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"type": "module",
|
||||
"browser": "dist/index.min.js",
|
||||
"module": "dist/index.mjs",
|
||||
"types": "dist/index.d.ts",
|
||||
"browser": "guest-js/dist/index.min.js",
|
||||
"module": "guest-js/dist/index.mjs",
|
||||
"types": "guest-js/dist/index.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"browser": "./dist/index.min.js"
|
||||
"import": "./guest-js/dist/index.mjs",
|
||||
"types": "./guest-js/dist/index.d.ts",
|
||||
"browser": "./guest-js/dist/index.min.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup -c"
|
||||
@@ -0,0 +1,11 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
import { createConfig } from "../../shared/rollup.config.mjs";
|
||||
|
||||
export default createConfig({
|
||||
input: "guest-js/index.ts",
|
||||
pkg: JSON.parse(
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8")
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../shared/tsconfig.json
|
||||
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
+49
-2
@@ -1,17 +1,64 @@
|
||||

|
||||
|
||||
<!-- description -->
|
||||
Interface with SQL databases through [sqlx](https://github.com/launchbadge/sqlx). It supports the `sqlite`, `mysql` and `postgres` drivers, enabled by a Cargo feature.
|
||||
|
||||
## Install
|
||||
|
||||
There are three general methods of installation that we can recommend.
|
||||
|
||||
1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked)
|
||||
2. Pull sources directly from Github using git tags / revision hashes (most secure)
|
||||
3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use)
|
||||
|
||||
Install the Core plugin by adding the following to your `Cargo.toml` file:
|
||||
|
||||
`src-tauri/Cargo.toml`
|
||||
```toml
|
||||
[dependencies.tauri-plugin-sql]
|
||||
git = "https://github.com/tauri-apps/plugins-workspace"
|
||||
branch = "dev"
|
||||
features = ["sqlite"] # or "postgres", or "mysql"
|
||||
```
|
||||
|
||||
You can install the JavaScript Guest bindings using your preferred JavaScript package manager:
|
||||
|
||||
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
|
||||
|
||||
```sh
|
||||
pnpm add https://github.com/tauri-apps/tauri-plugin-sql
|
||||
# or
|
||||
npm add https://github.com/tauri-apps/tauri-plugin-sql
|
||||
# or
|
||||
yarn add https://github.com/tauri-apps/tauri-plugin-sql
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
First you need to register the core plugin with Tauri:
|
||||
|
||||
`src-tauri/src/main.rs`
|
||||
```rust
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_sql::Builder::default())
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
```
|
||||
|
||||
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
|
||||
|
||||
```javascript
|
||||
import Database from 'tauri-plugin-sql-api'
|
||||
|
||||
// sqlite. The path is relative to `tauri::api::path::BaseDirectory::App`.
|
||||
const db = await Database.load('sqlite:test.db')
|
||||
// mysql
|
||||
const db = await Database.load('mysql://user:pass@host/database')
|
||||
// postgres
|
||||
const db = await Database.load('postgres://postgres:password@localhost/test')
|
||||
|
||||
await db.execute('INSERT INTO ...')
|
||||
```
|
||||
|
||||
## Contributing
|
||||
@@ -20,6 +67,6 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu
|
||||
|
||||
## License
|
||||
|
||||
Code: (c) 2015 - 2021 - The Tauri Programme within The Commons Conservancy.
|
||||
Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
|
||||
|
||||
MIT or MIT/Apache 2.0 where applicable.
|
||||
|
||||
Vendored
-95
@@ -1,95 +0,0 @@
|
||||
export interface QueryResult {
|
||||
/** The number of rows affected by the query. */
|
||||
rowsAffected: number;
|
||||
/**
|
||||
* The last inserted `id`.
|
||||
*
|
||||
* This value is always `0` when using the Postgres driver. If the
|
||||
* last inserted id is required on Postgres, the `select` function
|
||||
* must be used, with a `RETURNING` clause
|
||||
* (`INSERT INTO todos (title) VALUES ($1) RETURNING id`).
|
||||
*/
|
||||
lastInsertId: number;
|
||||
}
|
||||
/**
|
||||
* **Database**
|
||||
*
|
||||
* The `Database` class serves as the primary interface for
|
||||
* communicating with the rust side of the sql plugin.
|
||||
*/
|
||||
export default class Database {
|
||||
path: string;
|
||||
constructor(path: string);
|
||||
/**
|
||||
* **load**
|
||||
*
|
||||
* A static initializer which connects to the underlying database and
|
||||
* returns a `Database` instance once a connection to the database is established.
|
||||
*
|
||||
* # Sqlite
|
||||
*
|
||||
* The path is relative to `tauri::api::path::BaseDirectory::App` and must start with `sqlite:`.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const db = await Database.load("sqlite:test.db");
|
||||
* ```
|
||||
*/
|
||||
static load(path: string): Promise<Database>;
|
||||
/**
|
||||
* **get**
|
||||
*
|
||||
* A static initializer which synchronously returns an instance of
|
||||
* the Database class while deferring the actual database connection
|
||||
* until the first invocation or selection on the database.
|
||||
*
|
||||
* # Sqlite
|
||||
*
|
||||
* The path is relative to `tauri::api::path::BaseDirectory::App` and must start with `sqlite:`.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const db = Database.get("sqlite:test.db");
|
||||
* ```
|
||||
*/
|
||||
static get(path: string): Database;
|
||||
/**
|
||||
* **execute**
|
||||
*
|
||||
* Passes a SQL expression to the database for execution.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const result = await db.execute(
|
||||
* "UPDATE todos SET title = $1, completed = $2 WHERE id = $3",
|
||||
* [ todos.title, todos.status, todos.id ]
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
execute(query: string, bindValues?: unknown[]): Promise<QueryResult>;
|
||||
/**
|
||||
* **select**
|
||||
*
|
||||
* Passes in a SELECT query to the database for execution.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const result = await db.select(
|
||||
* "SELECT * from todos WHERE id = $1", id
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
select<T>(query: string, bindValues?: unknown[]): Promise<T>;
|
||||
/**
|
||||
* **close**
|
||||
*
|
||||
* Closes the database connection pool.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const success = await db.close()
|
||||
* ```
|
||||
* @param db - Optionally state the name of a database if you are managing more than one. Otherwise, all database pools will be in scope.
|
||||
*/
|
||||
close(db?: string): Promise<boolean>;
|
||||
}
|
||||
-119
@@ -1,119 +0,0 @@
|
||||
var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0});};
|
||||
|
||||
var f={};e(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`);},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`);},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r});})}function w(e,r="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}
|
||||
|
||||
/**
|
||||
* **Database**
|
||||
*
|
||||
* The `Database` class serves as the primary interface for
|
||||
* communicating with the rust side of the sql plugin.
|
||||
*/
|
||||
class Database {
|
||||
constructor(path) {
|
||||
this.path = path;
|
||||
}
|
||||
/**
|
||||
* **load**
|
||||
*
|
||||
* A static initializer which connects to the underlying database and
|
||||
* returns a `Database` instance once a connection to the database is established.
|
||||
*
|
||||
* # Sqlite
|
||||
*
|
||||
* The path is relative to `tauri::api::path::BaseDirectory::App` and must start with `sqlite:`.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const db = await Database.load("sqlite:test.db");
|
||||
* ```
|
||||
*/
|
||||
static async load(path) {
|
||||
const _path = await c("plugin:sql|load", {
|
||||
db: path,
|
||||
});
|
||||
return new Database(_path);
|
||||
}
|
||||
/**
|
||||
* **get**
|
||||
*
|
||||
* A static initializer which synchronously returns an instance of
|
||||
* the Database class while deferring the actual database connection
|
||||
* until the first invocation or selection on the database.
|
||||
*
|
||||
* # Sqlite
|
||||
*
|
||||
* The path is relative to `tauri::api::path::BaseDirectory::App` and must start with `sqlite:`.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const db = Database.get("sqlite:test.db");
|
||||
* ```
|
||||
*/
|
||||
static get(path) {
|
||||
return new Database(path);
|
||||
}
|
||||
/**
|
||||
* **execute**
|
||||
*
|
||||
* Passes a SQL expression to the database for execution.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const result = await db.execute(
|
||||
* "UPDATE todos SET title = $1, completed = $2 WHERE id = $3",
|
||||
* [ todos.title, todos.status, todos.id ]
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
async execute(query, bindValues) {
|
||||
const [rowsAffected, lastInsertId] = await c("plugin:sql|execute", {
|
||||
db: this.path,
|
||||
query,
|
||||
values: bindValues !== null && bindValues !== void 0 ? bindValues : [],
|
||||
});
|
||||
return {
|
||||
lastInsertId,
|
||||
rowsAffected,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* **select**
|
||||
*
|
||||
* Passes in a SELECT query to the database for execution.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const result = await db.select(
|
||||
* "SELECT * from todos WHERE id = $1", id
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
async select(query, bindValues) {
|
||||
const result = await c("plugin:sql|select", {
|
||||
db: this.path,
|
||||
query,
|
||||
values: bindValues !== null && bindValues !== void 0 ? bindValues : [],
|
||||
});
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* **close**
|
||||
*
|
||||
* Closes the database connection pool.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const success = await db.close()
|
||||
* ```
|
||||
* @param db - Optionally state the name of a database if you are managing more than one. Otherwise, all database pools will be in scope.
|
||||
*/
|
||||
async close(db) {
|
||||
const success = await c("plugin:sql|close", {
|
||||
db,
|
||||
});
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
export { Database as default };
|
||||
//# sourceMappingURL=index.min.js.map
|
||||
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.min.js","sources":["../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-FEIY7W7S.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-RCPA6UVN.js","../index.ts"],"sourcesContent":["var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0})};export{e as a};\n","import{a as d}from\"./chunk-FEIY7W7S.js\";var f={};d(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`)},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`)},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r})})}function w(e,r=\"asset\"){let n=encodeURIComponent(e);return navigator.userAgent.includes(\"Windows\")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}export{s as a,c as b,w as c,f as d};\n",null],"names":["d","invoke"],"mappings":"AAAA,IAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI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,MAAM,OAAO,CAAC,KAAa,EAAE,UAAsB,EAAA;QACjD,MAAM,CAAC,YAAY,EAAE,YAAY,CAAC,GAAG,MAAMA,CAAM,CAC/C,oBAAoB,EACpB;YACE,EAAE,EAAE,IAAI,CAAC,IAAI;YACb,KAAK;AACL,YAAA,MAAM,EAAE,UAAU,KAAA,IAAA,IAAV,UAAU,KAAV,KAAA,CAAA,GAAA,UAAU,GAAI,EAAE;AACzB,SAAA,CACF,CAAC;QAEF,OAAO;YACL,YAAY;YACZ,YAAY;SACb,CAAC;KACH;AAED;;;;;;;;;;;AAWG;AACH,IAAA,MAAM,MAAM,CAAI,KAAa,EAAE,UAAsB,EAAA;AACnD,QAAA,MAAM,MAAM,GAAG,MAAMA,CAAM,CAAI,mBAAmB,EAAE;YAClD,EAAE,EAAE,IAAI,CAAC,IAAI;YACb,KAAK;AACL,YAAA,MAAM,EAAE,UAAU,KAAA,IAAA,IAAV,UAAU,KAAV,KAAA,CAAA,GAAA,UAAU,GAAI,EAAE;AACzB,SAAA,CAAC,CAAC;AAEH,QAAA,OAAO,MAAM,CAAC;KACf;AAED;;;;;;;;;;AAUG;IACH,MAAM,KAAK,CAAC,EAAW,EAAA;AACrB,QAAA,MAAM,OAAO,GAAG,MAAMA,CAAM,CAAU,kBAAkB,EAAE;YACxD,EAAE;AACH,SAAA,CAAC,CAAC;AACH,QAAA,OAAO,OAAO,CAAC;KAChB;AACF;;;;"}
|
||||
Vendored
-117
@@ -1,117 +0,0 @@
|
||||
import { invoke } from '@tauri-apps/api/tauri';
|
||||
|
||||
/**
|
||||
* **Database**
|
||||
*
|
||||
* The `Database` class serves as the primary interface for
|
||||
* communicating with the rust side of the sql plugin.
|
||||
*/
|
||||
class Database {
|
||||
constructor(path) {
|
||||
this.path = path;
|
||||
}
|
||||
/**
|
||||
* **load**
|
||||
*
|
||||
* A static initializer which connects to the underlying database and
|
||||
* returns a `Database` instance once a connection to the database is established.
|
||||
*
|
||||
* # Sqlite
|
||||
*
|
||||
* The path is relative to `tauri::api::path::BaseDirectory::App` and must start with `sqlite:`.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const db = await Database.load("sqlite:test.db");
|
||||
* ```
|
||||
*/
|
||||
static async load(path) {
|
||||
const _path = await invoke("plugin:sql|load", {
|
||||
db: path,
|
||||
});
|
||||
return new Database(_path);
|
||||
}
|
||||
/**
|
||||
* **get**
|
||||
*
|
||||
* A static initializer which synchronously returns an instance of
|
||||
* the Database class while deferring the actual database connection
|
||||
* until the first invocation or selection on the database.
|
||||
*
|
||||
* # Sqlite
|
||||
*
|
||||
* The path is relative to `tauri::api::path::BaseDirectory::App` and must start with `sqlite:`.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const db = Database.get("sqlite:test.db");
|
||||
* ```
|
||||
*/
|
||||
static get(path) {
|
||||
return new Database(path);
|
||||
}
|
||||
/**
|
||||
* **execute**
|
||||
*
|
||||
* Passes a SQL expression to the database for execution.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const result = await db.execute(
|
||||
* "UPDATE todos SET title = $1, completed = $2 WHERE id = $3",
|
||||
* [ todos.title, todos.status, todos.id ]
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
async execute(query, bindValues) {
|
||||
const [rowsAffected, lastInsertId] = await invoke("plugin:sql|execute", {
|
||||
db: this.path,
|
||||
query,
|
||||
values: bindValues !== null && bindValues !== void 0 ? bindValues : [],
|
||||
});
|
||||
return {
|
||||
lastInsertId,
|
||||
rowsAffected,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* **select**
|
||||
*
|
||||
* Passes in a SELECT query to the database for execution.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const result = await db.select(
|
||||
* "SELECT * from todos WHERE id = $1", id
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
async select(query, bindValues) {
|
||||
const result = await invoke("plugin:sql|select", {
|
||||
db: this.path,
|
||||
query,
|
||||
values: bindValues !== null && bindValues !== void 0 ? bindValues : [],
|
||||
});
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* **close**
|
||||
*
|
||||
* Closes the database connection pool.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const success = await db.close()
|
||||
* ```
|
||||
* @param db - Optionally state the name of a database if you are managing more than one. Otherwise, all database pools will be in scope.
|
||||
*/
|
||||
async close(db) {
|
||||
const success = await invoke("plugin:sql|close", {
|
||||
db,
|
||||
});
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
export { Database as default };
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAgBA;;;;;AAKG;AACW,MAAO,QAAQ,CAAA;AAE3B,IAAA,WAAA,CAAY,IAAY,EAAA;AACtB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;KAClB;AAED;;;;;;;;;;;;;;AAcG;AACH,IAAA,aAAa,IAAI,CAAC,IAAY,EAAA;AAC5B,QAAA,MAAM,KAAK,GAAG,MAAM,MAAM,CAAS,iBAAiB,EAAE;AACpD,YAAA,EAAE,EAAE,IAAI;AACT,SAAA,CAAC,CAAC;AAEH,QAAA,OAAO,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC;KAC5B;AAED;;;;;;;;;;;;;;;AAeG;IACH,OAAO,GAAG,CAAC,IAAY,EAAA;AACrB,QAAA,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;KAC3B;AAED;;;;;;;;;;;;AAYG;AACH,IAAA,MAAM,OAAO,CAAC,KAAa,EAAE,UAAsB,EAAA;QACjD,MAAM,CAAC,YAAY,EAAE,YAAY,CAAC,GAAG,MAAM,MAAM,CAC/C,oBAAoB,EACpB;YACE,EAAE,EAAE,IAAI,CAAC,IAAI;YACb,KAAK;AACL,YAAA,MAAM,EAAE,UAAU,KAAA,IAAA,IAAV,UAAU,KAAV,KAAA,CAAA,GAAA,UAAU,GAAI,EAAE;AACzB,SAAA,CACF,CAAC;QAEF,OAAO;YACL,YAAY;YACZ,YAAY;SACb,CAAC;KACH;AAED;;;;;;;;;;;AAWG;AACH,IAAA,MAAM,MAAM,CAAI,KAAa,EAAE,UAAsB,EAAA;AACnD,QAAA,MAAM,MAAM,GAAG,MAAM,MAAM,CAAI,mBAAmB,EAAE;YAClD,EAAE,EAAE,IAAI,CAAC,IAAI;YACb,KAAK;AACL,YAAA,MAAM,EAAE,UAAU,KAAA,IAAA,IAAV,UAAU,KAAV,KAAA,CAAA,GAAA,UAAU,GAAI,EAAE;AACzB,SAAA,CAAC,CAAC;AAEH,QAAA,OAAO,MAAM,CAAC;KACf;AAED;;;;;;;;;;AAUG;IACH,MAAM,KAAK,CAAC,EAAW,EAAA;AACrB,QAAA,MAAM,OAAO,GAAG,MAAM,MAAM,CAAU,kBAAkB,EAAE;YACxD,EAAE;AACH,SAAA,CAAC,CAAC;AACH,QAAA,OAAO,OAAO,CAAC;KAChB;AACF;;;;"}
|
||||
@@ -1,10 +0,0 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
import { createConfig } from "../../../shared/rollup.config.mjs";
|
||||
|
||||
export default createConfig({
|
||||
pkg: JSON.parse(
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8")
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
@@ -1 +0,0 @@
|
||||
../../../shared/tsconfig.json
|
||||
@@ -6,13 +6,13 @@
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"type": "module",
|
||||
"browser": "dist/index.min.js",
|
||||
"module": "dist/index.mjs",
|
||||
"types": "dist/index.d.ts",
|
||||
"browser": "guest-js/dist/index.min.js",
|
||||
"module": "guest-js/dist/index.mjs",
|
||||
"types": "guest-js/dist/index.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"browser": "./dist/index.min.js"
|
||||
"import": "./guest-js/dist/index.mjs",
|
||||
"types": "./guest-js/dist/index.d.ts",
|
||||
"browser": "./guest-js/dist/index.min.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup -c"
|
||||
@@ -0,0 +1,11 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
import { createConfig } from "../../shared/rollup.config.mjs";
|
||||
|
||||
export default createConfig({
|
||||
input: "guest-js/index.ts",
|
||||
pkg: JSON.parse(
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8")
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../shared/tsconfig.json
|
||||
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
+45
-2
@@ -1,17 +1,60 @@
|
||||

|
||||
|
||||
<!-- description -->
|
||||
Simple, persistent key-value store.
|
||||
|
||||
## Install
|
||||
|
||||
There are three general methods of installation that we can recommend.
|
||||
|
||||
1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked)
|
||||
2. Pull sources directly from Github using git tags / revision hashes (most secure)
|
||||
3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use)
|
||||
|
||||
Install the Core plugin by adding the following to your `Cargo.toml` file:
|
||||
|
||||
`src-tauri/Cargo.toml`
|
||||
```toml
|
||||
[dependencies]
|
||||
tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
||||
```
|
||||
|
||||
You can install the JavaScript Guest bindings using your preferred JavaScript package manager:
|
||||
|
||||
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
|
||||
|
||||
```sh
|
||||
pnpm add https://github.com/tauri-apps/tauri-plugin-store
|
||||
# or
|
||||
npm add https://github.com/tauri-apps/tauri-plugin-store
|
||||
# or
|
||||
yarn add https://github.com/tauri-apps/tauri-plugin-store
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
First you need to register the core plugin with Tauri:
|
||||
|
||||
`src-tauri/src/main.rs`
|
||||
```rust
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_store::Builder::default().build())
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
```
|
||||
|
||||
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
|
||||
|
||||
```javascript
|
||||
import { Store } from 'tauri-plugin-store-api';
|
||||
|
||||
const store = new Store('.settings.dat');
|
||||
|
||||
await store.set('some-key', { value: 5 });
|
||||
|
||||
const val = await store.get('some-key');
|
||||
assert(val, { value: 5 });
|
||||
```
|
||||
|
||||
## Contributing
|
||||
@@ -20,6 +63,6 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu
|
||||
|
||||
## License
|
||||
|
||||
Code: (c) 2015 - 2021 - The Tauri Programme within The Commons Conservancy.
|
||||
Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
|
||||
|
||||
MIT or MIT/Apache 2.0 where applicable.
|
||||
|
||||
-105
@@ -1,105 +0,0 @@
|
||||
import { UnlistenFn } from "@tauri-apps/api/event";
|
||||
/**
|
||||
* A key-value store persisted by the backend layer.
|
||||
*/
|
||||
export declare class Store {
|
||||
path: string;
|
||||
constructor(path: string);
|
||||
/**
|
||||
* Inserts a key-value pair into the store.
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
* @returns
|
||||
*/
|
||||
set(key: string, value: unknown): Promise<void>;
|
||||
/**
|
||||
* Returns the value for the given `key` or `null` the key does not exist.
|
||||
*
|
||||
* @param key
|
||||
* @returns
|
||||
*/
|
||||
get<T>(key: string): Promise<T | null>;
|
||||
/**
|
||||
* Returns `true` if the given `key` exists in the store.
|
||||
*
|
||||
* @param key
|
||||
* @returns
|
||||
*/
|
||||
has(key: string): Promise<boolean>;
|
||||
/**
|
||||
* Removes a key-value pair from the store.
|
||||
*
|
||||
* @param key
|
||||
* @returns
|
||||
*/
|
||||
delete(key: string): Promise<boolean>;
|
||||
/**
|
||||
* Clears the store, removing all key-value pairs.
|
||||
*
|
||||
* Note: To clear the storage and reset it to it's `default` value, use `reset` instead.
|
||||
* @returns
|
||||
*/
|
||||
clear(): Promise<void>;
|
||||
/**
|
||||
* Resets the store to it's `default` value.
|
||||
*
|
||||
* If no default value has been set, this method behaves identical to `clear`.
|
||||
* @returns
|
||||
*/
|
||||
reset(): Promise<void>;
|
||||
/**
|
||||
* Returns a list of all key in the store.
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
keys(): Promise<string[]>;
|
||||
/**
|
||||
* Returns a list of all values in the store.
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
values(): Promise<string[]>;
|
||||
/**
|
||||
* Returns a list of all entries in the store.
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
entries<T>(): Promise<Array<[key: string, value: T]>>;
|
||||
/**
|
||||
* Returns the number of key-value pairs in the store.
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
length(): Promise<string[]>;
|
||||
/**
|
||||
* Attempts to load the on-disk state at the stores `path` into memory.
|
||||
*
|
||||
* This method is useful if the on-disk state was edited by the user and you want to synchronize the changes.
|
||||
*
|
||||
* Note: This method does not emit change events.
|
||||
* @returns
|
||||
*/
|
||||
load(): Promise<void>;
|
||||
/**
|
||||
* Saves the store to disk at the stores `path`.
|
||||
*
|
||||
* As the store is only persistet to disk before the apps exit, changes might be lost in a crash.
|
||||
* This method let's you persist the store to disk whenever you deem necessary.
|
||||
* @returns
|
||||
*/
|
||||
save(): Promise<void>;
|
||||
/**
|
||||
* Listen to changes on a store key.
|
||||
* @param key
|
||||
* @param cb
|
||||
* @returns A promise resolving to a function to unlisten to the event.
|
||||
*/
|
||||
onKeyChange<T>(key: string, cb: (value: T | null) => void): Promise<UnlistenFn>;
|
||||
/**
|
||||
* Listen to changes on the store.
|
||||
* @param cb
|
||||
* @returns A promise resolving to a function to unlisten to the event.
|
||||
*/
|
||||
onChange(cb: (key: string, value: unknown) => void): Promise<UnlistenFn>;
|
||||
}
|
||||
-185
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-177
@@ -1,177 +0,0 @@
|
||||
import { invoke } from '@tauri-apps/api/tauri';
|
||||
import { appWindow } from '@tauri-apps/api/window';
|
||||
|
||||
// Copyright 2021 Tauri Programme within The Commons Conservancy
|
||||
/**
|
||||
* A key-value store persisted by the backend layer.
|
||||
*/
|
||||
class Store {
|
||||
constructor(path) {
|
||||
this.path = path;
|
||||
}
|
||||
/**
|
||||
* Inserts a key-value pair into the store.
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
* @returns
|
||||
*/
|
||||
async set(key, value) {
|
||||
return await invoke("plugin:store|set", {
|
||||
path: this.path,
|
||||
key,
|
||||
value,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns the value for the given `key` or `null` the key does not exist.
|
||||
*
|
||||
* @param key
|
||||
* @returns
|
||||
*/
|
||||
async get(key) {
|
||||
return await invoke("plugin:store|get", {
|
||||
path: this.path,
|
||||
key,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns `true` if the given `key` exists in the store.
|
||||
*
|
||||
* @param key
|
||||
* @returns
|
||||
*/
|
||||
async has(key) {
|
||||
return await invoke("plugin:store|has", {
|
||||
path: this.path,
|
||||
key,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Removes a key-value pair from the store.
|
||||
*
|
||||
* @param key
|
||||
* @returns
|
||||
*/
|
||||
async delete(key) {
|
||||
return await invoke("plugin:store|delete", {
|
||||
path: this.path,
|
||||
key,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Clears the store, removing all key-value pairs.
|
||||
*
|
||||
* Note: To clear the storage and reset it to it's `default` value, use `reset` instead.
|
||||
* @returns
|
||||
*/
|
||||
async clear() {
|
||||
return await invoke("plugin:store|clear", {
|
||||
path: this.path,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Resets the store to it's `default` value.
|
||||
*
|
||||
* If no default value has been set, this method behaves identical to `clear`.
|
||||
* @returns
|
||||
*/
|
||||
async reset() {
|
||||
return await invoke("plugin:store|reset", {
|
||||
path: this.path,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns a list of all key in the store.
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
async keys() {
|
||||
return await invoke("plugin:store|keys", {
|
||||
path: this.path,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns a list of all values in the store.
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
async values() {
|
||||
return await invoke("plugin:store|values", {
|
||||
path: this.path,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns a list of all entries in the store.
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
async entries() {
|
||||
return await invoke("plugin:store|entries", {
|
||||
path: this.path,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns the number of key-value pairs in the store.
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
async length() {
|
||||
return await invoke("plugin:store|length", {
|
||||
path: this.path,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Attempts to load the on-disk state at the stores `path` into memory.
|
||||
*
|
||||
* This method is useful if the on-disk state was edited by the user and you want to synchronize the changes.
|
||||
*
|
||||
* Note: This method does not emit change events.
|
||||
* @returns
|
||||
*/
|
||||
async load() {
|
||||
return await invoke("plugin:store|load", {
|
||||
path: this.path,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Saves the store to disk at the stores `path`.
|
||||
*
|
||||
* As the store is only persisted to disk before the apps exit, changes might be lost in a crash.
|
||||
* This method lets you persist the store to disk whenever you deem necessary.
|
||||
* @returns
|
||||
*/
|
||||
async save() {
|
||||
return await invoke("plugin:store|save", {
|
||||
path: this.path,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Listen to changes on a store key.
|
||||
* @param key
|
||||
* @param cb
|
||||
* @returns A promise resolving to a function to unlisten to the event.
|
||||
*/
|
||||
async onKeyChange(key, cb) {
|
||||
return await appWindow.listen("store://change", (event) => {
|
||||
if (event.payload.path === this.path && event.payload.key === key) {
|
||||
cb(event.payload.value);
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Listen to changes on the store.
|
||||
* @param cb
|
||||
* @returns A promise resolving to a function to unlisten to the event.
|
||||
*/
|
||||
async onChange(cb) {
|
||||
return await appWindow.listen("store://change", (event) => {
|
||||
if (event.payload.path === this.path) {
|
||||
cb(event.payload.key, event.payload.value);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export { Store };
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAAA;AAcA;;AAEG;MACU,KAAK,CAAA;AAEhB,IAAA,WAAA,CAAY,IAAY,EAAA;AACtB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;KAClB;AAED;;;;;;AAMG;AACH,IAAA,MAAM,GAAG,CAAC,GAAW,EAAE,KAAc,EAAA;AACnC,QAAA,OAAO,MAAM,MAAM,CAAC,kBAAkB,EAAE;YACtC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,GAAG;YACH,KAAK;AACN,SAAA,CAAC,CAAC;KACJ;AAED;;;;;AAKG;IACH,MAAM,GAAG,CAAI,GAAW,EAAA;AACtB,QAAA,OAAO,MAAM,MAAM,CAAC,kBAAkB,EAAE;YACtC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,GAAG;AACJ,SAAA,CAAC,CAAC;KACJ;AAED;;;;;AAKG;IACH,MAAM,GAAG,CAAC,GAAW,EAAA;AACnB,QAAA,OAAO,MAAM,MAAM,CAAC,kBAAkB,EAAE;YACtC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,GAAG;AACJ,SAAA,CAAC,CAAC;KACJ;AAED;;;;;AAKG;IACH,MAAM,MAAM,CAAC,GAAW,EAAA;AACtB,QAAA,OAAO,MAAM,MAAM,CAAC,qBAAqB,EAAE;YACzC,IAAI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ACR,QAAA,OAAO,MAAM,MAAM,CAAC,mBAAmB,EAAE;YACvC,IAAI,EAAE,IAAI,CAAC,IAAI;AAChB,SAAA,CAAC,CAAC;KACJ;AAED;;;;;AAKG;AACH,IAAA,MAAM,WAAW,CACf,GAAW,EACX,EAA6B,EAAA;QAE7B,OAAO,MAAM,SAAS,CAAC,MAAM,CAC3B,gBAAgB,EAChB,CAAC,KAAK,KAAI;AACR,YAAA,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,KAAK,GAAG,EAAE;AACjE,gBAAA,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACzB,aAAA;AACH,SAAC,CACF,CAAC;KACH;AAED;;;;AAIG;IACH,MAAM,QAAQ,CACZ,EAA0C,EAAA;QAE1C,OAAO,MAAM,SAAS,CAAC,MAAM,CAC3B,gBAAgB,EAChB,CAAC,KAAK,KAAI;YACR,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE;AACpC,gBAAA,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC5C,aAAA;AACH,SAAC,CACF,CAAC;KACH;AACF;;;;"}
|
||||
@@ -1,10 +0,0 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
import { createConfig } from "../../../shared/rollup.config.mjs";
|
||||
|
||||
export default createConfig({
|
||||
pkg: JSON.parse(
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8")
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user