diff --git a/types/plugin.d.ts b/types/plugin.d.ts index 2ad5cc8..13929fa 100644 --- a/types/plugin.d.ts +++ b/types/plugin.d.ts @@ -1,13 +1,17 @@ import type { RouteLocationRaw, RouteRecordRaw, RouteRecordName } from 'vue-router'; import type { Component } from '@vue/runtime-core'; +/* This is some sort of PEP440 subset */ type Join = T extends [] ? '' : T extends [string | number | boolean | bigint] ? `${T[0]}` : T extends [string | number | boolean | bigint, ...infer U] ? `${T[0]}${D}${Join}` : string; -type BVersion = Join<[number, number], '.'> | Join<[number, number, number], '.'> -type Version = BVersion | Join<[BVersion, string], '-'> +type BaseVersion = Join<[number, number], '.'> | Join<[number, number, number], '.'> +type PreRelease = Join<[["a"|"b"|"rc"], number], "."> +type PRVersion = BaseVersion | `${BaseVersion}${PreRelease}` +/** A PEP440 subset used to describe backend module versions */ +export type PEP440Version = PRVersion | `${PRVersion}.dev${number}` export namespace FG_Plugin { /** @@ -22,10 +26,8 @@ export namespace FG_Plugin { version: string; /** Widgets provided by this plugin */ widgets: Widget[]; - /** Other frontend modules needed for this plugin to work correctly */ - requiredModules: [string, Version?][]; /** Backend modules needed for this plugin to work correctly */ - requiredBackendModules: [string, Version?][]; + requiredModules: [string, PEP440Version?][]; /** Menu entries for authenticated users */ innerRoutes?: MenuRoute[]; /** Public menu entries (without authentification) */