diff --git a/bun.lockb b/bun.lockb index d24d82a..3146796 100644 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/components/container.tsx b/components/container.tsx deleted file mode 100644 index 39e3af7..0000000 --- a/components/container.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { JSX } from "react"; - -export type ChildrenType = JSX.Element| Array; - -function Container(props: { children?: ChildrenType, ignore?: boolean }) { - if (props.ignore) - return <>{props.children}; - return ( -
- {props.children} -
- ); -} - -export default Container; \ No newline at end of file diff --git a/components/layout.tsx b/components/layout.tsx deleted file mode 100644 index 5fff3f3..0000000 --- a/components/layout.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import Title from './title'; -import Container, { ChildrenType } from './container'; - -type LayoutProps = { - children?: ChildrenType, - removeContainer?: boolean, -}; - -function Layout(props: LayoutProps) { - return ( - <> - - <Container ignore={props.removeContainer}> - {props.children} - </Container> - </> - ); -} - -export default Layout; diff --git a/next-env.d.ts b/next-env.d.ts index a4a7b3f..3cd7048 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -1,5 +1,6 @@ /// <reference types="next" /> /// <reference types="next/image-types/global" /> +/// <reference types="next/navigation-types/compat/navigation" /> // NOTE: This file should not be edited -// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information. +// see https://nextjs.org/docs/app/api-reference/config/typescript for more information. diff --git a/next.config.ts b/next.config.ts index 821f2bd..1f9905d 100644 --- a/next.config.ts +++ b/next.config.ts @@ -3,14 +3,19 @@ import NextBundleAnalyzer from '@next/bundle-analyzer'; let config: NextConfig = { reactStrictMode: true, - i18n: { - locales: ['en-US'], - defaultLocale: 'en-US' + turbopack: { + rules: { + '*.txt': { + as: '*.js', + loaders: ['raw-loader'], + }, + '*.md': { + as: '*.js', + loaders: ['raw-loader'], + } + }, + resolveExtensions: ['.txt', '.md', '.tsx', '.ts', '.js'] }, - // not sure why this breaks prod build in the latest version - // aah it's so frustrating to deal with an warning log that - // shows up regardless of the config but its presence halts - // the entire thing. webpack: (config, _options) => { config.module.rules.push( { diff --git a/notes/programming-resources.md b/notes/programming-resources.md index 2c58795..3141c12 100644 --- a/notes/programming-resources.md +++ b/notes/programming-resources.md @@ -7,13 +7,6 @@ refer to someone or within something. - https://www.gingerbill.org/series/memory-allocation-strategies/ -## Untangling Lifetimes: The Arena Allocator - -Making performant dynamic manual memory management in C feel almost like -garbage collection. - -- https://www.rfleury.com/p/untangling-lifetimes-the-arena-allocator - ## Immediate-Mode Graphical User Interfaces (2005) - https://caseymuratori.com/blog_0001 diff --git a/notes/references.md b/notes/references.md new file mode 100644 index 0000000..a9470ec --- /dev/null +++ b/notes/references.md @@ -0,0 +1,3 @@ +# References + +## [Intel® 64 and IA-32 Architectures Software Developer’s Manual](https://software.intel.com/en-us/download/intel-64-and-ia-32-architectures-sdm-combined-volumes-1-2a-2b-2c-2d-3a-3b-3c-3d-and-4) diff --git a/package.json b/package.json index 0ec1505..0acbfe5 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,18 @@ { "private": true, "scripts": { - "prebuild": "node ./scripts/generate-metadata.js", - "dev": "next dev", - "build": "next build", + "prebuild": "node ./scripts/generate-metadata.js", + "dev": "next dev --turbopack", + "build": "next build --turbopack", "start": "next start", "lint": "next lint" }, "dependencies": { "dotenv": "^16.3.1", "highlight.js": "^11.10.0", - "next": "^15.0.4", + "next": "^15.3.1", "normalize.css": "^8.0.1", + "raw-loader": "^4.0.2", "react": "^19.0.0", "react-dom": "^19.0.0", "react-markdown": "^9.0.1", diff --git a/pages/_app.tsx b/pages/_app.tsx deleted file mode 100644 index 8ee379d..0000000 --- a/pages/_app.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import type { AppProps } from 'next/app' -import 'normalize.css'; -import '../styles/global.css'; - -export default function App({ Component, pageProps }: AppProps) { - return <Component {...pageProps} /> -} \ No newline at end of file diff --git a/pages/_document.tsx b/pages/_document.tsx deleted file mode 100644 index b2fff8b..0000000 --- a/pages/_document.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { Html, Head, Main, NextScript } from "next/document"; - -export default function Document() { - return ( - <Html lang="en"> - <Head /> - <body> - <Main /> - <NextScript /> - </body> - </Html> - ); -} diff --git a/pages/about.tsx b/src/app/about/page.tsx similarity index 85% rename from pages/about.tsx rename to src/app/about/page.tsx index 80fa284..68b1338 100644 --- a/pages/about.tsx +++ b/src/app/about/page.tsx @@ -1,22 +1,20 @@ import ReactMarkdown from 'react-markdown'; -import ReadmeMd from '../README.md'; -import License from '../LICENSE.txt'; -import Layout from '../components/layout'; +import ReadmeMd from '../../../README.md'; +import License from '../../../LICENSE.txt'; function AboutPage() { return ( - <Layout > + <> <section className='block'> <p>Paul's Personal Website.</p> - <p> You can find me on the following: + <p> You can find me on the following platforms:</p> <ul> <li>X/Twitter: <a href='https://x.com/paulw_xyz'>paulw_xyz</a></li> <li>GitHub: <a href='https://github.com/paulwxyz'>paulwxyz</a></li> - <li>BlueSky (unused): <a href='https://bsky.app/profile/@paulw.xyz'>@paulw.xyz</a></li> + {/* <li>BlueSky (unused): <a href='https://bsky.app/profile/@paulw.xyz'>@paulw.xyz</a></li> */} <li><a href='https://git.paulw.xyz/xyz'>git.paulw.xyz</a></li> </ul> - </p> <p> The original motivation was to just play with Next.js as it pretty much did the things I wanted web pages to do. But it came at the cost of needless complexity. As I use the JavaScript/ECMAScript/Whatever-you-want-to-call-it-script more and more, I am convinced that it is not a platform worth pursuing because the more complex it gets, the less control I have over what it does and this platform and its users seems to be okay with that sort of loss. I have been instead pivoting toward things that impressed and got me interested in working with computers.</p> <p>Most services/products are keen on going against the <a href='https://stephango.com/file-over-app'>file over app</a> philosophy which entails prioritizing data over software and anticipate and embrace the eventual death of software. People instead want subscription services that barely support open formats and sometimes do not support exporting data to commonly used formats. The goal here is to avoid storing artifacts under locations that are easily not accessible, not under my control, and does not lock me out of using it with other software. The only reason I have not completely abandoned this is thanks to my decision to rely on Markdown files alone. Had it been reliant on any cloud software, I would have started over.</p> @@ -31,14 +29,14 @@ function AboutPage() { <section className='block'> <h2>README</h2> <ReactMarkdown> - {ReadmeMd.replace(/^#{1,5} /g, (s: string) => { return `#${s}` })} + {ReadmeMd.replace(/^#{6}\s+(.*)\s+$/gm, (s: string, a) => `**${a}**\n`).replace(/^#{1,5} /gm, (s: string) => { return `##${s}` })} </ReactMarkdown> </section> <section className='block'> <h2>LICENSE</h2> <pre className='license'>{License}</pre> </section> - </Layout> + </> ); } diff --git a/src/app/components/container.tsx b/src/app/components/container.tsx new file mode 100644 index 0000000..bb8869c --- /dev/null +++ b/src/app/components/container.tsx @@ -0,0 +1,9 @@ +export default function Container(props: { children?: React.ReactNode, ignore?: boolean }) { + if (props.ignore) + return <>{props.children}</>; + return ( + <div className='container'> + {props.children} + </div> + ); +} diff --git a/components/quick-links.tsx b/src/app/components/quick-links.tsx similarity index 88% rename from components/quick-links.tsx rename to src/app/components/quick-links.tsx index df951bc..bf49a0c 100644 --- a/components/quick-links.tsx +++ b/src/app/components/quick-links.tsx @@ -1,5 +1,5 @@ import Link from 'next/link'; -import Pages from '../public/external.json'; +import Pages from '../../../public/external.json'; function QuickLinks() { return ( diff --git a/components/recent-notes.tsx b/src/app/components/recent-notes.tsx similarity index 94% rename from components/recent-notes.tsx rename to src/app/components/recent-notes.tsx index b61a2e1..e5ed52e 100644 --- a/components/recent-notes.tsx +++ b/src/app/components/recent-notes.tsx @@ -1,5 +1,5 @@ import Link from "next/link"; -import NotesInfo from '../public/notes.json'; +import NotesInfo from '../../../public/notes.json'; function RecentNotes() { const notes = Object.entries(NotesInfo) diff --git a/styles/recent-posts.module.css b/src/app/components/recent-posts.module.css similarity index 100% rename from styles/recent-posts.module.css rename to src/app/components/recent-posts.module.css diff --git a/components/recent-posts.tsx b/src/app/components/recent-posts.tsx similarity index 91% rename from components/recent-posts.tsx rename to src/app/components/recent-posts.tsx index f070840..dadbd09 100644 --- a/components/recent-posts.tsx +++ b/src/app/components/recent-posts.tsx @@ -1,7 +1,7 @@ import Link from "next/link"; import { toRelativeDate } from "../lib/date"; -import style from '../styles/recent-posts.module.css'; -import PostsInfo from '../public/posts.json'; +import style from './recent-posts.module.css'; +import PostsInfo from '../../../public/posts.json'; function PostBlock({ slug, otime, title }: { slug: string, otime: string, title: string }) { return ( diff --git a/styles/title.module.css b/src/app/components/title.module.css similarity index 100% rename from styles/title.module.css rename to src/app/components/title.module.css diff --git a/components/title.tsx b/src/app/components/title.tsx similarity index 83% rename from components/title.tsx rename to src/app/components/title.tsx index 3c93564..ce0e1e1 100644 --- a/components/title.tsx +++ b/src/app/components/title.tsx @@ -1,10 +1,10 @@ +'use client' import Link from 'next/link'; -import { useRouter } from 'next/router'; +import { usePathname } from 'next/navigation'; import { Fragment } from 'react'; -import style from '../styles/title.module.css'; -import SiteMap from '../public/sitemap.json'; -import Head from 'next/head'; +import style from './title.module.css'; +import SiteMap from '../../../public/sitemap.json'; import { Sites } from '../lib/site'; function createPathElements(ancestors: Array<{ name: string, path: string }>) { @@ -20,19 +20,17 @@ function createPathElements(ancestors: Array<{ name: string, path: string }>) { }); } -function Title() { - - const router = useRouter(); - const pagePath = router.asPath; +export default function Title() { + const pagePath = usePathname(); const splitPath: Array<{ name: string, path: string }> = []; // TODO(Paul): clean this up let currRoot: Sites = SiteMap.pages; let title: string | null = null; - if (pagePath !== '/') { + if (pagePath && pagePath !== '/') { const subPaths = pagePath.split('?')[0].split('#')[0].split('/'); for (const p of subPaths.slice(1, subPaths.length)) { - if (!p) + if (!p || !currRoot[p]) continue; splitPath.push({ name: currRoot[p].title, path: p }); @@ -50,9 +48,9 @@ function Title() { const pathElements = splitPath && createPathElements(splitPath) || <></>; return ( <> - <Head> + {/* <head> <title>{title && `${title} | PaulW.XYZ` || 'PaulW.XYZ'} - + */}

