@backstage/core-plugin-api 1.5.0 → 1.5.1-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 CHANGED
@@ -1,5 +1,25 @@
1
1
  # @backstage/core-plugin-api
2
2
 
3
+ ## 1.5.1-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 2898b6c8d52: Minor type tweaks for TypeScript 5.0
8
+ - Updated dependencies
9
+ - @backstage/config@1.0.7
10
+ - @backstage/types@1.0.2
11
+ - @backstage/version-bridge@1.0.4-next.0
12
+
13
+ ## 1.5.1-next.0
14
+
15
+ ### Patch Changes
16
+
17
+ - e0c6e8b9c3c: Update peer dependencies
18
+ - Updated dependencies
19
+ - @backstage/version-bridge@1.0.4-next.0
20
+ - @backstage/config@1.0.7
21
+ - @backstage/types@1.0.2
22
+
3
23
  ## 1.5.0
4
24
 
5
25
  ### Minor Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/core-plugin-api",
3
- "version": "1.5.0",
3
+ "version": "1.5.1-next.1",
4
4
  "main": "../dist/alpha.esm.js",
5
5
  "module": "../dist/alpha.esm.js",
6
6
  "types": "../dist/alpha.d.ts"
package/dist/alpha.esm.js CHANGED
@@ -1,35 +1,4 @@
1
- import { createVersionedContext, createVersionedValueMap, useVersionedContext } from '@backstage/version-bridge';
2
- import React from 'react';
3
-
4
- const contextKey = "plugin-context";
5
- const PluginProvider = (props) => {
6
- const { children, plugin } = props;
7
- const { Provider } = createVersionedContext(contextKey);
8
- return /* @__PURE__ */ React.createElement(
9
- Provider,
10
- {
11
- value: createVersionedValueMap({
12
- 1: {
13
- plugin
14
- }
15
- })
16
- },
17
- children
18
- );
19
- };
20
- function usePluginOptions() {
21
- const versionedHolder = useVersionedContext(
22
- contextKey
23
- );
24
- if (!versionedHolder) {
25
- throw new Error("Plugin Options context is not available");
26
- }
27
- const value = versionedHolder.atVersion(1);
28
- if (!value) {
29
- throw new Error("Plugin Options v1 is not available");
30
- }
31
- return value.plugin.getPluginOptions();
32
- }
33
-
34
- export { PluginProvider, usePluginOptions };
1
+ export { P as PluginProvider, u as usePluginOptions } from './esm/usePluginOptions-68e31f9f.esm.js';
2
+ import '@backstage/version-bridge';
3
+ import 'react';
35
4
  //# sourceMappingURL=alpha.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"alpha.esm.js","sources":["../src/plugin-options/usePluginOptions.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createVersionedContext,\n createVersionedValueMap,\n useVersionedContext,\n} from '@backstage/version-bridge';\nimport { BackstagePlugin } from '@backstage/core-plugin-api';\nimport React, { ReactNode } from 'react';\n\nconst contextKey: string = 'plugin-context';\n\n/**\n * Properties for the PluginProvider component.\n *\n * @alpha\n */\nexport interface PluginOptionsProviderProps {\n children: ReactNode;\n plugin?: BackstagePlugin;\n}\n\n/**\n * Contains the plugin configuration.\n *\n * @alpha\n */\nexport const PluginProvider = (\n props: PluginOptionsProviderProps,\n): JSX.Element => {\n const { children, plugin } = props;\n\n const { Provider } = createVersionedContext<{\n 1: { plugin: BackstagePlugin | undefined };\n }>(contextKey);\n\n return (\n <Provider\n value={createVersionedValueMap({\n 1: {\n plugin,\n },\n })}\n >\n {children}\n </Provider>\n );\n};\n\n/**\n * Grab the current entity from the context, throws if the entity has not yet been loaded\n * or is not available.\n *\n * @alpha\n */\nexport function usePluginOptions<\n TPluginOptions extends {} = {},\n>(): TPluginOptions {\n const versionedHolder = useVersionedContext<{ 1: TPluginOptions }>(\n contextKey,\n );\n\n if (!versionedHolder) {\n throw new Error('Plugin Options context is not available');\n }\n\n const value = versionedHolder.atVersion(1);\n if (!value) {\n throw new Error('Plugin Options v1 is not available');\n }\n\n return (\n value as unknown as {\n plugin: {\n getPluginOptions(): {};\n };\n }\n ).plugin.getPluginOptions() as TPluginOptions;\n}\n"],"names":[],"mappings":";;;AAwBA,MAAM,UAAqB,GAAA,gBAAA,CAAA;AAiBd,MAAA,cAAA,GAAiB,CAC5B,KACgB,KAAA;AAChB,EAAM,MAAA,EAAE,QAAU,EAAA,MAAA,EAAW,GAAA,KAAA,CAAA;AAE7B,EAAA,MAAM,EAAE,QAAA,EAAa,GAAA,sBAAA,CAElB,UAAU,CAAA,CAAA;AAEb,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,OAAO,uBAAwB,CAAA;AAAA,QAC7B,CAAG,EAAA;AAAA,UACD,MAAA;AAAA,SACF;AAAA,OACD,CAAA;AAAA,KAAA;AAAA,IAEA,QAAA;AAAA,GACH,CAAA;AAEJ,EAAA;AAQO,SAAS,gBAEI,GAAA;AAClB,EAAA,MAAM,eAAkB,GAAA,mBAAA;AAAA,IACtB,UAAA;AAAA,GACF,CAAA;AAEA,EAAA,IAAI,CAAC,eAAiB,EAAA;AACpB,IAAM,MAAA,IAAI,MAAM,yCAAyC,CAAA,CAAA;AAAA,GAC3D;AAEA,EAAM,MAAA,KAAA,GAAQ,eAAgB,CAAA,SAAA,CAAU,CAAC,CAAA,CAAA;AACzC,EAAA,IAAI,CAAC,KAAO,EAAA;AACV,IAAM,MAAA,IAAI,MAAM,oCAAoC,CAAA,CAAA;AAAA,GACtD;AAEA,EACE,OAAA,KAAA,CAKA,OAAO,gBAAiB,EAAA,CAAA;AAC5B;;;;"}
