forked from leebenson/reactql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoutput.ts
45 lines (35 loc) · 1.06 KB
/
output.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
/*
An `Output` instance is passed through to the Webpack entry point,
when is then responsible for orchestrating middleware, routes or other
functions within the Webpack'd environment
*/
// ----------------------------------------------------------------------------
// IMPORTS
/* Local */
import Stats from "./stats";
// ----------------------------------------------------------------------------
// Types
export interface IOutput {
client: Stats;
server: Stats;
}
// Config cache
const config = new WeakMap<Output, IOutput>();
export default class Output {
// --------------------------------------------------------------------------
/* PUBLIC METHODS */
// --------------------------------------------------------------------------
/* CONSTRUCTOR */
public constructor(c: IOutput) {
config.set(this, c);
}
/* GETTERS */
// Return the Webpack client build stats
public get client() {
return config.get(this)!.client;
}
// Return the Webpack server build stats
public get server() {
return config.get(this)!.server;
}
}