From 7d6e721df1a2f722783b695176ebd11c64a85568 Mon Sep 17 00:00:00 2001 From: amrbashir Date: Tue, 14 Nov 2023 01:19:09 +0200 Subject: [PATCH] refactor: simplify rollup config and match `@tauri-apps/api` output style --- package.json | 2 +- plugins/authenticator/package.json | 11 +- plugins/authenticator/rollup.config.js | 3 + plugins/authenticator/rollup.config.mjs | 11 - plugins/authenticator/src/api-iife.js | 2 +- plugins/autostart/package.json | 11 +- plugins/autostart/rollup.config.js | 3 + plugins/autostart/rollup.config.mjs | 11 - plugins/autostart/src/api-iife.js | 2 +- plugins/barcode-scanner/package.json | 11 +- plugins/barcode-scanner/rollup.config.js | 3 + plugins/barcode-scanner/rollup.config.mjs | 11 - plugins/barcode-scanner/src/api-iife.js | 2 +- plugins/cli/package.json | 11 +- plugins/cli/rollup.config.js | 3 + plugins/cli/rollup.config.mjs | 11 - plugins/cli/src/api-iife.js | 2 +- plugins/clipboard-manager/package.json | 11 +- plugins/clipboard-manager/rollup.config.js | 3 + plugins/clipboard-manager/rollup.config.mjs | 11 - plugins/clipboard-manager/src/api-iife.js | 2 +- plugins/deep-link/package.json | 11 +- plugins/deep-link/rollup.config.js | 3 + plugins/deep-link/rollup.config.mjs | 11 - plugins/deep-link/src/api-iife.js | 2 +- plugins/dialog/package.json | 11 +- plugins/dialog/rollup.config.js | 18 ++ plugins/dialog/rollup.config.mjs | 34 --- plugins/dialog/src/api-iife.js | 2 +- plugins/fs/package.json | 11 +- plugins/fs/rollup.config.js | 3 + plugins/fs/rollup.config.mjs | 11 - plugins/fs/src/api-iife.js | 2 +- plugins/global-shortcut/package.json | 11 +- plugins/global-shortcut/rollup.config.js | 3 + plugins/global-shortcut/rollup.config.mjs | 11 - plugins/global-shortcut/src/api-iife.js | 2 +- plugins/http/package.json | 11 +- plugins/http/rollup.config.js | 3 + plugins/http/rollup.config.mjs | 11 - plugins/http/src/api-iife.js | 2 +- plugins/log/package.json | 11 +- plugins/log/rollup.config.js | 3 + plugins/log/rollup.config.mjs | 11 - plugins/log/src/api-iife.js | 2 +- plugins/notification/package.json | 11 +- plugins/notification/rollup.config.js | 18 ++ plugins/notification/rollup.config.mjs | 34 --- plugins/notification/src/api-iife.js | 2 +- plugins/os/package.json | 11 +- plugins/os/rollup.config.js | 3 + plugins/os/rollup.config.mjs | 11 - plugins/os/src/api-iife.js | 2 +- plugins/positioner/package.json | 11 +- plugins/positioner/rollup.config.js | 3 + plugins/positioner/rollup.config.mjs | 11 - plugins/positioner/src/api-iife.js | 2 +- plugins/process/package.json | 11 +- plugins/process/rollup.config.js | 3 + plugins/process/rollup.config.mjs | 11 - plugins/process/src/api-iife.js | 2 +- plugins/shell/package.json | 11 +- plugins/shell/rollup.config.js | 18 ++ plugins/shell/rollup.config.mjs | 34 --- plugins/shell/src/api-iife.js | 2 +- plugins/shell/src/init-iife.js | 2 +- plugins/sql/package.json | 11 +- plugins/sql/rollup.config.js | 3 + plugins/sql/rollup.config.mjs | 11 - plugins/sql/src/api-iife.js | 2 +- plugins/store/package.json | 11 +- plugins/store/rollup.config.js | 3 + plugins/store/rollup.config.mjs | 11 - plugins/store/src/api-iife.js | 2 +- plugins/stronghold/package.json | 11 +- plugins/stronghold/rollup.config.js | 3 + plugins/stronghold/rollup.config.mjs | 11 - plugins/stronghold/src/api-iife.js | 2 +- plugins/updater/package.json | 11 +- plugins/updater/rollup.config.js | 3 + plugins/updater/rollup.config.mjs | 11 - plugins/updater/src/api-iife.js | 2 +- plugins/upload/package.json | 11 +- plugins/upload/rollup.config.js | 3 + plugins/upload/rollup.config.mjs | 11 - plugins/upload/src/api-iife.js | 2 +- .../examples/svelte-app/package.json | 1 - plugins/websocket/package.json | 11 +- plugins/websocket/rollup.config.js | 3 + plugins/websocket/rollup.config.mjs | 11 - plugins/websocket/src/api-iife.js | 2 +- plugins/window-state/package.json | 11 +- plugins/window-state/rollup.config.js | 3 + plugins/window-state/rollup.config.mjs | 11 - plugins/window-state/src/api-iife.js | 2 +- pnpm-lock.yaml | 278 +++++------------- shared/rollup.config.js | 88 ++++++ shared/rollup.config.mjs | 82 ------ shared/template/package.json | 11 +- shared/template/rollup.config.js | 3 + shared/template/rollup.config.mjs | 11 - tsconfig.base.json | 21 +- 102 files changed, 363 insertions(+), 871 deletions(-) create mode 100644 plugins/authenticator/rollup.config.js delete mode 100644 plugins/authenticator/rollup.config.mjs create mode 100644 plugins/autostart/rollup.config.js delete mode 100644 plugins/autostart/rollup.config.mjs create mode 100644 plugins/barcode-scanner/rollup.config.js delete mode 100644 plugins/barcode-scanner/rollup.config.mjs create mode 100644 plugins/cli/rollup.config.js delete mode 100644 plugins/cli/rollup.config.mjs create mode 100644 plugins/clipboard-manager/rollup.config.js delete mode 100644 plugins/clipboard-manager/rollup.config.mjs create mode 100644 plugins/deep-link/rollup.config.js delete mode 100644 plugins/deep-link/rollup.config.mjs create mode 100644 plugins/dialog/rollup.config.js delete mode 100644 plugins/dialog/rollup.config.mjs create mode 100644 plugins/fs/rollup.config.js delete mode 100644 plugins/fs/rollup.config.mjs create mode 100644 plugins/global-shortcut/rollup.config.js delete mode 100644 plugins/global-shortcut/rollup.config.mjs create mode 100644 plugins/http/rollup.config.js delete mode 100644 plugins/http/rollup.config.mjs create mode 100644 plugins/log/rollup.config.js delete mode 100644 plugins/log/rollup.config.mjs create mode 100644 plugins/notification/rollup.config.js delete mode 100644 plugins/notification/rollup.config.mjs create mode 100644 plugins/os/rollup.config.js delete mode 100644 plugins/os/rollup.config.mjs create mode 100644 plugins/positioner/rollup.config.js delete mode 100644 plugins/positioner/rollup.config.mjs create mode 100644 plugins/process/rollup.config.js delete mode 100644 plugins/process/rollup.config.mjs create mode 100644 plugins/shell/rollup.config.js delete mode 100644 plugins/shell/rollup.config.mjs create mode 100644 plugins/sql/rollup.config.js delete mode 100644 plugins/sql/rollup.config.mjs create mode 100644 plugins/store/rollup.config.js delete mode 100644 plugins/store/rollup.config.mjs create mode 100644 plugins/stronghold/rollup.config.js delete mode 100644 plugins/stronghold/rollup.config.mjs create mode 100644 plugins/updater/rollup.config.js delete mode 100644 plugins/updater/rollup.config.mjs create mode 100644 plugins/upload/rollup.config.js delete mode 100644 plugins/upload/rollup.config.mjs create mode 100644 plugins/websocket/rollup.config.js delete mode 100644 plugins/websocket/rollup.config.mjs create mode 100644 plugins/window-state/rollup.config.js delete mode 100644 plugins/window-state/rollup.config.mjs create mode 100644 shared/rollup.config.js delete mode 100644 shared/rollup.config.mjs create mode 100644 shared/template/rollup.config.js delete mode 100644 shared/template/rollup.config.mjs diff --git a/package.json b/package.json index 13f4c46a8..d3ca389ee 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "eslint-plugin-promise": "6.1.1", "eslint-plugin-security": "1.7.1", "prettier": "3.0.3", - "rollup": "4.1.4", + "rollup": "4.2.0", "typescript": "5.2.2" }, "resolutions": { diff --git a/plugins/authenticator/package.json b/plugins/authenticator/package.json index 5cf119999..9c9109a61 100644 --- a/plugins/authenticator/package.json +++ b/plugins/authenticator/package.json @@ -7,26 +7,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "2.6.0" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/plugins/authenticator/rollup.config.js b/plugins/authenticator/rollup.config.js new file mode 100644 index 000000000..8e039e06c --- /dev/null +++ b/plugins/authenticator/rollup.config.js @@ -0,0 +1,3 @@ +import { createConfig } from "../../shared/rollup.config.js"; + +export default createConfig(); diff --git a/plugins/authenticator/rollup.config.mjs b/plugins/authenticator/rollup.config.mjs deleted file mode 100644 index 99a3dd319..000000000 --- a/plugins/authenticator/rollup.config.mjs +++ /dev/null @@ -1,11 +0,0 @@ -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/], -}); diff --git a/plugins/authenticator/src/api-iife.js b/plugins/authenticator/src/api-iife.js index 42d197c3e..5a3ceb7dd 100644 --- a/plugins/authenticator/src/api-iife.js +++ b/plugins/authenticator/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_AUTHENTICATOR__=function(t){"use strict";async function i(t,i={},a){return window.__TAURI_INTERNALS__.invoke(t,i,a)}"function"==typeof SuppressedError&&SuppressedError;return t.Authenticator=class{async init(){return await i("plugin:authenticator|init_auth")}async register(t,a){return await i("plugin:authenticator|register",{timeout:1e4,challenge:t,application:a})}async verifyRegistration(t,a,e,n){return await i("plugin:authenticator|verify_registration",{challenge:t,application:a,registerData:e,clientData:n})}async sign(t,a,e){return await i("plugin:authenticator|sign",{timeout:1e4,challenge:t,application:a,keyHandle:e})}async verifySignature(t,a,e,n,r,u){return await i("plugin:authenticator|verify_signature",{challenge:t,application:a,signData:e,clientData:n,keyHandle:r,pubkey:u})}},t}({});Object.defineProperty(window.__TAURI__,"authenticator",{value:__TAURI_AUTHENTICATOR__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_AUTHENTICATOR__=function(t){"use strict";async function i(t,i={},a){return window.__TAURI_INTERNALS__.invoke(t,i,a)}"function"==typeof SuppressedError&&SuppressedError;return t.Authenticator=class{async init(){return await i("plugin:authenticator|init_auth")}async register(t,a){return await i("plugin:authenticator|register",{timeout:1e4,challenge:t,application:a})}async verifyRegistration(t,a,e,n){return await i("plugin:authenticator|verify_registration",{challenge:t,application:a,registerData:e,clientData:n})}async sign(t,a,e){return await i("plugin:authenticator|sign",{timeout:1e4,challenge:t,application:a,keyHandle:e})}async verifySignature(t,a,e,n,r,u){return await i("plugin:authenticator|verify_signature",{challenge:t,application:a,signData:e,clientData:n,keyHandle:r,pubkey:u})}},t}({});Object.defineProperty(window.__TAURI__,"authenticator",{value:__TAURI_PLUGIN_AUTHENTICATOR__})} diff --git a/plugins/autostart/package.json b/plugins/autostart/package.json index 981be27f1..3b252f17a 100644 --- a/plugins/autostart/package.json +++ b/plugins/autostart/package.json @@ -6,26 +6,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "2.6.0" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/plugins/autostart/rollup.config.js b/plugins/autostart/rollup.config.js new file mode 100644 index 000000000..8e039e06c --- /dev/null +++ b/plugins/autostart/rollup.config.js @@ -0,0 +1,3 @@ +import { createConfig } from "../../shared/rollup.config.js"; + +export default createConfig(); diff --git a/plugins/autostart/rollup.config.mjs b/plugins/autostart/rollup.config.mjs deleted file mode 100644 index 99a3dd319..000000000 --- a/plugins/autostart/rollup.config.mjs +++ /dev/null @@ -1,11 +0,0 @@ -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/], -}); diff --git a/plugins/autostart/src/api-iife.js b/plugins/autostart/src/api-iife.js index dad831483..77a12c924 100644 --- a/plugins/autostart/src/api-iife.js +++ b/plugins/autostart/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_AUTOSTART__=function(n){"use strict";async function t(n,t={},a){return window.__TAURI_INTERNALS__.invoke(n,t,a)}return"function"==typeof SuppressedError&&SuppressedError,n.disable=async function(){await t("plugin:autostart|disable")},n.enable=async function(){await t("plugin:autostart|enable")},n.isEnabled=async function(){return await t("plugin:autostart|is_enabled")},n}({});Object.defineProperty(window.__TAURI__,"autostart",{value:__TAURI_AUTOSTART__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_AUTOSTART__=function(n){"use strict";async function t(n,t={},a){return window.__TAURI_INTERNALS__.invoke(n,t,a)}return"function"==typeof SuppressedError&&SuppressedError,n.disable=async function(){await t("plugin:autostart|disable")},n.enable=async function(){await t("plugin:autostart|enable")},n.isEnabled=async function(){return await t("plugin:autostart|is_enabled")},n}({});Object.defineProperty(window.__TAURI__,"autostart",{value:__TAURI_PLUGIN_AUTOSTART__})} diff --git a/plugins/barcode-scanner/package.json b/plugins/barcode-scanner/package.json index cc4e85ec3..026f0f4c3 100644 --- a/plugins/barcode-scanner/package.json +++ b/plugins/barcode-scanner/package.json @@ -7,26 +7,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "^2.5.0" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/plugins/barcode-scanner/rollup.config.js b/plugins/barcode-scanner/rollup.config.js new file mode 100644 index 000000000..8e039e06c --- /dev/null +++ b/plugins/barcode-scanner/rollup.config.js @@ -0,0 +1,3 @@ +import { createConfig } from "../../shared/rollup.config.js"; + +export default createConfig(); diff --git a/plugins/barcode-scanner/rollup.config.mjs b/plugins/barcode-scanner/rollup.config.mjs deleted file mode 100644 index 99a3dd319..000000000 --- a/plugins/barcode-scanner/rollup.config.mjs +++ /dev/null @@ -1,11 +0,0 @@ -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/], -}); diff --git a/plugins/barcode-scanner/src/api-iife.js b/plugins/barcode-scanner/src/api-iife.js index ec3a507cb..d94c59491 100644 --- a/plugins/barcode-scanner/src/api-iife.js +++ b/plugins/barcode-scanner/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_BARCODESCANNER__=function(n){"use strict";async function e(n,e={},r){return window.__TAURI_INTERNALS__.invoke(n,e,r)}var r;return"function"==typeof SuppressedError&&SuppressedError,n.Format=void 0,(r=n.Format||(n.Format={})).QRCode="QR_CODE",r.UPC_A="UPC_A",r.UPC_E="UPC_E",r.EAN8="EAN_8",r.EAN13="EAN_13",r.Code39="CODE_39",r.Code93="CODE_93",r.Code128="CODE_128",r.Codabar="CODABAR",r.ITF="ITF",r.Aztec="AZTEC",r.DataMatrix="DATA_MATRIX",r.PDF417="PDF_417",n.cancel=async function(){return await e("plugin:barcodeScanner|cancel")},n.checkPermissions=async function(){return await e("plugin:barcodeScanner|checkPermissions").then((n=>n.camera))},n.openAppSettings=async function(){return await e("plugin:barcodeScanner|openAppSettings")},n.requestPermissions=async function(){return await e("plugin:barcodeScanner|requestPermissions").then((n=>n.camera))},n.scan=async function(n){return await e("plugin:barcodeScanner|scan",{...n})},n}({});Object.defineProperty(window.__TAURI__,"barcodeScanner",{value:__TAURI_BARCODESCANNER__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_BARCODESCANNER__=function(n){"use strict";async function e(n,e={},r){return window.__TAURI_INTERNALS__.invoke(n,e,r)}var r;return"function"==typeof SuppressedError&&SuppressedError,n.Format=void 0,(r=n.Format||(n.Format={})).QRCode="QR_CODE",r.UPC_A="UPC_A",r.UPC_E="UPC_E",r.EAN8="EAN_8",r.EAN13="EAN_13",r.Code39="CODE_39",r.Code93="CODE_93",r.Code128="CODE_128",r.Codabar="CODABAR",r.ITF="ITF",r.Aztec="AZTEC",r.DataMatrix="DATA_MATRIX",r.PDF417="PDF_417",n.cancel=async function(){return await e("plugin:barcodeScanner|cancel")},n.checkPermissions=async function(){return await e("plugin:barcodeScanner|checkPermissions").then((n=>n.camera))},n.openAppSettings=async function(){return await e("plugin:barcodeScanner|openAppSettings")},n.requestPermissions=async function(){return await e("plugin:barcodeScanner|requestPermissions").then((n=>n.camera))},n.scan=async function(n){return await e("plugin:barcodeScanner|scan",{...n})},n}({});Object.defineProperty(window.__TAURI__,"barcodeScanner",{value:__TAURI_PLUGIN_BARCODESCANNER__})} diff --git a/plugins/cli/package.json b/plugins/cli/package.json index d9c1bda9c..4d772f14c 100644 --- a/plugins/cli/package.json +++ b/plugins/cli/package.json @@ -6,26 +6,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "^2.4.1" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/plugins/cli/rollup.config.js b/plugins/cli/rollup.config.js new file mode 100644 index 000000000..8e039e06c --- /dev/null +++ b/plugins/cli/rollup.config.js @@ -0,0 +1,3 @@ +import { createConfig } from "../../shared/rollup.config.js"; + +export default createConfig(); diff --git a/plugins/cli/rollup.config.mjs b/plugins/cli/rollup.config.mjs deleted file mode 100644 index 99a3dd319..000000000 --- a/plugins/cli/rollup.config.mjs +++ /dev/null @@ -1,11 +0,0 @@ -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/], -}); diff --git a/plugins/cli/src/api-iife.js b/plugins/cli/src/api-iife.js index 270dfe803..90b2f35f0 100644 --- a/plugins/cli/src/api-iife.js +++ b/plugins/cli/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_CLI__=function(_){"use strict";return"function"==typeof SuppressedError&&SuppressedError,_.getMatches=async function(){return await async function(_,n={},e){return window.__TAURI_INTERNALS__.invoke(_,n,e)}("plugin:cli|cli_matches")},_}({});Object.defineProperty(window.__TAURI__,"cli",{value:__TAURI_CLI__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_CLI__=function(_){"use strict";return"function"==typeof SuppressedError&&SuppressedError,_.getMatches=async function(){return await async function(_,n={},e){return window.__TAURI_INTERNALS__.invoke(_,n,e)}("plugin:cli|cli_matches")},_}({});Object.defineProperty(window.__TAURI__,"cli",{value:__TAURI_PLUGIN_CLI__})} diff --git a/plugins/clipboard-manager/package.json b/plugins/clipboard-manager/package.json index 3b19e444e..ac9d84c9e 100644 --- a/plugins/clipboard-manager/package.json +++ b/plugins/clipboard-manager/package.json @@ -6,26 +6,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "^2.4.1" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/plugins/clipboard-manager/rollup.config.js b/plugins/clipboard-manager/rollup.config.js new file mode 100644 index 000000000..8e039e06c --- /dev/null +++ b/plugins/clipboard-manager/rollup.config.js @@ -0,0 +1,3 @@ +import { createConfig } from "../../shared/rollup.config.js"; + +export default createConfig(); diff --git a/plugins/clipboard-manager/rollup.config.mjs b/plugins/clipboard-manager/rollup.config.mjs deleted file mode 100644 index 99a3dd319..000000000 --- a/plugins/clipboard-manager/rollup.config.mjs +++ /dev/null @@ -1,11 +0,0 @@ -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/], -}); diff --git a/plugins/clipboard-manager/src/api-iife.js b/plugins/clipboard-manager/src/api-iife.js index b865ef294..9e494285a 100644 --- a/plugins/clipboard-manager/src/api-iife.js +++ b/plugins/clipboard-manager/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_CLIPBOARDMANAGER__=function(e){"use strict";async function n(e,n={},r){return window.__TAURI_INTERNALS__.invoke(e,n,r)}return"function"==typeof SuppressedError&&SuppressedError,e.readText=async function(){return(await n("plugin:clipboard|read")).plainText.text},e.writeText=async function(e,r){return n("plugin:clipboard|write",{data:{plainText:{label:null==r?void 0:r.label,text:e}}})},e}({});Object.defineProperty(window.__TAURI__,"clipboardManager",{value:__TAURI_CLIPBOARDMANAGER__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_CLIPBOARDMANAGER__=function(e){"use strict";async function n(e,n={},r){return window.__TAURI_INTERNALS__.invoke(e,n,r)}return"function"==typeof SuppressedError&&SuppressedError,e.readText=async function(){return(await n("plugin:clipboard|read")).plainText.text},e.writeText=async function(e,r){return n("plugin:clipboard|write",{data:{plainText:{label:r?.label,text:e}}})},e}({});Object.defineProperty(window.__TAURI__,"clipboardManager",{value:__TAURI_PLUGIN_CLIPBOARDMANAGER__})} diff --git a/plugins/deep-link/package.json b/plugins/deep-link/package.json index 09f28edb0..e4c92e68f 100644 --- a/plugins/deep-link/package.json +++ b/plugins/deep-link/package.json @@ -7,26 +7,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "^2.5.0" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/plugins/deep-link/rollup.config.js b/plugins/deep-link/rollup.config.js new file mode 100644 index 000000000..8e039e06c --- /dev/null +++ b/plugins/deep-link/rollup.config.js @@ -0,0 +1,3 @@ +import { createConfig } from "../../shared/rollup.config.js"; + +export default createConfig(); diff --git a/plugins/deep-link/rollup.config.mjs b/plugins/deep-link/rollup.config.mjs deleted file mode 100644 index 99a3dd319..000000000 --- a/plugins/deep-link/rollup.config.mjs +++ /dev/null @@ -1,11 +0,0 @@ -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/], -}); diff --git a/plugins/deep-link/src/api-iife.js b/plugins/deep-link/src/api-iife.js index 2f427a575..1b7c809e1 100644 --- a/plugins/deep-link/src/api-iife.js +++ b/plugins/deep-link/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_DEEPLINK__=function(e){"use strict";function n(e,n=!1){return window.__TAURI_INTERNALS__.transformCallback(e,n)}async function r(e,n={},r){return window.__TAURI_INTERNALS__.invoke(e,n,r)}var t;async function _(e,t,_){return r("plugin:event|listen",{event:e,windowLabel:_?.target,handler:n(t)}).then((n=>async()=>async function(e,n){await r("plugin:event|unlisten",{event:e,eventId:n})}(e,n)))}async function i(){return await r("plugin:deep-link|get_current")}return"function"==typeof SuppressedError&&SuppressedError,function(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"}(t||(t={})),e.getCurrent=i,e.onOpenUrl=async function(e){const n=await i();return null!=n&&e(n),await _("deep-link://new-url",(n=>e(n.payload)))},e}({});Object.defineProperty(window.__TAURI__,"deepLink",{value:__TAURI_DEEPLINK__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_DEEPLINK__=function(e){"use strict";function n(e,n=!1){return window.__TAURI_INTERNALS__.transformCallback(e,n)}async function r(e,n={},r){return window.__TAURI_INTERNALS__.invoke(e,n,r)}var t;async function _(e,t,_){return r("plugin:event|listen",{event:e,windowLabel:_?.target,handler:n(t)}).then((n=>async()=>async function(e,n){await r("plugin:event|unlisten",{event:e,eventId:n})}(e,n)))}async function i(){return await r("plugin:deep-link|get_current")}return"function"==typeof SuppressedError&&SuppressedError,function(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"}(t||(t={})),e.getCurrent=i,e.onOpenUrl=async function(e){const n=await i();return null!=n&&e(n),await _("deep-link://new-url",(n=>e(n.payload)))},e}({});Object.defineProperty(window.__TAURI__,"deepLink",{value:__TAURI_PLUGIN_DEEPLINK__})} diff --git a/plugins/dialog/package.json b/plugins/dialog/package.json index 1d349b2b0..4bb547c4b 100644 --- a/plugins/dialog/package.json +++ b/plugins/dialog/package.json @@ -6,26 +6,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "^2.4.1" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/plugins/dialog/rollup.config.js b/plugins/dialog/rollup.config.js new file mode 100644 index 000000000..d5a02667a --- /dev/null +++ b/plugins/dialog/rollup.config.js @@ -0,0 +1,18 @@ +import { createConfig } from "../../shared/rollup.config.js"; +import { nodeResolve } from "@rollup/plugin-node-resolve"; +import typescript from "@rollup/plugin-typescript"; +import terser from "@rollup/plugin-terser"; + +export default createConfig({ + additionalConfigs: { + input: "guest-js/init.ts", + output: { + file: "src/init-iife.js", + format: "iife", + }, + plugins: [typescript(), terser(), nodeResolve()], + onwarn: (warning) => { + throw Object.assign(new Error(), warning); + }, + }, +}); diff --git a/plugins/dialog/rollup.config.mjs b/plugins/dialog/rollup.config.mjs deleted file mode 100644 index d2a3cda68..000000000 --- a/plugins/dialog/rollup.config.mjs +++ /dev/null @@ -1,34 +0,0 @@ -import { readFileSync } from "fs"; - -import { createConfig } from "../../shared/rollup.config.mjs"; - -import typescript from "@rollup/plugin-typescript"; -import resolve from "@rollup/plugin-node-resolve"; -import terser from "@rollup/plugin-terser"; - -const config = createConfig({ - input: "guest-js/index.ts", - pkg: JSON.parse( - readFileSync(new URL("./package.json", import.meta.url), "utf8"), - ), - external: [/^@tauri-apps\/api/], -}); - -config.push({ - input: "guest-js/init.ts", - output: { - file: "src/init-iife.js", - format: "iife", - }, - plugins: [ - resolve(), - typescript({ - sourceMap: false, - declaration: false, - declarationDir: undefined, - }), - terser(), - ], -}); - -export default config; diff --git a/plugins/dialog/src/api-iife.js b/plugins/dialog/src/api-iife.js index e8664e408..6b3883da2 100644 --- a/plugins/dialog/src/api-iife.js +++ b/plugins/dialog/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_DIALOG__=function(n){"use strict";async function o(n,o={},t){return window.__TAURI_INTERNALS__.invoke(n,o,t)}return"function"==typeof SuppressedError&&SuppressedError,n.ask=async function(n,t){var i,l,e,u,r;const d="string"==typeof t?{title:t}:t;return o("plugin:dialog|ask",{message:n.toString(),title:null===(i=null==d?void 0:d.title)||void 0===i?void 0:i.toString(),type_:null==d?void 0:d.type,okButtonLabel:null!==(e=null===(l=null==d?void 0:d.okLabel)||void 0===l?void 0:l.toString())&&void 0!==e?e:"Yes",cancelButtonLabel:null!==(r=null===(u=null==d?void 0:d.cancelLabel)||void 0===u?void 0:u.toString())&&void 0!==r?r:"No"})},n.confirm=async function(n,t){var i,l,e,u,r;const d="string"==typeof t?{title:t}:t;return o("plugin:dialog|confirm",{message:n.toString(),title:null===(i=null==d?void 0:d.title)||void 0===i?void 0:i.toString(),type_:null==d?void 0:d.type,okButtonLabel:null!==(e=null===(l=null==d?void 0:d.okLabel)||void 0===l?void 0:l.toString())&&void 0!==e?e:"Ok",cancelButtonLabel:null!==(r=null===(u=null==d?void 0:d.cancelLabel)||void 0===u?void 0:u.toString())&&void 0!==r?r:"Cancel"})},n.message=async function(n,t){var i,l;const e="string"==typeof t?{title:t}:t;return o("plugin:dialog|message",{message:n.toString(),title:null===(i=null==e?void 0:e.title)||void 0===i?void 0:i.toString(),type_:null==e?void 0:e.type,okButtonLabel:null===(l=null==e?void 0:e.okLabel)||void 0===l?void 0:l.toString()})},n.open=async function(n={}){return"object"==typeof n&&Object.freeze(n),o("plugin:dialog|open",{options:n})},n.save=async function(n={}){return"object"==typeof n&&Object.freeze(n),o("plugin:dialog|save",{options:n})},n}({});Object.defineProperty(window.__TAURI__,"dialog",{value:__TAURI_DIALOG__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_DIALOG__=function(t){"use strict";async function e(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}return"function"==typeof SuppressedError&&SuppressedError,t.ask=async function(t,n){const o="string"==typeof n?{title:n}:n;return e("plugin:dialog|ask",{message:t.toString(),title:o?.title?.toString(),type_:o?.type,okButtonLabel:o?.okLabel?.toString()??"Yes",cancelButtonLabel:o?.cancelLabel?.toString()??"No"})},t.confirm=async function(t,n){const o="string"==typeof n?{title:n}:n;return e("plugin:dialog|confirm",{message:t.toString(),title:o?.title?.toString(),type_:o?.type,okButtonLabel:o?.okLabel?.toString()??"Ok",cancelButtonLabel:o?.cancelLabel?.toString()??"Cancel"})},t.message=async function(t,n){const o="string"==typeof n?{title:n}:n;return e("plugin:dialog|message",{message:t.toString(),title:o?.title?.toString(),type_:o?.type,okButtonLabel:o?.okLabel?.toString()})},t.open=async function(t={}){return"object"==typeof t&&Object.freeze(t),e("plugin:dialog|open",{options:t})},t.save=async function(t={}){return"object"==typeof t&&Object.freeze(t),e("plugin:dialog|save",{options:t})},t}({});Object.defineProperty(window.__TAURI__,"dialog",{value:__TAURI_PLUGIN_DIALOG__})} diff --git a/plugins/fs/package.json b/plugins/fs/package.json index c0072316c..0fedb51d6 100644 --- a/plugins/fs/package.json +++ b/plugins/fs/package.json @@ -7,26 +7,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "^2.4.1" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/plugins/fs/rollup.config.js b/plugins/fs/rollup.config.js new file mode 100644 index 000000000..8e039e06c --- /dev/null +++ b/plugins/fs/rollup.config.js @@ -0,0 +1,3 @@ +import { createConfig } from "../../shared/rollup.config.js"; + +export default createConfig(); diff --git a/plugins/fs/rollup.config.mjs b/plugins/fs/rollup.config.mjs deleted file mode 100644 index 99a3dd319..000000000 --- a/plugins/fs/rollup.config.mjs +++ /dev/null @@ -1,11 +0,0 @@ -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/], -}); diff --git a/plugins/fs/src/api-iife.js b/plugins/fs/src/api-iife.js index d4da6a73b..4ac111268 100644 --- a/plugins/fs/src/api-iife.js +++ b/plugins/fs/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_FS__=function(t){"use strict";async function e(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}var n;async function a(t,n,a){"object"==typeof a&&Object.freeze(a),"object"==typeof t&&Object.freeze(t);const i={path:"",contents:""};let o=a;return"string"==typeof t?i.path=t:(i.path=t.path,i.contents=t.contents),"string"==typeof n?i.contents=null!=n?n:"":o=n,await e("plugin:fs|write_file",{path:i.path,contents:Array.from((new TextEncoder).encode(i.contents)),options:o})}return"function"==typeof SuppressedError&&SuppressedError,t.Dir=void 0,(n=t.Dir||(t.Dir={}))[n.Audio=1]="Audio",n[n.Cache=2]="Cache",n[n.Config=3]="Config",n[n.Data=4]="Data",n[n.LocalData=5]="LocalData",n[n.Document=6]="Document",n[n.Download=7]="Download",n[n.Picture=8]="Picture",n[n.Public=9]="Public",n[n.Video=10]="Video",n[n.Resource=11]="Resource",n[n.Temp=12]="Temp",n[n.AppConfig=13]="AppConfig",n[n.AppData=14]="AppData",n[n.AppLocalData=15]="AppLocalData",n[n.AppCache=16]="AppCache",n[n.AppLog=17]="AppLog",n[n.Desktop=18]="Desktop",n[n.Executable=19]="Executable",n[n.Font=20]="Font",n[n.Home=21]="Home",n[n.Runtime=22]="Runtime",n[n.Template=23]="Template",t.BaseDirectory=t.Dir,t.copyFile=async function(t,n,a={}){return await e("plugin:fs|copy_file",{source:t,destination:n,options:a})},t.createDir=async function(t,n={}){return await e("plugin:fs|create_dir",{path:t,options:n})},t.exists=async function(t){return await e("plugin:fs|exists",{path:t})},t.metadata=async function(t){return await e("plugin:fs|metadata",{path:t}).then((t=>{const{accessedAtMs:e,createdAtMs:n,modifiedAtMs:a,...i}=t;return{accessedAt:new Date(e),createdAt:new Date(n),modifiedAt:new Date(a),...i}}))},t.readBinaryFile=async function(t,n={}){const a=await e("plugin:fs|read_file",{path:t,options:n});return Uint8Array.from(a)},t.readDir=async function(t,n={}){return await e("plugin:fs|read_dir",{path:t,options:n})},t.readTextFile=async function(t,n={}){return await e("plugin:fs|read_text_file",{path:t,options:n})},t.removeDir=async function(t,n={}){return await e("plugin:fs|remove_dir",{path:t,options:n})},t.removeFile=async function(t,n={}){return await e("plugin:fs|remove_file",{path:t,options:n})},t.renameFile=async function(t,n,a={}){return await e("plugin:fs|rename_file",{oldPath:t,newPath:n,options:a})},t.writeBinaryFile=async function(t,n,a){"object"==typeof a&&Object.freeze(a),"object"==typeof t&&Object.freeze(t);const i={path:"",contents:[]};let o=a;return"string"==typeof t?i.path=t:(i.path=t.path,i.contents=t.contents),n&&"dir"in n?o=n:"string"==typeof t&&(i.contents=null!=n?n:[]),await e("plugin:fs|write_file",{path:i.path,contents:Array.from(i.contents instanceof ArrayBuffer?new Uint8Array(i.contents):i.contents),options:o})},t.writeFile=a,t.writeTextFile=a,t}({});Object.defineProperty(window.__TAURI__,"fs",{value:__TAURI_FS__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_FS__=function(t){"use strict";async function e(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}var n;async function a(t,n,a){"object"==typeof a&&Object.freeze(a),"object"==typeof t&&Object.freeze(t);const i={path:"",contents:""};let o=a;return"string"==typeof t?i.path=t:(i.path=t.path,i.contents=t.contents),"string"==typeof n?i.contents=n??"":o=n,await e("plugin:fs|write_file",{path:i.path,contents:Array.from((new TextEncoder).encode(i.contents)),options:o})}return"function"==typeof SuppressedError&&SuppressedError,t.Dir=void 0,(n=t.Dir||(t.Dir={}))[n.Audio=1]="Audio",n[n.Cache=2]="Cache",n[n.Config=3]="Config",n[n.Data=4]="Data",n[n.LocalData=5]="LocalData",n[n.Document=6]="Document",n[n.Download=7]="Download",n[n.Picture=8]="Picture",n[n.Public=9]="Public",n[n.Video=10]="Video",n[n.Resource=11]="Resource",n[n.Temp=12]="Temp",n[n.AppConfig=13]="AppConfig",n[n.AppData=14]="AppData",n[n.AppLocalData=15]="AppLocalData",n[n.AppCache=16]="AppCache",n[n.AppLog=17]="AppLog",n[n.Desktop=18]="Desktop",n[n.Executable=19]="Executable",n[n.Font=20]="Font",n[n.Home=21]="Home",n[n.Runtime=22]="Runtime",n[n.Template=23]="Template",t.BaseDirectory=t.Dir,t.copyFile=async function(t,n,a={}){return await e("plugin:fs|copy_file",{source:t,destination:n,options:a})},t.createDir=async function(t,n={}){return await e("plugin:fs|create_dir",{path:t,options:n})},t.exists=async function(t){return await e("plugin:fs|exists",{path:t})},t.metadata=async function(t){return await e("plugin:fs|metadata",{path:t}).then((t=>{const{accessedAtMs:e,createdAtMs:n,modifiedAtMs:a,...i}=t;return{accessedAt:new Date(e),createdAt:new Date(n),modifiedAt:new Date(a),...i}}))},t.readBinaryFile=async function(t,n={}){const a=await e("plugin:fs|read_file",{path:t,options:n});return Uint8Array.from(a)},t.readDir=async function(t,n={}){return await e("plugin:fs|read_dir",{path:t,options:n})},t.readTextFile=async function(t,n={}){return await e("plugin:fs|read_text_file",{path:t,options:n})},t.removeDir=async function(t,n={}){return await e("plugin:fs|remove_dir",{path:t,options:n})},t.removeFile=async function(t,n={}){return await e("plugin:fs|remove_file",{path:t,options:n})},t.renameFile=async function(t,n,a={}){return await e("plugin:fs|rename_file",{oldPath:t,newPath:n,options:a})},t.writeBinaryFile=async function(t,n,a){"object"==typeof a&&Object.freeze(a),"object"==typeof t&&Object.freeze(t);const i={path:"",contents:[]};let o=a;return"string"==typeof t?i.path=t:(i.path=t.path,i.contents=t.contents),n&&"dir"in n?o=n:"string"==typeof t&&(i.contents=n??[]),await e("plugin:fs|write_file",{path:i.path,contents:Array.from(i.contents instanceof ArrayBuffer?new Uint8Array(i.contents):i.contents),options:o})},t.writeFile=a,t.writeTextFile=a,t}({});Object.defineProperty(window.__TAURI__,"fs",{value:__TAURI_PLUGIN_FS__})} diff --git a/plugins/global-shortcut/package.json b/plugins/global-shortcut/package.json index ba47e0e35..b50150f76 100644 --- a/plugins/global-shortcut/package.json +++ b/plugins/global-shortcut/package.json @@ -6,26 +6,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "^2.4.1" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/plugins/global-shortcut/rollup.config.js b/plugins/global-shortcut/rollup.config.js new file mode 100644 index 000000000..8e039e06c --- /dev/null +++ b/plugins/global-shortcut/rollup.config.js @@ -0,0 +1,3 @@ +import { createConfig } from "../../shared/rollup.config.js"; + +export default createConfig(); diff --git a/plugins/global-shortcut/rollup.config.mjs b/plugins/global-shortcut/rollup.config.mjs deleted file mode 100644 index 99a3dd319..000000000 --- a/plugins/global-shortcut/rollup.config.mjs +++ /dev/null @@ -1,11 +0,0 @@ -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/], -}); diff --git a/plugins/global-shortcut/src/api-iife.js b/plugins/global-shortcut/src/api-iife.js index 934749c67..a46308f19 100644 --- a/plugins/global-shortcut/src/api-iife.js +++ b/plugins/global-shortcut/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_GLOBALSHORTCUT__=function(t){"use strict";function e(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)}var r;"function"==typeof SuppressedError&&SuppressedError;class n{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,r.set(this,(()=>{})),this.id=function(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}((t=>{e(this,r,"f").call(this,t)}))}set onmessage(t){!function(t,e,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?o.call(t,r):o?o.value=r:e.set(t,r)}(this,r,t,"f")}get onmessage(){return e(this,r,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}async function o(t,e={},r){return window.__TAURI_INTERNALS__.invoke(t,e,r)}return r=new WeakMap,t.isRegistered=async function(t){return await o("plugin:globalShortcut|is_registered",{shortcut:t})},t.register=async function(t,e){const r=new n;return r.onmessage=e,await o("plugin:globalShortcut|register",{shortcut:t,handler:r})},t.registerAll=async function(t,e){const r=new n;return r.onmessage=e,await o("plugin:globalShortcut|register_all",{shortcuts:t,handler:r})},t.unregister=async function(t){return await o("plugin:globalShortcut|unregister",{shortcut:t})},t.unregisterAll=async function(){return await o("plugin:globalShortcut|unregister_all")},t}({});Object.defineProperty(window.__TAURI__,"globalShortcut",{value:__TAURI_GLOBALSHORTCUT__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_GLOBALSHORTCUT__=function(t){"use strict";function e(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)}var r;"function"==typeof SuppressedError&&SuppressedError;class n{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,r.set(this,(()=>{})),this.id=function(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}((t=>{e(this,r,"f").call(this,t)}))}set onmessage(t){!function(t,e,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?o.call(t,r):o?o.value=r:e.set(t,r)}(this,r,t,"f")}get onmessage(){return e(this,r,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}async function o(t,e={},r){return window.__TAURI_INTERNALS__.invoke(t,e,r)}return r=new WeakMap,t.isRegistered=async function(t){return await o("plugin:globalShortcut|is_registered",{shortcut:t})},t.register=async function(t,e){const r=new n;return r.onmessage=e,await o("plugin:globalShortcut|register",{shortcut:t,handler:r})},t.registerAll=async function(t,e){const r=new n;return r.onmessage=e,await o("plugin:globalShortcut|register_all",{shortcuts:t,handler:r})},t.unregister=async function(t){return await o("plugin:globalShortcut|unregister",{shortcut:t})},t.unregisterAll=async function(){return await o("plugin:globalShortcut|unregister_all")},t}({});Object.defineProperty(window.__TAURI__,"globalShortcut",{value:__TAURI_PLUGIN_GLOBALSHORTCUT__})} diff --git a/plugins/http/package.json b/plugins/http/package.json index 345d2981e..4dc7bcf8b 100644 --- a/plugins/http/package.json +++ b/plugins/http/package.json @@ -6,26 +6,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "^2.5.0" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/plugins/http/rollup.config.js b/plugins/http/rollup.config.js new file mode 100644 index 000000000..8e039e06c --- /dev/null +++ b/plugins/http/rollup.config.js @@ -0,0 +1,3 @@ +import { createConfig } from "../../shared/rollup.config.js"; + +export default createConfig(); diff --git a/plugins/http/rollup.config.mjs b/plugins/http/rollup.config.mjs deleted file mode 100644 index 99a3dd319..000000000 --- a/plugins/http/rollup.config.mjs +++ /dev/null @@ -1,11 +0,0 @@ -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/], -}); diff --git a/plugins/http/src/api-iife.js b/plugins/http/src/api-iife.js index 1f1aedcc2..90b0ae7d2 100644 --- a/plugins/http/src/api-iife.js +++ b/plugins/http/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_HTTP__=function(e){"use strict";async function t(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}return"function"==typeof SuppressedError&&SuppressedError,e.fetch=async function(e,n){const r=null==n?void 0:n.maxRedirections,i=null==n?void 0:n.maxRedirections;n&&(delete n.maxRedirections,delete n.connectTimeout);const a=new Request(e,n),s=await a.arrayBuffer(),o=s.byteLength?Array.from(new Uint8Array(s)):null,u=await t("plugin:http|fetch",{method:a.method,url:a.url,headers:Array.from(a.headers.entries()),data:o,maxRedirections:r,connectTimeout:i});a.signal.addEventListener("abort",(()=>{t("plugin:http|fetch_cancel",{rid:u})}));const{status:d,statusText:c,url:_,headers:l}=await t("plugin:http|fetch_send",{rid:u}),f=await t("plugin:http|fetch_read_body",{rid:u}),h=new Response(new Uint8Array(f),{headers:l,status:d,statusText:c});return Object.defineProperty(h,"url",{value:_}),h},e}({});Object.defineProperty(window.__TAURI__,"http",{value:__TAURI_HTTP__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_HTTP__=function(e){"use strict";async function t(e,t={},r){return window.__TAURI_INTERNALS__.invoke(e,t,r)}return"function"==typeof SuppressedError&&SuppressedError,e.fetch=async function(e,r){const n=r?.maxRedirections,i=r?.maxRedirections;r&&(delete r.maxRedirections,delete r.connectTimeout);const a=new Request(e,r),s=await a.arrayBuffer(),o=s.byteLength?Array.from(new Uint8Array(s)):null,u=await t("plugin:http|fetch",{method:a.method,url:a.url,headers:Array.from(a.headers.entries()),data:o,maxRedirections:n,connectTimeout:i});a.signal.addEventListener("abort",(()=>{t("plugin:http|fetch_cancel",{rid:u})}));const{status:_,statusText:d,url:c,headers:f}=await t("plugin:http|fetch_send",{rid:u}),h=await t("plugin:http|fetch_read_body",{rid:u}),p=new Response(new Uint8Array(h),{headers:f,status:_,statusText:d});return Object.defineProperty(p,"url",{value:c}),p},e}({});Object.defineProperty(window.__TAURI__,"http",{value:__TAURI_PLUGIN_HTTP__})} diff --git a/plugins/log/package.json b/plugins/log/package.json index 79d4c2dfa..2fdc07508 100644 --- a/plugins/log/package.json +++ b/plugins/log/package.json @@ -7,26 +7,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "2.6.0" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/plugins/log/rollup.config.js b/plugins/log/rollup.config.js new file mode 100644 index 000000000..8e039e06c --- /dev/null +++ b/plugins/log/rollup.config.js @@ -0,0 +1,3 @@ +import { createConfig } from "../../shared/rollup.config.js"; + +export default createConfig(); diff --git a/plugins/log/rollup.config.mjs b/plugins/log/rollup.config.mjs deleted file mode 100644 index 99a3dd319..000000000 --- a/plugins/log/rollup.config.mjs +++ /dev/null @@ -1,11 +0,0 @@ -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/], -}); diff --git a/plugins/log/src/api-iife.js b/plugins/log/src/api-iife.js index 9ded0b4b7..097427ee4 100644 --- a/plugins/log/src/api-iife.js +++ b/plugins/log/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_LOG__=function(e){"use strict";function n(e,n=!1){return window.__TAURI_INTERNALS__.transformCallback(e,n)}async function r(e,n={},r){return window.__TAURI_INTERNALS__.invoke(e,n,r)}var a,o;async function t(e,a,o){return r("plugin:event|listen",{event:e,windowLabel:o?.target,handler:n(a)}).then((n=>async()=>async function(e,n){await r("plugin:event|unlisten",{event:e,eventId:n})}(e,n)))}async function i(e,n,a){var o,t;const i=null===(o=(new Error).stack)||void 0===o?void 0:o.split("\n").map((e=>e.split("@"))),l=null==i?void 0:i.filter((([e,n])=>e.length>0&&"[native code]"!==n)),{file:u,line:c,keyValues:s}=null!=a?a:{};let _=null===(t=null==l?void 0:l[0])||void 0===t?void 0:t.filter((e=>e.length>0)).join("@");"Error"===_&&(_="webview::unknown"),await r("plugin:log|log",{level:e,message:n,location:_,file:u,line:c,keyValues:s})}return"function"==typeof SuppressedError&&SuppressedError,function(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"}(a||(a={})),function(e){e[e.Trace=1]="Trace",e[e.Debug=2]="Debug",e[e.Info=3]="Info",e[e.Warn=4]="Warn",e[e.Error=5]="Error"}(o||(o={})),e.attachConsole=async function(){return await t("log://log",(e=>{const n=e.payload,r=n.message.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,"");switch(n.level){case o.Trace:console.log(r);break;case o.Debug:console.debug(r);break;case o.Info:console.info(r);break;case o.Warn:console.warn(r);break;case o.Error:console.error(r);break;default:throw new Error(`unknown log level ${n.level}`)}}))},e.debug=async function(e,n){await i(o.Debug,e,n)},e.error=async function(e,n){await i(o.Error,e,n)},e.info=async function(e,n){await i(o.Info,e,n)},e.trace=async function(e,n){await i(o.Trace,e,n)},e.warn=async function(e,n){await i(o.Warn,e,n)},e}({});Object.defineProperty(window.__TAURI__,"log",{value:__TAURI_LOG__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_LOG__=function(e){"use strict";function n(e,n=!1){return window.__TAURI_INTERNALS__.transformCallback(e,n)}async function r(e,n={},r){return window.__TAURI_INTERNALS__.invoke(e,n,r)}var a,o;async function t(e,a,o){return r("plugin:event|listen",{event:e,windowLabel:o?.target,handler:n(a)}).then((n=>async()=>async function(e,n){await r("plugin:event|unlisten",{event:e,eventId:n})}(e,n)))}async function i(e,n,a){const o=(new Error).stack?.split("\n").map((e=>e.split("@"))),t=o?.filter((([e,n])=>e.length>0&&"[native code]"!==n)),{file:i,line:c,keyValues:u}=a??{};let l=t?.[0]?.filter((e=>e.length>0)).join("@");"Error"===l&&(l="webview::unknown"),await r("plugin:log|log",{level:e,message:n,location:l,file:i,line:c,keyValues:u})}return"function"==typeof SuppressedError&&SuppressedError,function(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"}(a||(a={})),function(e){e[e.Trace=1]="Trace",e[e.Debug=2]="Debug",e[e.Info=3]="Info",e[e.Warn=4]="Warn",e[e.Error=5]="Error"}(o||(o={})),e.attachConsole=async function(){return await t("log://log",(e=>{const n=e.payload,r=n.message.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,"");switch(n.level){case o.Trace:console.log(r);break;case o.Debug:console.debug(r);break;case o.Info:console.info(r);break;case o.Warn:console.warn(r);break;case o.Error:console.error(r);break;default:throw new Error(`unknown log level ${n.level}`)}}))},e.debug=async function(e,n){await i(o.Debug,e,n)},e.error=async function(e,n){await i(o.Error,e,n)},e.info=async function(e,n){await i(o.Info,e,n)},e.trace=async function(e,n){await i(o.Trace,e,n)},e.warn=async function(e,n){await i(o.Warn,e,n)},e}({});Object.defineProperty(window.__TAURI__,"log",{value:__TAURI_PLUGIN_LOG__})} diff --git a/plugins/notification/package.json b/plugins/notification/package.json index 38a2e028b..75e574bce 100644 --- a/plugins/notification/package.json +++ b/plugins/notification/package.json @@ -6,26 +6,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "^2.4.1" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/plugins/notification/rollup.config.js b/plugins/notification/rollup.config.js new file mode 100644 index 000000000..d5a02667a --- /dev/null +++ b/plugins/notification/rollup.config.js @@ -0,0 +1,18 @@ +import { createConfig } from "../../shared/rollup.config.js"; +import { nodeResolve } from "@rollup/plugin-node-resolve"; +import typescript from "@rollup/plugin-typescript"; +import terser from "@rollup/plugin-terser"; + +export default createConfig({ + additionalConfigs: { + input: "guest-js/init.ts", + output: { + file: "src/init-iife.js", + format: "iife", + }, + plugins: [typescript(), terser(), nodeResolve()], + onwarn: (warning) => { + throw Object.assign(new Error(), warning); + }, + }, +}); diff --git a/plugins/notification/rollup.config.mjs b/plugins/notification/rollup.config.mjs deleted file mode 100644 index d2a3cda68..000000000 --- a/plugins/notification/rollup.config.mjs +++ /dev/null @@ -1,34 +0,0 @@ -import { readFileSync } from "fs"; - -import { createConfig } from "../../shared/rollup.config.mjs"; - -import typescript from "@rollup/plugin-typescript"; -import resolve from "@rollup/plugin-node-resolve"; -import terser from "@rollup/plugin-terser"; - -const config = createConfig({ - input: "guest-js/index.ts", - pkg: JSON.parse( - readFileSync(new URL("./package.json", import.meta.url), "utf8"), - ), - external: [/^@tauri-apps\/api/], -}); - -config.push({ - input: "guest-js/init.ts", - output: { - file: "src/init-iife.js", - format: "iife", - }, - plugins: [ - resolve(), - typescript({ - sourceMap: false, - declaration: false, - declarationDir: undefined, - }), - terser(), - ], -}); - -export default config; diff --git a/plugins/notification/src/api-iife.js b/plugins/notification/src/api-iife.js index b2ebe1e0c..1e9971976 100644 --- a/plugins/notification/src/api-iife.js +++ b/plugins/notification/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_NOTIFICATION__=function(n){"use strict";function i(n,i,e,t){if("a"===e&&!t)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof i?n!==i||!t:!i.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===e?t:"a"===e?t.call(n):t?t.value:i.get(n)}var e,t,o,r;"function"==typeof SuppressedError&&SuppressedError;class c{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,e.set(this,(()=>{})),this.id=function(n,i=!1){return window.__TAURI_INTERNALS__.transformCallback(n,i)}((n=>{i(this,e,"f").call(this,n)}))}set onmessage(n){!function(n,i,e,t,o){if("m"===t)throw new TypeError("Private method is not writable");if("a"===t&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof i?n!==i||!o:!i.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===t?o.call(n,e):o?o.value=e:i.set(n,e)}(this,e,n,"f")}get onmessage(){return i(this,e,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}e=new WeakMap;class a{constructor(n,i,e){this.plugin=n,this.event=i,this.channelId=e}async unregister(){return u(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}}async function s(n,i,e){const t=new c;return t.onmessage=e,u(`plugin:${n}|register_listener`,{event:i,handler:t}).then((()=>new a(n,i,t.id)))}async function u(n,i={},e){return window.__TAURI_INTERNALS__.invoke(n,i,e)}return function(n){n.Year="year",n.Month="month",n.TwoWeeks="twoWeeks",n.Week="week",n.Day="day",n.Hour="hour",n.Minute="minute",n.Second="second"}(t||(t={})),n.Importance=void 0,(o=n.Importance||(n.Importance={}))[o.None=0]="None",o[o.Min=1]="Min",o[o.Low=2]="Low",o[o.Default=3]="Default",o[o.High=4]="High",n.Visibility=void 0,(r=n.Visibility||(n.Visibility={}))[r.Secret=-1]="Secret",r[r.Private=0]="Private",r[r.Public=1]="Public",n.active=async function(){return u("plugin:notification|get_active")},n.cancel=async function(n){return u("plugin:notification|cancel",{notifications:n})},n.cancelAll=async function(){return u("plugin:notification|cancel")},n.channels=async function(){return u("plugin:notification|listChannels")},n.createChannel=async function(n){return u("plugin:notification|create_channel",{...n})},n.isPermissionGranted=async function(){return"default"!==window.Notification.permission?Promise.resolve("granted"===window.Notification.permission):u("plugin:notification|is_permission_granted")},n.onAction=async function(n){return s("notification","actionPerformed",n)},n.onNotificationReceived=async function(n){return s("notification","notification",n)},n.pending=async function(){return u("plugin:notification|get_pending")},n.registerActionTypes=async function(n){return u("plugin:notification|register_action_types",{types:n})},n.removeActive=async function(n){return u("plugin:notification|remove_active",{notifications:n})},n.removeAllActive=async function(){return u("plugin:notification|remove_active")},n.removeChannel=async function(n){return u("plugin:notification|delete_channel",{id:n})},n.requestPermission=async function(){return window.Notification.requestPermission()},n.sendNotification=function(n){"string"==typeof n?new window.Notification(n):new window.Notification(n.title,n)},n}({});Object.defineProperty(window.__TAURI__,"notification",{value:__TAURI_NOTIFICATION__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_NOTIFICATION__=function(n){"use strict";function i(n,i,e,t){if("a"===e&&!t)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof i?n!==i||!t:!i.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===e?t:"a"===e?t.call(n):t?t.value:i.get(n)}var e,t,o,r;"function"==typeof SuppressedError&&SuppressedError;class c{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,e.set(this,(()=>{})),this.id=function(n,i=!1){return window.__TAURI_INTERNALS__.transformCallback(n,i)}((n=>{i(this,e,"f").call(this,n)}))}set onmessage(n){!function(n,i,e,t,o){if("m"===t)throw new TypeError("Private method is not writable");if("a"===t&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof i?n!==i||!o:!i.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===t?o.call(n,e):o?o.value=e:i.set(n,e)}(this,e,n,"f")}get onmessage(){return i(this,e,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}e=new WeakMap;class a{constructor(n,i,e){this.plugin=n,this.event=i,this.channelId=e}async unregister(){return u(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}}async function s(n,i,e){const t=new c;return t.onmessage=e,u(`plugin:${n}|register_listener`,{event:i,handler:t}).then((()=>new a(n,i,t.id)))}async function u(n,i={},e){return window.__TAURI_INTERNALS__.invoke(n,i,e)}return function(n){n.Year="year",n.Month="month",n.TwoWeeks="twoWeeks",n.Week="week",n.Day="day",n.Hour="hour",n.Minute="minute",n.Second="second"}(t||(t={})),n.Importance=void 0,(o=n.Importance||(n.Importance={}))[o.None=0]="None",o[o.Min=1]="Min",o[o.Low=2]="Low",o[o.Default=3]="Default",o[o.High=4]="High",n.Visibility=void 0,(r=n.Visibility||(n.Visibility={}))[r.Secret=-1]="Secret",r[r.Private=0]="Private",r[r.Public=1]="Public",n.active=async function(){return u("plugin:notification|get_active")},n.cancel=async function(n){return u("plugin:notification|cancel",{notifications:n})},n.cancelAll=async function(){return u("plugin:notification|cancel")},n.channels=async function(){return u("plugin:notification|listChannels")},n.createChannel=async function(n){return u("plugin:notification|create_channel",{...n})},n.isPermissionGranted=async function(){return"default"!==window.Notification.permission?Promise.resolve("granted"===window.Notification.permission):u("plugin:notification|is_permission_granted")},n.onAction=async function(n){return s("notification","actionPerformed",n)},n.onNotificationReceived=async function(n){return s("notification","notification",n)},n.pending=async function(){return u("plugin:notification|get_pending")},n.registerActionTypes=async function(n){return u("plugin:notification|register_action_types",{types:n})},n.removeActive=async function(n){return u("plugin:notification|remove_active",{notifications:n})},n.removeAllActive=async function(){return u("plugin:notification|remove_active")},n.removeChannel=async function(n){return u("plugin:notification|delete_channel",{id:n})},n.requestPermission=async function(){return window.Notification.requestPermission()},n.sendNotification=function(n){"string"==typeof n?new window.Notification(n):new window.Notification(n.title,n)},n}({});Object.defineProperty(window.__TAURI__,"notification",{value:__TAURI_PLUGIN_NOTIFICATION__})} diff --git a/plugins/os/package.json b/plugins/os/package.json index 0bd95aeba..df6e9594a 100644 --- a/plugins/os/package.json +++ b/plugins/os/package.json @@ -6,26 +6,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "2.6.0" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/plugins/os/rollup.config.js b/plugins/os/rollup.config.js new file mode 100644 index 000000000..8e039e06c --- /dev/null +++ b/plugins/os/rollup.config.js @@ -0,0 +1,3 @@ +import { createConfig } from "../../shared/rollup.config.js"; + +export default createConfig(); diff --git a/plugins/os/rollup.config.mjs b/plugins/os/rollup.config.mjs deleted file mode 100644 index 99a3dd319..000000000 --- a/plugins/os/rollup.config.mjs +++ /dev/null @@ -1,11 +0,0 @@ -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/], -}); diff --git a/plugins/os/src/api-iife.js b/plugins/os/src/api-iife.js index 0adb2ae2f..a6dfc3f0c 100644 --- a/plugins/os/src/api-iife.js +++ b/plugins/os/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_OS__=function(n){"use strict";async function o(n,o={},e){return window.__TAURI_INTERNALS__.invoke(n,o,e)}return"function"==typeof SuppressedError&&SuppressedError,n.arch=async function(){return o("plugin:os|arch")},n.eol=function(){return window.__TAURI__.os.__eol},n.exeExtension=async function(){return o("plugin:os|exe_extension")},n.family=async function(){return o("plugin:os|family")},n.hostname=async function(){return o("plugin:os|hostname")},n.locale=async function(){return o("plugin:os|locale")},n.platform=async function(){return o("plugin:os|platform")},n.type=async function(){return o("plugin:os|os_type")},n.version=async function(){return o("plugin:os|version")},n}({});Object.defineProperty(window.__TAURI__,"os",{value:__TAURI_OS__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_OS__=function(n){"use strict";async function o(n,o={},e){return window.__TAURI_INTERNALS__.invoke(n,o,e)}return"function"==typeof SuppressedError&&SuppressedError,n.arch=async function(){return o("plugin:os|arch")},n.eol=function(){return window.__TAURI__.os.__eol},n.exeExtension=async function(){return o("plugin:os|exe_extension")},n.family=async function(){return o("plugin:os|family")},n.hostname=async function(){return o("plugin:os|hostname")},n.locale=async function(){return o("plugin:os|locale")},n.platform=async function(){return o("plugin:os|platform")},n.type=async function(){return o("plugin:os|os_type")},n.version=async function(){return o("plugin:os|version")},n}({});Object.defineProperty(window.__TAURI__,"os",{value:__TAURI_PLUGIN_OS__})} diff --git a/plugins/positioner/package.json b/plugins/positioner/package.json index 42f0e8059..1894cc850 100644 --- a/plugins/positioner/package.json +++ b/plugins/positioner/package.json @@ -7,26 +7,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "2.6.0" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/plugins/positioner/rollup.config.js b/plugins/positioner/rollup.config.js new file mode 100644 index 000000000..8e039e06c --- /dev/null +++ b/plugins/positioner/rollup.config.js @@ -0,0 +1,3 @@ +import { createConfig } from "../../shared/rollup.config.js"; + +export default createConfig(); diff --git a/plugins/positioner/rollup.config.mjs b/plugins/positioner/rollup.config.mjs deleted file mode 100644 index 99a3dd319..000000000 --- a/plugins/positioner/rollup.config.mjs +++ /dev/null @@ -1,11 +0,0 @@ -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/], -}); diff --git a/plugins/positioner/src/api-iife.js b/plugins/positioner/src/api-iife.js index fad6fc298..d0c8ba69c 100644 --- a/plugins/positioner/src/api-iife.js +++ b/plugins/positioner/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_POSITIONER__=function(t){"use strict";var o;return"function"==typeof SuppressedError&&SuppressedError,t.Position=void 0,(o=t.Position||(t.Position={}))[o.TopLeft=0]="TopLeft",o[o.TopRight=1]="TopRight",o[o.BottomLeft=2]="BottomLeft",o[o.BottomRight=3]="BottomRight",o[o.TopCenter=4]="TopCenter",o[o.BottomCenter=5]="BottomCenter",o[o.LeftCenter=6]="LeftCenter",o[o.RightCenter=7]="RightCenter",o[o.Center=8]="Center",o[o.TrayLeft=9]="TrayLeft",o[o.TrayBottomLeft=10]="TrayBottomLeft",o[o.TrayRight=11]="TrayRight",o[o.TrayBottomRight=12]="TrayBottomRight",o[o.TrayCenter=13]="TrayCenter",o[o.TrayBottomCenter=14]="TrayBottomCenter",t.moveWindow=async function(t){await async function(t,o={},e){return window.__TAURI_INTERNALS__.invoke(t,o,e)}("plugin:positioner|move_window",{position:t})},t}({});Object.defineProperty(window.__TAURI__,"positioner",{value:__TAURI_POSITIONER__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_POSITIONER__=function(t){"use strict";var o;return"function"==typeof SuppressedError&&SuppressedError,t.Position=void 0,(o=t.Position||(t.Position={}))[o.TopLeft=0]="TopLeft",o[o.TopRight=1]="TopRight",o[o.BottomLeft=2]="BottomLeft",o[o.BottomRight=3]="BottomRight",o[o.TopCenter=4]="TopCenter",o[o.BottomCenter=5]="BottomCenter",o[o.LeftCenter=6]="LeftCenter",o[o.RightCenter=7]="RightCenter",o[o.Center=8]="Center",o[o.TrayLeft=9]="TrayLeft",o[o.TrayBottomLeft=10]="TrayBottomLeft",o[o.TrayRight=11]="TrayRight",o[o.TrayBottomRight=12]="TrayBottomRight",o[o.TrayCenter=13]="TrayCenter",o[o.TrayBottomCenter=14]="TrayBottomCenter",t.moveWindow=async function(t){await async function(t,o={},e){return window.__TAURI_INTERNALS__.invoke(t,o,e)}("plugin:positioner|move_window",{position:t})},t}({});Object.defineProperty(window.__TAURI__,"positioner",{value:__TAURI_PLUGIN_POSITIONER__})} diff --git a/plugins/process/package.json b/plugins/process/package.json index b95279821..1ed26c3ae 100644 --- a/plugins/process/package.json +++ b/plugins/process/package.json @@ -6,26 +6,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "2.6.0" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/plugins/process/rollup.config.js b/plugins/process/rollup.config.js new file mode 100644 index 000000000..8e039e06c --- /dev/null +++ b/plugins/process/rollup.config.js @@ -0,0 +1,3 @@ +import { createConfig } from "../../shared/rollup.config.js"; + +export default createConfig(); diff --git a/plugins/process/rollup.config.mjs b/plugins/process/rollup.config.mjs deleted file mode 100644 index 99a3dd319..000000000 --- a/plugins/process/rollup.config.mjs +++ /dev/null @@ -1,11 +0,0 @@ -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/], -}); diff --git a/plugins/process/src/api-iife.js b/plugins/process/src/api-iife.js index 35dbaed1f..df87d8c9a 100644 --- a/plugins/process/src/api-iife.js +++ b/plugins/process/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_PROCESS__=function(n){"use strict";async function r(n,r={},e){return window.__TAURI_INTERNALS__.invoke(n,r,e)}return"function"==typeof SuppressedError&&SuppressedError,n.exit=async function(n=0){return r("plugin:process|exit",{code:n})},n.relaunch=async function(){return r("plugin:process|restart")},n}({});Object.defineProperty(window.__TAURI__,"process",{value:__TAURI_PROCESS__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_PROCESS__=function(n){"use strict";async function r(n,r={},_){return window.__TAURI_INTERNALS__.invoke(n,r,_)}return"function"==typeof SuppressedError&&SuppressedError,n.exit=async function(n=0){return r("plugin:process|exit",{code:n})},n.relaunch=async function(){return r("plugin:process|restart")},n}({});Object.defineProperty(window.__TAURI__,"process",{value:__TAURI_PLUGIN_PROCESS__})} diff --git a/plugins/shell/package.json b/plugins/shell/package.json index f2a3d9b95..3888991d8 100644 --- a/plugins/shell/package.json +++ b/plugins/shell/package.json @@ -6,26 +6,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "^2.4.1" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/plugins/shell/rollup.config.js b/plugins/shell/rollup.config.js new file mode 100644 index 000000000..d5a02667a --- /dev/null +++ b/plugins/shell/rollup.config.js @@ -0,0 +1,18 @@ +import { createConfig } from "../../shared/rollup.config.js"; +import { nodeResolve } from "@rollup/plugin-node-resolve"; +import typescript from "@rollup/plugin-typescript"; +import terser from "@rollup/plugin-terser"; + +export default createConfig({ + additionalConfigs: { + input: "guest-js/init.ts", + output: { + file: "src/init-iife.js", + format: "iife", + }, + plugins: [typescript(), terser(), nodeResolve()], + onwarn: (warning) => { + throw Object.assign(new Error(), warning); + }, + }, +}); diff --git a/plugins/shell/rollup.config.mjs b/plugins/shell/rollup.config.mjs deleted file mode 100644 index d2a3cda68..000000000 --- a/plugins/shell/rollup.config.mjs +++ /dev/null @@ -1,34 +0,0 @@ -import { readFileSync } from "fs"; - -import { createConfig } from "../../shared/rollup.config.mjs"; - -import typescript from "@rollup/plugin-typescript"; -import resolve from "@rollup/plugin-node-resolve"; -import terser from "@rollup/plugin-terser"; - -const config = createConfig({ - input: "guest-js/index.ts", - pkg: JSON.parse( - readFileSync(new URL("./package.json", import.meta.url), "utf8"), - ), - external: [/^@tauri-apps\/api/], -}); - -config.push({ - input: "guest-js/init.ts", - output: { - file: "src/init-iife.js", - format: "iife", - }, - plugins: [ - resolve(), - typescript({ - sourceMap: false, - declaration: false, - declarationDir: undefined, - }), - terser(), - ], -}); - -export default config; diff --git a/plugins/shell/src/api-iife.js b/plugins/shell/src/api-iife.js index 6247a3f5c..a64b87106 100644 --- a/plugins/shell/src/api-iife.js +++ b/plugins/shell/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_SHELL__=function(e){"use strict";function t(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)}var s;"function"==typeof SuppressedError&&SuppressedError;class r{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,s.set(this,(()=>{})),this.id=function(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}((e=>{t(this,s,"f").call(this,e)}))}set onmessage(e){!function(e,t,s,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?n.call(e,s):n?n.value=s:t.set(e,s)}(this,s,e,"f")}get onmessage(){return t(this,s,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}async function n(e,t={},s){return window.__TAURI_INTERNALS__.invoke(e,t,s)}s=new WeakMap;class i{constructor(){this.eventListeners=Object.create(null)}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}on(e,t){return e in this.eventListeners?this.eventListeners[e].push(t):this.eventListeners[e]=[t],this}once(e,t){const s=r=>{this.removeListener(e,s),t(r)};return this.addListener(e,s)}off(e,t){return e in this.eventListeners&&(this.eventListeners[e]=this.eventListeners[e].filter((e=>e!==t))),this}removeAllListeners(e){return e?delete this.eventListeners[e]:this.eventListeners=Object.create(null),this}emit(e,t){if(e in this.eventListeners){const s=this.eventListeners[e];for(const e of s)e(t);return!0}return!1}listenerCount(e){return e in this.eventListeners?this.eventListeners[e].length:0}prependListener(e,t){return e in this.eventListeners?this.eventListeners[e].unshift(t):this.eventListeners[e]=[t],this}prependOnceListener(e,t){const s=r=>{this.removeListener(e,s),t(r)};return this.prependListener(e,s)}}class o{constructor(e){this.pid=e}async write(e){return n("plugin:shell|stdin_write",{pid:this.pid,buffer:"string"==typeof e?e:Array.from(e)})}async kill(){return n("plugin:shell|kill",{cmd:"killChild",pid:this.pid})}}class a extends i{constructor(e,t=[],s){super(),this.stdout=new i,this.stderr=new i,this.program=e,this.args="string"==typeof t?[t]:t,this.options=null!=s?s:{}}static create(e,t=[],s){return new a(e,t,s)}static sidecar(e,t=[],s){const r=new a(e,t,s);return r.options.sidecar=!0,r}async spawn(){return async function(e,t,s=[],i){"object"==typeof s&&Object.freeze(s);const o=new r;return o.onmessage=e,n("plugin:shell|execute",{program:t,args:s,options:i,onEvent:o})}((e=>{switch(e.event){case"Error":this.emit("error",e.payload);break;case"Terminated":this.emit("close",e.payload);break;case"Stdout":this.stdout.emit("data",e.payload);break;case"Stderr":this.stderr.emit("data",e.payload)}}),this.program,this.args,this.options).then((e=>new o(e)))}async execute(){return new Promise(((e,t)=>{this.on("error",t);const s=[],r=[];this.stdout.on("data",(e=>{s.push(e)})),this.stderr.on("data",(e=>{r.push(e)})),this.on("close",(t=>{e({code:t.code,signal:t.signal,stdout:this.collectOutput(s),stderr:this.collectOutput(r)})})),this.spawn().catch(t)}))}collectOutput(e){return"raw"===this.options.encoding?e.reduce(((e,t)=>new Uint8Array([...e,...t,10])),new Uint8Array):e.join("\n")}}return e.Child=o,e.Command=a,e.EventEmitter=i,e.open=async function(e,t){return n("plugin:shell|open",{path:e,with:t})},e}({});Object.defineProperty(window.__TAURI__,"shell",{value:__TAURI_SHELL__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_SHELL__=function(e){"use strict";function t(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)}var s;"function"==typeof SuppressedError&&SuppressedError;class r{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,s.set(this,(()=>{})),this.id=function(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}((e=>{t(this,s,"f").call(this,e)}))}set onmessage(e){!function(e,t,s,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?n.call(e,s):n?n.value=s:t.set(e,s)}(this,s,e,"f")}get onmessage(){return t(this,s,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}async function n(e,t={},s){return window.__TAURI_INTERNALS__.invoke(e,t,s)}s=new WeakMap;class i{constructor(){this.eventListeners=Object.create(null)}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}on(e,t){return e in this.eventListeners?this.eventListeners[e].push(t):this.eventListeners[e]=[t],this}once(e,t){const s=r=>{this.removeListener(e,s),t(r)};return this.addListener(e,s)}off(e,t){return e in this.eventListeners&&(this.eventListeners[e]=this.eventListeners[e].filter((e=>e!==t))),this}removeAllListeners(e){return e?delete this.eventListeners[e]:this.eventListeners=Object.create(null),this}emit(e,t){if(e in this.eventListeners){const s=this.eventListeners[e];for(const e of s)e(t);return!0}return!1}listenerCount(e){return e in this.eventListeners?this.eventListeners[e].length:0}prependListener(e,t){return e in this.eventListeners?this.eventListeners[e].unshift(t):this.eventListeners[e]=[t],this}prependOnceListener(e,t){const s=r=>{this.removeListener(e,s),t(r)};return this.prependListener(e,s)}}class o{constructor(e){this.pid=e}async write(e){return n("plugin:shell|stdin_write",{pid:this.pid,buffer:"string"==typeof e?e:Array.from(e)})}async kill(){return n("plugin:shell|kill",{cmd:"killChild",pid:this.pid})}}class a extends i{constructor(e,t=[],s){super(),this.stdout=new i,this.stderr=new i,this.program=e,this.args="string"==typeof t?[t]:t,this.options=s??{}}static create(e,t=[],s){return new a(e,t,s)}static sidecar(e,t=[],s){const r=new a(e,t,s);return r.options.sidecar=!0,r}async spawn(){return async function(e,t,s=[],i){"object"==typeof s&&Object.freeze(s);const o=new r;return o.onmessage=e,n("plugin:shell|execute",{program:t,args:s,options:i,onEvent:o})}((e=>{switch(e.event){case"Error":this.emit("error",e.payload);break;case"Terminated":this.emit("close",e.payload);break;case"Stdout":this.stdout.emit("data",e.payload);break;case"Stderr":this.stderr.emit("data",e.payload)}}),this.program,this.args,this.options).then((e=>new o(e)))}async execute(){return new Promise(((e,t)=>{this.on("error",t);const s=[],r=[];this.stdout.on("data",(e=>{s.push(e)})),this.stderr.on("data",(e=>{r.push(e)})),this.on("close",(t=>{e({code:t.code,signal:t.signal,stdout:this.collectOutput(s),stderr:this.collectOutput(r)})})),this.spawn().catch(t)}))}collectOutput(e){return"raw"===this.options.encoding?e.reduce(((e,t)=>new Uint8Array([...e,...t,10])),new Uint8Array):e.join("\n")}}return e.Child=o,e.Command=a,e.EventEmitter=i,e.open=async function(e,t){return n("plugin:shell|open",{path:e,with:t})},e}({});Object.defineProperty(window.__TAURI__,"shell",{value:__TAURI_PLUGIN_SHELL__})} diff --git a/plugins/shell/src/init-iife.js b/plugins/shell/src/init-iife.js index 70e3dc1ae..abc8a15f7 100644 --- a/plugins/shell/src/init-iife.js +++ b/plugins/shell/src/init-iife.js @@ -1 +1 @@ -!function(){"use strict";async function e(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}function t(){var t;null===(t=document.querySelector("body"))||void 0===t||t.addEventListener("click",(function(t){let n=t.target;for(;null!=n;){if(n.matches("a")){const r=n;r.href&&["http://","https://","mailto:","tel:"].some((e=>r.href.startsWith(e)))&&"_blank"===r.target&&(e("plugin:shell|open",{path:r.href}),t.preventDefault());break}n=n.parentElement}}))}"function"==typeof SuppressedError&&SuppressedError,"complete"===document.readyState||"interactive"===document.readyState?t():window.addEventListener("DOMContentLoaded",t,!0)}(); +!function(){"use strict";async function e(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}function t(){document.querySelector("body")?.addEventListener("click",(function(t){let n=t.target;for(;null!=n;){if(n.matches("a")){const r=n;r.href&&["http://","https://","mailto:","tel:"].some((e=>r.href.startsWith(e)))&&"_blank"===r.target&&(e("plugin:shell|open",{path:r.href}),t.preventDefault());break}n=n.parentElement}}))}"function"==typeof SuppressedError&&SuppressedError,"complete"===document.readyState||"interactive"===document.readyState?t():window.addEventListener("DOMContentLoaded",t,!0)}(); diff --git a/plugins/sql/package.json b/plugins/sql/package.json index 932b36492..cb90f3e4a 100644 --- a/plugins/sql/package.json +++ b/plugins/sql/package.json @@ -7,26 +7,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "2.6.0" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/plugins/sql/rollup.config.js b/plugins/sql/rollup.config.js new file mode 100644 index 000000000..8e039e06c --- /dev/null +++ b/plugins/sql/rollup.config.js @@ -0,0 +1,3 @@ +import { createConfig } from "../../shared/rollup.config.js"; + +export default createConfig(); diff --git a/plugins/sql/rollup.config.mjs b/plugins/sql/rollup.config.mjs deleted file mode 100644 index 99a3dd319..000000000 --- a/plugins/sql/rollup.config.mjs +++ /dev/null @@ -1,11 +0,0 @@ -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/], -}); diff --git a/plugins/sql/src/api-iife.js b/plugins/sql/src/api-iife.js index 3ee9c447a..a30f68d90 100644 --- a/plugins/sql/src/api-iife.js +++ b/plugins/sql/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_SQL__=function(){"use strict";async function e(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}"function"==typeof SuppressedError&&SuppressedError;class t{constructor(e){this.path=e}static async load(n){const s=await e("plugin:sql|load",{db:n});return new t(s)}static get(e){return new t(e)}async execute(t,n){const[s,r]=await e("plugin:sql|execute",{db:this.path,query:t,values:null!=n?n:[]});return{lastInsertId:r,rowsAffected:s}}async select(t,n){return await e("plugin:sql|select",{db:this.path,query:t,values:null!=n?n:[]})}async close(t){return await e("plugin:sql|close",{db:t})}}return t}();Object.defineProperty(window.__TAURI__,"sql",{value:__TAURI_SQL__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_SQL__=function(){"use strict";async function e(e,t={},s){return window.__TAURI_INTERNALS__.invoke(e,t,s)}"function"==typeof SuppressedError&&SuppressedError;class t{constructor(e){this.path=e}static async load(s){const n=await e("plugin:sql|load",{db:s});return new t(n)}static get(e){return new t(e)}async execute(t,s){const[n,r]=await e("plugin:sql|execute",{db:this.path,query:t,values:s??[]});return{lastInsertId:r,rowsAffected:n}}async select(t,s){return await e("plugin:sql|select",{db:this.path,query:t,values:s??[]})}async close(t){return await e("plugin:sql|close",{db:t})}}return t}();Object.defineProperty(window.__TAURI__,"sql",{value:__TAURI_PLUGIN_SQL__})} diff --git a/plugins/store/package.json b/plugins/store/package.json index 588d7e70c..2e0d61640 100644 --- a/plugins/store/package.json +++ b/plugins/store/package.json @@ -7,26 +7,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "2.6.0" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/plugins/store/rollup.config.js b/plugins/store/rollup.config.js new file mode 100644 index 000000000..8e039e06c --- /dev/null +++ b/plugins/store/rollup.config.js @@ -0,0 +1,3 @@ +import { createConfig } from "../../shared/rollup.config.js"; + +export default createConfig(); diff --git a/plugins/store/rollup.config.mjs b/plugins/store/rollup.config.mjs deleted file mode 100644 index 99a3dd319..000000000 --- a/plugins/store/rollup.config.mjs +++ /dev/null @@ -1,11 +0,0 @@ -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/], -}); diff --git a/plugins/store/src/api-iife.js b/plugins/store/src/api-iife.js index c580c8c40..88d1ff2fd 100644 --- a/plugins/store/src/api-iife.js +++ b/plugins/store/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_STORE__=function(t){"use strict";function a(t,a=!1){return window.__TAURI_INTERNALS__.transformCallback(t,a)}async function e(t,a={},e){return window.__TAURI_INTERNALS__.invoke(t,a,e)}var n;async function r(t,n,r){return e("plugin:event|listen",{event:t,windowLabel:r?.target,handler:a(n)}).then((a=>async()=>async function(t,a){await e("plugin:event|unlisten",{event:t,eventId:a})}(t,a)))}"function"==typeof SuppressedError&&SuppressedError,function(t){t.WINDOW_RESIZED="tauri://resize",t.WINDOW_MOVED="tauri://move",t.WINDOW_CLOSE_REQUESTED="tauri://close-requested",t.WINDOW_CREATED="tauri://window-created",t.WINDOW_DESTROYED="tauri://destroyed",t.WINDOW_FOCUS="tauri://focus",t.WINDOW_BLUR="tauri://blur",t.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",t.WINDOW_THEME_CHANGED="tauri://theme-changed",t.WINDOW_FILE_DROP="tauri://file-drop",t.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",t.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",t.MENU="tauri://menu"}(n||(n={}));return t.Store=class{constructor(t){this.path=t}async set(t,a){return await e("plugin:store|set",{path:this.path,key:t,value:a})}async get(t){return await e("plugin:store|get",{path:this.path,key:t})}async has(t){return await e("plugin:store|has",{path:this.path,key:t})}async delete(t){return await e("plugin:store|delete",{path:this.path,key:t})}async clear(){return await e("plugin:store|clear",{path:this.path})}async reset(){return await e("plugin:store|reset",{path:this.path})}async keys(){return await e("plugin:store|keys",{path:this.path})}async values(){return await e("plugin:store|values",{path:this.path})}async entries(){return await e("plugin:store|entries",{path:this.path})}async length(){return await e("plugin:store|length",{path:this.path})}async load(){return await e("plugin:store|load",{path:this.path})}async save(){return await e("plugin:store|save",{path:this.path})}async onKeyChange(t,a){return await r("store://change",(e=>{e.payload.path===this.path&&e.payload.key===t&&a(e.payload.value)}))}async onChange(t){return await r("store://change",(a=>{a.payload.path===this.path&&t(a.payload.key,a.payload.value)}))}},t}({});Object.defineProperty(window.__TAURI__,"store",{value:__TAURI_STORE__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_STORE__=function(t){"use strict";function a(t,a=!1){return window.__TAURI_INTERNALS__.transformCallback(t,a)}async function e(t,a={},e){return window.__TAURI_INTERNALS__.invoke(t,a,e)}var n;async function r(t,n,r){return e("plugin:event|listen",{event:t,windowLabel:r?.target,handler:a(n)}).then((a=>async()=>async function(t,a){await e("plugin:event|unlisten",{event:t,eventId:a})}(t,a)))}"function"==typeof SuppressedError&&SuppressedError,function(t){t.WINDOW_RESIZED="tauri://resize",t.WINDOW_MOVED="tauri://move",t.WINDOW_CLOSE_REQUESTED="tauri://close-requested",t.WINDOW_CREATED="tauri://window-created",t.WINDOW_DESTROYED="tauri://destroyed",t.WINDOW_FOCUS="tauri://focus",t.WINDOW_BLUR="tauri://blur",t.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",t.WINDOW_THEME_CHANGED="tauri://theme-changed",t.WINDOW_FILE_DROP="tauri://file-drop",t.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",t.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",t.MENU="tauri://menu"}(n||(n={}));return t.Store=class{constructor(t){this.path=t}async set(t,a){return await e("plugin:store|set",{path:this.path,key:t,value:a})}async get(t){return await e("plugin:store|get",{path:this.path,key:t})}async has(t){return await e("plugin:store|has",{path:this.path,key:t})}async delete(t){return await e("plugin:store|delete",{path:this.path,key:t})}async clear(){return await e("plugin:store|clear",{path:this.path})}async reset(){return await e("plugin:store|reset",{path:this.path})}async keys(){return await e("plugin:store|keys",{path:this.path})}async values(){return await e("plugin:store|values",{path:this.path})}async entries(){return await e("plugin:store|entries",{path:this.path})}async length(){return await e("plugin:store|length",{path:this.path})}async load(){return await e("plugin:store|load",{path:this.path})}async save(){return await e("plugin:store|save",{path:this.path})}async onKeyChange(t,a){return await r("store://change",(e=>{e.payload.path===this.path&&e.payload.key===t&&a(e.payload.value)}))}async onChange(t){return await r("store://change",(a=>{a.payload.path===this.path&&t(a.payload.key,a.payload.value)}))}},t}({});Object.defineProperty(window.__TAURI__,"store",{value:__TAURI_PLUGIN_STORE__})} diff --git a/plugins/stronghold/package.json b/plugins/stronghold/package.json index 473eacb56..1aebb0333 100644 --- a/plugins/stronghold/package.json +++ b/plugins/stronghold/package.json @@ -7,26 +7,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "2.6.0" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/plugins/stronghold/rollup.config.js b/plugins/stronghold/rollup.config.js new file mode 100644 index 000000000..8e039e06c --- /dev/null +++ b/plugins/stronghold/rollup.config.js @@ -0,0 +1,3 @@ +import { createConfig } from "../../shared/rollup.config.js"; + +export default createConfig(); diff --git a/plugins/stronghold/rollup.config.mjs b/plugins/stronghold/rollup.config.mjs deleted file mode 100644 index 99a3dd319..000000000 --- a/plugins/stronghold/rollup.config.mjs +++ /dev/null @@ -1,11 +0,0 @@ -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/], -}); diff --git a/plugins/stronghold/src/api-iife.js b/plugins/stronghold/src/api-iife.js index ab414f34f..b8f95ec42 100644 --- a/plugins/stronghold/src/api-iife.js +++ b/plugins/stronghold/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_STRONGHOLD__=function(t){"use strict";async function e(t,e={},r){return window.__TAURI_INTERNALS__.invoke(t,e,r)}function r(t){return"string"==typeof t?t:Array.from(t instanceof ArrayBuffer?new Uint8Array(t):t)}"function"==typeof SuppressedError&&SuppressedError;class n{constructor(t,e){this.type=t,this.payload=e}static generic(t,e){return new n("Generic",{vault:r(t),record:r(e)})}static counter(t,e){return new n("Counter",{vault:r(t),counter:e})}}class a{constructor(t){this.procedureArgs=t}async generateSLIP10Seed(t,r){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"SLIP10Generate",payload:{output:t,sizeBytes:r}}}).then((t=>Uint8Array.from(t)))}async deriveSLIP10(t,r,n,a){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"SLIP10Derive",payload:{chain:t,input:{type:r,payload:n},output:a}}}).then((t=>Uint8Array.from(t)))}async recoverBIP39(t,r,n){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"BIP39Recover",payload:{mnemonic:t,passphrase:n,output:r}}}).then((t=>Uint8Array.from(t)))}async generateBIP39(t,r){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"BIP39Generate",payload:{output:t,passphrase:r}}}).then((t=>Uint8Array.from(t)))}async getEd25519PublicKey(t){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"PublicKey",payload:{type:"Ed25519",privateKey:t}}}).then((t=>Uint8Array.from(t)))}async signEd25519(t,r){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"Ed25519Sign",payload:{privateKey:t,msg:r}}}).then((t=>Uint8Array.from(t)))}}class s{constructor(t,e){this.path=t,this.name=r(e)}getVault(t){return new i(this.path,this.name,r(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 e("plugin:stronghold|get_store_record",{snapshotPath:this.path,client:this.client,key:r(t)}).then((t=>null!=t?Uint8Array.from(t):null))}async insert(t,n,a){return await e("plugin:stronghold|save_store_record",{snapshotPath:this.path,client:this.client,key:r(t),value:n,lifetime:a})}async remove(t){return await e("plugin:stronghold|remove_store_record",{snapshotPath:this.path,client:this.client,key:r(t)}).then((t=>null!=t?Uint8Array.from(t):null))}}class i extends a{constructor(t,e,n){super({snapshotPath:t,client:e,vault:n}),this.path=t,this.client=r(e),this.name=r(n)}async insert(t,n){return await e("plugin:stronghold|save_secret",{snapshotPath:this.path,client:this.client,vault:this.name,recordPath:r(t),secret:n})}async remove(t){return await e("plugin:stronghold|remove_secret",{snapshotPath:this.path,client:this.client,vault:this.name,recordPath:t.payload.record})}}class h{constructor(t){this.path=t}static async load(t,r){return await e("plugin:stronghold|initialize",{snapshotPath:t,password:r}).then((()=>new h(t)))}async unload(){return await e("plugin:stronghold|destroy",{snapshotPath:this.path})}async loadClient(t){return await e("plugin:stronghold|load_client",{snapshotPath:this.path,client:r(t)}).then((()=>new s(this.path,t)))}async createClient(t){return await e("plugin:stronghold|create_client",{snapshotPath:this.path,client:r(t)}).then((()=>new s(this.path,t)))}async save(){return await e("plugin:stronghold|save",{snapshotPath:this.path})}}return t.Client=s,t.Location=n,t.Store=o,t.Stronghold=h,t.Vault=i,t}({});Object.defineProperty(window.__TAURI__,"stronghold",{value:__TAURI_STRONGHOLD__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_STRONGHOLD__=function(t){"use strict";async function e(t,e={},r){return window.__TAURI_INTERNALS__.invoke(t,e,r)}function r(t){return"string"==typeof t?t:Array.from(t instanceof ArrayBuffer?new Uint8Array(t):t)}"function"==typeof SuppressedError&&SuppressedError;class n{constructor(t,e){this.type=t,this.payload=e}static generic(t,e){return new n("Generic",{vault:r(t),record:r(e)})}static counter(t,e){return new n("Counter",{vault:r(t),counter:e})}}class a{constructor(t){this.procedureArgs=t}async generateSLIP10Seed(t,r){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"SLIP10Generate",payload:{output:t,sizeBytes:r}}}).then((t=>Uint8Array.from(t)))}async deriveSLIP10(t,r,n,a){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"SLIP10Derive",payload:{chain:t,input:{type:r,payload:n},output:a}}}).then((t=>Uint8Array.from(t)))}async recoverBIP39(t,r,n){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"BIP39Recover",payload:{mnemonic:t,passphrase:n,output:r}}}).then((t=>Uint8Array.from(t)))}async generateBIP39(t,r){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"BIP39Generate",payload:{output:t,passphrase:r}}}).then((t=>Uint8Array.from(t)))}async getEd25519PublicKey(t){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"PublicKey",payload:{type:"Ed25519",privateKey:t}}}).then((t=>Uint8Array.from(t)))}async signEd25519(t,r){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"Ed25519Sign",payload:{privateKey:t,msg:r}}}).then((t=>Uint8Array.from(t)))}}class s{constructor(t,e){this.path=t,this.name=r(e)}getVault(t){return new i(this.path,this.name,r(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 e("plugin:stronghold|get_store_record",{snapshotPath:this.path,client:this.client,key:r(t)}).then((t=>null!=t?Uint8Array.from(t):null))}async insert(t,n,a){return await e("plugin:stronghold|save_store_record",{snapshotPath:this.path,client:this.client,key:r(t),value:n,lifetime:a})}async remove(t){return await e("plugin:stronghold|remove_store_record",{snapshotPath:this.path,client:this.client,key:r(t)}).then((t=>null!=t?Uint8Array.from(t):null))}}class i extends a{constructor(t,e,n){super({snapshotPath:t,client:e,vault:n}),this.path=t,this.client=r(e),this.name=r(n)}async insert(t,n){return await e("plugin:stronghold|save_secret",{snapshotPath:this.path,client:this.client,vault:this.name,recordPath:r(t),secret:n})}async remove(t){return await e("plugin:stronghold|remove_secret",{snapshotPath:this.path,client:this.client,vault:this.name,recordPath:t.payload.record})}}class h{constructor(t){this.path=t}static async load(t,r){return await e("plugin:stronghold|initialize",{snapshotPath:t,password:r}).then((()=>new h(t)))}async unload(){return await e("plugin:stronghold|destroy",{snapshotPath:this.path})}async loadClient(t){return await e("plugin:stronghold|load_client",{snapshotPath:this.path,client:r(t)}).then((()=>new s(this.path,t)))}async createClient(t){return await e("plugin:stronghold|create_client",{snapshotPath:this.path,client:r(t)}).then((()=>new s(this.path,t)))}async save(){return await e("plugin:stronghold|save",{snapshotPath:this.path})}}return t.Client=s,t.Location=n,t.Store=o,t.Stronghold=h,t.Vault=i,t}({});Object.defineProperty(window.__TAURI__,"stronghold",{value:__TAURI_PLUGIN_STRONGHOLD__})} diff --git a/plugins/updater/package.json b/plugins/updater/package.json index 511665dc2..9239a7acd 100644 --- a/plugins/updater/package.json +++ b/plugins/updater/package.json @@ -6,26 +6,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "^2.5.0" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/plugins/updater/rollup.config.js b/plugins/updater/rollup.config.js new file mode 100644 index 000000000..8e039e06c --- /dev/null +++ b/plugins/updater/rollup.config.js @@ -0,0 +1,3 @@ +import { createConfig } from "../../shared/rollup.config.js"; + +export default createConfig(); diff --git a/plugins/updater/rollup.config.mjs b/plugins/updater/rollup.config.mjs deleted file mode 100644 index 99a3dd319..000000000 --- a/plugins/updater/rollup.config.mjs +++ /dev/null @@ -1,11 +0,0 @@ -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/], -}); diff --git a/plugins/updater/src/api-iife.js b/plugins/updater/src/api-iife.js index 0732a9872..ed7656d68 100644 --- a/plugins/updater/src/api-iife.js +++ b/plugins/updater/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_UPDATER__=function(e){"use strict";function t(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}var r;"function"==typeof SuppressedError&&SuppressedError;class n{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,r.set(this,(()=>{})),this.id=function(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}((e=>{t(this,r,"f").call(this,e)}))}set onmessage(e){!function(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?o.call(e,r):o?o.value=r:t.set(e,r)}(this,r,e,"f")}get onmessage(){return t(this,r,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}async function o(e,t={},r){return window.__TAURI_INTERNALS__.invoke(e,t,r)}r=new WeakMap;class a{constructor(e){this.currentVersion=e.currentVersion,this.version=e.version,this.date=e.date,this.body=e.body}async downloadAndInstall(e){const t=new n;return null!=e&&(t.onmessage=e),o("plugin:updater|download_and_install",{onEvent:t})}}return e.Update=a,e.check=async function(e){return(null==e?void 0:e.headers)&&(e.headers=Array.from(new Headers(e.headers).entries())),o("plugin:updater|check",{...e}).then((e=>e.available?new a(e):null))},e}({});Object.defineProperty(window.__TAURI__,"updater",{value:__TAURI_UPDATER__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_UPDATER__=function(e){"use strict";function t(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}var r;"function"==typeof SuppressedError&&SuppressedError;class n{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,r.set(this,(()=>{})),this.id=function(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}((e=>{t(this,r,"f").call(this,e)}))}set onmessage(e){!function(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?o.call(e,r):o?o.value=r:t.set(e,r)}(this,r,e,"f")}get onmessage(){return t(this,r,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}async function o(e,t={},r){return window.__TAURI_INTERNALS__.invoke(e,t,r)}r=new WeakMap;class a{constructor(e){this.currentVersion=e.currentVersion,this.version=e.version,this.date=e.date,this.body=e.body}async downloadAndInstall(e){const t=new n;return null!=e&&(t.onmessage=e),o("plugin:updater|download_and_install",{onEvent:t})}}return e.Update=a,e.check=async function(e){return e?.headers&&(e.headers=Array.from(new Headers(e.headers).entries())),o("plugin:updater|check",{...e}).then((e=>e.available?new a(e):null))},e}({});Object.defineProperty(window.__TAURI__,"updater",{value:__TAURI_PLUGIN_UPDATER__})} diff --git a/plugins/upload/package.json b/plugins/upload/package.json index ae29248f8..cd3b7a6e5 100644 --- a/plugins/upload/package.json +++ b/plugins/upload/package.json @@ -7,26 +7,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "2.6.0" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/plugins/upload/rollup.config.js b/plugins/upload/rollup.config.js new file mode 100644 index 000000000..8e039e06c --- /dev/null +++ b/plugins/upload/rollup.config.js @@ -0,0 +1,3 @@ +import { createConfig } from "../../shared/rollup.config.js"; + +export default createConfig(); diff --git a/plugins/upload/rollup.config.mjs b/plugins/upload/rollup.config.mjs deleted file mode 100644 index 99a3dd319..000000000 --- a/plugins/upload/rollup.config.mjs +++ /dev/null @@ -1,11 +0,0 @@ -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/], -}); diff --git a/plugins/upload/src/api-iife.js b/plugins/upload/src/api-iife.js index 2b9053374..d81c4d17b 100644 --- a/plugins/upload/src/api-iife.js +++ b/plugins/upload/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_UPLOAD__=function(e){"use strict";function t(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}var n;"function"==typeof SuppressedError&&SuppressedError;class r{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,n.set(this,(()=>{})),this.id=function(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}((e=>{t(this,n,"f").call(this,e)}))}set onmessage(e){!function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?o.call(e,n):o?o.value=n:t.set(e,n)}(this,n,e,"f")}get onmessage(){return t(this,n,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}async function o(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}return n=new WeakMap,e.download=async function(e,t,n,a){const i=new Uint32Array(1);window.crypto.getRandomValues(i);const s=i[0],l=new r;null!=n&&(l.onmessage=n),await o("plugin:upload|download",{id:s,url:e,filePath:t,headers:null!=a?a:{},onProgress:l})},e.upload=async function(e,t,n,a){const i=new Uint32Array(1);window.crypto.getRandomValues(i);const s=i[0],l=new r;null!=n&&(l.onmessage=n),await o("plugin:upload|upload",{id:s,url:e,filePath:t,headers:null!=a?a:{},onProgress:l})},e}({});Object.defineProperty(window.__TAURI__,"upload",{value:__TAURI_UPLOAD__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_UPLOAD__=function(e){"use strict";function t(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}var n;"function"==typeof SuppressedError&&SuppressedError;class r{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,n.set(this,(()=>{})),this.id=function(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}((e=>{t(this,n,"f").call(this,e)}))}set onmessage(e){!function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?o.call(e,n):o?o.value=n:t.set(e,n)}(this,n,e,"f")}get onmessage(){return t(this,n,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}async function o(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}return n=new WeakMap,e.download=async function(e,t,n,a){const i=new Uint32Array(1);window.crypto.getRandomValues(i);const s=i[0],_=new r;null!=n&&(_.onmessage=n),await o("plugin:upload|download",{id:s,url:e,filePath:t,headers:a??{},onProgress:_})},e.upload=async function(e,t,n,a){const i=new Uint32Array(1);window.crypto.getRandomValues(i);const s=i[0],_=new r;null!=n&&(_.onmessage=n),await o("plugin:upload|upload",{id:s,url:e,filePath:t,headers:a??{},onProgress:_})},e}({});Object.defineProperty(window.__TAURI__,"upload",{value:__TAURI_PLUGIN_UPLOAD__})} diff --git a/plugins/websocket/examples/svelte-app/package.json b/plugins/websocket/examples/svelte-app/package.json index 8e1ca06cc..61bf6acc7 100644 --- a/plugins/websocket/examples/svelte-app/package.json +++ b/plugins/websocket/examples/svelte-app/package.json @@ -16,7 +16,6 @@ "@tauri-apps/cli": "2.0.0-alpha.17", "svelte": "4.2.2", "svelte-check": "3.5.2", - "tslib": "2.6.2", "typescript": "5.2.2", "vite": "4.5.0" }, diff --git a/plugins/websocket/package.json b/plugins/websocket/package.json index 4ba9f4e58..0e3226413 100644 --- a/plugins/websocket/package.json +++ b/plugins/websocket/package.json @@ -6,26 +6,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "2.6.0" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/plugins/websocket/rollup.config.js b/plugins/websocket/rollup.config.js new file mode 100644 index 000000000..8e039e06c --- /dev/null +++ b/plugins/websocket/rollup.config.js @@ -0,0 +1,3 @@ +import { createConfig } from "../../shared/rollup.config.js"; + +export default createConfig(); diff --git a/plugins/websocket/rollup.config.mjs b/plugins/websocket/rollup.config.mjs deleted file mode 100644 index 99a3dd319..000000000 --- a/plugins/websocket/rollup.config.mjs +++ /dev/null @@ -1,11 +0,0 @@ -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/], -}); diff --git a/plugins/websocket/src/api-iife.js b/plugins/websocket/src/api-iife.js index 5f4eb9810..24650a8c2 100644 --- a/plugins/websocket/src/api-iife.js +++ b/plugins/websocket/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_WEBSOCKET__=function(){"use strict";function e(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}var t;"function"==typeof SuppressedError&&SuppressedError;class r{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,t.set(this,(()=>{})),this.id=function(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}((r=>{e(this,t,"f").call(this,r)}))}set onmessage(e){!function(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?s.call(e,r):s?s.value=r:t.set(e,r)}(this,t,e,"f")}get onmessage(){return e(this,t,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}async function n(e,t={},r){return window.__TAURI_INTERNALS__.invoke(e,t,r)}t=new WeakMap;class s{constructor(e,t){this.id=e,this.listeners=t}static async connect(e,t){const i=[],a=new r;return a.onmessage=e=>{i.forEach((t=>t(e)))},await n("plugin:websocket|connect",{url:e,onMessage:a,config:t}).then((e=>new s(e,i)))}addListener(e){this.listeners.push(e)}async send(e){let t;if("string"==typeof e)t={type:"Text",data:e};else if("object"==typeof e&&"type"in e)t=e;else{if(!Array.isArray(e))throw new Error("invalid `message` type, expected a `{ type: string, data: any }` object, a string or a numeric array");t={type:"Binary",data:e}}return await n("plugin:websocket|send",{id:this.id,message:t})}async disconnect(){return await this.send({type:"Close",data:{code:1e3,reason:"Disconnected by client"}})}}return s}();Object.defineProperty(window.__TAURI__,"websocket",{value:__TAURI_WEBSOCKET__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_WEBSOCKET__=function(){"use strict";function e(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}var t;"function"==typeof SuppressedError&&SuppressedError;class r{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,t.set(this,(()=>{})),this.id=function(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}((r=>{e(this,t,"f").call(this,r)}))}set onmessage(e){!function(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?s.call(e,r):s?s.value=r:t.set(e,r)}(this,t,e,"f")}get onmessage(){return e(this,t,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}async function n(e,t={},r){return window.__TAURI_INTERNALS__.invoke(e,t,r)}t=new WeakMap;class s{constructor(e,t){this.id=e,this.listeners=t}static async connect(e,t){const i=[],a=new r;return a.onmessage=e=>{i.forEach((t=>t(e)))},await n("plugin:websocket|connect",{url:e,onMessage:a,config:t}).then((e=>new s(e,i)))}addListener(e){this.listeners.push(e)}async send(e){let t;if("string"==typeof e)t={type:"Text",data:e};else if("object"==typeof e&&"type"in e)t=e;else{if(!Array.isArray(e))throw new Error("invalid `message` type, expected a `{ type: string, data: any }` object, a string or a numeric array");t={type:"Binary",data:e}}return await n("plugin:websocket|send",{id:this.id,message:t})}async disconnect(){return await this.send({type:"Close",data:{code:1e3,reason:"Disconnected by client"}})}}return s}();Object.defineProperty(window.__TAURI__,"websocket",{value:__TAURI_PLUGIN_WEBSOCKET__})} diff --git a/plugins/window-state/package.json b/plugins/window-state/package.json index 200da69c3..8ad6c677b 100644 --- a/plugins/window-state/package.json +++ b/plugins/window-state/package.json @@ -7,26 +7,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "2.6.0" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/plugins/window-state/rollup.config.js b/plugins/window-state/rollup.config.js new file mode 100644 index 000000000..8e039e06c --- /dev/null +++ b/plugins/window-state/rollup.config.js @@ -0,0 +1,3 @@ +import { createConfig } from "../../shared/rollup.config.js"; + +export default createConfig(); diff --git a/plugins/window-state/rollup.config.mjs b/plugins/window-state/rollup.config.mjs deleted file mode 100644 index 99a3dd319..000000000 --- a/plugins/window-state/rollup.config.mjs +++ /dev/null @@ -1,11 +0,0 @@ -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/], -}); diff --git a/plugins/window-state/src/api-iife.js b/plugins/window-state/src/api-iife.js index 15012bf4f..5d79d9189 100644 --- a/plugins/window-state/src/api-iife.js +++ b/plugins/window-state/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_WINDOWSTATE__=function(e){"use strict";function t(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}async function i(e,t={},i){return window.__TAURI_INTERNALS__.invoke(e,t,i)}"function"==typeof SuppressedError&&SuppressedError;class n{constructor(e,t){this.type="Logical",this.width=e,this.height=t}}class a{constructor(e,t){this.type="Physical",this.width=e,this.height=t}toLogical(e){return new n(this.width/e,this.height/e)}}class l{constructor(e,t){this.type="Logical",this.x=e,this.y=t}}class s{constructor(e,t){this.type="Physical",this.x=e,this.y=t}toLogical(e){return new l(this.x/e,this.y/e)}}var r,o,u;async function c(e,t){await i("plugin:event|unlisten",{event:e,eventId:t})}async function h(e,n,a){return i("plugin:event|listen",{event:e,windowLabel:a?.target,handler:t(n)}).then((t=>async()=>c(e,t)))}!function(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"}(r||(r={})),function(e){e[e.Critical=1]="Critical",e[e.Informational=2]="Informational"}(o||(o={}));class w{constructor(e){this._preventDefault=!1,this.event=e.event,this.windowLabel=e.windowLabel,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}function d(){return new p(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}function b(){return window.__TAURI_INTERNALS__.metadata.windows.map((e=>new p(e.label,{skip:!0})))}!function(e){e.None="none",e.Normal="normal",e.Indeterminate="indeterminate",e.Paused="paused",e.Error="error"}(u||(u={}));const y=["tauri://created","tauri://error"];class p{constructor(e,t={}){this.label=e,this.listeners=Object.create(null),t?.skip||i("plugin:window|create",{options:{...t,label:e}}).then((async()=>this.emit("tauri://created"))).catch((async e=>this.emit("tauri://error",e)))}static getByLabel(e){return b().some((t=>t.label===e))?new p(e,{skip:!0}):null}static getCurrent(){return d()}static getAll(){return b()}static async getFocusedWindow(){for(const e of b())if(await e.isFocused())return e;return null}async listen(e,t){return this._handleTauriEvent(e,t)?Promise.resolve((()=>{const i=this.listeners[e];i.splice(i.indexOf(t),1)})):h(e,t,{target:this.label})}async once(e,t){return this._handleTauriEvent(e,t)?Promise.resolve((()=>{const i=this.listeners[e];i.splice(i.indexOf(t),1)})):async function(e,t,i){return h(e,(i=>{t(i),c(e,i.id).catch((()=>{}))}),i)}(e,t,{target:this.label})}async emit(e,t){if(y.includes(e)){for(const i of this.listeners[e]||[])i({event:e,id:-1,windowLabel:this.label,payload:t});return Promise.resolve()}return async function(e,t,n){await i("plugin:event|emit",{event:e,windowLabel:n?.target,payload:t})}(e,t,{target:this.label})}_handleTauriEvent(e,t){return!!y.includes(e)&&(e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t],!0)}async scaleFactor(){return i("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return i("plugin:window|inner_position",{label:this.label}).then((({x:e,y:t})=>new s(e,t)))}async outerPosition(){return i("plugin:window|outer_position",{label:this.label}).then((({x:e,y:t})=>new s(e,t)))}async innerSize(){return i("plugin:window|inner_size",{label:this.label}).then((({width:e,height:t})=>new a(e,t)))}async outerSize(){return i("plugin:window|outer_size",{label:this.label}).then((({width:e,height:t})=>new a(e,t)))}async isFullscreen(){return i("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return i("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return i("plugin:window|is_maximized",{label:this.label})}async isFocused(){return i("plugin:window|is_focused",{label:this.label})}async isDecorated(){return i("plugin:window|is_decorated",{label:this.label})}async isResizable(){return i("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return i("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return i("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return i("plugin:window|is_closable",{label:this.label})}async isVisible(){return i("plugin:window|is_visible",{label:this.label})}async title(){return i("plugin:window|title",{label:this.label})}async theme(){return i("plugin:window|theme",{label:this.label})}async center(){return i("plugin:window|center",{label:this.label})}async requestUserAttention(e){let t=null;return e&&(t=e===o.Critical?{type:"Critical"}:{type:"Informational"}),i("plugin:window|request_user_attention",{label:this.label,value:t})}async setResizable(e){return i("plugin:window|set_resizable",{label:this.label,value:e})}async setMaximizable(e){return i("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return i("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return i("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return i("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return i("plugin:window|maximize",{label:this.label})}async unmaximize(){return i("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return i("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return i("plugin:window|minimize",{label:this.label})}async unminimize(){return i("plugin:window|unminimize",{label:this.label})}async show(){return i("plugin:window|show",{label:this.label})}async hide(){return i("plugin:window|hide",{label:this.label})}async close(){return i("plugin:window|close",{label:this.label})}async setDecorations(e){return i("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return i("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return i("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return i("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return i("plugin:window|set_always_on_top",{label:this.label,value:e})}async setAlwaysOnBottom(e){return i("plugin:window|set_always_on_bottom",{label:this.label,value:e})}async setContentProtected(e){return i("plugin:window|set_content_protected",{label:this.label,value:e})}async setSize(e){if(!e||"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return i("plugin:window|set_size",{label:this.label,value:{type:e.type,data:{width:e.width,height:e.height}}})}async setMinSize(e){if(e&&"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return i("plugin:window|set_min_size",{label:this.label,value:e?{type:e.type,data:{width:e.width,height:e.height}}:null})}async setMaxSize(e){if(e&&"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return i("plugin:window|set_max_size",{label:this.label,value:e?{type:e.type,data:{width:e.width,height:e.height}}:null})}async setPosition(e){if(!e||"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return i("plugin:window|set_position",{label:this.label,value:{type:e.type,data:{x:e.x,y:e.y}}})}async setFullscreen(e){return i("plugin:window|set_fullscreen",{label:this.label,value:e})}async setFocus(){return i("plugin:window|set_focus",{label:this.label})}async setIcon(e){return i("plugin:window|set_icon",{label:this.label,value:"string"==typeof e?e:Array.from(e)})}async setSkipTaskbar(e){return i("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return i("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return i("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return i("plugin:window|set_cursor_icon",{label:this.label,value:e})}async setCursorPosition(e){if(!e||"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return i("plugin:window|set_cursor_position",{label:this.label,value:{type:e.type,data:{x:e.x,y:e.y}}})}async setIgnoreCursorEvents(e){return i("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return i("plugin:window|start_dragging",{label:this.label})}async setProgressBar(e){return i("plugin:window|set_progress_bar",{label:this.label,value:e})}async onResized(e){return this.listen(r.WINDOW_RESIZED,(t=>{var i;t.payload=(i=t.payload,new a(i.width,i.height)),e(t)}))}async onMoved(e){return this.listen(r.WINDOW_MOVED,(t=>{var i;t.payload=(i=t.payload,new s(i.x,i.y)),e(t)}))}async onCloseRequested(e){return this.listen(r.WINDOW_CLOSE_REQUESTED,(t=>{const i=new w(t);Promise.resolve(e(i)).then((()=>{if(!i.isPreventDefault())return this.close()}))}))}async onFocusChanged(e){const t=await this.listen(r.WINDOW_FOCUS,(t=>{e({...t,payload:!0})})),i=await this.listen(r.WINDOW_BLUR,(t=>{e({...t,payload:!1})}));return()=>{t(),i()}}async onScaleChanged(e){return this.listen(r.WINDOW_SCALE_FACTOR_CHANGED,e)}async onMenuClicked(e){return this.listen(r.MENU,e)}async onFileDropEvent(e){const t=await this.listen(r.WINDOW_FILE_DROP,(t=>{e({...t,payload:{type:"drop",paths:t.payload}})})),i=await this.listen(r.WINDOW_FILE_DROP_HOVER,(t=>{e({...t,payload:{type:"hover",paths:t.payload}})})),n=await this.listen(r.WINDOW_FILE_DROP_CANCELLED,(t=>{e({...t,payload:{type:"cancel"}})}));return()=>{t(),i(),n()}}async onThemeChanged(e){return this.listen(r.WINDOW_THEME_CHANGED,e)}}var _,g,m;async function v(e,t){return i("plugin:window-state|restore_state",{label:e,flags:t})}return function(e){e.AppearanceBased="appearanceBased",e.Light="light",e.Dark="dark",e.MediumLight="mediumLight",e.UltraDark="ultraDark",e.Titlebar="titlebar",e.Selection="selection",e.Menu="menu",e.Popover="popover",e.Sidebar="sidebar",e.HeaderView="headerView",e.Sheet="sheet",e.WindowBackground="windowBackground",e.HudWindow="hudWindow",e.FullScreenUI="fullScreenUI",e.Tooltip="tooltip",e.ContentBackground="contentBackground",e.UnderWindowBackground="underWindowBackground",e.UnderPageBackground="underPageBackground",e.Mica="mica",e.Blur="blur",e.Acrylic="acrylic",e.Tabbed="tabbed",e.TabbedDark="tabbedDark",e.TabbedLight="tabbedLight"}(_||(_={})),function(e){e.FollowsWindowActiveState="followsWindowActiveState",e.Active="active",e.Inactive="inactive"}(g||(g={})),e.StateFlags=void 0,(m=e.StateFlags||(e.StateFlags={}))[m.SIZE=1]="SIZE",m[m.POSITION=2]="POSITION",m[m.MAXIMIZED=4]="MAXIMIZED",m[m.VISIBLE=8]="VISIBLE",m[m.DECORATIONS=16]="DECORATIONS",m[m.FULLSCREEN=32]="FULLSCREEN",m[m.ALL=63]="ALL",e.restoreState=v,e.restoreStateCurrent=async function(e){return v(d().label,e)},e.saveWindowState=async function(e){return i("plugin:window-state|save_window_state",{flags:e})},e}({});Object.defineProperty(window.__TAURI__,"windowState",{value:__TAURI_WINDOWSTATE__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_WINDOWSTATE__=function(e){"use strict";function t(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}async function i(e,t={},i){return window.__TAURI_INTERNALS__.invoke(e,t,i)}"function"==typeof SuppressedError&&SuppressedError;class n{constructor(e,t){this.type="Logical",this.width=e,this.height=t}}class a{constructor(e,t){this.type="Physical",this.width=e,this.height=t}toLogical(e){return new n(this.width/e,this.height/e)}}class l{constructor(e,t){this.type="Logical",this.x=e,this.y=t}}class s{constructor(e,t){this.type="Physical",this.x=e,this.y=t}toLogical(e){return new l(this.x/e,this.y/e)}}var r,o,u;async function c(e,t){await i("plugin:event|unlisten",{event:e,eventId:t})}async function h(e,n,a){return i("plugin:event|listen",{event:e,windowLabel:a?.target,handler:t(n)}).then((t=>async()=>c(e,t)))}!function(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"}(r||(r={})),function(e){e[e.Critical=1]="Critical",e[e.Informational=2]="Informational"}(o||(o={}));class w{constructor(e){this._preventDefault=!1,this.event=e.event,this.windowLabel=e.windowLabel,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}function d(){return new p(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}function b(){return window.__TAURI_INTERNALS__.metadata.windows.map((e=>new p(e.label,{skip:!0})))}!function(e){e.None="none",e.Normal="normal",e.Indeterminate="indeterminate",e.Paused="paused",e.Error="error"}(u||(u={}));const y=["tauri://created","tauri://error"];class p{constructor(e,t={}){this.label=e,this.listeners=Object.create(null),t?.skip||i("plugin:window|create",{options:{...t,label:e}}).then((async()=>this.emit("tauri://created"))).catch((async e=>this.emit("tauri://error",e)))}static getByLabel(e){return b().some((t=>t.label===e))?new p(e,{skip:!0}):null}static getCurrent(){return d()}static getAll(){return b()}static async getFocusedWindow(){for(const e of b())if(await e.isFocused())return e;return null}async listen(e,t){return this._handleTauriEvent(e,t)?Promise.resolve((()=>{const i=this.listeners[e];i.splice(i.indexOf(t),1)})):h(e,t,{target:this.label})}async once(e,t){return this._handleTauriEvent(e,t)?Promise.resolve((()=>{const i=this.listeners[e];i.splice(i.indexOf(t),1)})):async function(e,t,i){return h(e,(i=>{t(i),c(e,i.id).catch((()=>{}))}),i)}(e,t,{target:this.label})}async emit(e,t){if(y.includes(e)){for(const i of this.listeners[e]||[])i({event:e,id:-1,windowLabel:this.label,payload:t});return Promise.resolve()}return async function(e,t,n){await i("plugin:event|emit",{event:e,windowLabel:n?.target,payload:t})}(e,t,{target:this.label})}_handleTauriEvent(e,t){return!!y.includes(e)&&(e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t],!0)}async scaleFactor(){return i("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return i("plugin:window|inner_position",{label:this.label}).then((({x:e,y:t})=>new s(e,t)))}async outerPosition(){return i("plugin:window|outer_position",{label:this.label}).then((({x:e,y:t})=>new s(e,t)))}async innerSize(){return i("plugin:window|inner_size",{label:this.label}).then((({width:e,height:t})=>new a(e,t)))}async outerSize(){return i("plugin:window|outer_size",{label:this.label}).then((({width:e,height:t})=>new a(e,t)))}async isFullscreen(){return i("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return i("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return i("plugin:window|is_maximized",{label:this.label})}async isFocused(){return i("plugin:window|is_focused",{label:this.label})}async isDecorated(){return i("plugin:window|is_decorated",{label:this.label})}async isResizable(){return i("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return i("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return i("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return i("plugin:window|is_closable",{label:this.label})}async isVisible(){return i("plugin:window|is_visible",{label:this.label})}async title(){return i("plugin:window|title",{label:this.label})}async theme(){return i("plugin:window|theme",{label:this.label})}async center(){return i("plugin:window|center",{label:this.label})}async requestUserAttention(e){let t=null;return e&&(t=e===o.Critical?{type:"Critical"}:{type:"Informational"}),i("plugin:window|request_user_attention",{label:this.label,value:t})}async setResizable(e){return i("plugin:window|set_resizable",{label:this.label,value:e})}async setMaximizable(e){return i("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return i("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return i("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return i("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return i("plugin:window|maximize",{label:this.label})}async unmaximize(){return i("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return i("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return i("plugin:window|minimize",{label:this.label})}async unminimize(){return i("plugin:window|unminimize",{label:this.label})}async show(){return i("plugin:window|show",{label:this.label})}async hide(){return i("plugin:window|hide",{label:this.label})}async close(){return i("plugin:window|close",{label:this.label})}async setDecorations(e){return i("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return i("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return i("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return i("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return i("plugin:window|set_always_on_top",{label:this.label,value:e})}async setAlwaysOnBottom(e){return i("plugin:window|set_always_on_bottom",{label:this.label,value:e})}async setContentProtected(e){return i("plugin:window|set_content_protected",{label:this.label,value:e})}async setSize(e){if(!e||"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return i("plugin:window|set_size",{label:this.label,value:{type:e.type,data:{width:e.width,height:e.height}}})}async setMinSize(e){if(e&&"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return i("plugin:window|set_min_size",{label:this.label,value:e?{type:e.type,data:{width:e.width,height:e.height}}:null})}async setMaxSize(e){if(e&&"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return i("plugin:window|set_max_size",{label:this.label,value:e?{type:e.type,data:{width:e.width,height:e.height}}:null})}async setPosition(e){if(!e||"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return i("plugin:window|set_position",{label:this.label,value:{type:e.type,data:{x:e.x,y:e.y}}})}async setFullscreen(e){return i("plugin:window|set_fullscreen",{label:this.label,value:e})}async setFocus(){return i("plugin:window|set_focus",{label:this.label})}async setIcon(e){return i("plugin:window|set_icon",{label:this.label,value:"string"==typeof e?e:Array.from(e)})}async setSkipTaskbar(e){return i("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return i("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return i("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return i("plugin:window|set_cursor_icon",{label:this.label,value:e})}async setCursorPosition(e){if(!e||"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return i("plugin:window|set_cursor_position",{label:this.label,value:{type:e.type,data:{x:e.x,y:e.y}}})}async setIgnoreCursorEvents(e){return i("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return i("plugin:window|start_dragging",{label:this.label})}async setProgressBar(e){return i("plugin:window|set_progress_bar",{label:this.label,value:e})}async onResized(e){return this.listen(r.WINDOW_RESIZED,(t=>{var i;t.payload=(i=t.payload,new a(i.width,i.height)),e(t)}))}async onMoved(e){return this.listen(r.WINDOW_MOVED,(t=>{var i;t.payload=(i=t.payload,new s(i.x,i.y)),e(t)}))}async onCloseRequested(e){return this.listen(r.WINDOW_CLOSE_REQUESTED,(t=>{const i=new w(t);Promise.resolve(e(i)).then((()=>{if(!i.isPreventDefault())return this.close()}))}))}async onFocusChanged(e){const t=await this.listen(r.WINDOW_FOCUS,(t=>{e({...t,payload:!0})})),i=await this.listen(r.WINDOW_BLUR,(t=>{e({...t,payload:!1})}));return()=>{t(),i()}}async onScaleChanged(e){return this.listen(r.WINDOW_SCALE_FACTOR_CHANGED,e)}async onMenuClicked(e){return this.listen(r.MENU,e)}async onFileDropEvent(e){const t=await this.listen(r.WINDOW_FILE_DROP,(t=>{e({...t,payload:{type:"drop",paths:t.payload}})})),i=await this.listen(r.WINDOW_FILE_DROP_HOVER,(t=>{e({...t,payload:{type:"hover",paths:t.payload}})})),n=await this.listen(r.WINDOW_FILE_DROP_CANCELLED,(t=>{e({...t,payload:{type:"cancel"}})}));return()=>{t(),i(),n()}}async onThemeChanged(e){return this.listen(r.WINDOW_THEME_CHANGED,e)}}var _,g,m;async function v(e,t){return i("plugin:window-state|restore_state",{label:e,flags:t})}return function(e){e.AppearanceBased="appearanceBased",e.Light="light",e.Dark="dark",e.MediumLight="mediumLight",e.UltraDark="ultraDark",e.Titlebar="titlebar",e.Selection="selection",e.Menu="menu",e.Popover="popover",e.Sidebar="sidebar",e.HeaderView="headerView",e.Sheet="sheet",e.WindowBackground="windowBackground",e.HudWindow="hudWindow",e.FullScreenUI="fullScreenUI",e.Tooltip="tooltip",e.ContentBackground="contentBackground",e.UnderWindowBackground="underWindowBackground",e.UnderPageBackground="underPageBackground",e.Mica="mica",e.Blur="blur",e.Acrylic="acrylic",e.Tabbed="tabbed",e.TabbedDark="tabbedDark",e.TabbedLight="tabbedLight"}(_||(_={})),function(e){e.FollowsWindowActiveState="followsWindowActiveState",e.Active="active",e.Inactive="inactive"}(g||(g={})),e.StateFlags=void 0,(m=e.StateFlags||(e.StateFlags={}))[m.SIZE=1]="SIZE",m[m.POSITION=2]="POSITION",m[m.MAXIMIZED=4]="MAXIMIZED",m[m.VISIBLE=8]="VISIBLE",m[m.DECORATIONS=16]="DECORATIONS",m[m.FULLSCREEN=32]="FULLSCREEN",m[m.ALL=63]="ALL",e.restoreState=v,e.restoreStateCurrent=async function(e){return v(d().label,e)},e.saveWindowState=async function(e){return i("plugin:window-state|save_window_state",{flags:e})},e}({});Object.defineProperty(window.__TAURI__,"windowState",{value:__TAURI_PLUGIN_WINDOWSTATE__})} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2b89fdc08..fd727c1ba 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,13 +14,13 @@ importers: devDependencies: '@rollup/plugin-node-resolve': specifier: 15.2.3 - version: 15.2.3(rollup@4.1.4) + version: 15.2.3(rollup@4.2.0) '@rollup/plugin-terser': specifier: 0.4.4 - version: 0.4.4(rollup@4.1.4) + version: 0.4.4(rollup@4.2.0) '@rollup/plugin-typescript': specifier: 11.1.5 - version: 11.1.5(rollup@4.1.4)(typescript@5.2.2) + version: 11.1.5(rollup@4.2.0)(typescript@5.2.2) '@typescript-eslint/eslint-plugin': specifier: 6.8.0 version: 6.8.0(@typescript-eslint/parser@6.8.0)(eslint@8.51.0)(typescript@5.2.2) @@ -55,8 +55,8 @@ importers: specifier: 3.0.3 version: 3.0.3 rollup: - specifier: 4.1.4 - version: 4.1.4 + specifier: 4.2.0 + version: 4.2.0 typescript: specifier: 5.2.2 version: 5.2.2 @@ -129,7 +129,7 @@ importers: version: 4.2.2 unocss: specifier: ^0.56.5 - version: 0.56.5(postcss@8.4.31)(vite@4.5.0) + version: 0.56.5(postcss@8.4.31)(rollup@4.2.0)(vite@4.5.0) vite: specifier: ^4.5.0 version: 4.5.0 @@ -139,60 +139,36 @@ importers: '@tauri-apps/api': specifier: 2.0.0-alpha.11 version: 2.0.0-alpha.11 - devDependencies: - tslib: - specifier: 2.6.0 - version: 2.6.0 plugins/autostart: dependencies: '@tauri-apps/api': specifier: 2.0.0-alpha.11 version: 2.0.0-alpha.11 - devDependencies: - tslib: - specifier: 2.6.0 - version: 2.6.0 plugins/barcode-scanner: dependencies: '@tauri-apps/api': specifier: 2.0.0-alpha.11 version: 2.0.0-alpha.11 - devDependencies: - tslib: - specifier: ^2.5.0 - version: 2.6.0 plugins/cli: dependencies: '@tauri-apps/api': specifier: 2.0.0-alpha.11 version: 2.0.0-alpha.11 - devDependencies: - tslib: - specifier: ^2.4.1 - version: 2.6.0 plugins/clipboard-manager: dependencies: '@tauri-apps/api': specifier: 2.0.0-alpha.11 version: 2.0.0-alpha.11 - devDependencies: - tslib: - specifier: ^2.4.1 - version: 2.6.0 plugins/deep-link: dependencies: '@tauri-apps/api': specifier: 2.0.0-alpha.11 version: 2.0.0-alpha.11 - devDependencies: - tslib: - specifier: ^2.5.0 - version: 2.6.0 plugins/deep-link/examples/app: dependencies: @@ -221,100 +197,60 @@ importers: '@tauri-apps/api': specifier: 2.0.0-alpha.11 version: 2.0.0-alpha.11 - devDependencies: - tslib: - specifier: ^2.4.1 - version: 2.6.0 plugins/fs: dependencies: '@tauri-apps/api': specifier: 2.0.0-alpha.11 version: 2.0.0-alpha.11 - devDependencies: - tslib: - specifier: ^2.4.1 - version: 2.6.0 plugins/global-shortcut: dependencies: '@tauri-apps/api': specifier: 2.0.0-alpha.11 version: 2.0.0-alpha.11 - devDependencies: - tslib: - specifier: ^2.4.1 - version: 2.6.0 plugins/http: dependencies: '@tauri-apps/api': specifier: 2.0.0-alpha.11 version: 2.0.0-alpha.11 - devDependencies: - tslib: - specifier: ^2.5.0 - version: 2.6.0 plugins/log: dependencies: '@tauri-apps/api': specifier: 2.0.0-alpha.11 version: 2.0.0-alpha.11 - devDependencies: - tslib: - specifier: 2.6.0 - version: 2.6.0 plugins/notification: dependencies: '@tauri-apps/api': specifier: 2.0.0-alpha.11 version: 2.0.0-alpha.11 - devDependencies: - tslib: - specifier: ^2.4.1 - version: 2.6.0 plugins/os: dependencies: '@tauri-apps/api': specifier: 2.0.0-alpha.11 version: 2.0.0-alpha.11 - devDependencies: - tslib: - specifier: 2.6.0 - version: 2.6.0 plugins/positioner: dependencies: '@tauri-apps/api': specifier: 2.0.0-alpha.11 version: 2.0.0-alpha.11 - devDependencies: - tslib: - specifier: 2.6.0 - version: 2.6.0 plugins/process: dependencies: '@tauri-apps/api': specifier: 2.0.0-alpha.11 version: 2.0.0-alpha.11 - devDependencies: - tslib: - specifier: 2.6.0 - version: 2.6.0 plugins/shell: dependencies: '@tauri-apps/api': specifier: 2.0.0-alpha.11 version: 2.0.0-alpha.11 - devDependencies: - tslib: - specifier: ^2.4.1 - version: 2.6.0 plugins/single-instance/examples/vanilla: devDependencies: @@ -327,60 +263,36 @@ importers: '@tauri-apps/api': specifier: 2.0.0-alpha.11 version: 2.0.0-alpha.11 - devDependencies: - tslib: - specifier: 2.6.0 - version: 2.6.0 plugins/store: dependencies: '@tauri-apps/api': specifier: 2.0.0-alpha.11 version: 2.0.0-alpha.11 - devDependencies: - tslib: - specifier: 2.6.0 - version: 2.6.0 plugins/stronghold: dependencies: '@tauri-apps/api': specifier: 2.0.0-alpha.11 version: 2.0.0-alpha.11 - devDependencies: - tslib: - specifier: 2.6.0 - version: 2.6.0 plugins/updater: dependencies: '@tauri-apps/api': specifier: 2.0.0-alpha.11 version: 2.0.0-alpha.11 - devDependencies: - tslib: - specifier: ^2.5.0 - version: 2.6.0 plugins/upload: dependencies: '@tauri-apps/api': specifier: 2.0.0-alpha.11 version: 2.0.0-alpha.11 - devDependencies: - tslib: - specifier: 2.6.0 - version: 2.6.0 plugins/websocket: dependencies: '@tauri-apps/api': specifier: 2.0.0-alpha.11 version: 2.0.0-alpha.11 - devDependencies: - tslib: - specifier: 2.6.0 - version: 2.6.0 plugins/websocket/examples/svelte-app: dependencies: @@ -403,9 +315,6 @@ importers: svelte-check: specifier: 3.5.2 version: 3.5.2(svelte@4.2.2) - tslib: - specifier: 2.6.2 - version: 2.6.2 typescript: specifier: 5.2.2 version: 5.2.2 @@ -418,10 +327,6 @@ importers: '@tauri-apps/api': specifier: 2.0.0-alpha.11 version: 2.0.0-alpha.11 - devDependencies: - tslib: - specifier: 2.6.0 - version: 2.6.0 packages: @@ -571,7 +476,7 @@ packages: peerDependencies: mocha: ^10.0.0 dependencies: - effection: 2.0.7 + effection: 2.0.7(mocha@10.2.0) mocha: 10.2.0 dev: true @@ -823,7 +728,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 - debug: 4.3.4 + debug: 4.3.4(supports-color@8.1.1) espree: 9.6.1 globals: 13.20.0 ignore: 5.2.4 @@ -850,7 +755,7 @@ packages: engines: {node: '>=10.10.0'} dependencies: '@humanwhocodes/object-schema': 2.0.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@8.1.1) minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -891,7 +796,7 @@ packages: '@antfu/install-pkg': 0.1.1 '@antfu/utils': 0.7.5 '@iconify/types': 2.0.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@8.1.1) kolorist: 1.8.0 local-pkg: 0.4.3 transitivePeerDependencies: @@ -958,7 +863,7 @@ packages: resolution: {integrity: sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==} dev: true - /@rollup/plugin-node-resolve@15.2.3(rollup@4.1.4): + /@rollup/plugin-node-resolve@15.2.3(rollup@4.2.0): resolution: {integrity: sha512-j/lym8nf5E21LwBT4Df1VD6hRO2L2iwUeUmP7litikRsVp1H6NWx20NEp0Y7su+7XGc476GnXXc4kFeZNGmaSQ==} engines: {node: '>=14.0.0'} peerDependencies: @@ -967,16 +872,16 @@ packages: rollup: optional: true dependencies: - '@rollup/pluginutils': 5.0.2(rollup@4.1.4) + '@rollup/pluginutils': 5.0.5(rollup@4.2.0) '@types/resolve': 1.20.2 deepmerge: 4.3.1 is-builtin-module: 3.2.1 is-module: 1.0.0 resolve: 1.22.2 - rollup: 4.1.4 + rollup: 4.2.0 dev: true - /@rollup/plugin-terser@0.4.4(rollup@4.1.4): + /@rollup/plugin-terser@0.4.4(rollup@4.2.0): resolution: {integrity: sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A==} engines: {node: '>=14.0.0'} peerDependencies: @@ -985,13 +890,13 @@ packages: rollup: optional: true dependencies: - rollup: 4.1.4 + rollup: 4.2.0 serialize-javascript: 6.0.1 smob: 1.4.0 terser: 5.19.1 dev: true - /@rollup/plugin-typescript@11.1.5(rollup@4.1.4)(typescript@5.2.2): + /@rollup/plugin-typescript@11.1.5(rollup@4.2.0)(typescript@5.2.2): resolution: {integrity: sha512-rnMHrGBB0IUEv69Q8/JGRD/n4/n6b3nfpufUu26axhUcboUzv/twfZU8fIBbTOphRAe0v8EyxzeDpKXqGHfyDA==} engines: {node: '>=14.0.0'} peerDependencies: @@ -1004,13 +909,13 @@ packages: tslib: optional: true dependencies: - '@rollup/pluginutils': 5.0.2(rollup@4.1.4) + '@rollup/pluginutils': 5.0.2(rollup@4.2.0) resolve: 1.22.2 - rollup: 4.1.4 + rollup: 4.2.0 typescript: 5.2.2 dev: true - /@rollup/pluginutils@5.0.2(rollup@4.1.4): + /@rollup/pluginutils@5.0.2(rollup@4.2.0): resolution: {integrity: sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==} engines: {node: '>=14.0.0'} peerDependencies: @@ -1022,10 +927,10 @@ packages: '@types/estree': 1.0.1 estree-walker: 2.0.2 picomatch: 2.3.1 - rollup: 4.1.4 + rollup: 4.2.0 dev: true - /@rollup/pluginutils@5.0.5: + /@rollup/pluginutils@5.0.5(rollup@4.2.0): resolution: {integrity: sha512-6aEYR910NyP73oHiJglti74iRyOwgFU4x3meH/H8OJx6Ry0j6cOVZ5X/wTvub7G7Ao6qaHBEaNsV3GLJkSsF+Q==} engines: {node: '>=14.0.0'} peerDependencies: @@ -1037,98 +942,99 @@ packages: '@types/estree': 1.0.1 estree-walker: 2.0.2 picomatch: 2.3.1 + rollup: 4.2.0 dev: true - /@rollup/rollup-android-arm-eabi@4.1.4: - resolution: {integrity: sha512-WlzkuFvpKl6CLFdc3V6ESPt7gq5Vrimd2Yv9IzKXdOpgbH4cdDSS1JLiACX8toygihtH5OlxyQzhXOph7Ovlpw==} + /@rollup/rollup-android-arm-eabi@4.2.0: + resolution: {integrity: sha512-8PlggAxGxavr+pkCNeV1TM2wTb2o+cUWDg9M1cm9nR27Dsn287uZtSLYXoQqQcmq+sYfF7lHfd3sWJJinH9GmA==} cpu: [arm] os: [android] requiresBuild: true dev: true optional: true - /@rollup/rollup-android-arm64@4.1.4: - resolution: {integrity: sha512-D1e+ABe56T9Pq2fD+R3ybe1ylCDzu3tY4Qm2Mj24R9wXNCq35+JbFbOpc2yrroO2/tGhTobmEl2Bm5xfE/n8RA==} + /@rollup/rollup-android-arm64@4.2.0: + resolution: {integrity: sha512-+71T85hbMFrJI+zKQULNmSYBeIhru55PYoF/u75MyeN2FcxE4HSPw20319b+FcZ4lWx2Nx/Ql9tN+hoaD3GH/A==} cpu: [arm64] os: [android] requiresBuild: true dev: true optional: true - /@rollup/rollup-darwin-arm64@4.1.4: - resolution: {integrity: sha512-7vTYrgEiOrjxnjsgdPB+4i7EMxbVp7XXtS+50GJYj695xYTTEMn3HZVEvgtwjOUkAP/Q4HDejm4fIAjLeAfhtg==} + /@rollup/rollup-darwin-arm64@4.2.0: + resolution: {integrity: sha512-IIIQLuG43QIElT1JZqUP/zqIdiJl4t9U/boa0GZnQTw9m1X0k3mlBuysbgYXeloLT1RozdL7bgw4lpSaI8GOXw==} cpu: [arm64] os: [darwin] requiresBuild: true dev: true optional: true - /@rollup/rollup-darwin-x64@4.1.4: - resolution: {integrity: sha512-eGJVZScKSLZkYjhTAESCtbyTBq9SXeW9+TX36ki5gVhDqJtnQ5k0f9F44jNK5RhAMgIj0Ht9+n6HAgH0gUUyWQ==} + /@rollup/rollup-darwin-x64@4.2.0: + resolution: {integrity: sha512-BXcXvnLaea1Xz900omrGJhxHFJfH9jZ0CpJuVsbjjhpniJ6qiLXz3xA8Lekaa4MuhFcJd4f0r+Ky1G4VFbYhWw==} cpu: [x64] os: [darwin] requiresBuild: true dev: true optional: true - /@rollup/rollup-linux-arm-gnueabihf@4.1.4: - resolution: {integrity: sha512-HnigYSEg2hOdX1meROecbk++z1nVJDpEofw9V2oWKqOWzTJlJf1UXVbDE6Hg30CapJxZu5ga4fdAQc/gODDkKg==} + /@rollup/rollup-linux-arm-gnueabihf@4.2.0: + resolution: {integrity: sha512-f4K3MKw9Y4AKi4ANGnmPIglr+S+8tO858YrGVuqAHXxJdVghBmz9CPU9kDpOnGvT4g4vg5uNyIFpOOFvffXyMA==} cpu: [arm] os: [linux] requiresBuild: true dev: true optional: true - /@rollup/rollup-linux-arm64-gnu@4.1.4: - resolution: {integrity: sha512-TzJ+N2EoTLWkaClV2CUhBlj6ljXofaYzF/R9HXqQ3JCMnCHQZmQnbnZllw7yTDp0OG5whP4gIPozR4QiX+00MQ==} + /@rollup/rollup-linux-arm64-gnu@4.2.0: + resolution: {integrity: sha512-bNsTYQBgp4H7w6cT7FZhesxpcUPahsSIy4NgdZjH1ZwEoZHxi4XKglj+CsSEkhsKi+x6toVvMylhjRKhEMYfnA==} cpu: [arm64] os: [linux] requiresBuild: true dev: true optional: true - /@rollup/rollup-linux-arm64-musl@4.1.4: - resolution: {integrity: sha512-aVPmNMdp6Dlo2tWkAduAD/5TL/NT5uor290YvjvFvCv0Q3L7tVdlD8MOGDL+oRSw5XKXKAsDzHhUOPUNPRHVTQ==} + /@rollup/rollup-linux-arm64-musl@4.2.0: + resolution: {integrity: sha512-Jp1NxBJpGLuxRU2ihrQk4IZ+ia5nffobG6sOFUPW5PMYkF0kQtxEbeDuCa69Xif211vUOcxlOnf5IOEIpTEySA==} cpu: [arm64] os: [linux] requiresBuild: true dev: true optional: true - /@rollup/rollup-linux-x64-gnu@4.1.4: - resolution: {integrity: sha512-77Fb79ayiDad0grvVsz4/OB55wJRyw9Ao+GdOBA9XywtHpuq5iRbVyHToGxWquYWlEf6WHFQQnFEttsAzboyKg==} + /@rollup/rollup-linux-x64-gnu@4.2.0: + resolution: {integrity: sha512-3p3iRtQmv2aXw+vtKNyZMLOQ+LSRsqArXjKAh2Oj9cqwfIRe7OXvdkOzWfZOIp1F/x5KJzVAxGxnniF4cMbnsQ==} cpu: [x64] os: [linux] requiresBuild: true dev: true optional: true - /@rollup/rollup-linux-x64-musl@4.1.4: - resolution: {integrity: sha512-/t6C6niEQTqmQTVTD9TDwUzxG91Mlk69/v0qodIPUnjjB3wR4UA3klg+orR2SU3Ux2Cgf2pWPL9utK80/1ek8g==} + /@rollup/rollup-linux-x64-musl@4.2.0: + resolution: {integrity: sha512-atih7IF/reUZe4LBLC5Izd44hth2tfDIG8LaPp4/cQXdHh9jabcZEvIeRPrpDq0i/Uu487Qu5gl5KwyAnWajnw==} cpu: [x64] os: [linux] requiresBuild: true dev: true optional: true - /@rollup/rollup-win32-arm64-msvc@4.1.4: - resolution: {integrity: sha512-ZY5BHHrOPkMbCuGWFNpJH0t18D2LU6GMYKGaqaWTQ3CQOL57Fem4zE941/Ek5pIsVt70HyDXssVEFQXlITI5Gg==} + /@rollup/rollup-win32-arm64-msvc@4.2.0: + resolution: {integrity: sha512-vYxF3tKJeUE4ceYzpNe2p84RXk/fGK30I8frpRfv/MyPStej/mRlojztkN7Jtd1014HHVeq/tYaMBz/3IxkxZw==} cpu: [arm64] os: [win32] requiresBuild: true dev: true optional: true - /@rollup/rollup-win32-ia32-msvc@4.1.4: - resolution: {integrity: sha512-XG2mcRfFrJvYyYaQmvCIvgfkaGinfXrpkBuIbJrTl9SaIQ8HumheWTIwkNz2mktCKwZfXHQNpO7RgXLIGQ7HXA==} + /@rollup/rollup-win32-ia32-msvc@4.2.0: + resolution: {integrity: sha512-1LZJ6zpl93SaPQvas618bMFarVwufWTaczH4ESAbFcwiC4OtznA6Ym+hFPyIGaJaGEB8uMWWac0uXGPXOg5FGA==} cpu: [ia32] os: [win32] requiresBuild: true dev: true optional: true - /@rollup/rollup-win32-x64-msvc@4.1.4: - resolution: {integrity: sha512-ANFqWYPwkhIqPmXw8vm0GpBEHiPpqcm99jiiAp71DbCSqLDhrtr019C5vhD0Bw4My+LmMvciZq6IsWHqQpl2ZQ==} + /@rollup/rollup-win32-x64-msvc@4.2.0: + resolution: {integrity: sha512-dgQfFdHCNg08nM5zBmqxqc9vrm0DVzhWotpavbPa0j4//MAOKZEB75yGAfzQE9fUJ+4pvM1239Y4IhL8f6sSog==} cpu: [x64] os: [win32] requiresBuild: true @@ -1180,7 +1086,7 @@ packages: vite: ^4.0.0 dependencies: '@sveltejs/vite-plugin-svelte': 2.4.6(svelte@4.2.2)(vite@4.5.0) - debug: 4.3.4 + debug: 4.3.4(supports-color@8.1.1) svelte: 4.2.2 vite: 4.5.0 transitivePeerDependencies: @@ -1195,7 +1101,7 @@ packages: vite: ^4.0.0 dependencies: '@sveltejs/vite-plugin-svelte-inspector': 1.0.4(@sveltejs/vite-plugin-svelte@2.4.6)(svelte@4.2.2)(vite@4.5.0) - debug: 4.3.4 + debug: 4.3.4(supports-color@8.1.1) deepmerge: 4.3.1 kleur: 4.1.5 magic-string: 0.30.5 @@ -1377,7 +1283,7 @@ packages: '@typescript-eslint/type-utils': 6.8.0(eslint@8.51.0)(typescript@5.2.2) '@typescript-eslint/utils': 6.8.0(eslint@8.51.0)(typescript@5.2.2) '@typescript-eslint/visitor-keys': 6.8.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@8.1.1) eslint: 8.51.0 graphemer: 1.4.0 ignore: 5.2.4 @@ -1403,7 +1309,7 @@ packages: '@typescript-eslint/types': 6.8.0 '@typescript-eslint/typescript-estree': 6.8.0(typescript@5.2.2) '@typescript-eslint/visitor-keys': 6.8.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@8.1.1) eslint: 8.51.0 typescript: 5.2.2 transitivePeerDependencies: @@ -1430,7 +1336,7 @@ packages: dependencies: '@typescript-eslint/typescript-estree': 6.8.0(typescript@5.2.2) '@typescript-eslint/utils': 6.8.0(eslint@8.51.0)(typescript@5.2.2) - debug: 4.3.4 + debug: 4.3.4(supports-color@8.1.1) eslint: 8.51.0 ts-api-utils: 1.0.1(typescript@5.2.2) typescript: 5.2.2 @@ -1454,7 +1360,7 @@ packages: dependencies: '@typescript-eslint/types': 6.8.0 '@typescript-eslint/visitor-keys': 6.8.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@8.1.1) globby: 11.1.0 is-glob: 4.0.3 semver: 7.5.4 @@ -1491,7 +1397,7 @@ packages: eslint-visitor-keys: 3.4.1 dev: true - /@unocss/astro@0.56.5(vite@4.5.0): + /@unocss/astro@0.56.5(rollup@4.2.0)(vite@4.5.0): resolution: {integrity: sha512-nkxyGV9mA7DZ5LEr4Gap/SggM60MFNUfn56ngpxCqjQHJOMRJrAcR99hCVn+78vZ9xuZl9HxdIwgZLzn41thMw==} peerDependencies: vite: ^2.9.0 || ^3.0.0-0 || ^4.0.0 @@ -1501,19 +1407,19 @@ packages: dependencies: '@unocss/core': 0.56.5 '@unocss/reset': 0.56.5 - '@unocss/vite': 0.56.5(vite@4.5.0) + '@unocss/vite': 0.56.5(rollup@4.2.0)(vite@4.5.0) vite: 4.5.0 transitivePeerDependencies: - rollup dev: true - /@unocss/cli@0.56.5: + /@unocss/cli@0.56.5(rollup@4.2.0): resolution: {integrity: sha512-VYaqu7Dr1n9ebFFdQM+9Jyg/o9BVKRShlV8bQsBS58gkXiWsA/uAl1Uy2vzpLSrT0F6uGyDmYUF6p4DaUnUO+w==} engines: {node: '>=14'} hasBin: true dependencies: '@ampproject/remapping': 2.2.1 - '@rollup/pluginutils': 5.0.5 + '@rollup/pluginutils': 5.0.5(rollup@4.2.0) '@unocss/config': 0.56.5 '@unocss/core': 0.56.5 '@unocss/preset-uno': 0.56.5 @@ -1682,13 +1588,13 @@ packages: '@unocss/core': 0.56.5 dev: true - /@unocss/vite@0.56.5(vite@4.5.0): + /@unocss/vite@0.56.5(rollup@4.2.0)(vite@4.5.0): resolution: {integrity: sha512-X4nvIukXTH//d+Oc97nJogK04sVGw4fc5LhVV1DjHQVmAOAmhTJCG6SxWGoSeqqUMx5X3gI9fVILK+5O8yl5EA==} peerDependencies: vite: ^2.9.0 || ^3.0.0-0 || ^4.0.0 dependencies: '@ampproject/remapping': 2.2.1 - '@rollup/pluginutils': 5.0.5 + '@rollup/pluginutils': 5.0.5(rollup@4.2.0) '@unocss/config': 0.56.5 '@unocss/core': 0.56.5 '@unocss/inspector': 0.56.5 @@ -2153,18 +2059,6 @@ packages: ms: 2.1.3 dev: true - /debug@4.3.4: - resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} - engines: {node: '>=6.0'} - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - dependencies: - ms: 2.1.2 - dev: true - /debug@4.3.4(supports-color@8.1.1): resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} engines: {node: '>=6.0'} @@ -2264,18 +2158,6 @@ packages: resolution: {integrity: sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==} dev: true - /effection@2.0.7: - resolution: {integrity: sha512-I9ndFvtByvHbvOHwMp1NM7vlLDT0RBOu1YlIfBece46VASSot0oPnAfoGdc1YKoQShQLjigvHZ6OqZYUAxUcXg==} - dependencies: - '@effection/channel': 2.0.5 - '@effection/core': 2.2.2 - '@effection/events': 2.0.5 - '@effection/fetch': 2.0.6(mocha@10.2.0) - '@effection/main': 2.1.2 - '@effection/stream': 2.0.5 - '@effection/subscription': 2.0.5 - dev: true - /effection@2.0.7(mocha@10.2.0): resolution: {integrity: sha512-I9ndFvtByvHbvOHwMp1NM7vlLDT0RBOu1YlIfBece46VASSot0oPnAfoGdc1YKoQShQLjigvHZ6OqZYUAxUcXg==} dependencies: @@ -2610,7 +2492,7 @@ packages: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.3 - debug: 4.3.4 + debug: 4.3.4(supports-color@8.1.1) doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.2.2 @@ -3517,7 +3399,7 @@ packages: /micromark@2.11.4: resolution: {integrity: sha512-+WoovN/ppKolQOFIAajxi7Lu9kInbPxFuTBVEavFcL8eAfVstoc5MocPmqBeAdBOJV00uaVjegzH4+MA0DN/uA==} dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@8.1.1) parse-entities: 2.0.0 transitivePeerDependencies: - supports-color @@ -4040,23 +3922,23 @@ packages: fsevents: 2.3.3 dev: true - /rollup@4.1.4: - resolution: {integrity: sha512-U8Yk1lQRKqCkDBip/pMYT+IKaN7b7UesK3fLSTuHBoBJacCE+oBqo/dfG/gkUdQNNB2OBmRP98cn2C2bkYZkyw==} + /rollup@4.2.0: + resolution: {integrity: sha512-deaMa9Z+jPVeBD2dKXv+h7EbdKte9++V2potc/ADqvVgEr6DEJ3ia9u0joarjC2lX/ubaCRYz3QVx0TzuVqAJA==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.1.4 - '@rollup/rollup-android-arm64': 4.1.4 - '@rollup/rollup-darwin-arm64': 4.1.4 - '@rollup/rollup-darwin-x64': 4.1.4 - '@rollup/rollup-linux-arm-gnueabihf': 4.1.4 - '@rollup/rollup-linux-arm64-gnu': 4.1.4 - '@rollup/rollup-linux-arm64-musl': 4.1.4 - '@rollup/rollup-linux-x64-gnu': 4.1.4 - '@rollup/rollup-linux-x64-musl': 4.1.4 - '@rollup/rollup-win32-arm64-msvc': 4.1.4 - '@rollup/rollup-win32-ia32-msvc': 4.1.4 - '@rollup/rollup-win32-x64-msvc': 4.1.4 + '@rollup/rollup-android-arm-eabi': 4.2.0 + '@rollup/rollup-android-arm64': 4.2.0 + '@rollup/rollup-darwin-arm64': 4.2.0 + '@rollup/rollup-darwin-x64': 4.2.0 + '@rollup/rollup-linux-arm-gnueabihf': 4.2.0 + '@rollup/rollup-linux-arm64-gnu': 4.2.0 + '@rollup/rollup-linux-arm64-musl': 4.2.0 + '@rollup/rollup-linux-x64-gnu': 4.2.0 + '@rollup/rollup-linux-x64-musl': 4.2.0 + '@rollup/rollup-win32-arm64-msvc': 4.2.0 + '@rollup/rollup-win32-ia32-msvc': 4.2.0 + '@rollup/rollup-win32-x64-msvc': 4.2.0 fsevents: 2.3.3 dev: true @@ -4513,10 +4395,6 @@ packages: strip-bom: 3.0.0 dev: true - /tslib@2.6.0: - resolution: {integrity: sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==} - dev: true - /tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} dev: true @@ -4634,7 +4512,7 @@ packages: '@types/unist': 2.0.7 dev: true - /unocss@0.56.5(postcss@8.4.31)(vite@4.5.0): + /unocss@0.56.5(postcss@8.4.31)(rollup@4.2.0)(vite@4.5.0): resolution: {integrity: sha512-tO+9St4CntSjHpLXZqBo0/etS06MtvFF1NEny/qFJCL9sCopWwmDKuzW6/LIb4wfqZLdMpVFoEACMNv8nP849A==} engines: {node: '>=14'} peerDependencies: @@ -4646,8 +4524,8 @@ packages: vite: optional: true dependencies: - '@unocss/astro': 0.56.5(vite@4.5.0) - '@unocss/cli': 0.56.5 + '@unocss/astro': 0.56.5(rollup@4.2.0)(vite@4.5.0) + '@unocss/cli': 0.56.5(rollup@4.2.0) '@unocss/core': 0.56.5 '@unocss/extractor-arbitrary-variants': 0.56.5 '@unocss/postcss': 0.56.5(postcss@8.4.31) @@ -4665,7 +4543,7 @@ packages: '@unocss/transformer-compile-class': 0.56.5 '@unocss/transformer-directives': 0.56.5 '@unocss/transformer-variant-group': 0.56.5 - '@unocss/vite': 0.56.5(vite@4.5.0) + '@unocss/vite': 0.56.5(rollup@4.2.0)(vite@4.5.0) vite: 4.5.0 transitivePeerDependencies: - postcss diff --git a/shared/rollup.config.js b/shared/rollup.config.js new file mode 100644 index 000000000..90e1084fe --- /dev/null +++ b/shared/rollup.config.js @@ -0,0 +1,88 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +import { readFileSync } from "fs"; +import { join } from "path"; +import { cwd } from "process"; +import { nodeResolve } from "@rollup/plugin-node-resolve"; +import typescript from "@rollup/plugin-typescript"; +import terser from "@rollup/plugin-terser"; + +/** + * Create a base rollup config + * + * @param {object} [options] Configuration object + * @param {string} [options.input] Input path + * @param {import('rollup').ExternalOption} [options.external] External dependencies list + * @param {import('rollup').RollupOptions | import('rollup').RollupOptions[]} [options.additionalConfigs] Additional rollup configurations + * + * @returns {import('rollup').RollupOptions} + */ +export function createConfig(options = {}) { + const { + input = "guest-js/index.ts", + external = [/^@tauri-apps\/api/], + additionalConfigs = [], + } = options; + + const pkg = JSON.parse(readFileSync(join(cwd(), "package.json"), "utf8")); + + const pluginJsName = pkg.name + .replace("@tauri-apps/plugin-", "") + .replace(/-./g, (x) => x[1].toUpperCase()); + const iifeVarName = `__TAURI_PLUGIN_${pluginJsName.toUpperCase()}__`; + + return [ + { + input, + output: [ + { + file: pkg.exports.import, + format: "esm", + }, + { + file: pkg.exports.require, + format: "cjs", + }, + ], + plugins: [ + typescript({ + declaration: true, + declarationDir: `./${pkg.exports.import.split("/")[0]}`, + }), + ], + external: [ + ...external, + ...Object.keys(pkg.dependencies || {}), + ...Object.keys(pkg.peerDependencies || {}), + ], + onwarn: (warning) => { + throw Object.assign(new Error(), warning); + }, + }, + + { + input, + output: { + format: "iife", + name: iifeVarName, + // IIFE is in the format `var ${iifeVarName} = (() => {})()` + // we check if __TAURI__ exists and inject the API object + banner: "if ('__TAURI__' in window) {", + // the last `}` closes the if in the banner + footer: `Object.defineProperty(window.__TAURI__, '${pluginJsName}', { value: ${iifeVarName} }) }`, + file: "src/api-iife.js", + }, + // and var is not guaranteed to assign to the global `window` object so we make sure to assign it + plugins: [typescript(), terser(), nodeResolve()], + onwarn: (warning) => { + throw Object.assign(new Error(), warning); + }, + }, + + ...(Array.isArray(additionalConfigs) + ? additionalConfigs + : [additionalConfigs]), + ]; +} diff --git a/shared/rollup.config.mjs b/shared/rollup.config.mjs deleted file mode 100644 index 95042f8c1..000000000 --- a/shared/rollup.config.mjs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -import { builtinModules } from "module"; - -import typescript from "@rollup/plugin-typescript"; -import resolve from "@rollup/plugin-node-resolve"; -import terser from "@rollup/plugin-terser"; - -/** - * Create a base rollup config - * @param {Record} pkg Imported package.json - * @param {string[]} external Imported package.json - * @returns {import('rollup').RollupOptions} - */ -export function createConfig({ input = "index.ts", pkg, external = [] }) { - const pluginJsName = pkg.name - .replace("@tauri-apps/plugin-", "") - .replace(/-./g, (x) => x[1].toUpperCase()); - const iifeVarName = `__TAURI_${pluginJsName.toUpperCase()}__`; - return [ - { - input, - external: Object.keys(pkg.dependencies || {}) - .concat(Object.keys(pkg.peerDependencies || {})) - .concat(builtinModules) - .concat(external), - onwarn: (warning) => { - throw Object.assign(new Error(), warning); - }, - strictDeprecations: true, - output: { - file: pkg.module, - format: "es", - sourcemap: true, - }, - plugins: [typescript({ sourceMap: true })], - }, - { - input, - onwarn: (warning) => { - throw Object.assign(new Error(), warning); - }, - strictDeprecations: true, - output: { - file: pkg.browser, - format: "es", - sourcemap: true, - entryFileNames: "[name].min.js", - }, - plugins: [ - resolve(), - // terser(), - typescript({ sourceMap: true }), - ], - }, - { - input, - output: { - file: "src/api-iife.js", - format: "iife", - name: iifeVarName, - // IIFE is in the format `var ${iifeVarName} = (() => {})()` - // we check if __TAURI__ exists and inject the API object - banner: "if ('__TAURI__' in window) {", - // the last `}` closes the if in the banner - footer: `Object.defineProperty(window.__TAURI__, '${pluginJsName}', { value: ${iifeVarName} }) }`, - }, - // and var is not guaranteed to assign to the global `window` object so we make sure to assign it - plugins: [ - resolve(), - typescript({ - sourceMap: false, - declaration: false, - declarationDir: undefined, - }), - terser(), - ], - }, - ]; -} diff --git a/shared/template/package.json b/shared/template/package.json index 388efff65..88606d39c 100644 --- a/shared/template/package.json +++ b/shared/template/package.json @@ -6,26 +6,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "2.6.0" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/shared/template/rollup.config.js b/shared/template/rollup.config.js new file mode 100644 index 000000000..8e039e06c --- /dev/null +++ b/shared/template/rollup.config.js @@ -0,0 +1,3 @@ +import { createConfig } from "../../shared/rollup.config.js"; + +export default createConfig(); diff --git a/shared/template/rollup.config.mjs b/shared/template/rollup.config.mjs deleted file mode 100644 index a71590d25..000000000 --- a/shared/template/rollup.config.mjs +++ /dev/null @@ -1,11 +0,0 @@ -import { readFileSync } from "fs"; - -import { createConfig } from "../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/], -}); diff --git a/tsconfig.base.json b/tsconfig.base.json index 629a7c965..b5e2c519d 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1,20 +1,13 @@ { "compilerOptions": { - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "lib": ["ES2019", "ES2020.Promise", "ES2020.String", "DOM", "DOM.Iterable"], - "module": "ESNext", - "moduleResolution": "node", - "noEmit": true, - "noEmitOnError": false, - "noUnusedLocals": true, - "noUnusedParameters": true, - "pretty": true, - "sourceMap": true, + "target": "es2021", + "module": "esnext", + "moduleResolution": "bundler", + "skipLibCheck": true, "strict": true, - "target": "ES2019", - "declaration": true, - "declarationDir": "./" + "noUnusedLocals": true, + "noImplicitAny": true, + "noEmit": true }, "exclude": ["dist-js", "node_modules", "test/types"] }