| 1 | /*
|
|---|
| 2 | Copyright 2018 Google LLC
|
|---|
| 3 |
|
|---|
| 4 | Use of this source code is governed by an MIT-style
|
|---|
| 5 | license that can be found in the LICENSE file or at
|
|---|
| 6 | https://opensource.org/licenses/MIT.
|
|---|
| 7 | */
|
|---|
| 8 |
|
|---|
| 9 | import {oneLine as ol} from 'common-tags';
|
|---|
| 10 |
|
|---|
| 11 | export const errors = {
|
|---|
| 12 | 'unable-to-get-rootdir': `Unable to get the root directory of your web app.`,
|
|---|
| 13 | 'no-extension': ol`Unable to detect a usable extension for a file in your web
|
|---|
| 14 | app directory.`,
|
|---|
| 15 | 'invalid-file-manifest-name': ol`The File Manifest Name must have at least one
|
|---|
| 16 | character.`,
|
|---|
| 17 | 'unable-to-get-file-manifest-name': 'Unable to get a file manifest name.',
|
|---|
| 18 | 'invalid-sw-dest': `The 'swDest' value must be a valid path.`,
|
|---|
| 19 | 'unable-to-get-sw-name': 'Unable to get a service worker file name.',
|
|---|
| 20 | 'unable-to-get-save-config': ol`An error occurred when asking to save details
|
|---|
| 21 | in a config file.`,
|
|---|
| 22 | 'unable-to-get-file-hash': ol`An error occurred when attempting to create a
|
|---|
| 23 | file hash.`,
|
|---|
| 24 | 'unable-to-get-file-size': ol`An error occurred when attempting to get a file
|
|---|
| 25 | size.`,
|
|---|
| 26 | 'unable-to-glob-files': 'An error occurred when globbing for files.',
|
|---|
| 27 | 'unable-to-make-manifest-directory': ol`Unable to make output directory for
|
|---|
| 28 | file manifest.`,
|
|---|
| 29 | 'read-manifest-template-failure': 'Unable to read template for file manifest',
|
|---|
| 30 | 'populating-manifest-tmpl-failed': ol`An error occurred when populating the
|
|---|
| 31 | file manifest template.`,
|
|---|
| 32 | 'manifest-file-write-failure': 'Unable to write the file manifest.',
|
|---|
| 33 | 'unable-to-make-sw-directory': ol`Unable to make the directories to output
|
|---|
| 34 | the service worker path.`,
|
|---|
| 35 | 'read-sw-template-failure': ol`Unable to read the service worker template
|
|---|
| 36 | file.`,
|
|---|
| 37 | 'sw-write-failure': 'Unable to write the service worker file.',
|
|---|
| 38 | 'sw-write-failure-directory': ol`Unable to write the service worker file;
|
|---|
| 39 | 'swDest' should be a full path to the file, not a path to a directory.`,
|
|---|
| 40 | 'unable-to-copy-workbox-libraries': ol`One or more of the Workbox libraries
|
|---|
| 41 | could not be copied over to the destination directory: `,
|
|---|
| 42 | 'invalid-generate-sw-input': ol`The input to generateSW() must be an object.`,
|
|---|
| 43 | 'invalid-glob-directory': ol`The supplied globDirectory must be a path as a
|
|---|
| 44 | string.`,
|
|---|
| 45 | 'invalid-dont-cache-bust': ol`The supplied 'dontCacheBustURLsMatching'
|
|---|
| 46 | parameter must be a RegExp.`,
|
|---|
| 47 | 'invalid-exclude-files': 'The excluded files should be an array of strings.',
|
|---|
| 48 | 'invalid-get-manifest-entries-input': ol`The input to
|
|---|
| 49 | 'getFileManifestEntries()' must be an object.`,
|
|---|
| 50 | 'invalid-manifest-path': ol`The supplied manifest path is not a string with
|
|---|
| 51 | at least one character.`,
|
|---|
| 52 | 'invalid-manifest-entries': ol`The manifest entries must be an array of
|
|---|
| 53 | strings or JavaScript objects containing a url parameter.`,
|
|---|
| 54 | 'invalid-manifest-format': ol`The value of the 'format' option passed to
|
|---|
| 55 | generateFileManifest() must be either 'iife' (the default) or 'es'.`,
|
|---|
| 56 | 'invalid-static-file-globs': ol`The 'globPatterns' value must be an array
|
|---|
| 57 | of strings.`,
|
|---|
| 58 | 'invalid-templated-urls': ol`The 'templatedURLs' value should be an object
|
|---|
| 59 | that maps URLs to either a string, or to an array of glob patterns.`,
|
|---|
| 60 | 'templated-url-matches-glob': ol`One of the 'templatedURLs' URLs is already
|
|---|
| 61 | being tracked via 'globPatterns': `,
|
|---|
| 62 | 'invalid-glob-ignores': ol`The 'globIgnores' parameter must be an array of
|
|---|
| 63 | glob pattern strings.`,
|
|---|
| 64 | 'manifest-entry-bad-url': ol`The generated manifest contains an entry without
|
|---|
| 65 | a URL string. This is likely an error with workbox-build.`,
|
|---|
| 66 | 'modify-url-prefix-bad-prefixes': ol`The 'modifyURLPrefix' parameter must be
|
|---|
| 67 | an object with string key value pairs.`,
|
|---|
| 68 | 'invalid-inject-manifest-arg': ol`The input to 'injectManifest()' must be an
|
|---|
| 69 | object.`,
|
|---|
| 70 | 'injection-point-not-found': ol`Unable to find a place to inject the manifest.
|
|---|
| 71 | Please ensure that your service worker file contains the following: `,
|
|---|
| 72 | 'multiple-injection-points': ol`Please ensure that your 'swSrc' file contains
|
|---|
| 73 | only one match for the following: `,
|
|---|
| 74 | 'populating-sw-tmpl-failed': ol`Unable to generate service worker from
|
|---|
| 75 | template.`,
|
|---|
| 76 | 'useless-glob-pattern': ol`One of the glob patterns doesn't match any files.
|
|---|
| 77 | Please remove or fix the following: `,
|
|---|
| 78 | 'bad-template-urls-asset': ol`There was an issue using one of the provided
|
|---|
| 79 | 'templatedURLs'.`,
|
|---|
| 80 | 'invalid-runtime-caching': ol`The 'runtimeCaching' parameter must an an
|
|---|
| 81 | array of objects with at least a 'urlPattern' and 'handler'.`,
|
|---|
| 82 | 'static-file-globs-deprecated': ol`'staticFileGlobs' is deprecated.
|
|---|
| 83 | Please use 'globPatterns' instead.`,
|
|---|
| 84 | 'dynamic-url-deprecated': ol`'dynamicURLToDependencies' is deprecated.
|
|---|
| 85 | Please use 'templatedURLs' instead.`,
|
|---|
| 86 | 'urlPattern-is-required': ol`The 'urlPattern' option is required when using
|
|---|
| 87 | 'runtimeCaching'.`,
|
|---|
| 88 | 'handler-is-required': ol`The 'handler' option is required when using
|
|---|
| 89 | runtimeCaching.`,
|
|---|
| 90 | 'invalid-generate-file-manifest-arg': ol`The input to generateFileManifest()
|
|---|
| 91 | must be an Object.`,
|
|---|
| 92 | 'invalid-sw-src': `The 'swSrc' file can't be read.`,
|
|---|
| 93 | 'same-src-and-dest': ol`Unable to find a place to inject the manifest. This is
|
|---|
| 94 | likely because swSrc and swDest are configured to the same file.
|
|---|
| 95 | Please ensure that your swSrc file contains the following:`,
|
|---|
| 96 | 'only-regexp-routes-supported': ol`Please use a regular expression object as
|
|---|
| 97 | the urlPattern parameter. (Express-style routes are not currently
|
|---|
| 98 | supported.)`,
|
|---|
| 99 | 'bad-runtime-caching-config': ol`An unknown configuration option was used
|
|---|
| 100 | with runtimeCaching: `,
|
|---|
| 101 | 'invalid-network-timeout-seconds': ol`When using networkTimeoutSeconds, you
|
|---|
| 102 | must set the handler to 'NetworkFirst'.`,
|
|---|
| 103 | 'no-module-name': ol`You must provide a moduleName parameter when calling
|
|---|
| 104 | getModuleURL().`,
|
|---|
| 105 | 'bad-manifest-transforms-return-value': ol`The return value from a
|
|---|
| 106 | manifestTransform should be an object with 'manifest' and optionally
|
|---|
| 107 | 'warnings' properties.`,
|
|---|
| 108 | 'string-entry-warning': ol`Some items were passed to additionalManifestEntries
|
|---|
| 109 | without revisioning info. This is generally NOT safe. Learn more at
|
|---|
| 110 | https://bit.ly/wb-precache.`,
|
|---|
| 111 | 'no-manifest-entries-or-runtime-caching': ol`Couldn't find configuration for
|
|---|
| 112 | either precaching or runtime caching. Please ensure that the various glob
|
|---|
| 113 | options are set to match one or more files, and/or configure the
|
|---|
| 114 | runtimeCaching option.`,
|
|---|
| 115 | 'cant-find-sourcemap': ol`The swSrc file refers to a sourcemap that can't be
|
|---|
| 116 | opened:`,
|
|---|
| 117 | 'nav-preload-runtime-caching': ol`When using navigationPreload, you must also
|
|---|
| 118 | configure a runtimeCaching route that will use the preloaded response.`,
|
|---|
| 119 | 'cache-name-required': ol`When using cache expiration, you must also
|
|---|
| 120 | configure a custom cacheName.`,
|
|---|
| 121 | 'manifest-transforms': ol`When using manifestTransforms, you must provide
|
|---|
| 122 | an array of functions.`,
|
|---|
| 123 | 'invalid-handler-string': ol`The handler name provided is not valid: `,
|
|---|
| 124 | };
|
|---|