New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@nuxtjs/workbox

Package Overview
Dependencies
Maintainers
5
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nuxtjs/workbox - npm Package Compare versions

Comparing version 3.0.0-beta.5 to 3.0.0-beta.6

19

CHANGELOG.md

@@ -6,2 +6,21 @@ # Change Log

# [3.0.0-beta.6](https://github.com/nuxt-community/pwa-module/compare/v3.0.0-beta.5...v3.0.0-beta.6) (2019-02-08)
### Bug Fixes
* relax pages regex for workbox 4 compatiblity ([04e74a7](https://github.com/nuxt-community/pwa-module/commit/04e74a7))
### Features
* cleanupOutdatedCaches ([9167013](https://github.com/nuxt-community/pwa-module/commit/9167013))
* **workbox:** assetsURLPattern, pagesURLPattern ([5fc3d66](https://github.com/nuxt-community/pwa-module/commit/5fc3d66))
* **workbox:** preCaching option ([67f1c3d](https://github.com/nuxt-community/pwa-module/commit/67f1c3d))
* **workbox:** upgrade workboxVersion to 4.0.0-rc.0 ([b364572](https://github.com/nuxt-community/pwa-module/commit/b364572))
# [3.0.0-beta.5](https://github.com/nuxt-community/pwa-module/compare/v3.0.0-beta.3...v3.0.0-beta.5) (2019-02-08)

@@ -8,0 +27,0 @@

51

lib/defaults.js
module.exports = {
workboxVersion: '3.6.3-5',
// General
workboxVersion: '4.0.0-rc.0',
workboxURL: undefined,
importScripts: [],
autoRegister: true,
dev: false,
// Config
config: {},
clientsClaim: true,
skipWaiting: true,
offlineAnalytics: false,
workboxExtensions: [],
dev: false,
// Precache
preCaching: [],
cacheOptions: {
cacheId: process.env.npm_package_name || 'nuxt',
directoryIndex: '/',
revision: undefined
},
cachingExtensions: [],
cleanupOutdatedCaches: true,
importScripts: [],
// Offline
offline: true,

@@ -15,20 +31,10 @@ offlinePage: null,

offlineAnalytics: false,
cachingExtensions: [],
// Runtime Caching
runtimeCaching: [],
routingExtensions: [],
workboxExtensions: [],
clientsClaim: true,
skipWaiting: true,
runtimeCaching: [],
cacheAssets: true,
assetsURLPattern: undefined,
pagesURLPattern: undefined,
autoRegister: true,
routerBase: undefined,
publicPath: undefined,
// Sw
swTemplate: undefined,

@@ -38,6 +44,5 @@ swUrl: undefined,

cacheOptions: {
cacheId: process.env.npm_package_name || 'nuxt',
directoryIndex: '/'
}
// Router
routerBase: undefined,
publicPath: undefined
}
const path = require('path')
const defaults = require('./defaults')
const { joinUrl, getRouteParams } = require('@nuxtjs/pwa-utils')
const { joinUrl, getRouteParams, startCase } = require('@nuxtjs/pwa-utils')

@@ -44,6 +44,9 @@ const HMRRegex = '(?!.*(__webpack_hmr|hot-update))'

// Cache all _nuxt resources at runtime
if (!options.assetsURLPattern) {
options.assetsURLPattern = joinUrl(options.publicPath, HMRRegex)
}
if (options.cacheAssets) {
options.runtimeCaching.push({
urlPattern: joinUrl(options.publicPath, HMRRegex),
handler: 'cacheFirst'
urlPattern: options.assetsURLPattern,
handler: 'CacheFirst'
})

@@ -53,13 +56,26 @@ }

// Optionally cache other routes for offline
if (!options.pagesURLPattern) {
options.pagesURLPattern = joinUrl(options.routerBase, HMRRegex)
}
if (options.offline && !options.offlinePage) {
options.runtimeCaching.push({
urlPattern: joinUrl(`^${options.routerBase}`, HMRRegex),
handler: 'networkFirst'
urlPattern: options.pagesURLPattern,
handler: 'NetworkFirst'
})
}
// Add offlineAssets to precaching
if (options.offlineAssets.length) {
options.preCaching.unshift(...options.offlineAssets)
}
// Add offlinePage to precaching
if (options.offlinePage) {
options.preCaching.unshift(options.offlinePage)
}
// Normalize runtimeCaching
options.runtimeCaching = options.runtimeCaching.map(entry => ({
...entry,
handler: entry.handler || 'networkFirst',
handler: startCase(entry.handler) || 'NetworkFirst',
method: entry.method || 'GET'

@@ -66,0 +82,0 @@ }))

{
"name": "@nuxtjs/workbox",
"version": "3.0.0-beta.5",
"version": "3.0.0-beta.6",
"license": "MIT",

@@ -11,5 +11,5 @@ "main": "lib/module.js",

"dependencies": {
"@nuxtjs/pwa-utils": "3.0.0-beta.5"
"@nuxtjs/pwa-utils": "3.0.0-beta.6"
},
"gitHead": "c865bb3224237c9dfdf5fe4e0f586bdea07b304a"
"gitHead": "5a3fa2e0ce38fc09f8ce462941f300143631da4a"
}

@@ -14,3 +14,3 @@ importScripts(<%= [options.workboxURL, ...options.importScripts].map((i) => `'${i}'`).join(', ') %>)

// Start controlling any existing clients as soon as it activates
workbox.clientsClaim()
workbox.core.clientsClaim()
<% } %>

@@ -20,5 +20,9 @@

// Skip over the SW waiting lifecycle stage
workbox.skipWaiting()
workbox.core.skipWaiting()
<% } %>
<% if (options.cleanupOutdatedCaches) { %>
workbox.precaching.cleanupOutdatedCaches()
<% } %>
<% if (options.offlineAnalytics) { %>

@@ -38,15 +42,7 @@ // Enable offline Google Analytics tracking

// Precache build artifacts
workbox.precaching.precacheAndRoute([], <%= JSON.stringify(options.cacheOptions, null, 2) %>)
<% if (options.offlineAssets.length) { %>
// Precache offlineAssets
workbox.precaching.precacheAndRoute([<%= options.offlineAssets.map((i) => `'${i}'`).join(', ') %>])
// Precache assets
<% if (options.preCaching.length) { %>
workbox.precaching.precacheAndRoute(<%= JSON.stringify(options.preCaching, null, 2) %>, <%= JSON.stringify(options.cacheOptions, null, 2) %>)
<% } %>
<% if (options.offlinePage) { %>
// Precache offlinePage
workbox.precaching.precacheAndRoute(['<%= options.offlinePage %>'])
<% } %>
<% if (options.cachingExtensions) { %>

@@ -62,3 +58,3 @@ // -- Start of cachingExtensions --

// Register route handlers for runtimeCaching
<% options.runtimeCaching.forEach(r => { %>workbox.routing.registerRoute(new RegExp('<%= r.urlPattern %>'), workbox.strategies.<%= r.handler %> (<%= JSON.stringify(r.strategyOptions || {}) %>), '<%= r.method %>')
<% options.runtimeCaching.forEach(r => { %>workbox.routing.registerRoute(new RegExp('<%= r.urlPattern %>'), new workbox.strategies.<%= r.handler %> (<%= JSON.stringify(r.strategyOptions || {}) %>), '<%= r.method %>')
<% }) %>

@@ -68,4 +64,4 @@

// Register router handler for offlinePage
workbox.routing.registerRoute(new RegExp('/.*'), ({event}) => {
return workbox.strategies.networkOnly().handle({event})
workbox.routing.registerRoute(new RegExp('<%= options.pagesURLPattern %>'), ({event}) => {
return new workbox.strategies.NetworkOnly().handle({event})
.catch(() => caches.match('<%= options.offlinePage %>'))

@@ -72,0 +68,0 @@ })<% } %>

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc