@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
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { renderToStaticMarkup } from "react-dom/server";
|
|
2
|
-
import { run } from "@modern-js/runtime-utils/node";
|
|
3
1
|
import { ChunkExtractor } from "@loadable/server";
|
|
2
|
+
import { run } from "@modern-js/runtime-utils/node";
|
|
4
3
|
import { time } from "@modern-js/runtime-utils/time";
|
|
5
4
|
import { parseHeaders } from "@modern-js/runtime-utils/universal/request";
|
|
5
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
6
6
|
import { wrapRuntimeContextProvider } from "../../react/wrapper";
|
|
7
7
|
import { SSRErrors, SSRTimings } from "../tracer";
|
|
8
8
|
const prefetch = async (App, request, options, ssrConfig, { onError, onTiming }) => {
|
|
@@ -4,8 +4,8 @@ import { _ as _class_private_field_set } from "@swc/helpers/_/_class_private_fie
|
|
|
4
4
|
import { _ as _class_private_method_get } from "@swc/helpers/_/_class_private_method_get";
|
|
5
5
|
import { _ as _class_private_method_init } from "@swc/helpers/_/_class_private_method_init";
|
|
6
6
|
import { serializeJson } from "@modern-js/runtime-utils/node";
|
|
7
|
-
import { attributesToString, serializeErrors } from "../utils";
|
|
8
7
|
import { ROUTER_DATA_JSON_ID, SSR_DATA_JSON_ID } from "../../constants";
|
|
8
|
+
import { attributesToString, serializeErrors } from "../utils";
|
|
9
9
|
var _options = /* @__PURE__ */ new WeakMap(), _getSSRData = /* @__PURE__ */ new WeakSet(), _getSSRDataScripts = /* @__PURE__ */ new WeakSet();
|
|
10
10
|
class SSRDataCollector {
|
|
11
11
|
effect() {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useContext } from "react";
|
|
3
|
-
import { BODY_PARTICALS_SEPARATOR, DOCUMENT_CHUNKSMAP_PLACEHOLDER, DOCUMENT_SSRDATASCRIPT_PLACEHOLDER } from "./constants";
|
|
4
3
|
import { DocumentStructureContext } from "./DocumentStructureContext";
|
|
5
4
|
import { DefaultRoot } from "./Root";
|
|
5
|
+
import { BODY_PARTICALS_SEPARATOR, DOCUMENT_CHUNKSMAP_PLACEHOLDER, DOCUMENT_SSRDATASCRIPT_PLACEHOLDER } from "./constants";
|
|
6
6
|
function Body(props) {
|
|
7
7
|
const { hasSetRoot } = useContext(DocumentStructureContext);
|
|
8
8
|
const { children, ...rest } = 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
|
const { comment, children } = props;
|
|
5
5
|
const commentStr = encodeURIComponent(children || comment || "");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useContext } from "react";
|
|
3
3
|
import { DocumentStructureContext } from "./DocumentStructureContext";
|
|
4
|
-
import { Scripts } from "./Scripts";
|
|
5
4
|
import { Links } from "./Links";
|
|
5
|
+
import { Scripts } from "./Scripts";
|
|
6
6
|
import { Title } from "./Title";
|
|
7
7
|
import { DOCUMENT_META_PLACEHOLDER, HEAD_PARTICALS_SEPARATOR, TOP_PARTICALS_SEPARATOR } from "./constants";
|
|
8
8
|
function Head(props) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useContext } from "react";
|
|
3
2
|
import { omit } from "@modern-js/utils/lodash";
|
|
3
|
+
import { useContext } from "react";
|
|
4
4
|
import { DocumentContext } from "./DocumentContext";
|
|
5
5
|
import { DOCUMENT_SSR_PLACEHOLDER } from "./constants";
|
|
6
6
|
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
|
const { content } = props;
|
|
5
5
|
const 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
|
const { content, children } = props;
|
|
5
5
|
const contentStr = children || content;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
+
import { fs, createDebugger, findExists } from "@modern-js/utils";
|
|
3
|
+
import { build } from "esbuild";
|
|
2
4
|
import React from "react";
|
|
3
5
|
import ReactDomServer from "react-dom/server";
|
|
4
|
-
import { build } from "esbuild";
|
|
5
|
-
import { createDebugger, findExists, fs } from "@modern-js/utils";
|
|
6
6
|
import { DocumentContext } from "../DocumentContext";
|
|
7
|
-
import {
|
|
7
|
+
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";
|
|
8
8
|
const debug = createDebugger("html_genarate");
|
|
9
9
|
const getDocumenByEntryName = function(entrypoints, entryName, fallbackDir) {
|
|
10
10
|
var _entrypoints_find;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { fs } from "@modern-js/utils";
|
|
3
|
-
import { makeLegalIdentifier } from "../makeLegalIdentifier";
|
|
4
3
|
import { FILE_SYSTEM_ROUTES_COMPONENTS_DIR, FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP, FILE_SYSTEM_ROUTES_INDEX, FILE_SYSTEM_ROUTES_LAYOUT } from "../../constants";
|
|
4
|
+
import { makeLegalIdentifier } from "../makeLegalIdentifier";
|
|
5
5
|
import { replaceWithAlias } from "../utils";
|
|
6
|
-
import { debug, findLayout,
|
|
6
|
+
import { debug, findLayout, getRouteWeight, shouldSkip } from "./utils";
|
|
7
7
|
const compName = (srcDirectory, filePath) => {
|
|
8
8
|
const legalCompName = makeLegalIdentifier(path.relative(srcDirectory, filePath));
|
|
9
9
|
return `Comp_${legalCompName}`;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { fs } from "@modern-js/utils";
|
|
3
3
|
import { FILE_SYSTEM_ROUTES_COMPONENTS_DIR, FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP, FILE_SYSTEM_ROUTES_INDEX, FILE_SYSTEM_ROUTES_LAYOUT } from "../../constants";
|
|
4
|
-
import { replaceWithAlias } from "../utils";
|
|
5
4
|
import { makeLegalIdentifier } from "../makeLegalIdentifier";
|
|
6
|
-
import {
|
|
5
|
+
import { replaceWithAlias } from "../utils";
|
|
6
|
+
import { debug, findLayout, getRouteWeight, shouldSkip } from "./utils";
|
|
7
7
|
const compName = (srcDirectory, filePath) => {
|
|
8
8
|
const legalCompName = makeLegalIdentifier(path.relative(srcDirectory, filePath));
|
|
9
9
|
return `Comp_${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
|
const debug = createDebugger("get-client-routes");
|
|
5
5
|
const findLayout = (dir) => findExists(JS_EXTENSIONS.map((ext) => path.resolve(dir, `${FILE_SYSTEM_ROUTES_LAYOUT}${ext}`)));
|
|
6
6
|
const getRouteWeight = (route) => route === "*" ? 999 : route.split(":").length - 1;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import { fs, getEntryOptions, isRouterV5, isSSGEntry, isUseSSRBundle, logger,
|
|
2
|
+
import { fs, filterRoutesForServer, filterRoutesLoader, getEntryOptions, isRouterV5, isSSGEntry, isUseSSRBundle, logger, markRoutes } from "@modern-js/utils";
|
|
3
3
|
import { cloneDeep } from "@modern-js/utils/lodash";
|
|
4
|
-
import { FILE_SYSTEM_ROUTES_FILE_NAME } from "../constants";
|
|
5
4
|
import { ENTRY_POINT_RUNTIME_GLOBAL_CONTEXT_FILE_NAME } from "../../../cli/constants";
|
|
6
|
-
import
|
|
5
|
+
import { FILE_SYSTEM_ROUTES_FILE_NAME } from "../constants";
|
|
7
6
|
import { getClientRoutes, getClientRoutesLegacy } from "./getClientRoutes";
|
|
8
|
-
import { getServerLoadersFile, getServerCombinedModueFile } from "./utils";
|
|
9
7
|
import { walk } from "./nestedRoutes";
|
|
8
|
+
import * as templates from "./templates";
|
|
9
|
+
import { getServerCombinedModueFile, getServerLoadersFile } from "./utils";
|
|
10
10
|
const generateCode = async (appContext, config, entrypoints, api) => {
|
|
11
11
|
const { internalDirectory, srcDirectory, internalDirAlias, internalSrcAlias, packageName } = appContext;
|
|
12
12
|
const hookRunners = api.useHookRunners();
|
|
@@ -81,7 +81,7 @@ const generateCode = async (appContext, config, entrypoints, api) => {
|
|
|
81
81
|
})
|
|
82
82
|
});
|
|
83
83
|
if (entrypoint.nestedRoutesEntry && isUseSSRBundle(config2)) {
|
|
84
|
-
var _config_output1;
|
|
84
|
+
var _config_output1, _config_output2;
|
|
85
85
|
const routesServerFile = getServerLoadersFile(internalDirectory, entryName);
|
|
86
86
|
const filtedRoutesForServer = filterRoutesForServer(routes);
|
|
87
87
|
const routesForServerLoaderMatches = filterRoutesLoader(routes);
|
|
@@ -100,6 +100,16 @@ const generateCode = async (appContext, config, entrypoints, api) => {
|
|
|
100
100
|
splitRouteChunks: config2 === null || config2 === void 0 ? void 0 : (_config_output1 = config2.output) === null || _config_output1 === void 0 ? void 0 : _config_output1.splitRouteChunks
|
|
101
101
|
});
|
|
102
102
|
await fs.outputFile(path.resolve(internalDirectory, `./${entryName}/routes.server.js`), serverRoutesCode, "utf8");
|
|
103
|
+
const mfServerRoutesCode = await templates.fileSystemRoutes({
|
|
104
|
+
metaName,
|
|
105
|
+
routes,
|
|
106
|
+
ssrMode: useSSG ? "string" : mode,
|
|
107
|
+
nestedRoutesEntry: entrypoint.nestedRoutesEntry,
|
|
108
|
+
entryName: entrypoint.entryName,
|
|
109
|
+
internalDirectory,
|
|
110
|
+
splitRouteChunks: config2 === null || config2 === void 0 ? void 0 : (_config_output2 = config2.output) === null || _config_output2 === void 0 ? void 0 : _config_output2.splitRouteChunks
|
|
111
|
+
});
|
|
112
|
+
await fs.outputFile(path.resolve(internalDirectory, `./${entryName}/mf-routes.js`), mfServerRoutesCode, "utf8");
|
|
103
113
|
}
|
|
104
114
|
const serverLoaderCombined = templates.ssrLoaderCombinedModule(entrypoints, entrypoint, config2, appContext);
|
|
105
115
|
if (serverLoaderCombined) {
|
|
@@ -111,25 +121,6 @@ const generateCode = async (appContext, config, entrypoints, api) => {
|
|
|
111
121
|
}
|
|
112
122
|
}
|
|
113
123
|
};
|
|
114
|
-
function markRoutes(routes, routeIds) {
|
|
115
|
-
return routes.map((route) => {
|
|
116
|
-
if (route.type !== "nested") {
|
|
117
|
-
return route;
|
|
118
|
-
}
|
|
119
|
-
if (route.children && route.children.length > 0) {
|
|
120
|
-
route.children = markRoutes(route.children, routeIds);
|
|
121
|
-
}
|
|
122
|
-
if (route.children && route.children.length > 0) {
|
|
123
|
-
route.inValidSSRRoute = route.children.every((child) => {
|
|
124
|
-
var _child_inValidSSRRoute;
|
|
125
|
-
return (_child_inValidSSRRoute = child.inValidSSRRoute) !== null && _child_inValidSSRRoute !== void 0 ? _child_inValidSSRRoute : false;
|
|
126
|
-
});
|
|
127
|
-
} else if (route.id) {
|
|
128
|
-
route.inValidSSRRoute = !routeIds.includes(route.id);
|
|
129
|
-
}
|
|
130
|
-
return route;
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
124
|
function generatorRegisterCode(internalDirectory, entryName, code) {
|
|
134
125
|
fs.outputFileSync(path.resolve(internalDirectory, `./${entryName}/${ENTRY_POINT_RUNTIME_GLOBAL_CONTEXT_FILE_NAME}`), code, "utf8");
|
|
135
126
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as path from "path";
|
|
2
|
-
import {
|
|
2
|
+
import { fs, JS_EXTENSIONS, normalizeToPosixPath } from "@modern-js/utils";
|
|
3
3
|
import { NESTED_ROUTE } from "../constants";
|
|
4
4
|
import { getPathWithoutExt, hasAction, replaceWithAlias } from "./utils";
|
|
5
5
|
const conventionNames = Object.values(NESTED_ROUTE);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import { findExists, formatImportPath,
|
|
2
|
+
import { fs, findExists, formatImportPath, getEntryOptions, isSSGEntry, slash } from "@modern-js/utils";
|
|
3
3
|
import { ROUTE_MODULES } from "@modern-js/utils/universal/constants";
|
|
4
4
|
import { APP_CONFIG_NAME, APP_INIT_EXPORTED, TEMP_LOADERS_DIR } from "../constants";
|
|
5
5
|
import { getPathWithoutExt, getServerLoadersFile, parseModule, replaceWithAlias } from "./utils";
|
|
@@ -332,14 +332,21 @@ function ssrLoaderCombinedModule(entrypoints, entrypoint, config, appContext) {
|
|
|
332
332
|
if (!config.source.enableAsyncEntry) {
|
|
333
333
|
return combinedModule;
|
|
334
334
|
}
|
|
335
|
-
return `
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
335
|
+
return `
|
|
336
|
+
async function loadModules() {
|
|
337
|
+
const [moduleA, moduleB] = await Promise.all([
|
|
338
|
+
import("${slash(serverLoaderRuntime)}"),
|
|
339
|
+
import("${slash(serverLoadersFile)}")
|
|
340
|
+
]);
|
|
341
|
+
|
|
342
|
+
return {
|
|
343
|
+
...moduleA,
|
|
344
|
+
...moduleB
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export { loadModules };
|
|
349
|
+
`;
|
|
343
350
|
}
|
|
344
351
|
return null;
|
|
345
352
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import {
|
|
4
|
-
import { transform } from "esbuild";
|
|
3
|
+
import { JS_EXTENSIONS, fs as fse, normalizeToPosixPath } from "@modern-js/utils";
|
|
5
4
|
import { parse } from "es-module-lexer";
|
|
5
|
+
import { transform } from "esbuild";
|
|
6
6
|
import { ACTION_EXPORT_NAME, LOADER_EXPORT_NAME } from "../constants";
|
|
7
7
|
const walkDirectory = (dir) => fs.readdirSync(dir).reduce((previous, filename) => {
|
|
8
8
|
const filePath = path.join(dir, filename);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import { JS_EXTENSIONS, findExists,
|
|
2
|
+
import { fs, JS_EXTENSIONS, findExists, isRouterV5 } from "@modern-js/utils";
|
|
3
3
|
import { hasApp } from "../../cli/entry";
|
|
4
4
|
import { FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT, NESTED_ROUTES_DIR, PAGES_DIR_NAME } from "./constants";
|
|
5
5
|
const hasPages = (dir) => fs.existsSync(path.join(dir, PAGES_DIR_NAME));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { cloneDeep } from "@modern-js/utils/lodash";
|
|
3
|
-
import { modifyEntrypoints } from "./entry";
|
|
4
|
-
import { isPageComponentFile } from "./code/utils";
|
|
5
3
|
import * as templates from "./code/templates";
|
|
4
|
+
import { isPageComponentFile } from "./code/utils";
|
|
5
|
+
import { modifyEntrypoints } from "./entry";
|
|
6
6
|
let originEntrypoints = [];
|
|
7
7
|
async function handleModifyEntrypoints(api, entrypoints) {
|
|
8
8
|
const config = api.useResolvedConfigContext();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { createRuntimeExportsUtils, filterRoutesForServer,
|
|
2
|
+
import { fs, NESTED_ROUTE_SPEC_FILE, createRuntimeExportsUtils, filterRoutesForServer, getEntryOptions, isRouterV5 as isV5 } from "@modern-js/utils";
|
|
3
3
|
import { isRouteEntry } from "./entry";
|
|
4
4
|
import { handleFileChange, handleGeneratorEntryCode, handleModifyEntrypoints } from "./handler";
|
|
5
5
|
import { isRouteEntry as isRouteEntry2 } from "./entry";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Suspense, useEffect, useRef, useMemo } from "react";
|
|
3
|
-
import { Await, useAsyncError } from "@modern-js/runtime-utils/router";
|
|
4
2
|
import { serializeJson } from "@modern-js/runtime-utils/node";
|
|
3
|
+
import { Await, useAsyncError } from "@modern-js/runtime-utils/router";
|
|
4
|
+
import { Suspense, useEffect, useMemo, useRef } from "react";
|
|
5
5
|
import { serializeErrors } from "./utils";
|
|
6
6
|
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}}))};`;
|
|
7
7
|
const resolveFnStr = `function r(e,r,o,A){A?_ROUTER_DATA.r[e][r].reject(A):_ROUTER_DATA.r[e][r].resolve(o)};`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Link as RouterLink, NavLink as RouterNavLink, matchRoutes, useHref, useMatches, useResolvedPath } from "@modern-js/runtime-utils/router";
|
|
2
3
|
import React, { useContext, useMemo } from "react";
|
|
3
|
-
import { Link as RouterLink, matchRoutes, useResolvedPath, useHref, useMatches, NavLink as RouterNavLink } from "@modern-js/runtime-utils/router";
|
|
4
4
|
import { RuntimeReactContext } from "../../core";
|
|
5
5
|
function composeEventHandlers(theirHandler, ourHandler) {
|
|
6
6
|
return (event) => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useContext, useMemo } from "react";
|
|
3
|
-
import { createBrowserRouter, createHashRouter, RouterProvider, createRoutesFromElements, useMatches, useLocation, useHref } from "@modern-js/runtime-utils/router";
|
|
4
|
-
import { parsedJSONFromElement } from "@modern-js/runtime-utils/parsed";
|
|
5
2
|
import { merge } from "@modern-js/runtime-utils/merge";
|
|
6
|
-
import {
|
|
3
|
+
import { parsedJSONFromElement } from "@modern-js/runtime-utils/parsed";
|
|
4
|
+
import { RouterProvider, createBrowserRouter, createHashRouter, createRoutesFromElements, useHref, useLocation, useMatches } from "@modern-js/runtime-utils/router";
|
|
5
|
+
import { useContext, useMemo } from "react";
|
|
7
6
|
import { RuntimeReactContext } from "../../core";
|
|
7
|
+
import { getGlobalLayoutApp, getGlobalRoutes } from "../../core/context";
|
|
8
8
|
import { modifyRoutes as modifyRoutesHook } from "./hooks";
|
|
9
9
|
import { deserializeErrors, renderRoutes, urlJoin } from "./utils";
|
|
10
10
|
let finalRouteConfig = {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { merge } from "@modern-js/runtime-utils/merge";
|
|
3
|
+
import { createRequestContext, reporterCtx } from "@modern-js/runtime-utils/node";
|
|
4
|
+
import { StaticRouterProvider, createStaticRouter } from "@modern-js/runtime-utils/node/router";
|
|
3
5
|
import { createStaticHandler } from "@modern-js/runtime-utils/remix-router";
|
|
4
|
-
import { createStaticRouter, StaticRouterProvider } from "@modern-js/runtime-utils/node/router";
|
|
5
6
|
import { createRoutesFromElements } from "@modern-js/runtime-utils/router";
|
|
6
|
-
import { reporterCtx, createRequestContext } from "@modern-js/runtime-utils/node";
|
|
7
7
|
import { time } from "@modern-js/runtime-utils/time";
|
|
8
8
|
import { LOADER_REPORTER_NAME } from "@modern-js/utils/universal/constants";
|
|
9
|
-
import {
|
|
9
|
+
import { useContext } from "react";
|
|
10
10
|
import { JSX_SHELL_STREAM_END_MARK } from "../../common";
|
|
11
11
|
import { RuntimeReactContext } from "../../core";
|
|
12
12
|
import { getGlobalLayoutApp, getGlobalRoutes } from "../../core/context";
|
|
13
|
-
import { renderRoutes, urlJoin } from "./utils";
|
|
14
|
-
import { modifyRoutes as modifyRoutesHook } from "./hooks";
|
|
15
13
|
import DeferredDataScripts from "./DeferredDataScripts.node";
|
|
14
|
+
import { modifyRoutes as modifyRoutesHook } from "./hooks";
|
|
15
|
+
import { renderRoutes, urlJoin } from "./utils";
|
|
16
16
|
function createRemixReuqest(request) {
|
|
17
17
|
const method = "GET";
|
|
18
18
|
const { headers } = request;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Route, isRouteErrorResponse } from "@modern-js/runtime-utils/router";
|
|
3
|
-
import { UNSAFE_ErrorResponseImpl as ErrorResponseImpl } from "@modern-js/runtime-utils/remix-router";
|
|
4
2
|
import { renderNestedRoute } from "@modern-js/runtime-utils/browser";
|
|
3
|
+
import { UNSAFE_ErrorResponseImpl as ErrorResponseImpl } from "@modern-js/runtime-utils/remix-router";
|
|
4
|
+
import { Route, isRouteErrorResponse } from "@modern-js/runtime-utils/router";
|
|
5
5
|
import { DefaultNotFound } from "./DefaultNotFound";
|
|
6
6
|
import DeferredDataScripts from "./DeferredDataScripts";
|
|
7
7
|
function getRouteComponents(routes, { globalApp, ssrMode, props, reporter }) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { plugin as effectsPlugin } from "@modern-js-reduck/plugin-effects";
|
|
2
1
|
import autoActionsPlugin from "@modern-js-reduck/plugin-auto-actions";
|
|
2
|
+
import { plugin as effectsPlugin } from "@modern-js-reduck/plugin-effects";
|
|
3
3
|
import immerPlugin from "@modern-js-reduck/plugin-immutable";
|
|
4
4
|
import { default as default2 } from "@modern-js-reduck/plugin-devtools";
|
|
5
5
|
const effects = () => effectsPlugin;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useContext } from "react";
|
|
3
|
-
import { createStore } from "@modern-js-reduck/store";
|
|
4
2
|
import { Provider } from "@modern-js-reduck/react";
|
|
3
|
+
import { createStore } from "@modern-js-reduck/store";
|
|
5
4
|
import { merge } from "@modern-js/runtime-utils/merge";
|
|
6
|
-
import {
|
|
7
|
-
import { RuntimeReactContext } from "../../core";
|
|
5
|
+
import { useContext } from "react";
|
|
8
6
|
import { isBrowser } from "../../common";
|
|
7
|
+
import { RuntimeReactContext } from "../../core";
|
|
8
|
+
import { autoActions, devtools, effects, immer } from "../plugins";
|
|
9
9
|
const StatePluginHandleMap = {
|
|
10
10
|
immer,
|
|
11
11
|
effects,
|
package/dist/types/cli/code.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AppTools, IAppContext, NormalizedConfig, RuntimePlugin } from '@modern-js/app-tools';
|
|
2
|
-
import type { Entrypoint } from '@modern-js/types';
|
|
3
2
|
import type { MaybeAsync } from '@modern-js/plugin';
|
|
3
|
+
import type { Entrypoint } from '@modern-js/types';
|
|
4
4
|
export declare const generateCode: (entrypoints: Entrypoint[], appContext: IAppContext, config: NormalizedConfig<AppTools>, onCollectRuntimePlugins: (params: {
|
|
5
5
|
entrypoint: Entrypoint;
|
|
6
6
|
plugins: RuntimePlugin[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { statePlugin } from '../state/cli';
|
|
3
|
-
import { routerPlugin } from '../router/cli';
|
|
1
|
+
import type { AppTools, CliPlugin } from '@modern-js/app-tools';
|
|
4
2
|
import { documentPlugin } from '../document/cli';
|
|
3
|
+
import { routerPlugin } from '../router/cli';
|
|
4
|
+
import { statePlugin } from '../state/cli';
|
|
5
5
|
import { ssrPlugin } from './ssr';
|
|
6
6
|
export { isRuntimeEntry } from './entry';
|
|
7
7
|
export { statePlugin, ssrPlugin, routerPlugin, documentPlugin };
|
package/dist/types/common.d.ts
CHANGED
package/dist/types/config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Renderer } from 'react-dom';
|
|
3
|
-
import type {
|
|
3
|
+
import type { createRoot, hydrateRoot } from 'react-dom/client';
|
|
4
4
|
import { type RuntimeContext, type TRuntimeContext } from './context/runtime';
|
|
5
5
|
import { type Plugin, type runtime } from './plugin';
|
|
6
6
|
export type CreateAppOptions = {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { Store } from '@modern-js-reduck/store';
|
|
3
|
-
import type {
|
|
3
|
+
import type { Router, RouterState, StaticHandlerContext } from '@modern-js/runtime-utils/remix-router';
|
|
4
|
+
import type { RouteManifest } from '../../router/runtime/types';
|
|
4
5
|
import { createLoaderManager } from '../loader/loaderManager';
|
|
5
6
|
import type { PluginRunner, runtime } from '../plugin';
|
|
6
|
-
import type { RouteManifest } from '../../router/runtime/types';
|
|
7
7
|
import type { SSRServerContext } from '../types';
|
|
8
8
|
export interface BaseRuntimeContext {
|
|
9
9
|
initialData?: Record<string, unknown>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type SSRConfig } from '../shared';
|
|
2
1
|
import type { RenderLevel } from '../../constants';
|
|
3
|
-
import type { HandleRequestConfig } from '../requestHandler';
|
|
4
2
|
import type { RuntimeContext } from '../../context';
|
|
3
|
+
import type { HandleRequestConfig } from '../requestHandler';
|
|
4
|
+
import { type SSRConfig } from '../shared';
|
|
5
5
|
export type BuildShellAfterTemplateOptions = {
|
|
6
6
|
runtimeContext: RuntimeContext;
|
|
7
7
|
renderLevel: RenderLevel;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type BuildShellBeforeTemplateOptions } from './beforeTemplate';
|
|
2
1
|
import { type BuildShellAfterTemplateOptions } from './afterTemplate';
|
|
2
|
+
import { type BuildShellBeforeTemplateOptions } from './beforeTemplate';
|
|
3
3
|
export type InjectTemplate = {
|
|
4
4
|
shellBefore: string;
|
|
5
5
|
shellAfter: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { LoaderResult } from '../../loader/loaderManager';
|
|
3
3
|
import type { HandleRequestOptions } from '../requestHandler';
|
|
4
|
-
import { type Tracer } from '../tracer';
|
|
5
4
|
import type { SSRConfig } from '../shared';
|
|
5
|
+
import { type Tracer } from '../tracer';
|
|
6
6
|
export declare const prefetch: (App: React.ReactElement, request: Request, options: HandleRequestOptions, ssrConfig: SSRConfig, { onError, onTiming }: Tracer) => Promise<{
|
|
7
7
|
initialData: Record<string, unknown> | undefined;
|
|
8
8
|
i18nData: any;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { StaticHandlerContext } from '@modern-js/runtime-utils/remix-router';
|
|
2
|
-
import type { SSRConfig } from '../shared';
|
|
3
2
|
import type { SSRServerContext } from '../../types';
|
|
4
|
-
import type {
|
|
3
|
+
import type { SSRConfig } from '../shared';
|
|
4
|
+
import type { ChunkSet, Collector } from './types';
|
|
5
5
|
export interface SSRDataCreatorOptions {
|
|
6
6
|
request: Request;
|
|
7
7
|
prefetchData: Record<string, any>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ServerStyleSheet } from 'styled-components';
|
|
2
1
|
import type { ReactElement } from 'react';
|
|
2
|
+
import { ServerStyleSheet } from 'styled-components';
|
|
3
3
|
import type { ChunkSet, Collector } from './types';
|
|
4
4
|
export declare class StyledCollector implements Collector {
|
|
5
5
|
#private;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type StaticHandlerContext } from '@modern-js/runtime-utils/remix-router';
|
|
2
1
|
import type { ServerUserConfig } from '@modern-js/app-tools';
|
|
2
|
+
import { type StaticHandlerContext } from '@modern-js/runtime-utils/remix-router';
|
|
3
3
|
import type { SSRConfig } from './shared';
|
|
4
4
|
export declare function attributesToString(attributes: Record<string, any>): string;
|
|
5
5
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BaseSSRServerContext } from '@modern-js/types';
|
|
2
|
-
import type { LoaderResult } from './loader/loaderManager';
|
|
3
2
|
import type { RenderLevel } from './constants';
|
|
3
|
+
import type { LoaderResult } from './loader/loaderManager';
|
|
4
4
|
declare global {
|
|
5
5
|
interface Window {
|
|
6
6
|
_SSR_DATA?: SSRContainer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AppTools, CliPlugin } from '@modern-js/app-tools';
|
|
2
2
|
import type { Entrypoint } from '@modern-js/types/cli';
|
|
3
3
|
export declare const getDocumenByEntryName: (entrypoints: Entrypoint[], entryName: string, fallbackDir?: string) => string | undefined;
|
|
4
4
|
export declare const documentPlugin: () => CliPlugin<AppTools>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { StateConfig } from './state';
|
|
2
1
|
import type { RouterConfig } from './router';
|
|
2
|
+
import type { StateConfig } from './state';
|
|
3
3
|
export type { Plugin } from './core';
|
|
4
4
|
export type { AppConfig, RuntimeConfig } from './common';
|
|
5
5
|
export { isBrowser } from './common';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { AppNormalizedConfig, AppTools } from '@modern-js/app-tools';
|
|
1
2
|
import type { IAppContext, PluginAPI } from '@modern-js/core';
|
|
2
3
|
import type { Entrypoint } from '@modern-js/types';
|
|
3
|
-
import type { AppNormalizedConfig, AppTools } from '@modern-js/app-tools';
|
|
4
4
|
export declare const generateCode: (appContext: IAppContext, config: AppNormalizedConfig<'shared'>, entrypoints: Entrypoint[], api: PluginAPI<AppTools<'shared'>>) => Promise<void>;
|
|
5
5
|
export declare function generatorRegisterCode(internalDirectory: string, entryName: string, code: string): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Entrypoint, NestedRouteForCli, PageRoute, RouteLegacy, SSRMode } from '@modern-js/types';
|
|
2
1
|
import type { AppNormalizedConfig, IAppContext } from '@modern-js/app-tools';
|
|
2
|
+
import type { Entrypoint, NestedRouteForCli, PageRoute, RouteLegacy, SSRMode } from '@modern-js/types';
|
|
3
3
|
export declare const routesForServer: ({ routesForServerLoaderMatches, }: {
|
|
4
4
|
routesForServerLoaderMatches: (NestedRouteForCli | PageRoute)[];
|
|
5
5
|
}) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Entrypoint } from '@modern-js/types';
|
|
2
|
-
import type { PluginAPI } from '@modern-js/core';
|
|
3
1
|
import type { AppTools } from '@modern-js/app-tools';
|
|
2
|
+
import type { PluginAPI } from '@modern-js/core';
|
|
3
|
+
import type { Entrypoint } from '@modern-js/types';
|
|
4
4
|
export declare function handleModifyEntrypoints(api: PluginAPI<AppTools<'shared'>>, entrypoints: Entrypoint[]): Promise<Entrypoint[]>;
|
|
5
5
|
export declare function handleGeneratorEntryCode(api: PluginAPI<AppTools<'shared'>>, entrypoints: Entrypoint[]): Promise<Entrypoint[]>;
|
|
6
6
|
export declare function handleFileChange(api: PluginAPI<AppTools<'shared'>>, e: any): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AppTools, CliPlugin } from '@modern-js/app-tools';
|
|
2
2
|
export { isRouteEntry } from './entry';
|
|
3
3
|
export { handleFileChange, handleModifyEntrypoints } from './handler';
|
|
4
4
|
export declare const routerPlugin: () => CliPlugin<AppTools<'shared'>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { type LinkProps as RouterLinkProps, type NavLinkProps as RouterNavLinkProps } from '@modern-js/runtime-utils/router';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
export declare function composeEventHandlers<EventType extends React.SyntheticEvent | Event>(theirHandler: ((event: EventType) => any) | undefined, ourHandler: (event: EventType) => any): (event: EventType) => any;
|
|
4
4
|
/**
|
|
5
5
|
* Modified from https://github.com/remix-run/remix/blob/9a0601bd704d2f3ee622e0ddacab9b611eb0c5bc/packages/remix-react/components.tsx#L218
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useRouteLoaderData as useRouteData } from '@modern-js/runtime-utils/router';
|
|
2
2
|
import { routerPlugin } from './plugin';
|
|
3
|
-
import type {
|
|
3
|
+
import type { RouterConfig, SingleRouteConfig } from './types';
|
|
4
4
|
export * from '@modern-js/runtime-utils/router';
|
|
5
5
|
export type { SingleRouteConfig, RouterConfig };
|
|
6
6
|
export { renderRoutes } from './utils';
|