vuetify-nuxt-module 0.13.0 → 0.13.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/README.md +2 -8
- package/dist/module.d.mts +1 -0
- package/dist/module.d.ts +1 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +13 -14
- package/dist/runtime/plugins/i18n.mjs +9 -4
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
- 😃 **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
|
|
40
40
|
- 🎭 **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
|
|
41
41
|
- 📦 **Multiple Icon Sets**: register [multiple icon sets](https://vuetifyjs.com/en/features/icon-fonts/#multiple-icon-sets)
|
|
42
|
-
- 🌍 **I18n Ready**: install [@nuxtjs/i18n](https://
|
|
42
|
+
- 🌍 **I18n Ready**: install [@nuxtjs/i18n](https://i18n.nuxtjs.org/) Nuxt module, and you're ready to use Vuetify [internationalization](https://vuetifyjs.com/en/features/internationalization/) features
|
|
43
43
|
- 📆 **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
|
|
44
44
|
- 💬 **Auto-Import Vuetify Locale Messages**: add [Vuetify Locale Messages](https://vuetifyjs.com/en/features/internationalization/#getting-started) adding just the locales you want to use, no more imports needed
|
|
45
45
|
- ⚙️ **Auto-Import Vuetify Composables**: you don't need to import Vuetify composables manually, they are automatically imported for you
|
|
@@ -52,13 +52,7 @@
|
|
|
52
52
|
> Requires Vite, will not work with Webpack
|
|
53
53
|
|
|
54
54
|
```bash
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
# yarn
|
|
58
|
-
yarn add vuetify-nuxt-module -D
|
|
59
|
-
|
|
60
|
-
# pnpm
|
|
61
|
-
pnpm add vuetify-nuxt-module -D
|
|
55
|
+
npx nuxi@latest module add vuetify-nuxt-module
|
|
62
56
|
```
|
|
63
57
|
|
|
64
58
|
[](https://stackblitz.com/github/userquin/vuetify-nuxt-module)
|
package/dist/module.d.mts
CHANGED
package/dist/module.d.ts
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
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
|
+
import { resolve, dirname, relative, extname } from 'node:path';
|
|
3
4
|
import defu from 'defu';
|
|
4
5
|
import { debounce } from 'perfect-debounce';
|
|
5
6
|
import { existsSync, statSync } from 'node:fs';
|
|
6
|
-
import { resolve, dirname, extname } from 'node:path';
|
|
7
7
|
import process from 'node:process';
|
|
8
8
|
import { createConfigLoader } from 'unconfig';
|
|
9
9
|
import { readFile } from 'node:fs/promises';
|
|
10
10
|
import { resolveVuetifyBase, normalizePath, generateImports } from '@vuetify/loader-shared';
|
|
11
|
-
import { isAbsolute, join, relative } from 'pathe';
|
|
11
|
+
import { isAbsolute, join, relative as relative$1 } from 'pathe';
|
|
12
12
|
import { pathToFileURL } from 'node:url';
|
|
13
13
|
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.13.
|
|
17
|
+
const version = "0.13.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)}`;
|
|
@@ -469,6 +469,7 @@ function registerWatcher(options, nuxt, ctx) {
|
|
|
469
469
|
if (nuxt.options.dev) {
|
|
470
470
|
let pageReload;
|
|
471
471
|
nuxt.hooks.hook("builder:watch", (_event, path) => {
|
|
472
|
+
path = relative(nuxt.options.srcDir, resolve(nuxt.options.srcDir, path));
|
|
472
473
|
if (!pageReload && ctx.vuetifyFilesToWatch.includes(path))
|
|
473
474
|
return nuxt.callHook("restart");
|
|
474
475
|
});
|
|
@@ -499,8 +500,8 @@ function registerWatcher(options, nuxt, ctx) {
|
|
|
499
500
|
}
|
|
500
501
|
|
|
501
502
|
function isSubdir(root, test) {
|
|
502
|
-
const relative
|
|
503
|
-
return relative
|
|
503
|
+
const relative = relative$1(root, test);
|
|
504
|
+
return relative && !relative.startsWith("..") && !isAbsolute(relative);
|
|
504
505
|
}
|
|
505
506
|
function vuetifyStylesPlugin(options, _logger) {
|
|
506
507
|
const vuetifyBase = resolveVuetifyBase();
|
|
@@ -531,7 +532,7 @@ function vuetifyStylesPlugin(options, _logger) {
|
|
|
531
532
|
if (!resolution)
|
|
532
533
|
return null;
|
|
533
534
|
const target = resolution.id.replace(/\.css$/, ".sass");
|
|
534
|
-
const file = relative(join(vuetifyBase, "lib"), target);
|
|
535
|
+
const file = relative$1(join(vuetifyBase, "lib"), target);
|
|
535
536
|
const contents = `@use "${normalizePath(configFile)}"
|
|
536
537
|
@use "${normalizePath(target)}"`;
|
|
537
538
|
tempFiles.set(file, contents);
|
|
@@ -1225,7 +1226,6 @@ function configureNuxt(configKey, nuxt, ctx) {
|
|
|
1225
1226
|
const {
|
|
1226
1227
|
importComposables,
|
|
1227
1228
|
prefixComposables,
|
|
1228
|
-
styles,
|
|
1229
1229
|
includeTransformAssetsUrls = true
|
|
1230
1230
|
} = ctx.moduleOptions;
|
|
1231
1231
|
const runtimeDir = ctx.resolver.resolve("./runtime");
|
|
@@ -1237,12 +1237,7 @@ function configureNuxt(configKey, nuxt, ctx) {
|
|
|
1237
1237
|
for (const virtual of RESOLVED_VIRTUAL_MODULES)
|
|
1238
1238
|
nuxt.options.imports.transform.include.push(new RegExp(`${virtual}$`));
|
|
1239
1239
|
nuxt.options.css ??= [];
|
|
1240
|
-
|
|
1241
|
-
nuxt.options.css.unshift("vuetify/styles/main.sass");
|
|
1242
|
-
else if (styles === true)
|
|
1243
|
-
nuxt.options.css.unshift("vuetify/styles");
|
|
1244
|
-
else if (typeof styles === "object" && typeof styles?.configFile === "string")
|
|
1245
|
-
nuxt.options.css.unshift(styles.configFile);
|
|
1240
|
+
nuxt.options.css.unshift("vuetify/styles");
|
|
1246
1241
|
if (includeTransformAssetsUrls && typeof nuxt.options.vite.vue?.template?.transformAssetUrls === "undefined") {
|
|
1247
1242
|
nuxt.options.vite.vue ??= {};
|
|
1248
1243
|
nuxt.options.vite.vue.template ??= {};
|
|
@@ -1261,6 +1256,8 @@ function configureNuxt(configKey, nuxt, ctx) {
|
|
|
1261
1256
|
});
|
|
1262
1257
|
if (importComposables) {
|
|
1263
1258
|
const composables = ["useDate", "useLocale", "useDefaults", "useDisplay", "useLayout", "useRtl", "useTheme"];
|
|
1259
|
+
if (ctx.vuetify3_5)
|
|
1260
|
+
composables.push("useGoTo");
|
|
1264
1261
|
addImports(composables.map((name) => ({
|
|
1265
1262
|
name,
|
|
1266
1263
|
from: ctx.vuetify3_4 || name !== "useDate" ? "vuetify" : "vuetify/labs/date",
|
|
@@ -1333,6 +1330,7 @@ const module = defineNuxtModule({
|
|
|
1333
1330
|
const vuetifyPkg = await getPackageInfo("vuetify");
|
|
1334
1331
|
const versions = vuetifyPkg?.version?.split(".").map((v) => Number.parseInt(v));
|
|
1335
1332
|
const vuetify3_4 = versions && versions.length > 1 && (versions[0] > 3 || versions[0] === 3 && versions[1] >= 4);
|
|
1333
|
+
const vuetify3_5 = versions && versions.length > 1 && (versions[0] > 3 || versions[0] === 3 && versions[1] >= 5);
|
|
1336
1334
|
const ctx = {
|
|
1337
1335
|
logger,
|
|
1338
1336
|
resolver: createResolver(import.meta.url),
|
|
@@ -1348,7 +1346,8 @@ const module = defineNuxtModule({
|
|
|
1348
1346
|
ssrClientHints: void 0,
|
|
1349
1347
|
componentsPromise: void 0,
|
|
1350
1348
|
labComponentsPromise: void 0,
|
|
1351
|
-
vuetify3_4
|
|
1349
|
+
vuetify3_4,
|
|
1350
|
+
vuetify3_5
|
|
1352
1351
|
};
|
|
1353
1352
|
await load(options, nuxt, ctx);
|
|
1354
1353
|
configureNuxt(CONFIG_KEY, nuxt, ctx);
|
|
@@ -45,16 +45,21 @@ function createProvideFunction(data) {
|
|
|
45
45
|
if (oldVal)
|
|
46
46
|
i18n.setLocale(val);
|
|
47
47
|
}, { immediate: true, flush: "post" });
|
|
48
|
+
const t = wrapI18n(i18n.t);
|
|
49
|
+
const n = wrapI18n(i18n.n);
|
|
48
50
|
return {
|
|
49
51
|
name: "nuxt-vue-i18n",
|
|
50
52
|
current: currentLocale,
|
|
51
53
|
fallback: data.fallback,
|
|
52
54
|
messages: data.messages,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
t: (key, ...params) => i18n.t(key, params),
|
|
56
|
-
n: i18n.n,
|
|
55
|
+
t,
|
|
56
|
+
n,
|
|
57
57
|
provide: createProvideFunction({ current: currentLocale, fallback: data.fallback, messages: data.messages })
|
|
58
58
|
};
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
+
function wrapI18n(t) {
|
|
62
|
+
return (...args) => {
|
|
63
|
+
return t(...args);
|
|
64
|
+
};
|
|
65
|
+
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vuetify-nuxt-module",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.13.
|
|
5
|
-
"packageManager": "pnpm@8.15.
|
|
4
|
+
"version": "0.13.2",
|
|
5
|
+
"packageManager": "pnpm@8.15.6",
|
|
6
6
|
"description": "Zero-Config Nuxt Module for Vuetify",
|
|
7
7
|
"author": "userquin <userquin@gmail.com>",
|
|
8
8
|
"license": "MIT",
|
|
@@ -66,15 +66,15 @@
|
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@nuxt/kit": "^3.9.0",
|
|
69
|
-
"defu": "^6.1.
|
|
70
|
-
"destr": "^2.0.
|
|
69
|
+
"defu": "^6.1.4",
|
|
70
|
+
"destr": "^2.0.3",
|
|
71
71
|
"local-pkg": "^0.5.0",
|
|
72
|
-
"pathe": "^1.1.
|
|
72
|
+
"pathe": "^1.1.2",
|
|
73
73
|
"perfect-debounce": "^1.0.0",
|
|
74
|
-
"ufo": "^1.3
|
|
74
|
+
"ufo": "^1.5.3",
|
|
75
75
|
"unconfig": "^0.3.11",
|
|
76
|
-
"vite-plugin-vuetify": "^2.0.
|
|
77
|
-
"vuetify": "^3.5.
|
|
76
|
+
"vite-plugin-vuetify": "^2.0.3",
|
|
77
|
+
"vuetify": "^3.5.13"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@antfu/eslint-config": "^0.43.1",
|
|
@@ -103,8 +103,8 @@
|
|
|
103
103
|
"sass": "^1.63.6",
|
|
104
104
|
"typescript": "^5.3.3",
|
|
105
105
|
"vite": "^5.0.12",
|
|
106
|
-
"vitest": "^1.
|
|
107
|
-
"vue-tsc": "^
|
|
106
|
+
"vitest": "^1.4.0",
|
|
107
|
+
"vue-tsc": "^2.0.7"
|
|
108
108
|
},
|
|
109
109
|
"pnpm": {
|
|
110
110
|
"peerDependencyRules": {
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
}
|
|
115
115
|
},
|
|
116
116
|
"resolutions": {
|
|
117
|
-
"@nuxt/kit": "
|
|
117
|
+
"@nuxt/kit": "3.11.1"
|
|
118
118
|
},
|
|
119
119
|
"build": {
|
|
120
120
|
"externals": [
|