1 | "use strict";
|
2 | var Env = (function () {
|
3 | function Env(_a) {
|
4 | var _b = _a.target, target = _b === void 0 ? 'client' : _b, _c = _a.mode, mode = _c === void 0 ? 'production' : _c;
|
5 | this.target = target;
|
6 | this.mode = mode;
|
7 | }
|
8 | Object.defineProperty(Env.prototype, "isClient", {
|
9 | get: function () { return this.target === 'client'; },
|
10 | enumerable: true,
|
11 | configurable: true
|
12 | });
|
13 | Object.defineProperty(Env.prototype, "isServer", {
|
14 | get: function () { return this.target === 'server'; },
|
15 | enumerable: true,
|
16 | configurable: true
|
17 | });
|
18 | Object.defineProperty(Env.prototype, "isProduction", {
|
19 | get: function () { return this.mode === 'production'; },
|
20 | enumerable: true,
|
21 | configurable: true
|
22 | });
|
23 | Object.defineProperty(Env.prototype, "isDevelopment", {
|
24 | get: function () { return this.mode === 'development'; },
|
25 | enumerable: true,
|
26 | configurable: true
|
27 | });
|
28 | Object.defineProperty(Env.prototype, "isDevelopmentClient", {
|
29 | get: function () { return this.isDevelopment && this.isClient; },
|
30 | enumerable: true,
|
31 | configurable: true
|
32 | });
|
33 | Object.defineProperty(Env.prototype, "isProductionClient", {
|
34 | get: function () { return this.isProduction && this.isClient; },
|
35 | enumerable: true,
|
36 | configurable: true
|
37 | });
|
38 | Object.defineProperty(Env.prototype, "isDevelopmentServer", {
|
39 | get: function () { return this.isDevelopment && this.isServer; },
|
40 | enumerable: true,
|
41 | configurable: true
|
42 | });
|
43 | Object.defineProperty(Env.prototype, "isProductionServer", {
|
44 | get: function () { return this.isProduction && this.isServer; },
|
45 | enumerable: true,
|
46 | configurable: true
|
47 | });
|
48 | Env.prototype.ifServer = function (then, or) { return this.isServer ? then : or; };
|
49 | Env.prototype.ifClient = function (then, or) { return this.isClient ? then : or; };
|
50 | Env.prototype.ifProduction = function (then, or) { return this.isProduction ? then : or; };
|
51 | Env.prototype.ifDevelopment = function (then, or) { return this.isDevelopment ? then : or; };
|
52 | Env.prototype.ifDevelopmentClient = function (then, or) { return this.isDevelopmentClient ? then : or; };
|
53 | Env.prototype.ifProductionClient = function (then, or) { return this.isProductionClient ? then : or; };
|
54 | Env.prototype.ifDevelopmentServer = function (then, or) { return this.isDevelopmentServer ? then : or; };
|
55 | Env.prototype.ifProductionServer = function (then, or) { return this.isProductionServer ? then : or; };
|
56 | return Env;
|
57 | }());
|
58 | Object.defineProperty(exports, "__esModule", { value: true });
|
59 | exports.default = Env;
|