@axis-backstage/plugin-readme 0.12.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,113 @@
1
+ # @axis-backstage/plugin-readme
2
+
3
+ ## 0.14.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 86c01b7: Bumped to Backstage 1.40
8
+
9
+ ## 0.13.0
10
+
11
+ ### Minor Changes
12
+
13
+ - ede8341: Updated to Backstage v1.36.1.
14
+
15
+ ## 0.12.0
16
+
17
+ ### Minor Changes
18
+
19
+ - 0726c03: Created the isReadmeAvailable function that returns false if no README content is found due to 404-error. If it returns false, no ReadmeCard is rendered in EntityPage. Also updated the error response from backend to be a NotFoundError.
20
+
21
+ ## 0.11.0
22
+
23
+ ### Minor Changes
24
+
25
+ - 3d15d61: Add new maxHeight property to ReadmeCard component
26
+
27
+ ## 0.10.0
28
+
29
+ ### Minor Changes
30
+
31
+ - 6fd284d: Updated to Backstage v1.30.1.
32
+
33
+ ## 0.9.0
34
+
35
+ ### Minor Changes
36
+
37
+ - 0b948ea: Generate pluginIds for plugins and bumping @backstage/cli
38
+
39
+ ## 0.8.0
40
+
41
+ ### Minor Changes
42
+
43
+ - 916589b: Bumped Backstage to v.27.7 and removed the TechRadar plugin since it was not used and caused problems with the new version.
44
+
45
+ ## 0.7.1
46
+
47
+ ### Patch Changes
48
+
49
+ - 0535af4: Bumped backstage dependencies to match 1.26.0
50
+
51
+ ## 0.7.0
52
+
53
+ ### Minor Changes
54
+
55
+ - 371f5fd: Readme backend APIs adjusted to consume entityRef as /:kind/:namespace/:name. Fixes a 404 routing issue where a proxy like oauth2Proxy could decode the URI encoded path parameter /:entityRef known to contain the reserved path delimiter '/'.
56
+
57
+ ## 0.6.0
58
+
59
+ ### Minor Changes
60
+
61
+ - 603304b: Updated the max height in case of variant `fullHeight` to be `none` by default. That is needed to really occupy the full height of the container.
62
+
63
+ ## 0.5.4
64
+
65
+ ### Patch Changes
66
+
67
+ - ae965c0: Fix broken workspace dependencies
68
+
69
+ ## 0.5.3
70
+
71
+ ### Patch Changes
72
+
73
+ - e6a9982: Troubleshooting "no readme file" error
74
+ - f09fe96: Added fullpage support
75
+ - b3faeda: Fixed so that Readme Dialog always have a min width. In that case, if it is not smuch markdown content, the dialog wont be weirdly small.
76
+
77
+ ## 0.5.2
78
+
79
+ ### Patch Changes
80
+
81
+ - 050e48d: Replace all Mui Grid v1 with v2
82
+
83
+ ## 0.5.1
84
+
85
+ ### Patch Changes
86
+
87
+ - 0613d84: Updated the notes in the README.md about backend installation and setup in Jira Dashboard plugin and README plugin
88
+ - b445aaa: Update @mui & @emotion dependencies
89
+
90
+ ## 0.5.0
91
+
92
+ ### Minor Changes
93
+
94
+ - 08961a1: Bump to react v.18 in app and plugins, and updated dependencies. "peer" is now react 18 + 17. Removed react v. 16.13.1
95
+
96
+ ## 0.4.0
97
+
98
+ ### Minor Changes
99
+
100
+ - 864d983: Bumped Backstage version to v.1.22.0
101
+
102
+ ## 0.3.0
103
+
104
+ ### Minor Changes
105
+
106
+ - 23ff76a: Bumped Backstage version to v.1.21.0 in whole monorepo
107
+ - 7d79c04: Bumped Readme frontend plugin to use Material UI v.5 components. Made necessary changes to the code.
108
+
109
+ ## 0.2.0
110
+
111
+ ### Minor Changes
112
+
113
+ - a67c963: Bumped Backstage to version 1.20.3
@@ -1 +1 @@
1
- {"version":3,"file":"ReadmeApi.esm.js","sources":["../../src/api/ReadmeApi.tsx"],"sourcesContent":["import { createApiRef } from '@backstage/core-plugin-api';\n\nexport const readmeApiRef = createApiRef<ReadmeApi>({\n id: 'plugin.readme',\n});\n\nexport type ReadmeApi = {\n getReadmeContent(entityRef: string): Promise<[string, string]>;\n};\n"],"names":[],"mappings":";;AAEO,MAAM,eAAe,YAAwB,CAAA;AAAA,EAClD,EAAI,EAAA,eAAA;AACN,CAAC;;;;"}
1
+ {"version":3,"file":"ReadmeApi.esm.js","sources":["../../src/api/ReadmeApi.tsx"],"sourcesContent":["import { createApiRef } from '@backstage/core-plugin-api';\n\nexport const readmeApiRef = createApiRef<ReadmeApi>({\n id: 'plugin.readme',\n});\n\nexport type ReadmeApi = {\n getReadmeContent(entityRef: string): Promise<[string, string]>;\n};\n"],"names":[],"mappings":";;AAEO,MAAM,eAAe,YAAwB,CAAA;AAAA,EAClD,EAAI,EAAA;AACN,CAAC;;;;"}
@@ -1,4 +1,4 @@
1
- import { stringifyEntityRef, parseEntityRef, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
1
+ import { parseEntityRef, DEFAULT_NAMESPACE, stringifyEntityRef } from '@backstage/catalog-model';
2
2
  import { ResponseError } from '@backstage/errors';
3
3
  import { readmeApiRef } from './ReadmeApi.esm.js';
4
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"ReadmeClient.esm.js","sources":["../../src/api/ReadmeClient.tsx"],"sourcesContent":["import {\n ApiHolder,\n DiscoveryApi,\n FetchApi,\n IdentityApi,\n} from '@backstage/core-plugin-api';\nimport {\n DEFAULT_NAMESPACE,\n Entity,\n parseEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { ResponseError } from '@backstage/errors';\nimport { ReadmeApi, readmeApiRef } from './ReadmeApi';\n\n/**\n * Checks if a README is available for the given entity by making a request to the backend.\nIf the backend returns a 404 NotFound error, it indicates that no README is available for the entity.\n@param entity - The entity for which to check the README availability.\n@param context - The context providing access to the API holder.\n@returns A promise that resolves to true if the README is available, or false if not found (404).\n * @public\n */\nexport const isReadmeAvailable = async (\n entity: Entity,\n context: { apis: ApiHolder },\n): Promise<boolean> => {\n const readmeClient = context.apis.get(readmeApiRef);\n\n if (readmeClient === undefined) {\n return false;\n }\n\n try {\n await readmeClient.getReadmeContent(stringifyEntityRef(entity));\n } catch (error) {\n if (error instanceof ResponseError && error.statusCode === 404) {\n return false;\n }\n }\n return true;\n};\n\nexport class ReadmeClient implements ReadmeApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n private readonly identityApi: IdentityApi;\n\n constructor(options: {\n discoveryApi: DiscoveryApi;\n fetchApi: FetchApi;\n identityApi: IdentityApi;\n }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi;\n this.identityApi = options.identityApi;\n }\n\n async getReadmeContent(entityRef: string): Promise<[string, string]> {\n const { token } = await this.identityApi.getCredentials();\n const baseUrl = await this.discoveryApi.getBaseUrl('readme');\n\n const { kind, name, namespace } = parseEntityRef(entityRef, {\n defaultNamespace: DEFAULT_NAMESPACE,\n });\n\n const resp = await this.fetchApi.fetch(\n `${baseUrl}/${kind}/${namespace}/${name}`,\n {\n method: 'GET',\n headers: { Authorization: `Bearer ${token}` },\n },\n );\n\n if (resp.ok) {\n return [\n await resp.text(),\n resp.headers.get('Content-Type') || 'text/plain',\n ];\n }\n\n throw await ResponseError.fromResponse(resp);\n }\n}\n"],"names":[],"mappings":";;;;AAuBa,MAAA,iBAAA,GAAoB,OAC/B,MAAA,EACA,OACqB,KAAA;AACrB,EAAA,MAAM,YAAe,GAAA,OAAA,CAAQ,IAAK,CAAA,GAAA,CAAI,YAAY,CAAA,CAAA;AAElD,EAAA,IAAI,iBAAiB,KAAW,CAAA,EAAA;AAC9B,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AAEA,EAAI,IAAA;AACF,IAAA,MAAM,YAAa,CAAA,gBAAA,CAAiB,kBAAmB,CAAA,MAAM,CAAC,CAAA,CAAA;AAAA,WACvD,KAAO,EAAA;AACd,IAAA,IAAI,KAAiB,YAAA,aAAA,IAAiB,KAAM,CAAA,UAAA,KAAe,GAAK,EAAA;AAC9D,MAAO,OAAA,KAAA,CAAA;AAAA,KACT;AAAA,GACF;AACA,EAAO,OAAA,IAAA,CAAA;AACT,EAAA;AAEO,MAAM,YAAkC,CAAA;AAAA,EAC5B,YAAA,CAAA;AAAA,EACA,QAAA,CAAA;AAAA,EACA,WAAA,CAAA;AAAA,EAEjB,YAAY,OAIT,EA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,\n FetchApi,\n IdentityApi,\n} from '@backstage/core-plugin-api';\nimport {\n DEFAULT_NAMESPACE,\n Entity,\n parseEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { ResponseError } from '@backstage/errors';\nimport { ReadmeApi, readmeApiRef } from './ReadmeApi';\n\n/**\n * Checks if a README is available for the given entity by making a request to the backend.\nIf the backend returns a 404 NotFound error, it indicates that no README is available for the entity.\n@param entity - The entity for which to check the README availability.\n@param context - The context providing access to the API holder.\n@returns A promise that resolves to true if the README is available, or false if not found (404).\n * @public\n */\nexport const isReadmeAvailable = async (\n entity: Entity,\n context: { apis: ApiHolder },\n): Promise<boolean> => {\n const readmeClient = context.apis.get(readmeApiRef);\n\n if (readmeClient === undefined) {\n return false;\n }\n\n try {\n await readmeClient.getReadmeContent(stringifyEntityRef(entity));\n } catch (error) {\n if (error instanceof ResponseError && error.statusCode === 404) {\n return false;\n }\n }\n return true;\n};\n\nexport class ReadmeClient implements ReadmeApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n private readonly identityApi: IdentityApi;\n\n constructor(options: {\n discoveryApi: DiscoveryApi;\n fetchApi: FetchApi;\n identityApi: IdentityApi;\n }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi;\n this.identityApi = options.identityApi;\n }\n\n async getReadmeContent(entityRef: string): Promise<[string, string]> {\n const { token } = await this.identityApi.getCredentials();\n const baseUrl = await this.discoveryApi.getBaseUrl('readme');\n\n const { kind, name, namespace } = parseEntityRef(entityRef, {\n defaultNamespace: DEFAULT_NAMESPACE,\n });\n\n const resp = await this.fetchApi.fetch(\n `${baseUrl}/${kind}/${namespace}/${name}`,\n {\n method: 'GET',\n headers: { Authorization: `Bearer ${token}` },\n },\n );\n\n if (resp.ok) {\n return [\n await resp.text(),\n resp.headers.get('Content-Type') || 'text/plain',\n ];\n }\n\n throw await ResponseError.fromResponse(resp);\n }\n}\n"],"names":[],"mappings":";;;;AAuBa,MAA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QACE,MAAQ,EAAA,KAAA;AAAA,QACR,OAAS,EAAA,EAAE,aAAe,EAAA,CAAA,OAAA,EAAU,KAAK,CAAG,CAAA;AAAA;AAC9C,KACF;AAEA,IAAA,IAAI,KAAK,EAAI,EAAA;AACX,MAAO,OAAA;AAAA,QACL,MAAM,KAAK,IAAK,EAAA;AAAA,QAChB,IAAK,CAAA,OAAA,CAAQ,GAAI,CAAA,cAAc,CAAK,IAAA;AAAA,OACtC;AAAA;AAGF,IAAM,MAAA,MAAM,aAAc,CAAA,YAAA,CAAa,IAAI,CAAA;AAAA;AAE/C;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { useEntity } from '@backstage/plugin-catalog-react';
3
3
  import { useApi } from '@backstage/core-plugin-api';
4
4
  import { Progress, Link, ResponseErrorPanel, ErrorPanel, MarkdownContent, CodeSnippet } from '@backstage/core-components';
@@ -28,26 +28,37 @@ const FetchComponent = () => {
28
28
  [entity]
29
29
  );
30
30
  if (loading) {
31
- return /* @__PURE__ */ React.createElement(Progress, null);
31
+ return /* @__PURE__ */ jsx(Progress, {});
32
32
  }
33
33
  if (error instanceof ResponseError) {
34
34
  if (error.statusCode === 404) {
35
- return /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Typography, { pb: 2, variant: "body2" }, "No README.md file found at source location:", " ", location && /* @__PURE__ */ React.createElement("strong", null, location)), /* @__PURE__ */ React.createElement(Typography, { variant: "body2" }, "Need help? Go to our", " ", /* @__PURE__ */ React.createElement(Link, { to: "https://github.com/AxisCommunications/backstage-plugins/blob/main/plugins/readme/README.md" }, "documentation")));
35
+ return /* @__PURE__ */ jsxs(Box, { children: [
36
+ /* @__PURE__ */ jsxs(Typography, { pb: 2, variant: "body2", children: [
37
+ "No README.md file found at source location:",
38
+ " ",
39
+ location && /* @__PURE__ */ jsx("strong", { children: location })
40
+ ] }),
41
+ /* @__PURE__ */ jsxs(Typography, { variant: "body2", children: [
42
+ "Need help? Go to our",
43
+ " ",
44
+ /* @__PURE__ */ jsx(Link, { to: "https://github.com/AxisCommunications/backstage-plugins/blob/main/plugins/readme/README.md", children: "documentation" })
45
+ ] })
46
+ ] });
36
47
  }
