@sentry/node 8.0.0-alpha.1 → 8.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) hide show
  1. package/README.md +14 -93
  2. package/cjs/index.js +3665 -77
  3. package/cjs/index.js.map +1 -1
  4. package/esm/index.js +3614 -31
  5. package/esm/index.js.map +1 -1
  6. package/esm/integrations/anr/worker-script.js +2 -2
  7. package/esm/package.json +1 -0
  8. package/package.json +21 -6
  9. package/types/index.d.ts +6 -5
  10. package/types/index.d.ts.map +1 -1
  11. package/types/integrations/anr/index.d.ts.map +1 -1
  12. package/types/integrations/anr/worker-script.d.ts +1 -1
  13. package/types/integrations/anr/worker-script.d.ts.map +1 -1
  14. package/types/integrations/http.d.ts +4 -0
  15. package/types/integrations/http.d.ts.map +1 -1
  16. package/types/integrations/local-variables/common.d.ts +1 -0
  17. package/types/integrations/local-variables/common.d.ts.map +1 -1
  18. package/types/integrations/local-variables/local-variables-sync.d.ts +1 -0
  19. package/types/integrations/local-variables/local-variables-sync.d.ts.map +1 -1
  20. package/types/integrations/tracing/fastify.d.ts +9 -0
  21. package/types/integrations/tracing/fastify.d.ts.map +1 -1
  22. package/types/integrations/tracing/hapi/index.d.ts.map +1 -1
  23. package/types/integrations/tracing/prisma.d.ts.map +1 -1
  24. package/types/proxy/helpers.d.ts +2 -2
  25. package/types/proxy/helpers.d.ts.map +1 -1
  26. package/types/proxy/index.d.ts.map +1 -1
  27. package/types/sdk/hub.d.ts.map +1 -1
  28. package/types/sdk/init.d.ts.map +1 -1
  29. package/types/transports/http-module.d.ts +2 -2
  30. package/types/transports/http-module.d.ts.map +1 -1
  31. package/types/types.d.ts +12 -4
  32. package/types/types.d.ts.map +1 -1
  33. package/types-ts3.8/index.d.ts +6 -5
  34. package/types-ts3.8/integrations/anr/worker-script.d.ts +1 -1
  35. package/types-ts3.8/integrations/http.d.ts +4 -0
  36. package/types-ts3.8/integrations/local-variables/common.d.ts +1 -0
  37. package/types-ts3.8/integrations/local-variables/local-variables-sync.d.ts +1 -0
  38. package/types-ts3.8/integrations/tracing/fastify.d.ts +9 -0
  39. package/types-ts3.8/proxy/helpers.d.ts +2 -2
  40. package/types-ts3.8/transports/http-module.d.ts +2 -2
  41. package/types-ts3.8/types.d.ts +12 -4
  42. package/cjs/cron/common.js +0 -56
  43. package/cjs/cron/common.js.map +0 -1
  44. package/cjs/cron/cron.js +0 -102
  45. package/cjs/cron/cron.js.map +0 -1
  46. package/cjs/cron/index.js +0 -15
  47. package/cjs/cron/index.js.map +0 -1
  48. package/cjs/cron/node-cron.js +0 -61
  49. package/cjs/cron/node-cron.js.map +0 -1
  50. package/cjs/cron/node-schedule.js +0 -57
  51. package/cjs/cron/node-schedule.js.map +0 -1
  52. package/cjs/debug-build.js +0 -11
  53. package/cjs/debug-build.js.map +0 -1
  54. package/cjs/integrations/anr/index.js +0 -145
  55. package/cjs/integrations/anr/index.js.map +0 -1
  56. package/cjs/integrations/anr/worker-script.js +0 -2
  57. package/cjs/integrations/anr/worker-script.js.map +0 -1
  58. package/cjs/integrations/console.js +0 -40
  59. package/cjs/integrations/console.js.map +0 -1
  60. package/cjs/integrations/context.js +0 -435
  61. package/cjs/integrations/context.js.map +0 -1
  62. package/cjs/integrations/contextlines.js +0 -137
  63. package/cjs/integrations/contextlines.js.map +0 -1
  64. package/cjs/integrations/http.js +0 -137
  65. package/cjs/integrations/http.js.map +0 -1
  66. package/cjs/integrations/local-variables/common.js +0 -87
  67. package/cjs/integrations/local-variables/common.js.map +0 -1
  68. package/cjs/integrations/local-variables/index.js +0 -8
  69. package/cjs/integrations/local-variables/index.js.map +0 -1
  70. package/cjs/integrations/local-variables/local-variables-sync.js +0 -400
  71. package/cjs/integrations/local-variables/local-variables-sync.js.map +0 -1
  72. package/cjs/integrations/modules.js +0 -99
  73. package/cjs/integrations/modules.js.map +0 -1
  74. package/cjs/integrations/node-fetch.js +0 -82
  75. package/cjs/integrations/node-fetch.js.map +0 -1
  76. package/cjs/integrations/onuncaughtexception.js +0 -137
  77. package/cjs/integrations/onuncaughtexception.js.map +0 -1
  78. package/cjs/integrations/onunhandledrejection.js +0 -90
  79. package/cjs/integrations/onunhandledrejection.js.map +0 -1
  80. package/cjs/integrations/spotlight.js +0 -109
  81. package/cjs/integrations/spotlight.js.map +0 -1
  82. package/cjs/integrations/tracing/express.js +0 -103
  83. package/cjs/integrations/tracing/express.js.map +0 -1
  84. package/cjs/integrations/tracing/fastify.js +0 -33
  85. package/cjs/integrations/tracing/fastify.js.map +0 -1
  86. package/cjs/integrations/tracing/graphql.js +0 -34
  87. package/cjs/integrations/tracing/graphql.js.map +0 -1
  88. package/cjs/integrations/tracing/hapi/index.js +0 -81
  89. package/cjs/integrations/tracing/hapi/index.js.map +0 -1
  90. package/cjs/integrations/tracing/index.js +0 -37
  91. package/cjs/integrations/tracing/index.js.map +0 -1
  92. package/cjs/integrations/tracing/koa.js +0 -21
  93. package/cjs/integrations/tracing/koa.js.map +0 -1
  94. package/cjs/integrations/tracing/mongo.js +0 -33
  95. package/cjs/integrations/tracing/mongo.js.map +0 -1
  96. package/cjs/integrations/tracing/mongoose.js +0 -33
  97. package/cjs/integrations/tracing/mongoose.js.map +0 -1
  98. package/cjs/integrations/tracing/mysql.js +0 -26
  99. package/cjs/integrations/tracing/mysql.js.map +0 -1
  100. package/cjs/integrations/tracing/mysql2.js +0 -33
  101. package/cjs/integrations/tracing/mysql2.js.map +0 -1
  102. package/cjs/integrations/tracing/nest.js +0 -26
  103. package/cjs/integrations/tracing/nest.js.map +0 -1
  104. package/cjs/integrations/tracing/postgres.js +0 -34
  105. package/cjs/integrations/tracing/postgres.js.map +0 -1
  106. package/cjs/integrations/tracing/prisma.js +0 -33
  107. package/cjs/integrations/tracing/prisma.js.map +0 -1
  108. package/cjs/nodeVersion.js +0 -12
  109. package/cjs/nodeVersion.js.map +0 -1
  110. package/cjs/otel/contextManager.js +0 -16
  111. package/cjs/otel/contextManager.js.map +0 -1
  112. package/cjs/proxy/base.js +0 -126
  113. package/cjs/proxy/base.js.map +0 -1
  114. package/cjs/proxy/index.js +0 -209
  115. package/cjs/proxy/index.js.map +0 -1
  116. package/cjs/proxy/parse-proxy-response.js +0 -104
  117. package/cjs/proxy/parse-proxy-response.js.map +0 -1
  118. package/cjs/sdk/api.js +0 -74
  119. package/cjs/sdk/api.js.map +0 -1
  120. package/cjs/sdk/client.js +0 -57
  121. package/cjs/sdk/client.js.map +0 -1
  122. package/cjs/sdk/hub.js +0 -104
  123. package/cjs/sdk/hub.js.map +0 -1
  124. package/cjs/sdk/init.js +0 -224
  125. package/cjs/sdk/init.js.map +0 -1
  126. package/cjs/sdk/initOtel.js +0 -70
  127. package/cjs/sdk/initOtel.js.map +0 -1
  128. package/cjs/sdk/scope.js +0 -18
  129. package/cjs/sdk/scope.js.map +0 -1
  130. package/cjs/transports/http.js +0 -160
  131. package/cjs/transports/http.js.map +0 -1
  132. package/cjs/utils/addOriginToSpan.js +0 -11
  133. package/cjs/utils/addOriginToSpan.js.map +0 -1
  134. package/cjs/utils/errorhandling.js +0 -44
  135. package/cjs/utils/errorhandling.js.map +0 -1
  136. package/cjs/utils/getRequestUrl.js +0 -18
  137. package/cjs/utils/getRequestUrl.js.map +0 -1
  138. package/cjs/utils/module.js +0 -62
  139. package/cjs/utils/module.js.map +0 -1
  140. package/esm/cron/common.js +0 -54
  141. package/esm/cron/common.js.map +0 -1
  142. package/esm/cron/cron.js +0 -100
  143. package/esm/cron/cron.js.map +0 -1
  144. package/esm/cron/index.js +0 -13
  145. package/esm/cron/index.js.map +0 -1
  146. package/esm/cron/node-cron.js +0 -56
  147. package/esm/cron/node-cron.js.map +0 -1
  148. package/esm/cron/node-schedule.js +0 -55
  149. package/esm/cron/node-schedule.js.map +0 -1
  150. package/esm/debug-build.js +0 -9
  151. package/esm/debug-build.js.map +0 -1
  152. package/esm/integrations/anr/index.js +0 -139
  153. package/esm/integrations/anr/index.js.map +0 -1
  154. package/esm/integrations/anr/worker-script.js.map +0 -1
  155. package/esm/integrations/console.js +0 -38
  156. package/esm/integrations/console.js.map +0 -1
  157. package/esm/integrations/context.js +0 -427
  158. package/esm/integrations/context.js.map +0 -1
  159. package/esm/integrations/contextlines.js +0 -131
  160. package/esm/integrations/contextlines.js.map +0 -1
  161. package/esm/integrations/http.js +0 -132
  162. package/esm/integrations/http.js.map +0 -1
  163. package/esm/integrations/local-variables/common.js +0 -81
  164. package/esm/integrations/local-variables/common.js.map +0 -1
  165. package/esm/integrations/local-variables/index.js +0 -6
  166. package/esm/integrations/local-variables/index.js.map +0 -1
  167. package/esm/integrations/local-variables/local-variables-sync.js +0 -394
  168. package/esm/integrations/local-variables/local-variables-sync.js.map +0 -1
  169. package/esm/integrations/modules.js +0 -97
  170. package/esm/integrations/modules.js.map +0 -1
  171. package/esm/integrations/node-fetch.js +0 -80
  172. package/esm/integrations/node-fetch.js.map +0 -1
  173. package/esm/integrations/onuncaughtexception.js +0 -134
  174. package/esm/integrations/onuncaughtexception.js.map +0 -1
  175. package/esm/integrations/onunhandledrejection.js +0 -87
  176. package/esm/integrations/onunhandledrejection.js.map +0 -1
  177. package/esm/integrations/spotlight.js +0 -106
  178. package/esm/integrations/spotlight.js.map +0 -1
  179. package/esm/integrations/tracing/express.js +0 -96
  180. package/esm/integrations/tracing/express.js.map +0 -1
  181. package/esm/integrations/tracing/fastify.js +0 -31
  182. package/esm/integrations/tracing/fastify.js.map +0 -1
  183. package/esm/integrations/tracing/graphql.js +0 -32
  184. package/esm/integrations/tracing/graphql.js.map +0 -1
  185. package/esm/integrations/tracing/hapi/index.js +0 -77
  186. package/esm/integrations/tracing/hapi/index.js.map +0 -1
  187. package/esm/integrations/tracing/index.js +0 -35
  188. package/esm/integrations/tracing/index.js.map +0 -1
  189. package/esm/integrations/tracing/koa.js +0 -19
  190. package/esm/integrations/tracing/koa.js.map +0 -1
  191. package/esm/integrations/tracing/mongo.js +0 -31
  192. package/esm/integrations/tracing/mongo.js.map +0 -1
  193. package/esm/integrations/tracing/mongoose.js +0 -31
  194. package/esm/integrations/tracing/mongoose.js.map +0 -1
  195. package/esm/integrations/tracing/mysql.js +0 -24
  196. package/esm/integrations/tracing/mysql.js.map +0 -1
  197. package/esm/integrations/tracing/mysql2.js +0 -31
  198. package/esm/integrations/tracing/mysql2.js.map +0 -1
  199. package/esm/integrations/tracing/nest.js +0 -24
  200. package/esm/integrations/tracing/nest.js.map +0 -1
  201. package/esm/integrations/tracing/postgres.js +0 -32
  202. package/esm/integrations/tracing/postgres.js.map +0 -1
  203. package/esm/integrations/tracing/prisma.js +0 -31
  204. package/esm/integrations/tracing/prisma.js.map +0 -1
  205. package/esm/nodeVersion.js +0 -9
  206. package/esm/nodeVersion.js.map +0 -1
  207. package/esm/otel/contextManager.js +0 -14
  208. package/esm/otel/contextManager.js.map +0 -1
  209. package/esm/proxy/base.js +0 -121
  210. package/esm/proxy/base.js.map +0 -1
  211. package/esm/proxy/index.js +0 -203
  212. package/esm/proxy/index.js.map +0 -1
  213. package/esm/proxy/parse-proxy-response.js +0 -102
  214. package/esm/proxy/parse-proxy-response.js.map +0 -1
  215. package/esm/sdk/api.js +0 -69
  216. package/esm/sdk/api.js.map +0 -1
  217. package/esm/sdk/client.js +0 -52
  218. package/esm/sdk/client.js.map +0 -1
  219. package/esm/sdk/hub.js +0 -102
  220. package/esm/sdk/hub.js.map +0 -1
  221. package/esm/sdk/init.js +0 -221
  222. package/esm/sdk/init.js.map +0 -1
  223. package/esm/sdk/initOtel.js +0 -67
  224. package/esm/sdk/initOtel.js.map +0 -1
  225. package/esm/sdk/scope.js +0 -16
  226. package/esm/sdk/scope.js.map +0 -1
  227. package/esm/transports/http.js +0 -155
  228. package/esm/transports/http.js.map +0 -1
  229. package/esm/utils/addOriginToSpan.js +0 -9
  230. package/esm/utils/addOriginToSpan.js.map +0 -1
  231. package/esm/utils/errorhandling.js +0 -42
  232. package/esm/utils/errorhandling.js.map +0 -1
  233. package/esm/utils/getRequestUrl.js +0 -16
  234. package/esm/utils/getRequestUrl.js.map +0 -1
  235. package/esm/utils/module.js +0 -60
  236. package/esm/utils/module.js.map +0 -1
  237. package/types/integrations/local-variables/local-variables-async.d.ts +0 -14
  238. package/types/integrations/local-variables/local-variables-async.d.ts.map +0 -1
  239. package/types-ts3.8/integrations/local-variables/local-variables-async.d.ts +0 -14
