-
-
Notifications
You must be signed in to change notification settings - Fork 673
Implement "export/import * from" #27
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
Comments
That's right, wildcard exports and imports are not handled yet. Going to take a look and marking this issue as enhancement until then :) |
Awesome, thank you! :) |
Any workaround in the meantime? |
Normal imports and exports should work, as should imports and exports of entire namespaces. Just the wildcard isn't implemented yet. |
Thanks what if I need to import a wasm,eg. compiled code from c++ to wasm then importing that to ts. Any viable way to make that work? Thanks. |
Linking wasms is a bit tricky currently. What I have in mind for this case is that the compiler could be provided with a base wasm, appending any additional code to it. would that work for your use case? Other than that there are tools like |
@dcodeIO thanks sorry about the late answer, i currently on vacations :). i was thinking about creating empty interfaces/type/mocks on typescript, using them from my main typescript code, then compiling to wasm and then replacing those mocks with real wasm implementations (that were previously compiled from c++ to wasm). that make sense? although not sure how to do that. if you have any suggestion will be helpful thanks. |
That should be possible as well. On the AssemblyScript side, you'd then have a .ts file that declare namespace MyCppModule {
export function someFunction(): i32;
}
// use it
MyCppModule.someFunction();
... And simply give |
@dcodeIO im missing something in here, how do i compile so my typescriptfile.wasm get linked to my cppfile.wasm file instead of the linked to the ts mock? |
Merging, or real linking, might be more complicated because a linker will have to move around data segments, table elements etc. and update their indexes where used. There is wasm-merge which might, or might not, help. My example above was based on the assumption that you'd then have two WebAssembly modules, with the exports of your cpp module being provided as imports to the typescript module. |
ok ill try to read about this, thanks 👍 |
Closed by #489 😄 |
…ation Uint8Array serialization
Bumps [assemblyscript](https://github.com/AssemblyScript/assemblyscript) from 0.9.2 to 0.9.4. - [Release notes](https://github.com/AssemblyScript/assemblyscript/releases) - [Commits](AssemblyScript/assemblyscript@v0.9.2...v0.9.4) Signed-off-by: dependabot-preview[bot] <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
* 'master' of github.com:jedisct1/wasa: Fixed the memory leak for Time.sleep (AssemblyScript#33) Improve Descriptor (AssemblyScript#25) Bump assemblyscript from 0.9.2 to 0.9.4 (AssemblyScript#27) Deps Optimizations + update dependencies (AssemblyScript#21) Bump @as-pect/cli from 2.7.0 to 2.8.1 (AssemblyScript#23) Bump assemblyscript from 0.9.1 to 0.9.2 (AssemblyScript#24) Fix Date.now to return milliseconds instead of microseconds (AssemblyScript#19) Bump assemblyscript from 0.9.0 to 0.9.1 (AssemblyScript#17)
So after creating #21
I now realize why I came to the conclusion import did not work.
If you try
export * from 'myfile'
, you will get the following console output:And if I remember correctly, imports dont work this way as well.
Thank you!
The text was updated successfully, but these errors were encountered: