@bleedingdev/modern-js-runtime 3.8.3-ultramodern.6 → 3.9.0-ultramodern.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/cli/code.js +3 -1
- package/dist/cjs/cli/ssr/index.js +2 -74
- package/dist/cjs/core/browser/hydrate.js +6 -1
- package/dist/cjs/core/context/index.js +4 -43
- package/dist/cjs/core/context/public.js +4 -7
- package/dist/cjs/core/context/runtime.js +17 -5
- package/dist/cjs/core/react/wrapper.js +22 -65
- package/dist/cjs/core/server/helmet.js +5 -4
- package/dist/cjs/core/server/requestResponse.js +4 -4
- package/dist/cjs/core/server/routerCleanup.js +2 -2
- package/dist/cjs/core/server/shared.js +171 -4
- package/dist/cjs/core/server/stream/afterTemplate.js +21 -16
- package/dist/cjs/core/server/stream/beforeTemplate.js +34 -25
- package/dist/cjs/core/server/stream/beforeTemplate.worker.js +28 -21
- package/dist/cjs/core/server/stream/createReadableStream.js +208 -123
- package/dist/cjs/core/server/stream/createReadableStream.worker.js +159 -90
- package/dist/cjs/core/server/stream/deferredScript.js +3 -3
- package/dist/cjs/core/server/stream/shared.js +2 -2
- package/dist/cjs/core/server/string/index.js +100 -64
- package/dist/cjs/core/server/string/loadable.js +34 -19
- package/dist/cjs/core/server/string/ssrData.js +5 -12
- package/dist/cjs/core/server/utils.js +1 -2
- package/dist/cjs/document/cli/index.js +1 -2
- package/dist/cjs/exports/head.js +7 -14
- package/dist/cjs/router/runtime/PrefetchLink.js +67 -123
- package/dist/cjs/router/runtime/hooks.js +13 -2
- package/dist/cjs/router/runtime/internal.js +7 -45
- package/dist/cjs/router/runtime/plugin.js +2 -8
- package/dist/cjs/router/runtime/plugin.node.js +2 -30
- package/dist/cjs/router/runtime/redirect.js +1 -1
- package/dist/esm/cli/code.mjs +3 -1
- package/dist/esm/cli/ssr/index.mjs +3 -72
- package/dist/esm/core/browser/hydrate.mjs +7 -2
- package/dist/esm/core/context/index.mjs +2 -5
- package/dist/esm/core/context/public.mjs +1 -5
- package/dist/esm/core/context/runtime.mjs +13 -4
- package/dist/esm/core/react/wrapper.mjs +21 -67
- package/dist/esm/core/server/helmet.mjs +5 -4
- package/dist/esm/core/server/requestResponse.mjs +3 -3
- package/dist/esm/core/server/routerCleanup.mjs +1 -1
- package/dist/esm/core/server/shared.mjs +153 -1
- package/dist/esm/core/server/stream/afterTemplate.mjs +23 -18
- package/dist/esm/core/server/stream/beforeTemplate.mjs +37 -28
- package/dist/esm/core/server/stream/beforeTemplate.worker.mjs +31 -24
- package/dist/esm/core/server/stream/createReadableStream.mjs +207 -122
- package/dist/esm/core/server/stream/createReadableStream.worker.mjs +149 -90
- package/dist/esm/core/server/stream/deferredScript.mjs +3 -3
- package/dist/esm/core/server/stream/shared.mjs +2 -2
- package/dist/esm/core/server/string/index.mjs +104 -68
- package/dist/esm/core/server/string/loadable.mjs +34 -19
- package/dist/esm/core/server/string/ssrData.mjs +5 -12
- package/dist/esm/core/server/utils.mjs +1 -2
- package/dist/esm/document/cli/index.mjs +2 -3
- package/dist/esm/exports/head.mjs +7 -14
- package/dist/esm/router/runtime/PrefetchLink.mjs +68 -124
- package/dist/esm/router/runtime/hooks.mjs +9 -1
- package/dist/esm/router/runtime/internal.mjs +2 -33
- package/dist/esm/router/runtime/plugin.mjs +1 -7
- package/dist/esm/router/runtime/plugin.node.mjs +1 -29
- package/dist/esm/router/runtime/redirect.mjs +1 -1
- package/dist/esm-node/cli/code.mjs +3 -1
- package/dist/esm-node/cli/ssr/index.mjs +3 -72
- package/dist/esm-node/core/browser/hydrate.mjs +7 -2
- package/dist/esm-node/core/context/index.mjs +2 -5
- package/dist/esm-node/core/context/public.mjs +1 -5
- package/dist/esm-node/core/context/runtime.mjs +13 -4
- package/dist/esm-node/core/react/wrapper.mjs +21 -67
- package/dist/esm-node/core/server/helmet.mjs +5 -4
- package/dist/esm-node/core/server/requestResponse.mjs +3 -3
- package/dist/esm-node/core/server/routerCleanup.mjs +1 -1
- package/dist/esm-node/core/server/shared.mjs +153 -1
- package/dist/esm-node/core/server/stream/afterTemplate.mjs +23 -18
- package/dist/esm-node/core/server/stream/beforeTemplate.mjs +37 -28
- package/dist/esm-node/core/server/stream/beforeTemplate.worker.mjs +31 -24
- package/dist/esm-node/core/server/stream/createReadableStream.mjs +207 -122
- package/dist/esm-node/core/server/stream/createReadableStream.worker.mjs +149 -90
- package/dist/esm-node/core/server/stream/deferredScript.mjs +3 -3
- package/dist/esm-node/core/server/stream/shared.mjs +2 -2
- package/dist/esm-node/core/server/string/index.mjs +104 -68
- package/dist/esm-node/core/server/string/loadable.mjs +34 -19
- package/dist/esm-node/core/server/string/ssrData.mjs +5 -12
- package/dist/esm-node/core/server/utils.mjs +1 -2
- package/dist/esm-node/document/cli/index.mjs +2 -3
- package/dist/esm-node/exports/head.mjs +7 -14
- package/dist/esm-node/router/runtime/PrefetchLink.mjs +68 -124
- package/dist/esm-node/router/runtime/hooks.mjs +9 -1
- package/dist/esm-node/router/runtime/internal.mjs +2 -33
- package/dist/esm-node/router/runtime/plugin.mjs +1 -7
- package/dist/esm-node/router/runtime/plugin.node.mjs +1 -29
- package/dist/esm-node/router/runtime/redirect.mjs +1 -1
- package/dist/types/cli/index.d.ts +7 -7
- package/dist/types/cli/ssr/index.d.ts +0 -3
- package/dist/types/core/browser/hydrate.d.ts +1 -1
- package/dist/types/core/browser/index.d.ts +1 -1
- package/dist/types/core/compat/hooks.d.ts +1 -1
- package/dist/types/core/compat/index.d.ts +1 -1
- package/dist/types/core/compat/requestContext.d.ts +3 -3
- package/dist/types/core/config.d.ts +1 -1
- package/dist/types/core/context/index.d.ts +8 -10
- package/dist/types/core/context/monitors/index.d.ts +1 -1
- package/dist/types/core/context/monitors/index.server.d.ts +1 -1
- package/dist/types/core/context/public.d.ts +1 -23
- package/dist/types/core/context/runtime.d.ts +27 -3
- package/dist/types/core/context/serverPayload/index.d.ts +1 -1
- package/dist/types/core/index.d.ts +5 -5
- package/dist/types/core/plugin/index.d.ts +1 -1
- package/dist/types/core/plugin/types.d.ts +2 -2
- package/dist/types/core/react/wrapper.d.ts +7 -1
- package/dist/types/core/server/helmet.d.ts +4 -5
- package/dist/types/core/server/index.d.ts +2 -2
- package/dist/types/core/server/react/index.d.ts +2 -2
- package/dist/types/core/server/requestHandler.d.ts +3 -3
- package/dist/types/core/server/requestResponse.d.ts +3 -3
- package/dist/types/core/server/routerCleanup.d.ts +2 -2
- package/dist/types/core/server/server.d.ts +4 -4
- package/dist/types/core/server/shared.d.ts +25 -2
- package/dist/types/core/server/stream/afterTemplate.d.ts +5 -4
- package/dist/types/core/server/stream/beforeTemplate.d.ts +6 -3
- package/dist/types/core/server/stream/beforeTemplate.worker.d.ts +6 -3
- package/dist/types/core/server/stream/createReadableStream.d.ts +1 -1
- package/dist/types/core/server/stream/createReadableStream.worker.d.ts +1 -1
- package/dist/types/core/server/stream/index.d.ts +1 -1
- package/dist/types/core/server/stream/shared.d.ts +5 -5
- package/dist/types/core/server/stream/template.d.ts +2 -2
- package/dist/types/core/server/string/index.d.ts +1 -1
- package/dist/types/core/server/string/loadable.d.ts +7 -4
- package/dist/types/core/server/string/ssrData.d.ts +5 -4
- package/dist/types/core/server/string/types.d.ts +2 -6
- package/dist/types/core/server/tracer.d.ts +1 -1
- package/dist/types/core/server/utils.d.ts +2 -2
- package/dist/types/core/types.d.ts +2 -3
- package/dist/types/document/index.d.ts +12 -12
- package/dist/types/exports/config-routes.d.ts +1 -1
- package/dist/types/exports/head.d.ts +2 -2
- package/dist/types/index.d.ts +9 -9
- package/dist/types/internal.d.ts +1 -1
- package/dist/types/react-server.d.ts +3 -3
- package/dist/types/router/cli/code/getClientRoutes/index.d.ts +1 -1
- package/dist/types/router/cli/handler.d.ts +1 -1
- package/dist/types/router/cli/index.d.ts +3 -3
- package/dist/types/router/index.d.ts +1 -1
- package/dist/types/router/internal.d.ts +2 -2
- package/dist/types/router/runtime/PrefetchLink.d.ts +27 -2
- package/dist/types/router/runtime/hooks.d.ts +19 -2
- package/dist/types/router/runtime/index.d.ts +4 -4
- package/dist/types/router/runtime/internal.d.ts +5 -22
- package/dist/types/router/runtime/plugin.d.ts +3 -3
- package/dist/types/router/runtime/plugin.node.d.ts +3 -3
- package/dist/types/router/runtime/rsc-router.d.ts +3 -3
- package/dist/types/router/runtime/types.d.ts +2 -43
- package/dist/types/router/runtime/utils.d.ts +1 -1
- package/package.json +19 -47
- package/rstest.config.mts +32 -2
- package/dist/cjs/boundary-debugger/index.js +0 -317
- package/dist/cjs/core/context/extensions.js +0 -74
- package/dist/cjs/core/context/helmetContext.js +0 -54
- package/dist/cjs/core/server/federatedCss.js +0 -58
- package/dist/cjs/core/server/scriptOrder.js +0 -140
- package/dist/cjs/module-federation/consume-surface.js +0 -199
- package/dist/cjs/module-federation/distributed-ssr.js +0 -135
- package/dist/cjs/module-federation/index.js +0 -316
- package/dist/cjs/module-federation/last-known-good.js +0 -157
- package/dist/cjs/module-federation/manifest-recovery-runtime-plugin.js +0 -129
- package/dist/cjs/module-federation/surface-resolution-types.js +0 -61
- package/dist/cjs/router/runtime/lifecycle.js +0 -167
- package/dist/cjs/router/runtime/provider.js +0 -153
- package/dist/esm/boundary-debugger/index.mjs +0 -277
- package/dist/esm/core/context/extensions.mjs +0 -33
- package/dist/esm/core/context/helmetContext.mjs +0 -13
- package/dist/esm/core/server/federatedCss.mjs +0 -20
- package/dist/esm/core/server/scriptOrder.mjs +0 -90
- package/dist/esm/module-federation/consume-surface.mjs +0 -158
- package/dist/esm/module-federation/distributed-ssr.mjs +0 -82
- package/dist/esm/module-federation/index.mjs +0 -115
- package/dist/esm/module-federation/last-known-good.mjs +0 -113
- package/dist/esm/module-federation/manifest-recovery-runtime-plugin.mjs +0 -89
- package/dist/esm/module-federation/surface-resolution-types.mjs +0 -8
- package/dist/esm/router/runtime/lifecycle.mjs +0 -105
- package/dist/esm/router/runtime/provider.mjs +0 -100
- package/dist/esm-node/boundary-debugger/index.mjs +0 -278
- package/dist/esm-node/core/context/extensions.mjs +0 -34
- package/dist/esm-node/core/context/helmetContext.mjs +0 -14
- package/dist/esm-node/core/server/federatedCss.mjs +0 -21
- package/dist/esm-node/core/server/scriptOrder.mjs +0 -91
- package/dist/esm-node/module-federation/consume-surface.mjs +0 -159
- package/dist/esm-node/module-federation/distributed-ssr.mjs +0 -83
- package/dist/esm-node/module-federation/index.mjs +0 -116
- package/dist/esm-node/module-federation/last-known-good.mjs +0 -114
- package/dist/esm-node/module-federation/manifest-recovery-runtime-plugin.mjs +0 -90
- package/dist/esm-node/module-federation/surface-resolution-types.mjs +0 -9
- package/dist/esm-node/router/runtime/lifecycle.mjs +0 -106
- package/dist/esm-node/router/runtime/provider.mjs +0 -101
- package/dist/types/boundary-debugger/index.d.ts +0 -28
- package/dist/types/core/context/extensions.d.ts +0 -35
- package/dist/types/core/context/helmetContext.d.ts +0 -10
- package/dist/types/core/server/federatedCss.d.ts +0 -5
- package/dist/types/core/server/scriptOrder.d.ts +0 -25
- package/dist/types/module-federation/consume-surface.d.ts +0 -104
- package/dist/types/module-federation/distributed-ssr.d.ts +0 -61
- package/dist/types/module-federation/index.d.ts +0 -71
- package/dist/types/module-federation/last-known-good.d.ts +0 -52
- package/dist/types/module-federation/manifest-recovery-runtime-plugin.d.ts +0 -25
- package/dist/types/module-federation/surface-resolution-types.d.ts +0 -23
- package/dist/types/router/runtime/lifecycle.d.ts +0 -27
- package/dist/types/router/runtime/provider.d.ts +0 -78
- /package/dist/esm/{rslib-runtime.mjs → rslib-runtime~1.mjs} +0 -0
- /package/dist/esm-node/{rslib-runtime.mjs → rslib-runtime~0.mjs} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RuntimePlugin as BaseRuntimePlugin, RuntimePluginExtends } from '@modern-js/plugin';
|
|
2
2
|
import type { Hooks } from '@modern-js/plugin/runtime';
|
|
3
|
-
import type { RuntimeConfig as BaseRuntimeConfig } from '../../common';
|
|
4
|
-
import type { TInternalRuntimeContext } from '../context/runtime';
|
|
3
|
+
import type { RuntimeConfig as BaseRuntimeConfig } from '../../common.js';
|
|
4
|
+
import type { TInternalRuntimeContext } from '../context/runtime.js';
|
|
5
5
|
export type RuntimeHooks = Hooks<RuntimeConfig, TInternalRuntimeContext>;
|
|
6
6
|
export type RuntimeExtends = Required<RuntimePluginExtends<RuntimeConfig, TInternalRuntimeContext, {}, {}>>;
|
|
7
7
|
export type RuntimePlugin<Extends extends RuntimePluginExtends = {}> = BaseRuntimePlugin<RuntimeExtends & Extends>;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import type { ResolveComponentFn } from '@modern-js/plugin/runtime';
|
|
1
2
|
import type React from 'react';
|
|
2
|
-
import { type TRuntimeContext } from '../context';
|
|
3
|
+
import { type TRuntimeContext } from '../context/index.js';
|
|
4
|
+
export declare function wrapRuntimeComponentResolver(root: React.ReactNode, hooks?: {
|
|
5
|
+
resolveComponent?: {
|
|
6
|
+
call: ResolveComponentFn;
|
|
7
|
+
};
|
|
8
|
+
} | undefined): React.ReactElement;
|
|
3
9
|
export declare function wrapRuntimeContextProvider(App: React.ReactElement, contextValue: TRuntimeContext): React.JSX.Element;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function helmetReplace(content: string, helmetData: HelmetServerState): string;
|
|
1
|
+
import type { SSRHeadData, SSRRenderLifecycle } from '@modern-js/plugin/runtime';
|
|
2
|
+
export declare function getHelmetData(providers: readonly SSRRenderLifecycle[]): SSRHeadData | undefined;
|
|
3
|
+
export declare function createReplaceHelemt(helmetData?: SSRHeadData): (template: string) => string;
|
|
4
|
+
export declare function helmetReplace(content: string, helmetData: SSRHeadData): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RuntimePlugin } from '../plugin';
|
|
2
|
-
export { NoSSR, NoSSRCache } from './react';
|
|
1
|
+
import type { RuntimePlugin } from '../plugin/index.js';
|
|
2
|
+
export { NoSSR, NoSSRCache } from './react/index.js';
|
|
3
3
|
export declare const ssr: (_config: any) => RuntimePlugin;
|
|
4
4
|
export default ssr;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { NoSSRCache } from './no-ssr-cache';
|
|
2
|
-
export { NoSSR } from './nossr';
|
|
1
|
+
export { NoSSRCache } from './no-ssr-cache/index.js';
|
|
2
|
+
export { NoSSR } from './nossr/index.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { RequestHandler, RequestHandlerOptions } from '@modern-js/
|
|
1
|
+
import type { RequestHandler, RequestHandlerOptions } from '@modern-js/server-core';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { type TInternalRuntimeContext } from '../context';
|
|
4
|
-
export type { RequestHandlerConfig as HandleRequestConfig } from '@modern-js/
|
|
3
|
+
import { type TInternalRuntimeContext } from '../context/index.js';
|
|
4
|
+
export type { RequestHandlerConfig as HandleRequestConfig } from '@modern-js/server-core';
|
|
5
5
|
export type HandleRequestOptions = Exclude<RequestHandlerOptions, 'staticGenerate'> & {
|
|
6
6
|
runtimeContext: TInternalRuntimeContext;
|
|
7
7
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { OnError } from '@modern-js/
|
|
2
|
-
import type { TInternalRuntimeContext } from '../context';
|
|
3
|
-
import type { RouterCleanup } from './routerCleanup';
|
|
1
|
+
import type { OnError } from '@modern-js/types';
|
|
2
|
+
import type { TInternalRuntimeContext } from '../context/index.js';
|
|
3
|
+
import type { RouterCleanup } from './routerCleanup.js';
|
|
4
4
|
export type ResponseProxy = {
|
|
5
5
|
headers: Record<string, string>;
|
|
6
6
|
status: number;
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* failures are reported through the request's `onError` instead of being
|
|
10
10
|
* swallowed.
|
|
11
11
|
*/
|
|
12
|
-
import type { OnError } from '@modern-js/
|
|
13
|
-
import type { TInternalRuntimeContext } from '../context';
|
|
12
|
+
import type { OnError } from '@modern-js/types';
|
|
13
|
+
import type { TInternalRuntimeContext } from '../context/index.js';
|
|
14
14
|
export declare const ROUTER_CLEANUP_ERROR = "An error occurs during router runtime cleanup";
|
|
15
15
|
export type RouterCleanup = {
|
|
16
16
|
/** True once the cleanup has been tied to a streamed response body. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { type CreateRequestHandler, createRequestHandler, type HandleRequest, type HandleRequestConfig, type HandleRequestOptions, } from './requestHandler';
|
|
2
|
-
export type { RenderOptions, RenderStreaming, RenderString } from './shared';
|
|
3
|
-
export { renderStreaming } from './stream';
|
|
4
|
-
export { renderString } from './string';
|
|
1
|
+
export { type CreateRequestHandler, createRequestHandler, type HandleRequest, type HandleRequestConfig, type HandleRequestOptions, } from './requestHandler.js';
|
|
2
|
+
export type { RenderOptions, RenderStreaming, RenderString } from './shared.js';
|
|
3
|
+
export { renderStreaming } from './stream/index.js';
|
|
4
|
+
export { renderString } from './string/index.js';
|
|
@@ -1,8 +1,31 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { SSRAssetGroup, SSRAssetTransformInfo, SSRRenderAsset, SSRRenderLifecycle, SSRRenderTerminal, SSRRouterData, SSRTemplateChunk, StreamSSRExtender } from '@modern-js/plugin/runtime';
|
|
2
|
+
import type { ServerUserConfig } from '@modern-js/server-core';
|
|
3
|
+
import type { HandleRequestOptions } from './requestHandler.js';
|
|
3
4
|
export type RenderOptions = HandleRequestOptions;
|
|
4
5
|
export type SSRConfig = NonNullable<ServerUserConfig['ssr']>;
|
|
5
6
|
export type RenderStreaming = (request: Request, serverRoot: React.ReactElement, optinos: RenderOptions) => Promise<ReadableStream>;
|
|
6
7
|
export type RenderString = (request: Request, serverRoot: React.ReactElement, optinos: RenderOptions) => Promise<string>;
|
|
7
8
|
export type BuildHtmlCb = (template: string) => string | Promise<string>;
|
|
8
9
|
export declare function buildHtml(template: string, callbacks: BuildHtmlCb[]): Promise<string>;
|
|
10
|
+
export declare function createSSRRenderLifecycle(observers: SSRRenderLifecycle[]): {
|
|
11
|
+
transformAssets<T extends SSRRenderAsset>(groups: readonly SSRAssetGroup<T>[], info: Omit<SSRAssetTransformInfo<T>, 'groups'>): readonly T[];
|
|
12
|
+
transformTemplateChunk(chunk: SSRTemplateChunk): SSRTemplateChunk;
|
|
13
|
+
getRouterData(): SSRRouterData | undefined;
|
|
14
|
+
readonly terminal: SSRRenderTerminal | undefined;
|
|
15
|
+
beforeReact(): void;
|
|
16
|
+
completedBody(html: string, phase: 'complete' | 'shell'): string;
|
|
17
|
+
finish(result: SSRRenderTerminal): void;
|
|
18
|
+
};
|
|
19
|
+
export declare function replaceSSRTemplateChunk(chunk: SSRTemplateChunk, lifecycle?: ReturnType<typeof createSSRRenderLifecycle>, options?: {
|
|
20
|
+
preserveEmpty?: boolean;
|
|
21
|
+
}): string;
|
|
22
|
+
export declare function orderSSRStreamTransforms(extenders: StreamSSRExtender[]): StreamSSRExtender[];
|
|
23
|
+
export declare function createSSRStreamErrorReporter(onError: (error: unknown) => void): (error: unknown) => void;
|
|
24
|
+
/** Observe the delivered body, rather than declaring completion at allReady. */
|
|
25
|
+
export declare function observeSSRStream(source: ReadableStream<Uint8Array>, options: {
|
|
26
|
+
lifecycle: ReturnType<typeof createSSRRenderLifecycle>;
|
|
27
|
+
onError: (error: unknown) => void | Promise<void>;
|
|
28
|
+
signal: AbortSignal;
|
|
29
|
+
onCancel?: (reason: unknown) => void | Promise<void>;
|
|
30
|
+
onComplete?: () => void | Promise<void>;
|
|
31
|
+
}): ReadableStream<Uint8Array>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type RenderLevel } from '../../constants';
|
|
2
|
-
import type { TInternalRuntimeContext } from '../../context';
|
|
3
|
-
import type { HandleRequestConfig } from '../requestHandler';
|
|
4
|
-
import { type SSRConfig } from '../shared';
|
|
1
|
+
import { type RenderLevel } from '../../constants.js';
|
|
2
|
+
import type { TInternalRuntimeContext } from '../../context/index.js';
|
|
3
|
+
import type { HandleRequestConfig } from '../requestHandler.js';
|
|
4
|
+
import { type createSSRRenderLifecycle, type SSRConfig } from '../shared.js';
|
|
5
5
|
export type BuildShellAfterTemplateOptions = {
|
|
6
6
|
runtimeContext: TInternalRuntimeContext;
|
|
7
7
|
renderLevel: RenderLevel;
|
|
@@ -9,5 +9,6 @@ export type BuildShellAfterTemplateOptions = {
|
|
|
9
9
|
request: Request;
|
|
10
10
|
entryName: string;
|
|
11
11
|
config: HandleRequestConfig;
|
|
12
|
+
lifecycle?: ReturnType<typeof createSSRRenderLifecycle>;
|
|
12
13
|
};
|
|
13
14
|
export declare function buildShellAfterTemplate(afterAppTemplate: string, options: BuildShellAfterTemplateOptions): Promise<string>;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { SSRHeadData } from '@modern-js/plugin/runtime';
|
|
2
|
+
import type { TInternalRuntimeContext } from '../../context/index.js';
|
|
3
|
+
import type { HandleRequestConfig } from '../requestHandler.js';
|
|
4
|
+
import { type createSSRRenderLifecycle } from '../shared.js';
|
|
3
5
|
export interface BuildShellBeforeTemplateOptions {
|
|
4
6
|
runtimeContext: TInternalRuntimeContext;
|
|
5
7
|
entryName: string;
|
|
6
8
|
config: HandleRequestConfig;
|
|
7
9
|
styledComponentsStyleTags?: string;
|
|
8
|
-
|
|
10
|
+
lifecycle?: ReturnType<typeof createSSRRenderLifecycle>;
|
|
11
|
+
helmetData?: SSRHeadData;
|
|
9
12
|
}
|
|
10
13
|
export declare function buildShellBeforeTemplate(beforeAppTemplate: string, options: BuildShellBeforeTemplateOptions): Promise<string>;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { SSRHeadData } from '@modern-js/plugin/runtime';
|
|
2
|
+
import type { TInternalRuntimeContext } from '../../context/index.js';
|
|
3
|
+
import type { HandleRequestConfig } from '../requestHandler.js';
|
|
4
|
+
import { type createSSRRenderLifecycle } from '../shared.js';
|
|
3
5
|
export interface BuildShellBeforeTemplateOptions {
|
|
4
6
|
runtimeContext: TInternalRuntimeContext;
|
|
5
7
|
entryName: string;
|
|
6
8
|
config: HandleRequestConfig;
|
|
7
9
|
styledComponentsStyleTags?: string;
|
|
8
|
-
|
|
10
|
+
lifecycle?: ReturnType<typeof createSSRRenderLifecycle>;
|
|
11
|
+
helmetData?: SSRHeadData;
|
|
9
12
|
}
|
|
10
13
|
export declare function buildShellBeforeTemplate(beforeAppTemplate: string, options: BuildShellBeforeTemplateOptions): Promise<string>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type CreateReadableStreamFromElement } from './shared';
|
|
1
|
+
import { type CreateReadableStreamFromElement } from './shared.js';
|
|
2
2
|
export declare const createReadableStreamFromElement: CreateReadableStreamFromElement;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type CreateReadableStreamFromElement } from './shared';
|
|
1
|
+
import { type CreateReadableStreamFromElement } from './shared.js';
|
|
2
2
|
export declare const createReadableStreamFromElement: CreateReadableStreamFromElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const renderStreaming: import("../shared").RenderStreaming;
|
|
1
|
+
export declare const renderStreaming: import("../shared.js").RenderStreaming;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { OnError } from '@modern-js/
|
|
1
|
+
import type { OnError } from '@modern-js/types';
|
|
2
2
|
import type { ClientManifest as RscClientManifest, ServerManifest as RscServerManifest, SSRManifest as RscSSRManifest } from '@modern-js/types/server';
|
|
3
3
|
import type React from 'react';
|
|
4
|
-
import type { TInternalRuntimeContext } from '../../context';
|
|
5
|
-
import type { HandleRequestConfig } from '../requestHandler';
|
|
6
|
-
import type { RenderStreaming, SSRConfig } from '../shared';
|
|
4
|
+
import type { TInternalRuntimeContext } from '../../context/index.js';
|
|
5
|
+
import type { HandleRequestConfig } from '../requestHandler.js';
|
|
6
|
+
import type { RenderStreaming, SSRConfig } from '../shared.js';
|
|
7
7
|
export type RscManifest = {
|
|
8
8
|
clientManifest?: RscClientManifest;
|
|
9
9
|
serverConsumerModuleMap?: unknown;
|
|
@@ -16,7 +16,7 @@ export type CreateReadableStreamFromElementOptions = {
|
|
|
16
16
|
ssrConfig: SSRConfig;
|
|
17
17
|
htmlTemplate: string;
|
|
18
18
|
entryName: string;
|
|
19
|
-
|
|
19
|
+
resource?: object;
|
|
20
20
|
rscClientManifest?: RscClientManifest;
|
|
21
21
|
rscSSRManifest?: RscSSRManifest;
|
|
22
22
|
rscServerManifest?: RscServerManifest;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type BuildShellAfterTemplateOptions } from './afterTemplate';
|
|
2
|
-
import { type BuildShellBeforeTemplateOptions } from './beforeTemplate';
|
|
1
|
+
import { type BuildShellAfterTemplateOptions } from './afterTemplate.js';
|
|
2
|
+
import { type BuildShellBeforeTemplateOptions } from './beforeTemplate.js';
|
|
3
3
|
export type InjectTemplate = {
|
|
4
4
|
shellBefore: string;
|
|
5
5
|
shellAfter: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type RenderString } from '../shared';
|
|
1
|
+
import { type RenderString } from '../shared.js';
|
|
2
2
|
export declare const renderString: RenderString;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
import type { ChunkSet, Collector } from './types';
|
|
2
|
+
import type { createSSRRenderLifecycle } from '../shared.js';
|
|
3
|
+
import type { ChunkSet, Collector } from './types.js';
|
|
4
4
|
declare module '@loadable/server' {
|
|
5
5
|
interface ChunkExtractor {
|
|
6
6
|
chunks: string[];
|
|
@@ -11,10 +11,9 @@ export interface LoadableCollectorOptions {
|
|
|
11
11
|
nonce?: string;
|
|
12
12
|
stats?: Record<string, any>;
|
|
13
13
|
routeManifest?: Record<string, any>;
|
|
14
|
-
runtimeContext: TInternalRuntimeContext;
|
|
15
14
|
template: string;
|
|
16
15
|
entryName: string;
|
|
17
|
-
|
|
16
|
+
lifecycle?: ReturnType<typeof createSSRRenderLifecycle>;
|
|
18
17
|
chunkSet: ChunkSet;
|
|
19
18
|
config: LoadableCollectorConfig;
|
|
20
19
|
}
|
|
@@ -28,6 +27,10 @@ export interface LoadableCollectorConfig {
|
|
|
28
27
|
export declare class LoadableCollector implements Collector {
|
|
29
28
|
private options;
|
|
30
29
|
private extractor?;
|
|
30
|
+
readonly stylesheetInfo: {
|
|
31
|
+
emittedAssets: string[];
|
|
32
|
+
attributes: Record<string, unknown>;
|
|
33
|
+
};
|
|
31
34
|
constructor(options: LoadableCollectorOptions);
|
|
32
35
|
private get existsAssets();
|
|
33
36
|
collect(comopnent: ReactElement): ReactElement;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { StaticHandlerContext } from '@modern-js/runtime-utils/router';
|
|
2
|
-
import type { TInternalRuntimeContext } from '../../context';
|
|
3
|
-
import type { SSRServerContext } from '../../types';
|
|
4
|
-
import type { SSRConfig } from '../shared';
|
|
5
|
-
import type { ChunkSet, Collector } from './types';
|
|
2
|
+
import type { TInternalRuntimeContext } from '../../context/index.js';
|
|
3
|
+
import type { SSRServerContext } from '../../types.js';
|
|
4
|
+
import type { createSSRRenderLifecycle, SSRConfig } from '../shared.js';
|
|
5
|
+
import type { ChunkSet, Collector } from './types.js';
|
|
6
6
|
export interface SSRDataCreatorOptions {
|
|
7
7
|
runtimeContext: TInternalRuntimeContext;
|
|
8
8
|
request: Request;
|
|
@@ -10,6 +10,7 @@ export interface SSRDataCreatorOptions {
|
|
|
10
10
|
ssrContext: SSRServerContext;
|
|
11
11
|
ssrConfig?: SSRConfig;
|
|
12
12
|
routerContext?: StaticHandlerContext;
|
|
13
|
+
lifecycle?: ReturnType<typeof createSSRRenderLifecycle>;
|
|
13
14
|
nonce?: string;
|
|
14
15
|
useJsonScript?: boolean;
|
|
15
16
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
export interface Collector {
|
|
4
|
-
collect?: (comopnent: ReactElement) => ReactElement;
|
|
5
|
-
effect: () => void | Promise<void>;
|
|
6
|
-
}
|
|
1
|
+
import type { RenderLevel } from '../../constants.js';
|
|
2
|
+
export type { Collector } from '@modern-js/plugin/runtime';
|
|
7
3
|
export type ChunkSet = {
|
|
8
4
|
renderLevel: RenderLevel;
|
|
9
5
|
ssrScripts: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ServerUserConfig } from '@modern-js/app-tools';
|
|
2
1
|
import type { StaticHandlerContext } from '@modern-js/runtime-utils/router';
|
|
3
|
-
import type {
|
|
2
|
+
import type { ServerUserConfig } from '@modern-js/server-core';
|
|
3
|
+
import type { SSRConfig } from './shared.js';
|
|
4
4
|
export declare function attributesToString(attributes: Record<string, any>): string;
|
|
5
5
|
/**
|
|
6
6
|
* @param source
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { OnError, OnTiming } from '@modern-js/
|
|
2
|
-
import type {
|
|
3
|
-
import type { RenderLevel } from './constants';
|
|
1
|
+
import type { BaseSSRServerContext, OnError, OnTiming } from '@modern-js/types';
|
|
2
|
+
import type { RenderLevel } from './constants.js';
|
|
4
3
|
declare global {
|
|
5
4
|
interface Window {
|
|
6
5
|
_SSR_DATA?: SSRContainer;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export * from './Body';
|
|
2
|
-
export * from './Comment';
|
|
3
|
-
export * from './constants';
|
|
4
|
-
export * from './DocumentContext';
|
|
5
|
-
export * from './DocumentStructureContext';
|
|
6
|
-
export * from './Head';
|
|
7
|
-
export * from './Html';
|
|
8
|
-
export * from './Links';
|
|
9
|
-
export * from './Root';
|
|
10
|
-
export * from './Script';
|
|
11
|
-
export * from './Scripts';
|
|
12
|
-
export * from './Style';
|
|
1
|
+
export * from './Body.js';
|
|
2
|
+
export * from './Comment.js';
|
|
3
|
+
export * from './constants.js';
|
|
4
|
+
export * from './DocumentContext.js';
|
|
5
|
+
export * from './DocumentStructureContext.js';
|
|
6
|
+
export * from './Head.js';
|
|
7
|
+
export * from './Html.js';
|
|
8
|
+
export * from './Links.js';
|
|
9
|
+
export * from './Root.js';
|
|
10
|
+
export * from './Script.js';
|
|
11
|
+
export * from './Scripts.js';
|
|
12
|
+
export * from './Style.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type definitions for config-based routing
|
|
3
3
|
*/
|
|
4
|
-
import type { DefineRoutesFunction, LayoutFunction, PageFunction, RouteConfig, RouteFunction, RouteFunctions, WildcardFunction } from '../router/cli/config-routes/parseRouteConfig';
|
|
4
|
+
import type { DefineRoutesFunction, LayoutFunction, PageFunction, RouteConfig, RouteFunction, RouteFunctions, WildcardFunction } from '../router/cli/config-routes/parseRouteConfig.js';
|
|
5
5
|
export type { DefineRoutesFunction, LayoutFunction, PageFunction, RouteConfig, RouteFunction, RouteFunctions, WildcardFunction, };
|
|
6
6
|
/**
|
|
7
7
|
* defineRoutes - main function to define route configurations
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export declare const Helmet: (props: React.PropsWithChildren<HelmetProps>) => React.
|
|
2
|
+
import { HelmetData as AsyncHelmetData, type HelmetDatum, type HelmetHTMLBodyDatum, type HelmetHTMLElementDatum, type HelmetProps, HelmetProvider, type HelmetServerState, type HelmetTags } from 'react-helmet-async';
|
|
3
|
+
export declare const Helmet: (props: React.PropsWithChildren<HelmetProps>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
4
4
|
declare const head: {
|
|
5
5
|
Helmet: typeof Helmet;
|
|
6
6
|
HelmetData: typeof AsyncHelmetData;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { RouterConfig } from './router/runtime/types';
|
|
2
|
-
export type { RuntimeConfig, RuntimePlugin } from './common';
|
|
3
|
-
export { isBrowser } from './common';
|
|
4
|
-
export { defineRuntimeConfig } from './core/config';
|
|
5
|
-
export { getMonitors } from './core/context/monitors';
|
|
6
|
-
export type { TRuntimeContext } from './core/context/public';
|
|
7
|
-
export { RuntimeContext, useRuntimeContext, } from './core/context/public';
|
|
8
|
-
export { getRequest } from './core/context/request';
|
|
9
|
-
export { redirect, setHeaders, setStatus } from './core/context/response';
|
|
1
|
+
import type { RouterConfig } from './router/runtime/types.js';
|
|
2
|
+
export type { RuntimeConfig, RuntimePlugin } from './common.js';
|
|
3
|
+
export { isBrowser } from './common.js';
|
|
4
|
+
export { defineRuntimeConfig } from './core/config.js';
|
|
5
|
+
export { getMonitors } from './core/context/monitors/index.js';
|
|
6
|
+
export type { TRuntimeContext } from './core/context/public.js';
|
|
7
|
+
export { RuntimeContext, useRuntimeContext, } from './core/context/public.js';
|
|
8
|
+
export { getRequest } from './core/context/request/index.js';
|
|
9
|
+
export { redirect, setHeaders, setStatus } from './core/context/response/index.js';
|
|
10
10
|
export type { RouterConfig };
|
package/dist/types/internal.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { InternalRuntimeContext, type TInternalRuntimeContext, } from './core/context/runtime';
|
|
1
|
+
export { InternalRuntimeContext, type TInternalRuntimeContext, } from './core/context/runtime.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { getMonitors } from './core/context/monitors';
|
|
2
|
-
export { getRequest } from './core/context/request';
|
|
3
|
-
export { redirect, setHeaders, setStatus } from './core/context/response';
|
|
1
|
+
export { getMonitors } from './core/context/monitors/index.js';
|
|
2
|
+
export { getRequest } from './core/context/request/index.js';
|
|
3
|
+
export { redirect, setHeaders, setStatus } from './core/context/response/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { getClientRoutes } from './getRoutes';
|
|
1
|
+
export { getClientRoutes } from './getRoutes.js';
|
|
@@ -23,7 +23,7 @@ type HandleFileChangeOptions = {
|
|
|
23
23
|
type HandleModifyEntrypointsOptions = {
|
|
24
24
|
routesOwner?: string;
|
|
25
25
|
};
|
|
26
|
-
export declare function handleModifyEntrypoints(entrypoints: Entrypoint[], routesDir?: string, options?: HandleModifyEntrypointsOptions): Promise<import("./entry").EntrypointWithRoutesMeta[]>;
|
|
26
|
+
export declare function handleModifyEntrypoints(entrypoints: Entrypoint[], routesDir?: string, options?: HandleModifyEntrypointsOptions): Promise<import("./entry.js").EntrypointWithRoutesMeta[]>;
|
|
27
27
|
export declare function handleGeneratorEntryCode(api: CLIPluginAPI<AppTools>, entrypoints: Entrypoint[], options?: HandleGeneratorEntryCodeOptions | string): Promise<GeneratedRoutesByEntry>;
|
|
28
28
|
export declare function handleFileChange(api: CLIPluginAPI<AppTools>, e: any, options?: HandleFileChangeOptions): Promise<void>;
|
|
29
29
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AppTools, CliPlugin } from '@modern-js/app-tools';
|
|
2
|
-
export { BUILT_IN_ROUTES_OWNER, getEntrypointRoutesDir, getEntrypointRoutesOwner, isRouteEntry, } from './entry';
|
|
3
|
-
export { handleFileChange, handleGeneratorEntryCode, handleModifyEntrypoints, } from './handler';
|
|
4
|
-
export { updateNestedRoutesSpec } from './nestedRoutesSpec';
|
|
2
|
+
export { BUILT_IN_ROUTES_OWNER, getEntrypointRoutesDir, getEntrypointRoutesOwner, isRouteEntry, } from './entry.js';
|
|
3
|
+
export { handleFileChange, handleGeneratorEntryCode, handleModifyEntrypoints, } from './handler.js';
|
|
4
|
+
export { updateNestedRoutesSpec } from './nestedRoutesSpec.js';
|
|
5
5
|
export declare const routerPlugin: () => CliPlugin<AppTools>;
|
|
6
6
|
export default routerPlugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './runtime';
|
|
1
|
+
export * from './runtime/index.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './runtime/internal';
|
|
2
|
-
export { routerPlugin as default } from './runtime/internal';
|
|
1
|
+
export * from './runtime/internal.js';
|
|
2
|
+
export { routerPlugin as default } from './runtime/internal.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type LinkProps as RouterLinkProps, type NavLinkProps as RouterNavLinkProps } from '@modern-js/runtime-utils/router';
|
|
1
|
+
import { type RouteObject, type LinkProps as RouterLinkProps, type NavLinkProps as RouterNavLinkProps } from '@modern-js/runtime-utils/router';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
/**
|
|
4
4
|
* Modified from https://github.com/remix-run/remix/blob/9a0601bd704d2f3ee622e0ddacab9b611eb0c5bc/packages/remix-react/components.tsx#L218
|
|
@@ -16,7 +16,7 @@ import React from 'react';
|
|
|
16
16
|
* - "viewport": Fetched when the link enters the viewport
|
|
17
17
|
* - "none": Never fetched
|
|
18
18
|
*/
|
|
19
|
-
type PrefetchBehavior = '
|
|
19
|
+
type PrefetchBehavior = NonNullable<RouterLinkProps['prefetch']>;
|
|
20
20
|
type PreloadBehavior = PrefetchBehavior | false;
|
|
21
21
|
export interface LinkProps extends RouterLinkProps {
|
|
22
22
|
prefetch?: PrefetchBehavior;
|
|
@@ -26,6 +26,31 @@ export interface NavLinkProps extends RouterNavLinkProps {
|
|
|
26
26
|
prefetch?: PrefetchBehavior;
|
|
27
27
|
preload?: PreloadBehavior;
|
|
28
28
|
}
|
|
29
|
+
/** Optional scheduling capability supplied by a runtime integration. */
|
|
30
|
+
export interface LinkPrefetchPolicy {
|
|
31
|
+
observe(options: {
|
|
32
|
+
element: HTMLAnchorElement | null;
|
|
33
|
+
prefetch?: PrefetchBehavior;
|
|
34
|
+
preload?: PreloadBehavior;
|
|
35
|
+
notify: (state: {
|
|
36
|
+
code: boolean;
|
|
37
|
+
data: boolean;
|
|
38
|
+
}) => void;
|
|
39
|
+
}): {
|
|
40
|
+
onIntent: () => void;
|
|
41
|
+
onCancel: () => void;
|
|
42
|
+
dispose: () => void;
|
|
43
|
+
};
|
|
44
|
+
schedule(options: {
|
|
45
|
+
runtimeContext: object;
|
|
46
|
+
chunkLoader: object;
|
|
47
|
+
publicPath: string;
|
|
48
|
+
key: string;
|
|
49
|
+
run: () => Promise<unknown>;
|
|
50
|
+
}): () => void;
|
|
51
|
+
canWarmup: () => boolean;
|
|
52
|
+
allowData: (route: RouteObject) => boolean;
|
|
53
|
+
}
|
|
29
54
|
declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
30
55
|
declare const NavLink: React.ForwardRefExoticComponent<NavLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
31
56
|
export { Link, NavLink };
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import type { RouteObject } from '@modern-js/runtime-utils/router';
|
|
2
|
-
import type { TRuntimeContext } from '../../core/context/runtime';
|
|
3
|
-
|
|
2
|
+
import type { TInternalRuntimeContext, TRuntimeContext } from '../../core/context/runtime.js';
|
|
3
|
+
export type RouterLifecycleContext = {
|
|
4
|
+
framework: string;
|
|
5
|
+
phase: 'ssr-prepare' | 'client-create' | 'hydrate';
|
|
6
|
+
routes: RouteObject[];
|
|
7
|
+
runtimeContext: TInternalRuntimeContext;
|
|
8
|
+
basename?: string;
|
|
9
|
+
hydrationData?: unknown;
|
|
10
|
+
router?: unknown;
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
};
|
|
4
13
|
export type RouterSyncHook<Handler extends (...args: any[]) => any> = {
|
|
5
14
|
call: (...args: Parameters<Handler>) => ReturnType<Handler>;
|
|
6
15
|
[key: string]: unknown;
|
|
@@ -12,6 +21,14 @@ declare const onAfterCreateRouter: RouterSyncHook<(context: RouterLifecycleConte
|
|
|
12
21
|
declare const onBeforeHydrateRouter: RouterSyncHook<(context: RouterLifecycleContext) => void>;
|
|
13
22
|
declare const onAfterHydrateRouter: RouterSyncHook<(context: RouterLifecycleContext) => void>;
|
|
14
23
|
export { modifyRoutes, onAfterCreateRouter, onAfterHydrateRouter, onBeforeCreateRouter, onBeforeCreateRoutes, onBeforeHydrateRouter, };
|
|
24
|
+
export declare const routerProviderRegistryHooks: {
|
|
25
|
+
modifyRoutes: RouterSyncHook<(routes: RouteObject[]) => RouteObject[]>;
|
|
26
|
+
onBeforeCreateRoutes: RouterSyncHook<(context: TRuntimeContext) => void>;
|
|
27
|
+
onBeforeCreateRouter: RouterSyncHook<(context: RouterLifecycleContext) => void>;
|
|
28
|
+
onAfterCreateRouter: RouterSyncHook<(context: RouterLifecycleContext) => void>;
|
|
29
|
+
onBeforeHydrateRouter: RouterSyncHook<(context: RouterLifecycleContext) => void>;
|
|
30
|
+
onAfterHydrateRouter: RouterSyncHook<(context: RouterLifecycleContext) => void>;
|
|
31
|
+
};
|
|
15
32
|
export type RouterExtendsHooks = {
|
|
16
33
|
modifyRoutes: typeof modifyRoutes;
|
|
17
34
|
onBeforeCreateRoutes: typeof onBeforeCreateRoutes;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useRouteLoaderData as useRouteData } from '@modern-js/runtime-utils/router';
|
|
2
2
|
export * from '@modern-js/runtime-utils/router';
|
|
3
|
-
export type { LinkProps, NavLinkProps } from './PrefetchLink';
|
|
4
|
-
export { Link, NavLink } from './PrefetchLink';
|
|
3
|
+
export type { LinkProps, NavLinkProps } from './PrefetchLink.js';
|
|
4
|
+
export { Link, NavLink } from './PrefetchLink.js';
|
|
5
5
|
export declare const useRouteLoaderData: typeof useRouteData;
|
|
6
|
-
export type { LoaderFunction, LoaderFunctionArgs } from './types';
|
|
7
|
-
export * from './withRouter';
|
|
6
|
+
export type { LoaderFunction, LoaderFunctionArgs } from './types.js';
|
|
7
|
+
export * from './withRouter.js';
|
|
@@ -1,22 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export type RouterPluginFactory = (userConfig?: Partial<RouterConfig>) => RuntimePlugin<{
|
|
7
|
-
extendHooks: RouterExtendsHooks;
|
|
8
|
-
}>;
|
|
9
|
-
/**
|
|
10
|
-
* Create one router wrapper and its provider realm for a runtime entry. Optional
|
|
11
|
-
* providers are supplied by the entry-owning integration (for example the
|
|
12
|
-
* TanStack runtime/router module), so independently bundled apps never resolve
|
|
13
|
-
* factories from another app's module graph.
|
|
14
|
-
*/
|
|
15
|
-
export declare const createRouterPlugin: (localProviders?: readonly LocalRouterProvider[]) => RouterPluginFactory;
|
|
16
|
-
export declare const routerPlugin: RouterPluginFactory;
|
|
17
|
-
export default routerPlugin;
|
|
18
|
-
export type { RouterExtendsHooks } from './hooks';
|
|
19
|
-
export { modifyRoutes } from './plugin';
|
|
20
|
-
export { createRouterProviderRealm, type RouterProviderFactory, type RouterProviderPlugin, type RouterProviderRealm, type RouterProviderRegistration, registerRouterProvider, resolveRouterProvider, } from './provider';
|
|
21
|
-
export { renderRoutes } from './utils';
|
|
22
|
-
export type { RouterConfig, SingleRouteConfig };
|
|
1
|
+
export { type RouterExtendsHooks, type RouterLifecycleContext, routerProviderRegistryHooks, } from './hooks.js';
|
|
2
|
+
export type { LinkPrefetchPolicy } from './PrefetchLink.js';
|
|
3
|
+
export { modifyRoutes, routerPlugin, routerPlugin as default } from './plugin.js';
|
|
4
|
+
export type { RouterConfig, SingleRouteConfig } from './types.js';
|
|
5
|
+
export { renderRoutes } from './utils.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { RuntimePlugin } from '../../common';
|
|
2
|
-
import type { RouterExtendsHooks } from './hooks';
|
|
3
|
-
import type { RouterConfig, Routes } from './types';
|
|
1
|
+
import type { RuntimePlugin } from '../../common.js';
|
|
2
|
+
import type { RouterExtendsHooks } from './hooks.js';
|
|
3
|
+
import type { RouterConfig, Routes } from './types.js';
|
|
4
4
|
export declare let finalRouteConfig: RouterConfig['routesConfig'];
|
|
5
5
|
export declare let beforeCreateRouter: boolean;
|
|
6
6
|
export declare function modifyRoutes(modifyFunction: (routes: Routes) => Routes): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { RuntimePlugin } from '../../common';
|
|
2
|
-
import type { RouterExtendsHooks } from './hooks';
|
|
3
|
-
import type { RouterConfig } from './types';
|
|
1
|
+
import type { RuntimePlugin } from '../../common.js';
|
|
2
|
+
import type { RouterExtendsHooks } from './hooks.js';
|
|
3
|
+
import type { RouterConfig } from './types.js';
|
|
4
4
|
export declare const routerPlugin: (userConfig?: Partial<RouterConfig>) => RuntimePlugin<{
|
|
5
5
|
extendHooks: RouterExtendsHooks;
|
|
6
6
|
}>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type RouteObject, type StaticHandlerContext } from '@modern-js/runtime-utils/router';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type { ServerPayload } from '../../core/context';
|
|
4
|
-
import type { RouteManifest } from './types';
|
|
5
|
-
export { handleRSCRedirect } from './redirect';
|
|
3
|
+
import type { ServerPayload } from '../../core/context/index.js';
|
|
4
|
+
import type { RouteManifest } from './types.js';
|
|
5
|
+
export { handleRSCRedirect } from './redirect.js';
|
|
6
6
|
declare global {
|
|
7
7
|
interface Window {
|
|
8
8
|
_MODERNJS_ROUTE_MANIFEST?: RouteManifest;
|