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
alxhub committed Jul 6, 2017
1 parent 6fe895e commit b25b0b7
Show file tree
Hide file tree
Showing 56 changed files with 440 additions and 77 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
3 changes: 2 additions & 1 deletion integration/service-worker/package.json
Expand Up @@ -42,6 +42,7 @@
"protractor": "file:../../node_modules/protractor",
"ts-node": "~3.0.4",
"tslint": "~5.3.2",
"typescript": "~2.3.3"
"typescript": "~2.3.3",
"webdriver-manager": "12.0.6"
}
}
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/build/gulp/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';
8 changes: 8 additions & 0 deletions packages/service-worker/build/gulp/public_api.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 {GulpAddStaticFileOptions, gulpAddStaticFiles, gulpGenerateManifest} from '@angular/service-worker/build';
8 changes: 8 additions & 0 deletions packages/service-worker/build/src/gulp.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 * as crypto from 'crypto';
import * as stream from 'stream';
import * as Vinyl from 'vinyl';
Expand Down
8 changes: 8 additions & 0 deletions packages/service-worker/build/src/webpack.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 * as crypto from 'crypto';

export interface SwPluginConfig {
Expand Down
8 changes: 8 additions & 0 deletions packages/service-worker/build/webpack/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';
8 changes: 8 additions & 0 deletions packages/service-worker/build/webpack/public_api.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 {AngularServiceWorkerPlugin, SwPluginConfig} from '@angular/service-worker/build';
8 changes: 8 additions & 0 deletions packages/service-worker/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';
8 changes: 8 additions & 0 deletions packages/service-worker/public_api.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
*/

export {NgswDebug} from './src/debug';
export {NgswModule} from './src/module';
export {NgswPush} from './src/push';
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

0 comments on commit b25b0b7

Please sign in to comment.