@@ -1,9 +0,0 @@
1
- import { _INTERNAL } from '@sentry/opentelemetry';
2
-
3
- /** Adds an origin to an OTEL Span. */
4
- function addOriginToSpan(span, origin) {
5
- _INTERNAL.addOriginToSpan(span, origin);
6
- }
7
-
8
- export { addOriginToSpan };
9
- //# sourceMappingURL=addOriginToSpan.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addOriginToSpan.js","sources":["../../../src/utils/addOriginToSpan.ts"],"sourcesContent":["import type { Span } from '@opentelemetry/api';\nimport { _INTERNAL } from '@sentry/opentelemetry';\nimport type { SpanOrigin } from '@sentry/types';\n\n/** Adds an origin to an OTEL Span. */\nexport function addOriginToSpan(span: Span, origin: SpanOrigin): void {\n _INTERNAL.addOriginToSpan(span, origin);\n}\n"],"names":[],"mappings":";;AAIA;AACO,SAAS,eAAe,CAAC,IAAI,EAAQ,MAAM,EAAoB;AACtE,EAAE,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;AACzC;;;;"}
@@ -1,42 +0,0 @@
1
- import { getClient } from '@sentry/core';
2
- import { consoleSandbox, logger } from '@sentry/utils';
3
- import { DEBUG_BUILD } from '../debug-build.js';
4
-
5
- const DEFAULT_SHUTDOWN_TIMEOUT = 2000;
6
-
7
- /**
8
- * @hidden
9
- */
10
- function logAndExitProcess(error) {
11
- consoleSandbox(() => {
12
- // eslint-disable-next-line no-console
13
- console.error(error);
14
- });
15
-
16
- const client = getClient();
17
-
18
- if (client === undefined) {
19
- DEBUG_BUILD && logger.warn('No NodeClient was defined, we are exiting the process now.');
20
- global.process.exit(1);
21
- return;
22
- }
23
-
24
- const options = client.getOptions();
25
- const timeout =
26
- (options && options.shutdownTimeout && options.shutdownTimeout > 0 && options.shutdownTimeout) ||
27
- DEFAULT_SHUTDOWN_TIMEOUT;
28
- client.close(timeout).then(
29
- (result) => {
30
- if (!result) {
31
- DEBUG_BUILD && logger.warn('We reached the timeout for emptying the request buffer, still exiting now!');
32
- }
33
- global.process.exit(1);
34
- },
35
- error => {
36
- DEBUG_BUILD && logger.error(error);
37
- },
38
- );
39
- }
40
-
41
- export { logAndExitProcess };
42
- //# sourceMappingURL=errorhandling.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errorhandling.js","sources":["../../../src/utils/errorhandling.ts"],"sourcesContent":["import { getClient } from '@sentry/core';\nimport { consoleSandbox, logger } from '@sentry/utils';\nimport { DEBUG_BUILD } from '../debug-build';\nimport type { NodeClient } from '../sdk/client';\n\nconst DEFAULT_SHUTDOWN_TIMEOUT = 2000;\n\n/**\n * @hidden\n */\nexport function logAndExitProcess(error: Error): void {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.error(error);\n });\n\n const client = getClient<NodeClient>();\n\n if (client === undefined) {\n DEBUG_BUILD && logger.warn('No NodeClient was defined, we are exiting the process now.');\n global.process.exit(1);\n return;\n }\n\n const options = client.getOptions();\n const timeout =\n (options && options.shutdownTimeout && options.shutdownTimeout > 0 && options.shutdownTimeout) ||\n DEFAULT_SHUTDOWN_TIMEOUT;\n client.close(timeout).then(\n (result: boolean) => {\n if (!result) {\n DEBUG_BUILD && logger.warn('We reached the timeout for emptying the request buffer, still exiting now!');\n }\n global.process.exit(1);\n },\n error => {\n DEBUG_BUILD && logger.error(error);\n },\n );\n}\n"],"names":[],"mappings":";;;;AAKA,MAAM,wBAAA,GAA2B,IAAI,CAAA;AACrC;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,KAAK,EAAe;AACtD,EAAE,cAAc,CAAC,MAAM;AACvB;AACA,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;AACxB,GAAG,CAAC,CAAA;AACJ;AACA,EAAE,MAAM,MAAA,GAAS,SAAS,EAAc,CAAA;AACxC;AACA,EAAE,IAAI,MAAO,KAAI,SAAS,EAAE;AAC5B,IAAI,eAAe,MAAM,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAA;AAC5F,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AAC1B,IAAI,OAAM;AACV,GAAE;AACF;AACA,EAAE,MAAM,OAAQ,GAAE,MAAM,CAAC,UAAU,EAAE,CAAA;AACrC,EAAE,MAAM,OAAQ;AAChB,IAAI,CAAC,OAAQ,IAAG,OAAO,CAAC,mBAAmB,OAAO,CAAC,eAAA,GAAkB,CAAE,IAAG,OAAO,CAAC,eAAe;AACjG,IAAI,wBAAwB,CAAA;AAC5B,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI;AAC5B,IAAI,CAAC,MAAM,KAAc;AACzB,MAAM,IAAI,CAAC,MAAM,EAAE;AACnB,QAAQ,eAAe,MAAM,CAAC,IAAI,CAAC,4EAA4E,CAAC,CAAA;AAChH,OAAM;AACN,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AAC5B,KAAK;AACL,IAAI,SAAS;AACb,MAAM,eAAe,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;AACxC,KAAK;AACL,GAAG,CAAA;AACH;;;;"}
@@ -1,16 +0,0 @@
1
- /** Build a full URL from request options. */
2
- function getRequestUrl(requestOptions) {
3
- const protocol = requestOptions.protocol || '';
4
- const hostname = requestOptions.hostname || requestOptions.host || '';
5
- // Don't log standard :80 (http) and :443 (https) ports to reduce the noise
6
- // Also don't add port if the hostname already includes a port
7
- const port =
8
- !requestOptions.port || requestOptions.port === 80 || requestOptions.port === 443 || /^(.*):(\d+)$/.test(hostname)
9
- ? ''
10
- : `:${requestOptions.port}`;
11
- const path = requestOptions.path ? requestOptions.path : '/';
12
- return `${protocol}//${hostname}${port}${path}`;
13
- }
14
-
15
- export { getRequestUrl };
16
- //# sourceMappingURL=getRequestUrl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getRequestUrl.js","sources":["../../../src/utils/getRequestUrl.ts"],"sourcesContent":["import type { RequestOptions } from 'http';\n\n/** Build a full URL from request options. */\nexport function getRequestUrl(requestOptions: RequestOptions): string {\n const protocol = requestOptions.protocol || '';\n const hostname = requestOptions.hostname || requestOptions.host || '';\n // Don't log standard :80 (http) and :443 (https) ports to reduce the noise\n // Also don't add port if the hostname already includes a port\n const port =\n !requestOptions.port || requestOptions.port === 80 || requestOptions.port === 443 || /^(.*):(\\d+)$/.test(hostname)\n ? ''\n : `:${requestOptions.port}`;\n const path = requestOptions.path ? requestOptions.path : '/';\n return `${protocol}//${hostname}${port}${path}`;\n}\n"],"names":[],"mappings":"AAEA;AACO,SAAS,aAAa,CAAC,cAAc,EAA0B;AACtE,EAAE,MAAM,QAAS,GAAE,cAAc,CAAC,QAAA,IAAY,EAAE,CAAA;AAChD,EAAE,MAAM,QAAS,GAAE,cAAc,CAAC,QAAS,IAAG,cAAc,CAAC,IAAK,IAAG,EAAE,CAAA;AACvE;AACA;AACA,EAAE,MAAM,IAAK;AACb,IAAI,CAAC,cAAc,CAAC,IAAA,IAAQ,cAAc,CAAC,SAAS,EAAA,IAAM,cAAc,CAAC,SAAS,GAAA,IAAO,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAA;AACrH,QAAQ,EAAA;AACR,QAAQ,CAAC,CAAC,EAAE,cAAc,CAAC,IAAI,CAAC,CAAA,CAAA;AACA,EAAA,MAAA,IAAA,GAAA,cAAA,CAAA,IAAA,GAAA,cAAA,CAAA,IAAA,GAAA,GAAA,CAAA;AACA,EAAA,OAAA,CAAA,EAAA,QAAA,CAAA,EAAA,EAAA,QAAA,CAAA,EAAA,IAAA,CAAA,EAAA,IAAA,CAAA,CAAA,CAAA;AACA;;;;"}
@@ -1,60 +0,0 @@
1
- import { posix, sep } from 'path';
2
- import { dirname } from '@sentry/utils';
3
-
4
- /** normalizes Windows paths */
5
- function normalizeWindowsPath(path) {
6
- return path
7
- .replace(/^[A-Z]:/, '') // remove Windows-style prefix
8
- .replace(/\\/g, '/'); // replace all `\` instances with `/`
9
- }
10
-
11
- /** Creates a function that gets the module name from a filename */
12
- function createGetModuleFromFilename(
13
- basePath = process.argv[1] ? dirname(process.argv[1]) : process.cwd(),
14
- isWindows = sep === '\\',
15
- ) {
16
- const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
17
-
18
- return (filename) => {
19
- if (!filename) {
20
- return;
21
- }
22
-
23
- const normalizedFilename = isWindows ? normalizeWindowsPath(filename) : filename;
24
-
25
- // eslint-disable-next-line prefer-const
26
- let { dir, base: file, ext } = posix.parse(normalizedFilename);
27
-
28
- if (ext === '.js' || ext === '.mjs' || ext === '.cjs') {
29
- file = file.slice(0, ext.length * -1);
30
- }
31
-
32
- if (!dir) {
33
- // No dirname whatsoever
34
- dir = '.';
35
- }
36
-
37
- const n = dir.lastIndexOf('/node_modules');
38
- if (n > -1) {
39
- return `${dir.slice(n + 14).replace(/\//g, '.')}:${file}`;
40
- }
41
-
42
- // Let's see if it's a part of the main module
43
- // To be a part of main module, it has to share the same base
44
- if (dir.startsWith(normalizedBase)) {
45
- let moduleName = dir.slice(normalizedBase.length + 1).replace(/\//g, '.');
46
-
47
- if (moduleName) {
48
- moduleName += ':';
49
- }
50
- moduleName += file;
51
-
52
- return moduleName;
53
- }
54
-
55
- return file;
56
- };
57
- }
58
-
59
- export { createGetModuleFromFilename };
60
- //# sourceMappingURL=module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"module.js","sources":["../../../src/utils/module.ts"],"sourcesContent":["import { posix, sep } from 'path';\nimport { dirname } from '@sentry/utils';\n\n/** normalizes Windows paths */\nfunction normalizeWindowsPath(path: string): string {\n return path\n .replace(/^[A-Z]:/, '') // remove Windows-style prefix\n .replace(/\\\\/g, '/'); // replace all `\\` instances with `/`\n}\n\n/** Creates a function that gets the module name from a filename */\nexport function createGetModuleFromFilename(\n basePath: string = process.argv[1] ? dirname(process.argv[1]) : process.cwd(),\n isWindows: boolean = sep === '\\\\',\n): (filename: string | undefined) => string | undefined {\n const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;\n\n return (filename: string | undefined) => {\n if (!filename) {\n return;\n }\n\n const normalizedFilename = isWindows ? normalizeWindowsPath(filename) : filename;\n\n // eslint-disable-next-line prefer-const\n let { dir, base: file, ext } = posix.parse(normalizedFilename);\n\n if (ext === '.js' || ext === '.mjs' || ext === '.cjs') {\n file = file.slice(0, ext.length * -1);\n }\n\n if (!dir) {\n // No dirname whatsoever\n dir = '.';\n }\n\n const n = dir.lastIndexOf('/node_modules');\n if (n > -1) {\n return `${dir.slice(n + 14).replace(/\\//g, '.')}:${file}`;\n }\n\n // Let's see if it's a part of the main module\n // To be a part of main module, it has to share the same base\n if (dir.startsWith(normalizedBase)) {\n let moduleName = dir.slice(normalizedBase.length + 1).replace(/\\//g, '.');\n\n if (moduleName) {\n moduleName += ':';\n }\n moduleName += file;\n\n return moduleName;\n }\n\n return file;\n };\n}\n"],"names":[],"mappings":";;;AAGA;AACA,SAAS,oBAAoB,CAAC,IAAI,EAAkB;AACpD,EAAE,OAAO,IAAA;AACT,KAAK,OAAO,CAAC,SAAS,EAAE,EAAE,CAAA;AAC1B,KAAK,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;AACxB,CAAA;AACA;AACA;AACO,SAAS,2BAA2B;AAC3C,EAAE,QAAQ,GAAW,OAAO,CAAC,IAAI,CAAC,CAAC,CAAE,GAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA,GAAI,OAAO,CAAC,GAAG,EAAE;AAC/E,EAAE,SAAS,GAAY,GAAA,KAAQ,IAAI;AACnC,EAAwD;AACxD,EAAE,MAAM,cAAe,GAAE,SAAU,GAAE,oBAAoB,CAAC,QAAQ,CAAE,GAAE,QAAQ,CAAA;AAC9E;AACA,EAAE,OAAO,CAAC,QAAQ,KAAyB;AAC3C,IAAI,IAAI,CAAC,QAAQ,EAAE;AACnB,MAAM,OAAM;AACZ,KAAI;AACJ;AACA,IAAI,MAAM,kBAAmB,GAAE,SAAU,GAAE,oBAAoB,CAAC,QAAQ,CAAE,GAAE,QAAQ,CAAA;AACpF;AACA;AACA,IAAI,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,GAAI,EAAA,GAAI,KAAK,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAA;AAClE;AACA,IAAI,IAAI,GAAI,KAAI,KAAM,IAAG,GAAI,KAAI,MAAO,IAAG,GAAI,KAAI,MAAM,EAAE;AAC3D,MAAM,IAAK,GAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,MAAA,GAAS,CAAC,CAAC,CAAC,CAAA;AAC3C,KAAI;AACJ;AACA,IAAI,IAAI,CAAC,GAAG,EAAE;AACd;AACA,MAAM,GAAA,GAAM,GAAG,CAAA;AACf,KAAI;AACJ;AACA,IAAI,MAAM,IAAI,GAAG,CAAC,WAAW,CAAC,eAAe,CAAC,CAAA;AAC9C,IAAI,IAAI,CAAA,GAAI,CAAC,CAAC,EAAE;AAChB,MAAM,OAAO,CAAC,EAAA,GAAA,CAAA,KAAA,CAAA,CAAA,GAAA,EAAA,CAAA,CAAA,OAAA,CAAA,KAAA,EAAA,GAAA,CAAA,CAAA,CAAA,EAAA,IAAA,CAAA,CAAA,CAAA;AACA,KAAA;AACA;AACA;AACA;AACA,IAAA,IAAA,GAAA,CAAA,UAAA,CAAA,cAAA,CAAA,EAAA;AACA,MAAA,IAAA,UAAA,GAAA,GAAA,CAAA,KAAA,CAAA,cAAA,CAAA,MAAA,GAAA,CAAA,CAAA,CAAA,OAAA,CAAA,KAAA,EAAA,GAAA,CAAA,CAAA;AACA;AACA,MAAA,IAAA,UAAA,EAAA;AACA,QAAA,UAAA,IAAA,GAAA,CAAA;AACA,OAAA;AACA,MAAA,UAAA,IAAA,IAAA,CAAA;AACA;AACA,MAAA,OAAA,UAAA,CAAA;AACA,KAAA;AACA;AACA,IAAA,OAAA,IAAA,CAAA;AACA,GAAA,CAAA;AACA;;;;"}
@@ -1,14 +0,0 @@
1
- import type { Event, Integration, IntegrationClass } from '@sentry/types';
2
- import type { NodeClient } from '../../sdk/client';
3
- import type { LocalVariablesIntegrationOptions } from './common';
4
- export declare const localVariablesAsyncIntegration: (options?: LocalVariablesIntegrationOptions | undefined) => import("@sentry/types").IntegrationFnResult;
5
- /**
6
- * Adds local variables to exception frames.
7
- * @deprecated Use `localVariablesAsyncIntegration()` instead.
8
- */
9
- export declare const LocalVariablesAsync: IntegrationClass<Integration & {
10
- processEvent: (event: Event) => Event;
11
- setup: (client: NodeClient) => void;
12
- }>;
13
- export type LocalVariablesAsync = typeof LocalVariablesAsync;
14
- //# sourceMappingURL=local-variables-async.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"local-variables-async.d.ts","sourceRoot":"","sources":["../../../../src/integrations/local-variables/local-variables-async.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAa,WAAW,EAAE,gBAAgB,EAA8B,MAAM,eAAe,CAAC;AAIjH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAEV,gCAAgC,EAIjC,MAAM,UAAU,CAAC;AAyPlB,eAAO,MAAM,8BAA8B,yGAAqD,CAAC;AAEjG;;;GAGG;AAEH,eAAO,MAAM,mBAAmB;0BAG4B,KAAK,KAAK,KAAK;oBAAkB,UAAU,KAAK,IAAI;EAAG,CAAC;AAGpH,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAC"}
@@ -1,14 +0,0 @@
1
- import { Event, Integration, IntegrationClass } from '@sentry/types';
2
- import { NodeClient } from '../../sdk/client';
3
- import { LocalVariablesIntegrationOptions } from './common';
4
- export declare const localVariablesAsyncIntegration: (options?: LocalVariablesIntegrationOptions | undefined) => import("@sentry/types").IntegrationFnResult;
5
- /**
6
- * Adds local variables to exception frames.
7
- * @deprecated Use `localVariablesAsyncIntegration()` instead.
8
- */
9
- export declare const LocalVariablesAsync: IntegrationClass<Integration & {
10
- processEvent: (event: Event) => Event;
11
- setup: (client: NodeClient) => void;
12
- }>;
13
- export type LocalVariablesAsync = typeof LocalVariablesAsync;
14
- //# sourceMappingURL=local-variables-async.d.ts.map