{"id":13782448,"url":"https://github.com/mischnic/parcel-plugin-sw-cache","last_synced_at":"2025-03-17T08:37:19.310Z","repository":{"id":47417926,"uuid":"118506465","full_name":"mischnic/parcel-plugin-sw-cache","owner":"mischnic","description":"📦👷  Parcel plugin for caching using a service worker","archived":false,"fork":false,"pushed_at":"2023-01-03T23:41:57.000Z","size":1404,"stargazers_count":47,"open_issues_count":13,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-27T21:37:08.282Z","etag":null,"topics":["offline-first","parcel","parcel-plugin","precache","progressive-web-app","service-worker","workbox"],"latest_commit_sha":null,"homepage":"https://npm.im/parcel-plugin-sw-cache","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mischnic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-22T19:46:38.000Z","updated_at":"2022-03-01T17:56:02.000Z","dependencies_parsed_at":"2023-02-01T14:02:21.177Z","dependency_job_id":null,"html_url":"https://github.com/mischnic/parcel-plugin-sw-cache","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mischnic%2Fparcel-plugin-sw-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mischnic%2Fparcel-plugin-sw-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mischnic%2Fparcel-plugin-sw-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mischnic%2Fparcel-plugin-sw-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mischnic","download_url":"https://codeload.github.com/mischnic/parcel-plugin-sw-cache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243852485,"owners_count":20358271,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["offline-first","parcel","parcel-plugin","precache","progressive-web-app","service-worker","workbox"],"created_at":"2024-08-03T18:01:37.238Z","updated_at":"2025-03-17T08:37:18.934Z","avatar_url":"https://github.com/mischnic.png","language":"JavaScript","readme":"# Parcel plugin for sw-caching\n\nA [Parcel](https://parceljs.org/) plugin to run [workbox-build](https://github.com/GoogleChrome/workbox) after every build.\n\n```sh\nyarn add -D parcel-plugin-sw-cache\n# or\nnpm install -D parcel-plugin-sw-cache\n```\n\nThe plugin is configured using the `cache` object inside `package.json` of your project. ([Example](example/package.json)).\nConfiguration keys used by the plugin (default options first):\n```js\n{\n    \"dependencies\": {\n        // ...\n    },\n    //...\n    \"cache\": {\n        \"disablePlugin\": false || true,\n        \"inDev\": false || true,\n        \"strategy\": \"default\" || \"inject\"\n        \"clearDist\": true || false\n    }\n    //...\n}\n```\n\nThe remaining properties in this object will be passed to `generateSW` or `injectManifest` (depending on `strategy`). See https://developers.google.com/web/tools/workbox/reference-docs/latest/module-workbox-build\n\nIn `inject` mode, occurences of  `__PUBLIC` will be replaced with Parcel's public-url option. In this case, `swSrc` is also a required parameter.\n\nNo configuration options are mandatory, the default configuration will work just fine. (Creating a service worker to precache all files in the output directory without runtime caching). With `strategy: \"default\"`, the default parameters passed to workbox-build are (which precaching all html, js, css, jpg and png files):\n```js\n{\n    globDirectory: outDir,\n    globPatterns: [\"**/*.{html,js,css,jpg,png}\"],\n    swDest: swDest,\n    navigateFallback: publicURL + \"/index.html\",\n    clientsClaim: true,\n    skipWaiting: true,\n    templatedURLs: {\n        \"/\": [\"index.html\"]\n    }\n}\n```\nand with `inject`:\n```js\n{\n    globDirectory: outDir,\n    globPatterns: [\n        \"**/*.{html,js,css,jpg,png,gif,svg,eot,ttf,woff,woff2}\"\n    ],\n    swDest: swDest,\n    templatedURLs: {\n        \"/\": [\"index.html\"]\n    }\n}\n```\n\nTo specify a RegExp, use an array instead (`ignoreURLParametersMatching`, `navigateFallbackWhitelist`, `runtimeCaching.urlPattern`, `injectionPointRegexp`).\n```js\nruntimeCaching: [\n    {\n        urlPattern: /my-match\\/api\\.[0-9]+/i\n    }\n]\n```\nbecomes\n```json\n\"runtimeCaching\": [\n    {\n        \"urlPattern\": [\"my-match\\/api\\\\.[0-9]+\", \"i\"]\n    }\n]\n```\n","funding_links":[],"categories":["Plugins","PWA"],"sub_categories":["Other"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmischnic%2Fparcel-plugin-sw-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmischnic%2Fparcel-plugin-sw-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmischnic%2Fparcel-plugin-sw-cache/lists"}