[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".
This commit is contained in:
Ferdinand Thiessen 2021-05-25 16:48:14 +02:00
parent 0ee466efb9
commit 131063dae8
1 changed files with 7 additions and 5 deletions

12
types/plugin.d.ts vendored
View File

@ -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 unknown[], D extends string> =
T extends [] ? '' :
T extends [string | number | boolean | bigint] ? `${T[0]}` :
T extends [string | number | boolean | bigint, ...infer U] ? `${T[0]}${D}${Join<U, D>}` :
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) */