Skip to content

Releases: GoogleChrome/workbox

Workbox v3.0.0-alpha.5

12 Jan 19:33
Compare
Choose a tag to compare
Pre-release

🎉 What's New?

  • #1138 Plugins can now be added to workbox-precaching; this is useful for adding plugins like workbox-broadcast-cache-update.
  • #1149 workbox-webpack-plugin now supports {test, include, exclude}-style filtering, providing an additional way of controlling which assets are included in the precache manifest. By default, assets matching /\.map$/ or /^manifest\.js(?:on)$/ are excluded.
  • #1154 workbox-precaching supports two new configuration options, cleanUrls and urlManipulation. By default cleanUrls is true and will check the precache for a with .html on the end (i.e. /about will check for /about.html. urlManipulation can be a function enabling you to express a mapping between the server-side URL and the underlying local file.

🐛 What's Fixed?

  • #1130 A cleaner service worker template.
  • #1127, #1128, #1126, #1133, #1132 Various improvements to the test suite.
  • #1139 Fix for an IDB bug, which could prevent v2 to v3 migrations from succeeding.
  • #1155 Fix for a bug that could cause workbox-background-sync to enter a loop of repeated registrations.
  • #1168 A fix for broken expiration.

⚠️ Breaking Changes

  • #1137 The importWorkboxFromCDN boolean option, which was supported in previous v3 alpha releases of workbox-build, has been replaced by importWorkboxFrom. Valid values for importWorkboxFrom are 'cdn', 'local', null, or (when used from the workbox-webpack-plugin) the name of a webpack chunk.
  • #1143 The workbox-webpack-plugin module now exposes two top-level webpack plugins, named GenerateSW and InjectManifest. Developers need to explicitly use one of these two plugins, depending on whether they want to create a new service worker file each time they run their build (GenerateSW) or whether they want to use an existing service worker file but inject updated precache manifest information each time they build (InjectManifest).
  • #1160 The valid runtimeCaching options have been updated, representing a break from the older syntax supported by sw-precache. The following example contains the full set of currently supported options:
runtimeCaching: [{
  urlPattern: /api/,
  handler: 'networkFirst',
  options: {
    networkTimeoutSeconds: 10,
    cacheName: 'my-api-cache',
    expiration: {
      maxEntries: 5,
      maxAgeSeconds: 60,
    },
    cacheableResponse: {
      statuses: [0, 200],
      headers: {'x-test': 'true'},
    },
    broadcastUpdate: {
      channelName: 'my-update-channel',
    },
    plugins: [
      {cacheDidUpdate: () => /* custom plugin code */}
    ],
  },
}]

Workbox v3.0.0-alpha.4

09 Jan 18:57
Compare
Choose a tag to compare
Pre-release

🎉 What's New?

  • #1138 Plugins can now be added to workbox-precaching; this is useful for adding plugins like workbox-broadcast-cache-update.
  • #1149 workbox-webpack-plugin now supports {test, include, exclude}-style filtering, providing an additional way of controlling which assets are included in the precache manifest. By default, assets matching /\.map$/ or /^manifest\.js(?:on)$/ are excluded.
  • #1154 workbox-precaching supports two new configuration options, cleanUrls and urlManipulation. By default cleanUrls is true and will check the precache for a with .html on the end (i.e. /about will check for /about.html. urlManipulation can be a function enabling you to express a mapping between the server-side URL and the underlying local file.

🐛 What's Fixed?

  • #1130 A cleaner service worker template.
  • #1127, #1128, #1126, #1133, #1132 Various improvements to the test suite.
  • #1139 Fix for an IDB bug, which could prevent v2 to v3 migrations from succeeding.
  • #1155 Fix for a bug that could cause workbox-background-sync to enter a loop of repeated registrations.

⚠️ Breaking Changes

  • #1137 The importWorkboxFromCDN boolean option, which was supported in previous v3 alpha releases of workbox-build, has been replaced by importWorkboxFrom. Valid values for importWorkboxFrom are 'cdn', 'local', null, or (when used from the workbox-webpack-plugin) the name of a webpack chunk.
  • #1143 The workbox-webpack-plugin module now exposes two top-level webpack plugins, named GenerateSW and InjectManifest. Developers need to explicitly use one of these two plugins, depending on whether they want to create a new service worker file each time they run their build (GenerateSW) or whether they want to use an existing service worker file but inject updated precache manifest information each time they build (InjectManifest).
  • #1160 The valid runtimeCaching options have been updated, representing a break from the older syntax supported by sw-precache. The following example contains the full set of currently supported options:
runtimeCaching: [{
  urlPattern: /api/,
  handler: 'networkFirst',
  options: {
    networkTimeoutSeconds: 10,
    cacheName: 'my-api-cache',
    expiration: {
      maxEntries: 5,
      maxAgeSeconds: 60,
    },
    cacheableResponse: {
      statuses: [0, 200],
      headers: {'x-test': 'true'},
    },
    broadcastUpdate: {
      channelName: 'my-update-channel',
    },
    plugins: [
      {cacheDidUpdate: () => /* custom plugin code */}
    ],
  },
}]

Workbox v3.0.0-alpha.3

13 Dec 19:27
Compare
Choose a tag to compare
Pre-release

🎉 Whats New

  • #1108 Added workbox-range-requests to v3
  • #1104 globFollow and globStrict added to workbox-build. This means symbolic links will be followed when searching for files and any errors discovered by glob will now throw.

🐛 Whats Fixed

  • #1111 Fixed a bug in precaching where indexedDB wasn't updating correctly
  • #1112 Fixes updates to precaching indexedDB schema when upgrading from V2 to V3
  • #1116 Fixes a grouping issue in logs if precaching fails.

⚠️ Breaking Changes

  • #1105 The default destination of a service worker for the CLI has changed from 'build/' to the location of the globDirectory (i.e. the directory searched for files to precache).
  • #1079 workbox-cache-expiration now throws an error if you attempt to use it on the runtime cache (i.e. the shared cache used by all strategies by default)

Workbox v3.0.0-alpha.2

01 Dec 22:30
Compare
Choose a tag to compare
Pre-release

Overview of Workbox V3

Workbox's v3 release represents a significant refactoring of the existing codebase.

🎉 Whats New

Minimize the size of Workbox

The amount of service worker runtime code that's downloaded and executed has been reduced. Instead of opting everyone in to a monolithic bundle, only code for the specific features that you're using will be imported at runtime.

Workbox has a CDN

We provide a fully supported, Google Cloud Storage-based CDN hosting as the canonical option for accessing the Workbox runtime libraries, making it easier to get up and running with Workbox.

Better Debugging and Logs

The debugging and logging experience has been vastly improved. Debug logs are enabled by default whenever Workbox is used from a localhost origin and all logging and assertions are stripped from the production builds

Improved webpack Plugin

workbox-webpack-plugin integrates more closely with the webpack build process, allowing for a zero-config use case when you want to precache all the assets in the build pipeline.

Achieving these goals, and cleaning up some aspects of the previous interface that felt awkward or led to antipatterns, required introducing a number of breaking changes in the v3 release.

⚠️ Breaking Changes

Build Configuration

The following changes affect the behavior of all of our build tools (workbox-build, workbox-cli, workbox-webpack-plugin), which share a common set of configuration options.

  • The 'fastest' handler name was previously valid, and treated as an alias for 'staleWhileRevalidate', when configuring runtimeCaching. It's no longer valid, and developers should switch to using 'staleWhileRevalidate' directly. (#915)

  • Several runtimeCaching.options property names have been updated, and additional parameter validation is in place that will cause a build to fail if an invalid configuration is used. See the documentation for runtimeCaching for a list of currently supported options. (#1096).

workbox-background-sync

  • There are significant changes to the API surface in v3. Developers should consult the documentation for current guidance. (#868)

workbox-cache-expiration

  • The plugin API has stayed the same, however there are significant API changes impacting developers who use it as a standalone class. Consult the documentation for the updated API surface. (#920)

workbox-cli

  • The set of command line options, and the way of reading in stored configuration, have all changed. Developers should consult the documentation or run the CLI with the --help flag for guidance. (#865)

  • Support for the workbox-cli alias for the binary script has been removed. The binary can now only be accessed as workbox. (#730)

workbox-google-analytics

  • While the API surface has not changed, the underlying implementation was updated to use the workbox-background-sync library, and therefore rely on the Background Sync API. (#244)

workbox-precaching

  • The precache() method previously performed both the cache modifications and set up routing to serve cached entries. Now, precache() only modifies cache entries, and a new method, addRoute(), has been exposed to register a route to serve those cached responses. Developers who want the previous, two-in-one functionality can switch to calling precacheAndRoute(). This enables more developer flexibility. (#886).

  • workbox-broadcast-update will no longer be automatically configured to announce cache updates for precached assets. To get this behavior, you can add the plugin manually. (#1073)

workbox-routing

  • The Router will now evaluate Routes in a first-registered-wins order. This is the opposite order of Route evaluation that was used in v2, where the last-registered Route would be given precedence. (#845)

  • The ExpressRoute class, and support for "Express-style" wildcards have been removed. This reduces the size of workbox-routing considerably. Strings used as the first parameter to workbox.routing.registerRoute() will now be treated as exact matches. Wildcard or partial matches should be handled by RegExps—using any RegExp that matches against part or all of the request URL can trigger a route. (#1012)

  • The addFetchListener() helper method of the Router class has been removed. Developers can either add their own fetch handler explicitly, or use the interface provided by workbox.routing, which will implicitly create a fetch handler for them. (#914)

  • The registerRoutes() and unregisterRoutes() methods were removed. The versions of those methods that operate on a single Route were not changed, and developers who need to register or unregister multiple routes at once should make a series of calls to registerRoute() or unregisterRoute() instead. (#856)

workbox-strategies (formerly know as workbox-runtime-caching)

  • The workbox-runtime-caching module is now officially known as workbox-strategies, and has been published on npm under its new name. (#1045)

  • The syntax for specifying plugins when configuring a strategy has changed. Each plugin needs to be explicitly listed in the plugins property of the strategy's configuration. (#1071)

  • Defining a strategy that applies to the default cache name and which uses cache expiration is no longer supported. When configuring cache expiration, you must also configure a specific cache name. (#1014)

  • The cacheWillMatch lifecycle method has been renamed to cachedResponseWillBeUsed. This should not be a visible change for developers unless they wrote their own plugins that reacted tocacheWillMatch. (#713)

workbox-sw

  • The handleFetch option has been removed. (#1002)

  • skipWaiting and clientsClaim are no longer options passed to the WorkboxSW constructor. Instead, they have been changed to methods of the same name that could be called on a WorkboxSW instance. (#853)

workbox-webpack-plugin

  • The plugin has been substantially rewritten, and in many cases, can be used in a "zero-configuration" mode. Consult the documentation for the updated API surface. (#696)

Workbox v3.0.0-alpha.1

01 Dec 22:30
Compare
Choose a tag to compare
Pre-release
v3.0.0-alpha.1

Workbox 2.1.2

16 Nov 21:54
Compare
Choose a tag to compare

What's new?

The 2.1.2 release contains a deprecation warning that's logged when Express-style routes containing wildcard characters are passed in to WorkboxSW.registerRoute().

Developers are urged to use RegExps as an alternative, in preparation for the deprecation in Workbox v3.

Notable PRs

Workbox 2.1.1

02 Nov 14:55
Compare
Choose a tag to compare

What's new?

The 2.1.1 release contains a small change to ensure that the workbox-webpack-plugin is compatible with node 4.x.

Notable PRs

Workbox 2.1.0

05 Oct 23:02
Compare
Choose a tag to compare

What's new?

The 2.1.0 release fixes a longstanding issue in workbox-sw that could cause routes established via router.registerRoute() to inadvertently take precedence over the internal route that is intended for precached assets.

As described in this issue, the impacted code might look like:

// The internal route to serve the precached assets *should* have
// taken precedence... but prior to the 2.1.0 release, it didn't.
workboxSW.precache([]);

// This is a very broad wildcard match!
// Previously, it would cause precached assets to be served network-first.
// As of the 2.1.0 release, it will no longer apply to precached assets.
workboxSW.router.registerRoute(
  '/*',
  workboxSW.strategies.networkFirst()
);

Our documentation states that precached assets are always served via a cache-first route, so this previous behavior is considered a bug.

If, for some reason, your service worker depended on this buggy behavior, please update your code prior to upgrading to 2.1.0.

Bug Fixes

Workbox 2.0.3

26 Sep 14:56
Compare
Choose a tag to compare

What's new?

The 2.0.3 release adds babel-preset-env-based transpilation into the build process for our browser libraries, currently targeted at compatibility with Chrome 51 and above. Following this change, the Workbox libraries should work within Samsung Browser 5 (which shares code with Chrome 51), while maintaining its existing compatibility with "evergreen" browsers.

Bug Fixes

2.0.2 RC1

24 Sep 09:50
Compare
Choose a tag to compare

This release adds support for stable versions of Samsung Browser. Workbox was previously not transpiling async/await functions but now uses babel-preset-env to support versions of Chrome >= 51.