Skip to content

Commit

Permalink
Merge pull request #85 from xwp/add/sw-streaming
Browse files Browse the repository at this point in the history
Add service worker streaming
  • Loading branch information
westonruter authored Oct 19, 2018
2 parents 600240f + 65d74ca commit f647214
Show file tree
Hide file tree
Showing 15 changed files with 793 additions and 236 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"es6": true
},
"parserOptions": {
"ecmaVersion": 8
"ecmaVersion": 2018
}
}
3 changes: 2 additions & 1 deletion .jshintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
wp-includes/js/service-worker.js
wp-includes/js/service-worker-error-response-handling.js
wp-includes/js/service-worker-navigation-routing.js
wp-includes/js/service-worker-precaching.js
wp-includes/js/service-worker-stream-combiner.js
7 changes: 7 additions & 0 deletions .phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
<rule ref="PHPCompatibilityWP">
<exclude-pattern>bin/*</exclude-pattern>
</rule>

<rule ref="WordPress.NamingConventions.ValidVariableName">
<properties>
<property name="customPropertiesWhitelist" value="childNodes,tagName,textContent,parentNode,nodeType,nodeName,nextSibling,firstChild,lastChild,nodeValue,DEFAULT_ARGS,documentElement,removeChild,ownerDocument,DEFAULT_WIDTH,DEFAULT_HEIGHT" />
</properties>
</rule>

<!-- For help in understanding this testVersion:
https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
<config name="testVersion" value="5.2-"/>
Expand Down
2 changes: 1 addition & 1 deletion amp/class-amp-service-worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function add_image_runtime_caching( $service_workers ) {
'/wp-content/.*\.(?:png|gif|jpg|jpeg|svg|webp)(\?.*)?$',
array(
'strategy' => WP_Service_Worker_Caching_Routes::STRATEGY_CACHE_FIRST,
'cacheName' => 'images',
'cacheName' => 'images', // @todo This needs to get the proper prefix in JS.
'plugins' => array(
'cacheableResponse' => array(
'statuses' => array( 0, 200 ),
Expand Down
2 changes: 1 addition & 1 deletion pwa.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

/** WP_Service_Worker_Component Implementation Classes */
require_once PWA_PLUGIN_DIR . '/wp-includes/components/class-wp-service-worker-configuration-component.php';
require_once PWA_PLUGIN_DIR . '/wp-includes/components/class-wp-service-worker-error-response-component.php';
require_once PWA_PLUGIN_DIR . '/wp-includes/components/class-wp-service-worker-navigation-routing-component.php';
require_once PWA_PLUGIN_DIR . '/wp-includes/components/class-wp-service-worker-precaching-routes-component.php';
require_once PWA_PLUGIN_DIR . '/wp-includes/components/class-wp-service-worker-precaching-routes.php';
require_once PWA_PLUGIN_DIR . '/wp-includes/components/class-wp-service-worker-caching-routes-component.php';
Expand Down
18 changes: 9 additions & 9 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
![Banner](wp-assets/banner-1544x500.png)
WordPress feature plugin to bring Progressive Web App (PWA) capabilities to Core

**Contributors:** [xwp](https://profiles.wordpress.org/xwp), [google](https://profiles.wordpress.org/google), [automattic](https://profiles.wordpress.org/automattic)
**Tags:** [pwa](https://wordpress.org/plugins/tags/pwa), [progressive web apps](https://wordpress.org/plugins/tags/progressive-web-apps), [service workers](https://wordpress.org/plugins/tags/service-workers), [web app manifest](https://wordpress.org/plugins/tags/web-app-manifest), [https](https://wordpress.org/plugins/tags/https)
**Requires at least:** 4.9
**Tested up to:** 4.9
**Stable tag:** 0.1.0
**License:** [GPLv2 or later](http://www.gnu.org/licenses/gpl-2.0.html)
**Requires PHP:** 5.2

[![Build Status](https://travis-ci.org/xwp/pwa-wp.svg?branch=master)](https://travis-ci.org/xwp/pwa-wp) [![Built with Grunt](https://cdn.gruntjs.com/builtwith.svg)](http://gruntjs.com)
**Contributors:** [xwp](https://profiles.wordpress.org/xwp), [google](https://profiles.wordpress.org/google), [automattic](https://profiles.wordpress.org/automattic)
**Tags:** [pwa](https://wordpress.org/plugins/tags/pwa), [progressive web apps](https://wordpress.org/plugins/tags/progressive-web-apps), [service workers](https://wordpress.org/plugins/tags/service-workers), [web app manifest](https://wordpress.org/plugins/tags/web-app-manifest), [https](https://wordpress.org/plugins/tags/https)
**Requires at least:** 4.9
**Tested up to:** 4.9
**Stable tag:** 0.1.0
**License:** [GPLv2 or later](http://www.gnu.org/licenses/gpl-2.0.html)
**Requires PHP:** 5.2

[![Build Status](https://travis-ci.org/xwp/pwa-wp.svg?branch=master)](https://travis-ci.org/xwp/pwa-wp) [![Built with Grunt](https://cdn.gruntjs.com/builtwith.svg)](http://gruntjs.com)

## Description ##

Expand Down
8 changes: 4 additions & 4 deletions wp-includes/class-wp-service-workers.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ class WP_Service_Workers implements WP_Service_Worker_Registry_Aware {
*/
public function __construct() {
$components = array(
'configuration' => new WP_Service_Worker_Configuration_Component(),
'error_response' => new WP_Service_Worker_Error_Response_Component(),
'precaching_routes' => new WP_Service_Worker_Precaching_Routes_Component(),
'caching_routes' => new WP_Service_Worker_Caching_Routes_Component(),
'configuration' => new WP_Service_Worker_Configuration_Component(),
'navigation_routing' => new WP_Service_Worker_Navigation_Routing_Component(),
'precaching_routes' => new WP_Service_Worker_Precaching_Routes_Component(),
'caching_routes' => new WP_Service_Worker_Caching_Routes_Component(),
);

$this->scripts = new WP_Service_Worker_Scripts( $components );
Expand Down

This file was deleted.

Loading

0 comments on commit f647214

Please sign in to comment.