vuetify-nuxt-module 0.6.5 → 0.6.6

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.ts CHANGED
@@ -1,11 +1,10 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
- import * as vuetify from 'vuetify';
3
- import { VuetifyOptions, createVuetify, LocaleOptions, RtlOptions } from 'vuetify';
2
+ import { HookResult } from '@nuxt/schema';
4
3
  import * as vuetify_locale from 'vuetify/locale';
5
4
  import * as vuetify_labs_components from 'vuetify/labs/components';
6
5
  import * as vuetify_directives from 'vuetify/directives';
7
6
  import * as vuetify_components from 'vuetify/components';
8
- import { UnwrapNestedRefs } from 'vue';
7
+ import { VuetifyOptions, createVuetify, LocaleOptions, RtlOptions } from 'vuetify';
9
8
 
10
9
  type DateAdapter = 'vuetify' | 'date-fns' | 'moment' | 'luxon' | 'dayjs' | 'js-joda' | 'date-fns-jalali' | 'jalaali' | 'hijri' | 'custom';
11
10
  /**
@@ -390,40 +389,38 @@ interface SSRClientHintsConfiguration {
390
389
  lightThemeName: string;
391
390
  };
392
391
  }
393
- declare module '@nuxt/schema' {
394
- interface NuxtConfig {
395
- vuetify?: ModuleOptions;
396
- }
397
- interface NuxtHooks {
398
- 'vuetify:registerModule': (registerModule: (config: InlineModuleOptions) => void) => void;
399
- }
392
+ interface ModuleHooks {
393
+ 'vuetify:registerModule': (registerModule: (config: InlineModuleOptions) => void) => HookResult;
400
394
  }
401
395
  declare module '#app/nuxt' {
402
- interface NuxtApp {
403
- $vuetify: ReturnType<typeof vuetify['createVuetify']>;
404
- /**
405
- * Request headers received from the client in SSR.
406
- */
407
- $ssrClientHints: UnwrapNestedRefs<SSRClientHints>;
408
- }
409
396
  interface RuntimeNuxtHooks {
410
397
  'vuetify:configuration': (options: {
411
398
  isDev: boolean;
412
399
  vuetifyOptions: VuetifyOptions;
413
- }) => Promise<void> | void;
400
+ }) => HookResult;
414
401
  'vuetify:before-create': (options: {
415
402
  isDev: boolean;
416
403
  vuetifyOptions: VuetifyOptions;
417
- }) => Promise<void> | void;
418
- 'vuetify:ready': (vuetify: ReturnType<typeof createVuetify>) => Promise<void> | void;
404
+ }) => HookResult;
405
+ 'vuetify:ready': (vuetify: ReturnType<typeof createVuetify>) => HookResult;
419
406
  'vuetify:ssr-client-hints': (options: {
420
407
  vuetifyOptions: VuetifyOptions;
421
408
  ssrClientHints: SSRClientHints;
422
409
  ssrClientHintsConfiguration: SSRClientHintsConfiguration;
423
- }) => Promise<void> | void;
410
+ }) => HookResult;
411
+ }
412
+ }
413
+ declare module '@nuxt/schema' {
414
+ interface NuxtConfig {
415
+ ['vuetify']?: Partial<ModuleOptions>;
416
+ }
417
+ interface NuxtOptions {
418
+ ['vuetify']?: ModuleOptions;
419
+ }
420
+ interface NuxtHooks extends ModuleHooks {
424
421
  }
425
422
  }
426
423
 
427
424
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
428
425
 
429
- export { ComponentName, Components, DateAdapter, DateOptions, DirectiveName, Directives, ExternalVuetifyOptions, FontAwesomeSvgIconSet, FontIconSet, IconFontName, IconSetName, IconsOptions, InlineModuleOptions, JSSVGIconSet, LabComponentName, LabComponents, MOptions, ModuleOptions, SSRClientHints, SSRClientHintsConfiguration, UnoCCSMdiIconSet, VOptions, VuetifyLocale, _default as default };
426
+ export { ComponentName, Components, DateAdapter, DateOptions, DirectiveName, Directives, ExternalVuetifyOptions, FontAwesomeSvgIconSet, FontIconSet, IconFontName, IconSetName, IconsOptions, InlineModuleOptions, JSSVGIconSet, LabComponentName, LabComponents, MOptions, ModuleHooks, ModuleOptions, SSRClientHints, SSRClientHintsConfiguration, UnoCCSMdiIconSet, VOptions, VuetifyLocale, _default as default };
package/dist/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "0.6.5"
7
+ "version": "0.6.6"
8
8
  }
package/dist/module.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import { addVitePlugin, extendWebpackConfig, addImports, addPlugin, useLogger, defineNuxtModule, isNuxt3, getNuxtVersion, createResolver, hasNuxtModule } from '@nuxt/kit';
2
+ import { isPackageExists, getPackageInfo } from 'local-pkg';
2
3
  import defu from 'defu';
3
4
  import { debounce } from 'perfect-debounce';
4
5
  import { existsSync, statSync } from 'node:fs';
@@ -6,7 +7,6 @@ import { resolve, dirname, extname } from 'node:path';
6
7
  import process from 'node:process';
7
8
  import { createConfigLoader } from 'unconfig';
8
9
  import { readFile, utimes } from 'node:fs/promises';
9
- import { isPackageExists } from 'local-pkg';
10
10
  import { resolveVuetifyBase, normalizePath, writeStyles, cacheDir, generateImports } from '@vuetify/loader-shared';
11
11
  import { isAbsolute, join, relative } from 'pathe';
12
12
  import { normalizePath as normalizePath$1 } from 'vite';
@@ -15,7 +15,7 @@ import { parseQuery, parseURL } from 'ufo';
15
15
  import destr from 'destr';
16
16
  import { transformAssetUrls } from 'vite-plugin-vuetify';
17
17
 
18
- const version = "0.6.5";
18
+ const version = "0.6.6";
19
19
 
20
20
  const VIRTUAL_VUETIFY_CONFIGURATION = "virtual:vuetify-configuration";
21
21
  const RESOLVED_VIRTUAL_VUETIFY_CONFIGURATION = `/@nuxt-vuetify-configuration/${VIRTUAL_VUETIFY_CONFIGURATION.slice("virtual:".length)}`;
@@ -866,7 +866,8 @@ async function buildConfiguration(ctx) {
866
866
  if (typeof labComponents === "boolean") {
867
867
  config.imports.push("import * as labsComponents from 'vuetify/labs/components'");
868
868
  config.labComponents.add("*");
869
- addDatePicker = false;
869
+ if (ctx.vuetify3_4 === false)
870
+ addDatePicker = false;
870
871
  } else if (typeof labComponents === "string") {
871
872
  useLabComponents.push(labComponents);
872
873
  } else if (Array.isArray(labComponents)) {
@@ -893,22 +894,32 @@ async function buildConfiguration(ctx) {
893
894
  componentsArray.push(component);
894
895
  config.labComponents.add(component);
895
896
  });
896
- if (dateOptions && !config.labComponents.has("VDatePicker")) {
897
+ if (ctx.vuetify3_4 === false && dateOptions && !addDatePicker) {
897
898
  const entry = componentsToImport.get("VDatePicker");
898
899
  if (entry) {
899
900
  entry.push("VDatePicker");
900
901
  config.labComponents.add("VDatePicker");
902
+ addDatePicker = false;
901
903
  }
902
904
  }
903
905
  componentsToImport.forEach((componentsArray, from) => {
904
906
  config.imports.push(`import {${componentsArray.join(",")}} from 'vuetify/labs/${from}'`);
905
907
  });
906
- addDatePicker = !config.labComponents.has("VDatePicker");
907
908
  }
908
909
  }
909
910
  if (dateOptions && addDatePicker) {
910
- config.imports.push("import {VDatePicker} from 'vuetify/labs/VDatePicker'");
911
- config.labComponents.add("VDatePicker");
911
+ let warn = true;
912
+ if (typeof ctx.vuetify3_4 === "boolean") {
913
+ warn = false;
914
+ if (ctx.vuetify3_4) {
915
+ config.components.add("VDatePicker");
916
+ config.imports.push("import {VDatePicker} from 'vuetify/components/VDatePicker'");
917
+ } else {
918
+ config.labComponents.add("VDatePicker");
919
+ config.imports.push("import {VDatePicker} from 'vuetify/labs/VDatePicker'");
920
+ }
921
+ }
922
+ warn && logger.warn("Unable to load Vuetify version from package.json, add VDatePicker to components or labComponents");
912
923
  }
913
924
  let componentsEntry = "";
914
925
  if (config.components.size) {
@@ -1148,7 +1159,7 @@ export function dateConfiguration() {
1148
1159
  `;
1149
1160
  }
1150
1161
  const { adapter: _adapter, ...newDateOptions } = ctx.vuetifyOptions.date ?? {};
1151
- const imports = ctx.dateAdapter === "vuetify" ? "import { VuetifyDateAdapter } from 'vuetify/labs/date/adapters/vuetify'" : ctx.dateAdapter === "custom" ? "" : `import Adapter from '@date-io/${ctx.dateAdapter}'`;
1162
+ const imports = ctx.dateAdapter === "vuetify" ? ctx.vuetify3_4 === true ? "" : "import { VuetifyDateAdapter } from 'vuetify/labs/date/adapters/vuetify'" : ctx.dateAdapter === "custom" ? "" : `import Adapter from '@date-io/${ctx.dateAdapter}'`;
1152
1163
  return `${imports}
1153
1164
  export const enabled = true
1154
1165
  export const isDev = ${ctx.isDev}
@@ -1164,7 +1175,7 @@ export function dateConfiguration() {
1164
1175
  }
1165
1176
  };
1166
1177
  function buildAdapter() {
1167
- if (ctx.dateAdapter === "custom")
1178
+ if (ctx.dateAdapter === "custom" || ctx.dateAdapter === "vuetify" && ctx.vuetify3_4 === true)
1168
1179
  return "";
1169
1180
  if (ctx.dateAdapter === "vuetify")
1170
1181
  return "options.adapter = VuetifyDateAdapter";
@@ -1307,6 +1318,10 @@ function configureNuxt(configKey, nuxt, ctx) {
1307
1318
  src: ctx.resolver.resolve(runtimeDir, "plugins/vuetify-client-hints.server"),
1308
1319
  mode: "server"
1309
1320
  });
1321
+ } else {
1322
+ addPlugin({
1323
+ src: ctx.resolver.resolve(runtimeDir, "plugins/vuetify-no-client-hints")
1324
+ });
1310
1325
  }
