@modern-js/runtime 2.58.2 → 2.58.4-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/dist/cjs/cli/index.js +11 -14
- package/dist/cjs/cli/ssr/babel-plugin-ssr-loader-id.js +1 -1
- package/dist/cjs/cli/template.js +1 -1
- package/dist/cjs/core/browser/hydrate.js +1 -1
- package/dist/cjs/core/browser/index.js +2 -2
- package/dist/cjs/core/compatible.js +4 -4
- package/dist/cjs/core/context/runtime.js +1 -1
- package/dist/cjs/core/loader/useLoader.js +1 -1
- package/dist/cjs/core/server/react/prerender/index.js +1 -1
- package/dist/cjs/core/server/requestHandler.js +8 -3
- package/dist/cjs/core/server/stream/afterTemplate.js +1 -1
- package/dist/cjs/core/server/stream/beforeTemplate.js +3 -3
- package/dist/cjs/core/server/stream/createReadableStream.js +2 -2
- package/dist/cjs/core/server/stream/createReadableStream.worker.js +2 -2
- package/dist/cjs/core/server/stream/shared.js +1 -1
- package/dist/cjs/core/server/stream/template.js +1 -1
- package/dist/cjs/core/server/string/index.js +18 -18
- package/dist/cjs/core/server/string/prefetch.js +5 -5
- package/dist/cjs/core/server/string/ssrData.js +1 -1
- package/dist/cjs/document/Body.js +1 -1
- package/dist/cjs/document/Head.js +1 -1
- package/dist/cjs/document/Root.js +1 -1
- package/dist/cjs/document/cli/index.js +2 -2
- package/dist/cjs/router/cli/code/getClientRoutes/getRoutes.js +1 -1
- package/dist/cjs/router/cli/code/getClientRoutes/getRoutesLegacy.js +1 -1
- package/dist/cjs/router/cli/code/index.js +18 -27
- package/dist/cjs/router/cli/code/templates.js +15 -8
- package/dist/cjs/router/cli/code/utils.js +1 -1
- package/dist/cjs/router/cli/handler.js +2 -2
- package/dist/cjs/router/runtime/DeferredDataScripts.node.js +2 -2
- package/dist/cjs/router/runtime/PrefetchLink.js +1 -1
- package/dist/cjs/router/runtime/plugin.js +4 -4
- package/dist/cjs/router/runtime/plugin.node.js +6 -6
- package/dist/cjs/router/runtime/utils.js +2 -2
- package/dist/cjs/state/plugins.js +1 -1
- package/dist/cjs/state/runtime/plugin.js +6 -6
- package/dist/esm/cli/code.js +1 -1
- package/dist/esm/cli/index.js +7 -10
- package/dist/esm/cli/ssr/babel-plugin-ssr-loader-id.js +1 -1
- package/dist/esm/cli/template.js +1 -1
- package/dist/esm/core/browser/hydrate.js +1 -1
- package/dist/esm/core/browser/index.js +2 -2
- package/dist/esm/core/browser/withCallback.js +1 -1
- package/dist/esm/core/compatible.js +4 -4
- package/dist/esm/core/context/runtime.js +1 -1
- package/dist/esm/core/loader/useLoader.js +1 -1
- package/dist/esm/core/plugin/base.js +1 -1
- package/dist/esm/core/plugin/index.js +1 -1
- package/dist/esm/core/server/react/prerender/index.js +2 -2
- package/dist/esm/core/server/requestHandler.js +8 -4
- package/dist/esm/core/server/stream/afterTemplate.js +1 -1
- package/dist/esm/core/server/stream/beforeTemplate.js +3 -3
- package/dist/esm/core/server/stream/createReadableStream.js +2 -2
- package/dist/esm/core/server/stream/createReadableStream.worker.js +2 -2
- package/dist/esm/core/server/stream/shared.js +1 -1
- package/dist/esm/core/server/stream/template.js +1 -1
- package/dist/esm/core/server/string/index.js +8 -8
- package/dist/esm/core/server/string/prefetch.js +2 -2
- package/dist/esm/core/server/string/ssrData.js +1 -1
- package/dist/esm/document/Body.js +1 -1
- package/dist/esm/document/Comment.js +1 -1
- package/dist/esm/document/Head.js +1 -1
- package/dist/esm/document/Root.js +1 -1
- package/dist/esm/document/Script.js +1 -1
- package/dist/esm/document/Style.js +1 -1
- package/dist/esm/document/cli/index.js +3 -3
- package/dist/esm/router/cli/code/getClientRoutes/getRoutes.js +2 -2
- package/dist/esm/router/cli/code/getClientRoutes/getRoutesLegacy.js +2 -2
- package/dist/esm/router/cli/code/getClientRoutes/utils.js +2 -2
- package/dist/esm/router/cli/code/index.js +36 -35
- package/dist/esm/router/cli/code/nestedRoutes.js +1 -1
- package/dist/esm/router/cli/code/templates.js +2 -2
- package/dist/esm/router/cli/code/utils.js +2 -2
- package/dist/esm/router/cli/entry.js +1 -1
- package/dist/esm/router/cli/handler.js +2 -2
- package/dist/esm/router/cli/index.js +1 -1
- package/dist/esm/router/runtime/DeferredDataScripts.node.js +2 -2
- package/dist/esm/router/runtime/PrefetchLink.js +1 -1
- package/dist/esm/router/runtime/plugin.js +4 -4
- package/dist/esm/router/runtime/plugin.node.js +6 -6
- package/dist/esm/router/runtime/utils.js +2 -2
- package/dist/esm/state/plugins.js +1 -1
- package/dist/esm/state/runtime/plugin.js +4 -4
- package/dist/esm-node/cli/code.js +1 -1
- package/dist/esm-node/cli/index.js +7 -10
- package/dist/esm-node/cli/ssr/babel-plugin-ssr-loader-id.js +1 -1
- package/dist/esm-node/cli/template.js +1 -1
- package/dist/esm-node/core/browser/hydrate.js +1 -1
- package/dist/esm-node/core/browser/index.js +2 -2
- package/dist/esm-node/core/browser/withCallback.js +1 -1
- package/dist/esm-node/core/compatible.js +4 -4
- package/dist/esm-node/core/context/runtime.js +1 -1
- package/dist/esm-node/core/loader/useLoader.js +1 -1
- package/dist/esm-node/core/plugin/base.js +1 -1
- package/dist/esm-node/core/plugin/index.js +1 -1
- package/dist/esm-node/core/server/react/prerender/index.js +2 -2
- package/dist/esm-node/core/server/requestHandler.js +8 -3
- package/dist/esm-node/core/server/stream/afterTemplate.js +1 -1
- package/dist/esm-node/core/server/stream/beforeTemplate.js +3 -3
- package/dist/esm-node/core/server/stream/createReadableStream.js +2 -2
- package/dist/esm-node/core/server/stream/createReadableStream.worker.js +2 -2
- package/dist/esm-node/core/server/stream/shared.js +1 -1
- package/dist/esm-node/core/server/stream/template.js +1 -1
- package/dist/esm-node/core/server/string/index.js +8 -8
- package/dist/esm-node/core/server/string/prefetch.js +2 -2
- package/dist/esm-node/core/server/string/ssrData.js +1 -1
- package/dist/esm-node/document/Body.js +1 -1
- package/dist/esm-node/document/Comment.js +1 -1
- package/dist/esm-node/document/Head.js +1 -1
- package/dist/esm-node/document/Root.js +1 -1
- package/dist/esm-node/document/Script.js +1 -1
- package/dist/esm-node/document/Style.js +1 -1
- package/dist/esm-node/document/cli/index.js +3 -3
- package/dist/esm-node/router/cli/code/getClientRoutes/getRoutes.js +2 -2
- package/dist/esm-node/router/cli/code/getClientRoutes/getRoutesLegacy.js +2 -2
- package/dist/esm-node/router/cli/code/getClientRoutes/utils.js +2 -2
- package/dist/esm-node/router/cli/code/index.js +15 -24
- package/dist/esm-node/router/cli/code/nestedRoutes.js +1 -1
- package/dist/esm-node/router/cli/code/templates.js +16 -9
- package/dist/esm-node/router/cli/code/utils.js +2 -2
- package/dist/esm-node/router/cli/entry.js +1 -1
- package/dist/esm-node/router/cli/handler.js +2 -2
- package/dist/esm-node/router/cli/index.js +1 -1
- package/dist/esm-node/router/runtime/DeferredDataScripts.node.js +2 -2
- package/dist/esm-node/router/runtime/PrefetchLink.js +1 -1
- package/dist/esm-node/router/runtime/plugin.js +4 -4
- package/dist/esm-node/router/runtime/plugin.node.js +6 -6
- package/dist/esm-node/router/runtime/utils.js +2 -2
- package/dist/esm-node/state/plugins.js +1 -1
- package/dist/esm-node/state/runtime/plugin.js +4 -4
- package/dist/types/cli/code.d.ts +1 -1
- package/dist/types/cli/index.d.ts +3 -3
- package/dist/types/cli/ssr/index.d.ts +1 -1
- package/dist/types/common.d.ts +1 -1
- package/dist/types/config.d.ts +1 -1
- package/dist/types/core/compatible.d.ts +1 -1
- package/dist/types/core/context/runtime.d.ts +2 -2
- package/dist/types/core/plugin/index.d.ts +1 -1
- package/dist/types/core/server/stream/afterTemplate.d.ts +2 -2
- package/dist/types/core/server/stream/template.d.ts +1 -1
- package/dist/types/core/server/string/loadable.d.ts +1 -1
- package/dist/types/core/server/string/prefetch.d.ts +1 -1
- package/dist/types/core/server/string/ssrData.d.ts +2 -2
- package/dist/types/core/server/string/styledComponent.d.ts +1 -1
- package/dist/types/core/server/utils.d.ts +1 -1
- package/dist/types/core/types.d.ts +1 -1
- package/dist/types/document/cli/index.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/router/cli/code/index.d.ts +1 -1
- package/dist/types/router/cli/code/templates.d.ts +1 -1
- package/dist/types/router/cli/handler.d.ts +2 -2
- package/dist/types/router/cli/index.d.ts +1 -1
- package/dist/types/router/runtime/PrefetchLink.d.ts +1 -1
- package/dist/types/router/runtime/index.d.ts +1 -1
- package/dist/types/router/runtime/types.d.ts +2 -2
- package/dist/types/router/runtime/utils.d.ts +2 -2
- package/dist/types/router/runtime/withRouter.d.ts +1 -1
- package/dist/types/state/cli/index.d.ts +1 -1
- package/package.json +10 -10
|
@@ -22,9 +22,9 @@ __export(DeferredDataScripts_node_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(DeferredDataScripts_node_exports);
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
-
var import_react = require("react");
|
|
26
|
-
var import_router = require("@modern-js/runtime-utils/router");
|
|
27
25
|
var import_node = require("@modern-js/runtime-utils/node");
|
|
26
|
+
var import_router = require("@modern-js/runtime-utils/router");
|
|
27
|
+
var import_react = require("react");
|
|
28
28
|
var import_utils = require("./utils");
|
|
29
29
|
const setupFnStr = `function s(r,e){_ROUTER_DATA.r=_ROUTER_DATA.r||{},_ROUTER_DATA.r[r]=_ROUTER_DATA.r[r]||{};return new Promise((function(A,R){_ROUTER_DATA.r[r][e]={resolve:A,reject:R}}))};`;
|
|
30
30
|
const resolveFnStr = `function r(e,r,o,A){A?_ROUTER_DATA.r[e][r].reject(A):_ROUTER_DATA.r[e][r].resolve(o)};`;
|
|
@@ -34,8 +34,8 @@ __export(PrefetchLink_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(PrefetchLink_exports);
|
|
36
36
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
-
var import_react = __toESM(require("react"));
|
|
38
37
|
var import_router = require("@modern-js/runtime-utils/router");
|
|
38
|
+
var import_react = __toESM(require("react"));
|
|
39
39
|
var import_core = require("../../core");
|
|
40
40
|
function composeEventHandlers(theirHandler, ourHandler) {
|
|
41
41
|
return (event) => {
|
|
@@ -25,12 +25,12 @@ __export(plugin_exports, {
|
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(plugin_exports);
|
|
27
27
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
-
var import_react = require("react");
|
|
29
|
-
var import_router = require("@modern-js/runtime-utils/router");
|
|
30
|
-
var import_parsed = require("@modern-js/runtime-utils/parsed");
|
|
31
28
|
var import_merge = require("@modern-js/runtime-utils/merge");
|
|
32
|
-
var
|
|
29
|
+
var import_parsed = require("@modern-js/runtime-utils/parsed");
|
|
30
|
+
var import_router = require("@modern-js/runtime-utils/router");
|
|
31
|
+
var import_react = require("react");
|
|
33
32
|
var import_core = require("../../core");
|
|
33
|
+
var import_context = require("../../core/context");
|
|
34
34
|
var import_hooks = require("./hooks");
|
|
35
35
|
var import_utils = require("./utils");
|
|
36
36
|
let finalRouteConfig = {
|
|
@@ -33,20 +33,20 @@ __export(plugin_node_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(plugin_node_exports);
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
-
var
|
|
37
|
-
var
|
|
36
|
+
var import_merge = require("@modern-js/runtime-utils/merge");
|
|
37
|
+
var import_node = require("@modern-js/runtime-utils/node");
|
|
38
38
|
var import_router = require("@modern-js/runtime-utils/node/router");
|
|
39
|
+
var import_remix_router = require("@modern-js/runtime-utils/remix-router");
|
|
39
40
|
var import_router2 = require("@modern-js/runtime-utils/router");
|
|
40
|
-
var import_node = require("@modern-js/runtime-utils/node");
|
|
41
41
|
var import_time = require("@modern-js/runtime-utils/time");
|
|
42
42
|
var import_constants = require("@modern-js/utils/universal/constants");
|
|
43
|
-
var
|
|
43
|
+
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_utils = require("./utils");
|
|
48
|
-
var import_hooks = require("./hooks");
|
|
49
47
|
var import_DeferredDataScripts = __toESM(require("./DeferredDataScripts.node"));
|
|
48
|
+
var import_hooks = require("./hooks");
|
|
49
|
+
var import_utils = require("./utils");
|
|
50
50
|
function createRemixReuqest(request) {
|
|
51
51
|
const method = "GET";
|
|
52
52
|
const { headers } = request;
|
|
@@ -38,9 +38,9 @@ __export(utils_exports, {
|
|
|
38
38
|
});
|
|
39
39
|
module.exports = __toCommonJS(utils_exports);
|
|
40
40
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
41
|
-
var import_router = require("@modern-js/runtime-utils/router");
|
|
42
|
-
var import_remix_router = require("@modern-js/runtime-utils/remix-router");
|
|
43
41
|
var import_browser = require("@modern-js/runtime-utils/browser");
|
|
42
|
+
var import_remix_router = require("@modern-js/runtime-utils/remix-router");
|
|
43
|
+
var import_router = require("@modern-js/runtime-utils/router");
|
|
44
44
|
var import_DefaultNotFound = require("./DefaultNotFound");
|
|
45
45
|
var import_DeferredDataScripts = __toESM(require("./DeferredDataScripts"));
|
|
46
46
|
function getRouteComponents(routes, { globalApp, ssrMode, props, reporter }) {
|
|
@@ -34,8 +34,8 @@ __export(plugins_exports, {
|
|
|
34
34
|
immer: () => immer
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(plugins_exports);
|
|
37
|
-
var import_plugin_effects = require("@modern-js-reduck/plugin-effects");
|
|
38
37
|
var import_plugin_auto_actions = __toESM(require("@modern-js-reduck/plugin-auto-actions"));
|
|
38
|
+
var import_plugin_effects = require("@modern-js-reduck/plugin-effects");
|
|
39
39
|
var import_plugin_immutable = __toESM(require("@modern-js-reduck/plugin-immutable"));
|
|
40
40
|
var import_plugin_devtools = __toESM(require("@modern-js-reduck/plugin-devtools"));
|
|
41
41
|
const effects = () => import_plugin_effects.plugin;
|
|
@@ -24,13 +24,13 @@ __export(plugin_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(plugin_exports);
|
|
26
26
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
27
|
-
var import_react = require("react");
|
|
27
|
+
var import_react = require("@modern-js-reduck/react");
|
|
28
28
|
var import_store = require("@modern-js-reduck/store");
|
|
29
|
-
var import_react2 = require("@modern-js-reduck/react");
|
|
30
29
|
var import_merge = require("@modern-js/runtime-utils/merge");
|
|
31
|
-
var
|
|
32
|
-
var import_core = require("../../core");
|
|
30
|
+
var import_react2 = require("react");
|
|
33
31
|
var import_common = require("../../common");
|
|
32
|
+
var import_core = require("../../core");
|
|
33
|
+
var import_plugins = require("../plugins");
|
|
34
34
|
__reExport(plugin_exports, require("../plugins"), module.exports);
|
|
35
35
|
const StatePluginHandleMap = {
|
|
36
36
|
immer: import_plugins.immer,
|
|
@@ -63,8 +63,8 @@ const statePlugin = (userConfig = {}) => ({
|
|
|
63
63
|
return {
|
|
64
64
|
wrapRoot(App) {
|
|
65
65
|
const getStateApp = (props) => {
|
|
66
|
-
const context = (0,
|
|
67
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
66
|
+
const context = (0, import_react2.useContext)(import_core.RuntimeReactContext);
|
|
67
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Provider, {
|
|
68
68
|
store: context.store,
|
|
69
69
|
config: storeConfig,
|
|
70
70
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {
|
package/dist/esm/cli/code.js
CHANGED
|
@@ -2,7 +2,7 @@ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
|
2
2
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { fs } from "@modern-js/utils";
|
|
5
|
-
import {
|
|
5
|
+
import { ENTRY_BOOTSTRAP_FILE_NAME, ENTRY_POINT_FILE_NAME, ENTRY_POINT_REGISTER_FILE_NAME, ENTRY_POINT_RUNTIME_GLOBAL_CONTEXT_FILE_NAME, ENTRY_POINT_RUNTIME_REGISTER_FILE_NAME, ENTRY_SERVER_BOOTSTRAP_FILE_NAME, INDEX_FILE_NAME, SERVER_ENTRY_POINT_FILE_NAME } from "./constants";
|
|
6
6
|
import * as template from "./template";
|
|
7
7
|
import * as serverTemplate from "./template.server";
|
|
8
8
|
function getSSRMode(entry, config) {
|
package/dist/esm/cli/index.js
CHANGED
|
@@ -3,14 +3,14 @@ import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
|
|
3
3
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
4
4
|
import path from "path";
|
|
5
5
|
import { isReact18 as checkIsReact18, cleanRequireCache, createRuntimeExportsUtils } from "@modern-js/utils";
|
|
6
|
-
import { statePlugin } from "../state/cli";
|
|
7
|
-
import { routerPlugin } from "../router/cli";
|
|
8
6
|
import { documentPlugin } from "../document/cli";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { ENTRY_BOOTSTRAP_FILE_NAME, ENTRY_POINT_FILE_NAME } from "./constants";
|
|
12
|
-
import { generateCode } from "./code";
|
|
7
|
+
import { routerPlugin } from "../router/cli";
|
|
8
|
+
import { statePlugin } from "../state/cli";
|
|
13
9
|
import { builderPluginAlias } from "./alias";
|
|
10
|
+
import { generateCode } from "./code";
|
|
11
|
+
import { ENTRY_BOOTSTRAP_FILE_NAME, ENTRY_POINT_FILE_NAME } from "./constants";
|
|
12
|
+
import { isRuntimeEntry } from "./entry";
|
|
13
|
+
import { ssrPlugin } from "./ssr";
|
|
14
14
|
import { isRuntimeEntry as isRuntimeEntry2 } from "./entry";
|
|
15
15
|
var runtimePlugin = function(params) {
|
|
16
16
|
return {
|
|
@@ -122,10 +122,7 @@ var runtimePlugin = function(params) {
|
|
|
122
122
|
]
|
|
123
123
|
},
|
|
124
124
|
bundlerChain: function(chain) {
|
|
125
|
-
chain.module.rule("modern-entry").test(
|
|
126
|
-
/\.js$/,
|
|
127
|
-
/\.jsx$/
|
|
128
|
-
]).include.add(path.resolve(appDirectory, "node_modules", ".".concat(metaName))).end().sideEffects(true);
|
|
125
|
+
chain.module.rule("modern-entry").test(/\.jsx?$/).include.add(path.resolve(appDirectory, "node_modules", ".".concat(metaName))).end().sideEffects(true);
|
|
129
126
|
},
|
|
130
127
|
/**
|
|
131
128
|
* Add IgnorePlugin to fix react-dom/client import error when use react17
|
|
@@ -2,8 +2,8 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
2
2
|
var __commonJS = (cb, mod) => function __require() {
|
|
3
3
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
4
4
|
};
|
|
5
|
-
import crypto from "crypto";
|
|
6
5
|
import { Buffer as Buffer2 } from "buffer";
|
|
6
|
+
import crypto from "crypto";
|
|
7
7
|
import * as t from "@babel/types";
|
|
8
8
|
import { get } from "@modern-js/utils/lodash";
|
|
9
9
|
var require_babel_plugin_ssr_loader_id = __commonJS({
|
package/dist/esm/cli/template.js
CHANGED
|
@@ -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
|
|
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});");
|
|
48
48
|
};
|
|
49
49
|
export {
|
|
50
50
|
index,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
2
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
-
import { normalizePathname } from "@modern-js/runtime-utils/url";
|
|
5
4
|
import { loadableReady } from "@loadable/component";
|
|
5
|
+
import { normalizePathname } from "@modern-js/runtime-utils/url";
|
|
6
6
|
import { RenderLevel } from "../constants";
|
|
7
7
|
import { wrapRuntimeContextProvider } from "../react/wrapper";
|
|
8
8
|
import { WithCallback } from "./withCallback";
|
|
@@ -4,14 +4,14 @@ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
|
4
4
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
5
5
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
6
6
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
7
|
-
import cookieTool from "cookie";
|
|
8
7
|
import { parsedJSONFromElement } from "@modern-js/runtime-utils/parsed";
|
|
8
|
+
import cookieTool from "cookie";
|
|
9
|
+
import { ROUTER_DATA_JSON_ID, SSR_DATA_JSON_ID } from "../constants";
|
|
9
10
|
import { getGlobalAppInit } from "../context";
|
|
10
11
|
import { getInitialContext } from "../context/runtime";
|
|
11
12
|
import { createLoaderManager } from "../loader/loaderManager";
|
|
12
13
|
import { getGlobalRunner } from "../plugin/runner";
|
|
13
14
|
import { wrapRuntimeContextProvider } from "../react/wrapper";
|
|
14
|
-
import { ROUTER_DATA_JSON_ID, SSR_DATA_JSON_ID } from "../constants";
|
|
15
15
|
import { hydrateRoot } from "./hydrate";
|
|
16
16
|
var IS_REACT18 = process.env.IS_REACT18 === "true";
|
|
17
17
|
var getQuery = function() {
|
|
@@ -4,14 +4,14 @@ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
|
4
4
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
5
5
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
import React, { useContext, useMemo } from "react";
|
|
8
7
|
import { ROUTE_MANIFEST } from "@modern-js/utils/universal/constants";
|
|
8
|
+
import React, { useContext, useMemo } from "react";
|
|
9
|
+
import { hydrateRoot as ModernHydrateRoot } from "./browser/hydrate";
|
|
10
|
+
import { getGlobalAppInit } from "./context";
|
|
9
11
|
import { RuntimeReactContext } from "./context/runtime";
|
|
10
|
-
import { registerPlugin } from "./plugin";
|
|
11
12
|
import { createLoaderManager } from "./loader/loaderManager";
|
|
13
|
+
import { registerPlugin } from "./plugin";
|
|
12
14
|
import { getGlobalRunner } from "./plugin/runner";
|
|
13
|
-
import { getGlobalAppInit } from "./context";
|
|
14
|
-
import { hydrateRoot as ModernHydrateRoot } from "./browser/hydrate";
|
|
15
15
|
import { wrapRuntimeContextProvider } from "./react/wrapper";
|
|
16
16
|
var IS_REACT18 = process.env.IS_REACT18 === "true";
|
|
17
17
|
function isClientArgs(id) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createContext } from "react";
|
|
2
1
|
import { ROUTE_MANIFEST } from "@modern-js/utils/universal/constants";
|
|
2
|
+
import { createContext } from "react";
|
|
3
3
|
import { createLoaderManager } from "../loader/loaderManager";
|
|
4
4
|
var RuntimeReactContext = createContext({});
|
|
5
5
|
var ServerRouterContext = createContext({});
|
|
@@ -2,8 +2,8 @@ import { _ as _instanceof } from "@swc/helpers/_/_instanceof";
|
|
|
2
2
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
3
3
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
4
4
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
5
|
-
import { useContext, useRef, useMemo, useState, useCallback, useEffect } from "react";
|
|
6
5
|
import invariant from "invariant";
|
|
6
|
+
import { useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
7
7
|
import { RuntimeReactContext } from "../context/runtime";
|
|
8
8
|
import { LoaderStatus } from "./loaderManager";
|
|
9
9
|
var useLoader = function(loaderFn) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createAsyncInterruptWorkflow, createContext, createManager, createSyncParallelWorkflow, createWaterfall } from "@modern-js/plugin";
|
|
2
2
|
var RuntimeConfigContext = createContext({});
|
|
3
3
|
var useRuntimeConfigContext = function() {
|
|
4
4
|
return RuntimeConfigContext.use().value;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
2
2
|
import { merge } from "@modern-js/runtime-utils/merge";
|
|
3
|
-
import {
|
|
3
|
+
import { RuntimeConfigContext, runtime } from "./base";
|
|
4
4
|
import { getGlobalRunner, setGlobalRunner } from "./runner";
|
|
5
5
|
export * from "./base";
|
|
6
6
|
function setupConfigContext() {
|
|
@@ -5,9 +5,9 @@ import { _ as _inherits } from "@swc/helpers/_/_inherits";
|
|
|
5
5
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
6
6
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
7
7
|
import { _ as _create_super } from "@swc/helpers/_/_create_super";
|
|
8
|
-
import withSideEffect from "react-side-effect";
|
|
9
8
|
import React, { createElement } from "react";
|
|
10
|
-
import
|
|
9
|
+
import withSideEffect from "react-side-effect";
|
|
10
|
+
import { aggKeysFromPropsList, aggMatchesFromPropsList, exist, getOutermostProperty } from "./util";
|
|
11
11
|
var PROP_NAMES = {
|
|
12
12
|
INTERVAL: "interval",
|
|
13
13
|
STALE_LIMIT: "staleLimit",
|
|
@@ -5,13 +5,13 @@ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
|
5
5
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
6
6
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
7
7
|
import { getPathname, parseCookie, parseHeaders, parseQuery } from "@modern-js/runtime-utils/universal/request";
|
|
8
|
-
import { createRoot } from "../react";
|
|
9
8
|
import { getGlobalAppInit } from "../context";
|
|
10
|
-
import { getGlobalRunner } from "../plugin/runner";
|
|
11
9
|
import { getInitialContext } from "../context/runtime";
|
|
12
10
|
import { createLoaderManager } from "../loader/loaderManager";
|
|
13
|
-
import {
|
|
11
|
+
import { getGlobalRunner } from "../plugin/runner";
|
|
12
|
+
import { createRoot } from "../react";
|
|
14
13
|
import { CHUNK_CSS_PLACEHOLDER } from "./constants";
|
|
14
|
+
import { getSSRConfigByEntry, getSSRMode } from "./utils";
|
|
15
15
|
function createSSRContext(request, options) {
|
|
16
16
|
var config = options.config, loaderContext = options.loaderContext, onError = options.onError, onTiming = options.onTiming, locals = options.locals, resource = options.resource, params = options.params, responseProxy = options.responseProxy, logger = options.logger, metrics = options.metrics, reporter = options.reporter;
|
|
17
17
|
var nonce = config.nonce;
|
|
@@ -73,7 +73,7 @@ var createRequestHandler = function() {
|
|
|
73
73
|
return _ts_generator(this, function(_state) {
|
|
74
74
|
requestHandler = function() {
|
|
75
75
|
var _ref2 = _async_to_generator(function(request, options) {
|
|
76
|
-
var Root, runner, routeManifest, context, runBeforeRender, responseProxy, ssrContext, getRedirectResponse, initialData, redirectResponse, htmlTemplate, response;
|
|
76
|
+
var _context_routerContext, _context_routerContext1, Root, runner, routeManifest, context, runBeforeRender, responseProxy, ssrContext, getRedirectResponse, initialData, _context_routerContext2, _context_ssrContext, redirectResponse, htmlTemplate, response;
|
|
77
77
|
return _ts_generator(this, function(_state2) {
|
|
78
78
|
switch (_state2.label) {
|
|
79
79
|
case 0:
|
|
@@ -150,6 +150,10 @@ var createRequestHandler = function() {
|
|
|
150
150
|
];
|
|
151
151
|
case 1:
|
|
152
152
|
initialData = _state2.sent();
|
|
153
|
+
if (((_context_routerContext = context.routerContext) === null || _context_routerContext === void 0 ? void 0 : _context_routerContext.statusCode) && ((_context_routerContext1 = context.routerContext) === null || _context_routerContext1 === void 0 ? void 0 : _context_routerContext1.statusCode) !== 200) {
|
|
154
|
+
;
|
|
155
|
+
(_context_ssrContext = context.ssrContext) === null || _context_ssrContext === void 0 ? void 0 : _context_ssrContext.response.status((_context_routerContext2 = context.routerContext) === null || _context_routerContext2 === void 0 ? void 0 : _context_routerContext2.statusCode);
|
|
156
|
+
}
|
|
153
157
|
context.initialData = initialData;
|
|
154
158
|
redirectResponse = getRedirectResponse(initialData);
|
|
155
159
|
if (redirectResponse) {
|
|
@@ -2,9 +2,9 @@ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
|
2
2
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
3
3
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
4
4
|
import { serializeJson } from "@modern-js/runtime-utils/node";
|
|
5
|
-
import { attributesToString, safeReplace } from "../utils";
|
|
6
5
|
import { SSR_DATA_PLACEHOLDER } from "../constants";
|
|
7
6
|
import { buildHtml } from "../shared";
|
|
7
|
+
import { attributesToString, safeReplace } from "../utils";
|
|
8
8
|
function buildShellAfterTemplate(afterAppTemplate, options) {
|
|
9
9
|
var request = options.request, config = options.config, ssrConfig = options.ssrConfig, runtimeContext = options.runtimeContext, renderLevel = options.renderLevel, entryName = options.entryName;
|
|
10
10
|
var callbacks = [
|
|
@@ -2,12 +2,12 @@ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
|
2
2
|
import { _ as _instanceof } from "@swc/helpers/_/_instanceof";
|
|
3
3
|
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
4
4
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
5
|
-
import ReactHelmet from "react-helmet";
|
|
6
5
|
import { matchRoutes } from "@modern-js/runtime-utils/router";
|
|
7
|
-
import
|
|
6
|
+
import ReactHelmet from "react-helmet";
|
|
8
7
|
import { CHUNK_CSS_PLACEHOLDER } from "../constants";
|
|
9
|
-
import {
|
|
8
|
+
import { createReplaceHelemt } from "../helmet";
|
|
10
9
|
import { buildHtml } from "../shared";
|
|
10
|
+
import { checkIsNode, safeReplace } from "../utils";
|
|
11
11
|
var readAsset = function() {
|
|
12
12
|
var _ref = _async_to_generator(function(chunk) {
|
|
13
13
|
var fs, path, filepath;
|
|
@@ -4,12 +4,12 @@ import { _ as _instanceof } from "@swc/helpers/_/_instanceof";
|
|
|
4
4
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
5
5
|
import { Transform } from "stream";
|
|
6
6
|
import { createReadableStreamFromReadable } from "@modern-js/runtime-utils/node";
|
|
7
|
-
import { ServerStyleSheet } from "styled-components";
|
|
8
7
|
import checkIsBot from "isbot";
|
|
8
|
+
import { ServerStyleSheet } from "styled-components";
|
|
9
9
|
import { ESCAPED_SHELL_STREAM_END_MARK } from "../../../common";
|
|
10
10
|
import { RenderLevel } from "../../constants";
|
|
11
|
-
import { getTemplates } from "./template";
|
|
12
11
|
import { ShellChunkStatus, getReadableStreamFromString } from "./shared";
|
|
12
|
+
import { getTemplates } from "./template";
|
|
13
13
|
var createReadableStreamFromElement = function() {
|
|
14
14
|
var _ref = _async_to_generator(function(request, rootElement, options) {
|
|
15
15
|
var renderToPipeableStream, runtimeContext, htmlTemplate, config, ssrConfig, entryName, shellChunkStatus, renderLevel, forceStream2String, isbot, onReady, sheet, chunkVec, root;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
2
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
3
|
-
import { renderToReadableStream } from "react-dom/server";
|
|
4
3
|
import checkIsBot from "isbot";
|
|
5
|
-
import {
|
|
4
|
+
import { renderToReadableStream } from "react-dom/server";
|
|
6
5
|
import { ESCAPED_SHELL_STREAM_END_MARK } from "../../../common";
|
|
6
|
+
import { RenderLevel } from "../../constants";
|
|
7
7
|
import { ShellChunkStatus, encodeForWebStream, getReadableStreamFromString } from "./shared";
|
|
8
8
|
import { getTemplates } from "./template";
|
|
9
9
|
var createReadableStreamFromElement = function() {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
2
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
3
|
+
import { run } from "@modern-js/runtime-utils/node";
|
|
3
4
|
import { time } from "@modern-js/runtime-utils/time";
|
|
4
5
|
import { parseHeaders } from "@modern-js/runtime-utils/universal/request";
|
|
5
|
-
import { run } from "@modern-js/runtime-utils/node";
|
|
6
6
|
import { wrapRuntimeContextProvider } from "../../react/wrapper";
|
|
7
7
|
import { SSRErrors, SSRTimings, createOnError, createOnTiming } from "../tracer";
|
|
8
8
|
import { getSSRConfigByEntry } from "../utils";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
2
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
3
3
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
4
|
-
import { buildShellBeforeTemplate } from "./beforeTemplate";
|
|
5
4
|
import { buildShellAfterTemplate } from "./afterTemplate";
|
|
5
|
+
import { buildShellBeforeTemplate } from "./beforeTemplate";
|
|
6
6
|
var HTML_SEPARATOR = "<!--<?- html ?>-->";
|
|
7
7
|
var getTemplates = function() {
|
|
8
8
|
var _ref = _async_to_generator(function(htmlTemplate, options) {
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
2
|
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
3
3
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
4
|
-
import ReactHelmet from "react-helmet";
|
|
5
|
-
import ReactDomServer from "react-dom/server";
|
|
6
|
-
import { time } from "@modern-js/runtime-utils/time";
|
|
7
4
|
import { run } from "@modern-js/runtime-utils/node";
|
|
5
|
+
import { time } from "@modern-js/runtime-utils/time";
|
|
8
6
|
import { parseHeaders } from "@modern-js/runtime-utils/universal/request";
|
|
7
|
+
import ReactDomServer from "react-dom/server";
|
|
8
|
+
import ReactHelmet from "react-helmet";
|
|
9
|
+
import { RenderLevel } from "../../constants";
|
|
9
10
|
import { wrapRuntimeContextProvider } from "../../react/wrapper";
|
|
10
|
-
import { createReplaceHelemt } from "../helmet";
|
|
11
|
-
import { getSSRConfigByEntry, safeReplace } from "../utils";
|
|
12
11
|
import { CHUNK_CSS_PLACEHOLDER, CHUNK_JS_PLACEHOLDER, HTML_PLACEHOLDER, SSR_DATA_PLACEHOLDER } from "../constants";
|
|
12
|
+
import { createReplaceHelemt } from "../helmet";
|
|
13
13
|
import { buildHtml } from "../shared";
|
|
14
14
|
import { SSRErrors, SSRTimings, createOnError, createOnTiming } from "../tracer";
|
|
15
|
-
import {
|
|
16
|
-
import { SSRDataCollector } from "./ssrData";
|
|
15
|
+
import { getSSRConfigByEntry, safeReplace } from "../utils";
|
|
17
16
|
import { LoadableCollector } from "./loadable";
|
|
18
|
-
import { StyledCollector } from "./styledComponent";
|
|
19
17
|
import { prefetch } from "./prefetch";
|
|
18
|
+
import { SSRDataCollector } from "./ssrData";
|
|
19
|
+
import { StyledCollector } from "./styledComponent";
|
|
20
20
|
var renderString = function() {
|
|
21
21
|
var _ref = _async_to_generator(function(request, serverRoot, options) {
|
|
22
22
|
var headersData;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
2
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
3
|
-
import { renderToStaticMarkup } from "react-dom/server";
|
|
4
|
-
import { run } from "@modern-js/runtime-utils/node";
|
|
5
3
|
import { ChunkExtractor } from "@loadable/server";
|
|
4
|
+
import { run } from "@modern-js/runtime-utils/node";
|
|
6
5
|
import { time } from "@modern-js/runtime-utils/time";
|
|
7
6
|
import { parseHeaders } from "@modern-js/runtime-utils/universal/request";
|
|
7
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
8
8
|
import { wrapRuntimeContextProvider } from "../../react/wrapper";
|
|
9
9
|
import { SSRErrors, SSRTimings } from "../tracer";
|
|
10
10
|
var prefetch = function() {
|
|
@@ -6,8 +6,8 @@ import { _ as _class_private_method_get } from "@swc/helpers/_/_class_private_me
|
|
|
6
6
|
import { _ as _class_private_method_init } from "@swc/helpers/_/_class_private_method_init";
|
|
7
7
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
8
8
|
import { serializeJson } from "@modern-js/runtime-utils/node";
|
|
9
|
-
import { attributesToString, serializeErrors } from "../utils";
|
|
10
9
|
import { ROUTER_DATA_JSON_ID, SSR_DATA_JSON_ID } from "../../constants";
|
|
10
|
+
import { attributesToString, serializeErrors } from "../utils";
|
|
11
11
|
var _options = /* @__PURE__ */ new WeakMap(), _getSSRData = /* @__PURE__ */ new WeakSet(), _getSSRDataScripts = /* @__PURE__ */ new WeakSet();
|
|
12
12
|
var SSRDataCollector = /* @__PURE__ */ function() {
|
|
13
13
|
"use strict";
|
|
@@ -3,9 +3,9 @@ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
|
3
3
|
import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
|
|
4
4
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { useContext } from "react";
|
|
6
|
-
import { BODY_PARTICALS_SEPARATOR, DOCUMENT_CHUNKSMAP_PLACEHOLDER, DOCUMENT_SSRDATASCRIPT_PLACEHOLDER } from "./constants";
|
|
7
6
|
import { DocumentStructureContext } from "./DocumentStructureContext";
|
|
8
7
|
import { DefaultRoot } from "./Root";
|
|
8
|
+
import { BODY_PARTICALS_SEPARATOR, DOCUMENT_CHUNKSMAP_PLACEHOLDER, DOCUMENT_SSRDATASCRIPT_PLACEHOLDER } from "./constants";
|
|
9
9
|
function Body(props) {
|
|
10
10
|
var hasSetRoot = useContext(DocumentStructureContext).hasSetRoot;
|
|
11
11
|
var children = props.children, rest = _object_without_properties(props, [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { DOCUMENT_COMMENT_PLACEHOLDER_END, DOCUMENT_COMMENT_PLACEHOLDER_START } from "./constants";
|
|
3
3
|
function Comment(props) {
|
|
4
4
|
var comment = props.comment, children = props.children;
|
|
5
5
|
var commentStr = encodeURIComponent(children || comment || "");
|
|
@@ -4,8 +4,8 @@ import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_
|
|
|
4
4
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { useContext } from "react";
|
|
6
6
|
import { DocumentStructureContext } from "./DocumentStructureContext";
|
|
7
|
-
import { Scripts } from "./Scripts";
|
|
8
7
|
import { Links } from "./Links";
|
|
8
|
+
import { Scripts } from "./Scripts";
|
|
9
9
|
import { Title } from "./Title";
|
|
10
10
|
import { DOCUMENT_META_PLACEHOLDER, HEAD_PARTICALS_SEPARATOR, TOP_PARTICALS_SEPARATOR } from "./constants";
|
|
11
11
|
function Head(props) {
|
|
@@ -2,8 +2,8 @@ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
|
2
2
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
3
3
|
import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
|
|
4
4
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { useContext } from "react";
|
|
6
5
|
import { omit } from "@modern-js/utils/lodash";
|
|
6
|
+
import { useContext } from "react";
|
|
7
7
|
import { DocumentContext } from "./DocumentContext";
|
|
8
8
|
import { DOCUMENT_SSR_PLACEHOLDER } from "./constants";
|
|
9
9
|
function Root(props) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { DOCUMENT_SCRIPT_PLACEHOLDER_END, DOCUMENT_SCRIPT_PLACEHOLDER_START } from "./constants";
|
|
3
3
|
function Script(props) {
|
|
4
4
|
var content = props.content;
|
|
5
5
|
var contentStr = content.toString();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { DOCUMENT_STYLE_PLACEHOLDER_END, DOCUMENT_STYLE_PLACEHOLDER_START } from "./constants";
|
|
3
3
|
function Style(props) {
|
|
4
4
|
var content = props.content, children = props.children;
|
|
5
5
|
var contentStr = children || content;
|
|
@@ -3,12 +3,12 @@ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
|
3
3
|
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
4
4
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
5
5
|
import path from "path";
|
|
6
|
+
import { fs, createDebugger, findExists } from "@modern-js/utils";
|
|
7
|
+
import { build } from "esbuild";
|
|
6
8
|
import React from "react";
|
|
7
9
|
import ReactDomServer from "react-dom/server";
|
|
8
|
-
import { build } from "esbuild";
|
|
9
|
-
import { createDebugger, findExists, fs } from "@modern-js/utils";
|
|
10
10
|
import { DocumentContext } from "../DocumentContext";
|
|
11
|
-
import {
|
|
11
|
+
import { BODY_PARTICALS_SEPARATOR, DOCUMENT_CHUNKSMAP_PLACEHOLDER, DOCUMENT_COMMENT_PLACEHOLDER_END, DOCUMENT_COMMENT_PLACEHOLDER_START, DOCUMENT_FILE_NAME, DOCUMENT_LINKS_PLACEHOLDER, DOCUMENT_META_PLACEHOLDER, DOCUMENT_SCRIPTS_PLACEHOLDER, DOCUMENT_SCRIPT_PLACEHOLDER_END, DOCUMENT_SCRIPT_PLACEHOLDER_START, DOCUMENT_SSRDATASCRIPT_PLACEHOLDER, DOCUMENT_SSR_PLACEHOLDER, DOCUMENT_STYLE_PLACEHOLDER_END, DOCUMENT_STYLE_PLACEHOLDER_START, DOCUMENT_TITLE_PLACEHOLDER, DOC_EXT, HEAD_PARTICALS_SEPARATOR, HTML_SEPARATOR, PLACEHOLDER_REPLACER_MAP, TOP_PARTICALS_SEPARATOR } from "../constants";
|
|
12
12
|
var debug = createDebugger("html_genarate");
|
|
13
13
|
var getDocumenByEntryName = function getDocumenByEntryName2(entrypoints, entryName, fallbackDir) {
|
|
14
14
|
var _entrypoints_find;
|
|
@@ -2,10 +2,10 @@ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
|
2
2
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { fs } from "@modern-js/utils";
|
|
5
|
-
import { makeLegalIdentifier } from "../makeLegalIdentifier";
|
|
6
5
|
import { FILE_SYSTEM_ROUTES_COMPONENTS_DIR, FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP, FILE_SYSTEM_ROUTES_INDEX, FILE_SYSTEM_ROUTES_LAYOUT } from "../../constants";
|
|
6
|
+
import { makeLegalIdentifier } from "../makeLegalIdentifier";
|
|
7
7
|
import { replaceWithAlias } from "../utils";
|
|
8
|
-
import { debug, findLayout,
|
|
8
|
+
import { debug, findLayout, getRouteWeight, shouldSkip } from "./utils";
|
|
9
9
|
var compName = function(srcDirectory, filePath) {
|
|
10
10
|
var legalCompName = makeLegalIdentifier(path.relative(srcDirectory, filePath));
|
|
11
11
|
return "Comp_".concat(legalCompName);
|
|
@@ -3,9 +3,9 @@ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { fs } from "@modern-js/utils";
|
|
5
5
|
import { FILE_SYSTEM_ROUTES_COMPONENTS_DIR, FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP, FILE_SYSTEM_ROUTES_INDEX, FILE_SYSTEM_ROUTES_LAYOUT } from "../../constants";
|
|
6
|
-
import { replaceWithAlias } from "../utils";
|
|
7
6
|
import { makeLegalIdentifier } from "../makeLegalIdentifier";
|
|
8
|
-
import {
|
|
7
|
+
import { replaceWithAlias } from "../utils";
|
|
8
|
+
import { debug, findLayout, getRouteWeight, shouldSkip } from "./utils";
|
|
9
9
|
var compName = function(srcDirectory, filePath) {
|
|
10
10
|
var legalCompName = makeLegalIdentifier(path.relative(srcDirectory, filePath));
|
|
11
11
|
return "Comp_".concat(legalCompName);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import { JS_EXTENSIONS, createDebugger, findExists
|
|
3
|
-
import {
|
|
2
|
+
import { fs, JS_EXTENSIONS, createDebugger, findExists } from "@modern-js/utils";
|
|
3
|
+
import { FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT, FILE_SYSTEM_ROUTES_IGNORED_REGEX, FILE_SYSTEM_ROUTES_LAYOUT } from "../../constants";
|
|
4
4
|
var debug = createDebugger("get-client-routes");
|
|
5
5
|
var findLayout = function(dir) {
|
|
6
6
|
return findExists(JS_EXTENSIONS.map(function(ext) {
|