{title || 'PaulW.XYZ'} @@ -68,5 +66,3 @@ function Title() { ); } - -export default Title; diff --git a/styles/global.css b/src/app/global.css similarity index 100% rename from styles/global.css rename to src/app/global.css diff --git a/src/app/layout.tsx b/src/app/layout.tsx new file mode 100644 index 0000000..b2e1b5e --- /dev/null +++ b/src/app/layout.tsx @@ -0,0 +1,18 @@ +import type {Metadata} from 'next' +import 'normalize.css' +import './global.css' +import Container from './components/container' +import Title from './components/title' + +export default function RootLayout({children,}: Readonly<{children: React.ReactNode}>) { + return ( + + + + <Container> + {children} + </Container> + </body> + </html> + ) +} \ No newline at end of file diff --git a/lib/date.ts b/src/app/lib/date.ts similarity index 100% rename from lib/date.ts rename to src/app/lib/date.ts diff --git a/lib/read-markdown.ts b/src/app/lib/read-markdown.ts similarity index 100% rename from lib/read-markdown.ts rename to src/app/lib/read-markdown.ts diff --git a/lib/site.ts b/src/app/lib/site.ts similarity index 100% rename from lib/site.ts rename to src/app/lib/site.ts diff --git a/pages/404.tsx b/src/app/not-found.tsx similarity index 65% rename from pages/404.tsx rename to src/app/not-found.tsx index a6024b1..7e66d40 100644 --- a/pages/404.tsx +++ b/src/app/not-found.tsx @@ -1,23 +1,21 @@ -import Head from 'next/head'; import Link from 'next/link'; -import style from '../styles/title.module.css'; +import style from '../components/title.module.css'; function NotFoundPage() { - // clean this page up + // TODO: figure out a way to somehow get next to ignore layout in special cases. tried /not-found/page.tsx but it doesn't work :X return ( <> - <Head> +{/* <head> <title>404: Not Found | PaulW.XYZ - +

Page Not Found

-
- PaulW.XYZ / ... ??? / 404: Not Found
-
+
PaulW.XYZ / ... ??? / 404: Not Found
+
*/}

