UNPKG

2.18 kBSource Map (JSON)View Raw
1{"version":3,"file":"global.js","sourceRoot":"","sources":["../../../src/utilities/globals/global.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAsBhC,eAAe,CACb,KAAK,CAAC,cAAM,OAAA,UAAU,EAAV,CAAU,CAAC;IACvB,KAAK,CAAC,cAAM,OAAA,MAAM,EAAN,CAAM,CAAC;IACnB,KAAK,CAAC,cAAM,OAAA,IAAI,EAAJ,CAAI,CAAC;IACjB,KAAK,CAAC,cAAM,OAAA,MAAM,EAAN,CAAM,CAAC;IAOnB,KAAK,CAAC,cAAa,OAAO,KAAK,CAAC,WAAW,CAAC,aAAa,CAAC,EAAE,CAAA,CAAC,CAAC,CAAC,CAGhE,CAAC","sourcesContent":["import { maybe } from \"./maybe\";\n\ndeclare global {\n // Despite our attempts to reuse the React Native __DEV__ constant instead of\n // inventing something new and Apollo-specific, declaring a useful type for\n // __DEV__ unfortunately conflicts (TS2451) with the global declaration in\n // @types/react-native/index.d.ts.\n //\n // To hide that harmless conflict, we @ts-ignore this line, which should\n // continue to provide a type for __DEV__ elsewhere in the Apollo Client\n // codebase, even when @types/react-native is not in use.\n //\n // However, because TypeScript drops @ts-ignore comments when generating .d.ts\n // files (https://github.com/microsoft/TypeScript/issues/38628), we also\n // sanitize the dist/utilities/globals/global.d.ts file to avoid declaring\n // __DEV__ globally altogether when @apollo/client is installed in the\n // node_modules directory of an application.\n //\n // @ts-ignore\n const __DEV__: boolean | undefined;\n}\n\nexport default (\n maybe(() => globalThis) ||\n maybe(() => window) ||\n maybe(() => self) ||\n maybe(() => global) ||\n // We don't expect the Function constructor ever to be invoked at runtime, as\n // long as at least one of globalThis, window, self, or global is defined, so\n // we are under no obligation to make it easy for static analysis tools to\n // detect syntactic usage of the Function constructor. If you think you can\n // improve your static analysis to detect this obfuscation, think again. This\n // is an arms race you cannot win, at least not in JavaScript.\n maybe(function() { return maybe.constructor(\"return this\")() })\n) as typeof globalThis & {\n __DEV__: typeof __DEV__;\n};\n"]}
\No newline at end of file