diff --git a/ghost/admin/ember-cli-build.js b/ghost/admin/ember-cli-build.js index cda297f428..95fa20e8d7 100644 --- a/ghost/admin/ember-cli-build.js +++ b/ghost/admin/ember-cli-build.js @@ -68,6 +68,14 @@ module.exports = function (defaults) { optional: ['es6.spec.symbols'], includePolyfill: true }, + 'ember-service-worker': { + rootUrl: '/ghost/' + }, + 'esw-cache-fallback': { + patterns: [ + '/ghost/api/(.+)' + ], + }, outputPaths: { app: { js: assetLocation('ghost.js') diff --git a/ghost/admin/lib/asset-delivery/index.js b/ghost/admin/lib/asset-delivery/index.js index b949f8a414..5ff966ce34 100644 --- a/ghost/admin/lib/asset-delivery/index.js +++ b/ghost/admin/lib/asset-delivery/index.js @@ -18,5 +18,9 @@ module.exports = { fs.copySync(assetsIn + '/' + relativePath, assetsOut + '/' + relativePath, {overwrite: true}); }); + + // Copy service workers + fs.copySync(results.directory + '/sw-registration.js', assetsOut + '/sw-registration.js'); + fs.copySync(results.directory + '/sw.js', assetsOut + '/sw.js'); } }; diff --git a/ghost/admin/package.json b/ghost/admin/package.json index b14249f852..475da36069 100644 --- a/ghost/admin/package.json +++ b/ghost/admin/package.json @@ -78,6 +78,10 @@ "ember-sinon": "0.6.0", "ember-sortable": "1.9.1", "ember-source": "2.11.0", + "ember-service-worker": "0.6.1", + "ember-service-worker-cache-fallback": "0.6.0", + "ember-service-worker-ghost-cache": "0.1.2", + "ember-service-worker-index": "0.6.1", "ember-test-selectors": "0.2.1", "ember-truth-helpers": "1.3.0", "ember-wormhole": "0.5.1", diff --git a/ghost/admin/yarn.lock b/ghost/admin/yarn.lock index cb4fb32904..3fe9563cf6 100644 --- a/ghost/admin/yarn.lock +++ b/ghost/admin/yarn.lock @@ -80,14 +80,14 @@ ansi-escapes@^1.1.0: version "1.4.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" -ansi-regex@*, ansi-regex@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" - ansi-regex@^0.2.0, ansi-regex@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-0.2.1.tgz#0d8e946967a3d8143f93e24e298525fc1b2235f9" +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + ansi-styles@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-1.1.0.tgz#eaecbf66cd706882760b2f4691582b8f55d7a7de" @@ -225,10 +225,6 @@ ast-types@0.8.12: version "0.8.12" resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.8.12.tgz#a0d90e4351bb887716c83fd637ebf818af4adfcc" -ast-types@0.8.15: - version "0.8.15" - resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.8.15.tgz#8eef0827f04dff0ec8857ba925abe3fea6194e52" - ast-types@0.9.4: version "0.9.4" resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.4.tgz#410d1f81890aeb8e0a38621558ba5869ae53c91b" @@ -723,7 +719,7 @@ broccoli-config-replace@^1.1.2: debug "^2.2.0" fs-extra "^0.24.0" -broccoli-file-creator@^1.0.0, broccoli-file-creator@^1.1.1: +broccoli-file-creator@^1.0.0, broccoli-file-creator@^1.1.0, broccoli-file-creator@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/broccoli-file-creator/-/broccoli-file-creator-1.1.1.tgz#1b35b67d215abdfadd8d49eeb69493c39e6c3450" dependencies: @@ -782,7 +778,7 @@ broccoli-funnel@1.0.2: symlink-or-copy "^1.0.0" walk-sync "^0.2.6" -broccoli-funnel@^1.0.0, broccoli-funnel@^1.0.1, broccoli-funnel@^1.0.2, broccoli-funnel@^1.0.6, broccoli-funnel@^1.0.7, broccoli-funnel@^1.0.9, broccoli-funnel@^1.1.0: +broccoli-funnel@^1.0.0, broccoli-funnel@^1.0.1, broccoli-funnel@^1.0.2, broccoli-funnel@^1.0.3, broccoli-funnel@^1.0.6, broccoli-funnel@^1.0.7, broccoli-funnel@^1.0.9, broccoli-funnel@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/broccoli-funnel/-/broccoli-funnel-1.1.0.tgz#dfb91a37c902456456de4a40a1881948d65b27d9" dependencies: @@ -894,6 +890,13 @@ broccoli-plugin@^1.0.0, broccoli-plugin@^1.1.0, broccoli-plugin@^1.2.0, broccoli rimraf "^2.3.4" symlink-or-copy "^1.1.8" +broccoli-rollup@0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/broccoli-rollup/-/broccoli-rollup-0.0.4.tgz#d23b2ef8fbd80e85dbb47d350fdab72902cd17c4" + dependencies: + broccoli-caching-writer "^2.2.0" + rollup "^0.26.2" + broccoli-rollup@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/broccoli-rollup/-/broccoli-rollup-1.0.3.tgz#24aa5a4adb7989ad53667214ed0531ce3bf2ce9d" @@ -976,7 +979,7 @@ broccoli-uglify-js@0.2.0: broccoli-filter "^0.1.6" uglify-js "~2.6.2" -broccoli-uglify-sourcemap@^1.0.0: +broccoli-uglify-sourcemap@^1.0.0, broccoli-uglify-sourcemap@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/broccoli-uglify-sourcemap/-/broccoli-uglify-sourcemap-1.5.1.tgz#9fd2e87f1c177b11a758e73c3a11d6a03d90d086" dependencies: @@ -1332,7 +1335,7 @@ commander@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.0.0.tgz#d1b86f901f8b64bd941bdeadaf924530393be928" -commander@2.3.0, commander@^2.1.0: +commander@2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.3.0.tgz#fd430e889832ec353b9acd1de217c11cb3eef873" @@ -1342,7 +1345,7 @@ commander@2.8.x: dependencies: graceful-readlink ">= 1.0.0" -commander@^2.5.0, commander@^2.6.0, commander@^2.9.0: +commander@^2.1.0, commander@^2.5.0, commander@^2.6.0, commander@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" dependencies: @@ -1628,7 +1631,7 @@ debug@~0.7.4: version "0.7.4" resolved "https://registry.yarnpkg.com/debug/-/debug-0.7.4.tgz#06e1ea8082c2cb14e39806e22e2f6f757f92af39" -debuglog@*, debuglog@^1.0.1: +debuglog@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" @@ -2491,6 +2494,47 @@ ember-scrollable@^0.4.0: ember-element-resize-detector "0.1.5" ember-lifeline "1.0.0" +ember-service-worker-cache-fallback@0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/ember-service-worker-cache-fallback/-/ember-service-worker-cache-fallback-0.6.0.tgz#e5ff46c651ed4c1ec995231a74392387cdaeb089" + dependencies: + broccoli-merge-trees "^1.2.1" + broccoli-plugin "^1.3.0" + +ember-service-worker-ghost-cache@0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/ember-service-worker-ghost-cache/-/ember-service-worker-ghost-cache-0.1.2.tgz#5ff538a08f160706b6ad50d582b55afcadbe2ea5" + dependencies: + broccoli-filter "^1.2.3" + broccoli-plugin "^1.3.0" + ember-cli-babel "^5.1.6" + glob "^7.1.1" + +ember-service-worker-index@0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/ember-service-worker-index/-/ember-service-worker-index-0.6.1.tgz#af232e4c66d4c2eb53870951ef00d8cdf3470198" + dependencies: + broccoli-merge-trees "^1.2.1" + broccoli-plugin "^1.3.0" + +ember-service-worker@0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/ember-service-worker/-/ember-service-worker-0.6.1.tgz#38ff1f61967ab68a84e297766dbcb282d551ff8f" + dependencies: + broccoli-babel-transpiler "^5.5.0" + broccoli-file-creator "^1.1.0" + broccoli-funnel "^1.0.3" + broccoli-merge-trees "1.1.1" + broccoli-plugin "^1.3.0" + broccoli-rollup "0.0.4" + broccoli-uglify-sourcemap "^1.5.1" + clone "^1.0.2" + ember-cli-babel "^5.1.6" + exists-sync "0.0.3" + glob "^7.1.1" + hash-for-dep "^1.0.2" + rollup-plugin-replace "^1.1.1" + ember-simple-auth@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/ember-simple-auth/-/ember-simple-auth-1.2.0.tgz#6275c1580ab17aad303d51723515f3b933fb4635" @@ -3421,7 +3465,7 @@ glob@3.2.8: inherits "2" minimatch "~0.2.11" -glob@7.1.1, glob@^7.0.0, glob@^7.0.3, glob@^7.0.4, glob@^7.0.5, glob@~7.1.1: +glob@7.1.1, glob@^7.0.0, glob@^7.0.3, glob@^7.0.4, glob@^7.0.5, glob@^7.1.1, glob@~7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" dependencies: @@ -3725,11 +3769,7 @@ hooker@~0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/hooker/-/hooker-0.2.3.tgz#b834f723cc4a242aa65963459df6d984c5d3d959" -hosted-git-info@^2.1.4, hosted-git-info@^2.1.5: - version "2.2.0" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.2.0.tgz#7a0d097863d886c0fabbdcd37bf1758d8becf8a5" - -hosted-git-info@~2.1.5: +hosted-git-info@^2.1.4, hosted-git-info@^2.1.5, hosted-git-info@~2.1.5: version "2.1.5" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.1.5.tgz#0ba81d90da2e25ab34a332e6ec77936e1598118b" @@ -3768,7 +3808,7 @@ ignore@^3.2.0: version "3.2.2" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.2.2.tgz#1c51e1ef53bab6ddc15db4d9ac4ec139eceb3410" -imurmurhash@*, imurmurhash@^0.1.4: +imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" @@ -4350,10 +4390,6 @@ lodash._basefor@^3.0.0: version "3.0.3" resolved "https://registry.yarnpkg.com/lodash._basefor/-/lodash._basefor-3.0.3.tgz#7550b4e9218ef09fad24343b612021c79b4c20c2" -lodash._baseindexof@*: - version "3.1.0" - resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c" - lodash._basetostring@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/lodash._basetostring/-/lodash._basetostring-3.0.1.tgz#d1861d877f824a52f669832dcaf3ee15566a07d5" @@ -4369,14 +4405,10 @@ lodash._basevalues@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/lodash._basevalues/-/lodash._basevalues-3.0.0.tgz#5b775762802bde3d3297503e26300820fdf661b7" -lodash._bindcallback@*, lodash._bindcallback@^3.0.0: +lodash._bindcallback@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e" -lodash._cacheindexof@*: - version "3.0.2" - resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92" - lodash._createassigner@^3.0.0: version "3.1.1" resolved "https://registry.yarnpkg.com/lodash._createassigner/-/lodash._createassigner-3.1.1.tgz#838a5bae2fdaca63ac22dee8e19fa4e6d6970b11" @@ -4385,17 +4417,11 @@ lodash._createassigner@^3.0.0: lodash._isiterateecall "^3.0.0" lodash.restparam "^3.0.0" -lodash._createcache@*: - version "3.1.2" - resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093" - dependencies: - lodash._getnative "^3.0.0" - lodash._createset@~4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26" -lodash._getnative@*, lodash._getnative@^3.0.0: +lodash._getnative@^3.0.0: version "3.9.1" resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" @@ -4527,7 +4553,7 @@ lodash.omit@^4.1.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.omit/-/lodash.omit-4.5.0.tgz#6eb19ae5a1ee1dd9df0b969e66ce0b7fa30b5e60" -lodash.restparam@*, lodash.restparam@^3.0.0: +lodash.restparam@^3.0.0: version "3.6.1" resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805" @@ -4630,6 +4656,12 @@ lru-cache@^4.0.0, lru-cache@^4.0.1: pseudomap "^1.0.1" yallist "^2.0.0" +magic-string@^0.15.2: + version "0.15.2" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.15.2.tgz#0681d7388741bbc3addaa65060992624c6c09e9c" + dependencies: + vlq "^0.2.1" + magic-string@^0.16.0: version "0.16.0" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.16.0.tgz#970ebb0da7193301285fb1aa650f39bdd81eb45a" @@ -4822,7 +4854,7 @@ minimist@0.0.8, minimist@~0.0.1: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" -minimist@1.2.0, minimist@^1.1.0, minimist@^1.1.1, minimist@^1.1.3: +minimist@1.2.0, minimist@^1.1.0, minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" @@ -5657,9 +5689,9 @@ read@1, read@~1.0.1, read@~1.0.7: dependencies: mute-stream "~0.0.4" -"readable-stream@1 || 2", "readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.2, readable-stream@^2.2.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.2.tgz#a9e6fec3c7dda85f8bb1b3ba7028604556fc825e" +"readable-stream@1 || 2", readable-stream@^2, readable-stream@^2.0.2, readable-stream@~2.1.5: + version "2.1.5" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.1.5.tgz#66fa8b720e1438b364681f2ad1a63c618448c9d0" dependencies: buffer-shims "^1.0.0" core-util-is "~1.0.0" @@ -5669,9 +5701,9 @@ read@1, read@~1.0.1, read@~1.0.7: string_decoder "~0.10.x" util-deprecate "~1.0.1" -readable-stream@^2, readable-stream@~2.1.5: - version "2.1.5" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.1.5.tgz#66fa8b720e1438b364681f2ad1a63c618448c9d0" +"readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.2.tgz#a9e6fec3c7dda85f8bb1b3ba7028604556fc825e" dependencies: buffer-shims "^1.0.0" core-util-is "~1.0.0" @@ -5701,7 +5733,7 @@ readable-stream@~2.0.5: string_decoder "~0.10.x" util-deprecate "~1.0.1" -readdir-scoped-modules@*, readdir-scoped-modules@^1.0.0: +readdir-scoped-modules@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.0.2.tgz#9fafa37d286be5d92cbaebdee030dc9b5f406747" dependencies: @@ -5725,7 +5757,7 @@ realize-package-specifier@~3.0.3: dezalgo "^1.0.1" npm-package-arg "^4.1.1" -recast@0.10.33: +recast@0.10.33, recast@^0.10.10: version "0.10.33" resolved "https://registry.yarnpkg.com/recast/-/recast-0.10.33.tgz#942808f7aa016f1fa7142c461d7e5704aaa8d697" dependencies: @@ -5734,15 +5766,6 @@ recast@0.10.33: private "~0.1.5" source-map "~0.5.0" -recast@^0.10.10: - version "0.10.43" - resolved "https://registry.yarnpkg.com/recast/-/recast-0.10.43.tgz#b95d50f6d60761a5f6252e15d80678168491ce7f" - dependencies: - ast-types "0.8.15" - esprima-fb "~15001.1001.0-dev-harmony-fb" - private "~0.1.5" - source-map "~0.5.0" - recast@^0.11.17, recast@^0.11.3: version "0.11.20" resolved "https://registry.yarnpkg.com/recast/-/recast-0.11.20.tgz#2cb9bec269c03b36d0598118a936cd0a293ca3f3" @@ -6051,13 +6074,29 @@ rollup-plugin-node-resolve@^2.0.0: builtin-modules "^1.1.0" resolve "^1.1.6" -rollup-pluginutils@^1.5.1: +rollup-plugin-replace@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/rollup-plugin-replace/-/rollup-plugin-replace-1.1.1.tgz#396315ded050a6ce43b9518a886a3f60efb1ea33" + dependencies: + magic-string "^0.15.2" + minimatch "^3.0.2" + rollup-pluginutils "^1.5.0" + +rollup-pluginutils@^1.5.0, rollup-pluginutils@^1.5.1: version "1.5.2" resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz#1e156e778f94b7255bfa1b3d0178be8f5c552408" dependencies: estree-walker "^0.2.1" minimatch "^3.0.2" +rollup@^0.26.2: + version "0.26.7" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.26.7.tgz#12875bc83a0ee8ddcf4b3bcf30f2b77d60652dd7" + dependencies: + chalk "^1.1.1" + minimist "^1.2.0" + source-map-support "^0.4.0" + rollup@^0.34.11: version "0.34.13" resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.34.13.tgz#a211cdde31f96cb39e7cb4e35becb15ddc3efa19" @@ -6883,7 +6922,7 @@ uuid@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" -validate-npm-package-license@*, validate-npm-package-license@^3.0.1: +validate-npm-package-license@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz#2804babe712ad3379459acfbe24746ab2c303fbc" dependencies: