@sentry/solidstart 11.11.0 → 11.13.0

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 (103) hide show
  1. package/build/cjs/_virtual/_rolldown/runtime.js +34 -0
  2. package/build/cjs/client/index.js +11 -18
  3. package/build/cjs/client/sdk.js +19 -20
  4. package/build/cjs/client/sdk.js.map +1 -1
  5. package/build/cjs/client/solidrouter.js +8 -16
  6. package/build/cjs/common/tunnel.js +11 -8
  7. package/build/cjs/common/tunnel.js.map +1 -1
  8. package/build/cjs/config/addInstrumentation.js +110 -111
  9. package/build/cjs/config/addInstrumentation.js.map +1 -1
  10. package/build/cjs/config/index.js +2 -0
  11. package/build/cjs/config/withSentry.js +86 -87
  12. package/build/cjs/config/withSentry.js.map +1 -1
  13. package/build/cjs/config/wrapServerEntryWithDynamicImport.js +139 -135
  14. package/build/cjs/config/wrapServerEntryWithDynamicImport.js.map +1 -1
  15. package/build/cjs/index.client.js +12 -18
  16. package/build/cjs/index.server.js +162 -159
  17. package/build/cjs/index.server.js.map +1 -1
  18. package/build/cjs/nitro/tunnelPlugin.js +12 -20
  19. package/build/cjs/nitro/tunnelPlugin.js.map +1 -1
  20. package/build/cjs/server/index.js +151 -158
  21. package/build/cjs/server/middleware.js +26 -37
  22. package/build/cjs/server/middleware.js.map +1 -1
  23. package/build/cjs/server/sdk.js +13 -14
  24. package/build/cjs/server/sdk.js.map +1 -1
  25. package/build/cjs/server/solidrouter.js +26 -18
  26. package/build/cjs/server/solidrouter.js.map +1 -1
  27. package/build/cjs/server/utils.js +32 -27
  28. package/build/cjs/server/utils.js.map +1 -1
  29. package/build/cjs/server/withServerActionInstrumentation.js +46 -49
  30. package/build/cjs/server/withServerActionInstrumentation.js.map +1 -1
  31. package/build/cjs/solidrouter.client.js +9 -16
  32. package/build/cjs/solidrouter.js +12 -18
  33. package/build/cjs/solidrouter.server.js +3 -8
  34. package/build/cjs/vite/buildInstrumentationFile.js +46 -46
  35. package/build/cjs/vite/buildInstrumentationFile.js.map +1 -1
  36. package/build/cjs/vite/index.js +5 -10
  37. package/build/cjs/vite/sentrySolidStart.js +86 -39
  38. package/build/cjs/vite/sentrySolidStart.js.map +1 -1
  39. package/build/cjs/vite/sentrySolidStartVite.js +32 -35
  40. package/build/cjs/vite/sentrySolidStartVite.js.map +1 -1
  41. package/build/cjs/vite/sourceMaps.js +117 -152
  42. package/build/cjs/vite/sourceMaps.js.map +1 -1
  43. package/build/esm/client/index.js +2 -3
  44. package/build/esm/client/sdk.js +19 -18
  45. package/build/esm/client/sdk.js.map +1 -1
  46. package/build/esm/client/solidrouter.js +1 -2
  47. package/build/esm/common/tunnel.js +11 -6
  48. package/build/esm/common/tunnel.js.map +1 -1
  49. package/build/esm/config/addInstrumentation.js +107 -109
  50. package/build/esm/config/addInstrumentation.js.map +1 -1
  51. package/build/esm/config/index.js +1 -0
  52. package/build/esm/config/withSentry.js +86 -84
  53. package/build/esm/config/withSentry.js.map +1 -1
  54. package/build/esm/config/wrapServerEntryWithDynamicImport.js +139 -133
  55. package/build/esm/config/wrapServerEntryWithDynamicImport.js.map +1 -1
  56. package/build/esm/index.client.js +3 -3
  57. package/build/esm/index.server.js +14 -10
  58. package/build/esm/index.server.js.map +1 -1
  59. package/build/esm/nitro/tunnelPlugin.js +12 -20
  60. package/build/esm/nitro/tunnelPlugin.js.map +1 -1
  61. package/build/esm/package.json +1 -1
  62. package/build/esm/server/index.js +7 -7
  63. package/build/esm/server/middleware.js +26 -35
  64. package/build/esm/server/middleware.js.map +1 -1
  65. package/build/esm/server/sdk.js +13 -12
  66. package/build/esm/server/sdk.js.map +1 -1
  67. package/build/esm/server/solidrouter.js +25 -16
  68. package/build/esm/server/solidrouter.js.map +1 -1
  69. package/build/esm/server/utils.js +32 -25
  70. package/build/esm/server/utils.js.map +1 -1
  71. package/build/esm/server/withServerActionInstrumentation.js +46 -47
  72. package/build/esm/server/withServerActionInstrumentation.js.map +1 -1
  73. package/build/esm/solidrouter.client.js +2 -2
  74. package/build/esm/solidrouter.js +3 -3
  75. package/build/esm/solidrouter.server.js +1 -2
  76. package/build/esm/vite/buildInstrumentationFile.js +43 -44
  77. package/build/esm/vite/buildInstrumentationFile.js.map +1 -1
  78. package/build/esm/vite/index.js +3 -3
  79. package/build/esm/vite/sentrySolidStart.js +86 -37
  80. package/build/esm/vite/sentrySolidStart.js.map +1 -1
  81. package/build/esm/vite/sentrySolidStartVite.js +32 -33
  82. package/build/esm/vite/sentrySolidStartVite.js.map +1 -1
  83. package/build/esm/vite/sourceMaps.js +117 -150
  84. package/build/esm/vite/sourceMaps.js.map +1 -1
  85. package/build/types/nitro/tunnelPlugin.d.ts +3 -3
  86. package/build/types/nitro/tunnelPlugin.d.ts.map +1 -1
  87. package/package.json +39 -37
  88. package/build/cjs/client/index.js.map +0 -1
  89. package/build/cjs/client/solidrouter.js.map +0 -1
  90. package/build/cjs/index.client.js.map +0 -1
  91. package/build/cjs/server/index.js.map +0 -1
  92. package/build/cjs/solidrouter.client.js.map +0 -1
  93. package/build/cjs/solidrouter.js.map +0 -1
  94. package/build/cjs/solidrouter.server.js.map +0 -1
  95. package/build/cjs/vite/index.js.map +0 -1
  96. package/build/esm/client/index.js.map +0 -1
  97. package/build/esm/client/solidrouter.js.map +0 -1
  98. package/build/esm/index.client.js.map +0 -1
  99. package/build/esm/server/index.js.map +0 -1
  100. package/build/esm/solidrouter.client.js.map +0 -1
  101. package/build/esm/solidrouter.js.map +0 -1
  102. package/build/esm/solidrouter.server.js.map +0 -1
  103. package/build/esm/vite/index.js.map +0 -1
