diff --git a/next.config.js b/next.config.js index fe88a09a0c4..38587e9ec6f 100644 --- a/next.config.js +++ b/next.config.js @@ -20,6 +20,14 @@ const nextConfig = { reactCompiler: true, }, env: {}, + async rewrites() { + return [ + { + source: '/:path*.md', + destination: '/api/raw-md/:path*', + }, + ]; + }, webpack: (config, {dev, isServer, ...options}) => { if (process.env.ANALYZE) { const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer'); diff --git a/package.json b/package.json index c2a84b1ea29..7f6e407090f 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "analyze": "ANALYZE=true next build", "dev": "next-remote-watch ./src/content", - "build": "next build && node --experimental-modules ./scripts/downloadFonts.mjs", + "build": "next build && node --experimental-modules ./scripts/downloadFonts.mjs && node scripts/generate-llms-txt.js", "lint": "next lint && eslint \"src/content/**/*.md\"", "lint:fix": "next lint --fix && eslint \"src/content/**/*.md\" --fix", "format:source": "prettier --config .prettierrc --write \"{plugins,src}/**/*.{js,ts,jsx,tsx,css}\"", @@ -21,6 +21,7 @@ "postinstall": "yarn --cwd eslint-local-rules install && is-ci || husky install .husky", "check-all": "npm-run-all prettier lint:fix tsc rss", "rss": "node scripts/generateRss.js", + "llms": "node scripts/generate-llms-txt.js", "deadlinks": "node scripts/deadLinkChecker.js", "copyright": "node scripts/copyright.js", "test:eslint-local-rules": "yarn --cwd eslint-local-rules test" diff --git a/public/llms.txt b/public/llms.txt new file mode 100644 index 00000000000..47ab2e99931 --- /dev/null +++ b/public/llms.txt @@ -0,0 +1,176 @@ +# React + +> The library for web and native user interfaces + +## Learn React + +- [Quick Start](https://react.dev/learn) + - [Tutorial: Tic-Tac-Toe](https://react.dev/learn/tutorial-tic-tac-toe) + - [Thinking in React](https://react.dev/learn/thinking-in-react) +- [Installation](https://react.dev/learn/installation) + - [Creating a React App](https://react.dev/learn/creating-a-react-app) + - [Build a React App from Scratch](https://react.dev/learn/build-a-react-app-from-scratch) + - [Add React to an Existing Project](https://react.dev/learn/add-react-to-an-existing-project) +- [Setup](https://react.dev/learn/setup) + - [Editor Setup](https://react.dev/learn/editor-setup) + - [Using TypeScript](https://react.dev/learn/typescript) + - [React Developer Tools](https://react.dev/learn/react-developer-tools) + - [Introduction](https://react.dev/learn/react-compiler/introduction) + - [Installation](https://react.dev/learn/react-compiler/installation) + - [Incremental Adoption](https://react.dev/learn/react-compiler/incremental-adoption) + - [Debugging and Troubleshooting](https://react.dev/learn/react-compiler/debugging) +- [Describing the UI](https://react.dev/learn/describing-the-ui) + - [Your First Component](https://react.dev/learn/your-first-component) + - [Importing and Exporting Components](https://react.dev/learn/importing-and-exporting-components) + - [Writing Markup with JSX](https://react.dev/learn/writing-markup-with-jsx) + - [JavaScript in JSX with Curly Braces](https://react.dev/learn/javascript-in-jsx-with-curly-braces) + - [Passing Props to a Component](https://react.dev/learn/passing-props-to-a-component) + - [Conditional Rendering](https://react.dev/learn/conditional-rendering) + - [Rendering Lists](https://react.dev/learn/rendering-lists) + - [Keeping Components Pure](https://react.dev/learn/keeping-components-pure) + - [Your UI as a Tree](https://react.dev/learn/understanding-your-ui-as-a-tree) +- [Adding Interactivity](https://react.dev/learn/adding-interactivity) + - [Responding to Events](https://react.dev/learn/responding-to-events) + - [State: A Component's Memory](https://react.dev/learn/state-a-components-memory) + - [Render and Commit](https://react.dev/learn/render-and-commit) + - [State as a Snapshot](https://react.dev/learn/state-as-a-snapshot) + - [Queueing a Series of State Updates](https://react.dev/learn/queueing-a-series-of-state-updates) + - [Updating Objects in State](https://react.dev/learn/updating-objects-in-state) + - [Updating Arrays in State](https://react.dev/learn/updating-arrays-in-state) +- [Managing State](https://react.dev/learn/managing-state) + - [Reacting to Input with State](https://react.dev/learn/reacting-to-input-with-state) + - [Choosing the State Structure](https://react.dev/learn/choosing-the-state-structure) + - [Sharing State Between Components](https://react.dev/learn/sharing-state-between-components) + - [Preserving and Resetting State](https://react.dev/learn/preserving-and-resetting-state) + - [Extracting State Logic into a Reducer](https://react.dev/learn/extracting-state-logic-into-a-reducer) + - [Passing Data Deeply with Context](https://react.dev/learn/passing-data-deeply-with-context) + - [Scaling Up with Reducer and Context](https://react.dev/learn/scaling-up-with-reducer-and-context) +- [Escape Hatches](https://react.dev/learn/escape-hatches) + - [Referencing Values with Refs](https://react.dev/learn/referencing-values-with-refs) + - [Manipulating the DOM with Refs](https://react.dev/learn/manipulating-the-dom-with-refs) + - [Synchronizing with Effects](https://react.dev/learn/synchronizing-with-effects) + - [You Might Not Need an Effect](https://react.dev/learn/you-might-not-need-an-effect) + - [Lifecycle of Reactive Effects](https://react.dev/learn/lifecycle-of-reactive-effects) + - [Separating Events from Effects](https://react.dev/learn/separating-events-from-effects) + - [Removing Effect Dependencies](https://react.dev/learn/removing-effect-dependencies) + - [Reusing Logic with Custom Hooks](https://react.dev/learn/reusing-logic-with-custom-hooks) + +## API Reference + +- [Hooks](https://react.dev/reference/react/hooks) + - [useActionState](https://react.dev/reference/react/useActionState) + - [useCallback](https://react.dev/reference/react/useCallback) + - [useContext](https://react.dev/reference/react/useContext) + - [useDebugValue](https://react.dev/reference/react/useDebugValue) + - [useDeferredValue](https://react.dev/reference/react/useDeferredValue) + - [useEffect](https://react.dev/reference/react/useEffect) + - [useEffectEvent](https://react.dev/reference/react/useEffectEvent) + - [useId](https://react.dev/reference/react/useId) + - [useImperativeHandle](https://react.dev/reference/react/useImperativeHandle) + - [useInsertionEffect](https://react.dev/reference/react/useInsertionEffect) + - [useLayoutEffect](https://react.dev/reference/react/useLayoutEffect) + - [useMemo](https://react.dev/reference/react/useMemo) + - [useOptimistic](https://react.dev/reference/react/useOptimistic) + - [useReducer](https://react.dev/reference/react/useReducer) + - [useRef](https://react.dev/reference/react/useRef) + - [useState](https://react.dev/reference/react/useState) + - [useSyncExternalStore](https://react.dev/reference/react/useSyncExternalStore) + - [useTransition](https://react.dev/reference/react/useTransition) +- [Components](https://react.dev/reference/react/components) + - [ (<>)](https://react.dev/reference/react/Fragment) + - [](https://react.dev/reference/react/Profiler) + - [](https://react.dev/reference/react/StrictMode) + - [](https://react.dev/reference/react/Suspense) + - [](https://react.dev/reference/react/Activity) + - [](https://react.dev/reference/react/ViewTransition) +- [APIs](https://react.dev/reference/react/apis) + - [act](https://react.dev/reference/react/act) + - [addTransitionType](https://react.dev/reference/react/addTransitionType) + - [cache](https://react.dev/reference/react/cache) + - [cacheSignal](https://react.dev/reference/react/cacheSignal) + - [captureOwnerStack](https://react.dev/reference/react/captureOwnerStack) + - [createContext](https://react.dev/reference/react/createContext) + - [lazy](https://react.dev/reference/react/lazy) + - [memo](https://react.dev/reference/react/memo) + - [startTransition](https://react.dev/reference/react/startTransition) + - [use](https://react.dev/reference/react/use) + - [experimental_taintObjectReference](https://react.dev/reference/react/experimental_taintObjectReference) + - [experimental_taintUniqueValue](https://react.dev/reference/react/experimental_taintUniqueValue) + - [useFormStatus](https://react.dev/reference/react-dom/hooks/useFormStatus) + - [Common (e.g.
)](https://react.dev/reference/react-dom/components/common) + - [
](https://react.dev/reference/react-dom/components/form) + - [](https://react.dev/reference/react-dom/components/input) + - [