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
3
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 0.3.4 to 0.4.0

11

CHANGELOG.md

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

<a name="0.4.0"></a>
# [0.4.0](https://github.com/nuxt/modules/compare/@nuxtjs/workbox@0.3.4...@nuxtjs/workbox@0.4.0) (2017-06-06)
### Features
* **workbox:** simplify publicPath & routerBase ([ab1cb77](https://github.com/nuxt/modules/commit/ab1cb77))
<a name="0.3.4"></a>

@@ -8,0 +19,0 @@ ## [0.3.4](https://github.com/nuxt/modules/compare/@nuxtjs/workbox@0.3.3...@nuxtjs/workbox@0.3.4) (2017-06-05)

21

index.js
const path = require('path')
const workboxPlugin = require('workbox-webpack-plugin');
const fixUrl = url => url.replace(/(?!^)\/\//g, '/').replace(':/', '://') // // ~> /
const regexEscape = url => url.replace(/\//g, '\\/') // / ~> \/
const wildcardRegex = url => '/' + regexEscape(fixUrl(url + '/.*')) + '/' // [url] ~> /[escape_url]\/*/
const fixUrl = url => url.replace(/\/\//g, '/').replace(':/', '://')
const wildcardRegex = url => '/' + fixUrl(url + '/.*').replace(/\//g, '\\/') + '/'
const isUrl = url => url.indexOf('http') === 0 || url.indexOf('//') === 0

@@ -14,7 +13,13 @@

// routerBase and publicPath
const routerBase = this.options.router.base
let publicPath = fixUrl(`${routerBase}/${this.options.build.publicPath}`)
if (isUrl(this.options.build.publicPath)) { // CDN
publicPath = this.options.build.publicPath
if (publicPath.indexOf('//') === 0) {
publicPath = '/' + publicPath // escape fixUrl
}
}
const swFileName = 'sw.js'
const routerBase = this.options.router.base === '/' ? '' : this.options.router.base
const publicPath = isUrl(this.options.build.publicPath)
? this.options.build.publicPath
: fixUrl(routerBase + this.options.build.publicPath)

@@ -32,3 +37,3 @@ // Add webpack plugin. This plugin internally uses swBuild to generate sw file

modifyUrlPrefix: {
'/': publicPath
'/': fixUrl(publicPath)
},

@@ -35,0 +40,0 @@ runtimeCaching: [

{
"name": "@nuxtjs/workbox",
"version": "0.3.4",
"version": "0.4.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "main": "index.js",

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