@rimelight/seo 0.0.6 → 0.0.8

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.
Files changed (67) hide show
  1. package/dist/assets.d.mts +39 -0
  2. package/dist/assets.mjs +96 -0
  3. package/dist/catalog.d.mts +7 -0
  4. package/dist/catalog.mjs +10 -0
  5. package/dist/index.d.mts +6 -2
  6. package/dist/index.mjs +5 -1
  7. package/dist/integration.mjs +194 -3
  8. package/dist/manifest.d.mts +7 -0
  9. package/dist/manifest.mjs +44 -0
  10. package/dist/og.mjs +1 -1
  11. package/dist/routes/api-catalog.d.mts +5 -0
  12. package/dist/routes/api-catalog.mjs +38 -0
  13. package/dist/routes/apple-touch-icon.png.d.mts +5 -0
  14. package/dist/routes/apple-touch-icon.png.mjs +17 -0
  15. package/dist/routes/favicon.ico.d.mts +5 -0
  16. package/dist/routes/favicon.ico.mjs +14 -0
  17. package/dist/routes/favicon.svg.d.mts +5 -0
  18. package/dist/routes/favicon.svg.mjs +12 -0
  19. package/dist/routes/icon-192.png.d.mts +5 -0
  20. package/dist/routes/icon-192.png.mjs +17 -0
  21. package/dist/routes/icon-512.png.d.mts +5 -0
  22. package/dist/routes/icon-512.png.mjs +17 -0
  23. package/dist/routes/icon-maskable-512.png.d.mts +5 -0
  24. package/dist/routes/icon-maskable-512.png.mjs +18 -0
  25. package/dist/routes/llms.txt.mjs +1 -1
  26. package/dist/routes/robots.txt.mjs +1 -1
  27. package/dist/routes/rss.xml.mjs +48 -20
  28. package/dist/routes/security.txt.d.mts +5 -0
  29. package/dist/routes/security.txt.mjs +24 -0
  30. package/dist/routes/site.webmanifest.d.mts +5 -0
  31. package/dist/routes/site.webmanifest.mjs +23 -0
  32. package/dist/routes/sitemap.xml.mjs +1 -1
  33. package/dist/security.d.mts +7 -0
  34. package/dist/security.mjs +34 -0
  35. package/dist/types.d.mts +191 -8
  36. package/package.json +30 -7
  37. package/src/assets.test.ts +70 -0
  38. package/src/assets.ts +137 -0
  39. package/src/catalog.test.ts +26 -0
  40. package/src/catalog.ts +11 -0
  41. package/src/components/SEOHead.astro +1 -1
  42. package/src/env.d.ts +55 -33
  43. package/src/index.ts +18 -1
  44. package/src/integration.ts +365 -172
  45. package/src/manifest.test.ts +41 -0
  46. package/src/manifest.ts +59 -0
  47. package/src/og.ts +1 -9
  48. package/src/routes/api-catalog.ts +55 -0
  49. package/src/routes/apple-touch-icon.png.ts +19 -0
  50. package/src/routes/favicon.ico.ts +19 -0
  51. package/src/routes/favicon.svg.ts +17 -0
  52. package/src/routes/icon-192.png.ts +19 -0
  53. package/src/routes/icon-512.png.ts +19 -0
  54. package/src/routes/icon-maskable-512.png.ts +24 -0
  55. package/src/routes/llms-full.txt.ts +77 -77
  56. package/src/routes/llms.txt.ts +93 -90
  57. package/src/routes/robots.txt.ts +63 -63
  58. package/src/routes/rss.xml.ts +129 -87
  59. package/src/routes/security.txt.ts +30 -0
  60. package/src/routes/site.webmanifest.ts +28 -0
  61. package/src/routes/sitemap.xml.ts +43 -43
  62. package/src/rss.test.ts +28 -28
  63. package/src/rss.ts +63 -63
  64. package/src/security.test.ts +46 -0
  65. package/src/security.ts +78 -0
  66. package/src/types.ts +564 -367
  67. package/LICENSE +0 -21
@@ -0,0 +1,78 @@
1
+ import type { SecurityTxtOptions } from "./types.js"
2
+
3
+ /**
4
+ * Build RFC 9116 compliant security.txt content. https://www.rfc-editor.org/rfc/rfc9116
5
+ */
6
+ export function buildSecurityTxt(options: SecurityTxtOptions): string {
7
+ const lines: string[] = []
8
+
9
+ // Contact (REQUIRED in RFC 9116: at least one)
10
+ const contacts = Array.isArray(options.contact)
11
+ ? options.contact
12
+ : options.contact
13
+ ? [options.contact]
14
+ : []
15
+
16
+ for (const contact of contacts) {
17
+ lines.push(`Contact: ${contact}`)
18
+ }
19
+
20
+ // Expires (REQUIRED in RFC 9116)
21
+ let expiresStr: string
22
+ if (options.expires instanceof Date) {
23
+ expiresStr = options.expires.toISOString()
24
+ } else if (typeof options.expires === "string" && options.expires.trim().length > 0) {
25
+ expiresStr = options.expires
26
+ } else {
27
+ // Default to 1 year in the future from generation
28
+ const oneYearFromNow = new Date()
29
+ oneYearFromNow.setFullYear(oneYearFromNow.getFullYear() + 1)
30
+ expiresStr = oneYearFromNow.toISOString()
31
+ }
32
+ lines.push(`Expires: ${expiresStr}`)
33
+
34
+ // Encryption (OPTIONAL)
35
+ if (options.encryption) {
36
+ const encList = Array.isArray(options.encryption) ? options.encryption : [options.encryption]
37
+ for (const enc of encList) {
38
+ lines.push(`Encryption: ${enc}`)
39
+ }
40
+ }
41
+
42
+ // Acknowledgments (OPTIONAL)
43
+ if (options.acknowledgments) {
44
+ const acks = Array.isArray(options.acknowledgments)
45
+ ? options.acknowledgments
46
+ : [options.acknowledgments]
47
+ for (const ack of acks) {
48
+ lines.push(`Acknowledgments: ${ack}`)
49
+ }
50
+ }
51
+
52
+ // Preferred-Languages (OPTIONAL)
53
+ if (options.preferredLanguages) {
54
+ lines.push(`Preferred-Languages: ${options.preferredLanguages}`)
55
+ }
56
+
57
+ // Canonical (OPTIONAL)
58
+ if (options.canonical) {
59
+ lines.push(`Canonical: ${options.canonical}`)
60
+ }
61
+
62
+ // Policy (OPTIONAL)
63
+ if (options.policy) {
64
+ lines.push(`Policy: ${options.policy}`)
65
+ }
66
+
67
+ // Hiring (OPTIONAL)
68
+ if (options.hiring) {
69
+ lines.push(`Hiring: ${options.hiring}`)
70
+ }
71
+
72
+ // CSAF (OPTIONAL)
73
+ if (options.csaf) {
74
+ lines.push(`CSAF: ${options.csaf}`)
75
+ }
76
+
77
+ return lines.join("\n") + "\n"
78
+ }