[Deprecated] A node module to generate service worker code that will precache specific resources so they work offline.
The 5.2.1
is a small patch release the bumps the dependency on update-notifier
to a version that is fully compatible with recent node
releases.
Thanks to @markFromMST and @cdanielsen for reporting and fixing the update-notifier
dependency issue.
The 5.2.0
release includes support for using Buffer
objects, in addition to the previously supported String
s and glob patterns, as the values in dynamicUrlToDependencies
.
It also includes a number of enhancements and clarifications to the project's README.
Thanks to @papandreou, @mbj36, @mlcdf, and @sp00m for their contributions!
The 5.1.1
includes a change to always remove the hash (a.k.a. URL fragment) portion of the a request's URL before determining whether sw-precache
should respond to it. This accounts for new behavior in Chrome and Firefox, as per an update to the service worker specification.
It also fixes a bug in the sw-toolbox
integration that preventing the successResponses
option from being set properly.
Thanks to @whmountains for reporting the underlying issue with hashes, and to @mahwy for their fix to the successResponses
configuration.
The 5.1.0
release includes one new piece of functionality, as well as a number of fixes for broken links in the documentation.
As described by @HenrikJoreteg, you can now supply a string as the value corresponding to a given "dynamic" URL, and the hash of that string will be used to determine whether or not the cache entry for that URL needs to be updated.
Thanks to @HenrikJoreteg, @natecox, @vernondegoede, @rmacklin, and @denar90!
The 5.0.0
release includes a number of significant changes, including one that will require all existing caches to be repopulated with fresh entries.
As described in more detail in this issue, browsers have imposed an additional restriction that prevents a service worker from responding to a navigation request with a response that was obtained via a redirect.
In practice, this is unlikely to affect most sw-precache
users, but it did affect some who explicitly had HTTP redirects set up covering their /
and /index.html
URLs.
To accommodate this new restriction, sw-precache
will now create a "clean" copy of any redirected responses prior to added them to its caches. The 5.0.0
release of sw-precache
will impose a one-time repopulation all of its caches after you deploy an updated service worker, and those new cached entries will contain "clean" entries for redirected responses.
node versions less than 4.0.0
are now officially end-of-lifed, and we have dropped support for them in the latest sw-precache
release. In practice, that means we've been able to update some dependencies in our package.json
to point to newer releases that in turn required node 4.0.0
.
dontCacheBustUrlsMatching
check against the URL's pathThis was always the intentional behavior, but previously developers who used dontCacheBustUrlsMatching
would find that the regular expression was applied to the full URL, including the hostname. As of this latest release, the regular expression is only applied to the URL's path, so that it could pick up versioning information that's explicitly included in the file names of resources.
update-notifier
to the CLITo notify users of the CLI about new releases moving forward, we've added update-notifier
to the CLI.
Thanks to @bertho-zero for their contributions!
The 4.3.0
release includes a change to explicitly set the redirect: 'follow'
option on requests used for precaching.
It also includes a fix for a bug that prevented a regular expression from being used for the cache.origin
configuration option in runtimeCaching
, and a bug that prevented navigateFallbackWhitelist
from being set via the CLI.
redirect: follow
on the precaching requests.
Thanks to @JLHwung, @mikestead, and @kevinphelps for their contributions!
The 4.2.3
release includes fixes to the command-line interface, ensuring that both the stripPrefixMulti
and dontCacheBustUrlsMatching
options are supported.
stripPrefixMulti
Thanks @Fridus for their contribution.
The 4.2.0
release brings the devDependencies/dependencies
for the project up to date, including requiring the latest release of sw-toolbox
.
It also clarifies the documentation and examples around the external configuration file passed to the sw-precache
command-line-interface via the --config
option. The code has always supported either a JSON file or a CommonJS module for configuration, but passing in a CommonJS module offers a cleaner syntax and allows developers to use JavaScript objects, like regular expressions, that can't be expressed as JSON. The examples now encourage the use of CommonJS module for the --config
value.
Thanks to @mactookmyname for their contribution leading to this release.
The 4.1.0
release brings with it a number of fixes to make the command-line sw-precache
interface compatible with a wider array of configuration options, along with additional control over the generated service worker file's lifecycle, and clarifications and enhancements to the documentation.
It also fixes a bug that prevented the service worker from falling back to a network response when a cached entry is manually deleted from the cache.
skipWaiting
and clientsClaim
optionsDevelopers can now opt-out of using skipWaiting()
and clients.claim()
, in the generated service worker file, via the new skipWaiting
and clientsClaim
options. They both are enabled by default, which matches the behavior in previous versions of sw-precache
.
Thanks to @yangchenyun, @eauc, @dandv, @TalAter, @Alexendoo, @TimvdLippe, @asolove, and @ithinkihaveacat for their PR contributions!