@backstage/frontend-app-api 0.2.0-next.2 → 0.3.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,63 @@
1
1
  # @backstage/frontend-app-api
2
2
 
3
+ ## 0.3.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 68fc9dc60e: Added the ability to configure bound routes through `app.routes.bindings`. The routing system used by `createApp` has been replaced by one that only supports route refs of the new format from `@backstage/frontend-plugin-api`. The requirement for route refs to have the same ID as their associated extension has been removed.
8
+
9
+ ### Patch Changes
10
+
11
+ - e28d379e32: Refactor internal extension instance system into an app graph.
12
+ - 6c2b872153: Add official support for React 18.
13
+ - dc613f9bcf: Updated `app.extensions` configuration schema.
14
+ - 685a4c8901: Installed features are now deduplicated both by reference and ID when available. Features passed to `createApp` now override both discovered and loaded features.
15
+ - bb98953cb9: Register default implementation for the `Translation API` on the new `createApp`.
16
+ - Updated dependencies
17
+ - @backstage/core-components@0.13.7-next.0
18
+ - @backstage/frontend-plugin-api@0.3.0-next.0
19
+ - @backstage/plugin-graphiql@0.3.0-next.0
20
+ - @backstage/core-plugin-api@1.8.0-next.0
21
+ - @backstage/version-bridge@1.0.7-next.0
22
+ - @backstage/core-app-api@1.11.1-next.0
23
+ - @backstage/theme@0.4.4-next.0
24
+ - @backstage/config@1.1.1
25
+ - @backstage/types@1.1.1
26
+
27
+ ## 0.2.0
28
+
29
+ ### Minor Changes
30
+
31
+ - 4461d87d5a: Removed support for the new `useRouteRef`.
32
+ - 9d03dfe5e3: The `createApp` config option has been replaced by a new `configLoader` option. There is now also a `pluginLoader` option that can be used to dynamically load plugins into the app.
33
+ - d7c5d80c57: The hidden `'root'` extension has been removed and has instead been made an input of the `'core'` extension. The checks for rejecting configuration of the `'root'` extension to rejects configuration of the `'core'` extension instead.
34
+ - d920b8c343: Added support for installing `ExtensionOverrides` via `createApp` options. As part of this change the `plugins` option has been renamed to `features`, and the `pluginLoader` has been renamed to `featureLoader`.
35
+
36
+ ### Patch Changes
37
+
38
+ - 322bbcae24: Internal update for removal of experimental plugin configuration API.
39
+ - f78ac58f88: Filters for discovered packages are now also applied at runtime. This makes it possible to disable packages through the `app.experimental.packages` config at runtime.
40
+ - 68ffb9e67d: The app will now reject any extensions that attach to nonexistent inputs.
41
+ - 5072824817: Implement `toString()` and `toJSON()` for extension instances.
42
+ - 1e60a9c3a5: Fixed an issue preventing the routing system to match subroutes
43
+ - 52366db5b3: Make themes configurable through extensions, and switched default themes to use extensions instead.
44
+ - 2ecd33618a: Added the `bindRoutes` option to `createApp`.
45
+ - e5a2956dd2: Register default api implementations when creating declarative integrated apps.
46
+ - 9a1fce352e: Updated dependency `@testing-library/jest-dom` to `^6.0.0`.
47
+ - 06432f900c: Updates for `at` -> `attachTo` refactor.
48
+ - 1718ec75b7: Added support for the existing routing system.
49
+ - 66d51a4827: Prevents root extension override and duplicated plugin extensions.
50
+ - Updated dependencies
51
+ - @backstage/frontend-plugin-api@0.2.0
52
+ - @backstage/core-app-api@1.11.0
53
+ - @backstage/core-plugin-api@1.7.0
54
+ - @backstage/core-components@0.13.6
55
+ - @backstage/plugin-graphiql@0.2.55
56
+ - @backstage/version-bridge@1.0.6
57
+ - @backstage/theme@0.4.3
58
+ - @backstage/config@1.1.1
59
+ - @backstage/types@1.1.1
60
+
3
61
  ## 0.2.0-next.2
4
62
 
5
63
  ### Minor Changes
package/config.d.ts CHANGED
@@ -16,20 +16,35 @@
16
16
 
17
17
  export interface Config {
18
18
  app?: {
19
+ experimental?: {
20
+ /**
21
+ * @visibility frontend
22
+ * @deepVisibility frontend
23
+ */
24
+ packages?: 'all' | { include?: string[]; exclude?: string[] };
25
+ };
26
+
27
+ routes?: {
28
+ /**
29
+ * @deepVisibility frontend
30
+ */
31
+ bindings?: { [externalRouteRefId: string]: string };
32
+ };
33
+
19
34
  /**
20
35
  * @deepVisibility frontend
21
36
  */
22
- extensions?:
37
+ extensions?: Array<
23
38
  | string
24
39
  | {
25
40
  [extensionId: string]:
26
41
  | boolean
27
- | string
28
42
  | {
29
- at?: string;
30
- extension?: string;
43
+ attachTo?: { id: string; input: string };
44
+ disabled?: boolean;
31
45
  config?: unknown;
32
46
  };
33
- };
47
+ }
48
+ >;
34
49
  };
35
50
  }
package/dist/index.d.ts CHANGED
@@ -1,8 +1,46 @@
1
1
  import { JSX } from 'react';
2
2
  import { Config } from '@backstage/config';
3
- import { ExtensionDataRef, BackstagePlugin } from '@backstage/frontend-plugin-api';
3
+ import { ExternalRouteRef, RouteRef, SubRouteRef, ExtensionDataRef, BackstagePlugin, ExtensionOverrides } from '@backstage/frontend-plugin-api';
4
4
  import { ConfigApi } from '@backstage/core-plugin-api';
5
5
 
6
+ /**
7
+ * Extracts a union of the keys in a map whose value extends the given type
8
+ *
9
+ * @ignore
10
+ */
11
+ type KeysWithType<Obj extends {
12
+ [key in string]: any;
13
+ }, Type> = {
14
+ [key in keyof Obj]: Obj[key] extends Type ? key : never;
15
+ }[keyof Obj];
16
+ /**
17
+ * Takes a map Map required values and makes all keys matching Keys optional
18
+ *
19
+ * @ignore
20
+ */
21
+ type PartialKeys<Map extends {
22
+ [name in string]: any;
23
+ }, Keys extends keyof Map> = Partial<Pick<Map, Keys>> & Required<Omit<Map, Keys>>;
24
+ /**
25
+ * Creates a map of target routes with matching parameters based on a map of external routes.
26
+ *
27
+ * @ignore
28
+ */
29
+ type TargetRouteMap<ExternalRoutes extends {
30
+ [name: string]: ExternalRouteRef;
31
+ }> = {
32
+ [name in keyof ExternalRoutes]: ExternalRoutes[name] extends ExternalRouteRef<infer Params, any> ? RouteRef<Params> | SubRouteRef<Params> : never;
33
+ };
34
+ /**
35
+ * A function that can bind from external routes of a given plugin, to concrete
36
+ * routes of other plugins. See {@link createApp}.
37
+ *
38
+ * @public
39
+ */
40
+ type AppRouteBinder = <TExternalRoutes extends {
41
+ [name: string]: ExternalRouteRef;
42
+ }>(externalRoutes: TExternalRoutes, targetRoutes: PartialKeys<TargetRouteMap<TExternalRoutes>, KeysWithType<TExternalRoutes, ExternalRouteRef<any, true>>>) => void;
43
+
6
44
  /** @public */
7
45
  interface ExtensionTreeNode {
8
46
  id: string;
@@ -21,13 +59,16 @@ declare function createExtensionTree(options: {
21
59
  }): ExtensionTree;
22
60
  /** @public */
23
61
  declare function createApp(options: {
24
- plugins: BackstagePlugin[];
62
+ features?: (BackstagePlugin | ExtensionOverrides)[];
25
63
  configLoader?: () => Promise<ConfigApi>;
26
- pluginLoader?: (ctx: {
64
+ bindRoutes?(context: {
65
+ bind: AppRouteBinder;
66
+ }): void;
67
+ featureLoader?: (ctx: {
27
68
  config: ConfigApi;
28
- }) => Promise<BackstagePlugin[]>;
69
+ }) => Promise<(BackstagePlugin | ExtensionOverrides)[]>;
29
70
  }): {
30
71
  createRoot(): JSX.Element;
31
72
  };
32
73
 
33
- export { ExtensionTree, ExtensionTreeNode, createApp, createExtensionTree };
74
+ export { AppRouteBinder, ExtensionTree, ExtensionTreeNode, createApp, createExtensionTree };