mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
[@types/workbox-webpack-plugin] Update to v5 (#42444)
* Rename GenerateSWOptions.navigateFallbackBlackist to navigateFallbackDenylist * Rename navigateFallbackWhitelist to navigateFallbackAllowlist * Remove importWorkboxFrom option
This commit is contained in:
32
types/workbox-webpack-plugin/index.d.ts
vendored
32
types/workbox-webpack-plugin/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for workbox-webpack-plugin 4.1
|
||||
// Type definitions for workbox-webpack-plugin 5.0
|
||||
// Project: https://github.com/GoogleChrome/workbox/blob/master/packages/workbox-webpack-plugin, https://github.com/googlechrome/workbox
|
||||
// Definitions by: Kevin Groat <https://github.com/kgroat>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -109,24 +109,6 @@ export interface CommonOptions {
|
||||
*/
|
||||
swDest?: string;
|
||||
|
||||
/**
|
||||
* Valid values are `'cdn'`, `'local'`, and `'disabled'`.
|
||||
*
|
||||
* - `'cdn'`, the default, will use a URL for the Workbox runtime libraries hosted on a highly-available Google Cloud Storage instance.
|
||||
*
|
||||
* - `'local'` will copy all of the Workbox runtime libraries into a versioned directory alongside your generated service worker, and configure the service worker to use those local copies.
|
||||
* This option is provided for developers who would prefer to host everything themselves and not rely on the Google Cloud Storage CDN.
|
||||
*
|
||||
* - `'disabled'` will opt-out automatic behavior. It's up to you to host a local copy of the Workbox libraries at your preferred URL, and to pass in the correct path to `workbox-sw.js`
|
||||
* via the `importScripts` configuration option.
|
||||
*
|
||||
* - Note: In webpack, passing in a string corresponding to the webpack chunk name containing a custom Workbox runtime library bundle is also supported.
|
||||
*
|
||||
* @default 'cdn'
|
||||
* @example importWorkboxFrom: 'local'
|
||||
*/
|
||||
importWorkboxFrom?: 'cdn' | 'local' | 'disabled';
|
||||
|
||||
/**
|
||||
* By default, Workbox will precache assets regardless of which chunk the asset is part of.
|
||||
*
|
||||
@@ -350,24 +332,24 @@ export interface GenerateSWOptions extends CommonOptions {
|
||||
*
|
||||
* This is useful if only a subset of your site's URLs should be treated as being part of a Single Page App.
|
||||
*
|
||||
* If both navigateFallbackBlacklist and navigateFallbackWhitelist are configured, the blacklist takes precedent.
|
||||
* If both navigateFallbackDenylist and navigateFallbackAllowlist are configured, the blacklist takes precedent.
|
||||
*
|
||||
* @default []
|
||||
* @example navigateFallbackBlacklist: [/^\/_/, /admin/]
|
||||
* @example navigateFallbackDenylist: [/^\/_/, /admin/]
|
||||
*/
|
||||
navigateFallbackBlacklist?: RegExp[];
|
||||
navigateFallbackDenylist?: RegExp[];
|
||||
|
||||
/**
|
||||
* An optional array of regular expressions that restricts which URLs the configured navigateFallback behavior applies to.
|
||||
*
|
||||
* This is useful if only a subset of your site's URLs should be treated as being part of a Single Page App.
|
||||
*
|
||||
* If both navigateFallbackBlacklist and navigateFallbackWhitelist are configured, the blacklist takes precedent.
|
||||
* If both navigateFallbackDenylist and navigateFallbackAllowlist are configured, the blacklist takes precedent.
|
||||
*
|
||||
* @default []
|
||||
* @example navigateFallbackWhitelist: [/^\/pages/]
|
||||
* @example navigateFallbackAllowlist: [/^\/pages/]
|
||||
*/
|
||||
navigateFallbackWhitelist?: RegExp[];
|
||||
navigateFallbackAllowlist?: RegExp[];
|
||||
|
||||
/**
|
||||
* An required list of JavaScript files that should be passed to
|
||||
|
||||
@@ -13,7 +13,6 @@ import { GenerateSW, InjectManifest } from 'workbox-webpack-plugin';
|
||||
// With all of the examples
|
||||
plugin = new GenerateSW({
|
||||
swDest: 'custom-sw-name.js',
|
||||
importWorkboxFrom: 'local',
|
||||
// *Only* include assets that belong to these chunks:
|
||||
chunks: ['chunk-name-1', 'chunk-name-2'],
|
||||
// Exclude assets that belong to these chunks:
|
||||
@@ -84,9 +83,9 @@ import { GenerateSW, InjectManifest } from 'workbox-webpack-plugin';
|
||||
}],
|
||||
navigateFallback: '/app-shell',
|
||||
// Exempt all URLs that start with /_ or contain admin anywhere:
|
||||
navigateFallbackBlacklist: [/^\/_/, /admin/],
|
||||
navigateFallbackDenylist: [/^\/_/, /admin/],
|
||||
// Include URLs that start with /pages:
|
||||
navigateFallbackWhitelist: [/^\/pages/],
|
||||
navigateFallbackAllowlist: [/^\/pages/],
|
||||
importScripts: ['push-notifications.abcd1234.js'],
|
||||
// This will ignore all parameters:
|
||||
ignoreUrlParametersMatching: [/./],
|
||||
@@ -141,7 +140,6 @@ import { GenerateSW, InjectManifest } from 'workbox-webpack-plugin';
|
||||
// With all of the examples
|
||||
plugin = new InjectManifest({
|
||||
swDest: 'custom-sw-name.js',
|
||||
importWorkboxFrom: 'local',
|
||||
// *Only* include assets that belong to these chunks:
|
||||
chunks: ['chunk-name-1', 'chunk-name-2'],
|
||||
// Exclude assets that belong to these chunks:
|
||||
|
||||
Reference in New Issue
Block a user