Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding custom chugins #37

Open
cchafe opened this issue Sep 1, 2024 · 6 comments
Open

adding custom chugins #37

cchafe opened this issue Sep 1, 2024 · 6 comments
Labels
question Further information is requested

Comments

@cchafe
Copy link

cchafe commented Sep 1, 2024

I drag a .chug.wasm into the file list and it sets the correct serverFilename and an
identical virtualFilename. Is it the case that it actually needs different entries in order to
function as a chugin? My working examples (edited by hand) of exported pages had to have the virtualFilename pre-pended with '/chugins/'

@terryzfeng
Copy link
Member

Yes you can manually load them into the /chugins folder or use the call loadChugin function before init for that to be handled automatically.

@cchafe
Copy link
Author

cchafe commented Sep 1, 2024

Any way to do this in the IDE? Dragging in a file wouldn't be enough.

@terryzfeng
Copy link
Member

terryzfeng commented Sep 10, 2024

There's no way to load chugins into the IDE because chugins cannot be loaded after the VM starts (which is immediate on page load). @gewang might still be working on runtime chugin loading with some @import type syntax...

The preloaded list of chugins at VM start could be hackily modified if you want other chugins to be loaded:
https://github.com/ccrma/webchuck-ide/blob/main/src/utils/webChugins.ts
https://github.com/ccrma/webchuck-ide/blob/6c9a9656e600e7827f923378f2136f03d779dba1/src/host.ts#L66C1-L68C67

@terryzfeng terryzfeng added the question Further information is requested label Sep 11, 2024
@terryzfeng
Copy link
Member

@cchafe @gewang Our preliminary testing of chuck v1.5.3.3 (unreleased) with the new @import syntax has allowed us to add custom chugins into the IDE! If you put the IDE into dev mode, you should be able to try this out! Let me know if you get a chance to test it and more details coming soon!

@cchafe
Copy link
Author

cchafe commented Oct 29, 2024

very cool -- tested with examples/import/import-test-1.ck
I suppose the project exporter might be using an earlier chuck
///////////////////////////
<compiled.code>:2:1: syntax error Chuck.js:834:16
[2] @import "Foo.ck

@terryzfeng
Copy link
Member

terryzfeng commented Oct 31, 2024

Yes, you'll need to use the Development version of Chuck (File > Settings). ChucK 1.5.3.3+ will be able to use this new @import syntax!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants