headless code generator

168 views
Skip to first unread message

Chi Ng

unread,
Sep 20, 2023, 2:59:04 PM9/20/23
to Blockly
Hi,

I was quite excited about the generator presented in this video from the 2023 summit:
https://www.youtube.com/watch?v=2wpka3WFF4Y&t=224s

I'm curious about which version of Blockly the headless generator is available in. I couldn't find any documentation related to it.

Many thanks,

--Chi 


feni...@google.com

unread,
Sep 20, 2023, 5:56:05 PM9/20/23
to Blockly
Hi Chi,

Thanks for your interest in that generator demo. That was a technical demo of a different way of doing headless generation, but adding it to the library is not currently on the roadmap: if we added it, we would have to support two different types of generators. 

However, you can use our existing generators just fine with a headless workspace. There's a demo here which includes a link to the code that's running.

Cheers,
Rachel

Chi Ng

unread,
Sep 20, 2023, 6:57:42 PM9/20/23
to blo...@googlegroups.com
Hi Rachel,

The core version of the generator requires importing Blockly and the Workspace class, which results in the transpiled bundle including a reference to the document object.

I have a Flutter app in which I want to generate code from serialized workspace JSON using flutterjs—an embedded JS engine.

The new generator seems perfect for my use case. Is the new generator open source?

Thanks,

-- Chi 



--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/21c71e0e-317a-49a1-806a-3d7fdb8c9da9n%40googlegroups.com.

Rachel Fenichel

unread,
Sep 22, 2023, 6:46:04 PM9/22/23
to blo...@googlegroups.com, Neil Fraser
Hi Chi,

Does that mean that Blockly's doesn't work headlessly for you, such as in Node? If yes, that's a regression, so please file a bug with your repro case.

Neil's generator is probably open source--I've CCed him to comment.

Cheers,
Rachel

You received this message because you are subscribed to a topic in the Google Groups "Blockly" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/blockly/jVSj8Y-x4e4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/CABuFRZyon6xjjOrFovxgAgOtdQ-Oi9NMQgdRgkB0J9KQgP-46Q%40mail.gmail.com.

Chi Ng

unread,
Sep 23, 2023, 11:47:12 AM9/23/23
to blo...@googlegroups.com, Neil Fraser
Hi Rachel,

Thank you for taking the time to answer my questions.

I haven't tried running the generator headless with Node.js yet. I suppose it should work since V8 is embedded in it. 
I will try it when I get around to it, and if I discover anything, I will let you know.

Many thanks,

--Chi

Reply all
Reply to author
Forward
0 new messages