Skip to content

Commit 73ef3fd

Browse files
MajorTalclaude
andauthored
fix(astro): require Astro 6 peer dep (>=6 <7) (#429)
The SSR runtime (astro/src/runtime/server.ts) imports astro/app/entrypoint, an Astro-6-only export (Astro 5 exports only ./app and ./app/node). The >=5 <7 peer range therefore caused a cryptic build crash on Astro 5 during "Building server entrypoints": [commonjs--resolver] Missing "./app/entrypoint" specifier in "astro" package The try/catch in getAstroApp() can't help — Vite resolves the specifier at bundle time, before the runtime guard runs. Tighten the peer range to >=6 <7 so it matches what the SSR adapter actually requires (npm warns at install instead of crashing mid-build). Reconcile the lockfile and update the README install note + CHANGELOG. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent abaa6cd commit 73ef3fd

4 files changed

Lines changed: 6 additions & 4 deletions

File tree

astro/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,16 @@ All notable changes to `@run402/astro`.
3535

3636
### Fixed
3737

38+
- **Too-loose Astro peer range caused a cryptic build failure on Astro 5.** `peerDependencies.astro` was `>=5 <7`, but the SSR runtime (`src/runtime/server.ts`) does `await import("astro/app/entrypoint")` — a specifier Astro 5 does not export (Astro 5.18.2 ships only `./app` and `./app/node`; `./app/entrypoint` first appears in Astro 6). A consumer on Astro 5 using the default `export default run402()` preset (or `createRun402Adapter()`) therefore aborted during `astro build`'s "Building server entrypoints" step with the opaque `[commonjs--resolver] Missing "./app/entrypoint" specifier in "astro" package` — the `try/catch` in `getAstroApp()` does not help because Vite resolves the specifier at bundle time, before the runtime guard runs. Tightened the peer range to `>=6 <7` so the declared support matches what the SSR adapter actually requires; npm now warns at install time rather than crashing mid-build. The build-time image integration (`run402Image()` / the named `run402` alias, used without the SSR adapter) never bundles `runtime/server.ts` and still runs on Astro 5, but Astro 5 is no longer in the supported peer range. Discovered while building the demos/evilme Astro SSR app, which pinned `astro@^6.1.3` to work around this.
39+
3840
- **`createRun402Adapter` incompatible with Astro 6** ([#403](https://github.com/kychee-com/run402/issues/403)). `astro build` on Astro 6.x previously aborted with `NoAdapterInstalled` even when the adapter was wired up, and printed a deprecation warning about `entrypointResolution: "explicit"` plus an `[ERROR] [config] adapter does not currently support sharp` line. Root cause was a mix of stale Astro-5-era adapter API usage: the adapter omitted `entrypointResolution` (defaulting to deprecated `"explicit"`), declared the legacy `exports: ["handler", "default"]` array, did not declare `sharpImageService` support, and the `run402()` preset pushed the adapter into `integrations[]` instead of the `adapter:` field — leaving `config.adapter` empty so Astro 6's check `!config.adapter && buildOutput === 'server'` threw `NoAdapterInstalled`. Fix:
3941
- Adapter now declares `entrypointResolution: "auto"` (Astro 6 recommended path) and drops the deprecated `exports` array — `runtime/server.ts` already exports `handler` + `default` directly.
4042
- Adapter declares `sharpImageService: "stable"` in `supportedAstroFeatures`.
4143
- Adapter no longer forces `adapterFeatures.buildOutput: "server"` — Astro derives the build shape from `output` + per-page `prerender`.
4244
- `run402()` preset returns `{ adapter: createRun402Adapter(...) }` on the top-level config (where Astro 6 looks for it) instead of pushing it into `integrations[]`.
4345
- `runtime/server.ts` migrated from the Astro-5 `manifest.mjs` + `new App(manifest)` pattern to Astro 6's `createApp()` from `astro/app/entrypoint` — Vite no longer fails to resolve `./manifest.mjs` because the virtual entrypoint module bakes the manifest in.
4446
- `astro:build:done` no longer uses `new URL("./...", pathnameString)` (invalid base) for the client dir — uses `path.join(buildOutputDir, "...")` against the resolved filesystem path instead.
45-
Devdep bumped to `astro ^6.1.3` so the TypeScript types include `entrypointResolution`; peer dep range is unchanged (`>=5 <7`), but **the SSR adapter portion now requires Astro 6+ at runtime** (the image-only integration still works on Astro 5). Users on the integrations-array pattern should migrate to `adapter: createRun402Adapter()`:
47+
Devdep bumped to `astro ^6.1.3` so the TypeScript types include `entrypointResolution`; **the SSR adapter portion now requires Astro 6+ at runtime** (`runtime/server.ts` imports the Astro-6-only `astro/app/entrypoint`), so the peer dep range was tightened to `>=6 <7` (see the dedicated Fixed entry above). The image-only `run402Image()` integration still runs on Astro 5 but is no longer inside the supported peer range. Users on the integrations-array pattern should migrate to `adapter: createRun402Adapter()`:
4648

4749
```ts
4850
// Before (Astro 5, broken on Astro 6):

astro/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ Compared to Next.js's `<Image>` model: Vercel transforms images lazily via Lambd
575575
npm install @run402/astro @run402/sdk
576576
```
577577

578-
Astro 5 or 6 (peer dependency, optional declaration so install never blocks).
578+
Astro 6 (peer dependency, optional declaration so install never blocks). The SSR adapter requires Astro 6 at runtime (its server entry imports `astro/app/entrypoint`, an Astro-6-only export); the build-time image integration alone also runs on Astro 5, though Astro 5 is outside the supported peer range.
579579

580580
## Configure
581581

astro/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"peerDependencies": {
7272
"@run402/functions": "^3.0.0",
7373
"@run402/sdk": ">=2.18.0",
74-
"astro": ">=5 <7",
74+
"astro": ">=6 <7",
7575
"react": ">=18.0.0",
7676
"react-dom": ">=18.0.0"
7777
},

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)