@umijs/renderer-react 4.0.0-beta.8 → 4.0.0-canary-20240513.3
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/LICENSE +21 -0
- package/dist/appContext.d.ts +24 -6
- package/dist/appContext.js +92 -3
- package/dist/browser.d.ts +86 -9
- package/dist/browser.js +289 -23
- package/dist/dataFetcher.d.ts +5 -0
- package/dist/dataFetcher.js +21 -0
- package/dist/html.d.ts +3 -0
- package/dist/html.js +171 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.js +9 -2
- package/dist/link.d.ts +5 -0
- package/dist/link.js +22 -0
- package/dist/routeContext.d.ts +7 -0
- package/dist/routeContext.js +5 -0
- package/dist/routes.d.ts +6 -18
- package/dist/routes.js +102 -26
- package/dist/server.d.ts +2 -0
- package/dist/server.js +67 -0
- package/dist/types.d.ts +74 -1
- package/dist/types.js +1 -1
- package/dist/useFetcher.d.ts +3 -0
- package/dist/useFetcher.js +12 -0
- package/dist/withRouter.d.ts +17 -0
- package/dist/withRouter.js +41 -0
- package/package.json +29 -25
- package/dist/app.d.ts +0 -14
- package/dist/app.js +0 -35
package/package.json
CHANGED
|
@@ -1,41 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/renderer-react",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-canary-20240513.3",
|
|
4
4
|
"description": "@umijs/renderer-react",
|
|
5
|
+
"homepage": "https://github.com/umijs/umi/tree/master/packages/renderer-react#readme",
|
|
6
|
+
"bugs": "https://github.com/umijs/umi/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/umijs/umi"
|
|
10
|
+
},
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"sideEffects": false,
|
|
5
13
|
"main": "dist/index.js",
|
|
6
14
|
"types": "dist/index.d.ts",
|
|
7
15
|
"files": [
|
|
8
16
|
"dist"
|
|
9
17
|
],
|
|
10
|
-
"scripts": {
|
|
11
|
-
"build": "pnpm tsc",
|
|
12
|
-
"build:deps": "pnpm esno ../../scripts/bundleDeps.ts",
|
|
13
|
-
"dev": "pnpm build -- --watch"
|
|
14
|
-
},
|
|
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
18
|
"dependencies": {
|
|
29
|
-
"
|
|
30
|
-
"
|
|
19
|
+
"@babel/runtime": "7.23.6",
|
|
20
|
+
"@loadable/component": "5.15.2",
|
|
21
|
+
"history": "5.3.0",
|
|
22
|
+
"react-helmet-async": "1.3.0",
|
|
23
|
+
"react-router-dom": "6.3.0"
|
|
31
24
|
},
|
|
32
25
|
"devDependencies": {
|
|
33
|
-
"react": "18.
|
|
34
|
-
"react-dom": "18.
|
|
26
|
+
"react": "18.1.0",
|
|
27
|
+
"react-dom": "18.1.0"
|
|
35
28
|
},
|
|
36
29
|
"peerDependencies": {
|
|
37
30
|
"react": ">=16.8",
|
|
38
31
|
"react-dom": ">=16.8"
|
|
39
32
|
},
|
|
40
|
-
"
|
|
41
|
-
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"authors": [
|
|
37
|
+
"chencheng <sorrycc@gmail.com> (https://github.com/sorrycc)"
|
|
38
|
+
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "umi-scripts father build",
|
|
41
|
+
"build:deps": "umi-scripts bundleDeps",
|
|
42
|
+
"dev": "umi-scripts father dev",
|
|
43
|
+
"test": "umi-scripts jest-turbo"
|
|
44
|
+
}
|
|
45
|
+
}
|
package/dist/app.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { Location } from 'history';
|
|
3
|
-
import { Navigator } from 'react-router-dom';
|
|
4
|
-
import { IRoutesById } from './types';
|
|
5
|
-
export declare function App(props: {
|
|
6
|
-
navigator: Navigator;
|
|
7
|
-
location: Location;
|
|
8
|
-
routes: IRoutesById;
|
|
9
|
-
routeComponents: Record<string, any>;
|
|
10
|
-
pluginManager: any;
|
|
11
|
-
}): JSX.Element;
|
|
12
|
-
export declare function RouteComponent(props: {
|
|
13
|
-
id: string;
|
|
14
|
-
}): JSX.Element;
|
package/dist/app.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Router, useRoutes } from 'react-router-dom';
|
|
3
|
-
import { AppContext, useAppContext } from './appContext';
|
|
4
|
-
import { createClientRoutes } from './routes';
|
|
5
|
-
export function App(props) {
|
|
6
|
-
const clientRoutes = React.useMemo(() => {
|
|
7
|
-
return createClientRoutes({
|
|
8
|
-
routesById: props.routes,
|
|
9
|
-
Component: RouteComponent,
|
|
10
|
-
});
|
|
11
|
-
}, [props.routes]);
|
|
12
|
-
return (React.createElement(AppContext.Provider, { value: {
|
|
13
|
-
routes: props.routes,
|
|
14
|
-
routeComponents: props.routeComponents,
|
|
15
|
-
pluginManager: props.pluginManager,
|
|
16
|
-
clientRoutes,
|
|
17
|
-
} },
|
|
18
|
-
React.createElement(Router, { navigator: props.navigator, location: props.location },
|
|
19
|
-
React.createElement(Routes, null))));
|
|
20
|
-
}
|
|
21
|
-
function Routes() {
|
|
22
|
-
const { clientRoutes } = useAppContext();
|
|
23
|
-
return useRoutes(clientRoutes) || clientRoutes[0].element;
|
|
24
|
-
}
|
|
25
|
-
function Loading() {
|
|
26
|
-
return React.createElement("div", null, "Loading...");
|
|
27
|
-
}
|
|
28
|
-
export function RouteComponent(props) {
|
|
29
|
-
const loader = useAppContext().routeComponents[props.id];
|
|
30
|
-
const RouteComponent = React.lazy(loader);
|
|
31
|
-
// ref: https://reactjs.org/docs/code-splitting.html
|
|
32
|
-
// TODO: replace with https://github.com/gregberge/loadable-components when we support ssr
|
|
33
|
-
return (React.createElement(React.Suspense, { fallback: React.createElement(Loading, null) },
|
|
34
|
-
React.createElement(RouteComponent, null)));
|
|
35
|
-
}
|