@octanejs/tanstack-router 0.1.11 → 0.1.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octanejs/tanstack-router",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "engines": {
@@ -58,16 +58,16 @@
58
58
  "isbot": "^5.1.22"
59
59
  },
60
60
  "peerDependencies": {
61
- "octane": "0.1.12"
61
+ "octane": "0.1.13"
62
62
  },
63
63
  "devDependencies": {
64
- "@tanstack/react-router": "1.170.16",
65
- "@tsrx/react": "^0.2.44",
64
+ "@tanstack/react-router": "1.170.18",
65
+ "@tsrx/react": "^0.2.46",
66
66
  "esbuild": "^0.28.1",
67
- "react": "^19.2.0",
68
- "react-dom": "^19.2.0",
69
- "vitest": "^4.1.9",
70
- "octane": "0.1.12"
67
+ "react": "^19.2.7",
68
+ "react-dom": "^19.2.7",
69
+ "vitest": "^4.1.10",
70
+ "octane": "0.1.13"
71
71
  },
72
72
  "scripts": {
73
73
  "test": "vitest run"
package/src/Asset.tsrx CHANGED
@@ -4,7 +4,8 @@ import type { RouterManagedTag } from '@tanstack/router-core';
4
4
  import { useRouter } from './context.ts';
5
5
  import { useHydrated } from './ClientOnly.tsrx';
6
6
 
7
- export type AssetProps = RouterManagedTag & {
7
+ export type AssetProps =
8
+ RouterManagedTag & {
8
9
  assetKey: string;
9
10
  target: 'head' | 'body';
10
11
  };
@@ -97,9 +97,7 @@ export function ErrorComponent(props: {
97
97
  style="font-size:.7em;border:1px solid red;border-radius:.25rem;padding:.3rem;color:red;overflow:auto"
98
98
  >
99
99
  @if (props.error?.message) {
100
- <code>
101
- {props.error.message as string}
102
- </code>
100
+ <code>{props.error.message as string}</code>
103
101
  }
104
102
  </pre>
105
103
  </div>
package/src/Link.tsrx CHANGED
@@ -16,9 +16,15 @@ import type { LinkComponentProps, OctaneAnchorProps, UseLinkPropsOptions } from
16
16
  // Keep the generic implementation signature visible to `.tsrx` consumers so
17
17
  // route-aware `to`/`params`/`search` inference and native anchor event types are
18
18
  // available before declaration emit.
19
- export function Link<TRouter extends AnyRouter = RegisteredRouter, TFrom extends string = string, TTo extends | string
20
- | undefined = undefined, TMaskFrom extends string = TFrom, TMaskTo extends string = ''>(props: LinkComponentProps<'a', TRouter, TFrom, TTo, TMaskFrom, TMaskTo>) @{
21
- const { _asChild: AsChild, children, ...rest } = props as typeof props & {
19
+ export function Link<
20
+ TRouter extends AnyRouter = RegisteredRouter,
21
+ TFrom extends string = string,
22
+ TTo extends string | undefined = undefined,
23
+ TMaskFrom extends string = TFrom,
24
+ TMaskTo extends string = '',
25
+ >(props: LinkComponentProps<'a', TRouter, TFrom, TTo, TMaskFrom, TMaskTo>) @{
26
+ const { _asChild: AsChild, children, ...rest } = props as
27
+ typeof props & {
22
28
  _asChild?: any;
23
29
  };
24
30
  const linkProps = useLinkProps(
@@ -14,7 +14,8 @@ import { SafeFragment } from './SafeFragment.tsrx';
14
14
  // Upstream's `RouterProps` is `Omit<RouterOptions<…>, 'context'> & { router }` —
15
15
  // extra props reconfigure the instance via `router.update()`. The octane binding
16
16
  // keeps the router-typed member strict and the option passthrough permissive.
17
- export type RouterProps = {
17
+ export type RouterProps =
18
+ {
18
19
  router: AnyRouter;
19
20
  context?: Record<string, any>;
20
21
  } & Record<string, any>;
package/src/context.ts CHANGED
@@ -20,8 +20,7 @@ export function useRouter<TRouter extends AnyRouter = RegisteredRouter>(opts?: {
20
20
  }): TRouter;
21
21
  export function useRouter(...args: unknown[]): AnyRouter {
22
22
  const opts = (args.length && typeof args[0] !== 'symbol' ? args[0] : undefined) as
23
- | { router?: AnyRouter; warn?: boolean }
24
- | undefined;
23
+ { router?: AnyRouter; warn?: boolean } | undefined;
25
24
  const ctx = useContext(routerContext);
26
25
  const router = opts?.router ?? ctx;
27
26
  if (!router && opts?.warn !== false) {
@@ -18,6 +18,14 @@ import { compileToVolarMappings } from 'octane/compiler/volar';
18
18
  * @returns {string}
19
19
  */
20
20
  export function maskOctaneRouteSource(source, filename = 'route.tsrx') {
21
+ // Only .tsrx carries the native template dialect. Plain .ts/.tsx route
22
+ // files (robots.txt.ts-style server routes, shared route helpers) must
23
+ // pass through untouched — the TSRX parser is not a general TS parser and
24
+ // rejects valid TS it was never meant to see.
25
+ if (!filename.endsWith('.tsrx')) {
26
+ return source;
27
+ }
28
+
21
29
  const { sourceAst } = compileToVolarMappings(source, filename);
22
30
  const output = source.split('');
23
31
 
package/src/linkTypes.ts CHANGED
@@ -58,8 +58,7 @@ export type LinkProps<
58
58
 
59
59
  export interface LinkPropsChildren {
60
60
  children?:
61
- | OctaneRenderable
62
- | ((state: { isActive: boolean; isTransitioning: boolean }) => unknown);
61
+ OctaneRenderable | ((state: { isActive: boolean; isTransitioning: boolean }) => unknown);
63
62
  }
64
63
 
65
64
  export type CreateLinkProps = LinkProps<any, any, string, string, string, string>;
@@ -180,7 +180,8 @@ export function useBlocker(
180
180
 
181
181
  // Upstream's PromptProps: the blocker options plus optional children (a render
182
182
  // prop receiving the resolver, or plain renderables).
183
- export type PromptProps = (UseBlockerOpts | LegacyBlockerOpts) & {
183
+ export type PromptProps =
184
+ (UseBlockerOpts | LegacyBlockerOpts) & {
184
185
  children?: OctaneNode | ((params: BlockerResolver) => OctaneNode);
185
186
  };
186
187