WIP - add extractor, generate snippet_data

This commit is contained in:
Stefan Fejes
2019-08-20 15:52:05 +02:00
parent 88084d3d30
commit cc8f1d8a7a
37396 changed files with 4588842 additions and 133 deletions

View File

@ -0,0 +1,89 @@
'use strict';
var _regenerator = require('babel-runtime/regenerator');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _assign = require('babel-runtime/core-js/object/assign');
var _assign2 = _interopRequireDefault(_assign);
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
/**
* This method generates a service worker based on the configuration options
* provided.
*
* @param {Object} config Please refer to the
* [configuration guide](https://developers.google.com/web/tools/workbox/modules/workbox-build#generateswstring_mode).
* @return {Promise<{swString: string, warnings: Array<string>}>} A promise that
* resolves once the service worker template is populated. The `swString`
* property contains a string representation of the full service worker code.
* Any non-fatal warning messages will be returned via `warnings`.
*
* @memberof module:workbox-build
*/
var generateSWString = function () {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(config) {
var options, _ref2, manifestEntries, warnings, swString;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
options = validate(config, generateSWStringSchema);
_context.next = 3;
return getFileManifestEntries(options);
case 3:
_ref2 = _context.sent;
manifestEntries = _ref2.manifestEntries;
warnings = _ref2.warnings;
_context.next = 8;
return populateSWTemplate((0, _assign2.default)({
manifestEntries
}, options));
case 8:
swString = _context.sent;
return _context.abrupt('return', { swString, warnings });
case 10:
case 'end':
return _context.stop();
}
}
}, _callee, this);
}));
return function generateSWString(_x) {
return _ref.apply(this, arguments);
};
}();
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var generateSWStringSchema = require('./options/generate-sw-string-schema');
var getFileManifestEntries = require('../lib/get-file-manifest-entries');
var populateSWTemplate = require('../lib/populate-sw-template');
var validate = require('./options/validate');
module.exports = generateSWString;

View File

@ -0,0 +1,142 @@
'use strict';
var _regenerator = require('babel-runtime/regenerator');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _assign = require('babel-runtime/core-js/object/assign');
var _assign2 = _interopRequireDefault(_assign);
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
/**
* This method creates a list of URLs to precache, referred to as a "precache
* manifest", based on the options you provide.
*
* It also takes in additional options that configures the service worker's
* behavior, like any `runtimeCaching` rules it should use.
*
* Based on the precache manifest and the additional configuration, it writes
* a ready-to-use service worker file to disk at `swDest`.
*
* @param {Object} config Please refer to the
* [configuration guide](https://developers.google.com/web/tools/workbox/modules/workbox-build#full_generatesw_config).
* @return {Promise<{count: number, size: number, warnings: Array<string>}>}
* A promise that resolves once the service worker file has been written to
* `swDest`. The `size` property contains the aggregate size of all the
* precached entries, in bytes, and the `count` property contains the total
* number of precached entries. Any non-fatal warning messages will be returned
* via `warnings`.
*
* @memberof module:workbox-build
*/
var generateSW = function () {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(config) {
var options, destDirectory, cdnUrl, workboxDirectoryName, workboxSWPkg, workboxSWFilename, _ref2, count, size, manifestEntries, warnings;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
options = validate(config, generateSWSchema);
destDirectory = path.dirname(options.swDest);
// Do nothing if importWorkboxFrom is set to 'disabled'. Otherwise, check:
if (!(options.importWorkboxFrom === 'cdn')) {
_context.next = 7;
break;
}
cdnUrl = cdnUtils.getModuleUrl('workbox-sw');
options.workboxSWImport = cdnUrl;
_context.next = 16;
break;
case 7:
if (!(options.importWorkboxFrom === 'local')) {
_context.next = 16;
break;
}
_context.next = 10;
return copyWorkboxLibraries(destDirectory);
case 10:
workboxDirectoryName = _context.sent;
// The Workbox library files should not be precached, since they're cached
// automatically by virtue of being used with importScripts().
options.globIgnores = [`**/${workboxDirectoryName}/*.js*`].concat(options.globIgnores || []);
workboxSWPkg = require(`workbox-sw/package.json`);
workboxSWFilename = path.basename(workboxSWPkg.main);
options.workboxSWImport = `${workboxDirectoryName}/${workboxSWFilename}`;
options.modulePathPrefix = workboxDirectoryName;
case 16:
_context.next = 18;
return getFileManifestEntries(options);
case 18:
_ref2 = _context.sent;
count = _ref2.count;
size = _ref2.size;
manifestEntries = _ref2.manifestEntries;
warnings = _ref2.warnings;
_context.next = 25;
return writeServiceWorkerUsingDefaultTemplate((0, _assign2.default)({
manifestEntries
}, options));
case 25:
return _context.abrupt('return', { count, size, warnings });
case 26:
case 'end':
return _context.stop();
}
}
}, _callee, this);
}));
return function generateSW(_x) {
return _ref.apply(this, arguments);
};
}();
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var path = require('path');
var cdnUtils = require('../lib/cdn-utils');
var copyWorkboxLibraries = require('../lib/copy-workbox-libraries');
var generateSWSchema = require('./options/generate-sw-schema');
var getFileManifestEntries = require('../lib/get-file-manifest-entries');
var validate = require('./options/validate');
var writeServiceWorkerUsingDefaultTemplate = require('../lib/write-sw-using-default-template');
module.exports = generateSW;

View File

@ -0,0 +1,83 @@
'use strict';
var _regenerator = require('babel-runtime/regenerator');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
/**
* This method returns a list of URLs to precache, referred to as a "precache
* manifest", along with details about the number of entries and their size,
* based on the options you provide.
*
* @param {Object} config Please refer to the
* [configuration guide](https://developers.google.com/web/tools/workbox/modules/workbox-build#getmanifest_mode).
* @return {Promise<{manifestEntries: Array<ManifestEntry>,
* count: number, size: number, warnings: Array<string>}>} A promise that
* resolves once the precache manifest is determined. The `size` property
* contains the aggregate size of all the precached entries, in bytes, the
* `count` property contains the total number of precached entries, and the
* `manifestEntries` property contains all the `ManifestEntry` items. Any
* non-fatal warning messages will be returned via `warnings`.
*
* @memberof module:workbox-build
*/
var getManifest = function () {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(config) {
var options, _ref2, manifestEntries, count, size, warnings;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
options = validate(config, getManifestSchema);
_context.next = 3;
return getFileManifestEntries(options);
case 3:
_ref2 = _context.sent;
manifestEntries = _ref2.manifestEntries;
count = _ref2.count;
size = _ref2.size;
warnings = _ref2.warnings;
return _context.abrupt('return', { manifestEntries, count, size, warnings });
case 9:
case 'end':
return _context.stop();
}
}
}, _callee, this);
}));
return function getManifest(_x) {
return _ref.apply(this, arguments);
};
}();
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var getFileManifestEntries = require('../lib/get-file-manifest-entries');
var getManifestSchema = require('./options/get-manifest-schema');
var validate = require('./options/validate');
module.exports = getManifest;

View File

@ -0,0 +1,155 @@
'use strict';
var _regenerator = require('babel-runtime/regenerator');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _stringify = require('babel-runtime/core-js/json/stringify');
var _stringify2 = _interopRequireDefault(_stringify);
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
/**
* This method creates a list of URLs to precache, referred to as a "precache
* manifest", based on the options you provide.
*
* The manifest is injected into the `swSrc` file, and the regular expression
* `injectionPointRegexp` determines where in the file the manifest should go.
*
* The final service worker file, with the manifest injected, is written to
* disk at `swDest`.
*
* @param {Object} config Please refer to the
* [configuration guide](https://developers.google.com/web/tools/workbox/modules/workbox-build#full_injectmanifest_config).
* @return {Promise<{count: number, size: number, warnings: Array<string>}>}
* A promise that resolves once the service worker file has been written to
* `swDest`. The `size` property contains the aggregate size of all the
* precached entries, in bytes, and the `count` property contains the total
* number of precached entries. Any non-fatal warning messages will be returned
* via `warnings`.
*
* @memberof module:workbox-build
*/
var injectManifest = function () {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(config) {
var options, globalRegexp, _ref2, count, size, manifestEntries, warnings, swFileContents, injectionResults, entriesString;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
options = validate(config, injectManifestSchema);
if (!(path.normalize(config.swSrc) === path.normalize(config.swDest))) {
_context.next = 3;
break;
}
throw new Error(errors['same-src-and-dest']);
case 3:
globalRegexp = new RegExp(options.injectionPointRegexp, 'g');
_context.next = 6;
return getFileManifestEntries(options);
case 6:
_ref2 = _context.sent;
count = _ref2.count;
size = _ref2.size;
manifestEntries = _ref2.manifestEntries;
warnings = _ref2.warnings;
swFileContents = void 0;
_context.prev = 12;
_context.next = 15;
return fse.readFile(config.swSrc, 'utf8');
case 15:
swFileContents = _context.sent;
_context.next = 21;
break;
case 18:
_context.prev = 18;
_context.t0 = _context['catch'](12);
throw new Error(`${errors['invalid-sw-src']} ${_context.t0.message}`);
case 21:
injectionResults = swFileContents.match(globalRegexp);
assert(injectionResults, errors['injection-point-not-found'] + (
// Customize the error message when this happens:
// - If the default RegExp is used, then include the expected string that
// matches as a hint to the developer.
// - If a custom RegExp is used, then just include the raw RegExp.
options.injectionPointRegexp === defaults.injectionPointRegexp ? 'workbox.precaching.precacheAndRoute([])' : options.injectionPointRegexp));
assert(injectionResults.length === 1, errors['multiple-injection-points'] + ` ${options.injectionPointRegexp}`);
entriesString = (0, _stringify2.default)(manifestEntries, null, 2);
swFileContents = swFileContents.replace(globalRegexp, `$1${entriesString}$2`);
_context.prev = 26;
_context.next = 29;
return fse.mkdirp(path.dirname(options.swDest));
case 29:
_context.next = 34;
break;
case 31:
_context.prev = 31;
_context.t1 = _context['catch'](26);
throw new Error(errors['unable-to-make-injection-directory'] + ` '${_context.t1.message}'`);
case 34:
_context.next = 36;
return fse.writeFile(config.swDest, swFileContents);
case 36:
return _context.abrupt('return', { count, size, warnings });
case 37:
case 'end':
return _context.stop();
}
}
}, _callee, this, [[12, 18], [26, 31]]);
}));
return function injectManifest(_x) {
return _ref.apply(this, arguments);
};
}();
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var assert = require('assert');
var fse = require('fs-extra');
var path = require('path');
var defaults = require('./options/defaults');
var errors = require('../lib/errors');
var getFileManifestEntries = require('../lib/get-file-manifest-entries');
var injectManifestSchema = require('./options/inject-manifest-schema');
var validate = require('./options/validate');
module.exports = injectManifest;

