1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Export more things for the extension API

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2023-02-01 17:22:50 -05:00
parent 7a57a89194
commit c8e9e257fb
7 changed files with 63 additions and 73 deletions

View File

@ -3,31 +3,21 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
// APIs
import { App } from "./app";
import * as EventBus from "./event-bus";
import * as Store from "./stores";
import { Util } from "./utils";
import * as Catalog from "./catalog";
import * as Types from "./types";
import * as Proxy from "./proxy";
import loggerInjectable from "../../common/logger.injectable";
import { asLegacyGlobalForExtensionApi } from "../as-legacy-globals-for-extension-api/as-legacy-global-object-for-extension-api";
import type { Logger } from "../../common/logger";
import type { LensExtension, LensExtensionManifest } from "../lens-extension";
const logger = asLegacyGlobalForExtensionApi(loggerInjectable);
// APIs
export { App } from "./app";
export * as EventBus from "./event-bus";
export * as Store from "./stores";
export * as Util from "./utils";
export * as Catalog from "./catalog";
export * as Types from "./types";
export * as Proxy from "./proxy";
export {
App,
EventBus,
Catalog,
Store,
Types,
Util,
logger,
Proxy,
Logger,
LensExtension,
LensExtensionManifest,
};
export type { Logger } from "../../common/logger";
export type { LensExtension, LensExtensionManifest } from "../lens-extension";
export type { InstalledExtension } from "../extension-discovery/extension-discovery";
export type { PackageJson } from "type-fest";
export const logger = asLegacyGlobalForExtensionApi(loggerInjectable);

View File

