Add warnings at build about access to globals
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 853
- Forks
- 662
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 8
Description
The same way we see is done in [lava-moat examples](https://github.com/LavaMoat/lavamoat-browserify-examples), the [lavamoat](https://github.com/lavamoat/lavamoat-browserify) tool uses [tofu](https://github.com/lavamoat/sesify-tofu), which can generate a file that emits every global variable that a module obviously requires to operate.
Many snap developers have found themselves hitting points where a module would not fully operate under SES because of some deeply-hidden `setTimeout` or `Uint8Array` in one of their dependencies.
We could add a [tofu](https://github.com/lavamoat/sesify-tofu) pre-process to the build step, and proactively warn developers when a module had some global requirement, and link to a blog post demonstrating how to do it.
For example:
- [Adding globals to plugin endowments](https://github.com/MetaMask/metamask-snaps-beta/pull/134)
- [Adding a whole module to plugin endowments](https://github.com/MetaMask/metamask-snaps-beta/pull/136)
Ref: https://github.com/MetaMask/snaps-cli/pull/46
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the tofu and LavaMoat examples first, then inspect the snaps build step referenced in the issue and the related snaps-cli pull request. Define how tofu output should be integrated and how warnings should point developers to the globals or modules needing endowments; done means builds proactively report those requirements with the intended guidance link.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100