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 */

docs/guide/nuxt-plugin-hooks.md renamed to docs/guide/nuxt-runtime-hooks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Nuxt Plugin Hooks
1+
# Nuxt Runtime Hooks
22

3-
This module configures and registers Vuetify using Nuxt plugins via `vuetify:configuration` hook.
3+
This module configures and registers Vuetify using Nuxt plugins via `vuetify:configuration` runtime hook.
44

55
`vuetify:configuration` hook is for internal use and not meant to be used by third-party plugins or directly from your application.
66
This module will expose only the necessary Nuxt plugins to configure Vuetify using the options you've configured in your application:

docs/index.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ features:
2525
details: Sensible built-in default Vuetify configuration for common use cases
2626
- icon: 🔌
2727
title: Extensible
28-
details: Expose the ability to customize the Vuetify configuration via Nuxt Plugin Hooks
29-
link: /guide/nuxt-plugin-hooks
30-
linkText: Nuxt Plugin Hooks
28+
details: Expose the ability to customize the Vuetify configuration via Nuxt Runtime Hooks
29+
link: /guide/nuxt-runtime-hooks
30+
linkText: Nuxt Runtime Hooks
3131
- icon:
3232
title: Fully tree shakable
3333
details: By default, only the needed Vuetify components are imported
@@ -43,10 +43,10 @@ features:
4343
link: /guide/server-side-rendering
4444
linkText: Server Side Rendering
4545
- icon: 🔩
46-
title: Nuxt Layers and Hooks
47-
details: Load your Vuetify configuration using Nuxt Layers or using a custom module via custom Nuxt Hook
48-
link: /guide/nuxt-layers-and-hooks
49-
linkText: Nuxt Layers and Hooks
46+
title: Nuxt Layers and Module Hooks
47+
details: Load your Vuetify configuration using Nuxt Layers or using a custom module via custom Nuxt Module Hook
48+
link: /guide/nuxt-layers-and-module-hooks
49+
linkText: Nuxt Layers and Module Hooks
5050
- icon: 📥
5151
title: Vuetify Configuration File
5252
details: Configure your Vuetify options using a custom <strong>vuetify.config</strong> file, no dev server restart needed

docs/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
"generate-pwa-icons": "pwa-assets-generator"
1212
},
1313
"dependencies": {
14-
"vue": "^3.3.4"
14+
"vue": "^3.3.8"
1515
},
1616
"devDependencies": {
1717
"@iconify-json/carbon": "^1.1.21",
1818
"@types/node": "^20.6.0",
19-
"@vite-pwa/assets-generator": "^0.0.10",
20-
"@vite-pwa/vitepress": "^0.2.3",
19+
"@vite-pwa/assets-generator": "^0.0.11",
20+
"@vite-pwa/vitepress": "^0.3.0",
2121
"sitemap": "^7.1.1",
22-
"unocss": "^0.53.5",
23-
"vitepress": "1.0.0-rc.24"
22+
"unocss": "^0.57.3",
23+
"vitepress": "1.0.0-rc.29"
2424
}
2525
}

docs/tsconfig.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
{
22
"compilerOptions": {
3-
"baseUrl": ".",
4-
"module": "esnext",
53
"target": "esnext",
64
"lib": ["DOM", "ESNext"],
7-
"strict": true,
85
"jsx": "preserve",
9-
"esModuleInterop": true,
10-
"skipLibCheck": true,
6+
"module": "esnext",
117
"moduleResolution": "node",
12-
"resolveJsonModule": true,
13-
"noUnusedLocals": true,
14-
"strictNullChecks": true,
15-
"forceConsistentCasingInFileNames": true,
8+
"baseUrl": ".",
169
"types": [
1710
"vite/client",
1811
"vite-plugin-pwa/vanillajs",
1912
"vitepress"
20-
]
13+
],
14+
"resolveJsonModule": true,
15+
"esModuleInterop": true,
16+
"forceConsistentCasingInFileNames": true,
17+
"strict": true,
18+
"strictNullChecks": true,
19+
"noUnusedLocals": true,
20+
"skipLibCheck": true
2121
},
2222
"include": [
2323
"./*.ts",

package.json

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vuetify-nuxt-module",
33
"type": "module",
44
"version": "0.6.7",
5-
"packageManager": "pnpm@8.10.2",
5+
"packageManager": "pnpm@8.10.5",
66
"description": "Zero-Config Nuxt Module for Vuetify",
77
"author": "userquin <userquin@gmail.com>",
88
"license": "MIT",
@@ -21,18 +21,17 @@
2121
],
2222
"exports": {
2323
".": {
24-
"types": "./dist/types.d.ts",
25-
"require": "./dist/module.cjs",
26-
"import": "./dist/module.mjs"
24+
"types": "./dist/types.d.mts",
25+
"default": "./dist/module.mjs"
2726
},
2827
"./custom-configuration": {
2928
"types": "./custom-configuration.d.ts",
30-
"require": "./custom-configuration.cjs",
31-
"import": "./custom-configuration.mjs"
29+
"default": "./custom-configuration.mjs"
3230
},
3331
"./configuration": {
3432
"types": "./configuration.d.ts"
35-
}
33+
},
34+
"./*": "./*"
3635
},
3736
"main": "./dist/module.cjs",
3837
"types": "./dist/types.d.ts",
@@ -43,7 +42,7 @@
4342
"*.mjs"
4443
],
4544
"scripts": {
46-
"prepack": "nuxt-module-build prepare && nuxt-module-build",
45+
"prepack": "nuxt-module-build prepare && nuxt-module-build build",
4746
"dev": "nuxi dev playground",
4847
"dev:multiple-json": "MULTIPLE_LANG_FILES=true nuxi dev playground",
4948
"dev:prepare": "nuxt-module-build --stub && nuxt-module-build prepare && nuxi prepare playground",
@@ -58,48 +57,52 @@
5857
"docs:serve": "pnpm -C docs run serve",
5958
"lint": "eslint .",
6059
"lint:fix": "nr lint --fix",
60+
"publint": "publint",
6161
"test": "vitest run",
6262
"test:watch": "vitest watch",
6363
"release": "bumpp && npm publish"
6464
},
6565
"dependencies": {
66-
"@nuxt/kit": "^3.6.2",
67-
"defu": "^6.1.2",
66+
"@nuxt/kit": "^3.8.2",
67+
"defu": "^6.1.3",
6868
"destr": "^2.0.2",
6969
"local-pkg": "^0.5.0",
7070
"pathe": "^1.1.1",
7171
"perfect-debounce": "^1.0.0",
7272
"ufo": "^1.3.1",
73-
"unconfig": "^0.3.9",
73+
"unconfig": "^0.3.11",
7474
"vite-plugin-vuetify": "^1.0.2",
75-
"vuetify": "^3.3.23"
75+
"vuetify": "^3.4.3"
7676
},
7777
"devDependencies": {
78-
"@antfu/eslint-config": "^0.41.0",
79-
"@antfu/ni": "^0.21.8",
78+
"@antfu/eslint-config": "^0.43.1",
79+
"@antfu/ni": "^0.21.10",
8080
"@date-io/luxon": "^2.17.0",
81-
"@fortawesome/fontawesome-svg-core": "^6.4.0",
82-
"@fortawesome/free-solid-svg-icons": "^6.4.0",
83-
"@fortawesome/vue-fontawesome": "^3.0.3",
81+
"@fortawesome/fontawesome-svg-core": "^6.4.2",
82+
"@fortawesome/free-solid-svg-icons": "^6.4.2",
83+
"@fortawesome/vue-fontawesome": "^3.0.5",
8484
"@iconify-json/carbon": "^1.1.21",
85-
"@iconify-json/mdi": "^1.1.54",
86-
"@mdi/js": "^7.2.96",
87-
"@nuxt/devtools": "^0.7.0",
88-
"@nuxt/module-builder": "^0.4.0",
89-
"@nuxt/schema": "^3.6.5",
90-
"@nuxt/test-utils": "^3.6.5",
91-
"@nuxtjs/i18n": "8.0.0-rc.5",
92-
"@parcel/watcher": "^2.2.0",
85+
"@iconify-json/mdi": "^1.1.55",
86+
"@mdi/js": "^7.3.67",
87+
"@nuxt/devtools": "^0.8.5",
88+
"@nuxt/module-builder": "^0.5.4",
89+
"@nuxt/schema": "^3.8.2",
90+
"@nuxt/test-utils": "^3.8.1",
91+
"@nuxtjs/i18n": "npm:@nuxtjs/i18n-edge",
92+
"@parcel/watcher": "^2.3.0",
9393
"@types/node": "^18",
94-
"@unocss/nuxt": "^0.53.6",
94+
"@unocss/nuxt": "^0.57.7",
9595
"bumpp": "^9.2.0",
96-
"eslint": "^8.49.0",
97-
"luxon": "^3.3.0",
98-
"nuxt": "^3.6.5",
96+
"eslint": "^8.54.0",
97+
"luxon": "^3.4.3",
98+
"nuxt": "^3.8.2",
99+
"publint": "^0.2.5",
100+
"rimraf": "^5.0.5",
99101
"sass": "^1.63.6",
100-
"typescript": "^5.2.2",
101-
"vite": "^4.3.9",
102-
"vitest": "^0.31.4"
102+
"typescript": "^5.3.2",
103+
"vite": "^4.5.0",
104+
"vitest": "^0.34.6",
105+
"vue-tsc": "^1.8.22"
103106
},
104107
"build": {
105108
"externals": [

playground/.nuxtrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
typescript.tsConfig.exclude[]=../src/runtime

playground/layer-module/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { defineNuxtModule } from '@nuxt/kit'
22

33
export default defineNuxtModule({
44
setup(_options, nuxt) {
5-
nuxt.hook('vuetify:registerModule', (register: any) => register({
5+
nuxt.hook('vuetify:registerModule', registerModule => registerModule({
66
vuetifyOptions: {
77
aliases: {
88
MyBtn: 'VBtn',

playground/layer-module/nuxt.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export default defineNuxtConfig({
22
// since it is local, the path is relative to the playground folder
3-
modules: ['../src/module'],
43
// @ts-expect-error just ignore types
54
setup(_options, nuxt) {
65
nuxt.hook('vuetify:registerModule', (register: any) => register({

playground/layers/vuetify-layer/nuxt.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export default defineNuxtConfig({
22
// since it is local, the path is relative to the playground folder
3-
modules: ['../src/module'],
43
// vuetify: {
54
// vuetifyOptions: './vuetify.config.ts',
65
/* vuetifyOptions: {

playground/layers/vuetify-layer/vuetify.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ExternalVuetifyOptions } from '../../../src/types'
1+
import type { ExternalVuetifyOptions } from 'vuetify-nuxt-module'
22

33
/*
44
import { defineVuetifyConfiguration } from '../../../custom-configuration'

0 commit comments

Comments
 (0)