vuetify-nuxt-module 0.18.4 → 0.18.6
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 +1 -1
- package/dist/module.mjs +35 -15
- package/package.json +2 -2
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -4,10 +4,10 @@ import { createFilter, version as version$1 } from 'vite';
|
|
|
4
4
|
import { resolve, dirname, relative } from 'node:path';
|
|
5
5
|
import defu from 'defu';
|
|
6
6
|
import { debounce } from 'perfect-debounce';
|
|
7
|
-
import { existsSync, statSync } from 'node:fs';
|
|
7
|
+
import fs, { existsSync, statSync } from 'node:fs';
|
|
8
8
|
import process from 'node:process';
|
|
9
9
|
import { createConfigLoader } from 'unconfig';
|
|
10
|
-
import { readFile } from 'node:fs/promises';
|
|
10
|
+
import fsp, { readFile } from 'node:fs/promises';
|
|
11
11
|
import { resolveVuetifyBase, isObject, normalizePath, generateImports } from '@vuetify/loader-shared';
|
|
12
12
|
import { pathToFileURL } from 'node:url';
|
|
13
13
|
import { relative as relative$1, isAbsolute } from 'pathe';
|
|
@@ -16,7 +16,7 @@ import { transformAssetUrls } from 'vite-plugin-vuetify';
|
|
|
16
16
|
import { parseQuery, parseURL } from 'ufo';
|
|
17
17
|
import destr from 'destr';
|
|
18
18
|
|
|
19
|
-
const version = "0.18.
|
|
19
|
+
const version = "0.18.6";
|
|
20
20
|
|
|
21
21
|
const VIRTUAL_VUETIFY_CONFIGURATION = "virtual:vuetify-configuration";
|
|
22
22
|
const RESOLVED_VIRTUAL_VUETIFY_CONFIGURATION = `\0${VIRTUAL_VUETIFY_CONFIGURATION}`;
|
|
@@ -536,6 +536,7 @@ function vuetifyStylesPlugin(options, [major, minor, patch], _logger) {
|
|
|
536
536
|
let fileImport = false;
|
|
537
537
|
const PREFIX = "vuetify-styles/";
|
|
538
538
|
const SSR_PREFIX = `/@${PREFIX}`;
|
|
539
|
+
const resolveCss = resolveCssFactory();
|
|
539
540
|
return {
|
|
540
541
|
name: "vuetify:styles:nuxt",
|
|
541
542
|
enforce: "pre",
|
|
@@ -556,20 +557,18 @@ function vuetifyStylesPlugin(options, [major, minor, patch], _logger) {
|
|
|
556
557
|
},
|
|
557
558
|
async resolveId(source, importer, { custom, ssr }) {
|
|
558
559
|
if (source.startsWith(PREFIX) || source.startsWith(SSR_PREFIX)) {
|
|
559
|
-
if (source.
|
|
560
|
+
if (source.match(/\.s[ca]ss$/))
|
|
560
561
|
return source;
|
|
561
562
|
const idx = source.indexOf("?");
|
|
562
563
|
return idx > -1 ? source.slice(0, idx) : source;
|
|
563
564
|
}
|
|
564
565
|
if (source === "vuetify/styles" || importer && source.endsWith(".css") && isSubdir(vuetifyBase, path.isAbsolute(source) ? source : importer)) {
|
|
565
|
-
if (options.styles === "sass")
|
|
566
|
-
|
|
567
|
-
return this.resolve(target2, importer, { skipSelf: true, custom });
|
|
568
|
-
}
|
|
566
|
+
if (options.styles === "sass")
|
|
567
|
+
return this.resolve(await resolveCss(source), importer, { skipSelf: true, custom });
|
|
569
568
|
const resolution = await this.resolve(source, importer, { skipSelf: true, custom });
|
|
570
569
|
if (!resolution)
|
|
571
570
|
return void 0;
|
|
572
|
-
const target = resolution.id
|
|
571
|
+
const target = await resolveCss(resolution.id);
|
|
573
572
|
if (isNone) {
|
|
574
573
|
noneFiles.add(target);
|
|
575
574
|
return target;
|
|
@@ -582,9 +581,9 @@ function vuetifyStylesPlugin(options, [major, minor, patch], _logger) {
|
|
|
582
581
|
if (sassVariables) {
|
|
583
582
|
const target = id.startsWith(PREFIX) ? path.resolve(vuetifyBase, id.slice(PREFIX.length)) : id.startsWith(SSR_PREFIX) ? path.resolve(vuetifyBase, id.slice(SSR_PREFIX.length)) : void 0;
|
|
584
583
|
if (target) {
|
|
584
|
+
const suffix = target.match(/\.scss/) ? ";\n" : "\n";
|
|
585
585
|
return {
|
|
586
|
-
code: `@use "${configFile}"
|
|
587
|
-
@use "${fileImport ? pathToFileURL(target).href : normalizePath(target)}"`,
|
|
586
|
+
code: `@use "${configFile}"${suffix}@use "${fileImport ? pathToFileURL(target).href : normalizePath(target)}"${suffix}`,
|
|
588
587
|
map: {
|
|
589
588
|
mappings: ""
|
|
590
589
|
}
|
|
@@ -595,6 +594,24 @@ function vuetifyStylesPlugin(options, [major, minor, patch], _logger) {
|
|
|
595
594
|
}
|
|
596
595
|
};
|
|
597
596
|
}
|
|
597
|
+
function resolveCssFactory() {
|
|
598
|
+
const mappings = /* @__PURE__ */ new Map();
|
|
599
|
+
return async (source) => {
|
|
600
|
+
let mapping = mappings.get(source);
|
|
601
|
+
if (!mapping) {
|
|
602
|
+
try {
|
|
603
|
+
mapping = source.replace(/\.css$/, ".sass");
|
|
604
|
+
await fsp.access(mapping, fs.constants.R_OK);
|
|
605
|
+
} catch (err) {
|
|
606
|
+
if (!(err instanceof Error && "code" in err && err.code === "ENOENT"))
|
|
607
|
+
throw err;
|
|
608
|
+
mapping = source.replace(/\.css$/, ".scss");
|
|
609
|
+
}
|
|
610
|
+
mappings.set(source, mapping);
|
|
611
|
+
}
|
|
612
|
+
return mapping;
|
|
613
|
+
};
|
|
614
|
+
}
|
|
598
615
|
function isSubdir(root, test) {
|
|
599
616
|
const relative = relative$1(root, test);
|
|
600
617
|
return relative && !relative.startsWith("..") && !isAbsolute(relative);
|
|
@@ -1249,23 +1266,26 @@ function configureVite(configKey, nuxt, ctx) {
|
|
|
1249
1266
|
viteInlineConfig.css.preprocessorOptions ??= {};
|
|
1250
1267
|
viteInlineConfig.css.preprocessorOptions.sass ??= {};
|
|
1251
1268
|
viteInlineConfig.css.preprocessorOptions.sass.api = "modern-compiler";
|
|
1269
|
+
viteInlineConfig.css.preprocessorOptions.scss ??= {};
|
|
1270
|
+
viteInlineConfig.css.preprocessorOptions.scss.api = "modern-compiler";
|
|
1252
1271
|
} else {
|
|
1253
1272
|
viteInlineConfig.css ??= {};
|
|
1254
1273
|
viteInlineConfig.css.preprocessorOptions ??= {};
|
|
1255
1274
|
viteInlineConfig.css.preprocessorOptions.sass ??= {};
|
|
1256
1275
|
viteInlineConfig.css.preprocessorOptions.sass.api = "modern";
|
|
1276
|
+
viteInlineConfig.css.preprocessorOptions.scss ??= {};
|
|
1277
|
+
viteInlineConfig.css.preprocessorOptions.scss.api = "modern";
|
|
1257
1278
|
if (!("preprocessorMaxWorkers" in viteInlineConfig.css))
|
|
1258
1279
|
viteInlineConfig.css.preprocessorMaxWorkers = true;
|
|
1259
1280
|
}
|
|
1260
1281
|
}
|
|
1261
1282
|
}
|
|
1262
|
-
const
|
|
1283
|
+
const autoImport = { labs: true };
|
|
1263
1284
|
const ignoreDirectives = ctx.moduleOptions.ignoreDirectives;
|
|
1264
1285
|
if (ignoreDirectives) {
|
|
1265
|
-
|
|
1266
|
-
vuetifyImportOptions.autoImport = { ignore };
|
|
1286
|
+
autoImport.ignore = Array.isArray(ignoreDirectives) ? ignoreDirectives : [ignoreDirectives];
|
|
1267
1287
|
}
|
|
1268
|
-
viteInlineConfig.plugins.push(vuetifyImportPlugin(
|
|
1288
|
+
viteInlineConfig.plugins.push(vuetifyImportPlugin({ autoImport }));
|
|
1269
1289
|
if (typeof ctx.moduleOptions.styles !== "boolean")
|
|
1270
1290
|
viteInlineConfig.plugins.push(vuetifyStylesPlugin({ styles: ctx.moduleOptions.styles }, ctx.viteVersion, ctx.logger));
|
|
1271
1291
|
viteInlineConfig.plugins.push(vuetifyConfigurationPlugin(ctx));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vuetify-nuxt-module",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.18.
|
|
4
|
+
"version": "0.18.6",
|
|
5
5
|
"packageManager": "pnpm@9.9.0",
|
|
6
6
|
"description": "Zero-Config Nuxt Module for Vuetify",
|
|
7
7
|
"author": "userquin <userquin@gmail.com>",
|
|
@@ -143,4 +143,4 @@
|
|
|
143
143
|
"installDependencies": false,
|
|
144
144
|
"startCommand": "node .stackblitz.js && pnpm install && nr prepack && nr dev:prepare && nr dev"
|
|
145
145
|
}
|
|
146
|
-
}
|
|
146
|
+
}
|