@nuxtjs/seo 2.0.0-rc.21 → 2.0.0-rc.23

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,9 +5,9 @@
5
5
  "bridge": false
6
6
  },
7
7
  "configKey": "seo",
8
- "version": "2.0.0-rc.20",
8
+ "version": "2.0.0-rc.22",
9
9
  "builder": {
10
- "@nuxt/module-builder": "0.8.3",
10
+ "@nuxt/module-builder": "0.8.4",
11
11
  "unbuild": "2.0.0"
12
12
  }
13
13
  }
package/dist/module.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { defineNuxtModule, createResolver, useLogger, installModule, hasNuxtModule, addPlugin, addImports, addServerHandler } from '@nuxt/kit';
2
2
  import { colors } from 'consola/utils';
3
3
  import { installNuxtSiteConfig } from 'nuxt-site-config-kit';
4
- import { readPackageJSON } from 'pkg-types';
5
4
  import { $fetch } from 'ofetch';
5
+ import { readPackageJSON } from 'pkg-types';
6
6
 
7
7
  const Modules = [
8
8
  "@nuxtjs/robots",
@@ -1,6 +1,6 @@
1
+ import { useNitroOrigin, useSiteConfig } from "#imports";
1
2
  import { defineEventHandler, sendRedirect, setHeader } from "h3";
2
3
  import { joinURL } from "ufo";
3
- import { useNitroOrigin, useSiteConfig } from "#imports";
4
4
  export default defineEventHandler((e) => {
5
5
  const siteConfig = useSiteConfig(e);
6
6
  if (siteConfig.url) {
@@ -2,7 +2,7 @@ export declare function useSchemaOrg(): void;
2
2
  export declare function defineWebSite(): void;
3
3
  export declare function defineWebPage(): void;
4
4
  export declare function useI18n(): {
5
- t: (_: string, fallback: string) => string;
5
+ t: (_: string, fallback: string, options: any) => string;
6
6
  te: (_: string) => boolean;
7
7
  strategy: string;
8
8
  defaultLocale: import("vue").Ref<any, any>;
@@ -1,5 +1,5 @@
1
- import { ref } from "vue";
2
1
  import { useSiteConfig } from "#imports";
2
+ import { ref } from "vue";
3
3
  export function useSchemaOrg() {
4
4
  }
5
5
  export function defineWebSite() {
@@ -9,7 +9,8 @@ export function defineWebPage() {
9
9
  export function useI18n() {
10
10
  const siteConfig = useSiteConfig();
11
11
  return {
12
- t: (_, fallback) => fallback,
12
+ // eslint-disable-next-line unused-imports/no-unused-vars
13
+ t: (_, fallback, options) => fallback,
13
14
  te: (_) => false,
14
15
  strategy: "no_prefix",
15
16
  defaultLocale: ref(siteConfig.defaultLocale || "en"),
@@ -1,5 +1,5 @@
1
- import type { MaybeRefOrGetter } from 'vue';
2
1
  import type { NuxtLinkProps } from 'nuxt/app';
2
+ import type { MaybeRefOrGetter } from 'vue';
3
3
  interface NuxtUIBreadcrumbItem extends NuxtLinkProps {
4
4
  label: string;
5
5
  labelClass?: string;
@@ -1,7 +1,3 @@
1
- import { withoutTrailingSlash } from "ufo";
2
- import { defu } from "defu";
3
- import { fixSlashes } from "site-config-stack/urls";
4
- import { pathBreadcrumbSegments } from "../../pure/breadcrumbs.js";
5
1
  import {
6
2
  computed,
7
3
  createSitePathResolver,
@@ -12,6 +8,10 @@ import {
12
8
  useSchemaOrg,
13
9
  useSiteConfig
14
10
  } from "#imports";
11
+ import { defu } from "defu";
12
+ import { fixSlashes } from "site-config-stack/urls";
13
+ import { withoutTrailingSlash } from "ufo";
14
+ import { pathBreadcrumbSegments } from "../../pure/breadcrumbs.js";
15
15
  function withoutQuery(path) {
16
16
  return path.split("?")[0];
17
17
  }
@@ -20,7 +20,6 @@ function titleCase(s) {
20
20
  }
21
21
  export function useBreadcrumbItems(options = {}) {
22
22
  const router = useRouter();
23
- const routes = router.getRoutes();
24
23
  const i18n = useI18n();
25
24
  const siteResolver = createSitePathResolver({
26
25
  canonical: true,
@@ -51,11 +50,11 @@ export function useBreadcrumbItems(options = {}) {
51
50
  if (options.append)
52
51
  segments.push(...options.append);
53
52
  return segments.filter(Boolean).map((item) => {
54
- const route = routes.find((r) => withoutTrailingSlash(r.path) === withoutTrailingSlash(item.to));
53
+ const route = router.resolve(item.to)?.matched?.[0] || router.currentRoute.value;
55
54
  const routeMeta = route?.meta || {};
56
55
  const routeName = route ? String(route.name || route.path) : item.to === "/" ? "index" : "unknown";
57
56
  let [name] = routeName.split("___");
58
- if (name === "unknown")
57
+ if (name === "unknown" || name.includes("/"))
59
58
  name = (item.to || "").split("/").pop() || "";
60
59
  if (routeMeta.breadcrumb) {
61
60
  item = {
@@ -65,10 +64,11 @@ export function useBreadcrumbItems(options = {}) {
65
64
  }
66
65
  item.label = item.label || routeMeta.breadcrumbTitle || routeMeta.title;
67
66
  if (typeof item.label === "undefined") {
68
- item.label = item.label || i18n.t(`breadcrumb.items.${name}.label`, name === "index" ? "Home" : titleCase(name), { missingWarn: false });
69
- item.ariaLabel = item.ariaLabel || i18n.t(`breadcrumb.items.${name}.ariaLabel`, item.label, { missingWarn: false });
67
+ item.label = i18n.t(`breadcrumb.items.${name}.label`, name === "index" ? "Home" : titleCase(name), { missingWarn: false });
68
+ }
69
+ if (typeof item.ariaLabel === "undefined") {
70
+ item.ariaLabel = i18n.t(`breadcrumb.items.${name}.ariaLabel`, item.label, { missingWarn: false }) || item.label;
70
71
  }
71
- item.ariaLabel = item.ariaLabel || item.label;
72
72
  item.current = item.current || item.to === current;
73
73
  if (toValue(options.hideCurrent) && item.current)
74
74
  return false;
@@ -1,4 +1,3 @@
1
- import { stringifyQuery } from "ufo";
2
1
  import {
3
2
  computed,
4
3
  createSitePathResolver,
@@ -8,6 +7,7 @@ import {
8
7
  useSeoMeta,
9
8
  useSiteConfig
10
9
  } from "#imports";
10
+ import { stringifyQuery } from "ufo";
11
11
  export function applyDefaults(i18n) {
12
12
  const { canonicalQueryWhitelist } = useRuntimeConfig().public["nuxt-seo"];
13
13
  const siteConfig = useSiteConfig();
@@ -1,9 +1,9 @@
1
- import { applyDefaults } from "../logic/applyDefaults.js";
2
1
  import {
3
2
  defineNuxtPlugin,
4
3
  ref,
5
4
  useSiteConfig
6
5
  } from "#imports";
6
+ import { applyDefaults } from "../logic/applyDefaults.js";
7
7
  export default defineNuxtPlugin({
8
8
  name: "nuxt-seo:defaults",
9
9
  order: 999,
@@ -1,5 +1,5 @@
1
- import { applyDefaults } from "../logic/applyDefaults.js";
2
1
  import { defineNuxtPlugin, ref, useSiteConfig } from "#imports";
2
+ import { applyDefaults } from "../logic/applyDefaults.js";
3
3
  export default defineNuxtPlugin({
4
4
  name: "nuxt-seo:defaults",
5
5
  env: {
@@ -1,10 +1,10 @@
1
- import { withoutTrailingSlash } from "ufo";
2
1
  import {
3
2
  computed,
4
3
  defineNuxtPlugin,
5
4
  useHead,
6
5
  useRoute
7
6
  } from "#imports";
7
+ import { withoutTrailingSlash } from "ufo";
8
8
  function titleCase(s) {
9
9
  return s.replaceAll("-", " ").replace(/\w\S*/g, (w) => w.charAt(0).toUpperCase() + w.substr(1).toLowerCase());
10
10
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxtjs/seo",
3
3
  "type": "module",
4
- "version": "2.0.0-rc.21",
4
+ "version": "2.0.0-rc.23",
5
5
  "description": "The all-in-one SEO layer for Nuxt 3.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",
@@ -31,33 +31,35 @@
31
31
  "dist"
32
32
  ],
33
33
  "dependencies": {
34
- "@nuxt/kit": "^3.13.0",
35
- "@nuxtjs/robots": "^4.1.6",
36
- "@nuxtjs/sitemap": "6.0.0",
34
+ "@nuxt/kit": "^3.13.2",
35
+ "@nuxtjs/robots": "^4.1.7",
36
+ "@nuxtjs/sitemap": "^6.1.1",
37
37
  "defu": "^6.1.4",
38
- "nuxt-link-checker": "^3.1.1",
39
- "nuxt-og-image": "3.0.0-rc.66",
40
- "nuxt-schema-org": "^3.3.9",
38
+ "nuxt-link-checker": "^3.1.2",
39
+ "nuxt-og-image": "^3.0.3",
40
+ "nuxt-schema-org": "^3.4.0",
41
41
  "nuxt-seo-experiments": "^4.0.1",
42
- "nuxt-site-config": "^2.2.16",
43
- "nuxt-site-config-kit": "^2.2.16",
42
+ "nuxt-site-config": "^2.2.18",
43
+ "nuxt-site-config-kit": "^2.2.18",
44
44
  "pkg-types": "^1.2.0",
45
45
  "ufo": "^1.5.4"
46
46
  },
47
47
  "devDependencies": {
48
- "@antfu/eslint-config": "^3.0.0",
49
- "@nuxt/module-builder": "^0.8.3",
50
- "@nuxt/schema": "3.13.0",
51
- "@nuxt/test-utils": "^3.14.1",
52
- "@nuxt/ui": "^2.18.4",
53
- "@nuxtjs/i18n": "^8.5.1",
54
- "bumpp": "^9.5.2",
55
- "eslint": "^9.9.1",
56
- "execa": "^9.3.1",
48
+ "@antfu/eslint-config": "^3.7.3",
49
+ "@nuxt/module-builder": "^0.8.4",
50
+ "@nuxt/schema": "^3.13.2",
51
+ "@nuxt/test-utils": "^3.14.2",
52
+ "@nuxt/ui": "^2.18.6",
53
+ "@nuxtjs/i18n": "^8.5.5",
54
+ "@vue/test-utils": "^2.4.6",
55
+ "bumpp": "^9.6.1",
56
+ "eslint": "^9.11.1",
57
+ "execa": "^9.4.0",
58
+ "happy-dom": "^15.7.4",
57
59
  "nitropack": "^2.9.7",
58
- "nuxt": "3.13.0",
59
- "typescript": "5.5.4",
60
- "vitest": "^2.0.5"
60
+ "nuxt": "^3.13.2",
61
+ "typescript": "^5.6.2",
62
+ "vitest": "^2.1.1"
61
63
  },
62
64
  "build": {
63
65
  "externals": [
@@ -66,9 +68,8 @@
66
68
  ]
67
69
  },
68
70
  "resolutions": {
69
- "@nuxt/schema": "3.13.0",
70
- "nuxt": "3.13.0",
71
- "shiki": "1.10.1",
71
+ "@nuxt/schema": "3.13.1",
72
+ "nuxt": "3.13.1",
72
73
  "typescript": "5.4.5"
73
74
  },
74
75
  "scripts": {
@@ -78,7 +79,8 @@
78
79
  "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare .playground",
79
80
  "lint": "eslint . --fix",
80
81
  "release": "pnpm build && bumpp && pnpm -r publish --access public",
81
- "test": "nuxi prepare .playground && vitest",
82
+ "test": "pnpm dev:prepare && vitest --run --exclude **/__runtime__ && pnpm test:runtime",
83
+ "test:runtime": "cd test/fixtures/basic && vitest --run",
82
84
  "typecheck": "npx vue-tsc --noEmit --strict"
83
85
  }
84
86
  }