@backstage/core-app-api 1.1.1 → 1.2.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @backstage/core-app-api
2
2
 
3
+ ## 1.2.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 9b737e5f2e: Updated the React Router wiring to make use of the new `basename` property of the router components in React Router v6 stable. To implement this, a new optional `basename` property has been added to the `Router` app component, which can be forwarded to the concrete router implementation in order to support this new behavior. This is done by default in any app that does not have a `Router` component override.
8
+ - 127fcad26d: Deprecated the `homepage` config as the component that used it - `HomepageTimer` - has been removed and replaced by the `HeaderWorldClock` in the home plugin
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+ - @backstage/core-plugin-api@1.1.0-next.0
14
+ - @backstage/types@1.0.1-next.0
15
+ - @backstage/config@1.0.4-next.0
16
+ - @backstage/version-bridge@1.0.1
17
+
3
18
  ## 1.1.1
4
19
 
5
20
  ### Patch Changes
package/config.d.ts CHANGED
@@ -89,6 +89,11 @@ export interface Config {
89
89
  name?: string;
90
90
  };
91
91
 
92
+ /**
93
+ * This config was used by the HomepageTimer but has been replaced by the HeaderWorldClock in the home plugin
94
+ *
95
+ * @deprecated in favor of the HeaderWorldClock which is found in the home plugin
96
+ */
92
97
  homepage?: {
93
98
  clocks?: Array<{
94
99
  /** @visibility frontend */
package/dist/index.d.ts CHANGED
@@ -590,7 +590,9 @@ declare type AppComponents = {
590
590
  NotFoundErrorPage: ComponentType<{}>;
591
591
  BootErrorPage: ComponentType<BootErrorPageProps>;
592
592
  Progress: ComponentType<{}>;
593
- Router: ComponentType<{}>;
593
+ Router: ComponentType<{
594
+ basename?: string;
595
+ }>;
594
596
  ErrorBoundaryFallback: ComponentType<ErrorBoundaryFallbackProps>;
595
597
  ThemeProvider?: ComponentType<{}>;
596
598
  /**
package/dist/index.esm.js CHANGED
@@ -2513,6 +2513,12 @@ function isReactRouterBeta() {
2513
2513
 
2514
2514
  const InternalAppContext = createContext({ routeObjects: [] });
2515
2515
  function getBasePath(configApi) {
2516
+ if (!isReactRouterBeta()) {
2517
+ return "";
2518
+ }
2519
+ return readBasePath(configApi);
2520
+ }
2521
+ function readBasePath(configApi) {
2516
2522
  var _a;
2517
2523
  let { pathname } = new URL(
2518
2524
  (_a = configApi.getOptionalString("app.baseUrl")) != null ? _a : "/",
@@ -2702,7 +2708,7 @@ class AppManager {
2702
2708
  };
2703
2709
  const AppRouter = ({ children }) => {
2704
2710
  const configApi = useApi(configApiRef);
2705
- const basePath = getBasePath(configApi);
2711
+ const basePath = readBasePath(configApi);
2706
2712
  const mountPath = `${basePath}/*`;
2707
2713
  const { routeObjects } = useContext(InternalAppContext);
2708
2714
  if (!SignInPageComponent) {
@@ -2729,21 +2735,37 @@ class AppManager {
2729
2735
  },
2730
2736
  { signOutTargetUrl: basePath || "/" }
2731
2737
  );
2738
+ if (isReactRouterBeta()) {
2739
+ return /* @__PURE__ */ React.createElement(RouterComponent, null, /* @__PURE__ */ React.createElement(RouteTracker, {
2740
+ routeObjects
2741
+ }), /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
2742
+ path: mountPath,
2743
+ element: /* @__PURE__ */ React.createElement(React.Fragment, null, children)
2744
+ })));
2745
+ }
2746
+ return /* @__PURE__ */ React.createElement(RouterComponent, {
2747
+ basename: basePath
2748
+ }, /* @__PURE__ */ React.createElement(RouteTracker, {
2749
+ routeObjects
2750
+ }), children);
2751
+ }
2752
+ if (isReactRouterBeta()) {
2732
2753
  return /* @__PURE__ */ React.createElement(RouterComponent, null, /* @__PURE__ */ React.createElement(RouteTracker, {
2733
2754
  routeObjects
2734
- }), /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
2755
+ }), /* @__PURE__ */ React.createElement(SignInPageWrapper, {
2756
+ component: SignInPageComponent
2757
+ }, /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
2735
2758
  path: mountPath,
2736
2759
  element: /* @__PURE__ */ React.createElement(React.Fragment, null, children)
2737
- })));
2760
+ }))));
2738
2761
  }
2739
- return /* @__PURE__ */ React.createElement(RouterComponent, null, /* @__PURE__ */ React.createElement(RouteTracker, {
2762
+ return /* @__PURE__ */ React.createElement(RouterComponent, {
2763
+ basename: basePath
2764
+ }, /* @__PURE__ */ React.createElement(RouteTracker, {
2740
2765
  routeObjects
2741
2766
  }), /* @__PURE__ */ React.createElement(SignInPageWrapper, {
2742
2767
  component: SignInPageComponent
2743
- }, /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
2744
- path: mountPath,
2745
- element: /* @__PURE__ */ React.createElement(React.Fragment, null, children)
2746
- }))));
2768
+ }, /* @__PURE__ */ React.createElement(React.Fragment, null, children)));
2747
2769
  };
2748
2770
  return AppRouter;
2749
2771
  }