vuetify-nuxt-module 0.18.3 → 0.18.5

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
@@ -5,7 +5,7 @@
5
5
  "nuxt": ">=3.9.0",
6
6
  "bridge": false
7
7
  },
8
- "version": "0.18.3",
8
+ "version": "0.18.5",
9
9
  "builder": {
10
10
  "@nuxt/module-builder": "0.8.3",
11
11
  "unbuild": "2.0.0"
package/dist/module.mjs CHANGED
@@ -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.3";
19
+ const version = "0.18.5";
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.endsWith(".sass"))
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
- const target2 = source.replace(/\.css$/, ".sass");
567
- return this.resolve(target2, importer, { skipSelf: true, custom });
568
- }
566
+ if (options.styles === "sass")
567
+ return this.resolve(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.replace(/\.css$/, ".sass");
571
+ const target = 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,23 @@ function vuetifyStylesPlugin(options, [major, minor, patch], _logger) {
595
594
  }
596
595
  };
597
596
  }
597
+ function resolveCssFactory() {
598
+ const mappings = /* @__PURE__ */ new Map();
599
+ return (source) => {
600
+ let mapping = mappings.get(source);
601
+ if (!mapping) {
602
+ try {
603
+ mapping = source.replace(/\.css$/, ".sass");
604
+ if (!existsSync(mapping))
605
+ mapping = source.replace(/\.css$/, ".scss");
606
+ } catch {
607
+ mapping = source.replace(/\.css$/, ".scss");
608
+ }
609
+ mappings.set(source, mapping);
610
+ }
611
+ return mapping;
612
+ };
613
+ }
598
614
  function isSubdir(root, test) {
599
615
  const relative = relative$1(root, test);
600
616
  return relative && !relative.startsWith("..") && !isAbsolute(relative);
@@ -1249,11 +1265,15 @@ function configureVite(configKey, nuxt, ctx) {
1249
1265
  viteInlineConfig.css.preprocessorOptions ??= {};
1250
1266
  viteInlineConfig.css.preprocessorOptions.sass ??= {};
1251
1267
  viteInlineConfig.css.preprocessorOptions.sass.api = "modern-compiler";
1268
+ viteInlineConfig.css.preprocessorOptions.scss ??= {};
1269
+ viteInlineConfig.css.preprocessorOptions.scss.api = "modern-compiler";
1252
1270
  } else {
1253
1271
  viteInlineConfig.css ??= {};
1254
1272
  viteInlineConfig.css.preprocessorOptions ??= {};
1255
1273
  viteInlineConfig.css.preprocessorOptions.sass ??= {};
1256
1274
  viteInlineConfig.css.preprocessorOptions.sass.api = "modern";
1275
+ viteInlineConfig.css.preprocessorOptions.scss ??= {};
1276
+ viteInlineConfig.css.preprocessorOptions.scss.api = "modern";
1257
1277
  if (!("preprocessorMaxWorkers" in viteInlineConfig.css))
1258
1278
  viteInlineConfig.css.preprocessorMaxWorkers = true;
1259
1279
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vuetify-nuxt-module",
3
3
  "type": "module",
4
- "version": "0.18.3",
4
+ "version": "0.18.5",
5
5
  "packageManager": "pnpm@9.9.0",
6
6
  "description": "Zero-Config Nuxt Module for Vuetify",
7
7
  "author": "userquin <userquin@gmail.com>",
@@ -74,7 +74,7 @@
74
74
  "ufo": "^1.5.4",
75
75
  "unconfig": "^0.5.5",
76
76
  "upath": "^2.0.1",
77
- "vite-plugin-vuetify": "^2.0.4",
77
+ "vite-plugin-vuetify": "^2.1.0",
78
78
  "vuetify": "^3.7.0"
79
79
  },
80
80
  "devDependencies": {