@sarimarcus/content-sites-core 0.39.0 → 0.40.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/CHANGELOG.md +8 -0
- package/README.md +1 -1
- package/dist/config/index.d.ts +0 -1
- package/dist/config/index.js +1 -1
- package/dist/schema/context.js +3 -3
- package/dist/schema/types.d.ts +1 -1
- package/dist/url/index.d.ts +1 -1
- package/dist/url/index.js +1 -1
- package/dist/url/routes.d.ts +2 -0
- package/dist/url/routes.js +5 -1
- package/package.json +1 -1
- package/src/config/index.ts +1 -1
- package/src/schema/context.ts +3 -3
- package/src/schema/types.ts +1 -1
- package/src/url/index.ts +1 -1
- package/src/url/routes.ts +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All packages in the platform release in lockstep; entries are per release version.
|
|
4
4
|
|
|
5
|
+
## 0.40.0 (2026-10-18)
|
|
6
|
+
|
|
7
|
+
- `url`: new `routeSegment(kind, routes?)` (override, then `DEFAULT_ROUTES`, then the kind's own name); `routePath` uses it. `schema`: `ctx.route` and `resolveAuthor` resolve through it, so one `SiteRoutes` override moves links and JSON-LD URLs together. Before, the schema context only read its own `routes` and the author URL was always `/author/` (SLA-3046).
|
|
8
|
+
|
|
9
|
+
### Breaking
|
|
10
|
+
|
|
11
|
+
- `./config` no longer exports `mergeConfig`, `resolveConfig`, `siteConfigValues` or `hasCapability` (no importer existed; the module stays internal until a consumer needs it). `scripts/platform/migrations/remove-deprecated.mjs` asserts a site imports none of them (SLA-3046).
|
|
12
|
+
|
|
5
13
|
## 0.39.0 (2026-10-16)
|
|
6
14
|
|
|
7
15
|
- `schema`: `hours.ts` exports `CLOCK_TIME`, the clock-time pattern `parseHoursShifts` and `latestClosing` now share; no behaviour change (SLA-3045).
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ today's ui components import from tourism code).
|
|
|
6
6
|
|
|
7
7
|
Named entry points: `url`, `affiliate`, `dates`, `geo`, `dom`, `text`, `config`, `types`, `schema`, `interludes`, `images` and `articles` (`src/internal` is never exported). No `.astro`
|
|
8
8
|
files. Lowest layer: imports nothing from the other packages; its one runtime dependency is `marked` (`readingTime`). Ownership per path is in
|
|
9
|
-
|
|
9
|
+
`data/snapshots/platform/catalogue.json` (owner `core`).
|
|
10
10
|
|
|
11
11
|
Code Node loads directly (config builders imported by `astro.config.mjs`) ships compiled to `dist/` with
|
|
12
12
|
type declarations. Node will not strip types from files under `node_modules`. So every entry point resolves to
|
package/dist/config/index.d.ts
CHANGED
|
@@ -3,4 +3,3 @@ export type { SiteConfigOptions, SitemapRule, PagefindIntegration } from './site
|
|
|
3
3
|
export { outboundLinkRel } from './outboundLinkRel.ts';
|
|
4
4
|
export type { OutboundLinkRelOptions } from './outboundLinkRel.ts';
|
|
5
5
|
export { latestGuideDate, guideDateMap, guidePublishDates } from './guideDates.ts';
|
|
6
|
-
export { mergeConfig, resolveConfig, siteConfigValues, hasCapability } from './precedence.ts';
|
package/dist/config/index.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
export { defineSiteConfig, buildLastmodMap, sitemapSerialize, PAGEFIND_EXCLUDE_SELECTORS } from "./siteConfig.js";
|
|
3
3
|
export { outboundLinkRel } from "./outboundLinkRel.js";
|
|
4
4
|
export { latestGuideDate, guideDateMap, guidePublishDates } from "./guideDates.js";
|
|
5
|
-
|
|
5
|
+
// precedence.ts (resolveConfig & co.) is internal until a consumer needs it: SLA-3046.
|
package/dist/schema/context.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeSiteUrl, toAbsoluteSiteUrl } from "../url/index.js";
|
|
1
|
+
import { normalizeSiteUrl, routeSegment, toAbsoluteSiteUrl } from "../url/index.js";
|
|
2
2
|
import { slugify } from "../text/index.js";
|
|
3
3
|
/** The site root with a trailing slash (either form) collapses to the bare base URL. */
|
|
4
4
|
export function normalizeHomepageUrl(url, siteUrl, siteBaseUrl) {
|
|
@@ -61,7 +61,7 @@ export function createSchemaContext(input) {
|
|
|
61
61
|
websiteId: `${siteBaseUrl}#website`,
|
|
62
62
|
abs: (path) => `${siteUrl}${basePath}${path}`,
|
|
63
63
|
absOrHttp: (path) => (path.startsWith('http') ? path : `${siteUrl}${basePath}${path}`),
|
|
64
|
-
route: (kind, slug) => `${siteUrl}${basePath}/${
|
|
64
|
+
route: (kind, slug) => `${siteUrl}${basePath}/${routeSegment(kind, routes)}/${slug}`,
|
|
65
65
|
fileExists,
|
|
66
66
|
// /images/{type}/{name}.webp → /images/og/{type}/{name}.jpg, falling back to the slug's jpg (SLA-2817);
|
|
67
67
|
// omitted rather than pointing at a file that is not there.
|
|
@@ -81,7 +81,7 @@ export function createSchemaContext(input) {
|
|
|
81
81
|
if (!authorName)
|
|
82
82
|
return null;
|
|
83
83
|
const profile = input.findAuthor?.(authorName);
|
|
84
|
-
const url =
|
|
84
|
+
const url = ctx.route('author', profile?.slug || slugify(authorName));
|
|
85
85
|
const image = profile?.photo
|
|
86
86
|
? (profile.photo.startsWith('http') ? profile.photo : `${siteUrl}${basePath}${profile.photo}`)
|
|
87
87
|
: undefined;
|
package/dist/schema/types.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export interface ResolvedAuthor {
|
|
|
28
28
|
image?: string;
|
|
29
29
|
sameAs?: string[];
|
|
30
30
|
}
|
|
31
|
-
/** Path segment per
|
|
31
|
+
/** Path segment per kind, e.g. `{ hotel: 'lodges' }`; the same map as `SiteRoutes`. A kind not listed uses `DEFAULT_ROUTES`, then its own name. */
|
|
32
32
|
export type RouteMap = Partial<Record<string, string>>;
|
|
33
33
|
export interface SchemaContextInput {
|
|
34
34
|
/** Site origin, with or without a trailing slash. */
|
package/dist/url/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { buildImageMap } from './imageMap.ts';
|
|
|
5
5
|
export { articleFeedItem } from './feed.ts';
|
|
6
6
|
export type { FeedArticle, FeedItem } from './feed.ts';
|
|
7
7
|
export { pageTypeOf } from './pageType.ts';
|
|
8
|
-
export { DEFAULT_ROUTES, routePath } from './routes.ts';
|
|
8
|
+
export { DEFAULT_ROUTES, routePath, routeSegment } from './routes.ts';
|
|
9
9
|
export type { RouteKind, SiteRoutes } from './routes.ts';
|
|
10
10
|
export { outboundClassifier, outboundHostKey, applyOutboundRel } from './outbound.ts';
|
|
11
11
|
export type { OutboundDomainStore } from './outbound.ts';
|
package/dist/url/index.js
CHANGED
|
@@ -5,6 +5,6 @@ export { normalizeHref, extractProseHrefs, dedupRelated } from "./relatedDedup.j
|
|
|
5
5
|
export { buildImageMap } from "./imageMap.js";
|
|
6
6
|
export { articleFeedItem } from "./feed.js";
|
|
7
7
|
export { pageTypeOf } from "./pageType.js";
|
|
8
|
-
export { DEFAULT_ROUTES, routePath } from "./routes.js";
|
|
8
|
+
export { DEFAULT_ROUTES, routePath, routeSegment } from "./routes.js";
|
|
9
9
|
export { outboundClassifier, outboundHostKey, applyOutboundRel } from "./outbound.js";
|
|
10
10
|
export { RELATED_ZONE_ROLES, closerHeading, featuredInGuides, buildTakenHrefs } from "./relatedZone.js";
|
package/dist/url/routes.d.ts
CHANGED
|
@@ -7,5 +7,7 @@ export declare const DEFAULT_ROUTES: {
|
|
|
7
7
|
};
|
|
8
8
|
export type RouteKind = keyof typeof DEFAULT_ROUTES;
|
|
9
9
|
export type SiteRoutes = Partial<Record<RouteKind, string>>;
|
|
10
|
+
/** Path segment for `kind`: the site's override, then `DEFAULT_ROUTES`, then the kind's own name (vertical entity kinds). */
|
|
11
|
+
export declare function routeSegment(kind: string, routes?: Partial<Record<string, string>>): string;
|
|
10
12
|
/** `/<segment>` for `kind`, or `/<segment>/<slug>`, from `routes` first and then the default. Base path not applied. */
|
|
11
13
|
export declare function routePath(kind: RouteKind, slug?: string, routes?: SiteRoutes): string;
|
package/dist/url/routes.js
CHANGED
|
@@ -5,8 +5,12 @@ export const DEFAULT_ROUTES = {
|
|
|
5
5
|
author: 'author',
|
|
6
6
|
neighborhood: 'neighborhood',
|
|
7
7
|
};
|
|
8
|
+
/** Path segment for `kind`: the site's override, then `DEFAULT_ROUTES`, then the kind's own name (vertical entity kinds). */
|
|
9
|
+
export function routeSegment(kind, routes = {}) {
|
|
10
|
+
return routes[kind] ?? DEFAULT_ROUTES[kind] ?? kind;
|
|
11
|
+
}
|
|
8
12
|
/** `/<segment>` for `kind`, or `/<segment>/<slug>`, from `routes` first and then the default. Base path not applied. */
|
|
9
13
|
export function routePath(kind, slug, routes = {}) {
|
|
10
|
-
const segment =
|
|
14
|
+
const segment = routeSegment(kind, routes);
|
|
11
15
|
return slug === undefined ? `/${segment}` : `/${segment}/${slug}`;
|
|
12
16
|
}
|
package/package.json
CHANGED
package/src/config/index.ts
CHANGED
|
@@ -4,4 +4,4 @@ export type { SiteConfigOptions, SitemapRule, PagefindIntegration } from './site
|
|
|
4
4
|
export { outboundLinkRel } from './outboundLinkRel.ts';
|
|
5
5
|
export type { OutboundLinkRelOptions } from './outboundLinkRel.ts';
|
|
6
6
|
export { latestGuideDate, guideDateMap, guidePublishDates } from './guideDates.ts';
|
|
7
|
-
|
|
7
|
+
// precedence.ts (resolveConfig & co.) is internal until a consumer needs it: SLA-3046.
|
package/src/schema/context.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeSiteUrl, toAbsoluteSiteUrl } from '../url/index.ts';
|
|
1
|
+
import { normalizeSiteUrl, routeSegment, toAbsoluteSiteUrl } from '../url/index.ts';
|
|
2
2
|
import { slugify } from '../text/index.ts';
|
|
3
3
|
import type { JsonLdNode, ResolvedAuthor, SchemaContext, SchemaContextInput } from './types.ts';
|
|
4
4
|
|
|
@@ -65,7 +65,7 @@ export function createSchemaContext(input: SchemaContextInput): SchemaContext {
|
|
|
65
65
|
websiteId: `${siteBaseUrl}#website`,
|
|
66
66
|
abs: (path) => `${siteUrl}${basePath}${path}`,
|
|
67
67
|
absOrHttp: (path) => (path.startsWith('http') ? path : `${siteUrl}${basePath}${path}`),
|
|
68
|
-
route: (kind, slug) => `${siteUrl}${basePath}/${
|
|
68
|
+
route: (kind, slug) => `${siteUrl}${basePath}/${routeSegment(kind, routes)}/${slug}`,
|
|
69
69
|
fileExists,
|
|
70
70
|
// /images/{type}/{name}.webp → /images/og/{type}/{name}.jpg, falling back to the slug's jpg (SLA-2817);
|
|
71
71
|
// omitted rather than pointing at a file that is not there.
|
|
@@ -82,7 +82,7 @@ export function createSchemaContext(input: SchemaContextInput): SchemaContext {
|
|
|
82
82
|
resolveAuthor(authorName) {
|
|
83
83
|
if (!authorName) return null;
|
|
84
84
|
const profile = input.findAuthor?.(authorName);
|
|
85
|
-
const url =
|
|
85
|
+
const url = ctx.route('author', profile?.slug || slugify(authorName));
|
|
86
86
|
const image = profile?.photo
|
|
87
87
|
? (profile.photo.startsWith('http') ? profile.photo : `${siteUrl}${basePath}${profile.photo}`)
|
|
88
88
|
: undefined;
|
package/src/schema/types.ts
CHANGED
|
@@ -34,7 +34,7 @@ export interface ResolvedAuthor {
|
|
|
34
34
|
sameAs?: string[];
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
/** Path segment per
|
|
37
|
+
/** Path segment per kind, e.g. `{ hotel: 'lodges' }`; the same map as `SiteRoutes`. A kind not listed uses `DEFAULT_ROUTES`, then its own name. */
|
|
38
38
|
export type RouteMap = Partial<Record<string, string>>;
|
|
39
39
|
|
|
40
40
|
export interface SchemaContextInput {
|
package/src/url/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { buildImageMap } from './imageMap.ts';
|
|
|
6
6
|
export { articleFeedItem } from './feed.ts';
|
|
7
7
|
export type { FeedArticle, FeedItem } from './feed.ts';
|
|
8
8
|
export { pageTypeOf } from './pageType.ts';
|
|
9
|
-
export { DEFAULT_ROUTES, routePath } from './routes.ts';
|
|
9
|
+
export { DEFAULT_ROUTES, routePath, routeSegment } from './routes.ts';
|
|
10
10
|
export type { RouteKind, SiteRoutes } from './routes.ts';
|
|
11
11
|
export { outboundClassifier, outboundHostKey, applyOutboundRel } from './outbound.ts';
|
|
12
12
|
export type { OutboundDomainStore } from './outbound.ts';
|
package/src/url/routes.ts
CHANGED
|
@@ -9,8 +9,13 @@ export const DEFAULT_ROUTES = {
|
|
|
9
9
|
export type RouteKind = keyof typeof DEFAULT_ROUTES;
|
|
10
10
|
export type SiteRoutes = Partial<Record<RouteKind, string>>;
|
|
11
11
|
|
|
12
|
+
/** Path segment for `kind`: the site's override, then `DEFAULT_ROUTES`, then the kind's own name (vertical entity kinds). */
|
|
13
|
+
export function routeSegment(kind: string, routes: Partial<Record<string, string>> = {}): string {
|
|
14
|
+
return routes[kind] ?? (DEFAULT_ROUTES as Record<string, string>)[kind] ?? kind;
|
|
15
|
+
}
|
|
16
|
+
|
|
12
17
|
/** `/<segment>` for `kind`, or `/<segment>/<slug>`, from `routes` first and then the default. Base path not applied. */
|
|
13
18
|
export function routePath(kind: RouteKind, slug?: string, routes: SiteRoutes = {}): string {
|
|
14
|
-
const segment =
|
|
19
|
+
const segment = routeSegment(kind, routes);
|
|
15
20
|
return slug === undefined ? `/${segment}` : `/${segment}/${slug}`;
|
|
16
21
|
}
|