@modern-js/runtime 2.63.0 → 2.63.1

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.
@@ -89,7 +89,7 @@ const runtimeGlobalContext = ({ srcDirectory, internalSrcAlias, metaName, entry,
89
89
  return `import { setGlobalContext } from '@${metaName}/runtime/context'
90
90
 
91
91
  import App from '${// We need to get the path of App.tsx here, but the entry is `src/entry.tsx`
92
- (0, import_utils.formatImportPath)(customEntry ? entry.replace("entry.tsx", "App").replace(srcDirectory, internalSrcAlias) : entry.replace(srcDirectory, internalSrcAlias).replace(".tsx", ""))}';
92
+ (0, import_utils.formatImportPath)(customEntry ? entry.replace(/entry\.[tj]sx/, "App").replace(srcDirectory, internalSrcAlias) : entry.replace(srcDirectory, internalSrcAlias).replace(/\.[tj]sx/, ""))}';
93
93
 
94
94
  setGlobalContext({
95
95
  App,
@@ -109,9 +109,11 @@ const routerPlugin = (userConfig = {}) => {
109
109
  if (routerContext instanceof Response) {
110
110
  return interrupt(routerContext);
111
111
  }
112
- if (routerContext.statusCode >= 500 && routerContext.statusCode < 600 && loaderFailureMode === "clientRender") {
112
+ if (routerContext.statusCode >= 500 && routerContext.statusCode < 600 && // TODO: if loaderFailureMode is not 'errroBoundary', error log will not be printed.
113
+ loaderFailureMode === "clientRender") {
113
114
  routerContext.statusCode = 200;
114
- throw routerContext.errors[0];
115
+ const errors = Object.values(routerContext.errors);
116
+ throw errors[0];
115
117
  }
116
118
  const router = (0, import_router.createStaticRouter)(routes, routerContext);
117
119
  context.routerContext = routerContext;
@@ -44,7 +44,7 @@ var runtimeRegister = function(param) {
44
44
  };
45
45
  var runtimeGlobalContext = function(param) {
46
46
  var srcDirectory = param.srcDirectory, internalSrcAlias = param.internalSrcAlias, metaName = param.metaName, entry = param.entry, customEntry = param.customEntry;
47
- return "import { setGlobalContext } from '@".concat(metaName, "/runtime/context'\n\nimport App from '").concat(formatImportPath(customEntry ? entry.replace("entry.tsx", "App").replace(srcDirectory, internalSrcAlias) : entry.replace(srcDirectory, internalSrcAlias).replace(".tsx", "")), "';\n\nsetGlobalContext({\n App,\n});");
47
+ return "import { setGlobalContext } from '@".concat(metaName, "/runtime/context'\n\nimport App from '").concat(formatImportPath(customEntry ? entry.replace(/entry\.[tj]sx/, "App").replace(srcDirectory, internalSrcAlias) : entry.replace(srcDirectory, internalSrcAlias).replace(/\.[tj]sx/, "")), "';\n\nsetGlobalContext({\n App,\n});");
48
48
  };
49
49
  export {
50
50
  index,
@@ -40,7 +40,7 @@ var routerPlugin = function() {
40
40
  return {
41
41
  beforeRender: function beforeRender(context, interrupt) {
42
42
  return _async_to_generator(function() {
43
- var _context_ssrContext, _context_ssrContext_onTiming, _context_ssrContext1, pluginConfig, _merge, _merge_basename, basename, routesConfig, createRoutes, _context_ssrContext2, request, ssrMode, nonce, _context_ssrContext_loaderFailureMode, loaderFailureMode, baseUrl, _basename, reporter, requestContext, runner, routes, query, remixRequest, end, routerContext, cost, router;
43
+ var _context_ssrContext, _context_ssrContext_onTiming, _context_ssrContext1, pluginConfig, _merge, _merge_basename, basename, routesConfig, createRoutes, _context_ssrContext2, request, ssrMode, nonce, _context_ssrContext_loaderFailureMode, loaderFailureMode, baseUrl, _basename, reporter, requestContext, runner, routes, query, remixRequest, end, routerContext, cost, errors, router;
44
44
  return _ts_generator(this, function(_state) {
45
45
  switch (_state.label) {
46
46
  case 0:
@@ -98,9 +98,11 @@ var routerPlugin = function() {
98
98
  interrupt(routerContext)
99
99
  ];
100
100
  }
101
- if (routerContext.statusCode >= 500 && routerContext.statusCode < 600 && loaderFailureMode === "clientRender") {
101
+ if (routerContext.statusCode >= 500 && routerContext.statusCode < 600 && // TODO: if loaderFailureMode is not 'errroBoundary', error log will not be printed.
102
+ loaderFailureMode === "clientRender") {
102
103
  routerContext.statusCode = 200;
103
- throw routerContext.errors[0];
104
+ errors = Object.values(routerContext.errors);
105
+ throw errors[0];
104
106
  }
105
107
  router = createStaticRouter(routes, routerContext);
106
108
  context.routerContext = routerContext;
@@ -53,7 +53,7 @@ const runtimeGlobalContext = ({ srcDirectory, internalSrcAlias, metaName, entry,
53
53
  return `import { setGlobalContext } from '@${metaName}/runtime/context'
54
54
 
55
55
  import App from '${// We need to get the path of App.tsx here, but the entry is `src/entry.tsx`
56
- formatImportPath(customEntry ? entry.replace("entry.tsx", "App").replace(srcDirectory, internalSrcAlias) : entry.replace(srcDirectory, internalSrcAlias).replace(".tsx", ""))}';
56
+ formatImportPath(customEntry ? entry.replace(/entry\.[tj]sx/, "App").replace(srcDirectory, internalSrcAlias) : entry.replace(srcDirectory, internalSrcAlias).replace(/\.[tj]sx/, ""))}';
57
57
 
