Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gabbifish/amp-transform-wasm
A WASM version of the AMP transform library work for use in Cloudflare Workers
https://github.com/gabbifish/amp-transform-wasm
Last synced: 27 days ago
JSON representation
A WASM version of the AMP transform library work for use in Cloudflare Workers
- Host: GitHub
- URL: https://github.com/gabbifish/amp-transform-wasm
- Owner: gabbifish
- Created: 2019-03-28T23:29:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-03-29T21:02:16.000Z (over 5 years ago)
- Last Synced: 2024-08-03T03:04:08.041Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 4.16 MB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AMP-transformer
This repository contains a go/WASM port of the [AMP packager transform library](https://github.com/ampproject/amppackager/tree/master/transformer). It is derived from Devin Mullin's work towards minimizing the Go WASM runtime so Go/WASM binaries can be run within CF Workers' 128-MB heap memory limit.## Building the AMP transformation
You'll need to compile a separate branch of Go that contains changes to the runtime such that
the amount of heap memory used can reasonably fit in a worker.```bash
git clone https://github.com/gabbifish/go
cd go/
git checkout gabbi-small
src/make.bash
```Then use it to build the wasm binary from worker.go:
```bash
cd go-wasm/
GOOS=js GOARCH=wasm path/to/custom-go/bin/go build -o main.wasm main.go
```Upload the wasm to Cloudflare Workers with name `TRANSFORM_WASM`.
## Building for Workers
First, make sure to pull node dependencies:
```bash
npm install
```then, to build for workers, run
```bash
npm run build
```
The final outputted workers code is in the `dist/` directory. There is a fully minified and less minified version of the code, so you can debug the code in the workers console using the less minified version before deploying the fully minified version.## Todo:
1. Set up makefile with nice API calls for easily uploading the worker and the wasm binary.