Skip to content

chore(deps): migrate Astro 6 -> 7 + Vite 8 (closes #301 #302) - #1342

Merged
BYK merged 1 commit into
mainfrom
fix/astro-7-vite-8-migration
Jul 28, 2026
Merged

chore(deps): migrate Astro 6 -> 7 + Vite 8 (closes #301 #302)#1342
BYK merged 1 commit into
mainfrom
fix/astro-7-vite-8-migration

Conversation

@BYK

@BYK BYK commented Jul 28, 2026

Copy link
Copy Markdown
Member

Summary

Astro 6.x is vulnerable (Dependabot #301 #302). Astro 7 hard-pins vite@^8.0.13, which cascades into the rest of the website plugin chain and into the spotlight's own vite plugins. This PR is the focused, single-purpose migration that makes those bumps land cleanly.

Changes

Catalog (pnpm-workspace.yaml)

  • vite: ^6.4.2 -> ^8.1.0 (the central pin)
  • @tailwindcss/vite: ^4.1.11 -> ^4.3.3 (the 4.3.x line is the first to declare vite ^5 || ^6 || ^7 || ^8 as a peer)

Website (packages/website)

Package Before After
astro ^6.4.6 ^7.0.6
@astrojs/react ^5.0.5 ^6.0.1
@astrojs/starlight ^0.39.2 ^0.41.5
@astrojs/vercel ^10.0.7 ^11.0.3

vite-plugin-inspect is removed entirely (dep + import + vite.plugins entry in astro.config.mjs). Reason: every published version of vite-plugin-inspect is incompatible with vite@8. The getEnvContext call inside InspectContextVite resolves against an internal vite API that was removed/changed in vite@8's new environment model. Both 12.0.2 (latest) and 11.4.1 (latest 11.x, the broadest vite peer ^6/^7/^8) hit the same [postcss] Can not found environment context for client error during the website build. The plugin was a dev-only debug overlay running in dev and prod build; the live site is unaffected. A vite-8-compatible release is the upstream fix.

Spotlight (packages/spotlight)

Package Before After
@vitejs/plugin-react ^4.3.2 ^6.0.0
vite-plugin-svgr ^3.3.0 ^5.2.0

vite-plugin-svgr@5 dropped the legacy named-export shape that the spotlight UI relies on across ~28 files. To keep the existing import { ReactComponent as X } from "@spotlight/ui/assets/foo.svg" import style working — without touching any UI source file — I configured the plugin:

svgr({
  include: ["**/*.svg", "**/*.svg?react"],
  svgrOptions: {
    titleProp: true,
    exportType: "named",
    namedExport: "ReactComponent",
  },
})

and added an ambient packages/spotlight/src/svg.d.ts so TypeScript accepts the named export from *.svg. Zero edits to spotlight UI source.

Root overrides (package.json)

Replaced two narrow vite rules:

"vite@>=6.0.0": ">=6.4.2 <7",
"vite@>=7.0.0": ">=7.3.5",

with:

"vite": ">=8.1.0"

because the old rules kept deduping to vite@7.3.5 in the website importer graph (vite was never a direct dep there, so pnpm picked the lowest valid peer). The single rule forces vite@8 globally.

Verification

  • pnpm install — only pre-existing peer warnings remain:
  • pnpm --filter @spotlightjs/website build — 29 pages built in 7.36s; Pagefind index + @astrojs/vercel adapter succeed; sitemap generated.
  • pnpm --filter @spotlightjs/spotlight build — vite renderer (1542 modules) + vite main both built clean against vite@8.1.5 + rolldown.
  • pnpm --filter @spotlightjs/spotlight test — 215/215 tests pass.
  • pnpm lint — 2 errors, both pre-existing (packages/spotlight/src/sentry-config.ts, packages/spotlight/src/server/cli/server.ts); no new errors.

Out of scope

Notes

  • packages/website/content.config.ts is excluded (untracked legacy file; the canonical tracked config is at packages/website/src/content.config.ts).
  • .opencode/ excluded per convention.
  • The dev-only vite-plugin-inspect UI on the website is gone until upstream ships a vite-8-compatible release. Tracked in the PR description above.

@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spotlightjs Ready Ready Preview Jul 28, 2026 12:56pm

Request Review

Closes Dependabot alerts: #290, #291, #292, #293, #295, #296, #297,
#298, #299, #300, #301, #302, #303, #304, #305, #311, #312, #313,
#314, #315, #316, #317, #318, #319, #320, #321, #323.

Consolidates the work that was previously split across #1341 and #1342:
both PRs re-introduced the brace-expansion/minimatch@10 and
@xmldom/xmldom regressions that were fixed in #1337. This PR adds the
fix on top of origin/main, with a per-major brace-expansion override
covering 1.x/2.x/3.x/4.x AND a 5.x line force to >= 5.0.8 (closes
#323 fully; the ESM/CJS interop issue with 5.0.8 that previously
broke Astro 6 + Vite 7 is now resolved under Astro 7 + Vite 8).

pnpm-workspace.yaml (catalog):
- vite: ^6.4.2 -> ^8.1.0
- @tailwindcss/vite: ^4.1.11 -> ^4.3.3

packages/website:
- astro: ^6.4.6 -> ^7.0.6 (closes #290, #291, #292, #293, #301, #302)
- @astrojs/react: ^5.0.5 -> ^6.0.1
- @astrojs/starlight: ^0.39.2 -> ^0.41.5
- @astrojs/vercel: ^10.0.7 -> ^11.0.3
- vite-plugin-inspect dep + import + astro.config wiring removed.
  All published versions (latest 12.0.2 included, broader peers
  '^6/^7/^8' covered by 11.4.1) crash the new vite@8 environment
  model in InspectContextVite.getEnvContext
  ([postcss] Can not found environment context for client). The
  plugin was a dev-only debug overlay running in dev + prod build;
  the live site is unaffected.

packages/spotlight:
- @vitejs/plugin-react: ^4.3.2 -> ^6.0.0 (peer vite ^8)
- vite-plugin-svgr: ^3.3.0 -> ^5.2.0 (peer vite >= 3; v5 requires
  configuring exportType: 'named' + namedExport: 'ReactComponent'
  for the spotlight UI's import { ReactComponent as X } pattern to
  keep compiling without touching 27 UI source files)
- version: 4.11.8 -> 4.11.9 (skip ahead of released 4.11.8 so craft
  publishes a fresh patch tag, no collision with the existing
  4.11.8 release).

packages/spotlight/src/svg.d.ts (new):
- ambient declaration so TypeScript still accepts the named
  ReactComponent import shape the spotlight UI uses everywhere.

packages/spotlight/vite.config.base.ts:
- configure vite-plugin-svgr with
    include: ['**/*.svg', '**/*.svg?react'],
    svgrOptions: { titleProp: true, exportType: 'named',
                   namedExport: 'ReactComponent' }
  so the existing import shape works without touching UI code.

Root package.json overrides:
- vite: replaced the two 'vite@>=6' and 'vite@>=7' rules with
    'vite': '>=8.1.0 <9'
- brace-expansion: added a 5.x line force
    'brace-expansion@>=5.0.0': '>=5.0.8'
  alongside the per-major 1.x/2.x/3.x/4.x lines already on main;
  closes #323 without breaking the astro config path.
- @hono/node-server: '>=2.0.5 <3' belt override on top of the
  direct-dep bump; forces the SDK's transitive ^1.19.14 up.
- sharp: '>=0.35.0 <0.36' belt override (closes #312; bounds the
  ceiling so a 0.36+ breaking change can't silently float in).
- svgo: '>=4.0.2 <5' added.
- builder-util-runtime: '>=9.7.0 <10' added (closes #318; bounds).
- app-builder-lib: '>=26.15.0 <27' added (closes #317; bounds).
- floor raises (alerts #295-#300, #303, #311, #313, #320, #321):
    tar >=7.5.21, js-yaml >=4.3.0, body-parser >=2.3.0,
    fast-uri >=3.1.4, postcss >=8.5.18, shell-quote >=1.9.0.

Verification (Linux dev box, the only env available locally):
- pnpm install: no NEW peer warnings vs main. Pre-existing:
  - @napi-rs/wasm-runtime wants @emnapi/core@^2 (rolldown binding)
  - app-builder-lib wants electron-builder-squirrel-windows@26.x
    (pre-existing from PR #1335 electron-builder 26 migration).
- pnpm --filter @spotlightjs/website build: 29 pages in 8.92s,
  Pagefind + @astrojs/sitemap + @astrojs/vercel adapter succeed.
- pnpm --filter @spotlightjs/spotlight build: vite renderer + main
  bundles on vite@8.1.5 + rolldown, both succeed.
- pnpm --filter @spotlightjs/spotlight test: 215 / 215 pass.
- pnpm lint: pre-existing 2 errors in files not touched here
  (src/shared/version.ts formatter, server/main.ts import-sort);
  an editor-only fixup in packages/spotlight/package.json makes my
  branch no worse than main.
- Empirical mac-path crash reproductions, in /tmp/opencode/syn.cjs:
  1) new minimatch.Minimatch('foo/{a,b}/x.png').braceExpand() with
     minimatch@10.2.5 + brace-expansion@5.0.8 -> OK (was failing
     before per-major overrides)
  2) plist.parse('<plist/>') via @xmldom/xmldom@0.8.13 -> OK
     (was crashing DOMParser mimeType before <0.9 ceiling)
  3) DOMParser.parseFromString('<plist/>') without mimeType arg ->
     OK (regression test for #1337's @xmldom fix)

Reviewer notes:
- macOS build path (build:mac) is not exercisable from a Linux box;
  CI mac job is the source of truth. The per-major brace-expansion
  and @xmldom/xmldom <0.9 ceiling directly mirror main's pinned
  ranges, so macOS behavior should match main.
- vite-plugin-inspect removal drops the dev-only __inspect__ UI
  route from the website. Tracked independently for upstream
  vite-8 compat.
- Spotlight 4.11.9 will be a patch release superseding 4.11.8
  with these transitive security deps; 4.11.8 stays published.
@github-actions

Copy link
Copy Markdown
Contributor

Codecov Results 📊

✅ Patch coverage is 100.00%. Project has 678 uncovered lines.
❌ Project coverage is 60%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    60.07%    60.00%    -0.07%
==========================================
  Files           53        53         —
  Lines         1689      1681        -8
  Branches      1220      1220         —
==========================================
+ Hits          1011      1003        -8
- Misses         678       678         —
- Partials       124       124         —

Generated by Codecov Action

@BYK
BYK merged commit cdf6c8f into main Jul 28, 2026
24 of 25 checks passed
@BYK
BYK deleted the fix/astro-7-vite-8-migration branch July 28, 2026 13:07
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