Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nuxt-community/pwa-module
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.0.0-beta.17
Choose a base ref
...
head repository: nuxt-community/pwa-module
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.0.0-beta.18
Choose a head ref
  • 7 commits
  • 14 files changed
  • 3 contributors

Commits on Sep 9, 2019

  1. Copy the full SHA
    ae12f89 View commit details
  2. fix: use shared pwa context

    pi0 committed Sep 9, 2019
    Copy the full SHA
    3c19bae View commit details
  3. Copy the full SHA
    4916ce6 View commit details
  4. Copy the full SHA
    d0f96de View commit details
  5. chore: cleanup

    pi0 committed Sep 9, 2019
    Copy the full SHA
    6c847cc View commit details
  6. fix pwa option handling

    pi0 committed Sep 9, 2019
    Copy the full SHA
    38485af View commit details
  7. chore(release): 3.0.0-beta.18

    pi0 committed Sep 9, 2019
    Copy the full SHA
    616915f View commit details
Showing with 126 additions and 118 deletions.
  1. +8 −0 CHANGELOG.md
  2. +1 −1 docs/modules/workbox.md
  3. +1 −1 docs/package.json
  4. +59 −58 docs/yarn.lock
  5. +12 −13 lib/icon/module.js
  6. +4 −4 lib/manifest/module.js
  7. +4 −4 lib/meta/module.js
  8. +22 −5 lib/module.js
  9. +1 −1 lib/onesignal/module.js
  10. +4 −4 lib/workbox/module.js
  11. +2 −2 lib/workbox/options.js
  12. +2 −18 lib/workbox/utils.js
  13. +2 −3 package.json
  14. +4 −4 yarn.lock
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,14 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [3.0.0-beta.18](https://github.com/nuxt-community/pwa-module/compare/v3.0.0-beta.17...v3.0.0-beta.18) (2019-09-09)


### Bug Fixes

* revert compileTemplate as is fixed by nuxt/nuxt.js[#6283](https://github.com/nuxt-community/pwa-module/issues/6283) for 2.9.x ([d0f96de](https://github.com/nuxt-community/pwa-module/commit/d0f96de))
* use shared pwa context ([3c19bae](https://github.com/nuxt-community/pwa-module/commit/3c19bae))

## [3.0.0-beta.17](https://github.com/nuxt-community/pwa-module/compare/v3.0.0-beta.16...v3.0.0-beta.17) (2019-09-05)


2 changes: 1 addition & 1 deletion docs/modules/workbox.md
Original file line number Diff line number Diff line change
@@ -309,7 +309,7 @@ Safari requires rangeRequests.

```js
workbox.routing.registerRoute(
/.*\.(mp4|webm)/,
/\.(mp4|webm)/,
workbox.strategies.cacheFirst({
plugins: [
new workbox.rangeRequests.Plugin(),
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
@@ -5,6 +5,6 @@
"build": "vuepress build"
},
"devDependencies": {
"vuepress": "^1.0.3"
"vuepress": "^1.0.4"
}
}
117 changes: 59 additions & 58 deletions docs/yarn.lock
Original file line number Diff line number Diff line change
@@ -807,18 +807,18 @@
source-map "~0.6.1"
vue-template-es2015-compiler "^1.9.0"

"@vuepress/core@^1.0.3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@vuepress/core/-/core-1.0.3.tgz#a32aedca770ee763c406a74abab2bc4fa42e9bdc"
integrity sha512-VUzjf2LMxy+DjiDs2QUO0R4zXATn0db7ClDETzc5D+HH08J2YwUO2YNHgIObHMyuihmDozesbYBiDp0kIxAqCw==
"@vuepress/core@^1.0.4":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@vuepress/core/-/core-1.0.4.tgz#623c5cc4d9865e60a11917af01cdaa1b41dbe5d2"
integrity sha512-ZF3e7nHCSREM0Yq/LyMmZEL3Qv85JVrqIgCHlv3goW9Ay5gn/YLy1JaG2+/1JgDFfw5Hr+qmtGs3aExGSeOS+Q==
dependencies:
"@babel/core" "^7.0.0"
"@vue/babel-preset-app" "^3.1.1"
"@vuepress/markdown" "^1.0.3"
"@vuepress/markdown-loader" "^1.0.3"
"@vuepress/plugin-last-updated" "^1.0.3"
"@vuepress/plugin-register-components" "^1.0.3"
"@vuepress/shared-utils" "^1.0.3"
"@vuepress/markdown" "^1.0.4"
"@vuepress/markdown-loader" "^1.0.4"
"@vuepress/plugin-last-updated" "^1.0.4"
"@vuepress/plugin-register-components" "^1.0.4"
"@vuepress/shared-utils" "^1.0.4"
autoprefixer "^9.5.1"
babel-loader "^8.0.4"
cache-loader "^3.0.0"
@@ -850,65 +850,65 @@
webpack-merge "^4.1.2"
webpackbar "3.2.0"

"@vuepress/markdown-loader@^1.0.3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@vuepress/markdown-loader/-/markdown-loader-1.0.3.tgz#8e63e66d0bb1ec75ee564424bdf8e7ee38077b63"
integrity sha512-2/023ghXi+7XHeHRbcXpUeWAERtSSCopPPdZqFV5/aIhW+Lv1Bl2iV1QfR2jKwlnZO/6g3HYMBq2GJaTNw0QLg==
"@vuepress/markdown-loader@^1.0.4":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@vuepress/markdown-loader/-/markdown-loader-1.0.4.tgz#2c54772889b19dcb8b2703cadd6088b96d748adb"
integrity sha512-kgePl2Oo0q8VGZe3tiuj88UJF1Mpn8Hp7bg0SSpa70WO6ne4S5u8H1M+80fClbuLLoyc5jtb92XcDkfzlnCurw==
dependencies:
"@vuepress/markdown" "^1.0.3"
"@vuepress/markdown" "^1.0.4"
loader-utils "^1.1.0"
lru-cache "^5.1.1"

"@vuepress/markdown@^1.0.3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@vuepress/markdown/-/markdown-1.0.3.tgz#633e2b69ee7c00a1aaa8b71584a50e4e1518edc6"
integrity sha512-kauU0EZk5+Ju74MtxiBiQ6HAbcchr8UjbURHSHwJe1k6W0fy0wyQ0ND5EILLhKZl1KhZeHGGDKBW385ruRKfcQ==
"@vuepress/markdown@^1.0.4":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@vuepress/markdown/-/markdown-1.0.4.tgz#ab0a403e78acb36fa24d90061191caadad7cb77c"
integrity sha512-xBEzq09UrAnQm1W7UVJ9UDraBTYJUyFj0aJOBwzKoG0QtGzK9ah6WTCeKOskvzLYQkqToVtig82q2uoKU9PH2A==
dependencies:
"@vuepress/shared-utils" "^1.0.3"
"@vuepress/shared-utils" "^1.0.4"
markdown-it "^8.4.1"
markdown-it-anchor "^5.0.2"
markdown-it-chain "^1.3.0"
markdown-it-emoji "^1.4.0"
markdown-it-table-of-contents "^0.4.0"
prismjs "^1.13.0"

"@vuepress/plugin-active-header-links@^1.0.3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@vuepress/plugin-active-header-links/-/plugin-active-header-links-1.0.3.tgz#94cae9a4e554fb7989461741748938efaa2fd65e"
integrity sha512-hUxGVfiQs/ywDykklSzMXT4evHe1w/DB5PMtS2LIig3sj5K+gAgNiu6L9SjXFTrYPxp9fWkYmkKPf7guV2QuRw==
"@vuepress/plugin-active-header-links@^1.0.4":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@vuepress/plugin-active-header-links/-/plugin-active-header-links-1.0.4.tgz#877d3b607597f9902deaac5184d79b6b2f6139b2"
integrity sha512-sYT1yvBeUMW9cTHVzrKl1mzCmMQCwROVTe2B7N1UvtLpYT+xvu33Uttbk9Aj/p5PxqGH65vaTBKaQoGkdyMp3g==
dependencies:
lodash.throttle "^4.1.1"

"@vuepress/plugin-last-updated@^1.0.3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@vuepress/plugin-last-updated/-/plugin-last-updated-1.0.3.tgz#b9e3cd2d7cc27d0e70e7ea2194c171607bd61493"
integrity sha512-GMD9g8Lw1ASdBiRZgQotkZqOgsGuvX33sDnmRuYjUcO4f6Lo+m8JZsOTStNjcquCvykucbjYqU1LQTyGAMyZWw==
"@vuepress/plugin-last-updated@^1.0.4":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@vuepress/plugin-last-updated/-/plugin-last-updated-1.0.4.tgz#ff50eaf74a9b1e27702b411532efd74801256941"
integrity sha512-HOUj4XJPnoAlYdeo7GPXVXNjC/A28u8bwvIBi92w5uBlNyYs4tjZMso/WVaMhH9Q7touYIp5PCcZTzACoOMNwg==
dependencies:
cross-spawn "^6.0.5"

"@vuepress/plugin-nprogress@^1.0.3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@vuepress/plugin-nprogress/-/plugin-nprogress-1.0.3.tgz#a0d6913193c933171b4695bf153efb0c29a76421"
integrity sha512-F7+R9EcBV0MT7dn06sUhGpsE7dzkT/eVLBNDqN3hDBedhu1XV8Ch5JYYGXKGFHrRdtDmiwyvEl4W6L6uzCVT4Q==
"@vuepress/plugin-nprogress@^1.0.4":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@vuepress/plugin-nprogress/-/plugin-nprogress-1.0.4.tgz#65628758a310552806c266d54a135555fbf67276"
integrity sha512-hhykZwb5Sh3oVIOz7nrjF59KImH+N6V4HphKni740G9LOu2577JU/Jf3MOxqTqRTAnrS73QvrE1dv6xJJ/HQqg==
dependencies:
nprogress "^0.2.0"

"@vuepress/plugin-register-components@^1.0.3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@vuepress/plugin-register-components/-/plugin-register-components-1.0.3.tgz#5cbfd0947c904a0f4c1911746fb5586520ed9b9d"
integrity sha512-6vlXEuaEJtV1EIudcVzJciJf0HRAcWRd6ViB9WO87enkqeT+bR32VZENqcN43RyF8vPP+mmZ/2eDUpvM3J6a2w==
"@vuepress/plugin-register-components@^1.0.4":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@vuepress/plugin-register-components/-/plugin-register-components-1.0.4.tgz#1a714d393842b5454443bbe3aa2b91b64995eb93"
integrity sha512-v5K2a8dsmIaynHh6LnFEbSfoCR8nM03vX+vS90iYPMdcE44DTL1d56YRf0zsRD0NN96gkIjcRA3NpSY5Oe8cGg==
dependencies:
"@vuepress/shared-utils" "^1.0.3"
"@vuepress/shared-utils" "^1.0.4"

"@vuepress/plugin-search@^1.0.3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@vuepress/plugin-search/-/plugin-search-1.0.3.tgz#f8cd98380cc00db067fb243e4fd298c6b8b7179a"
integrity sha512-CD4G6BrKtS6JS9DzPMbwwovanaKMhj/KN6Bv7P5oY5inWTl3lE9KOjzr1YUkoA6wL6f69EfdB5B7cdO2d47n/w==
"@vuepress/plugin-search@^1.0.4":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@vuepress/plugin-search/-/plugin-search-1.0.4.tgz#991a896cacb8f0bd6dc5789f8a2d93be32ae0abd"
integrity sha512-Jx+PDjkOiksX/E3fEQNbj2GP/g75giv8CoFl+9DyM3kxdDlUAC3N9Sd41SrYJ9lYlXG3ICEQAUyHYSjVvYKAuA==

"@vuepress/shared-utils@^1.0.3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@vuepress/shared-utils/-/shared-utils-1.0.3.tgz#224d2fc10fcf26d871eae8dd93b810616731123f"
integrity sha512-E9kh+nk+E0X6GTONXK1OWeY7Yyl/bUkWltmdh89f7hcSn2MxuBmlph4JdtZKrTK2m+9EqzpVR+CYanGjTA/ZQA==
"@vuepress/shared-utils@^1.0.4":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@vuepress/shared-utils/-/shared-utils-1.0.4.tgz#520c5a6ae263accd29efc8dfad727ad62052ded2"
integrity sha512-64Rlyb6HOhoeJDa6BbTGKVEgFqIJWdr6vO3o+wmAgKSvX7sqdT0Hs6ETjtt9jWSbjeQTjwP1XbXwKrpEY2jWKw==
dependencies:
chalk "^2.3.2"
diacritics "^1.3.0"
@@ -920,15 +920,16 @@
semver "^6.0.0"
upath "^1.1.0"

"@vuepress/theme-default@^1.0.3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@vuepress/theme-default/-/theme-default-1.0.3.tgz#a92025d9be1705ef7b95c53365a8ba3d917b6023"
integrity sha512-rS12CdMQwpSD7RI9XCM1gko13uPKhbVlbaxb7bd6ozjOQm4Iy1qAAyoZredRl1Sx29QvvcXZxLMGzAqx98GMCw==
"@vuepress/theme-default@^1.0.4":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@vuepress/theme-default/-/theme-default-1.0.4.tgz#a74fb0cf093ca8b78b4ef1157d2130505606e1d2"
integrity sha512-H6tZFgxIWYNnjLJVmcWBolWNy15c0keEY0ck2Lv3KkuzfkrABPbOuBLGcdG7vPAJBT+BDKpsJHoBpfGF7KwY1g==
dependencies:
"@vuepress/plugin-active-header-links" "^1.0.3"
"@vuepress/plugin-nprogress" "^1.0.3"
"@vuepress/plugin-search" "^1.0.3"
"@vuepress/plugin-active-header-links" "^1.0.4"
"@vuepress/plugin-nprogress" "^1.0.4"
"@vuepress/plugin-search" "^1.0.4"
docsearch.js "^2.5.2"
lodash "^4.17.15"
stylus "^0.54.5"
stylus-loader "^3.0.2"
vuepress-plugin-container "^2.0.0"
@@ -4180,7 +4181,7 @@ lodash.uniq@^4.5.0:
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=

lodash@^4.17.11, lodash@^4.17.3, lodash@^4.17.5:
lodash@^4.17.11, lodash@^4.17.15, lodash@^4.17.3, lodash@^4.17.5:
version "4.17.15"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
@@ -6999,13 +7000,13 @@ vuepress-plugin-container@^2.0.0:
dependencies:
markdown-it-container "^2.0.0"

vuepress@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/vuepress/-/vuepress-1.0.3.tgz#7c744061b5a3244ab86d49ac8d66417258509f13"
integrity sha512-+wCbyhZjaboY6VGBceai+JCdho96ZO9hVFHLnGGsj1/Zt2sKHrwWwV7lvbBO9y/IGib0YYpifpEJcpzvy3MDVg==
vuepress@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/vuepress/-/vuepress-1.0.4.tgz#0f02f67ff6dec02fa9c500c39dbe8c8203db87a0"
integrity sha512-QzJkRGGOv3+j7MNsjbCLGe5XaAl5fClndQa2woT8j6b+Cc7S1MOHNlITH6zDZ1eH7XETlNI3BmTZ/nJ2aoHyIw==
dependencies:
"@vuepress/core" "^1.0.3"
"@vuepress/theme-default" "^1.0.3"
"@vuepress/core" "^1.0.4"
"@vuepress/theme-default" "^1.0.4"
cac "^6.3.9"
envinfo "^7.2.0"
opencollective-postinstall "^2.0.2"
25 changes: 12 additions & 13 deletions lib/icon/module.js
Original file line number Diff line number Diff line change
@@ -4,15 +4,15 @@ const hasha = require('hasha')
const { fork } = require('child_process')
const { joinUrl, getRouteParams } = require('../utils')

module.exports = function (iconOptions) {
this.nuxt.hook('build:before', () => run.call(this, iconOptions, true))
module.exports = function (pwa) {
this.nuxt.hook('build:before', () => run.call(this, pwa, true))

if (this.options.mode === 'spa' && !this.options.dev) {
return run.call(this, iconOptions, false) // Fill meta
return run.call(this, pwa, false) // Fill meta
}
}

async function run (iconOptions, _emitAssets) {
async function run (pwa, _emitAssets) {
const { publicPath } = getRouteParams(this.options)

// Defaults
@@ -34,7 +34,7 @@ async function run (iconOptions, _emitAssets) {
// Merge options
const options = {
...defaults,
...iconOptions
...pwa.icon
}

// Find iconSrc
@@ -49,7 +49,7 @@ async function run (iconOptions, _emitAssets) {
await generateIcons.call(this, options)

// Add manifest
addManifest.call(this, options)
addManifest.call(this, options, pwa)

// Add plugin
if (options.accessibleIcons) {
@@ -117,16 +117,15 @@ async function generateIcons (options) {
}))
}

function addManifest (options) {
if (!this.options.manifest) {
this.options.manifest = {}
function addManifest (options, pwa) {
if (!pwa.manifest) {
pwa.manifest = {}
}

if (!this.options.manifest.icons) {
this.options.manifest.icons = []
if (!pwa.manifest.icons) {
pwa.manifest.icons = []
}

this.options.manifest.icons.push(...options._assetIcons)
pwa.manifest.icons.push(...options._assetIcons)
}

function emitAssets (options) {
8 changes: 4 additions & 4 deletions lib/manifest/module.js
Original file line number Diff line number Diff line change
@@ -2,9 +2,9 @@ const hash = require('hasha')

const { joinUrl, getRouteParams, find } = require('../utils')

module.exports = function nuxtManifest (manifestOptions) {
module.exports = function nuxtManifest (pwa) {
const hook = () => {
addManifest.call(this, manifestOptions)
addManifest.call(this, pwa)
}

if (this.options.mode === 'spa') {
@@ -14,7 +14,7 @@ module.exports = function nuxtManifest (manifestOptions) {
this.nuxt.hook('build:before', hook)
}

function addManifest (manifestOptions) {
function addManifest (pwa) {
const { routerBase, publicPath } = getRouteParams(this.options)

// Combine sources
@@ -31,7 +31,7 @@ function addManifest (manifestOptions) {
lang: 'en'
}

const options = { ...defaults, ...manifestOptions }
const options = { ...defaults, ...pwa.manifest }

// Remve extra fields from manifest
const manifest = { ...options }
8 changes: 4 additions & 4 deletions lib/meta/module.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const { find, isUrl } = require('../utils')

module.exports = function nuxtMeta (metaOptions) {
module.exports = function nuxtMeta (pwa) {
const hook = () => {
generateMeta.call(this, metaOptions)
generateMeta.call(this, pwa)
}

if (this.options.mode === 'spa') {
@@ -12,7 +12,7 @@ module.exports = function nuxtMeta (metaOptions) {
this.nuxt.hook('build:before', hook)
}

function generateMeta (metaOptions) {
function generateMeta (pwa) {
// Defaults
const defaults = {
name: process.env.npm_package_name,
@@ -40,7 +40,7 @@ function generateMeta (metaOptions) {
}

// Combine sources
const options = { ...defaults, ...this.options.manifest, ...metaOptions }
const options = { ...defaults, ...pwa.manifest, ...pwa.meta }

// Default value for viewport
if (options.viewport === undefined) {
27 changes: 22 additions & 5 deletions lib/module.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
module.exports = async function nuxtPWA (options) {
module.exports = async function nuxtPWA (moduleOptions) {
const modules = ['icon', 'manifest', 'meta', 'workbox']

const pwaOptions = { ...this.options.pwa, ...options }
// Shared options context
const pwa = { ...this.options.pwa, ...moduleOptions }

// Normalize options
for (const name of modules) {
if (pwaOptions[name] === false || this.options[name] === false) {
// Skip disabled modules
if (pwa[name] === false) {
continue
}
// Ensure options are an object
if (pwa[name] === undefined) {
pwa[name] = {}
}
// Backward compatibility for top-level options
if (this.options[name] !== undefined) {
pwa[name] = { ...this.options[name], ...pwa[name] }
}
}

// Execute modules in sequence
for (const name of modules) {
if (pwa[name] === false) {
continue
}
const moduleFn = require(`./${name}/module.js`)
const moduleOptions = { ...this.options[name], ...pwaOptions[name] }
await moduleFn.call(this, moduleOptions)
await moduleFn.call(this, pwa)
}
}

2 changes: 1 addition & 1 deletion lib/onesignal/module.js
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ function addOneSignal (oneSignalOptions) {
}
}

const options = defu(oneSignalOptions, defaults)
const options = defu({ ...this.options.oneSignal, ...oneSignalOptions }, defaults)

if (options.OneSignalSDK === undefined) {
if (options.cdn) {
Loading