@easy-web/core 1.7.1 → 1.9.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/README.md +23 -1
- package/dist/contracts/props.d.ts +4 -0
- package/dist/contracts/props.d.ts.map +1 -1
- package/dist/recipes/content-site.d.ts +75 -0
- package/dist/recipes/content-site.d.ts.map +1 -0
- package/dist/recipes/content-site.js +198 -0
- package/dist/recipes/content-site.js.map +1 -0
- package/dist/recipes/index.d.ts +1 -0
- package/dist/recipes/index.d.ts.map +1 -1
- package/dist/recipes/index.js +1 -0
- package/dist/recipes/index.js.map +1 -1
- package/dist/recipes/shell-recipe.d.ts +8 -1
- package/dist/recipes/shell-recipe.d.ts.map +1 -1
- package/dist/recipes/shell-recipe.js +21 -16
- package/dist/recipes/shell-recipe.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Card.astro +2 -2
- package/src/components/GalleryLightboxGrid.astro +1 -1
- package/src/components/Header.astro +1 -1
- package/src/components/HeaderCentered.astro +1 -1
- package/src/components/HeaderFlyout.astro +2 -2
- package/src/components/HeaderHideOnScroll.astro +1 -1
- package/src/components/PageShell.astro +1 -1
- package/src/components/SeoHead.astro +22 -4
- package/src/components/__tests__/Card.test.ts +16 -0
- package/src/contracts/props.ts +4 -0
- package/src/recipes/__tests__/content-site.test.ts +66 -0
- package/src/recipes/__tests__/shell-recipe.test.ts +3 -1
- package/src/recipes/content-site.ts +225 -0
- package/src/recipes/index.ts +1 -0
- package/src/recipes/shell-recipe.ts +29 -17
- package/src/seo/__tests__/__snapshots__/legacy-baseline.test.ts.snap +1 -1
- package/src/seo/__tests__/legacy-baseline.test.ts +2 -1
- package/src/seo/__tests__/og-locales.test.ts +55 -0
- package/src/type-tests/card-props.ts +10 -0
package/README.md
CHANGED
|
@@ -99,7 +99,9 @@ are allowed. A registry pin identifies package name, exact version, SHA-512 SRI
|
|
|
99
99
|
and package-relative export path. The future loader must verify artifact bytes
|
|
100
100
|
before importing executable code; admission checks its receipt against the
|
|
101
101
|
CLI-owned registry, not a registry supplied by the target. A receipt schema alone
|
|
102
|
-
is not cryptographic verification.
|
|
102
|
+
is not cryptographic verification. The verified-artifact loader is not implemented;
|
|
103
|
+
the CLI currently imports its first-party workspace/package dependencies directly.
|
|
104
|
+
Core ships the shell recipe and content-site recipe factory.
|
|
103
105
|
|
|
104
106
|
## Generic content composition
|
|
105
107
|
|
|
@@ -115,4 +117,24 @@ Only a money-enabled selection accepts `currency`, validated by the shared ISO
|
|
|
115
117
|
4217 input schema. `homepage` requires `featured`, so a type cannot occupy that
|
|
116
118
|
featured presentation slot merely by defining an image.
|
|
117
119
|
|
|
120
|
+
`createContentSiteRecipes(composition)` from `@easy-web/core/recipes` connects a
|
|
121
|
+
validated composition to shell navigation and a `content.pages` recipe. Its
|
|
122
|
+
`generatedContentCompositionSchema` deliberately accepts a smaller implemented
|
|
123
|
+
subset than the generic contract: one locale, `title`/`slug`/`body`, optional
|
|
124
|
+
`summary`/`image`, list/detail bindings and optional navigation or `cms-admin`. Other valid
|
|
125
|
+
contract selections fail with an explicit not-yet-supported diagnostic.
|
|
126
|
+
|
|
127
|
+
The recipe generates Astro collections from shared trait schemas, deterministic
|
|
128
|
+
example content, contract-checked entry adapters and list/detail pages using Card,
|
|
129
|
+
Media and Prose. A body becomes `HasBody` only after Astro renders it. Content
|
|
130
|
+
roles and bindings are logical graph contributions, not output filenames.
|
|
131
|
+
`primary` is a graph role; it does not select a homepage automatically.
|
|
132
|
+
`@easy-web/cms-adapters` supplies `createCmsContentSiteRecipes` for the CMS-enabled
|
|
133
|
+
path, consuming the same composition without replacing core's schemas or routes.
|
|
134
|
+
Core's optional `ContentSiteOptions` lets first-party recipes choose an asset
|
|
135
|
+
folder and contribute imports/integrations/markdown processing to the shell's
|
|
136
|
+
single configuration renderer. These are package-owned source expressions, not
|
|
137
|
+
user-configurable JavaScript or a post-generation config merge.
|
|
138
|
+
Application-auth composition remains unsupported.
|
|
139
|
+
|
|
118
140
|
This package is published as part of the fixed `@easy-web/*` family through the Changesets and npm Trusted Publishing workflow.
|
|
@@ -19,6 +19,8 @@ export type GalleryItem = Image & {
|
|
|
19
19
|
*/
|
|
20
20
|
export interface ItemCardProps {
|
|
21
21
|
item: Item & Partial<Linkable>;
|
|
22
|
+
/** Title heading tag. Defaults to `h3`; use `h2` directly below a page heading. */
|
|
23
|
+
headingLevel?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
22
24
|
/**
|
|
23
25
|
* `sizes` attribute of the responsive image. Only `ImageMetadata` sources
|
|
24
26
|
* get a `srcset`; a string source renders a plain `<img>` and ignores it.
|
|
@@ -33,6 +35,8 @@ export interface ItemCardProps {
|
|
|
33
35
|
}
|
|
34
36
|
/** `Card` rendered from individual props, exactly as before the content contracts. */
|
|
35
37
|
export interface LegacyCardProps {
|
|
38
|
+
/** Title heading tag, with the same `h3` default as the item API. */
|
|
39
|
+
headingLevel?: ItemCardProps['headingLevel'];
|
|
36
40
|
/** @deprecated Pass `item`; `item.title` is rendered. */
|
|
37
41
|
title: string;
|
|
38
42
|
/** @deprecated Pass `item`; `item.description` is rendered. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/contracts/props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAA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,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,KAAK,EAAE,IAAI,EAAE,CAAC;CACf;AAED,kFAAkF;AAClF,MAAM,WAAW,WAAY,SAAQ,oBAAoB;IACvD,QAAQ,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,UAAU,EAAE,IAAI,EAAE,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;CAC1B"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { z } from 'astro/zod';
|
|
2
|
+
import type { ShellConfiguration, ShellRecipeOptions } from './shell-recipe.js';
|
|
3
|
+
import type { RecipeMetadata } from './types.js';
|
|
4
|
+
export interface ContentSiteOptions {
|
|
5
|
+
readonly mediaFolder?: string;
|
|
6
|
+
readonly shellConfiguration?: ShellConfiguration;
|
|
7
|
+
}
|
|
8
|
+
export declare const generatedContentCompositionSchema: z.ZodReadonly<z.ZodObject<{
|
|
9
|
+
contentLocales: z.ZodReadonly<z.ZodArray<z.core.$ZodBranded<z.ZodString, "ContentLocale", "out">>>;
|
|
10
|
+
contentTypes: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
11
|
+
traits: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
12
|
+
title: "title";
|
|
13
|
+
slug: "slug";
|
|
14
|
+
summary: "summary";
|
|
15
|
+
body: "body";
|
|
16
|
+
image: "image";
|
|
17
|
+
photos: "photos";
|
|
18
|
+
order: "order";
|
|
19
|
+
taxonomy: "taxonomy";
|
|
20
|
+
publication: "publication";
|
|
21
|
+
schedule: "schedule";
|
|
22
|
+
location: "location";
|
|
23
|
+
cta: "cta";
|
|
24
|
+
money: "money";
|
|
25
|
+
featured: "featured";
|
|
26
|
+
}>>>;
|
|
27
|
+
currency: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "CurrencyCode", "out">>;
|
|
28
|
+
id: z.core.$ZodBranded<z.ZodString, "ContentTypeId", "out">;
|
|
29
|
+
primary: z.ZodDefault<z.ZodBoolean>;
|
|
30
|
+
labels: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
31
|
+
routes: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
32
|
+
bindings: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
33
|
+
homepage: "homepage";
|
|
34
|
+
list: "list";
|
|
35
|
+
detail: "detail";
|
|
36
|
+
navigation: "navigation";
|
|
37
|
+
"cms-admin": "cms-admin";
|
|
38
|
+
}>>>;
|
|
39
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
40
|
+
traits: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
41
|
+
title: "title";
|
|
42
|
+
slug: "slug";
|
|
43
|
+
summary: "summary";
|
|
44
|
+
body: "body";
|
|
45
|
+
image: "image";
|
|
46
|
+
photos: "photos";
|
|
47
|
+
order: "order";
|
|
48
|
+
taxonomy: "taxonomy";
|
|
49
|
+
publication: "publication";
|
|
50
|
+
schedule: "schedule";
|
|
51
|
+
location: "location";
|
|
52
|
+
cta: "cta";
|
|
53
|
+
money: "money";
|
|
54
|
+
featured: "featured";
|
|
55
|
+
}>>>;
|
|
56
|
+
id: z.core.$ZodBranded<z.ZodString, "ContentTypeId", "out">;
|
|
57
|
+
primary: z.ZodDefault<z.ZodBoolean>;
|
|
58
|
+
labels: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
59
|
+
routes: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
60
|
+
bindings: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
61
|
+
homepage: "homepage";
|
|
62
|
+
list: "list";
|
|
63
|
+
detail: "detail";
|
|
64
|
+
navigation: "navigation";
|
|
65
|
+
"cms-admin": "cms-admin";
|
|
66
|
+
}>>>;
|
|
67
|
+
}, z.core.$strict>>]>>>;
|
|
68
|
+
reservedRoutes: z.ZodReadonly<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
69
|
+
}, z.core.$strict>>;
|
|
70
|
+
/** Bind package-owned content generation to a validated composition, independently of a CMS. */
|
|
71
|
+
export declare function createContentSiteRecipes(rawComposition: unknown, options?: ContentSiteOptions): {
|
|
72
|
+
readonly shell: RecipeMetadata<ShellRecipeOptions>;
|
|
73
|
+
readonly content: RecipeMetadata;
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=content-site.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-site.d.ts","sourceRoot":"","sources":["../../src/recipes/content-site.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;AAK9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,KAAK,EAAuB,cAAc,EAAE,MAAM,YAAY,CAAC;AAMtE,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACpD;AAED,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA+B5C,CAAC;AAyIH,gGAAgG;AAChG,wBAAgB,wBAAwB,CAAC,cAAc,EAAE,OAAO,EAAE,OAAO,GAAE,kBAAuB,GAAG;IACjG,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,kBAAkB,CAAC,CAAC;IACnD,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;CACpC,CAmCA"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { z } from 'astro/zod';
|
|
2
|
+
import { posix } from 'node:path';
|
|
3
|
+
import { contentCompositionSchema, defaultReservedContentRoutes } from '../contracts/content-composition.js';
|
|
4
|
+
import { buildShellFiles, shellRecipe } from './shell-recipe.js';
|
|
5
|
+
const supportedTraits = new Set(['title', 'slug', 'summary', 'image', 'body']);
|
|
6
|
+
const supportedBindings = new Set(['list', 'detail', 'navigation', 'cms-admin']);
|
|
7
|
+
export const generatedContentCompositionSchema = contentCompositionSchema.superRefine((composition, context) => {
|
|
8
|
+
if (composition.contentLocales.length !== 1) {
|
|
9
|
+
context.addIssue({ code: 'custom', path: ['contentLocales'], message: 'Content generation currently requires exactly one locale' });
|
|
10
|
+
}
|
|
11
|
+
if (!composition.contentTypes.length) {
|
|
12
|
+
context.addIssue({ code: 'custom', path: ['contentTypes'], message: 'Content generation requires at least one content type' });
|
|
13
|
+
}
|
|
14
|
+
const routes = [];
|
|
15
|
+
composition.contentTypes.forEach((type, index) => {
|
|
16
|
+
const path = ['contentTypes', index];
|
|
17
|
+
for (const trait of type.traits) {
|
|
18
|
+
if (!supportedTraits.has(trait))
|
|
19
|
+
context.addIssue({ code: 'custom', path: [...path, 'traits'], message: `Content generation does not yet support trait "${trait}"` });
|
|
20
|
+
}
|
|
21
|
+
for (const binding of type.bindings) {
|
|
22
|
+
if (!supportedBindings.has(binding))
|
|
23
|
+
context.addIssue({ code: 'custom', path: [...path, 'bindings'], message: `Content generation does not yet support binding "${binding}"` });
|
|
24
|
+
}
|
|
25
|
+
if (!type.bindings.includes('list') || !type.bindings.includes('detail')) {
|
|
26
|
+
context.addIssue({ code: 'custom', path: [...path, 'bindings'], message: 'Content generation requires both list and detail bindings' });
|
|
27
|
+
}
|
|
28
|
+
for (const route of Object.values(type.routes)) {
|
|
29
|
+
const base = route.replace(/\/$/, '');
|
|
30
|
+
if (!/^\/[a-z0-9]+(?:-[a-z0-9]+)*(?:\/[a-z0-9]+(?:-[a-z0-9]+)*)*$/.test(base)
|
|
31
|
+
|| defaultReservedContentRoutes.some((reserved) => reserved !== '/' && `${base}/`.startsWith(reserved))) {
|
|
32
|
+
context.addIssue({ code: 'custom', path: [...path, 'routes'], message: `Unsupported generated content route "${route}"; use non-reserved lowercase path segments` });
|
|
33
|
+
}
|
|
34
|
+
if (routes.some((other) => base.startsWith(`${other}/`) || other.startsWith(`${base}/`))) {
|
|
35
|
+
context.addIssue({ code: 'custom', path: [...path, 'routes'], message: `Generated list/detail routes overlap at "${route}"` });
|
|
36
|
+
}
|
|
37
|
+
routes.push(base);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
function routeBase(type, locale) {
|
|
42
|
+
return type.routes[locale].replace(/\/$/, '');
|
|
43
|
+
}
|
|
44
|
+
function collectionSchema(type) {
|
|
45
|
+
const shapes = ['...titleTraitSchema.unwrap().shape', '...slugTraitSchema.unwrap().shape'];
|
|
46
|
+
if (type.traits.includes('summary'))
|
|
47
|
+
shapes.push('...summaryTraitSchema.unwrap().shape');
|
|
48
|
+
if (type.traits.includes('image')) {
|
|
49
|
+
shapes.push('image: imageTraitSchema.unwrap().shape.image.unwrap().extend({ src: image() })');
|
|
50
|
+
}
|
|
51
|
+
// File-based IDs keep duplicate public slugs visible to route validation.
|
|
52
|
+
return `${JSON.stringify(type.id)}: defineCollection({
|
|
53
|
+
loader: glob({ pattern: '**/*.md', base: ${JSON.stringify(`./src/content/${type.id}`)}, generateId: ({ entry }) => entry.replace(/\\.md$/, '') }),
|
|
54
|
+
schema: ${type.traits.includes('image') ? '({ image }) => ' : ''}z.object({ ${shapes.join(', ')} }).strict(),
|
|
55
|
+
})`;
|
|
56
|
+
}
|
|
57
|
+
function adapterSource(type, locale, index) {
|
|
58
|
+
const contracts = ['HasTitle', 'HasSlug', ...(type.traits.includes('summary') ? ['HasSummary'] : []), ...(type.traits.includes('image') ? ['HasImage'] : [])];
|
|
59
|
+
return `import type { CollectionEntry } from 'astro:content';
|
|
60
|
+
import { assertImplements, type Item, type Linkable, ${contracts.map((name) => `type ${name}`).join(', ')} } from '@easy-web/core/contracts';
|
|
61
|
+
import { composition } from '../../content/definitions';
|
|
62
|
+
|
|
63
|
+
type Entry = CollectionEntry<${JSON.stringify(type.id)}>;
|
|
64
|
+
assertImplements<Entry['data'], ${contracts.join(' & ')}>();
|
|
65
|
+
|
|
66
|
+
export function toItem(entry: Entry): Item & Linkable {
|
|
67
|
+
const data = entry.data;
|
|
68
|
+
return {
|
|
69
|
+
title: data.title,
|
|
70
|
+
${type.traits.includes('summary') ? 'description: data.summary,' : ''}
|
|
71
|
+
${type.traits.includes('image') ? 'image: data.image,' : ''}
|
|
72
|
+
href: composition.contentTypes[${index}].routes[${JSON.stringify(locale)}].replace(/\\/$/, '') + '/' + data.slug + '/',
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
`;
|
|
76
|
+
}
|
|
77
|
+
function listSource(type, locale) {
|
|
78
|
+
const prefix = '../'.repeat(routeBase(type, locale).split('/').length);
|
|
79
|
+
return `---
|
|
80
|
+
import { getCollection } from 'astro:content';
|
|
81
|
+
import Base from '${prefix}layouts/Base.astro';
|
|
82
|
+
import { toItem } from '${prefix}lib/content/${type.id}';
|
|
83
|
+
import Card from '@easy-web/core/components/Card.astro';
|
|
84
|
+
import CardGrid from '@easy-web/core/components/CardGrid.astro';
|
|
85
|
+
|
|
86
|
+
const items = (await getCollection(${JSON.stringify(type.id)}))
|
|
87
|
+
.map(toItem).sort((left, right) => left.href < right.href ? -1 : left.href > right.href ? 1 : 0);
|
|
88
|
+
---
|
|
89
|
+
<Base title={${JSON.stringify(type.labels[locale])}}>
|
|
90
|
+
<h1>{${JSON.stringify(type.labels[locale])}}</h1>
|
|
91
|
+
<CardGrid>
|
|
92
|
+
{items.map((item) => <Card item={item} />)}
|
|
93
|
+
</CardGrid>
|
|
94
|
+
</Base>
|
|
95
|
+
`;
|
|
96
|
+
}
|
|
97
|
+
function detailSource(type, locale) {
|
|
98
|
+
const prefix = '../'.repeat(routeBase(type, locale).split('/').length);
|
|
99
|
+
return `---
|
|
100
|
+
import { getCollection, render, type CollectionEntry } from 'astro:content';
|
|
101
|
+
import type { Rendered, Item, Linkable } from '@easy-web/core/contracts';
|
|
102
|
+
import Base from '${prefix}layouts/Base.astro';
|
|
103
|
+
import { toItem } from '${prefix}lib/content/${type.id}';
|
|
104
|
+
import Prose from '@easy-web/core/components/Prose.astro';
|
|
105
|
+
${type.traits.includes('image') ? "import Media from '@easy-web/core/components/Media.astro';" : ''}
|
|
106
|
+
|
|
107
|
+
export async function getStaticPaths() {
|
|
108
|
+
const entries = await getCollection(${JSON.stringify(type.id)});
|
|
109
|
+
const seen = new Set<string>();
|
|
110
|
+
return entries.map((entry) => {
|
|
111
|
+
if (seen.has(entry.data.slug)) throw new Error('Duplicate content slug: ' + entry.data.slug);
|
|
112
|
+
seen.add(entry.data.slug);
|
|
113
|
+
return { params: { slug: entry.data.slug }, props: { entry } };
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
interface Props { entry: CollectionEntry<${JSON.stringify(type.id)}> }
|
|
118
|
+
const { entry } = Astro.props;
|
|
119
|
+
const rendered: Rendered<Item & Linkable> = { ...toItem(entry), ...(await render(entry)) };
|
|
120
|
+
const { Content } = rendered;
|
|
121
|
+
---
|
|
122
|
+
<Base title={rendered.title} description={rendered.description}${type.traits.includes('image') ? ' image={rendered.image?.src && (typeof rendered.image.src === \'string\' ? rendered.image.src : rendered.image.src.src)}' : ''}>
|
|
123
|
+
<Prose>
|
|
124
|
+
<h1>{rendered.title}</h1>
|
|
125
|
+
{rendered.description && <p>{rendered.description}</p>}
|
|
126
|
+
${type.traits.includes('image') ? '{rendered.image && <Media image={rendered.image} />}' : ''}
|
|
127
|
+
<Content />
|
|
128
|
+
</Prose>
|
|
129
|
+
</Base>
|
|
130
|
+
`;
|
|
131
|
+
}
|
|
132
|
+
function contentFiles(composition, options) {
|
|
133
|
+
const locale = composition.contentLocales[0];
|
|
134
|
+
const mediaFolder = z.string().regex(/^src\/assets(?:\/[a-z0-9]+(?:-[a-z0-9]+)*)*$/)
|
|
135
|
+
.parse(options.mediaFolder ?? 'src/assets');
|
|
136
|
+
const exampleImage = `${mediaFolder}/content-example.svg`;
|
|
137
|
+
const files = [
|
|
138
|
+
{ path: 'src/content/definitions.ts', content: `import { defineCollection, z } from 'astro:content';
|
|
139
|
+
import { glob } from 'astro/loaders';
|
|
140
|
+
import { titleTraitSchema, slugTraitSchema${composition.contentTypes.some((type) => type.traits.includes('summary')) ? ', summaryTraitSchema' : ''}${composition.contentTypes.some((type) => type.traits.includes('image')) ? ', imageTraitSchema' : ''} } from '@easy-web/core/contracts';
|
|
141
|
+
|
|
142
|
+
export const composition = ${JSON.stringify(composition, null, 2)} as const;
|
|
143
|
+
|
|
144
|
+
export const collections = {
|
|
145
|
+
${composition.contentTypes.map(collectionSchema).join(',\n ')},
|
|
146
|
+
};
|
|
147
|
+
` },
|
|
148
|
+
{ path: 'src/content.config.ts', content: "export { collections } from './content/definitions';\n" },
|
|
149
|
+
];
|
|
150
|
+
if (composition.contentTypes.some((type) => type.traits.includes('image'))) {
|
|
151
|
+
files.push({ path: 'package.json', content: `${JSON.stringify({ dependencies: { sharp: '^0.35.0' } }, null, 2)}\n` });
|
|
152
|
+
files.push({ path: exampleImage, content: '<svg xmlns="http://www.w3.org/2000/svg" width="640" height="360" viewBox="0 0 640 360"><rect width="640" height="360" fill="#334155"/><circle cx="320" cy="180" r="90" fill="#94a3b8"/></svg>\n' });
|
|
153
|
+
}
|
|
154
|
+
for (const [index, type] of composition.contentTypes.entries()) {
|
|
155
|
+
const data = {
|
|
156
|
+
title: `${type.labels[locale]} - ${locale === 'de' ? 'Beispiel' : 'Example'}`,
|
|
157
|
+
slug: 'example',
|
|
158
|
+
...(type.traits.includes('summary') ? { summary: locale === 'de' ? 'Generierter Beispielinhalt.' : 'Generated example content.' } : {}),
|
|
159
|
+
...(type.traits.includes('image') ? { image: { src: posix.relative(`src/content/${type.id}`, exampleImage), alt: locale === 'de' ? 'Kreis auf dunklem Hintergrund' : 'Circle on a dark background' } } : {}),
|
|
160
|
+
};
|
|
161
|
+
const base = routeBase(type, locale).slice(1);
|
|
162
|
+
files.push({ path: `src/content/${type.id}/example.md`, content: `---\n${JSON.stringify(data, null, 2)}\n---\n\n${locale === 'de' ? 'Ersetze diesen Beispielinhalt vor der Veroeffentlichung.' : 'Replace this example content before production.'}\n` }, { path: `src/lib/content/${type.id}.ts`, content: adapterSource(type, locale, index) }, { path: `src/pages/${base}/index.astro`, content: listSource(type, locale) }, { path: `src/pages/${base}/[slug].astro`, content: detailSource(type, locale) });
|
|
163
|
+
}
|
|
164
|
+
return files;
|
|
165
|
+
}
|
|
166
|
+
/** Bind package-owned content generation to a validated composition, independently of a CMS. */
|
|
167
|
+
export function createContentSiteRecipes(rawComposition, options = {}) {
|
|
168
|
+
const composition = generatedContentCompositionSchema.parse(rawComposition);
|
|
169
|
+
const locale = composition.contentLocales[0];
|
|
170
|
+
const files = contentFiles(composition, options);
|
|
171
|
+
const contributions = files
|
|
172
|
+
.filter(({ path }) => !path.startsWith('src/pages/'))
|
|
173
|
+
.map(({ path }, index) => ({ kind: path === 'package.json' ? 'dependency' : 'file', id: `content.file.${index}`, target: path }));
|
|
174
|
+
for (const type of composition.contentTypes) {
|
|
175
|
+
contributions.push({ kind: 'content', id: `content.type.${type.id}`, target: type.primary ? 'primary' : 'additional' }, { kind: 'route', id: `content.list.${type.id}`, target: `${routeBase(type, locale)}/` }, { kind: 'route', id: `content.detail.${type.id}`, target: `${routeBase(type, locale)}/[slug]` }, ...type.bindings.map((binding) => ({ kind: 'binding', id: `content.binding.${type.id}.${binding}`, target: `content.type.${type.id}` })));
|
|
176
|
+
}
|
|
177
|
+
const navigation = composition.contentTypes.filter((type) => type.bindings.includes('navigation'))
|
|
178
|
+
.map((type) => ({ label: type.labels[locale], href: `${routeBase(type, locale)}/` }));
|
|
179
|
+
return {
|
|
180
|
+
shell: {
|
|
181
|
+
...shellRecipe,
|
|
182
|
+
validators: [{
|
|
183
|
+
id: 'shell.content-locale', phase: 'options',
|
|
184
|
+
validate: ({ options }) => options.defaultLocale === locale ? [] : [{ code: 'CONTENT_LOCALE_MISMATCH', message: 'shell.defaultLocale must match the content composition locale' }],
|
|
185
|
+
}],
|
|
186
|
+
generate: ({ options: shellOptions }) => ({ files: buildShellFiles(shellOptions, navigation, options.shellConfiguration) }),
|
|
187
|
+
},
|
|
188
|
+
content: {
|
|
189
|
+
id: 'content.pages', version: '1.7.1', protocolVersion: 1,
|
|
190
|
+
compatibleCliRange: '^0.1.0 || ^0.2.0', compatibleRuntimeRange: '^1.7.1',
|
|
191
|
+
provides: ['content.pages', 'content.typed-definitions'], requires: ['site.shell'], conflicts: [],
|
|
192
|
+
order: { priority: 10, key: 'content' }, optionsSchema: z.strictObject({}),
|
|
193
|
+
outputContributions: contributions, validators: [],
|
|
194
|
+
generate: () => ({ files }),
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=content-site.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-site.js","sourceRoot":"","sources":["../../src/recipes/content-site.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AAE7G,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKjE,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AAC/E,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC;AAOjF,MAAM,CAAC,MAAM,iCAAiC,GAAG,wBAAwB,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,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,2BAA2B,CAAC,EAAE,QAAQ,EAAE,CAAC,YAAY,CAAC,EAAE,SAAS,EAAE,EAAE;YACjG,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC;YAC1E,mBAAmB,EAAE,aAAa,EAAE,UAAU,EAAE,EAAE;YAClD,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;SAC9B;KACJ,CAAC;AACN,CAAC"}
|
package/dist/recipes/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/recipes/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/recipes/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC"}
|
package/dist/recipes/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/recipes/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/recipes/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'astro/zod';
|
|
2
|
+
import type { NavItem } from '../contracts/types.js';
|
|
2
3
|
export declare const SHELL_RECIPE_ID = "site.shell";
|
|
3
4
|
declare const shellOptionsSchema: z.ZodObject<{
|
|
4
5
|
siteName: z.ZodDefault<z.ZodString>;
|
|
@@ -6,7 +7,13 @@ declare const shellOptionsSchema: z.ZodObject<{
|
|
|
6
7
|
noIndex: z.ZodDefault<z.ZodBoolean>;
|
|
7
8
|
}, z.core.$strict>;
|
|
8
9
|
export type ShellRecipeOptions = z.infer<typeof shellOptionsSchema>;
|
|
9
|
-
|
|
10
|
+
/** Source expressions supplied by first-party recipes, never by CLI configuration. */
|
|
11
|
+
export interface ShellConfiguration {
|
|
12
|
+
readonly imports?: readonly string[];
|
|
13
|
+
readonly integrations?: readonly string[];
|
|
14
|
+
readonly markdownProcessor?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function buildShellFiles(rawOptions: unknown, navigation?: readonly NavItem[], configuration?: ShellConfiguration): readonly {
|
|
10
17
|
path: string;
|
|
11
18
|
content: string;
|
|
12
19
|
}[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-recipe.d.ts","sourceRoot":"","sources":["../../src/recipes/shell-recipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"shell-recipe.d.ts","sourceRoot":"","sources":["../../src/recipes/shell-recipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;AAE9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,eAAO,MAAM,eAAe,eAAe,CAAC;AAE5C,QAAA,MAAM,kBAAkB;;;;kBAItB,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAIpE,sFAAsF;AACtF,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CACvC;AA+GD,wBAAgB,eAAe,CAAC,UAAU,EAAE,OAAO,EAAE,UAAU,GAAE,SAAS,OAAO,EAAO,EAAE,aAAa,GAAE,kBAAuB,GAAG,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,CAa9K;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAuBA;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE;;kBAtCuG,MAAM;qBAAW,MAAM;;;CAuC7H,CAAC;AAE/C,eAAe,WAAW,CAAC"}
|
|
@@ -6,48 +6,56 @@ const shellOptionsSchema = z.strictObject({
|
|
|
6
6
|
noIndex: z.boolean().default(false),
|
|
7
7
|
});
|
|
8
8
|
const PLACEHOLDER_SITE_URL = 'https://replace-with-your-domain.example';
|
|
9
|
-
function astroConfig(options) {
|
|
9
|
+
function astroConfig(options, configuration) {
|
|
10
10
|
return `import { defineConfig } from 'astro/config';
|
|
11
11
|
import easyWebSeo from '@easy-web/core/seo';
|
|
12
|
+
${(configuration.imports ?? []).join('\n')}
|
|
12
13
|
|
|
13
14
|
export default defineConfig({
|
|
14
15
|
site: ${JSON.stringify(PLACEHOLDER_SITE_URL)},
|
|
16
|
+
${configuration.markdownProcessor ? `markdown: { processor: ${configuration.markdownProcessor} },` : ''}
|
|
15
17
|
integrations: [
|
|
16
18
|
easyWebSeo({ noIndex: ${options.noIndex ? 'true' : 'false'} }),
|
|
19
|
+
${(configuration.integrations ?? []).map((integration) => `${integration},`).join('\n ')}
|
|
17
20
|
],
|
|
18
21
|
});
|
|
19
22
|
`;
|
|
20
23
|
}
|
|
21
24
|
const packageJsonFragment = `${JSON.stringify({
|
|
22
25
|
type: 'module',
|
|
23
|
-
scripts: { dev: 'astro dev', build: 'astro build', preview: 'astro preview' },
|
|
26
|
+
scripts: { dev: 'astro dev', typecheck: 'astro check', build: 'astro build', preview: 'astro preview' },
|
|
24
27
|
dependencies: { '@easy-web/core': '^1.5.0', astro: '^7.3.5' },
|
|
25
|
-
devDependencies: { typescript: '^5.5.0' },
|
|
28
|
+
devDependencies: { '@astrojs/check': '^0.9.4', typescript: '^5.5.0' },
|
|
26
29
|
}, null, 2)}\n`;
|
|
27
30
|
const pnpmWorkspace = `allowBuilds:
|
|
28
31
|
esbuild: true
|
|
29
32
|
sharp: true
|
|
30
33
|
`;
|
|
31
|
-
function baseLayout(options) {
|
|
34
|
+
function baseLayout(options, navigation) {
|
|
32
35
|
return `---
|
|
33
36
|
import PageShell from '@easy-web/core/components/PageShell.astro';
|
|
34
37
|
import Header from '@easy-web/core/components/Header.astro';
|
|
35
38
|
import Footer from '@easy-web/core/components/Footer.astro';
|
|
39
|
+
import SeoHead from '@easy-web/core/components/SeoHead.astro';
|
|
40
|
+
import '@easy-web/core/styles/tokens.css';
|
|
36
41
|
|
|
37
42
|
interface Props {
|
|
38
43
|
title: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
image?: string;
|
|
39
46
|
}
|
|
40
|
-
const { title } = Astro.props;
|
|
47
|
+
const { title, description, image } = Astro.props;
|
|
41
48
|
const siteName = ${JSON.stringify(options.siteName)};
|
|
42
49
|
const currentLang = ${JSON.stringify(options.defaultLocale)};
|
|
43
|
-
const navItems = [{ label: 'Home', href: '/' }];
|
|
50
|
+
const navItems = ${JSON.stringify([{ label: options.defaultLocale === 'de' ? 'Startseite' : 'Home', href: '/' }, ...navigation])};
|
|
44
51
|
---
|
|
45
52
|
<!doctype html>
|
|
46
53
|
<html lang=${JSON.stringify(options.defaultLocale)}>
|
|
47
54
|
<head>
|
|
48
55
|
<meta charset="utf-8" />
|
|
49
56
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
50
|
-
<title
|
|
57
|
+
<SeoHead title={title} description={description} ogImage={image}
|
|
58
|
+
pathname={Astro.url.pathname} locale={currentLang} siteName={siteName} />
|
|
51
59
|
</head>
|
|
52
60
|
<body>
|
|
53
61
|
<PageShell lang={currentLang}>
|
|
@@ -95,24 +103,21 @@ const localizedPaths = `import type { LocalizedPathGroup } from '@easy-web/core/
|
|
|
95
103
|
|
|
96
104
|
export const localizedPaths: readonly LocalizedPathGroup[] = [];
|
|
97
105
|
`;
|
|
98
|
-
const robotsTxt = `Disallow: /admin/
|
|
99
|
-
Sitemap: ${PLACEHOLDER_SITE_URL}/sitemap-index.xml
|
|
100
|
-
`;
|
|
101
106
|
const gitignore = `node_modules
|
|
102
107
|
dist
|
|
103
108
|
.astro
|
|
104
109
|
`;
|
|
105
|
-
export function buildShellFiles(rawOptions) {
|
|
110
|
+
export function buildShellFiles(rawOptions, navigation = [], configuration = {}) {
|
|
106
111
|
const options = shellOptionsSchema.parse(rawOptions ?? {});
|
|
107
112
|
return [
|
|
108
|
-
{ path: 'astro.config.mjs', content: astroConfig(options) },
|
|
113
|
+
{ path: 'astro.config.mjs', content: astroConfig(options, configuration) },
|
|
109
114
|
{ path: 'package.json', content: packageJsonFragment },
|
|
110
115
|
{ path: 'pnpm-workspace.yaml', content: pnpmWorkspace },
|
|
111
|
-
{ path: 'src/layouts/Base.astro', content: baseLayout(options) },
|
|
116
|
+
{ path: 'src/layouts/Base.astro', content: baseLayout(options, navigation) },
|
|
112
117
|
{ path: 'src/pages/index.astro', content: homePage(options) },
|
|
113
118
|
{ path: 'src/pages/404.astro', content: notFoundPage(options) },
|
|
114
119
|
{ path: 'src/lib/localized-paths.ts', content: localizedPaths },
|
|
115
|
-
{ path: '
|
|
120
|
+
{ path: 'tsconfig.json', content: `${JSON.stringify({ extends: 'astro/tsconfigs/strict', include: ['.astro/types.d.ts', '**/*'], exclude: ['dist'] }, null, 2)}\n` },
|
|
116
121
|
{ path: '.gitignore', content: gitignore },
|
|
117
122
|
];
|
|
118
123
|
}
|
|
@@ -120,7 +125,7 @@ export const shellRecipe = {
|
|
|
120
125
|
id: SHELL_RECIPE_ID,
|
|
121
126
|
version: '1.5.0',
|
|
122
127
|
protocolVersion: 1,
|
|
123
|
-
compatibleCliRange: '^0.1.0',
|
|
128
|
+
compatibleCliRange: '^0.1.0 || ^0.2.0',
|
|
124
129
|
compatibleRuntimeRange: '^1.5.0',
|
|
125
130
|
provides: [SHELL_RECIPE_ID],
|
|
126
131
|
requires: [],
|
|
@@ -135,7 +140,7 @@ export const shellRecipe = {
|
|
|
135
140
|
{ kind: 'route', id: 'shell.home', target: '/' },
|
|
136
141
|
{ kind: 'route', id: 'shell.404', target: '/404' },
|
|
137
142
|
{ kind: 'file', id: 'shell.localized-paths', target: 'src/lib/localized-paths.ts' },
|
|
138
|
-
{ kind: '
|
|
143
|
+
{ kind: 'configuration', id: 'shell.tsconfig', target: 'tsconfig.json' },
|
|
139
144
|
{ kind: 'file', id: 'shell.gitignore', target: '.gitignore' },
|
|
140
145
|
],
|
|
141
146
|
validators: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-recipe.js","sourceRoot":"","sources":["../../src/recipes/sh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
|
|
10
10
|
export type Props = CardProps;
|
|
11
11
|
|
|
12
12
|
const props = Astro.props;
|
|
13
|
-
const { item, imageSizes, class: className } = props;
|
|
13
|
+
const { item, imageSizes, headingLevel: Heading = 'h3', class: className } = props;
|
|
14
14
|
const { title, description, href } = item ?? props;
|
|
15
15
|
// Only the legacy props fall back to the title for alt text; an item's image
|
|
16
16
|
// carries its own alt.
|
|
@@ -25,7 +25,7 @@ const Tag = href ? 'a' : 'div';
|
|
|
25
25
|
props.image && <img src={props.image} alt={legacyAlt} class="ew-card__image" loading="lazy" />
|
|
26
26
|
)}
|
|
27
27
|
<div class="ew-card__body">
|
|
28
|
-
<
|
|
28
|
+
<Heading class="ew-card__title">{title}</Heading>
|
|
29
29
|
{description && <p class="ew-card__description">{description}</p>}
|
|
30
30
|
</div>
|
|
31
31
|
</Tag>
|
|
@@ -245,7 +245,7 @@ const ratioClass = `ew-lightbox-grid__img--ratio-${aspectRatio.replace('/', '-')
|
|
|
245
245
|
flex-direction: column;
|
|
246
246
|
align-items: center;
|
|
247
247
|
justify-content: center;
|
|
248
|
-
z-index:
|
|
248
|
+
z-index: var(--ew-z-modal, 1300);
|
|
249
249
|
padding: var(--ew-space-5);
|
|
250
250
|
}
|
|
251
251
|
.ew-lightbox[data-open='false'] {
|
|
@@ -68,7 +68,7 @@ const logoImage = !logo ? undefined : typeof logo === 'string' ? { src: logo, al
|
|
|
68
68
|
.ew-header {
|
|
69
69
|
position: sticky;
|
|
70
70
|
top: 0;
|
|
71
|
-
z-index:
|
|
71
|
+
z-index: var(--ew-z-sticky, 1100);
|
|
72
72
|
background: var(--ew-surface);
|
|
73
73
|
border-bottom: 1px solid var(--ew-border);
|
|
74
74
|
}
|