@decocms/blocks 7.16.8 → 7.17.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/package.json +1 -1
- package/src/cms/schema.test.ts +19 -0
- package/src/cms/schema.ts +14 -2
package/package.json
CHANGED
package/src/cms/schema.test.ts
CHANGED
|
@@ -218,3 +218,22 @@ describe("registerAppSchemas", () => {
|
|
|
218
218
|
expect(registered?.tags).toEqual(["product-list"]);
|
|
219
219
|
});
|
|
220
220
|
});
|
|
221
|
+
|
|
222
|
+
describe("composeMeta framework option", () => {
|
|
223
|
+
it("defaults the framework field to tanstack-start", () => {
|
|
224
|
+
expect(composeMeta(emptySiteMeta()).framework).toBe("tanstack-start");
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
it("honors an explicit framework override (e.g. eitri)", () => {
|
|
228
|
+
expect(composeMeta(emptySiteMeta(), { framework: "eitri" }).framework).toBe("eitri");
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
it("still bakes in the framework block types regardless of framework name", () => {
|
|
232
|
+
const meta = composeMeta(emptySiteMeta(), { framework: "eitri" });
|
|
233
|
+
// The whole point of composing at generation time: Page + section-picker +
|
|
234
|
+
// Resolvable land in definitions so an FS-only consumer is self-contained.
|
|
235
|
+
expect(meta.schema.definitions).toHaveProperty("__SECTION_REF__");
|
|
236
|
+
expect(meta.schema.definitions).toHaveProperty("Resolvable");
|
|
237
|
+
expect(meta.manifest.blocks.pages).toHaveProperty("website/pages/Page.tsx");
|
|
238
|
+
});
|
|
239
|
+
});
|
package/src/cms/schema.ts
CHANGED
|
@@ -994,7 +994,19 @@ function wrapNestedProperties(
|
|
|
994
994
|
|
|
995
995
|
const SECTION_REF_DEF_KEY = "__SECTION_REF__";
|
|
996
996
|
|
|
997
|
-
export
|
|
997
|
+
export interface ComposeMetaOptions {
|
|
998
|
+
/**
|
|
999
|
+
* Value written to the returned `framework` field. Defaults to
|
|
1000
|
+
* "tanstack-start" for backward compatibility. Non-React stacks that compose
|
|
1001
|
+
* a self-contained meta at generation time (e.g. Eitri) pass their own name.
|
|
1002
|
+
*/
|
|
1003
|
+
framework?: string;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
export function composeMeta(
|
|
1007
|
+
siteMeta: MetaResponse,
|
|
1008
|
+
options?: ComposeMetaOptions,
|
|
1009
|
+
): MetaResponse {
|
|
998
1010
|
const siteAnyOf = siteMeta.schema?.root?.sections?.anyOf || [];
|
|
999
1011
|
|
|
1000
1012
|
// Build all framework components
|
|
@@ -1030,7 +1042,7 @@ export function composeMeta(siteMeta: MetaResponse): MetaResponse {
|
|
|
1030
1042
|
|
|
1031
1043
|
return {
|
|
1032
1044
|
...siteMeta,
|
|
1033
|
-
framework: "tanstack-start",
|
|
1045
|
+
framework: options?.framework ?? "tanstack-start",
|
|
1034
1046
|
manifest: {
|
|
1035
1047
|
blocks: {
|
|
1036
1048
|
...(siteMeta.manifest?.blocks || {}),
|