vuetify-nuxt-module 0.0.2 → 0.0.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/README.md CHANGED
@@ -37,7 +37,7 @@ Zero-config Nuxt module for Vuetify
37
37
 
38
38
  ## 📦 Install
39
39
 
40
- > Requires Vite 3.2.0+, will not work with Webpack
40
+ > Requires Vite, will not work with Webpack
41
41
 
42
42
  ```bash
43
43
  npm i vuetify-nuxt-module -D
package/dist/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "0.0.2"
7
+ "version": "0.0.3"
8
8
  }
package/dist/module.mjs CHANGED
@@ -3,14 +3,14 @@ import defu from 'defu';
3
3
  import vuetify from 'vite-plugin-vuetify';
4
4
  import { utimes } from 'node:fs/promises';
5
5
  import { resolveVuetifyBase, normalizePath, writeStyles, cacheDir } from '@vuetify/loader-shared';
6
- import * as path from 'upath';
6
+ import { isAbsolute, join, relative } from 'pathe';
7
7
  import { normalizePath as normalizePath$1 } from 'vite';
8
8
 
9
- const version = "0.0.2";
9
+ const version = "0.0.3";
10
10
 
11
11
  function isSubdir(root, test) {
12
- const relative = path.relative(root, test);
13
- return relative && !relative.startsWith("..") && !path.isAbsolute(relative);
12
+ const relative$1 = relative(root, test);
13
+ return relative$1 && !relative$1.startsWith("..") && !isAbsolute(relative$1);
14
14
  }
15
15
  const styleImportRegexp = /(@use |meta\.load-css\()['"](vuetify(?:\/lib)?(?:\/styles(?:\/main(?:\.sass)?)?)?)['"]/;
16
16
  function stylesPlugin(options, logger) {
@@ -111,14 +111,14 @@ function stylesPlugin(options, logger) {
111
111
  },
112
112
  configResolved(config) {
113
113
  if (typeof options.styles === "object") {
114
- if (path.isAbsolute(options.styles.configFile))
114
+ if (isAbsolute(options.styles.configFile))
115
115
  configFile = options.styles.configFile;
116
116
  else
117
- configFile = path.join(config.root || process.cwd(), options.styles.configFile);
117
+ configFile = join(config.root || process.cwd(), options.styles.configFile);
118
118
  }
119
119
  },
120
- async resolveId(source, importer, { custom }) {
121
- if (source === "vuetify/styles" || importer && source.endsWith(".css") && isSubdir(vuetifyBase, path.isAbsolute(source) ? source : importer)) {
120
+ async resolveId(source, importer, { custom, ssr }) {
121
+ if (source === "vuetify/styles" || importer && source.endsWith(".css") && isSubdir(vuetifyBase, isAbsolute(source) ? source : importer)) {
122
122
  if (options.styles === "none") {
123
123
  return "/@plugin-vuetify/lib/__void__";
124
124
  } else if (options.styles === "sass") {
@@ -143,14 +143,13 @@ function stylesPlugin(options, logger) {
143
143
  if (!resolution)
144
144
  return null;
145
145
  const target = resolution.id.replace(/\.css$/, ".sass");
146
- const file = path.relative(path.join(vuetifyBase, "lib"), target);
146
+ const file = relative(join(vuetifyBase, "lib"), target);
147
147
  const contents = `@use "${normalizePath(configFile)}"
148
148
  @use "${normalizePath(target)}"`;
149
149
  tempFiles.set(file, contents);
150
- return `/@plugin-vuetify/lib/${file}`;
150
+ return ssr ? `/@plugin-vuetify/lib/${file}` : `/@fs/plugin-vuetify/lib/${file}`;
151
151
  }
152
152
  }
153
- return null;
154
153
  },
155
154
  async transform(code, id) {
156
155
  if (options.styles === "expose" && [".scss", ".sass"].some((v) => id.endsWith(v)) && styleImportRegexp.test(code)) {
@@ -170,6 +169,10 @@ function stylesPlugin(options, logger) {
170
169
  const file = /^\/@plugin-vuetify\/lib\/(.*?)(\?.*)?$/.exec(id)[1];
171
170
  return tempFiles.get(file);
172
171
  }
172
+ if (id.startsWith("/@fs/plugin-vuetify/lib/")) {
173
+ const file = /^\/@fs\/plugin-vuetify\/lib\/(.*?)(\?.*)?$/.exec(id)[1];
174
+ return tempFiles.get(file);
175
+ }
173
176
  }
174
177
  };
175
178
  }
@@ -295,7 +298,7 @@ const module = defineNuxtModule({
295
298
  ...Array.isArray(viteInlineConfig.ssr.noExternal) ? viteInlineConfig.ssr.noExternal : [],
296
299
  CONFIG_KEY
297
300
  ];
298
- const autoImportPlugin = vuetify({ styles, autoImport: true }).find((p) => p && typeof p === "object" && "name" in p && p.name === "vuetify:import");
301
+ const autoImportPlugin = vuetify({ styles: true, autoImport: true }).find((p) => p && typeof p === "object" && "name" in p && p.name === "vuetify:import");
299
302
  viteInlineConfig.plugins.push(autoImportPlugin);
300
303
  viteInlineConfig.plugins.push(stylesPlugin({ styles }, logger));
301
304
  viteInlineConfig.plugins.push(vuetifyConfigurationPlugin(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vuetify-nuxt-module",
3
3
  "type": "module",
4
- "version": "0.0.2",
4
+ "version": "0.0.3",
5
5
  "packageManager": "pnpm@8.6.5",
6
6
  "description": "Zero-Config Nuxt Module for Vuetify ",
7
7
  "author": "userquin <userquin@gmail.com>",