@nuxtjs/workbox
Advanced tools
Comparing version 3.0.0-beta.0 to 3.0.0-beta.1
@@ -6,2 +6,13 @@ # Change Log | ||
# [3.0.0-beta.1](https://github.com/nuxt-community/pwa-module/compare/v3.0.0-beta.0...v3.0.0-beta.1) (2019-02-07) | ||
### Features | ||
* use better regexes ([318228e](https://github.com/nuxt-community/pwa-module/commit/318228e)) | ||
# [3.0.0-beta.0](https://github.com/nuxt-community/pwa-module/compare/v2.6.0...v3.0.0-beta.0) (2019-02-04) | ||
@@ -8,0 +19,0 @@ |
const path = require('path') | ||
const defaults = require('./defaults') | ||
const { fixUrl, isUrl } = require('./utils') | ||
const { joinUrl, getRouteParams } = require('@nuxtjs/pwa-utils') | ||
const HMRRegex = '(?!.*(__webpack_hmr|hot-update))' | ||
function getOptions (moduleOptions) { | ||
@@ -16,11 +18,4 @@ const options = Object.assign({}, defaults, moduleOptions, this.options.workbox) | ||
if (!options.publicPath) { | ||
if (isUrl(this.options.build.publicPath)) { | ||
// CDN | ||
options.publicPath = this.options.build.publicPath | ||
if (options.publicPath.indexOf('//') === 0) { | ||
options.publicPath = '/' + options.publicPath | ||
} | ||
} else { | ||
options.publicPath = fixUrl(`${options.routerBase}/${this.options.build.publicPath}`) | ||
} | ||
const { publicPath } = getRouteParams(this.options) | ||
options.publicPath = publicPath | ||
} | ||
@@ -40,3 +35,3 @@ | ||
if (!options.swURL) { | ||
options.swURL = fixUrl(`${options.routerBase}/sw.js`) | ||
options.swURL = joinUrl(options.routerBase, 'sw.js') | ||
} | ||
@@ -46,3 +41,3 @@ | ||
if (!options.swScope) { | ||
options.swScope = fixUrl(`${options.routerBase}/`) | ||
options.swScope = options.routerBase | ||
} | ||
@@ -53,3 +48,3 @@ | ||
options.runtimeCaching.push({ | ||
urlPattern: fixUrl(`${options.publicPath}/(?!.*hot-update).+`), | ||
urlPattern: joinUrl(options.publicPath, HMRRegex), | ||
handler: 'cacheFirst' | ||
@@ -62,3 +57,3 @@ }) | ||
options.runtimeCaching.push({ | ||
urlPattern: fixUrl(`${options.routerBase}/.*`), | ||
urlPattern: joinUrl(`^${options.routerBase}`, HMRRegex), | ||
handler: 'networkFirst' | ||
@@ -65,0 +60,0 @@ }) |
const { readFileSync, existsSync } = require('fs') | ||
function fixUrl (url) { | ||
return url.replace(/\/\//g, '/').replace(':/', '://') | ||
} | ||
function isUrl (url) { | ||
return url.indexOf('http') === 0 || url.indexOf('//') === 0 | ||
} | ||
function readJSFiles (files) { | ||
@@ -25,5 +18,3 @@ return Array.from(files) | ||
module.exports = { | ||
fixUrl, | ||
isUrl, | ||
readJSFiles | ||
} |
{ | ||
"name": "@nuxtjs/workbox", | ||
"version": "3.0.0-beta.0", | ||
"version": "3.0.0-beta.1", | ||
"license": "MIT", | ||
@@ -10,3 +10,6 @@ "main": "lib/module.js", | ||
}, | ||
"gitHead": "ef541d202ea3d067ce74245300cf58933dbb5bb1" | ||
"dependencies": { | ||
"@nuxtjs/pwa-utils": "3.0.0-beta.1" | ||
}, | ||
"gitHead": "9ce84a1ef64b58cecd2637af6dd2b7897cf60c55" | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
9854
1
203
+ Added@nuxtjs/pwa-utils@3.0.0-beta.1(transitive)