From fee976b69ebd9b465c4c2cbbb607cc9872e990d9 Mon Sep 17 00:00:00 2001 From: Kayori Date: Thu, 1 Oct 2026 14:25:13 +0200 Subject: [PATCH] Move frontend types into it's own package for a single source of truth --- Abstractions/Client/package.json | 9 +++++++++ Core/Client/bun.lock | 3 +++ Core/Client/package.json | 1 + Core/Client/src/types/plugins.d.ts | 13 +++---------- 4 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 Abstractions/Client/package.json diff --git a/Abstractions/Client/package.json b/Abstractions/Client/package.json new file mode 100644 index 0000000..7cbe6ab --- /dev/null +++ b/Abstractions/Client/package.json @@ -0,0 +1,9 @@ +{ + "name": "medusa-plugin-types", + "version": "0.1.0", + "private": true, + "types": "index.d.ts", + "peerDependencies": { + "vue": ">=3.0.0" + } +} diff --git a/Core/Client/bun.lock b/Core/Client/bun.lock index 4cc0154..62ed2cd 100644 --- a/Core/Client/bun.lock +++ b/Core/Client/bun.lock @@ -16,6 +16,7 @@ "axios": "^1.19.0", "classnames": "^2.5.1", "graphql": "16.14.2", + "medusa-plugin-types": "file:../../Abstractions/Client", "pinia": "^4.0.2", "qr-scanner": "^1.4.2", "tailwind-material-3": "^3.0.5", @@ -958,6 +959,8 @@ "mdurl": ["mdurl@2.1.0", "", {}, "sha512-1+HBaOx0zi/dQWht8rNv9MYf9qqpqL/kxI0hXImU6Y547zM6Sni8BQibt7ifgMcYtQg41ao3Ivd6cnSM86inpg=="], + "medusa-plugin-types": ["medusa-plugin-types@file:../../Abstractions/Client", { "peerDependencies": { "vue": ">=3.0.0" } }], + "memorystream": ["memorystream@0.3.1", "", {}, "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw=="], "merge2": ["merge2@1.4.1", "", {}, "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg=="], diff --git a/Core/Client/package.json b/Core/Client/package.json index fa2d529..b0b2abf 100644 --- a/Core/Client/package.json +++ b/Core/Client/package.json @@ -14,6 +14,7 @@ "api-codegen": "orval" }, "dependencies": { + "medusa-plugin-types": "file:../../Abstractions/Client", "@apollo/client": "^3.14.1", "@iconify/vue": "^5.0.1", "@material/material-color-utilities": "^0.4.0", diff --git a/Core/Client/src/types/plugins.d.ts b/Core/Client/src/types/plugins.d.ts index a8ff20a..44d67c0 100644 --- a/Core/Client/src/types/plugins.d.ts +++ b/Core/Client/src/types/plugins.d.ts @@ -1,21 +1,14 @@ import type * as Vue from 'vue' import type * as VueRouter from 'vue-router' import type * as PiniaLib from 'pinia' +import 'medusa-plugin-types' -export interface PluginExportMap { - [componentKey: string]: Vue.Component -} - -export interface MedusaHostHelpers { - getAccessToken: () => string | null -} +export type { PluginExportMap, MedusaHostHelpers } from 'medusa-plugin-types' declare global { interface Window { __medusa_vue__: typeof Vue __medusa_router__: typeof VueRouter __medusa_pinia__: typeof PiniaLib - __medusa_plugins__: Record - __medusa_host__: MedusaHostHelpers } -} \ No newline at end of file +}