amp-toolbox-runtime-version

AMP Runtime versions

"amp-toolbox-runtime-version has been moved to @ampproject/toolbox-runtime-version"
Last updated 7 years ago by amp-toolbox .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install amp-toolbox-runtime-version 
SYNC missed versions from official npm registry.

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 amp-toolbox-runtime-version

Usage

Basic usage:

const runtimeVersion = require('amp-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);

Current Tags

  • 1.2.0-alpha.1                                ...           canary (7 years ago)
  • 1.2.0-alpha.2                                ...           latest (7 years ago)

12 Versions

  • 1.2.0-alpha.2                                ...           7 years ago
  • 1.2.0-alpha.1                                ...           7 years ago
  • 1.2.0-alpha.0                                ...           7 years ago
  • 0.2.7 [deprecated]           ...           7 years ago
  • 0.2.6 [deprecated]           ...           7 years ago
  • 0.2.5 [deprecated]           ...           7 years ago
  • 0.2.4 [deprecated]           ...           7 years ago
  • 0.2.3 [deprecated]           ...           7 years ago
  • 0.2.2 [deprecated]           ...           7 years ago
  • 0.2.1 [deprecated]           ...           8 years ago
  • 0.1.0 [deprecated]           ...           8 years ago
  • 0.0.2 [deprecated]           ...           8 years ago
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 5
Last Month 10
Dependencies (2)
Dev Dependencies (0)
None
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |