Skip to content

Commit 1aa9f53

Browse files
Merge pull request #240 from IntersectMBO/worktree-shiny-giggling-frost
refactor: flatten module structure to eliminate webpack casing conflicts
2 parents 5942803 + 524f9e7 commit 1aa9f53

329 files changed

Lines changed: 1449 additions & 1856 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
"@evolution-sdk/evolution": minor
3+
---
4+
5+
Flatten module structure to eliminate webpack casing conflicts on case-insensitive filesystems. The wildcard export now maps PascalCase filenames directly — namespace name equals filename equals import path, removing the directory/namespace casing mismatch that caused dual module identifiers in webpack builds.
6+
7+
Modules previously nested in concept folders (address/, block/, transaction/, etc.) are now flat PascalCase files at the package root. Three subdirectories remain for separate domains with naming collisions: `plutus/` (on-chain script types), `cose/` (message signing protocol), and `blueprint/` (CIP-57 codegen). Deep imports into subdirectories are blocked.
8+
9+
- Concept-folder subpath imports like `@evolution-sdk/evolution/address` are removed. Use the root barrel (`import { Address } from "@evolution-sdk/evolution"`) or the wildcard (`import * as Address from "@evolution-sdk/evolution/Address"`).
10+
- `MessageSigning` is renamed to `COSE` in the root barrel export.
11+
- `./plutus`, `./cose`, and `./blueprint` are available as subpath imports with namespaced barrels.
12+
- Blueprint barrel now uses `export * as` instead of `export *`.

docs/app/tools/blueprint-codegen/blueprint-codegen.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import { useState } from "react"
44
import { Blueprint } from "@evolution-sdk/evolution"
55
import { DynamicCodeBlock } from "fumadocs-ui/components/dynamic-codeblock"
66

7-
const { PlutusBlueprint, generateTypeScript, createCodegenConfig } = Blueprint
7+
const { PlutusBlueprint } = Blueprint.Types
8+
const { generateTypeScript } = Blueprint.Codegen
9+
const { createCodegenConfig } = Blueprint.CodegenConfig
810

911
export function BlueprintCodegen() {
1012
const [blueprintJson, setBlueprintJson] = useState("")

docs/content/docs/addresses/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ const address = new Address.Address({
4040
### Option 2: Direct Module Imports
4141

4242
```typescript twoslash
43-
import { Address } from "@evolution-sdk/evolution/address/Address";
44-
import { KeyHash } from "@evolution-sdk/evolution/credential/KeyHash";
43+
import { Address } from "@evolution-sdk/evolution/Address";
44+
import { KeyHash } from "@evolution-sdk/evolution/KeyHash";
4545

4646
// Same functionality, imported directly from modules
4747
const paymentCred = new KeyHash({ hash: new Uint8Array(28) });

docs/content/docs/encoding/cbor.mdx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Most application code should use the module-specific APIs (`Transaction.fromCBOR
2323
## Quick Start
2424

2525
```typescript twoslash
26-
import { CBOR } from "@evolution-sdk/evolution/encoding"
26+
import { CBOR } from "@evolution-sdk/evolution"
2727

2828
// Decode hex to a typed CBOR value
2929
const value = CBOR.fromCBORHex("83010203")
@@ -48,7 +48,7 @@ const bytes = CBOR.toCBORBytes(value)
4848
`CBOR.fromCBORHex` returns a `CBOR` value — a discriminated union over every CBOR major type:
4949

5050
```typescript twoslash
51-
import { CBOR } from "@evolution-sdk/evolution/encoding"
51+
import { CBOR } from "@evolution-sdk/evolution"
5252

5353
// bigint ← CBOR major 0 (uint) and major 1 (nint)
5454
const uint: CBOR.CBOR = 42n
@@ -69,7 +69,7 @@ const text: CBOR.CBOR = "hello"
6969
Use the type guards to narrow before accessing:
7070

7171
```typescript twoslash
72-
import { CBOR } from "@evolution-sdk/evolution/encoding"
72+
import { CBOR } from "@evolution-sdk/evolution"
7373

7474
const raw = CBOR.fromCBORHex("a2016161026162") // { 1 → "a", 2 → "b" }
7575

@@ -88,7 +88,7 @@ Standard CBOR decode throws away encoding choices: whether an integer used 1 or
8888
`CBORFormat` is a discriminated union (8 variants) that captures the complete encoding tree for every CBOR node. `fromCBORHexWithFormat` / `fromCBORBytesWithFormat` decode and capture it simultaneously. `toCBORHexWithFormat` / `toCBORBytesWithFormat` replay the captured tree exactly.
8989

9090
```typescript twoslash
91-
import { CBOR } from "@evolution-sdk/evolution/encoding"
91+
import { CBOR } from "@evolution-sdk/evolution"
9292

9393
// "1800" = integer 0 encoded as a 1-byte uint (non-canonical; minimal is "00")
9494
const hex = "1800"
@@ -128,7 +128,7 @@ The plain `toCBORHex`/`toCBORBytes` APIs accept a `CodecOptions` argument that c
128128
| `CARDANO_NODE_DATA_OPTIONS` | Definite Plutus data (tooling compatibility) |
129129

130130
```typescript twoslash
131-
import { CBOR } from "@evolution-sdk/evolution/encoding"
131+
import { CBOR } from "@evolution-sdk/evolution"
132132

133133
const value = CBOR.fromCBORHex("a2026161016162") // map with non-sorted keys
134134

@@ -162,7 +162,7 @@ const canonicalHex = CBOR.toCBORHex(value, CBOR.CANONICAL_OPTIONS)
162162
### Type Guards
163163

164164
```typescript twoslash
165-
import { CBOR } from "@evolution-sdk/evolution/encoding"
165+
import { CBOR } from "@evolution-sdk/evolution"
166166

167167
const v: CBOR.CBOR = CBOR.fromCBORHex("01")
168168

@@ -179,7 +179,7 @@ CBOR.isTag(v) // v is { _tag: "Tag"; tag: number; value: CBOR.CBOR }
179179
`match` provides exhaustive pattern matching over a `CBOR` value, analogous to a switch on the full union:
180180

181181
```typescript twoslash
182-
import { CBOR } from "@evolution-sdk/evolution/encoding"
182+
import { CBOR } from "@evolution-sdk/evolution"
183183

184184
const value = CBOR.fromCBORHex("43010203") // bytes [01, 02, 03]
185185

@@ -207,7 +207,7 @@ const result = CBOR.match(value, {
207207
If your code receives a `Transaction` CBOR hex from a client, adds witnesses, and returns the result, use `WithFormat` at the transaction level to guarantee the body bytes — and thus the `txId` — are never altered:
208208

209209
```typescript twoslash
210-
import { Transaction } from "@evolution-sdk/evolution/transaction"
210+
import { Transaction } from "@evolution-sdk/evolution"
211211

212212
function addWalletWitnesses(txHex: string, walletWitnessHex: string): string {
213213
// Byte-level splice: body bytes untouched, txId stable
@@ -218,7 +218,7 @@ function addWalletWitnesses(txHex: string, walletWitnessHex: string): string {
218218
For cases where you need to inspect the transaction before re-encoding, use the WithFormat round-trip:
219219

220220
```typescript twoslash
221-
import { Transaction } from "@evolution-sdk/evolution/transaction"
221+
import { Transaction } from "@evolution-sdk/evolution"
222222

223223
function inspectAndReserialize(txHex: string): string {
224224
const { format, value: tx } = Transaction.fromCBORHexWithFormat(txHex)
@@ -236,7 +236,7 @@ function inspectAndReserialize(txHex: string): string {
236236
When you need a specific encoding shape that differs from the defaults — e.g. forcing an indefinite-length array — build the `CBORFormat` explicitly:
237237

238238
```typescript twoslash
239-
import { CBOR } from "@evolution-sdk/evolution/encoding"
239+
import { CBOR } from "@evolution-sdk/evolution"
240240

241241
const fmt: CBOR.CBORFormat = {
242242
_tag: "array",
@@ -253,7 +253,7 @@ const hex = CBOR.toCBORHexWithFormat([1n, 2n], fmt)
253253
`fromCBORHex` returns `CBOR`, not a narrowed type. Always check before indexing:
254254

255255
```typescript twoslash
256-
import { CBOR } from "@evolution-sdk/evolution/encoding"
256+
import { CBOR } from "@evolution-sdk/evolution"
257257

258258
function getMapEntry(hex: string, key: bigint): CBOR.CBOR | undefined {
259259
const v = CBOR.fromCBORHex(hex)

docs/content/docs/encoding/plutus.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ Multi-asset value representing ADA and native tokens as nested maps.
171171
```typescript twoslash
172172
import { Value } from "@evolution-sdk/evolution/plutus"
173173
import { Bytes, Data } from "@evolution-sdk/evolution"
174-
import { Text } from "@evolution-sdk/evolution/primitives"
174+
import { Text } from "@evolution-sdk/evolution"
175175

176176
// ADA only
177177
const adaOnly: Value.Value = new Map([
@@ -232,7 +232,7 @@ Reference token metadata following CIP-68 standard with versioning and extensibi
232232
```typescript twoslash
233233
import { CIP68Metadata } from "@evolution-sdk/evolution/plutus"
234234
import { Bytes, Data } from "@evolution-sdk/evolution"
235-
import { Text } from "@evolution-sdk/evolution/primitives"
235+
import { Text } from "@evolution-sdk/evolution"
236236

237237
// NFT metadata (label 222)
238238
const nftMetadata = Data.map([
@@ -352,7 +352,7 @@ Complete CIP-68 NFT mint creating both reference token (label 100, immutable met
352352
```typescript twoslash
353353
import { CIP68Metadata, Value } from "@evolution-sdk/evolution/plutus"
354354
import { Bytes, Data } from "@evolution-sdk/evolution"
355-
import { Text } from "@evolution-sdk/evolution/primitives"
355+
import { Text } from "@evolution-sdk/evolution"
356356

357357
// Metadata for both reference and user tokens
358358
const metadata = Data.map([
@@ -394,7 +394,7 @@ Decentralized exchange limit order specifying what assets are offered, what's re
394394
```typescript twoslash
395395
import { Credential, Value } from "@evolution-sdk/evolution/plutus"
396396
import { Bytes, Data } from "@evolution-sdk/evolution"
397-
import { Text } from "@evolution-sdk/evolution/primitives"
397+
import { Text } from "@evolution-sdk/evolution"
398398

399399
interface DexOrderDatum {
400400
owner: Credential.Credential

packages/aiken-uplc/src/Evaluator.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
* @packageDocumentation
55
*/
66

7-
import * as Bytes from "@evolution-sdk/evolution/bytes/Bytes"
8-
import * as CBOR from "@evolution-sdk/evolution/encoding/CBOR"
9-
import * as CostModel from "@evolution-sdk/evolution/script/CostModel"
10-
import * as Redeemer from "@evolution-sdk/evolution/script/Redeemer"
11-
import * as Script from "@evolution-sdk/evolution/script/Script"
12-
import * as ScriptRef from "@evolution-sdk/evolution/script/ScriptRef"
7+
import * as Bytes from "@evolution-sdk/evolution/Bytes"
8+
import * as CBOR from "@evolution-sdk/evolution/CBOR"
9+
import * as CostModel from "@evolution-sdk/evolution/CostModel"
10+
import * as Redeemer from "@evolution-sdk/evolution/Redeemer"
11+
import * as Script from "@evolution-sdk/evolution/Script"
12+
import * as ScriptRef from "@evolution-sdk/evolution/ScriptRef"
1313
import * as TransactionBuilder from "@evolution-sdk/evolution/sdk/builders/TransactionBuilder"
1414
import type * as EvalRedeemer from "@evolution-sdk/evolution/sdk/EvalRedeemer"
15-
import * as Transaction from "@evolution-sdk/evolution/transaction/Transaction"
16-
import * as TransactionInput from "@evolution-sdk/evolution/transaction/TransactionInput"
17-
import * as TxOut from "@evolution-sdk/evolution/transaction/TxOut"
18-
import type * as UTxO from "@evolution-sdk/evolution/transaction/UTxO"
15+
import * as Transaction from "@evolution-sdk/evolution/Transaction"
16+
import * as TransactionInput from "@evolution-sdk/evolution/TransactionInput"
17+
import * as TxOut from "@evolution-sdk/evolution/TxOut"
18+
import type * as UTxO from "@evolution-sdk/evolution/UTxO"
1919
import { Effect } from "effect"
2020

2121
/**

packages/evolution-devnet/src/Genesis.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import * as Address from "@evolution-sdk/evolution/address/Address"
2-
import * as AddressEras from "@evolution-sdk/evolution/address/AddressEras"
3-
import * as Assets from "@evolution-sdk/evolution/assets"
4-
import * as TransactionHash from "@evolution-sdk/evolution/transaction/TransactionHash"
5-
import * as UTxO from "@evolution-sdk/evolution/transaction/UTxO"
1+
import * as Address from "@evolution-sdk/evolution/Address"
2+
import * as AddressEras from "@evolution-sdk/evolution/AddressEras"
3+
import * as Assets from "@evolution-sdk/evolution/Assets"
4+
import * as TransactionHash from "@evolution-sdk/evolution/TransactionHash"
5+
import * as UTxO from "@evolution-sdk/evolution/UTxO"
66
import { blake2b } from "@noble/hashes/blake2"
77
import { Data, Effect } from "effect"
88

packages/evolution-devnet/test/Client.Devnet.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as Cluster from "@evolution-sdk/devnet/Cluster"
33
import * as Config from "@evolution-sdk/devnet/Config"
44
import * as Genesis from "@evolution-sdk/devnet/Genesis"
55
import { Cardano, Client, preprod } from "@evolution-sdk/evolution"
6-
import * as CoreAddress from "@evolution-sdk/evolution/address/Address"
6+
import * as CoreAddress from "@evolution-sdk/evolution/Address"
77
import { afterAll, beforeAll } from "vitest"
88

99
// Alias for Cardano.Assets

packages/evolution-devnet/test/Devnet.Genesis.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as Cluster from "@evolution-sdk/devnet/Cluster"
33
import * as Config from "@evolution-sdk/devnet/Config"
44
import * as Genesis from "@evolution-sdk/devnet/Genesis"
55
import { Cardano } from "@evolution-sdk/evolution"
6-
import * as CoreAddress from "@evolution-sdk/evolution/address/Address"
6+
import * as CoreAddress from "@evolution-sdk/evolution/Address"
77
import { afterAll, beforeAll } from "vitest"
88

99
/**

packages/evolution-devnet/test/Devnet.integration.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { afterAll, describe, expect, it } from "@effect/vitest"
22
import * as Cluster from "@evolution-sdk/devnet/Cluster"
33
import * as Container from "@evolution-sdk/devnet/Container"
4-
import * as AddressEras from "@evolution-sdk/evolution/address/AddressEras"
5-
import * as EnterpriseAddress from "@evolution-sdk/evolution/address/EnterpriseAddress"
6-
import * as KeyHash from "@evolution-sdk/evolution/credential/KeyHash"
7-
import * as PrivateKey from "@evolution-sdk/evolution/credential/PrivateKey"
8-
import * as VKey from "@evolution-sdk/evolution/credential/VKey"
4+
import * as AddressEras from "@evolution-sdk/evolution/AddressEras"
5+
import * as EnterpriseAddress from "@evolution-sdk/evolution/EnterpriseAddress"
6+
import * as KeyHash from "@evolution-sdk/evolution/KeyHash"
7+
import * as PrivateKey from "@evolution-sdk/evolution/PrivateKey"
8+
import * as VKey from "@evolution-sdk/evolution/VKey"
99
import Docker from "dockerode"
1010
import { Effect } from "effect"
1111

0 commit comments

Comments
 (0)