Skip to content

v0.2.0 - Type Aliases & Multi-File Imports

Latest

Choose a tag to compare

@rz1989s rz1989s released this 24 Nov 16:24
· 3 commits to main since this release

🎉 LUMOS v0.2.0 - Type Aliases & Multi-File Imports

Major release bringing schema organization and DRY principles to LUMOS!

✨ New Features

Type Aliases

  • Rust-style syntax: type UserId = PublicKey;
  • Recursive resolution with circular reference detection
  • Generate pub type (Rust) and export type (TypeScript)
  • Support for all types: primitives, Solana types, collections

Multi-File Imports

  • JavaScript-style syntax: import { Type1, Type2 } from "./file.lumos";
  • Automatic import discovery and resolution
  • Multi-line import support
  • Circular import detection
  • Cross-file type validation

FileResolver Architecture

  • 340-line multi-file schema manager
  • Automatic dependency discovery
  • Import caching
  • Three-pass validation (collect → resolve → validate)

📦 Installation

# Install or upgrade CLI
cargo install [email protected]

# Or update existing installation
cargo install --force lumos-cli

📚 Examples

Type Aliases:

type UserId = PublicKey;
type Lamports = u64;
type UserList = [PublicKey];

struct Account {
    owner: UserId,
    balance: Lamports,
}

Multi-File Imports:

// types.lumos
type UserId = PublicKey;
enum AccountStatus { Active, Frozen, Closed }

// accounts.lumos
import { UserId, AccountStatus } from "./types.lumos";

struct UserAccount {
    user: UserId,
    status: AccountStatus,
}

🧪 Testing

  • ✅ All 202 tests passing (100% success)
  • ✅ E2E compilation verified
  • ✅ 4 new file_resolver tests

📖 Documentation

  • Comprehensive examples in examples/type_aliases.lumos (200+ lines)
  • Multi-file examples in examples/imports/ (7 files)
  • Complete usage guide and troubleshooting

🔗 Links

🚀 What's Next

Phase 5.3 continues with:

  • Nested module support (#53)
  • Generic struct/enum definitions (#54)

Phase 5.3 Progress: 60% complete (3/5 issues)


Alhamdulillah! Thank you to everyone supporting LUMOS development. 🎉