@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.
- package/dist/assets.d.mts +39 -0
- package/dist/assets.mjs +96 -0
- package/dist/catalog.d.mts +7 -0
- package/dist/catalog.mjs +10 -0
- package/dist/index.d.mts +6 -2
- package/dist/index.mjs +5 -1
- package/dist/integration.mjs +194 -3
- package/dist/manifest.d.mts +7 -0
- package/dist/manifest.mjs +44 -0
- package/dist/og.mjs +1 -1
- package/dist/routes/api-catalog.d.mts +5 -0
- package/dist/routes/api-catalog.mjs +38 -0
- package/dist/routes/apple-touch-icon.png.d.mts +5 -0
- package/dist/routes/apple-touch-icon.png.mjs +17 -0
- package/dist/routes/favicon.ico.d.mts +5 -0
- package/dist/routes/favicon.ico.mjs +14 -0
- package/dist/routes/favicon.svg.d.mts +5 -0
- package/dist/routes/favicon.svg.mjs +12 -0
- package/dist/routes/icon-192.png.d.mts +5 -0
- package/dist/routes/icon-192.png.mjs +17 -0
- package/dist/routes/icon-512.png.d.mts +5 -0
- package/dist/routes/icon-512.png.mjs +17 -0
- package/dist/routes/icon-maskable-512.png.d.mts +5 -0
- package/dist/routes/icon-maskable-512.png.mjs +18 -0
- package/dist/routes/llms.txt.mjs +1 -1
- package/dist/routes/robots.txt.mjs +1 -1
- package/dist/routes/rss.xml.mjs +48 -20
- package/dist/routes/security.txt.d.mts +5 -0
- package/dist/routes/security.txt.mjs +24 -0
- package/dist/routes/site.webmanifest.d.mts +5 -0
- package/dist/routes/site.webmanifest.mjs +23 -0
- package/dist/routes/sitemap.xml.mjs +1 -1
- package/dist/security.d.mts +7 -0
- package/dist/security.mjs +34 -0
- package/dist/types.d.mts +191 -8
- package/package.json +30 -7
- package/src/assets.test.ts +70 -0
- package/src/assets.ts +137 -0
- package/src/catalog.test.ts +26 -0
- package/src/catalog.ts +11 -0
- package/src/components/SEOHead.astro +1 -1
- package/src/env.d.ts +55 -33
- package/src/index.ts +18 -1
- package/src/integration.ts +365 -172
- package/src/manifest.test.ts +41 -0
- package/src/manifest.ts +59 -0
- package/src/og.ts +1 -9
- package/src/routes/api-catalog.ts +55 -0
- package/src/routes/apple-touch-icon.png.ts +19 -0
- package/src/routes/favicon.ico.ts +19 -0
- package/src/routes/favicon.svg.ts +17 -0
- package/src/routes/icon-192.png.ts +19 -0
- package/src/routes/icon-512.png.ts +19 -0
- package/src/routes/icon-maskable-512.png.ts +24 -0
- package/src/routes/llms-full.txt.ts +77 -77
- package/src/routes/llms.txt.ts +93 -90
- package/src/routes/robots.txt.ts +63 -63
- package/src/routes/rss.xml.ts +129 -87
- package/src/routes/security.txt.ts +30 -0
- package/src/routes/site.webmanifest.ts +28 -0
- package/src/routes/sitemap.xml.ts +43 -43
- package/src/rss.test.ts +28 -28
- package/src/rss.ts +63 -63
- package/src/security.test.ts +46 -0
- package/src/security.ts +78 -0
- package/src/types.ts +564 -367
- package/LICENSE +0 -21
package/src/security.ts
ADDED
|
@@ -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
|
+
}
|