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

Wasm wrapper fixes and tests #1284

Merged
merged 15 commits into from
Oct 7, 2022

Conversation

nerfZael
Copy link
Contributor

No description provided.

@nerfZael nerfZael changed the title Resolution and wasn wrapper fixes Resolution and wasm wrapper fixes Sep 27, 2022
@nerfZael nerfZael marked this pull request as ready for review September 27, 2022 19:02
@nerfZael nerfZael changed the title Resolution and wasm wrapper fixes Resolution and wasm wrapper fixes and tests Sep 27, 2022
@nerfZael nerfZael changed the title Resolution and wasm wrapper fixes and tests Wasm wrapper fixes and tests Sep 27, 2022
pileks
pileks previously approved these changes Sep 28, 2022
Copy link
Contributor

@pileks pileks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

krisbitney
krisbitney previously approved these changes Sep 30, 2022
Copy link
Contributor

@krisbitney krisbitney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good! I added some comments about things that it looks like you've already considered but that I thought were worth checking.

packages/js/wasm/src/helpers/createWasmWrapper.ts Outdated Show resolved Hide resolved
| GetManifestOptions,
fileReaderOrManifestOptions?: IFileReader | GetManifestOptions,
manifestOptions?: GetManifestOptions
): Promise<WasmWrapper> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this return a Result?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yah I think we should start propagating errors instead of throwing.

Copy link
Contributor Author

@nerfZael nerfZael Oct 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is intended to be used (and be very ergonomic) when the developer knows it will not fail (or doesn't care) because he's using compiled wrapper binaries (manifest and wasm module buffers).
E.g.

const client = new PolywrapClient({
  resolver: RecursiveResolver.from([
     ...,
     { uri: "some-uri", wrapper: await WasmWrapper.from(manifestBuffer, wamModule) }
  ])
});

If the developer wants a safe version (that returs Result) he can use WasmPackage.from().createWrapper() which is less ergonomic but gets the job done :)

Copy link
Contributor

@dOrgJelli dOrgJelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kris left two great points around propagating errors via Result<T, E> and optimizing the conditional statements. I think these things should be fixed before merging.

@nerfZael nerfZael dismissed stale reviews from krisbitney and pileks via 61eeecc October 6, 2022 19:53
@dOrgJelli dOrgJelli merged commit 38bc53a into origin-dev Oct 7, 2022
@dOrgJelli dOrgJelli deleted the nerfzael-resolution-and-wrapper-fixes branch April 10, 2023 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants