0) Prerequisites
- Node.js 18+ and npm installed
- A terminal on macOS/Linux/WSL (Windows PowerShell also works)
Tip: Use nvm to manage Node versions:
1) Create a project folder
2) Install CLI
3) Add the WIT world
Createnewton-provider.wit in the project root:
4) Implement your component logic
Createapp.js:
Note: Keep this import at the top level of your module; ComponentizeJS resolves virtual specifiers like 'newton:provider/[email protected]' when you build the component.
5) Build the component
policy.wasm in the project root — a component that:
- Imports
newton:provider/http.fetchfrom the host - Exports
run(input: string) -> result<string, string>
6) (Alternative) Programmatic build
Createcomponentize.mjs:
7) Next steps
-
Port the
op-simdirectory (in its entirety) from: op-sim GitHub into your project root. - Test your WASM binary by running op-sim: