@escape-game-over/atlas 0.1.28 → 0.1.29
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 +2 -2
- package/src/redirects.ts +3 -2
- package/src/site/create.ts +5 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@escape-game-over/atlas",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.29",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Typed, data-driven machinery for static multi-locale, multi-deployment Astro sites.",
|
|
6
6
|
"private": false,
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@biomejs/biome": "2.5.14",
|
|
55
55
|
"@types/node": "26.6.2",
|
|
56
56
|
"@vitest/coverage-istanbul": "5.0.1",
|
|
57
|
-
"astro": "7.3.
|
|
57
|
+
"astro": "7.3.4",
|
|
58
58
|
"typescript": "6.0.3",
|
|
59
59
|
"vitest": "5.0.1"
|
|
60
60
|
}
|
package/src/redirects.ts
CHANGED
|
@@ -101,11 +101,12 @@ export type ValidateRedirectTargets<Rules> = {
|
|
|
101
101
|
* against what this project builds and its URL is derived — a redirect cannot
|
|
102
102
|
* outlive the page it points at, or miss a slug that was retranslated. The
|
|
103
103
|
* locale is optional and defaults to the site's own, since an old URL usually
|
|
104
|
-
* predates translation.
|
|
104
|
+
* predates translation. `page` names a page of a paginated list, and is refused
|
|
105
|
+
* the same way `pathFor` refuses it when the list has no such page.
|
|
105
106
|
*/
|
|
106
107
|
export type RedirectTarget<Id extends string, L extends string> =
|
|
107
108
|
| ExternalUrl
|
|
108
|
-
| { readonly route: Id; readonly locale?: L }
|
|
109
|
+
| { readonly route: Id; readonly locale?: L; readonly page?: number }
|
|
109
110
|
/**
|
|
110
111
|
* A file served verbatim from `public/` — a PDF, a spreadsheet.
|
|
111
112
|
*
|
package/src/site/create.ts
CHANGED
|
@@ -577,12 +577,14 @@ export function createSite<
|
|
|
577
577
|
from: rule.from,
|
|
578
578
|
// Three kinds of target, told apart by shape: a string is external
|
|
579
579
|
// and passes through, `file` is served verbatim from `public/`, and
|
|
580
|
-
// a route is resolved to whatever URL it has in the locale
|
|
581
|
-
// for.
|
|
580
|
+
// a route is resolved to whatever URL it has in the locale and on
|
|
581
|
+
// the page asked for.
|
|
582
582
|
to: ((): string => {
|
|
583
583
|
if (typeof rule.to === "string") return rule.to;
|
|
584
584
|
if ("file" in rule.to) return rule.to.file;
|
|
585
|
-
return pathFor(rule.to.route, rule.to.locale ?? defaultLocale
|
|
585
|
+
return pathFor(rule.to.route, rule.to.locale ?? defaultLocale, {
|
|
586
|
+
page: rule.to.page,
|
|
587
|
+
});
|
|
586
588
|
})(),
|
|
587
589
|
status: statusFor(rule.kind),
|
|
588
590
|
}));
|