mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-06-06 13:53:54 +02:00
Merge v1 into v2 (#468)
Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: FabianLars <fabianlars@fabianlars.de> Co-authored-by: FabianLars <FabianLars@users.noreply.github.com> Co-authored-by: Alexandre Dang <124160233+vdang-crabnebula@users.noreply.github.com> Co-authored-by: Ludea <ludovicw35@hotmail.com> Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com> Co-authored-by: Duke Jones <104690+dukejones@users.noreply.github.com> Co-authored-by: NaokiM03 <37442712+NaokiM03@users.noreply.github.com> Co-authored-by: Thibault <thibault_poisson@orange.fr> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: David Blythe <49919035+writeDavid@users.noreply.github.com> Co-authored-by: Lucas Nogueira <lucas@tauri.studio> fix(stronghold): change wrong argument name for `remove` (#422) fix(window-state): correctly set decoration state if no saved state exists, fixes #421 (#424) fix(stronghold): return null if there is no record (#129) fix(window-state): propagate promise (#435) closes #432 fix(window-state): manual default implentation (#425) fix(window-state): manual default implentation, closes #421 fix(deps): update rust crate iota-crypto to 0.21 (#438) fix readme example (#447) fix: handle recursive directory correctly (#455) fix(deps): update rust crate sqlx to 0.7. plugin-sql msrv is now 1.65 (#464) fix(persisted-scope): separately save asset protocol patterns (#459) fix(deps): update rust crate iota-crypto to 0.22 (#475) fix(deps): update tauri monorepo to v1.4.0 (#482) resolve to v15.1.0 (#489) fix(deps): update rust crate iota-crypto to 0.23 (#495)
This commit is contained in:
@@ -5,7 +5,7 @@ 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")
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
|
||||
@@ -93,7 +93,7 @@ const r2 = await auth.verifyRegistration(
|
||||
challenge,
|
||||
app,
|
||||
registerResult.registerData,
|
||||
registerResult.clientData
|
||||
registerResult.clientData,
|
||||
);
|
||||
const j2 = JSON.parse(r2);
|
||||
|
||||
@@ -108,7 +108,7 @@ const counter = await auth.verifySignature(
|
||||
signData.signData,
|
||||
clientData,
|
||||
keyHandle,
|
||||
pubkey
|
||||
pubkey,
|
||||
);
|
||||
|
||||
if (counter && counter > 0) {
|
||||
|
||||
@@ -25,7 +25,7 @@ export class Authenticator {
|
||||
challenge: string,
|
||||
application: string,
|
||||
registerData: string,
|
||||
clientData: string
|
||||
clientData: string,
|
||||
): Promise<string> {
|
||||
return await window.__TAURI_INVOKE__(
|
||||
"plugin:authenticator|verify_registration",
|
||||
@@ -34,14 +34,14 @@ export class Authenticator {
|
||||
application,
|
||||
registerData,
|
||||
clientData,
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
async sign(
|
||||
challenge: string,
|
||||
application: string,
|
||||
keyHandle: string
|
||||
keyHandle: string,
|
||||
): Promise<string> {
|
||||
return await window.__TAURI_INVOKE__("plugin:authenticator|sign", {
|
||||
timeout: 10000,
|
||||
@@ -57,7 +57,7 @@ export class Authenticator {
|
||||
signData: string,
|
||||
clientData: string,
|
||||
keyHandle: string,
|
||||
pubkey: string
|
||||
pubkey: string,
|
||||
): Promise<number> {
|
||||
return await window.__TAURI_INVOKE__(
|
||||
"plugin:authenticator|verify_signature",
|
||||
@@ -68,7 +68,7 @@ export class Authenticator {
|
||||
clientData,
|
||||
keyHandle,
|
||||
pubkey,
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"LICENSE"
|
||||
],
|
||||
"devDependencies": {
|
||||
"tslib": "^2.5.0"
|
||||
"tslib": "2.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.0.0-alpha.5"
|
||||
|
||||
@@ -5,7 +5,7 @@ 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")
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"LICENSE"
|
||||
],
|
||||
"devDependencies": {
|
||||
"tslib": "^2.5.0"
|
||||
"tslib": "2.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.0.0-alpha.5"
|
||||
|
||||
@@ -5,7 +5,7 @@ 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")
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
|
||||
@@ -5,7 +5,7 @@ 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")
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
|
||||
@@ -36,7 +36,7 @@ type ClipResponse = Clip<"PlainText", string>;
|
||||
*/
|
||||
async function writeText(
|
||||
text: string,
|
||||
opts?: { label?: string }
|
||||
opts?: { label?: string },
|
||||
): Promise<void> {
|
||||
return window.__TAURI_INVOKE__("plugin:clipboard|write", {
|
||||
data: {
|
||||
@@ -60,7 +60,7 @@ async function writeText(
|
||||
*/
|
||||
async function readText(): Promise<string> {
|
||||
const kind: ClipResponse = await window.__TAURI_INVOKE__(
|
||||
"plugin:clipboard|read"
|
||||
"plugin:clipboard|read",
|
||||
);
|
||||
return kind.options;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ 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")
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
|
||||
@@ -103,16 +103,16 @@ interface ConfirmDialogOptions {
|
||||
}
|
||||
|
||||
async function open(
|
||||
options?: OpenDialogOptions & { multiple?: false; directory?: false }
|
||||
options?: OpenDialogOptions & { multiple?: false; directory?: false },
|
||||
): Promise<null | FileResponse>;
|
||||
async function open(
|
||||
options?: OpenDialogOptions & { multiple?: true; directory?: false }
|
||||
options?: OpenDialogOptions & { multiple?: true; directory?: false },
|
||||
): Promise<null | FileResponse[]>;
|
||||
async function open(
|
||||
options?: OpenDialogOptions & { multiple?: false; directory?: true }
|
||||
options?: OpenDialogOptions & { multiple?: false; directory?: true },
|
||||
): Promise<null | string>;
|
||||
async function open(
|
||||
options?: OpenDialogOptions & { multiple?: true; directory?: true }
|
||||
options?: OpenDialogOptions & { multiple?: true; directory?: true },
|
||||
): Promise<null | string[]>;
|
||||
/**
|
||||
* Open a file/directory selection dialog.
|
||||
@@ -167,7 +167,7 @@ async function open(
|
||||
* @since 2.0.0
|
||||
*/
|
||||
async function open(
|
||||
options: OpenDialogOptions = {}
|
||||
options: OpenDialogOptions = {},
|
||||
): Promise<null | string | string[] | FileResponse | FileResponse[]> {
|
||||
if (typeof options === "object") {
|
||||
Object.freeze(options);
|
||||
@@ -227,7 +227,7 @@ async function save(options: SaveDialogOptions = {}): Promise<string | null> {
|
||||
*/
|
||||
async function message(
|
||||
message: string,
|
||||
options?: string | MessageDialogOptions
|
||||
options?: string | MessageDialogOptions,
|
||||
): Promise<void> {
|
||||
const opts = typeof options === "string" ? { title: options } : options;
|
||||
return window.__TAURI_INVOKE__("plugin:dialog|message", {
|
||||
@@ -256,7 +256,7 @@ async function message(
|
||||
*/
|
||||
async function ask(
|
||||
message: string,
|
||||
options?: string | ConfirmDialogOptions
|
||||
options?: string | ConfirmDialogOptions,
|
||||
): Promise<boolean> {
|
||||
const opts = typeof options === "string" ? { title: options } : options;
|
||||
return window.__TAURI_INVOKE__("plugin:dialog|ask", {
|
||||
@@ -286,7 +286,7 @@ async function ask(
|
||||
*/
|
||||
async function confirm(
|
||||
message: string,
|
||||
options?: string | ConfirmDialogOptions
|
||||
options?: string | ConfirmDialogOptions,
|
||||
): Promise<boolean> {
|
||||
const opts = typeof options === "string" ? { title: options } : options;
|
||||
return window.__TAURI_INVOKE__("plugin:dialog|confirm", {
|
||||
|
||||
@@ -5,7 +5,7 @@ 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")
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
|
||||
@@ -229,7 +229,7 @@ interface FileEntry {
|
||||
*/
|
||||
async function readTextFile(
|
||||
filePath: string,
|
||||
options: FsOptions = {}
|
||||
options: FsOptions = {},
|
||||
): Promise<string> {
|
||||
return await window.__TAURI_INVOKE__("plugin:fs|read_text_file", {
|
||||
path: filePath,
|
||||
@@ -250,7 +250,7 @@ async function readTextFile(
|
||||
*/
|
||||
async function readBinaryFile(
|
||||
filePath: string,
|
||||
options: FsOptions = {}
|
||||
options: FsOptions = {},
|
||||
): Promise<Uint8Array> {
|
||||
const arr = await window.__TAURI_INVOKE__<number[]>("plugin:fs|read_file", {
|
||||
path: filePath,
|
||||
@@ -274,7 +274,7 @@ async function readBinaryFile(
|
||||
async function writeTextFile(
|
||||
path: string,
|
||||
contents: string,
|
||||
options?: FsOptions
|
||||
options?: FsOptions,
|
||||
): Promise<void>;
|
||||
|
||||
/**
|
||||
@@ -291,7 +291,7 @@ async function writeTextFile(
|
||||
*/
|
||||
async function writeTextFile(
|
||||
file: FsTextFileOption,
|
||||
options?: FsOptions
|
||||
options?: FsOptions,
|
||||
): Promise<void>;
|
||||
|
||||
/**
|
||||
@@ -304,7 +304,7 @@ async function writeTextFile(
|
||||
async function writeTextFile(
|
||||
path: string | FsTextFileOption,
|
||||
contents?: string | FsOptions,
|
||||
options?: FsOptions
|
||||
options?: FsOptions,
|
||||
): Promise<void> {
|
||||
if (typeof options === "object") {
|
||||
Object.freeze(options);
|
||||
@@ -352,7 +352,7 @@ async function writeTextFile(
|
||||
async function writeBinaryFile(
|
||||
path: string,
|
||||
contents: BinaryFileContents,
|
||||
options?: FsOptions
|
||||
options?: FsOptions,
|
||||
): Promise<void>;
|
||||
|
||||
/**
|
||||
@@ -372,7 +372,7 @@ async function writeBinaryFile(
|
||||
*/
|
||||
async function writeBinaryFile(
|
||||
file: FsBinaryFileOption,
|
||||
options?: FsOptions
|
||||
options?: FsOptions,
|
||||
): Promise<void>;
|
||||
|
||||
/**
|
||||
@@ -385,7 +385,7 @@ async function writeBinaryFile(
|
||||
async function writeBinaryFile(
|
||||
path: string | FsBinaryFileOption,
|
||||
contents?: BinaryFileContents | FsOptions,
|
||||
options?: FsOptions
|
||||
options?: FsOptions,
|
||||
): Promise<void> {
|
||||
if (typeof options === "object") {
|
||||
Object.freeze(options);
|
||||
@@ -415,7 +415,7 @@ async function writeBinaryFile(
|
||||
contents: Array.from(
|
||||
file.contents instanceof ArrayBuffer
|
||||
? new Uint8Array(file.contents)
|
||||
: file.contents
|
||||
: file.contents,
|
||||
),
|
||||
options: fileOptions,
|
||||
});
|
||||
@@ -443,7 +443,7 @@ async function writeBinaryFile(
|
||||
*/
|
||||
async function readDir(
|
||||
dir: string,
|
||||
options: FsDirOptions = {}
|
||||
options: FsDirOptions = {},
|
||||
): Promise<FileEntry[]> {
|
||||
return await window.__TAURI_INVOKE__("plugin:fs|read_dir", {
|
||||
path: dir,
|
||||
@@ -468,7 +468,7 @@ async function readDir(
|
||||
*/
|
||||
async function createDir(
|
||||
dir: string,
|
||||
options: FsDirOptions = {}
|
||||
options: FsDirOptions = {},
|
||||
): Promise<void> {
|
||||
return await window.__TAURI_INVOKE__("plugin:fs|create_dir", {
|
||||
path: dir,
|
||||
@@ -492,7 +492,7 @@ async function createDir(
|
||||
*/
|
||||
async function removeDir(
|
||||
dir: string,
|
||||
options: FsDirOptions = {}
|
||||
options: FsDirOptions = {},
|
||||
): Promise<void> {
|
||||
return await window.__TAURI_INVOKE__("plugin:fs|remove_dir", {
|
||||
path: dir,
|
||||
@@ -516,7 +516,7 @@ async function removeDir(
|
||||
async function copyFile(
|
||||
source: string,
|
||||
destination: string,
|
||||
options: FsOptions = {}
|
||||
options: FsOptions = {},
|
||||
): Promise<void> {
|
||||
return await window.__TAURI_INVOKE__("plugin:fs|copy_file", {
|
||||
source,
|
||||
@@ -540,7 +540,7 @@ async function copyFile(
|
||||
*/
|
||||
async function removeFile(
|
||||
file: string,
|
||||
options: FsOptions = {}
|
||||
options: FsOptions = {},
|
||||
): Promise<void> {
|
||||
return await window.__TAURI_INVOKE__("plugin:fs|remove_file", {
|
||||
path: file,
|
||||
@@ -564,7 +564,7 @@ async function removeFile(
|
||||
async function renameFile(
|
||||
oldPath: string,
|
||||
newPath: string,
|
||||
options: FsOptions = {}
|
||||
options: FsOptions = {},
|
||||
): Promise<void> {
|
||||
return await window.__TAURI_INVOKE__("plugin:fs|rename_file", {
|
||||
oldPath,
|
||||
|
||||
@@ -5,7 +5,7 @@ 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")
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
|
||||
@@ -36,7 +36,7 @@ export type ShortcutHandler = (shortcut: string) => void;
|
||||
*/
|
||||
async function register(
|
||||
shortcut: string,
|
||||
handler: ShortcutHandler
|
||||
handler: ShortcutHandler,
|
||||
): Promise<void> {
|
||||
return await window.__TAURI_INVOKE__("plugin:globalShortcut|register", {
|
||||
shortcut,
|
||||
@@ -61,7 +61,7 @@ async function register(
|
||||
*/
|
||||
async function registerAll(
|
||||
shortcuts: string[],
|
||||
handler: ShortcutHandler
|
||||
handler: ShortcutHandler,
|
||||
): Promise<void> {
|
||||
return await window.__TAURI_INVOKE__("plugin:globalShortcut|register_all", {
|
||||
shortcuts,
|
||||
|
||||
@@ -5,7 +5,7 @@ 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")
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
|
||||
@@ -123,7 +123,7 @@ class Body {
|
||||
|
||||
const append = (
|
||||
key: string,
|
||||
v: string | Uint8Array | FilePart<Uint8Array> | File
|
||||
v: string | Uint8Array | FilePart<Uint8Array> | File,
|
||||
): void => {
|
||||
if (v !== null) {
|
||||
let r;
|
||||
@@ -208,12 +208,12 @@ class Body {
|
||||
* @since 2.0.0
|
||||
*/
|
||||
static bytes(
|
||||
bytes: Iterable<number> | ArrayLike<number> | ArrayBuffer
|
||||
bytes: Iterable<number> | ArrayLike<number> | ArrayBuffer,
|
||||
): Body {
|
||||
// stringifying Uint8Array doesn't return an array of numbers, so we create one here
|
||||
return new Body(
|
||||
"Bytes",
|
||||
Array.from(bytes instanceof ArrayBuffer ? new Uint8Array(bytes) : bytes)
|
||||
Array.from(bytes instanceof ArrayBuffer ? new Uint8Array(bytes) : bytes),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -349,7 +349,7 @@ class Client {
|
||||
} else if (response.ok) {
|
||||
throw Error(
|
||||
`Failed to parse response \`${response.data}\` as JSON: ${e};
|
||||
try setting the \`responseType\` option to \`ResponseType.Text\` or \`ResponseType.Binary\` if the API does not return a JSON response.`
|
||||
try setting the \`responseType\` option to \`ResponseType.Text\` or \`ResponseType.Binary\` if the API does not return a JSON response.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -400,7 +400,7 @@ class Client {
|
||||
async post<T>(
|
||||
url: string,
|
||||
body?: Body,
|
||||
options?: RequestOptions
|
||||
options?: RequestOptions,
|
||||
): Promise<Response<T>> {
|
||||
return this.request({
|
||||
method: "POST",
|
||||
@@ -430,7 +430,7 @@ class Client {
|
||||
async put<T>(
|
||||
url: string,
|
||||
body?: Body,
|
||||
options?: RequestOptions
|
||||
options?: RequestOptions,
|
||||
): Promise<Response<T>> {
|
||||
return this.request({
|
||||
method: "PUT",
|
||||
@@ -515,7 +515,7 @@ let defaultClient: Client | null = null;
|
||||
*/
|
||||
async function fetch<T>(
|
||||
url: string,
|
||||
options?: FetchOptions
|
||||
options?: FetchOptions,
|
||||
): Promise<Response<T>> {
|
||||
if (defaultClient === null) {
|
||||
defaultClient = await getClient();
|
||||
|
||||
@@ -5,7 +5,7 @@ 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")
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
|
||||
@@ -52,7 +52,7 @@ enum LogLevel {
|
||||
async function log(
|
||||
level: LogLevel,
|
||||
message: string,
|
||||
options?: LogOptions
|
||||
options?: LogOptions,
|
||||
): Promise<void> {
|
||||
const traces = new Error().stack?.split("\n").map((line) => line.split("@"));
|
||||
|
||||
@@ -95,7 +95,7 @@ async function log(
|
||||
*/
|
||||
export async function error(
|
||||
message: string,
|
||||
options?: LogOptions
|
||||
options?: LogOptions,
|
||||
): Promise<void> {
|
||||
await log(LogLevel.Error, message, options);
|
||||
}
|
||||
@@ -117,7 +117,7 @@ export async function error(
|
||||
*/
|
||||
export async function warn(
|
||||
message: string,
|
||||
options?: LogOptions
|
||||
options?: LogOptions,
|
||||
): Promise<void> {
|
||||
await log(LogLevel.Warn, message, options);
|
||||
}
|
||||
@@ -139,7 +139,7 @@ export async function warn(
|
||||
*/
|
||||
export async function info(
|
||||
message: string,
|
||||
options?: LogOptions
|
||||
options?: LogOptions,
|
||||
): Promise<void> {
|
||||
await log(LogLevel.Info, message, options);
|
||||
}
|
||||
@@ -161,7 +161,7 @@ export async function info(
|
||||
*/
|
||||
export async function debug(
|
||||
message: string,
|
||||
options?: LogOptions
|
||||
options?: LogOptions,
|
||||
): Promise<void> {
|
||||
await log(LogLevel.Debug, message, options);
|
||||
}
|
||||
@@ -183,7 +183,7 @@ export async function debug(
|
||||
*/
|
||||
export async function trace(
|
||||
message: string,
|
||||
options?: LogOptions
|
||||
options?: LogOptions,
|
||||
): Promise<void> {
|
||||
await log(LogLevel.Trace, message, options);
|
||||
}
|
||||
@@ -202,7 +202,7 @@ export async function attachConsole(): Promise<UnlistenFn> {
|
||||
// TODO: Investigate security/detect-unsafe-regex
|
||||
// eslint-disable-next-line no-control-regex, security/detect-unsafe-regex
|
||||
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,
|
||||
""
|
||||
"",
|
||||
);
|
||||
|
||||
switch (payload.level) {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"LICENSE"
|
||||
],
|
||||
"devDependencies": {
|
||||
"tslib": "^2.5.0"
|
||||
"tslib": "2.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.0.0-alpha.5"
|
||||
|
||||
@@ -5,7 +5,7 @@ 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")
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
|
||||
@@ -541,13 +541,13 @@ async function channels(): Promise<Channel[]> {
|
||||
}
|
||||
|
||||
async function onNotificationReceived(
|
||||
cb: (notification: Options) => void
|
||||
cb: (notification: Options) => void,
|
||||
): Promise<PluginListener> {
|
||||
return addPluginListener("notification", "notification", cb);
|
||||
}
|
||||
|
||||
async function onAction(
|
||||
cb: (notification: Options) => void
|
||||
cb: (notification: Options) => void,
|
||||
): Promise<PluginListener> {
|
||||
return addPluginListener("notification", "actionPerformed", cb);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ 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")
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"LICENSE"
|
||||
],
|
||||
"devDependencies": {
|
||||
"tslib": "^2.5.0"
|
||||
"tslib": "2.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.0.0-alpha.5"
|
||||
|
||||
@@ -5,7 +5,7 @@ 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")
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
|
||||
@@ -5,6 +5,16 @@
|
||||
- [`ebb2eb2`](https://github.com/tauri-apps/plugins-workspace/commit/ebb2eb2fe2ebfbb70530d16a983d396aa5829aa1)([#274](https://github.com/tauri-apps/plugins-workspace/pull/274)) Recursively unescape saved patterns before allowing/forbidding them. This effectively prevents `.persisted-scope` files from blowing up, which caused Out-Of-Memory issues, while automatically fixing existing broken files seamlessly.
|
||||
- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
|
||||
|
||||
## \[0.1.3]
|
||||
|
||||
- Split up fs and asset scopes. **This will reset the asset protocol scope once!**
|
||||
- [ad30286](https://github.com/tauri-apps/plugins-workspace/commit/ad3028646c96ed213a2f483823ffdc3c17b5fc1e) fix(persisted-scope): separately save asset protocol patterns ([#459](https://github.com/tauri-apps/plugins-workspace/pull/459)) on 2023-07-10
|
||||
|
||||
## \[0.1.2]
|
||||
|
||||
- Fix usage of directory patterns by removing glob asterisks at the end before allowing/forbidding them. This was causing them to be escaped, and so undesirable paths were allowed/forbidden while polluting the `.persisted_scope` file.
|
||||
- [9174b80](https://github.com/tauri-apps/plugins-workspace/commit/9174b808dc37154999c119fcc3f31258a9c5a3fb) \[persisted scope] fix: handle recursive directory correctly ([#455](https://github.com/tauri-apps/plugins-workspace/pull/455)) on 2023-06-29
|
||||
|
||||
## \[0.1.1]
|
||||
|
||||
- The MSRV was raised to 1.64!
|
||||
|
||||
@@ -15,17 +15,23 @@ use aho_corasick::AhoCorasick;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tauri::{
|
||||
plugin::{Builder, TauriPlugin},
|
||||
AppHandle, Manager, Runtime,
|
||||
GlobPattern, Manager, Runtime,
|
||||
};
|
||||
use tauri_plugin_fs::{FsExt, ScopeEvent as FsScopeEvent};
|
||||
#[cfg(feature = "protocol-asset")]
|
||||
use tauri::{FsScope, FsScopeEvent};
|
||||
use tauri_plugin_fs::{FsExt, Scope as FsPluginScope, ScopeEvent as FsPluginScopeEvent};
|
||||
|
||||
use std::{
|
||||
collections::HashSet,
|
||||
fs::{create_dir_all, File},
|
||||
io::Write,
|
||||
path::Path,
|
||||
};
|
||||
|
||||
// Using 2 separate files so that we don't have to think about write conflicts and not break backwards compat.
|
||||
const SCOPE_STATE_FILENAME: &str = ".persisted-scope";
|
||||
#[cfg(feature = "protocol-asset")]
|
||||
const ASSET_SCOPE_STATE_FILENAME: &str = ".persisted-scope-asset";
|
||||
|
||||
// Most of these patterns are just added to try to fix broken files in the wild.
|
||||
// After a while we can hopefully reduce it to something like [r"[?]", r"[*]", r"\\?\\\?\"]
|
||||
@@ -40,6 +46,70 @@ const PATTERNS: &[&str] = &[
|
||||
];
|
||||
const REPLACE_WITH: &[&str] = &[r"[", r"]", r"?", r"*", r"\?", r"\\?\", r"\\?\"];
|
||||
|
||||
trait ScopeExt {
|
||||
fn allow_file(&self, path: &Path);
|
||||
fn allow_directory(&self, path: &Path, recursive: bool);
|
||||
|
||||
fn forbid_file(&self, path: &Path);
|
||||
fn forbid_directory(&self, path: &Path, recursive: bool);
|
||||
|
||||
fn allowed_patterns(&self) -> HashSet<GlobPattern>;
|
||||
fn forbidden_patterns(&self) -> HashSet<GlobPattern>;
|
||||
}
|
||||
|
||||
impl ScopeExt for &FsPluginScope {
|
||||
fn allow_file(&self, path: &Path) {
|
||||
let _ = FsPluginScope::allow_file(self, path);
|
||||
}
|
||||
|
||||
fn allow_directory(&self, path: &Path, recursive: bool) {
|
||||
let _ = FsPluginScope::allow_directory(self, path, recursive);
|
||||
}
|
||||
|
||||
fn forbid_file(&self, path: &Path) {
|
||||
let _ = FsPluginScope::forbid_file(self, path);
|
||||
}
|
||||
|
||||
fn forbid_directory(&self, path: &Path, recursive: bool) {
|
||||
let _ = FsPluginScope::forbid_directory(self, path, recursive);
|
||||
}
|
||||
|
||||
fn allowed_patterns(&self) -> HashSet<GlobPattern> {
|
||||
FsPluginScope::allowed_patterns(self)
|
||||
}
|
||||
|
||||
fn forbidden_patterns(&self) -> HashSet<GlobPattern> {
|
||||
FsPluginScope::forbidden_patterns(self)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "protocol-asset")]
|
||||
impl ScopeExt for &FsScope {
|
||||
fn allow_file(&self, path: &Path) {
|
||||
let _ = FsScope::allow_file(self, path);
|
||||
}
|
||||
|
||||
fn allow_directory(&self, path: &Path, recursive: bool) {
|
||||
let _ = FsScope::allow_directory(self, path, recursive);
|
||||
}
|
||||
|
||||
fn forbid_file(&self, path: &Path) {
|
||||
let _ = FsScope::forbid_file(self, path);
|
||||
}
|
||||
|
||||
fn forbid_directory(&self, path: &Path, recursive: bool) {
|
||||
let _ = FsScope::forbid_directory(self, path, recursive);
|
||||
}
|
||||
|
||||
fn allowed_patterns(&self) -> HashSet<GlobPattern> {
|
||||
FsScope::allowed_patterns(self)
|
||||
}
|
||||
|
||||
fn forbidden_patterns(&self) -> HashSet<GlobPattern> {
|
||||
FsScope::forbidden_patterns(self)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
enum Error {
|
||||
#[error(transparent)]
|
||||
@@ -52,6 +122,14 @@ enum Error {
|
||||
Bincode(#[from] Box<bincode::ErrorKind>),
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Deserialize, Serialize, Eq, PartialEq, Hash)]
|
||||
enum TargetType {
|
||||
#[default]
|
||||
File,
|
||||
Directory,
|
||||
RecursiveDirectory,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Deserialize, Serialize)]
|
||||
struct Scope {
|
||||
allowed_paths: Vec<String>,
|
||||
@@ -68,85 +146,173 @@ fn fix_pattern(ac: &AhoCorasick, s: &str) -> String {
|
||||
s
|
||||
}
|
||||
|
||||
fn save_scopes<R: Runtime>(app: &AppHandle<R>, app_dir: &Path, scope_state_path: &Path) {
|
||||
if let Some(fs_scope) = app.try_fs_scope() {
|
||||
let scope = Scope {
|
||||
allowed_paths: fs_scope
|
||||
.allowed_patterns()
|
||||
.into_iter()
|
||||
.map(|p| p.to_string())
|
||||
.collect(),
|
||||
forbidden_patterns: fs_scope
|
||||
.forbidden_patterns()
|
||||
.into_iter()
|
||||
.map(|p| p.to_string())
|
||||
.collect(),
|
||||
};
|
||||
const RESURSIVE_DIRECTORY_SUFFIX: &str = "**";
|
||||
const DIRECTORY_SUFFIX: &str = "*";
|
||||
|
||||
let _ = create_dir_all(app_dir)
|
||||
.and_then(|_| File::create(scope_state_path))
|
||||
.map_err(Error::Io)
|
||||
.and_then(|mut f| {
|
||||
f.write_all(&bincode::serialize(&scope).map_err(Error::from)?)
|
||||
.map_err(Into::into)
|
||||
});
|
||||
fn detect_scope_type(scope_state_path: &str) -> TargetType {
|
||||
if scope_state_path.ends_with(RESURSIVE_DIRECTORY_SUFFIX) {
|
||||
TargetType::RecursiveDirectory
|
||||
} else if scope_state_path.ends_with(DIRECTORY_SUFFIX) {
|
||||
TargetType::Directory
|
||||
} else {
|
||||
TargetType::File
|
||||
}
|
||||
}
|
||||
|
||||
fn fix_directory(path_str: &str) -> &Path {
|
||||
let mut path = Path::new(path_str);
|
||||
|
||||
if path.ends_with(DIRECTORY_SUFFIX) || path.ends_with(RESURSIVE_DIRECTORY_SUFFIX) {
|
||||
path = match path.parent() {
|
||||
Some(value) => value,
|
||||
None => return path,
|
||||
};
|
||||
}
|
||||
|
||||
path
|
||||
}
|
||||
|
||||
fn allow_path(scope: impl ScopeExt, path: &str) {
|
||||
let target_type = detect_scope_type(path);
|
||||
|
||||
match target_type {
|
||||
TargetType::File => {
|
||||
scope.allow_file(Path::new(path));
|
||||
}
|
||||
TargetType::Directory => {
|
||||
// We remove the '*' at the end of it, else it will be escaped by the pattern.
|
||||
scope.allow_directory(fix_directory(path), false);
|
||||
}
|
||||
TargetType::RecursiveDirectory => {
|
||||
// We remove the '**' at the end of it, else it will be escaped by the pattern.
|
||||
scope.allow_directory(fix_directory(path), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn forbid_path(scope: impl ScopeExt, path: &str) {
|
||||
let target_type = detect_scope_type(path);
|
||||
|
||||
match target_type {
|
||||
TargetType::File => {
|
||||
scope.forbid_file(Path::new(path));
|
||||
}
|
||||
TargetType::Directory => {
|
||||
scope.forbid_directory(fix_directory(path), false);
|
||||
}
|
||||
TargetType::RecursiveDirectory => {
|
||||
scope.forbid_directory(fix_directory(path), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn save_scopes(scope: impl ScopeExt, app_dir: &Path, scope_state_path: &Path) {
|
||||
let scope = Scope {
|
||||
allowed_paths: scope
|
||||
.allowed_patterns()
|
||||
.into_iter()
|
||||
.map(|p| p.to_string())
|
||||
.collect(),
|
||||
forbidden_patterns: scope
|
||||
.forbidden_patterns()
|
||||
.into_iter()
|
||||
.map(|p| p.to_string())
|
||||
.collect(),
|
||||
};
|
||||
|
||||
let _ = create_dir_all(app_dir)
|
||||
.and_then(|_| File::create(scope_state_path))
|
||||
.map_err(Error::Io)
|
||||
.and_then(|mut f| {
|
||||
f.write_all(&bincode::serialize(&scope).map_err(Error::from)?)
|
||||
.map_err(Into::into)
|
||||
});
|
||||
}
|
||||
|
||||
pub fn init<R: Runtime>() -> TauriPlugin<R> {
|
||||
Builder::new("persisted-scope")
|
||||
.setup(|app, _api| {
|
||||
let fs_scope = app.try_fs_scope();
|
||||
let core_scopes = app.state::<tauri::scope::Scopes>();
|
||||
#[cfg(feature = "protocol-asset")]
|
||||
let asset_protocol_scope = app.asset_protocol_scope();
|
||||
let app = app.clone();
|
||||
let app_dir = app.path().app_data_dir();
|
||||
|
||||
if let Ok(app_dir) = app_dir {
|
||||
let scope_state_path = app_dir.join(SCOPE_STATE_FILENAME);
|
||||
let fs_scope_state_path = app_dir.join(SCOPE_STATE_FILENAME);
|
||||
#[cfg(feature = "protocol-asset")]
|
||||
let asset_scope_state_path = app_dir.join(ASSET_SCOPE_STATE_FILENAME);
|
||||
|
||||
if let Some(s) = fs_scope {
|
||||
let _ = s.forbid_file(&scope_state_path);
|
||||
}
|
||||
let _ = core_scopes.forbid_file(&scope_state_path);
|
||||
if let Some(fs_scope) = fs_scope {
|
||||
let _ = fs_scope.forbid_file(&fs_scope_state_path);}
|
||||
#[cfg(feature = "protocol-asset")]
|
||||
let _ = asset_protocol_scope.forbid_file(&asset_scope_state_path);
|
||||
|
||||
// We're trying to fix broken .persisted-scope files seamlessly, so we'll be running this on the values read on the saved file.
|
||||
// We will still save some semi-broken values because the scope events are quite spammy and we don't want to reduce runtime performance any further.
|
||||
let ac = AhoCorasick::new(PATTERNS).unwrap(/* This should be impossible to fail since we're using a small static input */);
|
||||
|
||||
if scope_state_path.exists() {
|
||||
let scope: Scope = tauri::api::file::read_binary(&scope_state_path)
|
||||
if let Some(fs_scope) = fs_scope {
|
||||
if fs_scope_state_path.exists() {
|
||||
let scope: Scope = tauri::api::file::read_binary(&fs_scope_state_path)
|
||||
.map_err(Error::from)
|
||||
.and_then(|scope| bincode::deserialize(&scope).map_err(Into::into))
|
||||
.unwrap_or_default();
|
||||
|
||||
for allowed in &scope.allowed_paths {
|
||||
let allowed = fix_pattern(&ac, allowed);
|
||||
|
||||
if let Some(s) = fs_scope {
|
||||
let _ = s.allow_file(&allowed);
|
||||
}
|
||||
let _ = core_scopes.allow_file(&allowed);
|
||||
allow_path(fs_scope, &allowed);
|
||||
}
|
||||
for forbidden in &scope.forbidden_patterns {
|
||||
let forbidden = fix_pattern(&ac, forbidden);
|
||||
|
||||
if let Some(s) = fs_scope {
|
||||
let _ = s.forbid_file(&forbidden);
|
||||
}
|
||||
let _ = core_scopes.forbid_file(&forbidden);
|
||||
forbid_path(fs_scope, &forbidden);
|
||||
}
|
||||
|
||||
// Manually save the fixed scopes to disk once.
|
||||
// This is needed to fix broken .peristed-scope files in case the app doesn't update the scope itself.
|
||||
save_scopes(&app, &app_dir, &scope_state_path);
|
||||
save_scopes(fs_scope, &app_dir, &fs_scope_state_path);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(s) = fs_scope {
|
||||
s.listen(move |event| {
|
||||
if let FsScopeEvent::PathAllowed(_) = event {
|
||||
save_scopes(&app, &app_dir, &scope_state_path);
|
||||
#[cfg(feature = "protocol-asset")]
|
||||
if asset_scope_state_path.exists() {
|
||||
let scope: Scope = tauri::api::file::read_binary(&asset_scope_state_path)
|
||||
.map_err(Error::from)
|
||||
.and_then(|scope| bincode::deserialize(&scope).map_err(Into::into))
|
||||
.unwrap_or_default();
|
||||
|
||||
for allowed in &scope.allowed_paths {
|
||||
let allowed = fix_pattern(&ac, allowed);
|
||||
allow_path(&asset_protocol_scope, &allowed);
|
||||
}
|
||||
for forbidden in &scope.forbidden_patterns {
|
||||
let forbidden = fix_pattern(&ac, forbidden);
|
||||
forbid_path(&asset_protocol_scope, &forbidden);
|
||||
}
|
||||
|
||||
// Manually save the fixed scopes to disk once.
|
||||
save_scopes(&asset_protocol_scope, &app_dir, &asset_scope_state_path);
|
||||
}
|
||||
|
||||
#[cfg(feature = "protocol-asset")]
|
||||
let app_dir_ = app_dir.clone();
|
||||
if let Some(fs_scope) = fs_scope {
|
||||
let fs_scope_ = fs_scope.clone();
|
||||
fs_scope.listen(move |event| {
|
||||
if let FsPluginScopeEvent::PathAllowed(_) = event {
|
||||
save_scopes(&fs_scope_, &app_dir, &fs_scope_state_path);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(feature = "protocol-asset")]
|
||||
{
|
||||
let asset_protocol_scope_ = asset_protocol_scope.clone();
|
||||
asset_protocol_scope.listen(move |event| {
|
||||
if let FsScopeEvent::PathAllowed(_) = event {
|
||||
save_scopes(&asset_protocol_scope_, &app_dir_, &asset_scope_state_path);
|
||||
}
|
||||
});}
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"LICENSE"
|
||||
],
|
||||
"devDependencies": {
|
||||
"tslib": "^2.5.0"
|
||||
"tslib": "2.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.0.0-alpha.5"
|
||||
|
||||
@@ -5,7 +5,7 @@ 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")
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"LICENSE"
|
||||
],
|
||||
"devDependencies": {
|
||||
"tslib": "^2.5.0"
|
||||
"tslib": "2.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.0.0-alpha.5"
|
||||
|
||||
@@ -5,7 +5,7 @@ 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")
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
|
||||
@@ -122,7 +122,7 @@ async function execute<O extends IOPayload>(
|
||||
onEvent: (event: CommandEvent<O>) => void,
|
||||
program: string,
|
||||
args: string | string[] = [],
|
||||
options?: InternalSpawnOptions
|
||||
options?: InternalSpawnOptions,
|
||||
): Promise<number> {
|
||||
if (typeof args === "object") {
|
||||
Object.freeze(args);
|
||||
@@ -153,7 +153,7 @@ class EventEmitter<E extends Record<string, any>> {
|
||||
*/
|
||||
addListener<N extends keyof E>(
|
||||
eventName: N,
|
||||
listener: (arg: E[typeof eventName]) => void
|
||||
listener: (arg: E[typeof eventName]) => void,
|
||||
): this {
|
||||
return this.on(eventName, listener);
|
||||
}
|
||||
@@ -165,7 +165,7 @@ class EventEmitter<E extends Record<string, any>> {
|
||||
*/
|
||||
removeListener<N extends keyof E>(
|
||||
eventName: N,
|
||||
listener: (arg: E[typeof eventName]) => void
|
||||
listener: (arg: E[typeof eventName]) => void,
|
||||
): this {
|
||||
return this.off(eventName, listener);
|
||||
}
|
||||
@@ -182,7 +182,7 @@ class EventEmitter<E extends Record<string, any>> {
|
||||
*/
|
||||
on<N extends keyof E>(
|
||||
eventName: N,
|
||||
listener: (arg: E[typeof eventName]) => void
|
||||
listener: (arg: E[typeof eventName]) => void,
|
||||
): this {
|
||||
if (eventName in this.eventListeners) {
|
||||
// eslint-disable-next-line security/detect-object-injection
|
||||
@@ -204,7 +204,7 @@ class EventEmitter<E extends Record<string, any>> {
|
||||
*/
|
||||
once<N extends keyof E>(
|
||||
eventName: N,
|
||||
listener: (arg: E[typeof eventName]) => void
|
||||
listener: (arg: E[typeof eventName]) => void,
|
||||
): this {
|
||||
const wrapper = (arg: E[typeof eventName]): void => {
|
||||
this.removeListener(eventName, wrapper);
|
||||
@@ -222,12 +222,12 @@ class EventEmitter<E extends Record<string, any>> {
|
||||
*/
|
||||
off<N extends keyof E>(
|
||||
eventName: N,
|
||||
listener: (arg: E[typeof eventName]) => void
|
||||
listener: (arg: E[typeof eventName]) => void,
|
||||
): this {
|
||||
if (eventName in this.eventListeners) {
|
||||
// eslint-disable-next-line security/detect-object-injection
|
||||
this.eventListeners[eventName] = this.eventListeners[eventName].filter(
|
||||
(l) => l !== listener
|
||||
(l) => l !== listener,
|
||||
);
|
||||
}
|
||||
return this;
|
||||
@@ -295,7 +295,7 @@ class EventEmitter<E extends Record<string, any>> {
|
||||
*/
|
||||
prependListener<N extends keyof E>(
|
||||
eventName: N,
|
||||
listener: (arg: E[typeof eventName]) => void
|
||||
listener: (arg: E[typeof eventName]) => void,
|
||||
): this {
|
||||
if (eventName in this.eventListeners) {
|
||||
// eslint-disable-next-line security/detect-object-injection
|
||||
@@ -317,7 +317,7 @@ class EventEmitter<E extends Record<string, any>> {
|
||||
*/
|
||||
prependOnceListener<N extends keyof E>(
|
||||
eventName: N,
|
||||
listener: (arg: E[typeof eventName]) => void
|
||||
listener: (arg: E[typeof eventName]) => void,
|
||||
): this {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const wrapper = (arg: any): void => {
|
||||
@@ -434,7 +434,7 @@ class Command<O extends IOPayload> extends EventEmitter<CommandEvents> {
|
||||
private constructor(
|
||||
program: string,
|
||||
args: string | string[] = [],
|
||||
options?: SpawnOptions
|
||||
options?: SpawnOptions,
|
||||
) {
|
||||
super();
|
||||
this.program = program;
|
||||
@@ -446,12 +446,12 @@ class Command<O extends IOPayload> extends EventEmitter<CommandEvents> {
|
||||
static create(
|
||||
program: string,
|
||||
args?: string | string[],
|
||||
options?: SpawnOptions & { encoding: "raw" }
|
||||
options?: SpawnOptions & { encoding: "raw" },
|
||||
): Command<Uint8Array>;
|
||||
static create(
|
||||
program: string,
|
||||
args?: string | string[],
|
||||
options?: SpawnOptions
|
||||
options?: SpawnOptions,
|
||||
): Command<string>;
|
||||
|
||||
/**
|
||||
@@ -469,7 +469,7 @@ class Command<O extends IOPayload> extends EventEmitter<CommandEvents> {
|
||||
static create<O extends IOPayload>(
|
||||
program: string,
|
||||
args: string | string[] = [],
|
||||
options?: SpawnOptions
|
||||
options?: SpawnOptions,
|
||||
): Command<O> {
|
||||
return new Command(program, args, options);
|
||||
}
|
||||
@@ -478,12 +478,12 @@ class Command<O extends IOPayload> extends EventEmitter<CommandEvents> {
|
||||
static sidecar(
|
||||
program: string,
|
||||
args?: string | string[],
|
||||
options?: SpawnOptions & { encoding: "raw" }
|
||||
options?: SpawnOptions & { encoding: "raw" },
|
||||
): Command<Uint8Array>;
|
||||
static sidecar(
|
||||
program: string,
|
||||
args?: string | string[],
|
||||
options?: SpawnOptions
|
||||
options?: SpawnOptions,
|
||||
): Command<string>;
|
||||
|
||||
/**
|
||||
@@ -501,7 +501,7 @@ class Command<O extends IOPayload> extends EventEmitter<CommandEvents> {
|
||||
static sidecar<O extends IOPayload>(
|
||||
program: string,
|
||||
args: string | string[] = [],
|
||||
options?: SpawnOptions
|
||||
options?: SpawnOptions,
|
||||
): Command<O> {
|
||||
const instance = new Command<O>(program, args, options);
|
||||
instance.options.sidecar = true;
|
||||
@@ -535,7 +535,7 @@ class Command<O extends IOPayload> extends EventEmitter<CommandEvents> {
|
||||
},
|
||||
this.program,
|
||||
this.args,
|
||||
this.options
|
||||
this.options,
|
||||
).then((pid) => new Child(pid));
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ 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")
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
if (
|
||||
target.href &&
|
||||
["http://", "https://", "mailto:", "tel:"].some((v) =>
|
||||
target.href.startsWith(v)
|
||||
target.href.startsWith(v),
|
||||
) &&
|
||||
target.target === "_blank"
|
||||
) {
|
||||
|
||||
-106
@@ -1,106 +0,0 @@
|
||||
lockfileVersion: 5.4
|
||||
|
||||
specifiers:
|
||||
'@tauri-apps/cli': ^1.0.0
|
||||
|
||||
dependencies:
|
||||
'@tauri-apps/cli': 1.0.2
|
||||
|
||||
packages:
|
||||
|
||||
/@tauri-apps/cli-darwin-arm64/1.0.2:
|
||||
resolution: {integrity: sha512-Ahd951yoYon1+WLNBg6xsx6Bb7+GJt7WwC1FllHZ2/iLCbrtWCS2qfeLS0L4ngBqCuWyL35JC/M2LIr9mcUzrg==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@tauri-apps/cli-darwin-x64/1.0.2:
|
||||
resolution: {integrity: sha512-8wo+SN1zWoXFQVa/iyEt3Cs0vNMjxDXqVe3Srm4UNpgKboFN5mIgbugwqvM+aJKnEZAH8h8n+ZJUHzc4wtPGHA==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@tauri-apps/cli-linux-arm-gnueabihf/1.0.2:
|
||||
resolution: {integrity: sha512-PGQghMn0adt9PTnyi2K2o/CLG3tWbOyZvwQjam5cfQbK757WmMgPErC1VqsxiQc+PItWYvqoE9gjANiFc2MpAQ==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@tauri-apps/cli-linux-arm64-gnu/1.0.2:
|
||||
resolution: {integrity: sha512-Uc+XNlWelrnRh7DYrdxBi8Oam9JAQM1GzgEwjupF6Pv7BwlODN7s0HImGPQOKrEkqzpfmYw7KpfgWiiEjS5/3Q==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@tauri-apps/cli-linux-arm64-musl/1.0.2:
|
||||
resolution: {integrity: sha512-lVwCG1QzQs2zWP32H4+Dw8NKgJ6hBox2X+bmawGfV9Ce+K4P84bnqfNgpdaSAncjeiTjrO+g7yT9gJFQCOrjlQ==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@tauri-apps/cli-linux-x64-gnu/1.0.2:
|
||||
resolution: {integrity: sha512-G2XmGxvufW9sgGhA3rx+HehcifVTUo8zyISd8DpvGwtpp6Z4WakbivzKFyGiNnnok0nvj/WUrLgBxtUbfdSY+A==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@tauri-apps/cli-linux-x64-musl/1.0.2:
|
||||
resolution: {integrity: sha512-/eX536p+KXSmkFuINGeU6EQmYiQEXj6JXbmetmJmkXN0297HbtH3rS3wlyVDCnobRzh1hMeOJEnV+XA20GghMA==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@tauri-apps/cli-win32-ia32-msvc/1.0.2:
|
||||
resolution: {integrity: sha512-ZvnaKkCABqUbyUKlNk4RdxKyfOte30D5BxN1pj6iZNeKAwXEuTcgP6iPzOovdeaDirkIjcWCEZymwtZDXN4Rvg==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [ia32]
|
||||
os: [win32]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@tauri-apps/cli-win32-x64-msvc/1.0.2:
|
||||
resolution: {integrity: sha512-uMcQyQQD7nyxps34HyYBYUYzFwH26lP58/qdT/GZWvBL1Sv2rqkQXuxHT7xtp4g7nTs0fGRWOtfcnvYIr/1wDw==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@tauri-apps/cli/1.0.2:
|
||||
resolution: {integrity: sha512-OJdQJVwtKnTAuv2a9JQlOd0gHbbGsXwT+N6M6YQiXZ3/5WdlXey1zhnD78GXwZsf8Cz0R7QIGTBECO4ur4fnKg==}
|
||||
engines: {node: '>= 10'}
|
||||
hasBin: true
|
||||
optionalDependencies:
|
||||
'@tauri-apps/cli-darwin-arm64': 1.0.2
|
||||
'@tauri-apps/cli-darwin-x64': 1.0.2
|
||||
'@tauri-apps/cli-linux-arm-gnueabihf': 1.0.2
|
||||
'@tauri-apps/cli-linux-arm64-gnu': 1.0.2
|
||||
'@tauri-apps/cli-linux-arm64-musl': 1.0.2
|
||||
'@tauri-apps/cli-linux-x64-gnu': 1.0.2
|
||||
'@tauri-apps/cli-linux-x64-musl': 1.0.2
|
||||
'@tauri-apps/cli-win32-ia32-msvc': 1.0.2
|
||||
'@tauri-apps/cli-win32-x64-msvc': 1.0.2
|
||||
dev: false
|
||||
@@ -7,7 +7,7 @@ description = "A Tauri App"
|
||||
authors = [ "You" ]
|
||||
repository = ""
|
||||
edition = "2021"
|
||||
rust-version = "1.57"
|
||||
rust-version = "1.65"
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
|
||||
@@ -17,7 +17,7 @@ tauri = { workspace = true }
|
||||
log = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
futures-core = "0.3"
|
||||
sqlx = { version = "0.6", features = [ "runtime-tokio-rustls", "json", "time" ] }
|
||||
sqlx = { version = "0.7", features = [ "runtime-tokio-rustls", "json", "time" ] }
|
||||
time = "0.3"
|
||||
tokio = { version = "1", features = [ "sync" ] }
|
||||
|
||||
|
||||
@@ -74,6 +74,37 @@ const db = await Database.load("postgres://postgres:password@localhost/test");
|
||||
await db.execute("INSERT INTO ...");
|
||||
```
|
||||
|
||||
## Syntax
|
||||
|
||||
We use sqlx as our underlying library, adopting their query syntax:
|
||||
|
||||
- sqlite and postgres use the "$#" syntax when substituting query data
|
||||
- mysql uses "?" when substituting query data
|
||||
|
||||
```javascript
|
||||
// INSERT and UPDATE examples for sqlite and postgres
|
||||
const result = await db.execute(
|
||||
"INSERT into todos (id, title, status) VALUES ($1, $2, $3)",
|
||||
[todos.id, todos.title, todos.status],
|
||||
);
|
||||
|
||||
const result = await db.execute(
|
||||
"UPDATE todos SET title = $1, completed = $2 WHERE id = $3",
|
||||
[todos.title, todos.status, todos.id],
|
||||
);
|
||||
|
||||
// INSERT and UPDATE examples for mysql
|
||||
const result = await db.execute(
|
||||
"INSERT into todos (id, title, status) VALUES (?, ?, ?)",
|
||||
[todos.id, todos.title, todos.status],
|
||||
);
|
||||
|
||||
const result = await db.execute(
|
||||
"UPDATE todos SET title = ?, completed = ? WHERE id = ?",
|
||||
[todos.title, todos.status, todos.id],
|
||||
);
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
PRs accepted. Please make sure to read the Contributing Guide before making a pull request.
|
||||
|
||||
@@ -84,10 +84,29 @@ export default class Database {
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* // for sqlite & postgres
|
||||
* // INSERT example
|
||||
* const result = await db.execute(
|
||||
* "INSERT into todos (id, title, status) VALUES ($1, $2, $3)",
|
||||
* [ todos.id, todos.title, todos.status ]
|
||||
* );
|
||||
* // UPDATE example
|
||||
* const result = await db.execute(
|
||||
* "UPDATE todos SET title = $1, completed = $2 WHERE id = $3",
|
||||
* [ todos.title, todos.status, todos.id ]
|
||||
* );
|
||||
*
|
||||
* // for mysql
|
||||
* // INSERT example
|
||||
* const result = await db.execute(
|
||||
* "INSERT into todos (id, title, status) VALUES (?, ?, ?)",
|
||||
* [ todos.id, todos.title, todos.status ]
|
||||
* );
|
||||
* // UPDATE example
|
||||
* const result = await db.execute(
|
||||
* "UPDATE todos SET title = ?, completed = ? WHERE id = ?",
|
||||
* [ todos.title, todos.status, todos.id ]
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
async execute(query: string, bindValues?: unknown[]): Promise<QueryResult> {
|
||||
@@ -104,7 +123,6 @@ export default class Database {
|
||||
rowsAffected,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* **select**
|
||||
*
|
||||
@@ -112,9 +130,15 @@ export default class Database {
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* // for sqlite & postgres
|
||||
* const result = await db.select(
|
||||
* "SELECT * from todos WHERE id = $1", id
|
||||
* );
|
||||
*
|
||||
* // for mysql
|
||||
* const result = await db.select(
|
||||
* "SELECT * from todos WHERE id = ?", id
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
async select<T>(query: string, bindValues?: unknown[]): Promise<T> {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"LICENSE"
|
||||
],
|
||||
"devDependencies": {
|
||||
"tslib": "^2.5.0"
|
||||
"tslib": "2.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.0.0-alpha.5"
|
||||
|
||||
@@ -5,7 +5,7 @@ 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")
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
|
||||
@@ -184,7 +184,7 @@ export class Store {
|
||||
*/
|
||||
async onKeyChange<T>(
|
||||
key: string,
|
||||
cb: (value: T | null) => void
|
||||
cb: (value: T | null) => void,
|
||||
): Promise<UnlistenFn> {
|
||||
return await listen<ChangePayload<T>>("store://change", (event) => {
|
||||
if (event.payload.path === this.path && event.payload.key === key) {
|
||||
@@ -201,7 +201,7 @@ export class Store {
|
||||
* @since 2.0.0
|
||||
*/
|
||||
async onChange<T>(
|
||||
cb: (key: string, value: T | null) => void
|
||||
cb: (key: string, value: T | null) => void,
|
||||
): Promise<UnlistenFn> {
|
||||
return await listen<ChangePayload<T>>("store://change", (event) => {
|
||||
if (event.payload.path === this.path) {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"LICENSE"
|
||||
],
|
||||
"devDependencies": {
|
||||
"tslib": "^2.5.0"
|
||||
"tslib": "2.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.0.0-alpha.5"
|
||||
|
||||
@@ -5,7 +5,7 @@ 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")
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ tauri = { workspace = true }
|
||||
log = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
iota_stronghold = "1"
|
||||
iota-crypto = "0.20"
|
||||
iota-crypto = "0.23"
|
||||
hex = "0.4"
|
||||
zeroize = { version = "1", features = [ "zeroize_derive" ] }
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ export type StoreKey =
|
||||
| ArrayBuffer;
|
||||
|
||||
function toBytesDto(
|
||||
v: ClientPath | VaultPath | RecordPath | StoreKey
|
||||
v: ClientPath | VaultPath | RecordPath | StoreKey,
|
||||
): string | number[] {
|
||||
if (typeof v === "string") {
|
||||
return v;
|
||||
@@ -133,7 +133,7 @@ class ProcedureExecutor {
|
||||
*/
|
||||
async generateSLIP10Seed(
|
||||
outputLocation: Location,
|
||||
sizeBytes?: number
|
||||
sizeBytes?: number,
|
||||
): Promise<Uint8Array> {
|
||||
return await window
|
||||
.__TAURI_INVOKE__<number[]>("plugin:stronghold|execute_procedure", {
|
||||
@@ -162,7 +162,7 @@ class ProcedureExecutor {
|
||||
chain: number[],
|
||||
source: "Seed" | "Key",
|
||||
sourceLocation: Location,
|
||||
outputLocation: Location
|
||||
outputLocation: Location,
|
||||
): Promise<Uint8Array> {
|
||||
return await window
|
||||
.__TAURI_INVOKE__<number[]>("plugin:stronghold|execute_procedure", {
|
||||
@@ -193,7 +193,7 @@ class ProcedureExecutor {
|
||||
async recoverBIP39(
|
||||
mnemonic: string,
|
||||
outputLocation: Location,
|
||||
passphrase?: string
|
||||
passphrase?: string,
|
||||
): Promise<Uint8Array> {
|
||||
return await window
|
||||
.__TAURI_INVOKE__<number[]>("plugin:stronghold|execute_procedure", {
|
||||
@@ -219,7 +219,7 @@ class ProcedureExecutor {
|
||||
*/
|
||||
async generateBIP39(
|
||||
outputLocation: Location,
|
||||
passphrase?: string
|
||||
passphrase?: string,
|
||||
): Promise<Uint8Array> {
|
||||
return await window
|
||||
.__TAURI_INVOKE__<number[]>("plugin:stronghold|execute_procedure", {
|
||||
@@ -267,7 +267,7 @@ class ProcedureExecutor {
|
||||
*/
|
||||
async signEd25519(
|
||||
privateKeyLocation: Location,
|
||||
msg: string
|
||||
msg: string,
|
||||
): Promise<Uint8Array> {
|
||||
return await window
|
||||
.__TAURI_INVOKE__<number[]>("plugin:stronghold|execute_procedure", {
|
||||
@@ -317,20 +317,20 @@ export class Store {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
async get(key: StoreKey): Promise<Uint8Array> {
|
||||
async get(key: StoreKey): Promise<Uint8Array | null> {
|
||||
return await window
|
||||
.__TAURI_INVOKE__<number[]>("plugin:stronghold|get_store_record", {
|
||||
snapshotPath: this.path,
|
||||
client: this.client,
|
||||
key: toBytesDto(key),
|
||||
})
|
||||
.then((v) => Uint8Array.from(v));
|
||||
.then((v) => (v != null ? Uint8Array.from(v) : null));
|
||||
}
|
||||
|
||||
async insert(
|
||||
key: StoreKey,
|
||||
value: number[],
|
||||
lifetime?: Duration
|
||||
lifetime?: Duration,
|
||||
): Promise<void> {
|
||||
return await window.__TAURI_INVOKE__(
|
||||
"plugin:stronghold|save_store_record",
|
||||
@@ -340,7 +340,7 @@ export class Store {
|
||||
key: toBytesDto(key),
|
||||
value,
|
||||
lifetime,
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ export class Store {
|
||||
snapshotPath: this.path,
|
||||
client: this.client,
|
||||
key: toBytesDto(key),
|
||||
}
|
||||
},
|
||||
)
|
||||
.then((v) => (v != null ? Uint8Array.from(v) : null));
|
||||
}
|
||||
@@ -409,7 +409,7 @@ export class Vault extends ProcedureExecutor {
|
||||
snapshotPath: this.path,
|
||||
client: this.client,
|
||||
vault: this.name,
|
||||
location,
|
||||
recordPath: location.payload.record,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"LICENSE"
|
||||
],
|
||||
"devDependencies": {
|
||||
"tslib": "^2.5.0"
|
||||
"tslib": "2.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.0.0-alpha.5"
|
||||
|
||||
@@ -5,7 +5,7 @@ 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")
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
|
||||
@@ -1 +1 @@
|
||||
if("__TAURI__"in window){var __TAURI_STRONGHOLD__=function(t){"use strict";function e(t){return"string"==typeof t?t:Array.from(t instanceof ArrayBuffer?new Uint8Array(t):t)}class r{constructor(t,e){this.type=t,this.payload=e}static generic(t,n){return new r("Generic",{vault:e(t),record:e(n)})}static counter(t,n){return new r("Counter",{vault:e(t),counter:n})}}class n{constructor(t){this.procedureArgs=t}async generateSLIP10Seed(t,e){return await window.__TAURI_INVOKE__("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"SLIP10Generate",payload:{output:t,sizeBytes:e}}}).then((t=>Uint8Array.from(t)))}async deriveSLIP10(t,e,r,n){return await window.__TAURI_INVOKE__("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"SLIP10Derive",payload:{chain:t,input:{type:e,payload:r},output:n}}}).then((t=>Uint8Array.from(t)))}async recoverBIP39(t,e,r){return await window.__TAURI_INVOKE__("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"BIP39Recover",payload:{mnemonic:t,passphrase:r,output:e}}}).then((t=>Uint8Array.from(t)))}async generateBIP39(t,e){return await window.__TAURI_INVOKE__("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"BIP39Generate",payload:{output:t,passphrase:e}}}).then((t=>Uint8Array.from(t)))}async getEd25519PublicKey(t){return await window.__TAURI_INVOKE__("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"PublicKey",payload:{type:"Ed25519",privateKey:t}}}).then((t=>Uint8Array.from(t)))}async signEd25519(t,e){return await window.__TAURI_INVOKE__("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"Ed25519Sign",payload:{privateKey:t,msg:e}}}).then((t=>Uint8Array.from(t)))}}class a{constructor(t,r){this.path=t,this.name=e(r)}getVault(t){return new s(this.path,this.name,e(t))}getStore(){return new i(this.path,this.name)}}class i{constructor(t,e){this.path=t,this.client=e}async get(t){return await window.__TAURI_INVOKE__("plugin:stronghold|get_store_record",{snapshotPath:this.path,client:this.client,key:e(t)}).then((t=>Uint8Array.from(t)))}async insert(t,r,n){return await window.__TAURI_INVOKE__("plugin:stronghold|save_store_record",{snapshotPath:this.path,client:this.client,key:e(t),value:r,lifetime:n})}async remove(t){return await window.__TAURI_INVOKE__("plugin:stronghold|remove_store_record",{snapshotPath:this.path,client:this.client,key:e(t)}).then((t=>null!=t?Uint8Array.from(t):null))}}class s extends n{constructor(t,r,n){super({snapshotPath:t,client:r,vault:n}),this.path=t,this.client=e(r),this.name=e(n)}async insert(t,r){return await window.__TAURI_INVOKE__("plugin:stronghold|save_secret",{snapshotPath:this.path,client:this.client,vault:this.name,recordPath:e(t),secret:r})}async remove(t){return await window.__TAURI_INVOKE__("plugin:stronghold|remove_secret",{snapshotPath:this.path,client:this.client,vault:this.name,location:t})}}class o{constructor(t){this.path=t}static async load(t,e){return await window.__TAURI_INVOKE__("plugin:stronghold|initialize",{snapshotPath:t,password:e}).then((()=>new o(t)))}async unload(){return await window.__TAURI_INVOKE__("plugin:stronghold|destroy",{snapshotPath:this.path})}async loadClient(t){return await window.__TAURI_INVOKE__("plugin:stronghold|load_client",{snapshotPath:this.path,client:e(t)}).then((()=>new a(this.path,t)))}async createClient(t){return await window.__TAURI_INVOKE__("plugin:stronghold|create_client",{snapshotPath:this.path,client:e(t)}).then((()=>new a(this.path,t)))}async save(){return await window.__TAURI_INVOKE__("plugin:stronghold|save",{snapshotPath:this.path})}}return t.Client=a,t.Location=r,t.Store=i,t.Stronghold=o,t.Vault=s,t}({});Object.defineProperty(window.__TAURI__,"stronghold",{value:__TAURI_STRONGHOLD__})}
|
||||
if("__TAURI__"in window){var __TAURI_STRONGHOLD__=function(t){"use strict";function e(t){return"string"==typeof t?t:Array.from(t instanceof ArrayBuffer?new Uint8Array(t):t)}class r{constructor(t,e){this.type=t,this.payload=e}static generic(t,n){return new r("Generic",{vault:e(t),record:e(n)})}static counter(t,n){return new r("Counter",{vault:e(t),counter:n})}}class n{constructor(t){this.procedureArgs=t}async generateSLIP10Seed(t,e){return await window.__TAURI_INVOKE__("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"SLIP10Generate",payload:{output:t,sizeBytes:e}}}).then((t=>Uint8Array.from(t)))}async deriveSLIP10(t,e,r,n){return await window.__TAURI_INVOKE__("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"SLIP10Derive",payload:{chain:t,input:{type:e,payload:r},output:n}}}).then((t=>Uint8Array.from(t)))}async recoverBIP39(t,e,r){return await window.__TAURI_INVOKE__("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"BIP39Recover",payload:{mnemonic:t,passphrase:r,output:e}}}).then((t=>Uint8Array.from(t)))}async generateBIP39(t,e){return await window.__TAURI_INVOKE__("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"BIP39Generate",payload:{output:t,passphrase:e}}}).then((t=>Uint8Array.from(t)))}async getEd25519PublicKey(t){return await window.__TAURI_INVOKE__("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"PublicKey",payload:{type:"Ed25519",privateKey:t}}}).then((t=>Uint8Array.from(t)))}async signEd25519(t,e){return await window.__TAURI_INVOKE__("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"Ed25519Sign",payload:{privateKey:t,msg:e}}}).then((t=>Uint8Array.from(t)))}}class a{constructor(t,r){this.path=t,this.name=e(r)}getVault(t){return new s(this.path,this.name,e(t))}getStore(){return new o(this.path,this.name)}}class o{constructor(t,e){this.path=t,this.client=e}async get(t){return await window.__TAURI_INVOKE__("plugin:stronghold|get_store_record",{snapshotPath:this.path,client:this.client,key:e(t)}).then((t=>null!=t?Uint8Array.from(t):null))}async insert(t,r,n){return await window.__TAURI_INVOKE__("plugin:stronghold|save_store_record",{snapshotPath:this.path,client:this.client,key:e(t),value:r,lifetime:n})}async remove(t){return await window.__TAURI_INVOKE__("plugin:stronghold|remove_store_record",{snapshotPath:this.path,client:this.client,key:e(t)}).then((t=>null!=t?Uint8Array.from(t):null))}}class s extends n{constructor(t,r,n){super({snapshotPath:t,client:r,vault:n}),this.path=t,this.client=e(r),this.name=e(n)}async insert(t,r){return await window.__TAURI_INVOKE__("plugin:stronghold|save_secret",{snapshotPath:this.path,client:this.client,vault:this.name,recordPath:e(t),secret:r})}async remove(t){return await window.__TAURI_INVOKE__("plugin:stronghold|remove_secret",{snapshotPath:this.path,client:this.client,vault:this.name,recordPath:t.payload.record})}}class i{constructor(t){this.path=t}static async load(t,e){return await window.__TAURI_INVOKE__("plugin:stronghold|initialize",{snapshotPath:t,password:e}).then((()=>new i(t)))}async unload(){return await window.__TAURI_INVOKE__("plugin:stronghold|destroy",{snapshotPath:this.path})}async loadClient(t){return await window.__TAURI_INVOKE__("plugin:stronghold|load_client",{snapshotPath:this.path,client:e(t)}).then((()=>new a(this.path,t)))}async createClient(t){return await window.__TAURI_INVOKE__("plugin:stronghold|create_client",{snapshotPath:this.path,client:e(t)}).then((()=>new a(this.path,t)))}async save(){return await window.__TAURI_INVOKE__("plugin:stronghold|save",{snapshotPath:this.path})}}return t.Client=a,t.Location=r,t.Store=o,t.Stronghold=i,t.Vault=s,t}({});Object.defineProperty(window.__TAURI__,"stronghold",{value:__TAURI_STRONGHOLD__})}
|
||||
|
||||
@@ -40,7 +40,7 @@ class Update {
|
||||
}
|
||||
|
||||
async downloadAndInstall(
|
||||
onEvent?: (progress: DownloadEvent) => void
|
||||
onEvent?: (progress: DownloadEvent) => void,
|
||||
): Promise<void> {
|
||||
const channel = new Channel<DownloadEvent>();
|
||||
if (onEvent != null) {
|
||||
@@ -54,7 +54,7 @@ class Update {
|
||||
|
||||
async function check(options?: CheckOptions): Promise<Update> {
|
||||
return invoke<UpdateResponse>("plugin:updater|check", { ...options }).then(
|
||||
(response) => new Update(response)
|
||||
(response) => new Update(response),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ 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")
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
|
||||
@@ -67,7 +67,7 @@ upload(
|
||||
"https://example.com/file-upload",
|
||||
"./path/to/my/file.txt",
|
||||
(progress, total) => console.log(`Uploaded ${progress} of ${total} bytes`), // a callback that will be called with the upload progress
|
||||
{ "Content-Type": "text/plain" } // optional headers to send with the request
|
||||
{ "Content-Type": "text/plain" }, // optional headers to send with the request
|
||||
);
|
||||
```
|
||||
|
||||
@@ -78,7 +78,7 @@ download(
|
||||
"https://example.com/file-download-link",
|
||||
"./path/to/save/my/file.txt",
|
||||
(progress, total) => console.log(`Downloaded ${progress} of ${total} bytes`), // a callback that will be called with the download progress
|
||||
{ "Content-Type": "text/plain" } // optional headers to send with the request
|
||||
{ "Content-Type": "text/plain" }, // optional headers to send with the request
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ async function upload(
|
||||
url: string,
|
||||
filePath: string,
|
||||
progressHandler?: ProgressHandler,
|
||||
headers?: Map<string, string>
|
||||
headers?: Map<string, string>,
|
||||
): Promise<void> {
|
||||
const ids = new Uint32Array(1);
|
||||
window.crypto.getRandomValues(ids);
|
||||
@@ -43,7 +43,7 @@ async function download(
|
||||
url: string,
|
||||
filePath: string,
|
||||
progressHandler?: ProgressHandler,
|
||||
headers?: Map<string, string>
|
||||
headers?: Map<string, string>,
|
||||
): Promise<void> {
|
||||
const ids = new Uint32Array(1);
|
||||
window.crypto.getRandomValues(ids);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"LICENSE"
|
||||
],
|
||||
"devDependencies": {
|
||||
"tslib": "^2.5.0"
|
||||
"tslib": "2.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.0.0-alpha.5"
|
||||
|
||||
@@ -5,7 +5,7 @@ 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")
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
|
||||
@@ -60,7 +60,7 @@ fn main() {
|
||||
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
|
||||
|
||||
```javascript
|
||||
import { WebSocket } from "@tauri-apps/plugin-websocket";
|
||||
import WebSocket from "@tauri-apps/plugin-websocket";
|
||||
|
||||
const ws = await WebSocket.connect("wss://example.com");
|
||||
|
||||
|
||||
@@ -11,14 +11,14 @@
|
||||
"tauri": "tauri"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/adapter-auto": "^2.0.0",
|
||||
"@sveltejs/kit": "^1.15.5",
|
||||
"@sveltejs/adapter-auto": "2.1.0",
|
||||
"@sveltejs/kit": "1.22.3",
|
||||
"@tauri-apps/cli": "2.0.0-alpha.10",
|
||||
"svelte": "^3.58.0",
|
||||
"svelte-check": "^3.2.0",
|
||||
"tslib": "^2.5.0",
|
||||
"typescript": "^5.0.4",
|
||||
"vite": "^4.3.9"
|
||||
"svelte": "4.0.5",
|
||||
"svelte-check": "3.4.6",
|
||||
"tslib": "2.6.0",
|
||||
"typescript": "5.1.6",
|
||||
"vite": "4.4.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/plugin-websocket": "link:../../"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
|
||||
@@ -66,7 +66,7 @@ export default class WebSocket {
|
||||
m = { type: "Binary", data: message };
|
||||
} else {
|
||||
throw new Error(
|
||||
"invalid `message` type, expected a `{ type: string, data: any }` object, a string or a numeric array"
|
||||
"invalid `message` type, expected a `{ type: string, data: any }` object, a string or a numeric array",
|
||||
);
|
||||
}
|
||||
return await window.__TAURI_INVOKE__("plugin:websocket|send", {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"LICENSE"
|
||||
],
|
||||
"devDependencies": {
|
||||
"tslib": "^2.5.0"
|
||||
"tslib": "2.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.0.0-alpha.5"
|
||||
|
||||
@@ -5,7 +5,7 @@ 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")
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"LICENSE"
|
||||
],
|
||||
"devDependencies": {
|
||||
"tslib": "^2.5.0"
|
||||
"tslib": "2.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.0.0-alpha.5"
|
||||
|
||||
@@ -5,7 +5,7 @@ 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")
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
|
||||
@@ -258,7 +258,7 @@ function getAll(): WebviewWindow[] {
|
||||
new WebviewWindow(w.label, {
|
||||
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
||||
skip: true,
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ class WebviewWindowHandle {
|
||||
*/
|
||||
async listen<T>(
|
||||
event: EventName,
|
||||
handler: EventCallback<T>
|
||||
handler: EventCallback<T>,
|
||||
): Promise<UnlistenFn> {
|
||||
if (this._handleTauriEvent(event, handler)) {
|
||||
return Promise.resolve(() => {
|
||||
@@ -435,7 +435,7 @@ class WindowManager extends WebviewWindowHandle {
|
||||
"plugin:window|inner_position",
|
||||
{
|
||||
label: this.label,
|
||||
}
|
||||
},
|
||||
)
|
||||
.then(({ x, y }) => new PhysicalPosition(x, y));
|
||||
}
|
||||
@@ -458,7 +458,7 @@ class WindowManager extends WebviewWindowHandle {
|
||||
"plugin:window|outer_position",
|
||||
{
|
||||
label: this.label,
|
||||
}
|
||||
},
|
||||
)
|
||||
.then(({ x, y }) => new PhysicalPosition(x, y));
|
||||
}
|
||||
@@ -482,7 +482,7 @@ class WindowManager extends WebviewWindowHandle {
|
||||
"plugin:window|inner_size",
|
||||
{
|
||||
label: this.label,
|
||||
}
|
||||
},
|
||||
)
|
||||
.then(({ width, height }) => new PhysicalSize(width, height));
|
||||
}
|
||||
@@ -506,7 +506,7 @@ class WindowManager extends WebviewWindowHandle {
|
||||
"plugin:window|outer_size",
|
||||
{
|
||||
label: this.label,
|
||||
}
|
||||
},
|
||||
)
|
||||
.then(({ width, height }) => new PhysicalSize(width, height));
|
||||
}
|
||||
@@ -782,7 +782,7 @@ class WindowManager extends WebviewWindowHandle {
|
||||
* @since 2.0.0
|
||||
*/
|
||||
async requestUserAttention(
|
||||
requestType: UserAttentionType | null
|
||||
requestType: UserAttentionType | null,
|
||||
): Promise<void> {
|
||||
let requestType_ = null;
|
||||
if (requestType) {
|
||||
@@ -1182,7 +1182,7 @@ class WindowManager extends WebviewWindowHandle {
|
||||
async setSize(size: LogicalSize | PhysicalSize): Promise<void> {
|
||||
if (!size || (size.type !== "Logical" && size.type !== "Physical")) {
|
||||
throw new Error(
|
||||
"the `size` argument must be either a LogicalSize or a PhysicalSize instance"
|
||||
"the `size` argument must be either a LogicalSize or a PhysicalSize instance",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1212,11 +1212,11 @@ class WindowManager extends WebviewWindowHandle {
|
||||
* @since 2.0.0
|
||||
*/
|
||||
async setMinSize(
|
||||
size: LogicalSize | PhysicalSize | null | undefined
|
||||
size: LogicalSize | PhysicalSize | null | undefined,
|
||||
): Promise<void> {
|
||||
if (size && size.type !== "Logical" && size.type !== "Physical") {
|
||||
throw new Error(
|
||||
"the `size` argument must be either a LogicalSize or a PhysicalSize instance"
|
||||
"the `size` argument must be either a LogicalSize or a PhysicalSize instance",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1248,11 +1248,11 @@ class WindowManager extends WebviewWindowHandle {
|
||||
* @since 2.0.0
|
||||
*/
|
||||
async setMaxSize(
|
||||
size: LogicalSize | PhysicalSize | null | undefined
|
||||
size: LogicalSize | PhysicalSize | null | undefined,
|
||||
): Promise<void> {
|
||||
if (size && size.type !== "Logical" && size.type !== "Physical") {
|
||||
throw new Error(
|
||||
"the `size` argument must be either a LogicalSize or a PhysicalSize instance"
|
||||
"the `size` argument must be either a LogicalSize or a PhysicalSize instance",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1284,14 +1284,14 @@ class WindowManager extends WebviewWindowHandle {
|
||||
* @since 2.0.0
|
||||
*/
|
||||
async setPosition(
|
||||
position: LogicalPosition | PhysicalPosition
|
||||
position: LogicalPosition | PhysicalPosition,
|
||||
): Promise<void> {
|
||||
if (
|
||||
!position ||
|
||||
(position.type !== "Logical" && position.type !== "Physical")
|
||||
) {
|
||||
throw new Error(
|
||||
"the `position` argument must be either a LogicalPosition or a PhysicalPosition instance"
|
||||
"the `position` argument must be either a LogicalPosition or a PhysicalPosition instance",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1484,14 +1484,14 @@ class WindowManager extends WebviewWindowHandle {
|
||||
* @since 2.0.0
|
||||
*/
|
||||
async setCursorPosition(
|
||||
position: LogicalPosition | PhysicalPosition
|
||||
position: LogicalPosition | PhysicalPosition,
|
||||
): Promise<void> {
|
||||
if (
|
||||
!position ||
|
||||
(position.type !== "Logical" && position.type !== "Physical")
|
||||
) {
|
||||
throw new Error(
|
||||
"the `position` argument must be either a LogicalPosition or a PhysicalPosition instance"
|
||||
"the `position` argument must be either a LogicalPosition or a PhysicalPosition instance",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1626,7 +1626,7 @@ class WindowManager extends WebviewWindowHandle {
|
||||
*/
|
||||
/* eslint-disable @typescript-eslint/promise-function-async */
|
||||
async onCloseRequested(
|
||||
handler: (event: CloseRequestedEvent) => void | Promise<void>
|
||||
handler: (event: CloseRequestedEvent) => void | Promise<void>,
|
||||
): Promise<UnlistenFn> {
|
||||
return this.listen<null>(TauriEvent.WINDOW_CLOSE_REQUESTED, (event) => {
|
||||
const evt = new CloseRequestedEvent(event);
|
||||
@@ -1663,13 +1663,13 @@ class WindowManager extends WebviewWindowHandle {
|
||||
TauriEvent.WINDOW_FOCUS,
|
||||
(event) => {
|
||||
handler({ ...event, payload: true });
|
||||
}
|
||||
},
|
||||
);
|
||||
const unlistenBlur = await this.listen<PhysicalPosition>(
|
||||
TauriEvent.WINDOW_BLUR,
|
||||
(event) => {
|
||||
handler({ ...event, payload: false });
|
||||
}
|
||||
},
|
||||
);
|
||||
return () => {
|
||||
unlistenFocus();
|
||||
@@ -1701,11 +1701,11 @@ class WindowManager extends WebviewWindowHandle {
|
||||
* @since 2.0.0
|
||||
*/
|
||||
async onScaleChanged(
|
||||
handler: EventCallback<ScaleFactorChanged>
|
||||
handler: EventCallback<ScaleFactorChanged>,
|
||||
): Promise<UnlistenFn> {
|
||||
return this.listen<ScaleFactorChanged>(
|
||||
TauriEvent.WINDOW_SCALE_FACTOR_CHANGED,
|
||||
handler
|
||||
handler,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1760,27 +1760,27 @@ class WindowManager extends WebviewWindowHandle {
|
||||
* @since 2.0.0
|
||||
*/
|
||||
async onFileDropEvent(
|
||||
handler: EventCallback<FileDropEvent>
|
||||
handler: EventCallback<FileDropEvent>,
|
||||
): Promise<UnlistenFn> {
|
||||
const unlistenFileDrop = await this.listen<string[]>(
|
||||
TauriEvent.WINDOW_FILE_DROP,
|
||||
(event) => {
|
||||
handler({ ...event, payload: { type: "drop", paths: event.payload } });
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
const unlistenFileHover = await this.listen<string[]>(
|
||||
TauriEvent.WINDOW_FILE_DROP_HOVER,
|
||||
(event) => {
|
||||
handler({ ...event, payload: { type: "hover", paths: event.payload } });
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
const unlistenCancel = await this.listen<null>(
|
||||
TauriEvent.WINDOW_FILE_DROP_CANCELLED,
|
||||
(event) => {
|
||||
handler({ ...event, payload: { type: "cancel" } });
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
return () => {
|
||||
@@ -1963,11 +1963,11 @@ if ("__TAURI_METADATA__" in window) {
|
||||
{
|
||||
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
||||
skip: true,
|
||||
}
|
||||
},
|
||||
);
|
||||
} else {
|
||||
console.warn(
|
||||
`Could not find "window.__TAURI_METADATA__". The "appWindow" value will reference the "main" window label.\nNote that this is not an issue if running this frontend on a browser instead of a Tauri window.`
|
||||
`Could not find "window.__TAURI_METADATA__". The "appWindow" value will reference the "main" window label.\nNote that this is not an issue if running this frontend on a browser instead of a Tauri window.`,
|
||||
);
|
||||
appWindow = new WebviewWindow("main", {
|
||||
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
||||
|
||||
@@ -5,7 +5,7 @@ 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")
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user