ampproject / amp-toolbox

A collection of AMP tools making it easier to publish and host AMP pages.
Apache License 2.0
449 stars 243 forks source link

Support usage of the optimizer in environments without a filesystem. #1179

Closed samouri closed 3 years ago

samouri commented 3 years ago

summary

There are environments in which one would want to run the AMP Optimizer that do not have access to a filesystem. For example, any function as a service (FAAS) like GCP Cloud Functions or Cloudflare Workers.

For this case, it would be better to disable the fs cache entirely so that errors don't pollute the logs. Ideally it could be configured via the options bag on init, i.e. new AmpOptimizer({ fsCache: false })

sebastianbenz commented 3 years ago

This is already supported via new AmpOptimizer({ cache: false }). You can also provide an in memory alternative: new AmpOptimizer({ cache: new Map() }).

samouri commented 3 years ago

Awesome! Lets document in https://github.com/ampproject/amp-toolbox/tree/master/packages/optimizer#options