@strudel/transpiler plugin system
This commit is contained in:
parent
6b00837a4d
commit
bc8517ade7
9 changed files with 680 additions and 506 deletions
|
|
@ -1,10 +1,31 @@
|
|||
# @strudel/transpiler
|
||||
|
||||
This package contains a JS code transpiler with the following features:
|
||||
This package contains a JS code transpiler with a plugin system that can be used to transform the code.
|
||||
|
||||
- add locations of mini notation strings (double quoted or backticked) for highlighting
|
||||
A plugin can be registered via a `registerTranspilerPlugin` call :
|
||||
|
||||
```js
|
||||
registerTranspilerPlugin({
|
||||
walk: (context) => ({
|
||||
enter: function(node, parent, prop, index) {},
|
||||
leave: function(node, parent, prop, index) {}
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
where the enter/leave functions (both optional) follow the `estree-walker` walk API.
|
||||
|
||||
4 plugins are currently hosted inside `@strudel/transpiler`
|
||||
|
||||
- mini: add locations of mini notation strings (double quoted or backticked) for highlighting
|
||||
- widgets: add handling of sliders & draw widgets
|
||||
- sample: make it possible to call a sample without await
|
||||
- kabelsalat: transform the code to handle the `K(..)` kabelsalat notation
|
||||
|
||||
it also
|
||||
- converts pseudo note variables to note strings
|
||||
- adds return statement to the last expression
|
||||
- handle label capturing for block-based eval
|
||||
|
||||
## Install
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue