diff --git a/.gitignore b/.gitignore index 5a079d62..6e45b579 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,8 @@ node_modules /.yalc yalc.lock /.local.tgz +.react-router/ **/gh-docs/__fixture__/tar.tgz -/NOTES.md \ No newline at end of file +/NOTES.md + diff --git a/app/routes.ts b/app/routes.ts index 12b77c7e..4c05936c 100644 --- a/app/routes.ts +++ b/app/routes.ts @@ -1,4 +1,4 @@ import { type RouteConfig } from "@react-router/dev/routes"; import { flatRoutes } from "@react-router/fs-routes"; -export const routes: RouteConfig = flatRoutes(); +export default flatRoutes() satisfies RouteConfig; diff --git a/app/routes/$.tsx b/app/routes/$.tsx index fb1dbe9a..bdd942c9 100644 --- a/app/routes/$.tsx +++ b/app/routes/$.tsx @@ -1,7 +1,7 @@ import { handleRedirects } from "~/lib/http.server"; -import type { LoaderFunctionArgs } from "react-router"; import { data, redirect } from "react-router"; import { getRepoDoc } from "~/lib/gh-docs"; +import type { Route } from "./+types/$"; // We use the catch-all route to attempt to find a doc for the given path. If a // doc isn't found, we return a 404 as expected. However we also log those @@ -48,7 +48,7 @@ function handleStaticFileRequests(param: string | undefined) { } } -export const loader = async ({ request, params }: LoaderFunctionArgs) => { +export const loader = async ({ request, params }: Route.LoaderArgs) => { // throw data({ butts: true }, { status: 401 }); handleRedirects(new URL(request.url).pathname); handleStaticFileRequests(params["*"]); diff --git a/app/routes/_extras.blog.$slug.tsx b/app/routes/_extras.blog.$slug.tsx index bb98c16a..1bbe9f95 100644 --- a/app/routes/_extras.blog.$slug.tsx +++ b/app/routes/_extras.blog.$slug.tsx @@ -1,11 +1,3 @@ -import type { - LinksFunction, - LoaderFunctionArgs, - MetaFunction, -} from "react-router"; -import { useLoaderData } from "react-router"; -import invariant from "tiny-invariant"; - import { getBlogPost } from "~/lib/blog.server"; import mdStyles from "~/styles/md.css?url"; import { useRef } from "react"; @@ -13,26 +5,23 @@ import { useDelegatedReactRouterLinks } from "~/ui/delegate-links"; import { Subscribe } from "~/ui/subscribe"; import cx from "clsx"; +import type { Route } from "./+types/_extras.blog.$slug"; -export const loader = async ({ params, request }: LoaderFunctionArgs) => { - let { slug } = params; - invariant(!!slug, "Expected slug param"); +export const loader = async ({ params, request }: Route.LoaderArgs) => { let requestUrl = new URL(request.url); let siteUrl = requestUrl.protocol + "//" + requestUrl.host; - let post = await getBlogPost(slug); + let post = await getBlogPost(params.slug); return { siteUrl, post }; }; -export const links: LinksFunction = () => [ +export const links: Route.LinksFunction = () => [ { rel: "stylesheet", href: mdStyles }, ]; -export const meta: MetaFunction = (args) => { - let { data, params } = args; +export function meta({ data, params }: Route.MetaArgs) { let { slug } = params; - invariant(!!slug, "Expected slug param"); let { siteUrl, post } = data || {}; if (!post) { @@ -73,10 +62,10 @@ export const meta: MetaFunction = (args) => { content: socialImageUrl ? post.imageAlt : undefined, }, ]; -}; +} -export default function BlogPost() { - let { post } = useLoaderData(); +export default function BlogPost({ loaderData }: Route.ComponentProps) { + let { post } = loaderData; let mdRef = useRef(null); useDelegatedReactRouterLinks(mdRef); diff --git a/app/routes/_extras.blog._index.tsx b/app/routes/_extras.blog._index.tsx index d88e8f8f..55007d10 100644 --- a/app/routes/_extras.blog._index.tsx +++ b/app/routes/_extras.blog._index.tsx @@ -1,14 +1,14 @@ import * as React from "react"; -import type { MetaFunction } from "react-router"; -import { useLoaderData, Link } from "react-router"; +import { Link } from "react-router"; import { Subscribe } from "~/ui/subscribe"; import { getBlogPostListings } from "~/lib/blog.server"; +import type { Route } from "./+types/_extras.blog._index"; export const loader = async () => { return { posts: await getBlogPostListings() }; }; -export const meta: MetaFunction = () => { +export const meta: Route.MetaFunction = () => { return [ { title: "Remix Blog" }, { @@ -18,11 +18,10 @@ export const meta: MetaFunction = () => { ]; }; -export default function Blog() { - const data = useLoaderData(); - const [latestPost, ...posts] = data.posts; +export default function Blog({ loaderData }: Route.ComponentProps) { + const [latestPost, ...posts] = loaderData.posts; - let featuredPosts = data.posts.filter((post) => post.featured); + let featuredPosts = loaderData.posts.filter((post) => post.featured); return (
= ({ data }) => { - let { siteUrl, resource } = data || {}; +export function meta({ data }: Route.MetaArgs) { + let { siteUrl, resource } = data; if (!resource) { return [{ title: "404 Not Found | Remix" }]; } @@ -39,10 +38,9 @@ export const meta: MetaFunction = ({ data }) => { siteUrl, image: socialImageUrl, }); -}; +} -export default function ResourcePage() { - let { resource } = useLoaderData(); +export default function ResourcePage({ loaderData }: Route.ComponentProps) { let { description, repoUrl, @@ -51,7 +49,7 @@ export default function ResourcePage() { starsFormatted, tags, readmeHtml, - } = resource; + } = loaderData.resource; return (
diff --git a/app/routes/_extras.showcase.tsx b/app/routes/_extras.showcase.tsx index 3863910e..3dc00e3f 100644 --- a/app/routes/_extras.showcase.tsx +++ b/app/routes/_extras.showcase.tsx @@ -1,12 +1,11 @@ -import type { LoaderFunctionArgs, MetaFunction } from "react-router"; -import { useLoaderData } from "react-router"; import { Fragment, forwardRef, useRef } from "react"; import type { ShowcaseExample } from "~/lib/showcase.server"; import { showcaseExamples } from "~/lib/showcase.server"; import { clsx } from "clsx"; import { useHydrated } from "~/ui/primitives/utils"; +import type { Route } from "./+types/_extras.showcase"; -export const loader = async ({ request }: LoaderFunctionArgs) => { +export const loader = async ({ request }: Route.LoaderArgs) => { let requestUrl = new URL(request.url); let siteUrl = requestUrl.protocol + "//" + requestUrl.host; @@ -14,8 +13,8 @@ export const loader = async ({ request }: LoaderFunctionArgs) => { }; // Stolen from _marketing._index.tsx. eventually would like to replace -export const meta: MetaFunction = (args) => { - let { siteUrl } = args.data || {}; +export function meta({ data }: Route.MetaArgs) { + let { siteUrl } = data; let title = "Remix Showcase"; let image = siteUrl ? `${siteUrl}/img/og.1.jpg` : null; let description = "See who is using Remix to build better websites."; @@ -34,10 +33,9 @@ export const meta: MetaFunction = (args) => { { name: "twitter:description", content: description }, { name: "twitter:image", content: image }, ]; -}; +} -export default function Showcase() { - let { showcaseExamples } = useLoaderData(); +export default function Showcase({ loaderData }: Route.ComponentProps) { // Might be a bit silly to declare here and then prop-drill, but was a little concerned about a needless useEffect+useState for every card let isHydrated = useHydrated(); @@ -56,7 +54,7 @@ export default function Showcase() {

    - {showcaseExamples.map((example, i) => { + {loaderData.showcaseExamples.map((example, i) => { let loading: ShowcaseTypes["loading"] = i < 6 ? "eager" : "lazy"; return ( diff --git a/app/routes/_marketing._index.tsx b/app/routes/_marketing._index.tsx index 4bab0bec..4b033289 100644 --- a/app/routes/_marketing._index.tsx +++ b/app/routes/_marketing._index.tsx @@ -1,11 +1,6 @@ -import { useLoaderData, data } from "react-router"; -import type { - MetaFunction, - HeadersFunction, - LoaderFunctionArgs, -} from "react-router"; +import { type HeadersFunction, data } from "react-router"; import { OutlineButtonLink, PrimaryButtonLink } from "~/ui/buttons"; -import { getMarkdownTutPage } from "~/lib/mdtut.server"; +import { getMarkdownTutPage, type Prose } from "~/lib/mdtut.server"; import "~/styles/index.css"; import { Red } from "~/ui/gradients"; import { BigTweet, TweetCarousel, tweets } from "~/ui/twitter-cards"; @@ -14,18 +9,19 @@ import invariant from "tiny-invariant"; import { Fragment } from "react"; import { getMeta } from "~/lib/meta"; import { CACHE_CONTROL } from "~/lib/http.server"; +import type { Route } from "./+types/_marketing._index"; -export const meta: MetaFunction = (args) => { - let { siteUrl } = args.data || {}; +export function meta({ data }: Route.MetaArgs) { + let { siteUrl } = data; let title = "Remix - Build Better Websites"; let image = siteUrl ? `${siteUrl}/img/og.1.jpg` : undefined; let description = "Remix is a full stack web framework that lets you focus on the user interface and work back through web standards to deliver a fast, slick, and resilient user experience. People are gonna love using your stuff."; return getMeta({ title, description, siteUrl, image }); -}; +} -export const loader = async ({ request }: LoaderFunctionArgs) => { +export const loader = async ({ request }: Route.LoaderArgs) => { let [[sample], [sampleSm], [, mutations], [, errors]] = await Promise.all([ getMarkdownTutPage("marketing/sample/sample.md"), getMarkdownTutPage("marketing/sample-sm/sample.md"), @@ -58,12 +54,12 @@ export const headers: HeadersFunction = ({ loaderHeaders }) => { return loaderHeaders; }; -export default function Index() { - let { mutations, errors } = useLoaderData(); +export default function Index({ loaderData }: Route.ComponentProps) { + let { mutations, errors, sample, sampleSm } = loaderData; return (
    - +

    Testimonials

    @@ -77,8 +73,7 @@ export default function Index() { ); } -function Hero() { - let { sample, sampleSm } = useLoaderData(); +function Hero({ sample, sampleSm }: { sample: Prose; sampleSm: Prose }) { return (

    Welcome to Remix

    diff --git a/app/routes/docs.$lang.$ref.$.tsx b/app/routes/docs.$lang.$ref.$.tsx index d6dd25cb..c42858e6 100644 --- a/app/routes/docs.$lang.$ref.$.tsx +++ b/app/routes/docs.$lang.$ref.$.tsx @@ -2,30 +2,25 @@ import * as React from "react"; import { Link, isRouteErrorResponse, - useLoaderData, useMatches, useParams, useRouteError, data, + useLoaderData, } from "react-router"; -import type { - HeadersFunction, - LoaderFunctionArgs, - MetaFunction, -} from "react-router"; +import type { HeadersFunction } from "react-router"; import { CACHE_CONTROL, handleRedirects } from "~/lib/http.server"; import invariant from "tiny-invariant"; import type { Doc } from "~/lib/gh-docs"; import { getRepoDoc } from "~/lib/gh-docs"; import iconsHref from "~/icons.svg"; import { useDelegatedReactRouterLinks } from "~/ui/delegate-links"; -import type { loader as docsLayoutLoader } from "~/routes/docs.$lang.$ref"; -import type { loader as rootLoader } from "~/root"; import { getMeta } from "~/lib/meta"; import { useEffect, useRef, useState } from "react"; import cx from "clsx"; +import type { Route } from "./+types/docs.$lang.$ref.$"; -export async function loader({ params, request }: LoaderFunctionArgs) { +export async function loader({ params, request }: Route.LoaderArgs) { let url = new URL(request.url); let baseUrl = url.protocol + "//" + url.host; let siteUrl = baseUrl + url.pathname; @@ -59,21 +54,9 @@ export const headers: HeadersFunction = ({ loaderHeaders }) => { return headers; }; -const LAYOUT_LOADER_KEY = "routes/docs.$lang.$ref"; - -type Loader = typeof loader; -type MatchLoaders = { - [LAYOUT_LOADER_KEY]: typeof docsLayoutLoader; - root: typeof rootLoader; -}; - -export const meta: MetaFunction = (args) => { - let { data } = args; - - let parentData = args.matches.find( - (match) => match.id === LAYOUT_LOADER_KEY, - )?.data; - let rootData = args.matches.find((match) => match.id === "root")?.data; +export function meta({ data, matches, params }: Route.MetaArgs) { + let rootData = matches[0].data; + let parentData = matches[1].data; invariant( parentData && "latestVersion" in parentData, "No parent data found", @@ -118,16 +101,16 @@ export const meta: MetaFunction = (args) => { additionalMeta: [ { name: "og:type", content: "article" }, { name: "og:site_name", content: "Remix" }, - { name: "docsearch:language", content: args.params.lang || "en" }, - { name: "docsearch:version", content: args.params.ref || "v1" }, + { name: "docsearch:language", content: params.lang || "en" }, + { name: "docsearch:version", content: params.ref || "v1" }, { name: "robots", content: robots }, { name: "googlebot", content: robots }, ], }); -}; +} export default function DocPage() { - let { doc } = useLoaderData(); + const { doc } = useLoaderData(); let ref = React.useRef(null); useDelegatedReactRouterLinks(ref); let matches = useMatches(); diff --git a/app/routes/docs.$lang._index.ts b/app/routes/docs.$lang._index.ts index b5da8bd7..0d8a1477 100644 --- a/app/routes/docs.$lang._index.ts +++ b/app/routes/docs.$lang._index.ts @@ -1,5 +1,6 @@ -import { redirect, type LoaderFunctionArgs } from "react-router"; -export async function loader({ params }: LoaderFunctionArgs) { - const { lang } = params; - return redirect(`/docs/${lang}/main`); +import { redirect } from "react-router"; +import type { Route } from "./+types/docs.$lang._index"; + +export async function loader({ params }: Route.LoaderArgs) { + return redirect(`/docs/${params.lang}/main`); } diff --git a/env.d.ts b/env.d.ts deleted file mode 100644 index 87010431..00000000 --- a/env.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -/// -/// diff --git a/package-lock.json b/package-lock.json index c13b0bcd..810b7701 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,8 +10,8 @@ "dependencies": { "@docsearch/css": "^3.5.2", "@docsearch/react": "^3.5.2", - "@react-router/express": "7.0.0-pre.5", - "@react-router/node": "7.0.0-pre.5", + "@react-router/express": "7.0.0-pre.6", + "@react-router/node": "7.0.0-pre.6", "cheerio": "^1.0.0-rc.12", "clsx": "^2.1.0", "compression": "^1.7.4", @@ -39,7 +39,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-is": "^18.2.0", - "react-router": "7.0.0-pre.5", + "react-router": "7.0.0-pre.6", "rehype-autolink-headings": "^7.1.0", "rehype-slug": "^6.0.0", "rehype-stringify": "^10.0.0", @@ -63,8 +63,8 @@ "zod": "^3.22.4" }, "devDependencies": { - "@react-router/dev": "7.0.0-pre.5", - "@react-router/fs-routes": "7.0.0-pre.5", + "@react-router/dev": "7.0.0-pre.6", + "@react-router/fs-routes": "7.0.0-pre.6", "@testing-library/jest-dom": "^6.2.0", "@types/eslint": "^9.6.1", "@types/follow-redirects": "^1.14.4", @@ -1605,6 +1605,12 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@mjackson/node-fetch-server": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@mjackson/node-fetch-server/-/node-fetch-server-0.2.0.tgz", + "integrity": "sha512-EMlH1e30yzmTpGLQjlFmaDAjyOeZhng1/XCd7DExR8PNAnG/G1tyruZxEoUe11ClnwGhGrtsdnyyUx1frSzjng==", + "license": "MIT" + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -2042,9 +2048,9 @@ } }, "node_modules/@react-router/dev": { - "version": "7.0.0-pre.5", - "resolved": "https://registry.npmjs.org/@react-router/dev/-/dev-7.0.0-pre.5.tgz", - "integrity": "sha512-U7mYFLwd+Gt/QikANHLZ5hnnUq731iW+gh+sfOFDZiDSvq2RGIqtvS6/WT2bEcC/G/tvjmrx2kVP30eSKOdCzw==", + "version": "7.0.0-pre.6", + "resolved": "https://registry.npmjs.org/@react-router/dev/-/dev-7.0.0-pre.6.tgz", + "integrity": "sha512-BhyxC+ku90IErL4lIuE6MvDw5irHLS4w0n+3VPGCOTemF3SVTMUG00Q2H5wbnMeM27zhn1XuCUWxvHJQwI+lrQ==", "dev": true, "license": "MIT", "dependencies": { @@ -2057,7 +2063,7 @@ "@babel/traverse": "^7.23.2", "@babel/types": "^7.22.5", "@npmcli/package-json": "^4.0.1", - "@react-router/node": "7.0.0-pre.5", + "@react-router/node": "7.0.0-pre.6", "arg": "^5.0.1", "babel-dead-code-elimination": "^1.0.6", "chokidar": "^4.0.0", @@ -2085,8 +2091,8 @@ "node": ">=20.0.0" }, "peerDependencies": { - "@react-router/serve": "^7.0.0-pre.5", - "react-router": "^7.0.0-pre.5", + "@react-router/serve": "^7.0.0-pre.6", + "react-router": "^7.0.0-pre.6", "typescript": "^5.1.0", "vite": "^5.1.0", "wrangler": "^3.28.2" @@ -2173,19 +2179,19 @@ } }, "node_modules/@react-router/express": { - "version": "7.0.0-pre.5", - "resolved": "https://registry.npmjs.org/@react-router/express/-/express-7.0.0-pre.5.tgz", - "integrity": "sha512-aIZmk1lJhVhOwO0rtpVs7uq1BXRYy3lfVaCgAtnQo26lW7eom6NnTX01joe39LYqf0K61V5eZHUAIsrI8qoWhQ==", + "version": "7.0.0-pre.6", + "resolved": "https://registry.npmjs.org/@react-router/express/-/express-7.0.0-pre.6.tgz", + "integrity": "sha512-GTq7E+yDAhSfHY8xbAscUVg9vAgwPSJzHPdcJpYYciMzT/FVjZEjS3cFVgP8MZnwB0Ac0d5pbaap+lxBiay7Vg==", "license": "MIT", "dependencies": { - "@react-router/node": "7.0.0-pre.5" + "@react-router/node": "7.0.0-pre.6" }, "engines": { "node": ">=20.0.0" }, "peerDependencies": { "express": "^4.17.1", - "react-router": "7.0.0-pre.5", + "react-router": "7.0.0-pre.6", "typescript": "^5.1.0" }, "peerDependenciesMeta": { @@ -2195,9 +2201,9 @@ } }, "node_modules/@react-router/fs-routes": { - "version": "7.0.0-pre.5", - "resolved": "https://registry.npmjs.org/@react-router/fs-routes/-/fs-routes-7.0.0-pre.5.tgz", - "integrity": "sha512-sOnZ7kl8eJj4+oRJ7gGZ+uTgwit2bWa+jGenIbGadqF/oHpFf6PwYd649GXGGpjjIx6EgM22Tb+dZzjyb25+nA==", + "version": "7.0.0-pre.6", + "resolved": "https://registry.npmjs.org/@react-router/fs-routes/-/fs-routes-7.0.0-pre.6.tgz", + "integrity": "sha512-eQTWVfksOqHumml9OywPFJZdCAekfIEzhvr6IlXrfq8BDGFHcezOs1D03ixAX3h+uwXcmW2cw1DqzyvHxZ82zg==", "dev": true, "license": "MIT", "dependencies": { @@ -2207,7 +2213,7 @@ "node": ">=20.0.0" }, "peerDependencies": { - "@react-router/dev": "^7.0.0-pre.5", + "@react-router/dev": "^7.0.0-pre.6", "typescript": "^5.1.0" }, "peerDependenciesMeta": { @@ -2217,12 +2223,12 @@ } }, "node_modules/@react-router/node": { - "version": "7.0.0-pre.5", - "resolved": "https://registry.npmjs.org/@react-router/node/-/node-7.0.0-pre.5.tgz", - "integrity": "sha512-meYaoDNs2F31v6BRGFikPCtoJ0VZfi7MTdlooc1wgxD/uO+GcV2i3RPLrvt2hXyDE59guz62Q73h+SiUlFMfeA==", + "version": "7.0.0-pre.6", + "resolved": "https://registry.npmjs.org/@react-router/node/-/node-7.0.0-pre.6.tgz", + "integrity": "sha512-9x0Tftl3SXBDev2s8SvK6tBtNPllgOHbFaIuFuID2XxcVcb4qJh6eYtCgBKgBOcj01/9NfwsQmfxzQEJVVUw0Q==", "license": "MIT", "dependencies": { - "@web3-storage/multipart-parser": "^1.0.0", + "@mjackson/node-fetch-server": "^0.2.0", "source-map-support": "^0.5.21", "stream-slice": "^0.1.2", "undici": "^6.19.2" @@ -2231,7 +2237,7 @@ "node": ">=20.0.0" }, "peerDependencies": { - "react-router": "7.0.0-pre.5", + "react-router": "7.0.0-pre.6", "typescript": "^5.1.0" }, "peerDependenciesMeta": { @@ -3388,12 +3394,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@web3-storage/multipart-parser": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@web3-storage/multipart-parser/-/multipart-parser-1.0.0.tgz", - "integrity": "sha512-BEO6al7BYqcnfX15W2cnGR+Q566ACXAT9UQykORCWW80lmkpWsnEob6zJS1ZVBKsSJC8+7vJkHwlp+lXG1UCdw==", - "license": "(Apache-2.0 AND MIT)" - }, "node_modules/accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", @@ -13905,16 +13905,14 @@ } }, "node_modules/react-router": { - "version": "7.0.0-pre.5", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.0.0-pre.5.tgz", - "integrity": "sha512-UGrqwmlTubhrtUzIu1WYb1z9FVeCqGi9RdywwjFrSQqIDTPjn7g5PPuFAS6pbVuj81VRI7HVzaljpzKXPDnfEQ==", + "version": "7.0.0-pre.6", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.0.0-pre.6.tgz", + "integrity": "sha512-ln9gXs3ilZLGdggPetKYWzxrmMNykTipWxSXHUcB0qSJECkPTe3NcKo8fJx6dQfS4gS1zhCXGpHWRVasinnxOw==", "license": "MIT", "dependencies": { "@types/cookie": "^0.6.0", - "@web3-storage/multipart-parser": "^1.0.0", "cookie": "^1.0.1", "set-cookie-parser": "^2.6.0", - "source-map": "^0.7.3", "turbo-stream": "2.4.0" }, "engines": { @@ -15140,9 +15138,10 @@ } }, "node_modules/search-insights": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/search-insights/-/search-insights-2.11.0.tgz", - "integrity": "sha512-Uin2J8Bpm3xaZi9Y8QibSys6uJOFZ+REMrf42v20AA3FUDUrshKkMEP6liJbMAHCm71wO6ls4mwAf7a3gFVxLw==", + "version": "2.17.3", + "resolved": "https://registry.npmjs.org/search-insights/-/search-insights-2.17.3.tgz", + "integrity": "sha512-RQPdCYTa8A68uM2jwxoY842xDhvx3E5LFL1LxvxCNMev4o5mLuokczhzjAgGwUZBAmOKZknArSxLKmXtIi2AxQ==", + "license": "MIT", "peer": true }, "node_modules/section-matter": { @@ -15336,14 +15335,6 @@ "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", "dev": true }, - "node_modules/source-map": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", - "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", - "engines": { - "node": ">= 8" - } - }, "node_modules/source-map-js": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", diff --git a/package.json b/package.json index 4911639c..8298557a 100644 --- a/package.json +++ b/package.json @@ -17,13 +17,13 @@ "lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .", "lint:fix": "npm run lint -- --fix", "test": "vitest", - "typecheck": "tsc -b" + "typecheck": "react-router typegen && tsc" }, "dependencies": { "@docsearch/css": "^3.5.2", "@docsearch/react": "^3.5.2", - "@react-router/express": "7.0.0-pre.5", - "@react-router/node": "7.0.0-pre.5", + "@react-router/express": "7.0.0-pre.6", + "@react-router/node": "7.0.0-pre.6", "cheerio": "^1.0.0-rc.12", "clsx": "^2.1.0", "compression": "^1.7.4", @@ -51,7 +51,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-is": "^18.2.0", - "react-router": "7.0.0-pre.5", + "react-router": "7.0.0-pre.6", "rehype-autolink-headings": "^7.1.0", "rehype-slug": "^6.0.0", "rehype-stringify": "^10.0.0", @@ -75,8 +75,8 @@ "zod": "^3.22.4" }, "devDependencies": { - "@react-router/dev": "7.0.0-pre.5", - "@react-router/fs-routes": "7.0.0-pre.5", + "@react-router/dev": "7.0.0-pre.6", + "@react-router/fs-routes": "7.0.0-pre.6", "@testing-library/jest-dom": "^6.2.0", "@types/eslint": "^9.6.1", "@types/follow-redirects": "^1.14.4", diff --git a/react-router.config.ts b/react-router.config.ts new file mode 100644 index 00000000..2bb2ed2e --- /dev/null +++ b/react-router.config.ts @@ -0,0 +1,7 @@ +import type { Config } from "@react-router/dev/config"; + +export default { + future: { + unstable_optimizeDeps: true, + }, +} satisfies Config; diff --git a/tsconfig.json b/tsconfig.json index 62294140..2b35872b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,13 @@ { - "include": ["env.d.ts", "**/*.ts", "**/*.tsx"], + "include": ["**/*.ts", "**/*.tsx", ".react-router/types/**/*"], "compilerOptions": { "lib": ["DOM", "DOM.Iterable", "ES2022"], - "types": ["vitest/globals", "vite-plugin-arraybuffer/types"], + "types": [ + "@react-router/node", + "vite/client", + "vitest/globals", + "vite-plugin-arraybuffer/types", + ], "esModuleInterop": true, "jsx": "react-jsx", "module": "ESNext", @@ -19,5 +24,6 @@ "allowJs": true, "isolatedModules": true, "resolveJsonModule": true, + "rootDirs": [".", "./.react-router/types"], }, }