Skip to content

Commit

Permalink
Auto-generated JSON updates (#3021)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffposnick committed Jan 31, 2022
1 parent 7b3746f commit e63ad2d
Show file tree
Hide file tree
Showing 5 changed files with 172 additions and 2 deletions.
45 changes: 44 additions & 1 deletion packages/workbox-build/src/schema/GenerateSWOptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"type": "object",
"properties": {
"additionalManifestEntries": {
"description": "A list of entries to be precached, in addition to any entries that are\ngenerated as part of the build configuration.",
"type": "array",
"items": {
"anyOf": [
Expand All @@ -16,27 +17,33 @@
}
},
"dontCacheBustURLsMatching": {
"description": "Assets that match this will be assumed to be uniquely versioned via their\nURL, and exempted from the normal HTTP cache-busting that's done when\npopulating the precache. While not required, it's recommended that if your\nexisting build process already inserts a `[hash]` value into each filename,\nyou provide a RegExp that will detect that, as it will reduce the bandwidth\nconsumed when precaching.",
"$ref": "#/definitions/RegExp"
},
"manifestTransforms": {
"description": "One or more functions which will be applied sequentially against the\ngenerated manifest. If `modifyURLPrefix` or `dontCacheBustURLsMatching` are\nalso specified, their corresponding transformations will be applied first.",
"type": "array",
"items": {}
},
"maximumFileSizeToCacheInBytes": {
"description": "This value can be used to determine the maximum size of files that will be\nprecached. This prevents you from inadvertently precaching very large files\nthat might have accidentally matched one of your patterns.",
"default": 2097152,
"type": "number"
},
"modifyURLPrefix": {
"description": "A mapping of prefixes that, if present in an entry in the precache\nmanifest, will be replaced with the corresponding value. This can be used\nto, for example, remove or add a path prefix from a manifest entry if your\nweb hosting setup doesn't match your local filesystem setup. As an\nalternative with more flexibility, you can use the `manifestTransforms`\noption and provide a function that modifies the entries in the manifest\nusing whatever logic you provide.",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"globFollow": {
"description": "Determines whether or not symlinks are followed when generating the\nprecache manifest. For more information, see the definition of `follow` in\nthe `glob` [documentation](https://github.com/isaacs/node-glob#options).",
"default": true,
"type": "boolean"
},
"globIgnores": {
"description": "A set of patterns matching files to always exclude when generating the\nprecache manifest. For more information, see the definition of `ignore` in\nthe `glob` [documentation](https://github.com/isaacs/node-glob#options).",
"default": [
"**/node_modules/**/*"
],
Expand All @@ -46,6 +53,7 @@
}
},
"globPatterns": {
"description": "Files matching any of these patterns will be included in the precache\nmanifest. For more information, see the\n[`glob` primer](https://github.com/isaacs/node-glob#glob-primer).",
"default": [
"**/*.{js,css,html}"
],
Expand All @@ -55,10 +63,12 @@
}
},
"globStrict": {
"description": "If true, an error reading a directory when generating a precache manifest\nwill cause the build to fail. If false, the problematic directory will be\nskipped. For more information, see the definition of `strict` in the `glob`\n[documentation](https://github.com/isaacs/node-glob#options).",
"default": true,
"type": "boolean"
},
"templatedURLs": {
"description": "If a URL is rendered based on some server-side logic, its contents may\ndepend on multiple files or on some other unique string value. The keys in\nthis object are server-rendered URLs. If the values are an array of\nstrings, they will be interpreted as `glob` patterns, and the contents of\nany files matching the patterns will be used to uniquely version the URL.\nIf used with a single string, it will be interpreted as unique versioning\ninformation that you've generated for a given URL.",
"type": "object",
"additionalProperties": {
"anyOf": [
Expand All @@ -75,6 +85,7 @@
}
},
"babelPresetEnvTargets": {
"description": "The [targets](https://babeljs.io/docs/en/babel-preset-env#targets) to pass\nto `babel-preset-env` when transpiling the service worker bundle.",
"default": [
"chrome >= 56"
],
Expand All @@ -84,20 +95,24 @@
}
},
"cacheId": {
"description": "An optional ID to be prepended to cache names. This is primarily useful for\nlocal development where multiple sites may be served from the same\n`http://localhost:port` origin.",
"type": [
"null",
"string"
]
},
"cleanupOutdatedCaches": {
"description": "Whether or not Workbox should attempt to identify and delete any precaches\ncreated by older, incompatible versions.",
"default": false,
"type": "boolean"
},
"clientsClaim": {
"description": "Whether or not the service worker should [start controlling](https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#clientsclaim)\nany existing clients as soon as it activates.",
"default": false,
"type": "boolean"
},
"directoryIndex": {
"description": "If a navigation request for a URL ending in `/` fails to match a precached\nURL, this value will be appended to the URL and that will be checked for a\nprecache match. This should be set to what your web server is using for its\ndirectory index.",
"type": [
"null",
"string"
Expand All @@ -108,53 +123,61 @@
"type": "boolean"
},
"ignoreURLParametersMatching": {
"description": "Any search parameter names that match against one of the RegExp in this\narray will be removed before looking for a precache match. This is useful\nif your users might request URLs that contain, for example, URL parameters\nused to track the source of the traffic. If not provided, the default value\nis `[/^utm_/, /^fbclid$/]`.",
"type": "array",
"items": {
"$ref": "#/definitions/RegExp"
}
},
"importScripts": {
"description": "A list of JavaScript files that should be passed to\n[`importScripts()`](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/importScripts)\ninside the generated service worker file. This is useful when you want to\nlet Workbox create your top-level service worker file, but want to include\nsome additional code, such as a push event listener.",
"type": "array",
"items": {
"type": "string"
}
},
"inlineWorkboxRuntime": {
"description": "Whether the runtime code for the Workbox library should be included in the\ntop-level service worker, or split into a separate file that needs to be\ndeployed alongside the service worker. Keeping the runtime separate means\nthat users will not have to re-download the Workbox code each time your\ntop-level service worker changes.",
"default": false,
"type": "boolean"
},
"mode": {
"description": "If set to 'production', then an optimized service worker bundle that\nexcludes debugging info will be produced. If not explicitly configured\nhere, the `process.env.NODE_ENV` value will be used, and failing that, it\nwill fall back to `'production'`.",
"default": "production",
"type": [
"null",
"string"
]
},
"navigateFallback": {
"description": "If specified, all\n[navigation requests](https://developers.google.com/web/fundamentals/primers/service-workers/high-performance-loading#first_what_are_navigation_requests)\nfor URLs that aren't precached will be fulfilled with the HTML at the URL\nprovided. You must pass in the URL of an HTML document that is listed in\nyour precache manifest. This is meant to be used in a Single Page App\nscenario, in which you want all navigations to use common\n[App Shell HTML](https://developers.google.com/web/fundamentals/architecture/app-shell).",
"default": null,
"type": [
"null",
"string"
]
},
"navigateFallbackAllowlist": {
"description": "An optional array of regular expressions that restricts which URLs the\nconfigured `navigateFallback` behavior applies to. This is useful if only a\nsubset of your site's URLs should be treated as being part of a\n[Single Page App](https://en.wikipedia.org/wiki/Single-page_application).\nIf both `navigateFallbackDenylist` and `navigateFallbackAllowlist` are\nconfigured, the denylist takes precedent.",
"type": "array",
"items": {
"$ref": "#/definitions/RegExp"
}
},
"navigateFallbackDenylist": {
"description": "An optional array of regular expressions that restricts which URLs the\nconfigured `navigateFallback` behavior applies to. This is useful if only a\nsubset of your site's URLs should be treated as being part of a\n[Single Page App](https://en.wikipedia.org/wiki/Single-page_application).\nIf both `navigateFallbackDenylist` and `navigateFallbackAllowlist` are\nconfigured, the denylist takes precedence.",
"type": "array",
"items": {
"$ref": "#/definitions/RegExp"
}
},
"navigationPreload": {
"description": "navigationPreload is only valid when runtimeCaching is configured. However,\nthis can't be expressed via TypeScript, so it's enforced via runtime logic.",
"description": "Whether or not to enable\n[navigation preload](https://developers.google.com/web/tools/workbox/modules/workbox-navigation-preload)\nin the generated service worker. When set to true, you must also use\n`runtimeCaching` to set up an appropriate response strategy that will match\nnavigation requests, and make use of the preloaded response.",
"default": false,
"type": "boolean"
},
"offlineGoogleAnalytics": {
"description": "Controls whether or not to include support for\n[offline Google Analytics](https://developers.google.com/web/tools/workbox/guides/enable-offline-analytics).\nWhen `true`, the call to `workbox-google-analytics`'s `initialize()` will\nbe added to your generated service worker. When set to an `Object`, that\nobject will be passed in to the `initialize()` call, allowing you to\ncustomize the behavior.",
"default": false,
"anyOf": [
{
Expand All @@ -166,23 +189,28 @@
]
},
"runtimeCaching": {
"description": "When using Workbox's build tools to generate your service worker, you can\nspecify one or more runtime caching configurations. These are then\ntranslated to {@link workbox-routing.registerRoute} calls using the match\nand handler configuration you define.\n\nFor all of the options, see the {@link workbox-build.RuntimeCaching}\ndocumentation. The example below shows a typical configuration, with two\nruntime routes defined:",
"type": "array",
"items": {
"$ref": "#/definitions/RuntimeCaching"
}
},
"skipWaiting": {
"description": "Whether to add an unconditional call to [`skipWaiting()`](https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#skip_the_waiting_phase)\nto the generated service worker. If `false`, then a `message` listener will\nbe added instead, allowing client pages to trigger `skipWaiting()` by\ncalling `postMessage({type: 'SKIP_WAITING'})` on a waiting service worker.",
"default": false,
"type": "boolean"
},
"sourcemap": {
"description": "Whether to create a sourcemap for the generated service worker files.",
"default": true,
"type": "boolean"
},
"swDest": {
"description": "The path and filename of the service worker file that will be created by\nthe build process, relative to the current working directory. It must end\nin '.js'.",
"type": "string"
},
"globDirectory": {
"description": "The local directory you wish to match `globPatterns` against. The path is\nrelative to the current directory.",
"type": "string"
}
},
Expand Down Expand Up @@ -279,6 +307,7 @@
"type": "object",
"properties": {
"handler": {
"description": "This determines how the runtime route will generate a response.\nTo use one of the built-in {@link workbox-strategies}, provide its name,\nlike `'NetworkFirst'`.\nAlternatively, this can be a {@link workbox-core.RouteHandler} callback\nfunction with custom response logic.",
"anyOf": [
{
"$ref": "#/definitions/RouteHandlerCallback"
Expand All @@ -299,6 +328,8 @@
]
},
"method": {
"description": "The HTTP method to match against. The default value of `'GET'` is normally\nsufficient, unless you explicitly need to match `'POST'`, `'PUT'`, or\nanother type of request.",
"default": "GET",
"enum": [
"DELETE",
"GET",
Expand All @@ -313,6 +344,7 @@
"type": "object",
"properties": {
"backgroundSync": {
"description": "Configuring this will add a\n{@link workbox-background-sync.BackgroundSyncPlugin} instance to the\n{@link workbox-strategies} configured in `handler`.",
"type": "object",
"properties": {
"name": {
Expand All @@ -328,6 +360,7 @@
]
},
"broadcastUpdate": {
"description": "Configuring this will add a\n{@link workbox-broadcast-update.BroadcastUpdatePlugin} instance to the\n{@link workbox-strategies} configured in `handler`.",
"type": "object",
"properties": {
"channelName": {
Expand All @@ -343,27 +376,33 @@
]
},
"cacheableResponse": {
"description": "Configuring this will add a\n{@link workbox-cacheable-response.CacheableResponsePlugin} instance to\nthe {@link workbox-strategies} configured in `handler`.",
"$ref": "#/definitions/CacheableResponseOptions"
},
"cacheName": {
"description": "If provided, this will set the `cacheName` property of the\n{@link workbox-strategies} configured in `handler`.",
"type": [
"null",
"string"
]
},
"expiration": {
"description": "Configuring this will add a\n{@link workbox-expiration.ExpirationPlugin} instance to\nthe {@link workbox-strategies} configured in `handler`.",
"$ref": "#/definitions/ExpirationPluginOptions"
},
"networkTimeoutSeconds": {
"description": "If provided, this will set the `cacheName` property of the\n{@link workbox-strategies} configured in `handler`. Note that only\n`'NetworkFirst'` and `'NetworkOnly'` support `networkTimeoutSeconds`.",
"type": "number"
},
"plugins": {
"description": "Configuring this allows the use of one or more Workbox plugins that\ndon't have \"shortcut\" options (like `expiration` for\n{@link workbox-expiration.ExpirationPlugin}). The plugins provided here\nwill be added to the {@link workbox-strategies} configured in `handler`.",
"type": "array",
"items": {
"$ref": "#/definitions/WorkboxPlugin"
}
},
"precacheFallback": {
"description": "Configuring this will add a\n{@link workbox-precaching.PrecacheFallbackPlugin} instance to\nthe {@link workbox-strategies} configured in `handler`.",
"type": "object",
"properties": {
"fallbackURL": {
Expand All @@ -376,18 +415,22 @@
]
},
"rangeRequests": {
"description": "Enabling this will add a\n{@link workbox-range-requests.RangeRequestsPlugin} instance to\nthe {@link workbox-strategies} configured in `handler`.",
"type": "boolean"
},
"fetchOptions": {
"description": "Configuring this will pass along the `fetchOptions` value to\nthe {@link workbox-strategies} configured in `handler`.",
"$ref": "#/definitions/RequestInit"
},
"matchOptions": {
"description": "Configuring this will pass along the `matchOptions` value to\nthe {@link workbox-strategies} configured in `handler`.",
"$ref": "#/definitions/CacheQueryOptions"
}
},
"additionalProperties": false
},
"urlPattern": {
"description": "This match criteria determines whether the configured handler will\ngenerate a response for any requests that don't match one of the precached\nURLs. If multiple `RuntimeCaching` routes are defined, then the first one\nwhose `urlPattern` matches will be the one that responds.\n\nThis value directly maps to the first parameter passed to\n{@link workbox-routing.registerRoute}. It's recommended to use a\n{@link workbox-core.RouteMatchCallback} function for greatest flexibility.",
"anyOf": [
{
"$ref": "#/definitions/RegExp"
Expand Down

0 comments on commit e63ad2d

Please sign in to comment.