View File

@ -0,0 +1,37 @@
'use strict';
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var joi = require('joi');
var defaults = require('./defaults');
var regExpObject = require('./reg-exp-object');
// Define some common constrains used by all methods.
module.exports = joi.object().keys({
dontCacheBustUrlsMatching: regExpObject,
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),
manifestTransforms: joi.array().items(joi.func().arity(1)),
maximumFileSizeToCacheInBytes: joi.number().min(1).default(defaults.maximumFileSizeToCacheInBytes),
modifyUrlPrefix: joi.object(),
// 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,65 @@
'use strict';
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var joi = require('joi');
var baseSchema = require('./base-schema');
var defaults = require('./defaults');
var regExpObject = require('./reg-exp-object');
// Add some constraints that apply to both generateSW and generateSWString.
module.exports = baseSchema.keys({
cacheId: joi.string(),
clientsClaim: joi.boolean().default(defaults.clientsClaim),
directoryIndex: joi.string(),
ignoreUrlParametersMatching: joi.array().items(regExpObject),
navigateFallback: joi.string().default(defaults.navigateFallback),
navigateFallbackBlacklist: joi.array().items(regExpObject),
navigateFallbackWhitelist: joi.array().items(regExpObject),
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()],
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')),
skipWaiting: joi.boolean().default(defaults.skipWaiting)
});

View File

@ -0,0 +1,32 @@
'use strict';
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
module.exports = {
clientsClaim: false,
globFollow: true,
globIgnores: ['**/node_modules/**/*'],
globPatterns: ['**/*.{js,css,html}'],
globStrict: true,
importWorkboxFrom: 'cdn',
injectionPointRegexp: /(\.precacheAndRoute\()\s*\[\s*\]\s*(\)|,)/,
maximumFileSizeToCacheInBytes: 2 * 1024 * 1024,
navigateFallback: undefined,
offlineGoogleAnalytics: false,
purgeOnQuotaError: false,
skipWaiting: false
};

View File

@ -0,0 +1,30 @@
'use strict';
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var joi = require('joi');
var commonGenerateSchema = require('./common-generate-schema');
var defaults = require('./defaults');
// Define some additional constraints.
module.exports = commonGenerateSchema.keys({
globDirectory: joi.string().required(),
importScripts: joi.array().items(joi.string()),
importWorkboxFrom: joi.string().default(defaults.importWorkboxFrom).valid('cdn', 'local', 'disabled'),
swDest: joi.string().required()
});

View File

@ -0,0 +1,29 @@
'use strict';
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var joi = require('joi');
var commonGenerateSchema = require('./common-generate-schema');
// Define some additional constraints.
module.exports = commonGenerateSchema.keys({
globDirectory: joi.string(),
importScripts: joi.array().items(joi.string()).required(),
modulePathPrefix: joi.string(),
workboxSWImport: joi.string()
});

View File

@ -0,0 +1,26 @@
'use strict';
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var joi = require('joi');
var baseSchema = require('./base-schema');
// Define some additional constraints.
module.exports = baseSchema.keys({
globDirectory: joi.string()
});

View File

@ -0,0 +1,30 @@
'use strict';
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var joi = require('joi');
var baseSchema = require('./base-schema');
var defaults = require('./defaults');
var regExpObject = require('./reg-exp-object');
module.exports = baseSchema.keys({
globDirectory: joi.string().required(),
injectionPointRegexp: regExpObject.default(defaults.injectionPointRegexp),
swSrc: joi.string().required(),
swDest: joi.string().required()
});

View File

@ -0,0 +1,23 @@
'use strict';
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var joi = require('joi');
module.exports = joi.object().type(RegExp).error(function () {
return 'the value must be a RegExp';
});

View File

@ -0,0 +1,35 @@
'use strict';
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
module.exports = function (options, schema) {
var _schema$validate = schema.validate(options, {
language: {
object: {
allowUnknown: 'is not a supported parameter.'
}
}
}),
value = _schema$validate.value,
error = _schema$validate.error;
if (error) {
throw error;
}
return value;
};