@solidjs/router 2.0.0-next.22 → 2.0.0-next.23

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/fs.d.ts CHANGED
@@ -12,8 +12,8 @@ export type FileRouteConfig<S extends string = string, T = unknown, F = undefine
12
12
  }) & ([Sch] extends [undefined] ? {} : {
13
13
  search: Sch;
14
14
  }) & {
15
- preload?: RoutePreloadFunc<T>;
16
- info?: RouteInfo;
15
+ preload?: RoutePreloadFunc<T> | undefined;
16
+ info?: RouteInfo | undefined;
17
17
  };
18
18
  /**
19
19
  * Identity helper for a route file's `route` export that types `preload`'s
@@ -34,11 +34,11 @@ export type FileRouteConfig<S extends string = string, T = unknown, F = undefine
34
34
  * types (and any `search` schema) flow through the manifest into `paths`.
35
35
  */
36
36
  export declare function defineFileRoute<S extends string, T = unknown, const F = DefinedRouteFilters<S>, Sch extends StandardSchemaV1<any, any> | undefined = undefined>(path: S, config: {
37
- matchFilters?: F & ValidFilters<F, S>;
38
- preload?: (args: RoutePreloadFuncArgs<RouteParams<S>>) => T;
37
+ matchFilters?: (F & ValidFilters<F, S>) | undefined;
38
+ preload?: ((args: RoutePreloadFuncArgs<RouteParams<S>>) => T) | undefined;
39
39
  /** Standard Schema validator for this route's search params; its input type flows into the typed path proxy. */
40
40
  search?: Sch;
41
- info?: RouteInfo;
41
+ info?: RouteInfo | undefined;
42
42
  }): FileRouteConfig<S, T, F, Sch>;
43
43
  /** A code-split module ref: delivered as a dynamic import. */
44
44
  export interface FileRouteLazyRef<M = Record<string, unknown>> {
@@ -47,7 +47,7 @@ export interface FileRouteLazyRef<M = Record<string, unknown>> {
47
47
  }
48
48
  /** An eager module ref: its picked exports are imported statically. */
49
49
  export interface FileRouteEagerRef<M = Record<string, unknown>> {
50
- src?: string;
50
+ src?: string | undefined;
51
51
  require(): M;
52
52
  }
53
53
  /** The shape of a nested route-manifest entry the adapter consumes. */
package/dist/index.js CHANGED
@@ -971,7 +971,8 @@ function createBranches(routeDef, base = "", stack = [], branches = []) {
971
971
  for (let i = 0, len = routeDefs.length; i < len; i++) {
972
972
  const def = routeDefs[i];
973
973
  if (def && typeof def === "object") {
974
- if (!def.hasOwnProperty("path")) def.path = "";
974
+ // absent and explicitly `undefined` paths are the same pathless route
975
+ if (def.path === undefined) def.path = "";
975
976
  const routes = createRoutes(def, base);
976
977
  for (const route of routes) {
977
978
  stack.push(route);
@@ -32,9 +32,9 @@ export type DefinedRoute<S = undefined, T = unknown, F = undefined, C = undefine
32
32
  }) & ([Sch] extends [undefined] ? {} : {
33
33
  search: Sch;
34
34
  }) & {
35
- component?: RouteSectionComponent<T>;
36
- preload?: RoutePreloadFunc<T>;
37
- info?: RouteInfo;
35
+ component?: RouteSectionComponent<T> | undefined;
36
+ preload?: RoutePreloadFunc<T> | undefined;
37
+ info?: RouteInfo | undefined;
38
38
  };
39
39
  /**
40
40
  * Identity helper that types a single route from its own `path` pattern:
@@ -49,20 +49,20 @@ export type DefinedRoute<S = undefined, T = unknown, F = undefined, C = undefine
49
49
  */
50
50
  export declare function defineRoute<const S extends string | readonly string[], T = unknown, const F = DefinedRouteFilters<S>, const C extends RouteChildren | undefined = RouteChildren | undefined, Sch extends StandardSchemaV1<any, any> | undefined = undefined>(route: {
51
51
  path: S;
52
- matchFilters?: F & ValidFilters<F, S>;
53
- preload?: (args: RoutePreloadFuncArgs<RouteParams<S>>) => T;
54
- component?: DefinedRouteComponent<T, RouteParams<S>>;
52
+ matchFilters?: (F & ValidFilters<F, S>) | undefined;
53
+ preload?: ((args: RoutePreloadFuncArgs<RouteParams<S>>) => T) | undefined;
54
+ component?: DefinedRouteComponent<T, RouteParams<S>> | undefined;
55
55
  children?: C;
56
56
  /** Standard Schema validator for this route's search params; its input type flows into the typed path proxy. */
57
57
  search?: Sch;
58
- info?: RouteInfo;
58
+ info?: RouteInfo | undefined;
59
59
  }): DefinedRoute<S, T, F, C, Sch>;
60
60
  export declare function defineRoute<T = unknown, const C extends RouteChildren | undefined = RouteChildren | undefined, Sch extends StandardSchemaV1<any, any> | undefined = undefined>(route: {
61
- preload?: (args: RoutePreloadFuncArgs) => T;
62
- component?: DefinedRouteComponent<T, Params>;
61
+ preload?: ((args: RoutePreloadFuncArgs) => T) | undefined;
62
+ component?: DefinedRouteComponent<T, Params> | undefined;
63
63
  children?: C;
64
64
  search?: Sch;
65
- info?: RouteInfo;
65
+ info?: RouteInfo | undefined;
66
66
  }): DefinedRoute<undefined, T, undefined, C, Sch>;
67
67
  export interface RouterConfig<R extends readonly RouteDefinition[] = RouteDefinition[]> {
68
68
  /** The route tree. Immutable per instance — it is the source of truth for matching *and* types. */
package/dist/routing.js CHANGED
@@ -421,7 +421,8 @@ export function createBranches(routeDef, base = "", stack = [], branches = []) {
421
421
  for (let i = 0, len = routeDefs.length; i < len; i++) {
422
422
  const def = routeDefs[i];
423
423
  if (def && typeof def === "object") {
424
- if (!def.hasOwnProperty("path"))
424
+ // absent and explicitly `undefined` paths are the same pathless route
425
+ if (def.path === undefined)
425
426
  def.path = "";
426
427
  const routes = createRoutes(def, base);
427
428
  for (const route of routes) {
package/dist/types.d.ts CHANGED
@@ -162,14 +162,14 @@ export type LazyRouteChildren = () => readonly RouteDefinition[] | Promise<reado
162
162
  routes: readonly RouteDefinition[];
163
163
  }>;
164
164
  export type RouteDefinition<S extends string | string[] = any, T = any> = {
165
- path?: S;
166
- matchFilters?: MatchFilters<S>;
167
- preload?: RoutePreloadFunc<T>;
168
- children?: RouteDefinition | readonly RouteDefinition[] | LazyRouteChildren;
169
- component?: RouteSectionComponent<T>;
165
+ path?: S | undefined;
166
+ matchFilters?: MatchFilters<S> | undefined;
167
+ preload?: RoutePreloadFunc<T> | undefined;
168
+ children?: RouteDefinition | readonly RouteDefinition[] | LazyRouteChildren | undefined;
169
+ component?: RouteSectionComponent<T> | undefined;
170
170
  /** Standard Schema validator for this route's search params; its input type flows into the typed path proxy. */
171
- search?: StandardSchemaV1<any, any>;
172
- info?: RouteInfo;
171
+ search?: StandardSchemaV1<any, any> | undefined;
172
+ info?: RouteInfo | undefined;
173
173
  };
174
174
  import type { RouteInfo } from "./index.jsx";
175
175
  export type { RouteInfo };
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "Ryan Turnquist"
7
7
  ],
8
8
  "license": "MIT",
9
- "version": "2.0.0-next.22",
9
+ "version": "2.0.0-next.23",
10
10
  "homepage": "https://github.com/solidjs/solid-router#readme",
11
11
  "repository": {
12
12
  "type": "git",