-
Notifications
You must be signed in to change notification settings - Fork 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
Add JavaScript bindings via Wasm #360
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 tasks
- Remove npx use native tools without wrappers that doesn't introduce the npm and versioning consistency concerns in CI. - Remove yalc as a developer who wishes to import the lib can choose to use yalc, the repo doesn't need to prescribe it. - Remove visitor that modifies the schema because it results in two sets of schema being exported from the lib, the one defined on the types, and the one returned by the function. Also the visitor's modification of union types was buggy resulting in titles on union arms that were incorrect. Since this change is focused on a JS language binding we can revisit improving the schema in a separate PR and ideally do it on the types itself. - Remove the Schema/TryFrom conversions as the pattern doesn't allow an importer to select the JSON Schema version, and encourage use of the schemars types for doing so. - Changed the size optimization profile to be limited to the binding crate instead of all the crates in the repo. - Remove the rlib crate-type because it is unnecessary and multiple crate-type's will cause rustc to abandon LTO, resulting in a larger .wasm file. - Remove appveyor config that isn't used in the repos CI. - Move the generation of the bindings into the Makefile where this repo defines all its targets. - Remove all wasm-pack targets except the default bundler since longer term we will probably use the bundler target combined with webpack to generate a UMD package that can be used in nodejs and in the browser. - Added types and exceptions to the wasmbind-gen functions so that the JS side can deal with arrays directly without having to decode JSON, and exceptions without having to decode errors from the JSON response that may conflict with valid JSON outputs. - Separated the guess functionality into a separate function and made it behave more like the CLI guess function in that it returns all valid values, not just the first.
Superseded by: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
Add JavaScript bindings via Wasm
Why
Based on #347 and continuation of #351 by @willemneal.
The Rust XDR lib is the only implementation of the XDR<>JSON format. This is a shortcut to allowing the use of the format in JavaScript contexts as a hold over until there is a native implementation in JavaScript.
Everything in this change is experimental, even more experimental than the JSON format that is itself still relatively experimental.
Merging
Intended to be merged to
main
after #347.