workbox-webpack-plugin
Advanced tools
Comparing version 3.6.2 to 4.0.0-alpha.0
@@ -1,61 +0,38 @@ | ||
'use strict'; | ||
"use strict"; | ||
var _regenerator = require('babel-runtime/regenerator'); | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _regenerator2 = _interopRequireDefault(_regenerator); | ||
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")); | ||
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray'); | ||
/* | ||
Copyright 2018 Google LLC | ||
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2); | ||
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 _require = require('workbox-build'), | ||
generateSWString = _require.generateSWString; | ||
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator'); | ||
const path = require('path'); | ||
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2); | ||
const convertStringToAsset = require('./lib/convert-string-to-asset'); | ||
var _assign = require('babel-runtime/core-js/object/assign'); | ||
const getDefaultConfig = require('./lib/get-default-config'); | ||
var _assign2 = _interopRequireDefault(_assign); | ||
const formatManifestFilename = require('./lib/format-manifest-filename'); | ||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); | ||
const getAssetHash = require('./lib/get-asset-hash'); | ||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | ||
const getManifestEntriesFromCompilation = require('./lib/get-manifest-entries-from-compilation'); | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
const getWorkboxSWImports = require('./lib/get-workbox-sw-imports'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
const relativeToOutputPath = require('./lib/relative-to-output-path'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const sanitizeConfig = require('./lib/sanitize-config'); | ||
/* | ||
Copyright 2017 Google Inc. | ||
const stringifyManifest = require('./lib/stringify-manifest'); | ||
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 _require = require('workbox-build'), | ||
generateSWString = _require.generateSWString; | ||
var path = require('path'); | ||
var convertStringToAsset = require('./lib/convert-string-to-asset'); | ||
var getDefaultConfig = require('./lib/get-default-config'); | ||
var formatManifestFilename = require('./lib/format-manifest-filename'); | ||
var getAssetHash = require('./lib/get-asset-hash'); | ||
var getManifestEntriesFromCompilation = require('./lib/get-manifest-entries-from-compilation'); | ||
var getWorkboxSWImports = require('./lib/get-workbox-sw-imports'); | ||
var relativeToOutputPath = require('./lib/relative-to-output-path'); | ||
var sanitizeConfig = require('./lib/sanitize-config'); | ||
var stringifyManifest = require('./lib/stringify-manifest'); | ||
var warnAboutConfig = require('./lib/warn-about-config'); | ||
const warnAboutConfig = require('./lib/warn-about-config'); | ||
/** | ||
@@ -72,3 +49,4 @@ * This class supports creating a new, ready-to-use service worker file as | ||
var GenerateSW = function () { | ||
class GenerateSW { | ||
/** | ||
@@ -81,7 +59,4 @@ * Creates an instance of GenerateSW. | ||
*/ | ||
function GenerateSW() { | ||
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
(0, _classCallCheck3.default)(this, GenerateSW); | ||
this.config = (0, _assign2.default)(getDefaultConfig(), { | ||
constructor(config = {}) { | ||
this.config = Object.assign(getDefaultConfig(), { | ||
// Hardcode this default filename, since we don't have swSrc to read from | ||
@@ -92,3 +67,2 @@ // (like we do in InjectManifest). | ||
} | ||
/** | ||
@@ -100,115 +74,76 @@ * @param {Object} compilation The webpack compilation. | ||
(0, _createClass3.default)(GenerateSW, [{ | ||
key: 'handleEmit', | ||
value: function () { | ||
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(compilation) { | ||
var configWarning, workboxSWImports, entries, importScriptsArray, manifestString, manifestAsset, manifestHash, manifestFilename, pathToManifestFile, workboxSWImport, sanitizedConfig, _ref2, swString, warnings, relSwDest; | ||
handleEmit(compilation) { | ||
var _this = this; | ||
return _regenerator2.default.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
configWarning = warnAboutConfig(this.config); | ||
return (0, _asyncToGenerator2.default)(function* () { | ||
const configWarning = warnAboutConfig(_this.config); | ||
if (configWarning) { | ||
compilation.warnings.push(configWarning); | ||
} | ||
if (configWarning) { | ||
compilation.warnings.push(configWarning); | ||
} | ||
_context.next = 4; | ||
return getWorkboxSWImports(compilation, this.config); | ||
const workboxSWImports = yield getWorkboxSWImports(compilation, _this.config); | ||
const entries = getManifestEntriesFromCompilation(compilation, _this.config); | ||
const importScriptsArray = [].concat(_this.config.importScripts); | ||
const manifestString = stringifyManifest(entries); | ||
const manifestAsset = convertStringToAsset(manifestString); | ||
const manifestHash = getAssetHash(manifestAsset); | ||
const manifestFilename = formatManifestFilename(_this.config.precacheManifestFilename, manifestHash); | ||
const pathToManifestFile = relativeToOutputPath(compilation, path.join(_this.config.importsDirectory, manifestFilename)); | ||
compilation.assets[pathToManifestFile] = manifestAsset; | ||
importScriptsArray.push((compilation.options.output.publicPath || '') + pathToManifestFile.split(path.sep).join('/')); // workboxSWImports might be null if importWorkboxFrom is 'disabled'. | ||
case 4: | ||
workboxSWImports = _context.sent; | ||
entries = getManifestEntriesFromCompilation(compilation, this.config); | ||
importScriptsArray = [].concat(this.config.importScripts); | ||
manifestString = stringifyManifest(entries); | ||
manifestAsset = convertStringToAsset(manifestString); | ||
manifestHash = getAssetHash(manifestAsset); | ||
manifestFilename = formatManifestFilename(this.config.precacheManifestFilename, manifestHash); | ||
pathToManifestFile = relativeToOutputPath(compilation, path.join(this.config.importsDirectory, manifestFilename)); | ||
let workboxSWImport; | ||
compilation.assets[pathToManifestFile] = manifestAsset; | ||
if (workboxSWImports) { | ||
if (workboxSWImports.length === 1) { | ||
// When importWorkboxFrom is 'cdn' or 'local', or a chunk name | ||
// that only contains one JavaScript asset, then this will be a one | ||
// element array, containing just the Workbox SW code. | ||
workboxSWImport = workboxSWImports[0]; | ||
} else { | ||
// If importWorkboxFrom was a chunk name that contained multiple | ||
// JavaScript assets, then we don't know which contains the Workbox SW | ||
// code. Just import them first as part of the "main" importScripts(). | ||
importScriptsArray.unshift(...workboxSWImports); | ||
} | ||
} | ||
importScriptsArray.push((compilation.options.output.publicPath || '') + pathToManifestFile.split(path.sep).join('/')); | ||
const sanitizedConfig = sanitizeConfig.forGenerateSWString(_this.config); // If globPatterns isn't explicitly set, then default to [], instead of | ||
// the workbox-build.generateSWString() default. | ||
// workboxSWImports might be null if importWorkboxFrom is 'disabled'. | ||
workboxSWImport = void 0; | ||
sanitizedConfig.globPatterns = sanitizedConfig.globPatterns || []; | ||
sanitizedConfig.importScripts = importScriptsArray; | ||
sanitizedConfig.workboxSWImport = workboxSWImport; | ||
if (workboxSWImports) { | ||
if (workboxSWImports.length === 1) { | ||
// When importWorkboxFrom is 'cdn' or 'local', or a chunk name | ||
// that only contains one JavaScript asset, then this will be a one | ||
// element array, containing just the Workbox SW code. | ||
workboxSWImport = workboxSWImports[0]; | ||
} else { | ||
// If importWorkboxFrom was a chunk name that contained multiple | ||
// JavaScript assets, then we don't know which contains the Workbox SW | ||
// code. Just import them first as part of the "main" importScripts(). | ||
importScriptsArray.unshift.apply(importScriptsArray, (0, _toConsumableArray3.default)(workboxSWImports)); | ||
} | ||
} | ||
const _ref = yield generateSWString(sanitizedConfig), | ||
swString = _ref.swString, | ||
warnings = _ref.warnings; | ||
sanitizedConfig = sanitizeConfig.forGenerateSWString(this.config); | ||
// If globPatterns isn't explicitly set, then default to [], instead of | ||
// the workbox-build.generateSWString() default. | ||
compilation.warnings = compilation.warnings.concat(warnings || []); | ||
const relSwDest = relativeToOutputPath(compilation, _this.config.swDest); | ||
compilation.assets[relSwDest] = convertStringToAsset(swString); | ||
})(); | ||
} | ||
/** | ||
* @param {Object} [compiler] default compiler object passed from webpack | ||
* | ||
* @private | ||
*/ | ||
sanitizedConfig.globPatterns = sanitizedConfig.globPatterns || []; | ||
sanitizedConfig.importScripts = importScriptsArray; | ||
sanitizedConfig.workboxSWImport = workboxSWImport; | ||
_context.next = 22; | ||
return generateSWString(sanitizedConfig); | ||
case 22: | ||
_ref2 = _context.sent; | ||
swString = _ref2.swString; | ||
warnings = _ref2.warnings; | ||
apply(compiler) { | ||
if ('hooks' in compiler) { | ||
// We're in webpack 4+. | ||
compiler.hooks.emit.tapPromise(this.constructor.name, compilation => this.handleEmit(compilation)); | ||
} else { | ||
// We're in webpack 2 or 3. | ||
compiler.plugin('emit', (compilation, callback) => { | ||
this.handleEmit(compilation).then(callback).catch(callback); | ||
}); | ||
} | ||
} | ||
compilation.warnings = compilation.warnings.concat(warnings || []); | ||
} | ||
relSwDest = relativeToOutputPath(compilation, this.config.swDest); | ||
compilation.assets[relSwDest] = convertStringToAsset(swString); | ||
case 28: | ||
case 'end': | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee, this); | ||
})); | ||
function handleEmit(_x2) { | ||
return _ref.apply(this, arguments); | ||
} | ||
return handleEmit; | ||
}() | ||
/** | ||
* @param {Object} [compiler] default compiler object passed from webpack | ||
* | ||
* @private | ||
*/ | ||
}, { | ||
key: 'apply', | ||
value: function apply(compiler) { | ||
var _this = this; | ||
if ('hooks' in compiler) { | ||
// We're in webpack 4+. | ||
compiler.hooks.emit.tapPromise(this.constructor.name, function (compilation) { | ||
return _this.handleEmit(compilation); | ||
}); | ||
} else { | ||
// We're in webpack 2 or 3. | ||
compiler.plugin('emit', function (compilation, callback) { | ||
_this.handleEmit(compilation).then(callback).catch(callback); | ||
}); | ||
} | ||
} | ||
}]); | ||
return GenerateSW; | ||
}(); | ||
module.exports = GenerateSW; |
@@ -1,21 +0,13 @@ | ||
'use strict'; | ||
"use strict"; | ||
/* | ||
Copyright 2017 Google Inc. | ||
Copyright 2018 Google LLC | ||
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. | ||
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 GenerateSW = require('./generate-sw'); | ||
var GenerateSW = require('./generate-sw'); | ||
var InjectManifest = require('./inject-manifest'); | ||
const InjectManifest = require('./inject-manifest'); | ||
@@ -22,0 +14,0 @@ module.exports = { |
@@ -1,71 +0,42 @@ | ||
'use strict'; | ||
"use strict"; | ||
var _regenerator = require('babel-runtime/regenerator'); | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _regenerator2 = _interopRequireDefault(_regenerator); | ||
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")); | ||
var _stringify = require('babel-runtime/core-js/json/stringify'); | ||
/* | ||
Copyright 2018 Google LLC | ||
var _stringify2 = _interopRequireDefault(_stringify); | ||
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 assert = require('assert'); | ||
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray'); | ||
const path = require('path'); | ||
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2); | ||
const _require = require('workbox-build'), | ||
getManifest = _require.getManifest; | ||
var _keys = require('babel-runtime/core-js/object/keys'); | ||
const convertStringToAsset = require('./lib/convert-string-to-asset'); | ||
var _keys2 = _interopRequireDefault(_keys); | ||
const getDefaultConfig = require('./lib/get-default-config'); | ||
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator'); | ||
const formatManifestFilename = require('./lib/format-manifest-filename'); | ||
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2); | ||
const getAssetHash = require('./lib/get-asset-hash'); | ||
var _assign = require('babel-runtime/core-js/object/assign'); | ||
const getManifestEntriesFromCompilation = require('./lib/get-manifest-entries-from-compilation'); | ||
var _assign2 = _interopRequireDefault(_assign); | ||
const getWorkboxSWImports = require('./lib/get-workbox-sw-imports'); | ||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); | ||
const readFileWrapper = require('./lib/read-file-wrapper'); | ||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | ||
const relativeToOutputPath = require('./lib/relative-to-output-path'); | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
const sanitizeConfig = require('./lib/sanitize-config'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
const stringifyManifest = require('./lib/stringify-manifest'); | ||
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 path = require('path'); | ||
var _require = require('workbox-build'), | ||
getManifest = _require.getManifest; | ||
var convertStringToAsset = require('./lib/convert-string-to-asset'); | ||
var getDefaultConfig = require('./lib/get-default-config'); | ||
var formatManifestFilename = require('./lib/format-manifest-filename'); | ||
var getAssetHash = require('./lib/get-asset-hash'); | ||
var getManifestEntriesFromCompilation = require('./lib/get-manifest-entries-from-compilation'); | ||
var getWorkboxSWImports = require('./lib/get-workbox-sw-imports'); | ||
var readFileWrapper = require('./lib/read-file-wrapper'); | ||
var relativeToOutputPath = require('./lib/relative-to-output-path'); | ||
var sanitizeConfig = require('./lib/sanitize-config'); | ||
var stringifyManifest = require('./lib/stringify-manifest'); | ||
var warnAboutConfig = require('./lib/warn-about-config'); | ||
const warnAboutConfig = require('./lib/warn-about-config'); | ||
/** | ||
@@ -83,3 +54,4 @@ * This class supports taking an existing service worker file which already | ||
var InjectManifest = function () { | ||
class InjectManifest { | ||
/** | ||
@@ -92,9 +64,5 @@ * Creates an instance of InjectManifest. | ||
*/ | ||
function InjectManifest() { | ||
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
(0, _classCallCheck3.default)(this, InjectManifest); | ||
constructor(config = {}) { | ||
assert(typeof config.swSrc === 'string', `swSrc must be set to the path ` + `to an existing service worker file.`); | ||
this.config = (0, _assign2.default)(getDefaultConfig(), { | ||
this.config = Object.assign(getDefaultConfig(), { | ||
// Default to using the same filename as the swSrc file, since that's | ||
@@ -105,3 +73,2 @@ // provided here. (In GenerateSW, that's not available.) | ||
} | ||
/** | ||
@@ -115,149 +82,97 @@ * @param {Object} compilation The webpack compilation. | ||
(0, _createClass3.default)(InjectManifest, [{ | ||
key: 'handleEmit', | ||
value: function () { | ||
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(compilation, readFile) { | ||
var configWarning, workboxSWImports, modulePathPrefix, entries, importScriptsArray, sanitizedConfig, _ref2, manifestEntries, warnings, manifestString, manifestAsset, manifestHash, manifestFilename, pathToManifestFile, originalSWString, absoluteSwSrc, importScriptsString, setConfigString, postInjectionSWString, relSwDest; | ||
handleEmit(compilation, readFile) { | ||
var _this = this; | ||
return _regenerator2.default.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
configWarning = warnAboutConfig(this.config); | ||
return (0, _asyncToGenerator2.default)(function* () { | ||
const configWarning = warnAboutConfig(_this.config); | ||
if (configWarning) { | ||
compilation.warnings.push(configWarning); | ||
} | ||
if (configWarning) { | ||
compilation.warnings.push(configWarning); | ||
} | ||
_context.next = 4; | ||
return getWorkboxSWImports(compilation, this.config); | ||
const workboxSWImports = yield getWorkboxSWImports(compilation, _this.config); // this.config.modulePathPrefix may or may not have been set by | ||
// getWorkboxSWImports(), depending on the other config options. If it was | ||
// set, we need to pull it out and make use of it later, as it can't be | ||
// used by the underlying workbox-build getManifest() method. | ||
case 4: | ||
workboxSWImports = _context.sent; | ||
const modulePathPrefix = _this.config.modulePathPrefix; | ||
delete _this.config.modulePathPrefix; | ||
let entries = getManifestEntriesFromCompilation(compilation, _this.config); | ||
const importScriptsArray = [].concat(_this.config.importScripts); | ||
const sanitizedConfig = sanitizeConfig.forGetManifest(_this.config); // If there are any "extra" config options remaining after we remove the | ||
// ones that are used natively by the plugin, then assume that they should | ||
// be passed on to workbox-build.getManifest() to generate extra entries. | ||
if (Object.keys(sanitizedConfig).length > 0) { | ||
// If globPatterns isn't explicitly set, then default to [], instead of | ||
// the workbox-build.getManifest() default. | ||
sanitizedConfig.globPatterns = sanitizedConfig.globPatterns || []; | ||
// this.config.modulePathPrefix may or may not have been set by | ||
// getWorkboxSWImports(), depending on the other config options. If it was | ||
// set, we need to pull it out and make use of it later, as it can't be | ||
// used by the underlying workbox-build getManifest() method. | ||
modulePathPrefix = this.config.modulePathPrefix; | ||
const _ref = yield getManifest(sanitizedConfig), | ||
manifestEntries = _ref.manifestEntries, | ||
warnings = _ref.warnings; | ||
delete this.config.modulePathPrefix; | ||
compilation.warnings = compilation.warnings.concat(warnings || []); | ||
entries = entries.concat(manifestEntries); | ||
} | ||
entries = getManifestEntriesFromCompilation(compilation, this.config); | ||
importScriptsArray = [].concat(this.config.importScripts); | ||
sanitizedConfig = sanitizeConfig.forGetManifest(this.config); | ||
// If there are any "extra" config options remaining after we remove the | ||
// ones that are used natively by the plugin, then assume that they should | ||
// be passed on to workbox-build.getManifest() to generate extra entries. | ||
const manifestString = stringifyManifest(entries); | ||
const manifestAsset = convertStringToAsset(manifestString); | ||
const manifestHash = getAssetHash(manifestAsset); | ||
const manifestFilename = formatManifestFilename(_this.config.precacheManifestFilename, manifestHash); | ||
const pathToManifestFile = relativeToOutputPath(compilation, path.join(_this.config.importsDirectory, manifestFilename)); | ||
compilation.assets[pathToManifestFile] = manifestAsset; | ||
importScriptsArray.push((compilation.options.output.publicPath || '') + pathToManifestFile.split(path.sep).join('/')); // workboxSWImports might be null if importWorkboxFrom is 'disabled'. | ||
if (!((0, _keys2.default)(sanitizedConfig).length > 0)) { | ||
_context.next = 19; | ||
break; | ||
} | ||
if (workboxSWImports) { | ||
importScriptsArray.push(...workboxSWImports); | ||
} | ||
// If globPatterns isn't explicitly set, then default to [], instead of | ||
// the workbox-build.getManifest() default. | ||
sanitizedConfig.globPatterns = sanitizedConfig.globPatterns || []; | ||
const originalSWString = yield readFileWrapper(readFile, _this.config.swSrc); // compilation.fileDependencies needs absolute paths. | ||
_context.next = 14; | ||
return getManifest(sanitizedConfig); | ||
const absoluteSwSrc = path.resolve(_this.config.swSrc); | ||
case 14: | ||
_ref2 = _context.sent; | ||
manifestEntries = _ref2.manifestEntries; | ||
warnings = _ref2.warnings; | ||
if (Array.isArray(compilation.fileDependencies)) { | ||
// webpack v3 | ||
if (compilation.fileDependencies.indexOf(absoluteSwSrc) === -1) { | ||
compilation.fileDependencies.push(absoluteSwSrc); | ||
} | ||
} else if ('add' in compilation.fileDependencies) { | ||
// webpack v4; no need to check for membership first, since it's a Set. | ||
compilation.fileDependencies.add(absoluteSwSrc); | ||
} | ||
compilation.warnings = compilation.warnings.concat(warnings || []); | ||
entries = entries.concat(manifestEntries); | ||
case 19: | ||
manifestString = stringifyManifest(entries); | ||
manifestAsset = convertStringToAsset(manifestString); | ||
manifestHash = getAssetHash(manifestAsset); | ||
manifestFilename = formatManifestFilename(this.config.precacheManifestFilename, manifestHash); | ||
pathToManifestFile = relativeToOutputPath(compilation, path.join(this.config.importsDirectory, manifestFilename)); | ||
compilation.assets[pathToManifestFile] = manifestAsset; | ||
importScriptsArray.push((compilation.options.output.publicPath || '') + pathToManifestFile.split(path.sep).join('/')); | ||
// workboxSWImports might be null if importWorkboxFrom is 'disabled'. | ||
if (workboxSWImports) { | ||
importScriptsArray.push.apply(importScriptsArray, (0, _toConsumableArray3.default)(workboxSWImports)); | ||
} | ||
_context.next = 29; | ||
return readFileWrapper(readFile, this.config.swSrc); | ||
case 29: | ||
originalSWString = _context.sent; | ||
// compilation.fileDependencies needs absolute paths. | ||
absoluteSwSrc = path.resolve(this.config.swSrc); | ||
if (Array.isArray(compilation.fileDependencies)) { | ||
// webpack v3 | ||
if (compilation.fileDependencies.indexOf(absoluteSwSrc) === -1) { | ||
compilation.fileDependencies.push(absoluteSwSrc); | ||
} | ||
} else if ('add' in compilation.fileDependencies) { | ||
// webpack v4; no need to check for membership first, since it's a Set. | ||
compilation.fileDependencies.add(absoluteSwSrc); | ||
} | ||
importScriptsString = importScriptsArray.map(_stringify2.default).join(', '); | ||
setConfigString = modulePathPrefix ? `workbox.setConfig({modulePathPrefix: ` + `${(0, _stringify2.default)(modulePathPrefix)}});` : ''; | ||
postInjectionSWString = `importScripts(${importScriptsString}); | ||
const importScriptsString = importScriptsArray.map(JSON.stringify).join(', '); | ||
const setConfigString = modulePathPrefix ? `workbox.setConfig({modulePathPrefix: ` + `${JSON.stringify(modulePathPrefix)}});` : ''; | ||
const postInjectionSWString = `importScripts(${importScriptsString}); | ||
${setConfigString} | ||
${originalSWString} | ||
`; | ||
relSwDest = relativeToOutputPath(compilation, this.config.swDest); | ||
const relSwDest = relativeToOutputPath(compilation, _this.config.swDest); | ||
compilation.assets[relSwDest] = convertStringToAsset(postInjectionSWString); | ||
})(); | ||
} | ||
/** | ||
* @param {Object} [compiler] default compiler object passed from webpack | ||
* | ||
* @private | ||
*/ | ||
compilation.assets[relSwDest] = convertStringToAsset(postInjectionSWString); | ||
case 37: | ||
case 'end': | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee, this); | ||
})); | ||
apply(compiler) { | ||
const readFile = compiler.inputFileSystem.readFile.bind(compiler.inputFileSystem); | ||
function handleEmit(_x2, _x3) { | ||
return _ref.apply(this, arguments); | ||
} | ||
if ('hooks' in compiler) { | ||
// We're in webpack 4+. | ||
compiler.hooks.emit.tapPromise(this.constructor.name, compilation => this.handleEmit(compilation, readFile)); | ||
} else { | ||
// We're in webpack 2 or 3. | ||
compiler.plugin('emit', (compilation, callback) => { | ||
this.handleEmit(compilation, readFile).then(callback).catch(callback); | ||
}); | ||
} | ||
} | ||
return handleEmit; | ||
}() | ||
} | ||
/** | ||
* @param {Object} [compiler] default compiler object passed from webpack | ||
* | ||
* @private | ||
*/ | ||
}, { | ||
key: 'apply', | ||
value: function apply(compiler) { | ||
var _this = this; | ||
var readFile = compiler.inputFileSystem.readFile.bind(compiler.inputFileSystem); | ||
if ('hooks' in compiler) { | ||
// We're in webpack 4+. | ||
compiler.hooks.emit.tapPromise(this.constructor.name, function (compilation) { | ||
return _this.handleEmit(compilation, readFile); | ||
}); | ||
} else { | ||
// We're in webpack 2 or 3. | ||
compiler.plugin('emit', function (compilation, callback) { | ||
_this.handleEmit(compilation, readFile).then(callback).catch(callback); | ||
}); | ||
} | ||
} | ||
}]); | ||
return InjectManifest; | ||
}(); | ||
module.exports = InjectManifest; |
"use strict"; | ||
/* | ||
Copyright 2017 Google Inc. | ||
Copyright 2018 Google LLC | ||
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. | ||
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. | ||
*/ | ||
@@ -48,8 +40,4 @@ | ||
return { | ||
source: function source() { | ||
return assetAsString; | ||
}, | ||
size: function size() { | ||
return assetAsString.length; | ||
} | ||
source: () => assetAsString, | ||
size: () => assetAsString.length | ||
}; | ||
@@ -56,0 +44,0 @@ } |
@@ -1,17 +0,9 @@ | ||
'use strict'; | ||
"use strict"; | ||
/* | ||
Copyright 2017 Google Inc. | ||
Copyright 2018 Google LLC | ||
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. | ||
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. | ||
*/ | ||
@@ -29,5 +21,5 @@ | ||
*/ | ||
module.exports = function (originalFilename, manifestHash) { | ||
var manifestHashPlaceholder = '[manifestHash]'; | ||
var replacedFilename = originalFilename.replace(manifestHashPlaceholder, manifestHash); | ||
module.exports = (originalFilename, manifestHash) => { | ||
const manifestHashPlaceholder = '[manifestHash]'; | ||
const replacedFilename = originalFilename.replace(manifestHashPlaceholder, manifestHash); | ||
@@ -34,0 +26,0 @@ if (replacedFilename === originalFilename) { |
@@ -1,21 +0,11 @@ | ||
'use strict'; | ||
"use strict"; | ||
/* | ||
Copyright 2017 Google Inc. | ||
Copyright 2018 Google LLC | ||
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. | ||
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. | ||
*/ | ||
var crypto = require('crypto'); | ||
const crypto = require('crypto'); | ||
/** | ||
@@ -27,4 +17,6 @@ * @param {WebpackAsset} asset | ||
*/ | ||
module.exports = function (asset) { | ||
module.exports = asset => { | ||
return crypto.createHash('md5').update(asset.source(), 'utf8').digest('hex'); | ||
}; |
@@ -1,17 +0,9 @@ | ||
'use strict'; | ||
"use strict"; | ||
/* | ||
Copyright 2017 Google Inc. | ||
Copyright 2018 Google LLC | ||
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. | ||
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. | ||
*/ | ||
@@ -24,16 +16,12 @@ | ||
*/ | ||
module.exports = function () { | ||
return { | ||
chunks: [], | ||
exclude: [ | ||
// Exclude source maps. | ||
/\.map$/, | ||
// Exclude anything starting with manifest and ending .js or .json. | ||
/^manifest.*\.js(?:on)?$/], | ||
excludeChunks: [], | ||
importsDirectory: '', | ||
importScripts: [], | ||
importWorkboxFrom: 'cdn', | ||
precacheManifestFilename: 'precache-manifest.[manifestHash].js' | ||
}; | ||
}; | ||
module.exports = () => ({ | ||
chunks: [], | ||
exclude: [// Exclude source maps. | ||
/\.map$/, // Exclude anything starting with manifest and ending .js. | ||
/^manifest.*\.js?$/], | ||
excludeChunks: [], | ||
importsDirectory: '', | ||
importScripts: [], | ||
importWorkboxFrom: 'cdn', | ||
precacheManifestFilename: 'precache-manifest.[manifestHash].js' | ||
}); |
@@ -1,50 +0,19 @@ | ||
'use strict'; | ||
"use strict"; | ||
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray'); | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2); | ||
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); | ||
var _values = require('babel-runtime/core-js/object/values'); | ||
var _values2 = _interopRequireDefault(_values); | ||
var _set = require('babel-runtime/core-js/set'); | ||
var _set2 = _interopRequireDefault(_set); | ||
var _entries = require('babel-runtime/core-js/object/entries'); | ||
var _entries2 = _interopRequireDefault(_entries); | ||
var _getIterator2 = require('babel-runtime/core-js/get-iterator'); | ||
var _getIterator3 = _interopRequireDefault(_getIterator2); | ||
var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray'); | ||
var _slicedToArray3 = _interopRequireDefault(_slicedToArray2); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/* | ||
Copyright 2017 Google Inc. | ||
Copyright 2018 Google LLC | ||
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. | ||
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 ModuleFilenameHelpers = require('webpack/lib/ModuleFilenameHelpers'); | ||
var ModuleFilenameHelpers = require('webpack/lib/ModuleFilenameHelpers'); | ||
const getAssetHash = require('./get-asset-hash'); | ||
var getAssetHash = require('./get-asset-hash'); | ||
var resolveWebpackUrl = require('./resolve-webpack-url'); | ||
const resolveWebpackUrl = require('./resolve-webpack-url'); | ||
/** | ||
@@ -63,2 +32,4 @@ * A single manifest entry that Workbox can precache. | ||
*/ | ||
function getEntry(knownHashes, url, revision) { | ||
@@ -68,10 +39,13 @@ // We're assuming that if the URL contains any of the known hashes | ||
// already revisioned, and we don't need additional out-of-band revisioning. | ||
if (!revision || knownHashes.some(function (hash) { | ||
return url.includes(hash); | ||
})) { | ||
return { url }; | ||
if (!revision || knownHashes.some(hash => url.includes(hash))) { | ||
return { | ||
url | ||
}; | ||
} | ||
return { revision, url }; | ||
return { | ||
revision, | ||
url | ||
}; | ||
} | ||
/** | ||
@@ -97,48 +71,28 @@ * Filter to narrow down the asset list to chunks that: | ||
*/ | ||
function filterAssets(assetMetadata, whitelist, blacklist) { | ||
var filteredMapping = {}; | ||
const filteredMapping = {}; | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
var _arr = Object.entries(assetMetadata); | ||
try { | ||
for (var _iterator = (0, _getIterator3.default)((0, _entries2.default)(assetMetadata)), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var _ref = _step.value; | ||
for (var _i = 0; _i < _arr.length; _i++) { | ||
const _arr$_i = (0, _slicedToArray2.default)(_arr[_i], 2), | ||
file = _arr$_i[0], | ||
metadata = _arr$_i[1]; | ||
var _ref2 = (0, _slicedToArray3.default)(_ref, 2); | ||
const chunkName = metadata.chunkName; // This file is whitelisted if: | ||
// - Trivially, if there is no whitelist defined. | ||
// - There is a whitelist and our file is associated with a chunk whose name | ||
// is listed. | ||
var file = _ref2[0]; | ||
var metadata = _ref2[1]; | ||
const isWhitelisted = whitelist.length === 0 || whitelist.includes(chunkName); // This file is blacklisted if our file is associated with a chunk whose | ||
// name is listed. | ||
var chunkName = metadata.chunkName; | ||
// This file is whitelisted if: | ||
// - Trivially, if there is no whitelist defined. | ||
// - There is a whitelist and our file is associated with a chunk whose name | ||
// is listed. | ||
var isWhitelisted = whitelist.length === 0 || whitelist.includes(chunkName); | ||
const isBlacklisted = blacklist.includes(chunkName); // Only include this entry in the filtered mapping if we're whitelisted and | ||
// not blacklisted. | ||
// This file is blacklisted if our file is associated with a chunk whose | ||
// name is listed. | ||
var isBlacklisted = blacklist.includes(chunkName); | ||
// Only include this entry in the filtered mapping if we're whitelisted and | ||
// not blacklisted. | ||
if (isWhitelisted && !isBlacklisted) { | ||
filteredMapping[file] = metadata; | ||
} | ||
if (isWhitelisted && !isBlacklisted) { | ||
filteredMapping[file] = metadata; | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
@@ -148,3 +102,2 @@ | ||
} | ||
/** | ||
@@ -166,22 +119,22 @@ * Takes in compilation.assets and compilation.chunks, and assigns metadata | ||
*/ | ||
function generateMetadataForAssets(assets, chunks) { | ||
var mapping = {}; | ||
const mapping = {}; // Start out by getting metadata for all the assets associated with a chunk. | ||
// Start out by getting metadata for all the assets associated with a chunk. | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
try { | ||
for (var _iterator2 = (0, _getIterator3.default)(chunks), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var chunk = _step2.value; | ||
var _iteratorNormalCompletion4 = true; | ||
var _didIteratorError4 = false; | ||
var _iteratorError4 = undefined; | ||
for (var _iterator = chunks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
const chunk = _step.value; | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
try { | ||
for (var _iterator4 = (0, _getIterator3.default)(chunk.files), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { | ||
var _file = _step4.value; | ||
mapping[_file] = { | ||
for (var _iterator2 = chunk.files[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
const file = _step2.value; | ||
mapping[file] = { | ||
chunkName: chunk.name, | ||
@@ -192,30 +145,29 @@ hash: chunk.renderedHash | ||
} catch (err) { | ||
_didIteratorError4 = true; | ||
_iteratorError4 = err; | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion4 && _iterator4.return) { | ||
_iterator4.return(); | ||
if (!_iteratorNormalCompletion2 && _iterator2.return != null) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError4) { | ||
throw _iteratorError4; | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
} | ||
} | ||
} // Next, loop through the total list of assets and find anything that isn't | ||
// associated with a chunk. | ||
// Next, loop through the total list of assets and find anything that isn't | ||
// associated with a chunk. | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
if (!_iteratorNormalCompletion && _iterator.return != null) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
@@ -225,38 +177,18 @@ } | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
var _arr2 = Object.entries(assets); | ||
try { | ||
for (var _iterator3 = (0, _getIterator3.default)((0, _entries2.default)(assets)), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var _ref3 = _step3.value; | ||
for (var _i2 = 0; _i2 < _arr2.length; _i2++) { | ||
const _arr2$_i = (0, _slicedToArray2.default)(_arr2[_i2], 2), | ||
file = _arr2$_i[0], | ||
asset = _arr2$_i[1]; | ||
var _ref4 = (0, _slicedToArray3.default)(_ref3, 2); | ||
if (file in mapping) { | ||
continue; | ||
} | ||
var file = _ref4[0]; | ||
var asset = _ref4[1]; | ||
if (file in mapping) { | ||
continue; | ||
} | ||
mapping[file] = { | ||
// Just use an empty string to denote the lack of chunk association. | ||
chunkName: '', | ||
hash: getAssetHash(asset) | ||
}; | ||
} | ||
} catch (err) { | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
_iterator3.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
} | ||
} | ||
mapping[file] = { | ||
// Just use an empty string to denote the lack of chunk association. | ||
chunkName: '', | ||
hash: getAssetHash(asset) | ||
}; | ||
} | ||
@@ -266,3 +198,2 @@ | ||
} | ||
/** | ||
@@ -278,27 +209,12 @@ * Given an assetMetadata mapping, returns a Set of all of the hashes that | ||
*/ | ||
function getKnownHashesFromAssets(assetMetadata) { | ||
var knownHashes = new _set2.default(); | ||
var _iteratorNormalCompletion5 = true; | ||
var _didIteratorError5 = false; | ||
var _iteratorError5 = undefined; | ||
const knownHashes = new Set(); | ||
try { | ||
for (var _iterator5 = (0, _getIterator3.default)((0, _values2.default)(assetMetadata)), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { | ||
var metadata = _step5.value; | ||
var _arr3 = Object.values(assetMetadata); | ||
knownHashes.add(metadata.hash); | ||
} | ||
} catch (err) { | ||
_didIteratorError5 = true; | ||
_iteratorError5 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion5 && _iterator5.return) { | ||
_iterator5.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError5) { | ||
throw _iteratorError5; | ||
} | ||
} | ||
for (var _i3 = 0; _i3 < _arr3.length; _i3++) { | ||
const metadata = _arr3[_i3]; | ||
knownHashes.add(metadata.hash); | ||
} | ||
@@ -308,3 +224,2 @@ | ||
} | ||
/** | ||
@@ -319,55 +234,32 @@ * Generate an array of manifest entries using webpack's compilation data. | ||
*/ | ||
function getManifestEntriesFromCompilation(compilation, config) { | ||
var blacklistedChunkNames = config.excludeChunks; | ||
var whitelistedChunkNames = config.chunks; | ||
var assets = compilation.assets, | ||
chunks = compilation.chunks; | ||
var publicPath = compilation.options.output.publicPath; | ||
var assetMetadata = generateMetadataForAssets(assets, chunks); | ||
var filteredAssetMetadata = filterAssets(assetMetadata, whitelistedChunkNames, blacklistedChunkNames); | ||
function getManifestEntriesFromCompilation(compilation, config) { | ||
const blacklistedChunkNames = config.excludeChunks; | ||
const whitelistedChunkNames = config.chunks; | ||
const assets = compilation.assets, | ||
chunks = compilation.chunks; | ||
const publicPath = compilation.options.output.publicPath; | ||
const assetMetadata = generateMetadataForAssets(assets, chunks); | ||
const filteredAssetMetadata = filterAssets(assetMetadata, whitelistedChunkNames, blacklistedChunkNames); | ||
const knownHashes = [compilation.hash, compilation.fullHash, ...getKnownHashesFromAssets(filteredAssetMetadata)].filter(hash => !!hash); | ||
const manifestEntries = []; | ||
var knownHashes = [compilation.hash, compilation.fullHash].concat((0, _toConsumableArray3.default)(getKnownHashesFromAssets(filteredAssetMetadata))).filter(function (hash) { | ||
return !!hash; | ||
}); | ||
var _arr4 = Object.entries(filteredAssetMetadata); | ||
var manifestEntries = []; | ||
var _iteratorNormalCompletion6 = true; | ||
var _didIteratorError6 = false; | ||
var _iteratorError6 = undefined; | ||
for (var _i4 = 0; _i4 < _arr4.length; _i4++) { | ||
const _arr4$_i = (0, _slicedToArray2.default)(_arr4[_i4], 2), | ||
file = _arr4$_i[0], | ||
metadata = _arr4$_i[1]; | ||
try { | ||
for (var _iterator6 = (0, _getIterator3.default)((0, _entries2.default)(filteredAssetMetadata)), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) { | ||
var _ref5 = _step6.value; | ||
// Filter based on test/include/exclude options set in the config, | ||
// following webpack's conventions. | ||
// This matches the behavior of, e.g., UglifyJS's webpack plugin. | ||
if (!ModuleFilenameHelpers.matchObject(config, file)) { | ||
continue; | ||
} | ||
var _ref6 = (0, _slicedToArray3.default)(_ref5, 2); | ||
var file = _ref6[0]; | ||
var metadata = _ref6[1]; | ||
// Filter based on test/include/exclude options set in the config, | ||
// following webpack's conventions. | ||
// This matches the behavior of, e.g., UglifyJS's webpack plugin. | ||
if (!ModuleFilenameHelpers.matchObject(config, file)) { | ||
continue; | ||
} | ||
var publicUrl = resolveWebpackUrl(publicPath, file); | ||
var manifestEntry = getEntry(knownHashes, publicUrl, metadata.hash); | ||
manifestEntries.push(manifestEntry); | ||
} | ||
} catch (err) { | ||
_didIteratorError6 = true; | ||
_iteratorError6 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion6 && _iterator6.return) { | ||
_iterator6.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError6) { | ||
throw _iteratorError6; | ||
} | ||
} | ||
const publicUrl = resolveWebpackUrl(publicPath, file); | ||
const manifestEntry = getEntry(knownHashes, publicUrl, metadata.hash); | ||
manifestEntries.push(manifestEntry); | ||
} | ||
@@ -374,0 +266,0 @@ |
@@ -1,15 +0,19 @@ | ||
'use strict'; | ||
"use strict"; | ||
var _regenerator = require('babel-runtime/regenerator'); | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _regenerator2 = _interopRequireDefault(_regenerator); | ||
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")); | ||
var _getIterator2 = require('babel-runtime/core-js/get-iterator'); | ||
/* | ||
Copyright 2018 Google LLC | ||
var _getIterator3 = _interopRequireDefault(_getIterator2); | ||
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 path = require('path'); | ||
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator'); | ||
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2); | ||
const _require = require('workbox-build'), | ||
copyWorkboxLibraries = _require.copyWorkboxLibraries, | ||
getModuleUrl = _require.getModuleUrl; | ||
/** | ||
@@ -26,142 +30,81 @@ * @param {Object} compilation The webpack compilation. | ||
*/ | ||
var getWorkboxSWImport = function () { | ||
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(compilation, config) { | ||
var wbDir, workboxSWImport, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk; | ||
return _regenerator2.default.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
_context.t0 = config.importWorkboxFrom; | ||
_context.next = _context.t0 === 'cdn' ? 3 : _context.t0 === 'local' ? 4 : _context.t0 === 'disabled' ? 10 : 11; | ||
break; | ||
case 3: | ||
return _context.abrupt('return', [getModuleUrl('workbox-sw')]); | ||
function getWorkboxSWImport(_x, _x2) { | ||
return _getWorkboxSWImport.apply(this, arguments); | ||
} | ||
case 4: | ||
_context.next = 6; | ||
return copyWorkboxLibraries(path.join(compilation.options.output.path, config.importsDirectory)); | ||
function _getWorkboxSWImport() { | ||
_getWorkboxSWImport = (0, _asyncToGenerator2.default)(function* (compilation, config) { | ||
switch (config.importWorkboxFrom) { | ||
case 'cdn': | ||
{ | ||
return [getModuleUrl('workbox-sw')]; | ||
} | ||
case 6: | ||
wbDir = _context.sent; | ||
case 'local': | ||
{ | ||
// This will create a local copy of the Workbox runtime libraries in | ||
// the output directory, independent of the webpack build pipeline. | ||
// In general, this should work, but one thing to keep in mind is that | ||
// when using the webpack-dev-server, the output will be created on | ||
// disk, rather than in the in-memory filesystem. (webpack-dev-server will | ||
// still be able to serve the runtime libraries from disk.) | ||
const wbDir = yield copyWorkboxLibraries(path.join(compilation.options.output.path, config.importsDirectory)); // We need to set this extra option in the config to ensure that the | ||
// workbox library loader knows where to get the local libraries from. | ||
config.modulePathPrefix = (compilation.options.output.publicPath || '') + path.join(config.importsDirectory, wbDir).split(path.sep).join('/'); | ||
const workboxSWImport = config.modulePathPrefix + '/workbox-sw.js'; | ||
return [workboxSWImport]; | ||
} | ||
// We need to set this extra option in the config to ensure that the | ||
// workbox library loader knows where to get the local libraries from. | ||
config.modulePathPrefix = (compilation.options.output.publicPath || '') + path.join(config.importsDirectory, wbDir).split(path.sep).join('/'); | ||
case 'disabled': | ||
{ | ||
return null; | ||
} | ||
workboxSWImport = config.modulePathPrefix + '/workbox-sw.js'; | ||
return _context.abrupt('return', [workboxSWImport]); | ||
default: | ||
{ | ||
// If importWorkboxFrom is anything else, then treat it as the name of | ||
// a webpack chunk that corresponds to the custom compilation of the | ||
// Workbox code. | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
case 10: | ||
return _context.abrupt('return', null); | ||
try { | ||
for (var _iterator = compilation.chunks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
const chunk = _step.value; | ||
case 11: | ||
// If importWorkboxFrom is anything else, then treat it as the name of | ||
// a webpack chunk that corresponds to the custom compilation of the | ||
// Workbox code. | ||
_iteratorNormalCompletion = true; | ||
_didIteratorError = false; | ||
_iteratorError = undefined; | ||
_context.prev = 14; | ||
_iterator = (0, _getIterator3.default)(compilation.chunks); | ||
// Make sure that we actually have a chunk with the appropriate name. | ||
if (chunk.name === config.importWorkboxFrom) { | ||
config.excludeChunks.push(chunk.name); | ||
return chunk.files.map(file => { | ||
return (compilation.options.output.publicPath || '') + file; | ||
}); | ||
} | ||
} // If there's no chunk with the right name, treat it as a fatal error. | ||
case 16: | ||
if (_iteratorNormalCompletion = (_step = _iterator.next()).done) { | ||
_context.next = 24; | ||
break; | ||
} | ||
chunk = _step.value; | ||
if (!(chunk.name === config.importWorkboxFrom)) { | ||
_context.next = 21; | ||
break; | ||
} | ||
config.excludeChunks.push(chunk.name); | ||
return _context.abrupt('return', chunk.files.map(function (file) { | ||
return (compilation.options.output.publicPath || '') + file; | ||
})); | ||
case 21: | ||
_iteratorNormalCompletion = true; | ||
_context.next = 16; | ||
break; | ||
case 24: | ||
_context.next = 30; | ||
break; | ||
case 26: | ||
_context.prev = 26; | ||
_context.t1 = _context['catch'](14); | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = _context.t1; | ||
case 30: | ||
_context.prev = 30; | ||
_context.prev = 31; | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return != null) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
case 33: | ||
_context.prev = 33; | ||
if (!_didIteratorError) { | ||
_context.next = 36; | ||
break; | ||
} | ||
throw _iteratorError; | ||
case 36: | ||
return _context.finish(33); | ||
case 37: | ||
return _context.finish(30); | ||
case 38: | ||
throw Error(`importWorkboxFrom was set to ` + `'${config.importWorkboxFrom}', which is not an existing chunk name.`); | ||
case 39: | ||
case 'end': | ||
return _context.stop(); | ||
throw Error(`importWorkboxFrom was set to ` + `'${config.importWorkboxFrom}', which is not an existing chunk name.`); | ||
} | ||
} | ||
}, _callee, this, [[14, 26, 30, 38], [31,, 33, 37]]); | ||
})); | ||
} | ||
}); | ||
return _getWorkboxSWImport.apply(this, arguments); | ||
} | ||
return function getWorkboxSWImport(_x, _x2) { | ||
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 _require = require('workbox-build'), | ||
copyWorkboxLibraries = _require.copyWorkboxLibraries, | ||
getModuleUrl = _require.getModuleUrl; | ||
module.exports = getWorkboxSWImport; |
"use strict"; | ||
var _promise = require("babel-runtime/core-js/promise"); | ||
var _promise2 = _interopRequireDefault(_promise); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/* | ||
Copyright 2017 Google Inc. | ||
Copyright 2018 Google LLC | ||
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. | ||
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. | ||
*/ | ||
@@ -38,7 +24,8 @@ | ||
function readFileWrapper(readFileFn, filePath) { | ||
return new _promise2.default(function (resolve, reject) { | ||
readFileFn(filePath, function (error, data) { | ||
return new Promise((resolve, reject) => { | ||
readFileFn(filePath, (error, data) => { | ||
if (error) { | ||
return reject(error); | ||
} | ||
resolve(data); | ||
@@ -45,0 +32,0 @@ }); |
@@ -1,21 +0,11 @@ | ||
'use strict'; | ||
"use strict"; | ||
/* | ||
Copyright 2017 Google Inc. | ||
Copyright 2018 Google LLC | ||
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. | ||
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. | ||
*/ | ||
var path = require('path'); | ||
const path = require('path'); | ||
/** | ||
@@ -30,10 +20,12 @@ * @param {Object} compilation The webpack compilation. | ||
*/ | ||
module.exports = function (compilation, swDest) { | ||
module.exports = (compilation, swDest) => { | ||
// See https://github.com/jantimon/html-webpack-plugin/pull/266/files#diff-168726dbe96b3ce427e7fedce31bb0bcR38 | ||
if (path.resolve(swDest) === path.normalize(swDest)) { | ||
return path.relative(compilation.options.output.path, swDest); | ||
} | ||
} // Otherwise, return swDest as-is. | ||
// Otherwise, return swDest as-is. | ||
return swDest; | ||
}; |
@@ -1,17 +0,9 @@ | ||
'use strict'; | ||
"use strict"; | ||
/* | ||
Copyright 2017 Google Inc. | ||
Copyright 2018 Google LLC | ||
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. | ||
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. | ||
*/ | ||
@@ -31,8 +23,2 @@ | ||
*/ | ||
module.exports = function () { | ||
for (var _len = arguments.length, paths = Array(_len), _key = 0; _key < _len; _key++) { | ||
paths[_key] = arguments[_key]; | ||
} | ||
return paths.join(''); | ||
}; | ||
module.exports = (...paths) => paths.join(''); |
@@ -1,27 +0,9 @@ | ||
'use strict'; | ||
"use strict"; | ||
var _getIterator2 = require('babel-runtime/core-js/get-iterator'); | ||
var _getIterator3 = _interopRequireDefault(_getIterator2); | ||
var _assign = require('babel-runtime/core-js/object/assign'); | ||
var _assign2 = _interopRequireDefault(_assign); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/* | ||
Copyright 2017 Google Inc. | ||
Copyright 2018 Google LLC | ||
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. | ||
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. | ||
*/ | ||
@@ -38,7 +20,5 @@ | ||
function forGetManifest(originalConfig) { | ||
var propertiesToRemove = ['chunks', 'exclude', 'excludeChunks', 'importScripts', 'importWorkboxFrom', 'importsDirectory', 'include', 'precacheManifestFilename', 'swDest', 'swSrc', 'test']; | ||
const propertiesToRemove = ['chunks', 'exclude', 'excludeChunks', 'importScripts', 'importWorkboxFrom', 'importsDirectory', 'include', 'precacheManifestFilename', 'swDest', 'swSrc', 'test']; | ||
return sanitizeConfig(originalConfig, propertiesToRemove); | ||
} | ||
/** | ||
@@ -52,8 +32,8 @@ * Helper method that sanitizes the config based on what | ||
*/ | ||
function forGenerateSWString(originalConfig) { | ||
var propertiesToRemove = ['chunks', 'exclude', 'excludeChunks', 'importWorkboxFrom', 'importsDirectory', 'include', 'precacheManifestFilename', 'swDest', 'test']; | ||
const propertiesToRemove = ['chunks', 'exclude', 'excludeChunks', 'importWorkboxFrom', 'importsDirectory', 'include', 'precacheManifestFilename', 'swDest', 'test']; | ||
return sanitizeConfig(originalConfig, propertiesToRemove); | ||
} | ||
/** | ||
@@ -71,5 +51,6 @@ * Given a config object, make a shallow copy via Object.assign(), and remove | ||
*/ | ||
function sanitizeConfig(originalConfig, propertiesToRemove) { | ||
var config = (0, _assign2.default)({}, originalConfig); | ||
const config = Object.assign({}, originalConfig); | ||
var _iteratorNormalCompletion = true; | ||
@@ -80,5 +61,4 @@ var _didIteratorError = false; | ||
try { | ||
for (var _iterator = (0, _getIterator3.default)(propertiesToRemove), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var property = _step.value; | ||
for (var _iterator = propertiesToRemove[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
const property = _step.value; | ||
delete config[property]; | ||
@@ -91,3 +71,3 @@ } | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
if (!_iteratorNormalCompletion && _iterator.return != null) { | ||
_iterator.return(); | ||
@@ -94,0 +74,0 @@ } |
@@ -1,21 +0,11 @@ | ||
'use strict'; | ||
"use strict"; | ||
/* | ||
Copyright 2017 Google Inc. | ||
Copyright 2018 Google LLC | ||
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. | ||
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. | ||
*/ | ||
var stringify = require('json-stable-stringify'); | ||
const stringify = require('json-stable-stringify'); | ||
/** | ||
@@ -26,4 +16,5 @@ * The variable name that workbox-sw expects manifest entries to be assigned. | ||
*/ | ||
var PRECACHE_MANIFEST_VAR = '__precacheManifest'; | ||
const PRECACHE_MANIFEST_VAR = '__precacheManifest'; | ||
/** | ||
@@ -39,12 +30,13 @@ * Generates a template string from an array of manifest entries that can be | ||
*/ | ||
module.exports = function (manifestEntries) { | ||
var sortedEntries = manifestEntries.sort(function (a, b) { | ||
return a.url < b.url; | ||
}); | ||
// json-stable-stringify ensures that we get a consistent output, with all | ||
module.exports = manifestEntries => { | ||
const sortedEntries = manifestEntries.sort((a, b) => a.url < b.url); // json-stable-stringify ensures that we get a consistent output, with all | ||
// the properties of each object sorted. | ||
// There's a hash created of the serialized JSON data, and we want the hash to | ||
// be the same if the data is the same, without any sort-order variation. | ||
var entriesJson = stringify(sortedEntries, { space: 2 }); | ||
const entriesJson = stringify(sortedEntries, { | ||
space: 2 | ||
}); | ||
return `self.${PRECACHE_MANIFEST_VAR} = ${entriesJson};`; | ||
}; |
@@ -1,27 +0,15 @@ | ||
'use strict'; | ||
"use strict"; | ||
/* | ||
Copyright 2017 Google Inc. | ||
Copyright 2018 Google LLC | ||
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. | ||
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 = config => { | ||
const moreInfoUrl = 'https://goo.gl/EQ4Rhm'; | ||
const globOptions = ['globDirectory', 'globFollow', 'globIgnores', 'globPatterns', 'globStrict']; | ||
const usedGlobOptions = globOptions.filter(option => option in config); | ||
module.exports = function (config) { | ||
var moreInfoUrl = 'https://goo.gl/EQ4Rhm'; | ||
var globOptions = ['globDirectory', 'globFollow', 'globIgnores', 'globPatterns', 'globStrict']; | ||
var usedGlobOptions = globOptions.filter(function (option) { | ||
return option in config; | ||
}); | ||
if (usedGlobOptions.length > 0) { | ||
@@ -31,7 +19,5 @@ return `You're using the following Workbox configuration option` + `${usedGlobOptions.length === 1 ? '' : 's'}: ` + `[${usedGlobOptions.join(', ')}]. In Workbox v3 and later, this is ` + `usually not needed. Please see ${moreInfoUrl} for more info.`; | ||
var optionsToWarnAboutWhenGlobPatternsIsNotSet = ['dontCacheBustUrlsMatching', 'manifestTransforms', 'maximumFileSizeToCacheInBytes', 'modifyUrlPrefix']; | ||
const optionsToWarnAboutWhenGlobPatternsIsNotSet = ['dontCacheBustUrlsMatching', 'manifestTransforms', 'maximumFileSizeToCacheInBytes', 'modifyUrlPrefix']; | ||
const usedNoopOptions = optionsToWarnAboutWhenGlobPatternsIsNotSet.filter(option => option in config); | ||
var usedNoopOptions = optionsToWarnAboutWhenGlobPatternsIsNotSet.filter(function (option) { | ||
return option in config; | ||
}); | ||
if (usedNoopOptions.length > 0) { | ||
@@ -38,0 +24,0 @@ return `You're using the following Workbox configuration option` + `${usedGlobOptions.length === 1 ? '' : 's'}: ` + `[${usedNoopOptions.join(', ')}]. This will not have any effect, as ` + `it will only modify files that are matched via 'globPatterns'. You ` + `can remove them from your config, and learn more at ${moreInfoUrl}`; |
{ | ||
"name": "workbox-webpack-plugin", | ||
"version": "3.6.2", | ||
"version": "4.0.0-alpha.0", | ||
"description": "A plugin for your Webpack build process, helping you generate a manifest of local files that workbox-sw should precache.", | ||
@@ -31,5 +31,5 @@ "keywords": [ | ||
"dependencies": { | ||
"babel-runtime": "^6.26.0", | ||
"@babel/runtime": "^7.0.0", | ||
"json-stable-stringify": "^1.0.1", | ||
"workbox-build": "^3.6.2" | ||
"workbox-build": "^4.0.0-alpha.0" | ||
}, | ||
@@ -40,6 +40,7 @@ "peerDependencies": { | ||
"author": "Will Farley <a.will.farley@gmail.com> (http://www.willfarley.org/)", | ||
"license": "Apache-2.0", | ||
"license": "MIT", | ||
"repository": "googlechrome/workbox", | ||
"bugs": "https://github.com/GoogleChrome/workbox/issues", | ||
"homepage": "https://github.com/GoogleChrome/workbox" | ||
"homepage": "https://github.com/GoogleChrome/workbox", | ||
"gitHead": "db1fb73fd32fbd5cbf42e246e6144011a5c6edc2" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 7 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48422
8
60
863
1
+ Added@babel/runtime@^7.0.0
+ Added@babel/runtime@7.26.0(transitive)
+ Added@hapi/address@2.1.4(transitive)
+ Added@hapi/bourne@1.3.2(transitive)
+ Added@hapi/hoek@8.5.1(transitive)
+ Added@hapi/joi@15.1.1(transitive)
+ Added@hapi/topo@3.1.6(transitive)
+ Addedbn.js@4.12.1(transitive)
+ Addedelliptic@6.6.1(transitive)
+ Addedpretty-bytes@5.6.0(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)
+ Addedworkbox-background-sync@4.3.1(transitive)
+ Addedworkbox-broadcast-update@4.3.1(transitive)
+ Addedworkbox-build@4.3.1(transitive)
+ Addedworkbox-cacheable-response@4.3.1(transitive)
+ Addedworkbox-core@4.3.1(transitive)
+ Addedworkbox-expiration@4.3.1(transitive)
+ Addedworkbox-google-analytics@4.3.1(transitive)
+ Addedworkbox-navigation-preload@4.3.1(transitive)
+ Addedworkbox-precaching@4.3.1(transitive)
+ Addedworkbox-range-requests@4.3.1(transitive)
+ Addedworkbox-routing@4.3.1(transitive)
+ Addedworkbox-strategies@4.3.1(transitive)
+ Addedworkbox-streams@4.3.1(transitive)
+ Addedworkbox-sw@4.3.1(transitive)
+ Addedworkbox-window@4.3.1(transitive)
- Removedbabel-runtime@^6.26.0
- Removedbn.js@4.12.0(transitive)
- Removedelliptic@6.6.0(transitive)
- Removedhoek@4.3.1(transitive)
- Removedisemail@3.2.0(transitive)
- Removedjoi@11.4.0(transitive)
- Removedpretty-bytes@4.0.2(transitive)
- Removedtopo@2.1.1(transitive)
- Removedworkbox-background-sync@3.6.3(transitive)
- Removedworkbox-broadcast-cache-update@3.6.3(transitive)
- Removedworkbox-build@3.6.3(transitive)
- Removedworkbox-cache-expiration@3.6.3(transitive)
- Removedworkbox-cacheable-response@3.6.3(transitive)
- Removedworkbox-core@3.6.3(transitive)
- Removedworkbox-google-analytics@3.6.3(transitive)
- Removedworkbox-navigation-preload@3.6.3(transitive)
- Removedworkbox-precaching@3.6.3(transitive)
- Removedworkbox-range-requests@3.6.3(transitive)
- Removedworkbox-routing@3.6.3(transitive)
- Removedworkbox-strategies@3.6.3(transitive)
- Removedworkbox-streams@3.6.3(transitive)
- Removedworkbox-sw@3.6.3(transitive)
Updatedworkbox-build@^4.0.0-alpha.0