@bleedingdev/modern-js-runtime 3.2.0-ultramodern.1 → 3.2.0-ultramodern.100
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/boundary-debugger/index.js +299 -0
- package/dist/cjs/cli/ssr/index.js +5 -15
- package/dist/cjs/cli/template.server.js +1 -0
- package/dist/cjs/core/context/serverPayload/index.js +1 -1
- package/dist/cjs/core/plugin/index.js +3 -2
- package/dist/cjs/core/react/wrapper.js +9 -3
- package/dist/cjs/core/server/federatedCss.js +47 -0
- package/dist/cjs/core/server/helmet.js +8 -2
- package/dist/cjs/core/server/scriptOrder.js +59 -0
- package/dist/cjs/core/server/stream/afterTemplate.js +13 -5
- package/dist/cjs/core/server/stream/beforeTemplate.js +13 -20
- package/dist/cjs/core/server/stream/beforeTemplate.worker.js +98 -0
- package/dist/cjs/core/server/stream/createReadableStream.js +7 -2
- package/dist/cjs/core/server/stream/createReadableStream.worker.js +4 -2
- package/dist/cjs/core/server/stream/shared.js +3 -1
- package/dist/cjs/core/server/string/index.js +16 -9
- package/dist/cjs/core/server/string/loadable.js +74 -10
- package/dist/cjs/exports/head.js +196 -5
- package/dist/cjs/exports/loadable.js +34 -4
- package/dist/cjs/exports/tanstack-router.js +311 -54
- package/dist/cjs/router/cli/code/tanstackTypes.js +116 -51
- package/dist/cjs/router/cli/code/templates.js +15 -9
- package/dist/cjs/router/runtime/tanstack/hydrationBoundary.js +44 -0
- package/dist/cjs/router/runtime/tanstack/outlet.js +54 -0
- package/dist/cjs/router/runtime/tanstack/plugin.js +190 -88
- package/dist/cjs/router/runtime/tanstack/plugin.node.js +4 -14
- package/dist/cjs/router/runtime/tanstack/routeTree.js +64 -12
- package/dist/cjs/rsc/server.worker.js +58 -0
- package/dist/cjs/ssr/serverRender/renderToString/entry.js +9 -8
- package/dist/esm/boundary-debugger/index.mjs +263 -0
- package/dist/esm/cli/ssr/index.mjs +5 -15
- package/dist/esm/cli/template.server.mjs +1 -0
- package/dist/esm/core/context/serverPayload/index.mjs +1 -1
- package/dist/esm/core/plugin/index.mjs +3 -2
- package/dist/esm/core/react/wrapper.mjs +9 -3
- package/dist/esm/core/server/federatedCss.mjs +13 -0
- package/dist/esm/core/server/helmet.mjs +5 -2
- package/dist/esm/core/server/scriptOrder.mjs +25 -0
- package/dist/esm/core/server/stream/afterTemplate.mjs +14 -6
- package/dist/esm/core/server/stream/beforeTemplate.mjs +14 -11
- package/dist/esm/core/server/stream/beforeTemplate.worker.mjs +64 -0
- package/dist/esm/core/server/stream/createReadableStream.mjs +7 -2
- package/dist/esm/core/server/stream/createReadableStream.worker.mjs +4 -2
- package/dist/esm/core/server/stream/shared.mjs +3 -1
- package/dist/esm/core/server/string/index.mjs +17 -9
- package/dist/esm/core/server/string/loadable.mjs +70 -9
- package/dist/esm/exports/head.mjs +189 -4
- package/dist/esm/exports/loadable.mjs +20 -3
- package/dist/esm/exports/tanstack-router.mjs +2 -1
- package/dist/esm/router/cli/code/tanstackTypes.mjs +116 -51
- package/dist/esm/router/cli/code/templates.mjs +15 -9
- package/dist/esm/router/runtime/tanstack/hydrationBoundary.mjs +10 -0
- package/dist/esm/router/runtime/tanstack/outlet.mjs +17 -0
- package/dist/esm/router/runtime/tanstack/plugin.mjs +193 -91
- package/dist/esm/router/runtime/tanstack/plugin.node.mjs +5 -15
- package/dist/esm/router/runtime/tanstack/routeTree.mjs +65 -13
- package/dist/esm/rsc/server.worker.mjs +1 -0
- package/dist/esm/ssr/serverRender/renderToString/entry.mjs +9 -6
- package/dist/esm-node/boundary-debugger/index.mjs +264 -0
- package/dist/esm-node/cli/ssr/index.mjs +5 -15
- package/dist/esm-node/cli/template.server.mjs +1 -0
- package/dist/esm-node/core/context/serverPayload/index.mjs +1 -1
- package/dist/esm-node/core/plugin/index.mjs +3 -2
- package/dist/esm-node/core/react/wrapper.mjs +9 -3
- package/dist/esm-node/core/server/federatedCss.mjs +14 -0
- package/dist/esm-node/core/server/helmet.mjs +5 -2
- package/dist/esm-node/core/server/scriptOrder.mjs +26 -0
- package/dist/esm-node/core/server/stream/afterTemplate.mjs +14 -6
- package/dist/esm-node/core/server/stream/beforeTemplate.mjs +14 -11
- package/dist/esm-node/core/server/stream/beforeTemplate.worker.mjs +65 -0
- package/dist/esm-node/core/server/stream/createReadableStream.mjs +7 -2
- package/dist/esm-node/core/server/stream/createReadableStream.worker.mjs +4 -2
- package/dist/esm-node/core/server/stream/shared.mjs +3 -1
- package/dist/esm-node/core/server/string/index.mjs +17 -9
- package/dist/esm-node/core/server/string/loadable.mjs +70 -9
- package/dist/esm-node/exports/head.mjs +189 -4
- package/dist/esm-node/exports/loadable.mjs +20 -3
- package/dist/esm-node/exports/tanstack-router.mjs +2 -1
- package/dist/esm-node/router/cli/code/tanstackTypes.mjs +116 -51
- package/dist/esm-node/router/cli/code/templates.mjs +15 -9
- package/dist/esm-node/router/runtime/tanstack/hydrationBoundary.mjs +11 -0
- package/dist/esm-node/router/runtime/tanstack/outlet.mjs +18 -0
- package/dist/esm-node/router/runtime/tanstack/plugin.mjs +193 -91
- package/dist/esm-node/router/runtime/tanstack/plugin.node.mjs +5 -15
- package/dist/esm-node/router/runtime/tanstack/routeTree.mjs +65 -13
- package/dist/esm-node/rsc/server.worker.mjs +2 -0
- package/dist/esm-node/ssr/serverRender/renderToString/entry.mjs +9 -6
- package/dist/types/boundary-debugger/index.d.ts +28 -0
- package/dist/types/cache/index.d.ts +1 -0
- package/dist/types/cli/alias.d.ts +7 -0
- package/dist/types/cli/code.d.ts +3 -0
- package/dist/types/cli/constants.d.ts +9 -0
- package/dist/types/cli/entry.d.ts +2 -0
- package/dist/types/cli/index.d.ts +11 -0
- package/dist/types/cli/ssr/index.d.ts +6 -0
- package/dist/types/cli/ssr/loadable-bundler-plugin.d.ts +31 -0
- package/dist/types/cli/ssr/mode.d.ts +15 -0
- package/dist/types/cli/template.d.ts +50 -0
- package/dist/types/cli/template.server.d.ts +20 -0
- package/dist/types/common.d.ts +8 -0
- package/dist/types/core/browser/hydrate.d.ts +5 -0
- package/dist/types/core/browser/index.d.ts +9 -0
- package/dist/types/core/browser/withCallback.d.ts +5 -0
- package/dist/types/core/compat/hooks.d.ts +4 -0
- package/dist/types/core/compat/index.d.ts +2 -0
- package/dist/types/core/compat/requestContext.d.ts +5 -0
- package/dist/types/core/config.d.ts +6 -0
- package/dist/types/core/constants.d.ts +6 -0
- package/dist/types/core/context/index.d.ts +50 -0
- package/dist/types/core/context/monitors/default.d.ts +2 -0
- package/dist/types/core/context/monitors/index.d.ts +1 -0
- package/dist/types/core/context/monitors/index.server.d.ts +2 -0
- package/dist/types/core/context/request/index.d.ts +1 -0
- package/dist/types/core/context/request/index.server.d.ts +1 -0
- package/dist/types/core/context/response/index.d.ts +4 -0
- package/dist/types/core/context/response/index.server.d.ts +4 -0
- package/dist/types/core/context/runtime.d.ts +46 -0
- package/dist/types/core/context/serverPayload/index.d.ts +4 -0
- package/dist/types/core/context/serverPayload/index.server.d.ts +31 -0
- package/dist/types/core/index.d.ts +5 -0
- package/dist/types/core/plugin/index.d.ts +5 -0
- package/dist/types/core/plugin/types.d.ts +10 -0
- package/dist/types/core/react/index.d.ts +2 -0
- package/dist/types/core/react/wrapper.d.ts +3 -0
- package/dist/types/core/server/constants.d.ts +4 -0
- package/dist/types/core/server/federatedCss.d.ts +5 -0
- package/dist/types/core/server/helmet.d.ts +5 -0
- package/dist/types/core/server/index.d.ts +4 -0
- package/dist/types/core/server/react/index.d.ts +2 -0
- package/dist/types/core/server/react/no-ssr-cache/index.d.ts +2 -0
- package/dist/types/core/server/react/nossr/index.d.ts +4 -0
- package/dist/types/core/server/requestHandler.d.ts +13 -0
- package/dist/types/core/server/scriptOrder.d.ts +1 -0
- package/dist/types/core/server/server.d.ts +4 -0
- package/dist/types/core/server/shared.d.ts +8 -0
- package/dist/types/core/server/stream/afterTemplate.d.ts +13 -0
- package/dist/types/core/server/stream/beforeTemplate.d.ts +10 -0
- package/dist/types/core/server/stream/beforeTemplate.worker.d.ts +10 -0
- package/dist/types/core/server/stream/createReadableStream.d.ts +2 -0
- package/dist/types/core/server/stream/createReadableStream.worker.d.ts +2 -0
- package/dist/types/core/server/stream/deferredScript.d.ts +15 -0
- package/dist/types/core/server/stream/index.d.ts +1 -0
- package/dist/types/core/server/stream/shared.d.ts +41 -0
- package/dist/types/core/server/stream/template.d.ts +9 -0
- package/dist/types/core/server/string/index.d.ts +2 -0
- package/dist/types/core/server/string/loadable.d.ts +47 -0
- package/dist/types/core/server/string/ssrData.d.ts +20 -0
- package/dist/types/core/server/string/types.d.ts +12 -0
- package/dist/types/core/server/tracer.d.ts +17 -0
- package/dist/types/core/server/utils.d.ts +19 -0
- package/dist/types/core/types.d.ts +49 -0
- package/dist/types/document/Body.d.ts +2 -0
- package/dist/types/document/Comment.d.ts +5 -0
- package/dist/types/document/DocumentContext.d.ts +13 -0
- package/dist/types/document/DocumentStructureContext.d.ts +12 -0
- package/dist/types/document/Head.d.ts +5 -0
- package/dist/types/document/Html.d.ts +4 -0
- package/dist/types/document/Links.d.ts +2 -0
- package/dist/types/document/Root.d.ts +7 -0
- package/dist/types/document/Script.d.ts +4 -0
- package/dist/types/document/Scripts.d.ts +2 -0
- package/dist/types/document/Style.d.ts +5 -0
- package/dist/types/document/Title.d.ts +1 -0
- package/dist/types/document/cli/index.d.ts +5 -0
- package/dist/types/document/constants.d.ts +25 -0
- package/dist/types/document/index.d.ts +12 -0
- package/dist/types/exports/config-routes.d.ts +9 -0
- package/dist/types/exports/head.d.ts +11 -0
- package/dist/types/exports/loadable.d.ts +10 -0
- package/dist/types/exports/tanstack-router.d.ts +7 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/internal.d.ts +2 -0
- package/dist/types/react-server.d.ts +3 -0
- package/dist/types/router/cli/code/getClientRoutes/getRoutes.d.ts +8 -0
- package/dist/types/router/cli/code/getClientRoutes/index.d.ts +1 -0
- package/dist/types/router/cli/code/getClientRoutes/utils.d.ts +4 -0
- package/dist/types/router/cli/code/index.d.ts +12 -0
- package/dist/types/router/cli/code/inspect.d.ts +22 -0
- package/dist/types/router/cli/code/makeLegalIdentifier.d.ts +1 -0
- package/dist/types/router/cli/code/nestedRoutes.d.ts +13 -0
- package/dist/types/router/cli/code/tanstackTypes.d.ts +10 -0
- package/dist/types/router/cli/code/templates.d.ts +28 -0
- package/dist/types/router/cli/code/utils.d.ts +12 -0
- package/dist/types/router/cli/config-routes/converter.d.ts +15 -0
- package/dist/types/router/cli/config-routes/parseRouteConfig.d.ts +32 -0
- package/dist/types/router/cli/constants.d.ts +31 -0
- package/dist/types/router/cli/entry.d.ts +18 -0
- package/dist/types/router/cli/handler.d.ts +28 -0
- package/dist/types/router/cli/index.d.ts +5 -0
- package/dist/types/router/index.d.ts +1 -0
- package/dist/types/router/internal.d.ts +2 -0
- package/dist/types/router/runtime/CSSLinks.d.ts +9 -0
- package/dist/types/router/runtime/DefaultNotFound.d.ts +2 -0
- package/dist/types/router/runtime/DeferredDataScripts.d.ts +2 -0
- package/dist/types/router/runtime/DeferredDataScripts.node.d.ts +11 -0
- package/dist/types/router/runtime/PrefetchLink.d.ts +27 -0
- package/dist/types/router/runtime/constants.d.ts +146 -0
- package/dist/types/router/runtime/hooks.d.ts +18 -0
- package/dist/types/router/runtime/index.d.ts +7 -0
- package/dist/types/router/runtime/internal.d.ts +11 -0
- package/dist/types/router/runtime/lifecycle.d.ts +25 -0
- package/dist/types/router/runtime/plugin.d.ts +9 -0
- package/dist/types/router/runtime/plugin.node.d.ts +7 -0
- package/dist/types/router/runtime/routerHelper.d.ts +5 -0
- package/dist/types/router/runtime/rsc-router.d.ts +20 -0
- package/dist/types/router/runtime/rsc.d.ts +1 -0
- package/dist/types/router/runtime/server.d.ts +1 -0
- package/dist/types/router/runtime/tanstack/basepathRewrite.d.ts +8 -0
- package/dist/types/router/runtime/tanstack/dataMutation.d.ts +29 -0
- package/dist/types/router/runtime/tanstack/hydrationBoundary.d.ts +2 -0
- package/dist/types/router/runtime/tanstack/outlet.d.ts +2 -0
- package/dist/types/router/runtime/tanstack/plugin.d.ts +6 -0
- package/dist/types/router/runtime/tanstack/plugin.node.d.ts +6 -0
- package/dist/types/router/runtime/tanstack/prefetchLink.d.ts +11 -0
- package/dist/types/router/runtime/tanstack/routeTree.d.ts +8 -0
- package/dist/types/router/runtime/tanstack/rsc/ClientSlot.d.ts +5 -0
- package/dist/types/router/runtime/tanstack/rsc/CompositeComponent.d.ts +3 -0
- package/dist/types/router/runtime/tanstack/rsc/ReplayableStream.d.ts +24 -0
- package/dist/types/router/runtime/tanstack/rsc/RscNodeRenderer.d.ts +5 -0
- package/dist/types/router/runtime/tanstack/rsc/SlotContext.d.ts +11 -0
- package/dist/types/router/runtime/tanstack/rsc/client.d.ts +11 -0
- package/dist/types/router/runtime/tanstack/rsc/createRscProxy.d.ts +7 -0
- package/dist/types/router/runtime/tanstack/rsc/index.d.ts +2 -0
- package/dist/types/router/runtime/tanstack/rsc/server.d.ts +14 -0
- package/dist/types/router/runtime/tanstack/rsc/slotUsageSanitizer.d.ts +2 -0
- package/dist/types/router/runtime/tanstack/rsc/symbols.d.ts +46 -0
- package/dist/types/router/runtime/types.d.ts +119 -0
- package/dist/types/router/runtime/utils.d.ts +48 -0
- package/dist/types/router/runtime/withRouter.d.ts +10 -0
- package/dist/types/rsc/client.d.ts +2 -0
- package/dist/types/rsc/server.d.ts +1 -0
- package/dist/types/rsc/server.worker.d.ts +1 -0
- package/package.json +24 -18
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export interface ServerComponentStream {
|
|
3
|
+
createReplayStream: () => ReadableStream<Uint8Array>;
|
|
4
|
+
}
|
|
5
|
+
export declare const SERVER_COMPONENT_STREAM: unique symbol;
|
|
6
|
+
export declare const RENDERABLE_RSC: unique symbol;
|
|
7
|
+
export declare const RSC_PROXY_GET_TREE: unique symbol;
|
|
8
|
+
export declare const RSC_PROXY_PATH: unique symbol;
|
|
9
|
+
export declare const RSC_SLOT_USAGES_STREAM: unique symbol;
|
|
10
|
+
export declare const RSC_SLOT_USAGES: unique symbol;
|
|
11
|
+
export type SerializableSlotArg = string | number | boolean | bigint | null | undefined | SerializableSlotArg[] | {
|
|
12
|
+
[key: string]: SerializableSlotArg;
|
|
13
|
+
};
|
|
14
|
+
export type RscSlotUsageEvent = {
|
|
15
|
+
slot: string;
|
|
16
|
+
args?: SerializableSlotArg[];
|
|
17
|
+
};
|
|
18
|
+
export interface AnyRenderableServerComponent<TNode = React.ReactNode> {
|
|
19
|
+
[SERVER_COMPONENT_STREAM]: ServerComponentStream;
|
|
20
|
+
[RENDERABLE_RSC]: true;
|
|
21
|
+
[RSC_PROXY_GET_TREE]?: () => unknown;
|
|
22
|
+
[RSC_PROXY_PATH]?: string[];
|
|
23
|
+
[RSC_SLOT_USAGES_STREAM]?: ReadableStream<RscSlotUsageEvent>;
|
|
24
|
+
'~types'?: {
|
|
25
|
+
node: TNode;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export interface AnyCompositeComponent<TProps extends object = Record<string, unknown>, TReturn = React.ReactNode> {
|
|
29
|
+
[SERVER_COMPONENT_STREAM]?: ServerComponentStream;
|
|
30
|
+
[RSC_PROXY_GET_TREE]?: () => unknown;
|
|
31
|
+
[RSC_PROXY_PATH]?: string[];
|
|
32
|
+
[RSC_SLOT_USAGES]?: RscSlotUsageEvent[];
|
|
33
|
+
[RSC_SLOT_USAGES_STREAM]?: ReadableStream<RscSlotUsageEvent>;
|
|
34
|
+
'~types'?: {
|
|
35
|
+
props: TProps;
|
|
36
|
+
return: TReturn;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
type InferCompositeProps<TComp extends AnyCompositeComponent> = TComp extends AnyCompositeComponent<infer TProps, unknown> ? TProps : Record<string, unknown>;
|
|
40
|
+
export type CompositeComponentProps<TComp extends AnyCompositeComponent> = {
|
|
41
|
+
src: TComp;
|
|
42
|
+
strict?: boolean;
|
|
43
|
+
} & InferCompositeProps<TComp>;
|
|
44
|
+
export declare function isServerComponent(value: unknown): value is AnyCompositeComponent | AnyRenderableServerComponent;
|
|
45
|
+
export declare function isRenderableServerComponent(value: unknown): boolean;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { RequestContext } from '@modern-js/runtime-utils/node';
|
|
2
|
+
import type { Params, RouteObject, RouteProps } from '@modern-js/runtime-utils/router';
|
|
3
|
+
import type { NestedRoute, PageRoute } from '@modern-js/types';
|
|
4
|
+
export type SingleRouteConfig = RouteProps & {
|
|
5
|
+
redirect?: string;
|
|
6
|
+
routes?: SingleRouteConfig[];
|
|
7
|
+
key?: string;
|
|
8
|
+
/**
|
|
9
|
+
* layout component
|
|
10
|
+
*/
|
|
11
|
+
layout?: React.ComponentType;
|
|
12
|
+
/**
|
|
13
|
+
* component would be rendered when route macthed.
|
|
14
|
+
*/
|
|
15
|
+
component?: React.ComponentType;
|
|
16
|
+
};
|
|
17
|
+
export type BuiltInRouterFramework = 'react-router' | 'tanstack';
|
|
18
|
+
export type RouterFramework = BuiltInRouterFramework | (string & {});
|
|
19
|
+
export type RouterConfig = {
|
|
20
|
+
/**
|
|
21
|
+
* Select the router implementation used by Modern.js conventional routing.
|
|
22
|
+
* - `react-router` (default): React Router v7 based integration
|
|
23
|
+
* - `tanstack`: TanStack Router integration
|
|
24
|
+
*/
|
|
25
|
+
framework?: RouterFramework;
|
|
26
|
+
routesConfig: {
|
|
27
|
+
globalApp?: React.ComponentType<any>;
|
|
28
|
+
routes?: (NestedRoute | PageRoute)[];
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* You should not use it
|
|
32
|
+
*/
|
|
33
|
+
oldVersion?: boolean;
|
|
34
|
+
serverBase?: string[];
|
|
35
|
+
supportHtml5History?: boolean;
|
|
36
|
+
basename?: string;
|
|
37
|
+
createRoutes?: () => RouteObject[];
|
|
38
|
+
future?: Partial<{
|
|
39
|
+
v7_startTransition: boolean;
|
|
40
|
+
}>;
|
|
41
|
+
/**
|
|
42
|
+
* An unstable feature, which will reload the page when the current browser URL and the SSR Context URL do not match.
|
|
43
|
+
*/
|
|
44
|
+
unstable_reloadOnURLMismatch?: boolean;
|
|
45
|
+
};
|
|
46
|
+
export type Routes = RouterConfig['routesConfig']['routes'];
|
|
47
|
+
export interface RouterRouteMatchSnapshot {
|
|
48
|
+
routeId: string;
|
|
49
|
+
assetRouteId?: string;
|
|
50
|
+
pathname?: string;
|
|
51
|
+
params?: Record<string, string>;
|
|
52
|
+
}
|
|
53
|
+
export interface RouteManifest {
|
|
54
|
+
routeAssets: RouteAssets;
|
|
55
|
+
}
|
|
56
|
+
export interface InternalRouterServerSnapshot {
|
|
57
|
+
framework?: RouterFramework;
|
|
58
|
+
basename?: string;
|
|
59
|
+
statusCode?: number;
|
|
60
|
+
errors?: Record<string, unknown>;
|
|
61
|
+
routerData?: {
|
|
62
|
+
loaderData?: Record<string, unknown>;
|
|
63
|
+
errors?: Record<string, unknown>;
|
|
64
|
+
};
|
|
65
|
+
hydrationScript?: string;
|
|
66
|
+
hydrationScripts?: string[];
|
|
67
|
+
matchedRouteIds?: string[];
|
|
68
|
+
matches?: RouterRouteMatchSnapshot[];
|
|
69
|
+
}
|
|
70
|
+
export interface InternalRouterRuntimeState {
|
|
71
|
+
framework: RouterFramework;
|
|
72
|
+
basename?: string;
|
|
73
|
+
instance?: unknown;
|
|
74
|
+
hydrationScript?: string;
|
|
75
|
+
hydrationScripts?: string[];
|
|
76
|
+
matchedRouteIds?: string[];
|
|
77
|
+
matches?: RouterRouteMatchSnapshot[];
|
|
78
|
+
serverSnapshot?: InternalRouterServerSnapshot;
|
|
79
|
+
cleanup?: () => void | Promise<void>;
|
|
80
|
+
}
|
|
81
|
+
export interface RouterServerPrepareResult {
|
|
82
|
+
state: InternalRouterRuntimeState;
|
|
83
|
+
snapshot?: InternalRouterServerSnapshot;
|
|
84
|
+
redirect?: Response;
|
|
85
|
+
cleanup?: () => void | Promise<void>;
|
|
86
|
+
}
|
|
87
|
+
export interface RouteAssets {
|
|
88
|
+
[routeId: string]: {
|
|
89
|
+
chunkIds?: (string | number)[];
|
|
90
|
+
assets?: string[];
|
|
91
|
+
referenceCssAssets?: string[];
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
export interface LazyComponentDescriptor {
|
|
95
|
+
_init: unknown;
|
|
96
|
+
_payload: unknown;
|
|
97
|
+
}
|
|
98
|
+
export type ModernRouteObject = RouteObject & {
|
|
99
|
+
isClientComponent?: boolean;
|
|
100
|
+
hasClientLoader?: boolean;
|
|
101
|
+
hasLoader?: boolean;
|
|
102
|
+
hasAction?: boolean;
|
|
103
|
+
inValidSSRRoute?: boolean;
|
|
104
|
+
parentId?: string;
|
|
105
|
+
lazyImport?: () => Promise<{
|
|
106
|
+
default: React.ComponentType;
|
|
107
|
+
}>;
|
|
108
|
+
component?: React.ComponentType | LazyComponentDescriptor;
|
|
109
|
+
entryCssFiles?: string[];
|
|
110
|
+
};
|
|
111
|
+
interface DataFunctionArgs<D = any> {
|
|
112
|
+
request: Request;
|
|
113
|
+
params: Params;
|
|
114
|
+
context?: D;
|
|
115
|
+
}
|
|
116
|
+
export type LoaderFunctionArgs<P extends Record<string, unknown> = Record<string, unknown>> = DataFunctionArgs<RequestContext<P>>;
|
|
117
|
+
declare type DataFunctionValue = Response | NonNullable<unknown> | null;
|
|
118
|
+
export type LoaderFunction = <P extends Record<string, unknown> = Record<string, unknown>>(args: LoaderFunctionArgs<P>) => Promise<DataFunctionValue> | DataFunctionValue;
|
|
119
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { DataRouter } from '@modern-js/runtime-utils/router';
|
|
2
|
+
import { type RouteObject, type StaticHandlerContext } from '@modern-js/runtime-utils/router';
|
|
3
|
+
import type { NestedRoute, PageRoute, SSRMode } from '@modern-js/types';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import type { RouterConfig } from './types';
|
|
6
|
+
export declare function getRouteComponents(routes: (NestedRoute | PageRoute)[], { globalApp, ssrMode, props, }: {
|
|
7
|
+
globalApp?: React.ComponentType<GlobalAppProps>;
|
|
8
|
+
ssrMode?: SSRMode;
|
|
9
|
+
props?: Record<string, unknown>;
|
|
10
|
+
}): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>[];
|
|
11
|
+
interface GlobalAppProps {
|
|
12
|
+
Component: React.ComponentType;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
export declare function getRouteObjects(routes: (NestedRoute | PageRoute)[], { globalApp, ssrMode, props, }: {
|
|
16
|
+
globalApp?: React.ComponentType<GlobalAppProps>;
|
|
17
|
+
ssrMode?: SSRMode;
|
|
18
|
+
props?: Record<string, unknown>;
|
|
19
|
+
}): RouteObject[];
|
|
20
|
+
export declare function createRouteObjectsFromConfig({ routesConfig, props, ssrMode, }: {
|
|
21
|
+
routesConfig: RouterConfig['routesConfig'];
|
|
22
|
+
props?: Record<string, unknown>;
|
|
23
|
+
ssrMode?: SSRMode;
|
|
24
|
+
}): RouteObject[] | null;
|
|
25
|
+
export declare function renderRoutes({ routesConfig, props, ssrMode, }: {
|
|
26
|
+
routesConfig: RouterConfig['routesConfig'];
|
|
27
|
+
props?: Record<string, unknown>;
|
|
28
|
+
ssrMode?: SSRMode;
|
|
29
|
+
}): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>[] | null;
|
|
30
|
+
export declare function getLocation(serverContext: {
|
|
31
|
+
request?: {
|
|
32
|
+
pathname?: string;
|
|
33
|
+
url?: string;
|
|
34
|
+
};
|
|
35
|
+
} | undefined): string;
|
|
36
|
+
export declare const urlJoin: (...parts: string[]) => string;
|
|
37
|
+
export declare function standardSlash(str: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* forked from https://github.com/remix-run/remix/blob/main/packages/remix-server-runtime/errors.ts
|
|
40
|
+
* license at https://github.com/remix-run/remix/blob/main/LICENSE.md
|
|
41
|
+
*/
|
|
42
|
+
export declare function serializeErrors(errors: StaticHandlerContext['errors']): StaticHandlerContext['errors'];
|
|
43
|
+
/**
|
|
44
|
+
* forked from https://github.com/remix-run/remix/blob/main/packages/remix-react/errors.ts
|
|
45
|
+
* license at https://github.com/remix-run/remix/blob/main/LICENSE.md
|
|
46
|
+
*/
|
|
47
|
+
export declare function deserializeErrors(errors: DataRouter['state']['errors']): DataRouter['state']['errors'];
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useLocation, useNavigate } from '@modern-js/runtime-utils/router';
|
|
2
|
+
import type React from 'react';
|
|
3
|
+
export interface WithRouterProps<Params extends {
|
|
4
|
+
[K in keyof Params]?: string;
|
|
5
|
+
} = {}> {
|
|
6
|
+
location: ReturnType<typeof useLocation>;
|
|
7
|
+
params: Params;
|
|
8
|
+
navigate: ReturnType<typeof useNavigate>;
|
|
9
|
+
}
|
|
10
|
+
export declare const withRouter: <Props extends WithRouterProps>(Component: React.ComponentType<Props>) => (props: Omit<Props, keyof WithRouterProps>) => React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@modern-js/render/rsc';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@modern-js/render/rsc-worker';
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"modern",
|
|
18
18
|
"modern.js"
|
|
19
19
|
],
|
|
20
|
-
"version": "3.2.0-ultramodern.
|
|
20
|
+
"version": "3.2.0-ultramodern.100",
|
|
21
21
|
"engines": {
|
|
22
22
|
"node": ">=20"
|
|
23
23
|
},
|
|
@@ -63,6 +63,10 @@
|
|
|
63
63
|
"types": "./dist/types/exports/head.d.ts",
|
|
64
64
|
"default": "./dist/esm/exports/head.mjs"
|
|
65
65
|
},
|
|
66
|
+
"./boundary-debugger": {
|
|
67
|
+
"types": "./dist/types/boundary-debugger/index.d.ts",
|
|
68
|
+
"default": "./dist/esm/boundary-debugger/index.mjs"
|
|
69
|
+
},
|
|
66
70
|
"./ssr": {
|
|
67
71
|
"types": "./dist/types/core/server/index.d.ts",
|
|
68
72
|
"default": "./dist/esm/core/server/index.mjs"
|
|
@@ -168,6 +172,9 @@
|
|
|
168
172
|
"head": [
|
|
169
173
|
"./dist/types/exports/head.d.ts"
|
|
170
174
|
],
|
|
175
|
+
"boundary-debugger": [
|
|
176
|
+
"./dist/types/boundary-debugger/index.d.ts"
|
|
177
|
+
],
|
|
171
178
|
"document": [
|
|
172
179
|
"./dist/types/document/index.d.ts"
|
|
173
180
|
],
|
|
@@ -212,27 +219,26 @@
|
|
|
212
219
|
"dependencies": {
|
|
213
220
|
"@loadable/component": "5.16.7",
|
|
214
221
|
"@loadable/server": "5.16.7",
|
|
215
|
-
"@swc/core": "1.15.
|
|
216
|
-
"@swc/helpers": "^0.5.
|
|
217
|
-
"@swc/plugin-loadable-components": "^11.
|
|
218
|
-
"@tanstack/react-router": "1.170.
|
|
219
|
-
"@tanstack/router-core": "1.
|
|
222
|
+
"@swc/core": "1.15.40",
|
|
223
|
+
"@swc/helpers": "^0.5.23",
|
|
224
|
+
"@swc/plugin-loadable-components": "^11.10.0",
|
|
225
|
+
"@tanstack/react-router": "1.170.11",
|
|
226
|
+
"@tanstack/router-core": "1.171.9",
|
|
220
227
|
"@types/loadable__component": "^5.13.10",
|
|
221
|
-
"@types/react-helmet": "^6.1.11",
|
|
222
228
|
"cookie": "1.1.1",
|
|
223
229
|
"entities": "^8.0.0",
|
|
224
230
|
"es-module-lexer": "^2.1.0",
|
|
225
231
|
"esbuild": "^0.28.0",
|
|
226
232
|
"invariant": "^2.2.4",
|
|
227
233
|
"isbot": "5.1.40",
|
|
228
|
-
"react-helmet": "
|
|
234
|
+
"react-helmet-async": "3.0.0",
|
|
229
235
|
"react-is": "^19.2.6",
|
|
230
|
-
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.2.0-ultramodern.
|
|
231
|
-
"@modern-js/
|
|
232
|
-
"@modern-js/
|
|
233
|
-
"@modern-js/
|
|
234
|
-
"@modern-js/
|
|
235
|
-
"@modern-js/
|
|
236
|
+
"@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.2.0-ultramodern.100",
|
|
237
|
+
"@modern-js/render": "npm:@bleedingdev/modern-js-render@3.2.0-ultramodern.100",
|
|
238
|
+
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.2.0-ultramodern.100",
|
|
239
|
+
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.2.0-ultramodern.100",
|
|
240
|
+
"@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.2.0-ultramodern.100",
|
|
241
|
+
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.2.0-ultramodern.100"
|
|
236
242
|
},
|
|
237
243
|
"peerDependencies": {
|
|
238
244
|
"react": "^19.2.6",
|
|
@@ -240,18 +246,18 @@
|
|
|
240
246
|
},
|
|
241
247
|
"devDependencies": {
|
|
242
248
|
"@remix-run/web-fetch": "^4.4.2",
|
|
243
|
-
"@rsbuild/core": "2.0.
|
|
249
|
+
"@rsbuild/core": "2.0.7",
|
|
244
250
|
"@rslib/core": "0.21.5",
|
|
245
251
|
"@tanstack/history": "1.162.0",
|
|
246
252
|
"@testing-library/dom": "^10.4.1",
|
|
247
253
|
"@testing-library/react": "^16.3.2",
|
|
248
254
|
"@types/invariant": "^2.2.37",
|
|
249
255
|
"@types/loadable__server": "5.12.11",
|
|
250
|
-
"@types/node": "^25.
|
|
251
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
256
|
+
"@types/node": "^25.9.1",
|
|
257
|
+
"@typescript/native-preview": "7.0.0-dev.20260527.2",
|
|
252
258
|
"react": "^19.2.6",
|
|
253
259
|
"react-dom": "^19.2.6",
|
|
254
|
-
"@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.2.0-ultramodern.
|
|
260
|
+
"@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.2.0-ultramodern.100",
|
|
255
261
|
"@scripts/rstest-config": "2.66.0"
|
|
256
262
|
},
|
|
257
263
|
"sideEffects": false,
|