@bleedingdev/modern-js-plugin-tanstack 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.
Files changed (114) hide show
  1. package/dist/cjs/cli/index.js +9 -0
  2. package/dist/cjs/cli/tanstackTypes/source.js +3 -1
  3. package/dist/cjs/runtime/basepathRewrite.js +13 -6
  4. package/dist/cjs/runtime/lifecycle.js +7 -7
  5. package/dist/cjs/runtime/plugin.js +1 -1
  6. package/dist/cjs/runtime/plugin.node.js +5 -1
  7. package/dist/cjs/runtime/prefetchLink.js +2 -7
  8. package/dist/cjs/runtime/register.js +0 -2
  9. package/dist/cjs/runtime/routeTree/construction.js +2 -0
  10. package/dist/cjs/runtime/router.js +25 -9
  11. package/dist/cjs/runtime/state.js +2 -2
  12. package/dist/cjs/runtime/utils.js +2 -0
  13. package/dist/esm/cli/index.mjs +13 -5
  14. package/dist/esm/cli/tanstackTypes/source.mjs +3 -1
  15. package/dist/esm/runtime/basepathRewrite.mjs +10 -3
  16. package/dist/esm/runtime/lifecycle.mjs +1 -1
  17. package/dist/esm/runtime/plugin.mjs +1 -1
  18. package/dist/esm/runtime/plugin.node.mjs +5 -1
  19. package/dist/esm/runtime/prefetchLink.mjs +1 -6
  20. package/dist/esm/runtime/register.mjs +0 -2
  21. package/dist/esm/runtime/routeTree/construction.mjs +2 -0
  22. package/dist/esm/runtime/router.mjs +27 -11
  23. package/dist/esm/runtime/state.mjs +1 -1
  24. package/dist/esm/runtime/utils.mjs +2 -0
  25. package/dist/esm-node/cli/index.mjs +15 -5
  26. package/dist/esm-node/cli/tanstackTypes/source.mjs +3 -1
  27. package/dist/esm-node/runtime/basepathRewrite.mjs +10 -3
  28. package/dist/esm-node/runtime/lifecycle.mjs +1 -1
  29. package/dist/esm-node/runtime/plugin.mjs +1 -1
  30. package/dist/esm-node/runtime/plugin.node.mjs +5 -1
  31. package/dist/esm-node/runtime/prefetchLink.mjs +1 -6
  32. package/dist/esm-node/runtime/register.mjs +0 -2
  33. package/dist/esm-node/runtime/routeTree/construction.mjs +2 -0
  34. package/dist/esm-node/runtime/router.mjs +27 -11
  35. package/dist/esm-node/runtime/state.mjs +1 -1
  36. package/dist/esm-node/runtime/utils.mjs +2 -0
  37. package/dist/types/cli/index.d.ts +5 -5
  38. package/dist/types/cli/tanstackTypes/shared.d.ts +1 -1
  39. package/dist/types/cli/tanstackTypes.d.ts +3 -3
  40. package/dist/types/cli.d.ts +2 -2
  41. package/dist/types/runtime/basepathRewrite.d.ts +2 -1
  42. package/dist/types/runtime/dataMutation.d.ts +3 -3
  43. package/dist/types/runtime/index.d.ts +14 -14
  44. package/dist/types/runtime/lifecycle.d.ts +9 -2
  45. package/dist/types/runtime/loaderBridge.d.ts +2 -2
  46. package/dist/types/runtime/plugin.d.ts +2 -2
  47. package/dist/types/runtime/plugin.node.d.ts +2 -2
  48. package/dist/types/runtime/plugin.worker.d.ts +1 -1
  49. package/dist/types/runtime/pluginShared.d.ts +2 -2
  50. package/dist/types/runtime/register.d.ts +1 -9
  51. package/dist/types/runtime/routeTree/construction.d.ts +1 -1
  52. package/dist/types/runtime/routeTree/index.d.ts +2 -2
  53. package/dist/types/runtime/routeTree/loaders.d.ts +1 -1
  54. package/dist/types/runtime/routeTree/tanstackRoutes.d.ts +1 -1
  55. package/dist/types/runtime/router.d.ts +2 -13
  56. package/dist/types/runtime/rsc/CompositeComponent.d.ts +1 -1
  57. package/dist/types/runtime/rsc/RscNodeRenderer.d.ts +1 -1
  58. package/dist/types/runtime/rsc/client.d.ts +4 -4
  59. package/dist/types/runtime/rsc/createRscProxy.d.ts +1 -1
  60. package/dist/types/runtime/rsc/payloadFetch.d.ts +1 -1
  61. package/dist/types/runtime/rsc/payloadRouter.d.ts +2 -2
  62. package/dist/types/runtime/rsc/payloadStorage.d.ts +1 -1
  63. package/dist/types/runtime/rsc/server.d.ts +3 -3
  64. package/dist/types/runtime/rsc/shared.d.ts +1 -1
  65. package/dist/types/runtime/rsc/slotUsageSanitizer.d.ts +1 -1
  66. package/dist/types/runtime/ssrManagedTags.d.ts +1 -1
  67. package/dist/types/runtime/ssrPreload.d.ts +1 -1
  68. package/dist/types/runtime/state.d.ts +1 -1
  69. package/dist/types/runtime/submitAction.d.ts +1 -1
  70. package/dist/types/runtime/types.d.ts +2 -1
  71. package/dist/types/runtime/utils.d.ts +1 -1
  72. package/dist/types/runtime.d.ts +1 -1
  73. package/package.json +19 -16
  74. package/rstest.config.mts +1 -24
  75. package/src/cli/index.ts +10 -0
  76. package/src/cli/tanstackTypes/source.ts +3 -1
  77. package/src/runtime/basepathRewrite.ts +11 -2
  78. package/src/runtime/lifecycle.ts +14 -3
  79. package/src/runtime/plugin.node.tsx +9 -2
  80. package/src/runtime/plugin.tsx +5 -1
  81. package/src/runtime/prefetchLink.tsx +1 -23
  82. package/src/runtime/register.ts +1 -12
  83. package/src/runtime/routeTree/construction.ts +2 -0
  84. package/src/runtime/router.ts +25 -40
  85. package/src/runtime/state.ts +1 -1
  86. package/src/runtime/types.ts +2 -2
  87. package/src/runtime/utils.tsx +3 -1
  88. package/tests/router/cli.test.ts +148 -824
  89. package/tests/router/dataMutation.test.tsx +17 -85
  90. package/tests/router/flightSerialization.roundtrip.test.tsx +9 -6
  91. package/tests/router/generateRouteArtifacts.test.ts +68 -28
  92. package/tests/router/loaderBridge.test.ts +0 -25
  93. package/tests/router/localisedIdentity.test.tsx +95 -0
  94. package/tests/router/prefetchLink.test.tsx +17 -21
  95. package/tests/router/prefetchLinkPreload.test.tsx +11 -31
  96. package/tests/router/routeHooks.test.ts +41 -105
  97. package/tests/router/routeTree.test.ts +144 -836
  98. package/tests/router/rsc.test.tsx +131 -166
  99. package/tests/router/serverPlugin.test.ts +43 -1
  100. package/tests/router/tanstackTypes.test.ts +109 -973
  101. package/tests/realm-isolation.test.ts +0 -114
  102. package/tests/router/fastDefaults.test.ts +0 -32
  103. package/tests/router/fixtures/legacyRuntimeRouter.ts +0 -10
  104. package/tests/router/fixtures/rscDecoderSecurityChild.cjs +0 -162
  105. package/tests/router/hooks.test.ts +0 -40
  106. package/tests/router/hydrationBoundary.test.tsx +0 -23
  107. package/tests/router/packageSurface.test.ts +0 -24
  108. package/tests/router/preloadRedirect.test.ts +0 -64
  109. package/tests/router/register.test.ts +0 -8
  110. package/tests/router/routerCompatibility.test.ts +0 -239
  111. package/tests/router/rscDecoderSecurity.test.ts +0 -113
  112. package/tests/router/rscPayloadRouterMatrix.test.ts +0 -197
  113. /package/dist/esm/{rslib-runtime.mjs → rslib-runtime~1.mjs} +0 -0
  114. /package/dist/esm-node/{rslib-runtime.mjs → rslib-runtime~0.mjs} +0 -0
@@ -11,6 +11,7 @@ import { routerProviderRegistryHooks } from "./hooks.mjs";
11
11
  import { wrapTanstackSsrHydrationBoundary } from "./hydrationBoundary.mjs";
12
12
  import { applyRouterServerPrepareResult, createRouterServerSnapshot, getRouterRuntimeState } from "./lifecycle.mjs";
13
13
  import { createTanstackRouteObjects, getTanstackRouteConfig, joinBasename } from "./pluginShared.mjs";
14
+ import { Link } from "./prefetchLink.mjs";
14
15
  import { createRouteTreeFromRouteObjects, getModernRouteIdsFromMatches } from "./routeTree/index.mjs";
15
16
  import { createTanstackRscServerPayload, handleTanstackRscRedirect } from "./rsc/payloadRouter.mjs";
16
17
  import { getTanstackRscRouter, setTanstackRscRouter, setTanstackRscServerPayload } from "./rsc/payloadStorage.mjs";
@@ -36,6 +37,9 @@ const tanstackRouterPlugin = (userConfig = {})=>{
36
37
  routeConfig
37
38
  });
38
39
  if (!modifiedRouteObjects.length) return;
40
+ context.router = {
41
+ Link: Link
42
+ };
39
43
  const { request, nonce, baseUrl, loaderFailureMode = 'errorBoundary' } = context.ssrContext;
40
44
  const _basename = '/' === baseUrl ? joinBasename(baseUrl, basename || '') : baseUrl;
41
45
  const rawRequest = request.raw;
@@ -58,7 +62,7 @@ const tanstackRouterPlugin = (userConfig = {})=>{
58
62
  initialHref
59
63
  ]
60
64
  });
61
- const rewrite = createModernBasepathRewrite(_basename);
65
+ const rewrite = createModernBasepathRewrite(_basename, false, modifiedRouteObjects);
62
66
  const routerLifecycleContext = {
63
67
  framework: 'tanstack',
64
68
  phase: 'ssr-prepare',
@@ -1,12 +1,7 @@
1
1
  import "node:module";
2
2
  import { jsx } from "react/jsx-runtime";
3
+ import { resolvePreloadFromPrefetch } from "@modern-js/runtime-extensions";
3
4
  import { useLinkProps } from "@tanstack/react-router";
4
- function resolvePreloadFromPrefetch(prefetch, preload) {
5
- if (void 0 !== preload) return preload;
6
- if ('none' === prefetch) return false;
7
- if ('intent' === prefetch || 'render' === prefetch || 'viewport' === prefetch) return prefetch;
8
- return 'viewport';
9
- }
10
5
  const LinkComponentImpl = (props)=>{
11
6
  const { prefetch, preload, 'aria-current': ariaCurrentProp, ref, children, ...rest } = props;
12
7
  const hasAriaCurrentOverride = 'aria-current' in props;
@@ -1,6 +1,4 @@
1
1
  import "node:module";
2
- import { registerRouterProvider } from "@modern-js/runtime/context";
3
2
  import { tanstackRouterPlugin } from "./plugin.mjs";
4
3
  const tanstackRouterProviderFactory = (userConfig)=>tanstackRouterPlugin(userConfig);
5
- registerRouterProvider('tanstack', tanstackRouterProviderFactory);
6
4
  export { tanstackRouterProviderFactory };
@@ -1,4 +1,5 @@
1
1
  import "node:module";
2
+ import { canonicaliseLocalisedRoutes } from "@modern-js/i18n-runtime-extensions";
2
3
  import { DefaultNotFound } from "@modern-js/runtime/context";
3
4
  import { rootRouteId } from "@tanstack/react-router";
4
5
  import { createRouteStaticData } from "../../shared/routeStaticData.mjs";
@@ -58,6 +59,7 @@ function getRootLikeRouteObject(routes) {
58
59
  return routes.find((route)=>'/' === route.path && !route.index);
59
60
  }
60
61
  function createRouteTreeFromRouteObjects(routes, options = {}) {
62
+ routes = canonicaliseLocalisedRoutes(routes);
61
63
  const rootLikeRoute = getRootLikeRouteObject(routes);
62
64
  const rootRevalidationState = {};
63
65
  const rootShouldRevalidate = rootLikeRoute?.shouldRevalidate;
@@ -1,17 +1,33 @@
1
1
  import "node:module";
2
- import * as __rspack_external__modern_js_runtime_router_internal_8b8183c5 from "@modern-js/runtime/router/internal";
2
+ import { routerProviderRegistryHooks } from "@modern-js/runtime/context";
3
+ import { routerPlugin } from "@modern-js/runtime/router/internal";
4
+ import { createRouterPlugin } from "@modern-js/runtime-extensions/router-provider";
5
+ import { createRouterStatePlugin } from "@modern-js/runtime-extensions/router-state-plugin";
3
6
  import { tanstackRouterProviderFactory } from "./register.mjs";
4
- function getRouterPlugin() {
5
- const createRouterPlugin = Reflect.get(__rspack_external__modern_js_runtime_router_internal_8b8183c5, 'createRouterPlugin');
6
- if ('function' == typeof createRouterPlugin) return createRouterPlugin([
7
+ const createProviderPlugin = createRouterPlugin({
8
+ defaultProvider: {
9
+ name: 'react-router',
10
+ factory: routerPlugin
11
+ },
12
+ registryHooks: routerProviderRegistryHooks,
13
+ localProviders: [
7
14
  {
8
15
  name: 'tanstack',
9
16
  factory: tanstackRouterProviderFactory
10
17
  }
11
- ]);
12
- const legacyRouterPlugin = Reflect.get(__rspack_external__modern_js_runtime_router_internal_8b8183c5, 'routerPlugin');
13
- if ('function' == typeof legacyRouterPlugin) return tanstackRouterProviderFactory;
14
- throw new Error('[@modern-js/plugin-tanstack] The installed @modern-js/runtime/router/internal exports neither createRouterPlugin nor routerPlugin. Install a compatible @modern-js/runtime version.');
15
- }
16
- const routerPlugin = getRouterPlugin();
17
- export { routerPlugin };
18
+ ]
19
+ });
20
+ const statePlugin = createRouterStatePlugin({
21
+ registryHooks: routerProviderRegistryHooks
22
+ });
23
+ const router_routerPlugin = (userConfig = {})=>{
24
+ const providerPlugin = createProviderPlugin(userConfig);
25
+ return {
26
+ ...providerPlugin,
27
+ setup (api) {
28
+ statePlugin.setup(api);
29
+ providerPlugin.setup(api);
30
+ }
31
+ };
32
+ };
33
+ export { router_routerPlugin as routerPlugin };
@@ -1,5 +1,5 @@
1
1
  import "node:module";
2
- import { getRouterRuntimeState } from "@modern-js/runtime/context";
2
+ import { getRouterRuntimeState } from "@modern-js/runtime-extensions/router-state";
3
3
  function getTanstackRouterState(context) {
4
4
  const state = getRouterRuntimeState(context);
5
5
  if (void 0 === state || 'tanstack' !== state.framework || void 0 === state.instance) return;
@@ -14,6 +14,7 @@ function withGlobalLayout(Component, globalApp) {
14
14
  }
15
15
  function toTanstackRouteObject(route, globalApp) {
16
16
  if ('nested' === route.type) return {
17
+ modernLocalisedRoute: Reflect.get(route, 'modernLocalisedRoute'),
17
18
  path: route.path,
18
19
  id: route.id,
19
20
  loader: route.loader,
@@ -38,6 +39,7 @@ function toTanstackRouteObject(route, globalApp) {
38
39
  if ('function' != typeof route.component && 'object' != typeof route.component) return null;
39
40
  const LayoutComponent = withGlobalLayout(route.component, globalApp);
40
41
  return {
42
+ modernLocalisedRoute: Reflect.get(route, 'modernLocalisedRoute'),
41
43
  path: route.path,
42
44
  element: /*#__PURE__*/ react.createElement(LayoutComponent)
43
45
  };
@@ -1,9 +1,9 @@
1
1
  import type { AppTools, CliPlugin } from '@modern-js/app-tools';
2
- import { type TanstackRouteCodeSplittingOption } from './routeSplitting';
3
- export { generateTanstackRouteArtifacts, writeTanstackRegisterFile, writeTanstackRouterTypesForEntries, } from './artifacts';
4
- export type { TanstackRouteCodeSplittingOption, TanstackRsbuildRouteSplittingProfile, } from './routeSplitting';
5
- export { createTanstackRsbuildRouteSplittingProfile, resolveTanstackRouteCodeSplittingEnabled, } from './routeSplitting';
6
- export { type CollectCanonicalRoutesOptions, collectCanonicalRoutesForEntry, generateTanstackRouterTypesSourceForEntry, } from './tanstackTypes';
2
+ import { type TanstackRouteCodeSplittingOption } from './routeSplitting.js';
3
+ export { generateTanstackRouteArtifacts, writeTanstackRegisterFile, writeTanstackRouterTypesForEntries, } from './artifacts.js';
4
+ export type { TanstackRouteCodeSplittingOption, TanstackRsbuildRouteSplittingProfile, } from './routeSplitting.js';
5
+ export { createTanstackRsbuildRouteSplittingProfile, resolveTanstackRouteCodeSplittingEnabled, } from './routeSplitting.js';
6
+ export { type CollectCanonicalRoutesOptions, collectCanonicalRoutesForEntry, generateTanstackRouterTypesSourceForEntry, } from './tanstackTypes.js';
7
7
  export type TanstackRouterPluginOptions = {
8
8
  routesDir?: string;
9
9
  generatedDirName?: string;
@@ -1,5 +1,5 @@
1
1
  import type { NestedRouteForCli, PageRoute } from '@modern-js/types';
2
- export { toTanstackPath } from '../../runtime/routeTree/paths';
2
+ export { toTanstackPath } from '../../runtime/routeTree/paths.js';
3
3
  export declare function resolveFileNoExt(inputNoExtPath: string): Promise<string | null>;
4
4
  export declare function quote(str: string): string;
5
5
  export declare function normalizeRelativeImport(p: string): string;
@@ -1,3 +1,3 @@
1
- export type { CollectCanonicalRoutesOptions } from './tanstackTypes/canonicalRoutes';
2
- export { collectCanonicalRoutesForEntry } from './tanstackTypes/canonicalRoutes';
3
- export { generateTanstackRouterTypesSourceForEntry } from './tanstackTypes/source';
1
+ export type { CollectCanonicalRoutesOptions } from './tanstackTypes/canonicalRoutes.js';
2
+ export { collectCanonicalRoutesForEntry } from './tanstackTypes/canonicalRoutes.js';
3
+ export { generateTanstackRouterTypesSourceForEntry } from './tanstackTypes/source.js';
@@ -1,2 +1,2 @@
1
- export * from './cli/index';
2
- export { default } from './cli/index';
1
+ export * from './cli/index.js';
2
+ export { default } from './cli/index.js';
@@ -1,4 +1,5 @@
1
- export declare function createModernBasepathRewrite(basepath: string, caseSensitive?: boolean): {
1
+ import type { RouteObject } from '@modern-js/runtime-utils/router';
2
+ export declare function createModernBasepathRewrite(basepath: string, caseSensitive?: boolean, routes?: RouteObject[]): {
2
3
  input: ({ url }: {
3
4
  url: URL;
4
5
  }) => URL;
@@ -1,7 +1,7 @@
1
1
  import type React from 'react';
2
- import type { SubmitOptions, SubmitTarget } from './formData';
3
- export type { SubmitOptions } from './formData';
4
- export { RouteActionResponseError } from './submitAction';
2
+ import type { SubmitOptions, SubmitTarget } from './formData.js';
3
+ export type { SubmitOptions } from './formData.js';
4
+ export { RouteActionResponseError } from './submitAction.js';
5
5
  export type FetcherState = 'idle' | 'submitting' | 'loading';
6
6
  export type FormProps = Omit<React.FormHTMLAttributes<HTMLFormElement>, 'onSubmit' | 'action'> & {
7
7
  action?: string;
@@ -1,15 +1,15 @@
1
- import './register';
1
+ import './register.js';
2
2
  export * from '@tanstack/react-router';
3
- export type { Fetcher, FetcherState, FetcherSubmitOptions, FormProps, SubmitOptions, } from './dataMutation';
4
- export { Form, RouteActionResponseError, useFetcher, } from './dataMutation';
5
- export type { ModernRouterContext } from './loaderBridge';
6
- export { createRouteStaticData, isAbsoluteUrl, modernLoaderToTanstack, throwTanstackRedirect, } from './loaderBridge';
7
- export { Outlet } from './outlet';
8
- export { tanstackRouterPlugin, tanstackRouterPlugin as default, } from './plugin';
9
- export type { LinkProps, NavLinkProps, PrefetchBehavior, } from './prefetchLink';
10
- export { Link, NavLink } from './prefetchLink';
11
- export { useChildMatches, useMatch, useMatches, useParentMatches, useRouterState, } from './routeHooks';
12
- export type { TanstackRouterState } from './state';
13
- export { getTanstackRouterState } from './state';
14
- export type { RouterConfig } from './types';
15
- export { getModernTanstackRouterFastDefaults, modernTanstackRouterFastDefaults, } from './types';
3
+ export type { Fetcher, FetcherState, FetcherSubmitOptions, FormProps, SubmitOptions, } from './dataMutation.js';
4
+ export { Form, RouteActionResponseError, useFetcher, } from './dataMutation.js';
5
+ export type { ModernRouterContext } from './loaderBridge.js';
6
+ export { createRouteStaticData, isAbsoluteUrl, modernLoaderToTanstack, throwTanstackRedirect, } from './loaderBridge.js';
7
+ export { Outlet } from './outlet.js';
8
+ export { tanstackRouterPlugin, tanstackRouterPlugin as default, } from './plugin.js';
9
+ export type { LinkProps, NavLinkProps, PrefetchBehavior, } from './prefetchLink.js';
10
+ export { Link, NavLink } from './prefetchLink.js';
11
+ export { useChildMatches, useMatch, useMatches, useParentMatches, useRouterState, } from './routeHooks.js';
12
+ export type { TanstackRouterState } from './state.js';
13
+ export { getTanstackRouterState } from './state.js';
14
+ export type { RouterConfig } from './types.js';
15
+ export { getModernTanstackRouterFastDefaults, modernTanstackRouterFastDefaults, } from './types.js';
@@ -1,7 +1,14 @@
1
1
  /**
2
- * The router runtime state helpers are owned by @modern-js/runtime (the same
2
+ * The router runtime state helpers are owned by @modern-js/runtime-extensions (the same
3
3
  * implementation backs the built-in react-router provider and the SSR
4
4
  * pipeline). This module only re-exports them so every router provider
5
5
  * writes to the exact same runtime-context extension slot.
6
6
  */
7
- export { applyRouterRuntimeState, applyRouterServerPrepareResult, createRouterRuntimeState, createRouterServerSnapshot, getRouterRuntimeState, getRouterServerSnapshot, type RouterLifecycleContext, type RouterLifecyclePhase, } from '@modern-js/runtime/context';
7
+ import type { RouterLifecycleContext as NativeRouterLifecycleContext } from '@modern-js/runtime/context';
8
+ import type { InternalRouterServerSnapshot, RouterRouteMatchSnapshot } from '@modern-js/runtime-extensions/router-state';
9
+ export type RouterLifecycleContext = NativeRouterLifecycleContext & {
10
+ matches?: RouterRouteMatchSnapshot[];
11
+ cleanup?: () => void | Promise<void>;
12
+ serverSnapshot?: InternalRouterServerSnapshot;
13
+ };
14
+ export { applyRouterRuntimeState, applyRouterServerPrepareResult, createRouterRuntimeState, createRouterServerSnapshot, getRouterRuntimeState, getRouterServerSnapshot, type RouterLifecyclePhase, } from '@modern-js/runtime-extensions/router-state';
@@ -1,5 +1,5 @@
1
- import { createRouteStaticData } from '../shared/routeStaticData';
2
- import { isAbsoluteUrl } from './shared/isAbsoluteUrl';
1
+ import { createRouteStaticData } from '../shared/routeStaticData.js';
2
+ import { isAbsoluteUrl } from './shared/isAbsoluteUrl.js';
3
3
  export { createRouteStaticData, isAbsoluteUrl };
4
4
  /** Router context shape used by the generated TanStack router types. */
5
5
  export type ModernRouterContext = {
@@ -1,4 +1,4 @@
1
- import { type TanstackRouterRuntimePlugin } from './pluginShared';
2
- import { type RouterConfig } from './types';
1
+ import { type TanstackRouterRuntimePlugin } from './pluginShared.js';
2
+ import { type RouterConfig } from './types.js';
3
3
  export declare const tanstackRouterPlugin: (userConfig?: Partial<RouterConfig>) => TanstackRouterRuntimePlugin;
4
4
  export default tanstackRouterPlugin;
@@ -1,4 +1,4 @@
1
- import { type TanstackRouterRuntimePlugin } from './pluginShared';
2
- import { type RouterConfig } from './types';
1
+ import { type TanstackRouterRuntimePlugin } from './pluginShared.js';
2
+ import { type RouterConfig } from './types.js';
3
3
  export declare const tanstackRouterPlugin: (userConfig?: Partial<RouterConfig>) => TanstackRouterRuntimePlugin;
4
4
  export default tanstackRouterPlugin;
@@ -1 +1 @@
1
- export { default, tanstackRouterPlugin, } from './plugin.node';
1
+ export { default, tanstackRouterPlugin, } from './plugin.node.js';
@@ -1,7 +1,7 @@
1
1
  import { type TInternalRuntimeContext } from '@modern-js/runtime/context';
2
2
  import type { RouteObject } from '@modern-js/runtime-utils/router';
3
- import type { RouterExtendsHooks } from './hooks';
4
- import type { RouterConfig } from './types';
3
+ import type { RouterExtendsHooks } from './hooks.js';
4
+ import type { RouterConfig } from './types.js';
5
5
  type TanstackRouterRuntimeConfig = {
6
6
  plugins?: TanstackRouterRuntimePlugin[];
7
7
  router?: Partial<RouterConfig>;
@@ -1,10 +1,2 @@
1
- /**
2
- * Registers TanStack in the @modern-js/runtime compatibility registry.
3
- * Runtime entries bind the exported local factory into their own provider
4
- * realm; registration remains for older runtime wrappers and mixed cohorts.
5
- *
6
- * This module is intentionally side-effectful (see `sideEffects` in
7
- * package.json).
8
- */
9
- import { type RouterProviderFactory } from '@modern-js/runtime/context';
1
+ import { type RouterProviderFactory } from '@modern-js/runtime-extensions/router-provider';
10
2
  export declare const tanstackRouterProviderFactory: RouterProviderFactory;
@@ -1,5 +1,5 @@
1
1
  import type { RouteObject } from '@modern-js/runtime-utils/router';
2
2
  import type { AnyRouter } from '@tanstack/react-router';
3
- import type { ModernTanstackRootRoute, RouteTreeOptions } from './types';
3
+ import type { ModernTanstackRootRoute, RouteTreeOptions } from './types.js';
4
4
  export declare function createRouteTreeFromRouteObjects(routes: RouteObject[], options?: RouteTreeOptions): ModernTanstackRootRoute;
5
5
  export declare function getModernRouteIdsFromMatches(router: AnyRouter): string[];
@@ -1,2 +1,2 @@
1
- export { pickRouteModuleComponent } from './components';
2
- export { createRouteTreeFromRouteObjects, getModernRouteIdsFromMatches, } from './construction';
1
+ export { pickRouteModuleComponent } from './components.js';
2
+ export { createRouteTreeFromRouteObjects, getModernRouteIdsFromMatches, } from './construction.js';
@@ -1,4 +1,4 @@
1
1
  import type { RouteObject } from '@modern-js/runtime-utils/router';
2
- import type { RouteRevalidationState, RouteTreeOptions, TanstackLoaderContext } from './types';
2
+ import type { RouteRevalidationState, RouteTreeOptions, TanstackLoaderContext } from './types.js';
3
3
  export declare function createModernShouldReload(shouldRevalidate: unknown, state: RouteRevalidationState): ((ctx: TanstackLoaderContext) => boolean | undefined) | undefined;
4
4
  export declare function wrapRouteObjectLoader(route: RouteObject, revalidationState?: RouteRevalidationState, options?: RouteTreeOptions): ((ctx: TanstackLoaderContext) => Promise<unknown>) | undefined;
@@ -1,4 +1,4 @@
1
- import type { MutableTanstackRoute, TanstackRootRouteOptions, TanstackRouteOptions } from './types';
1
+ import type { MutableTanstackRoute, TanstackRootRouteOptions, TanstackRouteOptions } from './types.js';
2
2
  export declare function createTanstackRoute(options: TanstackRouteOptions): MutableTanstackRoute;
3
3
  export declare function createTanstackRootRoute(options: TanstackRootRouteOptions): MutableTanstackRoute;
4
4
  export declare function wrapRouteComponentWithModernContext(route: MutableTanstackRoute, component: unknown, routeId?: string): void;
@@ -1,13 +1,2 @@
1
- /**
2
- * Entry-injected router module for entrypoints that are NOT TanStack
3
- * file-route entrypoints (e.g. apps configuring
4
- * `router: { framework: 'tanstack', createRoutes }` in modern.runtime.ts).
5
- *
6
- * The CLI plugin injects `{ name: 'router', path: '<pkg>/runtime/router' }`
7
- * for those entries. This module creates a framework-resolving wrapper whose
8
- * app-owned provider realm contains this module graph's TanStack factory.
9
- */
10
- import * as runtimeRouter from '@modern-js/runtime/router/internal';
11
- type LegacyRouterPlugin = (typeof runtimeRouter)['routerPlugin'];
12
- export declare const routerPlugin: LegacyRouterPlugin;
13
- export {};
1
+ import { routerPlugin as nativeRouterPlugin } from '@modern-js/runtime/router/internal';
2
+ export declare const routerPlugin: typeof nativeRouterPlugin;
@@ -1,2 +1,2 @@
1
- import { type AnyCompositeComponent, type CompositeComponentProps } from './symbols';
1
+ import { type AnyCompositeComponent, type CompositeComponentProps } from './symbols.js';
2
2
  export declare function CompositeComponent<TComp extends AnyCompositeComponent>(props: CompositeComponentProps<TComp>): import("react").JSX.Element;
@@ -1,4 +1,4 @@
1
- import type { AnyRenderableServerComponent } from './symbols';
1
+ import type { AnyRenderableServerComponent } from './symbols.js';
2
2
  export declare function RscNodeRenderer({ data, }: {
3
3
  data: AnyRenderableServerComponent;
4
4
  }): import("react").JSX.Element;
@@ -1,7 +1,7 @@
1
- import { CompositeComponent } from './CompositeComponent';
2
- import type { SerializedTanstackRscFlightValue } from './shared';
3
- import type { AnyCompositeComponent, RscSlotUsageEvent } from './symbols';
4
- export type { AnyCompositeComponent, AnyRenderableServerComponent, CompositeComponentProps, } from './symbols';
1
+ import { CompositeComponent } from './CompositeComponent.js';
2
+ import type { SerializedTanstackRscFlightValue } from './shared.js';
3
+ import type { AnyCompositeComponent, RscSlotUsageEvent } from './symbols.js';
4
+ export type { AnyCompositeComponent, AnyRenderableServerComponent, CompositeComponentProps, } from './symbols.js';
5
5
  export { CompositeComponent };
6
6
  type SerializedRsc = {
7
7
  kind: 'renderable' | 'composite';
@@ -1,4 +1,4 @@
1
- import { type RscSlotUsageEvent, type ServerComponentStream } from './symbols';
1
+ import { type RscSlotUsageEvent, type ServerComponentStream } from './symbols.js';
2
2
  export declare function createRscProxy(getTree: () => unknown, options?: {
3
3
  renderable?: boolean;
4
4
  slotUsages?: RscSlotUsageEvent[];
@@ -1,5 +1,5 @@
1
1
  import type { ServerPayload } from '@modern-js/runtime/context';
2
- import { isAbsoluteUrl } from '../shared/isAbsoluteUrl';
2
+ import { isAbsoluteUrl } from '../shared/isAbsoluteUrl.js';
3
3
  export { isAbsoluteUrl };
4
4
  type PayloadDecoder = (stream: ReadableStream<Uint8Array>) => Promise<unknown>;
5
5
  export declare const payloadFetchCache: Map<string, Promise<ServerPayload>>;
@@ -1,6 +1,6 @@
1
1
  import type { ServerPayload } from '@modern-js/runtime/context';
2
- import type { TanstackPayloadRouterLike } from './payloadRoutes';
3
- export { __setTanstackRscPayloadDecoderForTests } from './payloadFetch';
2
+ import type { TanstackPayloadRouterLike } from './payloadRoutes.js';
3
+ export { __setTanstackRscPayloadDecoderForTests } from './payloadFetch.js';
4
4
  type LoadRouteDataOptions = {
5
5
  hasClientLoader?: boolean;
6
6
  loadClientData: () => Promise<unknown>;
@@ -1,5 +1,5 @@
1
1
  import type { ServerPayload } from '@modern-js/runtime/context';
2
- import type { TanstackRouterWithServerSsr } from '../ssrTypes';
2
+ import type { TanstackRouterWithServerSsr } from '../ssrTypes.js';
3
3
  export declare const setTanstackRscServerPayload: (payload: ServerPayload) => void;
4
4
  export declare const setTanstackRscRouter: (router: TanstackRouterWithServerSsr) => void;
5
5
  export declare const getTanstackRscRouter: () => TanstackRouterWithServerSsr | undefined;
@@ -1,8 +1,8 @@
1
1
  import { RawStream } from '@tanstack/router-core';
2
2
  import React from 'react';
3
- import { type AnyCompositeComponent, type AnyRenderableServerComponent, type RscSlotUsageEvent } from './symbols';
4
- export { CompositeComponent } from './CompositeComponent';
5
- export type { AnyCompositeComponent, AnyRenderableServerComponent, CompositeComponentProps, } from './symbols';
3
+ import { type AnyCompositeComponent, type AnyRenderableServerComponent, type RscSlotUsageEvent } from './symbols.js';
4
+ export { CompositeComponent } from './CompositeComponent.js';
5
+ export type { AnyCompositeComponent, AnyRenderableServerComponent, CompositeComponentProps, } from './symbols.js';
6
6
  export declare function renderServerComponent<TNode extends React.ReactNode>(node: TNode): Promise<TNode & AnyRenderableServerComponent<TNode>>;
7
7
  export declare function createCompositeComponent<TProps extends object = Record<string, unknown>, TReturn = React.ReactNode>(component: (props: TProps) => React.ReactNode | Promise<React.ReactNode>): Promise<AnyCompositeComponent<TProps, TReturn>>;
8
8
  type SerializedRsc = {
@@ -1,5 +1,5 @@
1
1
  import type React from 'react';
2
- import { type AnyCompositeComponent, type AnyRenderableServerComponent, type RscSlotUsageEvent } from './symbols';
2
+ import { type AnyCompositeComponent, type AnyRenderableServerComponent, type RscSlotUsageEvent } from './symbols.js';
3
3
  export declare const TANSTACK_RSC_FLIGHT_VALUE = "__modernTanstackRsc";
4
4
  export type SerializedTanstackRscFlightValue = {
5
5
  [TANSTACK_RSC_FLIGHT_VALUE]: true;
@@ -1,2 +1,2 @@
1
- import type { SerializableSlotArg } from './symbols';
1
+ import type { SerializableSlotArg } from './symbols.js';
2
2
  export declare function sanitizeSlotArgs(args: unknown[]): SerializableSlotArg[];
@@ -1,5 +1,5 @@
1
1
  import type { AnyRouter } from '@tanstack/react-router';
2
- import type { TanstackRouterWithServerSsr } from './ssrTypes';
2
+ import type { TanstackRouterWithServerSsr } from './ssrTypes.js';
3
3
  export declare function waitForRouterSerialization(tanstackRouter: TanstackRouterWithServerSsr): Promise<void>;
4
4
  export declare function routerManagedTagsToHtml(tags: unknown): string[];
5
5
  export declare function createGetSsrHref(request: Request): string;
@@ -1,2 +1,2 @@
1
- import type { TanstackRouterWithServerSsr } from './ssrTypes';
1
+ import type { TanstackRouterWithServerSsr } from './ssrTypes.js';
2
2
  export declare function preloadMatchedRouteComponents(tanstackRouter: TanstackRouterWithServerSsr): Promise<void>;
@@ -1,4 +1,4 @@
1
- import { type InternalRouterRuntimeState } from '@modern-js/runtime/context';
1
+ import { type InternalRouterRuntimeState } from '@modern-js/runtime-extensions/router-state';
2
2
  import type { AnyRouter } from '@tanstack/react-router';
3
3
  /**
4
4
  * Router runtime state as published by the TanStack router provider into the
@@ -1,5 +1,5 @@
1
1
  import type { AnyRouter } from '@tanstack/react-router';
2
- import type { SubmitOptions, SubmitTarget } from './formData';
2
+ import type { SubmitOptions, SubmitTarget } from './formData.js';
3
3
  export declare class RouteActionResponseError<TData = unknown> extends Error {
4
4
  readonly response: Response;
5
5
  readonly data: TData;
@@ -1,7 +1,8 @@
1
1
  import type { ModernRoute } from '@modern-js/runtime/context';
2
2
  import type { RouteObject } from '@modern-js/runtime-utils/router';
3
3
  import type React from 'react';
4
- export type { InternalRouterServerSnapshot, ModernRoute, RouterFramework, } from '@modern-js/runtime/context';
4
+ export type { ModernRoute } from '@modern-js/runtime/context';
5
+ export type { InternalRouterServerSnapshot, RouterFramework, } from '@modern-js/runtime-extensions/router-state';
5
6
  /** TanStack-specific router config. */
6
7
  export type RouterConfig = {
7
8
  routesConfig: {
@@ -1,6 +1,6 @@
1
1
  import type { RouteObject } from '@modern-js/runtime-utils/router';
2
2
  import React from 'react';
3
- import type { ModernRoute } from './types';
3
+ import type { ModernRoute } from './types.js';
4
4
  type RouterConfig = {
5
5
  routesConfig: {
6
6
  globalApp?: React.ComponentType<any>;
@@ -1 +1 @@
1
- export * from './runtime/index';
1
+ export * from './runtime/index.js';
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "modern.js",
19
19
  "tanstack-router"
20
20
  ],
21
- "version": "3.8.3-ultramodern.6",
21
+ "version": "3.9.0-ultramodern.10",
22
22
  "engines": {
23
23
  "node": ">=20"
24
24
  },
@@ -94,17 +94,19 @@
94
94
  }
95
95
  },
96
96
  "dependencies": {
97
- "@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.8.3-ultramodern.6",
98
- "@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.8.3-ultramodern.6",
99
- "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.8.3-ultramodern.6",
100
- "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.8.3-ultramodern.6",
97
+ "@modern-js/i18n-runtime-extensions": "npm:@bleedingdev/modern-js-i18n-runtime-extensions@3.9.0-ultramodern.10",
98
+ "@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.0-ultramodern.10",
99
+ "@modern-js/runtime-extensions": "npm:@bleedingdev/modern-js-runtime-extensions@3.9.0-ultramodern.10",
100
+ "@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.9.0-ultramodern.10",
101
+ "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.10",
102
+ "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.10",
101
103
  "@swc/helpers": "^0.5.23",
102
- "@tanstack/react-router": "1.170.32",
103
- "@tanstack/router-core": "1.171.27"
104
+ "@tanstack/react-router": "1.170.33",
105
+ "@tanstack/router-core": "1.171.28"
104
106
  },
105
107
  "peerDependencies": {
106
- "@modern-js/app-tools": "3.8.3-ultramodern.6",
107
- "@modern-js/runtime": "3.8.3-ultramodern.6",
108
+ "@modern-js/app-tools": "3.9.0-ultramodern.10",
109
+ "@modern-js/runtime": "3.9.0-ultramodern.10",
108
110
  "react": "^19.2.8",
109
111
  "react-dom": "^19.2.8",
110
112
  "react-server-dom-rspack": "0.1.0"
@@ -115,16 +117,17 @@
115
117
  }
116
118
  },
117
119
  "devDependencies": {
118
- "@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.8.3-ultramodern.6",
119
- "@modern-js/runtime": "npm:@bleedingdev/modern-js-runtime@3.8.3-ultramodern.6",
120
- "@rslib/core": "0.23.2",
120
+ "@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.9.0-ultramodern.10",
121
+ "@modern-js/runtime": "npm:@bleedingdev/modern-js-runtime@3.9.0-ultramodern.10",
122
+ "@modern-js/server-utils": "npm:@bleedingdev/modern-js-server-utils@3.9.0-ultramodern.10",
123
+ "@rslib/core": "1.0.0",
121
124
  "@scripts/rstest-config": "2.66.0",
122
- "@tanstack/history": "1.162.1",
123
- "@testing-library/react": "^16.3.2",
125
+ "@tanstack/history": "1.162.2",
126
+ "@testing-library/react": "^16.3.3",
124
127
  "@tsconfig/strictest": "2.0.8",
125
- "@types/node": "^26.2.0",
128
+ "@types/node": "^26.4.1",
126
129
  "@types/react": "^19.2.18",
127
- "@types/react-dom": "^19.2.4",
130
+ "@types/react-dom": "^19.2.7",
128
131
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
129
132
  "react": "^19.2.8",
130
133
  "react-dom": "^19.2.8",
package/rstest.config.mts CHANGED
@@ -1,4 +1,3 @@
1
- import path from 'node:path';
2
1
  import type { ProjectConfig } from '@rstest/core';
3
2
  import { withTestPreset } from '@scripts/rstest-config';
4
3
 
@@ -24,20 +23,13 @@ export default {
24
23
  name: 'plugin-tanstack-node',
25
24
  testEnvironment: 'node',
26
25
  include: [
27
- 'tests/realm-isolation.test.ts',
28
26
  'tests/router/cli.test.ts',
29
- 'tests/router/fastDefaults.test.ts',
30
27
  'tests/router/flightSerialization.roundtrip.test.tsx',
31
28
  'tests/router/generateRouteArtifacts.test.ts',
32
- 'tests/router/hooks.test.ts',
33
29
  'tests/router/loaderBridge.test.ts',
34
- 'tests/router/packageSurface.test.ts',
35
- 'tests/router/preloadRedirect.test.ts',
36
- 'tests/router/register.test.ts',
30
+ 'tests/router/localisedIdentity.test.tsx',
37
31
  'tests/router/routeHooks.test.ts',
38
32
  'tests/router/serverPlugin.test.ts',
39
- 'tests/router/rscDecoderSecurity.test.ts',
40
- 'tests/router/rscPayloadRouterMatrix.test.ts',
41
33
  'tests/router/rsc.test.tsx',
42
34
  'tests/router/slotUsageSanitizer.test.ts',
43
35
  'tests/router/ssrPreload.test.ts',
@@ -46,27 +38,12 @@ export default {
46
38
  ],
47
39
  extends: commonConfig,
48
40
  }),
49
- withTestPreset({
50
- name: 'plugin-tanstack-router-compatibility',
51
- testEnvironment: 'node',
52
- include: ['tests/router/routerCompatibility.test.ts'],
53
- resolve: {
54
- alias: {
55
- '@modern-js/runtime/router/internal': path.resolve(
56
- __dirname,
57
- 'tests/router/fixtures/legacyRuntimeRouter.ts',
58
- ),
59
- },
60
- },
61
- extends: commonConfig,
62
- }),
63
41
  withTestPreset({
64
42
  name: 'plugin-tanstack-client',
65
43
  testEnvironment: 'happy-dom',
66
44
  include: [
67
45
  'tests/router/clientHydration.test.tsx',
68
46
  'tests/router/dataMutation.test.tsx',
69
- 'tests/router/hydrationBoundary.test.tsx',
70
47
  'tests/router/prefetchLink.test.tsx',
71
48
  'tests/router/prefetchLinkPreload.test.tsx',
72
49
  ],