vuetify-nuxt-module 0.19.1 → 0.19.3

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.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.15.0"
6
6
  },
7
- "version": "0.19.1",
7
+ "version": "0.19.3",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { addVitePlugin, addPluginTemplate, extendWebpackConfig, isNuxtMajorVersion, addImports, addPlugin, useLogger, defineNuxtModule, getNuxtVersion, hasNuxtModule, createResolver } from '@nuxt/kit';
2
2
  import { isPackageExists, getPackageInfo } from 'local-pkg';
3
+ import semver from 'semver';
3
4
  import { createFilter, version as version$1 } from 'vite';
4
5
  import { resolve, dirname, relative } from 'node:path';
5
6
  import defu from 'defu';
@@ -16,7 +17,7 @@ import { transformAssetUrls } from 'vite-plugin-vuetify';
16
17
  import { parseQuery, parseURL } from 'ufo';
17
18
  import destr from 'destr';
18
19
 
19
- const version = "0.19.1";
20
+ const version = "0.19.3";
20
21
 
21
22
  const VIRTUAL_VUETIFY_CONFIGURATION = "virtual:vuetify-configuration";
22
23
  const RESOLVED_VIRTUAL_VUETIFY_CONFIGURATION = `\0${VIRTUAL_VUETIFY_CONFIGURATION}`;
@@ -529,7 +530,7 @@ function registerWatcher(options, nuxt, ctx) {
529
530
  }
530
531
  }
531
532
 
532
- function vuetifyStylesPlugin(options, [major, minor, patch], _logger) {
533
+ function vuetifyStylesPlugin(options, viteVersion, _logger) {
533
534
  let configFile;
534
535
  const vuetifyBase = resolveVuetifyBase();
535
536
  const noneFiles = /* @__PURE__ */ new Set();
@@ -547,7 +548,7 @@ function vuetifyStylesPlugin(options, [major, minor, patch], _logger) {
547
548
  throw new Error("Remove vite-plugin-vuetify from your Nuxt config file, this module registers a modified version.");
548
549
  if (isObject(options.styles)) {
549
550
  sassVariables = true;
550
- fileImport = major > 5 || major === 5 && minor > 4 || major === 5 && minor === 4 && patch > 2;
551
+ fileImport = semver.gt(viteVersion, "5.4.2");
551
552
  if (path.isAbsolute(options.styles.configFile))
552
553
  configFile = path.resolve(options.styles.configFile);
553
554
  else
@@ -835,13 +836,13 @@ async function buildConfiguration(ctx) {
835
836
  componentsToImport.forEach((componentsArray, from) => {
836
837
  config.imports.push(`import {${Array.from(new Set(componentsArray)).join(",")}} from 'vuetify/components/${from}'`);
837
838
  });
838
- let addDatePicker = ctx.isVuetifyAtLeast(3, 4) ? !Array.from(componentsToImport.values()).some((components2) => components2.includes("VDatePicker")) : true;
839
+ let addDatePicker = ctx.vuetifyGte("3.4.0") ? !Array.from(componentsToImport.values()).some((components2) => components2.includes("VDatePicker")) : true;
839
840
  if (labComponents) {
840
841
  const useLabComponents = [];
841
842
  if (typeof labComponents === "boolean") {
842
843
  config.imports.push("import * as labsComponents from 'vuetify/labs/components'");
843
844
  config.labComponents.add("*");
844
- if (!ctx.isVuetifyAtLeast(3, 4))
845
+ if (!ctx.vuetifyGte("3.4.0"))
845
846
  addDatePicker = false;
846
847
  } else if (typeof labComponents === "string") {
847
848
  useLabComponents.push(labComponents);
@@ -869,7 +870,7 @@ async function buildConfiguration(ctx) {
869
870
  componentsArray.push(component);
870
871
  config.labComponents.add(component);
871
872
  });
872
- if (!ctx.isVuetifyAtLeast(3, 4) && dateOptions && !addDatePicker) {
873
+ if (!ctx.vuetifyGte("3.4.0") && dateOptions && !addDatePicker) {
873
874
  const entry = componentsToImport.get("VDatePicker");
874
875
  if (entry) {
875
876
  entry.push("VDatePicker");
@@ -884,9 +885,9 @@ async function buildConfiguration(ctx) {
884
885
  }
885
886
  if (dateOptions && addDatePicker) {
886
887
  let warn = true;
887
- if (ctx.isVuetifyAtLeast(0, 0)) {
888
+ if (ctx.vuetifyGte("3.0.0")) {
888
889
  warn = false;
889
- if (ctx.isVuetifyAtLeast(3, 4)) {
890
+ if (ctx.vuetifyGte("3.4.0")) {
890
891
  config.components.add("VDatePicker");
891
892
  config.imports.push("import {VDatePicker} from 'vuetify/components/VDatePicker'");
892
893
  } else {
@@ -1149,7 +1150,7 @@ export function dateConfiguration() {
1149
1150
  }
1150
1151
  };
1151
1152
  function buildAdapter() {
1152
- if (ctx.dateAdapter === "custom" || ctx.dateAdapter === "vuetify" && ctx.isVuetifyAtLeast(3, 4))
1153
+ if (ctx.dateAdapter === "custom" || ctx.dateAdapter === "vuetify" && ctx.vuetifyGte("3.4.0"))
1153
1154
  return "";
1154
1155
  if (ctx.dateAdapter === "vuetify")
1155
1156
  return "options.adapter = VuetifyDateAdapter";
@@ -1159,7 +1160,7 @@ export function dateConfiguration() {
1159
1160
  return "options.adapter = Adapter";
1160
1161
  }
1161
1162
  function buildImports() {
1162
- if (ctx.dateAdapter === "custom" || ctx.dateAdapter === "vuetify" && ctx.isVuetifyAtLeast(3, 4))
1163
+ if (ctx.dateAdapter === "custom" || ctx.dateAdapter === "vuetify" && ctx.vuetifyGte("3.4.0"))
1163
1164
  return "";
1164
1165
  if (ctx.dateAdapter === "vuetify")
1165
1166
  return "import { VuetifyDateAdapter } from 'vuetify/labs/date/adapters/vuetify'";
@@ -1259,8 +1260,7 @@ function configureVite(configKey, nuxt, ctx) {
1259
1260
  viteInlineConfig.vue.template.transformAssetUrls = transformAssetUrls;
1260
1261
  }
1261
1262
  if (!ctx.moduleOptions.disableModernSassCompiler) {
1262
- const [major, minor, patch] = ctx.viteVersion;
1263
- const enableModernSassCompiler = major > 5 || major === 5 && minor >= 4;
1263
+ const enableModernSassCompiler = semver.gte(ctx.viteVersion, "5.4.0");
1264
1264
  if (enableModernSassCompiler) {
1265
1265
  const sassEmbedded = isPackageExists("sass-embedded");
1266
1266
  if (sassEmbedded) {
@@ -1375,7 +1375,7 @@ function configureNuxt(configKey, nuxt, ctx) {
1375
1375
  } = ctx.moduleOptions;
1376
1376
  const runtimeDir = ctx.resolver.resolve("./runtime");
1377
1377
  if (typeof ctx.enableRules !== "undefined")
1378
- ctx.enableRules = ctx.isVuetifyAtLeast(3, 8);
1378
+ ctx.enableRules = ctx.vuetifyGte("3.8.0");
1379
1379
  if (ctx.isSSR && !!styles && typeof styles === "object")
1380
1380
  nuxt.options.features.inlineStyles = false;
1381
1381
  if (!disableVuetifyStyles) {
@@ -1410,18 +1410,18 @@ function configureNuxt(configKey, nuxt, ctx) {
1410
1410
  });
1411
1411
  if (importComposables) {
1412
1412
  const composables = ["useDate", "useLocale", "useDefaults", "useDisplay", "useLayout", "useRtl", "useTheme"];
1413
- if (ctx.isVuetifyAtLeast(3, 5))
1413
+ if (ctx.vuetifyGte("3.5.0"))
1414
1414
  composables.push("useGoTo");
1415
- if (ctx.isVuetifyAtLeast(3, 8)) {
1415
+ if (ctx.vuetifyGte("3.8.0")) {
1416
1416
  composables.push("useHotkey");
1417
1417
  if (ctx.enableRules)
1418
1418
  composables.push("useRules");
1419
1419
  }
1420
- if (ctx.isVuetifyAtLeast(3, 10))
1420
+ if (ctx.vuetifyGte("3.10.0"))
1421
1421
  composables.push("useMask");
1422
1422
  addImports(composables.map((name) => ({
1423
1423
  name,
1424
- from: ctx.isVuetifyAtLeast(3, 4) || name !== "useDate" ? "vuetify" : "vuetify/labs/date",
1424
+ from: ctx.vuetifyGte("3.4.0") || name !== "useDate" ? "vuetify" : "vuetify/labs/date",
1425
1425
  as: prefixComposables ? name.replace(/^use/, "useV") : void 0,
1426
1426
  meta: { docsUrl: name === "useRules" ? "https://vuetifyjs.com/en/features/rules/" : `https://vuetifyjs.com/en/api/${toKebabCase(name)}/` }
1427
1427
  })));
@@ -1494,9 +1494,9 @@ const module$1 = defineNuxtModule({
1494
1494
  if (isNuxtMajorVersion(2, nuxt))
1495
1495
  logger.error(`Cannot support nuxt version: ${getNuxtVersion(nuxt)}`);
1496
1496
  const vuetifyPkg = await getPackageInfo("vuetify");
1497
- const versions = vuetifyPkg?.version?.split(".").map((v) => Number.parseInt(v));
1498
- const isVuetifyAtLeast = (major, minor) => !!versions && versions.length > 1 && (versions[0] > major || versions[0] === major && versions[1] >= minor);
1499
- const viteVersion = version$1.split(".").map((v) => v.includes("-") ? v.split("-")[0] : v).map((v) => Number.parseInt(v));
1497
+ const currentVersion = vuetifyPkg?.version;
1498
+ const vuetifyGte = (version2) => !!currentVersion && semver.gte(currentVersion, version2);
1499
+ const viteVersion = version$1;
1500
1500
  const ctx = {
1501
1501
  logger,
1502
1502
  resolver: createResolver(import.meta.url),
@@ -1512,7 +1512,7 @@ const module$1 = defineNuxtModule({
1512
1512
  ssrClientHints: void 0,
1513
1513
  componentsPromise: void 0,
1514
1514
  labComponentsPromise: void 0,
1515
- isVuetifyAtLeast,
1515
+ vuetifyGte,
1516
1516
  viteVersion
1517
1517
  };
1518
1518
  await load(options, nuxt, ctx);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vuetify-nuxt-module",
3
3
  "type": "module",
4
- "version": "0.19.1",
4
+ "version": "0.19.3",
5
5
  "description": "Zero-Config Nuxt Module for Vuetify",
6
6
  "author": "userquin <userquin@gmail.com>",
7
7
  "license": "MIT",
@@ -51,17 +51,18 @@
51
51
  "*.mjs"
52
52
  ],
53
53
  "dependencies": {
54
- "@nuxt/kit": "3.15.4",
54
+ "@nuxt/kit": "^3.15.4 || ^4.0.0",
55
55
  "defu": "^6.1.4",
56
56
  "destr": "^2.0.3",
57
- "local-pkg": "^0.5.0",
57
+ "local-pkg": "^1.1.2",
58
58
  "pathe": "^1.1.2",
59
59
  "perfect-debounce": "^1.0.0",
60
+ "semver": "^7.7.3",
60
61
  "ufo": "^1.5.4",
61
- "unconfig": "^0.5.5",
62
+ "unconfig": "^7.4.2",
62
63
  "upath": "^2.0.1",
63
- "vite-plugin-vuetify": "^2.1.2",
64
- "vuetify": "^3.7.0"
64
+ "vite-plugin-vuetify": "^2.1.3",
65
+ "vuetify": "^3.7.0 || ^4.0.0-0"
65
66
  },
66
67
  "devDependencies": {
67
68
  "@antfu/eslint-config": "^0.43.1",
@@ -80,6 +81,7 @@
80
81
  "@nuxtjs/i18n": "^8.0.0",
81
82
  "@parcel/watcher": "^2.3.0",
82
83
  "@types/node": "^18",
84
+ "@types/semver": "^7.7.1",
83
85
  "@unocss/nuxt": "^66.5.10",
84
86
  "bumpp": "^9.2.0",
85
87
  "eslint": "^8.54.0",