react-router
Advanced tools
Comparing version 0.0.0-nightly-0061b031c-20241012 to 0.0.0-nightly-02b363c76-20241019
@@ -6,3 +6,3 @@ export type { InitialEntry, Location, Path, To } from "./lib/router/history"; | ||
export { IDLE_NAVIGATION, IDLE_FETCHER, IDLE_BLOCKER, } from "./lib/router/router"; | ||
export { data, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, redirect, redirectDocument, replace, resolvePath, } from "./lib/router/utils"; | ||
export { data, generatePath, isRouteErrorResponse, matchPath, matchRoutes, redirect, redirectDocument, replace, resolvePath, } from "./lib/router/utils"; | ||
export type { DataRouteMatch, DataRouteObject, IndexRouteObject, NavigateOptions, Navigator, NonIndexRouteObject, PatchRoutesOnNavigationFunction, PatchRoutesOnNavigationFunctionArgs, RouteMatch, RouteObject, } from "./lib/context"; | ||
@@ -40,3 +40,2 @@ export type { AwaitProps, IndexRouteProps, LayoutRouteProps, MemoryRouterProps, NavigateProps, OutletProps, PathRouteProps, RouteProps, RouterProps, RouterProviderProps, RoutesProps, } from "./lib/components"; | ||
export type { PageLinkDescriptor, HtmlLinkDescriptor, LinkDescriptor, } from "./lib/router/links"; | ||
export type { TypedResponse, JsonFunction, } from "./lib/server-runtime/responses"; | ||
export type { DataFunctionArgs, HeadersArgs, HeadersFunction, } from "./lib/server-runtime/routeModules"; | ||
@@ -43,0 +42,0 @@ export type { RequestHandler } from "./lib/server-runtime/server"; |
@@ -6,3 +6,2 @@ import "../global"; | ||
export type AppData = unknown; | ||
export declare function isResponse(value: any): value is Response; | ||
export declare function createRequestInit(request: Request): Promise<RequestInit>; |
@@ -519,2 +519,3 @@ import type { History, Location, Path, To } from "./history"; | ||
}) => boolean; | ||
export declare const redirectStatusCodes: Set<number>; | ||
export declare const IDLE_NAVIGATION: NavigationStates["Idle"]; | ||
@@ -541,2 +542,5 @@ export declare const IDLE_FETCHER: FetcherStates["Idle"]; | ||
export declare function isDataWithResponseInit(value: any): value is DataWithResponseInit<unknown>; | ||
export declare function isResponse(value: any): value is Response; | ||
export declare function isRedirectStatusCode(statusCode: number): boolean; | ||
export declare function isRedirectResponse(result: any): result is Response; | ||
export {}; |
@@ -1,2 +0,1 @@ | ||
import type { JsonFunction } from "../server-runtime/responses"; | ||
import type { Location, Path, To } from "./history"; | ||
@@ -427,9 +426,2 @@ /** | ||
export declare const normalizeHash: (hash: string) => string; | ||
/** | ||
* This is a shortcut for creating `application/json` responses. Converts `data` | ||
* to JSON and sets the `Content-Type` header. | ||
* | ||
* @category Utils | ||
*/ | ||
export declare const json: JsonFunction; | ||
export declare class DataWithResponseInit<D> { | ||
@@ -436,0 +428,0 @@ type: string; |
@@ -97,17 +97,11 @@ import type { Location } from "../router/history"; | ||
* // app/root.tsx | ||
* const loader = () => { | ||
* return json({ hello: "world" } as const) | ||
* } | ||
* const loader = () => ({ hello: "world" }) | ||
* export type Loader = typeof loader | ||
* | ||
* // app/routes/sales.tsx | ||
* const loader = () => { | ||
* return json({ salesCount: 1074 }) | ||
* } | ||
* const loader = () => ({ salesCount: 1074 }) | ||
* export type Loader = typeof loader | ||
* | ||
* // app/routes/sales/customers.tsx | ||
* const loader = () => { | ||
* return json({ customerCount: 74 }) | ||
* } | ||
* const loader = () => ({ customerCount: 74 }) | ||
* export type Loader = typeof loader | ||
@@ -120,5 +114,3 @@ * | ||
* | ||
* const loader = () => { | ||
* return json({ name: "Customer name" }) | ||
* } | ||
* const loader = () => ({ name: "Customer name" }) | ||
* | ||
@@ -125,0 +117,0 @@ * const meta: MetaFunction<typeof loader, { |
import type { DataWithResponseInit } from "./router/utils"; | ||
import type { AppLoadContext } from "./server-runtime/data"; | ||
import type { Jsonify } from "./server-runtime/jsonify"; | ||
import type { TypedResponse } from "./server-runtime/responses"; | ||
import type { Serializable } from "./server-runtime/single-fetch"; | ||
@@ -22,4 +20,4 @@ export type Expect<T extends true> = T; | ||
type DataFrom<T> = IsAny<T> extends true ? undefined : T extends Fn ? VoidToUndefined<Awaited<ReturnType<T>>> : undefined; | ||
type ClientData<T> = T extends TypedResponse<infer U> ? Jsonify<U> : T extends DataWithResponseInit<infer U> ? U : T; | ||
type ServerData<T> = T extends TypedResponse<infer U> ? Jsonify<U> : T extends DataWithResponseInit<infer U> ? Serialize<U> : Serialize<T>; | ||
type ClientData<T> = T extends DataWithResponseInit<infer U> ? U : T; | ||
type ServerData<T> = T extends DataWithResponseInit<infer U> ? Serialize<U> : Serialize<T>; | ||
type ServerDataFrom<T> = ServerData<DataFrom<T>>; | ||
@@ -47,16 +45,18 @@ type ClientDataFrom<T> = ClientData<DataFrom<T>>; | ||
] extends [true, true] ? ServerActionData | ClientActionData : IsDefined<ClientActionData> extends true ? ClientActionData : IsDefined<ServerActionData> extends true ? ServerActionData : undefined>; | ||
type DataFunctionArgs<Params> = { | ||
type ClientDataFunctionArgs<Params> = { | ||
request: Request; | ||
params: Params; | ||
context?: AppLoadContext; | ||
}; | ||
type ServerDataFunctionArgs<Params> = ClientDataFunctionArgs<Params> & { | ||
context: AppLoadContext; | ||
}; | ||
type Serialize<T> = T extends Serializable ? T : T extends (...args: any[]) => unknown ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? { | ||
[K in keyof T]: Serialize<T[K]>; | ||
} : undefined; | ||
export type CreateServerLoaderArgs<Params> = DataFunctionArgs<Params>; | ||
export type CreateClientLoaderArgs<Params, T extends RouteModule> = DataFunctionArgs<Params> & { | ||
export type CreateServerLoaderArgs<Params> = ServerDataFunctionArgs<Params>; | ||
export type CreateClientLoaderArgs<Params, T extends RouteModule> = ClientDataFunctionArgs<Params> & { | ||
serverLoader: () => Promise<ServerDataFrom<T["loader"]>>; | ||
}; | ||
export type CreateServerActionArgs<Params> = DataFunctionArgs<Params>; | ||
export type CreateClientActionArgs<Params, T extends RouteModule> = DataFunctionArgs<Params> & { | ||
export type CreateServerActionArgs<Params> = ServerDataFunctionArgs<Params>; | ||
export type CreateClientActionArgs<Params, T extends RouteModule> = ClientDataFunctionArgs<Params> & { | ||
serverAction: () => Promise<ServerDataFrom<T["action"]>>; | ||
@@ -63,0 +63,0 @@ }; |
/** | ||
* React Router v0.0.0-nightly-0061b031c-20241012 | ||
* React Router v0.0.0-nightly-02b363c76-20241019 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* React Router v0.0.0-nightly-0061b031c-20241012 | ||
* React Router v0.0.0-nightly-02b363c76-20241019 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* React Router v0.0.0-nightly-0061b031c-20241012 | ||
* React Router v0.0.0-nightly-02b363c76-20241019 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* React Router v0.0.0-nightly-0061b031c-20241012 | ||
* React Router v0.0.0-nightly-02b363c76-20241019 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* React Router v0.0.0-nightly-0061b031c-20241012 | ||
* React Router v0.0.0-nightly-02b363c76-20241019 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* React Router v0.0.0-nightly-0061b031c-20241012 | ||
* React Router v0.0.0-nightly-02b363c76-20241019 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
{ | ||
"name": "react-router", | ||
"version": "0.0.0-nightly-0061b031c-20241012", | ||
"version": "0.0.0-nightly-02b363c76-20241019", | ||
"description": "Declarative routing for React", | ||
@@ -48,3 +48,3 @@ "keywords": [ | ||
"turbo-stream": "2.4.0", | ||
"react-router": "0.0.0-nightly-0061b031c-20241012" | ||
"react-router": "0.0.0-nightly-02b363c76-20241019" | ||
}, | ||
@@ -51,0 +51,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
41875
13
6502693
81