Skip to content

Commit 9b434bb

Browse files
Merge pull request #356 from reactjs/sync-27d86ffe
Sync with react.dev @ 27d86ff
2 parents af526d9 + 8e66b4b commit 9b434bb

38 files changed

+3569
-1051
lines changed

scripts/deadLinkChecker.js

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const PUBLIC_DIR = path.join(__dirname, '../public');
1010
const fileCache = new Map();
1111
const anchorMap = new Map(); // Map<filepath, Set<anchorId>>
1212
const contributorMap = new Map(); // Map<anchorId, URL>
13+
const redirectMap = new Map(); // Map<source, destination>
1314
let errorCodes = new Set();
1415

1516
async function readFileWithCache(filePath) {
@@ -162,6 +163,22 @@ async function validateLink(link) {
162163
return {valid: true};
163164
}
164165

166+
// Check for redirects
167+
if (redirectMap.has(urlWithoutAnchor)) {
168+
const redirectDestination = redirectMap.get(urlWithoutAnchor);
169+
if (
170+
redirectDestination.startsWith('http://') ||
171+
redirectDestination.startsWith('https://')
172+
) {
173+
return {valid: true};
174+
}
175+
const redirectedLink = {
176+
...link,
177+
url: redirectDestination + (anchorMatch ? anchorMatch[0] : ''),
178+
};
179+
return validateLink(redirectedLink);
180+
}
181+
165182
// Check if it's an error code link
166183
const errorCodeMatch = urlWithoutAnchor.match(/^\/errors\/(\d+)$/);
167184
if (errorCodeMatch) {
@@ -295,17 +312,42 @@ async function fetchErrorCodes() {
295312
}
296313
const codes = await response.json();
297314
errorCodes = new Set(Object.keys(codes));
298-
console.log(chalk.gray(`Fetched ${errorCodes.size} React error codes\n`));
315+
console.log(chalk.gray(`Fetched ${errorCodes.size} React error codes`));
299316
} catch (error) {
300317
throw new Error(`Failed to fetch error codes: ${error.message}`);
301318
}
302319
}
303320

321+
async function buildRedirectsMap() {
322+
try {
323+
const vercelConfigPath = path.join(__dirname, '../vercel.json');
324+
const vercelConfig = JSON.parse(
325+
await fs.promises.readFile(vercelConfigPath, 'utf8')
326+
);
327+
328+
if (vercelConfig.redirects) {
329+
for (const redirect of vercelConfig.redirects) {
330+
redirectMap.set(redirect.source, redirect.destination);
331+
}
332+
console.log(
333+
chalk.gray(`Loaded ${redirectMap.size} redirects from vercel.json`)
334+
);
335+
}
336+
} catch (error) {
337+
console.log(
338+
chalk.yellow(
339+
`Warning: Could not load redirects from vercel.json: ${error.message}\n`
340+
)
341+
);
342+
}
343+
}
344+
304345
async function main() {
305346
const files = getMarkdownFiles();
306347
console.log(chalk.gray(`Checking ${files.length} markdown files...`));
307348

308349
await fetchErrorCodes();
350+
await buildRedirectsMap();
309351
await buildContributorMap();
310352
await buildAnchorMap(files);
311353

@@ -315,6 +357,7 @@ async function main() {
315357
const totalLinks = results.reduce((sum, r) => sum + r.totalLinks, 0);
316358

317359
if (deadLinks.length > 0) {
360+
console.log('\n');
318361
for (const link of deadLinks) {
319362
console.log(chalk.yellow(`${link.file}:${link.line}:${link.column}`));
320363
console.log(chalk.reset(` Link text: ${link.text}`));

src/components/Layout/HomeContent.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -755,9 +755,7 @@ function CommunityGallery() {
755755
}, []);
756756

757757
return (
758-
<div
759-
ref={ref}
760-
className="relative flex overflow-x-hidden overflow-y-visible w-auto">
758+
<div ref={ref} className="relative flex overflow-x-clip w-auto">
761759
<div
762760
className="w-full py-12 lg:py-20 whitespace-nowrap flex flex-row animate-marquee lg:animate-large-marquee"
763761
style={{
@@ -784,21 +782,26 @@ const CommunityImages = memo(function CommunityImages({isLazy}) {
784782
<div
785783
key={i}
786784
className={cn(
787-
`group flex justify-center px-5 min-w-[50%] lg:min-w-[25%] rounded-2xl relative`
785+
`group flex justify-center px-5 min-w-[50%] lg:min-w-[25%] rounded-2xl`
788786
)}>
789787
<div
790788
className={cn(
791-
'h-auto relative rounded-2xl overflow-hidden before:-skew-x-12 before:absolute before:inset-0 before:-translate-x-full group-hover:before:animate-[shimmer_1s_forwards] before:bg-gradient-to-r before:from-transparent before:via-white/10 before:to-transparent transition-all ease-in-out duration-300',
789+
'h-auto rounded-2xl before:rounded-2xl before:absolute before:pointer-events-none before:inset-0 before:transition-opacity before:-z-1 before:shadow-lg lg:before:shadow-2xl before:opacity-0 before:group-hover:opacity-100 transition-transform ease-in-out duration-300',
792790
i % 2 === 0
793-
? 'rotate-2 group-hover:rotate-[-1deg] group-hover:scale-110 group-hover:shadow-lg lg:group-hover:shadow-2xl'
794-
: 'group-hover:rotate-1 group-hover:scale-110 group-hover:shadow-lg lg:group-hover:shadow-2xl rotate-[-2deg]'
791+
? 'rotate-2 group-hover:rotate-[-1deg] group-hover:scale-110'
792+
: 'group-hover:rotate-1 group-hover:scale-110 rotate-[-2deg]'
795793
)}>
796-
<img
797-
loading={isLazy ? 'lazy' : 'eager'}
798-
src={src}
799-
alt={alt}
800-
className="aspect-[4/3] h-full w-full flex object-cover rounded-2xl bg-gray-10 dark:bg-gray-80"
801-
/>
794+
<div
795+
className={cn(
796+
'overflow-clip relative before:absolute before:inset-0 before:pointer-events-none before:-translate-x-full group-hover:before:animate-[shimmer_1s_forwards] before:bg-gradient-to-r before:from-transparent before:via-white/10 before:to-transparent transition-transform ease-in-out duration-300'
797+
)}>
798+
<img
799+
loading={isLazy ? 'lazy' : 'eager'}
800+
src={src}
801+
alt={alt}
802+
className="aspect-[4/3] h-full w-full flex object-cover rounded-2xl bg-gray-10 dark:bg-gray-80"
803+
/>
804+
</div>
802805
</div>
803806
</div>
804807
))}

src/content/blog/2024/10/21/react-compiler-beta-release.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ Or, if you're using Yarn:
7272
yarn add -D eslint-plugin-react-compiler@beta
7373
</TerminalBlock>
7474

75-
After installation you can enable the linter by [adding it to your ESLint config](/learn/react-compiler#installing-eslint-plugin-react-compiler). Using the linter helps identify Rules of React breakages, making it easier to adopt the compiler when it's fully released.
75+
After installation you can enable the linter by [adding it to your ESLint config](/learn/react-compiler/installation#eslint-integration). Using the linter helps identify Rules of React breakages, making it easier to adopt the compiler when it's fully released.
7676

7777
## Backwards Compatibility {/*backwards-compatibility*/}
7878

79-
React Compiler produces code that depends on runtime APIs added in React 19, but we've since added support for the compiler to also work with React 17 and 18. If you are not on React 19 yet, in the Beta release you can now try out React Compiler by specifying a minimum `target` in your compiler config, and adding `react-compiler-runtime` as a dependency. [You can find docs on this here](/learn/react-compiler#using-react-compiler-with-react-17-or-18).
79+
React Compiler produces code that depends on runtime APIs added in React 19, but we've since added support for the compiler to also work with React 17 and 18. If you are not on React 19 yet, in the Beta release you can now try out React Compiler by specifying a minimum `target` in your compiler config, and adding `react-compiler-runtime` as a dependency. [You can find docs on this here](/reference/react-compiler/configuration#react-17-18).
8080

8181
## Using React Compiler in libraries {/*using-react-compiler-in-libraries*/}
8282

@@ -86,7 +86,7 @@ React Compiler can also be used to compile libraries. Because React Compiler nee
8686

8787
Because your code is pre-compiled, users of your library will not need to have the compiler enabled in order to benefit from the automatic memoization applied to your library. If your library targets apps not yet on React 19, specify a minimum `target` and add `react-compiler-runtime` as a direct dependency. The runtime package will use the correct implementation of APIs depending on the application's version, and polyfill the missing APIs if necessary.
8888

89-
[You can find more docs on this here.](/learn/react-compiler#using-the-compiler-on-libraries)
89+
[You can find more docs on this here.](/reference/react-compiler/compiling-libraries)
9090

9191
## Opening up React Compiler Working Group to everyone {/*opening-up-react-compiler-working-group-to-everyone*/}
9292

src/content/community/meetups.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,6 @@ Do you have a local React.js meetup? Add it here! (Please keep the list alphabet
137137
## Portugal {/*portugal*/}
138138
* [Lisbon](https://www.meetup.com/JavaScript-Lisbon/)
139139

140-
## Scotland (UK) {/*scotland-uk*/}
141-
* [Edinburgh](https://www.meetup.com/React-Scotland/)
142-
143140
## Spain {/*spain*/}
144141
* [Barcelona](https://www.meetup.com/ReactJS-Barcelona/)
145142

src/content/learn/add-react-to-an-existing-project.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ title: किसी मौजूदा प्रोजेक्ट में Rea
2626

2727
यह सुनिश्चित करता है कि आपके ऐप का React हिस्सा हो सकता है [सर्वोत्तम प्रथाओं से लाभ](/learn/creating-a-react-app#full-stack-frameworks) उन फ्रेमवर्क में पका हुआ।
2828

29-
कई React-आधारित फ्रेमवर्क full-stack हैं और आपके React ऐप को सर्वर का लाभ उठाते हैं।हालाँकि, आप उसी दृष्टिकोण का उपयोग कर सकते हैं, भले ही आप सर्वर पर जावास्क्रिप्ट नहीं चलाना चाहते हैं या नहीं चाहते हैं।उस स्थिति में, HTML/CSS/JS निर्यात परोसें([`next export` output](https://nextjs.org/docs/advanced-features/static-html-export) Next.js के लिए, GATSBY के लिए डिफ़ॉल्ट) इसके `/some-app/` बजाय।
29+
Many React-based frameworks are full-stack and let your React app take advantage of the server. However, you can use the same approach even if you can't or don't want to run JavaScript on the server. In that case, serve the HTML/CSS/JS export ([`next export` output](https://nextjs.org/docs/advanced-features/static-html-export) for Next.js, default for Gatsby) at `/some-app/` instead.
3030

3131
## अपनी मौजूदा वेबसाइट के संपूर्ण सबरूट के लिए React का उपयोग करना {/*using-react-for-a-part-of-your-existing-page*/}
3232

0 commit comments

Comments
 (0)