/
plugin.ts
38 lines (32 loc) · 970 Bytes
/
plugin.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import type { AnyObject } from '@monorepo/common';
import type { Extension, LoadedExtension } from './extension';
import type { PluginEntryModule } from './runtime';
export type PluginRegistrationMethod = 'callback' | 'custom';
export type PluginRuntimeMetadata = {
name: string;
version: string;
dependencies?: Record<string, string>;
customProperties?: AnyObject;
};
export type PluginManifest = PluginRuntimeMetadata & {
baseURL: string;
extensions: Extension[];
loadScripts: string[];
registrationMethod: PluginRegistrationMethod;
buildHash?: string;
};
export type PendingPlugin = {
manifest: Readonly<PluginManifest>;
};
export type LoadedPlugin = {
manifest: Readonly<PluginManifest>;
loadedExtensions: Readonly<LoadedExtension[]>;
entryModule: PluginEntryModule;
enabled: boolean;
disableReason?: string;
};
export type FailedPlugin = {
manifest: Readonly<PluginManifest>;
errorMessage: string;
errorCause?: unknown;
};