mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-29 18:27:56 +02:00
* debug pwa * more debugging logs + attempt to upgrade workbox * fix PWA ? * fix PWA ? * enable pwa debugging for deploy previews * try to fix the app installed issue? * try to fix appinstalled not firing * try to add related applications to the PWA manifest * attempt to fix related_applications * attempt to fix related_applications * attempt to fix related_applications * improve PWA strategies * improve PWA doc * refactor/cleanup registerSw * cleanup
54 lines
1.5 KiB
JavaScript
54 lines
1.5 KiB
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
const Joi = require('joi');
|
|
const path = require('path');
|
|
|
|
const DEFAULT_OPTIONS = {
|
|
debug: false,
|
|
offlineModeActivationStrategies: [
|
|
'appInstalled',
|
|
'queryString',
|
|
'standalone',
|
|
],
|
|
injectManifestConfig: {},
|
|
pwaHead: [],
|
|
swCustom: undefined,
|
|
swRegister: path.join(__dirname, 'registerSw.js'),
|
|
reloadPopup: '@theme/PwaReloadPopup',
|
|
};
|
|
|
|
exports.PluginOptionSchema = Joi.object({
|
|
debug: Joi.bool().default(DEFAULT_OPTIONS.debug),
|
|
offlineModeActivationStrategies: Joi.array()
|
|
.items(
|
|
Joi.string()
|
|
.valid(
|
|
'appInstalled',
|
|
'queryString',
|
|
'standalone',
|
|
'mobile',
|
|
'saveData',
|
|
'always',
|
|
)
|
|
.required(),
|
|
)
|
|
.default(DEFAULT_OPTIONS.offlineModeActivationStrategies),
|
|
injectManifestConfig: Joi.object().default(
|
|
DEFAULT_OPTIONS.injectManifestConfig,
|
|
),
|
|
pwaHead: Joi.array()
|
|
.items(Joi.object({tagName: Joi.string().required()}).unknown().required())
|
|
.default(DEFAULT_OPTIONS.pwaHead),
|
|
swCustom: Joi.string(),
|
|
swRegister: Joi.alternatives()
|
|
.try(Joi.string(), Joi.bool().valid(false))
|
|
.default(DEFAULT_OPTIONS.swRegister),
|
|
reloadPopup: Joi.alternatives()
|
|
.try(Joi.string(), Joi.bool().valid(false))
|
|
.default(DEFAULT_OPTIONS.reloadPopup),
|
|
});
|