@modern-js/plugin-router-v5 2.37.1 → 2.37.2-fix.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/dist/cjs/cli/index.js +37 -81
- package/dist/cjs/runtime/hooks.js +2 -2
- package/dist/cjs/runtime/index.js +4 -1
- package/dist/cjs/runtime/plugin.js +71 -93
- package/dist/esm/cli/index.js +44 -91
- package/dist/esm/runtime/hooks.js +2 -2
- package/dist/esm/runtime/index.js +3 -1
- package/dist/esm/runtime/plugin.js +72 -89
- package/dist/esm-node/cli/index.js +38 -82
- package/dist/esm-node/runtime/hooks.js +2 -2
- package/dist/esm-node/runtime/index.js +3 -1
- package/dist/esm-node/runtime/plugin.js +72 -84
- package/dist/types/cli/index.d.ts +3 -3
- package/dist/types/cli/types.d.ts +5 -5
- package/dist/types/index.d.ts +1 -1
- package/dist/types/runtime/DefaultNotFound.d.ts +2 -2
- package/dist/types/runtime/hooks.d.ts +4 -5
- package/dist/types/runtime/index.d.ts +3 -3
- package/dist/types/runtime/plugin.d.ts +34 -45
- package/dist/types/runtime/utils.d.ts +4 -4
- package/package.json +12 -13
@@ -1,52 +1,41 @@
|
|
1
|
-
import
|
2
|
-
import {
|
3
|
-
import
|
4
|
-
import type
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
baseUrl: string;
|
10
|
-
params: Record<string, string>;
|
11
|
-
};
|
12
|
-
};
|
13
|
-
}
|
14
|
-
}
|
1
|
+
import type { RuntimePluginFuture } from '@modern-js/runtime';
|
2
|
+
import { type BrowserHistoryBuildOptions, type HashHistoryBuildOptions, type History } from 'history';
|
3
|
+
import type React from 'react';
|
4
|
+
import { type RouteProps } from 'react-router-dom';
|
5
|
+
import { modifyRoutesHook } from './hooks';
|
6
|
+
export type RouterExtendsHooks = {
|
7
|
+
modifyRoutes: typeof modifyRoutesHook;
|
8
|
+
};
|
15
9
|
export type SingleRouteConfig = RouteProps & {
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
10
|
+
redirect?: string;
|
11
|
+
routes?: SingleRouteConfig[];
|
12
|
+
key?: string;
|
13
|
+
/**
|
14
|
+
* layout component
|
15
|
+
*/
|
16
|
+
layout?: React.ComponentType;
|
17
|
+
/**
|
18
|
+
* component would be rendered when route macthed.
|
19
|
+
*/
|
20
|
+
component?: React.ComponentType;
|
27
21
|
};
|
28
22
|
export type HistoryConfig = {
|
29
|
-
|
30
|
-
|
23
|
+
supportHtml5History: true;
|
24
|
+
historyOptions: BrowserHistoryBuildOptions;
|
31
25
|
} | {
|
32
|
-
|
33
|
-
|
26
|
+
supportHtml5History: false;
|
27
|
+
historyOptions: HashHistoryBuildOptions;
|
34
28
|
};
|
35
29
|
export type RouterConfig = Partial<HistoryConfig> & {
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
30
|
+
mode?: 'react-router-5';
|
31
|
+
routesConfig?: {
|
32
|
+
globalApp?: React.ComponentType<any>;
|
33
|
+
routes?: SingleRouteConfig[];
|
34
|
+
};
|
35
|
+
createRoutes?: () => React.ComponentType<any> | null;
|
36
|
+
history?: History;
|
37
|
+
serverBase?: string[];
|
44
38
|
};
|
45
|
-
export declare const routerPlugin: ({
|
46
|
-
|
47
|
-
|
48
|
-
supportHtml5History,
|
49
|
-
routesConfig,
|
50
|
-
createRoutes,
|
51
|
-
historyOptions
|
52
|
-
}: RouterConfig) => Plugin;
|
39
|
+
export declare const routerPlugin: (userConfig?: RouterConfig) => RuntimePluginFuture<{
|
40
|
+
extendHooks: RouterExtendsHooks;
|
41
|
+
}>;
|
@@ -1,6 +1,6 @@
|
|
1
|
-
|
2
|
-
import { RouterConfig } from './plugin';
|
3
|
-
export declare function renderRoutes(routesConfig?: RouterConfig['routesConfig'], extraProps?: any): JSX.Element | null;
|
1
|
+
import React from 'react';
|
2
|
+
import type { RouterConfig } from './plugin';
|
3
|
+
export declare function renderRoutes(routesConfig?: RouterConfig['routesConfig'], extraProps?: any): React.JSX.Element | null;
|
4
4
|
export declare function getLocation(serverContext: any): string;
|
5
5
|
export declare const urlJoin: (...parts: string[]) => string;
|
6
|
-
export declare function standardSlash(str: string): string;
|
6
|
+
export declare function standardSlash(str: string): string;
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.37.
|
18
|
+
"version": "2.37.2-fix.0",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/cli/index.d.ts",
|
21
21
|
"main": "./dist/cjs/cli/index.js",
|
@@ -60,9 +60,10 @@
|
|
60
60
|
"hoist-non-react-statics": "^3.3.2",
|
61
61
|
"react-router-dom": "^5.3.4",
|
62
62
|
"@swc/helpers": "0.5.1",
|
63
|
-
"@modern-js/plugin": "2.37.
|
64
|
-
"@modern-js/
|
65
|
-
"@modern-js/utils": "2.37.
|
63
|
+
"@modern-js/plugin": "2.37.2",
|
64
|
+
"@modern-js/utils": "2.37.2",
|
65
|
+
"@modern-js/runtime-utils": "2.37.2",
|
66
|
+
"@modern-js/types": "2.37.2"
|
66
67
|
},
|
67
68
|
"peerDependencies": {
|
68
69
|
"react": ">=17",
|
@@ -78,19 +79,17 @@
|
|
78
79
|
"react-dom": "^18",
|
79
80
|
"ts-jest": "^29.1.0",
|
80
81
|
"typescript": "^5",
|
81
|
-
"@modern-js/app-tools": "2.37.
|
82
|
-
"@modern-js/
|
83
|
-
"@
|
84
|
-
"@
|
85
|
-
"@modern-js/
|
86
|
-
"@
|
87
|
-
"@scripts/jest-config": "2.37.1"
|
82
|
+
"@modern-js/app-tools": "2.37.2",
|
83
|
+
"@modern-js/runtime": "2.37.2",
|
84
|
+
"@scripts/jest-config": "2.37.2",
|
85
|
+
"@scripts/build": "2.37.2",
|
86
|
+
"@modern-js/utils": "2.37.2",
|
87
|
+
"@modern-js/core": "2.37.2"
|
88
88
|
},
|
89
89
|
"sideEffects": false,
|
90
90
|
"publishConfig": {
|
91
91
|
"registry": "https://registry.npmjs.org/",
|
92
|
-
"access": "public"
|
93
|
-
"provenance": true
|
92
|
+
"access": "public"
|
94
93
|
},
|
95
94
|
"scripts": {
|
96
95
|
"dev": "modern-lib build --watch",
|