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

feat!: Return also architecture and platform #8

Merged
merged 5 commits into from
Jun 23, 2022
Merged

feat!: Return also architecture and platform #8

merged 5 commits into from
Jun 23, 2022

Conversation

danez
Copy link
Contributor

@danez danez commented Jun 22, 2022

Summary

This change will allow zisi to detect if a prebuilt binary is not built for the correct platform and provide a better warning to the user.

Diff of the public api / ts types

+export class BinaryInfo {
+  arch: number;
+  platform: number;
+  runtime?: number;
+}
+
-export function detect(data: Uint8Array): number | undefined;
+export function detect(data: Uint8Array): BinaryInfo;

BREAKING CHANGE: The result is now non-nullable and it is a struct with the fields architecture, platform, runtime. Runtime is nullable as we can only detect it for ELF binaries for now. If the architecture or platform cannot be detected it will throw.

Test plan

New tests were added. I'm also going to write integration tests in nodejs

Refs netlify/pillar-runtime#231
Fixes #5

BREAKING CHANGE: The result is now non-nullable and it is a struct with the fields `architecture`, `platform`, `runtime`. Runtime is nullable as we can only detect it for ELF binaries for now. If `platform` or `architecture` cannot be detected it will throw.
@danez danez added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Jun 22, 2022
Copy link

@mraerino mraerino left a comment

Choose a reason for hiding this comment

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

nice work! some comments

src/error.rs Outdated Show resolved Hide resolved
src/error.rs Outdated Show resolved Hide resolved
src/info.rs Outdated Show resolved Hide resolved
src/info.rs Outdated Show resolved Hide resolved
src/info.rs Outdated Show resolved Hide resolved
src/info.rs Outdated Show resolved Hide resolved
@danez danez requested review from mraerino and a team June 23, 2022 08:57
Copy link

@mraerino mraerino left a comment

Choose a reason for hiding this comment

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

LGTM

@danez danez merged commit 6aa4a95 into main Jun 23, 2022
@danez danez deleted the binary-info branch June 23, 2022 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
2 participants