@modern-js/runtime-utils 2.51.0 → 2.52.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.
|
@@ -40,7 +40,7 @@ const transformNestedRoutes = (routes, reporter) => {
|
|
|
40
40
|
const renderNestedRoute = (nestedRoute, options = {}) => {
|
|
41
41
|
const { children, index, id, component, isRoot, lazyImport, config, handle } = nestedRoute;
|
|
42
42
|
const Component = component;
|
|
43
|
-
const { parent,
|
|
43
|
+
const { parent, props = {}, reporter } = options;
|
|
44
44
|
const routeProps = {
|
|
45
45
|
caseSensitive: nestedRoute.caseSensitive,
|
|
46
46
|
path: nestedRoute.path,
|
|
@@ -78,15 +78,10 @@ const renderNestedRoute = (nestedRoute, options = {}) => {
|
|
|
78
78
|
} else if (isLoadableComponent(Component) && lazyImport) {
|
|
79
79
|
element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {});
|
|
80
80
|
} else if (isRoot) {
|
|
81
|
-
element = /* @__PURE__ */ (0, import_jsx_runtime.
|
|
82
|
-
children:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}),
|
|
86
|
-
typeof document === "undefined" && DeferredDataComponent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DeferredDataComponent, {
|
|
87
|
-
nonce: props === null || props === void 0 ? void 0 : props.nonce
|
|
88
|
-
})
|
|
89
|
-
]
|
|
81
|
+
element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
82
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {
|
|
83
|
+
...props
|
|
84
|
+
})
|
|
90
85
|
});
|
|
91
86
|
} else if (lazyImport) {
|
|
92
87
|
element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, {
|
|
@@ -2,7 +2,7 @@ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
|
2
2
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
3
3
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
4
4
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
5
|
-
import { jsx as _jsx,
|
|
5
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
6
6
|
import { Suspense } from "react";
|
|
7
7
|
import { createRoutesFromElements, Outlet, Route } from "react-router-dom";
|
|
8
8
|
import { LOADER_REPORTER_NAME } from "@modern-js/utils/universal/constants";
|
|
@@ -38,7 +38,7 @@ var renderNestedRoute = function(nestedRoute) {
|
|
|
38
38
|
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
39
39
|
var children = nestedRoute.children, index = nestedRoute.index, id = nestedRoute.id, component = nestedRoute.component, isRoot = nestedRoute.isRoot, lazyImport = nestedRoute.lazyImport, config = nestedRoute.config, handle = nestedRoute.handle;
|
|
40
40
|
var Component = component;
|
|
41
|
-
var parent = options.parent,
|
|
41
|
+
var parent = options.parent, _options_props = options.props, props = _options_props === void 0 ? {} : _options_props, reporter = options.reporter;
|
|
42
42
|
var routeProps = {
|
|
43
43
|
caseSensitive: nestedRoute.caseSensitive,
|
|
44
44
|
path: nestedRoute.path,
|
|
@@ -73,13 +73,8 @@ var renderNestedRoute = function(nestedRoute) {
|
|
|
73
73
|
} else if (isLoadableComponent(Component) && lazyImport) {
|
|
74
74
|
element = /* @__PURE__ */ _jsx(Component, {});
|
|
75
75
|
} else if (isRoot) {
|
|
76
|
-
element = /* @__PURE__ */
|
|
77
|
-
children:
|
|
78
|
-
/* @__PURE__ */ _jsx(Component, _object_spread({}, props)),
|
|
79
|
-
typeof document === "undefined" && DeferredDataComponent && /* @__PURE__ */ _jsx(DeferredDataComponent, {
|
|
80
|
-
nonce: props === null || props === void 0 ? void 0 : props.nonce
|
|
81
|
-
})
|
|
82
|
-
]
|
|
76
|
+
element = /* @__PURE__ */ _jsx(_Fragment, {
|
|
77
|
+
children: /* @__PURE__ */ _jsx(Component, _object_spread({}, props))
|
|
83
78
|
});
|
|
84
79
|
} else if (lazyImport) {
|
|
85
80
|
element = /* @__PURE__ */ _jsx(Suspense, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Suspense } from "react";
|
|
3
3
|
import { createRoutesFromElements, Outlet, Route } from "react-router-dom";
|
|
4
4
|
import { LOADER_REPORTER_NAME } from "@modern-js/utils/universal/constants";
|
|
@@ -16,7 +16,7 @@ const transformNestedRoutes = (routes, reporter) => {
|
|
|
16
16
|
const renderNestedRoute = (nestedRoute, options = {}) => {
|
|
17
17
|
const { children, index, id, component, isRoot, lazyImport, config, handle } = nestedRoute;
|
|
18
18
|
const Component = component;
|
|
19
|
-
const { parent,
|
|
19
|
+
const { parent, props = {}, reporter } = options;
|
|
20
20
|
const routeProps = {
|
|
21
21
|
caseSensitive: nestedRoute.caseSensitive,
|
|
22
22
|
path: nestedRoute.path,
|
|
@@ -54,15 +54,10 @@ const renderNestedRoute = (nestedRoute, options = {}) => {
|
|
|
54
54
|
} else if (isLoadableComponent(Component) && lazyImport) {
|
|
55
55
|
element = /* @__PURE__ */ _jsx(Component, {});
|
|
56
56
|
} else if (isRoot) {
|
|
57
|
-
element = /* @__PURE__ */
|
|
58
|
-
children:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}),
|
|
62
|
-
typeof document === "undefined" && DeferredDataComponent && /* @__PURE__ */ _jsx(DeferredDataComponent, {
|
|
63
|
-
nonce: props === null || props === void 0 ? void 0 : props.nonce
|
|
64
|
-
})
|
|
65
|
-
]
|
|
57
|
+
element = /* @__PURE__ */ _jsx(_Fragment, {
|
|
58
|
+
children: /* @__PURE__ */ _jsx(Component, {
|
|
59
|
+
...props
|
|
60
|
+
})
|
|
66
61
|
});
|
|
67
62
|
} else if (lazyImport) {
|
|
68
63
|
element = /* @__PURE__ */ _jsx(Suspense, {
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.
|
|
18
|
+
"version": "2.52.0",
|
|
19
19
|
"_comment": "Provide ESM and CJS exports, ESM is used by runtime package, for treeshaking",
|
|
20
20
|
"exports": {
|
|
21
21
|
"./router": {
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"react-router-dom": "6.22.0",
|
|
115
115
|
"@remix-run/router": "1.15.0",
|
|
116
116
|
"@swc/helpers": "0.5.3",
|
|
117
|
-
"@modern-js/utils": "2.
|
|
117
|
+
"@modern-js/utils": "2.52.0"
|
|
118
118
|
},
|
|
119
119
|
"peerDependencies": {
|
|
120
120
|
"react": ">=17.0.0",
|
|
@@ -137,9 +137,9 @@
|
|
|
137
137
|
"jest": "^29",
|
|
138
138
|
"typescript": "^5",
|
|
139
139
|
"@types/serialize-javascript": "^5.0.1",
|
|
140
|
-
"@scripts/build": "2.
|
|
141
|
-
"@modern-js/types": "2.
|
|
142
|
-
"@scripts/jest-config": "2.
|
|
140
|
+
"@scripts/build": "2.52.0",
|
|
141
|
+
"@modern-js/types": "2.52.0",
|
|
142
|
+
"@scripts/jest-config": "2.52.0"
|
|
143
143
|
},
|
|
144
144
|
"sideEffects": false,
|
|
145
145
|
"scripts": {
|