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 +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +15 -12
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/module.json
CHANGED
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
|
|
6
|
+
import { isAbsolute, join, relative } from 'pathe';
|
|
7
7
|
import { normalizePath as normalizePath$1 } from 'vite';
|
|
8
8
|
|
|
9
|
-
const version = "0.0.
|
|
9
|
+
const version = "0.0.3";
|
|
10
10
|
|
|
11
11
|
function isSubdir(root, test) {
|
|
12
|
-
const relative =
|
|
13
|
-
return relative && !relative.startsWith("..") && !
|
|
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 (
|
|
114
|
+
if (isAbsolute(options.styles.configFile))
|
|
115
115
|
configFile = options.styles.configFile;
|
|
116
116
|
else
|
|
117
|
-
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,
|
|
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 =
|
|
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(
|