Socket
Socket
Sign inDemoInstall

@ampproject/toolbox-runtime-version

Package Overview
Dependencies
11
Maintainers
16
Versions
40
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @ampproject/toolbox-runtime-version

AMP Runtime versions


Version published
Weekly downloads
53K
decreased by-0.12%
Maintainers
16
Install size
618 kB
Created
Weekly downloads
 

Changelog

Source

2.9.0 (2022-06-23)

:rocket: Enhancement
  • cloudflare-optimizer-scripts
    • #1318 Add support for Opaque redirects (@abdulhannanali)
  • optimizer
:bug: Bug Fix
  • optimizer
    • #1319 Fix i-amphtml-sizer responsive issue (@ediamin)
    • #1312 More robust auto extension import (@sebastianbenz)
    • #1303 Fix for issue #1302: "SSR: Duplicated ids in rendered markup, if there are nodes with attributes 'media', 'heights' or 'sizes'" (@DK-Stern)
    • #1305 Fix for issue #1304: "SSR: Transforming of nodes with attribute 'heights' fails, if value contains multiple media queries" (@DK-Stern)
:house: Internal
  • cache-url, cli, cloudflare-optimizer-scripts, linter, optimizer-docker, optimizer, page-experience, update-cache
  • cache-list, cache-url, cli, cloudflare-optimizer-scripts, core, cors, linter, optimizer-docker, optimizer-express, optimizer, page-experience, runtime-fetch, runtime-version, script-csp, update-cache, validator-rules
Committers: 6

Readme

Source

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

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);

Keywords

FAQs

Last updated on 23 Jun 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc