nuxt-link-checker 5.1.0 → 5.1.1

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/README.md CHANGED
@@ -44,6 +44,8 @@ npx nuxi@latest module add link-checker
44
44
  > npx skilld add nuxt-link-checker
45
45
  > ```
46
46
 
47
+ 💡 Link Checker catches broken links at build. For live site checks with indexing, Core Web Vitals and Search Console data in one place, see [Nuxt SEO Pro](https://nuxtseo.com/pro).
48
+
47
49
  ## Documentation
48
50
 
49
51
  [📖 Read the full documentation](https://nuxtseo.com/link-checker/getting-started/installation) for more information.
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "nuxt": ">=3.9.0"
5
5
  },
6
6
  "configKey": "linkChecker",
7
- "version": "5.1.0",
7
+ "version": "5.1.1",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -1,6 +1,6 @@
1
1
  import { createDefu } from "defu";
2
2
  import Fuse from "fuse.js";
3
- import { defineEventHandler, readBody } from "h3";
3
+ import { createError, defineEventHandler, readBody } from "h3";
4
4
  import { fixSlashes } from "nuxt-site-config/urls";
5
5
  import { resolve } from "pathe";
6
6
  import { getNitroOrigin, getSiteConfig, useRuntimeConfig } from "#imports";
@@ -22,12 +22,44 @@ function isInternalRoute(path) {
22
22
  const lastSegment = path.split("/").pop() || path;
23
23
  return lastSegment.includes(".") || path.startsWith("/__") || path.startsWith("@");
24
24
  }
25
+ function isRecord(value) {
26
+ return typeof value === "object" && value !== null;
27
+ }
28
+ function isStringArray(value) {
29
+ return Array.isArray(value) && value.every((item) => typeof item === "string");
30
+ }
31
+ function parseInspectTasks(value) {
32
+ if (!Array.isArray(value))
33
+ return;
34
+ const tasks = value.filter((task) => {
35
+ return isRecord(task) && typeof task.link === "string" && typeof task.textContent === "string" && isStringArray(task.paths);
36
+ });
37
+ return tasks.length === value.length ? tasks : void 0;
38
+ }
39
+ function parseInspectRequestBody(body) {
40
+ if (!isRecord(body)) {
41
+ throw createError({
42
+ statusCode: 400,
43
+ statusMessage: "Invalid link checker inspection payload."
44
+ });
45
+ }
46
+ const tasks = parseInspectTasks(body.tasks);
47
+ const ids = isStringArray(body.ids) ? body.ids : void 0;
48
+ const path = body.path;
49
+ if (!tasks || !ids || path !== void 0 && typeof path !== "string") {
50
+ throw createError({
51
+ statusCode: 400,
52
+ statusMessage: "Invalid link checker inspection payload."
53
+ });
54
+ }
55
+ return { tasks, ids, path };
56
+ }
25
57
  export default defineEventHandler(async (e) => {
26
- const { tasks, ids, path } = await readBody(e);
58
+ const { tasks, ids, path } = parseInspectRequestBody(await readBody(e));
27
59
  const runtimeConfig = useRuntimeConfig().public["nuxt-link-checker"] || {};
28
60
  const partialCtx = {
29
61
  ids,
30
- fromPath: fixSlashes(false, path),
62
+ fromPath: fixSlashes(false, path ?? "/"),
31
63
  siteConfig: getSiteConfig(e)
32
64
  };
33
65
  lruFsCache.clear();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-link-checker",
3
3
  "type": "module",
4
- "version": "5.1.0",
4
+ "version": "5.1.1",
5
5
  "description": "Find and magically fix links that may be negatively effecting your Nuxt sites SEO.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",
@@ -54,9 +54,10 @@
54
54
  "consola": "^3.4.2",
55
55
  "diff": "^9.0.0",
56
56
  "fuse.js": "^7.4.2",
57
+ "h3": "^1.15.11",
57
58
  "magic-string": "^0.30.21",
58
59
  "nuxt-site-config": "^4.1.0",
59
- "nuxtseo-shared": "^5.2.6",
60
+ "nuxtseo-shared": "^5.3.0",
60
61
  "ofetch": "^1.5.1",
61
62
  "pathe": "^2.0.3",
62
63
  "pkg-types": "^2.3.1",
@@ -64,32 +65,33 @@
64
65
  "site-config-stack": "^4.1.0",
65
66
  "ufo": "^1.6.4",
66
67
  "ultrahtml": "^1.6.0",
67
- "unstorage": "^1.17.5",
68
- "vite": "^7.3.5"
68
+ "unstorage": "^1.17.5"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@antfu/eslint-config": "^9.0.0",
72
72
  "@nuxt/content": "^3.14.0",
73
- "@nuxt/devtools": "^4.0.0-alpha.7",
74
- "@nuxt/devtools-kit": "^4.0.0-alpha.7",
73
+ "@nuxt/devtools": "4.0.0-alpha.7",
74
+ "@nuxt/devtools-kit": "4.0.0-alpha.7",
75
75
  "@nuxt/eslint": "^1.16.0",
76
76
  "@nuxt/module-builder": "^1.0.2",
77
77
  "@nuxt/test-utils": "^4.0.3",
78
- "@nuxtjs/sitemap": "^8.2.0",
79
- "better-sqlite3": "^12.10.0",
78
+ "@nuxtjs/sitemap": "^8.2.1",
79
+ "@types/node": "^25.9.3",
80
+ "better-sqlite3": "^12.11.1",
80
81
  "bumpp": "^11.1.0",
81
- "eslint": "^10.4.1",
82
+ "eslint": "^10.5.0",
82
83
  "eslint-plugin-harlanzw": "^0.17.0",
83
84
  "execa": "^9.6.1",
84
85
  "nuxt": "^4.4.8",
85
- "nuxtseo-layer-devtools": "^5.2.6",
86
+ "nuxtseo-layer-devtools": "^5.3.0",
86
87
  "sirv": "^3.0.2",
87
88
  "std-env": "^4.1.0",
88
- "typescript": "6.0.2",
89
+ "typescript": "6.0.3",
89
90
  "unbuild": "^3.6.1",
90
- "vitest": "^4.1.8",
91
+ "vite": "^8.0.16",
92
+ "vitest": "^4.1.9",
91
93
  "vue-eslint-parser": "^10.4.1",
92
- "vue-tsc": "^3.3.4"
94
+ "vue-tsc": "^3.3.5"
93
95
  },
94
96
  "resolutions": {
95
97
  "nuxt-link-checker": "workspace:*"