UNPKG

1.82 kBSource Map (JSON)View Raw
1{"version":3,"file":"DEV.js","sourceRoot":"","sources":["../../../src/utilities/globals/DEV.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAKhC,IAAM,EAAE,GAAG,IAAI,CAAC;AAChB,IAAM,UAAU,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAExC,SAAS,MAAM;IACb,IAAI;QACF,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;KACzB;IAAC,WAAM;QACN,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE;YAIxC,KAAK,EAAE,KAAK,CAAC,cAAM,OAAA,OAAO,CAAC,GAAG,CAAC,QAAQ,EAApB,CAAoB,CAAC,KAAK,YAAY;YACzD,UAAU,EAAE,KAAK;YACjB,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QAGH,OAAQ,MAAc,CAAC,UAAU,CAAC,CAAC;KACpC;AACH,CAAC;AAED,eAAe,MAAM,EAAE,CAAC","sourcesContent":["import global from \"./global\";\nimport { maybe } from \"./maybe\";\n\n// To keep string-based find/replace minifiers from messing with __DEV__ inside\n// string literals or properties like global.__DEV__, we construct the \"__DEV__\"\n// string in a roundabout way that won't be altered by find/replace strategies.\nconst __ = \"__\";\nconst GLOBAL_KEY = [__, __].join(\"DEV\");\n\nfunction getDEV() {\n try {\n return Boolean(__DEV__);\n } catch {\n Object.defineProperty(global, GLOBAL_KEY, {\n // In a buildless browser environment, maybe(() => process.env.NODE_ENV)\n // evaluates as undefined, so __DEV__ becomes true by default, but can be\n // initialized to false instead by a script/module that runs earlier.\n value: maybe(() => process.env.NODE_ENV) !== \"production\",\n enumerable: false,\n configurable: true,\n writable: true,\n });\n // Using computed property access rather than global.__DEV__ here prevents\n // string-based find/replace strategies from munging this to global.false:\n return (global as any)[GLOBAL_KEY];\n }\n}\n\nexport default getDEV();\n"]}
\No newline at end of file