$ show cpreston321/nuxt-swiper
This is a Nuxt module that integrates Swiper.js into Nuxt 3 applications using Web Components. It provides automatic registration of `<swiper-container>` and `<swiper-slide>` custom elements, a Vue composable (`useSwiper`) for reactive Swiper instance control, and support for both bundled and individual Swiper module imports. The module is minimal, well-typed, and leverages Nuxt's module system for configuration. It includes a playground and test fixture but no complex business logic. The codebase is clean and modern, with proper TypeScript types and a structured setup, though the test suite is practically empty. The composable is well-crafted and could be extracted as a standalone utility.
The LLM identified 2 files worth highlighting for reuse:
A client-only Vue composable that provides reactive control over a Swiper instance. It returns reactive computed properties (isBeginning, isEnd, activeIndex, etc.) and navigation methods (next, prev, to, reset). Initializes the Swiper instance on mount or on demand via reInitialize. Cleanly separated from Nuxt dependencies except for Vue imports. Could be extracted for use in plain Vue or other frameworks with minimal changes.
The main module entry point that registers the Swiper custom elements plugin, optionally adds composable auto-imports, configures Vite dependency optimization for Swiper, and merges module options into app config. Exemplifies a well-structured Nuxt module with typed options, hooks, and resolver-based paths. Though tightly coupled to Nuxt's module system, it demonstrates clean separation of concerns and proper use of the Nuxt kit API.