refactor: capitalize comments (#7188)

* refactor: capitalize comments

* revert...
This commit is contained in:
Joshua Chen 2022-04-17 16:39:11 +08:00 committed by GitHub
parent 200009008b
commit fa1ce230ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
99 changed files with 241 additions and 350 deletions

View file

@ -150,7 +150,7 @@ export default function pluginPWA(
optimization: {
splitChunks: false,
minimize: !debug,
// see https://developers.google.com/web/tools/workbox/guides/using-bundlers#webpack
// See https://developers.google.com/web/tools/workbox/guides/using-bundlers#webpack
minimizer: debug
? []
: [
@ -161,7 +161,8 @@ export default function pluginPWA(
},
plugins: [
new webpack.EnvironmentPlugin({
PWA_SW_CUSTOM: swCustom || '', // fallback value required with Webpack 5
// Fallback value required with Webpack 5
PWA_SW_CUSTOM: swCustom || '',
}),
new LogPlugin({
name: 'Service Worker',
@ -192,7 +193,7 @@ export default function pluginPWA(
// @ts-expect-error: internal API?
...(injectManifest.globPatterns ?? []),
],
// those attributes are not overrideable
// Those attributes are not overrideable
swDest,
swSrc: swDest,
globDirectory: props.outDir,

View file

@ -81,6 +81,8 @@ declare module '@docusaurus/plugin-pwa' {
*/
swRegister: string | false;
};
export type Options = Partial<PluginOptions>;
}
declare module '@theme/PwaReloadPopup' {

View file

@ -16,7 +16,7 @@ const PWA_OFFLINE_MODE_ACTIVATION_STRATEGIES =
const PWA_DEBUG = process.env.PWA_DEBUG;
/* eslint-enable prefer-destructuring */
const debug = PWA_DEBUG; // shortcut
const debug = PWA_DEBUG; // Shortcut
const MAX_MOBILE_WIDTH = 940;
@ -101,7 +101,7 @@ async function getActiveStrategies() {
return isActive ? strategyName : undefined;
}),
);
return activeStrategies.filter(Boolean); // remove undefined values
return activeStrategies.filter(Boolean);
}
async function isOfflineModeEnabled() {

View file

@ -18,7 +18,7 @@ function parseSwParams() {
return params;
}
// doc advises against dynamic imports in SW
// Doc advises against dynamic imports in SW
// https://developers.google.com/web/tools/workbox/guides/using-bundlers#code_splitting_and_dynamic_imports
// https://twitter.com/sebastienlorber/status/1280155204575518720
// but looks it's working fine as it's inlined by webpack, need to double check
@ -73,7 +73,8 @@ function getPossibleURLs(url) {
// eslint-disable-next-line no-underscore-dangle
const precacheManifest = self.__WB_MANIFEST;
const controller = new PrecacheController({
fallbackToNetwork: true, // safer to turn this true?
// Safer to turn this true?
fallbackToNetwork: true,
});
if (params.offlineMode) {