vuetify-nuxt-module 0.19.0 → 0.19.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.json +1 -1
- package/dist/module.mjs +21 -22
- package/package.json +3 -1
package/dist/module.json
CHANGED
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.
|
|
20
|
+
const version = "0.19.2";
|
|
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,
|
|
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 =
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
888
|
+
if (ctx.vuetifyGte("3.0.0")) {
|
|
888
889
|
warn = false;
|
|
889
|
-
if (ctx.
|
|
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.
|
|
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.
|
|
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
|
|
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) {
|
|
@@ -1354,7 +1354,6 @@ export default defineNuxtPlugin({
|
|
|
1354
1354
|
await nuxtApp.hooks.callHook('vuetify:configuration', { isDev, vuetifyOptions })
|
|
1355
1355
|
await nuxtApp.hooks.callHook('vuetify:before-create', { isDev, vuetifyOptions })
|
|
1356
1356
|
const vuetify = createVuetify(vuetifyOptions)
|
|
1357
|
-
console.log('vuetify', vuetify)
|
|
1358
1357
|
nuxtApp.vueApp.use(vuetify)${rulesPlugin}
|
|
1359
1358
|
nuxtApp.provide('vuetify', vuetify)
|
|
1360
1359
|
await nuxtApp.hooks.callHook('vuetify:ready', vuetify)
|
|
@@ -1376,7 +1375,7 @@ function configureNuxt(configKey, nuxt, ctx) {
|
|
|
1376
1375
|
} = ctx.moduleOptions;
|
|
1377
1376
|
const runtimeDir = ctx.resolver.resolve("./runtime");
|
|
1378
1377
|
if (typeof ctx.enableRules !== "undefined")
|
|
1379
|
-
ctx.enableRules = ctx.
|
|
1378
|
+
ctx.enableRules = ctx.vuetifyGte("3.8.0");
|
|
1380
1379
|
if (ctx.isSSR && !!styles && typeof styles === "object")
|
|
1381
1380
|
nuxt.options.features.inlineStyles = false;
|
|
1382
1381
|
if (!disableVuetifyStyles) {
|
|
@@ -1411,18 +1410,18 @@ function configureNuxt(configKey, nuxt, ctx) {
|
|
|
1411
1410
|
});
|
|
1412
1411
|
if (importComposables) {
|
|
1413
1412
|
const composables = ["useDate", "useLocale", "useDefaults", "useDisplay", "useLayout", "useRtl", "useTheme"];
|
|
1414
|
-
if (ctx.
|
|
1413
|
+
if (ctx.vuetifyGte("3.5.0"))
|
|
1415
1414
|
composables.push("useGoTo");
|
|
1416
|
-
if (ctx.
|
|
1415
|
+
if (ctx.vuetifyGte("3.8.0")) {
|
|
1417
1416
|
composables.push("useHotkey");
|
|
1418
1417
|
if (ctx.enableRules)
|
|
1419
1418
|
composables.push("useRules");
|
|
1420
1419
|
}
|
|
1421
|
-
if (ctx.
|
|
1420
|
+
if (ctx.vuetifyGte("3.10.0"))
|
|
1422
1421
|
composables.push("useMask");
|
|
1423
1422
|
addImports(composables.map((name) => ({
|
|
1424
1423
|
name,
|
|
1425
|
-
from: ctx.
|
|
1424
|
+
from: ctx.vuetifyGte("3.4.0") || name !== "useDate" ? "vuetify" : "vuetify/labs/date",
|
|
1426
1425
|
as: prefixComposables ? name.replace(/^use/, "useV") : void 0,
|
|
1427
1426
|
meta: { docsUrl: name === "useRules" ? "https://vuetifyjs.com/en/features/rules/" : `https://vuetifyjs.com/en/api/${toKebabCase(name)}/` }
|
|
1428
1427
|
})));
|
|
@@ -1495,9 +1494,9 @@ const module$1 = defineNuxtModule({
|
|
|
1495
1494
|
if (isNuxtMajorVersion(2, nuxt))
|
|
1496
1495
|
logger.error(`Cannot support nuxt version: ${getNuxtVersion(nuxt)}`);
|
|
1497
1496
|
const vuetifyPkg = await getPackageInfo("vuetify");
|
|
1498
|
-
const
|
|
1499
|
-
const
|
|
1500
|
-
const viteVersion = version$1
|
|
1497
|
+
const currentVersion = vuetifyPkg?.version;
|
|
1498
|
+
const vuetifyGte = (version2) => !!currentVersion && semver.gte(currentVersion, version2);
|
|
1499
|
+
const viteVersion = version$1;
|
|
1501
1500
|
const ctx = {
|
|
1502
1501
|
logger,
|
|
1503
1502
|
resolver: createResolver(import.meta.url),
|
|
@@ -1513,7 +1512,7 @@ const module$1 = defineNuxtModule({
|
|
|
1513
1512
|
ssrClientHints: void 0,
|
|
1514
1513
|
componentsPromise: void 0,
|
|
1515
1514
|
labComponentsPromise: void 0,
|
|
1516
|
-
|
|
1515
|
+
vuetifyGte,
|
|
1517
1516
|
viteVersion
|
|
1518
1517
|
};
|
|
1519
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.
|
|
4
|
+
"version": "0.19.2",
|
|
5
5
|
"description": "Zero-Config Nuxt Module for Vuetify",
|
|
6
6
|
"author": "userquin <userquin@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"local-pkg": "^0.5.0",
|
|
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
62
|
"unconfig": "^0.5.5",
|
|
62
63
|
"upath": "^2.0.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",
|