Retooling: remove monorepo + replace gatsby with vuepress (#384)

* moving off of monorepo and gatsby

* update yarn.lock

* reorder

* release docs fix

* adding gh-pages
This commit is contained in:
Kenneth Chau 2020-08-21 10:18:14 -07:00 коммит произвёл GitHub
Родитель 79ebb41a51
Коммит 8d4bebd390
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
299 изменённых файлов: 2572 добавлений и 25158 удалений

27
.github/workflows/pr.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,27 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: PR
on:
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn
- run: yarn build
- run: yarn checkchange
- run: yarn test

35
.github/workflows/release.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,35 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Release
on:
workflow_dispatch:
push:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.repo_pat }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn
- run: yarn build
- run: yarn test
- run: |
git config user.email "kchau@microsoft.com"
git config user.name "Ken Chau"
- run: yarn release -y -n $NPM_AUTHTOKEN
env:
NPM_AUTHTOKEN: ${{ secrets.npm_authtoken }}

68
.gitignore поставляемый
Просмотреть файл

@ -1,72 +1,6 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.docz
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
dist
node_modules/
jspm_packages/
# Typescript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# dotenv environment variables file
.env
# gatsby files
.cache/
public
# Mac files
.DS_Store
# Yarn
yarn-error.log
.pnp/
.pnp.js
# Yarn Integrity file
.yarn-integrity
lib/

Просмотреть файл

@ -2,5 +2,5 @@
"trailingComma": "es5",
"tabWidth": 2,
"singleQuote": true,
"printWidth": 120
"printWidth": 100
}

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -1,36 +0,0 @@
# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
pr: none
trigger:
- master
pool:
vmImage: 'Ubuntu-16.04'
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- script: |
git config user.email "kchau@microsoft.com"
git config user.name "kchau@microsoft.com"
git remote set-url origin https://$(github.user):$(github.pat)@github.com/microsoft/beachball.git
displayName: 'git config'
- script: |
yarn
displayName: 'yarn'
- script: |
yarn build
displayName: 'build'
- script: |
yarn test
displayName: 'test'
- script: |
yarn pub -n $(npm.authtoken) -y
displayName: 'beachball publish'

Просмотреть файл

@ -1,29 +0,0 @@
trigger: none
pr:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- script: |
yarn
displayName: 'yarn'
- script: |
yarn build
displayName: 'yarn build'
- script: |
yarn test
displayName: 'yarn test'
- script: |
yarn checkchange
displayName: 'yarn checkchange'

3
beachball.config.js Normal file
Просмотреть файл

@ -0,0 +1,3 @@
module.exports = {
disallowedChangeTypes: ['major'],
};

Просмотреть файл

53
docs/.vuepress/config.js Normal file
Просмотреть файл

@ -0,0 +1,53 @@
module.exports = {
title: 'beachball',
description: 'The Sunniest Semantic Version Bumper',
base: '/beachball/',
themeConfig: {
nav: [
{ text: 'Home', link: '/' },
{ text: 'Getting Started', link: '/overview/getting-started' },
{ text: 'Github', link: 'https://github.com/microsoft/beachball' },
],
sidebar: [
{
title: 'Overview',
collapsable: false, // optional, defaults to true
sidebarDepth: 1, // optional, defaults to 1
children: [
'/overview/installation',
'/overview/getting-started',
'/overview/configuration',
],
},
{
title: 'Concepts', // required
collapsable: false, // optional, defaults to true
sidebarDepth: 1, // optional, defaults to 1
children: [
'/concepts/bump-algorithm',
'/concepts/change-files',
'/concepts/ci-integration',
'/concepts/groups',
],
},
{
title: 'Command Line Args', // required
collapsable: false, // optional, defaults to true
sidebarDepth: 1, // optional, defaults to 1
children: ['/cli/bump', '/cli/change', '/cli/check', '/cli/options', '/cli/publish'],
},
],
},
plugins: [
[
'mermaidjs',
{
gantt: {
barHeight: 20,
fontSize: 12,
useWidth: 960,
},
},
],
],
};

Просмотреть файл

@ -0,0 +1 @@
Keep

Просмотреть файл

@ -0,0 +1,2 @@
$contentWidth ?= 960px
$accentColor = darken(rgb(246, 224, 94), 30%)

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

23
docs/README.md Normal file
Просмотреть файл

@ -0,0 +1,23 @@
---
home: true
# heroImage: /hero.png
heroText: The Sunniest Semantic Version Bumper
tagline: Run all your npm scripts in topological order incrementally with cloud cache
actionText: Get Started →
actionLink: /overview/getting-started
features:
- title: Synchronized in git and npm
details: 'keep your git and npm versions in sync in CI and local workflows'
- title: Generates Changelogs
details: same command will generate changelogs for your users
- title: Automated Version Bumps
details: one command line to bump package(s) in your repo with semver
- title: Single or Monorepo
details: compatible out of the box for single repo or monorepos
- title: Pre-Publish Validation Checks
details: double and triple check git repo and npm registry before publish
- title: Zero Config Versioning
details: no config is required to get started, do more in one line
footer: MIT Licensed | Copyright © 2019-present Microsoft
---

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -1 +0,0 @@
{"app":["/app-e36445c3b269123ee357.js"],"component---node-modules-gatsby-plugin-offline-app-shell-js":["/component---node-modules-gatsby-plugin-offline-app-shell-js-cab98a124892315be993.js"],"component---src-templates-doc-jsx":["/component---src-templates-doc-jsx-d425e0c3654169ba3adc.js"],"component---src-pages-index-jsx":["/component---src-pages-index-jsx-fdf0f24c4c7f32a006b9.js"],"component---src-pages-404-jsx":["/component---src-pages-404-jsx-859fbd58d1cf149245b5.js"]}

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -1,2 +0,0 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[3],{JLXE:function(e,t,n){"use strict";var u=n("IGGJ");t.__esModule=!0,t.default=void 0;var o=u(n("W/Kd")),r=u(n("ERkP")),a=function(e){function t(){return e.apply(this,arguments)||this}return(0,o.default)(t,e),t.prototype.render=function(){return r.default.createElement(r.default.Fragment,null)},t}(r.default.Component);t.default=a}}]);
//# sourceMappingURL=component---node-modules-gatsby-plugin-offline-app-shell-js-cab98a124892315be993.js.map

Просмотреть файл

@ -1 +0,0 @@
{"version":3,"sources":["webpack:////Users/ken/workspace/beachball/node_modules/gatsby-plugin-offline/app-shell.js"],"names":["_interopRequireDefault","require","exports","__esModule","default","_inheritsLoose2","_react","_default","_React$Component","AppShell","apply","this","arguments","prototype","render","createElement","Fragment","Component"],"mappings":"2FAEA,IAAIA,EAAyBC,EAAQ,QAErCC,EAAQC,YAAa,EACrBD,EAAQE,aAAU,EAElB,IAAIC,EAAkBL,EAAuBC,EAAQ,SAEjDK,EAASN,EAAuBC,EAAQ,SAoBxCM,EAhBJ,SAAUC,GAGR,SAASC,IACP,OAAOD,EAAiBE,MAAMC,KAAMC,YAAcD,KASpD,OAZA,EAAIN,EAAgBD,SAASK,EAAUD,GAM1BC,EAASI,UAEfC,OAAS,WACd,OAAOR,EAAOF,QAAQW,cAAcT,EAAOF,QAAQY,SAAU,OAGxDP,EAbT,CAcEH,EAAOF,QAAQa,WAGjBf,EAAQE,QAAUG","file":"component---node-modules-gatsby-plugin-offline-app-shell-js-cab98a124892315be993.js","sourcesContent":["\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nexports.__esModule = true;\nexports.default = void 0;\n\nvar _inheritsLoose2 = _interopRequireDefault(require(\"@babel/runtime/helpers/inheritsLoose\"));\n\nvar _react = _interopRequireDefault(require(\"react\"));\n\nvar AppShell =\n/*#__PURE__*/\nfunction (_React$Component) {\n (0, _inheritsLoose2.default)(AppShell, _React$Component);\n\n function AppShell() {\n return _React$Component.apply(this, arguments) || this;\n }\n\n var _proto = AppShell.prototype;\n\n _proto.render = function render() {\n return _react.default.createElement(_react.default.Fragment, null);\n };\n\n return AppShell;\n}(_react.default.Component);\n\nvar _default = AppShell;\nexports.default = _default;"],"sourceRoot":""}

Просмотреть файл

@ -1,2 +0,0 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{pssB:function(n,e,o){"use strict";o.r(e);var t=o("ERkP"),u=o.n(t);e.default=function(){return u.a.createElement("div",null,"no found page eh")}}}]);
//# sourceMappingURL=component---src-pages-404-jsx-859fbd58d1cf149245b5.js.map

Просмотреть файл

@ -1 +0,0 @@
{"version":3,"sources":["webpack:///./src/pages/404.jsx"],"names":[],"mappings":"2FAAA,gCAEe,qBACb,OAAO","file":"component---src-pages-404-jsx-859fbd58d1cf149245b5.js","sourcesContent":["import React from 'react'\n\nexport default () => {\n return <div>no found page eh</div>\n}\n"],"sourceRoot":""}

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

18
docs/guide/README.md Normal file
Просмотреть файл

@ -0,0 +1,18 @@
---
title: Introducing Lage
---
## Overview
Your JS repo has gotten large enough that you have turned to using a tool to help you manage multiple packages inside a repository. That's great! However, you realized quickly that the tasks defined inside the workspace have to be run in package dependency order.
Lerna, Rush, wsrun and even pnpm will provide a simple way for you to run npm scripts to be run in a topological order. However, these tools will force you to run your tasks by script name one at a time. For example, all the `build` scripts will have to run first. Then all the `test` scripts run in the topological order.
This usually means that there are wasted CPU cycles in between `build` and `test`. We can achieve better pipelining the npm scripts if we had a way to say that `test` can run as soon as `build` are done for the package.
`lage` (Norwegian for "make", pronounced law-geh) solves this by providing a terse pipelining syntax. It has features specifically address large monorepos with high number of packages:
- package and task scopes
- output caching
- sound scheduling with package task pipeline
- prioritization

