From 393667b547c099c1ad68b7e6858454ef55e15560 Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Fri, 2 Jun 2023 13:30:44 +0200 Subject: [PATCH 1/3] chore: update pnpm version to 7.33 (#413) * chore: update pnpm version to 7.33 * fmt --- .npmrc | 1 + package.json | 2 +- plugins/upload/README.md | 22 +++++++++++----------- pnpm-lock.yaml | 6 +++++- 4 files changed, 18 insertions(+), 13 deletions(-) create mode 100644 .npmrc diff --git a/.npmrc b/.npmrc new file mode 100644 index 00000000..f87a0443 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +auto-install-peers=true \ No newline at end of file diff --git a/package.json b/package.json index 8a842919..f25a88ae 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,6 @@ "typescript": "^5.0.4" }, "engines": { - "pnpm": ">=7.24.2" + "pnpm": ">=7.33.0" } } diff --git a/plugins/upload/README.md b/plugins/upload/README.md index 0f74288d..48fe0153 100644 --- a/plugins/upload/README.md +++ b/plugins/upload/README.md @@ -52,25 +52,25 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```javascript -import { upload } from 'tauri-plugin-upload-api' +import { upload } from "tauri-plugin-upload-api"; 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 -) + "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 +); ``` ```javascript import { download } from "tauri-plugin-upload-api"; 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 -) + "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 +); ``` ## Contributing diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 18a1cda0..69468078 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,4 +1,8 @@ -lockfileVersion: '6.0' +lockfileVersion: '6.1' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false importers: From 29bf8a2ab45ad0f16c467d2a1bcb7a26424cc634 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 2 Jun 2023 13:48:49 +0200 Subject: [PATCH 2/3] chore(deps): update dependency eslint-config-standard-with-typescript to v35 (#412) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index f25a88ae..8872a988 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@typescript-eslint/parser": "^5.58.0", "eslint": "^8.38.0", "eslint-config-prettier": "^8.8.0", - "eslint-config-standard-with-typescript": "^34.0.1", + "eslint-config-standard-with-typescript": "^35.0.0", "eslint-plugin-import": "^2.27.5", "eslint-plugin-n": "^16.0.0", "eslint-plugin-promise": "^6.1.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 69468078..c5ee8389 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -30,8 +30,8 @@ importers: specifier: ^8.8.0 version: 8.8.0(eslint@8.38.0) eslint-config-standard-with-typescript: - specifier: ^34.0.1 - version: 34.0.1(@typescript-eslint/eslint-plugin@5.58.0)(eslint-plugin-import@2.27.5)(eslint-plugin-n@16.0.0)(eslint-plugin-promise@6.1.1)(eslint@8.38.0)(typescript@5.0.4) + specifier: ^35.0.0 + version: 35.0.0(@typescript-eslint/eslint-plugin@5.58.0)(eslint-plugin-import@2.27.5)(eslint-plugin-n@16.0.0)(eslint-plugin-promise@6.1.1)(eslint@8.38.0)(typescript@5.0.4) eslint-plugin-import: specifier: ^2.27.5 version: 2.27.5(@typescript-eslint/parser@5.58.0)(eslint@8.38.0) @@ -1311,10 +1311,10 @@ packages: eslint: 8.38.0 dev: true - /eslint-config-standard-with-typescript@34.0.1(@typescript-eslint/eslint-plugin@5.58.0)(eslint-plugin-import@2.27.5)(eslint-plugin-n@16.0.0)(eslint-plugin-promise@6.1.1)(eslint@8.38.0)(typescript@5.0.4): - resolution: {integrity: sha512-J7WvZeLtd0Vr9F+v4dZbqJCLD16cbIy4U+alJMq4MiXdpipdBM3U5NkXaGUjePc4sb1ZE01U9g6VuTBpHHz1fg==} + /eslint-config-standard-with-typescript@35.0.0(@typescript-eslint/eslint-plugin@5.58.0)(eslint-plugin-import@2.27.5)(eslint-plugin-n@16.0.0)(eslint-plugin-promise@6.1.1)(eslint@8.38.0)(typescript@5.0.4): + resolution: {integrity: sha512-Xa7DY9GgduZyp0qmXxBF0/dB+Vm4/DgWu1lGpNLJV2d46aCaUxTKDEnkzjUWX/1O9S0a+Dhnw7A4oI0JpYzwtw==} peerDependencies: - '@typescript-eslint/eslint-plugin': ^5.43.0 + '@typescript-eslint/eslint-plugin': ^5.50.0 eslint: ^8.0.1 eslint-plugin-import: ^2.25.2 eslint-plugin-n: ^15.0.0 From b3d7d11ae32e0970184f53be26e2c5530f78cdf0 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Tue, 6 Jun 2023 04:50:05 -0700 Subject: [PATCH 3/3] fix(stronghold): remove constructor, add static load function (#416) --- .changes/stronghold-constructor.md | 5 +++++ plugins/stronghold/guest-js/index.ts | 11 +++++------ 2 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 .changes/stronghold-constructor.md diff --git a/.changes/stronghold-constructor.md b/.changes/stronghold-constructor.md new file mode 100644 index 00000000..99966095 --- /dev/null +++ b/.changes/stronghold-constructor.md @@ -0,0 +1,5 @@ +--- +"stronghold-js": minor +--- + +Added `Stronghold.load` and removed its constructor. diff --git a/plugins/stronghold/guest-js/index.ts b/plugins/stronghold/guest-js/index.ts index 3339f87f..071eabf1 100644 --- a/plugins/stronghold/guest-js/index.ts +++ b/plugins/stronghold/guest-js/index.ts @@ -395,21 +395,20 @@ export class Stronghold { * @param path * @param password */ - constructor(path: string, password: string) { + private constructor(path: string) { this.path = path; - void this.reload(password); } /** - * Force a reload of the snapshot. The password must match. + * Load the snapshot if it exists (password must match), or start a fresh stronghold instance otherwise. * @param password * @returns */ - private async reload(password: string): Promise { + static async load(path: string, password: string): Promise { return await invoke("plugin:stronghold|initialize", { - snapshotPath: this.path, + snapshotPath: path, password, - }); + }).then(() => new Stronghold(path)); } /**