@modern-js/utils 2.7.1-alpha.1 → 2.8.1-alpha.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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @modern-js/utils
2
2
 
3
+ ## 2.8.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 1104a9f18b: feat: support start web service only
8
+ feat: 支持只启动 web 服务
9
+ - 1f6ca2c7fb: fix: nested routes in ssg
10
+ fix: 修复嵌套路由在 SSG 中的问题
11
+
3
12
  ## 2.7.0
4
13
 
5
14
  ### Minor Changes
@@ -50,7 +50,7 @@ const transformNestedRoutes = (routes) => {
50
50
  return (0, import_react_router_dom.createRoutesFromElements)(routeElements);
51
51
  };
52
52
  const renderNestedRoute = (nestedRoute, options = {}) => {
53
- const { children, index, id, component, isRoot } = nestedRoute;
53
+ const { children, index, id, component, isRoot, lazyImport } = nestedRoute;
54
54
  const Component = component;
55
55
  const { parent, DeferredDataComponent } = options;
56
56
  const routeProps = {
@@ -72,22 +72,24 @@ const renderNestedRoute = (nestedRoute, options = {}) => {
72
72
  }
73
73
  let element;
74
74
  if (Component) {
75
- if (parent == null ? void 0 : parent.loading) {
75
+ if ((parent == null ? void 0 : parent.loading) && lazyImport) {
76
76
  const Loading = parent.loading;
77
77
  if (isLoadableComponent(Component)) {
78
78
  element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loading, {}) });
79
79
  } else {
80
80
  element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loading, {}), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}) });
81
81
  }
82
- } else if (isLoadableComponent(Component)) {
82
+ } else if (isLoadableComponent(Component) && lazyImport) {
83
83
  element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {});
84
84
  } else if (isRoot) {
85
85
  element = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
86
86
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}),
87
87
  typeof document === "undefined" && DeferredDataComponent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DeferredDataComponent, {})
88
88
  ] });
89
- } else {
89
+ } else if (lazyImport) {
90
90
  element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}) });
91
+ } else {
92
+ element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {});
91
93
  }
92
94
  } else {
93
95
  nestedRoute.loading = parent == null ? void 0 : parent.loading;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.7.1-alpha.1",
14
+ "version": "2.8.1-alpha.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/index.d.ts",
17
17
  "main": "./dist/index.js",
@@ -161,15 +161,15 @@
161
161
  "react": ">=17.0.0",
162
162
  "react-dom": ">=17.0.0",
163
163
  "react-router-dom": "^6.8.1",
164
- "@modern-js/types": "2.7.0",
165
- "@scripts/build": "2.7.0",
166
- "@scripts/jest-config": "2.7.0",
167
164
  "@types/jest": "^27",
168
165
  "@types/node": "^14",
169
166
  "jest": "^27",
170
167
  "typescript": "^4",
171
168
  "webpack": "^5.75.0",
172
- "@types/serialize-javascript": "^5.0.1"
169
+ "@types/serialize-javascript": "^5.0.1",
170
+ "@modern-js/types": "2.8.0",
171
+ "@scripts/build": "2.8.0",
172
+ "@scripts/jest-config": "2.8.0"
173
173
  },
174
174
  "sideEffects": false,
175
175
  "scripts": {