Skip to content

site: Pre-migration chores, file renames, site improvements and bug fixes - #1807

Merged
askoufis merged 11 commits into
masterfrom
astro/pre-migration
Nov 11, 2026
Merged

askoufis merged 11 commits into
masterfrom
astro/pre-migration

Conversation

@askoufis

@askoufis askoufis commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Prepare the docs site for the Astro migration

Groundwork for migrating the docs site to Astro, split out so the migration PR stays focused. The site still builds with webpack after these changes. Each commit is self-contained, and its description has more detail, so reviewing commit by commit is recommended.

  • Bump pnpm to 11.28.6.
  • Declare *.png modules in the Next.js 16 fixture, which only type-checked because of a global declaration in the docs site.
  • Rename the docs from .md to .mdx, escaping the two bare < characters MDX rejects. CONTRIBUTING.md now covers MDX's rules and ```ts compiled blocks.
  • Simplify the colour mode toggle to read the class on html instead of keeping its own React context.
  • Show code text while fonts load: MonoLisa is declared with font-display: swap and preloaded, and the Google Fonts requests are combined.
  • Use measured font metrics and metric-matched fallback fonts from @capsizecss/metrics, to reduce layout shift when web fonts load. Also fixes code text being trimmed with the body font's metrics.
  • Stop the docs nav fading out when the window is resized across the desktop breakpoint.
  • Fix duplicate ids in compiled code blocks, and ButtonLink icon spacing on mobile.
  • Move the homepage code samples into their own module.
  • Upgrade Vite to 8.3.5 and rolldown to 1.2.16 repo-wide, as Astro requires it. Snapshots are updated for rolldown's output changes. One of those is a rolldown fix (fix(code-splitting): keep the source order of chunk imports rolldown/rolldown#11298): preserveModules builds now import modules in source order, matching Rollup. The rollup-plugin's rolldown dev dependency is raised to ^1.2.16.
  • Stop parallel e2e fixture builds interfering with each other, which made the esbuild and Parcel Playwright tests flaky.
    • Each esbuild, Vite production and Parcel build now gets its own temporary output directory, instead of sharing one that other builds could delete or overwrite.
    • Parcel builds no longer share a cache in the repo root, which was serving development builds production class names, and Parcel only watches the fixture's directory.
    • Also updates Parcel to 2.16.4 in the lockfile.

Updates the pinned `packageManager` version from 11.28.5 to 11.28.6. The lockfile is unchanged.
The fixture imports a `.png`, but its type declarations for image imports come from `next-env.d.ts`, which is gitignored. The root type check only passed because the docs site's `index.d.ts` declared `*.png` globally, and the site is included in the root `tsconfig.json`.

This declares `*.png` in the fixture itself, so it no longer relies on the site's declarations. That's needed once the site gets its own type check in the Astro migration.
The docs are already compiled as MDX, so this renames them to say so. It also gets the rename out of the way before the Astro migration, where MDX is parsed more strictly.

- Renames every page in `site/docs` from `.md` to `.mdx`, and updates the manifest generator to match. Webpack already handles both extensions.
- Escapes two bare `<` characters as `&lt;`, in the Next.js and `@vanilla-extract/dynamic` pages. Newer versions of MDX treat a bare `<` as the start of a JSX tag.
- Applies the markdown Prettier options to `.mdx` files.
- Updates `CONTRIBUTING.md` to describe the docs as MDX, including the escaping rules and ` ```ts compiled ` code blocks.
The colour mode toggle kept the current mode in React context, but the source of truth is already the class on the `html` element, set by the inline script in the document head before the page renders. This removes the context and reads the class instead.

- Moves `lightMode`, `darkMode` and the `localStorage` key into `system/styles/colorModes.ts`. They can then be imported without pulling in the sprinkles CSS, e.g. from the document head. `sprinkles.css.ts` re-exports the modes, so existing imports keep working.
- `ColorModeToggle` toggles the class on `html` and saves the preference, with no state of its own.
- Removes `ColorModeProvider`.

This also means each toggle can be its own component tree, which the Astro migration relies on.
MonoLisa's stylesheet doesn't set `font-display`, so code text stayed invisible until the font finished loading. This declares MonoLisa's `@font-face` rules in the theme instead, with `font-display: swap`, so code renders in a fallback font straight away.

- Declares MonoLisa 3 with `globalFontFace`, using the same font URLs and unicode ranges as the stylesheet. Renames the family from `ml` to `MonoLisaCode`.
- Preloads the basic Latin MonoLisa file, as it's needed by almost every page.
- Loads Shrikhand and DM Sans with a single Google Fonts `css2` request instead of two, and adds `preconnect` hints for Google Fonts.

Check that MonoLisa loads on the deploy preview: its API returned a 403 when the site was served from `localhost`.
The theme's font metrics were hand-copied numbers, and the fallback fonts had different metrics from the web fonts, so text shifted when the web fonts loaded.

- Takes the Shrikhand and DM Sans metrics from `@capsizecss/metrics`, and uses metrics measured from MonoLisa 3 for code, as `@capsizecss/metrics` doesn't include it.
- Keeps custom Apple system font metrics for body text, as the `@capsizecss/metrics` values misalign trimmed text. A comment explains this.
- Builds the heading and code font stacks with `createFontStack`. It declares size-adjusted fallback fonts (Arial and Liberation Sans for DM Sans, Roboto Mono for MonoLisa) that match the web font's metrics, so text doesn't shift when the web font loads.
- Leaves the Shrikhand brand font without an adjusted fallback. Size-adjusting a sans-serif to match it cramps the text without preventing any layout shift.
- Fixes code text being trimmed with the body font's metrics instead of the code font's.
… breakpoint

The primary nav's opacity and transform transition is used to open and close the menu on small screens. It also ran whenever the window was resized across the desktop breakpoint, so the nav visibly faded out when going from desktop to mobile widths.

This marks the nav with `data-crossing-breakpoint` when the desktop media query changes, which turns its transition off. The attribute is removed two animation frames later, once the new layout has been applied, so opening and closing the menu still animates.
Two small existing bugs:

- Every `CompiledCode` block rendered its CSS output panel with `id="outputContainer"`, so pages with several compiled blocks had duplicate IDs, and each "Show Output" button's `aria-controls` pointed at the first block's panel. The ID now comes from `useId`.
- `ButtonLink` spaced its icon with padding on a wrapper element, which stayed in place on mobile, where the "Get started" chevron is hidden. Spacing now uses `gap`, so a hidden icon takes no space. This also makes the spacing the same for every link: it was `small` for external and hash links and `xsmall` for the rest.
The homepage's code samples were inline template literals indented to match the JSX around them, which made both the samples and the page hard to read. This moves them into `HomePage/codeSamples.ts`.

- Each sample has its file name, contents, language, and the identifiers to underline as type errors, which were previously passed to `ErrorHighlighter` separately.
- Samples are written without the extra indentation, using `dedent` imported as `ts` (with a `css` alias for the CSS sample) so editors highlight the template literals.

Rendering is unchanged. This also prepares the samples to be highlighted at build time in the Astro migration.
Astro 7.4 requires Vite 8.3.5 or later, so the docs site's migration to Astro needs it. Leaving the rest of the repo on Vite 8.0.5 would put two copies of Vite, and of vitest, in the lockfile. The tests would then import one vitest while `@testing-library/jest-dom` extends the types of the other, breaking the root type check.

This upgrades Vite to 8.3.5 across the repo, and raises `@vanilla-extract/rollup-plugin`'s `rolldown` dev dependency to `^1.2.16`, the version this Vite uses. Every `vite` range in the repo already allows 8.3.5.

Rolldown 1.2.16 changes the bundled output in three ways, so the rollup-plugin snapshots and the `no-empty-chunks` inline snapshots are updated:

- Module comments are a single `// path` line instead of `//#region path` … `//#endregion`.
- Calls inside object literals that are only referenced once are hoisted into `const`s, e.g. `const themeLayer = layer("themeLayer")`. They still run in the same order.
- With `preserveModules` and `unstable_injectFilescopes`, `index.js` and `styles.css.js` now import other modules in the same order as their source files, matching Rollup's output. Earlier versions of rolldown sorted each module's imports by the order modules run from the entry ([rolldown/rolldown#11298](rolldown/rolldown#11298)), which could change the order styles were created when a module was imported directly rather than through the entry. Raising the dev dependency to `^1.2.16` keeps the tests from running against that behaviour.
Playwright runs the e2e tests in parallel, and each test file starts its fixture once per project (Desktop and Mobile) and mode (development and production). Builds of the same fixture could run at the same time, and they shared state on disk, which made the esbuild and Parcel tests flaky.

- esbuild built every mode into the same `dist/<type>/<fixture>` directory, and each build deleted that directory before writing to it. A test could load its page in the gap, getting the server's directory listing instead of the fixture, or get another mode's build.
- Vite's production build and Parcel also built into a shared `dist` directory.
- Parcel builds shared a cache in the repo root, as Parcel treats it as the project root. Parcel still writes to its cache with `shouldDisableCache`, so development builds could be served production class names, and vice versa.
- Parcel watched the whole repo, so it errored when Playwright removed its own `test-results` directories.

Each esbuild, Vite production and Parcel build now gets its own temporary directory, created with `fs.mkdtemp` in the OS temp directory and removed when the server closes. It's outside the fixture's directory, as Parcel watches that. Parcel keeps its cache in that directory, and only watches the fixture's directory.

Also updates Parcel to 2.16.4 in the lockfile, which the existing `^2.15.0` ranges allow. `@parcel/watcher` 2.6.0 adds an install script that only builds from source when `npm_config_build_from_source` is set, so it's denied in `allowBuilds`; the native binary comes from its prebuilt platform packages.
@changeset-bot

changeset-bot Bot commented Nov 9, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 02b4575

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@askoufis
askoufis merged commit 5cd0a8f into master Nov 11, 2026
21 of 25 checks passed
@askoufis
askoufis deleted the astro/pre-migration branch November 11, 2026 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant