workbox-streams
Advanced tools
Comparing version 7.0.0 to 7.1.0
@@ -5,2 +5,3 @@ this.workbox = this.workbox || {}; | ||
// @ts-ignore | ||
try { | ||
@@ -26,3 +27,2 @@ self['workbox:streams:7.0.0'] && _(); | ||
*/ | ||
function _getReaderFromSource(source) { | ||
@@ -34,3 +34,2 @@ if (source instanceof Response) { | ||
} | ||
throw new WorkboxError_js.WorkboxError('opaque-streams-source', { | ||
@@ -40,7 +39,5 @@ type: source.type | ||
} | ||
if (source instanceof ReadableStream) { | ||
return source.getReader(); | ||
} | ||
return new Response(source).body.getReader(); | ||
@@ -61,4 +58,2 @@ } | ||
*/ | ||
function concatenate(sourcePromises) { | ||
@@ -72,3 +67,2 @@ { | ||
} | ||
const readerPromises = sourcePromises.map(sourcePromise => { | ||
@@ -95,5 +89,3 @@ return Promise.resolve(sourcePromise).then(source => { | ||
} | ||
i++; | ||
if (i >= readerPromises.length) { | ||
@@ -103,3 +95,2 @@ // Log all the messages in the group at once in a single group. | ||
logger_js.logger.groupCollapsed(`Concatenating ${readerPromises.length} sources.`); | ||
for (const message of logMessages) { | ||
@@ -112,13 +103,10 @@ if (Array.isArray(message)) { | ||
} | ||
logger_js.logger.log('Finished reading all sources.'); | ||
logger_js.logger.groupEnd(); | ||
} | ||
controller.close(); | ||
streamDeferred.resolve(); | ||
return; | ||
} // The `pull` method is defined because we're inside it. | ||
} | ||
// The `pull` method is defined because we're inside it. | ||
return this.pull(controller); | ||
@@ -132,3 +120,2 @@ } else { | ||
} | ||
streamDeferred.reject(error); | ||
@@ -138,3 +125,2 @@ throw error; | ||
}, | ||
cancel() { | ||
@@ -144,6 +130,4 @@ { | ||
} | ||
streamDeferred.resolve(); | ||
} | ||
}); | ||
@@ -177,11 +161,8 @@ return { | ||
*/ | ||
function createHeaders(headersInit = {}) { | ||
// See https://github.com/GoogleChrome/workbox/issues/1461 | ||
const headers = new Headers(headersInit); | ||
if (!headers.has('content-type')) { | ||
headers.set('content-type', 'text/html'); | ||
} | ||
return headers; | ||
@@ -214,3 +195,2 @@ } | ||
*/ | ||
function concatenateToResponse(sourcePromises, headersInit) { | ||
@@ -249,3 +229,2 @@ const { | ||
*/ | ||
function isSupported() { | ||
@@ -278,3 +257,2 @@ return canConstructReadableStream_js.canConstructReadableStream(); | ||
*/ | ||
function strategy(sourceFunctions, headersInit) { | ||
@@ -296,3 +274,2 @@ return async ({ | ||
}); | ||
if (isSupported()) { | ||
@@ -303,19 +280,14 @@ const { | ||
} = concatenateToResponse(sourcePromises, headersInit); | ||
if (event) { | ||
event.waitUntil(done); | ||
} | ||
return response; | ||
} | ||
{ | ||
logger_js.logger.log(`The current browser doesn't support creating response ` + `streams. Falling back to non-streaming response instead.`); | ||
} // Fallback to waiting for everything to finish, and concatenating the | ||
} | ||
// Fallback to waiting for everything to finish, and concatenating the | ||
// responses. | ||
const blobPartsPromises = sourcePromises.map(async sourcePromise => { | ||
const source = await sourcePromise; | ||
if (source instanceof Response) { | ||
@@ -332,5 +304,5 @@ return source.blob(); | ||
const blobParts = await Promise.all(blobPartsPromises); | ||
const headers = createHeaders(headersInit); // Constructing a new Response from a Blob source is well-supported. | ||
const headers = createHeaders(headersInit); | ||
// Constructing a new Response from a Blob source is well-supported. | ||
// So is constructing a new Blob from multiple source Blobs or strings. | ||
return new Response(new Blob(blobParts), { | ||
@@ -349,3 +321,3 @@ headers | ||
}({}, 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, workbox.core._private); | ||
//# sourceMappingURL=workbox-streams.dev.js.map |
{ | ||
"name": "workbox-streams", | ||
"version": "7.0.0", | ||
"version": "7.1.0", | ||
"license": "MIT", | ||
@@ -26,6 +26,6 @@ "author": "Google's Web DevRel Team", | ||
"dependencies": { | ||
"workbox-core": "7.0.0", | ||
"workbox-routing": "7.0.0" | ||
"workbox-core": "7.1.0", | ||
"workbox-routing": "7.1.0" | ||
}, | ||
"gitHead": "c1d11636823e5e3a89520f7a531970a39304b14a" | ||
"gitHead": "9e69c4269c35e2db9fbba4d13e4e6206c7b66d2a" | ||
} |
// @ts-ignore | ||
try{self['workbox:streams:7.0.0']&&_()}catch(e){} | ||
try{self['workbox:streams:7.1.0']&&_()}catch(e){} |
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
109516
1086
+ Addedworkbox-core@7.1.0(transitive)
+ Addedworkbox-routing@7.1.0(transitive)
- Removedworkbox-core@7.0.0(transitive)
- Removedworkbox-routing@7.0.0(transitive)
Updatedworkbox-core@7.1.0
Updatedworkbox-routing@7.1.0