
Security News
PEP 810 Proposes Explicit Lazy Imports for Python 3.15
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
@ampproject/amp-sw
Advanced tools
A service worker library to turn your AMP pages into PWA with network resiliency.
AMP service worker is a service worker library for your AMP documents.
Purpose: Enhance network resiliency and optimize AMP asset reuse for AMP documents.
Core use cases:
stale-while-revalidate
strategy for a longer duration than the default http response headers indicate.To take advantage of AMP service worker, you'll need to host a resource loaded into the browser. Start by following these steps:
amp-install-serviceworker
(https://amp.dev/documentation/components/amp-install-serviceworker) to your AMP documents and point it your service worker file.
e.g.<amp-install-serviceworker
src="https://www.your-domain.com/serviceworker.js"
data-iframe-src="https://www.your-domain.com/install-serviceworker.html"
layout="nodisplay">
</amp-install-serviceworker>
importScripts('https://cdn.ampproject.org/sw/amp-sw.js');
AMP_SW.init();
AMP_SW.init({
assetCachingOptions: [{
regexp: /\.(png|jpg|woff2|woff|css|js)/,
cachingStrategy: 'CACHE_FIRST',
}],
offlinePageOptions: {
url: '/offline.html',
assets: [],
},
});
The AMP service worker is built up of the following modules:
link rel=prefetch
. You can use this to prefetch links and serve them from the service worker cache for the next time.While amp-sw
is divided into smaller sub modules, the core funationality of this project relies on the Workbox project. The amp-sw
modules also extend parts of the Workbox project.
FAQs
A service worker library to turn your AMP pages into PWA with network resiliency.
We found that @ampproject/amp-sw demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 open source maintainers collaborating on the project.
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.
Security News
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.