@easy-web/core 1.5.0 → 1.7.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 +100 -2
- package/dist/contracts/capabilities.d.ts +38 -0
- package/dist/contracts/capabilities.d.ts.map +1 -1
- package/dist/contracts/content-composition.d.ts +144 -0
- package/dist/contracts/content-composition.d.ts.map +1 -0
- package/dist/contracts/content-composition.js +143 -0
- package/dist/contracts/content-composition.js.map +1 -0
- package/dist/contracts/index.d.ts +2 -0
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +2 -0
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/traits.d.ts +98 -0
- package/dist/contracts/traits.d.ts.map +1 -0
- package/dist/contracts/traits.js +84 -0
- package/dist/contracts/traits.js.map +1 -0
- package/dist/demo/demo-content.d.ts +37 -0
- package/dist/demo/demo-content.d.ts.map +1 -0
- package/dist/demo/demo-content.js +171 -0
- package/dist/demo/demo-content.js.map +1 -0
- package/dist/demo/index.d.ts +3 -0
- package/dist/demo/index.d.ts.map +1 -0
- package/dist/demo/index.js +3 -0
- package/dist/demo/index.js.map +1 -0
- package/dist/demo/legal-shells.d.ts +18 -0
- package/dist/demo/legal-shells.d.ts.map +1 -0
- package/dist/demo/legal-shells.js +40 -0
- package/dist/demo/legal-shells.js.map +1 -0
- package/dist/i18n/cli-catalogs.d.ts +42 -0
- package/dist/i18n/cli-catalogs.d.ts.map +1 -0
- package/dist/i18n/cli-catalogs.js +29 -0
- package/dist/i18n/cli-catalogs.js.map +1 -0
- package/dist/i18n/create-localization.d.ts +37 -0
- package/dist/i18n/create-localization.d.ts.map +1 -0
- package/dist/i18n/create-localization.js +68 -0
- package/dist/i18n/create-localization.js.map +1 -0
- package/dist/i18n/explicit-formatters.d.ts +20 -0
- package/dist/i18n/explicit-formatters.d.ts.map +1 -0
- package/dist/i18n/explicit-formatters.js +18 -0
- package/dist/i18n/explicit-formatters.js.map +1 -0
- package/dist/i18n/index.d.ts +4 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +4 -0
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/locale-inputs.d.ts +18 -0
- package/dist/i18n/locale-inputs.d.ts.map +1 -0
- package/dist/i18n/locale-inputs.js +73 -0
- package/dist/i18n/locale-inputs.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/recipes/admission.d.ts +161 -0
- package/dist/recipes/admission.d.ts.map +1 -0
- package/dist/recipes/admission.js +85 -0
- package/dist/recipes/admission.js.map +1 -0
- package/dist/recipes/graph.d.ts +101 -0
- package/dist/recipes/graph.d.ts.map +1 -0
- package/dist/recipes/graph.js +166 -0
- package/dist/recipes/graph.js.map +1 -0
- package/dist/recipes/index.d.ts +9 -0
- package/dist/recipes/index.d.ts.map +1 -0
- package/dist/recipes/index.js +9 -0
- package/dist/recipes/index.js.map +1 -0
- package/dist/recipes/mermaid.d.ts +3 -0
- package/dist/recipes/mermaid.d.ts.map +1 -0
- package/dist/recipes/mermaid.js +79 -0
- package/dist/recipes/mermaid.js.map +1 -0
- package/dist/recipes/registry.d.ts +82 -0
- package/dist/recipes/registry.d.ts.map +1 -0
- package/dist/recipes/registry.js +40 -0
- package/dist/recipes/registry.js.map +1 -0
- package/dist/recipes/schema.d.ts +129 -0
- package/dist/recipes/schema.d.ts.map +1 -0
- package/dist/recipes/schema.js +41 -0
- package/dist/recipes/schema.js.map +1 -0
- package/dist/recipes/serialize.d.ts +20 -0
- package/dist/recipes/serialize.d.ts.map +1 -0
- package/dist/recipes/serialize.js +56 -0
- package/dist/recipes/serialize.js.map +1 -0
- package/dist/recipes/shell-recipe.d.ts +59 -0
- package/dist/recipes/shell-recipe.d.ts.map +1 -0
- package/dist/recipes/shell-recipe.js +145 -0
- package/dist/recipes/shell-recipe.js.map +1 -0
- package/dist/recipes/types.d.ts +72 -0
- package/dist/recipes/types.d.ts.map +1 -0
- package/dist/recipes/types.js +13 -0
- package/dist/recipes/types.js.map +1 -0
- package/dist/schemas/galleries.d.ts +2 -2
- package/dist/seo/build-info-manifest.d.ts +45 -0
- package/dist/seo/build-info-manifest.d.ts.map +1 -0
- package/dist/seo/build-info-manifest.js +39 -0
- package/dist/seo/build-info-manifest.js.map +1 -0
- package/dist/seo/build-info.d.ts +3 -0
- package/dist/seo/build-info.d.ts.map +1 -0
- package/dist/seo/build-info.js +45 -0
- package/dist/seo/build-info.js.map +1 -0
- package/dist/seo/index.d.ts +4 -0
- package/dist/seo/index.d.ts.map +1 -1
- package/dist/seo/index.js +25 -2
- package/dist/seo/index.js.map +1 -1
- package/dist/seo/routes/robots-txt.d.ts.map +1 -1
- package/dist/seo/routes/robots-txt.js +3 -1
- package/dist/seo/routes/robots-txt.js.map +1 -1
- package/dist/seo/routes/version-json.d.ts +4 -0
- package/dist/seo/routes/version-json.d.ts.map +1 -0
- package/dist/seo/routes/version-json.js +11 -0
- package/dist/seo/routes/version-json.js.map +1 -0
- package/package.json +17 -1
- package/src/components/DemoLegalShell.astro +36 -0
- package/src/contracts/__tests__/content-composition.test.ts +170 -0
- package/src/contracts/capabilities.ts +49 -0
- package/src/contracts/content-composition.ts +176 -0
- package/src/contracts/index.ts +2 -0
- package/src/contracts/traits.ts +107 -0
- package/src/demo/__tests__/demo-content.test.ts +107 -0
- package/src/demo/demo-content.ts +210 -0
- package/src/demo/index.ts +2 -0
- package/src/demo/legal-shells.ts +52 -0
- package/src/i18n/__tests__/create-localization.test.ts +138 -0
- package/src/i18n/__tests__/explicit-formatters.test.ts +82 -0
- package/src/i18n/cli-catalogs.ts +44 -0
- package/src/i18n/create-localization.ts +67 -0
- package/src/i18n/explicit-formatters.ts +36 -0
- package/src/i18n/index.ts +4 -0
- package/src/i18n/locale-inputs.ts +73 -0
- package/src/index.ts +1 -0
- package/src/recipes/__tests__/graph.test.ts +139 -0
- package/src/recipes/__tests__/protocol.test.ts +180 -0
- package/src/recipes/__tests__/serialize.test.ts +128 -0
- package/src/recipes/__tests__/shell-recipe.test.ts +75 -0
- package/src/recipes/admission.ts +77 -0
- package/src/recipes/graph.ts +244 -0
- package/src/recipes/index.ts +8 -0
- package/src/recipes/mermaid.ts +75 -0
- package/src/recipes/registry.ts +48 -0
- package/src/recipes/schema.ts +53 -0
- package/src/recipes/serialize.ts +77 -0
- package/src/recipes/shell-recipe.ts +162 -0
- package/src/recipes/types.ts +63 -0
- package/src/seo/__tests__/build-info-html.test.ts +19 -0
- package/src/seo/__tests__/build-info-integration.test.ts +107 -0
- package/src/seo/__tests__/build-info.test.ts +86 -0
- package/src/seo/__tests__/robots-txt.test.ts +8 -0
- package/src/seo/build-info-manifest.ts +49 -0
- package/src/seo/build-info.ts +44 -0
- package/src/seo/index.ts +28 -3
- package/src/seo/routes/robots-txt.ts +3 -1
- package/src/seo/routes/version-json.ts +13 -0
- package/src/seo/routes/version.astro +42 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
const compareText = (left, right) => left.localeCompare(right, 'en');
|
|
2
|
+
const compareRecipe = (left, right) => left.order.priority - right.order.priority || compareText(left.order.key, right.order.key) || compareText(left.id, right.id);
|
|
3
|
+
const compareContribution = (left, right) => compareText(left.kind, right.kind) || compareText(left.id, right.id) || compareText(left.target, right.target) ||
|
|
4
|
+
compareText(left.provenance.contributedBy, right.provenance.contributedBy);
|
|
5
|
+
const failure = (error) => ({ ok: false, error });
|
|
6
|
+
/**
|
|
7
|
+
* Resolves admitted in-memory recipe metadata without executing hooks or observing a target.
|
|
8
|
+
* Route contributions are fixed pages. Content targets are `primary` or `additional`.
|
|
9
|
+
* Binding ids prefixed with `adaptation.` activate only when their target contribution exists.
|
|
10
|
+
*/
|
|
11
|
+
export function resolveCapabilityGraph(recipes) {
|
|
12
|
+
const canonical = [...recipes].sort(compareRecipe);
|
|
13
|
+
const recipeById = new Map();
|
|
14
|
+
const providerByCapability = new Map();
|
|
15
|
+
for (const recipe of canonical) {
|
|
16
|
+
if (recipeById.has(recipe.id))
|
|
17
|
+
return failure({ code: 'duplicate-recipe-id', recipeId: recipe.id });
|
|
18
|
+
recipeById.set(recipe.id, recipe);
|
|
19
|
+
for (const capability of [...recipe.provides].sort(compareText)) {
|
|
20
|
+
const provider = providerByCapability.get(capability);
|
|
21
|
+
if (provider) {
|
|
22
|
+
return failure({
|
|
23
|
+
code: 'duplicate-provider', capability,
|
|
24
|
+
recipeIds: [provider.id, recipe.id].sort(compareText),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
providerByCapability.set(capability, recipe);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const requirements = [];
|
|
31
|
+
const dependencyIds = new Map();
|
|
32
|
+
const requiredBy = new Map();
|
|
33
|
+
for (const recipe of canonical) {
|
|
34
|
+
const dependencies = new Set();
|
|
35
|
+
for (const capability of [...recipe.requires].sort(compareText)) {
|
|
36
|
+
const provider = providerByCapability.get(capability);
|
|
37
|
+
if (!provider)
|
|
38
|
+
return failure({ code: 'missing-requirement', recipeId: recipe.id, capability });
|
|
39
|
+
dependencies.add(provider.id);
|
|
40
|
+
const consumers = requiredBy.get(provider.id) ?? new Set();
|
|
41
|
+
consumers.add(recipe.id);
|
|
42
|
+
requiredBy.set(provider.id, consumers);
|
|
43
|
+
requirements.push({ capability, consumerRecipeId: recipe.id, providerRecipeId: provider.id });
|
|
44
|
+
}
|
|
45
|
+
dependencyIds.set(recipe.id, dependencies);
|
|
46
|
+
}
|
|
47
|
+
const visiting = new Set();
|
|
48
|
+
const visited = new Set();
|
|
49
|
+
const stack = [];
|
|
50
|
+
const findCycle = (recipeId) => {
|
|
51
|
+
if (visiting.has(recipeId)) {
|
|
52
|
+
const start = stack.indexOf(recipeId);
|
|
53
|
+
return [...stack.slice(start), recipeId];
|
|
54
|
+
}
|
|
55
|
+
if (visited.has(recipeId))
|
|
56
|
+
return undefined;
|
|
57
|
+
visiting.add(recipeId);
|
|
58
|
+
stack.push(recipeId);
|
|
59
|
+
const dependencies = [...(dependencyIds.get(recipeId) ?? [])].sort(compareText);
|
|
60
|
+
for (const dependencyId of dependencies) {
|
|
61
|
+
const cycle = findCycle(dependencyId);
|
|
62
|
+
if (cycle)
|
|
63
|
+
return cycle;
|
|
64
|
+
}
|
|
65
|
+
stack.pop();
|
|
66
|
+
visiting.delete(recipeId);
|
|
67
|
+
visited.add(recipeId);
|
|
68
|
+
return undefined;
|
|
69
|
+
};
|
|
70
|
+
for (const recipe of canonical) {
|
|
71
|
+
const cycle = findCycle(recipe.id);
|
|
72
|
+
if (cycle)
|
|
73
|
+
return failure({ code: 'dependency-cycle', recipeIds: cycle });
|
|
74
|
+
}
|
|
75
|
+
for (const recipe of canonical) {
|
|
76
|
+
for (const capability of [...recipe.conflicts].sort(compareText)) {
|
|
77
|
+
const provider = providerByCapability.get(capability);
|
|
78
|
+
if (provider) {
|
|
79
|
+
return failure({
|
|
80
|
+
code: 'conflicting-capability', recipeId: recipe.id,
|
|
81
|
+
conflictingRecipeId: provider.id, capability,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const contributionOwners = new Map();
|
|
87
|
+
const outputOwners = new Map();
|
|
88
|
+
for (const recipe of canonical) {
|
|
89
|
+
for (const contribution of [...recipe.outputContributions].sort((left, right) => compareText(left.id, right.id))) {
|
|
90
|
+
const idOwner = contributionOwners.get(contribution.id);
|
|
91
|
+
if (idOwner) {
|
|
92
|
+
return failure({
|
|
93
|
+
code: 'duplicate-contribution-id', contributionId: contribution.id,
|
|
94
|
+
recipeIds: [idOwner.id, recipe.id].sort(compareText),
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
contributionOwners.set(contribution.id, recipe);
|
|
98
|
+
if (contribution.kind === 'file' || contribution.kind === 'route') {
|
|
99
|
+
const key = `${contribution.kind}:${contribution.target}`;
|
|
100
|
+
const outputOwner = outputOwners.get(key);
|
|
101
|
+
if (outputOwner) {
|
|
102
|
+
return failure({
|
|
103
|
+
code: 'output-conflict', kind: contribution.kind, target: contribution.target,
|
|
104
|
+
recipeIds: [outputOwner.id, recipe.id].sort(compareText),
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
outputOwners.set(key, recipe);
|
|
108
|
+
}
|
|
109
|
+
if (contribution.kind === 'content' && contribution.target !== 'primary' && contribution.target !== 'additional') {
|
|
110
|
+
return failure({ code: 'invalid-content-role', contributionId: contribution.id, target: contribution.target });
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const ordered = [];
|
|
115
|
+
const remainingDependencies = new Map([...dependencyIds].map(([id, values]) => [id, new Set(values)]));
|
|
116
|
+
while (ordered.length < canonical.length) {
|
|
117
|
+
const ready = canonical.filter((recipe) => !ordered.some((item) => item.id === recipe.id) && remainingDependencies.get(recipe.id)?.size === 0);
|
|
118
|
+
const next = ready.sort(compareRecipe)[0];
|
|
119
|
+
if (!next)
|
|
120
|
+
break;
|
|
121
|
+
ordered.push(next);
|
|
122
|
+
for (const dependencies of remainingDependencies.values())
|
|
123
|
+
dependencies.delete(next.id);
|
|
124
|
+
}
|
|
125
|
+
const provenanceFor = (recipe) => {
|
|
126
|
+
const consumers = [...(requiredBy.get(recipe.id) ?? [])].sort(compareText);
|
|
127
|
+
return {
|
|
128
|
+
contributedBy: recipe.id,
|
|
129
|
+
recipeVersion: recipe.version,
|
|
130
|
+
inclusion: consumers.length === 0 ? { kind: 'direct' } : { kind: 'transitive', requiredBy: consumers },
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
const contributions = ordered.flatMap((recipe) => recipe.outputContributions
|
|
134
|
+
.filter((item) => !item.id.startsWith('adaptation.') || contributionOwners.has(item.target))
|
|
135
|
+
.map((item) => ({ ...item, provenance: provenanceFor(recipe) })))
|
|
136
|
+
.sort(compareContribution);
|
|
137
|
+
const primary = contributions.filter((item) => item.kind === 'content' && item.target === 'primary');
|
|
138
|
+
if (primary.length > 1) {
|
|
139
|
+
return failure({
|
|
140
|
+
code: 'multiple-primary-content',
|
|
141
|
+
contributionIds: primary.map((item) => item.id).sort(compareText),
|
|
142
|
+
recipeIds: primary.map((item) => item.provenance.contributedBy).sort(compareText),
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
return { ok: true, value: {
|
|
146
|
+
recipes: ordered.map((recipe) => ({
|
|
147
|
+
id: recipe.id, version: recipe.version,
|
|
148
|
+
provides: [...recipe.provides].sort(compareText),
|
|
149
|
+
requires: [...recipe.requires].sort(compareText),
|
|
150
|
+
conflicts: [...recipe.conflicts].sort(compareText),
|
|
151
|
+
provenance: provenanceFor(recipe),
|
|
152
|
+
})),
|
|
153
|
+
capabilities: [...providerByCapability].sort(([left], [right]) => compareText(left, right))
|
|
154
|
+
.map(([id, provider]) => ({ id, providerRecipeId: provider.id, provenance: provenanceFor(provider) })),
|
|
155
|
+
requirements: requirements.sort((left, right) => compareText(left.consumerRecipeId, right.consumerRecipeId) || compareText(left.capability, right.capability)),
|
|
156
|
+
contributions,
|
|
157
|
+
fixedPages: contributions.filter((item) => item.kind === 'route'),
|
|
158
|
+
contentTypes: {
|
|
159
|
+
...(primary[0] ? { primary: primary[0] } : {}),
|
|
160
|
+
additional: contributions.filter((item) => item.kind === 'content' && item.target === 'additional'),
|
|
161
|
+
},
|
|
162
|
+
adaptations: contributions.filter((item) => item.kind === 'binding' && item.id.startsWith('adaptation.'))
|
|
163
|
+
.map((item) => ({ ...item, targetContributionId: item.target })),
|
|
164
|
+
} };
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=graph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.js","sourceRoot":"","sources":["../../src/recipes/graph.ts"],"names":[],"mappings":"AAuEA,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,KAAa,EAAU,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAC7F,MAAM,aAAa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I,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC;YACjE,YAAY,EAAE;gBACV,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC9C,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,KAAK,YAAY,CAAC;aACtG;YACD,WAAW,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,EAAkC,EAAE,CACvE,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;iBAC5D,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,oBAAoB,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;SACvE,EAAE,CAAC;AACR,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './schema.js';
|
|
2
|
+
export * from './types.js';
|
|
3
|
+
export * from './registry.js';
|
|
4
|
+
export * from './admission.js';
|
|
5
|
+
export * from './graph.js';
|
|
6
|
+
export * from './serialize.js';
|
|
7
|
+
export * from './mermaid.js';
|
|
8
|
+
export * from './shell-recipe.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './schema.js';
|
|
2
|
+
export * from './types.js';
|
|
3
|
+
export * from './registry.js';
|
|
4
|
+
export * from './admission.js';
|
|
5
|
+
export * from './graph.js';
|
|
6
|
+
export * from './serialize.js';
|
|
7
|
+
export * from './mermaid.js';
|
|
8
|
+
export * from './shell-recipe.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mermaid.d.ts","sourceRoot":"","sources":["../../src/recipes/mermaid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAmB9D,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,uBAAuB,GAAG,MAAM,CAuDzF"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
function sanitizeId(prefix, raw, used) {
|
|
2
|
+
const base = `${prefix}_${raw.replace(/[^A-Za-z0-9_]/g, '_')}`;
|
|
3
|
+
let candidate = base;
|
|
4
|
+
let n = 1;
|
|
5
|
+
while (used.has(candidate))
|
|
6
|
+
candidate = `${base}_${n++}`;
|
|
7
|
+
used.add(candidate);
|
|
8
|
+
return candidate;
|
|
9
|
+
}
|
|
10
|
+
function escapeLabel(text) {
|
|
11
|
+
return text
|
|
12
|
+
.replace(/&/g, '#38;')
|
|
13
|
+
.replace(/"/g, '#34;')
|
|
14
|
+
.replace(/</g, '#60;')
|
|
15
|
+
.replace(/>/g, '#62;');
|
|
16
|
+
}
|
|
17
|
+
export function serializeCapabilityGraphMermaid(document) {
|
|
18
|
+
const used = new Set();
|
|
19
|
+
const lines = ['flowchart TD'];
|
|
20
|
+
const recipeIds = new Map();
|
|
21
|
+
const capabilityIds = new Map();
|
|
22
|
+
for (const recipe of document.recipes) {
|
|
23
|
+
const id = sanitizeId('r', recipe.id, used);
|
|
24
|
+
recipeIds.set(recipe.id, id);
|
|
25
|
+
lines.push(` ${id}["${escapeLabel(recipe.id)}@${escapeLabel(recipe.version)}"]`);
|
|
26
|
+
}
|
|
27
|
+
for (const capability of document.capabilities) {
|
|
28
|
+
const id = sanitizeId('c', capability.id, used);
|
|
29
|
+
capabilityIds.set(capability.id, id);
|
|
30
|
+
lines.push(` ${id}(["${escapeLabel(capability.id)}"])`);
|
|
31
|
+
const providerId = recipeIds.get(capability.providerRecipeId);
|
|
32
|
+
if (providerId)
|
|
33
|
+
lines.push(` ${providerId} -->|provides| ${id}`);
|
|
34
|
+
}
|
|
35
|
+
for (const requirement of document.requirements) {
|
|
36
|
+
const consumerId = recipeIds.get(requirement.consumerRecipeId);
|
|
37
|
+
const capabilityId = capabilityIds.get(requirement.capability);
|
|
38
|
+
if (consumerId && capabilityId)
|
|
39
|
+
lines.push(` ${consumerId} -.->|requires| ${capabilityId}`);
|
|
40
|
+
}
|
|
41
|
+
for (const page of document.fixedPages) {
|
|
42
|
+
const id = sanitizeId('p', page.id, used);
|
|
43
|
+
lines.push(` ${id}["page: ${escapeLabel(page.target)}"]`);
|
|
44
|
+
const ownerId = recipeIds.get(page.provenance.contributedBy);
|
|
45
|
+
if (ownerId)
|
|
46
|
+
lines.push(` ${ownerId} -->|fixed page| ${id}`);
|
|
47
|
+
}
|
|
48
|
+
if (document.contentTypes.primary) {
|
|
49
|
+
const content = document.contentTypes.primary;
|
|
50
|
+
const id = sanitizeId('t', content.id, used);
|
|
51
|
+
lines.push(` ${id}["primary content: ${escapeLabel(content.target)}"]`);
|
|
52
|
+
const ownerId = recipeIds.get(content.provenance.contributedBy);
|
|
53
|
+
if (ownerId)
|
|
54
|
+
lines.push(` ${ownerId} -->|content| ${id}`);
|
|
55
|
+
}
|
|
56
|
+
for (const content of document.contentTypes.additional) {
|
|
57
|
+
const id = sanitizeId('t', content.id, used);
|
|
58
|
+
lines.push(` ${id}["content: ${escapeLabel(content.target)}"]`);
|
|
59
|
+
const ownerId = recipeIds.get(content.provenance.contributedBy);
|
|
60
|
+
if (ownerId)
|
|
61
|
+
lines.push(` ${ownerId} -->|content| ${id}`);
|
|
62
|
+
}
|
|
63
|
+
for (const binding of document.bindings) {
|
|
64
|
+
const id = sanitizeId('b', binding.id, used);
|
|
65
|
+
lines.push(` ${id}["binding: ${escapeLabel(binding.target)}"]`);
|
|
66
|
+
const ownerId = recipeIds.get(binding.provenance.contributedBy);
|
|
67
|
+
if (ownerId)
|
|
68
|
+
lines.push(` ${ownerId} -->|binds| ${id}`);
|
|
69
|
+
}
|
|
70
|
+
for (const adaptation of document.adaptations) {
|
|
71
|
+
const id = sanitizeId('a', adaptation.id, used);
|
|
72
|
+
lines.push(` ${id}["adaptation -> ${escapeLabel(adaptation.targetContributionId)}"]`);
|
|
73
|
+
const ownerId = recipeIds.get(adaptation.provenance.contributedBy);
|
|
74
|
+
if (ownerId)
|
|
75
|
+
lines.push(` ${ownerId} -.->|adapts| ${id}`);
|
|
76
|
+
}
|
|
77
|
+
return `${lines.join('\n')}\n`;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=mermaid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mermaid.js","sourceRoot":"","sources":["../../src/recipes/mermaid.ts"],"names":[],"mappings":"AAEA,SAAS,UAAU,CAAC,MAAc,EAAE,GAAW,EAAE,IAAiB;IAC9D,MAAM,IAAI,GAAG,GAAG,MAAM,IAAI,GAAG,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAA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AS,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;QAChE,IAAI,OAAO;YAAE,KAAK,CAAC,IAAI,CAAC,KAAK,OAAO,eAAe,EAAE,EAAE,CAAC,CAAC;IAC7D,CAAC;IACD,KAAK,MAAM,UAAU,IAAI,QAAQ,CAAC,WAAW,EAAE,CAAC;QAC5C,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QAChD,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,mBAAmB,WAAW,CAAC,UAAU,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;QACvF,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;QACnE,IAAI,OAAO;YAAE,KAAK,CAAC,IAAI,CAAC,KAAK,OAAO,iBAAiB,EAAE,EAAE,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { z } from 'astro/zod';
|
|
2
|
+
/** Closed first-party owners, not an open @easy-web/* namespace trust rule. */
|
|
3
|
+
export declare const recipePackageNameSchema: z.ZodEnum<{
|
|
4
|
+
"@easy-web/core": "@easy-web/core";
|
|
5
|
+
"@easy-web/cms-adapters": "@easy-web/cms-adapters";
|
|
6
|
+
"@easy-web/swa": "@easy-web/swa";
|
|
7
|
+
"@easy-web/auth": "@easy-web/auth";
|
|
8
|
+
"@easy-web/brand": "@easy-web/brand";
|
|
9
|
+
}>;
|
|
10
|
+
export declare const recipeIntegritySchema: z.ZodString;
|
|
11
|
+
export declare const recipeExportPathSchema: z.ZodString;
|
|
12
|
+
/**
|
|
13
|
+
* CLI-owned pins are the authority. NEVER load recipes from a generation target's
|
|
14
|
+
* node_modules. Only CLI-pinned or bundled verified artifacts may be imported.
|
|
15
|
+
* This manifest describes a loader contract; it performs no import or I/O.
|
|
16
|
+
*/
|
|
17
|
+
export declare const recipeRegistryPinSchema: z.ZodReadonly<z.ZodObject<{
|
|
18
|
+
packageName: z.ZodEnum<{
|
|
19
|
+
"@easy-web/core": "@easy-web/core";
|
|
20
|
+
"@easy-web/cms-adapters": "@easy-web/cms-adapters";
|
|
21
|
+
"@easy-web/swa": "@easy-web/swa";
|
|
22
|
+
"@easy-web/auth": "@easy-web/auth";
|
|
23
|
+
"@easy-web/brand": "@easy-web/brand";
|
|
24
|
+
}>;
|
|
25
|
+
version: z.ZodString;
|
|
26
|
+
integrity: z.ZodString;
|
|
27
|
+
exportPath: z.ZodString;
|
|
28
|
+
}, z.core.$strict>>;
|
|
29
|
+
export declare const recipeRegistryManifestSchema: z.ZodReadonly<z.ZodObject<{
|
|
30
|
+
protocolVersion: z.ZodLiteral<1>;
|
|
31
|
+
recipes: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
32
|
+
packageName: z.ZodEnum<{
|
|
33
|
+
"@easy-web/core": "@easy-web/core";
|
|
34
|
+
"@easy-web/cms-adapters": "@easy-web/cms-adapters";
|
|
35
|
+
"@easy-web/swa": "@easy-web/swa";
|
|
36
|
+
"@easy-web/auth": "@easy-web/auth";
|
|
37
|
+
"@easy-web/brand": "@easy-web/brand";
|
|
38
|
+
}>;
|
|
39
|
+
version: z.ZodString;
|
|
40
|
+
integrity: z.ZodString;
|
|
41
|
+
exportPath: z.ZodString;
|
|
42
|
+
}, z.core.$strict>>>>;
|
|
43
|
+
}, z.core.$strict>>;
|
|
44
|
+
/** Receipt supplied by the future loader AFTER hashing artifact bytes, BEFORE import. */
|
|
45
|
+
export declare const recipeArtifactReceiptSchema: z.ZodReadonly<z.ZodObject<{
|
|
46
|
+
source: z.ZodEnum<{
|
|
47
|
+
"cli-pinned": "cli-pinned";
|
|
48
|
+
bundled: "bundled";
|
|
49
|
+
}>;
|
|
50
|
+
pin: z.ZodReadonly<z.ZodObject<{
|
|
51
|
+
packageName: z.ZodEnum<{
|
|
52
|
+
"@easy-web/core": "@easy-web/core";
|
|
53
|
+
"@easy-web/cms-adapters": "@easy-web/cms-adapters";
|
|
54
|
+
"@easy-web/swa": "@easy-web/swa";
|
|
55
|
+
"@easy-web/auth": "@easy-web/auth";
|
|
56
|
+
"@easy-web/brand": "@easy-web/brand";
|
|
57
|
+
}>;
|
|
58
|
+
version: z.ZodString;
|
|
59
|
+
integrity: z.ZodString;
|
|
60
|
+
exportPath: z.ZodString;
|
|
61
|
+
}, z.core.$strict>>;
|
|
62
|
+
verifiedIntegrity: z.ZodString;
|
|
63
|
+
}, z.core.$strict>>;
|
|
64
|
+
export type RecipeRegistryPin = z.infer<typeof recipeRegistryPinSchema>;
|
|
65
|
+
export type RecipeRegistryManifest = z.infer<typeof recipeRegistryManifestSchema>;
|
|
66
|
+
export type RecipeArtifactReceipt = z.infer<typeof recipeArtifactReceiptSchema>;
|
|
67
|
+
export declare const recipeRegistryJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodReadonly<z.ZodObject<{
|
|
68
|
+
protocolVersion: z.ZodLiteral<1>;
|
|
69
|
+
recipes: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
70
|
+
packageName: z.ZodEnum<{
|
|
71
|
+
"@easy-web/core": "@easy-web/core";
|
|
72
|
+
"@easy-web/cms-adapters": "@easy-web/cms-adapters";
|
|
73
|
+
"@easy-web/swa": "@easy-web/swa";
|
|
74
|
+
"@easy-web/auth": "@easy-web/auth";
|
|
75
|
+
"@easy-web/brand": "@easy-web/brand";
|
|
76
|
+
}>;
|
|
77
|
+
version: z.ZodString;
|
|
78
|
+
integrity: z.ZodString;
|
|
79
|
+
exportPath: z.ZodString;
|
|
80
|
+
}, z.core.$strict>>>>;
|
|
81
|
+
}, z.core.$strict>>>;
|
|
82
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/recipes/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;AAG9B,+EAA+E;AAC/E,eAAO,MAAM,uBAAuB;;;;;;EAElC,CAAC;AAEH,eAAO,MAAM,qBAAqB,aAAmD,CAAC;AACtF,eAAO,MAAM,sBAAsB,aAAqF,CAAC;AAEzH;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;mBAKvB,CAAC;AAEd,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;mBAY5B,CAAC;AAEd,yFAAyF;AACzF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;mBAI3B,CAAC;AAEd,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAClF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAChF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;oBAA+C,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'astro/zod';
|
|
2
|
+
import { RECIPE_PROTOCOL_VERSION, recipeVersionSchema } from './schema.js';
|
|
3
|
+
/** Closed first-party owners, not an open @easy-web/* namespace trust rule. */
|
|
4
|
+
export const recipePackageNameSchema = z.enum([
|
|
5
|
+
'@easy-web/core', '@easy-web/cms-adapters', '@easy-web/swa', '@easy-web/auth', '@easy-web/brand',
|
|
6
|
+
]);
|
|
7
|
+
export const recipeIntegritySchema = z.string().regex(/^sha512-[A-Za-z0-9+/]{86}==$/);
|
|
8
|
+
export const recipeExportPathSchema = z.string().regex(/^\.\/[a-zA-Z0-9_-]+(?:\/[a-zA-Z0-9_-]+)*(?:\.[a-zA-Z0-9_-]+)?$/);
|
|
9
|
+
/**
|
|
10
|
+
* CLI-owned pins are the authority. NEVER load recipes from a generation target's
|
|
11
|
+
* node_modules. Only CLI-pinned or bundled verified artifacts may be imported.
|
|
12
|
+
* This manifest describes a loader contract; it performs no import or I/O.
|
|
13
|
+
*/
|
|
14
|
+
export const recipeRegistryPinSchema = z.strictObject({
|
|
15
|
+
packageName: recipePackageNameSchema,
|
|
16
|
+
version: recipeVersionSchema,
|
|
17
|
+
integrity: recipeIntegritySchema,
|
|
18
|
+
exportPath: recipeExportPathSchema,
|
|
19
|
+
}).readonly();
|
|
20
|
+
export const recipeRegistryManifestSchema = z.strictObject({
|
|
21
|
+
protocolVersion: z.literal(RECIPE_PROTOCOL_VERSION),
|
|
22
|
+
recipes: z.array(recipeRegistryPinSchema).readonly(),
|
|
23
|
+
}).superRefine((manifest, context) => {
|
|
24
|
+
const sources = new Set();
|
|
25
|
+
for (const pin of manifest.recipes) {
|
|
26
|
+
const key = `${pin.packageName}:${pin.exportPath}`;
|
|
27
|
+
if (sources.has(key)) {
|
|
28
|
+
context.addIssue({ code: 'custom', message: 'duplicate-registry-source', path: ['recipes'] });
|
|
29
|
+
}
|
|
30
|
+
sources.add(key);
|
|
31
|
+
}
|
|
32
|
+
}).readonly();
|
|
33
|
+
/** Receipt supplied by the future loader AFTER hashing artifact bytes, BEFORE import. */
|
|
34
|
+
export const recipeArtifactReceiptSchema = z.strictObject({
|
|
35
|
+
source: z.enum(['cli-pinned', 'bundled']),
|
|
36
|
+
pin: recipeRegistryPinSchema,
|
|
37
|
+
verifiedIntegrity: recipeIntegritySchema,
|
|
38
|
+
}).readonly();
|
|
39
|
+
export const recipeRegistryJsonSchema = z.toJSONSchema(recipeRegistryManifestSchema);
|
|
40
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/recipes/registry.ts"],"names":[],"mappings":"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AO,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,2BAA2B,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAClG,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;AACL,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AAEd,yFAAyF;AACzF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,YAAY,CAAC;IACtD,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACzC,GAAG,EAAE,uBAAuB;IAC5B,iBAAiB,EAAE,qBAAqB;CAC3C,CAAC,CAAC,QAAQ,EAAE,CAAC;AAKd,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,YAAY,CAAC,4BAA4B,CAAC,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { z } from 'astro/zod';
|
|
2
|
+
/** Increment only for a breaking recipe protocol change, independently of package semver. */
|
|
3
|
+
export declare const RECIPE_PROTOCOL_VERSION: 1;
|
|
4
|
+
export declare const recipeIdSchema: z.ZodString;
|
|
5
|
+
export declare const recipeVersionSchema: z.ZodString;
|
|
6
|
+
/** Semver range syntax and satisfaction are checked by the resolver's semver policy. */
|
|
7
|
+
export declare const recipeCompatibilityRangeSchema: z.ZodString;
|
|
8
|
+
export declare const recipeOutputContributionSchema: z.ZodReadonly<z.ZodObject<{
|
|
9
|
+
kind: z.ZodEnum<{
|
|
10
|
+
file: "file";
|
|
11
|
+
dependency: "dependency";
|
|
12
|
+
route: "route";
|
|
13
|
+
content: "content";
|
|
14
|
+
binding: "binding";
|
|
15
|
+
configuration: "configuration";
|
|
16
|
+
}>;
|
|
17
|
+
id: z.ZodString;
|
|
18
|
+
target: z.ZodString;
|
|
19
|
+
}, z.core.$strict>>;
|
|
20
|
+
export declare const recipeValidatorDescriptorSchema: z.ZodReadonly<z.ZodObject<{
|
|
21
|
+
id: z.ZodString;
|
|
22
|
+
phase: z.ZodEnum<{
|
|
23
|
+
output: "output";
|
|
24
|
+
options: "options";
|
|
25
|
+
}>;
|
|
26
|
+
}, z.core.$strict>>;
|
|
27
|
+
export declare const recipeMetadataFields: {
|
|
28
|
+
id: z.ZodString;
|
|
29
|
+
version: z.ZodString;
|
|
30
|
+
protocolVersion: z.ZodLiteral<1>;
|
|
31
|
+
compatibleCliRange: z.ZodString;
|
|
32
|
+
compatibleRuntimeRange: z.ZodString;
|
|
33
|
+
provides: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
34
|
+
requires: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
35
|
+
conflicts: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
36
|
+
/** Lower priority first, then key, then recipe id; dependencies precede consumers. */
|
|
37
|
+
order: z.ZodReadonly<z.ZodObject<{
|
|
38
|
+
priority: z.ZodNumber;
|
|
39
|
+
key: z.ZodString;
|
|
40
|
+
}, z.core.$strict>>;
|
|
41
|
+
outputContributions: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
42
|
+
kind: z.ZodEnum<{
|
|
43
|
+
file: "file";
|
|
44
|
+
dependency: "dependency";
|
|
45
|
+
route: "route";
|
|
46
|
+
content: "content";
|
|
47
|
+
binding: "binding";
|
|
48
|
+
configuration: "configuration";
|
|
49
|
+
}>;
|
|
50
|
+
id: z.ZodString;
|
|
51
|
+
target: z.ZodString;
|
|
52
|
+
}, z.core.$strict>>>>;
|
|
53
|
+
};
|
|
54
|
+
/** Serializable projection: executable hooks and Zod instances are deliberately excluded. */
|
|
55
|
+
export declare const recipeMetadataDescriptorSchema: z.ZodReadonly<z.ZodObject<{
|
|
56
|
+
optionsSchema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
57
|
+
validators: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
58
|
+
id: z.ZodString;
|
|
59
|
+
phase: z.ZodEnum<{
|
|
60
|
+
output: "output";
|
|
61
|
+
options: "options";
|
|
62
|
+
}>;
|
|
63
|
+
}, z.core.$strict>>>>;
|
|
64
|
+
generate: z.ZodLiteral<"direct">;
|
|
65
|
+
id: z.ZodString;
|
|
66
|
+
version: z.ZodString;
|
|
67
|
+
protocolVersion: z.ZodLiteral<1>;
|
|
68
|
+
compatibleCliRange: z.ZodString;
|
|
69
|
+
compatibleRuntimeRange: z.ZodString;
|
|
70
|
+
provides: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
71
|
+
requires: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
72
|
+
conflicts: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
73
|
+
order: z.ZodReadonly<z.ZodObject<{
|
|
74
|
+
priority: z.ZodNumber;
|
|
75
|
+
key: z.ZodString;
|
|
76
|
+
}, z.core.$strict>>;
|
|
77
|
+
outputContributions: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
78
|
+
kind: z.ZodEnum<{
|
|
79
|
+
file: "file";
|
|
80
|
+
dependency: "dependency";
|
|
81
|
+
route: "route";
|
|
82
|
+
content: "content";
|
|
83
|
+
binding: "binding";
|
|
84
|
+
configuration: "configuration";
|
|
85
|
+
}>;
|
|
86
|
+
id: z.ZodString;
|
|
87
|
+
target: z.ZodString;
|
|
88
|
+
}, z.core.$strict>>>>;
|
|
89
|
+
}, z.core.$strict>>;
|
|
90
|
+
export type RecipeMetadataDescriptor = z.infer<typeof recipeMetadataDescriptorSchema>;
|
|
91
|
+
export type RecipeOutputContribution = z.infer<typeof recipeOutputContributionSchema>;
|
|
92
|
+
export type RecipeValidatorDescriptor = z.infer<typeof recipeValidatorDescriptorSchema>;
|
|
93
|
+
/** Import from @easy-web/core/recipes/schema without evaluating the core barrel. */
|
|
94
|
+
export declare const recipeMetadataJsonSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodReadonly<z.ZodObject<{
|
|
95
|
+
optionsSchema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
96
|
+
validators: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
97
|
+
id: z.ZodString;
|
|
98
|
+
phase: z.ZodEnum<{
|
|
99
|
+
output: "output";
|
|
100
|
+
options: "options";
|
|
101
|
+
}>;
|
|
102
|
+
}, z.core.$strict>>>>;
|
|
103
|
+
generate: z.ZodLiteral<"direct">;
|
|
104
|
+
id: z.ZodString;
|
|
105
|
+
version: z.ZodString;
|
|
106
|
+
protocolVersion: z.ZodLiteral<1>;
|
|
107
|
+
compatibleCliRange: z.ZodString;
|
|
108
|
+
compatibleRuntimeRange: z.ZodString;
|
|
109
|
+
provides: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
110
|
+
requires: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
111
|
+
conflicts: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
112
|
+
order: z.ZodReadonly<z.ZodObject<{
|
|
113
|
+
priority: z.ZodNumber;
|
|
114
|
+
key: z.ZodString;
|
|
115
|
+
}, z.core.$strict>>;
|
|
116
|
+
outputContributions: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
117
|
+
kind: z.ZodEnum<{
|
|
118
|
+
file: "file";
|
|
119
|
+
dependency: "dependency";
|
|
120
|
+
route: "route";
|
|
121
|
+
content: "content";
|
|
122
|
+
binding: "binding";
|
|
123
|
+
configuration: "configuration";
|
|
124
|
+
}>;
|
|
125
|
+
id: z.ZodString;
|
|
126
|
+
target: z.ZodString;
|
|
127
|
+
}, z.core.$strict>>>>;
|
|
128
|
+
}, z.core.$strict>>>;
|
|
129
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/recipes/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;AAE9B,6FAA6F;AAC7F,eAAO,MAAM,uBAAuB,EAAG,CAAU,CAAC;AAElD,eAAO,MAAM,cAAc,aAAoE,CAAC;AAChG,eAAO,MAAM,mBAAmB,aAE/B,CAAC;AACF,wFAAwF;AACxF,eAAO,MAAM,8BAA8B,aAA2B,CAAC;AAEvE,eAAO,MAAM,8BAA8B;;;;;;;;;;;mBAK9B,CAAC;AAEd,eAAO,MAAM,+BAA+B;;;;;;mBAG/B,CAAC;AAEd,eAAO,MAAM,oBAAoB;;;;;;;;;IAU7B,sFAAsF;;;;;;;;;;;;;;;;;CAGzF,CAAC;AAEF,6FAA6F;AAC7F,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAK9B,CAAC;AAEd,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AACtF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AACtF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAExF,oFAAoF;AACpF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAAiD,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from 'astro/zod';
|
|
2
|
+
/** Increment only for a breaking recipe protocol change, independently of package semver. */
|
|
3
|
+
export const RECIPE_PROTOCOL_VERSION = 1;
|
|
4
|
+
export const recipeIdSchema = z.string().regex(/^[a-zA-Z][a-zA-Z0-9]*(?:[./:-][a-zA-Z0-9]+)*$/);
|
|
5
|
+
export const recipeVersionSchema = z.string().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/);
|
|
6
|
+
/** Semver range syntax and satisfaction are checked by the resolver's semver policy. */
|
|
7
|
+
export const recipeCompatibilityRangeSchema = z.string().trim().min(1);
|
|
8
|
+
export const recipeOutputContributionSchema = z.strictObject({
|
|
9
|
+
kind: z.enum(['file', 'dependency', 'route', 'content', 'binding', 'configuration']),
|
|
10
|
+
id: recipeIdSchema,
|
|
11
|
+
/** Logical destination; filesystem path safety belongs to the generation boundary. */
|
|
12
|
+
target: z.string().min(1),
|
|
13
|
+
}).readonly();
|
|
14
|
+
export const recipeValidatorDescriptorSchema = z.strictObject({
|
|
15
|
+
id: recipeIdSchema,
|
|
16
|
+
phase: z.enum(['options', 'output']),
|
|
17
|
+
}).readonly();
|
|
18
|
+
export const recipeMetadataFields = {
|
|
19
|
+
id: recipeIdSchema,
|
|
20
|
+
version: recipeVersionSchema,
|
|
21
|
+
protocolVersion: z.literal(RECIPE_PROTOCOL_VERSION),
|
|
22
|
+
compatibleCliRange: recipeCompatibilityRangeSchema,
|
|
23
|
+
compatibleRuntimeRange: recipeCompatibilityRangeSchema,
|
|
24
|
+
// Like HasImage/Linkable, capabilities express traits, not customer/domain identities.
|
|
25
|
+
provides: z.array(recipeIdSchema).min(1).readonly(),
|
|
26
|
+
requires: z.array(recipeIdSchema).readonly(),
|
|
27
|
+
conflicts: z.array(recipeIdSchema).readonly(),
|
|
28
|
+
/** Lower priority first, then key, then recipe id; dependencies precede consumers. */
|
|
29
|
+
order: z.strictObject({ priority: z.number().int(), key: recipeIdSchema }).readonly(),
|
|
30
|
+
outputContributions: z.array(recipeOutputContributionSchema).readonly(),
|
|
31
|
+
};
|
|
32
|
+
/** Serializable projection: executable hooks and Zod instances are deliberately excluded. */
|
|
33
|
+
export const recipeMetadataDescriptorSchema = z.strictObject({
|
|
34
|
+
...recipeMetadataFields,
|
|
35
|
+
optionsSchema: z.record(z.string(), z.json()),
|
|
36
|
+
validators: z.array(recipeValidatorDescriptorSchema).readonly(),
|
|
37
|
+
generate: z.literal('direct'),
|
|
38
|
+
}).readonly();
|
|
39
|
+
/** Import from @easy-web/core/recipes/schema without evaluating the core barrel. */
|
|
40
|
+
export const recipeMetadataJsonSchema = z.toJSONSchema(recipeMetadataDescriptorSchema);
|
|
41
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/recipes/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;AAE9B,6FAA6F;AAC7F,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAU,CAAC;AAElD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;AAChG,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAC/C,iLAAiL,CACpL,CAAC;AACF,wFAAwF;AACxF,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAEvE,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,YAAY,CAAC;IACzD,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;IACpF,EAAE,EAAE,cAAc;IAClB,sFAAsF;IACtF,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC5B,CAAC,CAAC,QAAQ,EAAE,CAAC;AAEd,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,YAAY,CAAC;IAC1D,E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