Skip to content

fix: source island hash from Nuxt#641

Merged
harlan-zw merged 2 commits into
mainfrom
fix/nuxt-island-hash
Jul 16, 2026
Merged

fix: source island hash from Nuxt#641
harlan-zw merged 2 commits into
mainfrom
fix/nuxt-island-hash

Conversation

@harlan-zw

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

Related to nuxt/nuxt#35583

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

fetchIsland replicated Nuxt's internal island hash with its own ohash call. Nuxt 4.5 exposes getIslandHash (nuxt/nuxt#35583) specifically so this module stops doing that: once Nuxt changes the algorithm, the replication would 400 every island fetch with Invalid island request hash.

A new #og-image/island-hash nitro virtual picks the implementation from the installed Nuxt: re-export getIslandHash on >= 4.5, adapt computeIslandHash from nuxt/dist/app/island-hash.js on 4.4.x, ohash replication only for anything older.

Non-crypto hashing (cache keys, etags, build-time component hashes) moves to fnv1a-64 + object-identity, the pair Nuxt adopted in the same PR. URL signing stays SHA-256 but now imports only digest from ohash/crypto, so full ohash only ships on pre-4.4 Nuxt. Signatures and cache keys regenerate on next build; nothing persists across builds that would break.

Nuxt 4.5 exposes getIslandHash (nuxt/nuxt#35583) so modules stop
replicating the island hash algorithm. Add a #og-image/island-hash
virtual that re-exports it on >=4.5, adapts computeIslandHash on 4.4.x
and keeps the ohash replication only for older Nuxt.

Cache keys, etags and component hashes now use fnv1a-64 +
object-identity (same pair Nuxt adopted). URL signing keeps SHA-256 via
ohash/crypto since a fast hash would be forgeable.
@pkg-pr-new

pkg-pr-new Bot commented Jul 16, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/nuxt-og-image@641

commit: d602bf3

@harlan-zw harlan-zw changed the title fix: source island hash from Nuxt, migrate hashing off ohash fix: source island hash from Nuxt Jul 16, 2026
@harlan-zw
harlan-zw merged commit 13cef4f into main Jul 16, 2026
11 checks passed
@harlan-zw
harlan-zw deleted the fix/nuxt-island-hash branch July 16, 2026 13:26
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