Skip to content

Commit

Permalink
refactor: address comments in code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Rickabaugh committed Jul 4, 2017
1 parent 6fe895e commit 5c3f29a
Show file tree
Hide file tree
Showing 41 changed files with 326 additions and 78 deletions.
8 changes: 8 additions & 0 deletions integration/service-worker/e2e/server/page-object.ts
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import {browser, by, element, protractor} from 'protractor';

export class HarnessPageObject {
Expand Down
8 changes: 8 additions & 0 deletions integration/service-worker/e2e/server/server.ts
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import express = require('express');

export function create(port: number, harnessPath: string): Promise<Server> {
Expand Down
8 changes: 8 additions & 0 deletions integration/service-worker/e2e/test/sanity_e2e.ts
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import {create, Server} from '../server/server';
import {HarnessPageObject} from '../server/page-object';

Expand Down
4 changes: 2 additions & 2 deletions integration/service-worker/protractor.config.js
Expand Up @@ -32,9 +32,9 @@ exports.config = {
},

/**
* ng2 related configuration
* Angular related configuration
*
* useAllAngular2AppRoots: tells Protractor to wait for any angular2 apps on the page instead of just the one matching
* useAllAngular2AppRoots: tells Protractor to wait for any Angular apps on the page instead of just the one matching
* `rootEl`
*
*/
Expand Down
2 changes: 1 addition & 1 deletion integration/service-worker/src/app/app.component.html
@@ -1,2 +1,2 @@
<h1>Service Worker Testing Harness</h1>
<controller></controller>
<test-controller></test-controller>
8 changes: 8 additions & 0 deletions integration/service-worker/src/app/app.component.ts
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import { Component } from '@angular/core';

@Component({
Expand Down
10 changes: 9 additions & 1 deletion integration/service-worker/src/app/controller.component.ts
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import {Component} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {NgswModule, NgswPush, NgswUpdate, NgswDebug, NgswAppVersion} from '@angular/service-worker';
Expand All @@ -10,7 +18,7 @@ import 'rxjs/add/operator/startWith';
import 'rxjs/add/operator/take';

@Component({
selector: 'controller',
selector: 'test-controller',
template: `
<!-- Action selection -->
<div>
Expand Down
8 changes: 8 additions & 0 deletions integration/service-worker/src/main.ts
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

Expand Down
8 changes: 8 additions & 0 deletions integration/service-worker/src/polyfills.ts
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
Expand Down
8 changes: 8 additions & 0 deletions integration/service-worker/src/test.ts
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

// This file is required by karma.conf.js and loads recursively all the .spec and framework files

import 'zone.js/dist/long-stack-trace-zone';
Expand Down
8 changes: 8 additions & 0 deletions packages/service-worker/sdk/plugins/index.ts
@@ -1 +1,9 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

export * from './public_api';
11 changes: 10 additions & 1 deletion packages/service-worker/sdk/plugins/public_api.ts
@@ -1,7 +1,16 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

export {Dynamic} from './src/dynamic/dynamic';
export {DynamicStrategy} from './src/dynamic/group';
export {FreshnessCacheConfig, FreshnessStrategy} from './src/dynamic/strategy/freshness';
export {PerformanceCacheConfig, PerformanceStrategy} from './src/dynamic/strategy/performance';
export {ExternalContentCache, ExternalContentCacheOptions} from './src/external/external';
export {Push} from './src/push/push';
export {RouteRedirection} from './src/routing/routing';
export {StaticContentCache, StaticContentCacheOptions} from './src/static/static';
export {StaticContentCache} from './src/static/static';
8 changes: 8 additions & 0 deletions packages/service-worker/sdk/plugins/src/dynamic/dynamic.ts
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import {FetchDelegate, FetchInstruction, NgSwCache, Operation, Plugin, PluginFactory, ScopedCache, UrlMatcher, VersionWorker, VersionWorkerImpl} from '@angular/service-worker/sdk';

import {DynamicGroup, DynamicStrategy, DynamicStrategyMap, ResponseWithSideEffect} from './group';
Expand Down
8 changes: 8 additions & 0 deletions packages/service-worker/sdk/plugins/src/dynamic/group.ts
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import {Clock, NgSwAdapter, NgSwCache, ScopedCache, UrlConfig, UrlMatcher} from '@angular/service-worker/sdk';

import {CompareFn, SortedLinkedList} from './linked';
Expand Down
8 changes: 8 additions & 0 deletions packages/service-worker/sdk/plugins/src/dynamic/linked.ts
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

/**
* A node in in the linked list, with references to the next and previous nodes.
*
Expand Down
8 changes: 8 additions & 0 deletions packages/service-worker/sdk/plugins/src/dynamic/manifest.ts
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import {UrlConfig} from '@angular/service-worker/sdk';

/**
Expand Down
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import {Clock} from '@angular/service-worker/sdk';
import {DynamicGroup, DynamicStrategy, ResponseWithSideEffect, maybeRun} from '../group';
import {CacheConfig} from '../manifest';
Expand Down
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import {DynamicGroup, DynamicStrategy, ResponseWithSideEffect, maybeRun} from '../group';
import {CacheConfig} from '../manifest';

Expand Down
8 changes: 8 additions & 0 deletions packages/service-worker/sdk/plugins/src/external/external.ts
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import {FetchInstruction, Operation, Plugin, PluginFactory, VersionWorker, VersionWorkerImpl, cacheFromNetworkOp, fetchFromCacheInstruction,} from '@angular/service-worker/sdk';

interface UrlConfig {
Expand Down
8 changes: 8 additions & 0 deletions packages/service-worker/sdk/plugins/src/routing/routing.ts
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import {rewriteUrlInstruction, FetchInstruction, Operation, Plugin, PluginFactory, VersionWorker, UrlConfig, UrlMatcher,} from '@angular/service-worker/sdk';

interface RouteMap {
Expand Down
15 changes: 9 additions & 6 deletions packages/service-worker/sdk/plugins/src/static/static.ts
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import {FetchInstruction, LOG, Operation, Plugin, PluginFactory, Verbosity, VersionWorker, cacheFromNetworkOp, copyExistingOrFetchOp, deleteCacheOp, fetchFromCacheInstruction} from '@angular/service-worker/sdk';

interface UrlToHashMap {
Expand All @@ -12,12 +20,7 @@ interface StaticManifest {
/**
* @experimental
*/
export interface StaticContentCacheOptions { manifestKey?: string; }

/**
* @experimental
*/
export function StaticContentCache(options?: StaticContentCacheOptions):
export function StaticContentCache(options?: {manifestKey?: string;}):
PluginFactory<StaticContentCacheImpl> {
const manifestKey = (options && options.manifestKey) || 'static';
return (worker: VersionWorker) => new StaticContentCacheImpl(worker, manifestKey);
Expand Down
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import {NgSwAdapter, NgSwCacheImpl} from '@angular/service-worker/sdk';
import {MockCacheStorage, MockClock, TestAdapter} from '@angular/service-worker/sdk/testing';

Expand Down
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import {SortedLinkedList} from '../../src/dynamic/linked';

function compareNumbers(a: number, b: number): number {
Expand Down
2 changes: 1 addition & 1 deletion packages/service-worker/sdk/public_api.ts
@@ -1,5 +1,5 @@
export {FetchDelegate, FetchInstruction, Operation, Plugin, PluginFactory, VersionWorker} from './src/api';
export {BootstrapOptions, bootstrapServiceWorker} from './src/bootstrap';
export {bootstrapServiceWorker} from './src/bootstrap';
export {ScopedCache} from './src/cache';
export {cacheFromNetworkOp, copyExistingCacheOp, copyExistingOrFetchOp, deleteCacheOp, fetchFromCacheInstruction, fetchFromNetworkInstruction, rewriteUrlInstruction} from './src/common';
export {Driver, DriverState} from './src/driver';
Expand Down
13 changes: 3 additions & 10 deletions packages/service-worker/sdk/src/bootstrap.ts
Expand Up @@ -56,17 +56,10 @@ class NgSwBrowserAdapter implements NgSwAdapter {
/**
* @experimental
*/
export interface BootstrapOptions {
manifestUrl?: string;
plugins?: PluginFactory<any>[];
logLevel?: Verbosity;
export function bootstrapServiceWorker(options?: {
manifestUrl?: string; plugins?: PluginFactory<any>[]; logLevel?: Verbosity;
logHandlers?: LogHandler[];
}

/**
* @experimental
*/
export function bootstrapServiceWorker(options?: BootstrapOptions): Driver {
}): Driver {
const manifestUrl = (options && options.manifestUrl) || '/ngsw-manifest.json';
const plugins = (options && options.plugins) || [];

Expand Down
8 changes: 8 additions & 0 deletions packages/service-worker/sdk/src/facade/adapter.ts
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

/**
* @experimental
*/
Expand Down
8 changes: 8 additions & 0 deletions packages/service-worker/sdk/src/facade/cache.ts
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import {NgSwAdapter} from './adapter';

/**
Expand Down
8 changes: 8 additions & 0 deletions packages/service-worker/sdk/src/facade/events.ts
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

/**
* @experimental
*/
Expand Down
8 changes: 8 additions & 0 deletions packages/service-worker/sdk/src/facade/fetch.ts
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import {NgSwAdapter} from './adapter';

/**
Expand Down
8 changes: 8 additions & 0 deletions packages/service-worker/sdk/src/fsa.ts
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

const protocolVersion = 1;
const worker = 'ngsw';

Expand Down
8 changes: 8 additions & 0 deletions packages/service-worker/sdk/src/sha1.ts
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

/**
* Compute the SHA1 of the given string
*
Expand Down

0 comments on commit 5c3f29a

Please sign in to comment.