Skip to content
This repository was archived by the owner on Oct 8, 2024. It is now read-only.

Add function signatures to metadata #39

Merged
merged 14 commits into from
Apr 3, 2024
Merged

Add function signatures to metadata #39

merged 14 commits into from
Apr 3, 2024

Conversation

mattjohnsonpint
Copy link
Member

@mattjohnsonpint mattjohnsonpint commented Mar 26, 2024

This PR is dependent on AssemblyScript/assemblyscript#2832, released with AssemblyScript 0.27.26.

Completes HYP-851

Note, the embedded metadata format has changed. It used to be split up in several wasm custom sections. It's now in one custom section named hypermode_meta, encoded as JSON. This will allow us to add more metadata in the future with minimal impact. This change, however, is incompatible with the current runtime. We'll need a corresponding change there as well.

There's also a lot of refactoring, including making the transform a TypeScript project of its own.

Also, we now emit metadata during the build, including a color ascii art logo (which we can update if desired). Example:

image

@mattjohnsonpint mattjohnsonpint requested a review from a team as a code owner March 26, 2024 20:11
Copy link

linear bot commented Mar 26, 2024

HYP-851 Extract function signatures

We'll need to be able to "read" the user's functions so we can map them to GraphQL.

In a compiler transform:

  1. Examine the module's exported functions
  2. Reconstruct the function signature:
    • Function name
    • Parameter names and types
    • Return type
  3. Gather type definitions used in the signature, recurse to include all referenced types
  4. Export function signatures and types to wasm metadata. (format TBD)

The runtime will use the metadata to generate corresponding GraphQL Schema.

@mattjohnsonpint mattjohnsonpint marked this pull request as draft March 26, 2024 20:11
Copy link

socket-security bot commented Mar 26, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@types/node@20.12.3 None +1 2.09 MB types
npm/@typescript-eslint/eslint-plugin@7.5.0 Transitive: environment, filesystem +47 40.6 MB jameshenry
npm/@typescript-eslint/parser@7.5.0 Transitive: environment, filesystem +39 35.8 MB jameshenry

🚮 Removed packages: npm/@typescript-eslint/eslint-plugin@7.4.0, npm/@typescript-eslint/parser@7.4.0, npm/assemblyscript@0.27.25

View full report↗︎

@mattjohnsonpint mattjohnsonpint marked this pull request as ready for review April 3, 2024 15:17
@mattjohnsonpint
Copy link
Member Author

I also updated some of the CI workflows, and added a new one that builds the example projects. You can see the hypermode build output in the logs here:

https://github.com/gohypermode/functions-as/actions/runs/8541390881/job/23400607095?pr=39#step:8:1

@mattjohnsonpint mattjohnsonpint merged commit 2bba3c1 into main Apr 3, 2024
8 checks passed
@mattjohnsonpint mattjohnsonpint deleted the mjp/transforms branch April 3, 2024 16:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants