vuetify-nuxt-module 0.2.0 → 0.2.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.2.0"
7
+ "version": "0.2.1"
8
8
  }
package/dist/module.mjs CHANGED
@@ -1,13 +1,12 @@
1
+ import { utimes, readFile } from 'node:fs/promises';
1
2
  import { useLogger, defineNuxtModule, createResolver, hasNuxtModule, extendWebpackConfig, addPlugin } from '@nuxt/kit';
2
3
  import defu from 'defu';
3
- import vuetify from 'vite-plugin-vuetify';
4
4
  import { isPackageExists } from 'local-pkg';
5
- import { utimes } from 'node:fs/promises';
6
5
  import { resolveVuetifyBase, normalizePath, writeStyles, cacheDir } from '@vuetify/loader-shared';
7
6
  import { isAbsolute, join, relative } from 'pathe';
8
7
  import { normalizePath as normalizePath$1 } from 'vite';
9
8
 
10
- const version = "0.2.0";
9
+ const version = "0.2.1";
11
10
 
12
11
  function isSubdir(root, test) {
13
12
  const relative$1 = relative(root, test);
@@ -459,6 +458,15 @@ ${fa.map((f) => ` ${f}`).join("\n")}
459
458
  }
460
459
  }
461
460
 
461
+ function toKebabCase(str = "") {
462
+ if (toKebabCase.cache.has(str))
463
+ return toKebabCase.cache.get(str);
464
+ const kebab = str.replace(/[^a-z]/gi, "-").replace(/\B([A-Z])/g, "-$1").toLowerCase();
465
+ toKebabCase.cache.set(str, kebab);
466
+ return kebab;
467
+ }
468
+ toKebabCase.cache = /* @__PURE__ */ new Map();
469
+
462
470
  const CONFIG_KEY = "vuetify";
463
471
  const logger = useLogger(`nuxt:${CONFIG_KEY}`);
464
472
  const module = defineNuxtModule({
@@ -546,6 +554,25 @@ const module = defineNuxtModule({
546
554
  references.push({ types: "vuetify-nuxt-module/configuration" });
547
555
  references.push({ types: "vuetify" });
548
556
  });
557
+ const vuetifyBase = resolveVuetifyBase();
558
+ nuxt.hook("components:extend", async (c) => {
559
+ const { components } = JSON.parse(await readFile(resolver.resolve(vuetifyBase, "dist/json/importMap.json"), "utf-8"));
560
+ Object.keys(components).forEach((component) => {
561
+ const from = components[component].from;
562
+ c.push({
563
+ pascalName: component,
564
+ kebabName: toKebabCase(component),
565
+ export: component,
566
+ filePath: `${resolver.resolve(vuetifyBase, `lib/${from}`)}`,
567
+ shortPath: `components/${from}`,
568
+ chunkName: toKebabCase(component),
569
+ prefetch: false,
570
+ preload: false,
571
+ global: false,
572
+ mode: "all"
573
+ });
574
+ });
575
+ });
549
576
  nuxt.hook("vite:extendConfig", (viteInlineConfig) => {
550
577
  viteInlineConfig.plugins = viteInlineConfig.plugins || [];
551
578
  checkVuetifyPlugins(viteInlineConfig);
@@ -555,8 +582,6 @@ const module = defineNuxtModule({
555
582
  ...Array.isArray(viteInlineConfig.ssr.noExternal) ? viteInlineConfig.ssr.noExternal : [],
556
583
  CONFIG_KEY
557
584
  ];
558
- const autoImportPlugin = vuetify({ styles: true, autoImport: true }).find((p) => p && typeof p === "object" && "name" in p && p.name === "vuetify:import");
559
- viteInlineConfig.plugins.push(autoImportPlugin);
560
585
  viteInlineConfig.plugins.push(vuetifyStylesPlugin({ styles }, logger));
561
586
  viteInlineConfig.plugins.push(vuetifyConfigurationPlugin(
562
587
  nuxt.options.dev,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vuetify-nuxt-module",
3
3
  "type": "module",
4
- "version": "0.2.0",
4
+ "version": "0.2.1",
5
5
  "packageManager": "pnpm@8.6.6",
6
6
  "description": "Zero-Config Nuxt Module for Vuetify ",
7
7
  "author": "userquin <userquin@gmail.com>",