Skip to content
Permalink

Comparing changes

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

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: GoogleChrome/workbox
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a95b6fd489c2a66574f1655b2de3acd2ece35fb3
Choose a base ref
...
head repository: GoogleChrome/workbox
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 9cbed278b992717195406fe077933a578142f5ed
Choose a head ref
Loading
Showing 331 changed files with 20,392 additions and 16,128 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
**Prior to filing a PR, please:**
- [open an issue](https://github.com/GoogleChrome/workbox/issues/new) to discuss your proposed change.
- ensure that `gulp lint test` passes locally.
- ensure that `gulp build && gulp lint test` passes locally.

R: @jeffposnick @philipwalton

10 changes: 5 additions & 5 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -18,15 +18,14 @@ jobs:
- uses: actions/setup-node@v1
with:
node-version: 8.x
node-version: 10.x

- name: Setup
run: |
# Use `npm i` to work around https://github.com/npm/cli/issues/558
npm i
gulp build
npm ci
npx gulp build
- run: npx gulp test-node
- run: npx gulp test_node

Full_Suite_Mac:
runs-on: macos-latest
@@ -54,5 +53,6 @@ jobs:
run: |
sudo safaridriver --enable
npm ci
npx gulp build
- run: npx gulp test
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -21,12 +21,11 @@ firebase-debug.log
# Generated TypeScript files and build data
tsconfig.tsbuildinfo
packages/workbox-*/**/*.d.ts
!packages/workbox-cli/src/index.d.ts
packages/workbox-*/**/*.js
!packages/workbox-build/**/*.js
!packages/workbox-cli/**/*.js
!packages/workbox-webpack-plugin/**/*.js


# Individual package ignores during TypeScript migration
packages/workbox-background-sync/**/*.mjs
packages/workbox-broadcast-update/**/*.mjs
@@ -37,6 +36,7 @@ packages/workbox-google-analytics/**/*.mjs
packages/workbox-navigation-preload/**/*.mjs
packages/workbox-precaching/**/*.mjs
packages/workbox-range-requests/**/*.mjs
packages/workbox-recipes/**/*.mjs
packages/workbox-routing/**/*.mjs
packages/workbox-strategies/**/*.mjs
packages/workbox-streams/**/*.mjs
16 changes: 16 additions & 0 deletions .ncurc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// We use `npx npm-check-updates` to find updates to dependencies.
// Some dependencies have breaking changes that we can't resolve.
// This config file excludes those dependencies from the checks
// until we're able to remediate our code to deal with them.

module.exports = {
reject: [
// See https://github.com/GoogleChrome/workbox/issues/2479
'@octokit/rest',
'rollup',
'service-worker-mock',
// See https://github.com/GoogleChrome/workbox/issues/2602
'@typescript-eslint/eslint-plugin',
'@typescript-eslint/parser',
],
};
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
# Welcome to Workbox!

Workbox is a collection of JavaScript libraries for
[Progressive Web Apps](https://developers.google.com/web/progressive-web-apps/).
[Progressive Web Apps](https://web.dev/progressive-web-apps/).

## Documentation

Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ <h1>workbox-background-sync Demo</h1>

<script>
document.querySelector('.fetch').addEventListener('click', () => {
fetch('./example.txt');
fetch('example.txt');
});

navigator.serviceWorker.register('./sw.js');
15 changes: 15 additions & 0 deletions demos/src/workbox-background-sync-demo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "workbox-background-sync",
"version": "1.0.0",
"description": "Workbox Background Sync Demo Git Listener",
"scripts": {
"start": "node updateServer.js"
},
"dependencies": {
"express": "^4.17.1"
},
"engines": {
"node": "8.x"
},
"license": "MIT"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.0.0/workbox-sw.js');
importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js');

// Note: Ignore the error that Glitch raises about workbox being undefined.
workbox.setConfig({
41 changes: 41 additions & 0 deletions demos/src/workbox-background-sync-demo/updateServer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const express = require('express');
const app = express();
const path = require('path');

app.get('/', (request, response) => {
response.sendFile(path.resolve('index.html'));
});

app.get('/sw.js', (request, response) => {
response.sendFile(path.resolve('sw.js'));
});

app.use(express.static('public'));

/* /////////////////////////////////////////////////////////////////////////////
The code below this comment is unrelated to the demo and used for maintenance
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
/////////////////////////////////////////////////////////////////////////////*/

const {execSync} = require('child_process');
const bodyParser = require('body-parser');

app.use(bodyParser.json());

app.post('/deploy', (request, response) => {
if (request.query.secret !== process.env.SECRET) {
response.status(401).send();
return;
}

const repoUrl = request.query.repo;
execSync(
`git checkout -- ./ && git pull -X theirs ${repoUrl} ` +
`glitch && refresh && git branch -D glitch`,
);
response.status(200).send();
});

const listener = app.listen(process.env.PORT, function() {
console.log('Your app is listening on port ' + listener.address().port);
});
15 changes: 15 additions & 0 deletions demos/src/workbox-broadcast-update-demo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "workbox-broadcast-update",
"version": "1.0.0",
"description": "Workbox Broadcast Update Demo Git Listener",
"scripts": {
"start": "node updateServer.js"
},
"dependencies": {
"express": "^4.17.1"
},
"engines": {
"node": "8.x"
},
"license": "MIT"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.0.0/workbox-sw.js');
importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js');

workbox.setConfig({
debug: true,
41 changes: 41 additions & 0 deletions demos/src/workbox-broadcast-update-demo/updateServer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const express = require('express');
const app = express();
const path = require('path');

app.get('/', (request, response) => {
response.sendFile(path.resolve('index.html'));
});

app.get('/sw.js', (request, response) => {
response.sendFile(path.resolve('sw.js'));
});

app.use(express.static('public'));

/* /////////////////////////////////////////////////////////////////////////////
The code below this comment is unrelated to the demo and used for maintenance
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
/////////////////////////////////////////////////////////////////////////////*/

const {execSync} = require('child_process');
const bodyParser = require('body-parser');

app.use(bodyParser.json());

app.post('/deploy', (request, response) => {
if (request.query.secret !== process.env.SECRET) {
response.status(401).send();
return;
}

const repoUrl = request.query.repo;
execSync(
`git checkout -- ./ && git pull -X theirs ${repoUrl} ` +
`glitch && refresh && git branch -D glitch`,
);
response.status(200).send();
});

const listener = app.listen(process.env.PORT, function() {
console.log('Your app is listening on port ' + listener.address().port);
});
39 changes: 15 additions & 24 deletions demos/src/workbox-cacheable-response/package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
{
"name": "hello-express",
"version": "0.0.1",
"description": "A simple Node app built on Express, instantly up and running.",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"express": "^4.16.4"
},
"engines": {
"node": "8.x"
},
"repository": {
"url": "https://glitch.com/edit/#!/hello-express"
},
"license": "MIT",
"keywords": [
"node",
"glitch",
"express"
]
}

"name": "workbox-cacheable-response",
"version": "1.0.0",
"description": "Workbox Cacheable Response Demo Listener",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"express": "^4.17.1"
},
"engines": {
"node": "8.x"
},
"license": "MIT"
}
25 changes: 25 additions & 0 deletions demos/src/workbox-cacheable-response/server.js
Original file line number Diff line number Diff line change
@@ -33,3 +33,28 @@ app.get('/api/is-response-cacheable',
}
},
);


/* /////////////////////////////////////////////////////////////////////////////
The code below this comment is unrelated to the demo and used for maintenance
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
/////////////////////////////////////////////////////////////////////////////*/

const {execSync} = require('child_process');
const bodyParser = require('body-parser');

app.use(bodyParser.json());

app.post('/deploy', (request, response) => {
if (request.query.secret !== process.env.SECRET) {
response.status(401).send();
return;
}

const repoUrl = request.query.repo;
execSync(
`git checkout -- ./ && git pull -X theirs ${repoUrl} ` +
`glitch && refresh && git branch -D glitch`,
);
response.status(200).send();
});
2 changes: 1 addition & 1 deletion demos/src/workbox-cacheable-response/sw.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.0.0/workbox-sw.js');
importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js');

workbox.setConfig({
debug: true,
2 changes: 1 addition & 1 deletion demos/src/workbox-core/index.html
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ <h1>workbox-core demo</h1>

installSWBtn.addEventListener('click', () => {
console.log("Installing service worker");
navigator.serviceWorker.register('./sw.js')
navigator.serviceWorker.register('/sw.js')
.then((reg) => {
showLogsBtn.addEventListener('click', () => {
const message = {
15 changes: 15 additions & 0 deletions demos/src/workbox-core/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "workbox-core",
"version": "1.0.0",
"description": "Workbox Core Demo Git Listener",
"scripts": {
"start": "node updateServer.js"
},
"dependencies": {
"express": "^4.17.1"
},
"engines": {
"node": "8.x"
},
"license": "MIT"
}
7 changes: 4 additions & 3 deletions demos/src/workbox-core/sw.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.0.0/workbox-sw.js');
// To avoid async issues, we load core before we call it in the callback
workbox.loadModule('workbox-core');
importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js');

// Note: Ignore the error that Glitch raises about workbox being undefined.
workbox.setConfig({
debug: true,
});

// To avoid async issues, we load core before we call it in the callback
workbox.loadModule('workbox-core');

const printLogs = () => {
// ☠️ You should never so this - this is just so we can show off our logging.
workbox.core._private.logger.debug(`🐛 Oh hai! I'm a debug message.`);
39 changes: 39 additions & 0 deletions demos/src/workbox-core/updateServer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const express = require('express');
const app = express();
const path = require('path');

app.get('/', (request, response) => {
response.sendFile(path.resolve('index.html'));
});

app.get('/sw.js', (request, response) => {
response.sendFile(path.resolve('sw.js'));
});

/* /////////////////////////////////////////////////////////////////////////////
The code below this comment is unrelated to the demo and used for maintenance
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
///////////////////////////////////////////////////////////////////////////// */

const {execSync} = require('child_process');
const bodyParser = require('body-parser');

app.use(bodyParser.json());

app.post('/deploy', (request, response) => {
if (request.query.secret !== process.env.SECRET) {
response.status(401).send();
return;
}

const repoUrl = request.query.repo;
execSync(
`git checkout -- ./ && git pull -X theirs ${repoUrl} ` +
`glitch && refresh && git branch -D glitch`,
);
response.status(200).send();
});

const listener = app.listen(process.env.PORT, function() {
console.log('Your app is listening on port ' + listener.address().port);
});
15 changes: 15 additions & 0 deletions demos/src/workbox-expiration/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "workbox-expiration",
"version": "1.0.0",
"description": "Workbox Expiration Demo Git Listener",
"scripts": {
"start": "node updateServer.js"
},
"dependencies": {
"express": "^4.17.1"
},
"engines": {
"node": "8.x"
},
"license": "MIT"
}
Loading