1311
1326
  addPlugin({
1312
1327
  src: ctx.resolver.resolve(runtimeDir, `plugins/vuetify${ctx.i18n ? "-sync" : ""}`)
@@ -1349,6 +1364,9 @@ const module = defineNuxtModule({
1349
1364
  async setup(options, nuxt) {
1350
1365
  if (!isNuxt3(nuxt))
1351
1366
  logger.error(`Cannot support nuxt version: ${getNuxtVersion(nuxt)}`);
1367
+ const vuetifyPkg = await getPackageInfo("vuetify");
1368
+ const versions = vuetifyPkg?.version?.split(".").map((v) => Number.parseInt(v));
1369
+ const vuetify3_4 = versions && versions.length > 1 && versions[0] >= 3 && versions[1] >= 4;
1352
1370
  const ctx = {
1353
1371
  logger,
1354
1372
  resolver: createResolver(import.meta.url),
@@ -1363,7 +1381,8 @@ const module = defineNuxtModule({
1363
1381
  icons: void 0,
1364
1382
  ssrClientHints: void 0,
1365
1383
  componentsPromise: void 0,
1366
- labComponentsPromise: void 0
1384
+ labComponentsPromise: void 0,
1385
+ vuetify3_4
1367
1386
  };
1368
1387
  await load(options, nuxt, ctx);
1369
1388
  configureNuxt(CONFIG_KEY, nuxt, ctx);
@@ -1,2 +1,7 @@
1
- declare const _default: any;
2
- export default _default;
1
+ import type { UnwrapNestedRefs } from 'vue';
2
+ import type { SSRClientHints } from './client-hints';
3
+ import type { Plugin } from '#app/nuxt';
4
+ declare const plugin: Plugin<{
5
+ ssrClientHints: UnwrapNestedRefs<SSRClientHints>;
6
+ }>;
7
+ export default plugin;
@@ -2,7 +2,7 @@ import { ssrClientHintsConfiguration } from "virtual:vuetify-ssr-client-hints-co
2
2
  import { reactive, watch } from "vue";
3
3
  import { VuetifyHTTPClientHints } from "./client-hints.mjs";
4
4
  import { defineNuxtPlugin, useNuxtApp, useState } from "#imports";
5
- export default defineNuxtPlugin((nuxtApp) => {
5
+ const plugin = defineNuxtPlugin((nuxtApp) => {
6
6
  const state = useState(VuetifyHTTPClientHints);
7
7
  const {
8
8
  firstRequest,
@@ -87,3 +87,4 @@ export default defineNuxtPlugin((nuxtApp) => {
87
87
  })
88
88
  };
89
89
  });
90
+ export default plugin;
@@ -1,2 +1,7 @@
1
- declare const _default: any;
2
- export default _default;
1
+ import type { UnwrapNestedRefs } from 'vue';
2
+ import type { SSRClientHints } from './client-hints';
3
+ import type { Plugin } from '#app/nuxt';
4
+ declare const plugin: Plugin<{
5
+ ssrClientHints: UnwrapNestedRefs<SSRClientHints>;
6
+ }>;
7
+ export default plugin;
@@ -24,7 +24,7 @@ const AcceptClientHintsRequestHeaders = Object.entries(AcceptClientHintsHeaders)
24
24
  return acc;
25
25
  }, {});
26
26
  const HttpRequestHeaders = Array.from(Object.values(AcceptClientHintsRequestHeaders)).concat("user-agent", "cookie");
27
- export default defineNuxtPlugin((nuxtApp) => {
27
+ const plugin = defineNuxtPlugin((nuxtApp) => {
28
28
  const state = useState(VuetifyHTTPClientHints);
29
29
  const requestHeaders = useRequestHeaders(HttpRequestHeaders);
30
30
  const userAgentHeader = requestHeaders["user-agent"];
@@ -237,3 +237,4 @@ function writeThemeCookie(clientHintsRequest, ssrClientHintsConfiguration2) {
237
237
  }
238
238
  return `${cookieName}=${themeName}; Path=${path}; Expires=${expires.toUTCString()}; SameSite=Lax`;
239
239
  }
240
+ export default plugin;
@@ -0,0 +1,7 @@
1
+ import type { UnwrapNestedRefs } from 'vue';
2
+ import type { SSRClientHints } from './client-hints';
3
+ import type { Plugin } from '#app/nuxt';
4
+ declare const plugin: Plugin<{
5
+ ssrClientHints: UnwrapNestedRefs<SSRClientHints>;
6
+ }>;
7
+ export default plugin;
@@ -0,0 +1,16 @@
1
+ import { reactive } from "vue";
2
+ import { defineNuxtPlugin } from "#imports";
3
+ const plugin = defineNuxtPlugin(() => {
4
+ return {
5
+ provide: reactive({
6
+ ssrClientHints: {
7
+ firstRequest: false,
8
+ prefersColorSchemeAvailable: false,
9
+ prefersReducedMotionAvailable: false,
10
+ viewportHeightAvailable: false,
11
+ viewportWidthAvailable: false
12
+ }
13
+ })
14
+ };
15
+ });
16
+ export default plugin;
@@ -1,2 +1,6 @@
1
- declare const _default: any;
2
- export default _default;
1
+ import type { createVuetify } from 'vuetify';
2
+ import type { Plugin } from '#app/nuxt';
3
+ declare const plugin: Plugin<{
4
+ vuetify: ReturnType<typeof createVuetify>;
5
+ }>;
6
+ export default plugin;
@@ -1,6 +1,6 @@
1
1
  import { configureVuetify } from "./config.mjs";
2
2
  import { defineNuxtPlugin, useNuxtApp } from "#imports";
3
- export default defineNuxtPlugin({
3
+ const plugin = defineNuxtPlugin({
4
4
  name: "vuetify:configuration:plugin",
5
5
  enforce: "post",
6
6
  // i18n runtime plugin is async
@@ -9,3 +9,4 @@ export default defineNuxtPlugin({
9
9
  useNuxtApp().hook("app:created", configureVuetify);
10
10
  }
11
11
  });
12
+ export default plugin;
@@ -1,2 +1,6 @@
1
- declare const _default: any;
2
- export default _default;
1
+ import type { createVuetify } from 'vuetify';
2
+ import type { Plugin } from '#app/nuxt';
3
+ declare const plugin: Plugin<{
4
+ vuetify: ReturnType<typeof createVuetify>;
5
+ }>;
6
+ export default plugin;
@@ -1,9 +1,10 @@
1
1
  import { configureVuetify } from "./config.mjs";
2
2
  import { defineNuxtPlugin, useNuxtApp } from "#imports";
3
- export default defineNuxtPlugin({
3
+ const plugin = defineNuxtPlugin({
4
4
  name: "vuetify:configuration:plugin",
5
5
  enforce: "post",
6
6
  setup() {
7
7
  useNuxtApp().hook("app:created", configureVuetify);
8
8
  }
9
9
  });
10
+ export default plugin;
package/dist/types.d.ts CHANGED
@@ -1,15 +1,17 @@
1
1
 
2
- import { ModuleOptions } from './module'
2
+ import { ModuleOptions, ModuleHooks } from './module'
3
3
 
4
4
  declare module '@nuxt/schema' {
5
5
  interface NuxtConfig { ['vuetify']?: Partial<ModuleOptions> }
6
6
  interface NuxtOptions { ['vuetify']?: ModuleOptions }
7
+ interface NuxtHooks extends ModuleHooks {}
7
8
  }
8
9
 
9
10
  declare module 'nuxt/schema' {
10
11
  interface NuxtConfig { ['vuetify']?: Partial<ModuleOptions> }
11
12
  interface NuxtOptions { ['vuetify']?: ModuleOptions }
13
+ interface NuxtHooks extends ModuleHooks {}
12
14
  }
13
15
 
14
16
 
15
- export { ComponentName, Components, DateAdapter, DateOptions, DirectiveName, Directives, ExternalVuetifyOptions, FontAwesomeSvgIconSet, FontIconSet, IconFontName, IconSetName, IconsOptions, InlineModuleOptions, JSSVGIconSet, LabComponentName, LabComponents, MOptions, ModuleOptions, SSRClientHints, SSRClientHintsConfiguration, UnoCCSMdiIconSet, VOptions, VuetifyLocale, default } from './module'
17
+ export { ComponentName, Components, DateAdapter, DateOptions, DirectiveName, Directives, ExternalVuetifyOptions, FontAwesomeSvgIconSet, FontIconSet, IconFontName, IconSetName, IconsOptions, InlineModuleOptions, JSSVGIconSet, LabComponentName, LabComponents, MOptions, ModuleHooks, ModuleOptions, SSRClientHints, SSRClientHintsConfiguration, UnoCCSMdiIconSet, VOptions, VuetifyLocale, default } from './module'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vuetify-nuxt-module",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.6",
5
5
  "packageManager": "pnpm@8.10.2",
6
6
  "description": "Zero-Config Nuxt Module for Vuetify",
7
7
  "author": "userquin <userquin@gmail.com>",
@@ -88,7 +88,7 @@
88
88
  "@nuxt/module-builder": "^0.4.0",
89
89
  "@nuxt/schema": "^3.6.5",
90
90
  "@nuxt/test-utils": "^3.6.5",
91
- "@nuxtjs/i18n": "npm:@nuxtjs/i18n-edge",
91
+ "@nuxtjs/i18n": "8.0.0-rc.5",
92
92
  "@parcel/watcher": "^2.2.0",
93
93
  "@types/node": "^18",
94
94
  "@unocss/nuxt": "^0.53.6",