Repository navigation
site: Pre-migration chores, file renames, site improvements and bug fixes - #1807
Merged
Merged
Conversation
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 `<`, 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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.