5
5
* Use of this source code is governed by an MIT-style license that can be
6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
- // tslint:disable
9
8
// TODO: cleanup this file, it's copied as is from Angular CLI.
10
- import { Path , join , normalize , virtualFs , dirname , getSystemPath , tags , fragment } from '@angular-devkit/core' ;
11
- import { Filesystem } from '@angular/service-worker/config' ;
9
+ import {
10
+ Path ,
11
+ dirname ,
12
+ getSystemPath ,
13
+ join ,
14
+ normalize ,
15
+ tags ,
16
+ virtualFs ,
17
+ } from '@angular-devkit/core' ;
18
+ import {
19
+ Filesystem ,
20
+ Generator ,
21
+ } from '@angular/service-worker/config' ; // tslint:disable-line:no-implicit-dependencies
12
22
import * as crypto from 'crypto' ;
13
23
import * as fs from 'fs' ;
24
+ import { Observable , from , merge , of } from 'rxjs' ;
25
+ import { concatMap , map , mergeMap , reduce , switchMap , toArray } from 'rxjs/operators' ;
14
26
import * as semver from 'semver' ;
15
-
16
27
import { resolveProjectModule } from '../require-project-module' ;
17
- import { map , reduce , switchMap , concatMap , mergeMap , toArray , tap } from "rxjs/operators" ;
18
- import { Observable , merge , of , from } from "rxjs" ;
19
28
20
29
21
30
export const NEW_SW_VERSION = '5.0.0-rc.0' ;
@@ -32,8 +41,8 @@ class CliFilesystem implements Filesystem {
32
41
map ( fragment => join ( path , fragment ) ) ,
33
42
// Emit directory content paths instead of the directory path.
34
43
mergeMap ( path => this . _host . isDirectory ( path ) . pipe (
35
- concatMap ( isDir => isDir ? recursiveList ( path ) : of ( path ) )
36
- )
44
+ concatMap ( isDir => isDir ? recursiveList ( path ) : of ( path ) ) ,
45
+ ) ,
37
46
) ,
38
47
) ;
39
48
@@ -133,14 +142,15 @@ export function augmentAppWithServiceWorker(
133
142
} ) ,
134
143
map ( content => JSON . parse ( virtualFs . fileBufferToString ( content ) ) ) ,
135
144
switchMap ( configJson => {
136
- const Generator = require ( swConfigPath ) . Generator ;
137
- const gen = new Generator ( new CliFilesystem ( host , outputPath ) , baseHref ) ;
145
+ const GeneratorConstructor = require ( swConfigPath ) . Generator as typeof Generator ;
146
+ const gen = new GeneratorConstructor ( new CliFilesystem ( host , outputPath ) , baseHref ) ;
138
147
139
148
return gen . process ( configJson ) ;
140
149
} ) ,
141
150
142
151
switchMap ( output => {
143
152
const manifest = JSON . stringify ( output , null , 2 ) ;
153
+
144
154
return host . read ( workerPath ) . pipe (
145
155
switchMap ( workerCode => {
146
156
return merge (
0 commit comments