2.8.0 • Published 4 months ago

@ampproject/toolbox-runtime-version v2.8.0

Weekly downloads
976,514
License
Apache-2.0
Repository
github
Last release
4 months ago

AMP Runtime Version

npm version

Use it to query cdn.ampproject.org for the current release or canary version of the AMP Runtime. Uses a stale-while-revalidate caching strategy to avoid network requests in the critical path.

You can use the API to re-write AMP runtime URLs to their versioned counter parts to improve browser caching, e.g. to replace:

https://cdn.ampproject.org/v0.css

with:

https://cdn.ampproject.org/rtv/001515617716922/v0.css

Installation

Install via:

npm install @ampproject/toolbox-runtime-version@beta

Usage

Basic usage:

const runtimeVersion = require('@ampproject/toolbox-runtime-version');

// Release version
runtimeVersion.currentVersion().then(version => {
  console.log(version);
});

// Canary version
runtimeVersion.currentVersion({canary: true}).then(version => {
  console.log(version);
});

// Rewriting cache URLs
const ampRuntimeUrl = 'https://cdn.ampproject.org/v0.js';
const version = await runtimeVersion.currentVersion();
const versionedAmpRuntimeUrl = ampRuntimeUrl.replace(
  'https://cdn.ampproject.org/',
  'https://cdn.ampproject.org/rtv/' + version + '/'
);
console.log(versionedAmpRuntimeUrl);
3.0.0-canary.2

4 months ago

2.8.0

12 months ago

2.8.0-canary.15

1 year ago

2.8.0-canary.9

1 year ago

2.8.0-canary.0

1 year ago

2.7.4

1 year ago

2.7.2

1 year ago

2.7.1

1 year ago

2.7.1-alpha.0

1 year ago

2.7.0-alpha.1

2 years ago

2.6.0

2 years ago

2.5.4

2 years ago

2.5.1

2 years ago

2.5.0

2 years ago

2.4.0-alpha.1

2 years ago

2.4.0-alpha.0

2 years ago

2.3.1

2 years ago

2.3.0

2 years ago

2.2.0

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

2.0.0-alpha.7

2 years ago

2.0.0-alpha.4

2 years ago

2.0.0-alpha.0

2 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.1.0-beta.1

3 years ago

1.1.0-beta.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

1.0.0-beta.9

3 years ago

1.0.0-beta.8

3 years ago

1.0.0-beta.7

3 years ago

1.0.0-beta.6

3 years ago

1.0.0-beta.5

3 years ago

1.0.0-beta.4

3 years ago

1.0.0-beta.3

3 years ago

1.0.0-beta.2

3 years ago

1.0.0-beta.1

3 years ago

1.0.0-beta.0

3 years ago