@sentry/solidstart 8.54.0 → 9.0.0-alpha.1
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.
- package/LICENSE +1 -1
- package/README.md +83 -37
- package/build/cjs/client/index.js +1 -1
- package/build/cjs/client/sdk.js +1 -1
- package/build/cjs/client/solidrouter.js +1 -1
- package/build/cjs/common/debug-build.js +1 -1
- package/build/cjs/config/addInstrumentation.js +1 -1
- package/build/cjs/config/withSentry.js +3 -7
- package/build/cjs/config/withSentry.js.map +1 -1
- package/build/cjs/config/wrapServerEntryWithDynamicImport.js +18 -20
- package/build/cjs/config/wrapServerEntryWithDynamicImport.js.map +1 -1
- package/build/cjs/index.client.js +1 -1
- package/build/cjs/index.server.js +1 -14
- package/build/cjs/index.server.js.map +1 -1
- package/build/cjs/server/index.js +1 -11
- package/build/cjs/server/index.js.map +1 -1
- package/build/cjs/server/middleware.js +2 -2
- package/build/cjs/server/middleware.js.map +1 -1
- package/build/cjs/server/sdk.js +1 -1
- package/build/cjs/server/solidrouter.js +1 -1
- package/build/cjs/server/utils.js +2 -6
- package/build/cjs/server/utils.js.map +1 -1
- package/build/cjs/server/withServerActionInstrumentation.js +1 -1
- package/build/cjs/solidrouter.client.js +1 -1
- package/build/cjs/solidrouter.js +1 -1
- package/build/cjs/solidrouter.server.js +1 -1
- package/build/cjs/vite/buildInstrumentationFile.js +1 -1
- package/build/cjs/vite/sentrySolidStartVite.js +8 -29
- package/build/cjs/vite/sentrySolidStartVite.js.map +1 -1
- package/build/cjs/vite/sourceMaps.js +123 -49
- package/build/cjs/vite/sourceMaps.js.map +1 -1
- package/build/esm/config/withSentry.js +2 -3
- package/build/esm/config/withSentry.js.map +1 -1
- package/build/esm/config/wrapServerEntryWithDynamicImport.js +17 -19
- package/build/esm/config/wrapServerEntryWithDynamicImport.js.map +1 -1
- package/build/esm/index.server.js +1 -2
- package/build/esm/index.server.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/server/index.js +1 -1
- package/build/esm/server/middleware.js +1 -1
- package/build/esm/server/middleware.js.map +1 -1
- package/build/esm/server/utils.js +1 -2
- package/build/esm/server/utils.js.map +1 -1
- package/build/esm/vite/sentrySolidStartVite.js +8 -25
- package/build/esm/vite/sentrySolidStartVite.js.map +1 -1
- package/build/esm/vite/sourceMaps.js +119 -43
- package/build/esm/vite/sourceMaps.js.map +1 -1
- package/build/types/config/utils.d.ts.map +1 -1
- package/build/types/config/wrapServerEntryWithDynamicImport.d.ts.map +1 -1
- package/build/types/index.server.d.ts +0 -1
- package/build/types/index.server.d.ts.map +1 -1
- package/build/types/index.types.d.ts +0 -2
- package/build/types/index.types.d.ts.map +1 -1
- package/build/types/server/index.d.ts +1 -1
- package/build/types/server/index.d.ts.map +1 -1
- package/build/types/vite/sentrySolidStartVite.d.ts +1 -18
- package/build/types/vite/sentrySolidStartVite.d.ts.map +1 -1
- package/build/types/vite/sourceMaps.d.ts +23 -5
- package/build/types/vite/sourceMaps.d.ts.map +1 -1
- package/package.json +6 -6
- package/build/types/vite/index.d.ts +0 -2
- package/build/types/vite/index.d.ts.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2024 Functional Software, Inc. dba Sentry
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
6
|
this software and associated documentation files (the "Software"), to deal in
|
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.
|
|
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.
|
|
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
|
|
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
|
-
```
|
package/build/cjs/client/sdk.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
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,8 +1,4 @@
|
|
|
1
|
-
|
|
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 (
|
|
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 (
|
|
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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAuC,EAAE,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,EAAE,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAE,QAAQ,CAAC;AAC3E,CAAC;;AAED,CAAA,CAAA;CACA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,C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ry.js","sources":["../../../src/config/withSentry.ts"],"sourcesContent":["import { logger } from '@sentry/core';\nimport type { Nitro } from 'nitropack';\nimport { addSentryPluginToVite } from '../vite/sentrySolidStartVite';\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,IAAG,gBAAgB,CAAC,MAAO,IAAG,EAAE,CAAE;AACjD,EAAE,MAAM,QAAQ,MAAM,CAAC,KAAM,IAAG,EAAE;AAClC,EAAE,MAAM,IAAK;AACb,IAAI,OAAO,gBAAgB,CAAC,IAAA,KAAS;AACrC,QAAQ,CAAC,GAAG,IAAI,KAAgBA,0CAAqB,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,mBAAmB;AACzG,QAAQA,0CAAqB,CAAC,gBAAgB,CAAC,IAAI,EAAE,mBAAmB,CAAC;;AAEzE,EAAE,OAAO;AACT,IAAI,GAAG,gBAAgB;AACvB,IAAI,IAAI;AACR,IAAI,MAAM,EAAE;AACZ,MAAM,GAAG,MAAM;AACf,MAAM,KAAK,EAAE;AACb,QAAQ,GAAG,KAAK;AAChB,QAAQ,MAAM,eAAe,CAAC,KAAK,EAAS,MAAM,EAAgB;AAClE,UAAU,IAAI,6BAA6B,EAAE,sBAAuB,KAAI,6BAA6B,EAAE;AACvG,YAAY,MAAMC,mDAAgC,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,mBAAoB,EAAC,CAAC;;AAExG,YAAY,6BAA6B,CAAC,KAAM;AAChD,cAAcC,WAAM,CAAC,GAAG;AACxB,gBAAgB,qHAAqH;AACrI,eAAe;AACf,iBAAiB;AACjB,YAAY,MAAMC,gDAA6B,CAAC,KAAK,CAAC;;AAEtD,YAAY,IAAI,6BAA6B,EAAE,sBAAuB,KAAI,kBAAkB,EAAE;AAC9F,cAAc,MAAMC,qCAAkB,CAAC,KAAK,CAAC;AAC7C;AACA;;AAEA;AACA,UAAU,IAAI,KAAK,CAAC,eAAe,CAAC,EAAE;AACtC,YAAY,KAAK,CAAC,eAAe,CAAC,CAAC,KAAK,CAAC;AACzC;AACA,SAAS;AACT,OAAO;AACP,KAAK;AACL,GAAG;AACH;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
1
|
+
Object.defineProperty(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
|
|
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 ||
|
|
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
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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,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,EAA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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;;AAEA,MAAA,IAAA,iBAAA,EAAA,QAAA,CAAA,MAAA,CAAA,EAAA;AACA;AACA;AACA;AACA;AACA,QAAA,OAAA,EAAA,EAAA,EAAA,MAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA;AACA;;AAEA,MAAA;AACA,QAAA,OAAA,CAAA,OAAA;AACA,QAAA,MAAA,CAAA,QAAA,CAAA,wBAAA,CAAA;AACA,QAAA,MAAA,CAAA,QAAA,CAAA,MA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AAA,EAAA,gBAAA,CAAA,QAAA,EAAA,IAAA,CAAA,SAAA,CAAA,OAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACA,QAAA,EAAA;AACA,OAAA;AACA,KAAA;AACA;;;;;;;;;;;;"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
3
|
const node = require('@sentry/node');
|
|
4
4
|
const solid = require('@sentry/solid');
|
|
5
5
|
const sdk = require('./server/sdk.js');
|
|
6
6
|
const withServerActionInstrumentation = require('./server/withServerActionInstrumentation.js');
|
|
7
7
|
const middleware = require('./server/middleware.js');
|
|
8
|
-
const sentrySolidStartVite = require('./vite/sentrySolidStartVite.js');
|
|
9
8
|
const withSentry = require('./config/withSentry.js');
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
|
|
13
|
-
exports.DEFAULT_USER_INCLUDES = node.DEFAULT_USER_INCLUDES;
|
|
14
12
|
exports.NodeClient = node.NodeClient;
|
|
15
13
|
exports.SDK_VERSION = node.SDK_VERSION;
|
|
16
14
|
exports.SEMANTIC_ATTRIBUTE_SENTRY_OP = node.SEMANTIC_ATTRIBUTE_SENTRY_OP;
|
|
@@ -21,8 +19,6 @@ exports.Scope = node.Scope;
|
|
|
21
19
|
exports.addBreadcrumb = node.addBreadcrumb;
|
|
22
20
|
exports.addEventProcessor = node.addEventProcessor;
|
|
23
21
|
exports.addIntegration = node.addIntegration;
|
|
24
|
-
exports.addOpenTelemetryInstrumentation = node.addOpenTelemetryInstrumentation;
|
|
25
|
-
exports.addRequestDataToEvent = node.addRequestDataToEvent;
|
|
26
22
|
exports.amqplibIntegration = node.amqplibIntegration;
|
|
27
23
|
exports.anrIntegration = node.anrIntegration;
|
|
28
24
|
exports.captureCheckIn = node.captureCheckIn;
|
|
@@ -40,7 +36,6 @@ exports.continueTrace = node.continueTrace;
|
|
|
40
36
|
exports.createGetModuleFromFilename = node.createGetModuleFromFilename;
|
|
41
37
|
exports.createTransport = node.createTransport;
|
|
42
38
|
exports.cron = node.cron;
|
|
43
|
-
exports.debugIntegration = node.debugIntegration;
|
|
44
39
|
exports.dedupeIntegration = node.dedupeIntegration;
|
|
45
40
|
exports.defaultStackParser = node.defaultStackParser;
|
|
46
41
|
exports.disableAnrDetectionForCallback = node.disableAnrDetectionForCallback;
|
|
@@ -48,7 +43,6 @@ exports.endSession = node.endSession;
|
|
|
48
43
|
exports.expressErrorHandler = node.expressErrorHandler;
|
|
49
44
|
exports.expressIntegration = node.expressIntegration;
|
|
50
45
|
exports.extraErrorDataIntegration = node.extraErrorDataIntegration;
|
|
51
|
-
exports.extractRequestData = node.extractRequestData;
|
|
52
46
|
exports.fastifyIntegration = node.fastifyIntegration;
|
|
53
47
|
exports.flush = node.flush;
|
|
54
48
|
exports.functionToStringIntegration = node.functionToStringIntegration;
|
|
@@ -57,7 +51,6 @@ exports.genericPoolIntegration = node.genericPoolIntegration;
|
|
|
57
51
|
exports.getActiveSpan = node.getActiveSpan;
|
|
58
52
|
exports.getAutoPerformanceIntegrations = node.getAutoPerformanceIntegrations;
|
|
59
53
|
exports.getClient = node.getClient;
|
|
60
|
-
exports.getCurrentHub = node.getCurrentHub;
|
|
61
54
|
exports.getCurrentScope = node.getCurrentScope;
|
|
62
55
|
exports.getDefaultIntegrations = node.getDefaultIntegrations;
|
|
63
56
|
exports.getGlobalScope = node.getGlobalScope;
|
|
@@ -79,14 +72,12 @@ exports.lastEventId = node.lastEventId;
|
|
|
79
72
|
exports.linkedErrorsIntegration = node.linkedErrorsIntegration;
|
|
80
73
|
exports.localVariablesIntegration = node.localVariablesIntegration;
|
|
81
74
|
exports.makeNodeTransport = node.makeNodeTransport;
|
|
82
|
-
exports.metrics = node.metrics;
|
|
83
75
|
exports.modulesIntegration = node.modulesIntegration;
|
|
84
76
|
exports.mongoIntegration = node.mongoIntegration;
|
|
85
77
|
exports.mongooseIntegration = node.mongooseIntegration;
|
|
86
78
|
exports.mysql2Integration = node.mysql2Integration;
|
|
87
79
|
exports.mysqlIntegration = node.mysqlIntegration;
|
|
88
80
|
exports.nativeNodeFetchIntegration = node.nativeNodeFetchIntegration;
|
|
89
|
-
exports.nestIntegration = node.nestIntegration;
|
|
90
81
|
exports.nodeContextIntegration = node.nodeContextIntegration;
|
|
91
82
|
exports.onUncaughtExceptionIntegration = node.onUncaughtExceptionIntegration;
|
|
92
83
|
exports.onUnhandledRejectionIntegration = node.onUnhandledRejectionIntegration;
|
|
@@ -96,7 +87,6 @@ exports.prismaIntegration = node.prismaIntegration;
|
|
|
96
87
|
exports.redisIntegration = node.redisIntegration;
|
|
97
88
|
exports.requestDataIntegration = node.requestDataIntegration;
|
|
98
89
|
exports.rewriteFramesIntegration = node.rewriteFramesIntegration;
|
|
99
|
-
exports.sessionTimingIntegration = node.sessionTimingIntegration;
|
|
100
90
|
exports.setContext = node.setContext;
|
|
101
91
|
exports.setCurrentClient = node.setCurrentClient;
|
|
102
92
|
exports.setExtra = node.setExtra;
|
|
@@ -110,7 +100,6 @@ exports.setupConnectErrorHandler = node.setupConnectErrorHandler;
|
|
|
110
100
|
exports.setupExpressErrorHandler = node.setupExpressErrorHandler;
|
|
111
101
|
exports.setupHapiErrorHandler = node.setupHapiErrorHandler;
|
|
112
102
|
exports.setupKoaErrorHandler = node.setupKoaErrorHandler;
|
|
113
|
-
exports.setupNestErrorHandler = node.setupNestErrorHandler;
|
|
114
103
|
exports.spanToBaggageHeader = node.spanToBaggageHeader;
|
|
115
104
|
exports.spanToJSON = node.spanToJSON;
|
|
116
105
|
exports.spanToTraceHeader = node.spanToTraceHeader;
|
|
@@ -133,8 +122,6 @@ exports.withSentryErrorBoundary = solid.withSentryErrorBoundary;
|
|
|
133
122
|
exports.init = sdk.init;
|
|
134
123
|
exports.withServerActionInstrumentation = withServerActionInstrumentation.withServerActionInstrumentation;
|
|
135
124
|
exports.sentryBeforeResponseMiddleware = middleware.sentryBeforeResponseMiddleware;
|
|
136
|
-
exports.addSentryPluginToVite = sentrySolidStartVite.addSentryPluginToVite;
|
|
137
|
-
exports.sentrySolidStartVite = sentrySolidStartVite.sentrySolidStartVite;
|
|
138
125
|
exports.withSentry = withSentry.withSentry;
|
|
139
126
|
Object.prototype.hasOwnProperty.call(node, '__proto__') &&
|
|
140
127
|
!Object.prototype.hasOwnProperty.call(exports, '__proto__') &&
|
|
@@ -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,
|
|
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,
|
|
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
|
|
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
|
|
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 TextE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