-
Notifications
You must be signed in to change notification settings - Fork 241
Create one way to handle network dependencies (validator, etc.) #378
Copy link
Copy link
Closed
Description
AMP has some dependencies on a few resources hosted on cdn.ampproject.org: a document is valid iff the validator hosted at cdn.ampproject.org says it is, the definitive source of runtime version comes from this host, etc.
For various reasons, it's not always a good idea to actually fetch these resources every time a module is invoked. (e.g. if attempting to validate multiple files it's not feasible/reasonable to fetch the validator for every file that needs to be validated; running tests should be possible without network access.)
Various AMP Toolbox modules (and friends) have created different approaches to dealing with these problems, see:
- the linter, which looks for a local file, then hits network
- runtime-version, which uses onebehindfetch
- the validator, which defaults to network
- validator rules, which consults an options object
- ampbench (not part of toolbox, but related), which caches to disk on startup, and is then updated manually
We should probably come up with a single mechanism for handling these use cases.
Reactions are currently unavailable