@backstage/core-plugin-api 1.10.5 → 1.10.6-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 +14 -0
- package/dist/analytics/AnalyticsContext.esm.js +3 -2
- package/dist/analytics/AnalyticsContext.esm.js.map +1 -1
- package/dist/apis/definitions/AlertApi.esm.js +1 -1
- package/dist/apis/definitions/AnalyticsApi.esm.js +1 -1
- package/dist/apis/definitions/AppThemeApi.esm.js +1 -1
- package/dist/apis/definitions/ConfigApi.esm.js +1 -1
- package/dist/apis/definitions/DiscoveryApi.esm.js +1 -1
- package/dist/apis/definitions/ErrorApi.esm.js +1 -1
- package/dist/apis/definitions/FeatureFlagsApi.esm.js +1 -1
- package/dist/apis/definitions/FetchApi.esm.js +1 -1
- package/dist/apis/definitions/IdentityApi.esm.js +1 -1
- package/dist/apis/definitions/OAuthRequestApi.esm.js +1 -1
- package/dist/apis/definitions/StorageApi.esm.js +1 -1
- package/dist/apis/definitions/auth.esm.js +1 -1
- package/dist/apis/system/useApi.esm.js +2 -2
- package/dist/apis/system/useApi.esm.js.map +1 -1
- package/dist/extensions/PluginErrorBoundary.esm.js +4 -3
- package/dist/extensions/PluginErrorBoundary.esm.js.map +1 -1
- package/dist/extensions/extensions.esm.js +8 -7
- package/dist/extensions/extensions.esm.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @backstage/core-plugin-api
|
|
2
2
|
|
|
3
|
+
## 1.10.6-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a47fd39: Removes instances of default React imports, a necessary update for the upcoming React 19 migration.
|
|
8
|
+
|
|
9
|
+
<https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html>
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @backstage/config@1.3.2
|
|
13
|
+
- @backstage/errors@1.2.7
|
|
14
|
+
- @backstage/types@1.2.1
|
|
15
|
+
- @backstage/version-bridge@1.0.11
|
|
16
|
+
|
|
3
17
|
## 1.10.5
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
1
2
|
import { createVersionedContext, createVersionedValueMap } from '@backstage/version-bridge';
|
|
2
|
-
import
|
|
3
|
+
import { useContext } from 'react';
|
|
3
4
|
|
|
4
5
|
const AnalyticsReactContext = createVersionedContext("analytics-context");
|
|
5
6
|
const useAnalyticsContext = () => {
|
|
@@ -25,7 +26,7 @@ const AnalyticsContext = (options) => {
|
|
|
25
26
|
...attributes
|
|
26
27
|
};
|
|
27
28
|
const versionedCombinedValue = createVersionedValueMap({ 1: combinedValue });
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
+
return /* @__PURE__ */ jsx(AnalyticsReactContext.Provider, { value: versionedCombinedValue, children });
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
export { AnalyticsContext, useAnalyticsContext };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyticsContext.esm.js","sources":["../../src/analytics/AnalyticsContext.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createVersionedContext,\n createVersionedValueMap,\n} from '@backstage/version-bridge';\nimport
|
|
1
|
+
{"version":3,"file":"AnalyticsContext.esm.js","sources":["../../src/analytics/AnalyticsContext.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createVersionedContext,\n createVersionedValueMap,\n} from '@backstage/version-bridge';\nimport { ComponentType, ReactNode, useContext } from 'react';\nimport { AnalyticsContextValue } from './types';\n\nconst AnalyticsReactContext = createVersionedContext<{\n 1: AnalyticsContextValue;\n}>('analytics-context');\n\n/**\n * A \"private\" (to this package) hook that enables context inheritance and a\n * way to read Analytics Context values at event capture-time.\n *\n * @internal\n */\nexport const useAnalyticsContext = (): AnalyticsContextValue => {\n const theContext = useContext(AnalyticsReactContext);\n\n // Provide a default value if no value exists.\n if (theContext === undefined) {\n return {\n routeRef: 'unknown',\n pluginId: 'root',\n extension: 'App',\n };\n }\n\n // This should probably never happen, but check for it.\n const theValue = theContext.atVersion(1);\n if (theValue === undefined) {\n throw new Error('No context found for version 1.');\n }\n\n return theValue;\n};\n\n/**\n * Provides components in the child react tree an Analytics Context, ensuring\n * all analytics events captured within the context have relevant attributes.\n *\n * @remarks\n *\n * Analytics contexts are additive, meaning the context ultimately emitted with\n * an event is the combination of all contexts in the parent tree.\n *\n * @public\n */\nexport const AnalyticsContext = (options: {\n attributes: Partial<AnalyticsContextValue>;\n children: ReactNode;\n}) => {\n const { attributes, children } = options;\n\n const parentValues = useAnalyticsContext();\n const combinedValue = {\n ...parentValues,\n ...attributes,\n };\n\n const versionedCombinedValue = createVersionedValueMap({ 1: combinedValue });\n return (\n <AnalyticsReactContext.Provider value={versionedCombinedValue}>\n {children}\n </AnalyticsReactContext.Provider>\n );\n};\n\n/**\n * Returns an HOC wrapping the provided component in an Analytics context with\n * the given values.\n *\n * @param Component - Component to be wrapped with analytics context attributes\n * @param values - Analytics context key/value pairs.\n * @internal\n */\nexport function withAnalyticsContext<TProps extends {}>(\n Component: ComponentType<TProps>,\n values: AnalyticsContextValue,\n) {\n const ComponentWithAnalyticsContext = (props: TProps) => {\n return (\n <AnalyticsContext attributes={values}>\n <Component {...props} />\n </AnalyticsContext>\n );\n };\n ComponentWithAnalyticsContext.displayName = `WithAnalyticsContext(${\n Component.displayName || Component.name || 'Component'\n })`;\n return ComponentWithAnalyticsContext;\n}\n"],"names":[],"mappings":";;;;AAuBA,MAAM,qBAAA,GAAwB,uBAE3B,mBAAmB,CAAA;AAQf,MAAM,sBAAsB,MAA6B;AAC9D,EAAM,MAAA,UAAA,GAAa,WAAW,qBAAqB,CAAA;AAGnD,EAAA,IAAI,eAAe,KAAW,CAAA,EAAA;AAC5B,IAAO,OAAA;AAAA,MACL,QAAU,EAAA,SAAA;AAAA,MACV,QAAU,EAAA,MAAA;AAAA,MACV,SAAW,EAAA;AAAA,KACb;AAAA;AAIF,EAAM,MAAA,QAAA,GAAW,UAAW,CAAA,SAAA,CAAU,CAAC,CAAA;AACvC,EAAA,IAAI,aAAa,KAAW,CAAA,EAAA;AAC1B,IAAM,MAAA,IAAI,MAAM,iCAAiC,CAAA;AAAA;AAGnD,EAAO,OAAA,QAAA;AACT;AAaa,MAAA,gBAAA,GAAmB,CAAC,OAG3B,KAAA;AACJ,EAAM,MAAA,EAAE,UAAY,EAAA,QAAA,EAAa,GAAA,OAAA;AAEjC,EAAA,MAAM,eAAe,mBAAoB,EAAA;AACzC,EAAA,MAAM,aAAgB,GAAA;AAAA,IACpB,GAAG,YAAA;AAAA,IACH,GAAG;AAAA,GACL;AAEA,EAAA,MAAM,sBAAyB,GAAA,uBAAA,CAAwB,EAAE,CAAA,EAAG,eAAe,CAAA;AAC3E,EAAA,2BACG,qBAAsB,CAAA,QAAA,EAAtB,EAA+B,KAAA,EAAO,wBACpC,QACH,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useVersionedContext } from '@backstage/version-bridge';
|
|
3
3
|
import { NotImplementedError } from '@backstage/errors';
|
|
4
4
|
|
|
@@ -38,7 +38,7 @@ function withApis(apis) {
|
|
|
38
38
|
impls[key] = api;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
return /* @__PURE__ */
|
|
41
|
+
return /* @__PURE__ */ jsx(WrappedComponent, { ...props, ...impls });
|
|
42
42
|
};
|
|
43
43
|
const displayName = WrappedComponent.displayName || WrappedComponent.name || "Component";
|
|
44
44
|
Hoc.displayName = `withApis(${displayName})`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useApi.esm.js","sources":["../../../src/apis/system/useApi.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"useApi.esm.js","sources":["../../../src/apis/system/useApi.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ComponentType, PropsWithChildren } from 'react';\nimport { ApiRef, ApiHolder, TypesToApiRefs } from './types';\nimport { useVersionedContext } from '@backstage/version-bridge';\nimport { NotImplementedError } from '@backstage/errors';\n\n/**\n * React hook for retrieving {@link ApiHolder}, an API catalog.\n *\n * @public\n */\nexport function useApiHolder(): ApiHolder {\n const versionedHolder = useVersionedContext<{ 1: ApiHolder }>('api-context');\n if (!versionedHolder) {\n throw new NotImplementedError('API context is not available');\n }\n\n const apiHolder = versionedHolder.atVersion(1);\n if (!apiHolder) {\n throw new NotImplementedError('ApiContext v1 not available');\n }\n return apiHolder;\n}\n\n/**\n * React hook for retrieving APIs.\n *\n * @param apiRef - Reference of the API to use.\n * @public\n */\nexport function useApi<T>(apiRef: ApiRef<T>): T {\n const apiHolder = useApiHolder();\n\n const api = apiHolder.get(apiRef);\n if (!api) {\n throw new NotImplementedError(`No implementation available for ${apiRef}`);\n }\n return api;\n}\n\n/**\n * Wrapper for giving component an API context.\n *\n * @param apis - APIs for the context.\n * @public\n */\nexport function withApis<T extends {}>(apis: TypesToApiRefs<T>) {\n return function withApisWrapper<TProps extends T>(\n WrappedComponent: ComponentType<TProps>,\n ) {\n const Hoc = (props: PropsWithChildren<Omit<TProps, keyof T>>) => {\n const apiHolder = useApiHolder();\n\n const impls = {} as T;\n\n for (const key in apis) {\n if (apis.hasOwnProperty(key)) {\n const ref = apis[key];\n\n const api = apiHolder.get(ref);\n if (!api) {\n throw new NotImplementedError(\n `No implementation available for ${ref}`,\n );\n }\n impls[key] = api;\n }\n }\n\n return <WrappedComponent {...(props as TProps)} {...impls} />;\n };\n const displayName =\n WrappedComponent.displayName || WrappedComponent.name || 'Component';\n\n Hoc.displayName = `withApis(${displayName})`;\n\n return Hoc;\n };\n}\n"],"names":[],"mappings":";;;;AA0BO,SAAS,YAA0B,GAAA;AACxC,EAAM,MAAA,eAAA,GAAkB,oBAAsC,aAAa,CAAA;AAC3E,EAAA,IAAI,CAAC,eAAiB,EAAA;AACpB,IAAM,MAAA,IAAI,oBAAoB,8B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AiB,WAAe,IAAA,gBAAA,CAAiB,IAAQ,IAAA,WAAA;AAE3D,IAAI,GAAA,CAAA,WAAA,GAAc,YAAY,WAAW,CAAA,CAAA,CAAA;AAEzC,IAAO,OAAA,GAAA;AAAA,GACT;AACF;;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Component } from 'react';
|
|
2
3
|
|
|
3
|
-
class PluginErrorBoundary extends
|
|
4
|
+
class PluginErrorBoundary extends Component {
|
|
4
5
|
static getDerivedStateFromError(error) {
|
|
5
6
|
return { error };
|
|
6
7
|
}
|
|
@@ -13,7 +14,7 @@ class PluginErrorBoundary extends React.Component {
|
|
|
13
14
|
const { app, plugin } = this.props;
|
|
14
15
|
const { ErrorBoundaryFallback } = app.getComponents();
|
|
15
16
|
if (error) {
|
|
16
|
-
return /* @__PURE__ */
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
17
18
|
ErrorBoundaryFallback,
|
|
18
19
|
{
|
|
19
20
|
error,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginErrorBoundary.esm.js","sources":["../../src/extensions/PluginErrorBoundary.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"PluginErrorBoundary.esm.js","sources":["../../src/extensions/PluginErrorBoundary.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { PropsWithChildren, Component } from 'react';\nimport { AppContext } from '../app/types';\nimport { BackstagePlugin } from '../plugin';\n\ntype Props = PropsWithChildren<{\n app: AppContext;\n plugin: BackstagePlugin;\n}>;\n\ntype State = { error: Error | undefined };\n\nexport class PluginErrorBoundary extends Component<Props, State> {\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n state: State = { error: undefined };\n\n handleErrorReset = () => {\n this.setState({ error: undefined });\n };\n\n render() {\n const { error } = this.state;\n const { app, plugin } = this.props;\n const { ErrorBoundaryFallback } = app.getComponents();\n\n if (error) {\n return (\n <ErrorBoundaryFallback\n error={error}\n resetError={this.handleErrorReset}\n plugin={plugin}\n />\n );\n }\n\n return this.props.children;\n }\n}\n"],"names":[],"mappings":";;;AA2BO,MAAM,4BAA4B,SAAwB,CAAA;AAAA,EAC/D,OAAO,yBAAyB,KAAc,EAAA;AAC5C,IAAA,OAAO,EAAE,KAAM,EAAA;AAAA;AACjB,EAEA,KAAA,GAAe,EAAE,KAAA,EAAO,KAAU,CAAA,EAAA;AAAA,EAElC,mBAAmB,MAAM;AACvB,IAAA,IAAA,CAAK,QAAS,CAAA,EAAE,KAAO,EAAA,KAAA,CAAA,EAAW,CAAA;AAAA,GACpC;AAAA,EAEA,MAAS,GAAA;AACP,IAAM,MAAA,EAAE,KAAM,EAAA,GAAI,IAAK,CAAA,KAAA;AACvB,IAAA,MAAM,EAAE,GAAA,EAAK,MAAO,EAAA,GAAI,IAAK,CAAA,KAAA;AAC7B,IAAA,MAAM,EAAE,qBAAA,EAA0B,GAAA,GAAA,CAAI,aAAc,EAAA;AAEpD,IAAA,IAAI,KAAO,EAAA;AACT,MACE,uBAAA,GAAA;AAAA,QAAC,qBAAA;AAAA,QAAA;AAAA,UACC,KAAA;AAAA,UACA,YAAY,IAAK,CAAA,gBAAA;AAAA,UACjB;AAAA;AAAA,OACF;AAAA;AAIJ,IAAA,OAAO,KAAK,KAAM,CAAA,QAAA;AAAA;AAEtB;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { lazy, Suspense, useEffect } from 'react';
|
|
2
3
|
import { AnalyticsContext } from '../analytics/AnalyticsContext.esm.js';
|
|
3
4
|
import { useAnalytics } from '../analytics/useAnalytics.esm.js';
|
|
4
5
|
import { useApp } from '../app/useApp.esm.js';
|
|
@@ -33,7 +34,7 @@ function createRoutableExtension(options) {
|
|
|
33
34
|
useEffect(() => {
|
|
34
35
|
analytics.captureEvent(routableExtensionRenderedEvent, "");
|
|
35
36
|
}, [analytics]);
|
|
36
|
-
return /* @__PURE__ */
|
|
37
|
+
return /* @__PURE__ */ jsx(InnerComponent, { ...props });
|
|
37
38
|
};
|
|
38
39
|
const componentName = name || InnerComponent.displayName || InnerComponent.name || "LazyComponent";
|
|
39
40
|
RoutableExtensionWrapper.displayName = `RoutableExtension(${componentName})`;
|
|
@@ -82,17 +83,17 @@ function createReactExtension(options) {
|
|
|
82
83
|
const app = useApp();
|
|
83
84
|
const { Progress } = app.getComponents();
|
|
84
85
|
const mountPoint = data?.["core.mountPoint"];
|
|
85
|
-
return /* @__PURE__ */
|
|
86
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Progress, {}), children: /* @__PURE__ */ jsx(PluginErrorBoundary, { app, plugin, children: /* @__PURE__ */ jsx(
|
|
86
87
|
AnalyticsContext,
|
|
87
88
|
{
|
|
88
89
|
attributes: {
|
|
89
90
|
pluginId: plugin.getId(),
|
|
90
91
|
...name && { extension: name },
|
|
91
92
|
...mountPoint && { routeRef: mountPoint.id }
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
)));
|
|
93
|
+
},
|
|
94
|
+
children: /* @__PURE__ */ jsx(Component, { ...props })
|
|
95
|
+
}
|
|
96
|
+
) }) });
|
|
96
97
|
};
|
|
97
98
|
attachComponentData(Result, "core.plugin", plugin);
|
|
98
99
|
attachComponentData(Result, "core.extensionName", name);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensions.esm.js","sources":["../../src/extensions/extensions.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { lazy, Suspense, useEffect } from 'react';\nimport { AnalyticsContext, useAnalytics } from '../analytics';\nimport { useApp } from '../app';\nimport { RouteRef, useRouteRef } from '../routing';\nimport { attachComponentData } from './componentData';\nimport { Extension, BackstagePlugin } from '../plugin';\nimport { PluginErrorBoundary } from './PluginErrorBoundary';\nimport { routableExtensionRenderedEvent } from '../analytics/Tracker';\nimport { ForwardedError } from '@backstage/errors';\n\n/**\n * Lazy or synchronous retrieving of extension components.\n *\n * @public\n */\nexport type ComponentLoader<T> =\n | {\n lazy: () => Promise<T>;\n }\n | {\n sync: T;\n };\n\n/**\n * Extension for components that can have its own URL route (top-level pages, tabs etc.).\n *\n * @remarks\n *\n * We do not use ComponentType as the return type, since it doesn't let us convey the children prop.\n * ComponentType inserts children as an optional prop whether the inner component accepts it or not,\n * making it impossible to make the usage of children type safe.\n *\n * See {@link https://backstage.io/docs/plugins/composability#extensions}.\n *\n * @public\n */\nexport function createRoutableExtension<\n T extends (props: any) => JSX.Element | null,\n>(options: {\n /**\n * A loader for the component that is rendered by this extension.\n */\n component: () => Promise<T>;\n\n /**\n * The mount point to bind this routable extension to.\n *\n * If this extension is placed somewhere in the app element tree of a Backstage\n * app, callers will be able to route to this extensions by calling,\n * `useRouteRef` with this mount point.\n */\n mountPoint: RouteRef;\n\n /**\n * The name of this extension that will represent it at runtime. It is for example\n * used to identify this extension in analytics data.\n *\n * If possible the name should always be the same as the name of the exported\n * variable for this extension.\n */\n name?: string;\n}): Extension<T> {\n const { component, mountPoint, name } = options;\n return createReactExtension({\n component: {\n lazy: () =>\n component().then(InnerComponent => {\n const RoutableExtensionWrapper: any = (props: any) => {\n const analytics = useAnalytics();\n\n // Validate that the routing is wired up correctly in the App.tsx\n try {\n useRouteRef(mountPoint);\n } catch (error) {\n if (typeof error === 'object' && error !== null) {\n const { message } = error as { message?: unknown };\n if (\n typeof message === 'string' &&\n message.startsWith('No path for ')\n ) {\n throw new Error(\n `Routable extension component with mount point ${mountPoint} was not discovered in the app element tree. ` +\n 'Routable extension components may not be rendered by other components and must be ' +\n 'directly available as an element within the App provider component.',\n );\n }\n }\n throw error;\n }\n\n // This event, never exposed to end-users of the analytics API,\n // helps inform which extension metadata gets associated with a\n // navigation event when the route navigated to is a gathered\n // mountpoint.\n useEffect(() => {\n analytics.captureEvent(routableExtensionRenderedEvent, '');\n }, [analytics]);\n\n return <InnerComponent {...props} />;\n };\n\n const componentName =\n name ||\n (InnerComponent as { displayName?: string }).displayName ||\n InnerComponent.name ||\n 'LazyComponent';\n\n RoutableExtensionWrapper.displayName = `RoutableExtension(${componentName})`;\n\n return RoutableExtensionWrapper as T;\n }),\n },\n data: {\n 'core.mountPoint': mountPoint,\n },\n name,\n });\n}\n\n/**\n * Plain React component extension.\n *\n * @remarks\n *\n * We do not use ComponentType as the return type, since it doesn't let us convey the children prop.\n * ComponentType inserts children as an optional prop whether the inner component accepts it or not,\n * making it impossible to make the usage of children type safe.\n *\n * See {@link https://backstage.io/docs/plugins/composability#extensions}.\n *\n * @public\n */\nexport function createComponentExtension<\n T extends (props: any) => JSX.Element | null,\n>(options: {\n /**\n * A loader or synchronously supplied component that is rendered by this extension.\n */\n component: ComponentLoader<T>;\n\n /**\n * The name of this extension that will represent it at runtime. It is for example\n * used to identify this extension in analytics data.\n *\n * If possible the name should always be the same as the name of the exported\n * variable for this extension.\n */\n name?: string;\n}): Extension<T> {\n const { component, name } = options;\n return createReactExtension({ component, name });\n}\n\n/**\n * Used by {@link createComponentExtension} and {@link createRoutableExtension}.\n *\n * @remarks\n *\n * We do not use ComponentType as the return type, since it doesn't let us convey the children prop.\n * ComponentType inserts children as an optional prop whether the inner component accepts it or not,\n * making it impossible to make the usage of children type safe.\n *\n * See {@link https://backstage.io/docs/plugins/composability#extensions}.\n *\n * @public\n */\nexport function createReactExtension<\n T extends (props: any) => JSX.Element | null,\n>(options: {\n /**\n * A loader or synchronously supplied component that is rendered by this extension.\n */\n component: ComponentLoader<T>;\n\n /**\n * Additional component data that is attached to the top-level extension component.\n */\n data?: Record<string, unknown>;\n\n /**\n * The name of this extension that will represent it at runtime. It is for example\n * used to identify this extension in analytics data.\n *\n * If possible the name should always be the same as the name of the exported\n * variable for this extension.\n */\n name?: string;\n}): Extension<T> {\n const { data = {}, name } = options;\n if (!name) {\n // eslint-disable-next-line no-console\n console.warn(\n 'Declaring extensions without name is DEPRECATED. ' +\n 'Make sure that all usages of createReactExtension, createComponentExtension and createRoutableExtension provide a name.',\n );\n }\n\n let Component: T;\n if ('lazy' in options.component) {\n const lazyLoader = options.component.lazy;\n Component = lazy(() =>\n lazyLoader().then(\n component => ({ default: component }),\n error => {\n const ofExtension = name ? ` of the ${name} extension` : '';\n throw new ForwardedError(\n `Failed lazy loading${ofExtension}, try to reload the page`,\n error,\n );\n },\n ),\n ) as unknown as T;\n } else {\n Component = options.component.sync;\n }\n const componentName =\n name ||\n (Component as { displayName?: string }).displayName ||\n Component.name ||\n 'Component';\n\n return {\n expose(plugin: BackstagePlugin) {\n const Result: any = (props: any) => {\n const app = useApp();\n const { Progress } = app.getComponents();\n // todo(iamEAP): Account for situations where this is attached via\n // separate calls to attachComponentData().\n const mountPoint = data?.['core.mountPoint'] as\n | { id?: string }\n | undefined;\n\n return (\n <Suspense fallback={<Progress />}>\n <PluginErrorBoundary app={app} plugin={plugin}>\n <AnalyticsContext\n attributes={{\n pluginId: plugin.getId(),\n ...(name && { extension: name }),\n ...(mountPoint && { routeRef: mountPoint.id }),\n }}\n >\n <Component {...props} />\n </AnalyticsContext>\n </PluginErrorBoundary>\n </Suspense>\n );\n };\n\n attachComponentData(Result, 'core.plugin', plugin);\n attachComponentData(Result, 'core.extensionName', name);\n for (const [key, value] of Object.entries(data)) {\n attachComponentData(Result, key, value);\n }\n\n Result.displayName = `Extension(${componentName})`;\n return Result;\n },\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAoDO,SAAS,wBAEd,OAuBe,EAAA;AACf,EAAA,MAAM,EAAE,SAAA,EAAW,UAAY,EAAA,IAAA,EAAS,GAAA,OAAA;AACxC,EAAA,OAAO,oBAAqB,CAAA;AAAA,IAC1B,SAAW,EAAA;AAAA,MACT,IAAM,EAAA,MACJ,SAAU,EAAA,CAAE,KAAK,CAAkB,cAAA,KAAA;AACjC,QAAM,MAAA,wBAAA,GAAgC,CAAC,KAAe,KAAA;AACpD,UAAA,MAAM,YAAY,YAAa,EAAA;AAG/B,UAAI,IAAA;AACF,YAAA,WAAA,CAAY,UAAU,CAAA;AAAA,mBACf,KAAO,EAAA;AACd,YAAA,IAAI,OAAO,KAAA,KAAU,QAAY,IAAA,KAAA,KAAU,IAAM,EAAA;AAC/C,cAAM,MAAA,EAAE,SAAY,GAAA,KAAA;AACpB,cAAA,IACE,OAAO,OAAY,KAAA,QAAA,IACnB,OAAQ,CAAA,UAAA,CAAW,cAAc,CACjC,EAAA;AACA,gBAAA,MAAM,IAAI,KAAA;AAAA,kBACR,iDAAiD,UAAU,CAAA,kMAAA;AAAA,iBAG7D;AAAA;AACF;AAEF,YAAM,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AAA,EAAQ,sBAAsB,IAAI,CAAA;AACtD,MAAA,KAAA,MAAW,CAAC,GAAK,EAAA,KAAK,KAAK,MAAO,CAAA,OAAA,CAAQ,IAAI,CAAG,EAAA;AAC/C,QAAoB,mBAAA,CAAA,MAAA,EAAQ,KAAK,KAAK,CAAA;AAAA;AAGxC,MAAO,MAAA,CAAA,WAAA,GAAc,aAAa,aAAa,CAAA,CAAA,CAAA;AAC/C,MAAO,OAAA,MAAA;AAAA;AACT,GACF;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"extensions.esm.js","sources":["../../src/extensions/extensions.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { lazy, Suspense, useEffect } from 'react';\nimport { AnalyticsContext, useAnalytics } from '../analytics';\nimport { useApp } from '../app';\nimport { RouteRef, useRouteRef } from '../routing';\nimport { attachComponentData } from './componentData';\nimport { Extension, BackstagePlugin } from '../plugin';\nimport { PluginErrorBoundary } from './PluginErrorBoundary';\nimport { routableExtensionRenderedEvent } from '../analytics/Tracker';\nimport { ForwardedError } from '@backstage/errors';\n\n/**\n * Lazy or synchronous retrieving of extension components.\n *\n * @public\n */\nexport type ComponentLoader<T> =\n | {\n lazy: () => Promise<T>;\n }\n | {\n sync: T;\n };\n\n/**\n * Extension for components that can have its own URL route (top-level pages, tabs etc.).\n *\n * @remarks\n *\n * We do not use ComponentType as the return type, since it doesn't let us convey the children prop.\n * ComponentType inserts children as an optional prop whether the inner component accepts it or not,\n * making it impossible to make the usage of children type safe.\n *\n * See {@link https://backstage.io/docs/plugins/composability#extensions}.\n *\n * @public\n */\nexport function createRoutableExtension<\n T extends (props: any) => JSX.Element | null,\n>(options: {\n /**\n * A loader for the component that is rendered by this extension.\n */\n component: () => Promise<T>;\n\n /**\n * The mount point to bind this routable extension to.\n *\n * If this extension is placed somewhere in the app element tree of a Backstage\n * app, callers will be able to route to this extensions by calling,\n * `useRouteRef` with this mount point.\n */\n mountPoint: RouteRef;\n\n /**\n * The name of this extension that will represent it at runtime. It is for example\n * used to identify this extension in analytics data.\n *\n * If possible the name should always be the same as the name of the exported\n * variable for this extension.\n */\n name?: string;\n}): Extension<T> {\n const { component, mountPoint, name } = options;\n return createReactExtension({\n component: {\n lazy: () =>\n component().then(InnerComponent => {\n const RoutableExtensionWrapper: any = (props: any) => {\n const analytics = useAnalytics();\n\n // Validate that the routing is wired up correctly in the App.tsx\n try {\n useRouteRef(mountPoint);\n } catch (error) {\n if (typeof error === 'object' && error !== null) {\n const { message } = error as { message?: unknown };\n if (\n typeof message === 'string' &&\n message.startsWith('No path for ')\n ) {\n throw new Error(\n `Routable extension component with mount point ${mountPoint} was not discovered in the app element tree. ` +\n 'Routable extension components may not be rendered by other components and must be ' +\n 'directly available as an element within the App provider component.',\n );\n }\n }\n throw error;\n }\n\n // This event, never exposed to end-users of the analytics API,\n // helps inform which extension metadata gets associated with a\n // navigation event when the route navigated to is a gathered\n // mountpoint.\n useEffect(() => {\n analytics.captureEvent(routableExtensionRenderedEvent, '');\n }, [analytics]);\n\n return <InnerComponent {...props} />;\n };\n\n const componentName =\n name ||\n (InnerComponent as { displayName?: string }).displayName ||\n InnerComponent.name ||\n 'LazyComponent';\n\n RoutableExtensionWrapper.displayName = `RoutableExtension(${componentName})`;\n\n return RoutableExtensionWrapper as T;\n }),\n },\n data: {\n 'core.mountPoint': mountPoint,\n },\n name,\n });\n}\n\n/**\n * Plain React component extension.\n *\n * @remarks\n *\n * We do not use ComponentType as the return type, since it doesn't let us convey the children prop.\n * ComponentType inserts children as an optional prop whether the inner component accepts it or not,\n * making it impossible to make the usage of children type safe.\n *\n * See {@link https://backstage.io/docs/plugins/composability#extensions}.\n *\n * @public\n */\nexport function createComponentExtension<\n T extends (props: any) => JSX.Element | null,\n>(options: {\n /**\n * A loader or synchronously supplied component that is rendered by this extension.\n */\n component: ComponentLoader<T>;\n\n /**\n * The name of this extension that will represent it at runtime. It is for example\n * used to identify this extension in analytics data.\n *\n * If possible the name should always be the same as the name of the exported\n * variable for this extension.\n */\n name?: string;\n}): Extension<T> {\n const { component, name } = options;\n return createReactExtension({ component, name });\n}\n\n/**\n * Used by {@link createComponentExtension} and {@link createRoutableExtension}.\n *\n * @remarks\n *\n * We do not use ComponentType as the return type, since it doesn't let us convey the children prop.\n * ComponentType inserts children as an optional prop whether the inner component accepts it or not,\n * making it impossible to make the usage of children type safe.\n *\n * See {@link https://backstage.io/docs/plugins/composability#extensions}.\n *\n * @public\n */\nexport function createReactExtension<\n T extends (props: any) => JSX.Element | null,\n>(options: {\n /**\n * A loader or synchronously supplied component that is rendered by this extension.\n */\n component: ComponentLoader<T>;\n\n /**\n * Additional component data that is attached to the top-level extension component.\n */\n data?: Record<string, unknown>;\n\n /**\n * The name of this extension that will represent it at runtime. It is for example\n * used to identify this extension in analytics data.\n *\n * If possible the name should always be the same as the name of the exported\n * variable for this extension.\n */\n name?: string;\n}): Extension<T> {\n const { data = {}, name } = options;\n if (!name) {\n // eslint-disable-next-line no-console\n console.warn(\n 'Declaring extensions without name is DEPRECATED. ' +\n 'Make sure that all usages of createReactExtension, createComponentExtension and createRoutableExtension provide a name.',\n );\n }\n\n let Component: T;\n if ('lazy' in options.component) {\n const lazyLoader = options.component.lazy;\n Component = lazy(() =>\n lazyLoader().then(\n component => ({ default: component }),\n error => {\n const ofExtension = name ? ` of the ${name} extension` : '';\n throw new ForwardedError(\n `Failed lazy loading${ofExtension}, try to reload the page`,\n error,\n );\n },\n ),\n ) as unknown as T;\n } else {\n Component = options.component.sync;\n }\n const componentName =\n name ||\n (Component as { displayName?: string }).displayName ||\n Component.name ||\n 'Component';\n\n return {\n expose(plugin: BackstagePlugin) {\n const Result: any = (props: any) => {\n const app = useApp();\n const { Progress } = app.getComponents();\n // todo(iamEAP): Account for situations where this is attached via\n // separate calls to attachComponentData().\n const mountPoint = data?.['core.mountPoint'] as\n | { id?: string }\n | undefined;\n\n return (\n <Suspense fallback={<Progress />}>\n <PluginErrorBoundary app={app} plugin={plugin}>\n <AnalyticsContext\n attributes={{\n pluginId: plugin.getId(),\n ...(name && { extension: name }),\n ...(mountPoint && { routeRef: mountPoint.id }),\n }}\n >\n <Component {...props} />\n </AnalyticsContext>\n </PluginErrorBoundary>\n </Suspense>\n );\n };\n\n attachComponentData(Result, 'core.plugin', plugin);\n attachComponentData(Result, 'core.extensionName', name);\n for (const [key, value] of Object.entries(data)) {\n attachComponentData(Result, key, value);\n }\n\n Result.displayName = `Extension(${componentName})`;\n return Result;\n },\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAoDO,SAAS,wBAEd,OAuBe,EAAA;AACf,EAAA,MAAM,EAAE,SAAA,EAAW,UAAY,EAAA,IAAA,EAAS,GAAA,OAAA;AACxC,EAAA,OAAO,oBAAqB,CAAA;AAAA,IAC1B,SAAW,EAAA;AAAA,MACT,IAAM,EAAA,MACJ,SAAU,EAAA,CAAE,KAAK,CAAkB,cAAA,KAAA;AACjC,QAAM,MAAA,wBAAA,GAAgC,CAAC,KAAe,KAAA;AACpD,UAAA,MAAM,YAAY,YAAa,EAAA;AAG/B,UAAI,IAAA;AACF,YAAA,WAAA,CAAY,UAAU,CAAA;AAAA,mBACf,KAAO,EAAA;AACd,YAAA,IAAI,OAAO,KAAA,KAAU,QAAY,IAAA,KAAA,KAAU,IAAM,EAAA;AAC/C,cAAM,MAAA,EAAE,SAAY,GAAA,KAAA;AACpB,cAAA,IACE,OAAO,OAAY,KAAA,QAAA,IACnB,OAAQ,CAAA,UAAA,CAAW,cAAc,CACjC,EAAA;AACA,gBAAA,MAAM,IAAI,KAAA;AAAA,kB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ACjD,MAAoB,mBAAA,CAAA,MAAA,EAAQ,sBAAsB,IAAI,CAAA;AACtD,MAAA,KAAA,MAAW,CAAC,GAAK,EAAA,KAAK,KAAK,MAAO,CAAA,OAAA,CAAQ,IAAI,CAAG,EAAA;AAC/C,QAAoB,mBAAA,CAAA,MAAA,EAAQ,KAAK,KAAK,CAAA;AAAA;AAGxC,MAAO,MAAA,CAAA,WAAA,GAAc,aAAa,aAAa,CAAA,CAAA,CAAA;AAC/C,MAAO,OAAA,MAAA;AAAA;AACT,GACF;AACF;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode, ComponentType, PropsWithChildren, ReactElement } from 'react';
|
|
2
3
|
import { Observable, JsonValue } from '@backstage/types';
|
|
3
4
|
import { Config } from '@backstage/config';
|
|
4
5
|
import { IdentityApi as IdentityApi$1, BackstagePlugin as BackstagePlugin$1, IconComponent as IconComponent$1 } from '@backstage/core-plugin-api';
|
|
@@ -45,7 +46,7 @@ type AnalyticsContextValue = CommonAnalyticsContext & {
|
|
|
45
46
|
declare const AnalyticsContext: (options: {
|
|
46
47
|
attributes: Partial<AnalyticsContextValue>;
|
|
47
48
|
children: ReactNode;
|
|
48
|
-
}) =>
|
|
49
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
49
50
|
|
|
50
51
|
/**
|
|
51
52
|
* API reference.
|
|
@@ -118,8 +119,8 @@ declare function useApi<T>(apiRef: ApiRef<T>): T;
|
|
|
118
119
|
* @param apis - APIs for the context.
|
|
119
120
|
* @public
|
|
120
121
|
*/
|
|
121
|
-
declare function withApis<T extends {}>(apis: TypesToApiRefs<T>): <TProps extends T>(WrappedComponent:
|
|
122
|
-
(props: PropsWithChildren<Omit<TProps, keyof T>>):
|
|
122
|
+
declare function withApis<T extends {}>(apis: TypesToApiRefs<T>): <TProps extends T>(WrappedComponent: ComponentType<TProps>) => {
|
|
123
|
+
(props: PropsWithChildren<Omit<TProps, keyof T>>): react_jsx_runtime.JSX.Element;
|
|
123
124
|
displayName: string;
|
|
124
125
|
};
|
|
125
126
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/core-plugin-api",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.6-next.0",
|
|
4
4
|
"description": "Core API used by Backstage plugins",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "web-library"
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"types": "./dist/index.d.ts",
|
|
37
37
|
"typesVersions": {
|
|
38
38
|
"*": {
|
|
39
|
-
"*": [
|
|
40
|
-
"dist/index.d.ts"
|
|
41
|
-
],
|
|
42
39
|
"alpha": [
|
|
43
40
|
"dist/alpha.d.ts"
|
|
41
|
+
],
|
|
42
|
+
"package.json": [
|
|
43
|
+
"package.json"
|
|
44
44
|
]
|
|
45
45
|
}
|
|
46
46
|
},
|
|
@@ -57,16 +57,16 @@
|
|
|
57
57
|
"test": "backstage-cli package test"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@backstage/config": "
|
|
61
|
-
"@backstage/errors": "
|
|
62
|
-
"@backstage/types": "
|
|
63
|
-
"@backstage/version-bridge": "
|
|
60
|
+
"@backstage/config": "1.3.2",
|
|
61
|
+
"@backstage/errors": "1.2.7",
|
|
62
|
+
"@backstage/types": "1.2.1",
|
|
63
|
+
"@backstage/version-bridge": "1.0.11",
|
|
64
64
|
"history": "^5.0.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@backstage/cli": "
|
|
68
|
-
"@backstage/core-app-api": "
|
|
69
|
-
"@backstage/test-utils": "
|
|
67
|
+
"@backstage/cli": "0.32.0-next.2",
|
|
68
|
+
"@backstage/core-app-api": "1.16.1-next.0",
|
|
69
|
+
"@backstage/test-utils": "1.7.7-next.0",
|
|
70
70
|
"@testing-library/dom": "^10.0.0",
|
|
71
71
|
"@testing-library/jest-dom": "^6.0.0",
|
|
72
72
|
"@testing-library/react": "^16.0.0",
|