Modulia is a lightweight loader library for Deno that dynamically loads JavaScript and YAML modules with context support.
- Dynamic loading of JS modules with context passing
- YAML and JSON file parsing support
- Simple and extensible loader architecture
Use load to dynamically import a module by its absolute path. The module must export a default value that is either:
- A function that receives a context object and returns an object, or
- An object directly.
export default function ({value}) {
return {
message: `Hello, from js! Context: ${value}!`
}
}export default {
message: `Hello, from js!`
}message: Hello, from yaml!import { load } from "jsr:@justbyitself/modulia"
const module = await load("/absolute/path/to/module.js")
const result = await module({ value: "context value" })Run tests with:
deno task test- More formats support (jsonc, hjson, toml...)