Error 404

@@ -28,7 +26,7 @@ function NotFoundPage() { More on HTTP status codes

-
+ {/*
*/} ); diff --git a/styles/note.module.css b/src/app/notes/[note]/note.module.css similarity index 100% rename from styles/note.module.css rename to src/app/notes/[note]/note.module.css diff --git a/pages/notes/[note].tsx b/src/app/notes/[note]/page.tsx similarity index 62% rename from pages/notes/[note].tsx rename to src/app/notes/[note]/page.tsx index d797205..3349ba1 100644 --- a/pages/notes/[note].tsx +++ b/src/app/notes/[note]/page.tsx @@ -11,12 +11,11 @@ import rehypeAutolinkHeadings from 'rehype-autolink-headings'; import rehypeHighlight from 'rehype-highlight'; import rehypeHighlightCodeLines, { type HighlightLinesOptions } from 'rehype-highlight-code-lines'; -import Layout from '../../components/layout'; import readMarkdown from '../../lib/read-markdown'; import { toLocaleString } from '../../lib/date'; -import NotesInfo from '../../public/notes.json'; +import NotesInfo from '../../../../public/notes.json'; -import style from '../../styles/note.module.css'; +import style from './note.module.css'; import 'highlight.js/styles/monokai-sublime.css'; import 'katex/dist/katex.min.css'; @@ -47,46 +46,21 @@ function Markdown({ content }: any) { } -function Note({ note }: { note: Note }) { +export default async function Note({params}: {params: { note: string}}) { + const note = params.note + const n = await getNotes(note) return (<> - - Last updated: {toLocaleString(note.mtime)} + Last updated: {toLocaleString(n.mtime)}
- +
-
); } -export async function getStaticProps({ params }: { params: { note: string } }) { - const note: string = params.note; +async function getNotes(name: string) { const notesInfo: Notes = NotesInfo; - const noteInfo: Note = notesInfo[note]; - - return { - props: { - note: { - ...noteInfo, - content: await readMarkdown('notes', note, true) - } - } - } -} - -export async function getStaticPaths() { - return { - paths: Object.keys(NotesInfo).map((note: string) => { - return { - params: { - note - } - } - }), - fallback: false - }; -} - -export default Note; + return {...notesInfo[name], content: await readMarkdown('notes', name, true)} +} \ No newline at end of file diff --git a/pages/notes/index.tsx b/src/app/notes/page.tsx similarity index 84% rename from pages/notes/index.tsx rename to src/app/notes/page.tsx index b1ef7e8..2f10f8b 100644 --- a/pages/notes/index.tsx +++ b/src/app/notes/page.tsx @@ -1,9 +1,7 @@ import Link from 'next/link'; -import Layout from '../../components/layout'; -import { toRelativeDate } from '../../lib/date'; - -import NotesInfo from '../../public/notes.json'; +import { toRelativeDate } from '../lib/date'; +import NotesInfo from '../../../public/notes.json'; function NoteEntry({ note }: { note: { title: string, mtime: string, slug: string } }) { return ( @@ -36,7 +34,7 @@ function NotesPage() { ); return ( - + <> { !notes || notes.length === 0 && <>No notes found @@ -50,7 +48,7 @@ function NotesPage() { } - + ) } diff --git a/pages/index.tsx b/src/app/page.tsx similarity index 62% rename from pages/index.tsx rename to src/app/page.tsx index 39204a2..f7b01ca 100644 --- a/pages/index.tsx +++ b/src/app/page.tsx @@ -1,10 +1,9 @@ import React from 'react'; import Link from 'next/link'; -import Layout from '../components/layout'; -import QuickLinks from '../components/quick-links'; -import RecentNotes from '../components/recent-notes'; -import RecentPosts from '../components/recent-posts'; -import RootInfo from '../public/home.json'; +import QuickLinks from './components/quick-links'; +import RecentNotes from './components/recent-notes'; +import RecentPosts from './components/recent-posts'; +import RootInfo from '../../public/home.json'; function Nav() { const nav = Object.entries(RootInfo); @@ -22,12 +21,12 @@ function Nav() { function HomePage() { return ( - + <>

); } - -function Post({ post }: { post: IPost & { content: string, cover?: string, otime: string, mtime?: string } }) { +// post: IPost & { content: string, cover?: string, otime: string, mtime?: string } +export default async function Post({ params }: { params: {post: string} }) { + const post = await getPost((await params).post); if (!post) return <>; return (<> -
- { post.otime !== post.mtime && + { post.otime !== post.mtime && post.mtime && Last updated: {toLocaleString(post.mtime)} @@ -80,37 +74,12 @@ function Post({ post }: { post: IPost & { content: string, cover?: string, otime
-
); } -export async function getStaticProps({ params }: any) { - const postsInfo: IPosts = PostsInfo; - const post: IPost = postsInfo[params.post]; - return { - props: { - post: { - ...post, - content: await readMarkdown('posts', params.post, true) - } - } - } -} - -export async function getStaticPaths() { - return { - paths: Object.keys(PostsInfo).map((post: string) => { - return { - params: { - post - } - } - }), - fallback: false - }; -} - - -export default Post; +export async function getPost(n: string) { + const postsInfo: Record = PostsInfo; + return {...postsInfo[n], content: await readMarkdown('posts', n, true)}; +} \ No newline at end of file diff --git a/pages/posts/index.tsx b/src/app/posts/page.tsx similarity index 88% rename from pages/posts/index.tsx rename to src/app/posts/page.tsx index e16a99b..9607bd6 100644 --- a/pages/posts/index.tsx +++ b/src/app/posts/page.tsx @@ -1,13 +1,11 @@ import Link from 'next/link'; -import Layout from '../../components/layout'; -import date from '../../lib/date'; -import PostsInfo from '../../public/posts.json'; +import date from '../lib/date'; +import PostsInfo from '../../../public/posts.json'; function PostsPage() { - return ( - + return (<> {Object.keys(PostsInfo).length && || } - + ) } diff --git a/pages/sitemap.tsx b/src/app/sitemap/page.tsx similarity index 87% rename from pages/sitemap.tsx rename to src/app/sitemap/page.tsx index 47e59b2..530f39e 100644 --- a/pages/sitemap.tsx +++ b/src/app/sitemap/page.tsx @@ -1,7 +1,6 @@ import Link from 'next/link'; -import Layout from '../components/layout'; import { Sites } from '../lib/site'; -import SiteMap from '../public/sitemap.json'; +import SiteMap from '../../../public/sitemap.json'; function Desc(props: any) { return ( @@ -33,9 +32,9 @@ function traverseMap(head?: Sites, cwd = '', depth = 0) { } function SiteMapPage() { - return + return <> {traverseMap(SiteMap.pages)} - ; + ; } export default SiteMapPage; diff --git a/styles/post.module.css b/src/app/styles/post.module.css similarity index 100% rename from styles/post.module.css rename to src/app/styles/post.module.css diff --git a/styles/github-profile.module.css b/styles/github-profile.module.css deleted file mode 100644 index ab199ef..0000000 --- a/styles/github-profile.module.css +++ /dev/null @@ -1,55 +0,0 @@ -.avatarContainer { - padding: 0.5rem; - text-align: center; - overflow: hidden; -} - -.avatarContainer img { - border-radius: 1rem; -} - -.cardLabel { - display: block; - font-weight: 700; - font-size: 1rem; - padding: .5rem; -} - -.cardLabel:after { - content: ':'; -} - -.cardValue { - background-color: #303436; - font-size: 1rem; - padding: 0.25rem 1rem; - margin: 0.25rem 0; - border: none; - display: block; - border-radius: 0.5rem; -} - - -@media screen and (min-width: 800px) { - .card { - display: flex; - } - - .cardTable { - flex: 1 1; - padding: 0.5rem; - align-items: stretch; - } - - .cardRow { - display: flex; - } - - .cardLabel { - flex: .2 1; - } - - .cardValue { - flex: 1 1; - } -} \ No newline at end of file diff --git a/styles/lists.module.css b/styles/lists.module.css deleted file mode 100644 index 825574e..0000000 --- a/styles/lists.module.css +++ /dev/null @@ -1,39 +0,0 @@ -.desc { - font-size: 0.95rem; -} - -.listItem { - padding: 0.25rem; - display: block; -} - -.listItem::before { - content: '■'; - padding: 0 0.5rem; -} - -.listItemDesc { - display: inline-block; - padding: 0.25rem; - margin-left: 2.5rem; - font-size: 0.95rem; -} - -.block .block { - margin: 0; - margin-left: 0.5rem; - border-radius: 0; - border-right: none; - border-bottom: none; - border-top: 1px dashed var(--main-border-color); - border-left: 1px dashed var(--main-border-color); -} - -.block .block:first-of-type { - border-top: none; -} - -.block .block:last-of-type { - border-bottom-left-radius: 1rem; - border-bottom: 1px dashed var(--main-border-color); -} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 425b523..4c0c1f9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1,7 @@ { "compilerOptions": { "target": "es2023", - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], + "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "strict": true, @@ -18,13 +14,22 @@ "isolatedModules": true, "jsx": "preserve", "importHelpers": true, - "incremental": true + "incremental": true, + "plugins": [ + { + "name": "next" + } + ], + "paths": { + "@/*": ["./src/*"] + } }, "include": [ "next-env.d.ts", "**/*.ts", "**/*.tsx", - "lib/slug.js" + "lib/slug.js", + ".next/types/**/*.ts" ], "exclude": [ "node_modules"