@umijs/renderer-react 4.0.0-beta.5 → 4.0.0-beta.9

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/dist/app.js CHANGED
@@ -9,7 +9,7 @@ export function App(props) {
9
9
  Component: RouteComponent,
10
10
  });
11
11
  }, [props.routes]);
12
- return (React.createElement(AppContext.Provider, { value: {
12
+ let ret = (React.createElement(AppContext.Provider, { value: {
13
13
  routes: props.routes,
14
14
  routeComponents: props.routeComponents,
15
15
  pluginManager: props.pluginManager,
@@ -17,6 +17,19 @@ export function App(props) {
17
17
  } },
18
18
  React.createElement(Router, { navigator: props.navigator, location: props.location },
19
19
  React.createElement(Routes, null))));
20
+ for (const key of [
21
+ 'innerProvider',
22
+ 'i18nProvider',
23
+ 'dataflowProvider',
24
+ 'outerProvider',
25
+ ]) {
26
+ ret = props.pluginManager.applyPlugins({
27
+ type: 'modify',
28
+ key: key,
29
+ initialValue: ret,
30
+ });
31
+ }
32
+ return ret;
20
33
  }
21
34
  function Routes() {
22
35
  const { clientRoutes } = useAppContext();
package/dist/routes.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { Navigate } from 'react-router-dom';
2
3
  export function createClientRoutes(opts) {
3
4
  const { routesById, parentId, Component } = opts;
4
5
  return Object.keys(routesById)
@@ -26,6 +27,6 @@ export function createClientRoute(opts) {
26
27
  id: route.id,
27
28
  path: route.path,
28
29
  index: route.index,
29
- element: React.createElement(Component, { id: route.id }),
30
+ element: route.redirect ? (React.createElement(Navigate, { to: route.redirect })) : (React.createElement(Component, { id: route.id })),
30
31
  };
31
32
  }
package/dist/types.d.ts CHANGED
@@ -3,6 +3,7 @@ export interface IRoute {
3
3
  path?: string;
4
4
  index?: boolean;
5
5
  parentId?: string;
6
+ redirect?: string;
6
7
  }
7
8
  export interface IRoutesById {
8
9
  [id: string]: IRoute;
package/package.json CHANGED
@@ -1,7 +1,15 @@
1
1
  {
2
2
  "name": "@umijs/renderer-react",
3
- "version": "4.0.0-beta.5",
3
+ "version": "4.0.0-beta.9",
4
4
  "description": "@umijs/renderer-react",
5
+ "homepage": "https://github.com/umijs/umi-next/tree/master/packages/renderer-react#readme",
6
+ "bugs": "https://github.com/umijs/umi-next/issues",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/umijs/umi-next"
10
+ },
11
+ "license": "MIT",
12
+ "sideEffects": false,
5
13
  "main": "dist/index.js",
6
14
  "types": "dist/index.d.ts",
7
15
  "files": [
@@ -12,19 +20,6 @@
12
20
  "build:deps": "pnpm esno ../../scripts/bundleDeps.ts",
13
21
  "dev": "pnpm build -- --watch"
14
22
  },
15
- "repository": {
16
- "type": "git",
17
- "url": "https://github.com/umijs/umi-next"
18
- },
19
- "authors": [
20
- "chencheng <sorrycc@gmail.com> (https://github.com/sorrycc)"
21
- ],
22
- "license": "MIT",
23
- "bugs": "https://github.com/umijs/umi-next/issues",
24
- "homepage": "https://github.com/umijs/umi-next/tree/master/packages/renderer-react#readme",
25
- "publishConfig": {
26
- "access": "public"
27
- },
28
23
  "dependencies": {
29
24
  "history": "5.0.1",
30
25
  "react-router-dom": "6.0.0-beta.8"
@@ -37,5 +32,10 @@
37
32
  "react": ">=16.8",
38
33
  "react-dom": ">=16.8"
39
34
  },
40
- "sideEffects": false
35
+ "publishConfig": {
36
+ "access": "public"
37
+ },
38
+ "authors": [
39
+ "chencheng <sorrycc@gmail.com> (https://github.com/sorrycc)"
40
+ ]
41
41
  }