Translates canonical URLs into AMP Cache URL format according to the AMP Cache URL specification. Version 1.2.0-alpha.2 is the latest pre-release; the package is stable but not actively developed. It supports multiple module formats (ESM, CommonJS, UMD) and includes both human-readable and SHA256 fallback cache URLs. Key differentiators: official AMP project tooling, support for cache URL creation and subdomain transformation, and handling of invalid URLs via SHA256.
npm install amp-toolbox-cache-urlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to transform a canonical URL into an AMP Cache URL and create a curls subdomain using the library's main functions.
Use const {createCacheUrl} = require('amp-toolbox-cache-url'); or const ampToolboxCacheUrl = require('amp-toolbox-cache-url'); ampToolboxCacheUrl.createCacheUrl(...).Use ESM imports: import {createCacheUrl} from 'amp-toolbox-cache-url';Use .then()/.catch() or async/await.
Install: npm install amp-toolbox-cache-url
Use require('amp-toolbox-cache-url').createCacheUrl(...) instead.Run: npm install amp-toolbox-cache-url
Include a script tag: <script src="node_modules/amp-toolbox-cache-url/dist/amp-toolbox-cache-url.umd.js"></script>
No dependency data recorded yet.