vuetify-nuxt-module 0.7.3 → 0.8.0

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.d.mts CHANGED
@@ -241,7 +241,7 @@ interface MOptions {
241
241
  * @see https://github.com/vuetifyjs/vuetify-loader/tree/master/packages/vite-plugin
242
242
  * @see https://github.com/userquin/vuetify-nuxt-module/issues/78 and https://github.com/userquin/vuetify-nuxt-module/issues/74
243
243
  */
244
- styles?: true | 'none' | 'expose' | 'sass' | {
244
+ styles?: true | 'none' | 'sass' | {
245
245
  configFile: string;
246
246
  };
247
247
  /**
package/dist/module.d.ts CHANGED
@@ -241,7 +241,7 @@ interface MOptions {
241
241
  * @see https://github.com/vuetifyjs/vuetify-loader/tree/master/packages/vite-plugin
242
242
  * @see https://github.com/userquin/vuetify-nuxt-module/issues/78 and https://github.com/userquin/vuetify-nuxt-module/issues/74
243
243
  */
244
- styles?: true | 'none' | 'expose' | 'sass' | {
244
+ styles?: true | 'none' | 'sass' | {
245
245
  configFile: string;
246
246
  };
247
247
  /**
package/dist/module.json CHANGED
@@ -5,5 +5,5 @@
5
5
  "nuxt": "^3.6.5",
6
6
  "bridge": false
7
7
  },
8
- "version": "0.7.3"
8
+ "version": "0.8.0"
9
9
  }
package/dist/module.mjs CHANGED
@@ -6,16 +6,15 @@ import { existsSync, statSync } from 'node:fs';
6
6
  import { resolve, dirname, extname } from 'node:path';
7
7
  import process from 'node:process';
8
8
  import { createConfigLoader } from 'unconfig';
9
- import { readFile, utimes } from 'node:fs/promises';
10
- import { resolveVuetifyBase, normalizePath, writeStyles, cacheDir, generateImports } from '@vuetify/loader-shared';
9
+ import { readFile } from 'node:fs/promises';
10
+ import { resolveVuetifyBase, normalizePath, generateImports } from '@vuetify/loader-shared';
11
11
  import { isAbsolute, join, relative } from 'pathe';
12
- import { normalizePath as normalizePath$1 } from 'vite';
13
12
  import { pathToFileURL } from 'node:url';
14
13
  import { parseQuery, parseURL } from 'ufo';
15
14
  import destr from 'destr';
16
15
  import { transformAssetUrls } from 'vite-plugin-vuetify';
17
16
 
18
- const version = "0.7.3";
17
+ const version = "0.8.0";
19
18
 
20
19
  const VIRTUAL_VUETIFY_CONFIGURATION = "virtual:vuetify-configuration";
21
20
  const RESOLVED_VIRTUAL_VUETIFY_CONFIGURATION = `/@nuxt-vuetify-configuration/${VIRTUAL_VUETIFY_CONFIGURATION.slice("virtual:".length)}`;
@@ -499,103 +498,13 @@ function isSubdir(root, test) {
499
498
  const relative$1 = relative(root, test);
500
499
  return relative$1 && !relative$1.startsWith("..") && !isAbsolute(relative$1);
501
500
  }
502
- const styleImportRegexp = /(@use |meta\.load-css\()['"](vuetify(?:\/lib)?(?:\/styles(?:\/main(?:\.sass)?)?)?)['"]/;
503
501
  function vuetifyStylesPlugin(options, logger) {
504
502
  const vuetifyBase = resolveVuetifyBase();
505
- const files = /* @__PURE__ */ new Set();
506
- let server;
507
- let context;
508
- let resolve;
509
- let promise;
510
- let needsTouch = false;
511
- const blockingModules = /* @__PURE__ */ new Set();
512
- let pendingModules;
513
- async function getPendingModules() {
514
- if (!server) {
515
- await new Promise((resolve2) => setTimeout(resolve2, 0));
516
- const modules = Array.from(context.getModuleIds()).filter((id) => {
517
- return !blockingModules.has(id) && !/\w\.(s[ac]|c)ss/.test(id);
518
- }).map((id) => context.getModuleInfo(id)).filter((module) => module.code == null);
519
- pendingModules = modules.map((module) => module.id);
520
- if (!pendingModules.length)
521
- return 0;
522
- const promises = modules.map((module) => context.load(module));
523
- await Promise.race(promises);
524
- return promises.length;
525
- } else {
526
- const modules = Array.from(server.moduleGraph.urlToModuleMap.entries()).filter(([k, v]) => v.transformResult == null && !k.startsWith("/@id/") && !/\w\.(s[ac]|c)ss/.test(k) && !blockingModules.has(v.id) && !/\/node_modules\/\.vite\/deps\/(?!vuetify[._])/.test(k));
527
- pendingModules = modules.map(([, v]) => v.id);
528
- if (!pendingModules.length)
529
- return 0;
530
- const promises = modules.map(([k, v]) => server.transformRequest(k).then(() => v));
531
- await Promise.race(promises);
532
- return promises.length;
533
- }
534
- }
535
- let timeout;
536
- async function awaitBlocking() {
537
- let pending;
538
- do {
539
- clearTimeout(timeout);
540
- timeout = setTimeout(() => {
541
- console.error("vuetify:styles fallback timeout hit", {
542
- blockingModules: Array.from(blockingModules.values()),
543
- pendingModules,
544
- // @ts-expect-error not exported?
545
- pendingRequests: server?._pendingRequests.keys()
546
- });
547
- resolve(false);
548
- }, options.stylesTimeout);
549
- pending = await Promise.any([
550
- promise,
551
- getPendingModules()
552
- ]);
553
- logger.info(pending, "pending modules", pendingModules);
554
- } while (pending);
555
- resolve(false);
556
- }
557
- async function awaitResolve(id) {
558
- if (id)
559
- blockingModules.add(id);
560
- if (!promise) {
561
- promise = new Promise((_resolve) => resolve = _resolve);
562
- awaitBlocking();
563
- await promise;
564
- clearTimeout(timeout);
565
- blockingModules.clear();
566
- logger.info("writing styles");
567
- await writeStyles(files);
568
- if (server && needsTouch) {
569
- const cacheFile = normalizePath$1(cacheDir("styles.scss"));
570
- logger.log("cacheFile", cacheFile);
571
- server.moduleGraph.getModulesByFile(cacheFile)?.forEach((module) => {
572
- module.importers.forEach((module2) => {
573
- if (module2.file) {
574
- const now = /* @__PURE__ */ new Date();
575
- logger.info(`touching ${module2.file}`);
576
- utimes(module2.file, now, now);
577
- }
578
- });
579
- });
580
- needsTouch = false;
581
- }
582
- promise = null;
583
- }
584
- return promise;
585
- }
586
503
  let configFile;
587
504
  const tempFiles = /* @__PURE__ */ new Map();
588
505
  return {
589
506
  name: "vuetify:styles:nuxt",
590
507
  enforce: "pre",
591
- configureServer(_server) {
592
- server = _server;
593
- },
594
- buildStart() {
595
- if (!server) {
596
- context = this;
597
- }
598
- },
599
508
  configResolved(config) {
600
509
  if (config.plugins.findIndex((plugin) => plugin.name === "vuetify:styles") > -1)
601
510
  throw new Error("Remove vite-plugin-vuetify from your Nuxt config file, this module registers a modified version.");
@@ -613,20 +522,6 @@ function vuetifyStylesPlugin(options, logger) {
613
522
  } else if (options.styles === "sass") {
614
523
  const target = source.replace(/\.css$/, ".sass");
615
524
  return this.resolve(target, importer, { skipSelf: true, custom });
616
- } else if (options.styles === "expose") {
617
- awaitResolve();
618
- const resolution = await this.resolve(
619
- source.replace(/\.css$/, ".sass"),
620
- importer,
621
- { skipSelf: true, custom }
622
- );
623
- if (resolution) {
624
- if (!files.has(resolution.id)) {
625
- needsTouch = true;
626
- files.add(resolution.id);
627
- }
628
- return "/@plugin-vuetify/lib/__void__";
629
- }
630
525
  } else if (typeof options.styles === "object") {
631
526
  const resolution = await this.resolve(source, importer, { skipSelf: true, custom });
632
527
  if (!resolution)
@@ -640,17 +535,6 @@ function vuetifyStylesPlugin(options, logger) {
640
535
  }
641
536
  }
642
537
  },
643
- async transform(code, id) {
644
- if (options.styles === "expose" && [".scss", ".sass"].some((v) => id.endsWith(v)) && styleImportRegexp.test(code)) {
645
- logger.info(`awaiting ${id}`);
646
- await awaitResolve(id);
647
- logger.info(`returning ${id}`);
648
- return {
649
- code: code.replace(styleImportRegexp, '$1".cache/vuetify/styles.scss"'),
650
- map: null
651
- };
652
- }
653
- },
654
538
  load(id) {
655
539
  if (/^\/@plugin-vuetify\/lib\/__void__(\?.*)?$/.test(id))
656
540
  return "";
@@ -1232,7 +1116,7 @@ function parseId(id) {
1232
1116
  path: pathname ?? id
1233
1117
  };
1234
1118
  }
1235
- function vuetifyImportPlugin() {
1119
+ function vuetifyImportPlugin(options) {
1236
1120
  return {
1237
1121
  name: "vuetify:import:nuxt",
1238
1122
  configResolved(config) {
@@ -1242,7 +1126,7 @@ function vuetifyImportPlugin() {
1242
1126
  async transform(code, id) {
1243
1127
  const { query, path } = parseId(id);
1244
1128
  if ((!query || !("vue" in query)) && extname(path) === ".vue" && !/^import { render as _sfc_render } from ".*"$/m.test(code) || query && "vue" in query && (query.type === "template" || query.type === "script" && query.setup === "true")) {
1245
- const { code: imports, source } = generateImports(code);
1129
+ const { code: imports, source } = generateImports(code, options);
1246
1130
  return {
1247
1131
  code: source + imports,
1248
1132
  map: null
@@ -1266,7 +1150,7 @@ function configureVite(configKey, nuxt, ctx) {
1266
1150
  configKey
1267
1151
  ];
1268
1152
  }
1269
- viteInlineConfig.plugins.push(vuetifyImportPlugin());
1153
+ viteInlineConfig.plugins.push(vuetifyImportPlugin({}));
1270
1154
  viteInlineConfig.plugins.push(vuetifyStylesPlugin({ styles: ctx.moduleOptions.styles }, ctx.logger));
1271
1155
  viteInlineConfig.plugins.push(vuetifyConfigurationPlugin(ctx));
1272
1156
  viteInlineConfig.plugins.push(vuetifyIconsPlugin(ctx));
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "vuetify-nuxt-module",
3
3
  "type": "module",
4
- "version": "0.7.3",
5
- "packageManager": "pnpm@8.11.0",
4
+ "version": "0.8.0",
5
+ "packageManager": "pnpm@8.13.1",
6
6
  "description": "Zero-Config Nuxt Module for Vuetify",
7
7
  "author": "userquin <userquin@gmail.com>",
8
8
  "license": "MIT",
@@ -65,16 +65,16 @@
65
65
  "release": "bumpp && npm publish"
66
66
  },
67
67
  "dependencies": {
68
- "@nuxt/kit": "^3.8.2",
68
+ "@nuxt/kit": "^3.9.0",
69
69
  "defu": "^6.1.3",
70
70
  "destr": "^2.0.2",
71
71
  "local-pkg": "^0.5.0",
72
72
  "pathe": "^1.1.1",
73
73
  "perfect-debounce": "^1.0.0",
74
- "ufo": "^1.3.1",
74
+ "ufo": "^1.3.2",
75
75
  "unconfig": "^0.3.11",
76
- "vite-plugin-vuetify": "^1.0.2",
77
- "vuetify": "^3.4.6"
76
+ "vite-plugin-vuetify": "^2.0.1",
77
+ "vuetify": "^3.4.8"
78
78
  },
79
79
  "devDependencies": {
80
80
  "@antfu/eslint-config": "^0.43.1",
@@ -86,14 +86,14 @@
86
86
  "@iconify-json/carbon": "^1.1.21",
87
87
  "@iconify-json/mdi": "^1.1.55",
88
88
  "@mdi/js": "^7.3.67",
89
- "@nuxt/devtools": "^0.8.5",
89
+ "@nuxt/devtools": "^1.0.6",
90
90
  "@nuxt/module-builder": "^0.5.4",
91
- "@nuxt/schema": "^3.8.2",
92
- "@nuxt/test-utils": "^3.8.1",
93
- "@nuxtjs/i18n": "npm:@nuxtjs/i18n-edge",
91
+ "@nuxt/schema": "^3.9.0",
92
+ "@nuxt/test-utils": "^3.9.0",
93
+ "@nuxtjs/i18n": "^8.0.0",
94
94
  "@parcel/watcher": "^2.3.0",
95
95
  "@types/node": "^18",
96
- "@unocss/nuxt": "^0.57.7",
96
+ "@unocss/nuxt": "^0.58.0",
97
97
  "bumpp": "^9.2.0",
98
98
  "eslint": "^8.54.0",
99
99
  "luxon": "^3.4.3",
@@ -101,10 +101,10 @@
101
101
  "publint": "^0.2.5",
102
102
  "rimraf": "^5.0.5",
103
103
  "sass": "^1.63.6",
104
- "typescript": "^5.3.2",
105
- "vite": "^4.5.0",
106
- "vitest": "^0.34.6",
107
- "vue-tsc": "^1.8.22"
104
+ "typescript": "^5.3.3",
105
+ "vite": "^5.0.10",
106
+ "vitest": "^1.1.0",
107
+ "vue-tsc": "^1.8.27"
108
108
  },
109
109
  "build": {
110
110
  "externals": [