vuetify-nuxt-module 0.4.6 β 0.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +99 -99
- package/dist/module.d.ts +12 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +163 -33
- package/dist/types.d.ts +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,99 +1,99 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
<picture>
|
|
3
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/userquin/vuetify-nuxt-module/raw/main/hero-dark.svg" />
|
|
4
|
-
<img alt="vuetify-nuxt-module - Zero-config Nuxt module for Vuetify" src='https://github.com/userquin/vuetify-nuxt-module/raw/main/hero.svg' alt="vuetify-nuxt-module - Zero-config Nuxt module for Vuetify"><br>
|
|
5
|
-
</picture>
|
|
6
|
-
<p>Zero-config Nuxt module for Vuetify</p>
|
|
7
|
-
</div>
|
|
8
|
-
|
|
9
|
-
<p align='center'>
|
|
10
|
-
<a href='https://www.npmjs.com/package/vuetify-nuxt-module' target="__blank">
|
|
11
|
-
<img src='https://img.shields.io/npm/v/vuetify-nuxt-module?color=33A6B8&label=' alt="NPM version">
|
|
12
|
-
</a>
|
|
13
|
-
<a href="https://www.npmjs.com/package/vuetify-nuxt-module" target="__blank">
|
|
14
|
-
<img alt="NPM Downloads" src="https://img.shields.io/npm/dm/vuetify-nuxt-module?color=476582&label=">
|
|
15
|
-
</a>
|
|
16
|
-
<a href="https://vuetify-nuxt-module.netlify.app/" target="__blank">
|
|
17
|
-
<img src="https://img.shields.io/static/v1?label=&message=docs%20%26%20guides&color=2e859c" alt="Docs & Guides">
|
|
18
|
-
</a>
|
|
19
|
-
<br>
|
|
20
|
-
<a href="https://github.com/userquin/vuetify-nuxt-module" target="__blank">
|
|
21
|
-
<img alt="GitHub stars" src="https://img.shields.io/github/stars/userquin/vuetify-nuxt-module?style=social">
|
|
22
|
-
</a>
|
|
23
|
-
</p>
|
|
24
|
-
|
|
25
|
-
<br>
|
|
26
|
-
|
|
27
|
-
## π Features
|
|
28
|
-
|
|
29
|
-
- π [**Documentation & guides**](https://vuetify-nuxt-module.netlify.app/)
|
|
30
|
-
- π **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)
|
|
32
|
-
- β‘ **Fully Tree Shakable**: by default, only the needed Vuetify components are imported
|
|
33
|
-
- π οΈ **Versatile**: custom Vuetify [directives](https://vuetifyjs.com/en/getting-started/installation/#manual-steps) and [labs components](https://vuetifyjs.com/en/labs/introduction/) registration
|
|
34
|
-
- β¨ **Configurable Styles**: configure your variables using [Vuetify SASS Variables](https://vuetifyjs.com/en/features/sass-variables/)
|
|
35
|
-
- π₯ **SSR**: automatic SSR detection and configuration
|
|
36
|
-
- π₯ **Pure CSS Icons**: no more font/js icons, use the new `
|
|
37
|
-
- π **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
|
|
38
|
-
- π **SVG Icons**: ready to use [@mdi/js](https://www.npmjs.com/package/@mdi/js) and [@fortawesome/vue-fontawesome](https://www.npmjs.com/package/@fortawesome/vue-fontawesome) SVG icons packs
|
|
39
|
-
- π¦ **Multiple Icon Sets**: register [multiple icon sets](https://vuetifyjs.com/en/features/icon-fonts/#multiple-icon-sets)
|
|
40
|
-
- π **I18n Ready**: install [@nuxtjs/i18n](https://v8.i18n.nuxtjs.org/) Nuxt module, and you're ready to use Vuetify [internationalization](https://vuetifyjs.com/en/features/internationalization/) features
|
|
41
|
-
- π **Date Components**: use Vuetify components [that require date functionality](https://vuetifyjs.com/en/features/dates/) installing and configuring one of the [@date-io](https://github.com/dmtrKovalenko/date-io#projects) adapters
|
|
42
|
-
- βοΈ **Auto-Import Vuetify Composables**: you don't need to import Vuetify composables manually, they are automatically imported for you
|
|
43
|
-
- π¨ **Vuetify Blueprints**: use [Vuetify Blueprints](https://vuetifyjs.com/en/features/blueprints/) to quickly scaffold components
|
|
44
|
-
- π© **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)
|
|
45
|
-
- π **Nuxt DevTools**: ready to inspect your Vuetify styles with the [Nuxt DevTools](https://github.com/nuxt/devtools) inspector
|
|
46
|
-
- π¦Ύ **Type Strong**: written in [TypeScript](https://www.typescriptlang.org/)
|
|
47
|
-
|
|
48
|
-
## π¦ Install
|
|
49
|
-
|
|
50
|
-
> Requires Vite, will not work with Webpack
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
npm i vuetify-nuxt-module -D
|
|
54
|
-
|
|
55
|
-
# yarn
|
|
56
|
-
yarn add vuetify-nuxt-module -D
|
|
57
|
-
|
|
58
|
-
# pnpm
|
|
59
|
-
pnpm add vuetify-nuxt-module -D
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
[](https://stackblitz.com/github/userquin/vuetify-nuxt-module)
|
|
63
|
-
|
|
64
|
-
## π¦ Usage
|
|
65
|
-
|
|
66
|
-
> `vuetify-nuxt-module` is strongly opinionated and has a built-in default configuration out of the box. You can use it without any configuration, and it will work for most use cases.
|
|
67
|
-
|
|
68
|
-
Add `vuetify-nuxt-module` module to `nuxt.config.ts` and configure it:
|
|
69
|
-
|
|
70
|
-
```ts
|
|
71
|
-
// Nuxt config file
|
|
72
|
-
import { defineNuxtConfig } from 'nuxt/config'
|
|
73
|
-
|
|
74
|
-
export default defineNuxtConfig({
|
|
75
|
-
modules: [
|
|
76
|
-
'vuetify-nuxt-module'
|
|
77
|
-
],
|
|
78
|
-
vuetify: {
|
|
79
|
-
moduleOptions: {
|
|
80
|
-
/* module specific options */
|
|
81
|
-
},
|
|
82
|
-
vuetifyOptions: {
|
|
83
|
-
/* vuetify options */
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
})
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Read the [π documentation](https://vuetify-nuxt-module.netlify.app/) for a complete guide on how to configure and use this module.
|
|
90
|
-
|
|
91
|
-
## π Full config
|
|
92
|
-
|
|
93
|
-
Check out the [types](https://github.com/userquin/vuetify-nuxt-module/blob/main/src/types.ts).
|
|
94
|
-
|
|
95
|
-
The virtual modules can be found in [configuration.d.ts](https://github.com/userquin/vuetify-nuxt-module/blob/main/configuration.d.ts) file.
|
|
96
|
-
|
|
97
|
-
## π License
|
|
98
|
-
|
|
99
|
-
[MIT](https://github.com/userquin/vuetify-nuxt-module/blob/main/LICENSE) License © 2023-PRESENT [JoaquΓn SΓ‘nchez](https://github.com/userquin)
|
|
1
|
+
<div align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/userquin/vuetify-nuxt-module/raw/main/hero-dark.svg" />
|
|
4
|
+
<img alt="vuetify-nuxt-module - Zero-config Nuxt module for Vuetify" src='https://github.com/userquin/vuetify-nuxt-module/raw/main/hero.svg' alt="vuetify-nuxt-module - Zero-config Nuxt module for Vuetify"><br>
|
|
5
|
+
</picture>
|
|
6
|
+
<p>Zero-config Nuxt module for Vuetify</p>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<p align='center'>
|
|
10
|
+
<a href='https://www.npmjs.com/package/vuetify-nuxt-module' target="__blank">
|
|
11
|
+
<img src='https://img.shields.io/npm/v/vuetify-nuxt-module?color=33A6B8&label=' alt="NPM version">
|
|
12
|
+
</a>
|
|
13
|
+
<a href="https://www.npmjs.com/package/vuetify-nuxt-module" target="__blank">
|
|
14
|
+
<img alt="NPM Downloads" src="https://img.shields.io/npm/dm/vuetify-nuxt-module?color=476582&label=">
|
|
15
|
+
</a>
|
|
16
|
+
<a href="https://vuetify-nuxt-module.netlify.app/" target="__blank">
|
|
17
|
+
<img src="https://img.shields.io/static/v1?label=&message=docs%20%26%20guides&color=2e859c" alt="Docs & Guides">
|
|
18
|
+
</a>
|
|
19
|
+
<br>
|
|
20
|
+
<a href="https://github.com/userquin/vuetify-nuxt-module" target="__blank">
|
|
21
|
+
<img alt="GitHub stars" src="https://img.shields.io/github/stars/userquin/vuetify-nuxt-module?style=social">
|
|
22
|
+
</a>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
<br>
|
|
26
|
+
|
|
27
|
+
## π Features
|
|
28
|
+
|
|
29
|
+
- π [**Documentation & guides**](https://vuetify-nuxt-module.netlify.app/)
|
|
30
|
+
- π **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)
|
|
32
|
+
- β‘ **Fully Tree Shakable**: by default, only the needed Vuetify components are imported
|
|
33
|
+
- π οΈ **Versatile**: custom Vuetify [directives](https://vuetifyjs.com/en/getting-started/installation/#manual-steps) and [labs components](https://vuetifyjs.com/en/labs/introduction/) registration
|
|
34
|
+
- β¨ **Configurable Styles**: configure your variables using [Vuetify SASS Variables](https://vuetifyjs.com/en/features/sass-variables/)
|
|
35
|
+
- π₯ **SSR**: automatic SSR detection and configuration
|
|
36
|
+
- π₯ **Pure CSS Icons**: no more font/js icons, use the new `unocss-mdi` icon set or build your own with UnoCSS Preset Icons
|
|
37
|
+
- π **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
|
|
38
|
+
- π **SVG Icons**: ready to use [@mdi/js](https://www.npmjs.com/package/@mdi/js) and [@fortawesome/vue-fontawesome](https://www.npmjs.com/package/@fortawesome/vue-fontawesome) SVG icons packs
|
|
39
|
+
- π¦ **Multiple Icon Sets**: register [multiple icon sets](https://vuetifyjs.com/en/features/icon-fonts/#multiple-icon-sets)
|
|
40
|
+
- π **I18n Ready**: install [@nuxtjs/i18n](https://v8.i18n.nuxtjs.org/) Nuxt module, and you're ready to use Vuetify [internationalization](https://vuetifyjs.com/en/features/internationalization/) features
|
|
41
|
+
- π **Date Components**: use Vuetify components [that require date functionality](https://vuetifyjs.com/en/features/dates/) installing and configuring one of the [@date-io](https://github.com/dmtrKovalenko/date-io#projects) adapters
|
|
42
|
+
- βοΈ **Auto-Import Vuetify Composables**: you don't need to import Vuetify composables manually, they are automatically imported for you
|
|
43
|
+
- π¨ **Vuetify Blueprints**: use [Vuetify Blueprints](https://vuetifyjs.com/en/features/blueprints/) to quickly scaffold components
|
|
44
|
+
- π© **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)
|
|
45
|
+
- π **Nuxt DevTools**: ready to inspect your Vuetify styles with the [Nuxt DevTools](https://github.com/nuxt/devtools) inspector
|
|
46
|
+
- π¦Ύ **Type Strong**: written in [TypeScript](https://www.typescriptlang.org/)
|
|
47
|
+
|
|
48
|
+
## π¦ Install
|
|
49
|
+
|
|
50
|
+
> Requires Vite, will not work with Webpack
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm i vuetify-nuxt-module -D
|
|
54
|
+
|
|
55
|
+
# yarn
|
|
56
|
+
yarn add vuetify-nuxt-module -D
|
|
57
|
+
|
|
58
|
+
# pnpm
|
|
59
|
+
pnpm add vuetify-nuxt-module -D
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
[](https://stackblitz.com/github/userquin/vuetify-nuxt-module)
|
|
63
|
+
|
|
64
|
+
## π¦ Usage
|
|
65
|
+
|
|
66
|
+
> `vuetify-nuxt-module` is strongly opinionated and has a built-in default configuration out of the box. You can use it without any configuration, and it will work for most use cases.
|
|
67
|
+
|
|
68
|
+
Add `vuetify-nuxt-module` module to `nuxt.config.ts` and configure it:
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
// Nuxt config file
|
|
72
|
+
import { defineNuxtConfig } from 'nuxt/config'
|
|
73
|
+
|
|
74
|
+
export default defineNuxtConfig({
|
|
75
|
+
modules: [
|
|
76
|
+
'vuetify-nuxt-module'
|
|
77
|
+
],
|
|
78
|
+
vuetify: {
|
|
79
|
+
moduleOptions: {
|
|
80
|
+
/* module specific options */
|
|
81
|
+
},
|
|
82
|
+
vuetifyOptions: {
|
|
83
|
+
/* vuetify options */
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Read the [π documentation](https://vuetify-nuxt-module.netlify.app/) for a complete guide on how to configure and use this module.
|
|
90
|
+
|
|
91
|
+
## π Full config
|
|
92
|
+
|
|
93
|
+
Check out the [types](https://github.com/userquin/vuetify-nuxt-module/blob/main/src/types.ts).
|
|
94
|
+
|
|
95
|
+
The virtual modules can be found in [configuration.d.ts](https://github.com/userquin/vuetify-nuxt-module/blob/main/configuration.d.ts) file.
|
|
96
|
+
|
|
97
|
+
## π License
|
|
98
|
+
|
|
99
|
+
[MIT](https://github.com/userquin/vuetify-nuxt-module/blob/main/LICENSE) License © 2023-PRESENT [JoaquΓn SΓ‘nchez](https://github.com/userquin)
|
package/dist/module.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
import * as vuetify from 'vuetify';
|
|
3
3
|
import { VuetifyOptions, LocaleOptions, RtlOptions } from 'vuetify';
|
|
4
|
+
import * as vuetify_locale from 'vuetify/locale';
|
|
4
5
|
import * as vuetify_labs_components from 'vuetify/labs/components';
|
|
5
6
|
import * as vuetify_directives from 'vuetify/directives';
|
|
6
7
|
import * as vuetify_components from 'vuetify/components';
|
|
@@ -90,6 +91,7 @@ type DirectiveName = keyof typeof vuetify_directives;
|
|
|
90
91
|
type Directives = boolean | DirectiveName | DirectiveName[];
|
|
91
92
|
type LabComponentName = keyof typeof vuetify_labs_components;
|
|
92
93
|
type LabComponents = boolean | LabComponentName | LabComponentName[];
|
|
94
|
+
type VuetifyLocale = keyof typeof vuetify_locale;
|
|
93
95
|
interface VOptions extends Partial<Omit<VuetifyOptions, 'ssr' | 'aliases' | 'components' | 'directives' | 'locale' | 'date' | 'icons'>> {
|
|
94
96
|
aliases?: Record<string, ComponentName>;
|
|
95
97
|
/**
|
|
@@ -105,10 +107,19 @@ interface VOptions extends Partial<Omit<VuetifyOptions, 'ssr' | 'aliases' | 'com
|
|
|
105
107
|
* - `locale`
|
|
106
108
|
* - `fallback`
|
|
107
109
|
* - `rtl`
|
|
110
|
+
* - `messages`
|
|
108
111
|
*
|
|
109
112
|
* The adapter will be `vuetify`, if you want to use another adapter, check `date` option.
|
|
110
113
|
*/
|
|
111
114
|
locale?: Omit<LocaleOptions, 'adapter'> & RtlOptions;
|
|
115
|
+
/**
|
|
116
|
+
* Include locale messages?
|
|
117
|
+
*
|
|
118
|
+
* When `@nuxtjs/i18n` Nuxt module is present, this option will be ignored.
|
|
119
|
+
*
|
|
120
|
+
* You can include the locales you want to use in your application, this module will load and configure the messages for you.
|
|
121
|
+
*/
|
|
122
|
+
localeMessages?: VuetifyLocale | VuetifyLocale[];
|
|
112
123
|
/**
|
|
113
124
|
* Include the lab components?
|
|
114
125
|
*
|
|
@@ -209,4 +220,4 @@ declare module '#app' {
|
|
|
209
220
|
|
|
210
221
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
|
|
211
222
|
|
|
212
|
-
export { ComponentName, Components, DateAdapter, DateOptions, DirectiveName, Directives, FontAwesomeSvgIconSet, FontIconSet, IconFontName, IconSetName, IconsOptions, JSSVGIconSet, LabComponentName, LabComponents, MOptions, ModuleOptions, VOptions, _default as default };
|
|
223
|
+
export { ComponentName, Components, DateAdapter, DateOptions, DirectiveName, Directives, FontAwesomeSvgIconSet, FontIconSet, IconFontName, IconSetName, IconsOptions, JSSVGIconSet, LabComponentName, LabComponents, MOptions, ModuleOptions, VOptions, VuetifyLocale, _default as default };
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { utimes, readFile } from 'node:fs/promises';
|
|
2
1
|
import { useLogger, defineNuxtModule, isNuxt3, getNuxtVersion, createResolver, hasNuxtModule, extendWebpackConfig, addImports, addPlugin } from '@nuxt/kit';
|
|
3
2
|
import defu from 'defu';
|
|
3
|
+
import { utimes, readFile } from 'node:fs/promises';
|
|
4
4
|
import { resolveVuetifyBase, normalizePath, writeStyles, cacheDir } from '@vuetify/loader-shared';
|
|
5
5
|
import { isAbsolute, join, relative } from 'pathe';
|
|
6
6
|
import { normalizePath as normalizePath$1 } from 'vite';
|
|
7
7
|
import { isPackageExists } from 'local-pkg';
|
|
8
8
|
|
|
9
|
-
const version = "0.4.
|
|
9
|
+
const version = "0.4.8";
|
|
10
10
|
|
|
11
11
|
function isSubdir(root, test) {
|
|
12
12
|
const relative$1 = relative(root, test);
|
|
@@ -184,11 +184,12 @@ const RESOLVED_VIRTUAL_VUETIFY_DATE_CONFIGURATION = `/@nuxt-vuetify-configuratio
|
|
|
184
184
|
const VIRTUAL_VUETIFY_ICONS_CONFIGURATION = "virtual:vuetify-icons-configuration";
|
|
185
185
|
const RESOLVED_VIRTUAL_VUETIFY_ICONS_CONFIGURATION = `/@nuxt-vuetify-configuration/${VIRTUAL_VUETIFY_ICONS_CONFIGURATION.slice("virtual:".length)}`;
|
|
186
186
|
|
|
187
|
-
function vuetifyConfigurationPlugin(isDev, i18n, directives, labComponents, vuetifyAppOptions) {
|
|
187
|
+
function vuetifyConfigurationPlugin(isDev, i18n, directives, labComponents, vuetifyAppOptions, componentsPromise, labComponentsPromise, logger) {
|
|
188
188
|
const {
|
|
189
189
|
directives: _directives,
|
|
190
190
|
date: _date,
|
|
191
191
|
icons: _icons,
|
|
192
|
+
localeMessages,
|
|
192
193
|
components,
|
|
193
194
|
aliases,
|
|
194
195
|
...newVuetifyOptions
|
|
@@ -207,7 +208,8 @@ function vuetifyConfigurationPlugin(isDev, i18n, directives, labComponents, vuet
|
|
|
207
208
|
delete newVuetifyOptions.locale.locale;
|
|
208
209
|
delete newVuetifyOptions.locale.fallback;
|
|
209
210
|
}
|
|
210
|
-
const result = buildConfiguration();
|
|
211
|
+
const result = await buildConfiguration();
|
|
212
|
+
const deepCopy = result.messages.length > 0;
|
|
211
213
|
return `${result.imports}
|
|
212
214
|
|
|
213
215
|
export const isDev = ${isDev}
|
|
@@ -216,13 +218,26 @@ export function vuetifyConfiguration() {
|
|
|
216
218
|
${result.directives}
|
|
217
219
|
${result.aliases}
|
|
218
220
|
${result.components}
|
|
221
|
+
${result.messages}
|
|
219
222
|
return options
|
|
220
223
|
}
|
|
224
|
+
${deepCopy ? `function deepCopy(src,des) {
|
|
225
|
+
for (const key in src) {
|
|
226
|
+
if (typeof src[key] === 'object') {
|
|
227
|
+
if (!typeof des[key] === 'object') des[key] = {}
|
|
228
|
+
deepCopy(src[key], des[key])
|
|
229
|
+
} else {
|
|
230
|
+
des[key] = src[key]
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return des
|
|
234
|
+
}
|
|
235
|
+
` : ""}
|
|
221
236
|
`;
|
|
222
237
|
}
|
|
223
238
|
}
|
|
224
239
|
};
|
|
225
|
-
function buildConfiguration() {
|
|
240
|
+
async function buildConfiguration() {
|
|
226
241
|
const dateOptions = vuetifyAppOptions.date;
|
|
227
242
|
const config = {
|
|
228
243
|
directives: "",
|
|
@@ -230,44 +245,103 @@ export function vuetifyConfiguration() {
|
|
|
230
245
|
aliasEntries: [],
|
|
231
246
|
aliases: aliases || {},
|
|
232
247
|
components: new Set(components ? Array.isArray(components) ? components : [components] : []),
|
|
233
|
-
labComponents: /* @__PURE__ */ new Set()
|
|
248
|
+
labComponents: /* @__PURE__ */ new Set(),
|
|
249
|
+
messages: ""
|
|
234
250
|
};
|
|
235
251
|
if (directives) {
|
|
236
252
|
if (typeof directives === "boolean") {
|
|
237
253
|
config.imports.push("import * as directives from 'vuetify/directives'");
|
|
238
254
|
config.directives = "options.directives = directives";
|
|
239
255
|
} else {
|
|
240
|
-
const useDirectives = Array.isArray(directives) ? directives : [directives];
|
|
256
|
+
const useDirectives = Array.isArray(directives) ? [...new Set(...directives)] : [directives];
|
|
241
257
|
config.imports.push(useDirectives.map((d) => `import { ${d} } from 'vuetify/directives/${d}'`).join("\n"));
|
|
242
258
|
config.directives = `options.directives = {${useDirectives.join(",")}}`;
|
|
243
259
|
}
|
|
244
260
|
}
|
|
245
|
-
|
|
261
|
+
const importMapComponents = await componentsPromise;
|
|
262
|
+
const componentsToImport = /* @__PURE__ */ new Map();
|
|
263
|
+
config.components.forEach((component) => {
|
|
264
|
+
const { from } = importMapComponents[component];
|
|
265
|
+
if (!from) {
|
|
266
|
+
logger.warn(`Component ${component} not found in Vuetify.`);
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
const parts = from.split("/");
|
|
270
|
+
if (parts.length < 2) {
|
|
271
|
+
logger.warn(`Component ${component} not found in Vuetify, please report a new issue.`);
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (!componentsToImport.has(parts[1]))
|
|
275
|
+
componentsToImport.set(parts[1], []);
|
|
276
|
+
const componentsArray = componentsToImport.get(parts[1]);
|
|
277
|
+
if (!componentsArray.includes(component))
|
|
278
|
+
componentsArray.push(component);
|
|
279
|
+
});
|
|
246
280
|
Object.entries(config.aliases).forEach(([key, component]) => {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
281
|
+
const { from } = importMapComponents[component];
|
|
282
|
+
if (!from) {
|
|
283
|
+
logger.warn(`Component ${component} not found in Vuetify.`);
|
|
284
|
+
return;
|
|
250
285
|
}
|
|
286
|
+
const parts = from.split("/");
|
|
287
|
+
if (parts.length < 2) {
|
|
288
|
+
logger.warn(`Component ${component} not found in Vuetify, please report a new issue.`);
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
if (!componentsToImport.has(parts[1]))
|
|
292
|
+
componentsToImport.set(parts[1], []);
|
|
293
|
+
const componentsArray = componentsToImport.get(parts[1]);
|
|
294
|
+
if (!componentsArray.includes(component))
|
|
295
|
+
componentsArray.push(component);
|
|
251
296
|
config.aliasEntries.push(`'${key}': ${component}`);
|
|
252
297
|
});
|
|
298
|
+
componentsToImport.forEach((componentsArray, from) => {
|
|
299
|
+
config.imports.push(`import {${componentsArray.join(",")}} from 'vuetify/components/${from}'`);
|
|
300
|
+
});
|
|
253
301
|
let addDatePicker = true;
|
|
254
302
|
if (labComponents) {
|
|
303
|
+
const useLabComponents = [];
|
|
255
304
|
if (typeof labComponents === "boolean") {
|
|
256
305
|
config.imports.push("import * as labsComponents from 'vuetify/labs/components'");
|
|
257
306
|
config.labComponents.add("*");
|
|
258
307
|
addDatePicker = false;
|
|
308
|
+
} else if (typeof labComponents === "string") {
|
|
309
|
+
useLabComponents.push(labComponents);
|
|
259
310
|
} else if (Array.isArray(labComponents)) {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
311
|
+
useLabComponents.push(...labComponents);
|
|
312
|
+
}
|
|
313
|
+
if (useLabComponents.length) {
|
|
314
|
+
componentsToImport.clear();
|
|
315
|
+
const importMapLabComponents = await labComponentsPromise;
|
|
316
|
+
useLabComponents.forEach((component) => {
|
|
317
|
+
const { from } = importMapLabComponents[component];
|
|
318
|
+
if (!from) {
|
|
319
|
+
logger.warn(`Lab Component ${component} not found in Vuetify.`);
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
const parts = from.split("/");
|
|
323
|
+
if (parts.length < 2) {
|
|
324
|
+
logger.warn(`Lab Component ${component} not found in Vuetify, please report a new issue.`);
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
if (!componentsToImport.has(parts[1]))
|
|
328
|
+
componentsToImport.set(parts[1], []);
|
|
329
|
+
const componentsArray = componentsToImport.get(parts[1]);
|
|
330
|
+
if (!componentsArray.includes(component))
|
|
331
|
+
componentsArray.push(component);
|
|
332
|
+
config.labComponents.add(component);
|
|
333
|
+
});
|
|
334
|
+
if (dateOptions && !config.labComponents.has("VDatePicker")) {
|
|
335
|
+
const entry = componentsToImport.get("VDatePicker");
|
|
336
|
+
if (entry) {
|
|
337
|
+
entry.push("VDatePicker");
|
|
338
|
+
config.labComponents.add("VDatePicker");
|
|
264
339
|
}
|
|
340
|
+
}
|
|
341
|
+
componentsToImport.forEach((componentsArray, from) => {
|
|
342
|
+
config.imports.push(`import {${componentsArray.join(",")}} from 'vuetify/labs/${from}'`);
|
|
265
343
|
});
|
|
266
344
|
addDatePicker = !config.labComponents.has("VDatePicker");
|
|
267
|
-
} else {
|
|
268
|
-
config.imports.push(`import {${labComponents}} from 'vuetify/labs/${labComponents}'`);
|
|
269
|
-
config.labComponents.add(labComponents);
|
|
270
|
-
addDatePicker = labComponents !== "VDatePicker";
|
|
271
345
|
}
|
|
272
346
|
}
|
|
273
347
|
if (dateOptions && addDatePicker) {
|
|
@@ -290,11 +364,31 @@ export function vuetifyConfiguration() {
|
|
|
290
364
|
else
|
|
291
365
|
componentsEntry = `options.components = {${Array.from(config.labComponents).join(",")}}`;
|
|
292
366
|
}
|
|
367
|
+
if (
|
|
368
|
+
/*! i18n && */
|
|
369
|
+
localeMessages
|
|
370
|
+
) {
|
|
371
|
+
const useLocales = Array.isArray(localeMessages) ? [.../* @__PURE__ */ new Set([...localeMessages])] : [localeMessages];
|
|
372
|
+
config.imports.push(`import {${useLocales.join(",")}} from 'vuetify/locale'`);
|
|
373
|
+
config.messages = `
|
|
374
|
+
options.locale = options.locale || {}
|
|
375
|
+
options.locale.messages = options.locale.messages || {}
|
|
376
|
+
${useLocales.map((locale) => {
|
|
377
|
+
return `
|
|
378
|
+
if ('${locale}' in options.locale.messages)
|
|
379
|
+
options.locale.messages['${locale}'] = deepCopy(options.locale.messages['${locale}'],${locale})
|
|
380
|
+
else
|
|
381
|
+
options.locale.messages['${locale}'] = ${locale}
|
|
382
|
+
`;
|
|
383
|
+
}).join("")}
|
|
384
|
+
`;
|
|
385
|
+
}
|
|
293
386
|
return {
|
|
294
387
|
imports: config.imports.length ? config.imports.join("\n") : "",
|
|
295
388
|
components: componentsEntry,
|
|
296
389
|
aliases: config.aliasEntries.length ? `options.aliases = {${config.aliasEntries.join(",")}}` : "",
|
|
297
|
-
directives: config.directives
|
|
390
|
+
directives: config.directives,
|
|
391
|
+
messages: config.messages
|
|
298
392
|
};
|
|
299
393
|
}
|
|
300
394
|
}
|
|
@@ -617,6 +711,19 @@ toKebabCase.cache = /* @__PURE__ */ new Map();
|
|
|
617
711
|
|
|
618
712
|
function detectDate() {
|
|
619
713
|
const result = [];
|
|
714
|
+
[
|
|
715
|
+
"date-fns",
|
|
716
|
+
"moment",
|
|
717
|
+
"luxon",
|
|
718
|
+
"dayjs",
|
|
719
|
+
"js-joda",
|
|
720
|
+
"date-fns-jalali",
|
|
721
|
+
"jalaali",
|
|
722
|
+
"hijri"
|
|
723
|
+
].forEach((adapter) => {
|
|
724
|
+
if (isPackageExists(`@date-io/${adapter}`))
|
|
725
|
+
result.push(adapter);
|
|
726
|
+
});
|
|
620
727
|
return result;
|
|
621
728
|
}
|
|
622
729
|
function cleanupBlueprint(vuetifyOptions) {
|
|
@@ -631,6 +738,30 @@ function cleanupBlueprint(vuetifyOptions) {
|
|
|
631
738
|
vuetifyOptions.blueprint = blueprint;
|
|
632
739
|
}
|
|
633
740
|
}
|
|
741
|
+
function checkVuetifyPlugins(config) {
|
|
742
|
+
let plugin = config.plugins?.find((p) => p && typeof p === "object" && "name" in p && p.name === "vuetify:import");
|
|
743
|
+
if (plugin)
|
|
744
|
+
throw new Error("Remove vite-plugin-vuetify plugin from Vite Plugins entry in Nuxt config file!");
|
|
745
|
+
plugin = config.plugins?.find((p) => p && typeof p === "object" && "name" in p && p.name === "vuetify:styles");
|
|
746
|
+
if (plugin)
|
|
747
|
+
throw new Error("Remove vite-plugin-vuetify plugin from Vite Plugins entry in Nuxt config file!");
|
|
748
|
+
}
|
|
749
|
+
function resolveVuetifyComponents(resolver) {
|
|
750
|
+
const vuetifyBase = resolveVuetifyBase();
|
|
751
|
+
const componentsPromise = importMapResolver();
|
|
752
|
+
const labComponentsPromise = importMapLabResolver();
|
|
753
|
+
return {
|
|
754
|
+
vuetifyBase,
|
|
755
|
+
componentsPromise,
|
|
756
|
+
labComponentsPromise
|
|
757
|
+
};
|
|
758
|
+
async function importMapResolver() {
|
|
759
|
+
return JSON.parse(await readFile(resolver.resolve(vuetifyBase, "dist/json/importMap.json"), "utf-8")).components;
|
|
760
|
+
}
|
|
761
|
+
async function importMapLabResolver() {
|
|
762
|
+
return JSON.parse(await readFile(resolver.resolve(vuetifyBase, "dist/json/importMap-labs.json"), "utf-8")).components;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
634
765
|
|
|
635
766
|
async function mergeVuetifyModules(options, nuxt) {
|
|
636
767
|
const moduleOptions = [];
|
|
@@ -723,7 +854,7 @@ const module = defineNuxtModule({
|
|
|
723
854
|
nuxt.options.css.unshift("vuetify/styles/main.sass");
|
|
724
855
|
else if (styles === true)
|
|
725
856
|
nuxt.options.css.unshift("vuetify/styles");
|
|
726
|
-
else if (typeof styles === "object" &&
|
|
857
|
+
else if (typeof styles === "object" && typeof styles?.configFile === "string")
|
|
727
858
|
nuxt.options.css.unshift(styles.configFile);
|
|
728
859
|
if (icons.enabled) {
|
|
729
860
|
icons.local?.forEach((css) => nuxt.options.css.push(css));
|
|
@@ -744,9 +875,13 @@ const module = defineNuxtModule({
|
|
|
744
875
|
nuxt.hook("prepare:types", ({ references }) => {
|
|
745
876
|
references.push({ types: "vuetify-nuxt-module/configuration" });
|
|
746
877
|
});
|
|
878
|
+
const {
|
|
879
|
+
vuetifyBase,
|
|
880
|
+
componentsPromise,
|
|
881
|
+
labComponentsPromise
|
|
882
|
+
} = resolveVuetifyComponents(resolver);
|
|
747
883
|
nuxt.hook("components:extend", async (c) => {
|
|
748
|
-
const
|
|
749
|
-
const { components } = JSON.parse(await readFile(resolver.resolve(vuetifyBase, "dist/json/importMap.json"), "utf-8"));
|
|
884
|
+
const components = await componentsPromise;
|
|
750
885
|
Object.keys(components).forEach((component) => {
|
|
751
886
|
const from = components[component].from;
|
|
752
887
|
c.push({
|
|
@@ -754,7 +889,7 @@ const module = defineNuxtModule({
|
|
|
754
889
|
kebabName: toKebabCase(component),
|
|
755
890
|
export: component,
|
|
756
891
|
filePath: `${resolver.resolve(vuetifyBase, `lib/${from}`)}`,
|
|
757
|
-
shortPath: `components/${from}`,
|
|
892
|
+
shortPath: `vuetify/components/${from}`,
|
|
758
893
|
chunkName: toKebabCase(component),
|
|
759
894
|
prefetch: false,
|
|
760
895
|
preload: false,
|
|
@@ -787,7 +922,10 @@ const module = defineNuxtModule({
|
|
|
787
922
|
i18n,
|
|
788
923
|
directives,
|
|
789
924
|
labComponents,
|
|
790
|
-
vuetifyAppOptions
|
|
925
|
+
vuetifyAppOptions,
|
|
926
|
+
componentsPromise,
|
|
927
|
+
labComponentsPromise,
|
|
928
|
+
logger
|
|
791
929
|
));
|
|
792
930
|
viteInlineConfig.plugins.push(vuetifyIconsPlugin(
|
|
793
931
|
nuxt.options.dev,
|
|
@@ -821,13 +959,5 @@ const module = defineNuxtModule({
|
|
|
821
959
|
}
|
|
822
960
|
}
|
|
823
961
|
});
|
|
824
|
-
function checkVuetifyPlugins(config) {
|
|
825
|
-
let plugin = config.plugins?.find((p) => p && typeof p === "object" && "name" in p && p.name === "vuetify:import");
|
|
826
|
-
if (plugin)
|
|
827
|
-
throw new Error("Remove vite-plugin-vuetify plugin from Vite Plugins entry in Nuxt config file!");
|
|
828
|
-
plugin = config.plugins?.find((p) => p && typeof p === "object" && "name" in p && p.name === "vuetify:styles");
|
|
829
|
-
if (plugin)
|
|
830
|
-
throw new Error("Remove vite-plugin-vuetify plugin from Vite Plugins entry in Nuxt config file!");
|
|
831
|
-
}
|
|
832
962
|
|
|
833
963
|
export { module as default };
|
package/dist/types.d.ts
CHANGED
|
@@ -12,4 +12,4 @@ declare module 'nuxt/schema' {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
export { ComponentName, Components, DateAdapter, DateOptions, DirectiveName, Directives, FontAwesomeSvgIconSet, FontIconSet, IconFontName, IconSetName, IconsOptions, JSSVGIconSet, LabComponentName, LabComponents, MOptions, ModuleOptions, VOptions, default } from './module'
|
|
15
|
+
export { ComponentName, Components, DateAdapter, DateOptions, DirectiveName, Directives, FontAwesomeSvgIconSet, FontIconSet, IconFontName, IconSetName, IconsOptions, JSSVGIconSet, LabComponentName, LabComponents, MOptions, ModuleOptions, VOptions, VuetifyLocale, default } from './module'
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vuetify-nuxt-module",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.4.
|
|
5
|
-
"packageManager": "pnpm@8.6.
|
|
4
|
+
"version": "0.4.8",
|
|
5
|
+
"packageManager": "pnpm@8.6.9",
|
|
6
6
|
"description": "Zero-Config Nuxt Module for Vuetify",
|
|
7
7
|
"author": "userquin <userquin@gmail.com>",
|
|
8
8
|
"license": "MIT",
|
|
@@ -59,13 +59,13 @@
|
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"@nuxt/kit": "^3.6.2",
|
|
61
61
|
"vite-plugin-vuetify": "^1.0.2",
|
|
62
|
-
"vuetify": "^3.3.
|
|
62
|
+
"vuetify": "^3.3.9"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@nuxt/kit": "^3.6.2",
|
|
66
66
|
"defu": "^6.1.2",
|
|
67
67
|
"vite-plugin-vuetify": "^1.0.2",
|
|
68
|
-
"vuetify": "^3.3.
|
|
68
|
+
"vuetify": "^3.3.9"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@antfu/eslint-config": "^0.39.6",
|