37
- return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error });
48
+ return /* @__PURE__ */ jsx(ResponseErrorPanel, { error });
38
49
  }
39
50
  if (error) {
40
- return /* @__PURE__ */ React.createElement(ErrorPanel, { error });
51
+ return /* @__PURE__ */ jsx(ErrorPanel, { error });
41
52
  }
42
53
  if (!content) {
43
- return /* @__PURE__ */ React.createElement(ErrorPanel, { error: Error("Unknown error") });
54
+ return /* @__PURE__ */ jsx(ErrorPanel, { error: Error("Unknown error") });
44
55
  }
45
56
  if (!content[1] || content[1] === "error") {
46
- return /* @__PURE__ */ React.createElement(ErrorPanel, { error: Error(content[1] ?? "Unknown error") });
57
+ return /* @__PURE__ */ jsx(ErrorPanel, { error: Error(content[1] ?? "Unknown error") });
47
58
  } else if (content[1].startsWith("text/markdown")) {
48
- return /* @__PURE__ */ React.createElement(MarkdownContent, { content: content[0] });
59
+ return /* @__PURE__ */ jsx(MarkdownContent, { content: content[0] });
49
60
  }
50
- return /* @__PURE__ */ React.createElement("div", { "data-testid": "readme-content" }, /* @__PURE__ */ React.createElement(CodeSnippet, { text: content[0], language: "plaintext" }));
61
+ return /* @__PURE__ */ jsx("div", { "data-testid": "readme-content", children: /* @__PURE__ */ jsx(CodeSnippet, { text: content[0], language: "plaintext" }) });
51
62
  };
52
63
 
53
64
  export { FetchComponent };
