Socket
Socket
Sign inDemoInstall

workbox-streams

Package Overview
Dependencies
Maintainers
4
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

workbox-streams - npm Package Compare versions

Comparing version 5.0.0-rc.1 to 5.0.0-rc.2

4

_types.d.ts
import './_version.js';
export declare type StreamSource = Response | ReadableStream | BodyInit;
/**
* @typedef {Response|ReadableStream|BodyInit} StreamSource
* @memberof workbox.streams
* @memberof module:workbox-streams
*/
export declare type StreamSource = Response | ReadableStream | BodyInit;

@@ -9,1 +9,11 @@ /*

import './_version.js';
// * * * IMPORTANT! * * *
// ------------------------------------------------------------------------- //
// jdsoc type definitions cannot be declared above TypeScript definitions or
// they'll be stripped from the built `.js` files, and they'll only be in the
// `d.ts` files, which aren't read by the jsdoc generator. As a result we
// have to put declare them below.
/**
* @typedef {Response|ReadableStream|BodyInit} StreamSource
* @memberof module:workbox-streams
*/
"use strict";
// @ts-ignore
try {
self['workbox:streams:5.0.0-rc.1'] && _();
self['workbox:streams:5.0.0-rc.2'] && _();
}
catch (e) { }

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

try {
self['workbox:streams:5.0.0-rc.1'] && _();
self['workbox:streams:5.0.0-rc.2'] && _();
} catch (e) {}

@@ -22,3 +22,3 @@

*
* @param {workbox.streams.StreamSource} source
* @param {module:workbox-streams.StreamSource} source
* @return {ReadableStreamReader}

@@ -47,6 +47,6 @@ * @private

*
* @param {Array<Promise<workbox.streams.StreamSource>>} sourcePromises
* @param {Array<Promise<module:workbox-streams.StreamSource>>} sourcePromises
* @return {Object<{done: Promise, stream: ReadableStream}>}
*
* @memberof workbox.streams
* @memberof module:workbox-streams
*/

@@ -147,2 +147,3 @@

*
* @private
* @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,

@@ -153,3 +154,3 @@ * `'text/html'` will be used by default.

*
* @memberof workbox.streams
* @memberof module:workbox-streams
*/

@@ -185,3 +186,3 @@

*
* @param {Array<Promise<workbox.streams.StreamSource>>} sourcePromises
* @param {Array<Promise<module:workbox-streams.StreamSource>>} sourcePromises
* @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,

@@ -191,3 +192,3 @@ * `'text/html'` will be used by default.

*
* @memberof workbox.streams
* @memberof module:workbox-streams
*/

@@ -226,3 +227,3 @@

*
* @memberof workbox.streams
* @memberof module:workbox-streams
*/

@@ -249,10 +250,9 @@

* @param {Array<function({event, request, url, params})>} sourceFunctions
* An array of functions similar to {@link workbox.routing.Route~handlerCallback}
* but that instead return a {@link workbox.streams.StreamSource} (or a
* An array of functions similar to {@link module:workbox-routing~handlerCallback}
* but that instead return a {@link module: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 {workbox.routing.Route~handlerCallback}
*
* @memberof workbox.streams
* @return {module:workbox-routing~handlerCallback}
* @memberof module:workbox-streams
*/

@@ -259,0 +259,0 @@

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

this.workbox=this.workbox||{},this.workbox.streams=function(e,n,t){"use strict";try{self["workbox:streams:5.0.0-rc.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>=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){"use strict";try{self["workbox:streams:5.0.0-rc.2"]&&_()}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>=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);
//# sourceMappingURL=workbox-streams.prod.js.map

@@ -11,6 +11,6 @@ import { StreamSource } from './_types.js';

*
* @param {Array<Promise<workbox.streams.StreamSource>>} sourcePromises
* @param {Array<Promise<module:workbox-streams.StreamSource>>} sourcePromises
* @return {Object<{done: Promise, stream: ReadableStream}>}
*
* @memberof workbox.streams
* @memberof module:workbox-streams
*/

@@ -17,0 +17,0 @@ declare function concatenate(sourcePromises: Promise<StreamSource>[]): {

@@ -17,3 +17,3 @@ /*

*
* @param {workbox.streams.StreamSource} source
* @param {module:workbox-streams.StreamSource} source
* @return {ReadableStreamReader}

@@ -39,6 +39,6 @@ * @private

*
* @param {Array<Promise<workbox.streams.StreamSource>>} sourcePromises
* @param {Array<Promise<module:workbox-streams.StreamSource>>} sourcePromises
* @return {Object<{done: Promise, stream: ReadableStream}>}
*
* @memberof workbox.streams
* @memberof module:workbox-streams
*/

@@ -45,0 +45,0 @@ function concatenate(sourcePromises) {

@@ -13,3 +13,3 @@ import { StreamSource } from './_types.js';

*
* @param {Array<Promise<workbox.streams.StreamSource>>} sourcePromises
* @param {Array<Promise<module: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 workbox.streams
* @memberof module:workbox-streams
*/

@@ -22,0 +22,0 @@ declare function concatenateToResponse(sourcePromises: Promise<StreamSource>[], headersInit: HeadersInit): {

@@ -21,3 +21,3 @@ /*

*
* @param {Array<Promise<workbox.streams.StreamSource>>} sourcePromises
* @param {Array<Promise<module: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 workbox.streams
* @memberof module:workbox-streams
*/

@@ -30,0 +30,0 @@ function concatenateToResponse(sourcePromises, headersInit) {

@@ -7,4 +7,4 @@ import { concatenate } from './concatenate.js';

/**
* @namespace workbox.streams
* @module workbox-streams
*/
export { concatenate, concatenateToResponse, isSupported, strategy, };

@@ -14,4 +14,4 @@ /*

/**
* @namespace workbox.streams
* @module workbox-streams
*/
export { concatenate, concatenateToResponse, isSupported, strategy, };

@@ -11,5 +11,5 @@ import './_version.js';

*
* @memberof workbox.streams
* @memberof module:workbox-streams
*/
declare function isSupported(): boolean;
export { isSupported };

@@ -19,3 +19,3 @@ /*

*
* @memberof workbox.streams
* @memberof module:workbox-streams
*/

@@ -22,0 +22,0 @@ function isSupported() {

{
"name": "workbox-streams",
"version": "5.0.0-rc.1",
"version": "5.0.0-rc.2",
"license": "MIT",

@@ -31,6 +31,6 @@ "author": "Google's Web DevRel Team",

"dependencies": {
"workbox-core": "^5.0.0-rc.1",
"workbox-routing": "^5.0.0-rc.1"
"workbox-core": "^5.0.0-rc.2",
"workbox-routing": "^5.0.0-rc.2"
},
"gitHead": "f03f71e50507e13d82d4e0a875cc49ba4501aff3"
"gitHead": "89904768b2210e59c830dd380cf88a06e1c26a2b"
}

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

This module's documentation can be found at https://developers.google.com/web/tools/workbox/reference-docs/latest/workbox.streams
This module's documentation can be found at https://developers.google.com/web/tools/workbox/reference-docs/latest/module-workbox-streams

@@ -11,7 +11,15 @@ /*

export type StreamSource = Response | ReadableStream | BodyInit;
// * * * IMPORTANT! * * *
// ------------------------------------------------------------------------- //
// jdsoc type definitions cannot be declared above TypeScript definitions or
// they'll be stripped from the built `.js` files, and they'll only be in the
// `d.ts` files, which aren't read by the jsdoc generator. As a result we
// have to put declare them below.
/**
* @typedef {Response|ReadableStream|BodyInit} StreamSource
* @memberof workbox.streams
* @memberof module:workbox-streams
*/
export type StreamSource = Response | ReadableStream | BodyInit;
// @ts-ignore
try{self['workbox:streams:5.0.0-rc.1']&&_()}catch(e){}
try{self['workbox:streams:5.0.0-rc.2']&&_()}catch(e){}

@@ -20,3 +20,3 @@ /*

*
* @param {workbox.streams.StreamSource} source
* @param {module:workbox-streams.StreamSource} source
* @return {ReadableStreamReader}

@@ -43,6 +43,6 @@ * @private

*
* @param {Array<Promise<workbox.streams.StreamSource>>} sourcePromises
* @param {Array<Promise<module:workbox-streams.StreamSource>>} sourcePromises
* @return {Object<{done: Promise, stream: ReadableStream}>}
*
* @memberof workbox.streams
* @memberof module:workbox-streams
*/

@@ -49,0 +49,0 @@ function concatenate(sourcePromises: Promise<StreamSource>[]): {

@@ -25,3 +25,3 @@ /*

*
* @param {Array<Promise<workbox.streams.StreamSource>>} sourcePromises
* @param {Array<Promise<module:workbox-streams.StreamSource>>} sourcePromises
* @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,

@@ -31,3 +31,3 @@ * `'text/html'` will be used by default.

*
* @memberof workbox.streams
* @memberof module:workbox-streams
*/

@@ -34,0 +34,0 @@ function concatenateToResponse(

@@ -17,3 +17,3 @@ /*

/**
* @namespace workbox.streams
* @module workbox-streams
*/

@@ -20,0 +20,0 @@

@@ -22,3 +22,3 @@ /*

*
* @memberof workbox.streams
* @memberof module:workbox-streams
*/

@@ -25,0 +25,0 @@ function isSupported() {

@@ -30,10 +30,9 @@ /*

* @param {Array<function({event, request, url, params})>} sourceFunctions
* An array of functions similar to {@link workbox.routing.Route~handlerCallback}
* but that instead return a {@link workbox.streams.StreamSource} (or a
* An array of functions similar to {@link module:workbox-routing~handlerCallback}
* but that instead return a {@link module: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 {workbox.routing.Route~handlerCallback}
*
* @memberof workbox.streams
* @return {module:workbox-routing~handlerCallback}
* @memberof module:workbox-streams
*/

@@ -40,0 +39,0 @@ function strategy(

@@ -17,2 +17,3 @@ /*

*
* @private
* @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,

@@ -23,3 +24,3 @@ * `'text/html'` will be used by default.

*
* @memberof workbox.streams
* @memberof module:workbox-streams
*/

@@ -26,0 +27,0 @@ function createHeaders(headersInit = {}) {

@@ -15,12 +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 workbox.routing.Route~handlerCallback}
* but that instead return a {@link workbox.streams.StreamSource} (or a
* An array of functions similar to {@link module:workbox-routing~handlerCallback}
* but that instead return a {@link module: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 {workbox.routing.Route~handlerCallback}
*
* @memberof workbox.streams
* @return {module:workbox-routing~handlerCallback}
* @memberof module:workbox-streams
*/
declare function strategy(sourceFunctions: StreamsHandlerCallback[], headersInit: HeadersInit): RouteHandlerCallback;
export { strategy };

@@ -21,10 +21,9 @@ /*

* @param {Array<function({event, request, url, params})>} sourceFunctions
* An array of functions similar to {@link workbox.routing.Route~handlerCallback}
* but that instead return a {@link workbox.streams.StreamSource} (or a
* An array of functions similar to {@link module:workbox-routing~handlerCallback}
* but that instead return a {@link module: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 {workbox.routing.Route~handlerCallback}
*
* @memberof workbox.streams
* @return {module:workbox-routing~handlerCallback}
* @memberof module:workbox-streams
*/

@@ -31,0 +30,0 @@ function strategy(sourceFunctions, headersInit) {

@@ -8,2 +8,3 @@ import '../_version.js';

*
* @private
* @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,

@@ -14,5 +15,5 @@ * `'text/html'` will be used by default.

*
* @memberof workbox.streams
* @memberof module:workbox-streams
*/
declare function createHeaders(headersInit?: {}): Headers;
export { createHeaders };

@@ -15,2 +15,3 @@ /*

*
* @private
* @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,

@@ -21,3 +22,3 @@ * `'text/html'` will be used by default.

*
* @memberof workbox.streams
* @memberof module:workbox-streams
*/

@@ -24,0 +25,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

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