@modern-js/runtime 2.68.6 → 2.68.7
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/core/context/index.js +1 -1
- package/dist/cjs/core/context/serverPayload/index.js +34 -0
- package/dist/cjs/core/context/{serverPayload.server.js → serverPayload/index.server.js} +3 -3
- package/dist/cjs/core/server/requestHandler.js +1 -1
- package/dist/cjs/router/runtime/plugin.node.js +1 -1
- package/dist/esm/core/context/index.js +1 -1
- package/dist/esm/core/context/serverPayload/index.js +9 -0
- package/dist/esm/core/server/requestHandler.js +1 -1
- package/dist/esm/router/runtime/plugin.node.js +1 -1
- package/dist/esm-node/core/context/index.js +1 -1
- package/dist/esm-node/core/context/serverPayload/index.js +9 -0
- package/dist/esm-node/core/server/requestHandler.js +1 -1
- package/dist/esm-node/router/runtime/plugin.node.js +1 -1
- package/dist/types/core/context/index.d.ts +3 -29
- package/dist/types/core/context/{serverPayload.server.d.ts → serverPayload/index.d.ts} +2 -1
- package/dist/types/core/context/serverPayload/index.server.d.ts +30 -0
- package/dist/types/core/server/utils.d.ts +0 -1
- package/package.json +12 -12
- /package/dist/esm/core/context/{serverPayload.server.js → serverPayload/index.server.js} +0 -0
- /package/dist/esm-node/core/context/{serverPayload.server.js → serverPayload/index.server.js} +0 -0
|
@@ -37,7 +37,7 @@ __export(context_exports, {
|
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(context_exports);
|
|
39
39
|
var import_runtime = require("./runtime");
|
|
40
|
-
var import_serverPayload = require("./serverPayload
|
|
40
|
+
var import_serverPayload = require("./serverPayload/index");
|
|
41
41
|
const globalContext = {};
|
|
42
42
|
function getGlobalIsRscClient() {
|
|
43
43
|
return globalContext.isRscClient;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var serverPayload_exports = {};
|
|
20
|
+
__export(serverPayload_exports, {
|
|
21
|
+
getServerPayload: () => getServerPayload,
|
|
22
|
+
setServerPayload: () => setServerPayload
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(serverPayload_exports);
|
|
25
|
+
const getServerPayload = () => {
|
|
26
|
+
return void 0;
|
|
27
|
+
};
|
|
28
|
+
const setServerPayload = (payload) => {
|
|
29
|
+
};
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
getServerPayload,
|
|
33
|
+
setServerPayload
|
|
34
|
+
});
|
|
@@ -16,12 +16,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var index_server_exports = {};
|
|
20
|
+
__export(index_server_exports, {
|
|
21
21
|
getServerPayload: () => getServerPayload,
|
|
22
22
|
setServerPayload: () => setServerPayload
|
|
23
23
|
});
|
|
24
|
-
module.exports = __toCommonJS(
|
|
24
|
+
module.exports = __toCommonJS(index_server_exports);
|
|
25
25
|
var import_node = require("@modern-js/runtime-utils/node");
|
|
26
26
|
const getServerPayload = () => {
|
|
27
27
|
const context = import_node.storage.useContext();
|
|
@@ -27,7 +27,7 @@ var import_request = require("@modern-js/runtime-utils/universal/request");
|
|
|
27
27
|
var import_react = require("react");
|
|
28
28
|
var import_context = require("../context");
|
|
29
29
|
var import_runtime = require("../context/runtime");
|
|
30
|
-
var import_serverPayload = require("../context/serverPayload
|
|
30
|
+
var import_serverPayload = require("../context/serverPayload/index");
|
|
31
31
|
var import_loaderManager = require("../loader/loaderManager");
|
|
32
32
|
var import_react2 = require("../react");
|
|
33
33
|
var import_constants = require("./constants");
|
|
@@ -44,7 +44,7 @@ var import_react = require("react");
|
|
|
44
44
|
var import_common = require("../../common");
|
|
45
45
|
var import_core = require("../../core");
|
|
46
46
|
var import_context = require("../../core/context");
|
|
47
|
-
var import_serverPayload = require("../../core/context/serverPayload.server");
|
|
47
|
+
var import_serverPayload = require("../../core/context/serverPayload/index.server");
|
|
48
48
|
var import_DeferredDataScripts = __toESM(require("./DeferredDataScripts.node"));
|
|
49
49
|
var import_hooks = require("./hooks");
|
|
50
50
|
var import_rsc_router = require("./rsc-router");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RuntimeReactContext, getInitialContext } from "./runtime";
|
|
2
2
|
var globalContext = {};
|
|
3
|
-
import { getServerPayload, setServerPayload } from "./serverPayload
|
|
3
|
+
import { getServerPayload, setServerPayload } from "./serverPayload/index";
|
|
4
4
|
function getGlobalIsRscClient() {
|
|
5
5
|
return globalContext.isRscClient;
|
|
6
6
|
}
|
|
@@ -11,7 +11,7 @@ import { getPathname, parseCookie, parseHeaders, parseQuery } from "@modern-js/r
|
|
|
11
11
|
import { Fragment } from "react";
|
|
12
12
|
import { getGlobalAppInit, getGlobalInternalRuntimeContext, getGlobalRSCRoot } from "../context";
|
|
13
13
|
import { getInitialContext } from "../context/runtime";
|
|
14
|
-
import { getServerPayload } from "../context/serverPayload
|
|
14
|
+
import { getServerPayload } from "../context/serverPayload/index";
|
|
15
15
|
import { createLoaderManager } from "../loader/loaderManager";
|
|
16
16
|
import { createRoot } from "../react";
|
|
17
17
|
import { CHUNK_CSS_PLACEHOLDER } from "./constants";
|
|
@@ -14,7 +14,7 @@ import { useContext } from "react";
|
|
|
14
14
|
import { JSX_SHELL_STREAM_END_MARK } from "../../common";
|
|
15
15
|
import { RuntimeReactContext } from "../../core";
|
|
16
16
|
import { getGlobalEnableRsc, getGlobalLayoutApp, getGlobalRoutes } from "../../core/context";
|
|
17
|
-
import { setServerPayload } from "../../core/context/serverPayload.server";
|
|
17
|
+
import { setServerPayload } from "../../core/context/serverPayload/index.server";
|
|
18
18
|
import DeferredDataScripts from "./DeferredDataScripts.node";
|
|
19
19
|
import { modifyRoutes as modifyRoutesHook, onBeforeCreateRoutes as onBeforeCreateRoutesHook } from "./hooks";
|
|
20
20
|
import { RSCStaticRouter, createServerPayload, handleRSCRedirect, prepareRSCRoutes } from "./rsc-router";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RuntimeReactContext, getInitialContext } from "./runtime";
|
|
2
2
|
const globalContext = {};
|
|
3
|
-
import { getServerPayload, setServerPayload } from "./serverPayload
|
|
3
|
+
import { getServerPayload, setServerPayload } from "./serverPayload/index";
|
|
4
4
|
function getGlobalIsRscClient() {
|
|
5
5
|
return globalContext.isRscClient;
|
|
6
6
|
}
|
|
@@ -4,7 +4,7 @@ import { getPathname, parseCookie, parseHeaders, parseQuery } from "@modern-js/r
|
|
|
4
4
|
import { Fragment } from "react";
|
|
5
5
|
import { getGlobalAppInit, getGlobalInternalRuntimeContext, getGlobalRSCRoot } from "../context";
|
|
6
6
|
import { getInitialContext } from "../context/runtime";
|
|
7
|
-
import { getServerPayload } from "../context/serverPayload
|
|
7
|
+
import { getServerPayload } from "../context/serverPayload/index";
|
|
8
8
|
import { createLoaderManager } from "../loader/loaderManager";
|
|
9
9
|
import { createRoot } from "../react";
|
|
10
10
|
import { CHUNK_CSS_PLACEHOLDER } from "./constants";
|
|
@@ -10,7 +10,7 @@ import { useContext } from "react";
|
|
|
10
10
|
import { JSX_SHELL_STREAM_END_MARK } from "../../common";
|
|
11
11
|
import { RuntimeReactContext } from "../../core";
|
|
12
12
|
import { getGlobalEnableRsc, getGlobalLayoutApp, getGlobalRoutes } from "../../core/context";
|
|
13
|
-
import { setServerPayload } from "../../core/context/serverPayload.server";
|
|
13
|
+
import { setServerPayload } from "../../core/context/serverPayload/index.server";
|
|
14
14
|
import DeferredDataScripts from "./DeferredDataScripts.node";
|
|
15
15
|
import { modifyRoutes as modifyRoutesHook, onBeforeCreateRoutes as onBeforeCreateRoutesHook } from "./hooks";
|
|
16
16
|
import { RSCStaticRouter, createServerPayload, handleRSCRedirect, prepareRSCRoutes } from "./rsc-router";
|
|
@@ -1,37 +1,11 @@
|
|
|
1
1
|
import type { InternalRuntimeContext } from '@modern-js/plugin-v2';
|
|
2
|
-
import type { RouterState } from '@modern-js/runtime-utils/remix-router';
|
|
3
2
|
import type { NestedRoute, PageRoute } from '@modern-js/types';
|
|
4
3
|
import type React from 'react';
|
|
5
4
|
import type { AppConfig } from '../../common';
|
|
6
5
|
import type { RuntimeExtends } from '../plugin/types';
|
|
6
|
+
import type { ServerPayload } from './serverPayload/index';
|
|
7
7
|
export { type RuntimeContext, RuntimeReactContext, getInitialContext, } from './runtime';
|
|
8
|
-
export type PayloadRoute
|
|
9
|
-
clientAction?: any;
|
|
10
|
-
clientLoader?: any;
|
|
11
|
-
element?: React.ReactNode;
|
|
12
|
-
errorElement?: React.ReactNode;
|
|
13
|
-
handle?: any;
|
|
14
|
-
hasAction: boolean;
|
|
15
|
-
hasErrorBoundary: boolean;
|
|
16
|
-
hasLoader: boolean;
|
|
17
|
-
id: string;
|
|
18
|
-
index?: boolean;
|
|
19
|
-
params: Record<string, string>;
|
|
20
|
-
parentId?: string;
|
|
21
|
-
path?: string;
|
|
22
|
-
pathname: string;
|
|
23
|
-
pathnameBase: string;
|
|
24
|
-
shouldRevalidate?: any;
|
|
25
|
-
};
|
|
26
|
-
export type ServerPayload = {
|
|
27
|
-
type: 'render';
|
|
28
|
-
actionData: RouterState['actionData'];
|
|
29
|
-
errors: RouterState['errors'];
|
|
30
|
-
loaderData: RouterState['loaderData'];
|
|
31
|
-
location: RouterState['location'];
|
|
32
|
-
routes: PayloadRoute[];
|
|
33
|
-
originalRoutes?: PayloadRoute[];
|
|
34
|
-
};
|
|
8
|
+
export type { ServerPayload, PayloadRoute } from './serverPayload/index';
|
|
35
9
|
interface GlobalContext {
|
|
36
10
|
entryName?: string;
|
|
37
11
|
/**
|
|
@@ -63,7 +37,7 @@ interface GlobalContext {
|
|
|
63
37
|
serverPayload?: ServerPayload;
|
|
64
38
|
enableRsc?: boolean;
|
|
65
39
|
}
|
|
66
|
-
export { getServerPayload, setServerPayload } from './serverPayload
|
|
40
|
+
export { getServerPayload, setServerPayload, } from './serverPayload/index';
|
|
67
41
|
export declare function getGlobalIsRscClient(): boolean | undefined;
|
|
68
42
|
export declare function getGlobalEnableRsc(): boolean | undefined;
|
|
69
43
|
export declare function setGlobalContext(context: Omit<GlobalContext, 'appConfig' | 'internalRuntimeContext'> & {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type { ServerPayload } from './index';
|
|
1
|
+
import type { PayloadRoute, ServerPayload } from './index.server';
|
|
2
|
+
export type { ServerPayload, PayloadRoute };
|
|
2
3
|
export declare const getServerPayload: () => ServerPayload | undefined;
|
|
3
4
|
export declare const setServerPayload: (payload: ServerPayload) => void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { RouterState } from '@modern-js/runtime-utils/remix-router';
|
|
2
|
+
export type PayloadRoute = {
|
|
3
|
+
clientAction?: any;
|
|
4
|
+
clientLoader?: any;
|
|
5
|
+
element?: React.ReactNode;
|
|
6
|
+
errorElement?: React.ReactNode;
|
|
7
|
+
handle?: any;
|
|
8
|
+
hasAction: boolean;
|
|
9
|
+
hasErrorBoundary: boolean;
|
|
10
|
+
hasLoader: boolean;
|
|
11
|
+
id: string;
|
|
12
|
+
index?: boolean;
|
|
13
|
+
params: Record<string, string>;
|
|
14
|
+
parentId?: string;
|
|
15
|
+
path?: string;
|
|
16
|
+
pathname: string;
|
|
17
|
+
pathnameBase: string;
|
|
18
|
+
shouldRevalidate?: any;
|
|
19
|
+
};
|
|
20
|
+
export type ServerPayload = {
|
|
21
|
+
type: 'render';
|
|
22
|
+
actionData: RouterState['actionData'];
|
|
23
|
+
errors: RouterState['errors'];
|
|
24
|
+
loaderData: RouterState['loaderData'];
|
|
25
|
+
location: RouterState['location'];
|
|
26
|
+
routes: PayloadRoute[];
|
|
27
|
+
originalRoutes?: PayloadRoute[];
|
|
28
|
+
};
|
|
29
|
+
export declare const getServerPayload: () => ServerPayload | undefined;
|
|
30
|
+
export declare const setServerPayload: (payload: ServerPayload) => void;
|
|
@@ -21,7 +21,6 @@ export declare function getSSRConfigByEntry(entryName: string, ssr?: ServerUserC
|
|
|
21
21
|
inlineScript?: boolean;
|
|
22
22
|
disablePrerender?: boolean;
|
|
23
23
|
unsafeHeaders?: string[];
|
|
24
|
-
scriptLoading?: "defer" | "blocking" | "module" | "async";
|
|
25
24
|
loaderFailureMode?: "clientRender" | "errorBoundary";
|
|
26
25
|
};
|
|
27
26
|
export declare function getSSRMode(ssrConfig?: SSRConfig): 'string' | 'stream' | false;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.68.
|
|
18
|
+
"version": "2.68.7",
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=14.17.6"
|
|
21
21
|
},
|
|
@@ -219,13 +219,13 @@
|
|
|
219
219
|
"react-is": "^18",
|
|
220
220
|
"react-side-effect": "^2.1.2",
|
|
221
221
|
"styled-components": "^5.3.1",
|
|
222
|
-
"@modern-js/plugin": "2.68.
|
|
223
|
-
"@modern-js/plugin-data-loader": "2.68.
|
|
224
|
-
"@modern-js/plugin-v2": "2.68.
|
|
225
|
-
"@modern-js/
|
|
226
|
-
"@modern-js/
|
|
227
|
-
"@modern-js/types": "2.68.
|
|
228
|
-
"@modern-js/utils": "2.68.
|
|
222
|
+
"@modern-js/plugin": "2.68.7",
|
|
223
|
+
"@modern-js/plugin-data-loader": "2.68.7",
|
|
224
|
+
"@modern-js/plugin-v2": "2.68.7",
|
|
225
|
+
"@modern-js/runtime-utils": "2.68.7",
|
|
226
|
+
"@modern-js/render": "2.68.7",
|
|
227
|
+
"@modern-js/types": "2.68.7",
|
|
228
|
+
"@modern-js/utils": "2.68.7"
|
|
229
229
|
},
|
|
230
230
|
"peerDependencies": {
|
|
231
231
|
"react": ">=17",
|
|
@@ -233,7 +233,7 @@
|
|
|
233
233
|
},
|
|
234
234
|
"devDependencies": {
|
|
235
235
|
"@remix-run/web-fetch": "^4.1.3",
|
|
236
|
-
"@rsbuild/core": "1.4.
|
|
236
|
+
"@rsbuild/core": "1.4.14",
|
|
237
237
|
"@testing-library/react": "^13.4.0",
|
|
238
238
|
"@types/cookie": "0.6.0",
|
|
239
239
|
"@types/invariant": "^2.2.30",
|
|
@@ -248,11 +248,11 @@
|
|
|
248
248
|
"ts-jest": "^29.1.0",
|
|
249
249
|
"ts-node": "^10.9.1",
|
|
250
250
|
"typescript": "^5",
|
|
251
|
-
"webpack": "^5.
|
|
252
|
-
"@modern-js/app-tools": "2.68.6",
|
|
251
|
+
"webpack": "^5.101.0",
|
|
253
252
|
"@scripts/build": "2.66.0",
|
|
254
253
|
"@scripts/jest-config": "2.66.0",
|
|
255
|
-
"@modern-js/
|
|
254
|
+
"@modern-js/app-tools": "2.68.7",
|
|
255
|
+
"@modern-js/core": "2.68.7"
|
|
256
256
|
},
|
|
257
257
|
"sideEffects": false,
|
|
258
258
|
"publishConfig": {
|
|
File without changes
|
/package/dist/esm-node/core/context/{serverPayload.server.js → serverPayload/index.server.js}
RENAMED
|
File without changes
|