Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"typecheck": "tsc -p tsconfig.json"
},
"dependencies": {
"@aestheticfunction/dspack-emit": "0.3.1"
"@aestheticfunction/dspack-emit": "0.3.2"
},
"devDependencies": {
"@astryxdesign/cli": "0.1.4",
Expand Down
28 changes: 17 additions & 11 deletions packages/contracts/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,28 @@ for (const version of ["0.9.1", "1.0"] as A2uiVersion[]) {
// owner-authored upstream extension (intents beyond destructive-action);
// the catalog emission and gates run today.
const shadcnDoc = JSON.parse(readFileSync(join(root, "shadcn-ui.dspack.json"), "utf8")) as DspackDoc;
const shadcnExample = (shadcnDoc as any).examples?.[0];
if (!shadcnExample?.surface) {
const shadcnExamples = ((shadcnDoc as any).examples ?? []) as Array<{ id: string; surface: unknown }>;
if (shadcnExamples.length === 0 || !shadcnExamples[0]?.surface) {
console.error("shadcn contract has no worked example surface; A3 would be vacuous");
process.exit(1);
}
// EVERY worked example must emit (P1.E): the example set is the contract's
// own definition of "expressible", and a nominally-mapped component whose
// sub-family refuses only surfaces when its example is actually emitted.
// examples[0] additionally feeds the A3 instance gate below.
let shadcnSurfaceMessages: unknown = { messages: [] };
try {
const emitted = emitSurface(shadcnExample.surface as DspackSurface, shadcnDoc, { profile: shadcnProfile });
shadcnSurfaceMessages = { messages: emitted.messages };
for (const w of emitted.warnings) console.log(` [shadcn surface warn] ${w.code}: ${w.message}`);
} catch (err) {
if (err instanceof EmitSurfaceError) {
console.error(`shadcn surface emission failed: ${err.message}`);
process.exit(4);
for (const [i, example] of shadcnExamples.entries()) {
try {
const emitted = emitSurface(example.surface as DspackSurface, shadcnDoc, { profile: shadcnProfile });
if (i === 0) shadcnSurfaceMessages = { messages: emitted.messages };
for (const w of emitted.warnings) console.log(` [shadcn surface warn] ${example.id} ${w.code}: ${w.message}`);
} catch (err) {
if (err instanceof EmitSurfaceError) {
console.error(`shadcn surface emission failed (${example.id}): ${err.message}`);
process.exit(4);
}
throw err;
}
throw err;
}
for (const version of ["0.9.1", "1.0"] as A2uiVersion[]) {
const { catalog, validation, report } = transform(shadcnDoc, version, shadcnSurfaceMessages, shadcnProfile);
Expand Down
12 changes: 10 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading