@backstage/plugin-techdocs 1.18.1-next.2 → 1.18.2

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,34 @@
1
1
  # @backstage/plugin-techdocs
2
2
 
3
+ ## 1.18.2
4
+
5
+ ### Patch Changes
6
+
7
+ - f712f71: Fixed TechDocs addons silently not rendering in apps using the new frontend system, on both the standalone documentation reader page and the entity documentation tab.
8
+
9
+ ## 1.18.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 736d84e: Use locale-insensitive Unicode casing for consistent string handling across environments.
14
+ - d421187: Reduced the initial app bundle size by loading page and optional UI implementations only when their extensions render.
15
+ - 9cb79f5: Use the catalog presentation API for TechDocs document titles and owner labels so entity display names are consistent with the rest of Backstage.
16
+ - Updated dependencies
17
+ - @backstage/core-components@0.18.14
18
+ - @backstage/integration@2.1.2
19
+ - @backstage/ui@0.18.0
20
+ - @backstage/catalog-client@1.16.2
21
+ - @backstage/catalog-model@1.10.1
22
+ - @backstage/plugin-catalog-react@3.2.3
23
+ - @backstage/plugin-techdocs-react@1.3.15
24
+ - @backstage/config@1.3.9
25
+ - @backstage/frontend-plugin-api@0.18.1
26
+ - @backstage/core-plugin-api@1.12.10
27
+ - @backstage/integration-react@1.2.22
28
+ - @backstage/plugin-auth-react@0.1.31
29
+ - @backstage/plugin-search-common@1.2.25
30
+ - @backstage/plugin-search-react@1.11.8
31
+
3
32
  ## 1.18.1-next.2
4
33
 
5
34
  ### Patch Changes
@@ -5,8 +5,8 @@ import { attachTechDocsAddonComponentData } from '@backstage/plugin-techdocs-rea
5
5
  import { TechDocsReaderRouter, EmbeddedDocsRouter } from '../../Router.esm.js';
6
6
  import { TechDocsReaderLayout } from './TechDocsReaderLayout.esm.js';
7
7
 
8
- function Addons(props) {
9
- return /* @__PURE__ */ jsx(TechDocsAddons, { children: props.options.map((options) => {
8
+ function renderAddons(addonOptions) {
9
+ return /* @__PURE__ */ jsx(TechDocsAddons, { children: addonOptions.map((options) => {
10
10
  const Addon = options.component;
11
11
  attachTechDocsAddonComponentData(Addon, options);
12
12
  return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(Addon, {}) }, options.name);
@@ -21,11 +21,11 @@ function TechDocsReaderPage(props) {
21
21
  withHeader: props.withHeader
22
22
  }
23
23
  ),
24
- /* @__PURE__ */ jsx(Addons, { options: props.addonOptions })
24
+ renderAddons(props.addonOptions)
25
25
  ] });
26
26
  }
27
27
  function TechDocsEntityContent(props) {
28
- return /* @__PURE__ */ jsx(EmbeddedDocsRouter, { emptyState: props.emptyState, children: /* @__PURE__ */ jsx(Addons, { options: props.addonOptions }) });
28
+ return /* @__PURE__ */ jsx(EmbeddedDocsRouter, { emptyState: props.emptyState, children: renderAddons(props.addonOptions) });
29
29
  }
30
30
 
31
31
  export { TechDocsEntityContent, TechDocsReaderPage };
@@ -1 +1 @@
1
- {"version":3,"file":"TechDocsReaderPage.esm.js","sources":["../../../src/alpha/components/TechDocsReaderPage.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { ReactElement, Suspense } from 'react';\nimport {\n TechDocsAddons,\n type TechDocsAddonOptions,\n} from '@backstage/plugin-techdocs-react';\nimport { attachTechDocsAddonComponentData } from '@backstage/plugin-techdocs-react/alpha';\nimport { EmbeddedDocsRouter, TechDocsReaderRouter } from '../../Router';\nimport { TechDocsReaderLayout } from './TechDocsReaderLayout';\n\nfunction Addons(props: { options: TechDocsAddonOptions[] }) {\n return (\n <TechDocsAddons>\n {props.options.map(options => {\n const Addon = options.component;\n attachTechDocsAddonComponentData(Addon, options);\n return (\n <Suspense key={options.name} fallback={null}>\n <Addon />\n </Suspense>\n );\n })}\n </TechDocsAddons>\n );\n}\n\nexport function TechDocsReaderPage(props: {\n addonOptions: TechDocsAddonOptions[];\n withSearch: boolean;\n withHeader: boolean;\n}) {\n return (\n <TechDocsReaderRouter>\n <TechDocsReaderLayout\n withSearch={props.withSearch}\n withHeader={props.withHeader}\n />\n <Addons options={props.addonOptions} />\n </TechDocsReaderRouter>\n );\n}\n\nexport function TechDocsEntityContent(props: {\n addonOptions: TechDocsAddonOptions[];\n emptyState?: ReactElement;\n}) {\n return (\n <EmbeddedDocsRouter emptyState={props.emptyState}>\n <Addons options={props.addonOptions} />\n </EmbeddedDocsRouter>\n );\n}\n"],"names":[],"mappings":";;;;;;;AAyBA,SAAS,OAAO,KAAA,EAA4C;AAC1D,EAAA,uBACE,GAAA,CAAC,cAAA,EAAA,EACE,QAAA,EAAA,KAAA,CAAM,OAAA,CAAQ,IAAI,CAAA,OAAA,KAAW;AAC5B,IAAA,MAAM,QAAQ,OAAA,CAAQ,SAAA;AACtB,IAAA,gCAAA,CAAiC,OAAO,OAAO,CAAA;AAC/C,IAAA,uBACE,GAAA,CAAC,YAA4B,QAAA,EAAU,IAAA,EACrC,8BAAC,KAAA,EAAA,EAAM,CAAA,EAAA,EADM,QAAQ,IAEvB,CAAA;AAAA,EAEJ,CAAC,CAAA,EACH,CAAA;AAEJ;AAEO,SAAS,mBAAmB,KAAA,EAIhC;AACD,EAAA,4BACG,oBAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,oBAAA;AAAA,MAAA;AAAA,QACC,YAAY,KAAA,CAAM,UAAA;AAAA,QAClB,YAAY,KAAA,CAAM;AAAA;AAAA,KACpB;AAAA,oBACA,GAAA,CAAC,MAAA,EAAA,EAAO,OAAA,EAAS,KAAA,CAAM,YAAA,EAAc;AAAA,GAAA,EACvC,CAAA;AAEJ;AAEO,SAAS,sBAAsB,KAAA,EAGnC;AACD,EAAA,uBACE,GAAA,CAAC,kBAAA,EAAA,EAAmB,UAAA,EAAY,KAAA,CAAM,UAAA,EACpC,8BAAC,MAAA,EAAA,EAAO,OAAA,EAAS,KAAA,CAAM,YAAA,EAAc,CAAA,EACvC,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TechDocsReaderPage.esm.js","sources":["../../../src/alpha/components/TechDocsReaderPage.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { ReactElement, Suspense } from 'react';\nimport {\n TechDocsAddons,\n type TechDocsAddonOptions,\n} from '@backstage/plugin-techdocs-react';\nimport { attachTechDocsAddonComponentData } from '@backstage/plugin-techdocs-react/alpha';\nimport { EmbeddedDocsRouter, TechDocsReaderRouter } from '../../Router';\nimport { TechDocsReaderLayout } from './TechDocsReaderLayout';\n\n// Deliberately a function call rather than a component. Addons are discovered\n// by walking the router outlet as an element tree: the walk only follows\n// `props.children` and never invokes a component, and this is also the only\n// place the addon component data is attached. A component wrapper breaks both,\n// because its children are built by a render that the walk never performs.\nfunction renderAddons(addonOptions: TechDocsAddonOptions[]) {\n return (\n <TechDocsAddons>\n {addonOptions.map(options => {\n const Addon = options.component;\n attachTechDocsAddonComponentData(Addon, options);\n return (\n <Suspense key={options.name} fallback={null}>\n <Addon />\n </Suspense>\n );\n })}\n </TechDocsAddons>\n );\n}\n\nexport function TechDocsReaderPage(props: {\n addonOptions: TechDocsAddonOptions[];\n withSearch: boolean;\n withHeader: boolean;\n}) {\n return (\n <TechDocsReaderRouter>\n <TechDocsReaderLayout\n withSearch={props.withSearch}\n withHeader={props.withHeader}\n />\n {renderAddons(props.addonOptions)}\n </TechDocsReaderRouter>\n );\n}\n\nexport function TechDocsEntityContent(props: {\n addonOptions: TechDocsAddonOptions[];\n emptyState?: ReactElement;\n}) {\n return (\n <EmbeddedDocsRouter emptyState={props.emptyState}>\n {renderAddons(props.addonOptions)}\n </EmbeddedDocsRouter>\n );\n}\n"],"names":[],"mappings":";;;;;;;AA8BA,SAAS,aAAa,YAAA,EAAsC;AAC1D,EAAA,uBACE,GAAA,CAAC,cAAA,EAAA,EACE,QAAA,EAAA,YAAA,CAAa,GAAA,CAAI,CAAA,OAAA,KAAW;AAC3B,IAAA,MAAM,QAAQ,OAAA,CAAQ,SAAA;AACtB,IAAA,gCAAA,CAAiC,OAAO,OAAO,CAAA;AAC/C,IAAA,uBACE,GAAA,CAAC,YAA4B,QAAA,EAAU,IAAA,EACrC,8BAAC,KAAA,EAAA,EAAM,CAAA,EAAA,EADM,QAAQ,IAEvB,CAAA;AAAA,EAEJ,CAAC,CAAA,EACH,CAAA;AAEJ;AAEO,SAAS,mBAAmB,KAAA,EAIhC;AACD,EAAA,4BACG,oBAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,oBAAA;AAAA,MAAA;AAAA,QACC,YAAY,KAAA,CAAM,UAAA;AAAA,QAClB,YAAY,KAAA,CAAM;AAAA;AAAA,KACpB;AAAA,IACC,YAAA,CAAa,MAAM,YAAY;AAAA,GAAA,EAClC,CAAA;AAEJ;AAEO,SAAS,sBAAsB,KAAA,EAGnC;AACD,EAAA,uBACE,GAAA,CAAC,sBAAmB,UAAA,EAAY,KAAA,CAAM,YACnC,QAAA,EAAA,YAAA,CAAa,KAAA,CAAM,YAAY,CAAA,EAClC,CAAA;AAEJ;;;;"}
@@ -1,7 +1,7 @@
1
1
  function toLowerMaybe(str, config) {
2
2
  return config.getOptionalBoolean(
3
3
  "techdocs.legacyUseCaseSensitiveTripletPaths"
4
- ) ? str : str.toLocaleLowerCase("en-US");
4
+ ) ? str : str.toLowerCase();
5
5
  }
6
6
 
7
7
  export { toLowerMaybe };
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.esm.js","sources":["../src/helpers.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\n\n// Lower-case entity triplets by default, but allow override.\nexport function toLowerMaybe(str: string, config: Config) {\n return config.getOptionalBoolean(\n 'techdocs.legacyUseCaseSensitiveTripletPaths',\n )\n ? str\n : str.toLocaleLowerCase('en-US');\n}\n"],"names":[],"mappings":"AAmBO,SAAS,YAAA,CAAa,KAAa,MAAA,EAAgB;AACxD,EAAA,OAAO,MAAA,CAAO,kBAAA;AAAA,IACZ;AAAA,GACF,GACI,GAAA,GACA,GAAA,CAAI,iBAAA,CAAkB,OAAO,CAAA;AACnC;;;;"}
1
+ {"version":3,"file":"helpers.esm.js","sources":["../src/helpers.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\n\n// Lower-case entity triplets by default, but allow override.\nexport function toLowerMaybe(str: string, config: Config) {\n return config.getOptionalBoolean(\n 'techdocs.legacyUseCaseSensitiveTripletPaths',\n )\n ? str\n : str.toLowerCase();\n}\n"],"names":[],"mappings":"AAmBO,SAAS,YAAA,CAAa,KAAa,MAAA,EAAgB;AACxD,EAAA,OAAO,MAAA,CAAO,kBAAA;AAAA,IACZ;AAAA,GACF,GACI,GAAA,GACA,GAAA,CAAI,WAAA,EAAY;AACtB;;;;"}
@@ -62,12 +62,12 @@ const EntityListDocsGrid = (props) => {
62
62
  a,
63
63
  void 0,
64
64
  presentationApi
65
- ).primaryTitle.toLocaleLowerCase();
65
+ ).primaryTitle.toLowerCase();
66
66
  const titleB = entityPresentationSnapshot(
67
67
  b,
68
68
  void 0,
69
69
  presentationApi
70
- ).primaryTitle.toLocaleLowerCase();
70
+ ).primaryTitle.toLowerCase();
71
71
  return titleA.localeCompare(titleB);
