From 131063dae8f69fd38123003857b568be138917e7 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Tue, 25 May 2021 16:48:14 +0200 Subject: [PATCH] [plugin] Plugins only can require backend modules *BREAKING* Frontend module dependencies are resolved by the package.json peerDependencies. This breaks current behaviour as the backend property is merged into the "frontend". --- types/plugin.d.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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) */