1
docs/idb-keyval-iife.min.js поставляемый
Просмотреть файл

@ -1 +0,0 @@
var idbKeyval=function(e){"use strict";class t{constructor(e="keyval-store",t="keyval"){this.storeName=t,this._dbp=new Promise((r,n)=>{const o=indexedDB.open(e,1);o.onerror=(()=>n(o.error)),o.onsuccess=(()=>r(o.result)),o.onupgradeneeded=(()=>{o.result.createObjectStore(t)})})}_withIDBStore(e,t){return this._dbp.then(r=>new Promise((n,o)=>{const s=r.transaction(this.storeName,e);s.oncomplete=(()=>n()),s.onabort=s.onerror=(()=>o(s.error)),t(s.objectStore(this.storeName))}))}}let r;function n(){return r||(r=new t),r}return e.Store=t,e.get=function(e,t=n()){let r;return t._withIDBStore("readonly",t=>{r=t.get(e)}).then(()=>r.result)},e.set=function(e,t,r=n()){return r._withIDBStore("readwrite",r=>{r.put(t,e)})},e.del=function(e,t=n()){return t._withIDBStore("readwrite",t=>{t.delete(e)})},e.clear=function(e=n()){return e._withIDBStore("readwrite",e=>{e.clear()})},e.keys=function(e=n()){const t=[];return e._withIDBStore("readonly",e=>{(e.openKeyCursor||e.openCursor).call(e).onsuccess=function(){this.result&&(t.push(this.result.key),this.result.continue())}}).then(()=>t)},e}({});

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 23 KiB

После

Ширина:  |  Высота:  |  Размер: 23 KiB

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Двоичные данные
docs/logos/logo-1024.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 57 KiB

Двоичные данные
docs/logos/logo-48.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 16 KiB

Просмотреть файл

@ -1 +0,0 @@
{"name":"Beachball","short_name":"Beachball","description":"The Sunniest Semantic Version Bumper","start_url":"/beachball","background_color":"#e0e0e0","theme_color":"#c62828","display":"minimal-ui","icons":[{"src":"/logos/logo-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/logos/logo-512x512.png","sizes":"512x512","type":"image/png"}]}

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -1 +0,0 @@
{"componentChunkName":"component---src-pages-404-jsx","path":"/404.html","result":{"pageContext":{}}}

Просмотреть файл

@ -1 +0,0 @@
{"componentChunkName":"component---src-pages-404-jsx","path":"/404","result":{"pageContext":{}}}

Просмотреть файл

@ -1 +0,0 @@
{"webpackCompilationHash":"13eda2d1bbd99cec7159"}

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -1 +0,0 @@
{"componentChunkName":"component---src-templates-doc-jsx","path":"/bump","result":{"data":{"postBySlug":{"html":"<p>Bumps versions locally without publishing to the remote git repo or npm registry. This command will also generate changelogs.</p>\n<p>This is the same logic that is used by the publish command, so it is a good practice to bump things locally to see what kind of changes are going to be done before those changes are published to the npm registry and the remote git repo. Since this affects files locally only, it is up to you to synchronize the package versions in the remote git repo as well as the npm registry.</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\">$ beachball bump</code></pre></div>","frontmatter":{"title":"bump"}},"tableOfContents":{"chapters":[{"title":"Overview","entries":[{"entry":{"id":"aa948e6b-0177-51ab-877c-de4df9879e2e","childMarkdownRemark":{"fields":{"slug":"/getting-started"},"frontmatter":{"title":"Getting Started"}}}},{"entry":{"id":"ccfd1734-230c-5de7-8188-b9c9f36c34e9","childMarkdownRemark":{"fields":{"slug":"/installation"},"frontmatter":{"title":"Installation"}}}},{"entry":{"id":"dcf24505-af9a-589d-a9fb-bc1619ff7e0e","childMarkdownRemark":{"fields":{"slug":"/configuration"},"frontmatter":{"title":"Configuration"}}}}]},{"title":"Concepts","entries":[{"entry":{"id":"9907d23d-40b1-5bcc-9fb8-e9b64c786230","childMarkdownRemark":{"fields":{"slug":"/change-files"},"frontmatter":{"title":"Change Files"}}}},{"entry":{"id":"545adc82-8077-53ed-b68d-27b25b2cd19f","childMarkdownRemark":{"fields":{"slug":"/ci-integration"},"frontmatter":{"title":"CI Integration"}}}},{"entry":{"id":"9faba470-79f3-5934-8e09-893c1e795f82","childMarkdownRemark":{"fields":{"slug":"/bump-algorithm"},"frontmatter":{"title":"Bump Algorithm"}}}},{"entry":{"id":"25893094-f9c2-5375-aaf8-24e6db23f765","childMarkdownRemark":{"fields":{"slug":"/version-groups"},"frontmatter":{"title":"Version Groups"}}}}]},{"title":"CLI Reference","entries":[{"entry":{"id":"d331b943-d44c-57ee-b77c-45d0ac5a7a0d","childMarkdownRemark":{"fields":{"slug":"/change"},"frontmatter":{"title":"change"}}}},{"entry":{"id":"25b6911e-bac6-5692-80eb-8c70d1863000","childMarkdownRemark":{"fields":{"slug":"/check"},"frontmatter":{"title":"check"}}}},{"entry":{"id":"e9d2f246-5b07-5abe-92a6-d65c4c4e8ac4","childMarkdownRemark":{"fields":{"slug":"/bump"},"frontmatter":{"title":"bump"}}}},{"entry":{"id":"22b3b9a8-e74d-5bdf-83ad-d25cfbe60715","childMarkdownRemark":{"fields":{"slug":"/publish"},"frontmatter":{"title":"publish"}}}},{"entry":{"id":"55c11620-e2b0-538d-b36d-f5897681b65a","childMarkdownRemark":{"fields":{"slug":"/options"},"frontmatter":{"title":"options"}}}}]}]}},"pageContext":{"slug":"/bump"}}}

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -1 +0,0 @@
{"componentChunkName":"component---src-pages-index-jsx","path":"/","result":{"data":{"allMarkdown":{"edges":[{"node":{"fields":{"slug":"/bump"},"excerpt":"Bumps versions locally without publishing to the remote git repo or npm registry. This command will also generate changelogs. This is the…","frontmatter":{"title":"bump"}}},{"node":{"fields":{"slug":"/bump-algorithm"},"excerpt":"Bumping a single package is a simple task of just looking up a change file for its change type and using semver to bump the version…","frontmatter":{"title":"Bump Algorithm"}}},{"node":{"fields":{"slug":"/change"},"excerpt":"This command walks you through a couple of questions and will generate the appropriate change file in the directory. The generated file…","frontmatter":{"title":"change"}}},{"node":{"fields":{"slug":"/change-files"},"excerpt":"There are very popular and excellent packages available which manage package versioning already. Beachball works differently: does _not…","frontmatter":{"title":"Change Files"}}},{"node":{"fields":{"slug":"/check"},"excerpt":"It is useful to enforce that change files are checked in for each PR before they enter the target branch. In this way, all changes are…","frontmatter":{"title":"check"}}},{"node":{"fields":{"slug":"/ci-integration"},"excerpt":"For the repository and package owners who want to automate the bumping of versions based on change files with , you'll need to provide some…","frontmatter":{"title":"CI Integration"}}},{"node":{"fields":{"slug":"/configuration"},"excerpt":"For most uses you probably do not need any specific configuration on each package within your repository. But there are a couple of options…","frontmatter":{"title":"Configuration"}}},{"node":{"fields":{"slug":"/getting-started"},"excerpt":"Javascript ecosystem moves fast. It moves so fast that sometimes the tools need to catch up to it. One of the reasons that this particular…","frontmatter":{"title":"Getting Started"}}},{"node":{"fields":{"slug":"/installation"},"excerpt":"There are two options to install . Option 1: no install Thanks to , you can use without any installation: Option 2: Install and Run as NPM…","frontmatter":{"title":"Installation"}}},{"node":{"fields":{"slug":"/options"},"excerpt":"This is a listing of all the options available. Not every option applies to all the commands. All Beachball CLI Options registry, defaults…","frontmatter":{"title":"options"}}},{"node":{"fields":{"slug":"/publish"},"excerpt":"Publishing automates all the bumping and synchronizing of package versions in git remotes as well as the npm registry. The steps taken by…","frontmatter":{"title":"publish"}}},{"node":{"fields":{"slug":"/version-groups"},"excerpt":"By default, all packages in the repository are versioned based solely on the changes as specified by the change files. Developers are…","frontmatter":{"title":"Version Groups"}}}]}},"pageContext":{}}}

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -1 +0,0 @@
{"componentChunkName":"component---node-modules-gatsby-plugin-offline-app-shell-js","path":"/offline-plugin-app-shell-fallback","result":{"pageContext":{}}}

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -1 +0,0 @@
{"componentChunkName":"component---src-templates-doc-jsx","path":"/publish","result":{"data":{"postBySlug":{"html":"<p>Publishing automates all the bumping and synchronizing of package versions in git remotes as well as the npm registry. The steps taken by the publish command are designed to be run so that it minimizes the chances of failure by doing validation upfront.</p>\n<p>By publishing, it'll perform the following tasks:</p>\n<ol>\n<li>Validate that there are no local changes</li>\n<li>Validate that the versions to be bumped are in fact available in the npm registry</li>\n<li>Bumps the package versions</li>\n<li>Generate package changelog files</li>\n<li>Revert all these changes</li>\n<li>Fetch latest git changes on the remote target branch</li>\n<li>Perform the exact same thing in steps 3 &#x26; 4</li>\n<li>Push these changes back to the remote target branch</li>\n</ol>\n<p>It might be surprising that <code class=\"language-text\">beachball publish</code> does so many steps, especially the step about reverting changes! In most version bumping systems that automates git repo version with npm registry, they assume that the source code is fresh by the time they push the changes back to the git repository. This is almost never the case when the build takes more than a few minutes! So, <code class=\"language-text\">beachball</code> fetches latest before we push back to the target branch. In large systems, it has been observed that without the git fetch, it becomes a source of conflict.</p>\n<p>All the options for publish are documented in the CLI <a href=\"./options\">options</a> page </p>","frontmatter":{"title":"publish"}},"tableOfContents":{"chapters":[{"title":"Overview","entries":[{"entry":{"id":"aa948e6b-0177-51ab-877c-de4df9879e2e","childMarkdownRemark":{"fields":{"slug":"/getting-started"},"frontmatter":{"title":"Getting Started"}}}},{"entry":{"id":"ccfd1734-230c-5de7-8188-b9c9f36c34e9","childMarkdownRemark":{"fields":{"slug":"/installation"},"frontmatter":{"title":"Installation"}}}},{"entry":{"id":"dcf24505-af9a-589d-a9fb-bc1619ff7e0e","childMarkdownRemark":{"fields":{"slug":"/configuration"},"frontmatter":{"title":"Configuration"}}}}]},{"title":"Concepts","entries":[{"entry":{"id":"9907d23d-40b1-5bcc-9fb8-e9b64c786230","childMarkdownRemark":{"fields":{"slug":"/change-files"},"frontmatter":{"title":"Change Files"}}}},{"entry":{"id":"545adc82-8077-53ed-b68d-27b25b2cd19f","childMarkdownRemark":{"fields":{"slug":"/ci-integration"},"frontmatter":{"title":"CI Integration"}}}},{"entry":{"id":"9faba470-79f3-5934-8e09-893c1e795f82","childMarkdownRemark":{"fields":{"slug":"/bump-algorithm"},"frontmatter":{"title":"Bump Algorithm"}}}},{"entry":{"id":"25893094-f9c2-5375-aaf8-24e6db23f765","childMarkdownRemark":{"fields":{"slug":"/version-groups"},"frontmatter":{"title":"Version Groups"}}}}]},{"title":"CLI Reference","entries":[{"entry":{"id":"d331b943-d44c-57ee-b77c-45d0ac5a7a0d","childMarkdownRemark":{"fields":{"slug":"/change"},"frontmatter":{"title":"change"}}}},{"entry":{"id":"25b6911e-bac6-5692-80eb-8c70d1863000","childMarkdownRemark":{"fields":{"slug":"/check"},"frontmatter":{"title":"check"}}}},{"entry":{"id":"e9d2f246-5b07-5abe-92a6-d65c4c4e8ac4","childMarkdownRemark":{"fields":{"slug":"/bump"},"frontmatter":{"title":"bump"}}}},{"entry":{"id":"22b3b9a8-e74d-5bdf-83ad-d25cfbe60715","childMarkdownRemark":{"fields":{"slug":"/publish"},"frontmatter":{"title":"publish"}}}},{"entry":{"id":"55c11620-e2b0-538d-b36d-f5897681b65a","childMarkdownRemark":{"fields":{"slug":"/options"},"frontmatter":{"title":"options"}}}}]}]}},"pageContext":{"slug":"/publish"}}}

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -1,5 +0,0 @@
User-agent: *
Disallow: */tags/
Disallow: */categories/
sitemap: https://vagr9k.github.io/gatsby-advanced-starter/sitemap.xml

Двоичные данные
docs/screen-shot-v0-1.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 238 KiB

Двоичные данные
docs/screen-shot-v0-2.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 421 KiB

Двоичные данные
docs/static/logo-48-498be729f92ecef0ba4ce56f04724541.png поставляемый

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 16 KiB

Просмотреть файл

@ -1,2 +0,0 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[1],{ToKp:function(n,o,p){},t6uS:function(n,o,p){}}]);
//# sourceMappingURL=styles-d1a3a035f4f665b784fa.js.map

Просмотреть файл

@ -1 +0,0 @@
{"version":3,"sources":[],"names":[],"mappings":"","file":"styles-d1a3a035f4f665b784fa.js","sourceRoot":""}

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -1,171 +0,0 @@
/**
* Welcome to your Workbox-powered service worker!
*
* You'll need to register this file in your web app and you should
* disable HTTP caching for this file too.
* See https://goo.gl/nhQhGp
*
* The rest of the code is auto-generated. Please don't update this file
* directly; instead, make changes to your Workbox build configuration
* and re-run your build process.
* See https://goo.gl/2aRDsh
*/
importScripts("workbox-v4.3.1/workbox-sw.js");
workbox.setConfig({modulePathPrefix: "workbox-v4.3.1"});
workbox.core.setCacheNameDetails({prefix: "gatsby-plugin-offline"});
workbox.core.skipWaiting();
workbox.core.clientsClaim();
/**
* The workboxSW.precacheAndRoute() method efficiently caches and responds to
* requests for URLs in the manifest.
* See https://goo.gl/S9QRab
*/
self.__precacheManifest = [
{
"url": "webpack-runtime-0cf686ccbfdcfb61a26d.js"
},
{
"url": "styles.bf08af97d323469509c4.css"
},
{
"url": "styles-d1a3a035f4f665b784fa.js"
},
{
"url": "commons-3821708ebb9dec13129d.js"
},
{
"url": "app-e36445c3b269123ee357.js"
},
{
"url": "component---node-modules-gatsby-plugin-offline-app-shell-js-cab98a124892315be993.js"
},
{
"url": "offline-plugin-app-shell-fallback/index.html",
"revision": "1dbb7a6f85ab158c9abbae646b0ac10f"
},
{
"url": "page-data/offline-plugin-app-shell-fallback/page-data.json",
"revision": "afc93dd653bfa7c7967efc1b0cca1616"
},
{
"url": "manifest.webmanifest",
"revision": "7ce2e9badb43a0d62cc40c38158a953d"
}
].concat(self.__precacheManifest || []);
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
workbox.routing.registerRoute(/(\.js$|\.css$|static\/)/, new workbox.strategies.CacheFirst(), 'GET');
workbox.routing.registerRoute(/^https?:.*\page-data\/.*\/page-data\.json/, new workbox.strategies.StaleWhileRevalidate(), 'GET');
workbox.routing.registerRoute(/^https?:.*\.(png|jpg|jpeg|webp|svg|gif|tiff|js|woff|woff2|json|css)$/, new workbox.strategies.StaleWhileRevalidate(), 'GET');
workbox.routing.registerRoute(/^https?:\/\/fonts\.googleapis\.com\/css/, new workbox.strategies.StaleWhileRevalidate(), 'GET');
/* global importScripts, workbox, idbKeyval */
importScripts(`idb-keyval-iife.min.js`)
const { NavigationRoute } = workbox.routing
let lastNavigationRequest = null
let offlineShellEnabled = true
// prefer standard object syntax to support more browsers
const MessageAPI = {
setPathResources: (event, { path, resources }) => {
event.waitUntil(idbKeyval.set(`resources:${path}`, resources))
},
clearPathResources: event => {
event.waitUntil(idbKeyval.clear())
},
enableOfflineShell: () => {
offlineShellEnabled = true
},
disableOfflineShell: () => {
offlineShellEnabled = false
},
}
self.addEventListener(`message`, event => {
const { gatsbyApi: api } = event.data
if (api) MessageAPI[api](event, event.data)
})
function handleAPIRequest({ event }) {
const { pathname } = new URL(event.request.url)
const params = pathname.match(/:(.+)/)[1]
const data = {}
if (params.includes(`=`)) {
params.split(`&`).forEach(param => {
const [key, val] = param.split(`=`)
data[key] = val
})
} else {
data.api = params
}
if (MessageAPI[data.api] !== undefined) {
MessageAPI[data.api]()
}
if (!data.redirect) {
return new Response()
}
return new Response(null, {
status: 302,
headers: {
Location: lastNavigationRequest,
},
})
}
const navigationRoute = new NavigationRoute(async ({ event }) => {
// handle API requests separately to normal navigation requests, so do this
// check first
if (event.request.url.match(/\/.gatsby-plugin-offline:.+/)) {
return handleAPIRequest({ event })
}
if (!offlineShellEnabled) {
return await fetch(event.request)
}
lastNavigationRequest = event.request.url
let { pathname } = new URL(event.request.url)
pathname = pathname.replace(new RegExp(`^/beachball`), ``)
// Check for resources + the app bundle
// The latter may not exist if the SW is updating to a new version
const resources = await idbKeyval.get(`resources:${pathname}`)
if (!resources || !(await caches.match(`/beachball/app-e36445c3b269123ee357.js`))) {
return await fetch(event.request)
}
for (const resource of resources) {
// As soon as we detect a failed resource, fetch the entire page from
// network - that way we won't risk being in an inconsistent state with
// some parts of the page failing.
if (!(await caches.match(resource))) {
return await fetch(event.request)
}
}
const offlineShell = `/beachball/offline-plugin-app-shell-fallback/index.html`
const offlineShellWithKey = workbox.precaching.getCacheKeyForURL(offlineShell)
return await caches.match(offlineShellWithKey)
})
workbox.routing.registerRoute(navigationRoute)
// this route is used when performing a non-navigation request (e.g. fetch)
workbox.routing.registerRoute(/\/.gatsby-plugin-offline:.+/, handleAPIRequest)

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -1,2 +0,0 @@
!function(e){function r(r){for(var n,u,c=r[0],i=r[1],l=r[2],p=0,s=[];p<c.length;p++)u=c[p],Object.prototype.hasOwnProperty.call(o,u)&&o[u]&&s.push(o[u][0]),o[u]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(f&&f(r);s.length;)s.shift()();return a.push.apply(a,l||[]),t()}function t(){for(var e,r=0;r<a.length;r++){for(var t=a[r],n=!0,c=1;c<t.length;c++){var i=t[c];0!==o[i]&&(n=!1)}n&&(a.splice(r--,1),e=u(u.s=t[0]))}return e}var n={},o={7:0},a=[];function u(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,u),t.l=!0,t.exports}u.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var a,c=document.createElement("script");c.charset="utf-8",c.timeout=120,u.nc&&c.setAttribute("nonce",u.nc),c.src=function(e){return u.p+""+({3:"component---node-modules-gatsby-plugin-offline-app-shell-js",4:"component---src-pages-404-jsx",5:"component---src-pages-index-jsx",6:"component---src-templates-doc-jsx"}[e]||e)+"-"+{3:"cab98a124892315be993",4:"859fbd58d1cf149245b5",5:"fdf0f24c4c7f32a006b9",6:"d425e0c3654169ba3adc"}[e]+".js"}(e);var i=new Error;a=function(r){c.onerror=c.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;i.message="Loading chunk "+e+" failed.\n("+n+": "+a+")",i.name="ChunkLoadError",i.type=n,i.request=a,t[1](i)}o[e]=void 0}};var l=setTimeout((function(){a({type:"timeout",target:c})}),12e4);c.onerror=c.onload=a,document.head.appendChild(c)}return Promise.all(r)},u.m=e,u.c=n,u.d=function(e,r,t){u.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,r){if(1&r&&(e=u(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(u.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)u.d(t,n,function(r){return e[r]}.bind(null,n));return t},u.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(r,"a",r),r},u.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},u.p="/beachball/",u.oe=function(e){throw console.error(e),e};var c=window.webpackJsonp=window.webpackJsonp||[],i=c.push.bind(c);c.push=r,c=c.slice();for(var l=0;l<c.length;l++)r(c[l]);var f=i;t()}([]);
//# sourceMappingURL=webpack-runtime-0cf686ccbfdcfb61a26d.js.map

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -1 +0,0 @@
{"errors":[],"warnings":[],"namedChunkGroups":{"app":{"chunks":[7,1,0,2],"assets":["webpack-runtime-0cf686ccbfdcfb61a26d.js","webpack-runtime-0cf686ccbfdcfb61a26d.js.map","styles.bf08af97d323469509c4.css","styles-d1a3a035f4f665b784fa.js","styles-d1a3a035f4f665b784fa.js.map","commons-3821708ebb9dec13129d.js","commons-3821708ebb9dec13129d.js.map","app-e36445c3b269123ee357.js","app-e36445c3b269123ee357.js.map"],"children":{},"childAssets":{}},"component---node-modules-gatsby-plugin-offline-app-shell-js":{"chunks":[3],"assets":["component---node-modules-gatsby-plugin-offline-app-shell-js-cab98a124892315be993.js","component---node-modules-gatsby-plugin-offline-app-shell-js-cab98a124892315be993.js.map"],"children":{},"childAssets":{}},"component---src-templates-doc-jsx":{"chunks":[1,0,6],"assets":["styles.bf08af97d323469509c4.css","styles-d1a3a035f4f665b784fa.js","styles-d1a3a035f4f665b784fa.js.map","commons-3821708ebb9dec13129d.js","commons-3821708ebb9dec13129d.js.map","component---src-templates-doc-jsx-d425e0c3654169ba3adc.js","component---src-templates-doc-jsx-d425e0c3654169ba3adc.js.map"],"children":{},"childAssets":{}},"component---src-pages-index-jsx":{"chunks":[1,0,5],"assets":["styles.bf08af97d323469509c4.css","styles-d1a3a035f4f665b784fa.js","styles-d1a3a035f4f665b784fa.js.map","commons-3821708ebb9dec13129d.js","commons-3821708ebb9dec13129d.js.map","component---src-pages-index-jsx-fdf0f24c4c7f32a006b9.js","component---src-pages-index-jsx-fdf0f24c4c7f32a006b9.js.map"],"children":{},"childAssets":{}},"component---src-pages-404-jsx":{"chunks":[4],"assets":["component---src-pages-404-jsx-859fbd58d1cf149245b5.js","component---src-pages-404-jsx-859fbd58d1cf149245b5.js.map"],"children":{},"childAssets":{}}},"assetsByChunkName":{"app":["webpack-runtime-0cf686ccbfdcfb61a26d.js","styles.bf08af97d323469509c4.css","styles-d1a3a035f4f665b784fa.js","commons-3821708ebb9dec13129d.js","app-e36445c3b269123ee357.js"],"component---node-modules-gatsby-plugin-offline-app-shell-js":["component---node-modules-gatsby-plugin-offline-app-shell-js-cab98a124892315be993.js"],"component---src-templates-doc-jsx":["styles.bf08af97d323469509c4.css","styles-d1a3a035f4f665b784fa.js","commons-3821708ebb9dec13129d.js","component---src-templates-doc-jsx-d425e0c3654169ba3adc.js"],"component---src-pages-index-jsx":["styles.bf08af97d323469509c4.css","styles-d1a3a035f4f665b784fa.js","commons-3821708ebb9dec13129d.js","component---src-pages-index-jsx-fdf0f24c4c7f32a006b9.js"],"component---src-pages-404-jsx":["component---src-pages-404-jsx-859fbd58d1cf149245b5.js"]}}

Просмотреть файл

@ -1,822 +0,0 @@
this.workbox = this.workbox || {};
this.workbox.backgroundSync = (function (exports, WorkboxError_mjs, logger_mjs, assert_mjs, getFriendlyURL_mjs, DBWrapper_mjs) {
'use strict';
try {
self['workbox:background-sync:4.3.1'] && _();
} catch (e) {} // eslint-disable-line
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
const DB_VERSION = 3;
const DB_NAME = 'workbox-background-sync';
const OBJECT_STORE_NAME = 'requests';
const INDEXED_PROP = 'queueName';
/**
* A class to manage storing requests from a Queue in IndexedbDB,
* indexed by their queue name for easier access.
*
* @private
*/
class QueueStore {
/**
* Associates this instance with a Queue instance, so entries added can be
* identified by their queue name.
*
* @param {string} queueName
* @private
*/
constructor(queueName) {
this._queueName = queueName;
this._db = new DBWrapper_mjs.DBWrapper(DB_NAME, DB_VERSION, {
onupgradeneeded: this._upgradeDb
});
}
/**
* Append an entry last in the queue.
*
* @param {Object} entry
* @param {Object} entry.requestData
* @param {number} [entry.timestamp]
* @param {Object} [entry.metadata]
* @private
*/
async pushEntry(entry) {
{
assert_mjs.assert.isType(entry, 'object', {
moduleName: 'workbox-background-sync',
className: 'QueueStore',
funcName: 'pushEntry',
paramName: 'entry'
});
assert_mjs.assert.isType(entry.requestData, 'object', {
moduleName: 'workbox-background-sync',
className: 'QueueStore',
funcName: 'pushEntry',
paramName: 'entry.requestData'
});
} // Don't specify an ID since one is automatically generated.
delete entry.id;
entry.queueName = this._queueName;
await this._db.add(OBJECT_STORE_NAME, entry);
}
/**
* Preppend an entry first in the queue.
*
* @param {Object} entry
* @param {Object} entry.requestData
* @param {number} [entry.timestamp]
* @param {Object} [entry.metadata]
* @private
*/
async unshiftEntry(entry) {
{
assert_mjs.assert.isType(entry, 'object', {
moduleName: 'workbox-background-sync',
className: 'QueueStore',
funcName: 'unshiftEntry',
paramName: 'entry'
});
assert_mjs.assert.isType(entry.requestData, 'object', {
moduleName: 'workbox-background-sync',
className: 'QueueStore',
funcName: 'unshiftEntry',
paramName: 'entry.requestData'
});
}
const [firstEntry] = await this._db.getAllMatching(OBJECT_STORE_NAME, {
count: 1
});
if (firstEntry) {
// Pick an ID one less than the lowest ID in the object store.
entry.id = firstEntry.id - 1;
} else {
// Otherwise let the auto-incrementor assign the ID.
delete entry.id;
}
entry.queueName = this._queueName;
await this._db.add(OBJECT_STORE_NAME, entry);
}
/**
* Removes and returns the last entry in the queue matching the `queueName`.
*
* @return {Promise<Object>}
* @private
*/
async popEntry() {
return this._removeEntry({
direction: 'prev'
});
}
/**
* Removes and returns the first entry in the queue matching the `queueName`.
*
* @return {Promise<Object>}
* @private
*/
async shiftEntry() {
return this._removeEntry({
direction: 'next'
});
}
/**
* Returns all entries in the store matching the `queueName`.
*
* @param {Object} options See workbox.backgroundSync.Queue~getAll}
* @return {Promise<Array<Object>>}
* @private
*/
async getAll() {
return await this._db.getAllMatching(OBJECT_STORE_NAME, {
index: INDEXED_PROP,
query: IDBKeyRange.only(this._queueName)
});
}
/**
* Deletes the entry for the given ID.
*
* WARNING: this method does not ensure the deleted enry belongs to this
* queue (i.e. matches the `queueName`). But this limitation is acceptable
* as this class is not publicly exposed. An additional check would make
* this method slower than it needs to be.
*
* @private
* @param {number} id
*/
async deleteEntry(id) {
await this._db.delete(OBJECT_STORE_NAME, id);
}
/**
* Removes and returns the first or last entry in the queue (based on the
* `direction` argument) matching the `queueName`.
*
* @return {Promise<Object>}
* @private
*/
async _removeEntry({
direction
}) {
const [entry] = await this._db.getAllMatching(OBJECT_STORE_NAME, {
direction,
index: INDEXED_PROP,
query: IDBKeyRange.only(this._queueName),
count: 1
});
if (entry) {
await this.deleteEntry(entry.id);
return entry;
}
}
/**
* Upgrades the database given an `upgradeneeded` event.
*
* @param {Event} event
* @private
*/
_upgradeDb(event) {
const db = event.target.result;
if (event.oldVersion > 0 && event.oldVersion < DB_VERSION) {
if (db.objectStoreNames.contains(OBJECT_STORE_NAME)) {
db.deleteObjectStore(OBJECT_STORE_NAME);
}
}
const objStore = db.createObjectStore(OBJECT_STORE_NAME, {
autoIncrement: true,
keyPath: 'id'
});
objStore.createIndex(INDEXED_PROP, INDEXED_PROP, {
unique: false
});
}
}
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
const serializableProperties = ['method', 'referrer', 'referrerPolicy', 'mode', 'credentials', 'cache', 'redirect', 'integrity', 'keepalive'];
/**
* A class to make it easier to serialize and de-serialize requests so they
* can be stored in IndexedDB.
*
* @private
*/
class StorableRequest {
/**
* Converts a Request object to a plain object that can be structured
* cloned or JSON-stringified.
*
* @param {Request} request
* @return {Promise<StorableRequest>}
*
* @private
*/
static async fromRequest(request) {
const requestData = {
url: request.url,
headers: {}
}; // Set the body if present.
if (request.method !== 'GET') {
// Use ArrayBuffer to support non-text request bodies.
// NOTE: we can't use Blobs becuse Safari doesn't support storing
// Blobs in IndexedDB in some cases:
// https://github.com/dfahlander/Dexie.js/issues/618#issuecomment-398348457
requestData.body = await request.clone().arrayBuffer();
} // Convert the headers from an iterable to an object.
for (const [key, value] of request.headers.entries()) {
requestData.headers[key] = value;
} // Add all other serializable request properties
for (const prop of serializableProperties) {
if (request[prop] !== undefined) {
requestData[prop] = request[prop];
}
}
return new StorableRequest(requestData);
}
/**
* Accepts an object of request data that can be used to construct a
* `Request` but can also be stored in IndexedDB.
*
* @param {Object} requestData An object of request data that includes the
* `url` plus any relevant properties of
* [requestInit]{@link https://fetch.spec.whatwg.org/#requestinit}.
* @private
*/
constructor(requestData) {
{
assert_mjs.assert.isType(requestData, 'object', {
moduleName: 'workbox-background-sync',
className: 'StorableRequest',
funcName: 'constructor',
paramName: 'requestData'
});
assert_mjs.assert.isType(requestData.url, 'string', {
moduleName: 'workbox-background-sync',
className: 'StorableRequest',
funcName: 'constructor',
paramName: 'requestData.url'
});
} // If the request's mode is `navigate`, convert it to `same-origin` since
// navigation requests can't be constructed via script.
if (requestData.mode === 'navigate') {
requestData.mode = 'same-origin';
}
this._requestData = requestData;
}
/**
* Returns a deep clone of the instances `_requestData` object.
*
* @return {Object}
*
* @private
*/
toObject() {
const requestData = Object.assign({}, this._requestData);
requestData.headers = Object.assign({}, this._requestData.headers);
if (requestData.body) {
requestData.body = requestData.body.slice(0);
}
return requestData;
}
/**
* Converts this instance to a Request.
*
* @return {Request}
*
* @private
*/
toRequest() {
return new Request(this._requestData.url, this._requestData);
}
/**
* Creates and returns a deep clone of the instance.
*
* @return {StorableRequest}
*
* @private
*/
clone() {
return new StorableRequest(this.toObject());
}
}
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
const TAG_PREFIX = 'workbox-background-sync';
const MAX_RETENTION_TIME = 60 * 24 * 7; // 7 days in minutes
const queueNames = new Set();
/**
* A class to manage storing failed requests in IndexedDB and retrying them
* later. All parts of the storing and replaying process are observable via
* callbacks.
*
* @memberof workbox.backgroundSync
*/
class Queue {
/**
* Creates an instance of Queue with the given options
*
* @param {string} name The unique name for this queue. This name must be
* unique as it's used to register sync events and store requests
* in IndexedDB specific to this instance. An error will be thrown if
* a duplicate name is detected.
* @param {Object} [options]
* @param {Function} [options.onSync] A function that gets invoked whenever
* the 'sync' event fires. The function is invoked with an object
* containing the `queue` property (referencing this instance), and you
* can use the callback to customize the replay behavior of the queue.
* When not set the `replayRequests()` method is called.
* Note: if the replay fails after a sync event, make sure you throw an
* error, so the browser knows to retry the sync event later.
* @param {number} [options.maxRetentionTime=7 days] The amount of time (in
* minutes) a request may be retried. After this amount of time has
* passed, the request will be deleted from the queue.
*/
constructor(name, {
onSync,
maxRetentionTime
} = {}) {
// Ensure the store name is not already being used
if (queueNames.has(name)) {
throw new WorkboxError_mjs.WorkboxError('duplicate-queue-name', {
name
});
} else {
queueNames.add(name);
}
this._name = name;
this._onSync = onSync || this.replayRequests;
this._maxRetentionTime = maxRetentionTime || MAX_RETENTION_TIME;
this._queueStore = new QueueStore(this._name);
this._addSyncListener();
}
/**
* @return {string}
*/
get name() {
return this._name;
}
/**
* Stores the passed request in IndexedDB (with its timestamp and any
* metadata) at the end of the queue.
*
* @param {Object} entry
* @param {Request} entry.request The request to store in the queue.
* @param {Object} [entry.metadata] Any metadata you want associated with the
* stored request. When requests are replayed you'll have access to this
* metadata object in case you need to modify the request beforehand.
* @param {number} [entry.timestamp] The timestamp (Epoch time in
* milliseconds) when the request was first added to the queue. This is
* used along with `maxRetentionTime` to remove outdated requests. In
* general you don't need to set this value, as it's automatically set
* for you (defaulting to `Date.now()`), but you can update it if you
* don't want particular requests to expire.
*/
async pushRequest(entry) {
{
assert_mjs.assert.isType(entry, 'object', {
moduleName: 'workbox-background-sync',
className: 'Queue',
funcName: 'pushRequest',
paramName: 'entry'
});
assert_mjs.assert.isInstance(entry.request, Request, {
moduleName: 'workbox-background-sync',
className: 'Queue',
funcName: 'pushRequest',
paramName: 'entry.request'
});
}
await this._addRequest(entry, 'push');
}
/**
* Stores the passed request in IndexedDB (with its timestamp and any
* metadata) at the beginning of the queue.
*
* @param {Object} entry
* @param {Request} entry.request The request to store in the queue.
* @param {Object} [entry.metadata] Any metadata you want associated with the
* stored request. When requests are replayed you'll have access to this
* metadata object in case you need to modify the request beforehand.
* @param {number} [entry.timestamp] The timestamp (Epoch time in
* milliseconds) when the request was first added to the queue. This is
* used along with `maxRetentionTime` to remove outdated requests. In
* general you don't need to set this value, as it's automatically set
* for you (defaulting to `Date.now()`), but you can update it if you
* don't want particular requests to expire.
*/
async unshiftRequest(entry) {
{
assert_mjs.assert.isType(entry, 'object', {
moduleName: 'workbox-background-sync',
className: 'Queue',
funcName: 'unshiftRequest',
paramName: 'entry'
});
assert_mjs.assert.isInstance(entry.request, Request, {
moduleName: 'workbox-background-sync',
className: 'Queue',
funcName: 'unshiftRequest',
paramName: 'entry.request'
});
}
await this._addRequest(entry, 'unshift');
}
/**
* Removes and returns the last request in the queue (along with its
* timestamp and any metadata). The returned object takes the form:
* `{request, timestamp, metadata}`.
*
* @return {Promise<Object>}
*/
async popRequest() {
return this._removeRequest('pop');
}
/**
* Removes and returns the first request in the queue (along with its
* timestamp and any metadata). The returned object takes the form:
* `{request, timestamp, metadata}`.
*
* @return {Promise<Object>}
*/
async shiftRequest() {
return this._removeRequest('shift');
}
/**
* Returns all the entries that have not expired (per `maxRetentionTime`).
* Any expired entries are removed from the queue.
*
* @return {Promise<Array<Object>>}
*/
async getAll() {
const allEntries = await this._queueStore.getAll();
const now = Date.now();
const unexpiredEntries = [];
for (const entry of allEntries) {
// Ignore requests older than maxRetentionTime. Call this function
// recursively until an unexpired request is found.
const maxRetentionTimeInMs = this._maxRetentionTime * 60 * 1000;
if (now - entry.timestamp > maxRetentionTimeInMs) {
await this._queueStore.deleteEntry(entry.id);
} else {
unexpiredEntries.push(convertEntry(entry));
}
}
return unexpiredEntries;
}
/**
* Adds the entry to the QueueStore and registers for a sync event.
*
* @param {Object} entry
* @param {Request} entry.request
* @param {Object} [entry.metadata]
* @param {number} [entry.timestamp=Date.now()]
* @param {string} operation ('push' or 'unshift')
* @private
*/
async _addRequest({
request,
metadata,
timestamp = Date.now()
}, operation) {
const storableRequest = await StorableRequest.fromRequest(request.clone());
const entry = {
requestData: storableRequest.toObject(),
timestamp
}; // Only include metadata if it's present.
if (metadata) {
entry.metadata = metadata;
}
await this._queueStore[`${operation}Entry`](entry);
{
logger_mjs.logger.log(`Request for '${getFriendlyURL_mjs.getFriendlyURL(request.url)}' has ` + `been added to background sync queue '${this._name}'.`);
} // Don't register for a sync if we're in the middle of a sync. Instead,
// we wait until the sync is complete and call register if
// `this._requestsAddedDuringSync` is true.
if (this._syncInProgress) {
this._requestsAddedDuringSync = true;
} else {
await this.registerSync();
}
}
/**
* Removes and returns the first or last (depending on `operation`) entry
* from the QueueStore that's not older than the `maxRetentionTime`.
*
* @param {string} operation ('pop' or 'shift')
* @return {Object|undefined}
* @private
*/
async _removeRequest(operation) {
const now = Date.now();
const entry = await this._queueStore[`${operation}Entry`]();
if (entry) {
// Ignore requests older than maxRetentionTime. Call this function
// recursively until an unexpired request is found.
const maxRetentionTimeInMs = this._maxRetentionTime * 60 * 1000;
if (now - entry.timestamp > maxRetentionTimeInMs) {
return this._removeRequest(operation);
}
return convertEntry(entry);
}
}
/**
* Loops through each request in the queue and attempts to re-fetch it.
* If any request fails to re-fetch, it's put back in the same position in
* the queue (which registers a retry for the next sync event).
*/
async replayRequests() {
let entry;
while (entry = await this.shiftRequest()) {
try {
await fetch(entry.request.clone());
{
logger_mjs.logger.log(`Request for '${getFriendlyURL_mjs.getFriendlyURL(entry.request.url)}'` + `has been replayed in queue '${this._name}'`);
}
} catch (error) {
await this.unshiftRequest(entry);
{
logger_mjs.logger.log(`Request for '${getFriendlyURL_mjs.getFriendlyURL(entry.request.url)}'` + `failed to replay, putting it back in queue '${this._name}'`);
}
throw new WorkboxError_mjs.WorkboxError('queue-replay-failed', {
name: this._name
});
}
}
{
logger_mjs.logger.log(`All requests in queue '${this.name}' have successfully ` + `replayed; the queue is now empty!`);
}
}
/**
* Registers a sync event with a tag unique to this instance.
*/
async registerSync() {
if ('sync' in registration) {
try {
await registration.sync.register(`${TAG_PREFIX}:${this._name}`);
} catch (err) {
// This means the registration failed for some reason, possibly due to
// the user disabling it.
{
logger_mjs.logger.warn(`Unable to register sync event for '${this._name}'.`, err);
}
}
}
}
/**
* In sync-supporting browsers, this adds a listener for the sync event.
* In non-sync-supporting browsers, this will retry the queue on service
* worker startup.
*
* @private
*/
_addSyncListener() {
if ('sync' in registration) {
self.addEventListener('sync', event => {
if (event.tag === `${TAG_PREFIX}:${this._name}`) {
{
logger_mjs.logger.log(`Background sync for tag '${event.tag}'` + `has been received`);
}
const syncComplete = async () => {
this._syncInProgress = true;
let syncError;
try {
await this._onSync({
queue: this
});
} catch (error) {
syncError = error; // Rethrow the error. Note: the logic in the finally clause
// will run before this gets rethrown.
throw syncError;
} finally {
// New items may have been added to the queue during the sync,
// so we need to register for a new sync if that's happened...
// Unless there was an error during the sync, in which
// case the browser will automatically retry later, as long
// as `event.lastChance` is not true.
if (this._requestsAddedDuringSync && !(syncError && !event.lastChance)) {
await this.registerSync();
}
this._syncInProgress = false;
this._requestsAddedDuringSync = false;
}
};
event.waitUntil(syncComplete());
}
});
} else {
{
logger_mjs.logger.log(`Background sync replaying without background sync event`);
} // If the browser doesn't support background sync, retry
// every time the service worker starts up as a fallback.
this._onSync({
queue: this
});
}
}
/**
* Returns the set of queue names. This is primarily used to reset the list
* of queue names in tests.
*
* @return {Set}
*
* @private
*/
static get _queueNames() {
return queueNames;
}
}
/**
* Converts a QueueStore entry into the format exposed by Queue. This entails
* converting the request data into a real request and omitting the `id` and
* `queueName` properties.
*
* @param {Object} queueStoreEntry
* @return {Object}
* @private
*/
const convertEntry = queueStoreEntry => {
const queueEntry = {
request: new StorableRequest(queueStoreEntry.requestData).toRequest(),
timestamp: queueStoreEntry.timestamp
};
if (queueStoreEntry.metadata) {
queueEntry.metadata = queueStoreEntry.metadata;
}
return queueEntry;
};
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
/**
* A class implementing the `fetchDidFail` lifecycle callback. This makes it
* easier to add failed requests to a background sync Queue.
*
* @memberof workbox.backgroundSync
*/
class Plugin {
/**
* @param {...*} queueArgs Args to forward to the composed Queue instance.
* See the [Queue]{@link workbox.backgroundSync.Queue} documentation for
* parameter details.
*/
constructor(...queueArgs) {
this._queue = new Queue(...queueArgs);
this.fetchDidFail = this.fetchDidFail.bind(this);
}
/**
* @param {Object} options
* @param {Request} options.request
* @private
*/
async fetchDidFail({
request
}) {
await this._queue.pushRequest({
request
});
}
}
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
exports.Queue = Queue;
exports.Plugin = Plugin;
return exports;
}({}, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private));
//# sourceMappingURL=workbox-background-sync.dev.js.map

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -1,2 +0,0 @@
this.workbox=this.workbox||{},this.workbox.backgroundSync=function(t,e,s){"use strict";try{self["workbox:background-sync:4.3.1"]&&_()}catch(t){}const i=3,n="workbox-background-sync",a="requests",r="queueName";class c{constructor(t){this.t=t,this.s=new s.DBWrapper(n,i,{onupgradeneeded:this.i})}async pushEntry(t){delete t.id,t.queueName=this.t,await this.s.add(a,t)}async unshiftEntry(t){const[e]=await this.s.getAllMatching(a,{count:1});e?t.id=e.id-1:delete t.id,t.queueName=this.t,await this.s.add(a,t)}async popEntry(){return this.h({direction:"prev"})}async shiftEntry(){return this.h({direction:"next"})}async getAll(){return await this.s.getAllMatching(a,{index:r,query:IDBKeyRange.only(this.t)})}async deleteEntry(t){await this.s.delete(a,t)}async h({direction:t}){const[e]=await this.s.getAllMatching(a,{direction:t,index:r,query:IDBKeyRange.only(this.t),count:1});if(e)return await this.deleteEntry(e.id),e}i(t){const e=t.target.result;t.oldVersion>0&&t.oldVersion<i&&e.objectStoreNames.contains(a)&&e.deleteObjectStore(a),e.createObjectStore(a,{autoIncrement:!0,keyPath:"id"}).createIndex(r,r,{unique:!1})}}const h=["method","referrer","referrerPolicy","mode","credentials","cache","redirect","integrity","keepalive"];class o{static async fromRequest(t){const e={url:t.url,headers:{}};"GET"!==t.method&&(e.body=await t.clone().arrayBuffer());for(const[s,i]of t.headers.entries())e.headers[s]=i;for(const s of h)void 0!==t[s]&&(e[s]=t[s]);return new o(e)}constructor(t){"navigate"===t.mode&&(t.mode="same-origin"),this.o=t}toObject(){const t=Object.assign({},this.o);return t.headers=Object.assign({},this.o.headers),t.body&&(t.body=t.body.slice(0)),t}toRequest(){return new Request(this.o.url,this.o)}clone(){return new o(this.toObject())}}const u="workbox-background-sync",y=10080,w=new Set;class d{constructor(t,{onSync:s,maxRetentionTime:i}={}){if(w.has(t))throw new e.WorkboxError("duplicate-queue-name",{name:t});w.add(t),this.u=t,this.l=s||this.replayRequests,this.q=i||y,this.m=new c(this.u),this.p()}get name(){return this.u}async pushRequest(t){await this.g(t,"push")}async unshiftRequest(t){await this.g(t,"unshift")}async popRequest(){return this.R("pop")}async shiftRequest(){return this.R("shift")}async getAll(){const t=await this.m.getAll(),e=Date.now(),s=[];for(const i of t){const t=60*this.q*1e3;e-i.timestamp>t?await this.m.deleteEntry(i.id):s.push(f(i))}return s}async g({request:t,metadata:e,timestamp:s=Date.now()},i){const n={requestData:(await o.fromRequest(t.clone())).toObject(),timestamp:s};e&&(n.metadata=e),await this.m[`${i}Entry`](n),this.k?this.D=!0:await this.registerSync()}async R(t){const e=Date.now(),s=await this.m[`${t}Entry`]();if(s){const i=60*this.q*1e3;return e-s.timestamp>i?this.R(t):f(s)}}async replayRequests(){let t;for(;t=await this.shiftRequest();)try{await fetch(t.request.clone())}catch(s){throw await this.unshiftRequest(t),new e.WorkboxError("queue-replay-failed",{name:this.u})}}async registerSync(){if("sync"in registration)try{await registration.sync.register(`${u}:${this.u}`)}catch(t){}}p(){"sync"in registration?self.addEventListener("sync",t=>{if(t.tag===`${u}:${this.u}`){const e=async()=>{let e;this.k=!0;try{await this.l({queue:this})}catch(t){throw e=t}finally{!this.D||e&&!t.lastChance||await this.registerSync(),this.k=!1,this.D=!1}};t.waitUntil(e())}}):this.l({queue:this})}static get _(){return w}}const f=t=>{const e={request:new o(t.requestData).toRequest(),timestamp:t.timestamp};return t.metadata&&(e.metadata=t.metadata),e};return t.Queue=d,t.Plugin=class{constructor(...t){this.v=new d(...t),this.fetchDidFail=this.fetchDidFail.bind(this)}async fetchDidFail({request:t}){await this.v.pushRequest({request:t})}},t}({},workbox.core._private,workbox.core._private);
//# sourceMappingURL=workbox-background-sync.prod.js.map

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -1,496 +0,0 @@
this.workbox = this.workbox || {};
this.workbox.broadcastUpdate = (function (exports, assert_mjs, getFriendlyURL_mjs, logger_mjs, Deferred_mjs, WorkboxError_mjs) {
'use strict';
try {
self['workbox:broadcast-update:4.3.1'] && _();
} catch (e) {} // eslint-disable-line
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
/**
* Given two `Response's`, compares several header values to see if they are
* the same or not.
*
* @param {Response} firstResponse
* @param {Response} secondResponse
* @param {Array<string>} headersToCheck
* @return {boolean}
*
* @memberof workbox.broadcastUpdate
* @private
*/
const responsesAreSame = (firstResponse, secondResponse, headersToCheck) => {
{
if (!(firstResponse instanceof Response && secondResponse instanceof Response)) {
throw new WorkboxError_mjs.WorkboxError('invalid-responses-are-same-args');
}
}
const atLeastOneHeaderAvailable = headersToCheck.some(header => {
return firstResponse.headers.has(header) && secondResponse.headers.has(header);
});
if (!atLeastOneHeaderAvailable) {
{
logger_mjs.logger.warn(`Unable to determine where the response has been updated ` + `because none of the headers that would be checked are present.`);
logger_mjs.logger.debug(`Attempting to compare the following: `, firstResponse, secondResponse, headersToCheck);
} // Just return true, indicating the that responses are the same, since we
// can't determine otherwise.
return true;
}
return headersToCheck.every(header => {
const headerStateComparison = firstResponse.headers.has(header) === secondResponse.headers.has(header);
const headerValueComparison = firstResponse.headers.get(header) === secondResponse.headers.get(header);
return headerStateComparison && headerValueComparison;
});
};
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
const CACHE_UPDATED_MESSAGE_TYPE = 'CACHE_UPDATED';
const CACHE_UPDATED_MESSAGE_META = 'workbox-broadcast-update';
const DEFAULT_BROADCAST_CHANNEL_NAME = 'workbox';
const DEFAULT_DEFER_NOTIFICATION_TIMEOUT = 10000;
const DEFAULT_HEADERS_TO_CHECK = ['content-length', 'etag', 'last-modified'];
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
/**
* You would not normally call this method directly; it's called automatically
* by an instance of the {@link BroadcastCacheUpdate} class. It's exposed here
* for the benefit of developers who would rather not use the full
* `BroadcastCacheUpdate` implementation.
*
* Calling this will dispatch a message on the provided
* {@link https://developers.google.com/web/updates/2016/09/broadcastchannel|Broadcast Channel}
* to notify interested subscribers about a change to a cached resource.
*
* The message that's posted has a formation inspired by the
* [Flux standard action](https://github.com/acdlite/flux-standard-action#introduction)
* format like so:
*
* ```
* {
* type: 'CACHE_UPDATED',
* meta: 'workbox-broadcast-update',
* payload: {
* cacheName: 'the-cache-name',
* updatedURL: 'https://example.com/'
* }
* }
* ```
*
* (Usage of [Flux](https://facebook.github.io/flux/) itself is not at
* all required.)
*
* @param {Object} options
* @param {string} options.cacheName The name of the cache in which the updated
* `Response` was stored.
* @param {string} options.url The URL associated with the updated `Response`.
* @param {BroadcastChannel} [options.channel] The `BroadcastChannel` to use.
* If no channel is set or the browser doesn't support the BroadcastChannel
* api, then an attempt will be made to `postMessage` each window client.
*
* @memberof workbox.broadcastUpdate
*/
const broadcastUpdate = async ({
channel,
cacheName,
url
}) => {
{
assert_mjs.assert.isType(cacheName, 'string', {
moduleName: 'workbox-broadcast-update',
className: '~',
funcName: 'broadcastUpdate',
paramName: 'cacheName'
});
assert_mjs.assert.isType(url, 'string', {
moduleName: 'workbox-broadcast-update',
className: '~',
funcName: 'broadcastUpdate',
paramName: 'url'
});
}
const data = {
type: CACHE_UPDATED_MESSAGE_TYPE,
meta: CACHE_UPDATED_MESSAGE_META,
payload: {
cacheName: cacheName,
updatedURL: url
}
};
if (channel) {
channel.postMessage(data);
} else {
const windows = await clients.matchAll({
type: 'window'
});
for (const win of windows) {
win.postMessage(data);
}
}
};
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
/**
* Uses the [Broadcast Channel API]{@link https://developers.google.com/web/updates/2016/09/broadcastchannel}
* to notify interested parties when a cached response has been updated.
* In browsers that do not support the Broadcast Channel API, the instance
* falls back to sending the update via `postMessage()` to all window clients.
*
* For efficiency's sake, the underlying response bodies are not compared;
* only specific response headers are checked.
*
* @memberof workbox.broadcastUpdate
*/
class BroadcastCacheUpdate {
/**
* Construct a BroadcastCacheUpdate instance with a specific `channelName` to
* broadcast messages on
*
* @param {Object} options
* @param {Array<string>}
* [options.headersToCheck=['content-length', 'etag', 'last-modified']]
* A list of headers that will be used to determine whether the responses
* differ.
* @param {string} [options.channelName='workbox'] The name that will be used
*. when creating the `BroadcastChannel`, which defaults to 'workbox' (the
* channel name used by the `workbox-window` package).
* @param {string} [options.deferNoticationTimeout=10000] The amount of time
* to wait for a ready message from the window on navigation requests
* before sending the update.
*/
constructor({
headersToCheck,
channelName,
deferNoticationTimeout
} = {}) {
this._headersToCheck = headersToCheck || DEFAULT_HEADERS_TO_CHECK;
this._channelName = channelName || DEFAULT_BROADCAST_CHANNEL_NAME;
this._deferNoticationTimeout = deferNoticationTimeout || DEFAULT_DEFER_NOTIFICATION_TIMEOUT;
{
assert_mjs.assert.isType(this._channelName, 'string', {
moduleName: 'workbox-broadcast-update',
className: 'BroadcastCacheUpdate',
funcName: 'constructor',
paramName: 'channelName'
});
assert_mjs.assert.isArray(this._headersToCheck, {
moduleName: 'workbox-broadcast-update',
className: 'BroadcastCacheUpdate',
funcName: 'constructor',
paramName: 'headersToCheck'
});
}
this._initWindowReadyDeferreds();
}
/**
* Compare two [Responses](https://developer.mozilla.org/en-US/docs/Web/API/Response)
* and send a message via the
* {@link https://developers.google.com/web/updates/2016/09/broadcastchannel|Broadcast Channel API}
* if they differ.
*
* Neither of the Responses can be {@link http://stackoverflow.com/questions/39109789|opaque}.
*
* @param {Object} options
* @param {Response} options.oldResponse Cached response to compare.
* @param {Response} options.newResponse Possibly updated response to compare.
* @param {string} options.url The URL of the request.
* @param {string} options.cacheName Name of the cache the responses belong
* to. This is included in the broadcast message.
* @param {Event} [options.event] event An optional event that triggered
* this possible cache update.
* @return {Promise} Resolves once the update is sent.
*/
notifyIfUpdated({
oldResponse,
newResponse,
url,
cacheName,
event
}) {
if (!responsesAreSame(oldResponse, newResponse, this._headersToCheck)) {
{
logger_mjs.logger.log(`Newer response found (and cached) for:`, url);
}
const sendUpdate = async () => {
// In the case of a navigation request, the requesting page will likely
// not have loaded its JavaScript in time to recevied the update
// notification, so we defer it until ready (or we timeout waiting).
if (event && event.request && event.request.mode === 'navigate') {
{
logger_mjs.logger.debug(`Original request was a navigation request, ` + `waiting for a ready message from the window`, event.request);
}
await this._windowReadyOrTimeout(event);
}
await this._broadcastUpdate({
channel: this._getChannel(),
cacheName,
url
});
}; // Send the update and ensure the SW stays alive until it's sent.
const done = sendUpdate();
if (event) {
try {
event.waitUntil(done);
} catch (error) {
{
logger_mjs.logger.warn(`Unable to ensure service worker stays alive ` + `when broadcasting cache update for ` + `${getFriendlyURL_mjs.getFriendlyURL(event.request.url)}'.`);
}
}
}
return done;
}
}
/**
* NOTE: this is exposed on the instance primarily so it can be spied on
* in tests.
*
* @param {Object} opts
* @private
*/
async _broadcastUpdate(opts) {
await broadcastUpdate(opts);
}
/**
* @return {BroadcastChannel|undefined} The BroadcastChannel instance used for
* broadcasting updates, or undefined if the browser doesn't support the
* Broadcast Channel API.
*
* @private
*/
_getChannel() {
if ('BroadcastChannel' in self && !this._channel) {
this._channel = new BroadcastChannel(this._channelName);
}
return this._channel;
}
/**
* Waits for a message from the window indicating that it's capable of
* receiving broadcasts. By default, this will only wait for the amount of
* time specified via the `deferNoticationTimeout` option.
*
* @param {Event} event The navigation fetch event.
* @return {Promise}
* @private
*/
_windowReadyOrTimeout(event) {
if (!this._navigationEventsDeferreds.has(event)) {
const deferred = new Deferred_mjs.Deferred(); // Set the deferred on the `_navigationEventsDeferreds` map so it will
// be resolved when the next ready message event comes.
this._navigationEventsDeferreds.set(event, deferred); // But don't wait too long for the message since it may never come.
const timeout = setTimeout(() => {
{
logger_mjs.logger.debug(`Timed out after ${this._deferNoticationTimeout}` + `ms waiting for message from window`);
}
deferred.resolve();
}, this._deferNoticationTimeout); // Ensure the timeout is cleared if the deferred promise is resolved.
deferred.promise.then(() => clearTimeout(timeout));
}
return this._navigationEventsDeferreds.get(event).promise;
}
/**
* Creates a mapping between navigation fetch events and deferreds, and adds
* a listener for message events from the window. When message events arrive,
* all deferreds in the mapping are resolved.
*
* Note: it would be easier if we could only resolve the deferred of
* navigation fetch event whose client ID matched the source ID of the
* message event, but currently client IDs are not exposed on navigation
* fetch events: https://www.chromestatus.com/feature/4846038800138240
*
* @private
*/
_initWindowReadyDeferreds() {
// A mapping between navigation events and their deferreds.
this._navigationEventsDeferreds = new Map(); // The message listener needs to be added in the initial run of the
// service worker, but since we don't actually need to be listening for
// messages until the cache updates, we only invoke the callback if set.
self.addEventListener('message', event => {
if (event.data.type === 'WINDOW_READY' && event.data.meta === 'workbox-window' && this._navigationEventsDeferreds.size > 0) {
{
logger_mjs.logger.debug(`Received WINDOW_READY event: `, event);
} // Resolve any pending deferreds.
for (const deferred of this._navigationEventsDeferreds.values()) {
deferred.resolve();
}
this._navigationEventsDeferreds.clear();
}
});
}
}
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
/**
* This plugin will automatically broadcast a message whenever a cached response
* is updated.
*
* @memberof workbox.broadcastUpdate
*/
class Plugin {
/**
* Construct a BroadcastCacheUpdate instance with the passed options and
* calls its `notifyIfUpdated()` method whenever the plugin's
* `cacheDidUpdate` callback is invoked.
*
* @param {Object} options
* @param {Array<string>}
* [options.headersToCheck=['content-length', 'etag', 'last-modified']]
* A list of headers that will be used to determine whether the responses
* differ.
* @param {string} [options.channelName='workbox'] The name that will be used
*. when creating the `BroadcastChannel`, which defaults to 'workbox' (the
* channel name used by the `workbox-window` package).
* @param {string} [options.deferNoticationTimeout=10000] The amount of time
* to wait for a ready message from the window on navigation requests
* before sending the update.
*/
constructor(options) {
this._broadcastUpdate = new BroadcastCacheUpdate(options);
}
/**
* A "lifecycle" callback that will be triggered automatically by the
* `workbox-sw` and `workbox-runtime-caching` handlers when an entry is
* added to a cache.
*
* @private
* @param {Object} options The input object to this function.
* @param {string} options.cacheName Name of the cache being updated.
* @param {Response} [options.oldResponse] The previous cached value, if any.
* @param {Response} options.newResponse The new value in the cache.
* @param {Request} options.request The request that triggered the udpate.
* @param {Request} [options.event] The event that triggered the update.
*/
cacheDidUpdate({
cacheName,
oldResponse,
newResponse,
request,
event
}) {
{
assert_mjs.assert.isType(cacheName, 'string', {
moduleName: 'workbox-broadcast-update',
className: 'Plugin',
funcName: 'cacheDidUpdate',
paramName: 'cacheName'
});
assert_mjs.assert.isInstance(newResponse, Response, {
moduleName: 'workbox-broadcast-update',
className: 'Plugin',
funcName: 'cacheDidUpdate',
paramName: 'newResponse'
});
assert_mjs.assert.isInstance(request, Request, {
moduleName: 'workbox-broadcast-update',
className: 'Plugin',
funcName: 'cacheDidUpdate',
paramName: 'request'
});
}
if (!oldResponse) {
// Without a two responses there is nothing to compare.
return;
}
this._broadcastUpdate.notifyIfUpdated({
cacheName,
oldResponse,
newResponse,
event,
url: request.url
});
}
}
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
exports.BroadcastCacheUpdate = BroadcastCacheUpdate;
exports.Plugin = Plugin;
exports.broadcastUpdate = broadcastUpdate;
exports.responsesAreSame = responsesAreSame;
return exports;
}({}, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private));
//# sourceMappingURL=workbox-broadcast-update.dev.js.map

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -1,2 +0,0 @@
this.workbox=this.workbox||{},this.workbox.broadcastUpdate=function(e,t){"use strict";try{self["workbox:broadcast-update:4.3.1"]&&_()}catch(e){}const s=(e,t,s)=>{return!s.some(s=>e.headers.has(s)&&t.headers.has(s))||s.every(s=>{const n=e.headers.has(s)===t.headers.has(s),a=e.headers.get(s)===t.headers.get(s);return n&&a})},n="workbox",a=1e4,i=["content-length","etag","last-modified"],o=async({channel:e,cacheName:t,url:s})=>{const n={type:"CACHE_UPDATED",meta:"workbox-broadcast-update",payload:{cacheName:t,updatedURL:s}};if(e)e.postMessage(n);else{const e=await clients.matchAll({type:"window"});for(const t of e)t.postMessage(n)}};class c{constructor({headersToCheck:e,channelName:t,deferNoticationTimeout:s}={}){this.t=e||i,this.s=t||n,this.i=s||a,this.o()}notifyIfUpdated({oldResponse:e,newResponse:t,url:n,cacheName:a,event:i}){if(!s(e,t,this.t)){const e=(async()=>{i&&i.request&&"navigate"===i.request.mode&&await this.h(i),await this.l({channel:this.u(),cacheName:a,url:n})})();if(i)try{i.waitUntil(e)}catch(e){}return e}}async l(e){await o(e)}u(){return"BroadcastChannel"in self&&!this.p&&(this.p=new BroadcastChannel(this.s)),this.p}h(e){if(!this.m.has(e)){const s=new t.Deferred;this.m.set(e,s);const n=setTimeout(()=>{s.resolve()},this.i);s.promise.then(()=>clearTimeout(n))}return this.m.get(e).promise}o(){this.m=new Map,self.addEventListener("message",e=>{if("WINDOW_READY"===e.data.type&&"workbox-window"===e.data.meta&&this.m.size>0){for(const e of this.m.values())e.resolve();this.m.clear()}})}}return e.BroadcastCacheUpdate=c,e.Plugin=class{constructor(e){this.l=new c(e)}cacheDidUpdate({cacheName:e,oldResponse:t,newResponse:s,request:n,event:a}){t&&this.l.notifyIfUpdated({cacheName:e,oldResponse:t,newResponse:s,event:a,url:n.url})}},e.broadcastUpdate=o,e.responsesAreSame=s,e}({},workbox.core._private);
//# sourceMappingURL=workbox-broadcast-update.prod.js.map

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -1,200 +0,0 @@
this.workbox = this.workbox || {};
this.workbox.cacheableResponse = (function (exports, WorkboxError_mjs, assert_mjs, getFriendlyURL_mjs, logger_mjs) {
'use strict';
try {
self['workbox:cacheable-response:4.3.1'] && _();
} catch (e) {} // eslint-disable-line
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
/**
* This class allows you to set up rules determining what
* status codes and/or headers need to be present in order for a
* [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
* to be considered cacheable.
*
* @memberof workbox.cacheableResponse
*/
class CacheableResponse {
/**
* To construct a new CacheableResponse instance you must provide at least
* one of the `config` properties.
*
* If both `statuses` and `headers` are specified, then both conditions must
* be met for the `Response` to be considered cacheable.
*
* @param {Object} config
* @param {Array<number>} [config.statuses] One or more status codes that a
* `Response` can have and be considered cacheable.
* @param {Object<string,string>} [config.headers] A mapping of header names
* and expected values that a `Response` can have and be considered cacheable.
* If multiple headers are provided, only one needs to be present.
*/
constructor(config = {}) {
{
if (!(config.statuses || config.headers)) {
throw new WorkboxError_mjs.WorkboxError('statuses-or-headers-required', {
moduleName: 'workbox-cacheable-response',
className: 'CacheableResponse',
funcName: 'constructor'
});
}
if (config.statuses) {
assert_mjs.assert.isArray(config.statuses, {
moduleName: 'workbox-cacheable-response',
className: 'CacheableResponse',
funcName: 'constructor',
paramName: 'config.statuses'
});
}
if (config.headers) {
assert_mjs.assert.isType(config.headers, 'object', {
moduleName: 'workbox-cacheable-response',
className: 'CacheableResponse',
funcName: 'constructor',
paramName: 'config.headers'
});
}
}
this._statuses = config.statuses;
this._headers = config.headers;
}
/**
* Checks a response to see whether it's cacheable or not, based on this
* object's configuration.
*
* @param {Response} response The response whose cacheability is being
* checked.
* @return {boolean} `true` if the `Response` is cacheable, and `false`
* otherwise.
*/
isResponseCacheable(response) {
{
assert_mjs.assert.isInstance(response, Response, {
moduleName: 'workbox-cacheable-response',
className: 'CacheableResponse',
funcName: 'isResponseCacheable',
paramName: 'response'
});
}
let cacheable = true;
if (this._statuses) {
cacheable = this._statuses.includes(response.status);
}
if (this._headers && cacheable) {
cacheable = Object.keys(this._headers).some(headerName => {
return response.headers.get(headerName) === this._headers[headerName];
});
}
{
if (!cacheable) {
logger_mjs.logger.groupCollapsed(`The request for ` + `'${getFriendlyURL_mjs.getFriendlyURL(response.url)}' returned a response that does ` + `not meet the criteria for being cached.`);
logger_mjs.logger.groupCollapsed(`View cacheability criteria here.`);
logger_mjs.logger.log(`Cacheable statuses: ` + JSON.stringify(this._statuses));
logger_mjs.logger.log(`Cacheable headers: ` + JSON.stringify(this._headers, null, 2));
logger_mjs.logger.groupEnd();
const logFriendlyHeaders = {};
response.headers.forEach((value, key) => {
logFriendlyHeaders[key] = value;
});
logger_mjs.logger.groupCollapsed(`View response status and headers here.`);
logger_mjs.logger.log(`Response status: ` + response.status);
logger_mjs.logger.log(`Response headers: ` + JSON.stringify(logFriendlyHeaders, null, 2));
logger_mjs.logger.groupEnd();
logger_mjs.logger.groupCollapsed(`View full response details here.`);
logger_mjs.logger.log(response.headers);
logger_mjs.logger.log(response);
logger_mjs.logger.groupEnd();
logger_mjs.logger.groupEnd();
}
}
return cacheable;
}
}
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
/**
* A class implementing the `cacheWillUpdate` lifecycle callback. This makes it
* easier to add in cacheability checks to requests made via Workbox's built-in
* strategies.
*
* @memberof workbox.cacheableResponse
*/
class Plugin {
/**
* To construct a new cacheable response Plugin instance you must provide at
* least one of the `config` properties.
*
* If both `statuses` and `headers` are specified, then both conditions must
* be met for the `Response` to be considered cacheable.
*
* @param {Object} config
* @param {Array<number>} [config.statuses] One or more status codes that a
* `Response` can have and be considered cacheable.
* @param {Object<string,string>} [config.headers] A mapping of header names
* and expected values that a `Response` can have and be considered cacheable.
* If multiple headers are provided, only one needs to be present.
*/
constructor(config) {
this._cacheableResponse = new CacheableResponse(config);
}
/**
* @param {Object} options
* @param {Response} options.response
* @return {boolean}
* @private
*/
cacheWillUpdate({
response
}) {
if (this._cacheableResponse.isResponseCacheable(response)) {
return response;
}
return null;
}
}
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
exports.CacheableResponse = CacheableResponse;
exports.Plugin = Plugin;
return exports;
}({}, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private));
//# sourceMappingURL=workbox-cacheable-response.dev.js.map

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -1,2 +0,0 @@
this.workbox=this.workbox||{},this.workbox.cacheableResponse=function(t){"use strict";try{self["workbox:cacheable-response:4.3.1"]&&_()}catch(t){}class s{constructor(t={}){this.t=t.statuses,this.s=t.headers}isResponseCacheable(t){let s=!0;return this.t&&(s=this.t.includes(t.status)),this.s&&s&&(s=Object.keys(this.s).some(s=>t.headers.get(s)===this.s[s])),s}}return t.CacheableResponse=s,t.Plugin=class{constructor(t){this.i=new s(t)}cacheWillUpdate({response:t}){return this.i.isResponseCacheable(t)?t:null}},t}({});
//# sourceMappingURL=workbox-cacheable-response.prod.js.map

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше