nuxt-seo-utils 7.0.11 → 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.10",
8
+ "version": "7.0.11",
9
9
  "builder": {
10
10
  "@nuxt/module-builder": "1.0.1",
11
11
  "unbuild": "3.5.0"
@@ -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
  }
@@ -122,12 +122,12 @@ export function useBreadcrumbItems(_options = {}) {
122
122
  if (i18n.strategy === "prefix" || i18n.strategy !== "no_prefix" && toValue(i18n.defaultLocale) !== toValue(i18n.locale))
123
123
  rootNode = `${rootNode}${toValue(i18n.locale)}`;
124
124
  }
125
- const current = withoutQuery(withoutTrailingSlash(flatOptions.path || toRaw(route).path || rootNode));
125
+ const current = withoutQuery(withoutTrailingSlash(flatOptions.path || toRaw(route)?.path || rootNode));
126
126
  const segments = pathBreadcrumbSegments(current, rootNode).map((path, index) => {
127
127
  let item = {
128
128
  to: path
129
129
  };
130
- const override = flatOptions.overrides[index];
130
+ const override = flatOptions.overrides?.[index];
131
131
  if (typeof override !== "undefined") {
132
132
  if (override === false)
133
133
  return false;
@@ -178,7 +178,7 @@ export function useBreadcrumbItems(_options = {}) {
178
178
  if (!pauseUpdates.value) {
179
179
  lastBreadcrumbs.value = newItems;
180
180
  }
181
- }, { immediate: true });
181
+ }, { immediate: true, flush: "sync" });
182
182
  const schemaOrgEnabled = typeof _options.schemaOrg === "undefined" ? true : _options.schemaOrg;
183
183
  if ((import.meta.dev || import.meta.server || import.meta.env?.NODE_ENV === "test") && schemaOrgEnabled) {
184
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.11",
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.1",
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.1",
52
- "@nuxt/test-utils": "^3.18.0",
53
- "@nuxt/ui": "^3.1.1",
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
55
  "@nuxtjs/i18n": "^9.5.4",
56
- "@types/node": "^22.15.3",
57
- "@unhead/vue": "^2.0.8",
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.26.0",
63
- "happy-dom": "^17.4.6",
64
- "markdownlint-cli": "^0.44.0",
65
- "nuxt": "^3.17.1",
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
  }