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

Log warning for bad cache control #1317

Merged
merged 3 commits into from
Feb 21, 2018
Merged

Log warning for bad cache control #1317

merged 3 commits into from
Feb 21, 2018

Conversation

gauntface
Copy link

R: @jeffposnick @addyosmani @gauntface

Fixes #620

Adds a basic test for cache-control header.

@gauntface gauntface added the Chillin' Not being actively worked on, or deferred for a point in the future. label Feb 16, 2018
@gauntface
Copy link
Author

Chillin till I can checkout the size growth (This should only be a dev feature).

@coveralls
Copy link

coveralls commented Feb 16, 2018

Coverage Status

Coverage decreased (-1.0%) to 88.224% when pulling 3f61ca0 on log-cache-control into df8dc74 on v3.

@gauntface gauntface removed the Chillin' Not being actively worked on, or deferred for a point in the future. label Feb 16, 2018
@gauntface
Copy link
Author

@jeffposnick a review would be appreciated - I figured out how to make rollup not include this stuff.

Copy link
Member

@addyosmani addyosmani left a comment

Choose a reason for hiding this comment

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

Had a quick read through. Check for cache headers and the warning logged LGTM.

(Smallest of nits we can address in the codebase later: we're still using 2017 in our license headers)

@@ -61,6 +62,8 @@ class WorkboxCore {
`${padding}https://github.com/GoogleChrome/workbox/issues/new`
);
logger.groupEnd();

checkSWFileCacheHeaders();
Copy link
Contributor

Choose a reason for hiding this comment

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

Small nit: could you wrap this in

if (typeof checkSWFileCacheHeaders === 'function') {
  checkSWFileCacheHeaders();
}

just to double-check that we're not somehow in a scenario in which it's set to null? I can't really imagine why that would happen with our normal builds, since this is in a NODE_ENV !== 'production' block , but I wonder if some custom build scenarios might end up leading to a mismatch.

@gauntface
Copy link
Author

@jeffposnick it shouldn't ever happen (It's following the same approach as assert class - but I added in the check regardless)

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.

Thanks for the extra check.

@workbox-pr-bot
Copy link
Collaborator

PR-Bot Size Plugin

Changed File Sizes

No file sizes have changed.

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.52 KB 3.52 KB 0% 1.45 KB
packages/workbox-broadcast-cache-update/build/workbox-broadcast-cache-update.prod.js 1.07 KB 1.07 KB 0% 573 B
packages/workbox-build/build/_types.js 41 B 41 B 0% 61 B
packages/workbox-build/build/index.js 2.52 KB 2.52 KB 0% 1.06 KB
packages/workbox-cache-expiration/build/workbox-cache-expiration.prod.js 3.41 KB 3.41 KB 0% 1.26 KB
packages/workbox-cacheable-response/build/workbox-cacheable-response.prod.js 594 B 594 B 0% 350 B
packages/workbox-cli/build/app.js 5.09 KB 5.09 KB 0% 1.86 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 6.48 KB 6.48 KB 0% 2.59 KB
packages/workbox-google-analytics/build/workbox-google-analytics.prod.js 2.12 KB 2.12 KB 0% 1.05 KB
packages/workbox-precaching/build/workbox-precaching.prod.js 5.26 KB 5.26 KB 0% 2.05 KB
packages/workbox-range-requests/build/workbox-range-requests.prod.js 1.64 KB 1.64 KB 0% 807 B
packages/workbox-routing/build/workbox-routing.prod.js 2.77 KB 2.77 KB 0% 1.25 KB
packages/workbox-strategies/build/workbox-strategies.prod.js 3.26 KB 3.26 KB 0% 1.02 KB
packages/workbox-sw/build/workbox-sw.js 1.46 KB 1.46 KB 0% 793 B
packages/workbox-webpack-plugin/build/generate-sw.js 6.41 KB 6.41 KB 0% 2.17 KB
packages/workbox-webpack-plugin/build/index.js 742 B 742 B 0% 470 B
packages/workbox-webpack-plugin/build/inject-manifest.js 8.82 KB 8.82 KB 0% 2.89 KB

Workbox Aggregate Size Plugin

☠️ WARNING ☠️

We are using 155% of our max size budget.

Total Size: 22.7KB
Percentage of Size Used: 155%

Gzipped: 9.1KB

@gauntface gauntface merged commit aee6b98 into v3 Feb 21, 2018
@gauntface gauntface deleted the log-cache-control branch February 21, 2018 19:14
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.

5 participants