-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathanalytics.d.ts
72 lines (72 loc) · 2.58 KB
/
analytics.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**
* @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 { analytics } from '@angular-devkit/core';
import { Compiler, Module, Stats, compilation } from 'webpack';
import { Source } from 'webpack-sources';
import Compilation = compilation.Compilation;
declare const NormalModule: any;
interface NormalModule extends Module {
_source?: Source | null;
resource?: string;
}
/**
* Faster than using a RegExp, so we use this to count occurences in source code.
* @param source The source to look into.
* @param match The match string to look for.
* @param wordBreak Whether to check for word break before and after a match was found.
* @return The number of matches found.
* @private
*/
export declare function countOccurrences(source: string, match: string, wordBreak?: boolean): number;
/**
* Holder of statistics related to the build.
*/
declare class AnalyticsBuildStats {
errors: string[];
numberOfNgOnInit: number;
initialChunkSize: number;
totalChunkCount: number;
totalChunkSize: number;
lazyChunkCount: number;
lazyChunkSize: number;
assetCount: number;
assetSize: number;
polyfillSize: number;
cssSize: number;
}
/**
* Analytics plugin that reports the analytics we want from the CLI.
*/
export declare class NgBuildAnalyticsPlugin {
protected _projectRoot: string;
protected _analytics: analytics.Analytics;
protected _category: string;
protected _built: boolean;
protected _stats: AnalyticsBuildStats;
constructor(_projectRoot: string, _analytics: analytics.Analytics, _category: string);
protected _reset(): void;
protected _getMetrics(stats: Stats): (string | number)[];
protected _getDimensions(stats: Stats): (string | number)[];
protected _reportBuildMetrics(stats: Stats): void;
protected _reportRebuildMetrics(stats: Stats): void;
protected _checkTsNormalModule(module: NormalModule): void;
protected _collectErrors(stats: Stats): void;
protected _collectBundleStats(json: any): void;
/************************************************************************************************
* The next section is all the different Webpack hooks for this plugin.
*/
/**
* Reports a succeed module.
* @private
*/
protected _succeedModule(mod: Module): void;
protected _compilation(compiler: Compiler, compilation: Compilation): void;
protected _done(stats: Stats): void;
apply(compiler: Compiler): void;
}
export {};