Syntax:
import { Counter, shared_count } from "./shared"
export let shared_count = 0
export component Counter = ...
Implementation:
- Lexer: Import, Export keywords
- AST: ImportDecl(names, source), Export(name, inner_decl)
- Parser: parse_import_decl, parse_export_decl
- CLI: resolve_imports() — recursive file resolution, dedup, inline
Resolves relative paths, adds .ds extension, handles transitive imports.
110 tests, 0 failures.
15 lines
350 B
Text
15 lines
350 B
Text
-- Multi-file module demo
|
|
-- Imports shared state and components from another .ds file
|
|
|
|
import { shared_count, Counter } from "./shared"
|
|
|
|
let local_count = 0
|
|
|
|
view app =
|
|
column [
|
|
text "Module Demo"
|
|
text "Local: {local_count}"
|
|
button "Local +1" { click: local_count += 1 }
|
|
text "Shared (from module): {shared_count}"
|
|
Counter
|
|
]
|