@prunellejs/seo 0.9.0 → 0.10.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prunellejs/seo",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "SEO meta, JSON-LD, sitemap, redirects, and self-hosted fonts plugin for Prunelle",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -21,6 +21,6 @@
21
21
  "directory": "packages/plugin-seo"
22
22
  },
23
23
  "peerDependencies": {
24
- "prunelle": "^0.9.0"
24
+ "prunelle": "^0.10.0"
25
25
  }
26
26
  }
package/src/check.ts CHANGED
@@ -71,7 +71,13 @@ function fileToRoutePath(routesDir: string, file: string): string {
71
71
  return `/${clean.replace(/\[\.\.\.([^\]]+)\]/g, '*$1').replace(/\[([^\]]+)\]/g, ':$1')}`
72
72
  }
73
73
 
74
- function formatWarn(relFile: string, code: string | undefined, offset: number, rule: string, detail: string, fix: string): string {
74
+ type SeoRule = 'missing-site' | 'long-title' | 'long-description' | 'excessive-font-preload' | 'missing-image-file' | 'missing-title' | 'duplicate-title' | 'missing-description' | 'duplicate-description' | 'noindex-in-sitemap' | 'missing-image'
75
+
76
+ declare module 'prunelle/config' {
77
+ interface PrunellePluginRules extends Record<`seo/${SeoRule}`, true> {}
78
+ }
79
+
80
+ function formatWarn(relFile: string, code: string | undefined, offset: number, rule: SeoRule, detail: string, fix: string): string {
75
81
  let line = 1
76
82
  let col = 1
77
83
  if (code !== undefined) {
package/src/sitemap.ts CHANGED
@@ -197,7 +197,7 @@ export function emitSitemap(
197
197
  const prerenderBaseDir = ctx.prerenderDir ?? ctx.outDir
198
198
  const urls = new Set<string>()
199
199
  for (const r of ctx.routes) {
200
- if (isApiPath(r.path) || isErrorLikePath(r.path, i18nCfg) || isApiRouteFile(ctx.outDir, r.file))
200
+ if (r.isApi === true || isApiPath(r.path) || isErrorLikePath(r.path, i18nCfg) || isApiRouteFile(ctx.outDir, r.file))
201
201
  continue
202
202
  if (r.prerendered) {
203
203
  for (const [u, relHtml] of Object.entries(r.prerendered)) {