vuetify-nuxt-module 0.10.1 → 0.10.2

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/dist/module.d.mts CHANGED
@@ -414,7 +414,7 @@ interface ModuleRuntimeHooks {
414
414
  }) => HookResult;
415
415
  }
416
416
  declare module '#app' {
417
- interface RuntimeNuxtHooks {
417
+ interface ModuleRuntimeHooks {
418
418
  'vuetify:configuration': (options: {
419
419
  isDev: boolean;
420
420
  vuetifyOptions: VuetifyOptions;
package/dist/module.d.ts CHANGED
@@ -414,7 +414,7 @@ interface ModuleRuntimeHooks {
414
414
  }) => HookResult;
415
415
  }
416
416
  declare module '#app' {
417
- interface RuntimeNuxtHooks {
417
+ interface ModuleRuntimeHooks {
418
418
  'vuetify:configuration': (options: {
419
419
  isDev: boolean;
420
420
  vuetifyOptions: VuetifyOptions;
package/dist/module.json CHANGED
@@ -5,5 +5,5 @@
5
5
  "nuxt": "^3.6.5",
6
6
  "bridge": false
7
7
  },
8
- "version": "0.10.1"
8
+ "version": "0.10.2"
9
9
  }
package/dist/module.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { addVitePlugin, extendWebpackConfig, addImports, addPlugin, addPluginTemplate, useLogger, defineNuxtModule, isNuxt3, getNuxtVersion, createResolver, hasNuxtModule } from '@nuxt/kit';
1
+ import { addVitePlugin, addPluginTemplate, extendWebpackConfig, addImports, addPlugin, useLogger, defineNuxtModule, isNuxt3, getNuxtVersion, createResolver, hasNuxtModule } from '@nuxt/kit';
2
2
  import { isPackageExists, getPackageInfo } from 'local-pkg';
3
3
  import defu from 'defu';
4
4
  import { debounce } from 'perfect-debounce';
@@ -14,7 +14,7 @@ import { parseQuery, parseURL } from 'ufo';
14
14
  import destr from 'destr';
15
15
  import { transformAssetUrls } from 'vite-plugin-vuetify';
16
16
 
17
- const version = "0.10.1";
17
+ const version = "0.10.2";
18
18
 
19
19
  const VIRTUAL_VUETIFY_CONFIGURATION = "virtual:vuetify-configuration";
20
20
  const RESOLVED_VIRTUAL_VUETIFY_CONFIGURATION = `/@nuxt-vuetify-configuration/${VIRTUAL_VUETIFY_CONFIGURATION.slice("virtual:".length)}`;
@@ -1160,6 +1160,61 @@ function configureVite(configKey, nuxt, ctx) {
1160
1160
  });
1161
1161
  }
1162
1162
 
1163
+ function addVuetifyNuxtPlugins(nuxt, ctx) {
1164
+ addVuetifyNuxtPlugin(nuxt, ctx, "client");
1165
+ addVuetifyNuxtPlugin(nuxt, ctx, "server");
1166
+ }
1167
+ function addVuetifyNuxtPlugin(nuxt, ctx, mode) {
1168
+ addPluginTemplate({
1169
+ filename: `vuetify-nuxt-plugin.${mode}.mjs`,
1170
+ name: `vuetify:nuxt:${mode}:plugin`,
1171
+ write: false,
1172
+ mode,
1173
+ getContents() {
1174
+ const dependsOn = ["vuetify:icons:plugin"];
1175
+ if (ctx.ssrClientHints.enabled) {
1176
+ if (mode === "client")
1177
+ dependsOn.push("vuetify:client-hints:client:plugin");
1178
+ else
1179
+ dependsOn.push("vuetify:client-hints:server:plugin");
1180
+ }
1181
+ if (ctx.i18n) {
1182
+ dependsOn.push("vuetify:i18n:plugin");
1183
+ }
1184
+ if (nuxt.options.dev || ctx.dateAdapter) {
1185
+ if (ctx.i18n) {
1186
+ dependsOn.push("vuetify:date-i18n:plugin");
1187
+ } else {
1188
+ dependsOn.push("vuetify:date:plugin");
1189
+ }
1190
+ }
1191
+ return `
1192
+ import { defineNuxtPlugin } from '#imports'
1193
+ import { isDev, vuetifyConfiguration } from 'virtual:vuetify-configuration'
1194
+ import { createVuetify } from 'vuetify'
1195
+
1196
+ export default defineNuxtPlugin({
1197
+ name: 'vuetify:nuxt:${mode}:plugin',
1198
+ order: 25,
1199
+ dependsOn: ${JSON.stringify(dependsOn)},
1200
+ parallel: true,
1201
+ async setup(nuxtApp) {
1202
+ const vuetifyOptions = vuetifyConfiguration()
1203
+ await nuxtApp.hooks.callHook('vuetify:configuration', { isDev, vuetifyOptions })
1204
+ await nuxtApp.hooks.callHook('vuetify:before-create', { isDev, vuetifyOptions })
1205
+ const vuetify = createVuetify(vuetifyOptions)
1206
+ nuxtApp.vueApp.use(vuetify)
1207
+ nuxtApp.provide('vuetify', vuetify)
1208
+ await nuxtApp.hooks.callHook('vuetify:ready', vuetify)
1209
+ if (process.client)
1210
+ isDev && console.log('Vuetify 3 initialized', vuetify)
1211
+ },
1212
+ })
1213
+ `;
1214
+ }
1215
+ });
1216
+ }
1217
+
1163
1218
  function configureNuxt(configKey, nuxt, ctx) {
1164
1219
  const {
1165
1220
  importComposables,
@@ -1204,14 +1259,7 @@ function configureNuxt(configKey, nuxt, ctx) {
1204
1259
  meta: { docsUrl: `https://vuetifyjs.com/en/api/${toKebabCase(name)}/` }
1205
1260
  })));
1206
1261
  }
1207
- let addHttpClientHintsPlugin = "";
1208
1262
  if (ctx.ssrClientHints.enabled) {
1209
- addHttpClientHintsPlugin = `
1210
- if (import.meta.client)
1211
- dependsOn.push('vuetify:client-hints:client:plugin')
1212
- if (import.meta.server)
1213
- dependsOn.push('vuetify:client-hints:server:plugin')
1214
- `;
1215
1263
  addPlugin({
1216
1264
  src: ctx.resolver.resolve(runtimeDir, "plugins/vuetify-client-hints.client"),
1217
1265
  mode: "client"
@@ -1225,61 +1273,26 @@ dependsOn.push('vuetify:client-hints:server:plugin')
1225
1273
  src: ctx.resolver.resolve(runtimeDir, "plugins/vuetify-no-client-hints")
1226
1274
  });
1227
1275
  }
1228
- const dependsOn = ["vuetify:icons:plugin"];
1229
1276
  addPlugin({
1230
1277
  src: ctx.resolver.resolve(runtimeDir, "plugins/vuetify-icons")
1231
1278
  });
1232
1279
  if (ctx.i18n) {
1233
- dependsOn.push("vuetify:i18n:plugin");
1234
1280
  addPlugin({
1235
1281
  src: ctx.resolver.resolve(runtimeDir, "plugins/vuetify-i18n")
1236
1282
  });
1237
1283
  }
1238
1284
  if (nuxt.options.dev || ctx.dateAdapter) {
1239
1285
  if (ctx.i18n) {
1240
- dependsOn.push("vuetify:date-i18n:plugin");
1241
1286
  addPlugin({
1242
1287
  src: ctx.resolver.resolve(runtimeDir, "plugins/vuetify-i18n-date")
1243
1288
  });
1244
1289
  } else {
1245
- dependsOn.push("vuetify:date:plugin");
1246
1290
  addPlugin({
1247
1291
  src: ctx.resolver.resolve(runtimeDir, "plugins/vuetify-date")
1248
1292
  });
1249
1293
  }
1250
1294
  }
1251
- addPluginTemplate({
1252
- filename: "vuetify-nuxt-plugin.mjs",
1253
- write: false,
1254
- getContents() {
1255
- return `
1256
- import { defineNuxtPlugin } from '#imports'
1257
- import { isDev, vuetifyConfiguration } from 'virtual:vuetify-configuration'
1258
- import { createVuetify } from 'vuetify'
1259
-
1260
- const dependsOn = ${JSON.stringify(dependsOn)}
1261
- ${addHttpClientHintsPlugin}
1262
-
1263
- export default defineNuxtPlugin({
1264
- name: 'vuetify:nuxt:plugin',
1265
- order: 25,
1266
- dependsOn,
1267
- parallel: true,
1268
- async setup(nuxtApp) {
1269
- const vuetifyOptions = vuetifyConfiguration()
1270
- await nuxtApp.hooks.callHook('vuetify:configuration', { isDev, vuetifyOptions })
1271
- await nuxtApp.hooks.callHook('vuetify:before-create', { isDev, vuetifyOptions })
1272
- const vuetify = createVuetify(vuetifyOptions)
1273
- nuxtApp.vueApp.use(vuetify)
1274
- nuxtApp.provide('vuetify', vuetify)
1275
- await nuxtApp.hooks.callHook('vuetify:ready', vuetify)
1276
- if (process.client)
1277
- isDev && console.log('Vuetify 3 initialized', vuetify)
1278
- },
1279
- })
1280
- `;
1281
- }
1282
- });
1295
+ addVuetifyNuxtPlugins(nuxt, ctx);
1283
1296
  }
1284
1297
 
1285
1298
  const CONFIG_KEY = "vuetify";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vuetify-nuxt-module",
3
3
  "type": "module",
4
- "version": "0.10.1",
4
+ "version": "0.10.2",
5
5
  "packageManager": "pnpm@8.14.1",
6
6
  "description": "Zero-Config Nuxt Module for Vuetify",
7
7
  "author": "userquin <userquin@gmail.com>",