Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

workbox-routing

Package Overview
Dependencies
Maintainers
3
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

workbox-routing - npm Package Compare versions

Comparing version 3.0.0-alpha.2 to 3.0.0-alpha.3

2

build/workbox-routing.dev.js

@@ -6,3 +6,3 @@ this.workbox = this.workbox || {};

try {
self.workbox.v['workbox:routing:3.0.0-alpha.2'] = 1;
self.workbox.v['workbox:routing:3.0.0-alpha.3'] = 1;
} catch (e) {} // eslint-disable-line

@@ -9,0 +9,0 @@

@@ -1,2 +0,2 @@

this.workbox=this.workbox||{},this.workbox.routing=function(t,e){"use strict";try{self.workbox.v["workbox:routing:3.0.0-alpha.2"]=1}catch(t){}var r=t=>t&&"object"==typeof t?t:{handle:t};class s{constructor(t,e,s){this.handler=r(e),this.match=t,this.method=s||"GET"}}class n extends s{constructor(t,e,r){super(({url:e})=>{const r=t.exec(e.href);return r?e.origin!==location.origin&&0!==r.index?null:r.slice(1):null},e,r)}}class o{constructor(){this.t=new Map}handleRequest(t){const e=new URL(t.request.url);if(!e.protocol.startsWith("http"))return;let r=null,s=null;const n=this.e(t,e);if(r=n.handler,s=n.params,!r&&this.r&&(r=this.r),!r)return;let o;try{o=r.handle({url:e,event:t,params:s})}catch(t){o=Promise.reject(t)}return o&&this.s&&(o=o.catch(r=>this.s.handle({url:e,event:t,err:r}))),o}e(t,e){const r=this.t.get(t.request.method)||[];for(const s of r){let r=s.match({url:e,event:t});if(r)return Array.isArray(r)&&0===r.length?r=void 0:(r.constructor===Object&&0===Object.keys(r).length||!0===r)&&(r=void 0),{route:s,params:r,handler:s.handler}}return{handler:void 0,params:void 0}}setDefaultHandler(t){this.r=r(t)}setCatchHandler(t){this.s=r(t)}registerRoute(t){this.t.has(t.method)||this.t.set(t.method,[]),this.t.get(t.method).push(t)}unregisterRoute(e){if(!this.t.has(e.method))throw new t.WorkboxError("unregister-route-but-not-found-with-method",{method:e.method});const r=this.t.get(e.method).indexOf(e);if(!(r>-1))throw new t.WorkboxError("unregister-route-route-not-registered");this.t.get(e.method).splice(r,1)}}class i extends s{constructor(t,{whitelist:e=[/./],blacklist:r=[]}={}){super((...t)=>this.n(...t),t),this.o=e,this.i=r}n({event:t,url:e}){if("navigate"!==t.request.mode)return!1;const r=e.pathname+e.search;return!this.i.some(t=>t.test(r))&&!!this.o.some(t=>t.test(r))}}var u=Object.freeze({RegExpRoute:n,Route:s,Router:o,NavigationRoute:i});class a extends o{registerRoute(e,r,o="GET"){let i;if("string"==typeof e){const t=new URL(e,location);i=new s(({url:e})=>e.href===t.href,r,o)}else if(e instanceof RegExp)i=new n(e,r,o);else if("function"==typeof e)i=new s(e,r,o);else{if(!(e instanceof s))throw new t.WorkboxError("unsupported-route-type",{moduleName:"workbox-routing",className:"DefaultRouter",funcName:"registerRoute",paramName:"capture"});i=e}return super.registerRoute(i),i}registerNavigationRoute(t,r={}){const s=e.cacheNames.getPrecacheName(r.cacheName),n=new i(()=>caches.match(t,{cacheName:s}),{whitelist:r.whitelist,blacklist:r.blacklist});return super.registerRoute(n),n}}const c=new a;return self.addEventListener("fetch",t=>{const e=c.handleRequest(t);e&&t.respondWith(e)}),Object.assign(c,u)}(workbox.core._private,workbox.core._private);
this.workbox=this.workbox||{},this.workbox.routing=function(t,e){"use strict";try{self.workbox.v["workbox:routing:3.0.0-alpha.3"]=1}catch(t){}var r=t=>t&&"object"==typeof t?t:{handle:t};class s{constructor(t,e,s){this.handler=r(e),this.match=t,this.method=s||"GET"}}class n extends s{constructor(t,e,r){super(({url:e})=>{const r=t.exec(e.href);return r?e.origin!==location.origin&&0!==r.index?null:r.slice(1):null},e,r)}}class o{constructor(){this.t=new Map}handleRequest(t){const e=new URL(t.request.url);if(!e.protocol.startsWith("http"))return;let r=null,s=null;const n=this.e(t,e);if(r=n.handler,s=n.params,!r&&this.r&&(r=this.r),!r)return;let o;try{o=r.handle({url:e,event:t,params:s})}catch(t){o=Promise.reject(t)}return o&&this.s&&(o=o.catch(r=>this.s.handle({url:e,event:t,err:r}))),o}e(t,e){const r=this.t.get(t.request.method)||[];for(const s of r){let r=s.match({url:e,event:t});if(r)return Array.isArray(r)&&0===r.length?r=void 0:(r.constructor===Object&&0===Object.keys(r).length||!0===r)&&(r=void 0),{route:s,params:r,handler:s.handler}}return{handler:void 0,params:void 0}}setDefaultHandler(t){this.r=r(t)}setCatchHandler(t){this.s=r(t)}registerRoute(t){this.t.has(t.method)||this.t.set(t.method,[]),this.t.get(t.method).push(t)}unregisterRoute(e){if(!this.t.has(e.method))throw new t.WorkboxError("unregister-route-but-not-found-with-method",{method:e.method});const r=this.t.get(e.method).indexOf(e);if(!(r>-1))throw new t.WorkboxError("unregister-route-route-not-registered");this.t.get(e.method).splice(r,1)}}class i extends s{constructor(t,{whitelist:e=[/./],blacklist:r=[]}={}){super((...t)=>this.n(...t),t),this.o=e,this.i=r}n({event:t,url:e}){if("navigate"!==t.request.mode)return!1;const r=e.pathname+e.search;return!this.i.some(t=>t.test(r))&&!!this.o.some(t=>t.test(r))}}var u=Object.freeze({RegExpRoute:n,Route:s,Router:o,NavigationRoute:i});class a extends o{registerRoute(e,r,o="GET"){let i;if("string"==typeof e){const t=new URL(e,location);i=new s(({url:e})=>e.href===t.href,r,o)}else if(e instanceof RegExp)i=new n(e,r,o);else if("function"==typeof e)i=new s(e,r,o);else{if(!(e instanceof s))throw new t.WorkboxError("unsupported-route-type",{moduleName:"workbox-routing",className:"DefaultRouter",funcName:"registerRoute",paramName:"capture"});i=e}return super.registerRoute(i),i}registerNavigationRoute(t,r={}){const s=e.cacheNames.getPrecacheName(r.cacheName),n=new i(()=>caches.match(t,{cacheName:s}),{whitelist:r.whitelist,blacklist:r.blacklist});return super.registerRoute(n),n}}const c=new a;return self.addEventListener("fetch",t=>{const e=c.handleRequest(t);e&&t.respondWith(e)}),Object.assign(c,u)}(workbox.core._private,workbox.core._private);
//# sourceMappingURL=workbox-routing.prod.js.map
{
"name": "workbox-routing",
"version": "3.0.0-alpha.2",
"version": "3.0.0-alpha.3",
"license": "Apache-2.0",

@@ -30,4 +30,4 @@ "author": "Google's Web DevRel Team",

"dependencies": {
"workbox-core": "^3.0.0-alpha.2"
"workbox-core": "^3.0.0-alpha.3"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc