@sentry/solidstart 8.53.0 → 9.0.0-alpha.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 (56) hide show
  1. package/README.md +83 -37
  2. package/build/cjs/client/index.js +1 -1
  3. package/build/cjs/client/sdk.js +1 -1
  4. package/build/cjs/client/solidrouter.js +1 -1
  5. package/build/cjs/common/debug-build.js +1 -1
  6. package/build/cjs/config/addInstrumentation.js +1 -1
  7. package/build/cjs/config/withSentry.js +3 -7
  8. package/build/cjs/config/withSentry.js.map +1 -1
  9. package/build/cjs/config/wrapServerEntryWithDynamicImport.js +18 -20
  10. package/build/cjs/config/wrapServerEntryWithDynamicImport.js.map +1 -1
  11. package/build/cjs/index.client.js +1 -1
  12. package/build/cjs/index.server.js +1 -11
  13. package/build/cjs/index.server.js.map +1 -1
  14. package/build/cjs/server/index.js +1 -11
  15. package/build/cjs/server/index.js.map +1 -1
  16. package/build/cjs/server/middleware.js +2 -2
  17. package/build/cjs/server/middleware.js.map +1 -1
  18. package/build/cjs/server/sdk.js +1 -1
  19. package/build/cjs/server/solidrouter.js +1 -1
  20. package/build/cjs/server/utils.js +2 -6
  21. package/build/cjs/server/utils.js.map +1 -1
  22. package/build/cjs/server/withServerActionInstrumentation.js +1 -1
  23. package/build/cjs/solidrouter.client.js +1 -1
  24. package/build/cjs/solidrouter.js +1 -1
  25. package/build/cjs/solidrouter.server.js +1 -1
  26. package/build/cjs/vite/buildInstrumentationFile.js +1 -1
  27. package/build/cjs/vite/sentrySolidStartVite.js +8 -29
  28. package/build/cjs/vite/sentrySolidStartVite.js.map +1 -1
  29. package/build/cjs/vite/sourceMaps.js +123 -49
  30. package/build/cjs/vite/sourceMaps.js.map +1 -1
  31. package/build/esm/config/withSentry.js +2 -3
  32. package/build/esm/config/withSentry.js.map +1 -1
  33. package/build/esm/config/wrapServerEntryWithDynamicImport.js +17 -19
  34. package/build/esm/config/wrapServerEntryWithDynamicImport.js.map +1 -1
  35. package/build/esm/index.server.js +1 -1
  36. package/build/esm/package.json +1 -1
  37. package/build/esm/server/index.js +1 -1
  38. package/build/esm/server/middleware.js +1 -1
  39. package/build/esm/server/middleware.js.map +1 -1
  40. package/build/esm/server/utils.js +1 -2
  41. package/build/esm/server/utils.js.map +1 -1
  42. package/build/esm/vite/sentrySolidStartVite.js +8 -25
  43. package/build/esm/vite/sentrySolidStartVite.js.map +1 -1
  44. package/build/esm/vite/sourceMaps.js +119 -43
  45. package/build/esm/vite/sourceMaps.js.map +1 -1
  46. package/build/types/config/utils.d.ts.map +1 -1
  47. package/build/types/config/wrapServerEntryWithDynamicImport.d.ts.map +1 -1
  48. package/build/types/index.types.d.ts +0 -1
  49. package/build/types/index.types.d.ts.map +1 -1
  50. package/build/types/server/index.d.ts +1 -1
  51. package/build/types/server/index.d.ts.map +1 -1
  52. package/build/types/vite/sentrySolidStartVite.d.ts +1 -18
  53. package/build/types/vite/sentrySolidStartVite.d.ts.map +1 -1
  54. package/build/types/vite/sourceMaps.d.ts +23 -5
  55. package/build/types/vite/sourceMaps.d.ts.map +1 -1
  56. package/package.json +6 -6
package/README.md CHANGED
@@ -60,7 +60,7 @@ mount(() => <StartClient />, document.getElementById('app'));
60
60
 
61
61
  ### 3. Server-side Setup
62
62
 
63
- Create an instrument file named `instrument.server.mjs` and add your initialization code for the server-side SDK.
63
+ Create an instrument file named `src/instrument.server.ts` and add your initialization code for the server-side SDK.
64
64
 
65
65
  ```javascript
66
66
  import * as Sentry from '@sentry/solidstart';
@@ -101,16 +101,94 @@ export default defineConfig({
101
101
  The Sentry middleware enhances the data collected by Sentry on the server side by enabling distributed tracing between
102
102
  the client and server.
103
103
 
104
- ### 5. Run your application
104
+ ### 5. Configure your application
105
+
106
+ For Sentry to work properly, SolidStart's `app.config.ts` has to be modified. Wrap your config with `withSentry` and
107
+ configure it to upload source maps.
108
+
109
+ If your `instrument.server.ts` file is not located in the `src` folder, you can specify the path via the
110
+ `instrumentation` option to `withSentry`.
111
+
112
+ To upload source maps, configure an auth token. Auth tokens can be passed explicitly with the `authToken` option, with a
113
+ `SENTRY_AUTH_TOKEN` environment variable, or with an `.env.sentry-build-plugin` file in the working directory when
114
+ building your project. We recommend adding the auth token to your CI/CD environment as an environment variable.
115
+
116
+ Learn more about configuring the plugin in our
117
+ [Sentry Vite Plugin documentation](https://www.npmjs.com/package/@sentry/vite-plugin).
118
+
119
+ ```typescript
120
+ import { defineConfig } from '@solidjs/start/config';
121
+ import { withSentry } from '@sentry/solidstart';
122
+
123
+ export default defineConfig(
124
+ withSentry(
125
+ {
126
+ // SolidStart config
127
+ middleware: './src/middleware.ts',
128
+ },
129
+ {
130
+ // Sentry `withSentry` options
131
+ org: process.env.SENTRY_ORG,
132
+ project: process.env.SENTRY_PROJECT,
133
+ authToken: process.env.SENTRY_AUTH_TOKEN,
134
+ debug: true,
135
+ // optional: if your `instrument.server.ts` file is not located inside `src`
136
+ instrumentation: './mypath/instrument.server.ts',
137
+ },
138
+ ),
139
+ );
140
+ ```
141
+
142
+ ### 6. Run your application
105
143
 
106
144
  Then run your app
107
145
 
108
146
  ```bash
109
- NODE_OPTIONS='--import=./instrument.server.mjs' yarn start
110
- # or
111
- NODE_OPTIONS='--require=./instrument.server.js' yarn start
147
+ NODE_OPTIONS='--import=./.output/server/instrument.server.mjs' yarn start
112
148
  ```
113
149
 
150
+ ⚠️ **Note build presets** ⚠️
151
+ Depending on [build preset](https://nitro.unjs.io/deploy), the location of `instrument.server.mjs` differs. To find out
152
+ where `instrument.server.mjs` is located, monitor the build log output for
153
+
154
+ ```bash
155
+ [Sentry SolidStart withSentry] Successfully created /my/project/path/.output/server/instrument.server.mjs.
156
+ ```
157
+
158
+ ⚠️ **Note for platforms without the ability to modify `NODE_OPTIONS` or use `--import`** ⚠️
159
+ Depending on where the application is deployed to, it might not be possible to modify or use `NODE_OPTIONS` to import
160
+ `instrument.server.mjs`.
161
+
162
+ For such platforms, we offer the option `autoInjectServerSentry: 'top-level-import'` to add a top level import of
163
+ `instrument.server.mjs` to the server entry file.
164
+
165
+ ```typescript
166
+ import { defineConfig } from '@solidjs/start/config';
167
+ import { withSentry } from '@sentry/solidstart';
168
+
169
+ export default defineConfig(
170
+ withSentry(
171
+ {
172
+ // ...
173
+ middleware: './src/middleware.ts',
174
+ },
175
+ {
176
+ org: process.env.SENTRY_ORG,
177
+ project: process.env.SENTRY_PROJECT,
178
+ authToken: process.env.SENTRY_AUTH_TOKEN,
179
+ debug: true,
180
+ // optional: if your `instrument.server.ts` file is not located inside `src`
181
+ instrumentation: './mypath/instrument.server.ts',
182
+ // optional: if NODE_OPTIONS or --import is not avaiable
183
+ autoInjectServerSentry: 'top-level-import',
184
+ },
185
+ ),
186
+ );
187
+ ```
188
+
189
+ This has a **fundamental restriction**: It only supports limited performance instrumentation. **Only basic http
190
+ instrumentation** will work, and no DB or framework-specific instrumentation will be available.
191
+
114
192
  # Solid Router
115
193
 
116
194
  The Solid Router instrumentation uses the Solid Router library to create navigation spans to ensure you collect
@@ -156,35 +234,3 @@ render(
156
234
  document.getElementById('root'),
157
235
  );
158
236
  ```
159
-
160
- ## Uploading Source Maps
161
-
162
- To upload source maps, add the `sentrySolidStartVite` plugin from `@sentry/solidstart` to your `app.config.ts` and
163
- configure an auth token. Auth tokens can be passed to the plugin explicitly with the `authToken` option, with a
164
- `SENTRY_AUTH_TOKEN` environment variable, or with an `.env.sentry-build-plugin` file in the working directory when
165
- building your project. We recommend you add the auth token to your CI/CD environment as an environment variable.
166
-
167
- Learn more about configuring the plugin in our
168
- [Sentry Vite Plugin documentation](https://www.npmjs.com/package/@sentry/vite-plugin).
169
-
170
- ```typescript
171
- // app.config.ts
172
- import { defineConfig } from '@solidjs/start/config';
173
- import { sentrySolidStartVite } from '@sentry/solidstart';
174
-
175
- export default defineConfig({
176
- // ...
177
-
178
- vite: {
179
- plugins: [
180
- sentrySolidStartVite({
181
- org: process.env.SENTRY_ORG,
182
- project: process.env.SENTRY_PROJECT,
183
- authToken: process.env.SENTRY_AUTH_TOKEN,
184
- debug: true,
185
- }),
186
- ],
187
- },
188
- // ...
189
- });
190
- ```
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const solid = require('@sentry/solid');
4
4
  const sdk = require('./sdk.js');
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const core = require('@sentry/core');
4
4
  const solid = require('@sentry/solid');
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const solidrouter = require('@sentry/solid/solidrouter');
4
4
 
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  /**
4
4
  * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const fs = require('fs');
4
4
  const path = require('path');
@@ -1,8 +1,4 @@
1
- var {
2
- _optionalChain
3
- } = require('@sentry/core');
4
-
5
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
6
2
 
7
3
  const core = require('@sentry/core');
8
4
  const sentrySolidStartVite = require('../vite/sentrySolidStartVite.js');
@@ -47,7 +43,7 @@ function withSentry(
47
43
  hooks: {
48
44
  ...hooks,
49
45
  async 'rollup:before'(nitro, config) {
50
- if (_optionalChain([sentrySolidStartPluginOptions, 'optionalAccess', _ => _.autoInjectServerSentry]) === 'experimental_dynamic-import') {
46
+ if (sentrySolidStartPluginOptions?.autoInjectServerSentry === 'experimental_dynamic-import') {
51
47
  await addInstrumentation.addDynamicImportEntryFileWrapper({ nitro, rollupConfig: config, sentryPluginOptions });
52
48
 
53
49
  sentrySolidStartPluginOptions.debug &&
@@ -57,7 +53,7 @@ function withSentry(
57
53
  } else {
58
54
  await addInstrumentation.addInstrumentationFileToBuild(nitro);
59
55
 
60
- if (_optionalChain([sentrySolidStartPluginOptions, 'optionalAccess', _2 => _2.autoInjectServerSentry]) === 'top-level-import') {
56
+ if (sentrySolidStartPluginOptions?.autoInjectServerSentry === 'top-level-import') {
61
57
  await addInstrumentation.addSentryTopImport(nitro);
62
58
  }
63
59
  }
@@ -1 +1 @@
1
- {"version":3,"file":"withSentry.js","sources":["../../../src/config/withSentry.ts"],"sourcesContent":["import { logger } from '@sentry/core';\nimport type { Nitro } from 'nitropack';\nimport { addSentryPluginToVite } from '../vite';\nimport type { SentrySolidStartPluginOptions } from '../vite/types';\nimport {\n addDynamicImportEntryFileWrapper,\n addInstrumentationFileToBuild,\n addSentryTopImport,\n} from './addInstrumentation';\nimport type { RollupConfig, SolidStartInlineConfig, SolidStartInlineServerConfig } from './types';\n\nconst defaultSentrySolidStartPluginOptions: Omit<\n SentrySolidStartPluginOptions,\n 'experimental_entrypointWrappedFunctions'\n> &\n Required<Pick<SentrySolidStartPluginOptions, 'experimental_entrypointWrappedFunctions'>> = {\n experimental_entrypointWrappedFunctions: ['default', 'handler', 'server'],\n};\n\n/**\n * Modifies the passed in Solid Start configuration with build-time enhancements such as\n * building the `instrument.server.ts` file into the appropriate build folder based on\n * build preset.\n *\n * @param solidStartConfig A Solid Start configuration object, as usually passed to `defineConfig` in `app.config.ts|js`\n * @param sentrySolidStartPluginOptions Options to configure the plugin\n * @returns The modified config to be exported and passed back into `defineConfig`\n */\nexport function withSentry(\n solidStartConfig: SolidStartInlineConfig = {},\n sentrySolidStartPluginOptions: SentrySolidStartPluginOptions,\n): SolidStartInlineConfig {\n const sentryPluginOptions = {\n ...sentrySolidStartPluginOptions,\n ...defaultSentrySolidStartPluginOptions,\n };\n\n const server = (solidStartConfig.server || {}) as SolidStartInlineServerConfig;\n const hooks = server.hooks || {};\n const vite =\n typeof solidStartConfig.vite === 'function'\n ? (...args: unknown[]) => addSentryPluginToVite(solidStartConfig.vite(...args), sentryPluginOptions)\n : addSentryPluginToVite(solidStartConfig.vite, sentryPluginOptions);\n\n return {\n ...solidStartConfig,\n vite,\n server: {\n ...server,\n hooks: {\n ...hooks,\n async 'rollup:before'(nitro: Nitro, config: RollupConfig) {\n if (sentrySolidStartPluginOptions?.autoInjectServerSentry === 'experimental_dynamic-import') {\n await addDynamicImportEntryFileWrapper({ nitro, rollupConfig: config, sentryPluginOptions });\n\n sentrySolidStartPluginOptions.debug &&\n logger.log(\n 'Wrapping the server entry file with a dynamic `import()`, so Sentry can be preloaded before the server initializes.',\n );\n } else {\n await addInstrumentationFileToBuild(nitro);\n\n if (sentrySolidStartPluginOptions?.autoInjectServerSentry === 'top-level-import') {\n await addSentryTopImport(nitro);\n }\n }\n\n // Run user provided hook\n if (hooks['rollup:before']) {\n hooks['rollup:before'](nitro);\n }\n },\n },\n },\n };\n}\n"],"names":["addSentryPluginToVite","addDynamicImportEntryFileWrapper","logger","addInstrumentationFileToBuild","addSentryTopImport"],"mappings":";;;;;;;;;;AAWA,CAAM,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;;CAIuF,EAAA;EAC3F,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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;UAEA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA;UACU,CAAI,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,CAAC,EAAE;YAC1B,KAAK,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,CAAC,CAAC,KAAK,CAAC;UACzC;QACS,CAAA;MACF,CAAA;IACF,CAAA;EACF,CAAA;AACH;;"}
1
+ {"version":3,"file":"withSentry.js","sources":["../../../src/config/withSentry.ts"],"sourcesContent":["import { logger } from '@sentry/core';\nimport type { Nitro } from 'nitropack';\nimport { addSentryPluginToVite } from '../vite';\nimport type { SentrySolidStartPluginOptions } from '../vite/types';\nimport {\n addDynamicImportEntryFileWrapper,\n addInstrumentationFileToBuild,\n addSentryTopImport,\n} from './addInstrumentation';\nimport type { RollupConfig, SolidStartInlineConfig, SolidStartInlineServerConfig } from './types';\n\nconst defaultSentrySolidStartPluginOptions: Omit<\n SentrySolidStartPluginOptions,\n 'experimental_entrypointWrappedFunctions'\n> &\n Required<Pick<SentrySolidStartPluginOptions, 'experimental_entrypointWrappedFunctions'>> = {\n experimental_entrypointWrappedFunctions: ['default', 'handler', 'server'],\n};\n\n/**\n * Modifies the passed in Solid Start configuration with build-time enhancements such as\n * building the `instrument.server.ts` file into the appropriate build folder based on\n * build preset.\n *\n * @param solidStartConfig A Solid Start configuration object, as usually passed to `defineConfig` in `app.config.ts|js`\n * @param sentrySolidStartPluginOptions Options to configure the plugin\n * @returns The modified config to be exported and passed back into `defineConfig`\n */\nexport function withSentry(\n solidStartConfig: SolidStartInlineConfig = {},\n sentrySolidStartPluginOptions: SentrySolidStartPluginOptions,\n): SolidStartInlineConfig {\n const sentryPluginOptions = {\n ...sentrySolidStartPluginOptions,\n ...defaultSentrySolidStartPluginOptions,\n };\n\n const server = (solidStartConfig.server || {}) as SolidStartInlineServerConfig;\n const hooks = server.hooks || {};\n const vite =\n typeof solidStartConfig.vite === 'function'\n ? (...args: unknown[]) => addSentryPluginToVite(solidStartConfig.vite(...args), sentryPluginOptions)\n : addSentryPluginToVite(solidStartConfig.vite, sentryPluginOptions);\n\n return {\n ...solidStartConfig,\n vite,\n server: {\n ...server,\n hooks: {\n ...hooks,\n async 'rollup:before'(nitro: Nitro, config: RollupConfig) {\n if (sentrySolidStartPluginOptions?.autoInjectServerSentry === 'experimental_dynamic-import') {\n await addDynamicImportEntryFileWrapper({ nitro, rollupConfig: config, sentryPluginOptions });\n\n sentrySolidStartPluginOptions.debug &&\n logger.log(\n 'Wrapping the server entry file with a dynamic `import()`, so Sentry can be preloaded before the server initializes.',\n );\n } else {\n await addInstrumentationFileToBuild(nitro);\n\n if (sentrySolidStartPluginOptions?.autoInjectServerSentry === 'top-level-import') {\n await addSentryTopImport(nitro);\n }\n }\n\n // Run user provided hook\n if (hooks['rollup:before']) {\n hooks['rollup:before'](nitro);\n }\n },\n },\n },\n };\n}\n"],"names":["addSentryPluginToVite","addDynamicImportEntryFileWrapper","logger","addInstrumentationFileToBuild","addSentryTopImport"],"mappings":";;;;;;AAWA,MAAM;;AAIJ,GAA2F;AAC7F,EAAE,uCAAuC,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC;AAC3E,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,UAAU;AAC1B,EAAE,gBAAgB,GAA2B,EAAE;AAC/C,EAAE,6BAA6B;AAC/B,EAA0B;AAC1B,EAAE,MAAM,sBAAsB;AAC9B,IAAI,GAAG,6BAA6B;AACpC,IAAI,GAAG,oCAAoC;AAC3C,GAAG;;AAEH,EAAE,MAAM,MAAO,I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ineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const core = require('@sentry/core');
4
4
 
@@ -45,7 +45,7 @@ function wrapServerEntryWithDynamicImport(config) {
45
45
  return { id: source, moduleSideEffects: true };
46
46
  }
47
47
 
48
- if (additionalImports && additionalImports.includes(source)) {
48
+ if (additionalImports?.includes(source)) {
49
49
  // When importing additional imports like "import-in-the-middle/hook.mjs" in the returned code of the `load()` function below:
50
50
  // By setting `moduleSideEffects` to `true`, the import is added to the bundle, although nothing is imported from it
51
51
  // By importing "import-in-the-middle/hook.mjs", we can make sure this file is included, as not all node builders are including files imported with `module.register()`.
@@ -62,7 +62,7 @@ function wrapServerEntryWithDynamicImport(config) {
62
62
  const resolution = await this.resolve(source, importer, options);
63
63
 
64
64
  // If it cannot be resolved or is external, just return it so that Rollup can display an error
65
- if (!resolution || (resolution && resolution.external)) return resolution;
65
+ if (!resolution || resolution?.external) return resolution;
66
66
 
67
67
  const moduleInfo = await this.load(resolution);
68
68
 
@@ -138,23 +138,21 @@ function extractFunctionReexportQueryParameters(query) {
138
138
  const wrapMatch = query.match(wrapRegex);
139
139
  const reexportMatch = query.match(reexportRegex);
140
140
 
141
- const wrap =
142
- wrapMatch && wrapMatch[1]
143
- ? wrapMatch[1]
144
- .split(',')
145
- .filter(param => param !== '')
146
- // Sanitize, as code could be injected with another rollup plugin
147
- .map((str) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
148
- : [];
149
-
150
- const reexport =
151
- reexportMatch && reexportMatch[1]
152
- ? reexportMatch[1]
153
- .split(',')
154
- .filter(param => param !== '' && param !== 'default')
155
- // Sanitize, as code could be injected with another rollup plugin
156
- .map((str) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
157
- : [];
141
+ const wrap = wrapMatch?.[1]
142
+ ? wrapMatch[1]
143
+ .split(',')
144
+ .filter(param => param !== '')
145
+ // Sanitize, as code could be injected with another rollup plugin
146
+ .map((str) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
147
+ : [];
148
+
149
+ const reexport = reexportMatch?.[1]
150
+ ? reexportMatch[1]
151
+ .split(',')
152
+ .filter(param => param !== '' && param !== 'default')
153
+ // Sanitize, as code could be injected with another rollup plugin
154
+ .map((str) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
155
+ : [];
158
156
 
159
157
  return { wrap, reexport };
160
158
  }
@@ -1 +1 @@
1
- {"version":3,"file":"wrapServerEntryWithDynamicImport.js","sources":["../../../src/config/wrapServerEntryWithDynamicImport.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport type { InputPluginOption } from 'rollup';\n\n/** THIS FILE IS AN UTILITY FOR NITRO-BASED PACKAGES AND SHOULD BE KEPT IN SYNC IN NUXT, SOLIDSTART, ETC. */\n\nexport const SENTRY_WRAPPED_ENTRY = '?sentry-query-wrapped-entry';\nexport const SENTRY_WRAPPED_FUNCTIONS = '?sentry-query-wrapped-functions=';\nexport const SENTRY_REEXPORTED_FUNCTIONS = '?sentry-query-reexported-functions=';\nexport const QUERY_END_INDICATOR = 'SENTRY-QUERY-END';\n\nexport type WrapServerEntryPluginOptions = {\n serverEntrypointFileName: string;\n serverConfigFileName: string;\n resolvedServerConfigPath: string;\n entrypointWrappedFunctions: string[];\n additionalImports?: string[];\n debug?: boolean;\n};\n\n/**\n * A Rollup plugin which wraps the server entry with a dynamic `import()`. This makes it possible to initialize Sentry first\n * by using a regular `import` and load the server after that.\n * This also works with serverless `handler` functions, as it re-exports the `handler`.\n *\n * @param config Configuration options for the Rollup Plugin\n * @param config.serverConfigFileName Name of the Sentry server config (without file extension). E.g. 'sentry.server.config'\n * @param config.serverEntrypointFileName The server entrypoint (with file extension). Usually, this is defined by the Nitro preset and is something like 'node-server.mjs'\n * @param config.resolvedServerConfigPath Resolved path of the Sentry server config (based on `src` directory)\n * @param config.entryPointWrappedFunctions Exported bindings of the server entry file, which are wrapped as async function. E.g. ['default', 'handler', 'server']\n * @param config.additionalImports Adds additional imports to the entry file. Can be e.g. 'import-in-the-middle/hook.mjs'\n * @param config.debug Whether debug logs are enabled in the build time environment\n */\nexport function wrapServerEntryWithDynamicImport(config: WrapServerEntryPluginOptions): InputPluginOption {\n const {\n serverConfigFileName,\n serverEntrypointFileName,\n resolvedServerConfigPath,\n entrypointWrappedFunctions,\n additionalImports,\n debug,\n } = config;\n\n // In order to correctly import the server config file\n // and dynamically import the nitro runtime, we need to\n // mark the resolutionId with '\\0raw' to fall into the\n // raw chunk group, c.f. https://github.com/nitrojs/nitro/commit/8b4a408231bdc222569a32ce109796a41eac4aa6#diff-e58102d2230f95ddeef2662957b48d847a6e891e354cfd0ae6e2e03ce848d1a2R142\n const resolutionIdPrefix = '\\0raw';\n\n return {\n name: 'sentry-wrap-server-entry-with-dynamic-import',\n async resolveId(source, importer, options) {\n if (source.includes(`/${serverConfigFileName}`)) {\n return { id: source, moduleSideEffects: true };\n }\n\n if (additionalImports && additionalImports.includes(source)) {\n // When importing additional imports like \"import-in-the-middle/hook.mjs\" in the returned code of the `load()` function below:\n // By setting `moduleSideEffects` to `true`, the import is added to the bundle, although nothing is imported from it\n // By importing \"import-in-the-middle/hook.mjs\", we can make sure this file is included, as not all node builders are including files imported with `module.register()`.\n // Prevents the error \"Failed to register ESM hook Error: Cannot find module 'import-in-the-middle/hook.mjs'\"\n return { id: source, moduleSideEffects: true, external: true };\n }\n\n if (\n options.isEntry &&\n source.includes(serverEntrypointFileName) &&\n source.includes('.mjs') &&\n !source.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)\n ) {\n const resolution = await this.resolve(source, importer, options);\n\n // If it cannot be resolved or is external, just return it so that Rollup can display an error\n if (!resolution || (resolution && resolution.external)) return resolution;\n\n const moduleInfo = await this.load(resolution);\n\n moduleInfo.moduleSideEffects = true;\n\n // The enclosing `if` already checks for the suffix in `source`, but a check in `resolution.id` is needed as well to prevent multiple attachment of the suffix\n return resolution.id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)\n ? resolution.id\n : `${resolutionIdPrefix}${resolution.id\n // Concatenates the query params to mark the file (also attaches names of re-exports - this is needed for serverless functions to re-export the handler)\n .concat(SENTRY_WRAPPED_ENTRY)\n .concat(\n constructWrappedFunctionExportQuery(moduleInfo.exportedBindings, entrypointWrappedFunctions, debug),\n )\n .concat(QUERY_END_INDICATOR)}`;\n }\n return null;\n },\n load(id: string) {\n if (id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)) {\n const entryId = removeSentryQueryFromPath(id).slice(resolutionIdPrefix.length);\n\n // Mostly useful for serverless `handler` functions\n const reExportedFunctions =\n id.includes(SENTRY_WRAPPED_FUNCTIONS) || id.includes(SENTRY_REEXPORTED_FUNCTIONS)\n ? constructFunctionReExport(id, entryId)\n : '';\n\n return (\n // Regular `import` of the Sentry config\n `import ${JSON.stringify(resolvedServerConfigPath)};\\n` +\n // Dynamic `import()` for the previous, actual entry point.\n // `import()` can be used for any code that should be run after the hooks are registered (https://nodejs.org/api/module.html#enabling)\n `import(${JSON.stringify(entryId)});\\n` +\n // By importing additional imports like \"import-in-the-middle/hook.mjs\", we can make sure this file wil be included, as not all node builders are including files imported with `module.register()`.\n `${additionalImports ? additionalImports.map(importPath => `import \"${importPath}\";\\n`) : ''}` +\n `${reExportedFunctions}\\n`\n );\n }\n\n return null;\n },\n };\n}\n\n/**\n * Strips the Sentry query part from a path.\n * Example: example/path?sentry-query-wrapped-entry?sentry-query-functions-reexport=foo,SENTRY-QUERY-END -> /example/path\n *\n * **Only exported for testing**\n */\nexport function removeSentryQueryFromPath(url: string): string {\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const regex = new RegExp(`\\\\${SENTRY_WRAPPED_ENTRY}.*?\\\\${QUERY_END_INDICATOR}`);\n return url.replace(regex, '');\n}\n\n/**\n * Extracts and sanitizes function re-export and function wrap query parameters from a query string.\n * If it is a default export, it is not considered for re-exporting.\n *\n * **Only exported for testing**\n */\nexport function extractFunctionReexportQueryParameters(query: string): { wrap: string[]; reexport: string[] } {\n // Regex matches the comma-separated params between the functions query\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const wrapRegex = new RegExp(\n `\\\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR}|\\\\${SENTRY_REEXPORTED_FUNCTIONS})`,\n );\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const reexportRegex = new RegExp(`\\\\${SENTRY_REEXPORTED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR})`);\n\n const wrapMatch = query.match(wrapRegex);\n const reexportMatch = query.match(reexportRegex);\n\n const wrap =\n wrapMatch && wrapMatch[1]\n ? wrapMatch[1]\n .split(',')\n .filter(param => param !== '')\n // Sanitize, as code could be injected with another rollup plugin\n .map((str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n : [];\n\n const reexport =\n reexportMatch && reexportMatch[1]\n ? reexportMatch[1]\n .split(',')\n .filter(param => param !== '' && param !== 'default')\n // Sanitize, as code could be injected with another rollup plugin\n .map((str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n : [];\n\n return { wrap, reexport };\n}\n\n/**\n * Constructs a comma-separated string with all functions that need to be re-exported later from the server entry.\n * It uses Rollup's `exportedBindings` to determine the functions to re-export. Functions which should be wrapped\n * (e.g. serverless handlers) are wrapped by Sentry.\n *\n * **Only exported for testing**\n */\nexport function constructWrappedFunctionExportQuery(\n exportedBindings: Record<string, string[]> | null,\n entrypointWrappedFunctions: string[],\n debug?: boolean,\n): string {\n const functionsToExport: { wrap: string[]; reexport: string[] } = {\n wrap: [],\n reexport: [],\n };\n\n // `exportedBindings` can look like this: `{ '.': [ 'handler' ] }` or `{ '.': [], './firebase-gen-1.mjs': [ 'server' ] }`\n // The key `.` refers to exports within the current file, while other keys show from where exports were imported first.\n Object.values(exportedBindings || {}).forEach(functions =>\n functions.forEach(fn => {\n if (entrypointWrappedFunctions.includes(fn)) {\n functionsToExport.wrap.push(fn);\n } else {\n functionsToExport.reexport.push(fn);\n }\n }),\n );\n\n if (debug && functionsToExport.wrap.length === 0) {\n consoleSandbox(() =>\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] No functions found to wrap. In case the server needs to export async functions other than `handler` or `server`, consider adding the name(s) to `entrypointWrappedFunctions`.',\n ),\n );\n }\n\n const wrapQuery = functionsToExport.wrap.length\n ? `${SENTRY_WRAPPED_FUNCTIONS}${functionsToExport.wrap.join(',')}`\n : '';\n const reexportQuery = functionsToExport.reexport.length\n ? `${SENTRY_REEXPORTED_FUNCTIONS}${functionsToExport.reexport.join(',')}`\n : '';\n\n return [wrapQuery, reexportQuery].join('');\n}\n\n/**\n * Constructs a code snippet with function reexports (can be used in Rollup plugins as a return value for `load()`)\n *\n * **Only exported for testing**\n */\nexport function constructFunctionReExport(pathWithQuery: string, entryId: string): string {\n const { wrap: wrapFunctions, reexport: reexportFunctions } = extractFunctionReexportQueryParameters(pathWithQuery);\n\n return wrapFunctions\n .reduce(\n (functionsCode, currFunctionName) =>\n functionsCode.concat(\n `async function ${currFunctionName}_sentryWrapped(...args) {\\n` +\n ` const res = await import(${JSON.stringify(entryId)});\\n` +\n ` return res.${currFunctionName}.call(this, ...args);\\n` +\n '}\\n' +\n `export { ${currFunctionName}_sentryWrapped as ${currFunctionName} };\\n`,\n ),\n '',\n )\n .concat(\n reexportFunctions.reduce(\n (functionsCode, currFunctionName) =>\n functionsCode.concat(`export { ${currFunctionName} } from ${JSON.stringify(entryId)};`),\n '',\n ),\n );\n}\n"],"names":["consoleSandbox"],"mappings":";;;;AAGA;;AAEO,MAAM,oBAAqB,GAAE;AAC7B,MAAM,wBAAyB,GAAE;AACjC,MAAM,2BAA4B,GAAE;AACpC,MAAM,mBAAoB,GAAE;;AAWnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gCAAgC,CAAC,MAAM,EAAmD;AAC1G,EAAE,MAAM;AACR,I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CAAA,IAAA,CAAA,GAAA,CAAA,CAAA;AACA,MAAA,EAAA;;AAEA,EAAA,OAAA,CAAA,SAAA,EAAA,aAAA,CAAA,CAAA,IAAA,CAAA,EAAA,CAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAA,yBAAA,CAAA,aAAA,EAAA,OAAA,EAAA;AACA,EAAA,MAAA,EAAA,IAAA,EAAA,aAAA,EAAA,QAAA,EAAA,iBAAA,EAAA,GAAA,sCAAA,CAAA,aAAA,CAAA;;AAEA,EAAA,OAAA;AACA,KAAA,MAAA;AACA,MAAA,CAAA,aAAA,EAAA,gBAAA;AACA,QAAA,aAAA,CAAA,MAAA;AACA,UAAA,CAAA,eAAA,EAAA,gBAAA,CAAA,2BAAA,CAAA;AACA,YAAA,CAAA,2BAAA,EAAA,IAAA,CAAA,SAAA,CAAA,OAAA,CAAA,CAAA,IAAA,CAAA;AACA,YAAA,CAAA,aAAA,EAAA,gBAAA,CAAA,uBAAA,CAAA;AACA,YAAA,KAAA;AACA,YAAA,CAAA,SAAA,EAAA,gBAAA,CAAA,kBAAA,EAAA,gBAAA,CAAA,KAAA,CAAA;AACA,SAAA;AACA,MAAA,EAAA;AACA;AACA,KAAA,MAAA;AACA,MAAA,iBAAA,CAAA,MAAA;AACA,QAAA,CAAA,aAAA,EAAA,gBAAA;AACA,UAAA,aAAA,CAAA,MAAA,CAAA,CAAA,SAAA,EAAA,gBAAA,CAAA,QAAA,EAAA,IAAA,CAAA,SAAA,CAAA,OAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACA,QAAA,EAAA;AACA,OAAA;AACA,KAAA;AACA;;;;;;;;;;;;"}
1
+ {"version":3,"file":"wrapServerEntryWithDynamicImport.js","sources":["../../../src/config/wrapServerEntryWithDynamicImport.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport type { InputPluginOption } from 'rollup';\n\n/** THIS FILE IS AN UTILITY FOR NITRO-BASED PACKAGES AND SHOULD BE KEPT IN SYNC IN NUXT, SOLIDSTART, ETC. */\n\nexport const SENTRY_WRAPPED_ENTRY = '?sentry-query-wrapped-entry';\nexport const SENTRY_WRAPPED_FUNCTIONS = '?sentry-query-wrapped-functions=';\nexport const SENTRY_REEXPORTED_FUNCTIONS = '?sentry-query-reexported-functions=';\nexport const QUERY_END_INDICATOR = 'SENTRY-QUERY-END';\n\nexport type WrapServerEntryPluginOptions = {\n serverEntrypointFileName: string;\n serverConfigFileName: string;\n resolvedServerConfigPath: string;\n entrypointWrappedFunctions: string[];\n additionalImports?: string[];\n debug?: boolean;\n};\n\n/**\n * A Rollup plugin which wraps the server entry with a dynamic `import()`. This makes it possible to initialize Sentry first\n * by using a regular `import` and load the server after that.\n * This also works with serverless `handler` functions, as it re-exports the `handler`.\n *\n * @param config Configuration options for the Rollup Plugin\n * @param config.serverConfigFileName Name of the Sentry server config (without file extension). E.g. 'sentry.server.config'\n * @param config.serverEntrypointFileName The server entrypoint (with file extension). Usually, this is defined by the Nitro preset and is something like 'node-server.mjs'\n * @param config.resolvedServerConfigPath Resolved path of the Sentry server config (based on `src` directory)\n * @param config.entryPointWrappedFunctions Exported bindings of the server entry file, which are wrapped as async function. E.g. ['default', 'handler', 'server']\n * @param config.additionalImports Adds additional imports to the entry file. Can be e.g. 'import-in-the-middle/hook.mjs'\n * @param config.debug Whether debug logs are enabled in the build time environment\n */\nexport function wrapServerEntryWithDynamicImport(config: WrapServerEntryPluginOptions): InputPluginOption {\n const {\n serverConfigFileName,\n serverEntrypointFileName,\n resolvedServerConfigPath,\n entrypointWrappedFunctions,\n additionalImports,\n debug,\n } = config;\n\n // In order to correctly import the server config file\n // and dynamically import the nitro runtime, we need to\n // mark the resolutionId with '\\0raw' to fall into the\n // raw chunk group, c.f. https://github.com/nitrojs/nitro/commit/8b4a408231bdc222569a32ce109796a41eac4aa6#diff-e58102d2230f95ddeef2662957b48d847a6e891e354cfd0ae6e2e03ce848d1a2R142\n const resolutionIdPrefix = '\\0raw';\n\n return {\n name: 'sentry-wrap-server-entry-with-dynamic-import',\n async resolveId(source, importer, options) {\n if (source.includes(`/${serverConfigFileName}`)) {\n return { id: source, moduleSideEffects: true };\n }\n\n if (additionalImports?.includes(source)) {\n // When importing additional imports like \"import-in-the-middle/hook.mjs\" in the returned code of the `load()` function below:\n // By setting `moduleSideEffects` to `true`, the import is added to the bundle, although nothing is imported from it\n // By importing \"import-in-the-middle/hook.mjs\", we can make sure this file is included, as not all node builders are including files imported with `module.register()`.\n // Prevents the error \"Failed to register ESM hook Error: Cannot find module 'import-in-the-middle/hook.mjs'\"\n return { id: source, moduleSideEffects: true, external: true };\n }\n\n if (\n options.isEntry &&\n source.includes(serverEntrypointFileName) &&\n source.includes('.mjs') &&\n !source.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)\n ) {\n const resolution = await this.resolve(source, importer, options);\n\n // If it cannot be resolved or is external, just return it so that Rollup can display an error\n if (!resolution || resolution?.external) return resolution;\n\n const moduleInfo = await this.load(resolution);\n\n moduleInfo.moduleSideEffects = true;\n\n // The enclosing `if` already checks for the suffix in `source`, but a check in `resolution.id` is needed as well to prevent multiple attachment of the suffix\n return resolution.id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)\n ? resolution.id\n : `${resolutionIdPrefix}${resolution.id\n // Concatenates the query params to mark the file (also attaches names of re-exports - this is needed for serverless functions to re-export the handler)\n .concat(SENTRY_WRAPPED_ENTRY)\n .concat(\n constructWrappedFunctionExportQuery(moduleInfo.exportedBindings, entrypointWrappedFunctions, debug),\n )\n .concat(QUERY_END_INDICATOR)}`;\n }\n return null;\n },\n load(id: string) {\n if (id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)) {\n const entryId = removeSentryQueryFromPath(id).slice(resolutionIdPrefix.length);\n\n // Mostly useful for serverless `handler` functions\n const reExportedFunctions =\n id.includes(SENTRY_WRAPPED_FUNCTIONS) || id.includes(SENTRY_REEXPORTED_FUNCTIONS)\n ? constructFunctionReExport(id, entryId)\n : '';\n\n return (\n // Regular `import` of the Sentry config\n `import ${JSON.stringify(resolvedServerConfigPath)};\\n` +\n // Dynamic `import()` for the previous, actual entry point.\n // `import()` can be used for any code that should be run after the hooks are registered (https://nodejs.org/api/module.html#enabling)\n `import(${JSON.stringify(entryId)});\\n` +\n // By importing additional imports like \"import-in-the-middle/hook.mjs\", we can make sure this file wil be included, as not all node builders are including files imported with `module.register()`.\n `${additionalImports ? additionalImports.map(importPath => `import \"${importPath}\";\\n`) : ''}` +\n `${reExportedFunctions}\\n`\n );\n }\n\n return null;\n },\n };\n}\n\n/**\n * Strips the Sentry query part from a path.\n * Example: example/path?sentry-query-wrapped-entry?sentry-query-functions-reexport=foo,SENTRY-QUERY-END -> /example/path\n *\n * **Only exported for testing**\n */\nexport function removeSentryQueryFromPath(url: string): string {\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const regex = new RegExp(`\\\\${SENTRY_WRAPPED_ENTRY}.*?\\\\${QUERY_END_INDICATOR}`);\n return url.replace(regex, '');\n}\n\n/**\n * Extracts and sanitizes function re-export and function wrap query parameters from a query string.\n * If it is a default export, it is not considered for re-exporting.\n *\n * **Only exported for testing**\n */\nexport function extractFunctionReexportQueryParameters(query: string): { wrap: string[]; reexport: string[] } {\n // Regex matches the comma-separated params between the functions query\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const wrapRegex = new RegExp(\n `\\\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR}|\\\\${SENTRY_REEXPORTED_FUNCTIONS})`,\n );\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const reexportRegex = new RegExp(`\\\\${SENTRY_REEXPORTED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR})`);\n\n const wrapMatch = query.match(wrapRegex);\n const reexportMatch = query.match(reexportRegex);\n\n const wrap = wrapMatch?.[1]\n ? wrapMatch[1]\n .split(',')\n .filter(param => param !== '')\n // Sanitize, as code could be injected with another rollup plugin\n .map((str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n : [];\n\n const reexport = reexportMatch?.[1]\n ? reexportMatch[1]\n .split(',')\n .filter(param => param !== '' && param !== 'default')\n // Sanitize, as code could be injected with another rollup plugin\n .map((str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n : [];\n\n return { wrap, reexport };\n}\n\n/**\n * Constructs a comma-separated string with all functions that need to be re-exported later from the server entry.\n * It uses Rollup's `exportedBindings` to determine the functions to re-export. Functions which should be wrapped\n * (e.g. serverless handlers) are wrapped by Sentry.\n *\n * **Only exported for testing**\n */\nexport function constructWrappedFunctionExportQuery(\n exportedBindings: Record<string, string[]> | null,\n entrypointWrappedFunctions: string[],\n debug?: boolean,\n): string {\n const functionsToExport: { wrap: string[]; reexport: string[] } = {\n wrap: [],\n reexport: [],\n };\n\n // `exportedBindings` can look like this: `{ '.': [ 'handler' ] }` or `{ '.': [], './firebase-gen-1.mjs': [ 'server' ] }`\n // The key `.` refers to exports within the current file, while other keys show from where exports were imported first.\n Object.values(exportedBindings || {}).forEach(functions =>\n functions.forEach(fn => {\n if (entrypointWrappedFunctions.includes(fn)) {\n functionsToExport.wrap.push(fn);\n } else {\n functionsToExport.reexport.push(fn);\n }\n }),\n );\n\n if (debug && functionsToExport.wrap.length === 0) {\n consoleSandbox(() =>\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] No functions found to wrap. In case the server needs to export async functions other than `handler` or `server`, consider adding the name(s) to `entrypointWrappedFunctions`.',\n ),\n );\n }\n\n const wrapQuery = functionsToExport.wrap.length\n ? `${SENTRY_WRAPPED_FUNCTIONS}${functionsToExport.wrap.join(',')}`\n : '';\n const reexportQuery = functionsToExport.reexport.length\n ? `${SENTRY_REEXPORTED_FUNCTIONS}${functionsToExport.reexport.join(',')}`\n : '';\n\n return [wrapQuery, reexportQuery].join('');\n}\n\n/**\n * Constructs a code snippet with function reexports (can be used in Rollup plugins as a return value for `load()`)\n *\n * **Only exported for testing**\n */\nexport function constructFunctionReExport(pathWithQuery: string, entryId: string): string {\n const { wrap: wrapFunctions, reexport: reexportFunctions } = extractFunctionReexportQueryParameters(pathWithQuery);\n\n return wrapFunctions\n .reduce(\n (functionsCode, currFunctionName) =>\n functionsCode.concat(\n `async function ${currFunctionName}_sentryWrapped(...args) {\\n` +\n ` const res = await import(${JSON.stringify(entryId)});\\n` +\n ` return res.${currFunctionName}.call(this, ...args);\\n` +\n '}\\n' +\n `export { ${currFunctionName}_sentryWrapped as ${currFunctionName} };\\n`,\n ),\n '',\n )\n .concat(\n reexportFunctions.reduce(\n (functionsCode, currFunctionName) =>\n functionsCode.concat(`export { ${currFunctionName} } from ${JSON.stringify(entryId)};`),\n '',\n ),\n );\n}\n"],"names":["consoleSandbox"],"mappings":";;;;AAGA;;AAEO,MAAM,oBAAqB,GAAE;AAC7B,MAAM,wBAAyB,GAAE;AACjC,MAAM,2BAA4B,GAAE;AACpC,MAAM,mBAAoB,GAAE;;AAWnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gCAAgC,CAAC,MAAM,EAAmD;AAC1G,EAAE,MAAM;AACR,IAAI,oBAAoB;AACxB,IAAI,wBAAwB;AAC5B,IAAI,wBAAwB;AAC5B,IAAI,0BAA0B;AAC9B,IAAI,iBAAiB;AACrB,IAAI,KAAK;AACT,GAAE,GAAI,MAAM;;AAEZ;AACA;AACA;AACA;AACA,EAAE,MAAM,kBAAmB,GAAE,OAAO;;AAEpC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,8CAA8C;AACxD,IAAI,MAAM,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE;AAC/C,MAAM,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,oBAAoB,CAAC,CAAA,CAAA,EAAA;AACA,QAAA,OAAA,EAAA,EAAA,EAAA,MAAA,EAAA,iBAAA,EAAA,IAAA,EAAA;AACA;;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ACA,YAAA,CAAA,aAAA,EAAA,gBAAA,CAAA,uBAAA,CAAA;AACA,YAAA,KAAA;AACA,YAAA,CAAA,SAAA,EAAA,gBAAA,CAAA,kBAAA,EAAA,gBAAA,CAAA,KAAA,CAAA;AACA,SAAA;AACA,MAAA,EAAA;AACA;AACA,KAAA,MAAA;AACA,MAAA,iBAAA,CAAA,MAAA;AACA,QAAA,CAAA,aAAA,EAAA,gBAAA;AACA,UAAA,aAAA,CAAA,MAAA,CAAA,CAAA,SAAA,EAAA,gBAAA,CAAA,QAAA,EAAA,IAAA,CAAA,SAAA,CAAA,OAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACA,QAAA,EAAA;AACA,OAAA;AACA,KAAA;AACA;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const solid = require('@sentry/solid');
4
4
  const sdk = require('./client/sdk.js');
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const node = require('@sentry/node');
4
4
  const solid = require('@sentry/solid');
@@ -10,7 +10,6 @@ const withSentry = require('./config/withSentry.js');
10
10
 
11
11
 
12
12
 
13
- exports.DEFAULT_USER_INCLUDES = node.DEFAULT_USER_INCLUDES;
14
13
  exports.NodeClient = node.NodeClient;
15
14
  exports.SDK_VERSION = node.SDK_VERSION;
16
15
  exports.SEMANTIC_ATTRIBUTE_SENTRY_OP = node.SEMANTIC_ATTRIBUTE_SENTRY_OP;
@@ -21,8 +20,6 @@ exports.Scope = node.Scope;
21
20
  exports.addBreadcrumb = node.addBreadcrumb;
22
21
  exports.addEventProcessor = node.addEventProcessor;
23
22
  exports.addIntegration = node.addIntegration;
24
- exports.addOpenTelemetryInstrumentation = node.addOpenTelemetryInstrumentation;
25
- exports.addRequestDataToEvent = node.addRequestDataToEvent;
26
23
  exports.amqplibIntegration = node.amqplibIntegration;
27
24
  exports.anrIntegration = node.anrIntegration;
28
25
  exports.captureCheckIn = node.captureCheckIn;
@@ -40,7 +37,6 @@ exports.continueTrace = node.continueTrace;
40
37
  exports.createGetModuleFromFilename = node.createGetModuleFromFilename;
41
38
  exports.createTransport = node.createTransport;
42
39
  exports.cron = node.cron;
43
- exports.debugIntegration = node.debugIntegration;
44
40
  exports.dedupeIntegration = node.dedupeIntegration;
45
41
  exports.defaultStackParser = node.defaultStackParser;
46
42
  exports.disableAnrDetectionForCallback = node.disableAnrDetectionForCallback;
@@ -48,7 +44,6 @@ exports.endSession = node.endSession;
48
44
  exports.expressErrorHandler = node.expressErrorHandler;
49
45
  exports.expressIntegration = node.expressIntegration;
50
46
  exports.extraErrorDataIntegration = node.extraErrorDataIntegration;
51
- exports.extractRequestData = node.extractRequestData;
52
47
  exports.fastifyIntegration = node.fastifyIntegration;
53
48
  exports.flush = node.flush;
54
49
  exports.functionToStringIntegration = node.functionToStringIntegration;
@@ -57,7 +52,6 @@ exports.genericPoolIntegration = node.genericPoolIntegration;
57
52
  exports.getActiveSpan = node.getActiveSpan;
58
53
  exports.getAutoPerformanceIntegrations = node.getAutoPerformanceIntegrations;
59
54
  exports.getClient = node.getClient;
60
- exports.getCurrentHub = node.getCurrentHub;
61
55
  exports.getCurrentScope = node.getCurrentScope;
62
56
  exports.getDefaultIntegrations = node.getDefaultIntegrations;
63
57
  exports.getGlobalScope = node.getGlobalScope;
@@ -79,14 +73,12 @@ exports.lastEventId = node.lastEventId;
79
73
  exports.linkedErrorsIntegration = node.linkedErrorsIntegration;
80
74
  exports.localVariablesIntegration = node.localVariablesIntegration;
81
75
  exports.makeNodeTransport = node.makeNodeTransport;
82
- exports.metrics = node.metrics;
83
76
  exports.modulesIntegration = node.modulesIntegration;
84
77
  exports.mongoIntegration = node.mongoIntegration;
85
78
  exports.mongooseIntegration = node.mongooseIntegration;
86
79
  exports.mysql2Integration = node.mysql2Integration;
87
80
  exports.mysqlIntegration = node.mysqlIntegration;
88
81
  exports.nativeNodeFetchIntegration = node.nativeNodeFetchIntegration;
89
- exports.nestIntegration = node.nestIntegration;
90
82
  exports.nodeContextIntegration = node.nodeContextIntegration;
91
83
  exports.onUncaughtExceptionIntegration = node.onUncaughtExceptionIntegration;
92
84
  exports.onUnhandledRejectionIntegration = node.onUnhandledRejectionIntegration;
@@ -96,7 +88,6 @@ exports.prismaIntegration = node.prismaIntegration;
96
88
  exports.redisIntegration = node.redisIntegration;
97
89
  exports.requestDataIntegration = node.requestDataIntegration;
98
90
  exports.rewriteFramesIntegration = node.rewriteFramesIntegration;
99
- exports.sessionTimingIntegration = node.sessionTimingIntegration;
100
91
  exports.setContext = node.setContext;
101
92
  exports.setCurrentClient = node.setCurrentClient;
102
93
  exports.setExtra = node.setExtra;
@@ -110,7 +101,6 @@ exports.setupConnectErrorHandler = node.setupConnectErrorHandler;
110
101
  exports.setupExpressErrorHandler = node.setupExpressErrorHandler;
111
102
  exports.setupHapiErrorHandler = node.setupHapiErrorHandler;
112
103
  exports.setupKoaErrorHandler = node.setupKoaErrorHandler;
113
- exports.setupNestErrorHandler = node.setupNestErrorHandler;
114
104
  exports.spanToBaggageHeader = node.spanToBaggageHeader;
115
105
  exports.spanToJSON = node.spanToJSON;
116
106
  exports.spanToTraceHeader = node.spanToTraceHeader;
@@ -1 +1 @@
1
- {"version":3,"file":"index.server.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.server.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const node = require('@sentry/node');
4
4
  const solid = require('@sentry/solid');
@@ -8,7 +8,6 @@ const middleware = require('./middleware.js');
8
8
 
9
9
 
10
10
 
11
- exports.DEFAULT_USER_INCLUDES = node.DEFAULT_USER_INCLUDES;
12
11
  exports.NodeClient = node.NodeClient;
13
12
  exports.SDK_VERSION = node.SDK_VERSION;
14
13
  exports.SEMANTIC_ATTRIBUTE_SENTRY_OP = node.SEMANTIC_ATTRIBUTE_SENTRY_OP;
@@ -19,8 +18,6 @@ exports.Scope = node.Scope;
19
18
  exports.addBreadcrumb = node.addBreadcrumb;
20
19
  exports.addEventProcessor = node.addEventProcessor;
21
20
  exports.addIntegration = node.addIntegration;
22
- exports.addOpenTelemetryInstrumentation = node.addOpenTelemetryInstrumentation;
23
- exports.addRequestDataToEvent = node.addRequestDataToEvent;
24
21
  exports.amqplibIntegration = node.amqplibIntegration;
25
22
  exports.anrIntegration = node.anrIntegration;
26
23
  exports.captureCheckIn = node.captureCheckIn;
@@ -38,7 +35,6 @@ exports.continueTrace = node.continueTrace;
38
35
  exports.createGetModuleFromFilename = node.createGetModuleFromFilename;
39
36
  exports.createTransport = node.createTransport;
40
37
  exports.cron = node.cron;
41
- exports.debugIntegration = node.debugIntegration;
42
38
  exports.dedupeIntegration = node.dedupeIntegration;
43
39
  exports.defaultStackParser = node.defaultStackParser;
44
40
  exports.disableAnrDetectionForCallback = node.disableAnrDetectionForCallback;
@@ -46,7 +42,6 @@ exports.endSession = node.endSession;
46
42
  exports.expressErrorHandler = node.expressErrorHandler;
47
43
  exports.expressIntegration = node.expressIntegration;
48
44
  exports.extraErrorDataIntegration = node.extraErrorDataIntegration;
49
- exports.extractRequestData = node.extractRequestData;
50
45
  exports.fastifyIntegration = node.fastifyIntegration;
51
46
  exports.flush = node.flush;
52
47
  exports.functionToStringIntegration = node.functionToStringIntegration;
@@ -55,7 +50,6 @@ exports.genericPoolIntegration = node.genericPoolIntegration;
55
50
  exports.getActiveSpan = node.getActiveSpan;
56
51
  exports.getAutoPerformanceIntegrations = node.getAutoPerformanceIntegrations;
57
52
  exports.getClient = node.getClient;
58
- exports.getCurrentHub = node.getCurrentHub;
59
53
  exports.getCurrentScope = node.getCurrentScope;
60
54
  exports.getDefaultIntegrations = node.getDefaultIntegrations;
61
55
  exports.getGlobalScope = node.getGlobalScope;
@@ -77,14 +71,12 @@ exports.lastEventId = node.lastEventId;
77
71
  exports.linkedErrorsIntegration = node.linkedErrorsIntegration;
78
72
  exports.localVariablesIntegration = node.localVariablesIntegration;
79
73
  exports.makeNodeTransport = node.makeNodeTransport;
80
- exports.metrics = node.metrics;
81
74
  exports.modulesIntegration = node.modulesIntegration;
82
75
  exports.mongoIntegration = node.mongoIntegration;
83
76
  exports.mongooseIntegration = node.mongooseIntegration;
84
77
  exports.mysql2Integration = node.mysql2Integration;
85
78
  exports.mysqlIntegration = node.mysqlIntegration;
86
79
  exports.nativeNodeFetchIntegration = node.nativeNodeFetchIntegration;
87
- exports.nestIntegration = node.nestIntegration;
88
80
  exports.nodeContextIntegration = node.nodeContextIntegration;
89
81
  exports.onUncaughtExceptionIntegration = node.onUncaughtExceptionIntegration;
90
82
  exports.onUnhandledRejectionIntegration = node.onUnhandledRejectionIntegration;
@@ -94,7 +86,6 @@ exports.prismaIntegration = node.prismaIntegration;
94
86
  exports.redisIntegration = node.redisIntegration;
95
87
  exports.requestDataIntegration = node.requestDataIntegration;
96
88
  exports.rewriteFramesIntegration = node.rewriteFramesIntegration;
97
- exports.sessionTimingIntegration = node.sessionTimingIntegration;
98
89
  exports.setContext = node.setContext;
99
90
  exports.setCurrentClient = node.setCurrentClient;
100
91
  exports.setExtra = node.setExtra;
@@ -108,7 +99,6 @@ exports.setupConnectErrorHandler = node.setupConnectErrorHandler;
108
99
  exports.setupExpressErrorHandler = node.setupExpressErrorHandler;
109
100
  exports.setupHapiErrorHandler = node.setupHapiErrorHandler;
110
101
  exports.setupKoaErrorHandler = node.setupKoaErrorHandler;
111
- exports.setupNestErrorHandler = node.setupNestErrorHandler;
112
102
  exports.spanToBaggageHeader = node.spanToBaggageHeader;
113
103
  exports.spanToJSON = node.spanToJSON;
114
104
  exports.spanToTraceHeader = node.spanToTraceHeader;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const core = require('@sentry/core');
4
4
 
@@ -28,7 +28,7 @@ function sentryBeforeResponseMiddleware() {
28
28
  core.addNonEnumerableProperty(response, '__sentry_wrapped__', true);
29
29
 
30
30
  const contentType = event.response.headers.get('content-type');
31
- const isPageloadRequest = contentType && contentType.startsWith('text/html');
31
+ const isPageloadRequest = contentType?.startsWith('text/html');
32
32
 
33
33
  if (!isPageloadRequest) {
34
34
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.js","sources":["../../../src/server/middleware.ts"],"sourcesContent":["import { getTraceMetaTags } from '@sentry/core';\nimport { addNonEnumerableProperty } from '@sentry/core';\nimport type { ResponseMiddleware } from '@solidjs/start/middleware';\nimport type { FetchEvent } from '@solidjs/start/server';\n\nexport type ResponseMiddlewareResponse = Parameters<ResponseMiddleware>[1] & {\n __sentry_wrapped__?: boolean;\n};\n\nfunction addMetaTagToHead(html: string): string {\n const metaTags = getTraceMetaTags();\n\n if (!metaTags) {\n return html;\n }\n\n const content = `<head>\\n${metaTags}\\n`;\n return html.replace('<head>', content);\n}\n\n/**\n * Returns an `onBeforeResponse` solid start middleware handler that adds tracing data as\n * <meta> tags to a page on pageload to enable distributed tracing.\n */\nexport function sentryBeforeResponseMiddleware() {\n return async function onBeforeResponse(event: FetchEvent, response: ResponseMiddlewareResponse) {\n if (!response.body || response.__sentry_wrapped__) {\n return;\n }\n\n // Ensure we don't double-wrap, in case a user has added the middleware twice\n // e.g. once manually, once via the wizard\n addNonEnumerableProperty(response, '__sentry_wrapped__', true);\n\n const contentType = event.response.headers.get('content-type');\n const isPageloadRequest = contentType && contentType.startsWith('text/html');\n\n if (!isPageloadRequest) {\n return;\n }\n\n const body = response.body as NodeJS.ReadableStream;\n const decoder = new TextDecoder();\n response.body = new ReadableStream({\n start: async controller => {\n for await (const chunk of body) {\n const html = typeof chunk === 'string' ? chunk : decoder.decode(chunk, { stream: true });\n const modifiedHtml = addMetaTagToHead(html);\n controller.enqueue(new TextEncoder().encode(modifiedHtml));\n }\n controller.close();\n },\n });\n };\n}\n"],"names":["getTraceMetaTags","addNonEnumerableProperty"],"mappings":";;;;AASA,SAAS,gBAAgB,CAAC,IAAI,EAAkB;AAChD,EAAE,MAAM,QAAA,GAAWA,qBAAgB,EAAE;;AAErC,EAAE,IAAI,CAAC,QAAQ,EAAE;AACjB,IAAI,OAAO,IAAI;AACf;;AAEA,EAAE,MAAM,UAAU,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC;AACzC,EAAE,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC;AACxC;;AAEA;AACA;AACA;AACA;AACO,SAAS,8BAA8B,GAAG;AACjD,EAAE,OAAO,eAAe,gBAAgB,CAAC,KAAK,EAAc,QAAQ,EAA8B;AAClG,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,QAAQ,CAAC,kBAAkB,EAAE;AACvD,MAAM;AACN;;AAEA;AACA;AACA,IAAIC,6BAAwB,CAAC,QAAQ,EAAE,oBAAoB,EAAE,IAAI,CAAC;;AAElE,IAAI,MAAM,WAAA,GAAc,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;AAClE,IAAI,MAAM,iBAAkB,GAAE,WAAY,IAAG,WAAW,CAAC,UAAU,CAAC,WAAW,CAAC;;AAEhF,IAAI,IAAI,CAAC,iBAAiB,EAAE;AAC5B,MAAM;AACN;;AAEA,IAAI,MAAM,IAAA,GAAO,QAAQ,CAAC,IAAK;AAC/B,IAAI,MAAM,OAAQ,GAAE,IAAI,WAAW,EAAE;AACrC,IAAI,QAAQ,CAAC,IAAA,GAAO,IAAI,cAAc,CAAC;AACvC,MAAM,KAAK,EAAE,MAAM,UAAA,IAAc;AACjC,QAAQ,WAAW,MAAM,KAAM,IAAG,IAAI,EAAE;AACxC,UAAU,MAAM,OAAO,OAAO,UAAU,QAAA,GAAW,KAAM,GAAE,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAK,EAAC,CAAC;AAClG,UAAU,MAAM,YAAa,GAAE,gBAAgB,CAAC,IAAI,CAAC;AACrD,UAAU,UAAU,CAAC,OAAO,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AACpE;AACA,QAAQ,UAAU,CAAC,KAAK,EAAE;AAC1B,OAAO;AACP,KAAK,CAAC;AACN,GAAG;AACH;;;;"}
1
+ {"version":3,"file":"middleware.js","sources":["../../../src/server/middleware.ts"],"sourcesContent":["import { getTraceMetaTags } from '@sentry/core';\nimport { addNonEnumerableProperty } from '@sentry/core';\nimport type { ResponseMiddleware } from '@solidjs/start/middleware';\nimport type { FetchEvent } from '@solidjs/start/server';\n\nexport type ResponseMiddlewareResponse = Parameters<ResponseMiddleware>[1] & {\n __sentry_wrapped__?: boolean;\n};\n\nfunction addMetaTagToHead(html: string): string {\n const metaTags = getTraceMetaTags();\n\n if (!metaTags) {\n return html;\n }\n\n const content = `<head>\\n${metaTags}\\n`;\n return html.replace('<head>', content);\n}\n\n/**\n * Returns an `onBeforeResponse` solid start middleware handler that adds tracing data as\n * <meta> tags to a page on pageload to enable distributed tracing.\n */\nexport function sentryBeforeResponseMiddleware() {\n return async function onBeforeResponse(event: FetchEvent, response: ResponseMiddlewareResponse) {\n if (!response.body || response.__sentry_wrapped__) {\n return;\n }\n\n // Ensure we don't double-wrap, in case a user has added the middleware twice\n // e.g. once manually, once via the wizard\n addNonEnumerableProperty(response, '__sentry_wrapped__', true);\n\n const contentType = event.response.headers.get('content-type');\n const isPageloadRequest = contentType?.startsWith('text/html');\n\n if (!isPageloadRequest) {\n return;\n }\n\n const body = response.body as NodeJS.ReadableStream;\n const decoder = new TextDecoder();\n response.body = new ReadableStream({\n start: async controller => {\n for await (const chunk of body) {\n const html = typeof chunk === 'string' ? chunk : decoder.decode(chunk, { stream: true });\n const modifiedHtml = addMetaTagToHead(html);\n controller.enqueue(new TextEncoder().encode(modifiedHtml));\n }\n controller.close();\n },\n });\n };\n}\n"],"names":["getTraceMetaTags","addNonEnumerableProperty"],"mappings":";;;;AASA,SAAS,gBAAgB,CAAC,IAAI,EAAkB;AAChD,EAAE,MAAM,QAAA,GAAWA,qBAAgB,EAAE;;AAErC,EAAE,IAAI,CAAC,QAAQ,EAAE;AACjB,IAAI,OAAO,IAAI;AACf;;AAEA,EAAE,MAAM,UAAU,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC;AACzC,EAAE,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC;AACxC;;AAEA;AACA;AACA;AACA;AACO,SAAS,8BAA8B,GAAG;AACjD,EAAE,OAAO,eAAe,gBAAgB,CAAC,KAAK,EAAc,QAAQ,EAA8B;AAClG,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,QAAQ,CAAC,kBAAkB,EAAE;AACvD,MAAM;AACN;;AAEA;AACA;AACA,IAAIC,6BAAwB,CAAC,QAAQ,EAAE,oBAAoB,EAAE,IAAI,CAAC;;AAElE,IAAI,MAAM,WAAA,GAAc,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;AAClE,IAAI,MAAM,oBAAoB,WAAW,EAAE,UAAU,CAAC,WAAW,CAAC;;AAElE,IAAI,IAAI,CAAC,iBAAiB,EAAE;AAC5B,MAAM;AACN;;AAEA,IAAI,MAAM,IAAA,GAAO,QAAQ,CAAC,IAAK;AAC/B,IAAI,MAAM,OAAQ,GAAE,IAAI,WAAW,EAAE;AACrC,IAAI,QAAQ,CAAC,IAAA,GAAO,IAAI,cAAc,CAAC;AACvC,MAAM,KAAK,EAAE,MAAM,UAAA,IAAc;AACjC,QAAQ,WAAW,MAAM,KAAM,IAAG,IAAI,EAAE;AACxC,UAAU,MAAM,OAAO,OAAO,UAAU,QAAA,GAAW,KAAM,GAAE,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAK,EAAC,CAAC;AAClG,UAAU,MAAM,YAAa,GAAE,gBAAgB,CAAC,IAAI,CAAC;AACrD,UAAU,UAAU,CAAC,OAAO,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AACpE;AACA,QAAQ,UAAU,CAAC,KAAK,EAAE;AAC1B,OAAO;AACP,KAAK,CAAC;AACN,GAAG;AACH;;;;"}
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const core = require('@sentry/core');
4
4
  const node = require('@sentry/node');
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const solidJs = require('solid-js');
4
4
  const web = require('solid-js/web');
@@ -1,8 +1,4 @@
1
- var {
2
- _optionalChain
3
- } = require('@sentry/core');
4
-
5
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
6
2
 
7
3
  const core = require('@sentry/core');
8
4
  const node = require('@sentry/node');
@@ -50,7 +46,7 @@ function filterLowQualityTransactions(options) {
50
46
  return event;
51
47
  }
52
48
  // Filter out transactions for build assets
53
- if (_optionalChain([event, 'access', _ => _.transaction, 'optionalAccess', _2 => _2.match, 'call', _3 => _3(/^GET \/_build\//)])) {
49
+ if (event.transaction?.match(/^GET \/_build\//)) {
54
50
  options.debug && core.logger.log('SolidStartLowQualityTransactionsFilter filtered transaction', event.transaction);
55
51
  return null;
56
52
  }