Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the stategy function into its own file #1635

Merged
merged 1 commit into from
Sep 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/workbox-streams/_public.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
import {concatenate} from './concatenate.mjs';
import {concatenateToResponse} from './concatenateToResponse.mjs';
import {isSupported} from './isSupported.mjs';
import {strategy} from './strategy.mjs';

import './_version.mjs';

export {
concatenate,
concatenateToResponse,
isSupported,
strategy,
};
6 changes: 1 addition & 5 deletions packages/workbox-streams/browser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
limitations under the License.
*/

import * as publicAPI from './_public.mjs';
import defaultExport from './_default.mjs';
import './_version.mjs';

const finalExport = Object.assign(defaultExport, publicAPI);

export default finalExport;
export * from './_public.mjs';
6 changes: 2 additions & 4 deletions packages/workbox-streams/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@
limitations under the License.
*/

import './_version.mjs';

/**
* @namespace workbox.streams
*/

import defaultExport from './_default.mjs';
import './_version.mjs';

export default defaultExport;
export * from './_public.mjs';
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import {logger} from 'workbox-core/_private/logger.mjs';

import {createHeaders} from './utils/createHeaders.mjs';
import {concatenate} from './concatenate.mjs';
import {concatenateToResponse} from './concatenateToResponse.mjs';
import {isSupported} from './isSupported.mjs';

Expand All @@ -39,7 +38,7 @@ import './_version.mjs';
*
* @memberof workbox.streams
*/
function strategy(sourceFunctions, headersInit) {
export function strategy(sourceFunctions, headersInit) {
return async ({event, url, params}) => {
if (isSupported()) {
const {done, response} = concatenateToResponse(sourceFunctions.map(
Expand Down Expand Up @@ -76,10 +75,3 @@ function strategy(sourceFunctions, headersInit) {
return new Response(new Blob(parts), {headers});
};
}

export default {
concatenate,
concatenateToResponse,
isSupported,
strategy,
};