Enhance the `.mbt.md` file's front matter `deps` config
Feature Request
Summary
This feature request includes two enhancement in different case:
- Extend
.mbt.mdfile's front matter configdepstarget to local Moonbit module as its dependency. - [optional] Allow a
.mbt.mdfile refer other.mbt.mdfiles (aliasing as its context, like virtual package).
Motivation
- Simplify the workaround for markdown test mode, make the
moon testfor.mbt.mdfile works offline. - make
.mbt.mdfile more flexible on distribution.
Detailed Description
.mbt.md file can run (test) by moon test command, which convenience for simple demo and POC. Although the deps can be config in Markdown front matter area, it can only refer to the module already published on mooncakes.io using module's name and version number, while the moon.mod.json can config local Moonbit module as package dependency using a path field.
case-1: extend deps config
we can extend deps config in this way:
moonbit:
deps:
moon/bit: 1.0
moon/bot: {path: ../bot} # <- local deps
Since most related code have been implemented, this enhancement would not take a hard work on it.
case-2: markdown file as 'virtual package'
First, aliasing each markdown file as a single package:
moonbit:
libs:
foo: ./foo/export.mbt.md # local file
foo.bar: https://example.com/b.mbt.md # remote file
then we can use these package in .mbt.md files' Moonbit code blocks:
let b = @foo.echo("ok")
This enhancement is very different compare to case 1, which need a lot of works on dependency check. Both two case can take a better experience on doc-oriented programming.
Related Issues
Checklist
- [x] I have added all necessary details to make it easy for the maintainers to understand my request.
@Young-Flash
Young-flash is no longer maintaining this project. As of this request, I currently do not have enough bandwidth to maintain it as I am working hard on #802. I'll re-review it after things are mostly settled.
Sorry for the late update! The rewrite is mostly done, but I am leaving the maintainer position soon. Case 1 should be a relative easy implementation, so I will keep this issue open. I'm unsure about the semantics of case 2. If you have time, maybe you can explain it more to our other colleagues via comments in this issue. I will redirect the feature request to them.