1
+ {"version":3,"file":"alpha.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -0,0 +1,35 @@
1
+ import { createVersionedContext, createVersionedValueMap, useVersionedContext } from '@backstage/version-bridge';
2
+ import React from 'react';
3
+
4
+ const contextKey = "plugin-context";
5
+ const PluginProvider = (props) => {
6
+ const { children, plugin } = props;
7
+ const { Provider } = createVersionedContext(contextKey);
8
+ return /* @__PURE__ */ React.createElement(
9
+ Provider,
10
+ {
11
+ value: createVersionedValueMap({
12
+ 1: {
13
+ plugin
14
+ }
15
+ })
16
+ },
17
+ children
18
+ );
19
+ };
20
+ function usePluginOptions() {
21
+ const versionedHolder = useVersionedContext(
22
+ contextKey
23
+ );
24
+ if (!versionedHolder) {
25
+ throw new Error("Plugin Options context is not available");
26
+ }
27
+ const value = versionedHolder.atVersion(1);
28
+ if (!value) {
29
+ throw new Error("Plugin Options v1 is not available");
30
+ }
31
+ return value.plugin.getPluginOptions();
32
+ }
33
+
34
+ export { PluginProvider as P, usePluginOptions as u };
35
+ //# sourceMappingURL=usePluginOptions-68e31f9f.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePluginOptions-68e31f9f.esm.js","sources":["../../src/plugin-options/usePluginOptions.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createVersionedContext,\n createVersionedValueMap,\n useVersionedContext,\n} from '@backstage/version-bridge';\nimport { BackstagePlugin } from '@backstage/core-plugin-api';\nimport React, { ReactNode } from 'react';\n\nconst contextKey: string = 'plugin-context';\n\n/**\n * Properties for the PluginProvider component.\n *\n * @alpha\n */\nexport interface PluginOptionsProviderProps {\n children: ReactNode;\n plugin?: BackstagePlugin;\n}\n\n/**\n * Contains the plugin configuration.\n *\n * @alpha\n */\nexport const PluginProvider = (\n props: PluginOptionsProviderProps,\n): JSX.Element => {\n const { children, plugin } = props;\n\n const { Provider } = createVersionedContext<{\n 1: { plugin: BackstagePlugin | undefined };\n }>(contextKey);\n\n return (\n <Provider\n value={createVersionedValueMap({\n 1: {\n plugin,\n },\n })}\n >\n {children}\n </Provider>\n );\n};\n\n/**\n * Grab the current entity from the context, throws if the entity has not yet been loaded\n * or is not available.\n *\n * @alpha\n */\nexport function usePluginOptions<\n TPluginOptions extends {} = {},\n>(): TPluginOptions {\n const versionedHolder = useVersionedContext<{ 1: TPluginOptions }>(\n contextKey,\n );\n\n if (!versionedHolder) {\n throw new Error('Plugin Options context is not available');\n }\n\n const value = versionedHolder.atVersion(1);\n if (!value) {\n throw new Error('Plugin Options v1 is not available');\n }\n\n return (\n value as unknown as {\n plugin: {\n getPluginOptions(): {};\n };\n }\n ).plugin.getPluginOptions() as TPluginOptions;\n}\n"],"names":[],"mappings":";;;AAwBA,MAAM,UAAqB,GAAA,gBAAA,CAAA;AAiBd,MAAA,cAAA,GAAiB,CAC5B,KACgB,KAAA;AAChB,EAAM,MAAA,EAAE,QAAU,EAAA,MAAA,EAAW,GAAA,KAAA,CAAA;AAE7B,EAAA,MAAM,EAAE,QAAA,EAAa,GAAA,sBAAA,CAElB,UAAU,CAAA,CAAA;AAEb,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,OAAO,uBAAwB,CAAA;AAAA,QAC7B,CAAG,EAAA;AAAA,UACD,MAAA;AAAA,SACF;AAAA,OACD,CAAA;AAAA,KAAA;AAAA,IAEA,QAAA;AAAA,GACH,CAAA;AAEJ,EAAA;AAQO,SAAS,gBAEI,GAAA;AAClB,EAAA,MAAM,eAAkB,GAAA,mBAAA;AAAA,IACtB,UAAA;AAAA,GACF,CAAA;AAEA,EAAA,IAAI,CAAC,eAAiB,EAAA;AACpB,IAAM,MAAA,IAAI,MAAM,yCAAyC,CAAA,CAAA;AAAA,GAC3D;AAEA,EAAM,MAAA,KAAA,GAAQ,eAAgB,CAAA,SAAA,CAAU,CAAC,CAAA,CAAA;AACzC,EAAA,IAAI,CAAC,KAAO,EAAA;AACV,IAAM,MAAA,IAAI,MAAM,oCAAoC,CAAA,CAAA;AAAA,GACtD;AAEA,EACE,OAAA,KAAA,CAKA,OAAO,gBAAiB,EAAA,CAAA;AAC5B;;;;"}