UNPKG

1.56 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, '__esModule', { value: true });
4
5var tsInvariant = require('ts-invariant');
6var process$1 = require('ts-invariant/process');
7var graphql = require('graphql');
8
9function maybe(thunk) {
10 try {
11 return thunk();
12 }
13 catch (_a) { }
14}
15
16var global$1 = (maybe(function () { return globalThis; }) ||
17 maybe(function () { return window; }) ||
18 maybe(function () { return self; }) ||
19 maybe(function () { return global; }) ||
20 maybe(function () { return maybe.constructor("return this")(); }));
21
22var __ = "__";
23var GLOBAL_KEY = [__, __].join("DEV");
24function getDEV() {
25 try {
26 return Boolean(__DEV__);
27 }
28 catch (_a) {
29 Object.defineProperty(global$1, GLOBAL_KEY, {
30 value: maybe(function () { return process.env.NODE_ENV; }) !== "production",
31 enumerable: false,
32 configurable: true,
33 writable: true,
34 });
35 return global$1[GLOBAL_KEY];
36 }
37}
38var DEV = getDEV();
39
40function removeTemporaryGlobals() {
41 return typeof graphql.Source === "function" ? process$1.remove() : process$1.remove();
42}
43
44function checkDEV() {
45 __DEV__ ? tsInvariant.invariant("boolean" === typeof DEV, DEV) : tsInvariant.invariant("boolean" === typeof DEV, 38);
46}
47removeTemporaryGlobals();
48checkDEV();
49
50exports.InvariantError = tsInvariant.InvariantError;
51exports.invariant = tsInvariant.invariant;
52exports.DEV = DEV;
53exports.checkDEV = checkDEV;
54exports.global = global$1;
55exports.maybe = maybe;
56//# sourceMappingURL=globals.cjs.map