From d3694a7621c414a2dbc0d56c371726f7bb68396d Mon Sep 17 00:00:00 2001 From: Devmax Date: Mon, 11 Dec 2023 11:17:29 -0800 Subject: [PATCH] Update getRoutes --- package.json | 2 + .../src/common/components/Dashboard.tsx | 4 +- .../frontend-server/src/modules/module.tsx | 9 +- yarn.lock | 99 +++++++------------ 4 files changed, 40 insertions(+), 74 deletions(-) diff --git a/package.json b/package.json index 1be16257a..340f6dbe7 100755 --- a/package.json +++ b/package.json @@ -306,6 +306,8 @@ "raw-loader": "^4.0.2", "react-addons-test-utils": "^16.0.0-alpha.3", "react-refresh": "^0.14.0", + "react-router": "^6.4.0", + "react-router-dom": "^6.4.0", "react-test-renderer": "^18.2.0", "redux-devtools-extension": "^2.13.9", "redux-mock-store": "^1.5.4", diff --git a/packages-modules/counter/browser/src/common/components/Dashboard.tsx b/packages-modules/counter/browser/src/common/components/Dashboard.tsx index f1ce50960..272719f94 100755 --- a/packages-modules/counter/browser/src/common/components/Dashboard.tsx +++ b/packages-modules/counter/browser/src/common/components/Dashboard.tsx @@ -1,4 +1,4 @@ import * as React from 'react'; -import { renderRoutes } from 'react-router-config'; +// import { renderRoutes } from 'react-router-config'; -export default (props) => <>{renderRoutes(props.route.routes, { matchPath: props.route.path })}; +export default (props) => <>{props.routes}; diff --git a/servers/frontend-server/src/modules/module.tsx b/servers/frontend-server/src/modules/module.tsx index cf0dfab21..417899e7b 100755 --- a/servers/frontend-server/src/modules/module.tsx +++ b/servers/frontend-server/src/modules/module.tsx @@ -9,15 +9,8 @@ import { ErrorBoundary } from '../app/ErrorBoundary'; const features = new Feature(FeatureWithRouterFactory, counterModules); -// console.log(features.getRoutes()); -// features.getRoutes() shouyld be updated as following, this code will be replaced after that. -let routeConfig = sortKeys(features.routeConfig) - .map((route) => Object.values(route)[0]) - .map((route) => ({ ...route, Component: route.component })); -console.log(routeConfig); - export const MainRoute = (props) => { - const routes = useRoutes(routeConfig); + const routes = useRoutes(features.getConfiguredRoutes()); return diff --git a/yarn.lock b/yarn.lock index 3f8461641..379d5a5a2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2032,7 +2032,7 @@ resolved "https://registry.yarnpkg.com/@babel/regjsgen/-/regjsgen-0.8.0.tgz#f0ba69b075e1f05fb2825b7fad991e7adbb18310" integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA== -"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.0", "@babel/runtime@^7.10.1", "@babel/runtime@^7.10.4", "@babel/runtime@^7.11.1", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.13.10", "@babel/runtime@^7.15.4", "@babel/runtime@^7.16.0", "@babel/runtime@^7.16.3", "@babel/runtime@^7.16.7", "@babel/runtime@^7.18.0", "@babel/runtime@^7.18.3", "@babel/runtime@^7.18.6", "@babel/runtime@^7.20.0", "@babel/runtime@^7.20.1", "@babel/runtime@^7.20.6", "@babel/runtime@^7.20.7", "@babel/runtime@^7.21.0", "@babel/runtime@^7.23.2", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.2", "@babel/runtime@^7.7.7", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2": +"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.0", "@babel/runtime@^7.10.1", "@babel/runtime@^7.10.4", "@babel/runtime@^7.11.1", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.13.10", "@babel/runtime@^7.15.4", "@babel/runtime@^7.16.0", "@babel/runtime@^7.16.3", "@babel/runtime@^7.16.7", "@babel/runtime@^7.18.0", "@babel/runtime@^7.18.3", "@babel/runtime@^7.18.6", "@babel/runtime@^7.20.0", "@babel/runtime@^7.20.1", "@babel/runtime@^7.20.6", "@babel/runtime@^7.20.7", "@babel/runtime@^7.21.0", "@babel/runtime@^7.23.2", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.2", "@babel/runtime@^7.7.7", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2": version "7.23.2" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.2.tgz#062b0ac103261d68a966c4c7baf2ae3e62ec3885" integrity sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg== @@ -6269,6 +6269,11 @@ resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.12.0.tgz#e89b64b6fa97a8a5b740a4c38c2904b80f1f229a" integrity sha512-2hXv036Bux90e1GXTWSMfNzfDDK8LA8JYEWfyHxzvwdp6GyoWEovKc9cotb3KCKmkdwsIBuFGX7ScTWyiHv7Eg== +"@remix-run/router@1.13.1": + version "1.13.1" + resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.13.1.tgz#07e2a8006f23a3bc898b3f317e0a58cc8076b86e" + integrity sha512-so+DHzZKsoOcoXrILB4rqDkMDy7NLMErRdOxvzvOKb507YINKUP4Di+shbTZDhSE/pBZ+vr7XGIpcOO0VLSA+Q== + "@repeaterjs/repeater@^3.0.4": version "3.0.4" resolved "https://registry.yarnpkg.com/@repeaterjs/repeater/-/repeater-3.0.4.tgz#a04d63f4d1bf5540a41b01a921c9a7fddc3bd1ca" @@ -7907,16 +7912,7 @@ hoist-non-react-statics "^3.3.0" redux "^4.0.0" -"@types/react-router-config@^5.0.6": - version "5.0.9" - resolved "https://registry.yarnpkg.com/@types/react-router-config/-/react-router-config-5.0.9.tgz#8dad16c6b887d08efaa6d9da83e40db629ac21b6" - integrity sha512-a7zOj9yVUtM3Ns5stoseQAAsmppNxZpXDv6tZiFV5qlRmV4W96u53on1vApBX1eRSc8mrFOiB54Hc0Pk1J8GFg== - dependencies: - "@types/history" "^4.7.11" - "@types/react" "*" - "@types/react-router" "^5.1.0" - -"@types/react-router-dom@^5.3.3": +"@types/react-router-dom@^6.4.0": version "5.3.3" resolved "https://registry.yarnpkg.com/@types/react-router-dom/-/react-router-dom-5.3.3.tgz#e9d6b4a66fcdbd651a5f106c2656a30088cc1e83" integrity sha512-kpqnYK4wcdm5UaWI3fLcELopqLrHgLqNsdpHauzlQktfkHL3npOSwtj1Uz9oKBAzs7lFtVkV8j83voAz2D8fhw== @@ -7925,16 +7921,14 @@ "@types/react" "*" "@types/react-router" "*" -"@types/react-router-native@^5.1.0": - version "5.1.3" - resolved "https://registry.yarnpkg.com/@types/react-router-native/-/react-router-native-5.1.3.tgz#a59a74f76ae3d3586b561d3e387ddc7af4cf3467" - integrity sha512-l0KYUUQPcEWjzF1haAcLZb3OAYUW0PP3570A08q0SWM993lM+uLMlKAS79N3u2Q/OvCag/1WOW42jcuBQr4ftA== +"@types/react-router-native@^6.4.0": + version "6.4.0" + resolved "https://registry.yarnpkg.com/@types/react-router-native/-/react-router-native-6.4.0.tgz#c27dc14c55fd6025019db5ba820a7694682c76da" + integrity sha512-wrbXZ+73GuSpwE7LDjbjKx2xDn4pSJGHOQWgHjIZIRpYI5GmlC0Wt2C8wBeD7exUtWOoOuNgsAMlc2LiB0vNAw== dependencies: - "@types/history" "^4.7.11" - "@types/react" "*" - "@types/react-router" "*" + react-router-native "*" -"@types/react-router@*", "@types/react-router@^5.1.0", "@types/react-router@^5.1.19": +"@types/react-router@*", "@types/react-router@^6.4.0": version "5.1.20" resolved "https://registry.yarnpkg.com/@types/react-router/-/react-router-5.1.20.tgz#88eccaa122a82405ef3efbcaaa5dcdd9f021387c" integrity sha512-jGjmu/ZqS7FjSH6owMcD5qpq19+1RS9DeVRqfl1FeBMxTDQAGwlMWOcs52NDoXaNKyG3d1cYQFMs9rCrb88o9Q== @@ -8292,6 +8286,11 @@ resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406" integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ== +"@ungap/url-search-params@^0.2.2": + version "0.2.2" + resolved "https://registry.yarnpkg.com/@ungap/url-search-params/-/url-search-params-0.2.2.tgz#2de3bdec21476a9b70ef11fd7b794752f9afa04c" + integrity sha512-qQsguKXZVKdCixOHX9jqnX/K/1HekPDpGKyEcXHT+zR6EjGA7S4boSuelL4uuPv6YfhN0n8c4UxW+v/Z3gM2iw== + "@urql/core@2.3.6": version "2.3.6" resolved "https://registry.yarnpkg.com/@urql/core/-/core-2.3.6.tgz#ee0a6f8fde02251e9560c5f17dce5cd90f948552" @@ -17518,7 +17517,7 @@ history-with-query@^4.10.4: tiny-warning "^1.0.0" value-equal "^1.0.1" -history@^4.10.1, history@^4.9.0: +history@^4.10.1: version "4.10.1" resolved "https://registry.yarnpkg.com/history/-/history-4.10.1.tgz#33371a65e3a83b267434e2b3f3b1b4c58aad4cf3" integrity sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew== @@ -17542,7 +17541,7 @@ hoist-non-react-statics@^2.3.1: resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz#c5903cf409c0dfd908f388e619d86b9c1174cb47" integrity sha512-rqcy4pJo55FTTLWt+bU8ukscqHeE/e9KWvsOW2b/a3afxQZhwkQdT1rPPCJ0rYXdj4vNcasY8zHTH+jF/qStxw== -hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.1, hoist-non-react-statics@^3.3.2: +hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.1, hoist-non-react-statics@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45" integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw== @@ -25718,7 +25717,7 @@ promzard@^0.3.0: dependencies: read "1" -prop-types@15.x, prop-types@^15.5.0, prop-types@^15.5.10, prop-types@^15.5.8, prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.7.0, prop-types@^15.7.2, prop-types@^15.8.1: +prop-types@15.x, prop-types@^15.5.0, prop-types@^15.5.10, prop-types@^15.5.8, prop-types@^15.6.0, prop-types@^15.6.2, prop-types@^15.7.0, prop-types@^15.7.2, prop-types@^15.8.1: version "15.8.1" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5" integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg== @@ -26767,7 +26766,7 @@ react-highlight@^0.12.0: dependencies: highlight.js "^9.11.0" -react-is@^16.12.0, react-is@^16.13.0, react-is@^16.13.1, react-is@^16.6.0, react-is@^16.7.0: +react-is@^16.12.0, react-is@^16.13.0, react-is@^16.13.1, react-is@^16.7.0: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== @@ -27007,26 +27006,6 @@ react-resizable@^1.10.1: prop-types "15.x" react-draggable "^4.0.3" -react-router-config@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/react-router-config/-/react-router-config-5.1.1.tgz#0f4263d1a80c6b2dc7b9c1902c9526478194a988" - integrity sha512-DuanZjaD8mQp1ppHjgnnUnyOlqYXZVjnov/JzFhjLEwd3Z4dYjMSnqrEzzGThH47vpCOqPPwJM2FtthLeJ8Pbg== - dependencies: - "@babel/runtime" "^7.1.2" - -react-router-dom@^5.1.2, react-router-dom@^5.3.3: - version "5.3.4" - resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-5.3.4.tgz#2ed62ffd88cae6db134445f4a0c0ae8b91d2e5e6" - integrity sha512-m4EqFMHv/Ih4kpcBCONHbkT68KoAeHN4p3lAGoNryfHi0dMy0kCzEZakiKRsvg5wHZ/JLrLW8o8KomWiz/qbYQ== - dependencies: - "@babel/runtime" "^7.12.13" - history "^4.9.0" - loose-envify "^1.3.1" - prop-types "^15.6.2" - react-router "5.3.4" - tiny-invariant "^1.0.2" - tiny-warning "^1.0.0" - react-router-dom@^6.4.0: version "6.19.0" resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.19.0.tgz#ee807e36ae7dd954db7a3f770e38b7cc026c66a8" @@ -27035,28 +27014,13 @@ react-router-dom@^6.4.0: "@remix-run/router" "1.12.0" react-router "6.19.0" -react-router-native@^5.3.3: - version "5.3.4" - resolved "https://registry.yarnpkg.com/react-router-native/-/react-router-native-5.3.4.tgz#17e78c94776e49ada961118e21838964ab8e26b4" - integrity sha512-IVBs6opllXbUx6tHr7OYLScg2B3sTc5gP9zrQAZEJ+30aF3olYCRtLUEGOAuYKhjohYiH7pEM5WTcO+IYbApxg== +react-router-native@*, react-router-native@^6.4.0: + version "6.20.1" + resolved "https://registry.yarnpkg.com/react-router-native/-/react-router-native-6.20.1.tgz#b455529e37064ebfdd14c49651a3f3d8d0ce88d2" + integrity sha512-/B9aCtueCR8ok5/wdSXf87KPranHf7OkR3ePklWgPKBsZ6L+9IOIFsaE9bB6B4P+pdOM9gV6w9qqxPUhnLsYeA== dependencies: - prop-types "^15.6.1" - react-router "5.3.4" - -react-router@5.3.4, react-router@^5.3.3: - version "5.3.4" - resolved "https://registry.yarnpkg.com/react-router/-/react-router-5.3.4.tgz#8ca252d70fcc37841e31473c7a151cf777887bb5" - integrity sha512-Ys9K+ppnJah3QuaRiLxk+jDWOR1MekYQrlytiXxC1RyfbdsZkS5pvKAzCCr031xHixZwpnsYNT5xysdFHQaYsA== - dependencies: - "@babel/runtime" "^7.12.13" - history "^4.9.0" - hoist-non-react-statics "^3.1.0" - loose-envify "^1.3.1" - path-to-regexp "^1.7.0" - prop-types "^15.6.2" - react-is "^16.6.0" - tiny-invariant "^1.0.2" - tiny-warning "^1.0.0" + "@ungap/url-search-params" "^0.2.2" + react-router "6.20.1" react-router@6.19.0, react-router@^6.4.0: version "6.19.0" @@ -27065,6 +27029,13 @@ react-router@6.19.0, react-router@^6.4.0: dependencies: "@remix-run/router" "1.12.0" +react-router@6.20.1: + version "6.20.1" + resolved "https://registry.yarnpkg.com/react-router/-/react-router-6.20.1.tgz#e8cc326031d235aaeec405bb234af77cf0fe75ef" + integrity sha512-ccvLrB4QeT5DlaxSFFYi/KR8UMQ4fcD8zBcR71Zp1kaYTC5oJKYAp1cbavzGrogwxca+ubjkd7XjFZKBW8CxPA== + dependencies: + "@remix-run/router" "1.13.1" + react-shallow-renderer@^16.13.1, react-shallow-renderer@^16.15.0: version "16.15.0" resolved "https://registry.yarnpkg.com/react-shallow-renderer/-/react-shallow-renderer-16.15.0.tgz#48fb2cf9b23d23cde96708fe5273a7d3446f4457"