retejs / code-plugin

8 stars 7 forks source link

how can i use this plugin #5

Closed tortorse closed 5 years ago

tortorse commented 5 years ago

I used this plugin followed the README, but there is an error

e.components.map is not a function

I found engine.components is a Map,but the plugin's input is a Array? Maybe i didn't use it in the right way?

rete version: 1.3.0 rete-code-plugin version: 0.1.1

Ni55aN commented 5 years ago

I need to see a full call trace

tortorse commented 5 years ago

Here is the code. https://codesandbox.io/s/vue-template-3ocyi?fontsize=14

Hatead1 commented 5 years ago

I confirm, the same error.

Ni55aN commented 5 years ago

fixed in v0.2.0. Rete CLI was updated, so take into account

import CodePlugin, { generate } from 'rete-code-plugin';
Ni55aN commented 5 years ago

A long time I'm planning to generate a code from AST, therefore plugin can have breaking changes

Hatead1 commented 5 years ago

And const sourceCode = await generate(engine, editor.toJSON());

Hatead1 commented 5 years ago

generate a code from AST

may be another plugin? ast-code-plugin or something like that?

Hatead1 commented 5 years ago

"c.code is not a function" if no code() function in component. But if component shouldn't generate code?

Ni55aN commented 5 years ago

code() {}

Hatead1 commented 5 years ago

Thanks!

tortorse commented 5 years ago

Thanks a lot!