vuetify-nuxt-module 0.5.14 → 0.5.16

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.ts CHANGED
@@ -250,7 +250,7 @@ interface MOptions {
250
250
  *
251
251
  * @default true
252
252
  */
253
- includeTransformAssetsUrls?: boolean;
253
+ includeTransformAssetsUrls?: boolean | Record<string, string[]>;
254
254
  /**
255
255
  * Vuetify SSR client hints.
256
256
  *
package/dist/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "0.5.14"
7
+ "version": "0.5.16"
8
8
  }
package/dist/module.mjs CHANGED
@@ -12,7 +12,7 @@ import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify';
12
12
  import { isAbsolute, join, relative } from 'pathe';
13
13
  import { normalizePath as normalizePath$1 } from 'vite';
14
14
 
15
- const version = "0.5.14";
15
+ const version = "0.5.16";
16
16
 
17
17
  const VIRTUAL_VUETIFY_CONFIGURATION = "virtual:vuetify-configuration";
18
18
  const RESOLVED_VIRTUAL_VUETIFY_CONFIGURATION = `/@nuxt-vuetify-configuration/${VIRTUAL_VUETIFY_CONFIGURATION.slice("virtual:".length)}`;
@@ -670,6 +670,59 @@ function toKebabCase(str = "") {
670
670
  return kebab;
671
671
  }
672
672
  toKebabCase.cache = /* @__PURE__ */ new Map();
673
+ function camelize(str) {
674
+ if (camelize.cache.has(str))
675
+ return camelize.cache.get(str);
676
+ const camel = str.replace(/-([a-z0-9])/g, (g) => g[1].toUpperCase());
677
+ camelize.cache.set(str, camel);
678
+ return camel;
679
+ }
680
+ camelize.cache = /* @__PURE__ */ new Map();
681
+ function pascalize(str) {
682
+ if (pascalize.cache.has(str))
683
+ return pascalize.cache.get(str);
684
+ let pascal = camelize(str);
685
+ pascal = pascal.slice(0, 1).toUpperCase() + pascal.slice(1);
686
+ pascalize.cache.set(str, pascal);
687
+ return pascal;
688
+ }
689
+ pascalize.cache = /* @__PURE__ */ new Map();
690
+ function normalizeTransformAssetUrls(transformAssetUrls) {
691
+ const names = new Set(Object.keys(transformAssetUrls));
692
+ let kebab;
693
+ let pascal;
694
+ for (const name of names) {
695
+ transformAssetUrls[name] = normalizeTransformAssetUrlsAttrs(transformAssetUrls[name]);
696
+ kebab = toKebabCase(name);
697
+ pascal = pascalize(name);
698
+ if (!names.has(kebab))
699
+ transformAssetUrls[kebab] = [...transformAssetUrls[name]];
700
+ if (!names.has(pascal))
701
+ transformAssetUrls[pascal] = [...transformAssetUrls[name]];
702
+ }
703
+ return transformAssetUrls;
704
+ }
705
+ function normalizeTransformAssetUrlsAttrs(attrs) {
706
+ const result = /* @__PURE__ */ new Set();
707
+ let kebab;
708
+ let camel;
709
+ let bind;
710
+ let idx;
711
+ for (const attr of attrs) {
712
+ result.add(attr);
713
+ idx = attr.indexOf(":");
714
+ if (idx > 0)
715
+ continue;
716
+ bind = idx === 0;
717
+ kebab = toKebabCase(bind ? attr.slice(1) : attr);
718
+ camel = camelize(bind ? attr.slice(1) : attr);
719
+ result.add(kebab);
720
+ result.add(camel);
721
+ result.add(`:${kebab}`);
722
+ result.add(`:${camel}`);
723
+ }
724
+ return [...result];
725
+ }
673
726
 
674
727
  function vuetifyConfigurationPlugin(ctx) {
675
728
  return {
@@ -1145,11 +1198,13 @@ function configureVite(configKey, nuxt, ctx) {
1145
1198
  viteInlineConfig.plugins = viteInlineConfig.plugins || [];
1146
1199
  checkVuetifyPlugins(viteInlineConfig);
1147
1200
  viteInlineConfig.optimizeDeps = defu(viteInlineConfig.optimizeDeps, { exclude: ["vuetify"] });
1148
- viteInlineConfig.ssr || (viteInlineConfig.ssr = {});
1149
- viteInlineConfig.ssr.noExternal = [
1150
- ...Array.isArray(viteInlineConfig.ssr.noExternal) ? viteInlineConfig.ssr.noExternal : [],
1151
- configKey
1152
- ];
1201
+ if (nuxt.options.ssr) {
1202
+ viteInlineConfig.ssr || (viteInlineConfig.ssr = {});
1203
+ viteInlineConfig.ssr.noExternal = [
1204
+ ...Array.isArray(viteInlineConfig.ssr.noExternal) ? viteInlineConfig.ssr.noExternal : viteInlineConfig.ssr.noExternal && typeof viteInlineConfig.ssr.noExternal !== "boolean" ? [viteInlineConfig.ssr.noExternal] : [],
1205
+ configKey
1206
+ ];
1207
+ }
1153
1208
  viteInlineConfig.plugins.push(vuetify({ styles: true, autoImport: true }));
1154
1209
  viteInlineConfig.plugins.push(vuetifyStylesPlugin({ styles: ctx.moduleOptions.styles }, ctx.logger));
1155
1210
  viteInlineConfig.plugins.push(vuetifyConfigurationPlugin(ctx));
@@ -1169,8 +1224,10 @@ function configureNuxt(configKey, nuxt, ctx) {
1169
1224
  includeTransformAssetsUrls = true
1170
1225
  } = ctx.moduleOptions;
1171
1226
  const runtimeDir = ctx.resolver.resolve("./runtime");
1172
- nuxt.options.build.transpile.push(configKey);
1173
- nuxt.options.build.transpile.push(runtimeDir);
1227
+ if (!nuxt.options.ssr) {
1228
+ nuxt.options.build.transpile.push(configKey);
1229
+ nuxt.options.build.transpile.push(runtimeDir);
1230
+ }
1174
1231
  (_a = nuxt.options).css ?? (_a.css = []);
1175
1232
  if (typeof styles === "string" && ["sass", "expose"].includes(styles))
1176
1233
  nuxt.options.css.unshift("vuetify/styles/main.sass");
@@ -1178,11 +1235,12 @@ function configureNuxt(configKey, nuxt, ctx) {
1178
1235
  nuxt.options.css.unshift("vuetify/styles");
1179
1236
  else if (typeof styles === "object" && typeof styles?.configFile === "string")
1180
1237
  nuxt.options.css.unshift(styles.configFile);
1181
- if (includeTransformAssetsUrls) {
1238
+ if (includeTransformAssetsUrls && typeof nuxt.options.vite.vue?.template?.transformAssetUrls === "undefined") {
1182
1239
  (_b = nuxt.options.vite).vue ?? (_b.vue = {});
1183
1240
  (_c = nuxt.options.vite.vue).template ?? (_c.template = {});
1184
- if (typeof nuxt.options.vite.vue.template.transformAssetUrls === "undefined")
1185
- nuxt.options.vite.vue.template.transformAssetUrls = transformAssetUrls;
1241
+ nuxt.options.vite.vue.template.transformAssetUrls = normalizeTransformAssetUrls(
1242
+ typeof includeTransformAssetsUrls === "object" ? defu(includeTransformAssetsUrls, transformAssetUrls) : transformAssetUrls
1243
+ );
1186
1244
  }
1187
1245
  extendWebpackConfig(() => {
1188
1246
  throw new Error("Webpack is not supported: vuetify-nuxt-module module can only be used with Vite!");
@@ -1222,16 +1280,10 @@ function configureNuxt(configKey, nuxt, ctx) {
1222
1280
  src: ctx.resolver.resolve(runtimeDir, "plugins/vuetify-i18n")
1223
1281
  });
1224
1282
  }
1225
- if (nuxt.options.dev) {
1283
+ if (nuxt.options.dev || ctx.dateAdapter) {
1226
1284
  addPlugin({
1227
1285
  src: ctx.resolver.resolve(runtimeDir, "plugins/vuetify-date")
1228
1286
  });
1229
- } else {
1230
- if (ctx.dateAdapter) {
1231
- addPlugin({
1232
- src: ctx.resolver.resolve(runtimeDir, "plugins/vuetify-date")
1233
- });
1234
- }
1235
1287
  }
1236
1288
  }
1237
1289
 
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "vuetify-nuxt-module",
3
3
  "type": "module",
4
- "version": "0.5.14",
5
- "packageManager": "pnpm@8.9.0",
4
+ "version": "0.5.16",
5
+ "packageManager": "pnpm@8.9.2",
6
6
  "description": "Zero-Config Nuxt Module for Vuetify",
7
7
  "author": "userquin <userquin@gmail.com>",
8
8
  "license": "MIT",