diff --git a/.changeset/blueprint-codegen-recursive.md b/.changeset/blueprint-codegen-recursive.md deleted file mode 100644 index b62bbeab..00000000 --- a/.changeset/blueprint-codegen-recursive.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -"@evolution-sdk/evolution": patch ---- - -Blueprint codegen now supports recursive type schemas — Plutus types that reference themselves -directly or through an intermediate type (e.g. `MultiSig` containing a `List` field). -Cyclic references are emitted as typed `Schema.suspend` thunks where the encoded type `I` is -inferred by recursively walking the blueprint definition graph rather than hardcoded to `Data.Constr`: -`list` → `readonly ItemEncoded[]`, `map` → `globalThis.Map`, -`bytes` → `Uint8Array`, `integer` → `bigint`, `constructor` and union → `Data.Constr`, -`$ref` followed transitively up to depth 10. The previous hardcoded `Data.Constr` caused a -TypeScript invariance error for any recursive field referencing a list type. - -Several other codegen correctness and API improvements ship in the same release: - -- **Namespace emission ordering** — the group-by-namespace emitter is replaced by a streaming emitter - that walks a global topological sort and opens/closes namespace blocks on demand. TypeScript namespace - merging handles split declarations transparently. This fixes cases where a type was emitted before - its cross-namespace dependency (e.g. `Option.OfStakeCredential` appearing before `Cardano.Address.StakeCredential`). - -- **Cyclic type emit pattern** — cyclic types now emit a `export type X = ...` / `export const X = ...` - pair with no outer `Schema.suspend` wrapper and no `as` cast. Only the inner field references that - close the cycle use typed thunks: `Schema.suspend((): Schema.Schema => T)`. - -- **`unionStyle` config** — `CodegenConfig` gains `unionStyle: "Variant" | "Struct" | "TaggedStruct"` - in place of the removed `forceVariant` and `useSuspend` fields. `Struct` emits - `TSchema.Struct({ Tag: TSchema.Struct({...}, { flatFields: true }) }, { flatInUnion: true })`, - `TaggedStruct` emits `TSchema.TaggedStruct("Tag", {...}, { flatInUnion: true })`, - and `Variant` emits `TSchema.Variant({ Tag: {...} })`. - -- **Import hygiene** — generated files emit `import { Schema } from "@evolution-sdk/evolution"` - only when cyclic types are present, rather than always importing from `effect` directly. - `CodegenConfig.imports.effect` is replaced by `imports.schema`. - diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index c40e1226..ec8a236e 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,13 @@ # docs +## 0.0.37 + +### Patch Changes + +- Updated dependencies [[`19829c7`](https://github.com/IntersectMBO/evolution-sdk/commit/19829c7c6e1cd1ac3a33fb180e4482016791dcd5)]: + - @evolution-sdk/evolution@0.3.30 + - @evolution-sdk/devnet@1.1.30 + ## 0.0.36 ### Patch Changes diff --git a/docs/package.json b/docs/package.json index 72b035d3..ec52c8dc 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,6 +1,6 @@ { "name": "docs", - "version": "0.0.36", + "version": "0.0.37", "private": true, "type": "module", "scripts": { diff --git a/examples/with-vite-react/CHANGELOG.md b/examples/with-vite-react/CHANGELOG.md index 3b997ab3..6e2b56c7 100644 --- a/examples/with-vite-react/CHANGELOG.md +++ b/examples/with-vite-react/CHANGELOG.md @@ -1,5 +1,12 @@ # evolution-vite-react-example +## 0.1.16 + +### Patch Changes + +- Updated dependencies [[`19829c7`](https://github.com/IntersectMBO/evolution-sdk/commit/19829c7c6e1cd1ac3a33fb180e4482016791dcd5)]: + - @evolution-sdk/evolution@0.3.30 + ## 0.1.15 ### Patch Changes diff --git a/examples/with-vite-react/package.json b/examples/with-vite-react/package.json index 28d49cda..bfe63f96 100644 --- a/examples/with-vite-react/package.json +++ b/examples/with-vite-react/package.json @@ -1,6 +1,6 @@ { "name": "evolution-vite-react-example", - "version": "0.1.15", + "version": "0.1.16", "private": true, "type": "module", "scripts": { diff --git a/packages/aiken-uplc/CHANGELOG.md b/packages/aiken-uplc/CHANGELOG.md index 87d46b0f..4ac1e62a 100644 --- a/packages/aiken-uplc/CHANGELOG.md +++ b/packages/aiken-uplc/CHANGELOG.md @@ -1,5 +1,12 @@ # @evolution-sdk/aiken-uplc +## 0.0.22 + +### Patch Changes + +- Updated dependencies [[`19829c7`](https://github.com/IntersectMBO/evolution-sdk/commit/19829c7c6e1cd1ac3a33fb180e4482016791dcd5)]: + - @evolution-sdk/evolution@0.3.30 + ## 0.0.21 ### Patch Changes diff --git a/packages/aiken-uplc/package.json b/packages/aiken-uplc/package.json index 687631f2..a9531856 100644 --- a/packages/aiken-uplc/package.json +++ b/packages/aiken-uplc/package.json @@ -1,6 +1,6 @@ { "name": "@evolution-sdk/aiken-uplc", - "version": "0.0.21", + "version": "0.0.22", "description": "Aiken UPLC evaluator for Evolution SDK with WASM-based local script evaluation", "type": "module", "main": "./dist/index.js", diff --git a/packages/evolution-devnet/CHANGELOG.md b/packages/evolution-devnet/CHANGELOG.md index 34a30503..af120965 100644 --- a/packages/evolution-devnet/CHANGELOG.md +++ b/packages/evolution-devnet/CHANGELOG.md @@ -1,5 +1,14 @@ # @evolution-sdk/devnet +## 1.1.30 + +### Patch Changes + +- Updated dependencies [[`19829c7`](https://github.com/IntersectMBO/evolution-sdk/commit/19829c7c6e1cd1ac3a33fb180e4482016791dcd5)]: + - @evolution-sdk/evolution@0.3.30 + - @evolution-sdk/aiken-uplc@0.0.22 + - @evolution-sdk/scalus-uplc@0.0.20 + ## 1.1.29 ### Patch Changes diff --git a/packages/evolution-devnet/package.json b/packages/evolution-devnet/package.json index 9ecf0a61..b0574733 100644 --- a/packages/evolution-devnet/package.json +++ b/packages/evolution-devnet/package.json @@ -1,6 +1,6 @@ { "name": "@evolution-sdk/devnet", - "version": "1.1.29", + "version": "1.1.30", "description": "Local Cardano devnet for testing and development with Docker", "type": "module", "main": "./dist/index.js", diff --git a/packages/evolution/CHANGELOG.md b/packages/evolution/CHANGELOG.md index 48b8754e..f7548bfd 100644 --- a/packages/evolution/CHANGELOG.md +++ b/packages/evolution/CHANGELOG.md @@ -1,5 +1,35 @@ # @evolution-sdk/evolution +## 0.3.30 + +### Patch Changes + +- [#215](https://github.com/IntersectMBO/evolution-sdk/pull/215) [`19829c7`](https://github.com/IntersectMBO/evolution-sdk/commit/19829c7c6e1cd1ac3a33fb180e4482016791dcd5) Thanks [@solidsnakedev](https://github.com/solidsnakedev)! - Blueprint codegen now supports recursive type schemas — Plutus types that reference themselves + directly or through an intermediate type (e.g. `MultiSig` containing a `List` field). + Cyclic references are emitted as typed `Schema.suspend` thunks where the encoded type `I` is + inferred by recursively walking the blueprint definition graph rather than hardcoded to `Data.Constr`: + `list` → `readonly ItemEncoded[]`, `map` → `globalThis.Map`, + `bytes` → `Uint8Array`, `integer` → `bigint`, `constructor` and union → `Data.Constr`, + `$ref` followed transitively up to depth 10. The previous hardcoded `Data.Constr` caused a + TypeScript invariance error for any recursive field referencing a list type. + + Several other codegen correctness and API improvements ship in the same release: + - **Namespace emission ordering** — the group-by-namespace emitter is replaced by a streaming emitter + that walks a global topological sort and opens/closes namespace blocks on demand. TypeScript namespace + merging handles split declarations transparently. This fixes cases where a type was emitted before + its cross-namespace dependency (e.g. `Option.OfStakeCredential` appearing before `Cardano.Address.StakeCredential`). + - **Cyclic type emit pattern** — cyclic types now emit a `export type X = ...` / `export const X = ...` + pair with no outer `Schema.suspend` wrapper and no `as` cast. Only the inner field references that + close the cycle use typed thunks: `Schema.suspend((): Schema.Schema => T)`. + - **`unionStyle` config** — `CodegenConfig` gains `unionStyle: "Variant" | "Struct" | "TaggedStruct"` + in place of the removed `forceVariant` and `useSuspend` fields. `Struct` emits + `TSchema.Struct({ Tag: TSchema.Struct({...}, { flatFields: true }) }, { flatInUnion: true })`, + `TaggedStruct` emits `TSchema.TaggedStruct("Tag", {...}, { flatInUnion: true })`, + and `Variant` emits `TSchema.Variant({ Tag: {...} })`. + - **Import hygiene** — generated files emit `import { Schema } from "@evolution-sdk/evolution"` + only when cyclic types are present, rather than always importing from `effect` directly. + `CodegenConfig.imports.effect` is replaced by `imports.schema`. + ## 0.3.29 ### Patch Changes diff --git a/packages/evolution/package.json b/packages/evolution/package.json index 64c1ceda..ca13a128 100644 --- a/packages/evolution/package.json +++ b/packages/evolution/package.json @@ -1,6 +1,6 @@ { "name": "@evolution-sdk/evolution", - "version": "0.3.29", + "version": "0.3.30", "description": "A modern TypeScript SDK for Cardano blockchain development", "type": "module", "main": "./dist/index.js", diff --git a/packages/scalus-uplc/CHANGELOG.md b/packages/scalus-uplc/CHANGELOG.md index b382aa11..07a17142 100644 --- a/packages/scalus-uplc/CHANGELOG.md +++ b/packages/scalus-uplc/CHANGELOG.md @@ -1,5 +1,12 @@ # @evolution-sdk/scalus-uplc +## 0.0.20 + +### Patch Changes + +- Updated dependencies [[`19829c7`](https://github.com/IntersectMBO/evolution-sdk/commit/19829c7c6e1cd1ac3a33fb180e4482016791dcd5)]: + - @evolution-sdk/evolution@0.3.30 + ## 0.0.19 ### Patch Changes diff --git a/packages/scalus-uplc/package.json b/packages/scalus-uplc/package.json index 8fbfe853..caa1f9a8 100644 --- a/packages/scalus-uplc/package.json +++ b/packages/scalus-uplc/package.json @@ -1,6 +1,6 @@ { "name": "@evolution-sdk/scalus-uplc", - "version": "0.0.19", + "version": "0.0.20", "description": "Scalus UPLC evaluator adapter for Evolution SDK", "type": "module", "main": "./dist/index.js",