nuxt-seo-utils 7.0.10 → 7.0.12

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.16.0",
6
6
  "bridge": false
7
7
  },
8
- "version": "7.0.9",
8
+ "version": "7.0.11",
9
9
  "builder": {
10
10
  "@nuxt/module-builder": "1.0.1",
11
11
  "unbuild": "3.5.0"
package/dist/module.mjs CHANGED
@@ -83,11 +83,13 @@ const MetaTagFileGlobs = [
83
83
  "**/*og-image.{png,jpg,jpeg,gif}",
84
84
  "**/*opengraph-image.{png,jpg,jpeg,gif}",
85
85
  "**/*twitter-image.{png,jpg,jpeg,gif}",
86
- "**/*icon.{ico,jpg,jpeg,png,svg}",
87
- "**/*icon-*.{ico,jpg,jpeg,png,svg}",
88
86
  "**/*apple-icon.{jpg,jpeg,png}",
89
87
  "**/*apple-touch.{jpg,jpeg,png}",
90
- "**/*apple-touch-icon.{jpg,jpeg,png}"
88
+ "**/*apple-touch-*.{jpg,jpeg,png}",
89
+ "**/*apple-touch-icon.{jpg,jpeg,png}",
90
+ "**/*apple-touch-icon-*.{jpg,jpeg,png}",
91
+ "**/*icon.{ico,jpg,jpeg,png,svg}",
92
+ "**/*icon-*.{ico,jpg,jpeg,png,svg}"
91
93
  ];
92
94
 
93
95
  function generateNuxtPageFromFile(file, pagesDir) {
@@ -303,7 +305,7 @@ async function generateTagsFromPublicFiles(nuxt = useNuxt()) {
303
305
  });
304
306
  }
305
307
  const isIcon = (file) => file.includes("icon") && !file.endsWith(".ico");
306
- const isAppleTouchIcon = (file) => file.startsWith("apple-icon.") || file.startsWith("apple-touch-icon.") || file.startsWith("apple-touch.");
308
+ const isAppleTouchIcon = (file) => file.includes("apple-icon") || file.includes("apple-touch-icon") || file.includes("apple-touch");
307
309
  headConfig.link.push(
308
310
  ...await Promise.all([
309
311
  ...rootPublicFiles.filter((file) => isIcon(file) && !isAppleTouchIcon(file)).sort().map(async (iconFile) => {
@@ -6,6 +6,6 @@ export declare function useI18n(): {
6
6
  t: (_: string, fallback: string, options: any) => string;
7
7
  te: (_: string) => boolean;
8
8
  strategy: string;
9
- defaultLocale: import("vue").Ref<any, any>;
10
- locale: import("vue").Ref<any, any>;
9
+ defaultLocale: import("vue").ComputedRef<any>;
10
+ locale: import("vue").ComputedRef<any>;
11
11
  };
@@ -1,5 +1,5 @@
1
1
  import { useSiteConfig } from "#site-config/app/composables/useSiteConfig";
2
- import { ref } from "vue";
2
+ import { computed, toValue } from "vue";
3
3
  export function useSchemaOrg() {
4
4
  }
5
5
  export function defineWebSite() {
@@ -9,13 +9,19 @@ export function defineWebPage() {
9
9
  export function defineBreadcrumb() {
10
10
  }
11
11
  export function useI18n() {
12
- const siteConfig = useSiteConfig();
12
+ const siteConfig = useSiteConfig({
13
+ resolveRefs: false
14
+ });
13
15
  return {
14
16
  // eslint-disable-next-line unused-imports/no-unused-vars
15
17
  t: (_, fallback, options) => fallback,
16
18
  te: (_) => false,
17
19
  strategy: "no_prefix",
18
- defaultLocale: ref(siteConfig.defaultLocale || "en"),
19
- locale: ref(siteConfig.currentLocale || siteConfig.defaultLocale || "en")
20
+ defaultLocale: computed(() => {
21
+ return toValue(siteConfig.defaultLocale) || "en";
22
+ }),
23
+ locale: computed(() => {
24
+ return toValue(siteConfig.currentLocale) || toValue(siteConfig.defaultLocale) || "en";
25
+ })
20
26
  };
21
27
  }
@@ -61,6 +61,14 @@ export interface BreadcrumbProps {
61
61
  * Should the root breadcrumb be shown.
62
62
  */
63
63
  hideRoot?: MaybeRefOrGetter<boolean>;
64
+ /**
65
+ * Should breadcrumb items with non-existing path be shown.
66
+ *
67
+ * By default, every path segments will be present in breadcrumb list even if there is no corresponding page for such segment.
68
+ *
69
+ * @default false
70
+ */
71
+ hideNonExisting?: MaybeRefOrGetter<boolean>;
64
72
  /**
65
73
  * The root segment of the breadcrumb list.
66
74
  *
@@ -96,6 +96,7 @@ export function useBreadcrumbItems(_options = {}) {
96
96
  });
97
97
  acc.hideRoot = typeof cur.hideRoot === "undefined" ? acc.hideRoot : cur.hideRoot;
98
98
  acc.hideCurrent = typeof cur.hideCurrent === "undefined" ? acc.hideCurrent : cur.hideCurrent;
99
+ acc.hideNonExisting = typeof cur.hideNonExisting === "undefined" ? acc.hideNonExisting : cur.hideNonExisting;
99
100
  acc.rootSegment = acc.rootSegment || cur.rootSegment;
100
101
  acc.path = acc.path || cur.path;
101
102
  acc.overrides = acc.overrides || [];
@@ -121,12 +122,12 @@ export function useBreadcrumbItems(_options = {}) {
121
122
  if (i18n.strategy === "prefix" || i18n.strategy !== "no_prefix" && toValue(i18n.defaultLocale) !== toValue(i18n.locale))
122
123
  rootNode = `${rootNode}${toValue(i18n.locale)}`;
123
124
  }
124
- const current = withoutQuery(withoutTrailingSlash(flatOptions.path || toRaw(route).path || rootNode));
125
+ const current = withoutQuery(withoutTrailingSlash(flatOptions.path || toRaw(route)?.path || rootNode));
125
126
  const segments = pathBreadcrumbSegments(current, rootNode).map((path, index) => {
126
127
  let item = {
127
128
  to: path
128
129
  };
129
- const override = flatOptions.overrides[index];
130
+ const override = flatOptions.overrides?.[index];
130
131
  if (typeof override !== "undefined") {
131
132
  if (override === false)
132
133
  return false;
@@ -155,6 +156,8 @@ export function useBreadcrumbItems(_options = {}) {
155
156
  fallbackLabel = routeMeta.breadcrumbLabel || routeMeta.breadcrumbTitle || routeMeta.title || fallbackLabel;
156
157
  fallbackLabel = i18n.t(`breadcrumb.items.${routeName}.label`, fallbackLabel, { missingWarn: false });
157
158
  fallbackAriaLabel = i18n.t(`breadcrumb.items.${routeName}.ariaLabel`, fallbackAriaLabel, { missingWarn: false });
159
+ } else if (flatOptions.hideNonExisting) {
160
+ return false;
158
161
  }
159
162
  item.label = item.label || fallbackLabel;
160
163
  item.ariaLabel = item.ariaLabel || fallbackAriaLabel || item.label;
@@ -175,7 +178,7 @@ export function useBreadcrumbItems(_options = {}) {
175
178
  if (!pauseUpdates.value) {
176
179
  lastBreadcrumbs.value = newItems;
177
180
  }
178
- }, { immediate: true });
181
+ }, { immediate: true, flush: "sync" });
179
182
  const schemaOrgEnabled = typeof _options.schemaOrg === "undefined" ? true : _options.schemaOrg;
180
183
  if ((import.meta.dev || import.meta.server || import.meta.env?.NODE_ENV === "test") && schemaOrgEnabled) {
181
184
  useSchemaOrg([
@@ -9,6 +9,7 @@ export function applyDefaults() {
9
9
  const siteConfig = useSiteConfig({
10
10
  resolveRefs: false
11
11
  });
12
+ const resolveCurrentLocale = () => toValue(siteConfig.currentLocale) || toValue(siteConfig.defaultLocale) || "en";
12
13
  const head = injectHead();
13
14
  head.use(TemplateParamsPlugin);
14
15
  const { canonicalQueryWhitelist, canonicalLowercase } = useRuntimeConfig().public["seo-utils"];
@@ -23,7 +24,7 @@ export function applyDefaults() {
23
24
  let url = resolveUrl(route.path || "/").value || route.path;
24
25
  if (canonicalLowercase) {
25
26
  try {
26
- url = url.toLocaleLowerCase(siteConfig.currentLocale || "en");
27
+ url = url.toLocaleLowerCase(resolveCurrentLocale());
27
28
  } catch {
28
29
  url = url.toLowerCase();
29
30
  }
@@ -40,7 +41,7 @@ export function applyDefaults() {
40
41
  tagPriority: "low"
41
42
  };
42
43
  useHead({
43
- htmlAttrs: { lang: () => toValue(siteConfig.currentLocale) },
44
+ htmlAttrs: { lang: resolveCurrentLocale },
44
45
  templateParams: {
45
46
  site: () => siteConfig,
46
47
  siteName: () => siteConfig.name
@@ -55,7 +56,7 @@ export function applyDefaults() {
55
56
  return url ? url.href : false;
56
57
  },
57
58
  ogLocale: () => {
58
- const locale = toValue(siteConfig.currentLocale);
59
+ const locale = resolveCurrentLocale();
59
60
  if (locale) {
60
61
  const l = locale.replace("-", "_");
61
62
  if (l.includes("_")) {
@@ -1,2 +1,2 @@
1
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<Buffer<ArrayBufferLike> | undefined>>;
1
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<NonSharedBuffer | undefined>>;
2
2
  export default _default;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-seo-utils",
3
3
  "type": "module",
4
- "version": "7.0.10",
4
+ "version": "7.0.12",
5
5
  "description": "SEO utilities to improve your Nuxt sites discoverability and shareability",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -32,8 +32,8 @@
32
32
  ]
33
33
  },
34
34
  "dependencies": {
35
- "@nuxt/kit": "^3.17.0",
36
- "@unhead/addons": "^2.0.8",
35
+ "@nuxt/kit": "^3.17.3",
36
+ "@unhead/addons": "^2.0.9",
37
37
  "defu": "^6.1.4",
38
38
  "escape-string-regexp": "^5.0.0",
39
39
  "fast-glob": "^3.3.3",
@@ -42,32 +42,32 @@
42
42
  "pathe": "^2.0.3",
43
43
  "pkg-types": "^2.1.0",
44
44
  "scule": "^1.3.0",
45
- "semver": "^7.7.1",
45
+ "semver": "^7.7.2",
46
46
  "ufo": "^1.6.1"
47
47
  },
48
48
  "devDependencies": {
49
- "@antfu/eslint-config": "^4.12.0",
49
+ "@antfu/eslint-config": "^4.13.1",
50
50
  "@nuxt/module-builder": "^1.0.1",
51
- "@nuxt/schema": "^3.17.0",
52
- "@nuxt/test-utils": "^3.17.2",
53
- "@nuxt/ui": "^3.1.0",
51
+ "@nuxt/schema": "^3.17.3",
52
+ "@nuxt/test-utils": "^3.19.0",
53
+ "@nuxt/ui": "^3.1.2",
54
54
  "@nuxtjs/eslint-config-typescript": "^12.1.0",
55
- "@nuxtjs/i18n": "^9.5.3",
56
- "@types/node": "^22.15.2",
57
- "@unhead/vue": "^2.0.8",
55
+ "@nuxtjs/i18n": "^9.5.4",
56
+ "@types/node": "^22.15.18",
57
+ "@unhead/vue": "^2.0.9",
58
58
  "@vue/test-utils": "^2.4.6",
59
- "bumpp": "^10.1.0",
59
+ "bumpp": "^10.1.1",
60
60
  "case-police": "^2.0.0",
61
61
  "cheerio": "1.0.0",
62
- "eslint": "^9.25.1",
63
- "happy-dom": "^17.4.4",
64
- "markdownlint-cli": "^0.44.0",
65
- "nuxt": "^3.17.0",
62
+ "eslint": "^9.27.0",
63
+ "happy-dom": "^17.4.7",
64
+ "markdownlint-cli": "^0.45.0",
65
+ "nuxt": "^3.17.3",
66
66
  "nuxt-content-twoslash": "^0.1.2",
67
67
  "playwright-core": "^1.52.0",
68
- "sass": "^1.87.0",
68
+ "sass": "^1.89.0",
69
69
  "typescript": "^5.8.3",
70
- "vitest": "^3.1.2",
70
+ "vitest": "^3.1.3",
71
71
  "vue-tsc": "^2.2.10"
72
72
  },
73
73
  "scripts": {
@@ -82,7 +82,7 @@
82
82
  "lint:docs": "markdownlint ./docs/content && case-police 'docs/content/**/*.md' *.md",
83
83
  "lint:docs:fix": "markdownlint ./docs/content --fix && case-police 'docs/content/**/*.md' *.md --fix",
84
84
  "twoslash:verify": "nuxt-content-twoslash verify --content-dir docs/content",
85
- "test": "pnpm dev:prepare && vitest --run --exclude **/__runtime__",
85
+ "test": "pnpm dev:prepare && vitest --run --exclude **/__runtime__ && pnpm test:runtime",
86
86
  "test:runtime": "cd test/fixtures/basic && vitest --run"
87
87
  }
88
88
  }