@backstage/frontend-plugin-api 0.6.5 → 0.6.6-next.1
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 +20 -0
- package/dist/components/ErrorBoundary.esm.js +4 -13
- package/dist/components/ErrorBoundary.esm.js.map +1 -1
- package/dist/components/ExtensionBoundary.esm.js +1 -2
- package/dist/components/ExtensionBoundary.esm.js.map +1 -1
- package/dist/extensions/createAppRootElementExtension.esm.js +1 -2
- package/dist/extensions/createAppRootElementExtension.esm.js.map +1 -1
- package/dist/extensions/createAppRootWrapperExtension.esm.js +1 -2
- package/dist/extensions/createAppRootWrapperExtension.esm.js.map +1 -1
- package/dist/extensions/createNavLogoExtension.esm.js +2 -2
- package/dist/extensions/createNavLogoExtension.esm.js.map +1 -1
- package/dist/extensions/createPageExtension.esm.js +1 -2
- package/dist/extensions/createPageExtension.esm.js.map +1 -1
- package/dist/extensions/createRouterExtension.esm.js +1 -2
- package/dist/extensions/createRouterExtension.esm.js.map +1 -1
- package/dist/extensions/createSignInPageExtension.esm.js +3 -4
- package/dist/extensions/createSignInPageExtension.esm.js.map +1 -1
- package/dist/routing/ExternalRouteRef.esm.js +4 -10
- package/dist/routing/ExternalRouteRef.esm.js.map +1 -1
- package/dist/routing/RouteRef.esm.js +20 -50
- package/dist/routing/RouteRef.esm.js.map +1 -1
- package/dist/routing/SubRouteRef.esm.js +9 -36
- package/dist/routing/SubRouteRef.esm.js.map +1 -1
- package/dist/wiring/createExtension.esm.js +2 -3
- package/dist/wiring/createExtension.esm.js.map +1 -1
- package/dist/wiring/createExtensionInput.esm.js +2 -2
- package/dist/wiring/createExtensionInput.esm.js.map +1 -1
- package/dist/wiring/createExtensionOverrides.esm.js +1 -2
- package/dist/wiring/createExtensionOverrides.esm.js.map +1 -1
- package/dist/wiring/createPlugin.esm.js +4 -5
- package/dist/wiring/createPlugin.esm.js.map +1 -1
- package/dist/wiring/resolveExtensionDefinition.esm.js +1 -2
- package/dist/wiring/resolveExtensionDefinition.esm.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @backstage/frontend-plugin-api
|
|
2
2
|
|
|
3
|
+
## 0.6.6-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/core-components@0.14.8-next.1
|
|
9
|
+
- @backstage/core-plugin-api@1.9.3-next.0
|
|
10
|
+
- @backstage/types@1.1.1
|
|
11
|
+
- @backstage/version-bridge@1.0.8
|
|
12
|
+
|
|
13
|
+
## 0.6.6-next.0
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
- @backstage/core-components@0.14.8-next.0
|
|
19
|
+
- @backstage/core-plugin-api@1.9.2
|
|
20
|
+
- @backstage/types@1.1.1
|
|
21
|
+
- @backstage/version-bridge@1.0.8
|
|
22
|
+
|
|
3
23
|
## 0.6.5
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
|
-
var __publicField = (obj, key, value) => {
|
|
6
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
|
-
return value;
|
|
8
|
-
};
|
|
9
3
|
class ErrorBoundary extends Component {
|
|
10
|
-
constructor() {
|
|
11
|
-
super(...arguments);
|
|
12
|
-
__publicField(this, "state", { error: void 0 });
|
|
13
|
-
__publicField(this, "handleErrorReset", () => {
|
|
14
|
-
this.setState({ error: void 0 });
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
4
|
static getDerivedStateFromError(error) {
|
|
18
5
|
return { error };
|
|
19
6
|
}
|
|
7
|
+
state = { error: void 0 };
|
|
8
|
+
handleErrorReset = () => {
|
|
9
|
+
this.setState({ error: void 0 });
|
|
10
|
+
};
|
|
20
11
|
render() {
|
|
21
12
|
const { error } = this.state;
|
|
22
13
|
const { plugin, children, Fallback } = this.props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBoundary.esm.js","sources":["../../src/components/ErrorBoundary.tsx"],"sourcesContent":["/*\n * Copyright 2023 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, { Component, ComponentType, PropsWithChildren } from 'react';\nimport { BackstagePlugin } from '../wiring';\nimport { CoreErrorBoundaryFallbackProps } from '../types';\n\ntype ErrorBoundaryProps = PropsWithChildren<{\n plugin?: BackstagePlugin;\n Fallback: ComponentType<CoreErrorBoundaryFallbackProps>;\n}>;\ntype ErrorBoundaryState = { error?: Error };\n\n/** @internal */\nexport class ErrorBoundary extends Component<\n ErrorBoundaryProps,\n ErrorBoundaryState\n> {\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n state: ErrorBoundaryState = { error: undefined };\n\n handleErrorReset = () => {\n this.setState({ error: undefined });\n };\n\n render() {\n const { error } = this.state;\n const { plugin, children, Fallback } = this.props;\n\n if (error) {\n return (\n <Fallback\n plugin={plugin}\n error={error}\n resetError={this.handleErrorReset}\n />\n );\n }\n\n return children;\n }\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.esm.js","sources":["../../src/components/ErrorBoundary.tsx"],"sourcesContent":["/*\n * Copyright 2023 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, { Component, ComponentType, PropsWithChildren } from 'react';\nimport { BackstagePlugin } from '../wiring';\nimport { CoreErrorBoundaryFallbackProps } from '../types';\n\ntype ErrorBoundaryProps = PropsWithChildren<{\n plugin?: BackstagePlugin;\n Fallback: ComponentType<CoreErrorBoundaryFallbackProps>;\n}>;\ntype ErrorBoundaryState = { error?: Error };\n\n/** @internal */\nexport class ErrorBoundary extends Component<\n ErrorBoundaryProps,\n ErrorBoundaryState\n> {\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n state: ErrorBoundaryState = { error: undefined };\n\n handleErrorReset = () => {\n this.setState({ error: undefined });\n };\n\n render() {\n const { error } = this.state;\n const { plugin, children, Fallback } = this.props;\n\n if (error) {\n return (\n <Fallback\n plugin={plugin}\n error={error}\n resetError={this.handleErrorReset}\n />\n );\n }\n\n return children;\n }\n}\n"],"names":[],"mappings":";;AA2BO,MAAM,sBAAsB,SAGjC,CAAA;AAAA,EACA,OAAO,yBAAyB,KAAc,EAAA;AAC5C,IAAA,OAAO,EAAE,KAAM,EAAA,CAAA;AAAA,GACjB;AAAA,EAEA,KAAA,GAA4B,EAAE,KAAA,EAAO,KAAU,CAAA,EAAA,CAAA;AAAA,EAE/C,mBAAmB,MAAM;AACvB,IAAA,IAAA,CAAK,QAAS,CAAA,EAAE,KAAO,EAAA,KAAA,CAAA,EAAW,CAAA,CAAA;AAAA,GACpC,CAAA;AAAA,EAEA,MAAS,GAAA;AACP,IAAM,MAAA,EAAE,KAAM,EAAA,GAAI,IAAK,CAAA,KAAA,CAAA;AACvB,IAAA,MAAM,EAAE,MAAA,EAAQ,QAAU,EAAA,QAAA,KAAa,IAAK,CAAA,KAAA,CAAA;AAE5C,IAAA,IAAI,KAAO,EAAA;AACT,MACE,uBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,QAAA;AAAA,QAAA;AAAA,UACC,MAAA;AAAA,UACA,KAAA;AAAA,UACA,YAAY,IAAK,CAAA,gBAAA;AAAA,SAAA;AAAA,OACnB,CAAA;AAAA,KAEJ;AAEA,IAAO,OAAA,QAAA,CAAA;AAAA,GACT;AACF;;;;"}
|
|
@@ -20,14 +20,13 @@ const RouteTracker = (props) => {
|
|
|
20
20
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
21
21
|
};
|
|
22
22
|
function ExtensionBoundary(props) {
|
|
23
|
-
var _a, _b;
|
|
24
23
|
const { node, routable, children } = props;
|
|
25
24
|
const plugin = node.spec.source;
|
|
26
25
|
const Progress = useComponentRef(coreComponentRefs.progress);
|
|
27
26
|
const fallback = useComponentRef(coreComponentRefs.errorBoundaryFallback);
|
|
28
27
|
const attributes = {
|
|
29
28
|
extensionId: node.spec.id,
|
|
30
|
-
pluginId:
|
|
29
|
+
pluginId: node.spec.source?.id ?? "app"
|
|
31
30
|
};
|
|
32
31
|
return /* @__PURE__ */ React.createElement(Suspense, { fallback: /* @__PURE__ */ React.createElement(Progress, null) }, /* @__PURE__ */ React.createElement(ErrorBoundary, { plugin, Fallback: fallback }, /* @__PURE__ */ React.createElement(AnalyticsContext, { attributes }, /* @__PURE__ */ React.createElement(RouteTracker, { disableTracking: !routable }, children))));
|
|
33
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtensionBoundary.esm.js","sources":["../../src/components/ExtensionBoundary.tsx"],"sourcesContent":["/*\n * Copyright 2023 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, {\n PropsWithChildren,\n ReactNode,\n Suspense,\n useEffect,\n} from 'react';\nimport { AnalyticsContext, useAnalytics } from '@backstage/core-plugin-api';\nimport { ErrorBoundary } from './ErrorBoundary';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { routableExtensionRenderedEvent } from '../../../core-plugin-api/src/analytics/Tracker';\nimport { AppNode, useComponentRef } from '../apis';\nimport { coreComponentRefs } from './coreComponentRefs';\n\ntype RouteTrackerProps = PropsWithChildren<{\n disableTracking?: boolean;\n}>;\n\nconst RouteTracker = (props: RouteTrackerProps) => {\n const { disableTracking, children } = props;\n const analytics = useAnalytics();\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 if (disableTracking) return;\n analytics.captureEvent(routableExtensionRenderedEvent, '');\n }, [analytics, disableTracking]);\n\n return <>{children}</>;\n};\n\n/** @public */\nexport interface ExtensionBoundaryProps {\n node: AppNode;\n routable?: boolean;\n children: ReactNode;\n}\n\n/** @public */\nexport function ExtensionBoundary(props: ExtensionBoundaryProps) {\n const { node, routable, children } = props;\n\n const plugin = node.spec.source;\n const Progress = useComponentRef(coreComponentRefs.progress);\n const fallback = useComponentRef(coreComponentRefs.errorBoundaryFallback);\n\n // Skipping \"routeRef\" attribute in the new system, the extension \"id\" should provide more insight\n const attributes = {\n extensionId: node.spec.id,\n pluginId: node.spec.source?.id ?? 'app',\n };\n\n return (\n <Suspense fallback={<Progress />}>\n <ErrorBoundary plugin={plugin} Fallback={fallback}>\n <AnalyticsContext attributes={attributes}>\n <RouteTracker disableTracking={!routable}>{children}</RouteTracker>\n </AnalyticsContext>\n </ErrorBoundary>\n </Suspense>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAiCA,MAAM,YAAA,GAAe,CAAC,KAA6B,KAAA;AACjD,EAAM,MAAA,EAAE,eAAiB,EAAA,QAAA,EAAa,GAAA,KAAA,CAAA;AACtC,EAAA,MAAM,YAAY,YAAa,EAAA,CAAA;AAM/B,EAAA,SAAA,CAAU,MAAM;AACd,IAAI,IAAA,eAAA;AAAiB,MAAA,OAAA;AACrB,IAAU,SAAA,CAAA,YAAA,CAAa,gCAAgC,EAAE,CAAA,CAAA;AAAA,GACxD,EAAA,CAAC,SAAW,EAAA,eAAe,CAAC,CAAA,CAAA;AAE/B,EAAA,iEAAU,QAAS,CAAA,CAAA;AACrB,CAAA,CAAA;AAUO,SAAS,kBAAkB,KAA+B,EAAA;
|
|
1
|
+
{"version":3,"file":"ExtensionBoundary.esm.js","sources":["../../src/components/ExtensionBoundary.tsx"],"sourcesContent":["/*\n * Copyright 2023 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, {\n PropsWithChildren,\n ReactNode,\n Suspense,\n useEffect,\n} from 'react';\nimport { AnalyticsContext, useAnalytics } from '@backstage/core-plugin-api';\nimport { ErrorBoundary } from './ErrorBoundary';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { routableExtensionRenderedEvent } from '../../../core-plugin-api/src/analytics/Tracker';\nimport { AppNode, useComponentRef } from '../apis';\nimport { coreComponentRefs } from './coreComponentRefs';\n\ntype RouteTrackerProps = PropsWithChildren<{\n disableTracking?: boolean;\n}>;\n\nconst RouteTracker = (props: RouteTrackerProps) => {\n const { disableTracking, children } = props;\n const analytics = useAnalytics();\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 if (disableTracking) return;\n analytics.captureEvent(routableExtensionRenderedEvent, '');\n }, [analytics, disableTracking]);\n\n return <>{children}</>;\n};\n\n/** @public */\nexport interface ExtensionBoundaryProps {\n node: AppNode;\n routable?: boolean;\n children: ReactNode;\n}\n\n/** @public */\nexport function ExtensionBoundary(props: ExtensionBoundaryProps) {\n const { node, routable, children } = props;\n\n const plugin = node.spec.source;\n const Progress = useComponentRef(coreComponentRefs.progress);\n const fallback = useComponentRef(coreComponentRefs.errorBoundaryFallback);\n\n // Skipping \"routeRef\" attribute in the new system, the extension \"id\" should provide more insight\n const attributes = {\n extensionId: node.spec.id,\n pluginId: node.spec.source?.id ?? 'app',\n };\n\n return (\n <Suspense fallback={<Progress />}>\n <ErrorBoundary plugin={plugin} Fallback={fallback}>\n <AnalyticsContext attributes={attributes}>\n <RouteTracker disableTracking={!routable}>{children}</RouteTracker>\n </AnalyticsContext>\n </ErrorBoundary>\n </Suspense>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAiCA,MAAM,YAAA,GAAe,CAAC,KAA6B,KAAA;AACjD,EAAM,MAAA,EAAE,eAAiB,EAAA,QAAA,EAAa,GAAA,KAAA,CAAA;AACtC,EAAA,MAAM,YAAY,YAAa,EAAA,CAAA;AAM/B,EAAA,SAAA,CAAU,MAAM;AACd,IAAI,IAAA,eAAA;AAAiB,MAAA,OAAA;AACrB,IAAU,SAAA,CAAA,YAAA,CAAa,gCAAgC,EAAE,CAAA,CAAA;AAAA,GACxD,EAAA,CAAC,SAAW,EAAA,eAAe,CAAC,CAAA,CAAA;AAE/B,EAAA,iEAAU,QAAS,CAAA,CAAA;AACrB,CAAA,CAAA;AAUO,SAAS,kBAAkB,KAA+B,EAAA;AAC/D,EAAA,MAAM,EAAE,IAAA,EAAM,QAAU,EAAA,QAAA,EAAa,GAAA,KAAA,CAAA;AAErC,EAAM,MAAA,MAAA,GAAS,KAAK,IAAK,CAAA,MAAA,CAAA;AACzB,EAAM,MAAA,QAAA,GAAW,eAAgB,CAAA,iBAAA,CAAkB,QAAQ,CAAA,CAAA;AAC3D,EAAM,MAAA,QAAA,GAAW,eAAgB,CAAA,iBAAA,CAAkB,qBAAqB,CAAA,CAAA;AAGxE,EAAA,MAAM,UAAa,GAAA;AAAA,IACjB,WAAA,EAAa,KAAK,IAAK,CAAA,EAAA;AAAA,IACvB,QAAU,EAAA,IAAA,CAAK,IAAK,CAAA,MAAA,EAAQ,EAAM,IAAA,KAAA;AAAA,GACpC,CAAA;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,YAAS,QAAU,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAS,CAC5B,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,aAAc,EAAA,EAAA,MAAA,EAAgB,QAAU,EAAA,QAAA,EAAA,sCACtC,gBAAiB,EAAA,EAAA,UAAA,EAAA,sCACf,YAAa,EAAA,EAAA,eAAA,EAAiB,CAAC,QAAW,EAAA,EAAA,QAAS,CACtD,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -2,12 +2,11 @@ import { coreExtensionData } from '../wiring/coreExtensionData.esm.js';
|
|
|
2
2
|
import { createExtension } from '../wiring/createExtension.esm.js';
|
|
3
3
|
|
|
4
4
|
function createAppRootElementExtension(options) {
|
|
5
|
-
var _a;
|
|
6
5
|
return createExtension({
|
|
7
6
|
kind: "app-root-element",
|
|
8
7
|
namespace: options.namespace,
|
|
9
8
|
name: options.name,
|
|
10
|
-
attachTo:
|
|
9
|
+
attachTo: options.attachTo ?? { id: "app/root", input: "elements" },
|
|
11
10
|
configSchema: options.configSchema,
|
|
12
11
|
disabled: options.disabled,
|
|
13
12
|
inputs: options.inputs,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAppRootElementExtension.esm.js","sources":["../../src/extensions/createAppRootElementExtension.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { JSX } from 'react';\nimport { PortableSchema } from '../schema/types';\nimport { Expand } from '../types';\nimport { coreExtensionData } from '../wiring/coreExtensionData';\nimport {\n AnyExtensionInputMap,\n ExtensionDefinition,\n ResolvedExtensionInputs,\n createExtension,\n} from '../wiring/createExtension';\n\n/**\n * Creates an extension that renders a React element at the app root, outside of\n * the app layout. This is useful for example for shared popups and similar.\n *\n * @public\n */\nexport function createAppRootElementExtension<\n TConfig extends {},\n TInputs extends AnyExtensionInputMap,\n>(options: {\n namespace?: string;\n name?: string;\n attachTo?: { id: string; input: string };\n configSchema?: PortableSchema<TConfig>;\n disabled?: boolean;\n inputs?: TInputs;\n element:\n | JSX.Element\n | ((options: {\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n config: TConfig;\n }) => JSX.Element);\n}): ExtensionDefinition<TConfig> {\n return createExtension({\n kind: 'app-root-element',\n namespace: options.namespace,\n name: options.name,\n attachTo: options.attachTo ?? { id: 'app/root', input: 'elements' },\n configSchema: options.configSchema,\n disabled: options.disabled,\n inputs: options.inputs,\n output: {\n element: coreExtensionData.reactElement,\n },\n factory({ inputs, config }) {\n return {\n element:\n typeof options.element === 'function'\n ? options.element({ inputs, config })\n : options.element,\n };\n },\n });\n}\n"],"names":[],"mappings":";;;AAiCO,SAAS,8BAGd,OAa+B,EAAA;
|
|
1
|
+
{"version":3,"file":"createAppRootElementExtension.esm.js","sources":["../../src/extensions/createAppRootElementExtension.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { JSX } from 'react';\nimport { PortableSchema } from '../schema/types';\nimport { Expand } from '../types';\nimport { coreExtensionData } from '../wiring/coreExtensionData';\nimport {\n AnyExtensionInputMap,\n ExtensionDefinition,\n ResolvedExtensionInputs,\n createExtension,\n} from '../wiring/createExtension';\n\n/**\n * Creates an extension that renders a React element at the app root, outside of\n * the app layout. This is useful for example for shared popups and similar.\n *\n * @public\n */\nexport function createAppRootElementExtension<\n TConfig extends {},\n TInputs extends AnyExtensionInputMap,\n>(options: {\n namespace?: string;\n name?: string;\n attachTo?: { id: string; input: string };\n configSchema?: PortableSchema<TConfig>;\n disabled?: boolean;\n inputs?: TInputs;\n element:\n | JSX.Element\n | ((options: {\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n config: TConfig;\n }) => JSX.Element);\n}): ExtensionDefinition<TConfig> {\n return createExtension({\n kind: 'app-root-element',\n namespace: options.namespace,\n name: options.name,\n attachTo: options.attachTo ?? { id: 'app/root', input: 'elements' },\n configSchema: options.configSchema,\n disabled: options.disabled,\n inputs: options.inputs,\n output: {\n element: coreExtensionData.reactElement,\n },\n factory({ inputs, config }) {\n return {\n element:\n typeof options.element === 'function'\n ? options.element({ inputs, config })\n : options.element,\n };\n },\n });\n}\n"],"names":[],"mappings":";;;AAiCO,SAAS,8BAGd,OAa+B,EAAA;AAC/B,EAAA,OAAO,eAAgB,CAAA;AAAA,IACrB,IAAM,EAAA,kBAAA;AAAA,IACN,WAAW,OAAQ,CAAA,SAAA;AAAA,IACnB,MAAM,OAAQ,CAAA,IAAA;AAAA,IACd,UAAU,OAAQ,CAAA,QAAA,IAAY,EAAE,EAAI,EAAA,UAAA,EAAY,OAAO,UAAW,EAAA;AAAA,IAClE,cAAc,OAAQ,CAAA,YAAA;AAAA,IACtB,UAAU,OAAQ,CAAA,QAAA;AAAA,IAClB,QAAQ,OAAQ,CAAA,MAAA;AAAA,IAChB,MAAQ,EAAA;AAAA,MACN,SAAS,iBAAkB,CAAA,YAAA;AAAA,KAC7B;AAAA,IACA,OAAQ,CAAA,EAAE,MAAQ,EAAA,MAAA,EAAU,EAAA;AAC1B,MAAO,OAAA;AAAA,QACL,OACE,EAAA,OAAO,OAAQ,CAAA,OAAA,KAAY,UACvB,GAAA,OAAA,CAAQ,OAAQ,CAAA,EAAE,MAAQ,EAAA,MAAA,EAAQ,CAAA,GAClC,OAAQ,CAAA,OAAA;AAAA,OAChB,CAAA;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
|
|
@@ -3,12 +3,11 @@ import { createExtension } from '../wiring/createExtension.esm.js';
|
|
|
3
3
|
import { createExtensionDataRef } from '../wiring/createExtensionDataRef.esm.js';
|
|
4
4
|
|
|
5
5
|
function createAppRootWrapperExtension(options) {
|
|
6
|
-
var _a;
|
|
7
6
|
return createExtension({
|
|
8
7
|
kind: "app-root-wrapper",
|
|
9
8
|
namespace: options.namespace,
|
|
10
9
|
name: options.name,
|
|
11
|
-
attachTo:
|
|
10
|
+
attachTo: options.attachTo ?? { id: "app/root", input: "wrappers" },
|
|
12
11
|
configSchema: options.configSchema,
|
|
13
12
|
disabled: options.disabled,
|
|
14
13
|
inputs: options.inputs,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAppRootWrapperExtension.esm.js","sources":["../../src/extensions/createAppRootWrapperExtension.tsx"],"sourcesContent":["/*\n * Copyright 2023 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, { ComponentType, PropsWithChildren } from 'react';\nimport { PortableSchema } from '../schema/types';\nimport {\n AnyExtensionInputMap,\n ExtensionDefinition,\n ResolvedExtensionInputs,\n createExtension,\n} from '../wiring/createExtension';\nimport { createExtensionDataRef } from '../wiring/createExtensionDataRef';\nimport { Expand } from '../types';\n\n/**\n * Creates an extension that renders a React wrapper at the app root, enclosing\n * the app layout. This is useful for example for adding global React contexts\n * and similar.\n *\n * @public\n */\nexport function createAppRootWrapperExtension<\n TConfig extends {},\n TInputs extends AnyExtensionInputMap,\n>(options: {\n namespace?: string;\n name?: string;\n attachTo?: { id: string; input: string };\n configSchema?: PortableSchema<TConfig>;\n disabled?: boolean;\n inputs?: TInputs;\n Component: ComponentType<\n PropsWithChildren<{\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n config: TConfig;\n }>\n >;\n}): ExtensionDefinition<TConfig> {\n return createExtension({\n kind: 'app-root-wrapper',\n namespace: options.namespace,\n name: options.name,\n attachTo: options.attachTo ?? { id: 'app/root', input: 'wrappers' },\n configSchema: options.configSchema,\n disabled: options.disabled,\n inputs: options.inputs,\n output: {\n component: createAppRootWrapperExtension.componentDataRef,\n },\n factory({ inputs, config }) {\n const Component = (props: PropsWithChildren<{}>) => {\n return (\n <options.Component inputs={inputs} config={config}>\n {props.children}\n </options.Component>\n );\n };\n return {\n component: Component,\n };\n },\n });\n}\n\n/** @public */\nexport namespace createAppRootWrapperExtension {\n export const componentDataRef =\n createExtensionDataRef<ComponentType<PropsWithChildren<{}>>>(\n 'app.root.wrapper',\n );\n}\n"],"names":["createAppRootWrapperExtension"],"mappings":";;;;AAkCO,SAAS,8BAGd,OAa+B,EAAA;
|
|
1
|
+
{"version":3,"file":"createAppRootWrapperExtension.esm.js","sources":["../../src/extensions/createAppRootWrapperExtension.tsx"],"sourcesContent":["/*\n * Copyright 2023 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, { ComponentType, PropsWithChildren } from 'react';\nimport { PortableSchema } from '../schema/types';\nimport {\n AnyExtensionInputMap,\n ExtensionDefinition,\n ResolvedExtensionInputs,\n createExtension,\n} from '../wiring/createExtension';\nimport { createExtensionDataRef } from '../wiring/createExtensionDataRef';\nimport { Expand } from '../types';\n\n/**\n * Creates an extension that renders a React wrapper at the app root, enclosing\n * the app layout. This is useful for example for adding global React contexts\n * and similar.\n *\n * @public\n */\nexport function createAppRootWrapperExtension<\n TConfig extends {},\n TInputs extends AnyExtensionInputMap,\n>(options: {\n namespace?: string;\n name?: string;\n attachTo?: { id: string; input: string };\n configSchema?: PortableSchema<TConfig>;\n disabled?: boolean;\n inputs?: TInputs;\n Component: ComponentType<\n PropsWithChildren<{\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n config: TConfig;\n }>\n >;\n}): ExtensionDefinition<TConfig> {\n return createExtension({\n kind: 'app-root-wrapper',\n namespace: options.namespace,\n name: options.name,\n attachTo: options.attachTo ?? { id: 'app/root', input: 'wrappers' },\n configSchema: options.configSchema,\n disabled: options.disabled,\n inputs: options.inputs,\n output: {\n component: createAppRootWrapperExtension.componentDataRef,\n },\n factory({ inputs, config }) {\n const Component = (props: PropsWithChildren<{}>) => {\n return (\n <options.Component inputs={inputs} config={config}>\n {props.children}\n </options.Component>\n );\n };\n return {\n component: Component,\n };\n },\n });\n}\n\n/** @public */\nexport namespace createAppRootWrapperExtension {\n export const componentDataRef =\n createExtensionDataRef<ComponentType<PropsWithChildren<{}>>>(\n 'app.root.wrapper',\n );\n}\n"],"names":["createAppRootWrapperExtension"],"mappings":";;;;AAkCO,SAAS,8BAGd,OAa+B,EAAA;AAC/B,EAAA,OAAO,eAAgB,CAAA;AAAA,IACrB,IAAM,EAAA,kBAAA;AAAA,IACN,WAAW,OAAQ,CAAA,SAAA;AAAA,IACnB,MAAM,OAAQ,CAAA,IAAA;AAAA,IACd,UAAU,OAAQ,CAAA,QAAA,IAAY,EAAE,EAAI,EAAA,UAAA,EAAY,OAAO,UAAW,EAAA;AAAA,IAClE,cAAc,OAAQ,CAAA,YAAA;AAAA,IACtB,UAAU,OAAQ,CAAA,QAAA;AAAA,IAClB,QAAQ,OAAQ,CAAA,MAAA;AAAA,IAChB,MAAQ,EAAA;AAAA,MACN,WAAW,6BAA8B,CAAA,gBAAA;AAAA,KAC3C;AAAA,IACA,OAAQ,CAAA,EAAE,MAAQ,EAAA,MAAA,EAAU,EAAA;AAC1B,MAAM,MAAA,SAAA,GAAY,CAAC,KAAiC,KAAA;AAClD,QAAA,2CACG,OAAQ,CAAA,SAAA,EAAR,EAAkB,MAAgB,EAAA,MAAA,EAAA,EAChC,MAAM,QACT,CAAA,CAAA;AAAA,OAEJ,CAAA;AACA,MAAO,OAAA;AAAA,QACL,SAAW,EAAA,SAAA;AAAA,OACb,CAAA;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH,CAAA;AAAA,CAGO,CAAUA,8BAAV,KAAA;AACE,EAAMA,+BAAA,gBACX,GAAA,sBAAA;AAAA,IACE,kBAAA;AAAA,GACF,CAAA;AAAA,CAJa,EAAA,6BAAA,KAAA,6BAAA,GAAA,EAAA,CAAA,CAAA;;;;"}
|
|
@@ -5,8 +5,8 @@ function createNavLogoExtension(options) {
|
|
|
5
5
|
const { logoIcon, logoFull } = options;
|
|
6
6
|
return createExtension({
|
|
7
7
|
kind: "nav-logo",
|
|
8
|
-
name: options
|
|
9
|
-
namespace: options
|
|
8
|
+
name: options?.name,
|
|
9
|
+
namespace: options?.namespace,
|
|
10
10
|
attachTo: { id: "app/nav", input: "logos" },
|
|
11
11
|
output: {
|
|
12
12
|
logos: createNavLogoExtension.logoElementsDataRef
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createNavLogoExtension.esm.js","sources":["../../src/extensions/createNavLogoExtension.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { createExtension, createExtensionDataRef } from '../wiring';\n\n/**\n * Helper for creating extensions for a nav logos.\n * @public\n */\nexport function createNavLogoExtension(options: {\n name?: string;\n namespace?: string;\n logoIcon: JSX.Element;\n logoFull: JSX.Element;\n}) {\n const { logoIcon, logoFull } = options;\n return createExtension({\n kind: 'nav-logo',\n name: options?.name,\n namespace: options?.namespace,\n attachTo: { id: 'app/nav', input: 'logos' },\n output: {\n logos: createNavLogoExtension.logoElementsDataRef,\n },\n factory: () => {\n return {\n logos: {\n logoIcon,\n logoFull,\n },\n };\n },\n });\n}\n\n/** @public */\nexport namespace createNavLogoExtension {\n export const logoElementsDataRef = createExtensionDataRef<{\n logoIcon?: JSX.Element;\n logoFull?: JSX.Element;\n }>('core.nav-logo.logo-elements');\n}\n"],"names":["createNavLogoExtension"],"mappings":";;;AAsBO,SAAS,uBAAuB,OAKpC,EAAA;AACD,EAAM,MAAA,EAAE,QAAU,EAAA,QAAA,EAAa,GAAA,OAAA,CAAA;AAC/B,EAAA,OAAO,eAAgB,CAAA;AAAA,IACrB,IAAM,EAAA,UAAA;AAAA,IACN,MAAM,OAAS,
|
|
1
|
+
{"version":3,"file":"createNavLogoExtension.esm.js","sources":["../../src/extensions/createNavLogoExtension.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { createExtension, createExtensionDataRef } from '../wiring';\n\n/**\n * Helper for creating extensions for a nav logos.\n * @public\n */\nexport function createNavLogoExtension(options: {\n name?: string;\n namespace?: string;\n logoIcon: JSX.Element;\n logoFull: JSX.Element;\n}) {\n const { logoIcon, logoFull } = options;\n return createExtension({\n kind: 'nav-logo',\n name: options?.name,\n namespace: options?.namespace,\n attachTo: { id: 'app/nav', input: 'logos' },\n output: {\n logos: createNavLogoExtension.logoElementsDataRef,\n },\n factory: () => {\n return {\n logos: {\n logoIcon,\n logoFull,\n },\n };\n },\n });\n}\n\n/** @public */\nexport namespace createNavLogoExtension {\n export const logoElementsDataRef = createExtensionDataRef<{\n logoIcon?: JSX.Element;\n logoFull?: JSX.Element;\n }>('core.nav-logo.logo-elements');\n}\n"],"names":["createNavLogoExtension"],"mappings":";;;AAsBO,SAAS,uBAAuB,OAKpC,EAAA;AACD,EAAM,MAAA,EAAE,QAAU,EAAA,QAAA,EAAa,GAAA,OAAA,CAAA;AAC/B,EAAA,OAAO,eAAgB,CAAA;AAAA,IACrB,IAAM,EAAA,UAAA;AAAA,IACN,MAAM,OAAS,EAAA,IAAA;AAAA,IACf,WAAW,OAAS,EAAA,SAAA;AAAA,IACpB,QAAU,EAAA,EAAE,EAAI,EAAA,SAAA,EAAW,OAAO,OAAQ,EAAA;AAAA,IAC1C,MAAQ,EAAA;AAAA,MACN,OAAO,sBAAuB,CAAA,mBAAA;AAAA,KAChC;AAAA,IACA,SAAS,MAAM;AACb,MAAO,OAAA;AAAA,QACL,KAAO,EAAA;AAAA,UACL,QAAA;AAAA,UACA,QAAA;AAAA,SACF;AAAA,OACF,CAAA;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH,CAAA;AAAA,CAGO,CAAUA,uBAAV,KAAA;AACE,EAAMA,uBAAAA,CAAA,mBAAsB,GAAA,sBAAA,CAGhC,6BAA6B,CAAA,CAAA;AAAA,CAJjB,EAAA,sBAAA,KAAA,sBAAA,GAAA,EAAA,CAAA,CAAA;;;;"}
|
|
@@ -5,7 +5,6 @@ import { coreExtensionData } from '../wiring/coreExtensionData.esm.js';
|
|
|
5
5
|
import { createExtension } from '../wiring/createExtension.esm.js';
|
|
6
6
|
|
|
7
7
|
function createPageExtension(options) {
|
|
8
|
-
var _a;
|
|
9
8
|
const configSchema = "configSchema" in options ? options.configSchema : createSchemaFromZod(
|
|
10
9
|
(z) => z.object({ path: z.string().default(options.defaultPath) })
|
|
11
10
|
);
|
|
@@ -13,7 +12,7 @@ function createPageExtension(options) {
|
|
|
13
12
|
kind: "page",
|
|
14
13
|
namespace: options.namespace,
|
|
15
14
|
name: options.name,
|
|
16
|
-
attachTo:
|
|
15
|
+
attachTo: options.attachTo ?? { id: "app/routes", input: "routes" },
|
|
17
16
|
configSchema,
|
|
18
17
|
inputs: options.inputs,
|
|
19
18
|
disabled: options.disabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPageExtension.esm.js","sources":["../../src/extensions/createPageExtension.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 } from 'react';\nimport { ExtensionBoundary } from '../components';\nimport { createSchemaFromZod, PortableSchema } from '../schema';\nimport {\n coreExtensionData,\n createExtension,\n ResolvedExtensionInputs,\n AnyExtensionInputMap,\n} from '../wiring';\nimport { RouteRef } from '../routing';\nimport { Expand } from '../types';\nimport { ExtensionDefinition } from '../wiring/createExtension';\n\n/**\n * Helper for creating extensions for a routable React page component.\n *\n * @public\n */\nexport function createPageExtension<\n TConfig extends { path: string },\n TInputs extends AnyExtensionInputMap,\n>(\n options: (\n | {\n defaultPath: string;\n }\n | {\n configSchema: PortableSchema<TConfig>;\n }\n ) & {\n namespace?: string;\n name?: string;\n attachTo?: { id: string; input: string };\n disabled?: boolean;\n inputs?: TInputs;\n routeRef?: RouteRef;\n loader: (options: {\n config: TConfig;\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n }) => Promise<JSX.Element>;\n },\n): ExtensionDefinition<TConfig> {\n const configSchema =\n 'configSchema' in options\n ? options.configSchema\n : (createSchemaFromZod(z =>\n z.object({ path: z.string().default(options.defaultPath) }),\n ) as PortableSchema<TConfig>);\n\n return createExtension({\n kind: 'page',\n namespace: options.namespace,\n name: options.name,\n attachTo: options.attachTo ?? { id: 'app/routes', input: 'routes' },\n configSchema,\n inputs: options.inputs,\n disabled: options.disabled,\n output: {\n element: coreExtensionData.reactElement,\n path: coreExtensionData.routePath,\n routeRef: coreExtensionData.routeRef.optional(),\n },\n factory({ config, inputs, node }) {\n const ExtensionComponent = lazy(() =>\n options\n .loader({ config, inputs })\n .then(element => ({ default: () => element })),\n );\n\n return {\n path: config.path,\n routeRef: options.routeRef,\n element: (\n <ExtensionBoundary node={node} routable>\n <ExtensionComponent />\n </ExtensionBoundary>\n ),\n };\n },\n });\n}\n"],"names":[],"mappings":";;;;;;AAkCO,SAAS,oBAId,OAmB8B,EAAA;
|
|
1
|
+
{"version":3,"file":"createPageExtension.esm.js","sources":["../../src/extensions/createPageExtension.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 } from 'react';\nimport { ExtensionBoundary } from '../components';\nimport { createSchemaFromZod, PortableSchema } from '../schema';\nimport {\n coreExtensionData,\n createExtension,\n ResolvedExtensionInputs,\n AnyExtensionInputMap,\n} from '../wiring';\nimport { RouteRef } from '../routing';\nimport { Expand } from '../types';\nimport { ExtensionDefinition } from '../wiring/createExtension';\n\n/**\n * Helper for creating extensions for a routable React page component.\n *\n * @public\n */\nexport function createPageExtension<\n TConfig extends { path: string },\n TInputs extends AnyExtensionInputMap,\n>(\n options: (\n | {\n defaultPath: string;\n }\n | {\n configSchema: PortableSchema<TConfig>;\n }\n ) & {\n namespace?: string;\n name?: string;\n attachTo?: { id: string; input: string };\n disabled?: boolean;\n inputs?: TInputs;\n routeRef?: RouteRef;\n loader: (options: {\n config: TConfig;\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n }) => Promise<JSX.Element>;\n },\n): ExtensionDefinition<TConfig> {\n const configSchema =\n 'configSchema' in options\n ? options.configSchema\n : (createSchemaFromZod(z =>\n z.object({ path: z.string().default(options.defaultPath) }),\n ) as PortableSchema<TConfig>);\n\n return createExtension({\n kind: 'page',\n namespace: options.namespace,\n name: options.name,\n attachTo: options.attachTo ?? { id: 'app/routes', input: 'routes' },\n configSchema,\n inputs: options.inputs,\n disabled: options.disabled,\n output: {\n element: coreExtensionData.reactElement,\n path: coreExtensionData.routePath,\n routeRef: coreExtensionData.routeRef.optional(),\n },\n factory({ config, inputs, node }) {\n const ExtensionComponent = lazy(() =>\n options\n .loader({ config, inputs })\n .then(element => ({ default: () => element })),\n );\n\n return {\n path: config.path,\n routeRef: options.routeRef,\n element: (\n <ExtensionBoundary node={node} routable>\n <ExtensionComponent />\n </ExtensionBoundary>\n ),\n };\n },\n });\n}\n"],"names":[],"mappings":";;;;;;AAkCO,SAAS,oBAId,OAmB8B,EAAA;AAC9B,EAAA,MAAM,YACJ,GAAA,cAAA,IAAkB,OACd,GAAA,OAAA,CAAQ,YACP,GAAA,mBAAA;AAAA,IAAoB,CACnB,CAAA,KAAA,CAAA,CAAE,MAAO,CAAA,EAAE,IAAM,EAAA,CAAA,CAAE,MAAO,EAAA,CAAE,OAAQ,CAAA,OAAA,CAAQ,WAAW,CAAA,EAAG,CAAA;AAAA,GAC5D,CAAA;AAEN,EAAA,OAAO,eAAgB,CAAA;AAAA,IACrB,IAAM,EAAA,MAAA;AAAA,IACN,WAAW,OAAQ,CAAA,SAAA;AAAA,IACnB,MAAM,OAAQ,CAAA,IAAA;AAAA,IACd,UAAU,OAAQ,CAAA,QAAA,IAAY,EAAE,EAAI,EAAA,YAAA,EAAc,OAAO,QAAS,EAAA;AAAA,IAClE,YAAA;AAAA,IACA,QAAQ,OAAQ,CAAA,MAAA;AAAA,IAChB,UAAU,OAAQ,CAAA,QAAA;AAAA,IAClB,MAAQ,EAAA;AAAA,MACN,SAAS,iBAAkB,CAAA,YAAA;AAAA,MAC3B,MAAM,iBAAkB,CAAA,SAAA;AAAA,MACxB,QAAA,EAAU,iBAAkB,CAAA,QAAA,CAAS,QAAS,EAAA;AAAA,KAChD;AAAA,IACA,OAAQ,CAAA,EAAE,MAAQ,EAAA,MAAA,EAAQ,MAAQ,EAAA;AAChC,MAAA,MAAM,kBAAqB,GAAA,IAAA;AAAA,QAAK,MAC9B,OAAA,CACG,MAAO,CAAA,EAAE,QAAQ,MAAO,EAAC,CACzB,CAAA,IAAA,CAAK,CAAY,OAAA,MAAA,EAAE,OAAS,EAAA,MAAM,SAAU,CAAA,CAAA;AAAA,OACjD,CAAA;AAEA,MAAO,OAAA;AAAA,QACL,MAAM,MAAO,CAAA,IAAA;AAAA,QACb,UAAU,OAAQ,CAAA,QAAA;AAAA,QAClB,OAAA,sCACG,iBAAkB,EAAA,EAAA,IAAA,EAAY,UAAQ,IACrC,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,wBAAmB,CACtB,CAAA;AAAA,OAEJ,CAAA;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
|
|
@@ -3,12 +3,11 @@ import { createExtension } from '../wiring/createExtension.esm.js';
|
|
|
3
3
|
import { createExtensionDataRef } from '../wiring/createExtensionDataRef.esm.js';
|
|
4
4
|
|
|
5
5
|
function createRouterExtension(options) {
|
|
6
|
-
var _a;
|
|
7
6
|
return createExtension({
|
|
8
7
|
kind: "app-router-component",
|
|
9
8
|
namespace: options.namespace,
|
|
10
9
|
name: options.name,
|
|
11
|
-
attachTo:
|
|
10
|
+
attachTo: options.attachTo ?? { id: "app/root", input: "router" },
|
|
12
11
|
configSchema: options.configSchema,
|
|
13
12
|
disabled: options.disabled,
|
|
14
13
|
inputs: options.inputs,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createRouterExtension.esm.js","sources":["../../src/extensions/createRouterExtension.tsx"],"sourcesContent":["/*\n * Copyright 2023 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, { ComponentType, PropsWithChildren } from 'react';\nimport { PortableSchema } from '../schema/types';\nimport {\n AnyExtensionInputMap,\n ExtensionDefinition,\n ResolvedExtensionInputs,\n createExtension,\n} from '../wiring/createExtension';\nimport { createExtensionDataRef } from '../wiring/createExtensionDataRef';\nimport { Expand } from '../types';\n\n/**\n * Creates an extension that replaces the router implementation at the app root.\n * This is useful to be able to for example replace the BrowserRouter with a\n * MemoryRouter in tests, or to add additional props to a BrowserRouter.\n *\n * @public\n */\nexport function createRouterExtension<\n TConfig extends {},\n TInputs extends AnyExtensionInputMap,\n>(options: {\n namespace?: string;\n name?: string;\n attachTo?: { id: string; input: string };\n configSchema?: PortableSchema<TConfig>;\n disabled?: boolean;\n inputs?: TInputs;\n Component: ComponentType<\n PropsWithChildren<{\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n config: TConfig;\n }>\n >;\n}): ExtensionDefinition<TConfig> {\n return createExtension({\n kind: 'app-router-component',\n namespace: options.namespace,\n name: options.name,\n attachTo: options.attachTo ?? { id: 'app/root', input: 'router' },\n configSchema: options.configSchema,\n disabled: options.disabled,\n inputs: options.inputs,\n output: {\n component: createRouterExtension.componentDataRef,\n },\n factory({ inputs, config }) {\n const Component = (props: PropsWithChildren<{}>) => {\n return (\n <options.Component inputs={inputs} config={config}>\n {props.children}\n </options.Component>\n );\n };\n return {\n component: Component,\n };\n },\n });\n}\n\n/** @public */\nexport namespace createRouterExtension {\n export const componentDataRef =\n createExtensionDataRef<ComponentType<PropsWithChildren<{}>>>(\n 'app.router.wrapper',\n );\n}\n"],"names":["createRouterExtension"],"mappings":";;;;AAkCO,SAAS,sBAGd,OAa+B,EAAA;
|
|
1
|
+
{"version":3,"file":"createRouterExtension.esm.js","sources":["../../src/extensions/createRouterExtension.tsx"],"sourcesContent":["/*\n * Copyright 2023 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, { ComponentType, PropsWithChildren } from 'react';\nimport { PortableSchema } from '../schema/types';\nimport {\n AnyExtensionInputMap,\n ExtensionDefinition,\n ResolvedExtensionInputs,\n createExtension,\n} from '../wiring/createExtension';\nimport { createExtensionDataRef } from '../wiring/createExtensionDataRef';\nimport { Expand } from '../types';\n\n/**\n * Creates an extension that replaces the router implementation at the app root.\n * This is useful to be able to for example replace the BrowserRouter with a\n * MemoryRouter in tests, or to add additional props to a BrowserRouter.\n *\n * @public\n */\nexport function createRouterExtension<\n TConfig extends {},\n TInputs extends AnyExtensionInputMap,\n>(options: {\n namespace?: string;\n name?: string;\n attachTo?: { id: string; input: string };\n configSchema?: PortableSchema<TConfig>;\n disabled?: boolean;\n inputs?: TInputs;\n Component: ComponentType<\n PropsWithChildren<{\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n config: TConfig;\n }>\n >;\n}): ExtensionDefinition<TConfig> {\n return createExtension({\n kind: 'app-router-component',\n namespace: options.namespace,\n name: options.name,\n attachTo: options.attachTo ?? { id: 'app/root', input: 'router' },\n configSchema: options.configSchema,\n disabled: options.disabled,\n inputs: options.inputs,\n output: {\n component: createRouterExtension.componentDataRef,\n },\n factory({ inputs, config }) {\n const Component = (props: PropsWithChildren<{}>) => {\n return (\n <options.Component inputs={inputs} config={config}>\n {props.children}\n </options.Component>\n );\n };\n return {\n component: Component,\n };\n },\n });\n}\n\n/** @public */\nexport namespace createRouterExtension {\n export const componentDataRef =\n createExtensionDataRef<ComponentType<PropsWithChildren<{}>>>(\n 'app.router.wrapper',\n );\n}\n"],"names":["createRouterExtension"],"mappings":";;;;AAkCO,SAAS,sBAGd,OAa+B,EAAA;AAC/B,EAAA,OAAO,eAAgB,CAAA;AAAA,IACrB,IAAM,EAAA,sBAAA;AAAA,IACN,WAAW,OAAQ,CAAA,SAAA;AAAA,IACnB,MAAM,OAAQ,CAAA,IAAA;AAAA,IACd,UAAU,OAAQ,CAAA,QAAA,IAAY,EAAE,EAAI,EAAA,UAAA,EAAY,OAAO,QAAS,EAAA;AAAA,IAChE,cAAc,OAAQ,CAAA,YAAA;AAAA,IACtB,UAAU,OAAQ,CAAA,QAAA;AAAA,IAClB,QAAQ,OAAQ,CAAA,MAAA;AAAA,IAChB,MAAQ,EAAA;AAAA,MACN,WAAW,qBAAsB,CAAA,gBAAA;AAAA,KACnC;AAAA,IACA,OAAQ,CAAA,EAAE,MAAQ,EAAA,MAAA,EAAU,EAAA;AAC1B,MAAM,MAAA,SAAA,GAAY,CAAC,KAAiC,KAAA;AAClD,QAAA,2CACG,OAAQ,CAAA,SAAA,EAAR,EAAkB,MAAgB,EAAA,MAAA,EAAA,EAChC,MAAM,QACT,CAAA,CAAA;AAAA,OAEJ,CAAA;AACA,MAAO,OAAA;AAAA,QACL,SAAW,EAAA,SAAA;AAAA,OACb,CAAA;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH,CAAA;AAAA,CAGO,CAAUA,sBAAV,KAAA;AACE,EAAMA,uBAAA,gBACX,GAAA,sBAAA;AAAA,IACE,oBAAA;AAAA,GACF,CAAA;AAAA,CAJa,EAAA,qBAAA,KAAA,qBAAA,GAAA,EAAA,CAAA,CAAA;;;;"}
|
|
@@ -4,12 +4,11 @@ import { createExtensionDataRef } from '../wiring/createExtensionDataRef.esm.js'
|
|
|
4
4
|
import { createExtension } from '../wiring/createExtension.esm.js';
|
|
5
5
|
|
|
6
6
|
function createSignInPageExtension(options) {
|
|
7
|
-
var _a;
|
|
8
7
|
return createExtension({
|
|
9
8
|
kind: "sign-in-page",
|
|
10
|
-
namespace: options
|
|
11
|
-
name: options
|
|
12
|
-
attachTo:
|
|
9
|
+
namespace: options?.namespace,
|
|
10
|
+
name: options?.name,
|
|
11
|
+
attachTo: options.attachTo ?? { id: "app/root", input: "signInPage" },
|
|
13
12
|
configSchema: options.configSchema,
|
|
14
13
|
inputs: options.inputs,
|
|
15
14
|
disabled: options.disabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSignInPageExtension.esm.js","sources":["../../src/extensions/createSignInPageExtension.tsx"],"sourcesContent":["/*\n * Copyright 2023 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, { ComponentType, lazy } from 'react';\nimport { ExtensionBoundary } from '../components';\nimport { PortableSchema } from '../schema';\nimport {\n createExtension,\n ResolvedExtensionInputs,\n AnyExtensionInputMap,\n createExtensionDataRef,\n ExtensionDefinition,\n} from '../wiring';\nimport { Expand } from '../types';\nimport { SignInPageProps } from '@backstage/core-plugin-api';\n\n/**\n *\n * @public\n */\nexport function createSignInPageExtension<\n TConfig extends {},\n TInputs extends AnyExtensionInputMap,\n>(options: {\n namespace?: string;\n name?: string;\n attachTo?: { id: string; input: string };\n configSchema?: PortableSchema<TConfig>;\n disabled?: boolean;\n inputs?: TInputs;\n loader: (options: {\n config: TConfig;\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n }) => Promise<ComponentType<SignInPageProps>>;\n}): ExtensionDefinition<TConfig> {\n return createExtension({\n kind: 'sign-in-page',\n namespace: options?.namespace,\n name: options?.name,\n attachTo: options.attachTo ?? { id: 'app/root', input: 'signInPage' },\n configSchema: options.configSchema,\n inputs: options.inputs,\n disabled: options.disabled,\n output: {\n component: createSignInPageExtension.componentDataRef,\n },\n factory({ config, inputs, node }) {\n const ExtensionComponent = lazy(() =>\n options\n .loader({ config, inputs })\n .then(component => ({ default: component })),\n );\n\n return {\n component: props => (\n <ExtensionBoundary node={node} routable>\n <ExtensionComponent {...props} />\n </ExtensionBoundary>\n ),\n };\n },\n });\n}\n\n/** @public */\nexport namespace createSignInPageExtension {\n export const componentDataRef = createExtensionDataRef<\n ComponentType<SignInPageProps>\n >('core.sign-in-page.component');\n}\n"],"names":["createSignInPageExtension"],"mappings":";;;;;AAiCO,SAAS,0BAGd,OAW+B,EAAA;
|
|
1
|
+
{"version":3,"file":"createSignInPageExtension.esm.js","sources":["../../src/extensions/createSignInPageExtension.tsx"],"sourcesContent":["/*\n * Copyright 2023 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, { ComponentType, lazy } from 'react';\nimport { ExtensionBoundary } from '../components';\nimport { PortableSchema } from '../schema';\nimport {\n createExtension,\n ResolvedExtensionInputs,\n AnyExtensionInputMap,\n createExtensionDataRef,\n ExtensionDefinition,\n} from '../wiring';\nimport { Expand } from '../types';\nimport { SignInPageProps } from '@backstage/core-plugin-api';\n\n/**\n *\n * @public\n */\nexport function createSignInPageExtension<\n TConfig extends {},\n TInputs extends AnyExtensionInputMap,\n>(options: {\n namespace?: string;\n name?: string;\n attachTo?: { id: string; input: string };\n configSchema?: PortableSchema<TConfig>;\n disabled?: boolean;\n inputs?: TInputs;\n loader: (options: {\n config: TConfig;\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n }) => Promise<ComponentType<SignInPageProps>>;\n}): ExtensionDefinition<TConfig> {\n return createExtension({\n kind: 'sign-in-page',\n namespace: options?.namespace,\n name: options?.name,\n attachTo: options.attachTo ?? { id: 'app/root', input: 'signInPage' },\n configSchema: options.configSchema,\n inputs: options.inputs,\n disabled: options.disabled,\n output: {\n component: createSignInPageExtension.componentDataRef,\n },\n factory({ config, inputs, node }) {\n const ExtensionComponent = lazy(() =>\n options\n .loader({ config, inputs })\n .then(component => ({ default: component })),\n );\n\n return {\n component: props => (\n <ExtensionBoundary node={node} routable>\n <ExtensionComponent {...props} />\n </ExtensionBoundary>\n ),\n };\n },\n });\n}\n\n/** @public */\nexport namespace createSignInPageExtension {\n export const componentDataRef = createExtensionDataRef<\n ComponentType<SignInPageProps>\n >('core.sign-in-page.component');\n}\n"],"names":["createSignInPageExtension"],"mappings":";;;;;AAiCO,SAAS,0BAGd,OAW+B,EAAA;AAC/B,EAAA,OAAO,eAAgB,CAAA;AAAA,IACrB,IAAM,EAAA,cAAA;AAAA,IACN,WAAW,OAAS,EAAA,SAAA;AAAA,IACpB,MAAM,OAAS,EAAA,IAAA;AAAA,IACf,UAAU,OAAQ,CAAA,QAAA,IAAY,EAAE,EAAI,EAAA,UAAA,EAAY,OAAO,YAAa,EAAA;AAAA,IACpE,cAAc,OAAQ,CAAA,YAAA;AAAA,IACtB,QAAQ,OAAQ,CAAA,MAAA;AAAA,IAChB,UAAU,OAAQ,CAAA,QAAA;AAAA,IAClB,MAAQ,EAAA;AAAA,MACN,WAAW,yBAA0B,CAAA,gBAAA;AAAA,KACvC;AAAA,IACA,OAAQ,CAAA,EAAE,MAAQ,EAAA,MAAA,EAAQ,MAAQ,EAAA;AAChC,MAAA,MAAM,kBAAqB,GAAA,IAAA;AAAA,QAAK,MAC9B,OAAA,CACG,MAAO,CAAA,EAAE,MAAQ,EAAA,MAAA,EAAQ,CAAA,CACzB,IAAK,CAAA,CAAA,SAAA,MAAc,EAAE,OAAA,EAAS,WAAY,CAAA,CAAA;AAAA,OAC/C,CAAA;AAEA,MAAO,OAAA;AAAA,QACL,SAAA,EAAW,CACT,KAAA,qBAAA,KAAA,CAAA,aAAA,CAAC,iBAAkB,EAAA,EAAA,IAAA,EAAY,QAAQ,EAAA,IAAA,EAAA,kBACpC,KAAA,CAAA,aAAA,CAAA,kBAAA,EAAA,EAAoB,GAAG,KAAA,EAAO,CACjC,CAAA;AAAA,OAEJ,CAAA;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH,CAAA;AAAA,CAGO,CAAUA,0BAAV,KAAA;AACE,EAAMA,0BAAAA,CAAA,gBAAmB,GAAA,sBAAA,CAE9B,6BAA6B,CAAA,CAAA;AAAA,CAHhB,EAAA,yBAAA,KAAA,yBAAA,GAAA,EAAA,CAAA,CAAA;;;;"}
|
|
@@ -1,29 +1,23 @@
|
|
|
1
1
|
import { RouteRefImpl } from './RouteRef.esm.js';
|
|
2
2
|
import { describeParentCallSite } from './describeParentCallSite.esm.js';
|
|
3
3
|
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __publicField = (obj, key, value) => {
|
|
7
|
-
__defNormalProp(obj, key + "" , value);
|
|
8
|
-
return value;
|
|
9
|
-
};
|
|
10
4
|
class ExternalRouteRefImpl extends RouteRefImpl {
|
|
11
5
|
constructor(optional, params = [], defaultTarget, creationSite) {
|
|
12
6
|
super(params, creationSite);
|
|
13
7
|
this.optional = optional;
|
|
14
8
|
this.params = params;
|
|
15
9
|
this.defaultTarget = defaultTarget;
|
|
16
|
-
__publicField(this, "$$type", "@backstage/ExternalRouteRef");
|
|
17
10
|
}
|
|
11
|
+
$$type = "@backstage/ExternalRouteRef";
|
|
18
12
|
getDefaultTarget() {
|
|
19
13
|
return this.defaultTarget;
|
|
20
14
|
}
|
|
21
15
|
}
|
|
22
16
|
function createExternalRouteRef(options) {
|
|
23
17
|
return new ExternalRouteRefImpl(
|
|
24
|
-
Boolean(options
|
|
25
|
-
options
|
|
26
|
-
options
|
|
18
|
+
Boolean(options?.optional),
|
|
19
|
+
options?.params,
|
|
20
|
+
options?.defaultTarget,
|
|
27
21
|
describeParentCallSite()
|
|
28
22
|
);
|
|
29
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalRouteRef.esm.js","sources":["../../src/routing/ExternalRouteRef.ts"],"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 { RouteRefImpl } from './RouteRef';\nimport { describeParentCallSite } from './describeParentCallSite';\nimport { AnyRouteRefParams } from './types';\n\n/**\n * Route descriptor, to be later bound to a concrete route by the app. Used to implement cross-plugin route references.\n *\n * @remarks\n *\n * See {@link https://backstage.io/docs/plugins/composability#routing-system}.\n *\n * @public\n */\nexport interface ExternalRouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n TOptional extends boolean = boolean,\n> {\n readonly $$type: '@backstage/ExternalRouteRef';\n readonly T: TParams;\n readonly optional: TOptional;\n}\n\n/** @internal */\nexport interface InternalExternalRouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n TOptional extends boolean = boolean,\n> extends ExternalRouteRef<TParams, TOptional> {\n readonly version: 'v1';\n getParams(): string[];\n getDescription(): string;\n getDefaultTarget(): string | undefined;\n\n setId(id: string): void;\n}\n\n/** @internal */\nexport function toInternalExternalRouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n TOptional extends boolean = boolean,\n>(\n resource: ExternalRouteRef<TParams, TOptional>,\n): InternalExternalRouteRef<TParams, TOptional> {\n const r = resource as InternalExternalRouteRef<TParams, TOptional>;\n if (r.$$type !== '@backstage/ExternalRouteRef') {\n throw new Error(`Invalid ExternalRouteRef, bad type '${r.$$type}'`);\n }\n\n return r;\n}\n\n/** @internal */\nexport function isExternalRouteRef(opaque: {\n $$type: string;\n}): opaque is ExternalRouteRef {\n return opaque.$$type === '@backstage/ExternalRouteRef';\n}\n\n/** @internal */\nclass ExternalRouteRefImpl\n extends RouteRefImpl\n implements InternalExternalRouteRef\n{\n readonly $$type = '@backstage/ExternalRouteRef' as any;\n\n constructor(\n readonly optional: boolean,\n readonly params: string[] = [],\n readonly defaultTarget: string | undefined,\n creationSite: string,\n ) {\n super(params, creationSite);\n }\n\n getDefaultTarget() {\n return this.defaultTarget;\n }\n}\n\n/**\n * Creates a route descriptor, to be later bound to a concrete route by the app. Used to implement cross-plugin route references.\n *\n * @remarks\n *\n * See {@link https://backstage.io/docs/plugins/composability#routing-system}.\n *\n * @param options - Description of the route reference to be created.\n * @public\n */\nexport function createExternalRouteRef<\n TParams extends { [param in TParamKeys]: string } | undefined = undefined,\n TOptional extends boolean = false,\n TParamKeys extends string = string,\n>(options?: {\n /**\n * The parameters that will be provided to the external route reference.\n */\n readonly params?: string extends TParamKeys\n ? (keyof TParams)[]\n : TParamKeys[];\n\n /**\n * Whether or not this route is optional, defaults to false.\n *\n * Optional external routes are not required to be bound in the app, and\n * if they aren't, `useExternalRouteRef` will return `undefined`.\n */\n optional?: TOptional;\n\n /**\n * The route (typically in another plugin) that this should map to by default.\n *\n * The string is expected to be on the standard `<plugin id>.<route id>` form,\n * for example `techdocs.docRoot`.\n */\n defaultTarget?: string;\n}): ExternalRouteRef<\n keyof TParams extends never\n ? undefined\n : string extends TParamKeys\n ? TParams\n : { [param in TParamKeys]: string },\n TOptional\n> {\n return new ExternalRouteRefImpl(\n Boolean(options?.optional),\n options?.params as string[] | undefined,\n options?.defaultTarget,\n describeParentCallSite(),\n ) as ExternalRouteRef<any, any>;\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExternalRouteRef.esm.js","sources":["../../src/routing/ExternalRouteRef.ts"],"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 { RouteRefImpl } from './RouteRef';\nimport { describeParentCallSite } from './describeParentCallSite';\nimport { AnyRouteRefParams } from './types';\n\n/**\n * Route descriptor, to be later bound to a concrete route by the app. Used to implement cross-plugin route references.\n *\n * @remarks\n *\n * See {@link https://backstage.io/docs/plugins/composability#routing-system}.\n *\n * @public\n */\nexport interface ExternalRouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n TOptional extends boolean = boolean,\n> {\n readonly $$type: '@backstage/ExternalRouteRef';\n readonly T: TParams;\n readonly optional: TOptional;\n}\n\n/** @internal */\nexport interface InternalExternalRouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n TOptional extends boolean = boolean,\n> extends ExternalRouteRef<TParams, TOptional> {\n readonly version: 'v1';\n getParams(): string[];\n getDescription(): string;\n getDefaultTarget(): string | undefined;\n\n setId(id: string): void;\n}\n\n/** @internal */\nexport function toInternalExternalRouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n TOptional extends boolean = boolean,\n>(\n resource: ExternalRouteRef<TParams, TOptional>,\n): InternalExternalRouteRef<TParams, TOptional> {\n const r = resource as InternalExternalRouteRef<TParams, TOptional>;\n if (r.$$type !== '@backstage/ExternalRouteRef') {\n throw new Error(`Invalid ExternalRouteRef, bad type '${r.$$type}'`);\n }\n\n return r;\n}\n\n/** @internal */\nexport function isExternalRouteRef(opaque: {\n $$type: string;\n}): opaque is ExternalRouteRef {\n return opaque.$$type === '@backstage/ExternalRouteRef';\n}\n\n/** @internal */\nclass ExternalRouteRefImpl\n extends RouteRefImpl\n implements InternalExternalRouteRef\n{\n readonly $$type = '@backstage/ExternalRouteRef' as any;\n\n constructor(\n readonly optional: boolean,\n readonly params: string[] = [],\n readonly defaultTarget: string | undefined,\n creationSite: string,\n ) {\n super(params, creationSite);\n }\n\n getDefaultTarget() {\n return this.defaultTarget;\n }\n}\n\n/**\n * Creates a route descriptor, to be later bound to a concrete route by the app. Used to implement cross-plugin route references.\n *\n * @remarks\n *\n * See {@link https://backstage.io/docs/plugins/composability#routing-system}.\n *\n * @param options - Description of the route reference to be created.\n * @public\n */\nexport function createExternalRouteRef<\n TParams extends { [param in TParamKeys]: string } | undefined = undefined,\n TOptional extends boolean = false,\n TParamKeys extends string = string,\n>(options?: {\n /**\n * The parameters that will be provided to the external route reference.\n */\n readonly params?: string extends TParamKeys\n ? (keyof TParams)[]\n : TParamKeys[];\n\n /**\n * Whether or not this route is optional, defaults to false.\n *\n * Optional external routes are not required to be bound in the app, and\n * if they aren't, `useExternalRouteRef` will return `undefined`.\n */\n optional?: TOptional;\n\n /**\n * The route (typically in another plugin) that this should map to by default.\n *\n * The string is expected to be on the standard `<plugin id>.<route id>` form,\n * for example `techdocs.docRoot`.\n */\n defaultTarget?: string;\n}): ExternalRouteRef<\n keyof TParams extends never\n ? undefined\n : string extends TParamKeys\n ? TParams\n : { [param in TParamKeys]: string },\n TOptional\n> {\n return new ExternalRouteRefImpl(\n Boolean(options?.optional),\n options?.params as string[] | undefined,\n options?.defaultTarget,\n describeParentCallSite(),\n ) as ExternalRouteRef<any, any>;\n}\n"],"names":[],"mappings":";;;AA0EA,MAAM,6BACI,YAEV,CAAA;AAAA,EAGE,YACW,QACA,EAAA,MAAA,GAAmB,EAAC,EACpB,eACT,YACA,EAAA;AACA,IAAA,KAAA,CAAM,QAAQ,YAAY,CAAA,CAAA;AALjB,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA,CAAA;AACA,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA,CAAA;AACA,IAAA,IAAA,CAAA,aAAA,GAAA,aAAA,CAAA;AAAA,GAIX;AAAA,EATS,MAAS,GAAA,6BAAA,CAAA;AAAA,EAWlB,gBAAmB,GAAA;AACjB,IAAA,OAAO,IAAK,CAAA,aAAA,CAAA;AAAA,GACd;AACF,CAAA;AAYO,SAAS,uBAId,OA8BA,EAAA;AACA,EAAA,OAAO,IAAI,oBAAA;AAAA,IACT,OAAA,CAAQ,SAAS,QAAQ,CAAA;AAAA,IACzB,OAAS,EAAA,MAAA;AAAA,IACT,OAAS,EAAA,aAAA;AAAA,IACT,sBAAuB,EAAA;AAAA,GACzB,CAAA;AACF;;;;"}
|
|
@@ -1,30 +1,5 @@
|
|
|
1
1
|
import { describeParentCallSite } from './describeParentCallSite.esm.js';
|
|
2
2
|
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
|
-
var __publicField = (obj, key, value) => {
|
|
6
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
|
-
return value;
|
|
8
|
-
};
|
|
9
|
-
var __accessCheck = (obj, member, msg) => {
|
|
10
|
-
if (!member.has(obj))
|
|
11
|
-
throw TypeError("Cannot " + msg);
|
|
12
|
-
};
|
|
13
|
-
var __privateGet = (obj, member, getter) => {
|
|
14
|
-
__accessCheck(obj, member, "read from private field");
|
|
15
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
16
|
-
};
|
|
17
|
-
var __privateAdd = (obj, member, value) => {
|
|
18
|
-
if (member.has(obj))
|
|
19
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
20
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
21
|
-
};
|
|
22
|
-
var __privateSet = (obj, member, value, setter) => {
|
|
23
|
-
__accessCheck(obj, member, "write to private field");
|
|
24
|
-
member.set(obj, value);
|
|
25
|
-
return value;
|
|
26
|
-
};
|
|
27
|
-
var _id, _params, _creationSite, _name, name_get;
|
|
28
3
|
function toInternalRouteRef(resource) {
|
|
29
4
|
const r = resource;
|
|
30
5
|
if (r.$$type !== "@backstage/RouteRef") {
|
|
@@ -35,49 +10,44 @@ function toInternalRouteRef(resource) {
|
|
|
35
10
|
class RouteRefImpl {
|
|
36
11
|
constructor(params = [], creationSite) {
|
|
37
12
|
this.params = params;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
__publicField(this, "version", "v1");
|
|
41
|
-
__privateAdd(this, _id, void 0);
|
|
42
|
-
__privateAdd(this, _params, void 0);
|
|
43
|
-
__privateAdd(this, _creationSite, void 0);
|
|
44
|
-
__privateSet(this, _params, params);
|
|
45
|
-
__privateSet(this, _creationSite, creationSite);
|
|
13
|
+
this.#params = params;
|
|
14
|
+
this.#creationSite = creationSite;
|
|
46
15
|
}
|
|
16
|
+
$$type = "@backstage/RouteRef";
|
|
17
|
+
version = "v1";
|
|
18
|
+
#id;
|
|
19
|
+
#params;
|
|
20
|
+
#creationSite;
|
|
47
21
|
getParams() {
|
|
48
|
-
return
|
|
22
|
+
return this.#params;
|
|
49
23
|
}
|
|
50
24
|
getDescription() {
|
|
51
|
-
if (
|
|
52
|
-
return
|
|
25
|
+
if (this.#id) {
|
|
26
|
+
return this.#id;
|
|
53
27
|
}
|
|
54
|
-
return `created at '${
|
|
28
|
+
return `created at '${this.#creationSite}'`;
|
|
29
|
+
}
|
|
30
|
+
get #name() {
|
|
31
|
+
return this.$$type.slice("@backstage/".length);
|
|
55
32
|
}
|
|
56
33
|
setId(id) {
|
|
57
34
|
if (!id) {
|
|
58
|
-
throw new Error(`${
|
|
35
|
+
throw new Error(`${this.#name} id must be a non-empty string`);
|
|
59
36
|
}
|
|
60
|
-
if (
|
|
37
|
+
if (this.#id) {
|
|
61
38
|
throw new Error(
|
|
62
|
-
`${
|
|
39
|
+
`${this.#name} was referenced twice as both '${this.#id}' and '${id}'`
|
|
63
40
|
);
|
|
64
41
|
}
|
|
65
|
-
|
|
42
|
+
this.#id = id;
|
|
66
43
|
}
|
|
67
44
|
toString() {
|
|
68
|
-
return `${
|
|
45
|
+
return `${this.#name}{${this.getDescription()}}`;
|
|
69
46
|
}
|
|
70
47
|
}
|
|
71
|
-
_id = new WeakMap();
|
|
72
|
-
_params = new WeakMap();
|
|
73
|
-
_creationSite = new WeakMap();
|
|
74
|
-
_name = new WeakSet();
|
|
75
|
-
name_get = function() {
|
|
76
|
-
return this.$$type.slice("@backstage/".length);
|
|
77
|
-
};
|
|
78
48
|
function createRouteRef(config) {
|
|
79
49
|
return new RouteRefImpl(
|
|
80
|
-
config
|
|
50
|
+
config?.params,
|
|
81
51
|
describeParentCallSite()
|
|
82
52
|
);
|
|
83
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteRef.esm.js","sources":["../../src/routing/RouteRef.ts"],"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 { describeParentCallSite } from './describeParentCallSite';\nimport { AnyRouteRefParams } from './types';\n\n/**\n * Absolute route reference.\n *\n * @remarks\n *\n * See {@link https://backstage.io/docs/plugins/composability#routing-system}.\n *\n * @public\n */\nexport interface RouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n> {\n readonly $$type: '@backstage/RouteRef';\n readonly T: TParams;\n}\n\n/** @internal */\nexport interface InternalRouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n> extends RouteRef<TParams> {\n readonly version: 'v1';\n getParams(): string[];\n getDescription(): string;\n\n setId(id: string): void;\n}\n\n/** @internal */\nexport function toInternalRouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n>(resource: RouteRef<TParams>): InternalRouteRef<TParams> {\n const r = resource as InternalRouteRef<TParams>;\n if (r.$$type !== '@backstage/RouteRef') {\n throw new Error(`Invalid RouteRef, bad type '${r.$$type}'`);\n }\n\n return r;\n}\n\n/** @internal */\nexport function isRouteRef(opaque: { $$type: string }): opaque is RouteRef {\n return opaque.$$type === '@backstage/RouteRef';\n}\n\n/** @internal */\nexport class RouteRefImpl implements InternalRouteRef {\n readonly $$type = '@backstage/RouteRef';\n readonly version = 'v1';\n declare readonly T: never;\n\n #id?: string;\n #params: string[];\n #creationSite: string;\n\n constructor(readonly params: string[] = [], creationSite: string) {\n this.#params = params;\n this.#creationSite = creationSite;\n }\n\n getParams(): string[] {\n return this.#params;\n }\n\n getDescription(): string {\n if (this.#id) {\n return this.#id;\n }\n return `created at '${this.#creationSite}'`;\n }\n\n get #name() {\n return this.$$type.slice('@backstage/'.length);\n }\n\n setId(id: string): void {\n if (!id) {\n throw new Error(`${this.#name} id must be a non-empty string`);\n }\n if (this.#id) {\n throw new Error(\n `${this.#name} was referenced twice as both '${this.#id}' and '${id}'`,\n );\n }\n this.#id = id;\n }\n\n toString(): string {\n return `${this.#name}{${this.getDescription()}}`;\n }\n}\n\n/**\n * Create a {@link RouteRef} from a route descriptor.\n *\n * @param config - Description of the route reference to be created.\n * @public\n */\nexport function createRouteRef<\n // Params is the type that we care about and the one to be embedded in the route ref.\n // For example, given the params ['name', 'kind'], Params will be {name: string, kind: string}\n TParams extends { [param in TParamKeys]: string } | undefined = undefined,\n TParamKeys extends string = string,\n>(config?: {\n /** A list of parameter names that the path that this route ref is bound to must contain */\n readonly params: string extends TParamKeys ? (keyof TParams)[] : TParamKeys[];\n}): RouteRef<\n keyof TParams extends never\n ? undefined\n : string extends TParamKeys\n ? TParams\n : { [param in TParamKeys]: string }\n> {\n return new RouteRefImpl(\n config?.params as string[] | undefined,\n describeParentCallSite(),\n ) as RouteRef<any>;\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RouteRef.esm.js","sources":["../../src/routing/RouteRef.ts"],"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 { describeParentCallSite } from './describeParentCallSite';\nimport { AnyRouteRefParams } from './types';\n\n/**\n * Absolute route reference.\n *\n * @remarks\n *\n * See {@link https://backstage.io/docs/plugins/composability#routing-system}.\n *\n * @public\n */\nexport interface RouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n> {\n readonly $$type: '@backstage/RouteRef';\n readonly T: TParams;\n}\n\n/** @internal */\nexport interface InternalRouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n> extends RouteRef<TParams> {\n readonly version: 'v1';\n getParams(): string[];\n getDescription(): string;\n\n setId(id: string): void;\n}\n\n/** @internal */\nexport function toInternalRouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n>(resource: RouteRef<TParams>): InternalRouteRef<TParams> {\n const r = resource as InternalRouteRef<TParams>;\n if (r.$$type !== '@backstage/RouteRef') {\n throw new Error(`Invalid RouteRef, bad type '${r.$$type}'`);\n }\n\n return r;\n}\n\n/** @internal */\nexport function isRouteRef(opaque: { $$type: string }): opaque is RouteRef {\n return opaque.$$type === '@backstage/RouteRef';\n}\n\n/** @internal */\nexport class RouteRefImpl implements InternalRouteRef {\n readonly $$type = '@backstage/RouteRef';\n readonly version = 'v1';\n declare readonly T: never;\n\n #id?: string;\n #params: string[];\n #creationSite: string;\n\n constructor(readonly params: string[] = [], creationSite: string) {\n this.#params = params;\n this.#creationSite = creationSite;\n }\n\n getParams(): string[] {\n return this.#params;\n }\n\n getDescription(): string {\n if (this.#id) {\n return this.#id;\n }\n return `created at '${this.#creationSite}'`;\n }\n\n get #name() {\n return this.$$type.slice('@backstage/'.length);\n }\n\n setId(id: string): void {\n if (!id) {\n throw new Error(`${this.#name} id must be a non-empty string`);\n }\n if (this.#id) {\n throw new Error(\n `${this.#name} was referenced twice as both '${this.#id}' and '${id}'`,\n );\n }\n this.#id = id;\n }\n\n toString(): string {\n return `${this.#name}{${this.getDescription()}}`;\n }\n}\n\n/**\n * Create a {@link RouteRef} from a route descriptor.\n *\n * @param config - Description of the route reference to be created.\n * @public\n */\nexport function createRouteRef<\n // Params is the type that we care about and the one to be embedded in the route ref.\n // For example, given the params ['name', 'kind'], Params will be {name: string, kind: string}\n TParams extends { [param in TParamKeys]: string } | undefined = undefined,\n TParamKeys extends string = string,\n>(config?: {\n /** A list of parameter names that the path that this route ref is bound to must contain */\n readonly params: string extends TParamKeys ? (keyof TParams)[] : TParamKeys[];\n}): RouteRef<\n keyof TParams extends never\n ? undefined\n : string extends TParamKeys\n ? TParams\n : { [param in TParamKeys]: string }\n> {\n return new RouteRefImpl(\n config?.params as string[] | undefined,\n describeParentCallSite(),\n ) as RouteRef<any>;\n}\n"],"names":[],"mappings":";;AA+CO,SAAS,mBAEd,QAAwD,EAAA;AACxD,EAAA,MAAM,CAAI,GAAA,QAAA,CAAA;AACV,EAAI,IAAA,CAAA,CAAE,WAAW,qBAAuB,EAAA;AACtC,IAAA,MAAM,IAAI,KAAA,CAAM,CAA+B,4BAAA,EAAA,CAAA,CAAE,MAAM,CAAG,CAAA,CAAA,CAAA,CAAA;AAAA,GAC5D;AAEA,EAAO,OAAA,CAAA,CAAA;AACT,CAAA;AAQO,MAAM,YAAyC,CAAA;AAAA,EASpD,WAAqB,CAAA,MAAA,GAAmB,EAAC,EAAG,YAAsB,EAAA;AAA7C,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA,CAAA;AACnB,IAAA,IAAA,CAAK,OAAU,GAAA,MAAA,CAAA;AACf,IAAA,IAAA,CAAK,aAAgB,GAAA,YAAA,CAAA;AAAA,GACvB;AAAA,EAXS,MAAS,GAAA,qBAAA,CAAA;AAAA,EACT,OAAU,GAAA,IAAA,CAAA;AAAA,EAGnB,GAAA,CAAA;AAAA,EACA,OAAA,CAAA;AAAA,EACA,aAAA,CAAA;AAAA,EAOA,SAAsB,GAAA;AACpB,IAAA,OAAO,IAAK,CAAA,OAAA,CAAA;AAAA,GACd;AAAA,EAEA,cAAyB,GAAA;AACvB,IAAA,IAAI,KAAK,GAAK,EAAA;AACZ,MAAA,OAAO,IAAK,CAAA,GAAA,CAAA;AAAA,KACd;AACA,IAAO,OAAA,CAAA,YAAA,EAAe,KAAK,aAAa,CAAA,CAAA,CAAA,CAAA;AAAA,GAC1C;AAAA,EAEA,IAAI,KAAQ,GAAA;AACV,IAAA,OAAO,IAAK,CAAA,MAAA,CAAO,KAAM,CAAA,aAAA,CAAc,MAAM,CAAA,CAAA;AAAA,GAC/C;AAAA,EAEA,MAAM,EAAkB,EAAA;AACtB,IAAA,IAAI,CAAC,EAAI,EAAA;AACP,MAAA,MAAM,IAAI,KAAA,CAAM,CAAG,EAAA,IAAA,CAAK,KAAK,CAAgC,8BAAA,CAAA,CAAA,CAAA;AAAA,KAC/D;AACA,IAAA,IAAI,KAAK,GAAK,EAAA;AACZ,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,GAAG,IAAK,CAAA,KAAK,kCAAkC,IAAK,CAAA,GAAG,UAAU,EAAE,CAAA,CAAA,CAAA;AAAA,OACrE,CAAA;AAAA,KACF;AACA,IAAA,IAAA,CAAK,GAAM,GAAA,EAAA,CAAA;AAAA,GACb;AAAA,EAEA,QAAmB,GAAA;AACjB,IAAA,OAAO,GAAG,IAAK,CAAA,KAAK,CAAI,CAAA,EAAA,IAAA,CAAK,gBAAgB,CAAA,CAAA,CAAA,CAAA;AAAA,GAC/C;AACF,CAAA;AAQO,SAAS,eAKd,MASA,EAAA;AACA,EAAA,OAAO,IAAI,YAAA;AAAA,IACT,MAAQ,EAAA,MAAA;AAAA,IACR,sBAAuB,EAAA;AAAA,GACzB,CAAA;AACF;;;;"}
|
|
@@ -1,57 +1,30 @@
|
|
|
1
1
|
import { toInternalRouteRef } from './RouteRef.esm.js';
|
|
2
2
|
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
|
-
var __publicField = (obj, key, value) => {
|
|
6
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
|
-
return value;
|
|
8
|
-
};
|
|
9
|
-
var __accessCheck = (obj, member, msg) => {
|
|
10
|
-
if (!member.has(obj))
|
|
11
|
-
throw TypeError("Cannot " + msg);
|
|
12
|
-
};
|
|
13
|
-
var __privateGet = (obj, member, getter) => {
|
|
14
|
-
__accessCheck(obj, member, "read from private field");
|
|
15
|
-
return member.get(obj);
|
|
16
|
-
};
|
|
17
|
-
var __privateAdd = (obj, member, value) => {
|
|
18
|
-
if (member.has(obj))
|
|
19
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
20
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
21
|
-
};
|
|
22
|
-
var __privateSet = (obj, member, value, setter) => {
|
|
23
|
-
__accessCheck(obj, member, "write to private field");
|
|
24
|
-
member.set(obj, value);
|
|
25
|
-
return value;
|
|
26
|
-
};
|
|
27
|
-
var _params, _parent;
|
|
28
3
|
const PARAM_PATTERN = /^\w+$/;
|
|
29
4
|
class SubRouteRefImpl {
|
|
30
5
|
constructor(path, params, parent) {
|
|
31
6
|
this.path = path;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
__privateAdd(this, _params, void 0);
|
|
35
|
-
__privateAdd(this, _parent, void 0);
|
|
36
|
-
__privateSet(this, _params, params);
|
|
37
|
-
__privateSet(this, _parent, parent);
|
|
7
|
+
this.#params = params;
|
|
8
|
+
this.#parent = parent;
|
|
38
9
|
}
|
|
10
|
+
$$type = "@backstage/SubRouteRef";
|
|
11
|
+
version = "v1";
|
|
12
|
+
#params;
|
|
13
|
+
#parent;
|
|
39
14
|
getParams() {
|
|
40
|
-
return
|
|
15
|
+
return this.#params;
|
|
41
16
|
}
|
|
42
17
|
getParent() {
|
|
43
|
-
return
|
|
18
|
+
return this.#parent;
|
|
44
19
|
}
|
|
45
20
|
getDescription() {
|
|
46
|
-
const parent = toInternalRouteRef(
|
|
21
|
+
const parent = toInternalRouteRef(this.#parent);
|
|
47
22
|
return `at ${this.path} with parent ${parent.getDescription()}`;
|
|
48
23
|
}
|
|
49
24
|
toString() {
|
|
50
25
|
return `SubRouteRef{${this.getDescription()}}`;
|
|
51
26
|
}
|
|
52
27
|
}
|
|
53
|
-
_params = new WeakMap();
|
|
54
|
-
_parent = new WeakMap();
|
|
55
28
|
function createSubRouteRef(config) {
|
|
56
29
|
const { path, parent } = config;
|
|
57
30
|
const internalParent = toInternalRouteRef(parent);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubRouteRef.esm.js","sources":["../../src/routing/SubRouteRef.ts"],"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 { RouteRef, toInternalRouteRef } from './RouteRef';\nimport { AnyRouteRefParams } from './types';\n\n// Should match the pattern in react-router\nconst PARAM_PATTERN = /^\\w+$/;\n\n/**\n * Descriptor of a route relative to an absolute {@link RouteRef}.\n *\n * @remarks\n *\n * See {@link https://backstage.io/docs/plugins/composability#routing-system}.\n *\n * @public\n */\nexport interface SubRouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n> {\n readonly $$type: '@backstage/SubRouteRef';\n\n readonly T: TParams;\n\n readonly path: string;\n}\n\n/** @internal */\nexport interface InternalSubRouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n> extends SubRouteRef<TParams> {\n readonly version: 'v1';\n\n getParams(): string[];\n getParent(): RouteRef;\n getDescription(): string;\n}\n\n/** @internal */\nexport function toInternalSubRouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n>(resource: SubRouteRef<TParams>): InternalSubRouteRef<TParams> {\n const r = resource as InternalSubRouteRef<TParams>;\n if (r.$$type !== '@backstage/SubRouteRef') {\n throw new Error(`Invalid SubRouteRef, bad type '${r.$$type}'`);\n }\n\n return r;\n}\n\n/** @internal */\nexport function isSubRouteRef(opaque: {\n $$type: string;\n}): opaque is SubRouteRef {\n return opaque.$$type === '@backstage/SubRouteRef';\n}\n\n/** @internal */\nexport class SubRouteRefImpl<TParams extends AnyRouteRefParams>\n implements SubRouteRef<TParams>\n{\n readonly $$type = '@backstage/SubRouteRef';\n readonly version = 'v1';\n declare readonly T: never;\n\n #params: string[];\n #parent: RouteRef;\n\n constructor(readonly path: string, params: string[], parent: RouteRef) {\n this.#params = params;\n this.#parent = parent;\n }\n\n getParams(): string[] {\n return this.#params;\n }\n\n getParent(): RouteRef {\n return this.#parent;\n }\n\n getDescription(): string {\n const parent = toInternalRouteRef(this.#parent);\n return `at ${this.path} with parent ${parent.getDescription()}`;\n }\n\n toString(): string {\n return `SubRouteRef{${this.getDescription()}}`;\n }\n}\n\n/**\n * Used in {@link PathParams} type declaration.\n * @ignore\n */\ntype ParamPart<S extends string> = S extends `:${infer Param}` ? Param : never;\n\n/**\n * Used in {@link PathParams} type declaration.\n * @ignore\n */\ntype ParamNames<S extends string> = S extends `${infer Part}/${infer Rest}`\n ? ParamPart<Part> | ParamNames<Rest>\n : ParamPart<S>;\n/**\n * This utility type helps us infer a Param object type from a string path\n * For example, `/foo/:bar/:baz` inferred to `{ bar: string, baz: string }`\n * @ignore\n */\ntype PathParams<S extends string> = { [name in ParamNames<S>]: string };\n\n/**\n * Merges a param object type with an optional params type into a params object.\n * @ignore\n */\ntype MergeParams<\n P1 extends { [param in string]: string },\n P2 extends AnyRouteRefParams,\n> = (P1[keyof P1] extends never ? {} : P1) & (P2 extends undefined ? {} : P2);\n\n/**\n * Convert empty params to undefined.\n * @ignore\n */\ntype TrimEmptyParams<Params extends { [param in string]: string }> =\n keyof Params extends never ? undefined : Params;\n\n/**\n * Creates a SubRouteRef type given the desired parameters and parent route parameters.\n * The parameters types are merged together while ensuring that there is no overlap between the two.\n *\n * @ignore\n */\ntype MakeSubRouteRef<\n Params extends { [param in string]: string },\n ParentParams extends AnyRouteRefParams,\n> = keyof Params & keyof ParentParams extends never\n ? SubRouteRef<TrimEmptyParams<MergeParams<Params, ParentParams>>>\n : never;\n\n/**\n * Create a {@link SubRouteRef} from a route descriptor.\n *\n * @param config - Description of the route reference to be created.\n * @public\n */\nexport function createSubRouteRef<\n Path extends string,\n ParentParams extends AnyRouteRefParams = never,\n>(config: {\n path: Path;\n parent: RouteRef<ParentParams>;\n}): MakeSubRouteRef<PathParams<Path>, ParentParams> {\n const { path, parent } = config;\n type Params = PathParams<Path>;\n\n const internalParent = toInternalRouteRef(parent);\n const parentParams = internalParent.getParams();\n\n // Collect runtime parameters from the path, e.g. ['bar', 'baz'] from '/foo/:bar/:baz'\n const pathParams = path\n .split('/')\n .filter(p => p.startsWith(':'))\n .map(p => p.substring(1));\n const params = [...parentParams, ...pathParams];\n\n if (parentParams.some(p => pathParams.includes(p as string))) {\n throw new Error(\n 'SubRouteRef may not have params that overlap with its parent',\n );\n }\n if (!path.startsWith('/')) {\n throw new Error(`SubRouteRef path must start with '/', got '${path}'`);\n }\n if (path.endsWith('/')) {\n throw new Error(`SubRouteRef path must not end with '/', got '${path}'`);\n }\n for (const param of pathParams) {\n if (!PARAM_PATTERN.test(param)) {\n throw new Error(`SubRouteRef path has invalid param, got '${param}'`);\n }\n }\n\n // We ensure that the type of the return type is sane here\n const subRouteRef = new SubRouteRefImpl(\n path,\n params as string[],\n parent,\n ) as SubRouteRef<TrimEmptyParams<MergeParams<Params, ParentParams>>>;\n\n // But skip type checking of the return value itself, because the conditional\n // type checking of the parent parameter overlap is tricky to express.\n return subRouteRef as any;\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SubRouteRef.esm.js","sources":["../../src/routing/SubRouteRef.ts"],"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 { RouteRef, toInternalRouteRef } from './RouteRef';\nimport { AnyRouteRefParams } from './types';\n\n// Should match the pattern in react-router\nconst PARAM_PATTERN = /^\\w+$/;\n\n/**\n * Descriptor of a route relative to an absolute {@link RouteRef}.\n *\n * @remarks\n *\n * See {@link https://backstage.io/docs/plugins/composability#routing-system}.\n *\n * @public\n */\nexport interface SubRouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n> {\n readonly $$type: '@backstage/SubRouteRef';\n\n readonly T: TParams;\n\n readonly path: string;\n}\n\n/** @internal */\nexport interface InternalSubRouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n> extends SubRouteRef<TParams> {\n readonly version: 'v1';\n\n getParams(): string[];\n getParent(): RouteRef;\n getDescription(): string;\n}\n\n/** @internal */\nexport function toInternalSubRouteRef<\n TParams extends AnyRouteRefParams = AnyRouteRefParams,\n>(resource: SubRouteRef<TParams>): InternalSubRouteRef<TParams> {\n const r = resource as InternalSubRouteRef<TParams>;\n if (r.$$type !== '@backstage/SubRouteRef') {\n throw new Error(`Invalid SubRouteRef, bad type '${r.$$type}'`);\n }\n\n return r;\n}\n\n/** @internal */\nexport function isSubRouteRef(opaque: {\n $$type: string;\n}): opaque is SubRouteRef {\n return opaque.$$type === '@backstage/SubRouteRef';\n}\n\n/** @internal */\nexport class SubRouteRefImpl<TParams extends AnyRouteRefParams>\n implements SubRouteRef<TParams>\n{\n readonly $$type = '@backstage/SubRouteRef';\n readonly version = 'v1';\n declare readonly T: never;\n\n #params: string[];\n #parent: RouteRef;\n\n constructor(readonly path: string, params: string[], parent: RouteRef) {\n this.#params = params;\n this.#parent = parent;\n }\n\n getParams(): string[] {\n return this.#params;\n }\n\n getParent(): RouteRef {\n return this.#parent;\n }\n\n getDescription(): string {\n const parent = toInternalRouteRef(this.#parent);\n return `at ${this.path} with parent ${parent.getDescription()}`;\n }\n\n toString(): string {\n return `SubRouteRef{${this.getDescription()}}`;\n }\n}\n\n/**\n * Used in {@link PathParams} type declaration.\n * @ignore\n */\ntype ParamPart<S extends string> = S extends `:${infer Param}` ? Param : never;\n\n/**\n * Used in {@link PathParams} type declaration.\n * @ignore\n */\ntype ParamNames<S extends string> = S extends `${infer Part}/${infer Rest}`\n ? ParamPart<Part> | ParamNames<Rest>\n : ParamPart<S>;\n/**\n * This utility type helps us infer a Param object type from a string path\n * For example, `/foo/:bar/:baz` inferred to `{ bar: string, baz: string }`\n * @ignore\n */\ntype PathParams<S extends string> = { [name in ParamNames<S>]: string };\n\n/**\n * Merges a param object type with an optional params type into a params object.\n * @ignore\n */\ntype MergeParams<\n P1 extends { [param in string]: string },\n P2 extends AnyRouteRefParams,\n> = (P1[keyof P1] extends never ? {} : P1) & (P2 extends undefined ? {} : P2);\n\n/**\n * Convert empty params to undefined.\n * @ignore\n */\ntype TrimEmptyParams<Params extends { [param in string]: string }> =\n keyof Params extends never ? undefined : Params;\n\n/**\n * Creates a SubRouteRef type given the desired parameters and parent route parameters.\n * The parameters types are merged together while ensuring that there is no overlap between the two.\n *\n * @ignore\n */\ntype MakeSubRouteRef<\n Params extends { [param in string]: string },\n ParentParams extends AnyRouteRefParams,\n> = keyof Params & keyof ParentParams extends never\n ? SubRouteRef<TrimEmptyParams<MergeParams<Params, ParentParams>>>\n : never;\n\n/**\n * Create a {@link SubRouteRef} from a route descriptor.\n *\n * @param config - Description of the route reference to be created.\n * @public\n */\nexport function createSubRouteRef<\n Path extends string,\n ParentParams extends AnyRouteRefParams = never,\n>(config: {\n path: Path;\n parent: RouteRef<ParentParams>;\n}): MakeSubRouteRef<PathParams<Path>, ParentParams> {\n const { path, parent } = config;\n type Params = PathParams<Path>;\n\n const internalParent = toInternalRouteRef(parent);\n const parentParams = internalParent.getParams();\n\n // Collect runtime parameters from the path, e.g. ['bar', 'baz'] from '/foo/:bar/:baz'\n const pathParams = path\n .split('/')\n .filter(p => p.startsWith(':'))\n .map(p => p.substring(1));\n const params = [...parentParams, ...pathParams];\n\n if (parentParams.some(p => pathParams.includes(p as string))) {\n throw new Error(\n 'SubRouteRef may not have params that overlap with its parent',\n );\n }\n if (!path.startsWith('/')) {\n throw new Error(`SubRouteRef path must start with '/', got '${path}'`);\n }\n if (path.endsWith('/')) {\n throw new Error(`SubRouteRef path must not end with '/', got '${path}'`);\n }\n for (const param of pathParams) {\n if (!PARAM_PATTERN.test(param)) {\n throw new Error(`SubRouteRef path has invalid param, got '${param}'`);\n }\n }\n\n // We ensure that the type of the return type is sane here\n const subRouteRef = new SubRouteRefImpl(\n path,\n params as string[],\n parent,\n ) as SubRouteRef<TrimEmptyParams<MergeParams<Params, ParentParams>>>;\n\n // But skip type checking of the return value itself, because the conditional\n // type checking of the parent parameter overlap is tricky to express.\n return subRouteRef as any;\n}\n"],"names":[],"mappings":";;AAoBA,MAAM,aAAgB,GAAA,OAAA,CAAA;AAoDf,MAAM,eAEb,CAAA;AAAA,EAQE,WAAA,CAAqB,IAAc,EAAA,MAAA,EAAkB,MAAkB,EAAA;AAAlD,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA,CAAA;AACnB,IAAA,IAAA,CAAK,OAAU,GAAA,MAAA,CAAA;AACf,IAAA,IAAA,CAAK,OAAU,GAAA,MAAA,CAAA;AAAA,GACjB;AAAA,EAVS,MAAS,GAAA,wBAAA,CAAA;AAAA,EACT,OAAU,GAAA,IAAA,CAAA;AAAA,EAGnB,OAAA,CAAA;AAAA,EACA,OAAA,CAAA;AAAA,EAOA,SAAsB,GAAA;AACpB,IAAA,OAAO,IAAK,CAAA,OAAA,CAAA;AAAA,GACd;AAAA,EAEA,SAAsB,GAAA;AACpB,IAAA,OAAO,IAAK,CAAA,OAAA,CAAA;AAAA,GACd;AAAA,EAEA,cAAyB,GAAA;AACvB,IAAM,MAAA,MAAA,GAAS,kBAAmB,CAAA,IAAA,CAAK,OAAO,CAAA,CAAA;AAC9C,IAAA,OAAO,MAAM,IAAK,CAAA,IAAI,CAAgB,aAAA,EAAA,MAAA,CAAO,gBAAgB,CAAA,CAAA,CAAA;AAAA,GAC/D;AAAA,EAEA,QAAmB,GAAA;AACjB,IAAO,OAAA,CAAA,YAAA,EAAe,IAAK,CAAA,cAAA,EAAgB,CAAA,CAAA,CAAA,CAAA;AAAA,GAC7C;AACF,CAAA;AAyDO,SAAS,kBAGd,MAGkD,EAAA;AAClD,EAAM,MAAA,EAAE,IAAM,EAAA,MAAA,EAAW,GAAA,MAAA,CAAA;AAGzB,EAAM,MAAA,cAAA,GAAiB,mBAAmB,MAAM,CAAA,CAAA;AAChD,EAAM,MAAA,YAAA,GAAe,eAAe,SAAU,EAAA,CAAA;AAG9C,EAAA,MAAM,aAAa,IAChB,CAAA,KAAA,CAAM,GAAG,CAAA,CACT,OAAO,CAAK,CAAA,KAAA,CAAA,CAAE,UAAW,CAAA,GAAG,CAAC,CAC7B,CAAA,GAAA,CAAI,OAAK,CAAE,CAAA,SAAA,CAAU,CAAC,CAAC,CAAA,CAAA;AAC1B,EAAA,MAAM,MAAS,GAAA,CAAC,GAAG,YAAA,EAAc,GAAG,UAAU,CAAA,CAAA;AAE9C,EAAA,IAAI,aAAa,IAAK,CAAA,CAAA,CAAA,KAAK,WAAW,QAAS,CAAA,CAAW,CAAC,CAAG,EAAA;AAC5D,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,8DAAA;AAAA,KACF,CAAA;AAAA,GACF;AACA,EAAA,IAAI,CAAC,IAAA,CAAK,UAAW,CAAA,GAAG,CAAG,EAAA;AACzB,IAAA,MAAM,IAAI,KAAA,CAAM,CAA8C,2CAAA,EAAA,IAAI,CAAG,CAAA,CAAA,CAAA,CAAA;AAAA,GACvE;AACA,EAAI,IAAA,IAAA,CAAK,QAAS,CAAA,GAAG,CAAG,EAAA;AACtB,IAAA,MAAM,IAAI,KAAA,CAAM,CAAgD,6CAAA,EAAA,IAAI,CAAG,CAAA,CAAA,CAAA,CAAA;AAAA,GACzE;AACA,EAAA,KAAA,MAAW,SAAS,UAAY,EAAA;AAC9B,IAAA,IAAI,CAAC,aAAA,CAAc,IAAK,CAAA,KAAK,CAAG,EAAA;AAC9B,MAAA,MAAM,IAAI,KAAA,CAAM,CAA4C,yCAAA,EAAA,KAAK,CAAG,CAAA,CAAA,CAAA,CAAA;AAAA,KACtE;AAAA,GACF;AAGA,EAAA,MAAM,cAAc,IAAI,eAAA;AAAA,IACtB,IAAA;AAAA,IACA,MAAA;AAAA,IACA,MAAA;AAAA,GACF,CAAA;AAIA,EAAO,OAAA,WAAA,CAAA;AACT;;;;"}
|
|
@@ -13,7 +13,6 @@ function toInternalExtensionDefinition(overrides) {
|
|
|
13
13
|
return internal;
|
|
14
14
|
}
|
|
15
15
|
function createExtension(options) {
|
|
16
|
-
var _a, _b;
|
|
17
16
|
return {
|
|
18
17
|
$$type: "@backstage/ExtensionDefinition",
|
|
19
18
|
version: "v1",
|
|
@@ -21,8 +20,8 @@ function createExtension(options) {
|
|
|
21
20
|
namespace: options.namespace,
|
|
22
21
|
name: options.name,
|
|
23
22
|
attachTo: options.attachTo,
|
|
24
|
-
disabled:
|
|
25
|
-
inputs:
|
|
23
|
+
disabled: options.disabled ?? false,
|
|
24
|
+
inputs: options.inputs ?? {},
|
|
26
25
|
output: options.output,
|
|
27
26
|
configSchema: options.configSchema,
|
|
28
27
|
factory({ inputs, ...rest }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createExtension.esm.js","sources":["../../src/wiring/createExtension.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { AppNode } from '../apis';\nimport { PortableSchema } from '../schema';\nimport { Expand } from '../types';\nimport { ExtensionDataRef } from './createExtensionDataRef';\nimport { ExtensionInput } from './createExtensionInput';\n\n/** @public */\nexport type AnyExtensionDataMap = {\n [name in string]: ExtensionDataRef<unknown, { optional?: true }>;\n};\n\n/** @public */\nexport type AnyExtensionInputMap = {\n [inputName in string]: ExtensionInput<\n AnyExtensionDataMap,\n { optional: boolean; singleton: boolean }\n >;\n};\n\n/**\n * Converts an extension data map into the matching concrete data values type.\n * @public\n */\nexport type ExtensionDataValues<TExtensionData extends AnyExtensionDataMap> = {\n [DataName in keyof TExtensionData as TExtensionData[DataName]['config'] extends {\n optional: true;\n }\n ? never\n : DataName]: TExtensionData[DataName]['T'];\n} & {\n [DataName in keyof TExtensionData as TExtensionData[DataName]['config'] extends {\n optional: true;\n }\n ? DataName\n : never]?: TExtensionData[DataName]['T'];\n};\n\n/**\n * Convert a single extension input into a matching resolved input.\n * @public\n */\nexport type ResolvedExtensionInput<TExtensionData extends AnyExtensionDataMap> =\n {\n node: AppNode;\n output: ExtensionDataValues<TExtensionData>;\n };\n\n/**\n * Converts an extension input map into a matching collection of resolved inputs.\n * @public\n */\nexport type ResolvedExtensionInputs<\n TInputs extends { [name in string]: ExtensionInput<any, any> },\n> = {\n [InputName in keyof TInputs]: false extends TInputs[InputName]['config']['singleton']\n ? Array<Expand<ResolvedExtensionInput<TInputs[InputName]['extensionData']>>>\n : false extends TInputs[InputName]['config']['optional']\n ? Expand<ResolvedExtensionInput<TInputs[InputName]['extensionData']>>\n : Expand<\n ResolvedExtensionInput<TInputs[InputName]['extensionData']> | undefined\n >;\n};\n\n/** @public */\nexport interface CreateExtensionOptions<\n TOutput extends AnyExtensionDataMap,\n TInputs extends AnyExtensionInputMap,\n TConfig,\n> {\n kind?: string;\n namespace?: string;\n name?: string;\n attachTo: { id: string; input: string };\n disabled?: boolean;\n inputs?: TInputs;\n output: TOutput;\n configSchema?: PortableSchema<TConfig>;\n factory(options: {\n node: AppNode;\n config: TConfig;\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n }): Expand<ExtensionDataValues<TOutput>>;\n}\n\n/** @public */\nexport interface ExtensionDefinition<TConfig> {\n $$type: '@backstage/ExtensionDefinition';\n readonly kind?: string;\n readonly namespace?: string;\n readonly name?: string;\n readonly attachTo: { id: string; input: string };\n readonly disabled: boolean;\n readonly configSchema?: PortableSchema<TConfig>;\n}\n\n/** @internal */\nexport interface InternalExtensionDefinition<TConfig>\n extends ExtensionDefinition<TConfig> {\n readonly version: 'v1';\n readonly inputs: AnyExtensionInputMap;\n readonly output: AnyExtensionDataMap;\n factory(options: {\n node: AppNode;\n config: TConfig;\n inputs: ResolvedExtensionInputs<any>;\n }): ExtensionDataValues<any>;\n}\n\n/** @internal */\nexport function toInternalExtensionDefinition<TConfig>(\n overrides: ExtensionDefinition<TConfig>,\n): InternalExtensionDefinition<TConfig> {\n const internal = overrides as InternalExtensionDefinition<TConfig>;\n if (internal.$$type !== '@backstage/ExtensionDefinition') {\n throw new Error(\n `Invalid extension definition instance, bad type '${internal.$$type}'`,\n );\n }\n if (internal.version !== 'v1') {\n throw new Error(\n `Invalid extension definition instance, bad version '${internal.version}'`,\n );\n }\n return internal;\n}\n\n/** @public */\nexport function createExtension<\n TOutput extends AnyExtensionDataMap,\n TInputs extends AnyExtensionInputMap,\n TConfig = never,\n>(\n options: CreateExtensionOptions<TOutput, TInputs, TConfig>,\n): ExtensionDefinition<TConfig> {\n return {\n $$type: '@backstage/ExtensionDefinition',\n version: 'v1',\n kind: options.kind,\n namespace: options.namespace,\n name: options.name,\n attachTo: options.attachTo,\n disabled: options.disabled ?? false,\n inputs: options.inputs ?? {},\n output: options.output,\n configSchema: options.configSchema,\n factory({ inputs, ...rest }) {\n // TODO: Simplify this, but TS wouldn't infer the input type for some reason\n return options.factory({\n inputs: inputs as Expand<ResolvedExtensionInputs<TInputs>>,\n ...rest,\n });\n },\n toString() {\n const parts: string[] = [];\n if (options.kind) {\n parts.push(`kind=${options.kind}`);\n }\n if (options.namespace) {\n parts.push(`namespace=${options.namespace}`);\n }\n if (options.name) {\n parts.push(`name=${options.name}`);\n }\n parts.push(`attachTo=${options.attachTo.id}@${options.attachTo.input}`);\n return `ExtensionDefinition{${parts.join(',')}}`;\n },\n } as InternalExtensionDefinition<TConfig>;\n}\n"],"names":[],"mappings":"AA6HO,SAAS,8BACd,SACsC,EAAA;AACtC,EAAA,MAAM,QAAW,GAAA,SAAA,CAAA;AACjB,EAAI,IAAA,QAAA,CAAS,WAAW,gCAAkC,EAAA;AACxD,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,iDAAA,EAAoD,SAAS,MAAM,CAAA,CAAA,CAAA;AAAA,KACrE,CAAA;AAAA,GACF;AACA,EAAI,IAAA,QAAA,CAAS,YAAY,IAAM,EAAA;AAC7B,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,oDAAA,EAAuD,SAAS,OAAO,CAAA,CAAA,CAAA;AAAA,KACzE,CAAA;AAAA,GACF;AACA,EAAO,OAAA,QAAA,CAAA;AACT,CAAA;AAGO,SAAS,gBAKd,OAC8B,EAAA;
|
|
1
|
+
{"version":3,"file":"createExtension.esm.js","sources":["../../src/wiring/createExtension.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { AppNode } from '../apis';\nimport { PortableSchema } from '../schema';\nimport { Expand } from '../types';\nimport { ExtensionDataRef } from './createExtensionDataRef';\nimport { ExtensionInput } from './createExtensionInput';\n\n/** @public */\nexport type AnyExtensionDataMap = {\n [name in string]: ExtensionDataRef<unknown, { optional?: true }>;\n};\n\n/** @public */\nexport type AnyExtensionInputMap = {\n [inputName in string]: ExtensionInput<\n AnyExtensionDataMap,\n { optional: boolean; singleton: boolean }\n >;\n};\n\n/**\n * Converts an extension data map into the matching concrete data values type.\n * @public\n */\nexport type ExtensionDataValues<TExtensionData extends AnyExtensionDataMap> = {\n [DataName in keyof TExtensionData as TExtensionData[DataName]['config'] extends {\n optional: true;\n }\n ? never\n : DataName]: TExtensionData[DataName]['T'];\n} & {\n [DataName in keyof TExtensionData as TExtensionData[DataName]['config'] extends {\n optional: true;\n }\n ? DataName\n : never]?: TExtensionData[DataName]['T'];\n};\n\n/**\n * Convert a single extension input into a matching resolved input.\n * @public\n */\nexport type ResolvedExtensionInput<TExtensionData extends AnyExtensionDataMap> =\n {\n node: AppNode;\n output: ExtensionDataValues<TExtensionData>;\n };\n\n/**\n * Converts an extension input map into a matching collection of resolved inputs.\n * @public\n */\nexport type ResolvedExtensionInputs<\n TInputs extends { [name in string]: ExtensionInput<any, any> },\n> = {\n [InputName in keyof TInputs]: false extends TInputs[InputName]['config']['singleton']\n ? Array<Expand<ResolvedExtensionInput<TInputs[InputName]['extensionData']>>>\n : false extends TInputs[InputName]['config']['optional']\n ? Expand<ResolvedExtensionInput<TInputs[InputName]['extensionData']>>\n : Expand<\n ResolvedExtensionInput<TInputs[InputName]['extensionData']> | undefined\n >;\n};\n\n/** @public */\nexport interface CreateExtensionOptions<\n TOutput extends AnyExtensionDataMap,\n TInputs extends AnyExtensionInputMap,\n TConfig,\n> {\n kind?: string;\n namespace?: string;\n name?: string;\n attachTo: { id: string; input: string };\n disabled?: boolean;\n inputs?: TInputs;\n output: TOutput;\n configSchema?: PortableSchema<TConfig>;\n factory(options: {\n node: AppNode;\n config: TConfig;\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n }): Expand<ExtensionDataValues<TOutput>>;\n}\n\n/** @public */\nexport interface ExtensionDefinition<TConfig> {\n $$type: '@backstage/ExtensionDefinition';\n readonly kind?: string;\n readonly namespace?: string;\n readonly name?: string;\n readonly attachTo: { id: string; input: string };\n readonly disabled: boolean;\n readonly configSchema?: PortableSchema<TConfig>;\n}\n\n/** @internal */\nexport interface InternalExtensionDefinition<TConfig>\n extends ExtensionDefinition<TConfig> {\n readonly version: 'v1';\n readonly inputs: AnyExtensionInputMap;\n readonly output: AnyExtensionDataMap;\n factory(options: {\n node: AppNode;\n config: TConfig;\n inputs: ResolvedExtensionInputs<any>;\n }): ExtensionDataValues<any>;\n}\n\n/** @internal */\nexport function toInternalExtensionDefinition<TConfig>(\n overrides: ExtensionDefinition<TConfig>,\n): InternalExtensionDefinition<TConfig> {\n const internal = overrides as InternalExtensionDefinition<TConfig>;\n if (internal.$$type !== '@backstage/ExtensionDefinition') {\n throw new Error(\n `Invalid extension definition instance, bad type '${internal.$$type}'`,\n );\n }\n if (internal.version !== 'v1') {\n throw new Error(\n `Invalid extension definition instance, bad version '${internal.version}'`,\n );\n }\n return internal;\n}\n\n/** @public */\nexport function createExtension<\n TOutput extends AnyExtensionDataMap,\n TInputs extends AnyExtensionInputMap,\n TConfig = never,\n>(\n options: CreateExtensionOptions<TOutput, TInputs, TConfig>,\n): ExtensionDefinition<TConfig> {\n return {\n $$type: '@backstage/ExtensionDefinition',\n version: 'v1',\n kind: options.kind,\n namespace: options.namespace,\n name: options.name,\n attachTo: options.attachTo,\n disabled: options.disabled ?? false,\n inputs: options.inputs ?? {},\n output: options.output,\n configSchema: options.configSchema,\n factory({ inputs, ...rest }) {\n // TODO: Simplify this, but TS wouldn't infer the input type for some reason\n return options.factory({\n inputs: inputs as Expand<ResolvedExtensionInputs<TInputs>>,\n ...rest,\n });\n },\n toString() {\n const parts: string[] = [];\n if (options.kind) {\n parts.push(`kind=${options.kind}`);\n }\n if (options.namespace) {\n parts.push(`namespace=${options.namespace}`);\n }\n if (options.name) {\n parts.push(`name=${options.name}`);\n }\n parts.push(`attachTo=${options.attachTo.id}@${options.attachTo.input}`);\n return `ExtensionDefinition{${parts.join(',')}}`;\n },\n } as InternalExtensionDefinition<TConfig>;\n}\n"],"names":[],"mappings":"AA6HO,SAAS,8BACd,SACsC,EAAA;AACtC,EAAA,MAAM,QAAW,GAAA,SAAA,CAAA;AACjB,EAAI,IAAA,QAAA,CAAS,WAAW,gCAAkC,EAAA;AACxD,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,iDAAA,EAAoD,SAAS,MAAM,CAAA,CAAA,CAAA;AAAA,KACrE,CAAA;AAAA,GACF;AACA,EAAI,IAAA,QAAA,CAAS,YAAY,IAAM,EAAA;AAC7B,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,oDAAA,EAAuD,SAAS,OAAO,CAAA,CAAA,CAAA;AAAA,KACzE,CAAA;AAAA,GACF;AACA,EAAO,OAAA,QAAA,CAAA;AACT,CAAA;AAGO,SAAS,gBAKd,OAC8B,EAAA;AAC9B,EAAO,OAAA;AAAA,IACL,MAAQ,EAAA,gCAAA;AAAA,IACR,OAAS,EAAA,IAAA;AAAA,IACT,MAAM,OAAQ,CAAA,IAAA;AAAA,IACd,WAAW,OAAQ,CAAA,SAAA;AAAA,IACnB,MAAM,OAAQ,CAAA,IAAA;AAAA,IACd,UAAU,OAAQ,CAAA,QAAA;AAAA,IAClB,QAAA,EAAU,QAAQ,QAAY,IAAA,KAAA;AAAA,IAC9B,MAAA,EAAQ,OAAQ,CAAA,MAAA,IAAU,EAAC;AAAA,IAC3B,QAAQ,OAAQ,CAAA,MAAA;AAAA,IAChB,cAAc,OAAQ,CAAA,YAAA;AAAA,IACtB,OAAQ,CAAA,EAAE,MAAQ,EAAA,GAAG,MAAQ,EAAA;AAE3B,MAAA,OAAO,QAAQ,OAAQ,CAAA;AAAA,QACrB,MAAA;AAAA,QACA,GAAG,IAAA;AAAA,OACJ,CAAA,CAAA;AAAA,KACH;AAAA,IACA,QAAW,GAAA;AACT,MAAA,MAAM,QAAkB,EAAC,CAAA;AACzB,MAAA,IAAI,QAAQ,IAAM,EAAA;AAChB,QAAA,KAAA,CAAM,IAAK,CAAA,CAAA,KAAA,EAAQ,OAAQ,CAAA,IAAI,CAAE,CAAA,CAAA,CAAA;AAAA,OACnC;AACA,MAAA,IAAI,QAAQ,SAAW,EAAA;AACrB,QAAA,KAAA,CAAM,IAAK,CAAA,CAAA,UAAA,EAAa,OAAQ,CAAA,SAAS,CAAE,CAAA,CAAA,CAAA;AAAA,OAC7C;AACA,MAAA,IAAI,QAAQ,IAAM,EAAA;AAChB,QAAA,KAAA,CAAM,IAAK,CAAA,CAAA,KAAA,EAAQ,OAAQ,CAAA,IAAI,CAAE,CAAA,CAAA,CAAA;AAAA,OACnC;AACA,MAAM,KAAA,CAAA,IAAA,CAAK,YAAY,OAAQ,CAAA,QAAA,CAAS,EAAE,CAAI,CAAA,EAAA,OAAA,CAAQ,QAAS,CAAA,KAAK,CAAE,CAAA,CAAA,CAAA;AACtE,MAAA,OAAO,CAAuB,oBAAA,EAAA,KAAA,CAAM,IAAK,CAAA,GAAG,CAAC,CAAA,CAAA,CAAA,CAAA;AAAA,KAC/C;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -3,8 +3,8 @@ function createExtensionInput(extensionData, config) {
|
|
|
3
3
|
$$type: "@backstage/ExtensionInput",
|
|
4
4
|
extensionData,
|
|
5
5
|
config: {
|
|
6
|
-
singleton: Boolean(config
|
|
7
|
-
optional: Boolean(config
|
|
6
|
+
singleton: Boolean(config?.singleton),
|
|
7
|
+
optional: Boolean(config?.optional)
|
|
8
8
|
}
|
|
9
9
|
};
|
|
10
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createExtensionInput.esm.js","sources":["../../src/wiring/createExtensionInput.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { AnyExtensionDataMap } from './createExtension';\n\n/** @public */\nexport interface ExtensionInput<\n TExtensionData extends AnyExtensionDataMap,\n TConfig extends { singleton: boolean; optional: boolean },\n> {\n $$type: '@backstage/ExtensionInput';\n extensionData: TExtensionData;\n config: TConfig;\n}\n\n/** @public */\nexport function createExtensionInput<\n TExtensionData extends AnyExtensionDataMap,\n TConfig extends { singleton?: boolean; optional?: boolean },\n>(\n extensionData: TExtensionData,\n config?: TConfig,\n): ExtensionInput<\n TExtensionData,\n {\n singleton: TConfig['singleton'] extends true ? true : false;\n optional: TConfig['optional'] extends true ? true : false;\n }\n> {\n return {\n $$type: '@backstage/ExtensionInput',\n extensionData,\n config: {\n singleton: Boolean(config?.singleton) as TConfig['singleton'] extends true\n ? true\n : false,\n optional: Boolean(config?.optional) as TConfig['optional'] extends true\n ? true\n : false,\n },\n };\n}\n"],"names":[],"mappings":"AA6BgB,SAAA,oBAAA,CAId,eACA,MAOA,EAAA;AACA,EAAO,OAAA;AAAA,IACL,MAAQ,EAAA,2BAAA;AAAA,IACR,aAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,SAAA,EAAW,OAAQ,CAAA,MAAA,
|
|
1
|
+
{"version":3,"file":"createExtensionInput.esm.js","sources":["../../src/wiring/createExtensionInput.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { AnyExtensionDataMap } from './createExtension';\n\n/** @public */\nexport interface ExtensionInput<\n TExtensionData extends AnyExtensionDataMap,\n TConfig extends { singleton: boolean; optional: boolean },\n> {\n $$type: '@backstage/ExtensionInput';\n extensionData: TExtensionData;\n config: TConfig;\n}\n\n/** @public */\nexport function createExtensionInput<\n TExtensionData extends AnyExtensionDataMap,\n TConfig extends { singleton?: boolean; optional?: boolean },\n>(\n extensionData: TExtensionData,\n config?: TConfig,\n): ExtensionInput<\n TExtensionData,\n {\n singleton: TConfig['singleton'] extends true ? true : false;\n optional: TConfig['optional'] extends true ? true : false;\n }\n> {\n return {\n $$type: '@backstage/ExtensionInput',\n extensionData,\n config: {\n singleton: Boolean(config?.singleton) as TConfig['singleton'] extends true\n ? true\n : false,\n optional: Boolean(config?.optional) as TConfig['optional'] extends true\n ? true\n : false,\n },\n };\n}\n"],"names":[],"mappings":"AA6BgB,SAAA,oBAAA,CAId,eACA,MAOA,EAAA;AACA,EAAO,OAAA;AAAA,IACL,MAAQ,EAAA,2BAAA;AAAA,IACR,aAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,SAAA,EAAW,OAAQ,CAAA,MAAA,EAAQ,SAAS,CAAA;AAAA,MAGpC,QAAA,EAAU,OAAQ,CAAA,MAAA,EAAQ,QAAQ,CAAA;AAAA,KAGpC;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { resolveExtensionDefinition } from './resolveExtensionDefinition.esm.js';
|
|
2
2
|
|
|
3
3
|
function createExtensionOverrides(options) {
|
|
4
|
-
var _a;
|
|
5
4
|
const extensions = options.extensions.map(
|
|
6
5
|
(def) => resolveExtensionDefinition(def)
|
|
7
6
|
);
|
|
8
|
-
const featureFlags =
|
|
7
|
+
const featureFlags = options.featureFlags ?? [];
|
|
9
8
|
return {
|
|
10
9
|
$$type: "@backstage/ExtensionOverrides",
|
|
11
10
|
version: "v1",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createExtensionOverrides.esm.js","sources":["../../src/wiring/createExtensionOverrides.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { ExtensionDefinition } from './createExtension';\nimport {\n Extension,\n resolveExtensionDefinition,\n} from './resolveExtensionDefinition';\nimport { ExtensionOverrides, FeatureFlagConfig } from './types';\n\n/** @public */\nexport interface ExtensionOverridesOptions {\n extensions: ExtensionDefinition<unknown>[];\n featureFlags?: FeatureFlagConfig[];\n}\n\n/** @internal */\nexport interface InternalExtensionOverrides extends ExtensionOverrides {\n readonly version: 'v1';\n readonly extensions: Extension<unknown>[];\n readonly featureFlags: FeatureFlagConfig[];\n}\n\n/** @public */\nexport function createExtensionOverrides(\n options: ExtensionOverridesOptions,\n): ExtensionOverrides {\n const extensions = options.extensions.map(def =>\n resolveExtensionDefinition(def),\n );\n const featureFlags = options.featureFlags ?? [];\n return {\n $$type: '@backstage/ExtensionOverrides',\n version: 'v1',\n extensions,\n featureFlags,\n toString() {\n const ex = extensions.map(String).join(',');\n const ff = featureFlags.map(f => f.name).join(',');\n return `ExtensionOverrides{extensions=[${ex}],featureFlags=[${ff}]}`;\n },\n } as InternalExtensionOverrides;\n}\n\n/** @internal */\nexport function toInternalExtensionOverrides(\n overrides: ExtensionOverrides,\n): InternalExtensionOverrides {\n const internal = overrides as InternalExtensionOverrides;\n if (internal.$$type !== '@backstage/ExtensionOverrides') {\n throw new Error(\n `Invalid extension overrides instance, bad type '${internal.$$type}'`,\n );\n }\n if (internal.version !== 'v1') {\n throw new Error(\n `Invalid extension overrides instance, bad version '${internal.version}'`,\n );\n }\n return internal;\n}\n"],"names":[],"mappings":";;AAqCO,SAAS,yBACd,OACoB,EAAA;
|
|
1
|
+
{"version":3,"file":"createExtensionOverrides.esm.js","sources":["../../src/wiring/createExtensionOverrides.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { ExtensionDefinition } from './createExtension';\nimport {\n Extension,\n resolveExtensionDefinition,\n} from './resolveExtensionDefinition';\nimport { ExtensionOverrides, FeatureFlagConfig } from './types';\n\n/** @public */\nexport interface ExtensionOverridesOptions {\n extensions: ExtensionDefinition<unknown>[];\n featureFlags?: FeatureFlagConfig[];\n}\n\n/** @internal */\nexport interface InternalExtensionOverrides extends ExtensionOverrides {\n readonly version: 'v1';\n readonly extensions: Extension<unknown>[];\n readonly featureFlags: FeatureFlagConfig[];\n}\n\n/** @public */\nexport function createExtensionOverrides(\n options: ExtensionOverridesOptions,\n): ExtensionOverrides {\n const extensions = options.extensions.map(def =>\n resolveExtensionDefinition(def),\n );\n const featureFlags = options.featureFlags ?? [];\n return {\n $$type: '@backstage/ExtensionOverrides',\n version: 'v1',\n extensions,\n featureFlags,\n toString() {\n const ex = extensions.map(String).join(',');\n const ff = featureFlags.map(f => f.name).join(',');\n return `ExtensionOverrides{extensions=[${ex}],featureFlags=[${ff}]}`;\n },\n } as InternalExtensionOverrides;\n}\n\n/** @internal */\nexport function toInternalExtensionOverrides(\n overrides: ExtensionOverrides,\n): InternalExtensionOverrides {\n const internal = overrides as InternalExtensionOverrides;\n if (internal.$$type !== '@backstage/ExtensionOverrides') {\n throw new Error(\n `Invalid extension overrides instance, bad type '${internal.$$type}'`,\n );\n }\n if (internal.version !== 'v1') {\n throw new Error(\n `Invalid extension overrides instance, bad version '${internal.version}'`,\n );\n }\n return internal;\n}\n"],"names":[],"mappings":";;AAqCO,SAAS,yBACd,OACoB,EAAA;AACpB,EAAM,MAAA,UAAA,GAAa,QAAQ,UAAW,CAAA,GAAA;AAAA,IAAI,CAAA,GAAA,KACxC,2BAA2B,GAAG,CAAA;AAAA,GAChC,CAAA;AACA,EAAM,MAAA,YAAA,GAAe,OAAQ,CAAA,YAAA,IAAgB,EAAC,CAAA;AAC9C,EAAO,OAAA;AAAA,IACL,MAAQ,EAAA,+BAAA;AAAA,IACR,OAAS,EAAA,IAAA;AAAA,IACT,UAAA;AAAA,IACA,YAAA;AAAA,IACA,QAAW,GAAA;AACT,MAAA,MAAM,KAAK,UAAW,CAAA,GAAA,CAAI,MAAM,CAAA,CAAE,KAAK,GAAG,CAAA,CAAA;AAC1C,MAAM,MAAA,EAAA,GAAK,aAAa,GAAI,CAAA,CAAA,CAAA,KAAK,EAAE,IAAI,CAAA,CAAE,KAAK,GAAG,CAAA,CAAA;AACjD,MAAO,OAAA,CAAA,+BAAA,EAAkC,EAAE,CAAA,gBAAA,EAAmB,EAAE,CAAA,EAAA,CAAA,CAAA;AAAA,KAClE;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { resolveExtensionDefinition } from './resolveExtensionDefinition.esm.js';
|
|
2
2
|
|
|
3
3
|
function createPlugin(options) {
|
|
4
|
-
|
|
5
|
-
const extensions = ((_a = options.extensions) != null ? _a : []).map(
|
|
4
|
+
const extensions = (options.extensions ?? []).map(
|
|
6
5
|
(def) => resolveExtensionDefinition(def, { namespace: options.id })
|
|
7
6
|
);
|
|
8
7
|
const extensionIds = extensions.map((e) => e.id);
|
|
@@ -22,9 +21,9 @@ function createPlugin(options) {
|
|
|
22
21
|
$$type: "@backstage/BackstagePlugin",
|
|
23
22
|
version: "v1",
|
|
24
23
|
id: options.id,
|
|
25
|
-
routes:
|
|
26
|
-
externalRoutes:
|
|
27
|
-
featureFlags:
|
|
24
|
+
routes: options.routes ?? {},
|
|
25
|
+
externalRoutes: options.externalRoutes ?? {},
|
|
26
|
+
featureFlags: options.featureFlags ?? [],
|
|
28
27
|
extensions,
|
|
29
28
|
toString() {
|
|
30
29
|
return `Plugin{id=${options.id}}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPlugin.esm.js","sources":["../../src/wiring/createPlugin.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { ExtensionDefinition } from './createExtension';\nimport {\n Extension,\n resolveExtensionDefinition,\n} from './resolveExtensionDefinition';\nimport {\n AnyExternalRoutes,\n AnyRoutes,\n BackstagePlugin,\n FeatureFlagConfig,\n} from './types';\n\n/** @public */\nexport interface PluginOptions<\n Routes extends AnyRoutes,\n ExternalRoutes extends AnyExternalRoutes,\n> {\n id: string;\n routes?: Routes;\n externalRoutes?: ExternalRoutes;\n extensions?: ExtensionDefinition<unknown>[];\n featureFlags?: FeatureFlagConfig[];\n}\n\n/** @public */\nexport interface InternalBackstagePlugin<\n Routes extends AnyRoutes = AnyRoutes,\n ExternalRoutes extends AnyExternalRoutes = AnyExternalRoutes,\n> extends BackstagePlugin<Routes, ExternalRoutes> {\n readonly version: 'v1';\n readonly extensions: Extension<unknown>[];\n readonly featureFlags: FeatureFlagConfig[];\n}\n\n/** @public */\nexport function createPlugin<\n Routes extends AnyRoutes = {},\n ExternalRoutes extends AnyExternalRoutes = {},\n>(\n options: PluginOptions<Routes, ExternalRoutes>,\n): BackstagePlugin<Routes, ExternalRoutes> {\n const extensions = (options.extensions ?? []).map(def =>\n resolveExtensionDefinition(def, { namespace: options.id }),\n );\n\n const extensionIds = extensions.map(e => e.id);\n if (extensionIds.length !== new Set(extensionIds).size) {\n const duplicates = Array.from(\n new Set(\n extensionIds.filter((id, index) => extensionIds.indexOf(id) !== index),\n ),\n );\n // TODO(Rugvip): This could provide some more information about the kind + name of the extensions\n throw new Error(\n `Plugin '${options.id}' provided duplicate extensions: ${duplicates.join(\n ', ',\n )}`,\n );\n }\n\n return {\n $$type: '@backstage/BackstagePlugin',\n version: 'v1',\n id: options.id,\n routes: options.routes ?? ({} as Routes),\n externalRoutes: options.externalRoutes ?? ({} as ExternalRoutes),\n featureFlags: options.featureFlags ?? [],\n extensions,\n toString() {\n return `Plugin{id=${options.id}}`;\n },\n } as InternalBackstagePlugin<Routes, ExternalRoutes>;\n}\n\n/** @internal */\nexport function toInternalBackstagePlugin(\n plugin: BackstagePlugin,\n): InternalBackstagePlugin {\n const internal = plugin as InternalBackstagePlugin;\n if (internal.$$type !== '@backstage/BackstagePlugin') {\n throw new Error(`Invalid plugin instance, bad type '${internal.$$type}'`);\n }\n if (internal.version !== 'v1') {\n throw new Error(\n `Invalid plugin instance, bad version '${internal.version}'`,\n );\n }\n return internal;\n}\n"],"names":[],"mappings":";;AAmDO,SAAS,aAId,OACyC,EAAA;
|
|
1
|
+
{"version":3,"file":"createPlugin.esm.js","sources":["../../src/wiring/createPlugin.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { ExtensionDefinition } from './createExtension';\nimport {\n Extension,\n resolveExtensionDefinition,\n} from './resolveExtensionDefinition';\nimport {\n AnyExternalRoutes,\n AnyRoutes,\n BackstagePlugin,\n FeatureFlagConfig,\n} from './types';\n\n/** @public */\nexport interface PluginOptions<\n Routes extends AnyRoutes,\n ExternalRoutes extends AnyExternalRoutes,\n> {\n id: string;\n routes?: Routes;\n externalRoutes?: ExternalRoutes;\n extensions?: ExtensionDefinition<unknown>[];\n featureFlags?: FeatureFlagConfig[];\n}\n\n/** @public */\nexport interface InternalBackstagePlugin<\n Routes extends AnyRoutes = AnyRoutes,\n ExternalRoutes extends AnyExternalRoutes = AnyExternalRoutes,\n> extends BackstagePlugin<Routes, ExternalRoutes> {\n readonly version: 'v1';\n readonly extensions: Extension<unknown>[];\n readonly featureFlags: FeatureFlagConfig[];\n}\n\n/** @public */\nexport function createPlugin<\n Routes extends AnyRoutes = {},\n ExternalRoutes extends AnyExternalRoutes = {},\n>(\n options: PluginOptions<Routes, ExternalRoutes>,\n): BackstagePlugin<Routes, ExternalRoutes> {\n const extensions = (options.extensions ?? []).map(def =>\n resolveExtensionDefinition(def, { namespace: options.id }),\n );\n\n const extensionIds = extensions.map(e => e.id);\n if (extensionIds.length !== new Set(extensionIds).size) {\n const duplicates = Array.from(\n new Set(\n extensionIds.filter((id, index) => extensionIds.indexOf(id) !== index),\n ),\n );\n // TODO(Rugvip): This could provide some more information about the kind + name of the extensions\n throw new Error(\n `Plugin '${options.id}' provided duplicate extensions: ${duplicates.join(\n ', ',\n )}`,\n );\n }\n\n return {\n $$type: '@backstage/BackstagePlugin',\n version: 'v1',\n id: options.id,\n routes: options.routes ?? ({} as Routes),\n externalRoutes: options.externalRoutes ?? ({} as ExternalRoutes),\n featureFlags: options.featureFlags ?? [],\n extensions,\n toString() {\n return `Plugin{id=${options.id}}`;\n },\n } as InternalBackstagePlugin<Routes, ExternalRoutes>;\n}\n\n/** @internal */\nexport function toInternalBackstagePlugin(\n plugin: BackstagePlugin,\n): InternalBackstagePlugin {\n const internal = plugin as InternalBackstagePlugin;\n if (internal.$$type !== '@backstage/BackstagePlugin') {\n throw new Error(`Invalid plugin instance, bad type '${internal.$$type}'`);\n }\n if (internal.version !== 'v1') {\n throw new Error(\n `Invalid plugin instance, bad version '${internal.version}'`,\n );\n }\n return internal;\n}\n"],"names":[],"mappings":";;AAmDO,SAAS,aAId,OACyC,EAAA;AACzC,EAAA,MAAM,UAAc,GAAA,CAAA,OAAA,CAAQ,UAAc,IAAA,EAAI,EAAA,GAAA;AAAA,IAAI,SAChD,0BAA2B,CAAA,GAAA,EAAK,EAAE,SAAW,EAAA,OAAA,CAAQ,IAAI,CAAA;AAAA,GAC3D,CAAA;AAEA,EAAA,MAAM,YAAe,GAAA,UAAA,CAAW,GAAI,CAAA,CAAA,CAAA,KAAK,EAAE,EAAE,CAAA,CAAA;AAC7C,EAAA,IAAI,aAAa,MAAW,KAAA,IAAI,GAAI,CAAA,YAAY,EAAE,IAAM,EAAA;AACtD,IAAA,MAAM,aAAa,KAAM,CAAA,IAAA;AAAA,MACvB,IAAI,GAAA;AAAA,QACF,YAAA,CAAa,OAAO,CAAC,EAAA,EAAI,UAAU,YAAa,CAAA,OAAA,CAAQ,EAAE,CAAA,KAAM,KAAK,CAAA;AAAA,OACvE;AAAA,KACF,CAAA;AAEA,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAW,QAAA,EAAA,OAAA,CAAQ,EAAE,CAAA,iCAAA,EAAoC,UAAW,CAAA,IAAA;AAAA,QAClE,IAAA;AAAA,OACD,CAAA,CAAA;AAAA,KACH,CAAA;AAAA,GACF;AAEA,EAAO,OAAA;AAAA,IACL,MAAQ,EAAA,4BAAA;AAAA,IACR,OAAS,EAAA,IAAA;AAAA,IACT,IAAI,OAAQ,CAAA,EAAA;AAAA,IACZ,MAAA,EAAQ,OAAQ,CAAA,MAAA,IAAW,EAAC;AAAA,IAC5B,cAAA,EAAgB,OAAQ,CAAA,cAAA,IAAmB,EAAC;AAAA,IAC5C,YAAA,EAAc,OAAQ,CAAA,YAAA,IAAgB,EAAC;AAAA,IACvC,UAAA;AAAA,IACA,QAAW,GAAA;AACT,MAAO,OAAA,CAAA,UAAA,EAAa,QAAQ,EAAE,CAAA,CAAA,CAAA,CAAA;AAAA,KAChC;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { toInternalExtensionDefinition } from './createExtension.esm.js';
|
|
2
2
|
|
|
3
3
|
function resolveExtensionDefinition(definition, context) {
|
|
4
|
-
var _a;
|
|
5
4
|
const internalDefinition = toInternalExtensionDefinition(definition);
|
|
6
5
|
const { name, kind, namespace: _, ...rest } = internalDefinition;
|
|
7
|
-
const namespace =
|
|
6
|
+
const namespace = internalDefinition.namespace ?? context?.namespace;
|
|
8
7
|
const namePart = name && namespace ? `${namespace}/${name}` : namespace || name;
|
|
9
8
|
if (!namePart) {
|
|
10
9
|
throw new Error(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveExtensionDefinition.esm.js","sources":["../../src/wiring/resolveExtensionDefinition.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { AppNode } from '../apis';\nimport {\n AnyExtensionDataMap,\n AnyExtensionInputMap,\n ExtensionDataValues,\n ExtensionDefinition,\n ResolvedExtensionInputs,\n toInternalExtensionDefinition,\n} from './createExtension';\nimport { PortableSchema } from '../schema';\n\n/** @public */\nexport interface Extension<TConfig> {\n $$type: '@backstage/Extension';\n readonly id: string;\n readonly attachTo: { id: string; input: string };\n readonly disabled: boolean;\n readonly configSchema?: PortableSchema<TConfig>;\n}\n\n/** @internal */\nexport interface InternalExtension<TConfig> extends Extension<TConfig> {\n readonly version: 'v1';\n readonly inputs: AnyExtensionInputMap;\n readonly output: AnyExtensionDataMap;\n factory(options: {\n node: AppNode;\n config: TConfig;\n inputs: ResolvedExtensionInputs<any>;\n }): ExtensionDataValues<any>;\n}\n\n/** @internal */\nexport function toInternalExtension<TConfig>(\n overrides: Extension<TConfig>,\n): InternalExtension<TConfig> {\n const internal = overrides as InternalExtension<TConfig>;\n if (internal.$$type !== '@backstage/Extension') {\n throw new Error(\n `Invalid extension instance, bad type '${internal.$$type}'`,\n );\n }\n if (internal.version !== 'v1') {\n throw new Error(\n `Invalid extension instance, bad version '${internal.version}'`,\n );\n }\n return internal;\n}\n\n/** @internal */\nexport function resolveExtensionDefinition<TConfig>(\n definition: ExtensionDefinition<TConfig>,\n context?: { namespace?: string },\n): Extension<TConfig> {\n const internalDefinition = toInternalExtensionDefinition(definition);\n const { name, kind, namespace: _, ...rest } = internalDefinition;\n const namespace = internalDefinition.namespace ?? context?.namespace;\n\n const namePart =\n name && namespace ? `${namespace}/${name}` : namespace || name;\n if (!namePart) {\n throw new Error(\n `Extension must declare an explicit namespace or name as it could not be resolved from context, kind=${kind} namespace=${namespace} name=${name}`,\n );\n }\n\n const id = kind ? `${kind}:${namePart}` : namePart;\n\n return {\n ...rest,\n $$type: '@backstage/Extension',\n version: 'v1',\n id,\n toString() {\n return `Extension{id=${id}}`;\n },\n } as Extension<TConfig>;\n}\n"],"names":[],"mappings":";;AAmEgB,SAAA,0BAAA,CACd,YACA,OACoB,EAAA;
|
|
1
|
+
{"version":3,"file":"resolveExtensionDefinition.esm.js","sources":["../../src/wiring/resolveExtensionDefinition.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { AppNode } from '../apis';\nimport {\n AnyExtensionDataMap,\n AnyExtensionInputMap,\n ExtensionDataValues,\n ExtensionDefinition,\n ResolvedExtensionInputs,\n toInternalExtensionDefinition,\n} from './createExtension';\nimport { PortableSchema } from '../schema';\n\n/** @public */\nexport interface Extension<TConfig> {\n $$type: '@backstage/Extension';\n readonly id: string;\n readonly attachTo: { id: string; input: string };\n readonly disabled: boolean;\n readonly configSchema?: PortableSchema<TConfig>;\n}\n\n/** @internal */\nexport interface InternalExtension<TConfig> extends Extension<TConfig> {\n readonly version: 'v1';\n readonly inputs: AnyExtensionInputMap;\n readonly output: AnyExtensionDataMap;\n factory(options: {\n node: AppNode;\n config: TConfig;\n inputs: ResolvedExtensionInputs<any>;\n }): ExtensionDataValues<any>;\n}\n\n/** @internal */\nexport function toInternalExtension<TConfig>(\n overrides: Extension<TConfig>,\n): InternalExtension<TConfig> {\n const internal = overrides as InternalExtension<TConfig>;\n if (internal.$$type !== '@backstage/Extension') {\n throw new Error(\n `Invalid extension instance, bad type '${internal.$$type}'`,\n );\n }\n if (internal.version !== 'v1') {\n throw new Error(\n `Invalid extension instance, bad version '${internal.version}'`,\n );\n }\n return internal;\n}\n\n/** @internal */\nexport function resolveExtensionDefinition<TConfig>(\n definition: ExtensionDefinition<TConfig>,\n context?: { namespace?: string },\n): Extension<TConfig> {\n const internalDefinition = toInternalExtensionDefinition(definition);\n const { name, kind, namespace: _, ...rest } = internalDefinition;\n const namespace = internalDefinition.namespace ?? context?.namespace;\n\n const namePart =\n name && namespace ? `${namespace}/${name}` : namespace || name;\n if (!namePart) {\n throw new Error(\n `Extension must declare an explicit namespace or name as it could not be resolved from context, kind=${kind} namespace=${namespace} name=${name}`,\n );\n }\n\n const id = kind ? `${kind}:${namePart}` : namePart;\n\n return {\n ...rest,\n $$type: '@backstage/Extension',\n version: 'v1',\n id,\n toString() {\n return `Extension{id=${id}}`;\n },\n } as Extension<TConfig>;\n}\n"],"names":[],"mappings":";;AAmEgB,SAAA,0BAAA,CACd,YACA,OACoB,EAAA;AACpB,EAAM,MAAA,kBAAA,GAAqB,8BAA8B,UAAU,CAAA,CAAA;AACnE,EAAA,MAAM,EAAE,IAAM,EAAA,IAAA,EAAM,WAAW,CAAG,EAAA,GAAG,MAAS,GAAA,kBAAA,CAAA;AAC9C,EAAM,MAAA,SAAA,GAAY,kBAAmB,CAAA,SAAA,IAAa,OAAS,EAAA,SAAA,CAAA;AAE3D,EAAM,MAAA,QAAA,GACJ,QAAQ,SAAY,GAAA,CAAA,EAAG,SAAS,CAAI,CAAA,EAAA,IAAI,KAAK,SAAa,IAAA,IAAA,CAAA;AAC5D,EAAA,IAAI,CAAC,QAAU,EAAA;AACb,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAuG,oGAAA,EAAA,IAAI,CAAc,WAAA,EAAA,SAAS,SAAS,IAAI,CAAA,CAAA;AAAA,KACjJ,CAAA;AAAA,GACF;AAEA,EAAA,MAAM,KAAK,IAAO,GAAA,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,QAAQ,CAAK,CAAA,GAAA,QAAA,CAAA;AAE1C,EAAO,OAAA;AAAA,IACL,GAAG,IAAA;AAAA,IACH,MAAQ,EAAA,sBAAA;AAAA,IACR,OAAS,EAAA,IAAA;AAAA,IACT,EAAA;AAAA,IACA,QAAW,GAAA;AACT,MAAA,OAAO,gBAAgB,EAAE,CAAA,CAAA,CAAA,CAAA;AAAA,KAC3B;AAAA,GACF,CAAA;AACF;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/frontend-plugin-api",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.6-next.1",
|
|
4
4
|
"backstage": {
|
|
5
5
|
"role": "web-library"
|
|
6
6
|
},
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"test": "backstage-cli package test"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@backstage/core-components": "^0.14.
|
|
35
|
-
"@backstage/core-plugin-api": "^1.9.
|
|
34
|
+
"@backstage/core-components": "^0.14.8-next.1",
|
|
35
|
+
"@backstage/core-plugin-api": "^1.9.3-next.0",
|
|
36
36
|
"@backstage/types": "^1.1.1",
|
|
37
37
|
"@backstage/version-bridge": "^1.0.8",
|
|
38
38
|
"@material-ui/core": "^4.12.4",
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
"zod-to-json-schema": "^3.21.4"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@backstage/cli": "^0.26.
|
|
46
|
-
"@backstage/frontend-app-api": "^0.7.
|
|
47
|
-
"@backstage/frontend-test-utils": "^0.1.
|
|
48
|
-
"@backstage/test-utils": "^1.5.
|
|
45
|
+
"@backstage/cli": "^0.26.7-next.2",
|
|
46
|
+
"@backstage/frontend-app-api": "^0.7.1-next.1",
|
|
47
|
+
"@backstage/frontend-test-utils": "^0.1.8-next.1",
|
|
48
|
+
"@backstage/test-utils": "^1.5.6-next.1",
|
|
49
49
|
"@testing-library/jest-dom": "^6.0.0",
|
|
50
50
|
"@testing-library/react": "^15.0.0",
|
|
51
51
|
"history": "^5.3.0"
|