@bleedingdev/modern-js-runtime 3.9.0-ultramodern.3 → 3.9.0-ultramodern.4
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/dist/cjs/cli/code.js +3 -1
- package/dist/cjs/core/browser/hydrate.js +6 -1
- package/dist/cjs/core/context/public.js +2 -1
- package/dist/cjs/core/context/runtime.js +2 -1
- package/dist/esm/cli/code.mjs +3 -1
- package/dist/esm/core/browser/hydrate.mjs +7 -2
- package/dist/esm/core/context/public.mjs +2 -1
- package/dist/esm/core/context/runtime.mjs +2 -1
- package/dist/esm-node/cli/code.mjs +3 -1
- package/dist/esm-node/core/browser/hydrate.mjs +7 -2
- package/dist/esm-node/core/context/public.mjs +2 -1
- package/dist/esm-node/core/context/runtime.mjs +2 -1
- package/package.json +9 -9
package/dist/cjs/cli/code.js
CHANGED
|
@@ -115,7 +115,9 @@ const generateCode = async (entrypoints, appContext, config, hooks)=>{
|
|
|
115
115
|
const bootstrapFile = external_path_default().resolve(internalDirectory, `./${entryName}/${external_constants_js_namespaceObject.ENTRY_BOOTSTRAP_FILE_NAME}`);
|
|
116
116
|
await utils_namespaceObject.fs.outputFile(bootstrapFile, `import(/* webpackChunkName: "async-${entryName}" */ './${external_constants_js_namespaceObject.INDEX_FILE_NAME}');`, 'utf8');
|
|
117
117
|
const bootstrapServerFile = external_path_default().resolve(internalDirectory, `./${entryName}/${external_constants_js_namespaceObject.ENTRY_SERVER_BOOTSTRAP_FILE_NAME}`);
|
|
118
|
-
if (ssrMode) await utils_namespaceObject.fs.outputFile(bootstrapServerFile, `export const requestHandler = import('./${external_constants_js_namespaceObject.SERVER_ENTRY_POINT_FILE_NAME}').then((m) => m.requestHandler)
|
|
118
|
+
if (ssrMode) await utils_namespaceObject.fs.outputFile(bootstrapServerFile, `export const requestHandler = import('./${external_constants_js_namespaceObject.SERVER_ENTRY_POINT_FILE_NAME}').then((m) => m.requestHandler);
|
|
119
|
+
// The renderer awaits this promise later; retain its rejection without an early unhandled rejection.
|
|
120
|
+
requestHandler.catch(() => {});`, 'utf8');
|
|
119
121
|
}
|
|
120
122
|
if (ssrMode) {
|
|
121
123
|
const indexServerCode = external_template_server_js_namespaceObject.serverIndex({
|
|
@@ -67,7 +67,12 @@ function hydrateRoot(App, context, ModernRender, ModernHydrate) {
|
|
|
67
67
|
callback: callback,
|
|
68
68
|
children: App
|
|
69
69
|
});
|
|
70
|
-
return ModernHydrate(
|
|
70
|
+
return ModernHydrate(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
71
|
+
children: [
|
|
72
|
+
(0, wrapper_js_namespaceObject.wrapRuntimeContextProvider)(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(SSRApp, {}), hydrateContext),
|
|
73
|
+
null
|
|
74
|
+
]
|
|
75
|
+
}));
|
|
71
76
|
}
|
|
72
77
|
}
|
|
73
78
|
return stringSSRHydrate();
|
|
@@ -32,8 +32,9 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
32
32
|
RuntimeContext: ()=>RuntimeContext,
|
|
33
33
|
useRuntimeContext: ()=>useRuntimeContext
|
|
34
34
|
});
|
|
35
|
+
const react_context_namespaceObject = require("@modern-js/runtime-extensions/react-context");
|
|
35
36
|
const external_react_namespaceObject = require("react");
|
|
36
|
-
const RuntimeContext = (0, external_react_namespaceObject.createContext)({});
|
|
37
|
+
const RuntimeContext = (0, react_context_namespaceObject.getRuntimeReactContext)('public', ()=>(0, external_react_namespaceObject.createContext)({}));
|
|
37
38
|
const ReactRuntimeContext = RuntimeContext;
|
|
38
39
|
const useRuntimeContext = ()=>(0, external_react_namespaceObject.useContext)(RuntimeContext);
|
|
39
40
|
exports.ReactRuntimeContext = __webpack_exports__.ReactRuntimeContext;
|
|
@@ -34,10 +34,11 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
34
34
|
getInitialContext: ()=>getInitialContext,
|
|
35
35
|
useRuntimeContext: ()=>external_public_js_namespaceObject.useRuntimeContext
|
|
36
36
|
});
|
|
37
|
+
const react_context_namespaceObject = require("@modern-js/runtime-extensions/react-context");
|
|
37
38
|
const external_react_namespaceObject = require("react");
|
|
38
39
|
const external_public_js_namespaceObject = require("./public.js");
|
|
39
40
|
const ROUTE_MANIFEST = '_MODERNJS_ROUTE_MANIFEST';
|
|
40
|
-
const InternalRuntimeContext = (0, external_react_namespaceObject.createContext)({});
|
|
41
|
+
const InternalRuntimeContext = (0, react_context_namespaceObject.getRuntimeReactContext)('internal', ()=>(0, external_react_namespaceObject.createContext)({}));
|
|
41
42
|
const getInitialContext = (isBrowser = true, routeManifest)=>{
|
|
42
43
|
const requestContext = {
|
|
43
44
|
request: {
|
package/dist/esm/cli/code.mjs
CHANGED
|
@@ -73,7 +73,9 @@ const generateCode = async (entrypoints, appContext, config, hooks)=>{
|
|
|
73
73
|
const bootstrapFile = path.resolve(internalDirectory, `./${entryName}/${ENTRY_BOOTSTRAP_FILE_NAME}`);
|
|
74
74
|
await fs.outputFile(bootstrapFile, `import(/* webpackChunkName: "async-${entryName}" */ './${INDEX_FILE_NAME}');`, 'utf8');
|
|
75
75
|
const bootstrapServerFile = path.resolve(internalDirectory, `./${entryName}/${ENTRY_SERVER_BOOTSTRAP_FILE_NAME}`);
|
|
76
|
-
if (ssrMode) await fs.outputFile(bootstrapServerFile, `export const requestHandler = import('./${SERVER_ENTRY_POINT_FILE_NAME}').then((m) => m.requestHandler)
|
|
76
|
+
if (ssrMode) await fs.outputFile(bootstrapServerFile, `export const requestHandler = import('./${SERVER_ENTRY_POINT_FILE_NAME}').then((m) => m.requestHandler);
|
|
77
|
+
// The renderer awaits this promise later; retain its rejection without an early unhandled rejection.
|
|
78
|
+
requestHandler.catch(() => {});`, 'utf8');
|
|
77
79
|
}
|
|
78
80
|
if (ssrMode) {
|
|
79
81
|
const indexServerCode = __rspack_external__template_server_mjs_f98cfe58.serverIndex({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { loadableReady } from "@loadable/component";
|
|
3
3
|
import { SSR_HYDRATION_ID_PREFIX } from "@modern-js/utils/universal/constants";
|
|
4
4
|
import { hydrateRoot } from "react-dom/client";
|
|
@@ -34,7 +34,12 @@ function hydrate_hydrateRoot(App, context, ModernRender, ModernHydrate) {
|
|
|
34
34
|
callback: callback,
|
|
35
35
|
children: App
|
|
36
36
|
});
|
|
37
|
-
return ModernHydrate(
|
|
37
|
+
return ModernHydrate(/*#__PURE__*/ jsxs(Fragment, {
|
|
38
|
+
children: [
|
|
39
|
+
wrapRuntimeContextProvider(/*#__PURE__*/ jsx(SSRApp, {}), hydrateContext),
|
|
40
|
+
null
|
|
41
|
+
]
|
|
42
|
+
}));
|
|
38
43
|
}
|
|
39
44
|
}
|
|
40
45
|
return stringSSRHydrate();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { getRuntimeReactContext } from "@modern-js/runtime-extensions/react-context";
|
|
1
2
|
import { createContext, useContext } from "react";
|
|
2
|
-
const RuntimeContext = createContext({});
|
|
3
|
+
const RuntimeContext = getRuntimeReactContext('public', ()=>createContext({}));
|
|
3
4
|
const ReactRuntimeContext = RuntimeContext;
|
|
4
5
|
const useRuntimeContext = ()=>useContext(RuntimeContext);
|
|
5
6
|
export { ReactRuntimeContext, RuntimeContext, useRuntimeContext };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { getRuntimeReactContext } from "@modern-js/runtime-extensions/react-context";
|
|
1
2
|
import { createContext } from "react";
|
|
2
3
|
const ROUTE_MANIFEST = '_MODERNJS_ROUTE_MANIFEST';
|
|
3
|
-
const InternalRuntimeContext = createContext({});
|
|
4
|
+
const InternalRuntimeContext = getRuntimeReactContext('internal', ()=>createContext({}));
|
|
4
5
|
const getInitialContext = (isBrowser = true, routeManifest)=>{
|
|
5
6
|
const requestContext = {
|
|
6
7
|
request: {
|
|
@@ -74,7 +74,9 @@ const generateCode = async (entrypoints, appContext, config, hooks)=>{
|
|
|
74
74
|
const bootstrapFile = path.resolve(internalDirectory, `./${entryName}/${ENTRY_BOOTSTRAP_FILE_NAME}`);
|
|
75
75
|
await fs.outputFile(bootstrapFile, `import(/* webpackChunkName: "async-${entryName}" */ './${INDEX_FILE_NAME}');`, 'utf8');
|
|
76
76
|
const bootstrapServerFile = path.resolve(internalDirectory, `./${entryName}/${ENTRY_SERVER_BOOTSTRAP_FILE_NAME}`);
|
|
77
|
-
if (ssrMode) await fs.outputFile(bootstrapServerFile, `export const requestHandler = import('./${SERVER_ENTRY_POINT_FILE_NAME}').then((m) => m.requestHandler)
|
|
77
|
+
if (ssrMode) await fs.outputFile(bootstrapServerFile, `export const requestHandler = import('./${SERVER_ENTRY_POINT_FILE_NAME}').then((m) => m.requestHandler);
|
|
78
|
+
// The renderer awaits this promise later; retain its rejection without an early unhandled rejection.
|
|
79
|
+
requestHandler.catch(() => {});`, 'utf8');
|
|
78
80
|
}
|
|
79
81
|
if (ssrMode) {
|
|
80
82
|
const indexServerCode = __rspack_external__template_server_mjs_f98cfe58.serverIndex({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { loadableReady } from "@loadable/component";
|
|
4
4
|
import { SSR_HYDRATION_ID_PREFIX } from "@modern-js/utils/universal/constants";
|
|
5
5
|
import { hydrateRoot } from "react-dom/client";
|
|
@@ -35,7 +35,12 @@ function hydrate_hydrateRoot(App, context, ModernRender, ModernHydrate) {
|
|
|
35
35
|
callback: callback,
|
|
36
36
|
children: App
|
|
37
37
|
});
|
|
38
|
-
return ModernHydrate(
|
|
38
|
+
return ModernHydrate(/*#__PURE__*/ jsxs(Fragment, {
|
|
39
|
+
children: [
|
|
40
|
+
wrapRuntimeContextProvider(/*#__PURE__*/ jsx(SSRApp, {}), hydrateContext),
|
|
41
|
+
null
|
|
42
|
+
]
|
|
43
|
+
}));
|
|
39
44
|
}
|
|
40
45
|
}
|
|
41
46
|
return stringSSRHydrate();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
+
import { getRuntimeReactContext } from "@modern-js/runtime-extensions/react-context";
|
|
2
3
|
import { createContext, useContext } from "react";
|
|
3
|
-
const RuntimeContext = createContext({});
|
|
4
|
+
const RuntimeContext = getRuntimeReactContext('public', ()=>createContext({}));
|
|
4
5
|
const ReactRuntimeContext = RuntimeContext;
|
|
5
6
|
const useRuntimeContext = ()=>useContext(RuntimeContext);
|
|
6
7
|
export { ReactRuntimeContext, RuntimeContext, useRuntimeContext };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
+
import { getRuntimeReactContext } from "@modern-js/runtime-extensions/react-context";
|
|
2
3
|
import { createContext } from "react";
|
|
3
4
|
const ROUTE_MANIFEST = '_MODERNJS_ROUTE_MANIFEST';
|
|
4
|
-
const InternalRuntimeContext = createContext({});
|
|
5
|
+
const InternalRuntimeContext = getRuntimeReactContext('internal', ()=>createContext({}));
|
|
5
6
|
const getInitialContext = (isBrowser = true, routeManifest)=>{
|
|
6
7
|
const requestContext = {
|
|
7
8
|
request: {
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"modern",
|
|
18
18
|
"modern.js"
|
|
19
19
|
],
|
|
20
|
-
"version": "3.9.0-ultramodern.
|
|
20
|
+
"version": "3.9.0-ultramodern.4",
|
|
21
21
|
"engines": {
|
|
22
22
|
"node": ">=20"
|
|
23
23
|
},
|
|
@@ -246,13 +246,13 @@
|
|
|
246
246
|
"dependencies": {
|
|
247
247
|
"@loadable/component": "5.16.7",
|
|
248
248
|
"@loadable/server": "5.16.7",
|
|
249
|
-
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.0-ultramodern.
|
|
250
|
-
"@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.9.0-ultramodern.
|
|
251
|
-
"@modern-js/render": "npm:@bleedingdev/modern-js-render@3.9.0-ultramodern.
|
|
252
|
-
"@modern-js/runtime-extensions": "npm:@bleedingdev/modern-js-runtime-extensions@3.9.0-ultramodern.
|
|
253
|
-
"@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.9.0-ultramodern.
|
|
254
|
-
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.
|
|
255
|
-
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.
|
|
249
|
+
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.0-ultramodern.4",
|
|
250
|
+
"@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.9.0-ultramodern.4",
|
|
251
|
+
"@modern-js/render": "npm:@bleedingdev/modern-js-render@3.9.0-ultramodern.4",
|
|
252
|
+
"@modern-js/runtime-extensions": "npm:@bleedingdev/modern-js-runtime-extensions@3.9.0-ultramodern.4",
|
|
253
|
+
"@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.9.0-ultramodern.4",
|
|
254
|
+
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.4",
|
|
255
|
+
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.4",
|
|
256
256
|
"@swc/core": "1.16.2",
|
|
257
257
|
"@swc/helpers": "^0.5.23",
|
|
258
258
|
"@swc/plugin-loadable-components": "^13.0.0",
|
|
@@ -273,7 +273,7 @@
|
|
|
273
273
|
"react-dom": "^19.2.8"
|
|
274
274
|
},
|
|
275
275
|
"devDependencies": {
|
|
276
|
-
"@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.9.0-ultramodern.
|
|
276
|
+
"@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.9.0-ultramodern.4",
|
|
277
277
|
"@remix-run/web-fetch": "^4.4.2",
|
|
278
278
|
"@rsbuild/core": "2.2.3",
|
|
279
279
|
"@rslib/core": "1.0.0",
|