@@ -1 +1 @@
1
- {"version":3,"file":"FetchComponent.esm.js","sources":["../../../src/components/FetchComponent/FetchComponent.tsx"],"sourcesContent":["import React from 'react';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport {\n CodeSnippet,\n ErrorPanel,\n Link,\n MarkdownContent,\n Progress,\n ResponseErrorPanel,\n} from '@backstage/core-components';\nimport useAsync from 'react-use/lib/useAsync';\nimport { readmeApiRef } from '../../api/ReadmeApi';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport { getEntitySourceLocation } from '@backstage/catalog-model';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport { ResponseError } from '@backstage/errors';\n\nexport const FetchComponent = () => {\n const { entity } = useEntity();\n const readmeApi = useApi(readmeApiRef);\n let location;\n\n try {\n const { target } = getEntitySourceLocation(entity);\n location = target ?? target;\n } catch (err) {\n location = ': Unknown';\n }\n\n const {\n value: content,\n loading,\n error,\n } = useAsync(\n async (): Promise<string[]> =>\n await readmeApi.getReadmeContent(stringifyEntityRef(entity)),\n [entity],\n );\n\n if (loading) {\n return <Progress />;\n }\n\n if (error instanceof ResponseError) {\n if (error.statusCode === 404) {\n return (\n <Box>\n <Typography pb={2} variant=\"body2\">\n No README.md file found at source location:{' '}\n {location && <strong>{location}</strong>}\n </Typography>\n <Typography variant=\"body2\">\n Need help? Go to our{' '}\n <Link to=\"https://github.com/AxisCommunications/backstage-plugins/blob/main/plugins/readme/README.md\">\n documentation\n </Link>\n </Typography>\n </Box>\n );\n }\n return <ResponseErrorPanel error={error} />;\n }\n\n if (error) {\n return <ErrorPanel error={error} />;\n }\n if (!content) {\n return <ErrorPanel error={Error('Unknown error')} />;\n }\n if (!content[1] || content[1] === 'error') {\n return <ErrorPanel error={Error(content[1] ?? 'Unknown error')} />;\n } else if (content[1].startsWith('text/markdown')) {\n return <MarkdownContent content={content[0]} />;\n }\n // probably text/plain\n return (\n <div data-testid=\"readme-content\">\n <CodeSnippet text={content[0]} language=\"plaintext\" />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAmBO,MAAM,iBAAiB,MAAM;AAClC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAC7B,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA,CAAA;AACrC,EAAI,IAAA,QAAA,CAAA;AAEJ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T,IAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,KAAc,EAAA,CAAA,CAAA;AAAA,GACnC;AACA,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,KAAO,EAAA,KAAA,CAAM,eAAe,CAAG,EAAA,CAAA,CAAA;AAAA,GACpD;AACA,EAAA,IAAI,CAAC,OAAQ,CAAA,CAAC,KAAK,OAAQ,CAAA,CAAC,MAAM,OAAS,EAAA;AACzC,IAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,KAAO,EAAA,KAAA,CAAM,QAAQ,CAAC,CAAA,IAAK,eAAe,CAAG,EAAA,CAAA,CAAA;AAAA,aACvD,OAAQ,CAAA,CAAC,CAAE,CAAA,UAAA,CAAW,eAAe,CAAG,EAAA;AACjD,IAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,eAAA,EAAA,EAAgB,OAAS,EAAA,OAAA,CAAQ,CAAC,CAAG,EAAA,CAAA,CAAA;AAAA,GAC/C;AAEA,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAI,aAAY,EAAA,gBAAA,EAAA,kBACd,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA,EAAY,IAAM,EAAA,OAAA,CAAQ,CAAC,CAAA,EAAG,QAAS,EAAA,WAAA,EAAY,CACtD,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"FetchComponent.esm.js","sources":["../../../src/components/FetchComponent/FetchComponent.tsx"],"sourcesContent":["import { useEntity } from '@backstage/plugin-catalog-react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport {\n CodeSnippet,\n ErrorPanel,\n Link,\n MarkdownContent,\n Progress,\n ResponseErrorPanel,\n} from '@backstage/core-components';\nimport useAsync from 'react-use/lib/useAsync';\nimport { readmeApiRef } from '../../api/ReadmeApi';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport { getEntitySourceLocation } from '@backstage/catalog-model';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport { ResponseError } from '@backstage/errors';\n\nexport const FetchComponent = () => {\n const { entity } = useEntity();\n const readmeApi = useApi(readmeApiRef);\n let location;\n\n try {\n const { target } = getEntitySourceLocation(entity);\n location = target ?? target;\n } catch (err) {\n location = ': Unknown';\n }\n\n const {\n value: content,\n loading,\n error,\n } = useAsync(\n async (): Promise<string[]> =>\n await readmeApi.getReadmeContent(stringifyEntityRef(entity)),\n [entity],\n );\n\n if (loading) {\n return <Progress />;\n }\n\n if (error instanceof ResponseError) {\n if (error.statusCode === 404) {\n return (\n <Box>\n <Typography pb={2} variant=\"body2\">\n No README.md file found at source location:{' '}\n {location && <strong>{location}</strong>}\n </Typography>\n <Typography variant=\"body2\">\n Need help? Go to our{' '}\n <Link to=\"https://github.com/AxisCommunications/backstage-plugins/blob/main/plugins/readme/README.md\">\n documentation\n </Link>\n </Typography>\n </Box>\n );\n }\n return <ResponseErrorPanel error={error} />;\n }\n\n if (error) {\n return <ErrorPanel error={error} />;\n }\n if (!content) {\n return <ErrorPanel error={Error('Unknown error')} />;\n }\n if (!content[1] || content[1] === 'error') {\n return <ErrorPanel error={Error(content[1] ?? 'Unknown error')} />;\n } else if (content[1].startsWith('text/markdown')) {\n return <MarkdownContent content={content[0]} />;\n }\n // probably text/plain\n return (\n <div data-testid=\"readme-content\">\n <CodeSnippet text={content[0]} language=\"plaintext\" />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAkBO,MAAM,iBAAiB,MAAM;AAClC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA;AACrC,EAAI,IAAA,QAAA;AAEJ,EAAI,IAAA;AACF,IAAA,MAAM,EAAE,MAAA,EAAW,GAAA,uBAAA,CAAwB,MAAM,CAAA;AACjD,IAAA,QAAA,GAAW,MAAU,IAAA,MAAA;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,EAAW,KAAO,EAAA,KAAA,CAAM,eAAe,CAAG,EAAA,CAAA;AAAA;AAEpD,EAAA,IAAI,CAAC,OAAQ,CAAA,CAAC,KAAK,OAAQ,CAAA,CAAC,MAAM,OAAS,EAAA;AACzC,IAAO,uBAAA,GAAA,CAAC,cAAW,KAAO,EAAA,KAAA,CAAM,QAAQ,CAAC,CAAA,IAAK,eAAe,CAAG,EAAA,CAAA;AAAA,aACvD,OAAQ,CAAA,CAAC,CAAE,CAAA,UAAA,CAAW,eAAe,CAAG,EAAA;AACjD,IAAA,uBAAQ,GAAA,CAAA,eAAA,EAAA,EAAgB,OAAS,EAAA,OAAA,CAAQ,CAAC,CAAG,EAAA,CAAA;AAAA;AAG/C,EAAA,uBACG,GAAA,CAAA,KAAA,EAAA,EAAI,aAAY,EAAA,gBAAA,EACf,QAAC,kBAAA,GAAA,CAAA,WAAA,EAAA,EAAY,IAAM,EAAA,OAAA,CAAQ,CAAC,CAAA,EAAG,QAAS,EAAA,WAAA,EAAY,CACtD,EAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +1,5 @@
1
- import React, { useState } from 'react';
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import { useState } from 'react';
2
3
  import IconButton from '@mui/material/IconButton';
3
4
  import Box from '@mui/material/Box';
4
5
  import { InfoCard } from '@backstage/core-components';
@@ -10,31 +11,34 @@ const ReadmeCard = (props) => {
10
11
  const { variant = "gridItem", maxHeight: propMaxHeight } = props;
11
12
  const maxHeight = variant === "fullHeight" ? "none" : propMaxHeight ?? "235px";
12
13
  const [displayDialog, setDisplayDialog] = useState(false);
13
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
14
- InfoCard,
15
- {
16
- title: "README",
17
- variant,
18
- action: variant !== "fullHeight" ? /* @__PURE__ */ React.createElement(
19
- IconButton,
20
- {
21
- onClick: () => setDisplayDialog(true),
22
- "aria-label": "open dialog",
23
- role: "button",
24
- title: "Open in dialog",
25
- size: "large"
26
- },
27
- /* @__PURE__ */ React.createElement(OpenInNewIcon, null)
28
- ) : void 0
29
- },
30
- /* @__PURE__ */ React.createElement("div", { style: { overflow: "auto" } }, /* @__PURE__ */ React.createElement(Box, { maxHeight }, /* @__PURE__ */ React.createElement(FetchComponent, null)))
31
- ), /* @__PURE__ */ React.createElement(
32
- ReadmeDialog,
33
- {
34
- open: displayDialog,
35
- onClose: () => setDisplayDialog(false)
36
- }
37
- ));
14
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
15
+ /* @__PURE__ */ jsx(
16
+ InfoCard,
17
+ {
18
+ title: "README",
19
+ variant,
20
+ action: variant !== "fullHeight" ? /* @__PURE__ */ jsx(
21
+ IconButton,
22
+ {
23
+ onClick: () => setDisplayDialog(true),
24
+ "aria-label": "open dialog",
25
+ role: "button",
26
+ title: "Open in dialog",
27
+ size: "large",
28
+ children: /* @__PURE__ */ jsx(OpenInNewIcon, {})
29
+ }
30
+ ) : void 0,
31
+ children: /* @__PURE__ */ jsx("div", { style: { overflow: "auto" }, children: /* @__PURE__ */ jsx(Box, { maxHeight, children: /* @__PURE__ */ jsx(FetchComponent, {}) }) })
32
+ }
33
+ ),
34
+ /* @__PURE__ */ jsx(
35
+ ReadmeDialog,
36
+ {
37
+ open: displayDialog,
38
+ onClose: () => setDisplayDialog(false)
39
+ }
40
+ )
41
+ ] });
38
42
  };