@ -108,13 +108,16 @@ export type { CreateKubeApiForLocalClusterConfig as ILocalKubeApiConfig } from "
export {
KubeObject,
KubeStatus,
type OwnerReference,
type KubeObjectMetadata,
type NamespaceScopedMetadata,
type ClusterScopedMetadata,
type BaseKubeJsonApiObjectMetadata,
type KubeJsonApiObjectMetadata,
type KubeStatusData,
} from "../../common/k8s-api/kube-object";
export type {
OwnerReference,
KubeObjectMetadata,
NamespaceScopedMetadata,
ClusterScopedMetadata,
BaseKubeJsonApiObjectMetadata,
KubeJsonApiObjectMetadata,
KubeStatusData,
KubeJsonApiDataFor,
} from "../../common/k8s-api/kube-object";
export type {
@ -177,11 +180,11 @@ export abstract class KubeObjectStore<
}
}
export {
type JsonPatch,
type KubeObjectStoreLoadAllParams,
type KubeObjectStoreLoadingParams,
type KubeObjectStoreSubscribeParams,
export type {
JsonPatch,
KubeObjectStoreLoadAllParams,
KubeObjectStoreLoadingParams,
KubeObjectStoreSubscribeParams,
} from "../../common/k8s-api/kube-object.store";
/**

View File

@ -1,17 +0,0 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
export type { StatusBarRegistration } from "../../renderer/components/status-bar/status-bar-registration";
export type { KubeObjectMenuRegistration, KubeObjectMenuComponents } from "../../renderer/components/kube-object-menu/kube-object-menu-registration";
export type { AppPreferenceRegistration, AppPreferenceComponents } from "../../features/preferences/renderer/compliance-for-legacy-extension-api/app-preference-registration";
export type { KubeObjectDetailRegistration, KubeObjectDetailComponents } from "../../renderer/components/kube-object-details/kube-object-detail-registration";
export type { KubeObjectStatusRegistration } from "../../renderer/components/kube-object-status-icon/kube-object-status-registration";
export type { PageRegistration, RegisteredPage, PageParams, PageComponentProps, PageComponents, PageTarget } from "../../renderer/routes/page-registration";
export type { ClusterPageMenuRegistration, ClusterPageMenuComponents } from "../../renderer/components/layout/cluster-page-menu";
export type { ProtocolHandlerRegistration, RouteParams as ProtocolRouteParams, RouteHandler as ProtocolRouteHandler } from "../../common/protocol-handler/registration";
export type { CustomCategoryViewProps, CustomCategoryViewComponents, CustomCategoryViewRegistration } from "../../renderer/components/+catalog/custom-views";
export type { ShellEnvModifier, ShellEnvContext } from "../../main/shell-session/shell-env-modifier/shell-env-modifier-registration";
export type { KubeObjectContextMenuItem, KubeObjectOnContextMenuOpenContext, KubeObjectOnContextMenuOpen, KubeObjectHandlers, KubeObjectHandlerRegistration } from "../../renderer/kube-object/handler";
export type { TrayMenuRegistration } from "../../main/tray/tray-menu-registration";
export type { MenuRegistration } from "../../features/application-menu/main/menu-registration";

View File

@ -3,8 +3,21 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
export type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
export type IpcRendererEvent = Electron.IpcRendererEvent;
export type IpcMainEvent = Electron.IpcMainEvent;
export * from "./registrations";
export type { StatusBarRegistration } from "../../renderer/components/status-bar/status-bar-registration";
export type { KubeObjectMenuRegistration, KubeObjectMenuComponents } from "../../renderer/components/kube-object-menu/kube-object-menu-registration";
export type { AppPreferenceRegistration, AppPreferenceComponents } from "../../features/preferences/renderer/compliance-for-legacy-extension-api/app-preference-registration";
export type { KubeObjectDetailRegistration, KubeObjectDetailComponents } from "../../renderer/components/kube-object-details/kube-object-detail-registration";
export type { KubeObjectStatusRegistration } from "../../renderer/components/kube-object-status-icon/kube-object-status-registration";
export type { PageRegistration, RegisteredPage, PageParams, PageComponentProps, PageComponents, PageTarget } from "../../renderer/routes/page-registration";
export type { ClusterPageMenuRegistration, ClusterPageMenuComponents } from "../../renderer/components/layout/cluster-page-menu";
export type { ProtocolHandlerRegistration, RouteParams as ProtocolRouteParams, RouteHandler as ProtocolRouteHandler } from "../../common/protocol-handler/registration";
export type { CustomCategoryViewProps, CustomCategoryViewComponents, CustomCategoryViewRegistration } from "../../renderer/components/+catalog/custom-views";
export type { ShellEnvModifier, ShellEnvContext } from "../../main/shell-session/shell-env-modifier/shell-env-modifier-registration";
export type { KubeObjectContextMenuItem, KubeObjectOnContextMenuOpenContext, KubeObjectOnContextMenuOpen, KubeObjectHandlers, KubeObjectHandlerRegistration } from "../../renderer/kube-object/handler";
export type { TrayMenuRegistration } from "../../main/tray/tray-menu-registration";
export type { MenuRegistration } from "../../features/application-menu/main/menu-registration";

View File

@ -7,20 +7,23 @@ import openLinkInBrowserInjectable from "../../common/utils/open-link-in-browser
import buildVersionInjectable from "../../main/vars/build-version/build-version.injectable";
import { asLegacyGlobalFunctionForExtensionApi } from "../as-legacy-globals-for-extension-api/as-legacy-global-function-for-extension-api";
import { getLegacyGlobalDiForExtensionApi } from "../as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api";
import { Singleton } from "../../common/utils";
import { prevDefault, stopPropagation } from "../../renderer/utils/prevDefault";
import { cssNames } from "../../renderer/utils/cssNames";
export const Util = {
Singleton,
prevDefault,
stopPropagation,
cssNames,
openExternal: asLegacyGlobalFunctionForExtensionApi(openLinkInBrowserInjectable),
openBrowser: asLegacyGlobalFunctionForExtensionApi(openLinkInBrowserInjectable),
getAppVersion: () => {
const di = getLegacyGlobalDiForExtensionApi();
export { Singleton } from "../../common/utils";
export { prevDefault, stopPropagation } from "../../renderer/utils/prevDefault";
return di.inject(buildVersionInjectable).get();
},
} as const;
export type { IClassName, IgnoredClassNames } from "../../renderer/utils";
export { cssNames } from "../../renderer/utils/cssNames";
export type { OpenLinkInBrowser } from "../../common/utils/open-link-in-browser.injectable";
export const openExternal = asLegacyGlobalFunctionForExtensionApi(openLinkInBrowserInjectable);
export const openBrowser = asLegacyGlobalFunctionForExtensionApi(openLinkInBrowserInjectable);
export const getAppVersion = () => {
const di = getLegacyGlobalDiForExtensionApi();
return di.inject(buildVersionInjectable).get();
};
export { disposer } from "../../common/utils";
export type { Disposer, Disposable, ExtendableDisposer } from "../../common/utils";

View File

@ -8,7 +8,7 @@ import { action, computed, makeObservable, observable } from "mobx";
import type { PackageJson } from "type-fest";
import { disposer } from "../common/utils";
import type { LensExtensionDependencies } from "./lens-extension-set-dependencies";
import type { ProtocolHandlerRegistration } from "./common-api/registrations";
import type { ProtocolHandlerRegistration } from "../common/protocol-handler/registration";
export type LensExtensionId = string; // path to manifest (package.json)
export type LensExtensionConstructor = new (...args: ConstructorParameters<typeof LensExtension>) => LensExtension;

View File

@ -6,9 +6,7 @@
import { iter } from "../../common/utils";
export type IgnoredClassNames = number | symbol | Function;
export type IClassName = string | string[] | IClassNameMap | undefined | null | false | IgnoredClassNames;
export type IClassNameMap = object;
export type IClassName = string | string[] | Record<string, any> | undefined | null | false | IgnoredClassNames;
export function cssNames(...classNames: IClassName[]): string {
const classNamesEnabled = new Map<string, boolean>();