# @types/sw-precache

> TypeScript definitions for sw-precache

Latest version **5.2.4** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/sw-precache
pnpm add @types/sw-precache
yarn add @types/sw-precache
bun add @types/sw-precache
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 5.2.4 |
| Published | 2023-11-07 |
| First published | 2018-05-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 6.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51449 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/sw-precache
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sw-precache
- npm.io page: https://npm.io/package/@types/sw-precache

## Dependencies (2)

- [sw-toolbox](https://npm.io/package/sw-toolbox.md) *
- [@types/node](https://npm.io/package/@types/node.md) *

## Recent versions

- 5.2.4 (latest) — 2023-11-07
- 5.2.1 (ts3.6) — 2021-07-02
- 5.2.0 (ts2.1) — 2018-05-05
- 5.2.3 — 2023-10-18
- 5.2.2 — 2023-09-25

## README

# Installation
> `npm install --save @types/sw-precache`

# Summary
This package contains type definitions for sw-precache (https://github.com/googlechrome/sw-precache).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sw-precache.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sw-precache/index.d.ts)
````ts
/// <reference types="node" />

import { Handler as SwToolboxHanlder, Options as SwToolboxOptions } from "sw-toolbox";

export type Handler =
    | "networkFirst"
    | "cacheFirst"
    | "fastest"
    | "cacheOnly"
    | "networkOnly"
    | SwToolboxHanlder;

export type Method = "get" | "post" | "put" | "delete" | "head";

export interface Options {
    cacheId?: string | undefined;
    clientsClaim?: boolean | undefined;
    directoryIndex?: string | undefined;
    dontCacheBustUrlsMatching?: RegExp | undefined;
    dynamicUrlToDependencies?: {
        [url: string]: string | Buffer | string[];
    } | undefined;
    handleFetch?: boolean | undefined;
    ignoreUrlParametersMatching?: RegExp[] | undefined;
    importScripts?: string[] | undefined;
    logger?: Console["log"] | undefined;
    maximumFileSizeToCacheInBytes?: number | undefined;
    navigateFallback?: string | undefined;
    navigateFallbackWhitelist?: RegExp[] | undefined;
    replacePrefix?: string | undefined;
    runtimeCaching?:
        | Array<{
            urlPattern: RegExp | string;
            handler: Handler;
            method?: Method | undefined;
            options?: SwToolboxOptions | undefined;
        }>
        | undefined;
    skipWaiting?: boolean | undefined;
    staticFileGlobs?: string[] | undefined;
    stripPrefix?: string | undefined;
    stripPrefixMulti?: {
        [path: string]: string;
    } | undefined;
    templateFilePath?: string | undefined;
    verbose?: boolean | undefined;
}

export type Generate = (
    options?: Options,
    callback?: (
        error: NodeJS.ErrnoException,
        serviceWorkerString: string,
    ) => void,
) => Promise<string>;

export type Write = (
    filePath: string,
    options?: Options,
    callback?: (error: NodeJS.ErrnoException) => void,
) => Promise<string>;

export const generate: Generate;
export const write: Write;

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 15:11:36 GMT
 * Dependencies: [@types/node](https://npmjs.com/package/@types/node), [sw-toolbox](https://npmjs.com/package/sw-toolbox)

# Credits
These definitions were written by [JounQin](https://github.com/JounQin).

---
_Source: https://npm.io/package/@types/sw-precache · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