39
43
 
40
44
  export { ReadmeCard };
@@ -1 +1 @@
1
- {"version":3,"file":"ReadmeCard.esm.js","sources":["../../../src/components/ReadmeCard/ReadmeCard.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport IconButton from '@mui/material/IconButton';\nimport Box from '@mui/material/Box';\nimport { InfoCard, InfoCardVariants } from '@backstage/core-components';\nimport { FetchComponent } from '../FetchComponent';\nimport OpenInNewIcon from '@mui/icons-material/OpenInNew';\nimport { ReadmeDialog } from '../ReadmeDialog/ReadmeDialog';\n\n/**\n * ReadmeCardProps props.\n *\n * @public\n */\n\nexport type ReadmeCardProps = {\n variant?: InfoCardVariants;\n maxHeight?: string | number;\n};\n\nexport const ReadmeCard = (props: ReadmeCardProps) => {\n const { variant = 'gridItem', maxHeight: propMaxHeight } = props;\n const maxHeight =\n variant === 'fullHeight' ? 'none' : propMaxHeight ?? '235px';\n\n const [displayDialog, setDisplayDialog] = useState(false);\n\n return (\n <>\n <InfoCard\n title=\"README\"\n variant={variant}\n action={\n variant !== 'fullHeight' ? (\n <IconButton\n onClick={() => setDisplayDialog(true)}\n aria-label=\"open dialog\"\n role=\"button\"\n title=\"Open in dialog\"\n size=\"large\"\n >\n <OpenInNewIcon />\n </IconButton>\n ) : undefined\n }\n >\n <div style={{ overflow: 'auto' }}>\n <Box maxHeight={maxHeight}>\n <FetchComponent />\n </Box>\n </div>\n </InfoCard>\n\n <ReadmeDialog\n open={displayDialog}\n onClose={() => setDisplayDialog(false)}\n />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAmBa,MAAA,UAAA,GAAa,CAAC,KAA2B,KAAA;AACpD,EAAA,MAAM,EAAE,OAAA,GAAU,UAAY,EAAA,SAAA,EAAW,eAAkB,GAAA,KAAA,CAAA;AAC3D,EAAA,MAAM,SACJ,GAAA,OAAA,KAAY,YAAe,GAAA,MAAA,GAAS,aAAiB,IAAA,OAAA,CAAA;AAEvD,EAAA,MAAM,CAAC,aAAA,EAAe,gBAAgB,CAAA,GAAI,SAAS,KAAK,CAAA,CAAA;AAExD,EAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,QAAA;AAAA,MACN,OAAA;AAAA,MACA,MAAA,EACE,YAAY,YACV,mBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,OAAA,EAAS,MAAM,gBAAA,CAAiB,IAAI,CAAA;AAAA,UACpC,YAAW,EAAA,aAAA;AAAA,UACX,IAAK,EAAA,QAAA;AAAA,UACL,KAAM,EAAA,gBAAA;AAAA,UACN,IAAK,EAAA,OAAA;AAAA,SAAA;AAAA,4CAEJ,aAAc,EAAA,IAAA,CAAA;AAAA,OAEf,GAAA,KAAA,CAAA;AAAA,KAAA;AAAA,oBAGL,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAI,KAAO,EAAA,EAAE,QAAU,EAAA,MAAA,EACtB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,GAAI,EAAA,EAAA,SAAA,EAAA,kBACF,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,IAAe,CAClB,CACF,CAAA;AAAA,GAGF,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,IAAM,EAAA,aAAA;AAAA,MACN,OAAA,EAAS,MAAM,gBAAA,CAAiB,KAAK,CAAA;AAAA,KAAA;AAAA,GAEzC,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ReadmeCard.esm.js","sources":["../../../src/components/ReadmeCard/ReadmeCard.tsx"],"sourcesContent":["import { useState } from 'react';\nimport IconButton from '@mui/material/IconButton';\nimport Box from '@mui/material/Box';\nimport { InfoCard, InfoCardVariants } from '@backstage/core-components';\nimport { FetchComponent } from '../FetchComponent';\nimport OpenInNewIcon from '@mui/icons-material/OpenInNew';\nimport { ReadmeDialog } from '../ReadmeDialog/ReadmeDialog';\n\n/**\n * ReadmeCardProps props.\n *\n * @public\n */\n\nexport type ReadmeCardProps = {\n variant?: InfoCardVariants;\n maxHeight?: string | number;\n};\n\nexport const ReadmeCard = (props: ReadmeCardProps) => {\n const { variant = 'gridItem', maxHeight: propMaxHeight } = props;\n const maxHeight =\n variant === 'fullHeight' ? 'none' : propMaxHeight ?? '235px';\n\n const [displayDialog, setDisplayDialog] = useState(false);\n\n return (\n <>\n <InfoCard\n title=\"README\"\n variant={variant}\n action={\n variant !== 'fullHeight' ? (\n <IconButton\n onClick={() => setDisplayDialog(true)}\n aria-label=\"open dialog\"\n role=\"button\"\n title=\"Open in dialog\"\n size=\"large\"\n >\n <OpenInNewIcon />\n </IconButton>\n ) : undefined\n }\n >\n <div style={{ overflow: 'auto' }}>\n <Box maxHeight={maxHeight}>\n <FetchComponent />\n </Box>\n </div>\n </InfoCard>\n\n <ReadmeDialog\n open={displayDialog}\n onClose={() => setDisplayDialog(false)}\n />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAmBa,MAAA,UAAA,GAAa,CAAC,KAA2B,KAAA;AACpD,EAAA,MAAM,EAAE,OAAA,GAAU,UAAY,EAAA,SAAA,EAAW,eAAkB,GAAA,KAAA;AAC3D,EAAA,MAAM,SACJ,GAAA,OAAA,KAAY,YAAe,GAAA,MAAA,GAAS,aAAiB,IAAA,OAAA;AAEvD,EAAA,MAAM,CAAC,aAAA,EAAe,gBAAgB,CAAA,GAAI,SAAS,KAAK,CAAA;AAExD,EAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,KAAM,EAAA,QAAA;AAAA,QACN,OAAA;AAAA,QACA,MAAA,EACE,YAAY,YACV,mBAAA,GAAA;AAAA,UAAC,UAAA;AAAA,UAAA;AAAA,YACC,OAAA,EAAS,MAAM,gBAAA,CAAiB,IAAI,CAAA;AAAA,YACpC,YAAW,EAAA,aAAA;AAAA,YACX,IAAK,EAAA,QAAA;AAAA,YACL,KAAM,EAAA,gBAAA;AAAA,YACN,IAAK,EAAA,OAAA;AAAA,YAEL,8BAAC,aAAc,EAAA,EAAA;AAAA;AAAA,SAEf,GAAA,MAAA;AAAA,QAGN,QAAC,kBAAA,GAAA,CAAA,KAAA,EAAA,EAAI,KAAO,EAAA,EAAE,QAAU,EAAA,MAAA,EACtB,EAAA,QAAA,kBAAA,GAAA,CAAC,GAAI,EAAA,EAAA,SAAA,EACH,QAAC,kBAAA,GAAA,CAAA,cAAA,EAAA,EAAe,GAClB,CACF,EAAA;AAAA;AAAA,KACF;AAAA,oBAEA,GAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,IAAM,EAAA,aAAA;AAAA,QACN,OAAA,EAAS,MAAM,gBAAA,CAAiB,KAAK;AAAA;AAAA;AACvC,GACF,EAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import Button from '@mui/material/Button';
3
3
  import Dialog from '@mui/material/Dialog';
4
4
  import DialogActions from '@mui/material/DialogActions';
@@ -8,26 +8,28 @@ import Box from '@mui/material/Box';
8
8
  import { FetchComponent } from '../FetchComponent/FetchComponent.esm.js';
9
9
 
10
10
  const ReadmeDialog = ({ open, onClose }) => {
11
- return /* @__PURE__ */ React.createElement(
11
+ return /* @__PURE__ */ jsxs(
12
12
  Dialog,
13
13
  {
14
14
  maxWidth: "md",
15
15
  open,
16
16
  onClose,
17
- "data-testid": "content-dialog"
18
- },
19
- /* @__PURE__ */ React.createElement(DialogTitle, null, "README"),
20
- /* @__PURE__ */ React.createElement(DialogContent, { dividers: true }, /* @__PURE__ */ React.createElement(Box, { minWidth: 650 }, /* @__PURE__ */ React.createElement(FetchComponent, null))),
21
- /* @__PURE__ */ React.createElement(DialogActions, null, /* @__PURE__ */ React.createElement(
22
- Button,
23
- {
24
- variant: "contained",
25
- color: "primary",
26
- "aria-label": "close",
27
- onClick: onClose
28
- },
29
- "Close"
30
- ))
17
+ "data-testid": "content-dialog",
18
+ children: [
19
+ /* @__PURE__ */ jsx(DialogTitle, { children: "README" }),
20
+ /* @__PURE__ */ jsx(DialogContent, { dividers: true, children: /* @__PURE__ */ jsx(Box, { minWidth: 650, children: /* @__PURE__ */ jsx(FetchComponent, {}) }) }),
21
+ /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(
22
+ Button,
23
+ {
24
+ variant: "contained",
25
+ color: "primary",
26
+ "aria-label": "close",
27
+ onClick: onClose,
28
+ children: "Close"
29
+ }
30
+ ) })
31
+ ]
32
+ }
31
33
  );
32
34
  };
33
35
 
@@ -1 +1 @@
1
- {"version":3,"file":"ReadmeDialog.esm.js","sources":["../../../src/components/ReadmeDialog/ReadmeDialog.tsx"],"sourcesContent":["import React from 'react';\nimport Button from '@mui/material/Button';\nimport Dialog from '@mui/material/Dialog';\nimport DialogActions from '@mui/material/DialogActions';\nimport DialogContent from '@mui/material/DialogContent';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport Box from '@mui/material/Box';\nimport { FetchComponent } from '../FetchComponent';\n\ntype Props = {\n open: boolean;\n onClose: () => void;\n};\n\nexport const ReadmeDialog = ({ open, onClose }: Props) => {\n return (\n <Dialog\n maxWidth=\"md\"\n open={open}\n onClose={onClose}\n data-testid=\"content-dialog\"\n >\n <DialogTitle>README</DialogTitle>\n <DialogContent dividers>\n <Box minWidth={650}>\n <FetchComponent />\n </Box>\n </DialogContent>\n <DialogActions>\n <Button\n variant=\"contained\"\n color=\"primary\"\n aria-label=\"close\"\n onClick={onClose}\n >\n Close\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAcO,MAAM,YAAe,GAAA,CAAC,EAAE,IAAA,EAAM,SAAqB,KAAA;AACxD,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,QAAS,EAAA,IAAA;AAAA,MACT,IAAA;AAAA,MACA,OAAA;AAAA,MACA,aAAY,EAAA,gBAAA;AAAA,KAAA;AAAA,oBAEZ,KAAA,CAAA,aAAA,CAAC,mBAAY,QAAM,CAAA;AAAA,oBACnB,KAAA,CAAA,aAAA,CAAC,aAAc,EAAA,EAAA,QAAA,EAAQ,IACrB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,GAAI,EAAA,EAAA,QAAA,EAAU,GACb,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAe,EAAA,IAAA,CAClB,CACF,CAAA;AAAA,wCACC,aACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,OAAQ,EAAA,WAAA;AAAA,QACR,KAAM,EAAA,SAAA;AAAA,QACN,YAAW,EAAA,OAAA;AAAA,QACX,OAAS,EAAA,OAAA;AAAA,OAAA;AAAA,MACV,OAAA;AAAA,KAGH,CAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ReadmeDialog.esm.js","sources":["../../../src/components/ReadmeDialog/ReadmeDialog.tsx"],"sourcesContent":["import Button from '@mui/material/Button';\nimport Dialog from '@mui/material/Dialog';\nimport DialogActions from '@mui/material/DialogActions';\nimport DialogContent from '@mui/material/DialogContent';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport Box from '@mui/material/Box';\nimport { FetchComponent } from '../FetchComponent';\n\ntype Props = {\n open: boolean;\n onClose: () => void;\n};\n\nexport const ReadmeDialog = ({ open, onClose }: Props) => {\n return (\n <Dialog\n maxWidth=\"md\"\n open={open}\n onClose={onClose}\n data-testid=\"content-dialog\"\n >\n <DialogTitle>README</DialogTitle>\n <DialogContent dividers>\n <Box minWidth={650}>\n <FetchComponent />\n </Box>\n </DialogContent>\n <DialogActions>\n <Button\n variant=\"contained\"\n color=\"primary\"\n aria-label=\"close\"\n onClick={onClose}\n >\n Close\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAaO,MAAM,YAAe,GAAA,CAAC,EAAE,IAAA,EAAM,SAAqB,KAAA;AACxD,EACE,uBAAA,IAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,QAAS,EAAA,IAAA;AAAA,MACT,IAAA;AAAA,MACA,OAAA;AAAA,MACA,aAAY,EAAA,gBAAA;AAAA,MAEZ,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,eAAY,QAAM,EAAA,QAAA,EAAA,CAAA;AAAA,wBACnB,GAAA,CAAC,aAAc,EAAA,EAAA,QAAA,EAAQ,IACrB,EAAA,QAAA,kBAAA,GAAA,CAAC,GAAI,EAAA,EAAA,QAAA,EAAU,GACb,EAAA,QAAA,kBAAA,GAAA,CAAC,cAAe,EAAA,EAAA,CAAA,EAClB,CACF,EAAA,CAAA;AAAA,4BACC,aACC,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,OAAQ,EAAA,WAAA;AAAA,YACR,KAAM,EAAA,SAAA;AAAA,YACN,YAAW,EAAA,OAAA;AAAA,YACX,OAAS,EAAA,OAAA;AAAA,YACV,QAAA,EAAA;AAAA;AAAA,SAGH,EAAA;AAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- /// <reference types="react" />
2
- import * as React from 'react';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
2
  import { InfoCardVariants } from '@backstage/core-components';
4
3
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
5
4
  import { ApiHolder } from '@backstage/core-plugin-api';
@@ -24,7 +23,7 @@ declare const readmePlugin: _backstage_core_plugin_api.BackstagePlugin<{
24
23
  /**
25
24
  * Readme card exported from the Readme plugin
26
25
  * @public */
27
- declare const ReadmeCard: (props: ReadmeCardProps) => React.JSX.Element;
26
+ declare const ReadmeCard: (props: ReadmeCardProps) => react_jsx_runtime.JSX.Element;
28
27
 
29
28
  /**
30
29
  * Checks if a README is available for the given entity by making a request to the backend.
@@ -1,4 +1,4 @@
1
- import { createPlugin, createApiFactory, discoveryApiRef, fetchApiRef, identityApiRef, createRoutableExtension } from '@backstage/core-plugin-api';
1
+ import { createPlugin, createApiFactory, identityApiRef, fetchApiRef, discoveryApiRef, createRoutableExtension } from '@backstage/core-plugin-api';
2
2
  import { rootRouteRef } from './routes.esm.js';
3
3
  import { readmeApiRef } from './api/ReadmeApi.esm.js';
4
4
  import { ReadmeClient } from './api/ReadmeClient.esm.js';
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["import {\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n fetchApiRef,\n identityApiRef,\n} from '@backstage/core-plugin-api';\n\nimport { rootRouteRef } from './routes';\nimport { readmeApiRef } from './api/ReadmeApi';\nimport { ReadmeClient } from './api/ReadmeClient';\n\n/**\n * Plugin that provides the Readme api\n * @public */\nexport const readmePlugin = createPlugin({\n id: 'readme',\n apis: [\n createApiFactory({\n api: readmeApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n identityApi: identityApiRef,\n },\n factory: ({ discoveryApi, fetchApi, identityApi }) =>\n new ReadmeClient({ discoveryApi, fetchApi, identityApi }),\n }),\n ],\n routes: {\n root: rootRouteRef,\n },\n});\n\n/**\n * Readme card exported from the Readme plugin\n * @public */\nexport const ReadmeCard = readmePlugin.provide(\n createRoutableExtension({\n name: 'ReadmeCard',\n component: () => import('./components/ReadmeCard').then(m => m.ReadmeCard),\n mountPoint: rootRouteRef,\n }),\n);\n"],"names":[],"mappings":";;;;;AAgBO,MAAM,eAAe,YAAa,CAAA;AAAA,EACvC,EAAI,EAAA,QAAA;AAAA,EACJ,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,YAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA,eAAA;AAAA,QACd,QAAU,EAAA,WAAA;AAAA,QACV,WAAa,EAAA,cAAA;AAAA,OACf;AAAA,MACA,OAAS,EAAA,CAAC,EAAE,YAAA,EAAc,QAAU,EAAA,WAAA,EAClC,KAAA,IAAI,YAAa,CAAA,EAAE,YAAc,EAAA,QAAA,EAAU,aAAa,CAAA;AAAA,KAC3D,CAAA;AAAA,GACH;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,YAAA;AAAA,GACR;AACF,CAAC,EAAA;AAKM,MAAM,aAAa,YAAa,CAAA,OAAA;AAAA,EACrC,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,YAAA;AAAA,IACN,SAAA,EAAW,MAAM,OAAO,sCAAyB,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,UAAU,CAAA;AAAA,IACzE,UAAY,EAAA,YAAA;AAAA,GACb,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["import {\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n fetchApiRef,\n identityApiRef,\n} from '@backstage/core-plugin-api';\n\nimport { rootRouteRef } from './routes';\nimport { readmeApiRef } from './api/ReadmeApi';\nimport { ReadmeClient } from './api/ReadmeClient';\n\n/**\n * Plugin that provides the Readme api\n * @public */\nexport const readmePlugin = createPlugin({\n id: 'readme',\n apis: [\n createApiFactory({\n api: readmeApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n identityApi: identityApiRef,\n },\n factory: ({ discoveryApi, fetchApi, identityApi }) =>\n new ReadmeClient({ discoveryApi, fetchApi, identityApi }),\n }),\n ],\n routes: {\n root: rootRouteRef,\n },\n});\n\n/**\n * Readme card exported from the Readme plugin\n * @public */\nexport const ReadmeCard = readmePlugin.provide(\n createRoutableExtension({\n name: 'ReadmeCard',\n component: () => import('./components/ReadmeCard').then(m => m.ReadmeCard),\n mountPoint: rootRouteRef,\n }),\n);\n"],"names":[],"mappings":";;;;;AAgBO,MAAM,eAAe,YAAa,CAAA;AAAA,EACvC,EAAI,EAAA,QAAA;AAAA,EACJ,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,YAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA,eAAA;AAAA,QACd,QAAU,EAAA,WAAA;AAAA,QACV,WAAa,EAAA;AAAA,OACf;AAAA,MACA,OAAS,EAAA,CAAC,EAAE,YAAA,EAAc,QAAU,EAAA,WAAA,EAClC,KAAA,IAAI,YAAa,CAAA,EAAE,YAAc,EAAA,QAAA,EAAU,aAAa;AAAA,KAC3D;AAAA,GACH;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA;AAAA;AAEV,CAAC;AAKM,MAAM,aAAa,YAAa,CAAA,OAAA;AAAA,EACrC,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,YAAA;AAAA,IACN,SAAA,EAAW,MAAM,OAAO,sCAAyB,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,UAAU,CAAA;AAAA,IACzE,UAAY,EAAA;AAAA,GACb;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"routes.esm.js","sources":["../src/routes.ts"],"sourcesContent":["import { createRouteRef } from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'readme',\n});\n"],"names":[],"mappings":";;AAEO,MAAM,eAAe,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA,QAAA;AACN,CAAC;;;;"}
1
+ {"version":3,"file":"routes.esm.js","sources":["../src/routes.ts"],"sourcesContent":["import { createRouteRef } from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'readme',\n});\n"],"names":[],"mappings":";;AAEO,MAAM,eAAe,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA;AACN,CAAC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axis-backstage/plugin-readme",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "main": "dist/index.esm.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "Apache-2.0",
@@ -29,34 +29,43 @@
29
29
  "postpack": "backstage-cli package postpack"
30
30
  },
31
31
  "dependencies": {
32
- "@backstage/catalog-model": "^1.6.0",
33
- "@backstage/core-components": "^0.14.10",
34
- "@backstage/core-plugin-api": "^1.9.3",
35
- "@backstage/errors": "^1.2.4",
36
- "@backstage/plugin-catalog-react": "^1.12.3",
37
- "@backstage/theme": "^0.5.6",
32
+ "@backstage/catalog-model": "^1.7.4",
33
+ "@backstage/core-components": "^0.17.3",
34
+ "@backstage/core-plugin-api": "^1.10.8",
35
+ "@backstage/errors": "^1.2.7",
36
+ "@backstage/plugin-catalog-react": "^1.19.0",
37
+ "@backstage/theme": "^0.6.6",
38
38
  "@mui/icons-material": "^5.15.7",
39
39
  "@mui/material": "^5.15.7",
40
40
  "react-use": "^17.2.4"
41
41
  },
42
42
  "peerDependencies": {
43
- "@emotion/react": "^11.11.3",
44
- "@emotion/styled": "^11.11.0",
45
- "react": "^17.0.0 || ^18.0.0"
43
+ "@types/react": "^17.0.0 || ^18.0.0",
44
+ "react": "^17.0.0 || ^18.0.0",
45
+ "react-dom": "^17.0.0 || ^18.0.0",
46
+ "react-router-dom": "^6.3.0"
46
47
  },
47
48
  "devDependencies": {
48
- "@backstage/cli": "^0.27.0",
49
- "@backstage/core-app-api": "^1.14.2",
50
- "@backstage/dev-utils": "^1.0.37",
51
- "@backstage/test-utils": "^1.5.10",
52
- "@testing-library/jest-dom": "6.0.0",
53
- "@testing-library/react": "^14.0.0",
49
+ "@backstage/cli": "^0.33.0",
50
+ "@backstage/core-app-api": "^1.17.1",
51
+ "@backstage/dev-utils": "^1.1.11",
52
+ "@backstage/test-utils": "^1.7.9",
53
+ "@testing-library/dom": "^10.0.0",
54
+ "@testing-library/jest-dom": "^6.0.0",
55
+ "@testing-library/react": "^16.0.0",
54
56
  "@testing-library/user-event": "^14.0.0",
55
- "msw": "^1.0.0"
57
+ "msw": "^1.3.5"
56
58
  },
57
59
  "files": [
58
60
  "dist"
59
61
  ],
62
+ "typesVersions": {
63
+ "*": {
64
+ "package.json": [
65
+ "package.json"
66
+ ]
67
+ }
68
+ },
60
69
  "module": "./dist/index.esm.js",
61
70
  "directory": "_release/package"
62
- }
71
+ }