singularity-core 0.15.2 → 0.15.3
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/security/index.d.ts +5 -0
- package/dist/security/index.js +6 -0
- package/dist/seo/index.d.ts +18 -0
- package/dist/seo/index.js +19 -0
- package/package.json +15 -17
package/dist/security/index.d.ts
CHANGED
|
@@ -33,6 +33,11 @@ export declare function buildContentSecurityPolicy({ nonce, dev, extraSources, }
|
|
|
33
33
|
* referrer, permissions and cross-origin isolation, plus the CSP when one
|
|
34
34
|
* is given.
|
|
35
35
|
*
|
|
36
|
+
* `X-XSS-Protection: 0` is for security scanners that flag the header as
|
|
37
|
+
* missing. Browsers have dropped the XSS auditor it controlled (the CSP does
|
|
38
|
+
* that job), and `0` is the safe value: `1; mode=block` let old browsers
|
|
39
|
+
* leak data across sites.
|
|
40
|
+
*
|
|
36
41
|
* COOP `same-origin` keeps cross-origin windows out of the page's browsing
|
|
37
42
|
* context group. COEP is `credentialless`, not `require-corp`: the maps'
|
|
38
43
|
* OpenStreetMap tiles and the QR code images send no
|
package/dist/security/index.js
CHANGED
|
@@ -81,6 +81,11 @@ const DISABLED_FEATURES = [
|
|
|
81
81
|
* referrer, permissions and cross-origin isolation, plus the CSP when one
|
|
82
82
|
* is given.
|
|
83
83
|
*
|
|
84
|
+
* `X-XSS-Protection: 0` is for security scanners that flag the header as
|
|
85
|
+
* missing. Browsers have dropped the XSS auditor it controlled (the CSP does
|
|
86
|
+
* that job), and `0` is the safe value: `1; mode=block` let old browsers
|
|
87
|
+
* leak data across sites.
|
|
88
|
+
*
|
|
84
89
|
* COOP `same-origin` keeps cross-origin windows out of the page's browsing
|
|
85
90
|
* context group. COEP is `credentialless`, not `require-corp`: the maps'
|
|
86
91
|
* OpenStreetMap tiles and the QR code images send no
|
|
@@ -92,6 +97,7 @@ export function securityHeaders(contentSecurityPolicy) {
|
|
|
92
97
|
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
|
|
93
98
|
"X-Frame-Options": "SAMEORIGIN",
|
|
94
99
|
"X-Content-Type-Options": "nosniff",
|
|
100
|
+
"X-XSS-Protection": "0",
|
|
95
101
|
"Referrer-Policy": "strict-origin-when-cross-origin",
|
|
96
102
|
"Permissions-Policy": DISABLED_FEATURES.map((feature) => `${feature}=()`).join(", "),
|
|
97
103
|
"Cross-Origin-Opener-Policy": "same-origin",
|
package/dist/seo/index.d.ts
CHANGED
|
@@ -64,6 +64,24 @@ export type CanonicalMatch = {
|
|
|
64
64
|
* `head` runs again on every navigation, so the link follows the page.
|
|
65
65
|
*/
|
|
66
66
|
export declare function pageCanonicalUrl(base: string, matches: readonly CanonicalMatch[]): string | undefined;
|
|
67
|
+
/** One language version of a page: its BCP 47 tag ("en", "sv") and URL. */
|
|
68
|
+
export type LanguageAlternate = {
|
|
69
|
+
hrefLang: string;
|
|
70
|
+
/** Absolute URL of the page in that language. */
|
|
71
|
+
href: string;
|
|
72
|
+
};
|
|
73
|
+
/** An `hreflang` link for a route's `head.links`. */
|
|
74
|
+
export type HreflangLink = LanguageAlternate & {
|
|
75
|
+
rel: "alternate";
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* `hreflang` links for a page: one per language version, the page's own
|
|
79
|
+
* among them as search engines expect, plus `x-default` for visitors whose
|
|
80
|
+
* language none matches (`defaultHref`, else the first version). A
|
|
81
|
+
* single-language site passes one version, its canonical URL. No versions
|
|
82
|
+
* gives no links, as for a 404.
|
|
83
|
+
*/
|
|
84
|
+
export declare function hreflangLinks(alternates: readonly LanguageAlternate[], defaultHref?: string | undefined): HreflangLink[];
|
|
67
85
|
export type RobotsTxtOptions = {
|
|
68
86
|
userAgent?: string;
|
|
69
87
|
allow?: string[];
|
package/dist/seo/index.js
CHANGED
|
@@ -68,6 +68,25 @@ export function pageCanonicalUrl(base, matches) {
|
|
|
68
68
|
return undefined;
|
|
69
69
|
return canonicalUrl(base, page.pathname);
|
|
70
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* `hreflang` links for a page: one per language version, the page's own
|
|
73
|
+
* among them as search engines expect, plus `x-default` for visitors whose
|
|
74
|
+
* language none matches (`defaultHref`, else the first version). A
|
|
75
|
+
* single-language site passes one version, its canonical URL. No versions
|
|
76
|
+
* gives no links, as for a 404.
|
|
77
|
+
*/
|
|
78
|
+
export function hreflangLinks(alternates, defaultHref = alternates[0]?.href) {
|
|
79
|
+
if (!defaultHref)
|
|
80
|
+
return [];
|
|
81
|
+
return [
|
|
82
|
+
...alternates.map(({ hrefLang, href }) => ({
|
|
83
|
+
rel: "alternate",
|
|
84
|
+
hrefLang,
|
|
85
|
+
href,
|
|
86
|
+
})),
|
|
87
|
+
{ rel: "alternate", hrefLang: "x-default", href: defaultHref },
|
|
88
|
+
];
|
|
89
|
+
}
|
|
71
90
|
/** robots.txt for one user agent. Serve with `plainTextResponse`. */
|
|
72
91
|
export function buildRobotsTxt({ userAgent = "*", allow = [], disallow = [], sitemap, }) {
|
|
73
92
|
return [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "singularity-core",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.3",
|
|
4
4
|
"description": "Shared non-UI code for Singularity TanStack Start apps: auth sessions, API client middleware, API schemas, paging, route data, images, formatting, HTTP helpers, theme, cookie notice, SEO, security headers and telemetry.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Filip",
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
"sideEffects": [
|
|
13
13
|
"./dist/security/zod-jitless.js"
|
|
14
14
|
],
|
|
15
|
-
"packageManager": "pnpm@12.3.4",
|
|
16
15
|
"engines": {
|
|
17
16
|
"node": ">=26.0.0 <27.0.0",
|
|
18
17
|
"pnpm": ">=12.0.0 <13.0.0"
|
|
@@ -97,20 +96,6 @@
|
|
|
97
96
|
"./biome": "./config/biome-app.json",
|
|
98
97
|
"./package.json": "./package.json"
|
|
99
98
|
},
|
|
100
|
-
"scripts": {
|
|
101
|
-
"build": "node -e \"fs.rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.build.json",
|
|
102
|
-
"typecheck": "tsc --noEmit",
|
|
103
|
-
"test": "vitest run",
|
|
104
|
-
"test:watch": "vitest",
|
|
105
|
-
"openapi-dev-types": "openapi-typescript http://localhost:5268/swagger/v1/swagger.json -o ./src/api/v1.ts --alphabetize --default-non-nullable --enum-values",
|
|
106
|
-
"openapi-types": "openapi-typescript https://api.filion.se/swagger/v1/swagger.json -o ./src/api/v1.ts --alphabetize --default-non-nullable --enum-values",
|
|
107
|
-
"prepack": "pnpm build",
|
|
108
|
-
"check": "biome check",
|
|
109
|
-
"verify": "pnpm run typecheck && pnpm run check && pnpm run test",
|
|
110
|
-
"biome:check": "biome check --write",
|
|
111
|
-
"biome:lint": "biome lint --fix",
|
|
112
|
-
"biome:format": "biome format --write"
|
|
113
|
-
},
|
|
114
99
|
"peerDependencies": {
|
|
115
100
|
"@tanstack/react-router": "^1.170.0",
|
|
116
101
|
"@tanstack/react-start": "^1.168.0",
|
|
@@ -152,5 +137,18 @@
|
|
|
152
137
|
"typescript": "6.0.3",
|
|
153
138
|
"vitest": "5.0.5",
|
|
154
139
|
"zod": "4.6.7"
|
|
140
|
+
},
|
|
141
|
+
"scripts": {
|
|
142
|
+
"build": "node -e \"fs.rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.build.json",
|
|
143
|
+
"typecheck": "tsc --noEmit",
|
|
144
|
+
"test": "vitest run",
|
|
145
|
+
"test:watch": "vitest",
|
|
146
|
+
"openapi-dev-types": "openapi-typescript http://localhost:5268/swagger/v1/swagger.json -o ./src/api/v1.ts --alphabetize --default-non-nullable --enum-values",
|
|
147
|
+
"openapi-types": "openapi-typescript https://api.filion.se/swagger/v1/swagger.json -o ./src/api/v1.ts --alphabetize --default-non-nullable --enum-values",
|
|
148
|
+
"check": "biome check",
|
|
149
|
+
"verify": "pnpm run typecheck && pnpm run check && pnpm run test",
|
|
150
|
+
"biome:check": "biome check --write",
|
|
151
|
+
"biome:lint": "biome lint --fix",
|
|
152
|
+
"biome:format": "biome format --write"
|
|
155
153
|
}
|
|
156
|
-
}
|
|
154
|
+
}
|