@@ -0,0 +1,34 @@
1
+ // \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __exportAll = (all, flags) => {
9
+ let target = Object.setPrototypeOf({}, null);
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
+ if (!(flags & 1)) __defProp(target, Symbol.toStringTag, { value: "Module" });
15
+ return flags & 2 ? target : Object.preventExtensions(target);
16
+ };
17
+ var __copyProps = (to, from, except, desc) => {
18
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
19
+ key = keys[i];
20
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
21
+ get: ((k) => from[k]).bind(null, key),
22
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
23
+ });
24
+ }
25
+ return to;
26
+ };
27
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
29
+ value: mod,
30
+ enumerable: true
31
+ }) : target, mod));
32
+ exports.__exportAll = __exportAll;
33
+ exports.__reExport = __reExport;
34
+ exports.__toESM = __toESM;
@@ -1,19 +1,12 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const solid = require('@sentry/solid');
4
- const sdk = require('./sdk.js');
5
-
6
-
7
-
8
- exports.init = sdk.init;
9
- Object.prototype.hasOwnProperty.call(solid, '__proto__') &&
10
- !Object.prototype.hasOwnProperty.call(exports, '__proto__') &&
11
- Object.defineProperty(exports, '__proto__', {
12
- enumerable: true,
13
- value: solid['__proto__']
14
- });
15
-
16
- Object.keys(solid).forEach(function (k) {
17
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = solid[k];
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("../_virtual/_rolldown/runtime.js");
3
+ const require_sdk = require("./sdk.js");
4
+ exports.init = require_sdk.init;
5
+ var _sentry_solid = require("@sentry/solid");
6
+ Object.prototype.hasOwnProperty.call(_sentry_solid, "__proto__") && !Object.prototype.hasOwnProperty.call(exports, "__proto__") && Object.defineProperty(exports, "__proto__", {
7
+ enumerable: true,
8
+ value: _sentry_solid["__proto__"]
9
+ });
10
+ Object.keys(_sentry_solid).forEach(function(k) {
11
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = _sentry_solid[k];
18
12
  });
19
- //# sourceMappingURL=index.js.map
@@ -1,25 +1,24 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const core = require('@sentry/core');
4
- const tunnel = require('../common/tunnel.js');
5
- const solid = require('@sentry/solid');
6
-
1
+ const require_tunnel = require("../common/tunnel.js");
2
+ let _sentry_solid = require("@sentry/solid");
3
+ let _sentry_core = require("@sentry/core");
4
+ // src/client/sdk.ts
5
+ /**
6
+ * Initializes the client side of the Solid Start SDK.
7
+ */
7
8
  function init(options) {
8
- const opts = {
9
- defaultIntegrations: getDefaultIntegrations(options),
10
- ...options
11
- };
12
- tunnel.applyTunnelBasePath(opts);
13
- core.applySdkMetadata(opts, "solidstart", ["solidstart", "solid"]);
14
- return solid.init(opts);
9
+ const opts = {
10
+ defaultIntegrations: getDefaultIntegrations(options),
11
+ ...options
12
+ };
13
+ require_tunnel.applyTunnelBasePath(opts);
14
+ (0, _sentry_core.applySdkMetadata)(opts, "solidstart", ["solidstart", "solid"]);
15
+ return (0, _sentry_solid.init)(opts);
15
16
  }
16
17
  function getDefaultIntegrations(options) {
17
- const integrations = solid.getDefaultIntegrations(options);
18
- if (typeof __SENTRY_TRACING__ === "undefined" || __SENTRY_TRACING__) {
19
- integrations.push(solid.browserTracingIntegration());
20
- }
21
- return integrations;
18
+ const integrations = (0, _sentry_solid.getDefaultIntegrations)(options);
19
+ if (typeof __SENTRY_TRACING__ === "undefined" || __SENTRY_TRACING__) integrations.push((0, _sentry_solid.browserTracingIntegration)());
20
+ return integrations;
22
21
  }
23
-
24
22
  exports.init = init;
25
- //# sourceMappingURL=sdk.js.map
23
+
24
+ //# sourceMappingURL=sdk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sources":["../../../src/client/sdk.ts"],"sourcesContent":["import type { Client, Integration } from '@sentry/core';\nimport { applySdkMetadata } from '@sentry/core';\nimport type { BrowserOptions } from '@sentry/solid';\nimport { applyTunnelBasePath } from '../common/tunnel';\nimport {\n browserTracingIntegration,\n getDefaultIntegrations as getDefaultSolidIntegrations,\n init as initSolidSDK,\n} from '@sentry/solid';\n\n// Treeshakable guard to remove all code related to tracing\ndeclare const __SENTRY_TRACING__: boolean;\n\n/**\n * Initializes the client side of the Solid Start SDK.\n */\nexport function init(options: BrowserOptions): Client | undefined {\n const opts = {\n defaultIntegrations: getDefaultIntegrations(options),\n ...options,\n };\n\n applyTunnelBasePath(opts);\n applySdkMetadata(opts, 'solidstart', ['solidstart', 'solid']);\n\n return initSolidSDK(opts);\n}\n\nfunction getDefaultIntegrations(options: BrowserOptions): Integration[] {\n const integrations = getDefaultSolidIntegrations(options);\n\n // This evaluates to true unless __SENTRY_TRACING__ is text-replaced with \"false\",\n // in which case everything inside will get tree-shaken away\n if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {\n // We add the default BrowserTracingIntegration here always.\n // We can do this, even if `solidRouterBrowserTracingIntegration` is\n // supplied as integration in `init` by users because it will win\n // over the default integration by virtue of having the same\n // `BrowserTracing` integration name and being added later.\n integrations.push(browserTracingIntegration());\n }\n\n return integrations;\n}\n"],"names":["applyTunnelBasePath","applySdkMetadata","initSolidSDK","getDefaultSolidIntegrations","browserTracingIntegration"],"mappings":";;;;;;AAgBO,SAAS,KAAK,OAAA,EAA6C;AAChE,EAAA,MAAM,IAAA,GAAO;AAAA,IACX,mBAAA,EAAqB,uBAAuB,OAAO,CAAA;AAAA,IACnD,GAAG;AAAA,GACL;AAEA,EAAAA,0BAAA,CAAoB,IAAI,CAAA;AACxB,EAAAC,qBAAA,CAAiB,IAAA,EAAM,YAAA,EAAc,CAAC,YAAA,EAAc,OAAO,CAAC,CAAA;AAE5D,EAAA,OAAOC,WAAa,IAAI,CAAA;AAC1B;AAEA,SAAS,uBAAuB,OAAA,EAAwC;AACtE,EAAA,MAAM,YAAA,GAAeC,6BAA4B,OAAO,CAAA;AAIxD,EAAA,IAAI,OAAO,kBAAA,KAAuB,WAAA,IAAe,kBAAA,EAAoB;AAMnE,IAAA,YAAA,CAAa,IAAA,CAAKC,iCAA2B,CAAA;AAAA,EAC/C;AAEA,EAAA,OAAO,YAAA;AACT;;;;"}
1
+ {"version":3,"file":"sdk.js","names":["applyTunnelBasePath","applySdkMetadata","initSolidSDK","getDefaultSolidIntegrations","browserTracingIntegration"],"sources":["../../../src/client/sdk.ts"],"sourcesContent":["import type { Client, Integration } from '@sentry/core';\nimport { applySdkMetadata } from '@sentry/core';\nimport type { BrowserOptions } from '@sentry/solid';\nimport { applyTunnelBasePath } from '../common/tunnel';\nimport {\n browserTracingIntegration,\n getDefaultIntegrations as getDefaultSolidIntegrations,\n init as initSolidSDK,\n} from '@sentry/solid';\n\n// Treeshakable guard to remove all code related to tracing\ndeclare const __SENTRY_TRACING__: boolean;\n\n/**\n * Initializes the client side of the Solid Start SDK.\n */\nexport function init(options: BrowserOptions): Client | undefined {\n const opts = {\n defaultIntegrations: getDefaultIntegrations(options),\n ...options,\n };\n\n applyTunnelBasePath(opts);\n applySdkMetadata(opts, 'solidstart', ['solidstart', 'solid']);\n\n return initSolidSDK(opts);\n}\n\nfunction getDefaultIntegrations(options: BrowserOptions): Integration[] {\n const integrations = getDefaultSolidIntegrations(options);\n\n // This evaluates to true unless __SENTRY_TRACING__ is text-replaced with \"false\",\n // in which case everything inside will get tree-shaken away\n if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {\n // We add the default BrowserTracingIntegration here always.\n // We can do this, even if `solidRouterBrowserTracingIntegration` is\n // supplied as integration in `init` by users because it will win\n // over the default integration by virtue of having the same\n // `BrowserTracing` integration name and being added later.\n integrations.push(browserTracingIntegration());\n }\n\n return integrations;\n}\n"],"mappings":";;;;;;;AAgBA,SAAgB,KAAK,SAA6C;CAChE,MAAM,OAAO;EACX,qBAAqB,uBAAuB,OAAO;EACnD,GAAG;CACL;CAEAA,eAAAA,oBAAoB,IAAI;CACxBC,CAAAA,GAAAA,aAAAA,iBAAAA,CAAiB,MAAM,cAAc,CAAC,cAAc,OAAO,CAAC;CAE5D,QAAA,GAAOC,cAAAA,KAAAA,CAAa,IAAI;AAC1B;AAEA,SAAS,uBAAuB,SAAwC;CACtE,MAAM,gBAAA,GAAeC,cAAAA,uBAAAA,CAA4B,OAAO;CAIxD,IAAI,OAAO,uBAAuB,eAAe,oBAM/C,aAAa,MAAA,GAAKC,cAAAA,0BAAAA,CAA0B,CAAC;CAG/C,OAAO;AACT"}
@@ -1,17 +1,9 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const solidrouter = require('@sentry/solid/solidrouter');
4
-
5
-
6
-
7
- Object.prototype.hasOwnProperty.call(solidrouter, '__proto__') &&
8
- !Object.prototype.hasOwnProperty.call(exports, '__proto__') &&
9
- Object.defineProperty(exports, '__proto__', {
10
- enumerable: true,
11
- value: solidrouter['__proto__']
12
- });
13
-
14
- Object.keys(solidrouter).forEach(function (k) {
15
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = solidrouter[k];
1
+ require("../_virtual/_rolldown/runtime.js");
2
+ var _sentry_solid_solidrouter = require("@sentry/solid/solidrouter");
3
+ Object.prototype.hasOwnProperty.call(_sentry_solid_solidrouter, "__proto__") && !Object.prototype.hasOwnProperty.call(exports, "__proto__") && Object.defineProperty(exports, "__proto__", {
4
+ enumerable: true,
5
+ value: _sentry_solid_solidrouter["__proto__"]
6
+ });
7
+ Object.keys(_sentry_solid_solidrouter).forEach(function(k) {
8
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = _sentry_solid_solidrouter[k];
16
9
  });
17
- //# sourceMappingURL=solidrouter.js.map
@@ -1,13 +1,16 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const core = require('@sentry/core');
4
-
1
+ let _sentry_core = require("@sentry/core");
2
+ // src/common/tunnel.ts
3
+ /** Set on the server by `withSentry` to the app's `server.baseURL`. */
5
4
  const TUNNEL_BASE_PATH_GLOBAL = "__sentry_solidstart_base_path";
5
+ /**
6
+ * Serves the browser's managed tunnel under the app's base path, which `withSentry` (SolidStart 1) or
7
+ * `sentrySolidStart` (SolidStart 2) defines at build time. A `basePath` the user set wins.
8
+ */
6
9
  function applyTunnelBasePath(options) {
7
- const basePath = typeof __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__ !== "undefined" ? __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__ : "";
8
- options.tunnel = core._INTERNAL_applyTunnelDefaults(options.tunnel, { basePath });
10
+ const basePath = typeof __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__ !== "undefined" ? __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__ : "";
11
+ options.tunnel = (0, _sentry_core._INTERNAL_applyBrowserTunnelDefaults)(options.tunnel, { basePath });
9
12
  }
10
-
11
13
  exports.TUNNEL_BASE_PATH_GLOBAL = TUNNEL_BASE_PATH_GLOBAL;
12
14
  exports.applyTunnelBasePath = applyTunnelBasePath;
13
- //# sourceMappingURL=tunnel.js.map
15
+
16
+ //# sourceMappingURL=tunnel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tunnel.js","sources":["../../../src/common/tunnel.ts"],"sourcesContent":["import type { Options } from '@sentry/core';\nimport { _INTERNAL_applyTunnelDefaults as applyTunnelDefaults } from '@sentry/core';\n\n/** Set on the server by `withSentry` to the app's `server.baseURL`. */\nexport const TUNNEL_BASE_PATH_GLOBAL = '__sentry_solidstart_base_path';\n\ndeclare const __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__: string | undefined;\n\n/**\n * Serves the browser's managed tunnel under the app's base path, which `withSentry` (SolidStart 1) or\n * `sentrySolidStart` (SolidStart 2) defines at build time. A `basePath` the user set wins.\n */\nexport function applyTunnelBasePath(options: Pick<Options, 'tunnel'>): void {\n const basePath =\n typeof __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__ !== 'undefined' ? __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__ : '';\n options.tunnel = applyTunnelDefaults(options.tunnel, { basePath });\n}\n"],"names":["applyTunnelDefaults"],"mappings":";;;;AAIO,MAAM,uBAAA,GAA0B;AAQhC,SAAS,oBAAoB,OAAA,EAAwC;AAC1E,EAAA,MAAM,QAAA,GACJ,OAAO,sCAAA,KAA2C,WAAA,GAAc,sCAAA,GAAyC,EAAA;AAC3G,EAAA,OAAA,CAAQ,SAASA,kCAAA,CAAoB,OAAA,CAAQ,MAAA,EAAQ,EAAE,UAAU,CAAA;AACnE;;;;;"}
1
+ {"version":3,"file":"tunnel.js","names":["applyBrowserTunnelDefaults"],"sources":["../../../src/common/tunnel.ts"],"sourcesContent":["import type { Options } from '@sentry/core';\nimport { _INTERNAL_applyBrowserTunnelDefaults as applyBrowserTunnelDefaults } from '@sentry/core';\n\n/** Set on the server by `withSentry` to the app's `server.baseURL`. */\nexport const TUNNEL_BASE_PATH_GLOBAL = '__sentry_solidstart_base_path';\n\ndeclare const __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__: string | undefined;\n\n/**\n * Serves the browser's managed tunnel under the app's base path, which `withSentry` (SolidStart 1) or\n * `sentrySolidStart` (SolidStart 2) defines at build time. A `basePath` the user set wins.\n */\nexport function applyTunnelBasePath(options: Pick<Options, 'tunnel'>): void {\n const basePath =\n typeof __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__ !== 'undefined' ? __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__ : '';\n options.tunnel = applyBrowserTunnelDefaults(options.tunnel, { basePath });\n}\n"],"mappings":";;;AAIA,MAAa,0BAA0B;;;;;AAQvC,SAAgB,oBAAoB,SAAwC;CAC1E,MAAM,WACJ,OAAO,2CAA2C,cAAc,yCAAyC;CAC3G,QAAQ,UAAA,GAASA,aAAAA,qCAAAA,CAA2B,QAAQ,QAAQ,EAAE,SAAS,CAAC;AAC1E"}
@@ -1,123 +1,122 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const core = require('@sentry/core');
4
- const fs = require('fs');
5
- const path = require('path');
6
- const wrapServerEntryWithDynamicImport = require('./wrapServerEntryWithDynamicImport.js');
7
-
1
+ const require_runtime = require("../_virtual/_rolldown/runtime.js");
2
+ const require_wrapServerEntryWithDynamicImport = require("./wrapServerEntryWithDynamicImport.js");
3
+ let _sentry_core = require("@sentry/core");
4
+ let fs = require("fs");
5
+ fs = require_runtime.__toESM(fs);
6
+ let path = require("path");
7
+ path = require_runtime.__toESM(path);
8
+ // src/config/addInstrumentation.ts
8
9
  const staticHostPresets = ["github_pages"];
9
10
  const serverFilePresets = ["netlify"];
11
+ /**
12
+ * Adds the built `instrument.server.js` file to the output directory.
13
+ *
14
+ * As Sentry also imports the release injection file, this needs to be copied over manually as well.
15
+ * TODO: The mechanism of manually copying those files could maybe be improved
16
+ *
17
+ * This will no-op if no `instrument.server.js` file was found in the
18
+ * build directory.
19
+ */
10
20
  async function addInstrumentationFileToBuild(nitro) {
11
- nitro.hooks.hook("close", async () => {
12
- if (staticHostPresets.includes(nitro.options.preset)) {
13
- return;
14
- }
15
- const buildDir = nitro.options.buildDir;
16
- const serverDir = nitro.options.output.serverDir;
17
- try {
18
- const assetsServerDir = path.join(serverDir, "assets");
19
- if (!fs.existsSync(assetsServerDir)) {
20
- await fs.promises.mkdir(assetsServerDir, { recursive: true });
21
- core.consoleSandbox(() => {
22
- console.log(`[Sentry SolidStart withSentry] Successfully created directory ${assetsServerDir}.`);
23
- });
24
- }
25
- try {
26
- const ssrAssetsPath = path.resolve(buildDir, "build", "ssr", "assets");
27
- const assetsBuildDir = await fs.promises.readdir(ssrAssetsPath);
28
- const releaseInjectionFile = assetsBuildDir.find(
29
- (file) => /^_sentry-release-injection-file-.*\.(js|mjs)$/.test(file)
30
- );
31
- if (releaseInjectionFile) {
32
- const releaseSource = path.resolve(ssrAssetsPath, releaseInjectionFile);
33
- const releaseDestination = path.resolve(assetsServerDir, releaseInjectionFile);
34
- await fs.promises.copyFile(releaseSource, releaseDestination);
35
- core.consoleSandbox(() => {
36
- console.log(`[Sentry SolidStart withSentry] Successfully created ${releaseDestination}.`);
37
- });
38
- }
39
- } catch (err) {
40
- core.consoleSandbox(() => {
41
- console.warn("[Sentry SolidStart withSentry] Failed to copy release injection file.", err);
42
- });
43
- }
44
- const instrumentSource = path.resolve(buildDir, "build", "ssr", "instrument.server.js");
45
- const instrumentDestination = path.resolve(serverDir, "instrument.server.mjs");
46
- await fs.promises.copyFile(instrumentSource, instrumentDestination);
47
- core.consoleSandbox(() => {
48
- console.log(`[Sentry SolidStart withSentry] Successfully created ${instrumentDestination}.`);
49
- });
50
- } catch (error) {
51
- core.consoleSandbox(() => {
52
- console.warn("[Sentry SolidStart withSentry] Failed to add instrumentation file to build.", error);
53
- });
54
- }
55
- });
21
+ nitro.hooks.hook("close", async () => {
22
+ if (staticHostPresets.includes(nitro.options.preset)) return;
23
+ const buildDir = nitro.options.buildDir;
24
+ const serverDir = nitro.options.output.serverDir;
25
+ try {
26
+ const assetsServerDir = path.join(serverDir, "assets");
27
+ if (!fs.existsSync(assetsServerDir)) {
28
+ await fs.promises.mkdir(assetsServerDir, { recursive: true });
29
+ (0, _sentry_core.consoleSandbox)(() => {
30
+ console.log(`[Sentry SolidStart withSentry] Successfully created directory ${assetsServerDir}.`);
31
+ });
32
+ }
33
+ try {
34
+ const ssrAssetsPath = path.resolve(buildDir, "build", "ssr", "assets");
35
+ const releaseInjectionFile = (await fs.promises.readdir(ssrAssetsPath)).find((file) => /^_sentry-release-injection-file-.*\.(js|mjs)$/.test(file));
36
+ if (releaseInjectionFile) {
37
+ const releaseSource = path.resolve(ssrAssetsPath, releaseInjectionFile);
38
+ const releaseDestination = path.resolve(assetsServerDir, releaseInjectionFile);
39
+ await fs.promises.copyFile(releaseSource, releaseDestination);
40
+ (0, _sentry_core.consoleSandbox)(() => {
41
+ console.log(`[Sentry SolidStart withSentry] Successfully created ${releaseDestination}.`);
42
+ });
43
+ }
44
+ } catch (err) {
45
+ (0, _sentry_core.consoleSandbox)(() => {
46
+ console.warn("[Sentry SolidStart withSentry] Failed to copy release injection file.", err);
47
+ });
48
+ }
49
+ const instrumentSource = path.resolve(buildDir, "build", "ssr", "instrument.server.js");
50
+ const instrumentDestination = path.resolve(serverDir, "instrument.server.mjs");
51
+ await fs.promises.copyFile(instrumentSource, instrumentDestination);
52
+ (0, _sentry_core.consoleSandbox)(() => {
53
+ console.log(`[Sentry SolidStart withSentry] Successfully created ${instrumentDestination}.`);
54
+ });
55
+ } catch (error) {
56
+ (0, _sentry_core.consoleSandbox)(() => {
57
+ console.warn("[Sentry SolidStart withSentry] Failed to add instrumentation file to build.", error);
58
+ });
59
+ }
60
+ });
56
61
  }
62
+ /**
63
+ * Adds an `instrument.server.mjs` import to the top of the server entry file.
64
+ *
65
+ * This is meant as an escape hatch and should only be used in environments where
66
+ * it's not possible to `--import` the file instead as it comes with a limited
67
+ * tracing experience, only collecting http traces.
68
+ */
57
69
  async function addSentryTopImport(nitro) {
58
- nitro.hooks.hook("close", async () => {
59
- const buildPreset = nitro.options.preset;
60
- const serverDir = nitro.options.output.serverDir;
61
- if (staticHostPresets.includes(buildPreset)) {
62
- return;
63
- }
64
- const instrumentationFile = path.resolve(serverDir, "instrument.server.mjs");
65
- const serverEntryFileName = serverFilePresets.includes(buildPreset) ? "server.mjs" : "index.mjs";
66
- const serverEntryFile = path.resolve(serverDir, serverEntryFileName);
67
- try {
68
- await fs.promises.access(instrumentationFile, fs.constants.F_OK);
69
- } catch (error) {
70
- core.consoleSandbox(() => {
71
- console.warn(
72
- `[Sentry SolidStart withSentry] Failed to add \`${instrumentationFile}\` as top level import to \`${serverEntryFile}\`.`,
73
- error
74
- );
75
- });
76
- return;
77
- }
78
- try {
79
- const content = await fs.promises.readFile(serverEntryFile, "utf-8");
80
- const updatedContent = `import './instrument.server.mjs';
81
- ${content}`;
82
- await fs.promises.writeFile(serverEntryFile, updatedContent);
83
- core.consoleSandbox(() => {
84
- console.log(
85
- `[Sentry SolidStart withSentry] Added \`${instrumentationFile}\` as top level import to \`${serverEntryFile}\`.`
86
- );
87
- });
88
- } catch (error) {
89
- console.warn(
90
- `[Sentry SolidStart withSentry] An error occurred when trying to add \`${instrumentationFile}\` as top level import to \`${serverEntryFile}\`.`,
91
- error
92
- );
93
- }
94
- });
70
+ nitro.hooks.hook("close", async () => {
71
+ const buildPreset = nitro.options.preset;
72
+ const serverDir = nitro.options.output.serverDir;
73
+ if (staticHostPresets.includes(buildPreset)) return;
74
+ const instrumentationFile = path.resolve(serverDir, "instrument.server.mjs");
75
+ const serverEntryFileName = serverFilePresets.includes(buildPreset) ? "server.mjs" : "index.mjs";
76
+ const serverEntryFile = path.resolve(serverDir, serverEntryFileName);
77
+ try {
78
+ await fs.promises.access(instrumentationFile, fs.constants.F_OK);
79
+ } catch (error) {
80
+ (0, _sentry_core.consoleSandbox)(() => {
81
+ console.warn(`[Sentry SolidStart withSentry] Failed to add \`${instrumentationFile}\` as top level import to \`${serverEntryFile}\`.`, error);
82
+ });
83
+ return;
84
+ }
85
+ try {
86
+ const updatedContent = `import './instrument.server.mjs';\n${await fs.promises.readFile(serverEntryFile, "utf-8")}`;
87
+ await fs.promises.writeFile(serverEntryFile, updatedContent);
88
+ (0, _sentry_core.consoleSandbox)(() => {
89
+ console.log(`[Sentry SolidStart withSentry] Added \`${instrumentationFile}\` as top level import to \`${serverEntryFile}\`.`);
90
+ });
91
+ } catch (error) {
92
+ console.warn(`[Sentry SolidStart withSentry] An error occurred when trying to add \`${instrumentationFile}\` as top level import to \`${serverEntryFile}\`.`, error);
93
+ }
94
+ });
95
95
  }
96
- async function addDynamicImportEntryFileWrapper({
97
- nitro,
98
- rollupConfig,
99
- sentryPluginOptions
100
- }) {
101
- if (staticHostPresets.includes(nitro.options.preset)) {
102
- return;
103
- }
104
- const srcDir = nitro.options.srcDir;
105
- const serverInstrumentationPath = path.resolve(srcDir, "src", "instrument.server.ts");
106
- const instrumentationFileName = sentryPluginOptions.instrumentation ? path.basename(sentryPluginOptions.instrumentation) : "";
107
- rollupConfig.plugins.push(
108
- wrapServerEntryWithDynamicImport.wrapServerEntryWithDynamicImport({
109
- serverConfigFileName: sentryPluginOptions.instrumentation ? path.join(path.dirname(instrumentationFileName), path.parse(instrumentationFileName).name) : "instrument.server",
110
- serverEntrypointFileName: sentryPluginOptions.serverEntrypointFileName || nitro.options.preset,
111
- resolvedServerConfigPath: serverInstrumentationPath,
112
- entrypointWrappedFunctions: sentryPluginOptions.experimental_entrypointWrappedFunctions,
113
- debug: sentryPluginOptions.debug
114
- })
115
- );
96
+ /**
97
+ * This function modifies the Rollup configuration to include a plugin that wraps the entry file with a dynamic import (`import()`)
98
+ * and adds the Sentry server config with the static `import` declaration.
99
+ *
100
+ * With this, the Sentry server config can be loaded before all other modules of the application.
101
+ * See: https://nodejs.org/api/module.html#enabling
102
+ */
103
+ async function addDynamicImportEntryFileWrapper({ nitro, rollupConfig, sentryPluginOptions }) {
104
+ if (staticHostPresets.includes(nitro.options.preset)) return;
105
+ const srcDir = nitro.options.srcDir;
106
+ const serverInstrumentationPath = path.resolve(srcDir, "src", "instrument.server.ts");
107
+ const instrumentationFileName = sentryPluginOptions.instrumentation ? path.basename(sentryPluginOptions.instrumentation) : "";
108
+ rollupConfig.plugins.push(require_wrapServerEntryWithDynamicImport.wrapServerEntryWithDynamicImport({
109
+ serverConfigFileName: sentryPluginOptions.instrumentation ? path.join(path.dirname(instrumentationFileName), path.parse(instrumentationFileName).name) : "instrument.server",
110
+ serverEntrypointFileName: sentryPluginOptions.serverEntrypointFileName || nitro.options.preset,
111
+ resolvedServerConfigPath: serverInstrumentationPath,
112
+ entrypointWrappedFunctions: sentryPluginOptions.experimental_entrypointWrappedFunctions,
113
+ debug: sentryPluginOptions.debug
114
+ }));
116
115
  }
117
-
118
116
  exports.addDynamicImportEntryFileWrapper = addDynamicImportEntryFileWrapper;
119
117
  exports.addInstrumentationFileToBuild = addInstrumentationFileToBuild;
120
118
  exports.addSentryTopImport = addSentryTopImport;
121
119
  exports.serverFilePresets = serverFilePresets;
122
120
  exports.staticHostPresets = staticHostPresets;
123
- //# sourceMappingURL=addInstrumentation.js.map
121
+
122
+ //# sourceMappingURL=addInstrumentation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"addInstrumentation.js","sources":["../../../src/config/addInstrumentation.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport * as fs from 'fs';\nimport type { Nitro } from 'nitropack';\nimport * as path from 'path';\nimport type { SentrySolidStartPluginOptions } from '../vite/types';\nimport type { RollupConfig } from './types';\nimport { wrapServerEntryWithDynamicImport } from './wrapServerEntryWithDynamicImport';\n\n// Nitro presets for hosts that only host static files\nexport const staticHostPresets = ['github_pages'];\n// Nitro presets for hosts that use `server.mjs` as opposed to `index.mjs`\nexport const serverFilePresets = ['netlify'];\n\n/**\n * Adds the built `instrument.server.js` file to the output directory.\n *\n * As Sentry also imports the release injection file, this needs to be copied over manually as well.\n * TODO: The mechanism of manually copying those files could maybe be improved\n *\n * This will no-op if no `instrument.server.js` file was found in the\n * build directory.\n */\nexport async function addInstrumentationFileToBuild(nitro: Nitro): Promise<void> {\n nitro.hooks.hook('close', async () => {\n // Static file hosts have no server component so there's nothing to do\n if (staticHostPresets.includes(nitro.options.preset)) {\n return;\n }\n\n const buildDir = nitro.options.buildDir;\n const serverDir = nitro.options.output.serverDir;\n\n try {\n // 1. Create assets directory first (for release-injection-file)\n const assetsServerDir = path.join(serverDir, 'assets');\n if (!fs.existsSync(assetsServerDir)) {\n await fs.promises.mkdir(assetsServerDir, { recursive: true });\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(`[Sentry SolidStart withSentry] Successfully created directory ${assetsServerDir}.`);\n });\n }\n\n // 2. Copy release injection file if available\n try {\n const ssrAssetsPath = path.resolve(buildDir, 'build', 'ssr', 'assets');\n const assetsBuildDir = await fs.promises.readdir(ssrAssetsPath);\n const releaseInjectionFile = assetsBuildDir.find(file =>\n /^_sentry-release-injection-file-.*\\.(js|mjs)$/.test(file),\n );\n\n if (releaseInjectionFile) {\n const releaseSource = path.resolve(ssrAssetsPath, releaseInjectionFile);\n const releaseDestination = path.resolve(assetsServerDir, releaseInjectionFile);\n\n await fs.promises.copyFile(releaseSource, releaseDestination);\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(`[Sentry SolidStart withSentry] Successfully created ${releaseDestination}.`);\n });\n }\n } catch (err) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn('[Sentry SolidStart withSentry] Failed to copy release injection file.', err);\n });\n }\n\n // 3. Copy Sentry server instrumentation file\n const instrumentSource = path.resolve(buildDir, 'build', 'ssr', 'instrument.server.js');\n const instrumentDestination = path.resolve(serverDir, 'instrument.server.mjs');\n\n await fs.promises.copyFile(instrumentSource, instrumentDestination);\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(`[Sentry SolidStart withSentry] Successfully created ${instrumentDestination}.`);\n });\n } catch (error) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn('[Sentry SolidStart withSentry] Failed to add instrumentation file to build.', error);\n });\n }\n });\n}\n\n/**\n * Adds an `instrument.server.mjs` import to the top of the server entry file.\n *\n * This is meant as an escape hatch and should only be used in environments where\n * it's not possible to `--import` the file instead as it comes with a limited\n * tracing experience, only collecting http traces.\n */\nexport async function addSentryTopImport(nitro: Nitro): Promise<void> {\n nitro.hooks.hook('close', async () => {\n const buildPreset = nitro.options.preset;\n const serverDir = nitro.options.output.serverDir;\n\n // Static file hosts have no server component so there's nothing to do\n if (staticHostPresets.includes(buildPreset)) {\n return;\n }\n\n const instrumentationFile = path.resolve(serverDir, 'instrument.server.mjs');\n const serverEntryFileName = serverFilePresets.includes(buildPreset) ? 'server.mjs' : 'index.mjs';\n const serverEntryFile = path.resolve(serverDir, serverEntryFileName);\n\n try {\n await fs.promises.access(instrumentationFile, fs.constants.F_OK);\n } catch (error) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry SolidStart withSentry] Failed to add \\`${instrumentationFile}\\` as top level import to \\`${serverEntryFile}\\`.`,\n error,\n );\n });\n return;\n }\n\n try {\n const content = await fs.promises.readFile(serverEntryFile, 'utf-8');\n const updatedContent = `import './instrument.server.mjs';\\n${content}`;\n await fs.promises.writeFile(serverEntryFile, updatedContent);\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry SolidStart withSentry] Added \\`${instrumentationFile}\\` as top level import to \\`${serverEntryFile}\\`.`,\n );\n });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry SolidStart withSentry] An error occurred when trying to add \\`${instrumentationFile}\\` as top level import to \\`${serverEntryFile}\\`.`,\n error,\n );\n }\n });\n}\n\n/**\n * This function modifies the Rollup configuration to include a plugin that wraps the entry file with a dynamic import (`import()`)\n * and adds the Sentry server config with the static `import` declaration.\n *\n * With this, the Sentry server config can be loaded before all other modules of the application.\n * See: https://nodejs.org/api/module.html#enabling\n */\nexport async function addDynamicImportEntryFileWrapper({\n nitro,\n rollupConfig,\n sentryPluginOptions,\n}: {\n nitro: Nitro;\n rollupConfig: RollupConfig;\n sentryPluginOptions: Omit<SentrySolidStartPluginOptions, 'experimental_entrypointWrappedFunctions'> &\n Required<Pick<SentrySolidStartPluginOptions, 'experimental_entrypointWrappedFunctions'>>;\n}): Promise<void> {\n // Static file hosts have no server component so there's nothing to do\n if (staticHostPresets.includes(nitro.options.preset)) {\n return;\n }\n\n const srcDir = nitro.options.srcDir;\n // todo allow other instrumentation paths\n const serverInstrumentationPath = path.resolve(srcDir, 'src', 'instrument.server.ts');\n\n const instrumentationFileName = sentryPluginOptions.instrumentation\n ? path.basename(sentryPluginOptions.instrumentation)\n : '';\n\n rollupConfig.plugins.push(\n wrapServerEntryWithDynamicImport({\n serverConfigFileName: sentryPluginOptions.instrumentation\n ? path.join(path.dirname(instrumentationFileName), path.parse(instrumentationFileName).name)\n : 'instrument.server',\n serverEntrypointFileName: sentryPluginOptions.serverEntrypointFileName || nitro.options.preset,\n resolvedServerConfigPath: serverInstrumentationPath,\n entrypointWrappedFunctions: sentryPluginOptions.experimental_entrypointWrappedFunctions,\n debug: sentryPluginOptions.debug,\n }),\n );\n}\n"],"names":["consoleSandbox","wrapServerEntryWithDynamicImport"],"mappings":";;;;;;;AASO,MAAM,iBAAA,GAAoB,CAAC,cAAc;AAEzC,MAAM,iBAAA,GAAoB,CAAC,SAAS;AAW3C,eAAsB,8BAA8B,KAAA,EAA6B;AAC/E,EAAA,KAAA,CAAM,KAAA,CAAM,IAAA,CAAK,OAAA,EAAS,YAAY;AAEpC,IAAA,IAAI,iBAAA,CAAkB,QAAA,CAAS,KAAA,CAAM,OAAA,CAAQ,MAAM,CAAA,EAAG;AACpD,MAAA;AAAA,IACF;AAEA,IAAA,MAAM,QAAA,GAAW,MAAM,OAAA,CAAQ,QAAA;AAC/B,IAAA,MAAM,SAAA,GAAY,KAAA,CAAM,OAAA,CAAQ,MAAA,CAAO,SAAA;AAEvC,IAAA,IAAI;AAEF,MAAA,MAAM,eAAA,GAAkB,IAAA,CAAK,IAAA,CAAK,SAAA,EAAW,QAAQ,CAAA;AACrD,MAAA,IAAI,CAAC,EAAA,CAAG,UAAA,CAAW,eAAe,CAAA,EAAG;AACnC,QAAA,MAAM,GAAG,QAAA,CAAS,KAAA,CAAM,iBAAiB,EAAE,SAAA,EAAW,MAAM,CAAA;AAC5D,QAAAA,mBAAA,CAAe,MAAM;AAEnB,UAAA,OAAA,CAAQ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C,iEAAA,CAAiC;AAAA,MAC/B,oBAAA,EAAsB,mBAAA,CAAoB,eAAA,GACtC,IAAA,CAAK,KAAK,IAAA,CAAK,OAAA,CAAQ,uBAAuB,CAAA,EAAG,IAAA,CAAK,KAAA,CAAM,uBAAuB,CAAA,CAAE,IAAI,CAAA,GACzF,mBAAA;AAAA,MACJ,wBAAA,EAA0B,mBAAA,CAAoB,wBAAA,IAA4B,KAAA,CAAM,OAAA,CAAQ,MAAA;AAAA,MACxF,wBAAA,EAA0B,yBAAA;AAAA,MAC1B,4BAA4B,mBAAA,CAAoB,uCAAA;AAAA,MAChD,OAAO,mBAAA,CAAoB;AAAA,KAC5B;AAAA,GACH;AACF;;;;;;;;"}
1
+ {"version":3,"file":"addInstrumentation.js","names":["consoleSandbox","wrapServerEntryWithDynamicImport"],"sources":["../../../src/config/addInstrumentation.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport * as fs from 'fs';\nimport type { Nitro } from 'nitropack';\nimport * as path from 'path';\nimport type { SentrySolidStartPluginOptions } from '../vite/types';\nimport type { RollupConfig } from './types';\nimport { wrapServerEntryWithDynamicImport } from './wrapServerEntryWithDynamicImport';\n\n// Nitro presets for hosts that only host static files\nexport const staticHostPresets = ['github_pages'];\n// Nitro presets for hosts that use `server.mjs` as opposed to `index.mjs`\nexport const serverFilePresets = ['netlify'];\n\n/**\n * Adds the built `instrument.server.js` file to the output directory.\n *\n * As Sentry also imports the release injection file, this needs to be copied over manually as well.\n * TODO: The mechanism of manually copying those files could maybe be improved\n *\n * This will no-op if no `instrument.server.js` file was found in the\n * build directory.\n */\nexport async function addInstrumentationFileToBuild(nitro: Nitro): Promise<void> {\n nitro.hooks.hook('close', async () => {\n // Static file hosts have no server component so there's nothing to do\n if (staticHostPresets.includes(nitro.options.preset)) {\n return;\n }\n\n const buildDir = nitro.options.buildDir;\n const serverDir = nitro.options.output.serverDir;\n\n try {\n // 1. Create assets directory first (for release-injection-file)\n const assetsServerDir = path.join(serverDir, 'assets');\n if (!fs.existsSync(assetsServerDir)) {\n await fs.promises.mkdir(assetsServerDir, { recursive: true });\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(`[Sentry SolidStart withSentry] Successfully created directory ${assetsServerDir}.`);\n });\n }\n\n // 2. Copy release injection file if available\n try {\n const ssrAssetsPath = path.resolve(buildDir, 'build', 'ssr', 'assets');\n const assetsBuildDir = await fs.promises.readdir(ssrAssetsPath);\n const releaseInjectionFile = assetsBuildDir.find(file =>\n /^_sentry-release-injection-file-.*\\.(js|mjs)$/.test(file),\n );\n\n if (releaseInjectionFile) {\n const releaseSource = path.resolve(ssrAssetsPath, releaseInjectionFile);\n const releaseDestination = path.resolve(assetsServerDir, releaseInjectionFile);\n\n await fs.promises.copyFile(releaseSource, releaseDestination);\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(`[Sentry SolidStart withSentry] Successfully created ${releaseDestination}.`);\n });\n }\n } catch (err) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn('[Sentry SolidStart withSentry] Failed to copy release injection file.', err);\n });\n }\n\n // 3. Copy Sentry server instrumentation file\n const instrumentSource = path.resolve(buildDir, 'build', 'ssr', 'instrument.server.js');\n const instrumentDestination = path.resolve(serverDir, 'instrument.server.mjs');\n\n await fs.promises.copyFile(instrumentSource, instrumentDestination);\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(`[Sentry SolidStart withSentry] Successfully created ${instrumentDestination}.`);\n });\n } catch (error) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn('[Sentry SolidStart withSentry] Failed to add instrumentation file to build.', error);\n });\n }\n });\n}\n\n/**\n * Adds an `instrument.server.mjs` import to the top of the server entry file.\n *\n * This is meant as an escape hatch and should only be used in environments where\n * it's not possible to `--import` the file instead as it comes with a limited\n * tracing experience, only collecting http traces.\n */\nexport async function addSentryTopImport(nitro: Nitro): Promise<void> {\n nitro.hooks.hook('close', async () => {\n const buildPreset = nitro.options.preset;\n const serverDir = nitro.options.output.serverDir;\n\n // Static file hosts have no server component so there's nothing to do\n if (staticHostPresets.includes(buildPreset)) {\n return;\n }\n\n const instrumentationFile = path.resolve(serverDir, 'instrument.server.mjs');\n const serverEntryFileName = serverFilePresets.includes(buildPreset) ? 'server.mjs' : 'index.mjs';\n const serverEntryFile = path.resolve(serverDir, serverEntryFileName);\n\n try {\n await fs.promises.access(instrumentationFile, fs.constants.F_OK);\n } catch (error) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry SolidStart withSentry] Failed to add \\`${instrumentationFile}\\` as top level import to \\`${serverEntryFile}\\`.`,\n error,\n );\n });\n return;\n }\n\n try {\n const content = await fs.promises.readFile(serverEntryFile, 'utf-8');\n const updatedContent = `import './instrument.server.mjs';\\n${content}`;\n await fs.promises.writeFile(serverEntryFile, updatedContent);\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry SolidStart withSentry] Added \\`${instrumentationFile}\\` as top level import to \\`${serverEntryFile}\\`.`,\n );\n });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry SolidStart withSentry] An error occurred when trying to add \\`${instrumentationFile}\\` as top level import to \\`${serverEntryFile}\\`.`,\n error,\n );\n }\n });\n}\n\n/**\n * This function modifies the Rollup configuration to include a plugin that wraps the entry file with a dynamic import (`import()`)\n * and adds the Sentry server config with the static `import` declaration.\n *\n * With this, the Sentry server config can be loaded before all other modules of the application.\n * See: https://nodejs.org/api/module.html#enabling\n */\nexport async function addDynamicImportEntryFileWrapper({\n nitro,\n rollupConfig,\n sentryPluginOptions,\n}: {\n nitro: Nitro;\n rollupConfig: RollupConfig;\n sentryPluginOptions: Omit<SentrySolidStartPluginOptions, 'experimental_entrypointWrappedFunctions'> &\n Required<Pick<SentrySolidStartPluginOptions, 'experimental_entrypointWrappedFunctions'>>;\n}): Promise<void> {\n // Static file hosts have no server component so there's nothing to do\n if (staticHostPresets.includes(nitro.options.preset)) {\n return;\n }\n\n const srcDir = nitro.options.srcDir;\n // todo allow other instrumentation paths\n const serverInstrumentationPath = path.resolve(srcDir, 'src', 'instrument.server.ts');\n\n const instrumentationFileName = sentryPluginOptions.instrumentation\n ? path.basename(sentryPluginOptions.instrumentation)\n : '';\n\n rollupConfig.plugins.push(\n wrapServerEntryWithDynamicImport({\n serverConfigFileName: sentryPluginOptions.instrumentation\n ? path.join(path.dirname(instrumentationFileName), path.parse(instrumentationFileName).name)\n : 'instrument.server',\n serverEntrypointFileName: sentryPluginOptions.serverEntrypointFileName || nitro.options.preset,\n resolvedServerConfigPath: serverInstrumentationPath,\n entrypointWrappedFunctions: sentryPluginOptions.experimental_entrypointWrappedFunctions,\n debug: sentryPluginOptions.debug,\n }),\n );\n}\n"],"mappings":";;;;;;;;AASA,MAAa,oBAAoB,CAAC,cAAc;AAEhD,MAAa,oBAAoB,CAAC,SAAS;;;;;;;;;;AAW3C,eAAsB,8BAA8B,OAA6B;CAC/E,MAAM,MAAM,KAAK,SAAS,YAAY;EAEpC,IAAI,kBAAkB,SAAS,MAAM,QAAQ,MAAM,GACjD;EAGF,MAAM,WAAW,MAAM,QAAQ;EAC/B,MAAM,YAAY,MAAM,QAAQ,OAAO;EAEvC,IAAI;GAEF,MAAM,kBAAkB,KAAK,KAAK,WAAW,QAAQ;GACrD,IAAI,CAAC,GAAG,WAAW,eAAe,GAAG;IACnC,MAAM,GAAG,SAAS,MAAM,iBAAiB,EAAE,WAAW,KAAK,CAAC;IAC5DA,CAAAA,GAAAA,aAAAA,eAAAA,OAAqB;KAEnB,QAAQ,IAAI,iEAAiE,gBAAgB,EAAE;IACjG,CAAC;GACH;GAGA,IAAI;IACF,MAAM,gBAAgB,KAAK,QAAQ,UAAU,SAAS,OAAO,QAAQ;IAErE,MAAM,wBAAuB,MADA,GAAG,SAAS,QAAQ,aAAa,EAAA,CAClB,MAAK,SAC/C,gDAAgD,KAAK,IAAI,CAC3D;IAEA,IAAI,sBAAsB;KACxB,MAAM,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