{"version":3,"file":"index.mjs","names":[],"sources":["../src/lib/errors.ts","../src/lib/get-composite-details.ts","../src/lib/get-string-hash.ts","../src/lib/get-file-hash.ts","../src/lib/get-file-size.ts","../src/lib/get-file-details.ts","../src/lib/get-string-details.ts","../src/lib/additional-precache-entries-transform.ts","../src/lib/maximum-size-transform.ts","../src/lib/escape-regexp.ts","../src/lib/modify-url-prefix-transform.ts","../src/lib/no-revision-for-urls-matching-transform.ts","../src/lib/transform-manifest.ts","../src/lib/get-file-manifest-entries.ts","../src/lib/validate-options.ts","../src/get-manifest.ts","../src/lib/get-source-map-url.ts","../src/lib/rebase-path.ts","../src/lib/replace-and-update-source-map.ts","../src/lib/translate-url-to-sourcemap-paths.ts","../src/inject-manifest.ts","../src/index.ts"],"sourcesContent":["/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\n\nimport { oneLine as ol } from \"common-tags\";\n\nexport const errors = {\n  \"unable-to-get-rootdir\": \"Unable to get the root directory of your web app.\",\n  \"no-extension\": ol`Unable to detect a usable extension for a file in your web\n    app directory.`,\n  \"invalid-file-manifest-name\": ol`The File Manifest Name must have at least one\n    character.`,\n  \"unable-to-get-file-manifest-name\": \"Unable to get a file manifest name.\",\n  \"invalid-sw-dest\": `The 'swDest' value must be a valid path.`,\n  \"unable-to-get-sw-name\": \"Unable to get a service worker file name.\",\n  \"unable-to-get-save-config\": ol`An error occurred when asking to save details\n    in a config file.`,\n  \"unable-to-get-file-hash\": ol`An error occurred when attempting to create a\n    file hash.`,\n  \"unable-to-get-file-size\": ol`An error occurred when attempting to get a file\n    size.`,\n  \"unable-to-glob-files\": \"An error occurred when globbing for files.\",\n  \"unable-to-make-manifest-directory\": ol`Unable to make output directory for\n    file manifest.`,\n  \"read-manifest-template-failure\": \"Unable to read template for file manifest\",\n  \"populating-manifest-tmpl-failed\": ol`An error occurred when populating the\n    file manifest template.`,\n  \"manifest-file-write-failure\": \"Unable to write the file manifest.\",\n  \"unable-to-make-sw-directory\": ol`Unable to make the directories to output\n    the service worker path.`,\n  \"sw-write-failure\": \"Unable to write the service worker file.\",\n  \"sw-write-failure-directory\": ol`Unable to write the service worker file;\n    'swDest' should be a full path to the file, not a path to a directory.`,\n  \"unable-to-copy-serwist-libraries\": ol`One or more of the Serwist libraries\n    could not be copied over to the destination directory: `,\n  \"invalid-glob-directory\": ol`The supplied globDirectory must be a path as a\n    string.`,\n  \"invalid-dont-cache-bust\": ol`The supplied 'dontCacheBustURLsMatching'\n    parameter must be a RegExp.`,\n  \"invalid-exclude-files\": \"The excluded files should be an array of strings.\",\n  \"invalid-get-manifest-entries-input\": ol`The input to\n    'getFileManifestEntries()' must be an object.`,\n  \"invalid-manifest-path\": ol`The supplied manifest path is not a string with\n    at least one character.`,\n  \"invalid-manifest-entries\": ol`The manifest entries must be an array of\n    strings or JavaScript objects containing a url parameter.`,\n  \"invalid-manifest-format\": ol`The value of the 'format' option passed to\n    generateFileManifest() must be either 'iife' (the default) or 'es'.`,\n  \"invalid-static-file-globs\": ol`The 'globPatterns' value must be an array\n    of strings.`,\n  \"invalid-templated-urls\": ol`The 'templatedURLs' value should be an object\n    that maps URLs to either a string, or to an array of glob patterns.`,\n  \"templated-url-matches-glob\": ol`One of the 'templatedURLs' URLs is already\n    being tracked via 'globPatterns': `,\n  \"invalid-glob-ignores\": ol`The 'globIgnores' parameter must be an array of\n    glob pattern strings.`,\n  \"manifest-entry-bad-url\": ol`The generated manifest contains an entry without\n    a URL string. This is likely an error with @serwist/build.`,\n  \"modify-url-prefix-bad-prefixes\": ol`The 'modifyURLPrefix' parameter must be\n    an object with string key value pairs.`,\n  \"invalid-inject-manifest-arg\": ol`The input to 'injectManifest()' must be an\n    object.`,\n  \"injection-point-not-found\": ol`Unable to find a place to inject the manifest.\n    Please ensure that your service worker file contains the following: `,\n  \"multiple-injection-points\": ol`Please ensure that your 'swSrc' file contains\n    only one match for the following: `,\n  \"bad-template-urls-asset\": ol`There was an issue using one of the provided\n    'templatedURLs'.`,\n  \"invalid-generate-file-manifest-arg\": ol`The input to generateFileManifest()\n    must be an Object.`,\n  \"invalid-sw-src\": `The 'swSrc' file can't be read.`,\n  \"same-src-and-dest\": ol`Unable to find a place to inject the manifest. This is\n    likely because swSrc and swDest are configured to the same file.\n    Please ensure that your swSrc file contains the following:`,\n  \"no-module-name\": ol`You must provide a moduleName parameter when calling\n    getModuleURL().`,\n  \"bad-manifest-transforms-return-value\": ol`The return value from a\n    manifestTransform should be an object with 'manifest' and optionally\n    'warnings' properties.`,\n  \"string-entry-warning\": ol`Some items were passed to additionalPrecacheEntries\n    without revisioning info. This is generally NOT safe. Learn more at\n    https://bit.ly/wb-precache.`,\n  \"cant-find-sourcemap\": ol`The swSrc file refers to a sourcemap that can't be\n    opened:`,\n  \"manifest-transforms\": ol`When using manifestTransforms, you must provide\n    an array of functions.`,\n};\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\n\nimport crypto from \"node:crypto\";\n\nimport type { FileDetails } from \"../types.js\";\n\nexport const getCompositeDetails = (compositeURL: string, dependencyDetails: FileDetails[]): FileDetails => {\n  let totalSize = 0;\n  let compositeHash = \"\";\n\n  for (const fileDetails of dependencyDetails) {\n    totalSize += fileDetails.size;\n    compositeHash += fileDetails.hash === null ? \"\" : fileDetails.hash;\n  }\n\n  const md5 = crypto.createHash(\"md5\");\n  md5.update(compositeHash);\n  const hashOfHashes = md5.digest(\"hex\");\n\n  return {\n    file: compositeURL,\n    hash: hashOfHashes,\n    size: totalSize,\n  };\n};\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\n\nimport crypto from \"node:crypto\";\n\nexport function getStringHash(input: string | NodeJS.ArrayBufferView): string {\n  const md5 = crypto.createHash(\"md5\");\n  md5.update(input);\n  return md5.digest(\"hex\");\n}\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\n\nimport { readFileSync } from \"node:fs\";\n\nimport { errors } from \"./errors.js\";\nimport { getStringHash } from \"./get-string-hash.js\";\n\nexport const getFileHash = (file: string): string => {\n  try {\n    const buffer = readFileSync(file);\n    return getStringHash(buffer);\n  } catch (err) {\n    throw new Error(`${errors[\"unable-to-get-file-hash\"]} '${err instanceof Error && err.message ? err.message : \"\"}'`);\n  }\n};\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\n\nimport fs from \"node:fs\";\nimport { errors } from \"./errors.js\";\n\nexport const getFileSize = (file: string): number | null => {\n  try {\n    const stat = fs.statSync(file);\n    if (!stat.isFile()) {\n      return null;\n    }\n    return stat.size;\n  } catch (err) {\n    throw new Error(`${errors[\"unable-to-get-file-size\"]} '${err instanceof Error && err.message ? err.message : \"\"}'`);\n  }\n};\n","/*\n  Copyright 2021 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport path from \"node:path\";\nimport { globSync } from \"glob\";\nimport type { FileDetails, GlobPartial } from \"../types.js\";\nimport { errors } from \"./errors.js\";\nimport { getFileHash } from \"./get-file-hash.js\";\nimport { getFileSize } from \"./get-file-size.js\";\n\nexport const getFileDetails = ({\n  globDirectory,\n  globFollow,\n  globIgnores,\n  globPattern,\n}: Omit<GlobPartial, \"globDirectory\" | \"globPatterns\" | \"templatedURLs\"> & {\n  // This will only be called when globDirectory is not undefined.\n  globDirectory: string;\n  globPattern: string;\n}): {\n  globbedFileDetails: FileDetails[];\n  warning: string;\n} => {\n  let globbedFiles: string[];\n  let warning = \"\";\n\n  try {\n    globbedFiles = globSync(globPattern, {\n      cwd: globDirectory,\n      follow: globFollow,\n      ignore: globIgnores,\n    });\n  } catch (err) {\n    throw new Error(`${errors[\"unable-to-glob-files\"]} '${err instanceof Error && err.message ? err.message : \"\"}'`);\n  }\n\n  const globbedFileDetails: FileDetails[] = [];\n  for (const file of globbedFiles) {\n    const fullPath = path.join(globDirectory, file);\n    const fileSize = getFileSize(fullPath);\n    if (fileSize !== null) {\n      const fileHash = getFileHash(fullPath);\n      globbedFileDetails.push({\n        file: path.relative(globDirectory, fullPath),\n        hash: fileHash,\n        size: fileSize,\n      });\n    }\n  }\n\n  return { globbedFileDetails, warning };\n};\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\n\nimport type { FileDetails } from \"../types.js\";\nimport { getStringHash } from \"./get-string-hash.js\";\n\nexport const getStringDetails = (url: string, str: string): FileDetails => ({\n  file: url,\n  hash: getStringHash(str),\n  size: str.length,\n});\n","/*\n  Copyright 2019 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\n\nimport type { ManifestEntry } from \"../types.js\";\nimport { errors } from \"./errors.js\";\n\ntype AdditionalManifestEntriesTransform = (manifest: (ManifestEntry & { size: number })[]) => {\n  manifest: (ManifestEntry & { size: number })[];\n  warnings: string[];\n};\n\nexport const additionalPrecacheEntriesTransform = (additionalPrecacheEntries: (ManifestEntry | string)[]): AdditionalManifestEntriesTransform => {\n  return (manifest: (ManifestEntry & { size: number })[]) => {\n    const warnings: string[] = [];\n    const stringEntries = new Set<string>();\n\n    for (const additionalEntry of additionalPrecacheEntries) {\n      // Warn about either a string or an object that lacks a revision property.\n      // (An object with a revision property set to null is okay.)\n      if (typeof additionalEntry === \"string\") {\n        stringEntries.add(additionalEntry);\n        manifest.push({\n          revision: null,\n          size: 0,\n          url: additionalEntry,\n        });\n      } else {\n        if (additionalEntry && !additionalEntry.integrity && additionalEntry.revision === undefined) {\n          stringEntries.add(additionalEntry.url);\n        }\n        manifest.push(Object.assign({ size: 0 }, additionalEntry));\n      }\n    }\n\n    if (stringEntries.size > 0) {\n      let urls = \"\\n\";\n      for (const stringEntry of stringEntries) {\n        urls += `  - ${stringEntry}\\n`;\n      }\n\n      warnings.push(errors[\"string-entry-warning\"] + urls);\n    }\n\n    return {\n      manifest,\n      warnings,\n    };\n  };\n};\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\n\nimport prettyBytes from \"pretty-bytes\";\n\nimport type { ManifestTransform } from \"../types.js\";\n\nexport function maximumSizeTransform(maximumFileSizeToCacheInBytes: number): ManifestTransform {\n  return (originalManifest) => {\n    const warnings: string[] = [];\n    const manifest = originalManifest.filter((entry) => {\n      if (entry.size <= maximumFileSizeToCacheInBytes) {\n        return true;\n      }\n\n      warnings.push(\n        `${entry.url} is ${prettyBytes(entry.size)}, and won't be precached. Configure maximumFileSizeToCacheInBytes to change this limit.`,\n      );\n      return false;\n    });\n\n    return { manifest, warnings };\n  };\n}\n","/*\n  Copyright 2019 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\n\n// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions\nexport const escapeRegExp = (str: string): string => {\n  return str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n};\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\n\nimport type { ManifestTransform } from \"../types.js\";\nimport { errors } from \"./errors.js\";\nimport { escapeRegExp } from \"./escape-regexp.js\";\n\nexport function modifyURLPrefixTransform(modifyURLPrefix: { [key: string]: string }): ManifestTransform {\n  if (!modifyURLPrefix || typeof modifyURLPrefix !== \"object\" || Array.isArray(modifyURLPrefix)) {\n    throw new Error(errors[\"modify-url-prefix-bad-prefixes\"]);\n  }\n\n  // If there are no entries in modifyURLPrefix, just return an identity\n  // function as a shortcut.\n  if (Object.keys(modifyURLPrefix).length === 0) {\n    return (manifest) => {\n      return { manifest };\n    };\n  }\n\n  for (const key of Object.keys(modifyURLPrefix)) {\n    if (typeof modifyURLPrefix[key] !== \"string\") {\n      throw new Error(errors[\"modify-url-prefix-bad-prefixes\"]);\n    }\n  }\n\n  // Escape the user input so it's safe to use in a regex.\n  const safeModifyURLPrefixes = Object.keys(modifyURLPrefix).map(escapeRegExp);\n  // Join all the `modifyURLPrefix` keys so a single regex can be used.\n  const prefixMatchesStrings = safeModifyURLPrefixes.join(\"|\");\n  // Add `^` to the front the prefix matches so it only matches the start of\n  // a string.\n  const modifyRegex = new RegExp(`^(${prefixMatchesStrings})`);\n\n  return (originalManifest) => {\n    const manifest = originalManifest.map((entry) => {\n      if (typeof entry.url !== \"string\") {\n        throw new Error(errors[\"manifest-entry-bad-url\"]);\n      }\n\n      entry.url = entry.url.replace(modifyRegex, (match) => {\n        return modifyURLPrefix[match];\n      });\n\n      return entry;\n    });\n\n    return { manifest };\n  };\n}\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\n\nimport type { ManifestTransform } from \"../types.js\";\nimport { errors } from \"./errors.js\";\n\nexport function noRevisionForURLsMatchingTransform(regexp: RegExp): ManifestTransform {\n  if (!(regexp instanceof RegExp)) {\n    throw new Error(errors[\"invalid-dont-cache-bust\"]);\n  }\n\n  return (originalManifest) => {\n    const manifest = originalManifest.map((entry) => {\n      if (typeof entry.url !== \"string\") {\n        throw new Error(errors[\"manifest-entry-bad-url\"]);\n      }\n\n      if (entry.url.match(regexp)) {\n        entry.revision = null;\n      }\n\n      return entry;\n    });\n\n    return { manifest };\n  };\n}\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\n\nimport type { BaseResolved, FileDetails, ManifestEntry, ManifestTransform } from \"../types.js\";\nimport { additionalPrecacheEntriesTransform } from \"./additional-precache-entries-transform.js\";\nimport { errors } from \"./errors.js\";\nimport { maximumSizeTransform } from \"./maximum-size-transform.js\";\nimport { modifyURLPrefixTransform } from \"./modify-url-prefix-transform.js\";\nimport { noRevisionForURLsMatchingTransform } from \"./no-revision-for-urls-matching-transform.js\";\n\n/**\n * A `ManifestTransform` function can be used to modify the modify the `url` or\n * `revision` properties of some or all of the {@linkcode ManifestEntry} in the manifest.\n *\n * Deleting the `revision` property of an entry will cause\n * the corresponding `url` to be precached without cache-busting parameters\n * applied, which is to say, it implies that the URL itself contains\n * proper versioning info. If the `revision` property is present, it must be\n * set to a string.\n *\n * @example A transformation that prepended the origin of a CDN for any\n * URL starting with '/assets/' could be implemented as:\n *\n * const cdnTransform = async (manifestEntries) => {\n *   const manifest = manifestEntries.map(entry => {\n *     const cdnOrigin = 'https://example.com';\n *     if (entry.url.startsWith('/assets/')) {\n *       entry.url = cdnOrigin + entry.url;\n *     }\n *     return entry;\n *   });\n *   return {manifest, warnings: []};\n * };\n *\n * @example A transformation that nulls the revision field when the\n * URL contains an 8-character hash surrounded by '.', indicating that it\n * already contains revision information:\n *\n * const removeRevisionTransform = async (manifestEntries) => {\n *   const manifest = manifestEntries.map(entry => {\n *     const hashRegExp = /\\.\\w{8}\\./;\n *     if (entry.url.match(hashRegExp)) {\n *       entry.revision = null;\n *     }\n *     return entry;\n *   });\n *   return {manifest, warnings: []};\n * };\n *\n * @callback ManifestTransform\n * @param manifestEntries The full\n * array of entries, prior to the current transformation.\n * @param compilation When used in the webpack plugins, this param\n * will be set to the current `compilation`.\n * @returns The array of entries with the transformation applied,\n * and optionally, any warnings that should be reported back to the build tool.\n */\ninterface ManifestTransformResultWithWarnings {\n  count: number;\n  size: number;\n  manifestEntries: ManifestEntry[] | undefined;\n  warnings: string[];\n}\ninterface ManifestEntryWithSize extends ManifestEntry {\n  size: number;\n}\ninterface TransformManifestOptions\n  extends Pick<\n    BaseResolved,\n    | \"additionalPrecacheEntries\"\n    | \"dontCacheBustURLsMatching\"\n    | \"manifestTransforms\"\n    | \"maximumFileSizeToCacheInBytes\"\n    | \"modifyURLPrefix\"\n    | \"disablePrecacheManifest\"\n  > {\n  fileDetails: FileDetails[];\n  // When this is called by the webpack plugin, transformParam will be the\n  // current webpack compilation.\n  transformParam?: unknown;\n}\n\nexport async function transformManifest({\n  additionalPrecacheEntries,\n  dontCacheBustURLsMatching,\n  fileDetails,\n  manifestTransforms,\n  maximumFileSizeToCacheInBytes,\n  modifyURLPrefix,\n  transformParam,\n  disablePrecacheManifest,\n}: TransformManifestOptions): Promise<ManifestTransformResultWithWarnings> {\n  if (disablePrecacheManifest) {\n    return {\n      count: 0,\n      size: 0,\n      manifestEntries: undefined,\n      warnings: [],\n    };\n  }\n\n  const allWarnings: string[] = [];\n\n  // Take the array of fileDetail objects and convert it into an array of\n  // {url, revision, size} objects, with \\ replaced with /.\n  const normalizedManifest: ManifestEntryWithSize[] = fileDetails.map((fileDetails) => ({\n    url: fileDetails.file.replace(/\\\\/g, \"/\"),\n    revision: fileDetails.hash,\n    size: fileDetails.size,\n  }));\n\n  const transformsToApply: ManifestTransform[] = [];\n\n  if (maximumFileSizeToCacheInBytes) {\n    transformsToApply.push(maximumSizeTransform(maximumFileSizeToCacheInBytes));\n  }\n\n  if (modifyURLPrefix) {\n    transformsToApply.push(modifyURLPrefixTransform(modifyURLPrefix));\n  }\n\n  if (dontCacheBustURLsMatching) {\n    transformsToApply.push(noRevisionForURLsMatchingTransform(dontCacheBustURLsMatching));\n  }\n\n  // Run any manifestTransforms functions second-to-last.\n  if (manifestTransforms) {\n    transformsToApply.push(...manifestTransforms);\n  }\n\n  // Run additionalPrecacheEntriesTransform last.\n  if (additionalPrecacheEntries) {\n    transformsToApply.push(additionalPrecacheEntriesTransform(additionalPrecacheEntries));\n  }\n\n  let transformedManifest: ManifestEntryWithSize[] = normalizedManifest;\n  for (const transform of transformsToApply) {\n    const result = await transform(transformedManifest, transformParam);\n    if (!(\"manifest\" in result)) {\n      throw new Error(errors[\"bad-manifest-transforms-return-value\"]);\n    }\n\n    transformedManifest = result.manifest;\n    allWarnings.push(...(result.warnings || []));\n  }\n\n  // Generate some metadata about the manifest before we clear out the size\n  // properties from each entry.\n  const count = transformedManifest.length;\n  let size = 0;\n  for (const manifestEntry of transformedManifest as (ManifestEntry & { size?: number })[]) {\n    size += manifestEntry.size || 0;\n    delete manifestEntry.size;\n  }\n\n  return {\n    count,\n    size,\n    manifestEntries: transformedManifest as ManifestEntry[],\n    warnings: allWarnings,\n  };\n}\n","/*\n  Copyright 2021 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\n\nimport assert from \"node:assert\";\n\nimport type { FileDetails, GetManifestOptionsComplete, GetManifestResult } from \"../types.js\";\nimport { errors } from \"./errors.js\";\nimport { getCompositeDetails } from \"./get-composite-details.js\";\nimport { getFileDetails } from \"./get-file-details.js\";\nimport { getStringDetails } from \"./get-string-details.js\";\nimport { transformManifest } from \"./transform-manifest.js\";\n\nexport const getFileManifestEntries = async ({\n  additionalPrecacheEntries,\n  dontCacheBustURLsMatching,\n  globDirectory,\n  globFollow,\n  globIgnores,\n  globPatterns = [],\n  globStrict,\n  manifestTransforms,\n  maximumFileSizeToCacheInBytes,\n  modifyURLPrefix,\n  templatedURLs,\n  disablePrecacheManifest,\n}: GetManifestOptionsComplete): Promise<GetManifestResult> => {\n  if (disablePrecacheManifest) {\n    return {\n      count: 0,\n      size: 0,\n      manifestEntries: undefined,\n      warnings: [],\n    };\n  }\n\n  const warnings: string[] = [];\n  const allFileDetails = new Map<string, FileDetails>();\n\n  try {\n    for (const globPattern of globPatterns) {\n      const { globbedFileDetails, warning } = getFileDetails({\n        globDirectory,\n        globFollow,\n        globIgnores,\n        globPattern,\n        globStrict,\n      });\n\n      if (warning) {\n        warnings.push(warning);\n      }\n\n      for (const details of globbedFileDetails) {\n        if (details && !allFileDetails.has(details.file)) {\n          allFileDetails.set(details.file, details);\n        }\n      }\n    }\n  } catch (error) {\n    // If there's an exception thrown while globbing, then report\n    // it back as a warning, and don't consider it fatal.\n    if (error instanceof Error && error.message) {\n      warnings.push(error.message);\n    }\n  }\n\n  if (templatedURLs) {\n    for (const url of Object.keys(templatedURLs)) {\n      assert(!allFileDetails.has(url), errors[\"templated-url-matches-glob\"]);\n\n      const dependencies = templatedURLs[url];\n      if (Array.isArray(dependencies)) {\n        const details = dependencies.reduce<FileDetails[]>((previous, globPattern) => {\n          try {\n            const { globbedFileDetails, warning } = getFileDetails({\n              globDirectory,\n              globFollow,\n              globIgnores,\n              globPattern,\n              globStrict,\n            });\n\n            if (warning) {\n              warnings.push(warning);\n            }\n\n            return previous.concat(globbedFileDetails);\n          } catch (error) {\n            const debugObj: { [key: string]: string[] } = {};\n            debugObj[url] = dependencies;\n            throw new Error(\n              `${errors[\"bad-template-urls-asset\"]} '${globPattern}' from '${JSON.stringify(debugObj)}':\\n${\n                error instanceof Error ? error.toString() : \"\"\n              }`,\n            );\n          }\n        }, []);\n        if (details.length === 0) {\n          throw new Error(`${errors[\"bad-template-urls-asset\"]} The glob pattern '${dependencies.toString()}' did not match anything.`);\n        }\n        allFileDetails.set(url, getCompositeDetails(url, details));\n      } else if (typeof dependencies === \"string\") {\n        allFileDetails.set(url, getStringDetails(url, dependencies));\n      }\n    }\n  }\n\n  const transformedManifest = await transformManifest({\n    additionalPrecacheEntries,\n    dontCacheBustURLsMatching,\n    manifestTransforms,\n    maximumFileSizeToCacheInBytes,\n    modifyURLPrefix,\n    fileDetails: Array.from(allFileDetails.values()),\n    disablePrecacheManifest,\n  });\n\n  transformedManifest.warnings.push(...warnings);\n\n  return transformedManifest;\n};\n","import { z } from \"zod\";\n/*\n  Copyright 2021 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport { SerwistConfigError, validationErrorMap } from \"../schema/error.js\";\nimport type { GetManifestOptionsComplete, InjectManifestOptionsComplete } from \"../types.js\";\n\nexport const validateGetManifestOptions = async (input: unknown): Promise<GetManifestOptionsComplete> => {\n  const result = await (await import(\"../schema/get-manifest.js\")).getManifestOptions.spa(input, { error: validationErrorMap });\n  if (!result.success) {\n    throw new SerwistConfigError({\n      moduleName: \"@serwist/build\",\n      message: z.prettifyError(result.error),\n    });\n  }\n  return result.data;\n};\n\nexport const validateInjectManifestOptions = async (input: unknown): Promise<InjectManifestOptionsComplete> => {\n  const result = await (await import(\"../schema/inject-manifest.js\")).injectManifestOptions.spa(input, { error: validationErrorMap });\n  if (!result.success) {\n    throw new SerwistConfigError({\n      moduleName: \"@serwist/build\",\n      message: z.prettifyError(result.error),\n    });\n  }\n  return result.data;\n};\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\n\nimport { getFileManifestEntries } from \"./lib/get-file-manifest-entries.js\";\nimport { validateGetManifestOptions } from \"./lib/validate-options.js\";\nimport type { GetManifestOptions, GetManifestResult } from \"./types.js\";\n\n/**\n * This method returns a list of URLs to precache, referred to as a \"precache\n * manifest\", along with details about the number of entries and their size,\n * based on the options you provide.\n *\n * ```\n * // The following lists some common options; see the rest of the documentation\n * // for the full set of options and defaults.\n * const {count, manifestEntries, size, warnings} = await getManifest({\n *   dontCacheBustURLsMatching: [new RegExp('...')],\n *   globDirectory: '...',\n *   globPatterns: ['...', '...'],\n *   maximumFileSizeToCacheInBytes: ...,\n * });\n * ```\n */\nexport const getManifest = async (config: GetManifestOptions): Promise<GetManifestResult> => {\n  const options = await validateGetManifestOptions(config);\n\n  return await getFileManifestEntries(options);\n};\n","/*\n  Copyright 2022 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\n\n// Adapted from https://github.com/lydell/source-map-url/blob/master/source-map-url.js\n// See https://github.com/GoogleChrome/workbox/issues/3019\nconst innerRegex = /[#@] sourceMappingURL=([^\\s'\"]*)/;\nconst regex = RegExp(`(?:/\\\\*(?:\\\\s*\\r?\\n(?://)?)?(?:${innerRegex.source})\\\\s*\\\\*/|//(?:${innerRegex.source}))\\\\s*`);\n\nexport function getSourceMapURL(srcContents: string): string | null {\n  const match = srcContents.match(regex);\n  return match ? match[1] || match[2] || \"\" : null;\n}\n","/*\n  Copyright 2019 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\n\nimport path from \"node:path\";\nimport { toUnix } from \"@serwist/utils\";\n\nexport function rebasePath({ baseDirectory, file }: { baseDirectory: string; file: string }): string {\n  // The initial path is relative to the current directory, so make it absolute.\n  const absolutePath = path.resolve(file);\n\n  // Convert the absolute path so that it's relative to the baseDirectory.\n  const relativePath = path.relative(baseDirectory, absolutePath);\n\n  // Remove any leading ./ as it won't work in a glob pattern.\n  const normalizedPath = path.normalize(relativePath);\n\n  return toUnix(normalizedPath);\n}\n","/*\n  Copyright 2019 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\n\nimport type { RawSourceMap } from \"source-map\";\nimport { SourceMapConsumer, SourceMapGenerator } from \"source-map\";\n\ninterface ReplaceAndUpdateSourceMapOptions {\n  /**\n   * The name for the file whose contents\n   * correspond to originalSource.\n   */\n  jsFilename: string;\n  /**\n   * The sourcemap for originalSource,\n   * prior to any replacements.\n   */\n  originalMap: RawSourceMap;\n  /**\n   * The source code, prior to any\n   * replacements.\n   */\n  originalSource: string;\n  /**\n   * A string to swap in for searchString.\n   */\n  replaceString: string;\n  /**\n   * A string in originalSource to replace.\n   * Only the first occurrence will be replaced.\n   */\n  searchString: string;\n}\n\n/**\n * Adapted from https://github.com/nsams/sourcemap-aware-replace, with modern\n * JavaScript updates, along with additional properties copied from originalMap.\n *\n * @param options\n * @returns An object containing both\n * originalSource with the replacement applied, and the modified originalMap.\n * @private\n */\nexport async function replaceAndUpdateSourceMap({\n  jsFilename,\n  originalMap,\n  originalSource,\n  replaceString,\n  searchString,\n}: ReplaceAndUpdateSourceMapOptions): Promise<{ map: string; source: string }> {\n  const generator = new SourceMapGenerator({\n    file: jsFilename,\n  });\n\n  const consumer = await new SourceMapConsumer(originalMap);\n\n  let pos: number;\n  let src = originalSource;\n  const replacements: { line: number; column: number }[] = [];\n  let lineNum = 0;\n  let filePos = 0;\n\n  const lines = src.split(\"\\n\");\n  for (let line of lines) {\n    lineNum++;\n    let searchPos = 0;\n    while ((pos = line.indexOf(searchString, searchPos)) !== -1) {\n      src = src.substring(0, filePos + pos) + replaceString + src.substring(filePos + pos + searchString.length);\n      line = line.substring(0, pos) + replaceString + line.substring(pos + searchString.length);\n      replacements.push({ line: lineNum, column: pos });\n      searchPos = pos + replaceString.length;\n    }\n    filePos += line.length + 1;\n  }\n\n  replacements.reverse();\n\n  consumer.eachMapping((mapping) => {\n    for (const replacement of replacements) {\n      if (replacement.line === mapping.generatedLine && mapping.generatedColumn > replacement.column) {\n        const offset = searchString.length - replaceString.length;\n        mapping.generatedColumn -= offset;\n      }\n    }\n\n    if (mapping.source) {\n      const newMapping = {\n        generated: {\n          line: mapping.generatedLine,\n          column: mapping.generatedColumn,\n        },\n        original: {\n          line: mapping.originalLine,\n          column: mapping.originalColumn,\n        },\n        source: mapping.source,\n      };\n      return generator.addMapping(newMapping);\n    }\n\n    return mapping;\n  });\n\n  consumer.destroy();\n  // JSON.parse returns any.\n  const updatedSourceMap: RawSourceMap = Object.assign(JSON.parse(generator.toString()), {\n    names: originalMap.names,\n    sourceRoot: originalMap.sourceRoot,\n    sources: originalMap.sources,\n    sourcesContent: originalMap.sourcesContent,\n  });\n\n  return {\n    map: JSON.stringify(updatedSourceMap),\n    source: src,\n  };\n}\n","/*\n  Copyright 2021 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { toUnix } from \"@serwist/utils\";\nimport { errors } from \"./errors.js\";\n\nexport function translateURLToSourcemapPaths(\n  url: string | null,\n  swSrc: string,\n  swDest: string,\n): {\n  destPath: string | undefined;\n  srcPath: string | undefined;\n  warning: string | undefined;\n} {\n  let destPath: string | undefined;\n  let srcPath: string | undefined;\n  let warning: string | undefined;\n\n  if (url && !url.startsWith(\"data:\")) {\n    const possibleSrcPath = path.resolve(path.dirname(swSrc), url);\n    if (fs.existsSync(possibleSrcPath)) {\n      srcPath = toUnix(possibleSrcPath);\n      destPath = toUnix(path.resolve(path.dirname(swDest), url));\n    } else {\n      warning = `${errors[\"cant-find-sourcemap\"]} ${possibleSrcPath}`;\n    }\n  }\n\n  return { destPath, srcPath, warning };\n}\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport assert from \"node:assert\";\nimport fsp from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { toUnix } from \"@serwist/utils\";\nimport type { RawSourceMap } from \"source-map\";\nimport { errors } from \"./lib/errors.js\";\nimport { escapeRegExp } from \"./lib/escape-regexp.js\";\nimport { getFileManifestEntries } from \"./lib/get-file-manifest-entries.js\";\nimport { getSourceMapURL } from \"./lib/get-source-map-url.js\";\nimport { rebasePath } from \"./lib/rebase-path.js\";\nimport { replaceAndUpdateSourceMap } from \"./lib/replace-and-update-source-map.js\";\nimport { translateURLToSourcemapPaths } from \"./lib/translate-url-to-sourcemap-paths.js\";\nimport { validateInjectManifestOptions } from \"./lib/validate-options.js\";\nimport type { BuildResult, InjectManifestOptions } from \"./types.js\";\n\n/**\n * This method creates a list of URLs to precache, referred to as a \"precache\n * manifest\", based on the options you provide.\n *\n * The manifest is injected into the `swSrc` file, and the placeholder string\n * `injectionPoint` determines where in the file the manifest should go.\n *\n * The final service worker file, with the manifest injected, is written to\n * disk at `swDest`.\n *\n * This method will not compile or bundle your `swSrc` file; it just handles\n * injecting the manifest.\n *\n * ```\n * // The following lists some common options; see the rest of the documentation\n * // for the full set of options and defaults.\n * const {count, size, warnings} = await injectManifest({\n *   dontCacheBustURLsMatching: [new RegExp('...')],\n *   globDirectory: '...',\n *   globPatterns: ['...', '...'],\n *   maximumFileSizeToCacheInBytes: ...,\n *   swDest: '...',\n *   swSrc: '...',\n * });\n * ```\n */\nexport const injectManifest = async (config: InjectManifestOptions): Promise<BuildResult> => {\n  const options = await validateInjectManifestOptions(config);\n\n  // Make sure we leave swSrc and swDest out of the precache manifest.\n  for (const file of [options.swSrc, options.swDest]) {\n    options.globIgnores!.push(\n      rebasePath({\n        file,\n        baseDirectory: options.globDirectory,\n      }),\n    );\n  }\n\n  const globalRegexp = new RegExp(escapeRegExp(options.injectionPoint!), \"g\");\n\n  const { count, size, manifestEntries, warnings } = await getFileManifestEntries(options);\n  let swFileContents: string;\n  try {\n    swFileContents = await fsp.readFile(options.swSrc, \"utf8\");\n  } catch (error) {\n    throw new Error(`${errors[\"invalid-sw-src\"]} ${error instanceof Error && error.message ? error.message : \"\"}`);\n  }\n\n  const injectionResults = swFileContents.match(globalRegexp);\n  // See https://github.com/GoogleChrome/workbox/issues/2230\n  const injectionPoint = options.injectionPoint ? options.injectionPoint : \"\";\n  if (!injectionResults) {\n    if (path.resolve(options.swSrc) === path.resolve(options.swDest)) {\n      throw new Error(`${errors[\"same-src-and-dest\"]} ${injectionPoint}`);\n    }\n    throw new Error(`${errors[\"injection-point-not-found\"]} ${injectionPoint}`);\n  }\n\n  assert(injectionResults.length === 1, `${errors[\"multiple-injection-points\"]} ${injectionPoint}`);\n\n  const manifestString = manifestEntries === undefined ? \"undefined\" : JSON.stringify(manifestEntries);\n\n  const filesToWrite: { [key: string]: string } = {};\n\n  const url = getSourceMapURL(swFileContents);\n  // See https://github.com/GoogleChrome/workbox/issues/2957\n  const { destPath, srcPath, warning } = translateURLToSourcemapPaths(url, options.swSrc, options.swDest);\n  if (warning) {\n    warnings.push(warning);\n  }\n\n  // If our swSrc file contains a sourcemap, we would invalidate that\n  // mapping if we just replaced injectionPoint with the stringified manifest.\n  // Instead, we need to update the swDest contents as well as the sourcemap\n  // (assuming it's a real file, not a data: URL) at the same time.\n  // See https://github.com/GoogleChrome/workbox/issues/2235\n  // and https://github.com/GoogleChrome/workbox/issues/2648\n  if (srcPath && destPath) {\n    const originalMap = JSON.parse(await fsp.readFile(srcPath, \"utf-8\")) as RawSourceMap;\n\n    const { map, source } = await replaceAndUpdateSourceMap({\n      originalMap,\n      jsFilename: toUnix(path.basename(options.swDest)),\n      originalSource: swFileContents,\n      replaceString: manifestString,\n      searchString: options.injectionPoint!,\n    });\n\n    filesToWrite[options.swDest] = source;\n    filesToWrite[destPath] = map;\n  } else {\n    // If there's no sourcemap associated with swSrc, a simple string\n    // replacement will suffice.\n    filesToWrite[options.swDest] = swFileContents.replace(globalRegexp, manifestString);\n  }\n\n  for (const [file, contents] of Object.entries(filesToWrite)) {\n    try {\n      await fsp.mkdir(path.dirname(file), { recursive: true });\n    } catch (error: unknown) {\n      throw new Error(`${errors[\"unable-to-make-sw-directory\"]} '${error instanceof Error && error.message ? error.message : \"\"}'`);\n    }\n\n    await fsp.writeFile(file, contents);\n  }\n\n  return {\n    count,\n    size,\n    warnings,\n    // Use path.resolve() to make all the paths absolute.\n    filePaths: Object.keys(filesToWrite).map((f) => toUnix(path.resolve(f))),\n  };\n};\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport { getManifest } from \"./get-manifest.js\";\nimport { injectManifest } from \"./inject-manifest.js\";\nimport { DEFAULT_GLOB_PATTERNS } from \"./lib/constants.js\";\nimport { errors } from \"./lib/errors.js\";\nimport { escapeRegExp } from \"./lib/escape-regexp.js\";\nimport { getFileManifestEntries } from \"./lib/get-file-manifest-entries.js\";\nimport { getSourceMapURL } from \"./lib/get-source-map-url.js\";\nimport { rebasePath } from \"./lib/rebase-path.js\";\nimport { replaceAndUpdateSourceMap } from \"./lib/replace-and-update-source-map.js\";\nimport { transformManifest } from \"./lib/transform-manifest.js\";\nimport { translateURLToSourcemapPaths } from \"./lib/translate-url-to-sourcemap-paths.js\";\nimport { validateGetManifestOptions, validateInjectManifestOptions } from \"./lib/validate-options.js\";\n\n// TODO: remove in v10.\n/**\n * Use `JSON.stringify` instead.\n *\n * @deprecated\n */\nconst stringify = JSON.stringify;\n\nexport {\n  errors,\n  DEFAULT_GLOB_PATTERNS,\n  escapeRegExp,\n  getFileManifestEntries,\n  getManifest,\n  getSourceMapURL,\n  injectManifest,\n  rebasePath,\n  replaceAndUpdateSourceMap,\n  stringify,\n  transformManifest,\n  translateURLToSourcemapPaths,\n  validateGetManifestOptions,\n  validateInjectManifestOptions,\n};\n\nexport type * from \"./types.js\";\n"],"mappings":";;;;;;;;;;;;;AAUA,MAAa,SAAS;CACpB,yBAAyB;CACzB,gBAAgB,OAAE;;CAElB,8BAA8B,OAAE;;CAEhC,oCAAoC;CACpC,mBAAmB;CACnB,yBAAyB;CACzB,6BAA6B,OAAE;;CAE/B,2BAA2B,OAAE;;CAE7B,2BAA2B,OAAE;;CAE7B,wBAAwB;CACxB,qCAAqC,OAAE;;CAEvC,kCAAkC;CAClC,mCAAmC,OAAE;;CAErC,+BAA+B;CAC/B,+BAA+B,OAAE;;CAEjC,oBAAoB;CACpB,8BAA8B,OAAE;;CAEhC,oCAAoC,OAAE;;CAEtC,0BAA0B,OAAE;;CAE5B,2BAA2B,OAAE;;CAE7B,yBAAyB;CACzB,sCAAsC,OAAE;;CAExC,yBAAyB,OAAE;;CAE3B,4BAA4B,OAAE;;CAE9B,2BAA2B,OAAE;;CAE7B,6BAA6B,OAAE;;CA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