@modern-js/runtime 2.63.6 → 2.63.7-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.
@@ -180,7 +180,11 @@ const useRuntimeContext = () => {
180
180
  getInitData: () => {
181
181
  return Object.freeze(context.initialData);
182
182
  }
183
- } : {};
183
+ } : {
184
+ getInitData: () => {
185
+ return Object.freeze(context.initialData);
186
+ }
187
+ };
184
188
  const pickedContext = {
185
189
  ...context,
186
190
  context: tSSRContext,
@@ -109,10 +109,12 @@ const routerPlugin = (userConfig = {}) => {
109
109
  if (routerContext instanceof Response) {
110
110
  return interrupt(routerContext);
111
111
  }
112
- if (routerContext.statusCode >= 500 && routerContext.statusCode < 600 && // TODO: if loaderFailureMode is not 'errroBoundary', error log will not be printed.
113
- loaderFailureMode === "clientRender") {
112
+ const errors = Object.values(routerContext.errors || {});
113
+ if (
114
+ // TODO: if loaderFailureMode is not 'errroBoundary', error log will not be printed.
115
+ errors.length > 0 && loaderFailureMode === "clientRender"
116
+ ) {
114
117
  routerContext.statusCode = 200;
115
- const errors = Object.values(routerContext.errors);
116
118
  throw errors[0];
117
119
  }
118
120
  const router = (0, import_router.createStaticRouter)(routes, routerContext);
@@ -202,7 +202,11 @@ var useRuntimeContext = function() {
202
202
  getInitData: function() {
203
203
  return Object.freeze(context.initialData);
204
204
  }
205
- } : {};
205
+ } : {
206
+ getInitData: function() {
207
+ return Object.freeze(context.initialData);
208
+ }
209
+ };
206
210
  var pickedContext = _object_spread_props(_object_spread({}, context), {
207
211
  context: tSSRContext,
208
212
  request: (_context_ssrContext = context.ssrContext) === null || _context_ssrContext === void 0 ? void 0 : _context_ssrContext.request,
@@ -98,10 +98,12 @@ var routerPlugin = function() {
98
98
  interrupt(routerContext)
99
99
  ];
100
100
  }
101
- if (routerContext.statusCode >= 500 && routerContext.statusCode < 600 && // TODO: if loaderFailureMode is not 'errroBoundary', error log will not be printed.
102
- loaderFailureMode === "clientRender") {
101
+ errors = Object.values(routerContext.errors || {});
102
+ if (
103
+ // TODO: if loaderFailureMode is not 'errroBoundary', error log will not be printed.
104
+ errors.length > 0 && loaderFailureMode === "clientRender"
105
+ ) {
103
106
  routerContext.statusCode = 200;
104
- errors = Object.values(routerContext.errors);
105
107
  throw errors[0];
106
108
  }
107
109
  router = createStaticRouter(routes, routerContext);
@@ -145,7 +145,11 @@ const useRuntimeContext = () => {
145
145
  getInitData: () => {
146
146
  return Object.freeze(context.initialData);
147
147
  }
148
- } : {};
148
+ } : {
149
+ getInitData: () => {
150
+ return Object.freeze(context.initialData);
151
+ }
152
+ };
149
153
  const pickedContext = {
150
154
  ...context,
151
155
  context: tSSRContext,
@@ -75,10 +75,12 @@ const routerPlugin = (userConfig = {}) => {
75
75
  if (routerContext instanceof Response) {
76
76
  return interrupt(routerContext);
77
77
  }
78
- if (routerContext.statusCode >= 500 && routerContext.statusCode < 600 && // TODO: if loaderFailureMode is not 'errroBoundary', error log will not be printed.
79
- loaderFailureMode === "clientRender") {
78
+ const errors = Object.values(routerContext.errors || {});
79
+ if (
80
+ // TODO: if loaderFailureMode is not 'errroBoundary', error log will not be printed.
81
+ errors.length > 0 && loaderFailureMode === "clientRender"
82
+ ) {
80
83
  routerContext.statusCode = 200;
81
- const errors = Object.values(routerContext.errors);
82
84
  throw errors[0];
83
85
  }
84
86
  const router = createStaticRouter(routes, routerContext);
@@ -59,6 +59,7 @@ interface TSSRBaseContext {
59
59
  userAgent: string;
60
60
  cookie: string;
61
61
  };
62
+ getInitData: () => Readonly<Record<string, unknown> | undefined>;
62
63
  [propName: string]: any;
63
64
  }
64
65
  interface ServerContext extends TSSRBaseContext {
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.63.6",
18
+ "version": "2.63.7-alpha.0",
19
19
  "engines": {
20
20
  "node": ">=14.17.6"
21
21
  },
@@ -236,8 +236,7 @@
236
236
  "sideEffects": false,
237
237
  "publishConfig": {
238
238
  "registry": "https://registry.npmjs.org/",
239
- "access": "public",
240
- "provenance": true
239
+ "access": "public"
241
240
  },
242
241
  "scripts": {
243
242
  "dev": "modern-lib build --watch",