-
Notifications
You must be signed in to change notification settings - Fork 831
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
Revamp the runtime caching option conversion. #1160
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -38,16 +38,25 @@ module.exports = baseSchema.keys({ | |||
'staleWhileRevalidate' | ||||
)], | ||||
options: joi.object().keys({ | ||||
cacheName: joi.string(), | ||||
plugins: joi.array().items(joi.object()), | ||||
cacheExpiration: joi.object().keys({ | ||||
maxEntries: joi.number().min(1), | ||||
maxAgeSeconds: joi.number().min(1), | ||||
}).or('maxEntries', 'maxAgeSeconds'), | ||||
backgroundSync: joi.object().keys({ | ||||
name: joi.string().required(), | ||||
options: joi.object(), | ||||
}), | ||||
broadcastCacheUpdate: joi.object().keys({ | ||||
channelName: joi.string().required(), | ||||
options: joi.object(), | ||||
}), | ||||
cacheableResponse: joi.object().keys({ | ||||
statuses: joi.array().items(joi.number().min(0).max(599)), | ||||
headers: joi.object(), | ||||
}).or('statuses', 'headers'), | ||||
cacheName: joi.string(), | ||||
expiration: joi.object().keys({ | ||||
maxEntries: joi.number().min(1), | ||||
maxAgeSeconds: joi.number().min(1), | ||||
}).or('maxEntries', 'maxAgeSeconds'), | ||||
networkTimeoutSeconds: joi.number().min(1), | ||||
plugins: joi.array().items(joi.object()), | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does this work? I.e. how does code in the node space get into the service worker? My main consideration here is that if this works, why support one way in the build process and a different way in the service worker? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code that converts whatever is configured in the and the string is used in the template at
(None of that has changed recently.) The syntax used to generate the service worker code is not exactly the same as the syntax used when executing the service worker runtime. Service worker execution implies that we're inside of the I think in this PR the mapping between configuration supplied to |
||||
}), | ||||
}).requiredKeys('urlPattern', 'handler')), | ||||
skipWaiting: joi.boolean().default(defaults.skipWaiting), | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the broadcast cache update object needs a channel name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup—that requirement is enforced one line up, on line 46.