workbox-streams
Advanced tools
Comparing version 6.4.2 to 6.5.0
@@ -5,3 +5,3 @@ import './_version.js'; | ||
* @typedef {Response|ReadableStream|BodyInit} StreamSource | ||
* @memberof module:workbox-streams | ||
* @memberof workbox-streams | ||
*/ |
@@ -17,3 +17,3 @@ /* | ||
* @typedef {Response|ReadableStream|BodyInit} StreamSource | ||
* @memberof module:workbox-streams | ||
* @memberof workbox-streams | ||
*/ |
"use strict"; | ||
// @ts-ignore | ||
try { | ||
self['workbox:streams:6.4.1'] && _(); | ||
self['workbox:streams:6.4.2'] && _(); | ||
} | ||
catch (e) { } |
this.workbox = this.workbox || {}; | ||
this.workbox.streams = (function (exports, logger_js, assert_js, Deferred_js, canConstructReadableStream_js) { | ||
this.workbox.streams = (function (exports, assert_js, Deferred_js, logger_js, WorkboxError_js, canConstructReadableStream_js) { | ||
'use strict'; | ||
try { | ||
self['workbox:streams:6.4.1'] && _(); | ||
self['workbox:streams:6.4.2'] && _(); | ||
} catch (e) {} | ||
@@ -21,3 +21,3 @@ | ||
* | ||
* @param {module:workbox-streams.StreamSource} source | ||
* @param {workbox-streams.StreamSource} source | ||
* @return {ReadableStreamReader} | ||
@@ -29,3 +29,10 @@ * @private | ||
if (source instanceof Response) { | ||
return source.body.getReader(); | ||
// See https://github.com/GoogleChrome/workbox/issues/2998 | ||
if (source.body) { | ||
return source.body.getReader(); | ||
} | ||
throw new WorkboxError_js.WorkboxError('opaque-streams-source', { | ||
type: source.type | ||
}); | ||
} | ||
@@ -47,6 +54,6 @@ | ||
* | ||
* @param {Array<Promise<module:workbox-streams.StreamSource>>} sourcePromises | ||
* @param {Array<Promise<workbox-streams.StreamSource>>} sourcePromises | ||
* @return {Object<{done: Promise, stream: ReadableStream}>} | ||
* | ||
* @memberof module:workbox-streams | ||
* @memberof workbox-streams | ||
*/ | ||
@@ -153,3 +160,3 @@ | ||
* | ||
* @memberof module:workbox-streams | ||
* @memberof workbox-streams | ||
*/ | ||
@@ -185,3 +192,3 @@ | ||
* | ||
* @param {Array<Promise<module:workbox-streams.StreamSource>>} sourcePromises | ||
* @param {Array<Promise<workbox-streams.StreamSource>>} sourcePromises | ||
* @param {HeadersInit} [headersInit] If there's no `Content-Type` specified, | ||
@@ -191,3 +198,3 @@ * `'text/html'` will be used by default. | ||
* | ||
* @memberof module:workbox-streams | ||
* @memberof workbox-streams | ||
*/ | ||
@@ -226,3 +233,3 @@ | ||
* | ||
* @memberof module:workbox-streams | ||
* @memberof workbox-streams | ||
*/ | ||
@@ -249,9 +256,9 @@ | ||
* @param {Array<function({event, request, url, params})>} sourceFunctions | ||
* An array of functions similar to {@link module:workbox-routing~handlerCallback} | ||
* but that instead return a {@link module:workbox-streams.StreamSource} (or a | ||
* An array of functions similar to {@link workbox-routing~handlerCallback} | ||
* but that instead return a {@link workbox-streams.StreamSource} (or a | ||
* Promise which resolves to one). | ||
* @param {HeadersInit} [headersInit] If there's no `Content-Type` specified, | ||
* `'text/html'` will be used by default. | ||
* @return {module:workbox-routing~handlerCallback} | ||
* @memberof module:workbox-streams | ||
* @return {workbox-routing~handlerCallback} | ||
* @memberof workbox-streams | ||
*/ | ||
@@ -325,3 +332,3 @@ | ||
}({}, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private)); | ||
}({}, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private)); | ||
//# sourceMappingURL=workbox-streams.dev.js.map |
@@ -1,2 +0,2 @@ | ||
this.workbox=this.workbox||{},this.workbox.streams=function(e,n,t){"use strict";try{self["workbox:streams:6.4.1"]&&_()}catch(e){}function s(e){const t=e.map((e=>Promise.resolve(e).then((e=>function(e){return e instanceof Response?e.body.getReader():e instanceof ReadableStream?e.getReader():new Response(e).body.getReader()}(e))))),s=new n.Deferred;let r=0;const o=new ReadableStream({pull(e){return t[r].then((e=>e.read())).then((n=>{if(n.done)return r++,r>=t.length?(e.close(),void s.resolve()):this.pull(e);e.enqueue(n.value)})).catch((e=>{throw s.reject(e),e}))},cancel(){s.resolve()}});return{done:s.promise,stream:o}}function r(e={}){const n=new Headers(e);return n.has("content-type")||n.set("content-type","text/html"),n}function o(e,n){const{done:t,stream:o}=s(e),c=r(n);return{done:t,response:new Response(o,{headers:c})}}function c(){return t.canConstructReadableStream()}return e.concatenate=s,e.concatenateToResponse=o,e.isSupported=c,e.strategy=function(e,n){return async({event:t,request:s,url:a,params:u})=>{const i=e.map((e=>Promise.resolve(e({event:t,request:s,url:a,params:u}))));if(c()){const{done:e,response:s}=o(i,n);return t&&t.waitUntil(e),s}const f=i.map((async e=>{const n=await e;return n instanceof Response?n.blob():new Response(n).blob()})),p=await Promise.all(f),w=r(n);return new Response(new Blob(p),{headers:w})}},e}({},workbox.core._private,workbox.core._private); | ||
this.workbox=this.workbox||{},this.workbox.streams=function(e,n,t,r){"use strict";try{self["workbox:streams:6.4.2"]&&_()}catch(e){}function s(e){const r=e.map((e=>Promise.resolve(e).then((e=>function(e){if(e instanceof Response){if(e.body)return e.body.getReader();throw new t.WorkboxError("opaque-streams-source",{type:e.type})}return e instanceof ReadableStream?e.getReader():new Response(e).body.getReader()}(e))))),s=new n.Deferred;let o=0;const a=new ReadableStream({pull(e){return r[o].then((e=>e.read())).then((n=>{if(n.done)return o++,o>=r.length?(e.close(),void s.resolve()):this.pull(e);e.enqueue(n.value)})).catch((e=>{throw s.reject(e),e}))},cancel(){s.resolve()}});return{done:s.promise,stream:a}}function o(e={}){const n=new Headers(e);return n.has("content-type")||n.set("content-type","text/html"),n}function a(e,n){const{done:t,stream:r}=s(e),a=o(n);return{done:t,response:new Response(r,{headers:a})}}function c(){return r.canConstructReadableStream()}return e.concatenate=s,e.concatenateToResponse=a,e.isSupported=c,e.strategy=function(e,n){return async({event:t,request:r,url:s,params:u})=>{const i=e.map((e=>Promise.resolve(e({event:t,request:r,url:s,params:u}))));if(c()){const{done:e,response:r}=a(i,n);return t&&t.waitUntil(e),r}const w=i.map((async e=>{const n=await e;return n instanceof Response?n.blob():new Response(n).blob()})),f=await Promise.all(w),p=o(n);return new Response(new Blob(f),{headers:p})}},e}({},workbox.core._private,workbox.core._private,workbox.core._private); | ||
//# sourceMappingURL=workbox-streams.prod.js.map |
@@ -11,6 +11,6 @@ import { StreamSource } from './_types.js'; | ||
* | ||
* @param {Array<Promise<module:workbox-streams.StreamSource>>} sourcePromises | ||
* @param {Array<Promise<workbox-streams.StreamSource>>} sourcePromises | ||
* @return {Object<{done: Promise, stream: ReadableStream}>} | ||
* | ||
* @memberof module:workbox-streams | ||
* @memberof workbox-streams | ||
*/ | ||
@@ -17,0 +17,0 @@ declare function concatenate(sourcePromises: Promise<StreamSource>[]): { |
@@ -8,5 +8,6 @@ /* | ||
*/ | ||
import { logger } from 'workbox-core/_private/logger.js'; | ||
import { assert } from 'workbox-core/_private/assert.js'; | ||
import { Deferred } from 'workbox-core/_private/Deferred.js'; | ||
import { logger } from 'workbox-core/_private/logger.js'; | ||
import { WorkboxError } from 'workbox-core/_private/WorkboxError.js'; | ||
import './_version.js'; | ||
@@ -18,3 +19,3 @@ /** | ||
* | ||
* @param {module:workbox-streams.StreamSource} source | ||
* @param {workbox-streams.StreamSource} source | ||
* @return {ReadableStreamReader} | ||
@@ -25,3 +26,7 @@ * @private | ||
if (source instanceof Response) { | ||
return source.body.getReader(); | ||
// See https://github.com/GoogleChrome/workbox/issues/2998 | ||
if (source.body) { | ||
return source.body.getReader(); | ||
} | ||
throw new WorkboxError('opaque-streams-source', { type: source.type }); | ||
} | ||
@@ -41,6 +46,6 @@ if (source instanceof ReadableStream) { | ||
* | ||
* @param {Array<Promise<module:workbox-streams.StreamSource>>} sourcePromises | ||
* @param {Array<Promise<workbox-streams.StreamSource>>} sourcePromises | ||
* @return {Object<{done: Promise, stream: ReadableStream}>} | ||
* | ||
* @memberof module:workbox-streams | ||
* @memberof workbox-streams | ||
*/ | ||
@@ -47,0 +52,0 @@ function concatenate(sourcePromises) { |
@@ -13,3 +13,3 @@ import { StreamSource } from './_types.js'; | ||
* | ||
* @param {Array<Promise<module:workbox-streams.StreamSource>>} sourcePromises | ||
* @param {Array<Promise<workbox-streams.StreamSource>>} sourcePromises | ||
* @param {HeadersInit} [headersInit] If there's no `Content-Type` specified, | ||
@@ -19,3 +19,3 @@ * `'text/html'` will be used by default. | ||
* | ||
* @memberof module:workbox-streams | ||
* @memberof workbox-streams | ||
*/ | ||
@@ -22,0 +22,0 @@ declare function concatenateToResponse(sourcePromises: Promise<StreamSource>[], headersInit: HeadersInit): { |
@@ -21,3 +21,3 @@ /* | ||
* | ||
* @param {Array<Promise<module:workbox-streams.StreamSource>>} sourcePromises | ||
* @param {Array<Promise<workbox-streams.StreamSource>>} sourcePromises | ||
* @param {HeadersInit} [headersInit] If there's no `Content-Type` specified, | ||
@@ -27,3 +27,3 @@ * `'text/html'` will be used by default. | ||
* | ||
* @memberof module:workbox-streams | ||
* @memberof workbox-streams | ||
*/ | ||
@@ -30,0 +30,0 @@ function concatenateToResponse(sourcePromises, headersInit) { |
@@ -11,5 +11,5 @@ import './_version.js'; | ||
* | ||
* @memberof module:workbox-streams | ||
* @memberof workbox-streams | ||
*/ | ||
declare function isSupported(): boolean; | ||
export { isSupported }; |
@@ -19,3 +19,3 @@ /* | ||
* | ||
* @memberof module:workbox-streams | ||
* @memberof workbox-streams | ||
*/ | ||
@@ -22,0 +22,0 @@ function isSupported() { |
{ | ||
"name": "workbox-streams", | ||
"version": "6.4.2", | ||
"version": "6.5.0", | ||
"license": "MIT", | ||
@@ -26,6 +26,6 @@ "author": "Google's Web DevRel Team", | ||
"dependencies": { | ||
"workbox-core": "6.4.2", | ||
"workbox-routing": "6.4.2" | ||
"workbox-core": "6.5.0", | ||
"workbox-routing": "6.5.0" | ||
}, | ||
"gitHead": "9fae1320327a3a75bf71df9a76708978bd252428" | ||
"gitHead": "d796009eadcba556b2795e0fea7d71a241f535e0" | ||
} |
@@ -22,3 +22,3 @@ /* | ||
* @typedef {Response|ReadableStream|BodyInit} StreamSource | ||
* @memberof module:workbox-streams | ||
* @memberof workbox-streams | ||
*/ |
// @ts-ignore | ||
try{self['workbox:streams:6.4.2']&&_()}catch(e){} | ||
try{self['workbox:streams:6.5.0']&&_()}catch(e){} |
@@ -9,6 +9,8 @@ /* | ||
import {logger} from 'workbox-core/_private/logger.js'; | ||
import {assert} from 'workbox-core/_private/assert.js'; | ||
import {Deferred} from 'workbox-core/_private/Deferred.js'; | ||
import {logger} from 'workbox-core/_private/logger.js'; | ||
import {StreamSource} from './_types.js'; | ||
import {WorkboxError} from 'workbox-core/_private/WorkboxError.js'; | ||
import './_version.js'; | ||
@@ -21,3 +23,3 @@ | ||
* | ||
* @param {module:workbox-streams.StreamSource} source | ||
* @param {workbox-streams.StreamSource} source | ||
* @return {ReadableStreamReader} | ||
@@ -30,3 +32,7 @@ * @private | ||
if (source instanceof Response) { | ||
return source.body!.getReader(); | ||
// See https://github.com/GoogleChrome/workbox/issues/2998 | ||
if (source.body) { | ||
return source.body.getReader(); | ||
} | ||
throw new WorkboxError('opaque-streams-source', {type: source.type}); | ||
} | ||
@@ -47,6 +53,6 @@ if (source instanceof ReadableStream) { | ||
* | ||
* @param {Array<Promise<module:workbox-streams.StreamSource>>} sourcePromises | ||
* @param {Array<Promise<workbox-streams.StreamSource>>} sourcePromises | ||
* @return {Object<{done: Promise, stream: ReadableStream}>} | ||
* | ||
* @memberof module:workbox-streams | ||
* @memberof workbox-streams | ||
*/ | ||
@@ -53,0 +59,0 @@ function concatenate(sourcePromises: Promise<StreamSource>[]): { |
@@ -24,3 +24,3 @@ /* | ||
* | ||
* @param {Array<Promise<module:workbox-streams.StreamSource>>} sourcePromises | ||
* @param {Array<Promise<workbox-streams.StreamSource>>} sourcePromises | ||
* @param {HeadersInit} [headersInit] If there's no `Content-Type` specified, | ||
@@ -30,3 +30,3 @@ * `'text/html'` will be used by default. | ||
* | ||
* @memberof module:workbox-streams | ||
* @memberof workbox-streams | ||
*/ | ||
@@ -33,0 +33,0 @@ function concatenateToResponse( |
@@ -21,3 +21,3 @@ /* | ||
* | ||
* @memberof module:workbox-streams | ||
* @memberof workbox-streams | ||
*/ | ||
@@ -24,0 +24,0 @@ function isSupported(): boolean { |
@@ -34,9 +34,9 @@ /* | ||
* @param {Array<function({event, request, url, params})>} sourceFunctions | ||
* An array of functions similar to {@link module:workbox-routing~handlerCallback} | ||
* but that instead return a {@link module:workbox-streams.StreamSource} (or a | ||
* An array of functions similar to {@link workbox-routing~handlerCallback} | ||
* but that instead return a {@link workbox-streams.StreamSource} (or a | ||
* Promise which resolves to one). | ||
* @param {HeadersInit} [headersInit] If there's no `Content-Type` specified, | ||
* `'text/html'` will be used by default. | ||
* @return {module:workbox-routing~handlerCallback} | ||
* @memberof module:workbox-streams | ||
* @return {workbox-routing~handlerCallback} | ||
* @memberof workbox-streams | ||
*/ | ||
@@ -43,0 +43,0 @@ function strategy( |
@@ -23,3 +23,3 @@ /* | ||
* | ||
* @memberof module:workbox-streams | ||
* @memberof workbox-streams | ||
*/ | ||
@@ -26,0 +26,0 @@ function createHeaders(headersInit = {}): Headers { |
@@ -15,11 +15,11 @@ import { RouteHandlerCallback, RouteHandlerCallbackOptions } from 'workbox-core/types.js'; | ||
* @param {Array<function({event, request, url, params})>} sourceFunctions | ||
* An array of functions similar to {@link module:workbox-routing~handlerCallback} | ||
* but that instead return a {@link module:workbox-streams.StreamSource} (or a | ||
* An array of functions similar to {@link workbox-routing~handlerCallback} | ||
* but that instead return a {@link workbox-streams.StreamSource} (or a | ||
* Promise which resolves to one). | ||
* @param {HeadersInit} [headersInit] If there's no `Content-Type` specified, | ||
* `'text/html'` will be used by default. | ||
* @return {module:workbox-routing~handlerCallback} | ||
* @memberof module:workbox-streams | ||
* @return {workbox-routing~handlerCallback} | ||
* @memberof workbox-streams | ||
*/ | ||
declare function strategy(sourceFunctions: StreamsHandlerCallback[], headersInit: HeadersInit): RouteHandlerCallback; | ||
export { strategy }; |
@@ -21,9 +21,9 @@ /* | ||
* @param {Array<function({event, request, url, params})>} sourceFunctions | ||
* An array of functions similar to {@link module:workbox-routing~handlerCallback} | ||
* but that instead return a {@link module:workbox-streams.StreamSource} (or a | ||
* An array of functions similar to {@link workbox-routing~handlerCallback} | ||
* but that instead return a {@link workbox-streams.StreamSource} (or a | ||
* Promise which resolves to one). | ||
* @param {HeadersInit} [headersInit] If there's no `Content-Type` specified, | ||
* `'text/html'` will be used by default. | ||
* @return {module:workbox-routing~handlerCallback} | ||
* @memberof module:workbox-streams | ||
* @return {workbox-routing~handlerCallback} | ||
* @memberof workbox-streams | ||
*/ | ||
@@ -30,0 +30,0 @@ function strategy(sourceFunctions, headersInit) { |
@@ -14,5 +14,5 @@ import '../_version.js'; | ||
* | ||
* @memberof module:workbox-streams | ||
* @memberof workbox-streams | ||
*/ | ||
declare function createHeaders(headersInit?: {}): Headers; | ||
export { createHeaders }; |
@@ -21,3 +21,3 @@ /* | ||
* | ||
* @memberof module:workbox-streams | ||
* @memberof workbox-streams | ||
*/ | ||
@@ -24,0 +24,0 @@ function createHeaders(headersInit = {}) { |
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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
97587
1056
+ Addedworkbox-core@6.5.0(transitive)
+ Addedworkbox-routing@6.5.0(transitive)
- Removedworkbox-core@6.4.2(transitive)
- Removedworkbox-routing@6.4.2(transitive)
Updatedworkbox-core@6.5.0
Updatedworkbox-routing@6.5.0