Skip to content

Commit 82ef634

Browse files
committed
fixup!
1 parent 2a44862 commit 82ef634

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

apps/site/app/[locale]/page.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import { joinNested } from '#site/util/array';
2323
import type { PageParams } from '#site/router/page';
2424
import type { FC } from 'react';
2525

26-
2726
// Generates all possible static paths based on the locales and environment configuration
2827
// - Returns an empty array if static export is disabled (`ENABLE_STATIC_EXPORT` is false)
2928
// - If `ENABLE_STATIC_EXPORT_LOCALE` is true, generates paths for all available locales

apps/site/next.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const getDeploymentId = async () => {
2424
/** @type {import('next').NextConfig} */
2525
const nextConfig = {
2626
// Configure `pageExtensions` to include markdown and MDX files
27-
pageExtensions: ['js', 'jsx', 'md', 'mdx', 'ts', 'tsx'],
27+
pageExtensions: ['md', 'mdx', 'tsx'],
2828
// Full Support of React 18 SSR and Streaming
2929
reactCompiler: true,
3030
// We don't want to redirect with trailing slashes
@@ -92,7 +92,7 @@ const nextConfig = {
9292

9393
const withNextIntl = createNextIntlPlugin('./i18n.tsx');
9494
const withMDX = createMDX({
95-
extension: /\.(md|mdx)$/,
95+
extension: /\.mdx?$/,
9696
options: {
9797
remarkPlugins,
9898
rehypePlugins,

apps/site/router/index.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ const pathnameToFilename = new Map<string, string>();
2727
* Normalizes a path to always use forward slashes
2828
*/
2929
const normalizePath = (path: string): string =>
30-
normalize(path)
31-
.replace(/\\/g, '/')
32-
.replace(/^\. \//, '');
30+
normalize(path).replace(/\\/g, '/').replace(/^\.\//, '');
3331

3432
/**
3533
* Normalizes a filename into a pathname by removing file extensions and index suffixes
@@ -42,7 +40,7 @@ const normalizePathname = (filename: string): string => {
4240
pathname = pathname.slice(0, -1);
4341
}
4442

45-
return normalizePath(pathname);
43+
return pathname;
4644
};
4745

4846
/**
@@ -53,7 +51,7 @@ const tryImportMarkdown = async (
5351
pathname: string
5452
): Promise<MarkdownFile | null> => {
5553
const normalizedPath = normalizePath(pathname);
56-
const filename = pathnameToFilename.get(normalizedPath.replace(/^\.\//, ''));
54+
const filename = pathnameToFilename.get(normalizedPath);
5755

5856
if (!filename) {
5957
return null;
@@ -84,6 +82,7 @@ const tryImportMarkdown = async (
8482
export const getMarkdownFile = cache(
8583
async (locale: string, pathname: string): Promise<MarkdownFile | null> => {
8684
const localized = await tryImportMarkdown(locale, pathname);
85+
8786
if (localized) {
8887
return localized;
8988
}
@@ -182,9 +181,12 @@ export const getPageMetadata = cache(async (locale: string, path: string) => {
182181
* All available routes in the application
183182
*/
184183
export const allRoutes = (await getMarkdownFiles())
185-
.map(filename => {
184+
.map(f => {
185+
const filename = normalizePath(f);
186186
const pathname = normalizePathname(filename);
187+
187188
pathnameToFilename.set(pathname, filename);
189+
188190
return pathname;
189191
})
190192
.filter(Boolean);

apps/site/styles/index.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@
99
@import '@node-core/ui-components/styles/index.css';
1010
@import '@node-core/rehype-shiki/index.css';
1111
@import './locales.css';
12+
13+
@source '../../../packages/content/src';

0 commit comments

Comments
 (0)