Skip to content

v2.0.0

Latest

Choose a tag to compare

@rrd108 rrd108 released this 24 Nov 07:07

compare changes

🚀 Enhancements

  • Add configurable storageKeyPrefix for storage keys (ced64e5)
  • ⚠️ Resolve config in one place and support .config/nuxt-api-shield.ts (91c9c0a)

🩹 Fixes

  • Create the GitHub release only after the tag is pushed (6ea53b8)
  • Ignore trailing slashes in routes and skipRoutes (3a1bec3)

📖 Documentation

  • Add agent skills configuration (a66a8f4)
  • Restructure README around a quick start and an options reference (d064ab9)
  • Add a step-by-step guide for upgrading from v1 to v2 (d2c0871)

🏡 Chore

  • Publish releases with npm instead of yarn (48fa138)
  • Add release script that picks the bump and checks npm access (18ea95a)

⚠️ Breaking Changes

  • ⚠️ Resolve config in one place and support .config/nuxt-api-shield.ts (91c9c0a)

❤️ Contributors

⚠️ Upgrade notes (v2)

Step-by-step migration: Upgrading from v1.

  • Node 22.12 or later is required (or Node 24).
  • New: .config/nuxt-api-shield.ts — options can live in a dedicated config file (.config/nuxt-api-shield.ts or nuxt-api-shield.config.ts), typed with defineShieldConfig from nuxt-api-shield/config. Precedence, highest first: runtimeConfig.nuxtApiShield, the nuxtApiShield key, the config file, the defaults.
  • runtimeConfig.public.nuxtApiShield is removed — deprecated in v1.1.0, it now fails the build. Move it to runtimeConfig.nuxtApiShield, the nuxtApiShield key or the config file.
  • Arrays are no longer concatenated across sources — if you set routes or skipRoutes in both runtimeConfig.nuxtApiShield and nuxtApiShield, only the runtimeConfig one is used now. Objects still merge key by key.
  • Invalid wildcard routes fail the build — a pattern: true route that breaks the pattern rules (e.g. /**, /api*) used to be skipped silently at request time, leaving that route unprotected. The build now stops with an error naming the route.
  • Trailing slashes in routes and skipRoutes are ignored — request paths are matched without a trailing slash, so a rule like '/api/v2/' or a skip route like '/api/health/' never matched anything and left those routes unprotected (or not skipped). They are now treated as '/api/v2' and '/api/health'.
  • ModuleOptions fields are all optional — and the resolved, fully-defaulted shape is exported as ResolvedShieldConfig (what useRuntimeConfig().nuxtApiShield holds).