0.2.0 - Mid migration

This commit is contained in:
Daniel Mason 2022-04-25 14:47:15 +12:00
parent 139e6a915e
commit 7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions

View file

@ -0,0 +1,32 @@
"use strict";
/*
Copyright 2019 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
module.exports = {
babelPresetEnvTargets: ['chrome >= 56'],
cleanupOutdatedCaches: false,
clientsClaim: false,
compileSrc: true,
disableDevLogs: false,
exclude: [/\.map$/, /^manifest.*\.js$/],
globFollow: true,
globIgnores: ['**/node_modules/**/*'],
globPatterns: ['**/*.{js,css,html}'],
globStrict: true,
injectionPoint: 'self.__WB_MANIFEST',
inlineWorkboxRuntime: false,
maximumFileSizeToCacheInBytes: 2 * 1024 * 1024,
mode: 'production',
navigateFallback: undefined,
navigationPreload: false,
offlineGoogleAnalytics: false,
purgeOnQuotaError: true,
skipWaiting: false,
sourcemap: true,
swDestFilename: 'service-worker.js'
};

View file

@ -0,0 +1,15 @@
"use strict";
/*
Copyright 2019 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
const joi = require('@hapi/joi');
module.exports = joi.object().keys({
revision: joi.string().required().allow(null),
url: joi.string().required()
});

View file

@ -0,0 +1,12 @@
"use strict";
/*
Copyright 2019 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
const joi = require('@hapi/joi');
module.exports = joi.object().type(RegExp).error(() => 'the value must be a RegExp');

View file

@ -0,0 +1,25 @@
"use strict";
/*
Copyright 2019 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
const joi = require('@hapi/joi');
const defaults = require('../defaults');
const manifestEntryObject = require('../objects/manifest-entry');
const regExpObject = require('../objects/reg-exp');
module.exports = {
additionalManifestEntries: joi.array().items(joi.string(), manifestEntryObject),
dontCacheBustURLsMatching: regExpObject,
manifestTransforms: joi.array().items(joi.func().minArity(1).maxArity(2)),
maximumFileSizeToCacheInBytes: joi.number().min(1).default(defaults.maximumFileSizeToCacheInBytes),
mode: joi.string().default(process.env.NODE_ENV || defaults.mode),
modifyURLPrefix: joi.object()
};

View file

@ -0,0 +1,67 @@
"use strict";
/*
Copyright 2019 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
const joi = require('@hapi/joi');
const defaults = require('../defaults');
const regExpObject = require('../objects/reg-exp');
module.exports = {
babelPresetEnvTargets: joi.array().items(joi.string()).default(defaults.babelPresetEnvTargets),
cacheId: joi.string(),
cleanupOutdatedCaches: joi.boolean().default(defaults.cleanupOutdatedCaches),
clientsClaim: joi.boolean().default(defaults.clientsClaim),
directoryIndex: joi.string(),
disableDevLogs: joi.boolean().default(defaults.disableDevLogs),
ignoreURLParametersMatching: joi.array().items(regExpObject),
importScripts: joi.array().items(joi.string()),
inlineWorkboxRuntime: joi.boolean().default(defaults.inlineWorkboxRuntime),
navigateFallback: joi.string().default(defaults.navigateFallback),
navigateFallbackAllowlist: joi.array().items(regExpObject),
navigateFallbackBlacklist: joi.forbidden().error(new Error('navigateFallbackBlacklist has been renamed navigateFallbackDenylist.')),
navigateFallbackDenylist: joi.array().items(regExpObject),
navigateFallbackWhitelist: joi.forbidden().error(new Error('navigateFallbackWhitelist has been renamed navigateFallbackAllowlist.')),
navigationPreload: joi.boolean().default(defaults.navigationPreload),
offlineGoogleAnalytics: joi.alternatives().try(joi.boolean(), joi.object()).default(defaults.offlineGoogleAnalytics),
runtimeCaching: joi.array().items(joi.object().keys({
method: joi.string().valid('DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT'),
urlPattern: [regExpObject, joi.string(), joi.func()],
handler: [joi.func(), joi.string().valid('CacheFirst', 'CacheOnly', 'NetworkFirst', 'NetworkOnly', 'StaleWhileRevalidate')],
options: joi.object().keys({
backgroundSync: joi.object().keys({
name: joi.string().required(),
options: joi.object()
}),
broadcastUpdate: 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),
purgeOnQuotaError: joi.boolean().default(defaults.purgeOnQuotaError)
}).or('maxEntries', 'maxAgeSeconds'),
networkTimeoutSeconds: joi.number().min(1),
plugins: joi.array().items(joi.object()),
fetchOptions: joi.object(),
matchOptions: joi.object()
}).with('expiration', 'cacheName')
}).requiredKeys('urlPattern', 'handler')).when('navigationPreload', {
is: true,
then: joi.required()
}),
skipWaiting: joi.boolean().default(defaults.skipWaiting),
sourcemap: joi.boolean().default(defaults.sourcemap)
};

View file

@ -0,0 +1,23 @@
"use strict";
/*
Copyright 2019 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
const joi = require('@hapi/joi');
const defaults = require('../defaults');
module.exports = {
globDirectory: joi.string(),
globFollow: joi.boolean().default(defaults.globFollow),
globIgnores: joi.array().items(joi.string()).default(defaults.globIgnores),
globPatterns: joi.array().items(joi.string()).default(defaults.globPatterns),
globStrict: joi.boolean().default(defaults.globStrict),
// templatedURLs is an object where any property name is valid, and the values
// can be either a string or an array of strings.
templatedURLs: joi.object().pattern(/./, [joi.string(), joi.array().items(joi.string())])
};

View file

@ -0,0 +1,17 @@
"use strict";
/*
Copyright 2019 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
const joi = require('@hapi/joi');
const defaults = require('../defaults');
module.exports = {
injectionPoint: joi.string().default(defaults.injectionPoint),
swSrc: joi.string().required()
};

View file

@ -0,0 +1,21 @@
"use strict";
/*
Copyright 2019 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
const joi = require('@hapi/joi');
const defaults = require('../defaults');
const regExpObject = require('../objects/reg-exp');
module.exports = {
chunks: joi.array().items(joi.string()),
exclude: joi.array().items(joi.string(), regExpObject, joi.func().arity(1)).default(defaults.exclude),
excludeChunks: joi.array().items(joi.string()),
include: joi.array().items(joi.string(), regExpObject, joi.func().arity(1))
};

View file

@ -0,0 +1,21 @@
"use strict";
/*
Copyright 2019 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
const joi = require('@hapi/joi');
const basePartial = require('../partials/base');
const generatePartial = require('../partials/generate');
const globPartial = require('../partials/glob');
const supportedOptions = Object.assign({
swDest: joi.string().required().regex(/\.js$/)
}, basePartial, generatePartial, globPartial);
module.exports = joi.object().keys(supportedOptions);

View file

@ -0,0 +1,17 @@
"use strict";
/*
Copyright 2019 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
const joi = require('@hapi/joi');
const basePartial = require('../partials/base');
const globPartial = require('../partials/glob');
const supportedOptions = Object.assign({}, basePartial, globPartial);
module.exports = joi.object().keys(supportedOptions);

View file

@ -0,0 +1,21 @@
"use strict";
/*
Copyright 2019 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
const joi = require('@hapi/joi');
const basePartial = require('../partials/base');
const globPartial = require('../partials/glob');
const injectPartial = require('../partials/inject');
const supportedOptions = Object.assign({
swDest: joi.string().required().regex(/\.js$/)
}, basePartial, globPartial, injectPartial);
module.exports = joi.object().keys(supportedOptions);

View file

@ -0,0 +1,24 @@
"use strict";
/*
Copyright 2019 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
const joi = require('@hapi/joi');
const basePartial = require('../partials/base');
const defaults = require('../defaults');
const generatePartial = require('../partials/generate');
const webpackPartial = require('../partials/webpack');
const supportedOptions = Object.assign({
importScriptsViaChunks: joi.array().items(joi.string()),
swDest: joi.string().default(defaults.swDestFilename)
}, basePartial, generatePartial, webpackPartial);
module.exports = joi.object().keys(supportedOptions);

View file

@ -0,0 +1,42 @@
"use strict";
/*
Copyright 2019 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
const joi = require('@hapi/joi');
const upath = require('upath');
const basePartial = require('../partials/base');
const defaults = require('../defaults');
const injectPartial = require('../partials/inject');
const webpackPartial = require('../partials/webpack'); // See https://github.com/hapijs/joi/blob/v16.0.0-rc2/API.md#anydefaultvalue-description
const swSrcBasename = context => {
const {
name
} = upath.parse(context.swSrc); // Always use the .js extension when generating a default filename.
return name + '.js';
};
swSrcBasename.description = 'derived from the swSrc file name';
const supportedOptions = Object.assign({
compileSrc: joi.boolean().default(defaults.compileSrc),
webpackCompilationPlugins: joi.array().items(joi.object()).when('compileSrc', {
is: false,
then: joi.forbidden()
})
}, basePartial, injectPartial, webpackPartial);
module.exports = joi.object().keys(supportedOptions).keys({
// List this separately, so that the swSrc validation happens first.
swDest: joi.string().default(swSrcBasename)
});