vuetify-nuxt-module 0.6.0 → 0.6.1

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,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "0.6.0"
7
+ "version": "0.6.1"
8
8
  }
package/dist/module.mjs CHANGED
@@ -2,17 +2,20 @@ import { addVitePlugin, extendWebpackConfig, addImports, addPlugin, useLogger, d
2
2
  import defu from 'defu';
3
3
  import { debounce } from 'perfect-debounce';
4
4
  import { existsSync, statSync } from 'node:fs';
5
- import { resolve, dirname } from 'node:path';
5
+ import { resolve, dirname, extname } from 'node:path';
6
6
  import process from 'node:process';
7
7
  import { createConfigLoader } from 'unconfig';
8
8
  import { readFile, utimes } from 'node:fs/promises';
9
9
  import { isPackageExists } from 'local-pkg';
10
- import { resolveVuetifyBase, normalizePath, writeStyles, cacheDir } from '@vuetify/loader-shared';
11
- import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify';
10
+ import { resolveVuetifyBase, normalizePath, writeStyles, cacheDir, generateImports } from '@vuetify/loader-shared';
12
11
  import { isAbsolute, join, relative } from 'pathe';
13
12
  import { normalizePath as normalizePath$1 } from 'vite';
13
+ import { pathToFileURL } from 'node:url';
14
+ import { parseQuery, parseURL } from 'ufo';
15
+ import destr from 'destr';
16
+ import { transformAssetUrls } from 'vite-plugin-vuetify';
14
17
 
15
- const version = "0.6.0";
18
+ const version = "0.6.1";
16
19
 
17
20
  const VIRTUAL_VUETIFY_CONFIGURATION = "virtual:vuetify-configuration";
18
21
  const RESOLVED_VIRTUAL_VUETIFY_CONFIGURATION = `/@nuxt-vuetify-configuration/${VIRTUAL_VUETIFY_CONFIGURATION.slice("virtual:".length)}`;
@@ -1192,6 +1195,40 @@ function vuetifySSRClientHintsPlugin(ctx) {
1192
1195
  };
1193
1196
  }
1194
1197
 
1198
+ function parseId2(id) {
1199
+ id = id.replace(/^(virtual:nuxt:|virtual:)/, "");
1200
+ return parseURL(decodeURIComponent(isAbsolute(id) ? pathToFileURL(id).href : id));
1201
+ }
1202
+ function parseId(id) {
1203
+ const { search, pathname } = parseId2(id);
1204
+ const query = parseQuery(search);
1205
+ const urlProps = query.props ? destr(query.props) : void 0;
1206
+ return {
1207
+ query: urlProps,
1208
+ path: pathname ?? id
1209
+ };
1210
+ }
1211
+ function vuetifyImportPlugin() {
1212
+ return {
1213
+ name: "vuetify:import",
1214
+ configResolved(config) {
1215
+ if (config.plugins.findIndex((plugin) => plugin.name === "vuetify:import") < config.plugins.findIndex((plugin) => plugin.name === "vite:vue"))
1216
+ throw new Error("Vuetify plugin must be loaded after the vue plugin");
1217
+ },
1218
+ async transform(code, id) {
1219
+ const { query, path } = parseId(id);
1220
+ if ((!query || !("vue" in query)) && extname(path) === ".vue" && !/^import { render as _sfc_render } from ".*"$/m.test(code) || query && "vue" in query && (query.type === "template" || query.type === "script" && query.setup === "true")) {
1221
+ const { code: imports, source } = generateImports(code);
1222
+ return {
1223
+ code: source + imports,
1224
+ map: null
1225
+ };
1226
+ }
1227
+ return null;
1228
+ }
1229
+ };
1230
+ }
1231
+
1195
1232
  function configureVite(configKey, nuxt, ctx) {
1196
1233
  nuxt.hook("vite:extend", ({ config }) => checkVuetifyPlugins(config));
1197
1234
  nuxt.hook("vite:extendConfig", (viteInlineConfig) => {
@@ -1205,7 +1242,7 @@ function configureVite(configKey, nuxt, ctx) {
1205
1242
  configKey
1206
1243
  ];
1207
1244
  }
1208
- viteInlineConfig.plugins.push(vuetify({ styles: true, autoImport: true }));
1245
+ viteInlineConfig.plugins.push(vuetifyImportPlugin());
1209
1246
  viteInlineConfig.plugins.push(vuetifyStylesPlugin({ styles: ctx.moduleOptions.styles }, ctx.logger));
1210
1247
  viteInlineConfig.plugins.push(vuetifyConfigurationPlugin(ctx));
1211
1248
  viteInlineConfig.plugins.push(vuetifyIconsPlugin(ctx));
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "vuetify-nuxt-module",
3
3
  "type": "module",
4
- "version": "0.6.0",
5
- "packageManager": "pnpm@8.9.2",
4
+ "version": "0.6.1",
5
+ "packageManager": "pnpm@8.10.2",
6
6
  "description": "Zero-Config Nuxt Module for Vuetify",
7
7
  "author": "userquin <userquin@gmail.com>",
8
8
  "license": "MIT",
@@ -69,7 +69,7 @@
69
69
  "perfect-debounce": "^1.0.0",
70
70
  "unconfig": "^0.3.9",
71
71
  "vite-plugin-vuetify": "^1.0.2",
72
- "vuetify": "^3.3.17"
72
+ "vuetify": "^3.3.23"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@antfu/eslint-config": "^0.41.0",
@@ -104,6 +104,7 @@
104
104
  "node:child_process",
105
105
  "node:fs",
106
106
  "consola",
107
+ "destr",
107
108
  "esbuild",
108
109
  "local-pkg",
109
110
  "pathe",
@@ -128,4 +129,4 @@
128
129
  "installDependencies": false,
129
130
  "startCommand": "node .stackblitz.js && pnpm install && pnpm run dev"
130
131
  }
131
- }
132
+ }