@bleedingdev/modern-js-runtime 3.9.0-ultramodern.4 → 3.9.0-ultramodern.5
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/ssr/index.js +2 -74
- package/dist/cjs/core/context/index.js +4 -43
- package/dist/cjs/core/context/public.js +4 -8
- package/dist/cjs/core/context/runtime.js +17 -6
- 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/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/ssr/index.mjs +3 -72
- package/dist/esm/core/context/index.mjs +2 -5
- package/dist/esm/core/context/public.mjs +1 -6
- package/dist/esm/core/context/runtime.mjs +12 -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/exports/head.mjs +7 -14
- package/dist/esm/router/runtime/PrefetchLink.mjs +67 -123
- 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/ssr/index.mjs +3 -72
- package/dist/esm-node/core/context/index.mjs +2 -5
- package/dist/esm-node/core/context/public.mjs +1 -6
- package/dist/esm-node/core/context/runtime.mjs +12 -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/exports/head.mjs +7 -14
- package/dist/esm-node/router/runtime/PrefetchLink.mjs +67 -123
- 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/ssr/index.d.ts +0 -3
- package/dist/types/core/context/index.d.ts +4 -6
- package/dist/types/core/context/public.d.ts +1 -23
- package/dist/types/core/context/runtime.d.ts +26 -2
- package/dist/types/core/react/wrapper.d.ts +6 -0
- package/dist/types/core/server/helmet.d.ts +4 -5
- package/dist/types/core/server/shared.d.ts +23 -0
- package/dist/types/core/server/stream/afterTemplate.d.ts +2 -1
- package/dist/types/core/server/stream/beforeTemplate.d.ts +4 -1
- package/dist/types/core/server/stream/beforeTemplate.worker.d.ts +4 -1
- package/dist/types/core/server/stream/shared.d.ts +1 -1
- package/dist/types/core/server/string/loadable.d.ts +6 -3
- package/dist/types/core/server/string/ssrData.d.ts +2 -1
- package/dist/types/core/server/string/types.d.ts +1 -5
- package/dist/types/exports/head.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/internal.d.ts +4 -21
- package/dist/types/router/runtime/types.d.ts +2 -43
- package/package.json +9 -38
- 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
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import type { SSRHeadData } from '@modern-js/plugin/runtime';
|
|
1
2
|
import type { TInternalRuntimeContext } from '../../context/index.js';
|
|
2
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>;
|
|
@@ -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
1
|
import type { ReactElement } from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { createSSRRenderLifecycle } from '../shared.js';
|
|
3
3
|
import type { ChunkSet, Collector } from './types.js';
|
|
4
4
|
declare module '@loadable/server' {
|
|
5
5
|
interface ChunkExtractor {
|
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
import type { StaticHandlerContext } from '@modern-js/runtime-utils/router';
|
|
2
2
|
import type { TInternalRuntimeContext } from '../../context/index.js';
|
|
3
3
|
import type { SSRServerContext } from '../../types.js';
|
|
4
|
-
import type { SSRConfig } from '../shared.js';
|
|
4
|
+
import type { createSSRRenderLifecycle, SSRConfig } from '../shared.js';
|
|
5
5
|
import type { ChunkSet, Collector } from './types.js';
|
|
6
6
|
export interface SSRDataCreatorOptions {
|
|
7
7
|
runtimeContext: TInternalRuntimeContext;
|
|
@@ -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 { ReactElement } from 'react';
|
|
2
1
|
import type { RenderLevel } from '../../constants.js';
|
|
3
|
-
export
|
|
4
|
-
collect?: (comopnent: ReactElement) => ReactElement;
|
|
5
|
-
effect: () => void | Promise<void>;
|
|
6
|
-
}
|
|
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
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;
|
|
@@ -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.js';
|
|
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,22 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type LocalRouterProvider = Omit<RouterProviderRegistration, 'isDefault'>;
|
|
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.js';
|
|
19
|
-
export { modifyRoutes } from './plugin.js';
|
|
20
|
-
export { createRouterProviderRealm, type RouterProviderFactory, type RouterProviderPlugin, type RouterProviderRealm, type RouterProviderRegistration, registerRouterProvider, resolveRouterProvider, } from './provider.js';
|
|
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';
|
|
21
5
|
export { renderRoutes } from './utils.js';
|
|
22
|
-
export type { RouterConfig, SingleRouteConfig };
|
|
@@ -20,15 +20,11 @@ export type SingleRouteConfig = RouteProps & {
|
|
|
20
20
|
*/
|
|
21
21
|
component?: React.ComponentType;
|
|
22
22
|
};
|
|
23
|
-
export type BuiltInRouterFramework = 'react-router' | 'tanstack';
|
|
24
|
-
export type RouterFramework = BuiltInRouterFramework | (string & {});
|
|
25
23
|
export type RouterConfig = {
|
|
26
24
|
/**
|
|
27
|
-
*
|
|
28
|
-
* - `react-router` (default): React Router based integration
|
|
29
|
-
* - `tanstack`: TanStack Router integration
|
|
25
|
+
* Router implementation identifier for integrations that provide selection.
|
|
30
26
|
*/
|
|
31
|
-
framework?:
|
|
27
|
+
framework?: string;
|
|
32
28
|
routesConfig: {
|
|
33
29
|
globalApp?: React.ComponentType<any>;
|
|
34
30
|
routes?: ModernRoute[];
|
|
@@ -50,46 +46,9 @@ export type RouterConfig = {
|
|
|
50
46
|
unstable_reloadOnURLMismatch?: boolean;
|
|
51
47
|
};
|
|
52
48
|
export type Routes = RouterConfig['routesConfig']['routes'];
|
|
53
|
-
export interface RouterRouteMatchSnapshot {
|
|
54
|
-
routeId: string;
|
|
55
|
-
assetRouteId?: string;
|
|
56
|
-
pathname?: string;
|
|
57
|
-
params?: Record<string, string>;
|
|
58
|
-
}
|
|
59
49
|
export interface RouteManifest {
|
|
60
50
|
routeAssets: RouteAssets;
|
|
61
51
|
}
|
|
62
|
-
export interface InternalRouterServerSnapshot {
|
|
63
|
-
framework?: RouterFramework;
|
|
64
|
-
basename?: string;
|
|
65
|
-
statusCode?: number;
|
|
66
|
-
errors?: Record<string, unknown>;
|
|
67
|
-
routerData?: {
|
|
68
|
-
loaderData?: Record<string, unknown>;
|
|
69
|
-
errors?: Record<string, unknown>;
|
|
70
|
-
};
|
|
71
|
-
hydrationScript?: string;
|
|
72
|
-
hydrationScripts?: string[];
|
|
73
|
-
matchedRouteIds?: string[];
|
|
74
|
-
matches?: RouterRouteMatchSnapshot[];
|
|
75
|
-
}
|
|
76
|
-
export interface InternalRouterRuntimeState {
|
|
77
|
-
framework: RouterFramework;
|
|
78
|
-
basename?: string;
|
|
79
|
-
instance?: unknown;
|
|
80
|
-
hydrationScript?: string;
|
|
81
|
-
hydrationScripts?: string[];
|
|
82
|
-
matchedRouteIds?: string[];
|
|
83
|
-
matches?: RouterRouteMatchSnapshot[];
|
|
84
|
-
serverSnapshot?: InternalRouterServerSnapshot;
|
|
85
|
-
cleanup?: () => void | Promise<void>;
|
|
86
|
-
}
|
|
87
|
-
export interface RouterServerPrepareResult {
|
|
88
|
-
state: InternalRouterRuntimeState;
|
|
89
|
-
snapshot?: InternalRouterServerSnapshot;
|
|
90
|
-
redirect?: Response;
|
|
91
|
-
cleanup?: () => void | Promise<void>;
|
|
92
|
-
}
|
|
93
52
|
export interface RouteAssets {
|
|
94
53
|
[routeId: string]: {
|
|
95
54
|
chunkIds?: (string | number)[];
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"modern",
|
|
18
18
|
"modern.js"
|
|
19
19
|
],
|
|
20
|
-
"version": "3.9.0-ultramodern.
|
|
20
|
+
"version": "3.9.0-ultramodern.5",
|
|
21
21
|
"engines": {
|
|
22
22
|
"node": ">=20"
|
|
23
23
|
},
|
|
@@ -69,26 +69,6 @@
|
|
|
69
69
|
"types": "./dist/types/exports/head.d.ts",
|
|
70
70
|
"default": "./dist/esm/exports/head.mjs"
|
|
71
71
|
},
|
|
72
|
-
"./boundary-debugger": {
|
|
73
|
-
"types": "./dist/types/boundary-debugger/index.d.ts",
|
|
74
|
-
"default": "./dist/esm/boundary-debugger/index.mjs"
|
|
75
|
-
},
|
|
76
|
-
"./module-federation": {
|
|
77
|
-
"types": "./dist/types/module-federation/index.d.ts",
|
|
78
|
-
"default": "./dist/esm/module-federation/index.mjs"
|
|
79
|
-
},
|
|
80
|
-
"./module-federation/distributed-ssr": {
|
|
81
|
-
"types": "./dist/types/module-federation/distributed-ssr.d.ts",
|
|
82
|
-
"default": "./dist/esm/module-federation/distributed-ssr.mjs"
|
|
83
|
-
},
|
|
84
|
-
"./module-federation/manifest-recovery-runtime-plugin": {
|
|
85
|
-
"types": "./dist/types/module-federation/manifest-recovery-runtime-plugin.d.ts",
|
|
86
|
-
"node": {
|
|
87
|
-
"import": "./dist/esm/module-federation/manifest-recovery-runtime-plugin.mjs",
|
|
88
|
-
"require": "./dist/cjs/module-federation/manifest-recovery-runtime-plugin.js"
|
|
89
|
-
},
|
|
90
|
-
"default": "./dist/esm/module-federation/manifest-recovery-runtime-plugin.mjs"
|
|
91
|
-
},
|
|
92
72
|
"./ssr": {
|
|
93
73
|
"types": "./dist/types/core/server/index.d.ts",
|
|
94
74
|
"default": "./dist/esm/core/server/index.mjs"
|
|
@@ -196,15 +176,6 @@
|
|
|
196
176
|
"head": [
|
|
197
177
|
"./dist/types/exports/head.d.ts"
|
|
198
178
|
],
|
|
199
|
-
"boundary-debugger": [
|
|
200
|
-
"./dist/types/boundary-debugger/index.d.ts"
|
|
201
|
-
],
|
|
202
|
-
"module-federation": [
|
|
203
|
-
"./dist/types/module-federation/index.d.ts"
|
|
204
|
-
],
|
|
205
|
-
"module-federation/manifest-recovery-runtime-plugin": [
|
|
206
|
-
"./dist/types/module-federation/manifest-recovery-runtime-plugin.d.ts"
|
|
207
|
-
],
|
|
208
179
|
"document": [
|
|
209
180
|
"./dist/types/document/index.d.ts"
|
|
210
181
|
],
|
|
@@ -246,13 +217,13 @@
|
|
|
246
217
|
"dependencies": {
|
|
247
218
|
"@loadable/component": "5.16.7",
|
|
248
219
|
"@loadable/server": "5.16.7",
|
|
249
|
-
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.0-ultramodern.
|
|
250
|
-
"@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.9.0-ultramodern.
|
|
251
|
-
"@modern-js/render": "npm:@bleedingdev/modern-js-render@3.9.0-ultramodern.
|
|
252
|
-
"@modern-js/runtime-extensions": "npm:@bleedingdev/modern-js-runtime-extensions@3.9.0-ultramodern.
|
|
253
|
-
"@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.9.0-ultramodern.
|
|
254
|
-
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.
|
|
255
|
-
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.
|
|
220
|
+
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.0-ultramodern.5",
|
|
221
|
+
"@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.9.0-ultramodern.5",
|
|
222
|
+
"@modern-js/render": "npm:@bleedingdev/modern-js-render@3.9.0-ultramodern.5",
|
|
223
|
+
"@modern-js/runtime-extensions": "npm:@bleedingdev/modern-js-runtime-extensions@3.9.0-ultramodern.5",
|
|
224
|
+
"@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.9.0-ultramodern.5",
|
|
225
|
+
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.5",
|
|
226
|
+
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.5",
|
|
256
227
|
"@swc/core": "1.16.2",
|
|
257
228
|
"@swc/helpers": "^0.5.23",
|
|
258
229
|
"@swc/plugin-loadable-components": "^13.0.0",
|
|
@@ -273,7 +244,7 @@
|
|
|
273
244
|
"react-dom": "^19.2.8"
|
|
274
245
|
},
|
|
275
246
|
"devDependencies": {
|
|
276
|
-
"@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.9.0-ultramodern.
|
|
247
|
+
"@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.9.0-ultramodern.5",
|
|
277
248
|
"@remix-run/web-fetch": "^4.4.2",
|
|
278
249
|
"@rsbuild/core": "2.2.3",
|
|
279
250
|
"@rslib/core": "1.0.0",
|
package/rstest.config.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
1
2
|
import type { ProjectConfig } from '@rstest/core';
|
|
2
3
|
import { withTestPreset } from '@scripts/rstest-config';
|
|
3
4
|
|
|
@@ -23,7 +24,7 @@ export default {
|
|
|
23
24
|
name: 'plugin-runtime-node',
|
|
24
25
|
testEnvironment: 'node',
|
|
25
26
|
exclude: [
|
|
26
|
-
'tests/
|
|
27
|
+
'tests/ssr/serverRender/workerLifecycle.test.tsx',
|
|
27
28
|
'tests/router/plugin.client.test.tsx',
|
|
28
29
|
'tests/router/prefetch.test.tsx',
|
|
29
30
|
'tests/router/prefetch-realm-isolation.test.tsx',
|
|
@@ -48,11 +49,40 @@ export default {
|
|
|
48
49
|
},
|
|
49
50
|
],
|
|
50
51
|
}),
|
|
52
|
+
withTestPreset({
|
|
53
|
+
name: 'plugin-runtime-worker-lifecycle',
|
|
54
|
+
testEnvironment: 'node',
|
|
55
|
+
extends: commonConfig,
|
|
56
|
+
include: ['tests/ssr/serverRender/workerLifecycle.test.tsx'],
|
|
57
|
+
resolve: {
|
|
58
|
+
alias: {
|
|
59
|
+
'@modern-js/render/ssr': path.join(
|
|
60
|
+
__dirname,
|
|
61
|
+
'../render/src/server/ssr/index.ts',
|
|
62
|
+
),
|
|
63
|
+
'react-server-dom-rspack/client.browser': path.join(
|
|
64
|
+
__dirname,
|
|
65
|
+
'tests/fixtures/rsc-client.ts',
|
|
66
|
+
),
|
|
67
|
+
'react-server-dom-rspack/client.edge': path.join(
|
|
68
|
+
__dirname,
|
|
69
|
+
'tests/fixtures/rsc-client.ts',
|
|
70
|
+
),
|
|
71
|
+
'@modern-js/render/rsc': path.join(
|
|
72
|
+
__dirname,
|
|
73
|
+
'tests/fixtures/rsc-server.ts',
|
|
74
|
+
),
|
|
75
|
+
'@modern-js/render/rsc-worker': path.join(
|
|
76
|
+
__dirname,
|
|
77
|
+
'tests/fixtures/rsc-server.ts',
|
|
78
|
+
),
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
}),
|
|
51
82
|
withTestPreset({
|
|
52
83
|
name: 'plugin-runtime-client',
|
|
53
84
|
testEnvironment: 'happy-dom',
|
|
54
85
|
include: [
|
|
55
|
-
'tests/boundary-debugger/client.test.tsx',
|
|
56
86
|
'tests/router/plugin.client.test.tsx',
|
|
57
87
|
'tests/router/prefetch.test.tsx',
|
|
58
88
|
'tests/router/prefetch-realm-isolation.test.tsx',
|