Skip to content

Commit

Permalink
IS-422: Update React docs to v19 (#424)
Browse files Browse the repository at this point in the history
  • Loading branch information
kristersd authored Dec 8, 2024
1 parent 287ae4d commit 4d992f3
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/helpers/react-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { gitHubReadToken } from "./env";
const LOOKUP_REGEX = /<Intro>\s*(.*?)\s*<\/Intro>/gs;
const LINK_REGEX = /\[([^\]]+)\]\((?!https?:\/\/)([^)]+)\)/g;

const EXTRACT_SEARCH_KEY_REGEX = /(?<=!(docs|react-docs)\s)[^\s]+/;
const EXTRACT_SEARCH_KEY_REGEX = /(?<=!(docs|react-docs)\s)[^\s.]+/;

const BASE_URL =
"https://api.github.com/repos/reactjs/react.dev/contents/src/content/reference/";
Expand Down Expand Up @@ -60,21 +60,23 @@ const processReactDocumentation = (content: string) => {
const matches = [...patchedContentLinks.matchAll(LOOKUP_REGEX)];

if (matches.length > 0) {
const [introContent] = matches.map(([, match]) => match.trim());
const [introContent] = matches.map(([, match]) =>
match.trim().replace(/\n\n/g, "\n"),
);
return introContent;
}

return null;
};

const REACT_AVAILABLE_DOCS = [
"react/act",
"react/cache",
"react/Children",
"react/cloneElement",
"react/Component",
"react/createContext",
"react/createElement",
"react/createFactory",
"react/createRef",
"react/experimental_taintObjectReference",
"react/experimental_taintUniqueValue",
Expand All @@ -90,9 +92,8 @@ const REACT_AVAILABLE_DOCS = [
"react/startTransition",
"react/StrictMode",
"react/Suspense",
"react/use-client",
"react/use-server",
"react/use",
"react/useActionState",
"react/useCallback",
"react/useContext",
"react/useDebugValue",
Expand All @@ -111,18 +112,19 @@ const REACT_AVAILABLE_DOCS = [
"react/useTransition",
"react-dom/client/createRoot",
"react-dom/client/hydrateRoot",
"react-dom/hooks/useFormState",
"react-dom/createPortal",
"react-dom/flushSync",
"react-dom/hooks/useFormStatus",
"react-dom/server/renderToNodeStream",
"react-dom/preconnect",
"react-dom/prefetchDNS",
"react-dom/preinit",
"react-dom/preinitModule",
"react-dom/preload",
"react-dom/preloadModule",
"react-dom/server/renderToPipeableStream",
"react-dom/server/renderToReadableStream",
"react-dom/server/renderToStaticMarkup",
"react-dom/server/renderToStaticNodeStream",
"react-dom/server/renderToString",
"react-dom/unmountComponentAtNode",
"react-dom/hydrate",
"react-dom/render",
"react-dom/createPortal",
"react-dom/findDOMNode",
"react-dom/flushSync",
"react-dom/static/prerender",
"react-dom/static/prerenderToNodeStream",
];

0 comments on commit 4d992f3

Please sign in to comment.