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

Conversation

philipwalton
Copy link
Member

This PR:

  • Moves the strategy() function form _default.mjs into it's own file, so it can be imported on it's own (e.g. import {strategy} from 'workbox-streams/strategy.mjs').
  • Removes the _default.mjs file as there's no "special" default export outside of what's already in _public.mjs.

R: @jeffposnick

@workbox-pr-bot
Copy link
Collaborator

PR-Bot Size Plugin

Changed File Sizes

File Before After Change GZipped
packages/workbox-streams/build/workbox-streams.prod.js 1.66 KB 1.57 KB -5% 739 B

New Files

No new files have been added.

All File Sizes

View Table
File Before After Change GZipped
packages/workbox-background-sync/build/workbox-background-sync.prod.js 3.51 KB 3.51 KB 0% 1.45 KB
packages/workbox-broadcast-cache-update/build/workbox-broadcast-cache-update.prod.js 1.12 KB 1.12 KB 0% 584 B
packages/workbox-build/build/_types.js 41 B 41 B 0% 61 B
packages/workbox-build/build/index.js 4.02 KB 4.02 KB 0% 1.57 KB
packages/workbox-cache-expiration/build/workbox-cache-expiration.prod.js 3.89 KB 3.89 KB 0% 1.37 KB
packages/workbox-cacheable-response/build/workbox-cacheable-response.prod.js 587 B 587 B 0% 346 B
packages/workbox-cli/build/app.js 6.76 KB 6.76 KB 0% 2.27 KB
packages/workbox-cli/build/bin.js 2.32 KB 2.32 KB 0% 1.03 KB
packages/workbox-core/build/workbox-core.prod.js 7.19 KB 7.19 KB 0% 2.84 KB
packages/workbox-google-analytics/build/workbox-google-analytics.prod.js 2.12 KB 2.12 KB 0% 1.03 KB
packages/workbox-navigation-preload/build/workbox-navigation-preload.prod.js 522 B 522 B 0% 298 B
packages/workbox-precaching/build/workbox-precaching.prod.js 5.57 KB 5.57 KB 0% 2.15 KB
packages/workbox-range-requests/build/workbox-range-requests.prod.js 1.63 KB 1.63 KB 0% 798 B
packages/workbox-routing/build/workbox-routing.prod.js 2.87 KB 2.87 KB 0% 1.31 KB
packages/workbox-strategies/build/workbox-strategies.prod.js 4.52 KB 4.52 KB 0% 1.17 KB
packages/workbox-streams/build/workbox-streams.prod.js 1.66 KB 1.57 KB -5% 739 B
packages/workbox-sw/build/workbox-sw.js 1.50 KB 1.50 KB 0% 810 B
packages/workbox-webpack-plugin/build/generate-sw.js 8.04 KB 8.04 KB 0% 2.57 KB
packages/workbox-webpack-plugin/build/index.js 742 B 742 B 0% 470 B
packages/workbox-webpack-plugin/build/inject-manifest.js 10.30 KB 10.30 KB 0% 3.23 KB

Workbox Aggregate Size Plugin

9.75KB gzip'ed (65% of limit)
25.51KB uncompressed

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.003%) to 86.117% when pulling be84ed2 on streams-structure into 6c054a7 on master.

@philipwalton
Copy link
Member Author

Some additional notes: this is actually even harder to use than I'd originally thought. At the moment if you want to use strategy via import, you have to pull in the entire module since named exports aren't used (only the default), and you have to reference the private _default.mjs file.

In other words, you can't do this:

import {strategy} from 'workbox-streams';

Or this (my preferred approach):

import {strategy} from 'workbox-streams/strategy.mjs';

You have to do this:

import streams from 'workbox-streams/_default.mjs';

// Then use `strategy` as a property fo the `streams` default export...

(Sorry for not catching this in my review of streams package...)

@jeffposnick jeffposnick self-requested a review September 17, 2018 14:54
Copy link
Contributor

@jeffposnick jeffposnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

A lot of the JS module exports are a black box to me, so if you think there are other packages that need remediation (and it's backwards-compatible), go for it.

@jeffposnick jeffposnick merged commit 685fd1b into master Sep 17, 2018
@jeffposnick jeffposnick deleted the streams-structure branch September 17, 2018 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants