summaryrefslogtreecommitdiff
path: root/shared/logger/node_modules/@sentry/utils/esm/env.js
diff options
context:
space:
mode:
authorrxliuli <rxliuli@gmail.com>2025-11-04 05:03:50 +0800
committerrxliuli <rxliuli@gmail.com>2025-11-04 05:03:50 +0800
commitbce557cc2dc767628bed6aac87301a1be7c5431b (patch)
treeb51a051228d01fe3306cd7626d4a96768aadb944 /shared/logger/node_modules/@sentry/utils/esm/env.js
init commit
Diffstat (limited to 'shared/logger/node_modules/@sentry/utils/esm/env.js')
-rw-r--r--shared/logger/node_modules/@sentry/utils/esm/env.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/shared/logger/node_modules/@sentry/utils/esm/env.js b/shared/logger/node_modules/@sentry/utils/esm/env.js
new file mode 100644
index 0000000..dacd2f1
--- /dev/null
+++ b/shared/logger/node_modules/@sentry/utils/esm/env.js
@@ -0,0 +1,34 @@
+/*
+ * This module exists for optimizations in the build process through rollup and terser. We define some global
+ * constants, which can be overridden during build. By guarding certain pieces of code with functions that return these
+ * constants, we can control whether or not they appear in the final bundle. (Any code guarded by a false condition will
+ * never run, and will hence be dropped during treeshaking.) The two primary uses for this are stripping out calls to
+ * `logger` and preventing node-related code from appearing in browser bundles.
+ *
+ * Attention:
+ * This file should not be used to define constants/flags that are intended to be used for tree-shaking conducted by
+ * users. These flags should live in their respective packages, as we identified user tooling (specifically webpack)
+ * having issues tree-shaking these constants across package boundaries.
+ * An example for this is the __SENTRY_DEBUG__ constant. It is declared in each package individually because we want
+ * users to be able to shake away expressions that it guards.
+ */
+
+/**
+ * Figures out if we're building a browser bundle.
+ *
+ * @returns true if this is a browser bundle build.
+ */
+function isBrowserBundle() {
+ return typeof __SENTRY_BROWSER_BUNDLE__ !== 'undefined' && !!__SENTRY_BROWSER_BUNDLE__;
+}
+
+/**
+ * Get source of SDK.
+ */
+function getSDKSource() {
+ // @ts-ignore "npm" is injected by rollup during build process
+ return "npm";
+}
+
+export { getSDKSource, isBrowserBundle };
+//# sourceMappingURL=env.js.map