Skip to content

Commit 9832de5

Browse files
authored
fix!: #app module augmentation and types (#156)
* feat!: use latest Nuxt, Vite and Vuetify * chore: fix types * chore: update lockfile * chore: full types refactor * chore: cleanup * chore: include imports inside module * chore: workaround nuxt module builder * chore: bump to VP rc.27 * chore: revert module builder workaround * docs: include using edge i18n module hint * chore: use d.mts for default exports types * chore: update module hook in playground * chore: bump to latest VP and PWA * chore: fix lint * chore: revert main entry + add playground as workspace * chore: fix lint * chore: add vue-tsc to playground * fix: configure ts properly for vue-tsc in module and playground * chhore: bump to Vuetify 3.4.3 * chore: revert nuxt module augmentations
1 parent 2358913 commit 9832de5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+3267
-3507
lines changed

.nuxtrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
typescript.includeWorkspace=true
2+
typescript.tsConfig.exclude[]=../playground

.stackblitz.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { promises as fsPromises } from 'node:fs'
22

3-
removeParcel('./playground/nuxt.config.mts')
3+
removeParcel('./playground/nuxt.config.ts')
44

55
async function removeParcel(filename) {
66
try {

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828

2929
- 📖 [**Documentation & guides**](https://vuetify-nuxt-module.netlify.app/)
3030
- 👌 **Zero-Config**: sensible built-in default [Vuetify](https://vuetifyjs.com/) configuration for common use cases
31-
- 🔌 **Extensible**: expose the ability to customize the Vuetify configuration via [Nuxt Plugin Hooks](https://nuxt.com/docs/guide/going-further/hooks#usage-with-plugins)
31+
- 🔌 **Extensible**: expose the ability to customize the Vuetify configuration via [Nuxt Runtime Hooks](https://nuxt.com/docs/guide/going-further/hooks#usage-with-plugins)
3232
-**Fully Tree Shakable**: by default, only the needed Vuetify components are imported
3333
- 🛠️ **Versatile**: custom Vuetify [directives](https://vuetifyjs.com/en/getting-started/installation/#manual-steps) and [labs components](https://vuetifyjs.com/en/labs/introduction/) registration
3434
-**Configurable Styles**: configure your variables using [Vuetify SASS Variables](https://vuetifyjs.com/en/features/sass-variables/)
3535
- 💥 **SSR**: automatic SSR detection and configuration including [HTTP Client hints](https://developer.mozilla.org/en-US/docs/Web/HTTP/Client_hints)
36-
- 🔩 **Nuxt Layers and Hooks**: load your Vuetify configuration using [Nuxt Layers](https://nuxt.com/docs/getting-started/layers#layers) or using a custom module via `vuetify:registerModule` [Nuxt Hook](https://nuxt.com/docs/guide/going-further/hooks#nuxt-hooks-build-time)
36+
- 🔩 **Nuxt Layers and Module Hooks**: load your Vuetify configuration using [Nuxt Layers](https://nuxt.com/docs/getting-started/layers#layers) or using a custom module via `vuetify:registerModule` [Nuxt Module Hook](https://nuxt.com/docs/guide/going-further/hooks#nuxt-hooks-build-time)
3737
- 📥 **Vuetify Configuration File**: configure your Vuetify options using a custom `vuetify.config` file, no dev server restart needed
3838
- 🔥 **Pure CSS Icons**: no more font/js icons, use the new `unocss-mdi` icon set or build your own with UnoCSS Preset Icons
3939
- 😃 **Icon Fonts**: configure the [icon font](https://vuetifyjs.com/en/features/icon-fonts/) you want to use, the module will automatically import it for you using CDN or local dependencies

custom-configuration.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import { ExternalVuetifyOptions } from './dist/types';
1+
import type { ExternalVuetifyOptions } from './dist/module'
22
declare function defineVuetifyConfiguration(vuetifyOptions: ExternalVuetifyOptions): ExternalVuetifyOptions;
33
export { defineVuetifyConfiguration };

docs/.vitepress/config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@ export default withPwa(defineConfig({
120120
text: 'Getting Started',
121121
link: '/guide/',
122122
}, {
123-
text: 'Nuxt Layers and Hooks',
124-
link: '/guide/nuxt-layers-and-hooks',
123+
text: 'Nuxt Layers and Module Hooks',
124+
link: '/guide/nuxt-layers-and-module-hooks',
125125
}, {
126126
text: 'Vuetify Configuration File',
127127
link: '/guide/vuetify-configuration-file',
128128
}, {
129-
text: 'Nuxt Plugin Hooks',
130-
link: '/guide/nuxt-plugin-hooks',
129+
text: 'Nuxt Runtime Hooks',
130+
link: '/guide/nuxt-runtime-hooks',
131131
}, {
132132
text: 'Server Side Rendering (SSR)',
133133
link: '/guide/server-side-rendering',

docs/guide/i18n.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ outline: deep
55
# Internationalization
66

77
::: warning
8-
Requires latest [@nuxtjs/i18n](https://v8.i18n.nuxtjs.org/) Nuxt module: `8.0.0.beta.13`.
8+
Requires latest [Edge Release Channel](https://github.com/nuxt-modules/i18n#edge-release-channel) [@nuxtjs/i18n](https://v8.i18n.nuxtjs.org/) Nuxt module: `npm:@nuxtjs/i18n-edge`, you may need to reinstall the module to get the latest edge version.
9+
10+
When the new version `8.0.0-rc.6` released, it should be fine: `8.0.0-rc.5` is breaking Nuxt `#app` module augmentation (it is using `#app/nuxt` internally).
911
:::
1012

1113
Install and configure [@nuxtjs/i18n](https://v8.i18n.nuxtjs.org/) Nuxt module, and you're ready to use Vuetify [internationalization](https://vuetifyjs.com/en/features/internationalization/) features.
@@ -18,7 +20,7 @@ NOTE: You need to provide the translations by yourself. The module won't provide
1820

1921
### Basic configuration
2022

21-
The `@nuxtjs/i18n` module `8.0.0.beta.13` requires to split Nuxt (`@nuxtjs/i18n`) and Vue (`vue-i18n`) configuration files. In the previous beta versions, we could use a single configuration file, but using the latest beta version, we need to split them:
23+
The `@nuxtjs/i18n` module, from version `8.0.0.beta.13+`, requires splitting Nuxt (`@nuxtjs/i18n`) and Vue (`vue-i18n`) configuration files. In the previous beta versions, we could use a single configuration file, but now we need to split them:
2224

2325
#### Nuxt configuration
2426

docs/guide/icons/svg-icons.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export default defineNuxtConfig({
8888
svg: {
8989
fa: {
9090
libraries: [
91-
[/* default export? */ false, /* export name */ 'fas', /* library */ '@fortawesome/free-solid-svg-icons']
91+
[/* default export? */false, /* export name */ 'fas', /* library */ '@fortawesome/free-solid-svg-icons']
9292
]
9393
}
9494
}
@@ -114,7 +114,7 @@ export default defineNuxtConfig({
114114
svg: {
115115
fa: {
116116
libraries: [
117-
[/* default export? */ false, /* export name */ 'fad', /* library */ '@fortawesome/pro-duotone-svg-icons']
117+
[/* default export? */false, /* export name */ 'fad', /* library */ '@fortawesome/pro-duotone-svg-icons']
118118
]
119119
}
120120
}

docs/guide/icons/unocss-preset-icons.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ This module provides the `mdi` icons via `unocss-mdi` icon set. `unocss-mdi` ico
118118
This is a Nuxt Plugin example using [@iconify-json/mdi](https://icon-sets.iconify.design/mdi/) collection (manual `unocss-mdi` icon set replacement), replace the icons using your new collection:
119119
```ts
120120
// @unocss-include DON'T FORGET TO ADD THIS COMMENT
121-
import { mdi } from 'vuetify/lib/iconsets/mdi'
121+
import { mdi } from 'vuetify/iconsets/mdi'
122122
import { defineNuxtPlugin } from '#imports'
123123

124124
export default defineNuxtPlugin((nuxtApp) => {

docs/guide/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ outline: deep
66

77
Welcome to the Vuetify Nuxt Module documentation.
88

9+
::: warning Breaking Changes
10+
From `v0.7.0` version, this module requires `Nuxt v3.6.5+`.
11+
:::
12+
913
You can open the vuetify-nuxt-module GitHub repo in StackBlitz to start playing with the playground:
1014

1115
<a href="https://stackblitz.com/github/userquin/vuetify-nuxt-module" target="_blank" rel="noopener noreferrer">

docs/guide/nuxt-layers-and-hooks.md renamed to docs/guide/nuxt-layers-and-module-hooks.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
outline: deep
33
---
44

5-
# Nuxt Layers and Hooks
5+
# Nuxt Layers and Module Hooks
66

7-
You can load your Vuetify configuration using [Nuxt Layers](https://nuxt.com/docs/getting-started/layers#layers) or using a custom module via `vuetify:registerModule` [Nuxt Hook](https://nuxt.com/docs/guide/going-further/hooks#nuxt-hooks-build-time).
7+
You can load your Vuetify configuration using [Nuxt Layers](https://nuxt.com/docs/getting-started/layers#layers) or using a custom module via `vuetify:registerModule` [Nuxt Module Hook](https://nuxt.com/docs/guide/going-further/hooks#nuxt-hooks-build-time).
8+
9+
::: warning
10+
If you're **NOT** using Nuxt `^3.8.1+`, you should use `// @ts-expect-error` when using the `vuetify:registerModule` nuxt module hook, TypeScript will complain.
11+
:::
812

913
## Nuxt Layers
1014

@@ -19,7 +23,7 @@ export default defineNuxtConfig({
1923
})
2024
```
2125

22-
## Nuxt Hook
26+
## Nuxt Module Hook
2327

2428
You can use a custom module to load your Vuetify configuration:
2529
```ts
@@ -36,6 +40,7 @@ and your module will load your configuration via `vuetify:registerModule` Nuxt h
3640
// modules/my-vuetify-module
3741
export default defineNuxtModule({
3842
setup(_options, nuxt) {
43+
// If you're using Nuxt < 3.8.1, you should add a ts-expect-error here
3944
nuxt.hook('vuetify:registerModule', register => register({
4045
moduleOptions: {
4146
/* module specific options */

0 commit comments

Comments
 (0)