@modern-js/runtime 2.41.0 → 2.42.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/document/DocumentStructureContext.js +2 -1
- package/dist/cjs/document/Head.js +7 -5
- package/dist/cjs/document/Html.js +2 -0
- package/dist/cjs/document/Title.js +34 -0
- package/dist/cjs/document/cli/index.js +5 -1
- package/dist/cjs/document/constants.js +3 -0
- package/dist/cjs/router/runtime/index.js +6 -2
- package/dist/cjs/router/runtime/plugin.js +2 -2
- package/dist/cjs/router/runtime/{shouldRevalidate.js → routeModule.js} +19 -5
- package/dist/cjs/ssr/index.js +3 -3
- package/dist/cjs/ssr/serverRender/tracker.js +9 -6
- package/dist/esm/document/DocumentStructureContext.js +2 -1
- package/dist/esm/document/Head.js +7 -5
- package/dist/esm/document/Html.js +2 -0
- package/dist/esm/document/Title.js +10 -0
- package/dist/esm/document/cli/index.js +9 -3
- package/dist/esm/document/constants.js +2 -0
- package/dist/esm/router/runtime/index.js +3 -1
- package/dist/esm/router/runtime/plugin.js +1 -1
- package/dist/esm/router/runtime/{shouldRevalidate.js → routeModule.js} +13 -1
- package/dist/esm/ssr/index.js +1 -1
- package/dist/esm/ssr/serverRender/tracker.js +9 -6
- package/dist/esm-node/document/DocumentStructureContext.js +2 -1
- package/dist/esm-node/document/Head.js +7 -5
- package/dist/esm-node/document/Html.js +2 -0
- package/dist/esm-node/document/Title.js +10 -0
- package/dist/esm-node/document/cli/index.js +6 -2
- package/dist/esm-node/document/constants.js +2 -0
- package/dist/esm-node/router/runtime/index.js +3 -1
- package/dist/esm-node/router/runtime/plugin.js +1 -1
- package/dist/esm-node/router/runtime/{shouldRevalidate.js → routeModule.js} +13 -1
- package/dist/esm-node/ssr/index.js +1 -1
- package/dist/esm-node/ssr/serverRender/tracker.js +9 -6
- package/dist/types/cli/index.d.ts +1 -1
- package/dist/types/common.d.ts +3 -3
- package/dist/types/config.d.ts +5 -5
- package/dist/types/core/appConfig.d.ts +1 -1
- package/dist/types/core/compatible.d.ts +8 -11
- package/dist/types/core/index.d.ts +1 -1
- package/dist/types/core/loader/index.d.ts +1 -1
- package/dist/types/core/loader/loaderManager.d.ts +38 -38
- package/dist/types/core/loader/useLoader.d.ts +31 -31
- package/dist/types/core/plugin.d.ts +178 -177
- package/dist/types/core/types.d.ts +12 -12
- package/dist/types/document/Body.d.ts +2 -2
- package/dist/types/document/Comment.d.ts +3 -3
- package/dist/types/document/DocumentContext.d.ts +9 -9
- package/dist/types/document/DocumentStructureContext.d.ts +8 -7
- package/dist/types/document/Head.d.ts +2 -2
- package/dist/types/document/Html.d.ts +2 -2
- package/dist/types/document/Links.d.ts +1 -1
- package/dist/types/document/Root.d.ts +4 -4
- package/dist/types/document/Script.d.ts +2 -2
- package/dist/types/document/Scripts.d.ts +1 -1
- package/dist/types/document/Style.d.ts +3 -3
- package/dist/types/document/Title.d.ts +2 -0
- package/dist/types/document/cli/index.d.ts +1 -1
- package/dist/types/document/constants.d.ts +3 -2
- package/dist/types/document/index.d.ts +1 -1
- package/dist/types/exports/head.d.ts +1 -1
- package/dist/types/exports/loadable.d.ts +1 -1
- package/dist/types/exports/server.d.ts +9 -17
- package/dist/types/exports/styled.d.ts +1 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/router/cli/index.d.ts +1 -1
- package/dist/types/router/index.d.ts +1 -1
- package/dist/types/router/runtime/DefaultNotFound.d.ts +1 -1
- package/dist/types/router/runtime/DeferredDataScripts.d.ts +1 -1
- package/dist/types/router/runtime/DeferredDataScripts.node.d.ts +2 -2
- package/dist/types/router/runtime/PrefetchLink.d.ts +3 -3
- package/dist/types/router/runtime/fetch.d.ts +1 -1
- package/dist/types/router/runtime/fetch.node.d.ts +1 -1
- package/dist/types/router/runtime/fetch.worker.d.ts +1 -1
- package/dist/types/router/runtime/hooks.d.ts +1 -1
- package/dist/types/router/runtime/index.d.ts +3 -3
- package/dist/types/router/runtime/plugin.d.ts +1 -7
- package/dist/types/router/runtime/plugin.node.d.ts +2 -6
- package/dist/types/router/runtime/routeModule.d.ts +6 -0
- package/dist/types/router/runtime/server.d.ts +1 -1
- package/dist/types/router/runtime/types.d.ts +41 -41
- package/dist/types/router/runtime/utils.d.ts +11 -21
- package/dist/types/router/runtime/withRouter.d.ts +4 -4
- package/dist/types/runtimeContext.d.ts +26 -26
- package/dist/types/ssr/cli/babel-plugin-ssr-loader-id.d.ts +1 -1
- package/dist/types/ssr/cli/index.d.ts +1 -1
- package/dist/types/ssr/cli/loadable-bundler-plugin.d.ts +1 -1
- package/dist/types/ssr/index.d.ts +5 -5
- package/dist/types/ssr/index.node.d.ts +1 -1
- package/dist/types/ssr/prefetch.d.ts +9 -9
- package/dist/types/ssr/react/index.d.ts +1 -1
- package/dist/types/ssr/react/nossr/index.d.ts +3 -3
- package/dist/types/ssr/react/prerender/index.d.ts +1 -1
- package/dist/types/ssr/react/prerender/type.d.ts +17 -17
- package/dist/types/ssr/react/prerender/util.d.ts +1 -1
- package/dist/types/ssr/react/withCallback/index.d.ts +3 -3
- package/dist/types/ssr/serverRender/helmet.d.ts +1 -1
- package/dist/types/ssr/serverRender/index.d.ts +1 -1
- package/dist/types/ssr/serverRender/renderToStream/buildTemplate.after.d.ts +3 -3
- package/dist/types/ssr/serverRender/renderToStream/buildTemplate.share.d.ts +1 -1
- package/dist/types/ssr/serverRender/renderToStream/bulidTemplate.before.d.ts +1 -1
- package/dist/types/ssr/serverRender/renderToStream/index.d.ts +1 -4
- package/dist/types/ssr/serverRender/renderToStream/renderToPipe.d.ts +1 -1
- package/dist/types/ssr/serverRender/renderToStream/renderToPipe.worker.d.ts +1 -1
- package/dist/types/ssr/serverRender/renderToStream/template.d.ts +3 -3
- package/dist/types/ssr/serverRender/renderToString/buildHtml.d.ts +1 -1
- package/dist/types/ssr/serverRender/renderToString/entry.d.ts +19 -19
- package/dist/types/ssr/serverRender/renderToString/index.d.ts +1 -5
- package/dist/types/ssr/serverRender/renderToString/loadable.d.ts +18 -18
- package/dist/types/ssr/serverRender/renderToString/render.d.ts +8 -8
- package/dist/types/ssr/serverRender/renderToString/styledComponent.d.ts +7 -7
- package/dist/types/ssr/serverRender/renderToString/type.d.ts +10 -10
- package/dist/types/ssr/serverRender/tracker.d.ts +14 -19
- package/dist/types/ssr/serverRender/types.d.ts +17 -17
- package/dist/types/ssr/serverRender/utils.d.ts +1 -1
- package/dist/types/ssr/utils.d.ts +4 -4
- package/dist/types/state/cli/index.d.ts +1 -1
- package/dist/types/state/index.d.ts +1 -1
- package/dist/types/state/plugins.d.ts +1 -1
- package/dist/types/state/runtime/index.d.ts +1 -1
- package/dist/types/state/runtime/plugin.d.ts +3 -3
- package/package.json +10 -10
- package/dist/types/router/runtime/shouldRevalidate.d.ts +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const DefaultNotFound: () => JSX.Element;
|
|
2
|
+
export declare const DefaultNotFound: () => JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
declare const _default: () => null;
|
|
2
|
-
export default _default;
|
|
2
|
+
export default _default;
|
|
@@ -18,11 +18,11 @@ export declare function composeEventHandlers<EventType extends React.SyntheticEv
|
|
|
18
18
|
*/
|
|
19
19
|
type PrefetchBehavior = 'intent' | 'render' | 'none';
|
|
20
20
|
export interface LinkProps extends RouterLinkProps {
|
|
21
|
-
|
|
21
|
+
prefetch?: PrefetchBehavior;
|
|
22
22
|
}
|
|
23
23
|
export interface NavLinkProps extends RouterNavLinkProps {
|
|
24
|
-
|
|
24
|
+
prefetch?: PrefetchBehavior;
|
|
25
25
|
}
|
|
26
26
|
declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
27
27
|
declare const NavLink: React.ForwardRefExoticComponent<NavLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
28
|
-
export { Link, NavLink };
|
|
28
|
+
export { Link, NavLink };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
declare function installGlobals(): void;
|
|
2
|
-
export { installGlobals };
|
|
2
|
+
export { installGlobals };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { installGlobals } from '@remix-run/node';
|
|
2
|
-
export { installGlobals };
|
|
2
|
+
export { installGlobals };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
declare function installGlobals(): void;
|
|
2
|
-
export { installGlobals };
|
|
2
|
+
export { installGlobals };
|
|
@@ -9,7 +9,7 @@ export * from './withRouter';
|
|
|
9
9
|
export { Link, NavLink } from './PrefetchLink';
|
|
10
10
|
export type { LinkProps, NavLinkProps } from './PrefetchLink';
|
|
11
11
|
export declare const useRouteLoaderData: typeof useRouteData;
|
|
12
|
-
export { createShouldRevalidate } from './
|
|
12
|
+
export { createShouldRevalidate, handleRouteModule, handleRouteModuleError, } from './routeModule';
|
|
13
13
|
export type { LoaderFunction, LoaderFunctionArgs } from './types';
|
|
14
|
-
export type { FormEncType, FormMethod, GetScrollRestorationKeyFunction, ParamKeyValuePair, SubmitOptions, URLSearchParamsInit, FetcherWithComponents, BrowserRouterProps, HashRouterProps, HistoryRouterProps, FormProps, ScrollRestorationProps, SubmitFunction, ActionFunction, ActionFunctionArgs, AwaitProps, unstable_Blocker, unstable_BlockerFunction, DataRouteMatch, DataRouteObject, Fetcher, Hash, IndexRouteObject, IndexRouteProps, JsonFunction, LayoutRouteProps, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NonIndexRouteObject, OutletProps, Params, ParamParseKey, Path, PathMatch, Pathname, PathPattern, PathRouteProps, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, Search, ShouldRevalidateFunction, To } from '@modern-js/runtime-utils/router';
|
|
15
|
-
export { createBrowserRouter, createHashRouter, createMemoryRouter, RouterProvider, BrowserRouter, HashRouter, MemoryRouter, Router, Await, Form, Navigate, Outlet, Route, Routes, ScrollRestoration, useActionData, useAsyncError, useAsyncValue, useBeforeUnload, useFetcher, useFetchers, useFormAction, useHref, useInRouterContext, useLinkClickHandler, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRoutes, useSearchParams, useSubmit, createRoutesFromChildren, createRoutesFromElements, createSearchParams, generatePath, isRouteErrorResponse, matchPath, matchRoutes, renderMatches, resolvePath, createPath, unstable_useBlocker, unstable_usePrompt, defer, json, redirect } from '@modern-js/runtime-utils/router';
|
|
14
|
+
export type { FormEncType, FormMethod, GetScrollRestorationKeyFunction, ParamKeyValuePair, SubmitOptions, URLSearchParamsInit, FetcherWithComponents, BrowserRouterProps, HashRouterProps, HistoryRouterProps, FormProps, ScrollRestorationProps, SubmitFunction, ActionFunction, ActionFunctionArgs, AwaitProps, unstable_Blocker, unstable_BlockerFunction, DataRouteMatch, DataRouteObject, Fetcher, Hash, IndexRouteObject, IndexRouteProps, JsonFunction, LayoutRouteProps, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NonIndexRouteObject, OutletProps, Params, ParamParseKey, Path, PathMatch, Pathname, PathPattern, PathRouteProps, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, Search, ShouldRevalidateFunction, To, } from '@modern-js/runtime-utils/router';
|
|
15
|
+
export { createBrowserRouter, createHashRouter, createMemoryRouter, RouterProvider, BrowserRouter, HashRouter, MemoryRouter, Router, Await, Form, Navigate, Outlet, Route, Routes, ScrollRestoration, useActionData, useAsyncError, useAsyncValue, useBeforeUnload, useFetcher, useFetchers, useFormAction, useHref, useInRouterContext, useLinkClickHandler, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRoutes, useSearchParams, useSubmit, createRoutesFromChildren, createRoutesFromElements, createSearchParams, generatePath, isRouteErrorResponse, matchPath, matchRoutes, renderMatches, resolvePath, createPath, unstable_useBlocker, unstable_usePrompt, defer, json, redirect, } from '@modern-js/runtime-utils/router';
|
|
@@ -3,10 +3,4 @@ import type { RouterConfig, Routes } from './types';
|
|
|
3
3
|
export declare let finalRouteConfig: RouterConfig['routesConfig'];
|
|
4
4
|
export declare let beforeCreateRouter: boolean;
|
|
5
5
|
export declare function modifyRoutes(modifyFunction: (routes: Routes) => Routes): void;
|
|
6
|
-
export declare const routerPlugin: ({
|
|
7
|
-
serverBase,
|
|
8
|
-
supportHtml5History,
|
|
9
|
-
basename,
|
|
10
|
-
routesConfig,
|
|
11
|
-
createRoutes
|
|
12
|
-
}: RouterConfig) => Plugin;
|
|
6
|
+
export declare const routerPlugin: ({ serverBase, supportHtml5History, basename, routesConfig, createRoutes, }: RouterConfig) => Plugin;
|
|
@@ -2,9 +2,5 @@ import type { Plugin } from '../../core';
|
|
|
2
2
|
import { SSRServerContext } from '../../ssr/serverRender/types';
|
|
3
3
|
import type { RouterConfig } from './types';
|
|
4
4
|
export declare function createFetchHeaders(requestHeaders: SSRServerContext['request']['headers']): Headers;
|
|
5
|
-
export declare const routerPlugin: ({
|
|
6
|
-
|
|
7
|
-
routesConfig,
|
|
8
|
-
createRoutes
|
|
9
|
-
}: RouterConfig) => Plugin;
|
|
10
|
-
export declare const modifyRoutes: () => void;
|
|
5
|
+
export declare const routerPlugin: ({ basename, routesConfig, createRoutes, }: RouterConfig) => Plugin;
|
|
6
|
+
export declare const modifyRoutes: () => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type Module from 'module';
|
|
3
|
+
import { ShouldRevalidateFunction } from '@modern-js/runtime-utils/remix-router';
|
|
4
|
+
export declare const createShouldRevalidate: (routeId: string) => ShouldRevalidateFunction;
|
|
5
|
+
export declare const handleRouteModule: (routeModule: Module, routeId: string) => Module;
|
|
6
|
+
export declare const handleRouteModuleError: (error: Error) => null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from '@modern-js/runtime-utils/node/router';
|
|
1
|
+
export * from '@modern-js/runtime-utils/node/router';
|
|
@@ -3,59 +3,59 @@ import type { RouteProps, RouteObject, Params } from '@modern-js/runtime-utils/r
|
|
|
3
3
|
import { PageRoute, NestedRoute } from '@modern-js/types';
|
|
4
4
|
import type { RequestContext } from '@modern-js/runtime-utils/node';
|
|
5
5
|
declare global {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
interface Window {
|
|
7
|
+
_SERVER_DATA?: {
|
|
8
|
+
router: {
|
|
9
|
+
baseUrl: string;
|
|
10
|
+
params: Record<string, string>;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
14
|
}
|
|
15
15
|
export type SingleRouteConfig = RouteProps & {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
redirect?: string;
|
|
17
|
+
routes?: SingleRouteConfig[];
|
|
18
|
+
key?: string;
|
|
19
|
+
/**
|
|
20
|
+
* layout component
|
|
21
|
+
*/
|
|
22
|
+
layout?: React.ComponentType;
|
|
23
|
+
/**
|
|
24
|
+
* component would be rendered when route macthed.
|
|
25
|
+
*/
|
|
26
|
+
component?: React.ComponentType;
|
|
27
27
|
};
|
|
28
28
|
export type RouterConfig = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
mode?: 'react-router-5';
|
|
30
|
+
routesConfig: {
|
|
31
|
+
globalApp?: React.ComponentType<any>;
|
|
32
|
+
routes: (NestedRoute | PageRoute)[];
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* You should not use it
|
|
36
|
+
*/
|
|
37
|
+
oldVersion?: boolean;
|
|
38
|
+
serverBase?: string[];
|
|
39
|
+
supportHtml5History?: boolean;
|
|
40
|
+
basename?: string;
|
|
41
|
+
createRoutes?: () => RouteObject[];
|
|
42
42
|
};
|
|
43
43
|
export type Routes = RouterConfig['routesConfig']['routes'];
|
|
44
44
|
export interface RouteManifest {
|
|
45
|
-
|
|
45
|
+
routeAssets: RouteAssets;
|
|
46
46
|
}
|
|
47
47
|
export interface RouteAssets {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
[routeId: string]: {
|
|
49
|
+
chunkIds?: (string | number)[];
|
|
50
|
+
assets?: string[];
|
|
51
|
+
};
|
|
52
52
|
}
|
|
53
53
|
interface DataFunctionArgs<D = any> {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
request: Request;
|
|
55
|
+
params: Params;
|
|
56
|
+
context?: D;
|
|
57
57
|
}
|
|
58
58
|
export type LoaderFunctionArgs = DataFunctionArgs<RequestContext>;
|
|
59
59
|
declare type DataFunctionValue = Response | NonNullable<unknown> | null;
|
|
60
60
|
export type LoaderFunction = (args: LoaderFunctionArgs) => Promise<DataFunctionValue> | DataFunctionValue;
|
|
61
|
-
export {};
|
|
61
|
+
export {};
|
|
@@ -2,27 +2,17 @@ import React from 'react';
|
|
|
2
2
|
import type { Reporter, NestedRoute, PageRoute, SSRMode } from '@modern-js/types';
|
|
3
3
|
import { type StaticHandlerContext, type Router } from '@modern-js/runtime-utils/remix-router';
|
|
4
4
|
import { RouterConfig } from './types';
|
|
5
|
-
export declare function getRouteComponents(routes: (NestedRoute | PageRoute)[], {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}: {
|
|
11
|
-
globalApp?: React.ComponentType<any>;
|
|
12
|
-
ssrMode?: SSRMode;
|
|
13
|
-
props?: Record<string, any>;
|
|
14
|
-
reporter?: Reporter;
|
|
5
|
+
export declare function getRouteComponents(routes: (NestedRoute | PageRoute)[], { globalApp, ssrMode, props, reporter, }: {
|
|
6
|
+
globalApp?: React.ComponentType<any>;
|
|
7
|
+
ssrMode?: SSRMode;
|
|
8
|
+
props?: Record<string, any>;
|
|
9
|
+
reporter?: Reporter;
|
|
15
10
|
}): React.ReactElement<any, string | React.JSXElementConstructor<any>>[];
|
|
16
|
-
export declare function renderRoutes({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}: {
|
|
22
|
-
routesConfig: RouterConfig['routesConfig'];
|
|
23
|
-
props?: Record<string, any>;
|
|
24
|
-
ssrMode?: SSRMode;
|
|
25
|
-
reporter?: Reporter;
|
|
11
|
+
export declare function renderRoutes({ routesConfig, props, ssrMode, reporter, }: {
|
|
12
|
+
routesConfig: RouterConfig['routesConfig'];
|
|
13
|
+
props?: Record<string, any>;
|
|
14
|
+
ssrMode?: SSRMode;
|
|
15
|
+
reporter?: Reporter;
|
|
26
16
|
}): React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | null;
|
|
27
17
|
export declare function getLocation(serverContext: any): string;
|
|
28
18
|
export declare const urlJoin: (...parts: string[]) => string;
|
|
@@ -36,4 +26,4 @@ export declare function serializeErrors(errors: StaticHandlerContext['errors']):
|
|
|
36
26
|
* forked from https://github.com/remix-run/remix/blob/main/packages/remix-react/errors.ts
|
|
37
27
|
* license at https://github.com/remix-run/remix/blob/main/LICENSE.md
|
|
38
28
|
*/
|
|
39
|
-
export declare function deserializeErrors(errors: Router['state']['errors']): Router['state']['errors'];
|
|
29
|
+
export declare function deserializeErrors(errors: Router['state']['errors']): Router['state']['errors'];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useLocation, useNavigate } from '@modern-js/runtime-utils/router';
|
|
3
3
|
export interface WithRouterProps {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
location: ReturnType<typeof useLocation>;
|
|
5
|
+
params: Record<string, string>;
|
|
6
|
+
navigate: ReturnType<typeof useNavigate>;
|
|
7
7
|
}
|
|
8
|
-
export declare const withRouter: <Props extends WithRouterProps>(Component: React.ComponentType<Props>) => (props: Omit<Props, keyof WithRouterProps>) => JSX.Element;
|
|
8
|
+
export declare const withRouter: <Props extends WithRouterProps>(Component: React.ComponentType<Props>) => (props: Omit<Props, keyof WithRouterProps>) => JSX.Element;
|
|
@@ -6,37 +6,37 @@ import { runtime } from './core/plugin';
|
|
|
6
6
|
import { RouteManifest } from './router/runtime/types';
|
|
7
7
|
import { SSRServerContext } from './ssr/serverRender/types';
|
|
8
8
|
export interface BaseRuntimeContext {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
initialData?: Record<string, unknown>;
|
|
10
|
+
loaderManager: ReturnType<typeof createLoaderManager>;
|
|
11
|
+
runner: ReturnType<typeof runtime.init>;
|
|
12
|
+
ssrContext?: SSRServerContext;
|
|
13
|
+
store?: Store;
|
|
14
|
+
routeManifest: RouteManifest;
|
|
15
|
+
routerContext?: StaticHandlerContext;
|
|
16
|
+
/**
|
|
17
|
+
* private method
|
|
18
|
+
*/
|
|
19
|
+
remixRouter?: Router;
|
|
20
|
+
/**
|
|
21
|
+
* private
|
|
22
|
+
*/
|
|
23
|
+
unstable_getBlockNavState?: () => boolean;
|
|
24
24
|
}
|
|
25
25
|
export interface RuntimeContext extends BaseRuntimeContext {
|
|
26
|
-
|
|
26
|
+
[key: string]: any;
|
|
27
27
|
}
|
|
28
28
|
export declare const RuntimeReactContext: import("react").Context<RuntimeContext>;
|
|
29
29
|
export declare const ServerRouterContext: import("react").Context<any>;
|
|
30
30
|
export interface BaseTRuntimeContext {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
initialData?: Record<string, unknown>;
|
|
32
|
+
request?: SSRServerContext['request'];
|
|
33
|
+
response?: SSRServerContext['response'];
|
|
34
|
+
store?: Store;
|
|
35
|
+
router?: {
|
|
36
|
+
navigate: Router['navigate'];
|
|
37
|
+
location: RouterState['location'];
|
|
38
|
+
};
|
|
39
39
|
}
|
|
40
40
|
export interface TRuntimeContext extends BaseTRuntimeContext {
|
|
41
|
-
|
|
42
|
-
}
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Plugin } from '../core';
|
|
2
2
|
import { RenderLevel, SSRServerContext, SSRPluginConfig } from './serverRender/types';
|
|
3
3
|
declare module '../core' {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
interface SSRContainer {
|
|
5
|
+
renderLevel: RenderLevel;
|
|
6
|
+
context?: SSRServerContext;
|
|
7
|
+
}
|
|
8
8
|
}
|
|
9
9
|
export declare const ssr: (config: SSRPluginConfig) => Plugin;
|
|
10
10
|
export default ssr;
|
|
11
|
-
export * from './react';
|
|
11
|
+
export * from './react';
|
|
@@ -3,14 +3,14 @@ import { LoaderResult } from '../core/loader/loaderManager';
|
|
|
3
3
|
import { SSRPluginConfig } from './serverRender/types';
|
|
4
4
|
import { SSRTracker } from './serverRender/tracker';
|
|
5
5
|
declare const prefetch: (App: React.ComponentType<any>, context: RuntimeContext, config: SSRPluginConfig, tracker: SSRTracker) => Promise<{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
initialData: Record<string, unknown> | undefined;
|
|
7
|
+
i18nData: any;
|
|
8
|
+
loadersData?: undefined;
|
|
9
|
+
storeState?: undefined;
|
|
10
10
|
} | {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
loadersData: Record<string, LoaderResult>;
|
|
12
|
+
initialData: Record<string, unknown> | undefined;
|
|
13
|
+
i18nData: any;
|
|
14
|
+
storeState: any;
|
|
15
15
|
}>;
|
|
16
|
-
export default prefetch;
|
|
16
|
+
export default prefetch;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { PreRender } from './prerender';
|
|
2
|
-
export { NoSSR } from './nossr';
|
|
2
|
+
export { NoSSR } from './nossr';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactElement } from 'react';
|
|
2
2
|
export declare const NoSSR: (props: React.PropsWithChildren<{
|
|
3
|
-
|
|
3
|
+
fallback?: ReactElement | string;
|
|
4
4
|
}>) => React.FunctionComponentElement<{
|
|
5
|
-
|
|
6
|
-
}>;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PreRender: any;
|
|
1
|
+
export declare const PreRender: any;
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
export type SprProps = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
interval: number;
|
|
3
|
+
staleLimit: number | boolean;
|
|
4
|
+
level: number;
|
|
5
|
+
includes: MetaKeyMap | null;
|
|
6
|
+
excludes: MetaKeyMap | null;
|
|
7
|
+
fallback: boolean;
|
|
8
|
+
matches: MetaKeyMatch | null;
|
|
9
9
|
};
|
|
10
10
|
export type GeneralizedProps = SprProps & {
|
|
11
|
-
|
|
11
|
+
[propName: string]: any;
|
|
12
12
|
};
|
|
13
13
|
export type SprConstructor = {
|
|
14
|
-
|
|
14
|
+
config: () => SprProps;
|
|
15
15
|
};
|
|
16
16
|
export type MetaKeyMap = {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
header?: string[];
|
|
18
|
+
query?: string[];
|
|
19
19
|
};
|
|
20
20
|
type MatchMap = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
[propName: string]: {
|
|
22
|
+
[propName: string]: string;
|
|
23
|
+
};
|
|
24
24
|
};
|
|
25
25
|
export type MetaKeyMatch = {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
header?: MatchMap;
|
|
27
|
+
query?: MatchMap;
|
|
28
28
|
};
|
|
29
|
-
export {};
|
|
29
|
+
export {};
|
|
@@ -3,4 +3,4 @@ export declare const getInnermostProperty: (propsList: GeneralizedProps[], propN
|
|
|
3
3
|
export declare const getOutermostProperty: (propsList: GeneralizedProps[], propName: string) => any;
|
|
4
4
|
export declare const aggKeysFromPropsList: (propsList: GeneralizedProps[], propName: string) => MetaKeyMap;
|
|
5
5
|
export declare const aggMatchesFromPropsList: (propsList: GeneralizedProps[], propName: string) => MetaKeyMatch;
|
|
6
|
-
export declare function exist(target: any): boolean;
|
|
6
|
+
export declare function exist(target: any): boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { HelmetData } from 'react-helmet';
|
|
2
|
-
export default function helmet(content: string, helmetData: HelmetData): string;
|
|
2
|
+
export default function helmet(content: string, helmetData: HelmetData): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ServerRenderOptions } from './types';
|
|
2
|
-
export default function serverRender(options: ServerRenderOptions): Promise<any>;
|
|
2
|
+
export default function serverRender(options: ServerRenderOptions): Promise<any>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RenderLevel, RuntimeContext } from '../types';
|
|
2
2
|
type BuildShellAfterTemplateOptions = {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
context: RuntimeContext;
|
|
4
|
+
renderLevel: RenderLevel;
|
|
5
5
|
};
|
|
6
6
|
export declare function buildShellAfterTemplate(afterAppTemplate: string, options: BuildShellAfterTemplateOptions): string;
|
|
7
|
-
export {};
|
|
7
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const HEAD_REG_EXP: RegExp;
|
|
2
2
|
export type BuildTemplateCb = (headTemplate: string) => string;
|
|
3
|
-
export declare function buildTemplate(template: string, callbacks: BuildTemplateCb[]): string;
|
|
3
|
+
export declare function buildTemplate(template: string, callbacks: BuildTemplateCb[]): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { RuntimeContext } from '../types';
|
|
2
|
-
export declare function buildShellBeforeTemplate(beforeAppTemplate: string, context: RuntimeContext): string;
|
|
2
|
+
export declare function buildShellBeforeTemplate(beforeAppTemplate: string, context: RuntimeContext): string;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { ServerRenderOptions } from '../types';
|
|
3
|
-
export declare const render: ({
|
|
4
|
-
App,
|
|
5
|
-
context
|
|
6
|
-
}: ServerRenderOptions) => Promise<import("./renderToPipe").Pipe<import("stream").Writable>>;
|
|
3
|
+
export declare const render: ({ App, context }: ServerRenderOptions) => Promise<import("./renderToPipe").Pipe<import("stream").Writable>>;
|
|
@@ -5,4 +5,4 @@ import type { RenderToPipeableStreamOptions } from 'react-dom/server';
|
|
|
5
5
|
import { RuntimeContext } from '../types';
|
|
6
6
|
export type Pipe<T extends Writable> = (output: T) => Promise<T | string>;
|
|
7
7
|
declare function renderToPipe(rootElement: React.ReactElement, context: RuntimeContext, options?: RenderToPipeableStreamOptions): Pipe<Writable>;
|
|
8
|
-
export default renderToPipe;
|
|
8
|
+
export default renderToPipe;
|
|
@@ -5,4 +5,4 @@ import type { RenderToReadableStreamOptions } from 'react-dom/server';
|
|
|
5
5
|
import { RuntimeContext } from '../types';
|
|
6
6
|
export type Pipe<T extends Writable> = (output: T) => Promise<T | string>;
|
|
7
7
|
declare function renderToPipe(rootElement: React.ReactElement, context: RuntimeContext, options?: RenderToReadableStreamOptions): Promise<string | ReadableStream<any>>;
|
|
8
|
-
export default renderToPipe;
|
|
8
|
+
export default renderToPipe;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RenderLevel, RuntimeContext } from '../types';
|
|
2
2
|
export type InjectTemplate = {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
shellBefore: string;
|
|
4
|
+
shellAfter: string;
|
|
5
5
|
};
|
|
6
|
-
export declare const getTemplates: (context: RuntimeContext, renderLevel: RenderLevel) => InjectTemplate;
|
|
6
|
+
export declare const getTemplates: (context: RuntimeContext, renderLevel: RenderLevel) => InjectTemplate;
|
|
@@ -3,4 +3,4 @@ export declare function buildHtml(template: string, callbacks: BuildHtmlCb[]): s
|
|
|
3
3
|
export declare function createReplaceHtml(html: string): BuildHtmlCb;
|
|
4
4
|
export declare function createReplaceSSRDataScript(data: string): BuildHtmlCb;
|
|
5
5
|
export declare function createReplaceChunkJs(js: string): BuildHtmlCb;
|
|
6
|
-
export declare function createReplaceChunkCss(css: string): BuildHtmlCb;
|
|
6
|
+
export declare function createReplaceChunkCss(css: string): BuildHtmlCb;
|
|
@@ -2,25 +2,25 @@ import { RuntimeContext, ModernSSRReactComponent, SSRPluginConfig, SSRServerCont
|
|
|
2
2
|
import { SSRTracker } from '../tracker';
|
|
3
3
|
import { RenderResult } from './type';
|
|
4
4
|
type EntryOptions = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
ctx: SSRServerContext;
|
|
6
|
+
App: ModernSSRReactComponent;
|
|
7
|
+
config: SSRPluginConfig;
|
|
8
8
|
};
|
|
9
9
|
export default class Entry {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
10
|
+
entryName: string;
|
|
11
|
+
result: RenderResult;
|
|
12
|
+
metrics: SSRServerContext['metrics'];
|
|
13
|
+
tracker: SSRTracker;
|
|
14
|
+
private readonly template;
|
|
15
|
+
private readonly App;
|
|
16
|
+
private readonly pluginConfig;
|
|
17
|
+
private readonly htmlModifiers;
|
|
18
|
+
private readonly nonce?;
|
|
19
|
+
private readonly routeManifest?;
|
|
20
|
+
constructor(options: EntryOptions);
|
|
21
|
+
renderToHtml(context: RuntimeContext): Promise<string>;
|
|
22
|
+
private prefetch;
|
|
23
|
+
private renderToString;
|
|
24
|
+
private getSSRDataScript;
|
|
25
25
|
}
|
|
26
|
-
export {};
|
|
26
|
+
export {};
|