magicast
magicast copied to clipboard
[WIP] support $comment
๐ Linked issue
#21
โ Type of change
- [ ] ๐ Documentation (updates to the documentation, readme, or JSdoc annotations)
- [ ] ๐ Bug fix (a non-breaking change that fixes an issue)
- [ ] ๐ Enhancement (improving an existing functionality like performance)
- [x] โจ New feature (a non-breaking change that adds functionality)
- [ ] ๐งน Chore (updates to the build process or auxiliary tools and libraries)
- [ ] โ ๏ธ Breaking change (fix or feature that would cause existing functionality to change)
๐ Description
I've tried to implement part of the functionality and turning on the WIP Pull Request first. Would like to have comments and suggestions for this API design.
Here are some choices I have made.
mod.exports.default.a.$comment = 'asdsad' // throw Error because mod.exports.default.a is proxied to a string, So I make $comment on every object for now. Take a look at the test cases for exampes.- Always use leadding comment block instead of comment line
- If it has multipe comment on one node, getter will join them with newline('\n')
Question
How to deal with array field for example:
export defaut {
urls: [
/* comment about first url */
"http://example.com",
/* comment about second url */
"http://example2.com"
]
}
๐ Checklist
- [x] I have linked an issue or discussion.
- [ ] I have updated the documentation accordingly.
@antfu Would you take a look on the API?
I'm in a big need of this, this would be awesome!