58
58
  setGlobalContext({
59
59
  App,
@@ -75,9 +75,11 @@ const routerPlugin = (userConfig = {}) => {
75
75
  if (routerContext instanceof Response) {
76
76
  return interrupt(routerContext);
77
77
  }
78
- if (routerContext.statusCode >= 500 && routerContext.statusCode < 600 && loaderFailureMode === "clientRender") {
78
+ if (routerContext.statusCode >= 500 && routerContext.statusCode < 600 && // TODO: if loaderFailureMode is not 'errroBoundary', error log will not be printed.
79
+ loaderFailureMode === "clientRender") {
79
80
  routerContext.statusCode = 200;
80
- throw routerContext.errors[0];
81
+ const errors = Object.values(routerContext.errors);
82
+ throw errors[0];
81
83
  }
82
84
  const router = createStaticRouter(routes, routerContext);
83
85
  context.routerContext = routerContext;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.63.0",
18
+ "version": "2.63.1",
19
19
  "engines": {
20
20
  "node": ">=14.17.6"
21
21
  },
@@ -200,11 +200,11 @@
200
200
  "react-is": "^18",
201
201
  "react-side-effect": "^2.1.1",
202
202
  "styled-components": "^5.3.1",
203
- "@modern-js/plugin": "2.63.0",
204
- "@modern-js/plugin-data-loader": "2.63.0",
205
- "@modern-js/types": "2.63.0",
206
- "@modern-js/utils": "2.63.0",
207
- "@modern-js/runtime-utils": "2.63.0"
203
+ "@modern-js/plugin-data-loader": "2.63.1",
204
+ "@modern-js/runtime-utils": "2.63.1",
205
+ "@modern-js/plugin": "2.63.1",
206
+ "@modern-js/types": "2.63.1",
207
+ "@modern-js/utils": "2.63.1"
208
208
  },
209
209
  "peerDependencies": {
210
210
  "react": ">=17",
@@ -212,7 +212,7 @@
212
212
  },
213
213
  "devDependencies": {
214
214
  "@remix-run/web-fetch": "^4.1.3",
215
- "@rsbuild/core": "~1.1.5",
215
+ "@rsbuild/core": "1.1.8",
216
216
  "@testing-library/react": "^13.4.0",
217
217
  "@types/cookie": "0.6.0",
218
218
  "@types/invariant": "^2.2.30",
@@ -228,10 +228,10 @@
228
228
  "ts-node": "^10.9.1",
229
229
  "typescript": "^5",
230
230
  "webpack": "^5.96.1",
231
- "@modern-js/app-tools": "2.63.0",
232
- "@scripts/jest-config": "2.63.0",
233
- "@modern-js/core": "2.63.0",
234
- "@scripts/build": "2.63.0"
231
+ "@modern-js/app-tools": "2.63.1",
232
+ "@scripts/build": "2.63.1",
233
+ "@modern-js/core": "2.63.1",
234
+ "@scripts/jest-config": "2.63.1"
235
235
  },
236
236
  "sideEffects": false,
237
237
  "publishConfig": {