72
72
  });
73
73
  return /* @__PURE__ */ jsx(Content, { children: (props.groups || [allEntitiesGroup]).map((group, index) => /* @__PURE__ */ jsx(
@@ -1 +1 @@
1
- {"version":3,"file":"EntityListDocsGrid.esm.js","sources":["../../../../src/home/components/Grids/EntityListDocsGrid.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DocsCardGrid } from './DocsCardGrid';\nimport { Entity } from '@backstage/catalog-model';\nimport {\n CodeSnippet,\n Content,\n ContentHeader,\n Link,\n Progress,\n WarningPanel,\n} from '@backstage/core-components';\nimport {\n entityPresentationApiRef,\n entityPresentationSnapshot,\n useEntityList,\n useEntityOwnership,\n} from '@backstage/plugin-catalog-react';\nimport { useApiHolder } from '@backstage/core-plugin-api';\nimport Typography from '@material-ui/core/Typography';\nimport { ReactNode } from 'react';\n\n/**\n * Props for {@link EntityListDocsGrid}\n *\n * @public\n */\nexport type DocsGroupConfig = {\n title: ReactNode;\n filterPredicate: ((entity: Entity) => boolean) | string;\n};\n\n/**\n * Props for {@link EntityListDocsGrid}\n *\n * @public\n */\nexport type EntityListDocsGridPageProps = {\n groups?: DocsGroupConfig[];\n};\n\nconst allEntitiesGroup: DocsGroupConfig = {\n title: 'All Documentation',\n filterPredicate: () => true,\n};\n\nconst EntityListDocsGridGroup = (props: {\n group: DocsGroupConfig;\n entities: Entity[];\n}) => {\n const { entities, group } = props;\n const { loading: loadingOwnership, isOwnedEntity } = useEntityOwnership();\n\n const shownEntities = entities.filter(entity => {\n if (group.filterPredicate === 'ownedByUser') {\n if (loadingOwnership) {\n return false;\n }\n return isOwnedEntity(entity);\n }\n\n return (\n typeof group.filterPredicate === 'function' &&\n group.filterPredicate(entity)\n );\n });\n\n const titleComponent: ReactNode = (() => {\n return typeof group.title === 'string' ? (\n <ContentHeader title={group.title} />\n ) : (\n group.title\n );\n })();\n\n if (shownEntities.length === 0) {\n return null;\n }\n\n return (\n <Content>\n {titleComponent}\n <DocsCardGrid entities={shownEntities} />\n </Content>\n );\n};\n\n/**\n * Component responsible to get entities from entity list context and pass down to DocsCardGrid\n *\n * @public\n */\nexport const EntityListDocsGrid = (props: EntityListDocsGridPageProps) => {\n const { loading, error, entities } = useEntityList();\n const apiHolder = useApiHolder();\n const presentationApi = apiHolder.get(entityPresentationApiRef);\n\n if (error) {\n return (\n <WarningPanel\n severity=\"error\"\n title=\"Could not load available documentation.\"\n >\n <CodeSnippet language=\"text\" text={error.toString()} />\n </WarningPanel>\n );\n }\n\n if (loading) {\n return <Progress />;\n }\n\n if (entities.length === 0) {\n return (\n <div data-testid=\"doc-not-found\">\n <Typography variant=\"body2\">\n No documentation found that match your filter. Learn more about{' '}\n <Link to=\"https://backstage.io/docs/features/techdocs/creating-and-publishing\">\n publishing documentation\n </Link>\n .\n </Typography>\n </div>\n );\n }\n\n const sortedEntities = [...entities].sort((a, b) => {\n const titleA = entityPresentationSnapshot(\n a,\n undefined,\n presentationApi,\n ).primaryTitle.toLocaleLowerCase();\n const titleB = entityPresentationSnapshot(\n b,\n undefined,\n presentationApi,\n ).primaryTitle.toLocaleLowerCase();\n return titleA.localeCompare(titleB);\n });\n\n return (\n <Content>\n {(props.groups || [allEntitiesGroup]).map((group, index: number) => (\n <EntityListDocsGridGroup\n entities={sortedEntities}\n group={group}\n key={`${group.title}-${index}`}\n />\n ))}\n </Content>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAuDA,MAAM,gBAAA,GAAoC;AAAA,EACxC,KAAA,EAAO,mBAAA;AAAA,EACP,iBAAiB,MAAM;AACzB,CAAA;AAEA,MAAM,uBAAA,GAA0B,CAAC,KAAA,KAG3B;AACJ,EAAA,MAAM,EAAE,QAAA,EAAU,KAAA,EAAM,GAAI,KAAA;AAC5B,EAAA,MAAM,EAAE,OAAA,EAAS,gBAAA,EAAkB,aAAA,KAAkB,kBAAA,EAAmB;AAExE,EAAA,MAAM,aAAA,GAAgB,QAAA,CAAS,MAAA,CAAO,CAAA,MAAA,KAAU;AAC9C,IAAA,IAAI,KAAA,CAAM,oBAAoB,aAAA,EAAe;AAC3C,MAAA,IAAI,gBAAA,EAAkB;AACpB,QAAA,OAAO,KAAA;AAAA,MACT;AACA,MAAA,OAAO,cAAc,MAAM,CAAA;AAAA,IAC7B;AAEA,IAAA,OACE,OAAO,KAAA,CAAM,eAAA,KAAoB,UAAA,IACjC,KAAA,CAAM,gBAAgB,MAAM,CAAA;AAAA,EAEhC,CAAC,CAAA;AAED,EAAA,MAAM,kBAA6B,MAAM;AACvC,IAAA,OAAO,OAAO,KAAA,CAAM,KAAA,KAAU,QAAA,mBAC5B,GAAA,CAAC,iBAAc,KAAA,EAAO,KAAA,CAAM,KAA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A,EAET,CAAA,EACF,CAAA;AAAA,EAEJ;AAEA,EAAA,MAAM,cAAA,GAAiB,CAAC,GAAG,QAAQ,EAAE,IAAA,CAAK,CAAC,GAAG,CAAA,KAAM;AAClD,IAAA,MAAM,MAAA,GAAS,0BAAA;AAAA,MACb,CAAA;AAAA,MACA,MAAA;AAAA,MACA;AAAA,KACF,CAAE,aAAa,iBAAA,EAAkB;AACjC,IAAA,MAAM,MAAA,GAAS,0BAAA;AAAA,MACb,CAAA;AAAA,MACA,MAAA;AAAA,MACA;AAAA,KACF,CAAE,aAAa,iBAAA,EAAkB;AACjC,IAAA,OAAO,MAAA,CAAO,cAAc,MAAM,CAAA;AAAA,EACpC,CAAC,CAAA;AAED,EAAA,uBACE,GAAA,CAAC,OAAA,EAAA,EACG,QAAA,EAAA,CAAA,KAAA,CAAM,MAAA,IAAU,CAAC,gBAAgB,CAAA,EAAG,GAAA,CAAI,CAAC,KAAA,EAAO,KAAA,qBAChD,GAAA;AAAA,IAAC,uBAAA;AAAA,IAAA;AAAA,MACC,QAAA,EAAU,cAAA;AAAA,MACV;AAAA,KAAA;AAAA,IACK,CAAA,EAAG,KAAA,CAAM,KAAK,CAAA,CAAA,EAAI,KAAK,CAAA;AAAA,GAE/B,CAAA,EACH,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"EntityListDocsGrid.esm.js","sources":["../../../../src/home/components/Grids/EntityListDocsGrid.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DocsCardGrid } from './DocsCardGrid';\nimport { Entity } from '@backstage/catalog-model';\nimport {\n CodeSnippet,\n Content,\n ContentHeader,\n Link,\n Progress,\n WarningPanel,\n} from '@backstage/core-components';\nimport {\n entityPresentationApiRef,\n entityPresentationSnapshot,\n useEntityList,\n useEntityOwnership,\n} from '@backstage/plugin-catalog-react';\nimport { useApiHolder } from '@backstage/core-plugin-api';\nimport Typography from '@material-ui/core/Typography';\nimport { ReactNode } from 'react';\n\n/**\n * Props for {@link EntityListDocsGrid}\n *\n * @public\n */\nexport type DocsGroupConfig = {\n title: ReactNode;\n filterPredicate: ((entity: Entity) => boolean) | string;\n};\n\n/**\n * Props for {@link EntityListDocsGrid}\n *\n * @public\n */\nexport type EntityListDocsGridPageProps = {\n groups?: DocsGroupConfig[];\n};\n\nconst allEntitiesGroup: DocsGroupConfig = {\n title: 'All Documentation',\n filterPredicate: () => true,\n};\n\nconst EntityListDocsGridGroup = (props: {\n group: DocsGroupConfig;\n entities: Entity[];\n}) => {\n const { entities, group } = props;\n const { loading: loadingOwnership, isOwnedEntity } = useEntityOwnership();\n\n const shownEntities = entities.filter(entity => {\n if (group.filterPredicate === 'ownedByUser') {\n if (loadingOwnership) {\n return false;\n }\n return isOwnedEntity(entity);\n }\n\n return (\n typeof group.filterPredicate === 'function' &&\n group.filterPredicate(entity)\n );\n });\n\n const titleComponent: ReactNode = (() => {\n return typeof group.title === 'string' ? (\n <ContentHeader title={group.title} />\n ) : (\n group.title\n );\n })();\n\n if (shownEntities.length === 0) {\n return null;\n }\n\n return (\n <Content>\n {titleComponent}\n <DocsCardGrid entities={shownEntities} />\n </Content>\n );\n};\n\n/**\n * Component responsible to get entities from entity list context and pass down to DocsCardGrid\n *\n * @public\n */\nexport const EntityListDocsGrid = (props: EntityListDocsGridPageProps) => {\n const { loading, error, entities } = useEntityList();\n const apiHolder = useApiHolder();\n const presentationApi = apiHolder.get(entityPresentationApiRef);\n\n if (error) {\n return (\n <WarningPanel\n severity=\"error\"\n title=\"Could not load available documentation.\"\n >\n <CodeSnippet language=\"text\" text={error.toString()} />\n </WarningPanel>\n );\n }\n\n if (loading) {\n return <Progress />;\n }\n\n if (entities.length === 0) {\n return (\n <div data-testid=\"doc-not-found\">\n <Typography variant=\"body2\">\n No documentation found that match your filter. Learn more about{' '}\n <Link to=\"https://backstage.io/docs/features/techdocs/creating-and-publishing\">\n publishing documentation\n </Link>\n .\n </Typography>\n </div>\n );\n }\n\n const sortedEntities = [...entities].sort((a, b) => {\n const titleA = entityPresentationSnapshot(\n a,\n undefined,\n presentationApi,\n ).primaryTitle.toLowerCase();\n const titleB = entityPresentationSnapshot(\n b,\n undefined,\n presentationApi,\n ).primaryTitle.toLowerCase();\n return titleA.localeCompare(titleB);\n });\n\n return (\n <Content>\n {(props.groups || [allEntitiesGroup]).map((group, index: number) => (\n <EntityListDocsGridGroup\n entities={sortedEntities}\n group={group}\n key={`${group.title}-${index}`}\n />\n ))}\n </Content>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAuDA,MAAM,gBAAA,GAAoC;AAAA,EACxC,KAAA,EAAO,mBAAA;AAAA,EACP,iBAAiB,MAAM;AACzB,CAAA;AAEA,MAAM,uBAAA,GAA0B,CAAC,KAAA,KAG3B;AACJ,EAAA,MAAM,EAAE,QAAA,EAAU,KAAA,EAAM,GAAI,KAAA;AAC5B,EAAA,MAAM,EAAE,OAAA,EAAS,gBAAA,EAAkB,aAAA,KAAkB,kBAAA,EAAmB;AAExE,EAAA,MAAM,aAAA,GAAgB,QAAA,CAAS,MAAA,CAAO,CAAA,MAAA,KAAU;AAC9C,IAAA,IAAI,KAAA,CAAM,oBAAoB,aAAA,EAAe;AAC3C,MAAA,IAAI,gBAAA,EAAkB;AACpB,QAAA,OAAO,KAAA;AAAA,MACT;AACA,MAAA,OAAO,cAAc,MAAM,CAAA;AAAA,IAC7B;AAEA,IAAA,OACE,OAAO,KAAA,CAAM,eAAA,KAAoB,UAAA,IACjC,KAAA,CAAM,gBAAgB,MAAM,CAAA;AAAA,EAEhC,CAAC,CAAA;AAED,EAAA,MAAM,k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AAA,sBAChE,GAAA,CAAC,IAAA,EAAA,EAAK,EAAA,EAAG,qEAAA,EAAsE,QAAA,EAAA,0BAAA,EAE/E,CAAA;AAAA,MAAO;AAAA,KAAA,EAET,CAAA,EACF,CAAA;AAAA,EAEJ;AAEA,EAAA,MAAM,cAAA,GAAiB,CAAC,GAAG,QAAQ,EAAE,IAAA,CAAK,CAAC,GAAG,CAAA,KAAM;AAClD,IAAA,MAAM,MAAA,GAAS,0BAAA;AAAA,MACb,CAAA;AAAA,MACA,MAAA;AAAA,MACA;AAAA,KACF,CAAE,aAAa,WAAA,EAAY;AAC3B,IAAA,MAAM,MAAA,GAAS,0BAAA;AAAA,MACb,CAAA;AAAA,MACA,MAAA;AAAA,MACA;AAAA,KACF,CAAE,aAAa,WAAA,EAAY;AAC3B,IAAA,OAAO,MAAA,CAAO,cAAc,MAAM,CAAA;AAAA,EACpC,CAAC,CAAA;AAED,EAAA,uBACE,GAAA,CAAC,OAAA,EAAA,EACG,QAAA,EAAA,CAAA,KAAA,CAAM,MAAA,IAAU,CAAC,gBAAgB,CAAA,EAAG,GAAA,CAAI,CAAC,KAAA,EAAO,KAAA,qBAChD,GAAA;AAAA,IAAC,uBAAA;AAAA,IAAA;AAAA,MACC,QAAA,EAAU,cAAA;AAAA,MACV;AAAA,KAAA;AAAA,IACK,CAAA,EAAG,KAAA,CAAM,KAAK,CAAA,CAAA,EAAI,KAAK,CAAA;AAAA,GAE/B,CAAA,EACH,CAAA;AAEJ;;;;"}
@@ -33,17 +33,11 @@ const columnFactories = {
33
33
  searchable: true,
34
34
  defaultSort: "asc",
35
35
  customSort: (row1, row2) => {
36
- const title1 = customTitle(
37
- row1.entity,
38
- presentationApi
39
- ).toLocaleLowerCase();
40
- const title2 = customTitle(
41
- row2.entity,
42
- presentationApi
43
- ).toLocaleLowerCase();
36
+ const title1 = customTitle(row1.entity, presentationApi).toLowerCase();
37
+ const title2 = customTitle(row2.entity, presentationApi).toLowerCase();
44
38
  return title1.localeCompare(title2);
45
39
  },
46
- customFilterAndSearch: (filter, row) => customTitle(row.entity, presentationApi).toLocaleLowerCase().includes(filter.toLocaleLowerCase()),
40
+ customFilterAndSearch: (filter, row) => customTitle(row.entity, presentationApi).toLowerCase().includes(filter.toLowerCase()),
47
41
  render: (row) => /* @__PURE__ */ jsx(
48
42
  SubvalueCell,
49
43
  {
@@ -1 +1 @@
1
- {"version":3,"file":"columns.esm.js","sources":["../../../../src/home/components/Tables/columns.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Link,\n SubvalueCell,\n type TableColumn,\n} from '@backstage/core-components';\nimport {\n EntityDisplayName,\n type EntityPresentationApi,\n entityPresentationSnapshot,\n EntityRefLinks,\n} from '@backstage/plugin-catalog-react';\nimport { Entity } from '@backstage/catalog-model';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { techdocsTranslationRef } from '../../../translation';\nimport { DocsTableRow } from './types';\n\nfunction customTitle(\n entity: Entity,\n presentationApi?: EntityPresentationApi,\n): string {\n return entityPresentationSnapshot(entity, undefined, presentationApi)\n .primaryTitle;\n}\n\n/**\n * Component for translating table column titles\n * @alpha\n */\nconst TableColumnTitle = ({\n translationKey,\n}: {\n translationKey: 'document' | 'owner' | 'kind' | 'type';\n}) => {\n const { t } = useTranslationRef(techdocsTranslationRef);\n return <>{t(`table.columns.${translationKey}`)}</>;\n};\n\n/**\n * Not directly exported, but through DocsTable.columns and EntityListDocsTable.columns\n *\n * @public\n */\nexport const columnFactories = {\n createTitleColumn(options?: {\n hidden?: boolean;\n entityPresentationApi?: EntityPresentationApi;\n }): TableColumn<DocsTableRow> {\n const nameCol = columnFactories.createNameColumn({\n entityPresentationApi: options?.entityPresentationApi,\n });\n return {\n ...nameCol,\n field: 'entity.metadata.title',\n hidden: options?.hidden,\n };\n },\n\n createNameColumn(options?: {\n entityPresentationApi?: EntityPresentationApi;\n }): TableColumn<DocsTableRow> {\n const presentationApi = options?.entityPresentationApi;\n return {\n title: <TableColumnTitle translationKey=\"document\" />,\n field: 'entity.metadata.name',\n highlight: true,\n searchable: true,\n defaultSort: 'asc',\n customSort: (row1, row2) => {\n const title1 = customTitle(\n row1.entity,\n presentationApi,\n ).toLocaleLowerCase();\n const title2 = customTitle(\n row2.entity,\n presentationApi,\n ).toLocaleLowerCase();\n return title1.localeCompare(title2);\n },\n customFilterAndSearch: (filter, row) =>\n customTitle(row.entity, presentationApi)\n .toLocaleLowerCase()\n .includes(filter.toLocaleLowerCase()),\n render: (row: DocsTableRow) => (\n <SubvalueCell\n value={\n <Link to={row.resolved.docsUrl}>\n {presentationApi ? (\n <EntityDisplayName entityRef={row.entity} />\n ) : (\n customTitle(row.entity)\n )}\n </Link>\n }\n subvalue={row.entity.metadata.description}\n />\n ),\n };\n },\n createOwnerColumn(): TableColumn<DocsTableRow> {\n return {\n title: <TableColumnTitle translationKey=\"owner\" />,\n field: 'resolved.ownedByRelationsTitle',\n render: ({ resolved }) => (\n <EntityRefLinks\n entityRefs={resolved.ownedByRelations}\n defaultKind=\"group\"\n />\n ),\n };\n },\n createKindColumn(): TableColumn<DocsTableRow> {\n return {\n title: <TableColumnTitle translationKey=\"kind\" />,\n field: 'entity.kind',\n };\n },\n createTypeColumn(): TableColumn<DocsTableRow> {\n return {\n title: <TableColumnTitle translationKey=\"type\" />,\n field: 'entity.spec.type',\n };\n },\n};\n\nexport const defaultColumns: TableColumn<DocsTableRow>[] = [\n columnFactories.createTitleColumn({ hidden: true }),\n columnFactories.createNameColumn(),\n columnFactories.createOwnerColumn(),\n columnFactories.createKindColumn(),\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EACF,CAAA;AAAA,EACA,gBAAA,GAA8C;AAC5C,IAAA,OAAO;AAAA,MACL,KAAA,kBAAO,GAAA,CAAC,gBAAA,EAAA,EAAiB,cAAA,EAAe,MAAA,EAAO,CAAA;AAAA,MAC/C,KAAA,EAAO;AAAA,KACT;AAAA,EACF;AACF;AAE2D;AAAA,EACzD,eAAA,CAAgB,iBAAA,CAAkB,EAAE,MAAA,EAAQ,MAAM,CAAA;AAAA,EAClD,gBAAgB,gBAAA,EAAiB;AAAA,EACjC,gBAAgB,iBAAA,EAAkB;AAAA,EAClC,gBAAgB,gBAAA,EAAiB;AAAA,EACjC,gBAAgB,gBAAA;AAClB;;;;"}
1
+ {"version":3,"file":"columns.esm.js","sources":["../../../../src/home/components/Tables/columns.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Link,\n SubvalueCell,\n type TableColumn,\n} from '@backstage/core-components';\nimport {\n EntityDisplayName,\n type EntityPresentationApi,\n entityPresentationSnapshot,\n EntityRefLinks,\n} from '@backstage/plugin-catalog-react';\nimport { Entity } from '@backstage/catalog-model';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { techdocsTranslationRef } from '../../../translation';\nimport { DocsTableRow } from './types';\n\nfunction customTitle(\n entity: Entity,\n presentationApi?: EntityPresentationApi,\n): string {\n return entityPresentationSnapshot(entity, undefined, presentationApi)\n .primaryTitle;\n}\n\n/**\n * Component for translating table column titles\n * @alpha\n */\nconst TableColumnTitle = ({\n translationKey,\n}: {\n translationKey: 'document' | 'owner' | 'kind' | 'type';\n}) => {\n const { t } = useTranslationRef(techdocsTranslationRef);\n return <>{t(`table.columns.${translationKey}`)}</>;\n};\n\n/**\n * Not directly exported, but through DocsTable.columns and EntityListDocsTable.columns\n *\n * @public\n */\nexport const columnFactories = {\n createTitleColumn(options?: {\n hidden?: boolean;\n entityPresentationApi?: EntityPresentationApi;\n }): TableColumn<DocsTableRow> {\n const nameCol = columnFactories.createNameColumn({\n entityPresentationApi: options?.entityPresentationApi,\n });\n return {\n ...nameCol,\n field: 'entity.metadata.title',\n hidden: options?.hidden,\n };\n },\n\n createNameColumn(options?: {\n entityPresentationApi?: EntityPresentationApi;\n }): TableColumn<DocsTableRow> {\n const presentationApi = options?.entityPresentationApi;\n return {\n title: <TableColumnTitle translationKey=\"document\" />,\n field: 'entity.metadata.name',\n highlight: true,\n searchable: true,\n defaultSort: 'asc',\n customSort: (row1, row2) => {\n const title1 = customTitle(row1.entity, presentationApi).toLowerCase();\n const title2 = customTitle(row2.entity, presentationApi).toLowerCase();\n return title1.localeCompare(title2);\n },\n customFilterAndSearch: (filter, row) =>\n customTitle(row.entity, presentationApi)\n .toLowerCase()\n .includes(filter.toLowerCase()),\n render: (row: DocsTableRow) => (\n <SubvalueCell\n value={\n <Link to={row.resolved.docsUrl}>\n {presentationApi ? (\n <EntityDisplayName entityRef={row.entity} />\n ) : (\n customTitle(row.entity)\n )}\n </Link>\n }\n subvalue={row.entity.metadata.description}\n />\n ),\n };\n },\n createOwnerColumn(): TableColumn<DocsTableRow> {\n return {\n title: <TableColumnTitle translationKey=\"owner\" />,\n field: 'resolved.ownedByRelationsTitle',\n render: ({ resolved }) => (\n <EntityRefLinks\n entityRefs={resolved.ownedByRelations}\n defaultKind=\"group\"\n />\n ),\n };\n },\n createKindColumn(): TableColumn<DocsTableRow> {\n return {\n title: <TableColumnTitle translationKey=\"kind\" />,\n field: 'entity.kind',\n };\n },\n createTypeColumn(): TableColumn<DocsTableRow> {\n return {\n title: <TableColumnTitle translationKey=\"type\" />,\n field: 'entity.spec.type',\n };\n },\n};\n\nexport const defaultColumns: TableColumn<DocsTableRow>[] = [\n columnFactories.createTitleColumn({ hidden: true }),\n columnFactories.createNameColumn(),\n columnFactories.createOwnerColumn(),\n columnFactories.createKindColumn(),\n columnFactories.createTypeColumn(),\n];\n"],"names":[],"mappings":";;;;;;AAgCA,SAAS,WAAA,CACP,QACA,eAAA,EACQ;AACR,EAAA,OAAO,0BAAA,CAA2B,MAAA,EAAQ,MAAA,EAAW,eAAe,CAAA,CACjE,YAAA;AACL;AAMA,MAAM,mBAAmB,CAAC;AAAA,EACxB;AACF,CAAA,KAEM;AACJ,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,sBAAsB,CAAA;AACtD,EAAA,uBAAO,GAAA,CAAA,QAAA,EAAA,EAAG,QAAA,EAAA,CAAA,CAAE,CAAA,cAAA,EAAiB,cAAc,EAAE,CAAA,EAAE,CAAA;AACjD,CAAA;AAOO,MAAM,eAAA,GAAkB;AAAA,EAC7B,kBAAkB,OAAA,EAGY;AAC5B,IAAA,MAAM,OAAA,GAAU,gBAAgB,gBAAA,CAAiB;AAAA,MAC/C,uBAAuB,OAAA,EAAS;AAAA,KACjC,CAAA;AACD,IAAA,OAAO;AAAA,MACL,GAAG,OAAA;AAAA,MACH,KAAA,EAAO,uBAAA;AAAA,MACP,QAAQ,OAAA,EAAS;AAAA,KACnB;AAAA,EACF,CAAA;AAAA,EAEA,iBAAiB,OAAA,EAEa;AAC5B,IAAA,MAAM,kBAAkB,OAAA,EAAS,qBAAA;AACjC,IAAA,OAAO;AAAA,MACL,KAAA,kBAAO,GAAA,CAAC,gBAAA,EAAA,EAAiB,cAAA,EAAe,UAAA,EAAW,CAAA;AAAA,MACnD,KAAA,EAAO,sBAAA;AAAA,MACP,SAAA,EAAW,IAAA;AAAA,MACX,UAAA,EAAY,IAAA;AAAA,MACZ,WAAA,EAAa,KAAA;AAAA,MACb,UAAA,EAAY,CAAC,IAAA,EAAM,IAAA,KAAS;A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BAAO,GAAA,CAAC,gBAAA,EAAA,EAAiB,cAAA,EAAe,MAAA,EAAO,CAAA;AAAA,MAC/C,KAAA,EAAO;AAAA,KACT;AAAA,EACF,CAAA;AAAA,EACA,gBAAA,GAA8C;AAC5C,IAAA,OAAO;AAAA,MACL,KAAA,kBAAO,GAAA,CAAC,gBAAA,EAAA,EAAiB,cAAA,EAAe,MAAA,EAAO,CAAA;AAAA,MAC/C,KAAA,EAAO;AAAA,KACT;AAAA,EACF;AACF;AAE2D;AAAA,EACzD,eAAA,CAAgB,iBAAA,CAAkB,EAAE,MAAA,EAAQ,MAAM,CAAA;AAAA,EAClD,gBAAgB,gBAAA,EAAiB;AAAA,EACjC,gBAAgB,iBAAA,EAAkB;AAAA,EAClC,gBAAgB,gBAAA,EAAiB;AAAA,EACjC,gBAAgB,gBAAA;AAClB;;;;"}
@@ -1,5 +1,5 @@
1
1
  var name = "@backstage/plugin-techdocs";
2
- var version = "1.18.1-next.2";
2
+ var version = "1.18.2";
3
3
  var description = "The Backstage plugin that renders technical documentation for your components";
4
4
  var backstage = {
5
5
  role: "frontend-plugin",
@@ -12,7 +12,7 @@ function useEntityPageTechDocsRedirect(entityRef) {
12
12
  const rootDocsPath = trimEndSlash(routeDocsRoot({ kind, namespace, name }));
13
13
  const catalogDocsPath = trimEndSlash(routeDocsCatalog());
14
14
  return (url) => {
15
- if (url.toLocaleLowerCase("en-US").startsWith(rootDocsPath.toLocaleLowerCase("en-US"))) {
15
+ if (url.toLowerCase().startsWith(rootDocsPath.toLowerCase())) {
16
16
  const suffix = trimStartSlash(url.slice(rootDocsPath.length));
17
17
  return suffix.length === 0 || suffix.startsWith("#") ? `${catalogDocsPath}${suffix}` : `${catalogDocsPath}/${suffix}`;
18
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useTechDocsLocation.esm.js","sources":["../../../src/search/hooks/useTechDocsLocation.ts"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport { useMemo } from 'react';\n\nimport { CompoundEntityRef } from '@backstage/catalog-model';\nimport { useRouteRef } from '@backstage/core-plugin-api';\n\nimport { rootCatalogDocsRouteRef, rootDocsRouteRef } from '../../routes';\n\nconst trimStartSlash = (path: string) => path.replace(/^\\/+/, '');\nconst trimEndSlash = (path: string) => path.replace(/\\/+$/, '');\n\n/**\n * Returns a function that takes a location to a Tech Docs entry, and returns a\n * new location, re-routed to the catalog page tab.\n *\n * @internal\n */\nexport function useEntityPageTechDocsRedirect(entityRef: CompoundEntityRef) {\n const { kind, name, namespace } = entityRef;\n\n const routeDocsRoot = useRouteRef(rootDocsRouteRef);\n const routeDocsCatalog = useRouteRef(rootCatalogDocsRouteRef);\n\n // Re-routes a /docs/:namespace/:kind/:name/* location into\n // /catalog/:namespace/:kind/:name/docs/*, while handling situations where\n // these defaults are changed.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const reRouteLocationToCatalog = useMemo(() => {\n const rootDocsPath = trimEndSlash(routeDocsRoot({ kind, namespace, name }));\n const catalogDocsPath = trimEndSlash(routeDocsCatalog());\n\n return (url: string): string => {\n if (\n url\n .toLocaleLowerCase('en-US')\n .startsWith(rootDocsPath.toLocaleLowerCase('en-US'))\n ) {\n const suffix = trimStartSlash(url.slice(rootDocsPath.length));\n return suffix.length === 0 || suffix.startsWith('#')\n ? `${catalogDocsPath}${suffix}`\n : `${catalogDocsPath}/${suffix}`;\n }\n return url;\n };\n }, [routeDocsRoot, routeDocsCatalog, kind, name, namespace]);\n\n return reRouteLocationToCatalog;\n}\n"],"names":[],"mappings":";;;;AAsBA,MAAM,iBAAiB,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ts"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport { useMemo } from 'react';\n\nimport { CompoundEntityRef } from '@backstage/catalog-model';\nimport { useRouteRef } from '@backstage/core-plugin-api';\n\nimport { rootCatalogDocsRouteRef, rootDocsRouteRef } from '../../routes';\n\nconst trimStartSlash = (path: string) => path.replace(/^\\/+/, '');\nconst trimEndSlash = (path: string) => path.replace(/\\/+$/, '');\n\n/**\n * Returns a function that takes a location to a Tech Docs entry, and returns a\n * new location, re-routed to the catalog page tab.\n *\n * @internal\n */\nexport function useEntityPageTechDocsRedirect(entityRef: CompoundEntityRef) {\n const { kind, name, namespace } = entityRef;\n\n const routeDocsRoot = useRouteRef(rootDocsRouteRef);\n const routeDocsCatalog = useRouteRef(rootCatalogDocsRouteRef);\n\n // Re-routes a /docs/:namespace/:kind/:name/* location into\n // /catalog/:namespace/:kind/:name/docs/*, while handling situations where\n // these defaults are changed.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const reRouteLocationToCatalog = useMemo(() => {\n const rootDocsPath = trimEndSlash(routeDocsRoot({ kind, namespace, name }));\n const catalogDocsPath = trimEndSlash(routeDocsCatalog());\n\n return (url: string): string => {\n if (url.toLowerCase().startsWith(rootDocsPath.toLowerCase())) {\n const suffix = trimStartSlash(url.slice(rootDocsPath.length));\n return suffix.length === 0 || suffix.startsWith('#')\n ? `${catalogDocsPath}${suffix}`\n : `${catalogDocsPath}/${suffix}`;\n }\n return url;\n };\n }, [routeDocsRoot, routeDocsCatalog, kind, name, namespace]);\n\n return reRouteLocationToCatalog;\n}\n"],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"@backstage/plugin-techdocs",
3
- "version": "1.18.1-next.2",
3
+ "version": "1.18.2",
4
4
  "description": "The Backstage plugin that renders technical documentation for your components",
5
5
  "backstage": {
6
6
  "role": "frontend-plugin",
@@ -71,23 +71,23 @@
71
71
  "test": "backstage-cli package test"
72
72
  },
73
73
  "dependencies": {
74
- "@backstage/catalog-client": "1.16.2-next.1",
75
- "@backstage/catalog-model": "1.10.0",
76
- "@backstage/config": "1.3.9-next.0",
77
- "@backstage/core-components": "0.18.14-next.2",
78
- "@backstage/core-plugin-api": "1.12.10-next.1",
79
- "@backstage/errors": "1.3.1",
80
- "@backstage/frontend-plugin-api": "0.18.1-next.1",
81
- "@backstage/integration": "2.1.2-next.1",
82
- "@backstage/integration-react": "1.2.22-next.1",
83
- "@backstage/plugin-auth-react": "0.1.31-next.1",
84
- "@backstage/plugin-catalog-react": "3.2.3-next.2",
85
- "@backstage/plugin-search-common": "1.2.25-next.0",
86
- "@backstage/plugin-search-react": "1.11.8-next.2",
87
- "@backstage/plugin-techdocs-common": "0.1.1",
88
- "@backstage/plugin-techdocs-react": "1.3.15-next.2",
89
- "@backstage/theme": "0.7.3",
90
- "@backstage/ui": "0.18.0-next.2",
74
+ "@backstage/catalog-client": "^1.16.2",
75
+ "@backstage/catalog-model": "^1.10.1",
76
+ "@backstage/config": "^1.3.9",
77
+ "@backstage/core-components": "^0.18.14",
78
+ "@backstage/core-plugin-api": "^1.12.10",
79
+ "@backstage/errors": "^1.3.1",
80
+ "@backstage/frontend-plugin-api": "^0.18.1",
81
+ "@backstage/integration": "^2.1.2",
82
+ "@backstage/integration-react": "^1.2.22",
83
+ "@backstage/plugin-auth-react": "^0.1.31",
84
+ "@backstage/plugin-catalog-react": "^3.2.3",
85
+ "@backstage/plugin-search-common": "^1.2.25",
86
+ "@backstage/plugin-search-react": "^1.11.8",
87
+ "@backstage/plugin-techdocs-common": "^0.1.1",
88
+ "@backstage/plugin-techdocs-react": "^1.3.15",
89
+ "@backstage/theme": "^0.7.3",
90
+ "@backstage/ui": "^0.18.0",
91
91
  "@material-ui/core": "^4.12.2",
92
92
  "@material-ui/icons": "^4.9.1",
93
93
  "@material-ui/lab": "4.0.0-alpha.61",
@@ -102,12 +102,12 @@
102
102
  "zod": "^4.0.0"
103
103
  },
104
104
  "devDependencies": {
105
- "@backstage/cli": "0.36.6-next.1",
106
- "@backstage/core-app-api": "1.20.5-next.2",
107
- "@backstage/dev-utils": "1.1.27-next.1",
108
- "@backstage/plugin-catalog": "2.0.9-next.2",
109
- "@backstage/plugin-techdocs-module-addons-contrib": "1.1.40-next.1",
110
- "@backstage/test-utils": "1.7.22-next.2",
105
+ "@backstage/cli": "^0.36.6",
106
+ "@backstage/core-app-api": "^1.20.5",
107
+ "@backstage/dev-utils": "^1.1.27",
108
+ "@backstage/plugin-catalog": "^2.0.9",
109
+ "@backstage/plugin-techdocs-module-addons-contrib": "^1.1.40",
110
+ "@backstage/test-utils": "^1.7.22",
111
111
  "@testing-library/dom": "^10.0.0",
112
112
  "@testing-library/jest-dom": "^6.0.0",
113
113
  "@testing-library/react": "^16.0.0",