@sentry/solidstart 9.36.0 → 9.37.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 (31) hide show
  1. package/build/cjs/client/sdk.js.map +1 -1
  2. package/build/cjs/common/debug-build.js.map +1 -1
  3. package/build/cjs/config/addInstrumentation.js.map +1 -1
  4. package/build/cjs/config/withSentry.js +4 -3
  5. package/build/cjs/config/withSentry.js.map +1 -1
  6. package/build/cjs/config/wrapServerEntryWithDynamicImport.js.map +1 -1
  7. package/build/cjs/server/middleware.js.map +1 -1
  8. package/build/cjs/server/solidrouter.js.map +1 -1
  9. package/build/cjs/server/utils.js.map +1 -1
  10. package/build/cjs/server/withServerActionInstrumentation.js.map +1 -1
  11. package/build/cjs/vite/buildInstrumentationFile.js.map +1 -1
  12. package/build/cjs/vite/sentrySolidStartVite.js.map +1 -1
  13. package/build/cjs/vite/sourceMaps.js.map +1 -1
  14. package/build/esm/client/sdk.js.map +1 -1
  15. package/build/esm/common/debug-build.js.map +1 -1
  16. package/build/esm/config/addInstrumentation.js.map +1 -1
  17. package/build/esm/config/withSentry.js +4 -3
  18. package/build/esm/config/withSentry.js.map +1 -1
  19. package/build/esm/config/wrapServerEntryWithDynamicImport.js.map +1 -1
  20. package/build/esm/package.json +1 -1
  21. package/build/esm/server/middleware.js.map +1 -1
  22. package/build/esm/server/solidrouter.js.map +1 -1
  23. package/build/esm/server/utils.js.map +1 -1
  24. package/build/esm/server/withServerActionInstrumentation.js.map +1 -1
  25. package/build/esm/vite/buildInstrumentationFile.js.map +1 -1
  26. package/build/esm/vite/sentrySolidStartVite.js.map +1 -1
  27. package/build/esm/vite/sourceMaps.js.map +1 -1
  28. package/build/types/config/types.d.ts +1 -1
  29. package/build/types/config/types.d.ts.map +1 -1
  30. package/build/types/config/withSentry.d.ts.map +1 -1
  31. package/package.json +7 -4
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sources":["../../../src/client/sdk.ts"],"sourcesContent":["import type { Client, Integration } from '@sentry/core';\nimport { applySdkMetadata } from '@sentry/core';\nimport type { BrowserOptions } from '@sentry/solid';\nimport {\n browserTracingIntegration,\n getDefaultIntegrations as getDefaultSolidIntegrations,\n init as initSolidSDK,\n} from '@sentry/solid';\n\n// Treeshakable guard to remove all code related to tracing\ndeclare const __SENTRY_TRACING__: boolean;\n\n/**\n * Initializes the client side of the Solid Start SDK.\n */\nexport function init(options: BrowserOptions): Client | undefined {\n const opts = {\n defaultIntegrations: getDefaultIntegrations(options),\n ...options,\n };\n\n applySdkMetadata(opts, 'solidstart', ['solidstart', 'solid']);\n\n return initSolidSDK(opts);\n}\n\nfunction getDefaultIntegrations(options: BrowserOptions): Integration[] {\n const integrations = getDefaultSolidIntegrations(options);\n\n // This evaluates to true unless __SENTRY_TRACING__ is text-replaced with \"false\",\n // in which case everything inside will get tree-shaken away\n if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {\n // We add the default BrowserTracingIntegration here always.\n // We can do this, even if `solidRouterBrowserTracingIntegration` is\n // supplied as integration in `init` by users because it will win\n // over the default integration by virtue of having the same\n // `BrowserTracing` integration name and being added later.\n integrations.push(browserTracingIntegration());\n }\n\n return integrations;\n}\n"],"names":["applySdkMetadata","initSolidSDK","getDefaultSolidIntegrations","browserTracingIntegration"],"mappings":";;;;;AASA;;AAGA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAsC;AAClE,EAAE,MAAM,OAAO;AACf,IAAI,mBAAmB,EAAE,sBAAsB,CAAC,OAAO,CAAC;AACxD,IAAI,GAAG,OAAO;AACd,GAAG;;AAEH,EAAEA,qBAAgB,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;;AAE/D,EAAE,OAAOC,UAAY,CAAC,IAAI,CAAC;AAC3B;;AAEA,SAAS,sBAAsB,CAAC,OAAO,EAAiC;AACxE,EAAE,MAAM,YAAa,GAAEC,4BAA2B,CAAC,OAAO,CAAC;;AAE3D;AACA;AACA,EAAE,IAAI,OAAO,kBAAA,KAAuB,WAAY,IAAG,kBAAkB,EAAE;AACvE;AACA;AACA;AACA;AACA;AACA,IAAI,YAAY,CAAC,IAAI,CAACC,+BAAyB,EAAE,CAAC;AAClD;;AAEA,EAAE,OAAO,YAAY;AACrB;;;;"}
1
+ {"version":3,"file":"sdk.js","sources":["../../../src/client/sdk.ts"],"sourcesContent":["import type { Client, Integration } from '@sentry/core';\nimport { applySdkMetadata } from '@sentry/core';\nimport type { BrowserOptions } from '@sentry/solid';\nimport {\n browserTracingIntegration,\n getDefaultIntegrations as getDefaultSolidIntegrations,\n init as initSolidSDK,\n} from '@sentry/solid';\n\n// Treeshakable guard to remove all code related to tracing\ndeclare const __SENTRY_TRACING__: boolean;\n\n/**\n * Initializes the client side of the Solid Start SDK.\n */\nexport function init(options: BrowserOptions): Client | undefined {\n const opts = {\n defaultIntegrations: getDefaultIntegrations(options),\n ...options,\n };\n\n applySdkMetadata(opts, 'solidstart', ['solidstart', 'solid']);\n\n return initSolidSDK(opts);\n}\n\nfunction getDefaultIntegrations(options: BrowserOptions): Integration[] {\n const integrations = getDefaultSolidIntegrations(options);\n\n // This evaluates to true unless __SENTRY_TRACING__ is text-replaced with \"false\",\n // in which case everything inside will get tree-shaken away\n if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {\n // We add the default BrowserTracingIntegration here always.\n // We can do this, even if `solidRouterBrowserTracingIntegration` is\n // supplied as integration in `init` by users because it will win\n // over the default integration by virtue of having the same\n // `BrowserTracing` integration name and being added later.\n integrations.push(browserTracingIntegration());\n }\n\n return integrations;\n}\n"],"names":["applySdkMetadata","initSolidSDK","getDefaultSolidIntegrations","browserTracingIntegration"],"mappings":";;;;;AASA;;AAGA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAsC;AAClE,EAAE,MAAM,OAAO;AACf,IAAI,mBAAmB,EAAE,sBAAsB,CAAC,OAAO,CAAC;AACxD,IAAI,GAAG,OAAO;AACd,GAAG;;AAEH,EAAEA,qBAAgB,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;;AAE/D,EAAE,OAAOC,UAAY,CAAC,IAAI,CAAC;AAC3B;;AAEA,SAAS,sBAAsB,CAAC,OAAO,EAAiC;AACxE,EAAE,MAAM,YAAA,GAAeC,4BAA2B,CAAC,OAAO,CAAC;;AAE3D;AACA;AACA,EAAE,IAAI,OAAO,kBAAA,KAAuB,WAAA,IAAe,kBAAkB,EAAE;AACvE;AACA;AACA;AACA;AACA;AACA,IAAI,YAAY,CAAC,IAAI,CAACC,+BAAyB,EAAE,CAAC;AAClD;;AAEA,EAAE,OAAO,YAAY;AACrB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"debug-build.js","sources":["../../../src/common/debug-build.ts"],"sourcesContent":["declare const __DEBUG_BUILD__: boolean;\n\n/**\n * 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.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nexport const DEBUG_BUILD = __DEBUG_BUILD__;\n"],"names":[],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACO,MAAM,WAAY,IAAiB,OAAA,gBAAA,KAAA,WAAA,IAAA,gBAAA;;;;"}
1
+ {"version":3,"file":"debug-build.js","sources":["../../../src/common/debug-build.ts"],"sourcesContent":["declare const __DEBUG_BUILD__: boolean;\n\n/**\n * 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.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nexport const DEBUG_BUILD = __DEBUG_BUILD__;\n"],"names":[],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACO,MAAM,WAAA,IAAc,OAAA,gBAAA,KAAA,WAAA,IAAA,gBAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"addInstrumentation.js","sources":["../../../src/config/addInstrumentation.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport * as fs from 'fs';\nimport type { Nitro } from 'nitropack';\nimport * as path from 'path';\nimport type { SentrySolidStartPluginOptions } from '../vite/types';\nimport type { RollupConfig } from './types';\nimport { wrapServerEntryWithDynamicImport } from './wrapServerEntryWithDynamicImport';\n\n// Nitro presets for hosts that only host static files\nexport const staticHostPresets = ['github_pages'];\n// Nitro presets for hosts that use `server.mjs` as opposed to `index.mjs`\nexport const serverFilePresets = ['netlify'];\n\n/**\n * Adds the built `instrument.server.js` file to the output directory.\n *\n * As Sentry also imports the release injection file, this needs to be copied over manually as well.\n * TODO: The mechanism of manually copying those files could maybe be improved\n *\n * This will no-op if no `instrument.server.js` file was found in the\n * build directory.\n */\nexport async function addInstrumentationFileToBuild(nitro: Nitro): Promise<void> {\n nitro.hooks.hook('close', async () => {\n // Static file hosts have no server component so there's nothing to do\n if (staticHostPresets.includes(nitro.options.preset)) {\n return;\n }\n\n const buildDir = nitro.options.buildDir;\n const serverDir = nitro.options.output.serverDir;\n\n try {\n // 1. Create assets directory first (for release-injection-file)\n const assetsServerDir = path.join(serverDir, 'assets');\n if (!fs.existsSync(assetsServerDir)) {\n await fs.promises.mkdir(assetsServerDir, { recursive: true });\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(`[Sentry SolidStart withSentry] Successfully created directory ${assetsServerDir}.`);\n });\n }\n\n // 2. Copy release injection file if available\n try {\n const ssrAssetsPath = path.resolve(buildDir, 'build', 'ssr', 'assets');\n const assetsBuildDir = await fs.promises.readdir(ssrAssetsPath);\n const releaseInjectionFile = assetsBuildDir.find(file =>\n /^_sentry-release-injection-file-.*\\.(js|mjs)$/.test(file),\n );\n\n if (releaseInjectionFile) {\n const releaseSource = path.resolve(ssrAssetsPath, releaseInjectionFile);\n const releaseDestination = path.resolve(assetsServerDir, releaseInjectionFile);\n\n await fs.promises.copyFile(releaseSource, releaseDestination);\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(`[Sentry SolidStart withSentry] Successfully created ${releaseDestination}.`);\n });\n }\n } catch (err) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn('[Sentry SolidStart withSentry] Failed to copy release injection file.', err);\n });\n }\n\n // 3. Copy Sentry server instrumentation file\n const instrumentSource = path.resolve(buildDir, 'build', 'ssr', 'instrument.server.js');\n const instrumentDestination = path.resolve(serverDir, 'instrument.server.mjs');\n\n await fs.promises.copyFile(instrumentSource, instrumentDestination);\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(`[Sentry SolidStart withSentry] Successfully created ${instrumentDestination}.`);\n });\n } catch (error) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn('[Sentry SolidStart withSentry] Failed to add instrumentation file to build.', error);\n });\n }\n });\n}\n\n/**\n * Adds an `instrument.server.mjs` import to the top of the server entry file.\n *\n * This is meant as an escape hatch and should only be used in environments where\n * it's not possible to `--import` the file instead as it comes with a limited\n * tracing experience, only collecting http traces.\n */\nexport async function addSentryTopImport(nitro: Nitro): Promise<void> {\n nitro.hooks.hook('close', async () => {\n const buildPreset = nitro.options.preset;\n const serverDir = nitro.options.output.serverDir;\n\n // Static file hosts have no server component so there's nothing to do\n if (staticHostPresets.includes(buildPreset)) {\n return;\n }\n\n const instrumentationFile = path.resolve(serverDir, 'instrument.server.mjs');\n const serverEntryFileName = serverFilePresets.includes(buildPreset) ? 'server.mjs' : 'index.mjs';\n const serverEntryFile = path.resolve(serverDir, serverEntryFileName);\n\n try {\n await fs.promises.access(instrumentationFile, fs.constants.F_OK);\n } catch (error) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry SolidStart withSentry] Failed to add \\`${instrumentationFile}\\` as top level import to \\`${serverEntryFile}\\`.`,\n error,\n );\n });\n return;\n }\n\n try {\n const content = await fs.promises.readFile(serverEntryFile, 'utf-8');\n const updatedContent = `import './instrument.server.mjs';\\n${content}`;\n await fs.promises.writeFile(serverEntryFile, updatedContent);\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry SolidStart withSentry] Added \\`${instrumentationFile}\\` as top level import to \\`${serverEntryFile}\\`.`,\n );\n });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry SolidStart withSentry] An error occurred when trying to add \\`${instrumentationFile}\\` as top level import to \\`${serverEntryFile}\\`.`,\n error,\n );\n }\n });\n}\n\n/**\n * This function modifies the Rollup configuration to include a plugin that wraps the entry file with a dynamic import (`import()`)\n * and adds the Sentry server config with the static `import` declaration.\n *\n * With this, the Sentry server config can be loaded before all other modules of the application (which is needed for import-in-the-middle).\n * See: https://nodejs.org/api/module.html#enabling\n */\nexport async function addDynamicImportEntryFileWrapper({\n nitro,\n rollupConfig,\n sentryPluginOptions,\n}: {\n nitro: Nitro;\n rollupConfig: RollupConfig;\n sentryPluginOptions: Omit<SentrySolidStartPluginOptions, 'experimental_entrypointWrappedFunctions'> &\n Required<Pick<SentrySolidStartPluginOptions, 'experimental_entrypointWrappedFunctions'>>;\n}): Promise<void> {\n // Static file hosts have no server component so there's nothing to do\n if (staticHostPresets.includes(nitro.options.preset)) {\n return;\n }\n\n const srcDir = nitro.options.srcDir;\n // todo allow other instrumentation paths\n const serverInstrumentationPath = path.resolve(srcDir, 'src', 'instrument.server.ts');\n\n const instrumentationFileName = sentryPluginOptions.instrumentation\n ? path.basename(sentryPluginOptions.instrumentation)\n : '';\n\n rollupConfig.plugins.push(\n wrapServerEntryWithDynamicImport({\n serverConfigFileName: sentryPluginOptions.instrumentation\n ? path.join(path.dirname(instrumentationFileName), path.parse(instrumentationFileName).name)\n : 'instrument.server',\n serverEntrypointFileName: sentryPluginOptions.serverEntrypointFileName || nitro.options.preset,\n resolvedServerConfigPath: serverInstrumentationPath,\n entrypointWrappedFunctions: sentryPluginOptions.experimental_entrypointWrappedFunctions,\n additionalImports: ['import-in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AA,CAAA,IAAA;AACA,UAAA,mBAAA;AACA,MAAA,wBAAA,EAAA,mBAAA,CAAA,wBAAA,IAAA,KAAA,CAAA,OAAA,CAAA,MAAA;AACA,MAAA,wBAAA,EAAA,yBAAA;AACA,MAAA,0BAAA,EAAA,mBAAA,CAAA,uCAAA;AACA,MAAA,iBAAA,EAAA,CAAA,+BAAA,CAAA;AACA,MAAA,KAAA,EAAA,mBAAA,CAAA,KAAA;AACA,KAAA,CAAA;AACA,GAAA;AACA;;;;;;;;"}
1
+ {"version":3,"file":"addInstrumentation.js","sources":["../../../src/config/addInstrumentation.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport * as fs from 'fs';\nimport type { Nitro } from 'nitropack';\nimport * as path from 'path';\nimport type { SentrySolidStartPluginOptions } from '../vite/types';\nimport type { RollupConfig } from './types';\nimport { wrapServerEntryWithDynamicImport } from './wrapServerEntryWithDynamicImport';\n\n// Nitro presets for hosts that only host static files\nexport const staticHostPresets = ['github_pages'];\n// Nitro presets for hosts that use `server.mjs` as opposed to `index.mjs`\nexport const serverFilePresets = ['netlify'];\n\n/**\n * Adds the built `instrument.server.js` file to the output directory.\n *\n * As Sentry also imports the release injection file, this needs to be copied over manually as well.\n * TODO: The mechanism of manually copying those files could maybe be improved\n *\n * This will no-op if no `instrument.server.js` file was found in the\n * build directory.\n */\nexport async function addInstrumentationFileToBuild(nitro: Nitro): Promise<void> {\n nitro.hooks.hook('close', async () => {\n // Static file hosts have no server component so there's nothing to do\n if (staticHostPresets.includes(nitro.options.preset)) {\n return;\n }\n\n const buildDir = nitro.options.buildDir;\n const serverDir = nitro.options.output.serverDir;\n\n try {\n // 1. Create assets directory first (for release-injection-file)\n const assetsServerDir = path.join(serverDir, 'assets');\n if (!fs.existsSync(assetsServerDir)) {\n await fs.promises.mkdir(assetsServerDir, { recursive: true });\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(`[Sentry SolidStart withSentry] Successfully created directory ${assetsServerDir}.`);\n });\n }\n\n // 2. Copy release injection file if available\n try {\n const ssrAssetsPath = path.resolve(buildDir, 'build', 'ssr', 'assets');\n const assetsBuildDir = await fs.promises.readdir(ssrAssetsPath);\n const releaseInjectionFile = assetsBuildDir.find(file =>\n /^_sentry-release-injection-file-.*\\.(js|mjs)$/.test(file),\n );\n\n if (releaseInjectionFile) {\n const releaseSource = path.resolve(ssrAssetsPath, releaseInjectionFile);\n const releaseDestination = path.resolve(assetsServerDir, releaseInjectionFile);\n\n await fs.promises.copyFile(releaseSource, releaseDestination);\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(`[Sentry SolidStart withSentry] Successfully created ${releaseDestination}.`);\n });\n }\n } catch (err) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn('[Sentry SolidStart withSentry] Failed to copy release injection file.', err);\n });\n }\n\n // 3. Copy Sentry server instrumentation file\n const instrumentSource = path.resolve(buildDir, 'build', 'ssr', 'instrument.server.js');\n const instrumentDestination = path.resolve(serverDir, 'instrument.server.mjs');\n\n await fs.promises.copyFile(instrumentSource, instrumentDestination);\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(`[Sentry SolidStart withSentry] Successfully created ${instrumentDestination}.`);\n });\n } catch (error) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn('[Sentry SolidStart withSentry] Failed to add instrumentation file to build.', error);\n });\n }\n });\n}\n\n/**\n * Adds an `instrument.server.mjs` import to the top of the server entry file.\n *\n * This is meant as an escape hatch and should only be used in environments where\n * it's not possible to `--import` the file instead as it comes with a limited\n * tracing experience, only collecting http traces.\n */\nexport async function addSentryTopImport(nitro: Nitro): Promise<void> {\n nitro.hooks.hook('close', async () => {\n const buildPreset = nitro.options.preset;\n const serverDir = nitro.options.output.serverDir;\n\n // Static file hosts have no server component so there's nothing to do\n if (staticHostPresets.includes(buildPreset)) {\n return;\n }\n\n const instrumentationFile = path.resolve(serverDir, 'instrument.server.mjs');\n const serverEntryFileName = serverFilePresets.includes(buildPreset) ? 'server.mjs' : 'index.mjs';\n const serverEntryFile = path.resolve(serverDir, serverEntryFileName);\n\n try {\n await fs.promises.access(instrumentationFile, fs.constants.F_OK);\n } catch (error) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry SolidStart withSentry] Failed to add \\`${instrumentationFile}\\` as top level import to \\`${serverEntryFile}\\`.`,\n error,\n );\n });\n return;\n }\n\n try {\n const content = await fs.promises.readFile(serverEntryFile, 'utf-8');\n const updatedContent = `import './instrument.server.mjs';\\n${content}`;\n await fs.promises.writeFile(serverEntryFile, updatedContent);\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry SolidStart withSentry] Added \\`${instrumentationFile}\\` as top level import to \\`${serverEntryFile}\\`.`,\n );\n });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry SolidStart withSentry] An error occurred when trying to add \\`${instrumentationFile}\\` as top level import to \\`${serverEntryFile}\\`.`,\n error,\n );\n }\n });\n}\n\n/**\n * This function modifies the Rollup configuration to include a plugin that wraps the entry file with a dynamic import (`import()`)\n * and adds the Sentry server config with the static `import` declaration.\n *\n * With this, the Sentry server config can be loaded before all other modules of the application (which is needed for import-in-the-middle).\n * See: https://nodejs.org/api/module.html#enabling\n */\nexport async function addDynamicImportEntryFileWrapper({\n nitro,\n rollupConfig,\n sentryPluginOptions,\n}: {\n nitro: Nitro;\n rollupConfig: RollupConfig;\n sentryPluginOptions: Omit<SentrySolidStartPluginOptions, 'experimental_entrypointWrappedFunctions'> &\n Required<Pick<SentrySolidStartPluginOptions, 'experimental_entrypointWrappedFunctions'>>;\n}): Promise<void> {\n // Static file hosts have no server component so there's nothing to do\n if (staticHostPresets.includes(nitro.options.preset)) {\n return;\n }\n\n const srcDir = nitro.options.srcDir;\n // todo allow other instrumentation paths\n const serverInstrumentationPath = path.resolve(srcDir, 'src', 'instrument.server.ts');\n\n const instrumentationFileName = sentryPluginOptions.instrumentation\n ? path.basename(sentryPluginOptions.instrumentation)\n : '';\n\n rollupConfig.plugins.push(\n wrapServerEntryWithDynamicImport({\n serverConfigFileName: sentryPluginOptions.instrumentation\n ? path.join(path.dirname(instrumentationFileName), path.parse(instrumentationFileName).name)\n : 'instrument.server',\n serverEntrypointFileName: sentryPluginOptions.serverEntrypointFileName || nitro.options.preset,\n resolvedServerConfigPath: serverInstrumentationPath,\n entrypointWrappedFunctions: sentryPluginOptions.experimental_entrypointWrappedFunctions,\n additionalImports: ['import-in-the-middle/hook.mjs'],\n debug: sentryPluginOptions.debug,\n }),\n );\n}\n"],"names":["consoleSandbox","wrapServerEntryWithDynamicImport"],"mappings":";;;;;;;AAQA;AACO,MAAM,iBAAA,GAAoB,CAAC,cAAc;AAChD;AACO,MAAM,iBAAA,GAAoB,CAAC,SAAS;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAe,6BAA6B,CAAC,KAAK,EAAwB;AACjF,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY;AACxC;AACA,IAAI,IAAI,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;AAC1D,MAAM;AACN;;AAEA,IAAI,MAAM,QAAA,GAAW,KAAK,CAAC,OAAO,CAAC,QAAQ;AAC3C,IAAI,MAAM,YAAY,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS;;AAEpD,IAAI,IAAI;AACR;AACA,MAAM,MAAM,eAAA,GAAkB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC;AAC5D,MAAM,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE;AAC3C,QAAQ,MAAM,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,eAAe,EAAE,EAAE,SAAS,EAAE,IAAA,EAAM,CAAC;AACrE,QAAQA,mBAAc,CAAC,MAAM;AAC7B;AACA,UAAU,OAAO,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AAA,GAAA,mBAAA,CAAA;AACA,MAAA,IAAA,CAAA,QAAA,CAAA,mBAAA,CAAA,eAAA;AACA,MAAA,EAAA;;AAEA,EAAA,YAAA,CAAA,OAAA,CAAA,IAAA;AACA,IAAAC,iEAAA,CAAA;AACA,MAAA,oBAAA,EAAA,mBAAA,CAAA;AACA,UAAA,IAAA,CAAA,IAAA,CAAA,IAAA,CAAA,OAAA,CAAA,uBAAA,CAAA,EAAA,IAAA,CAAA,KAAA,CAAA,uBAAA,CAAA,CAAA,IAAA;AACA,UAAA,mBAAA;AACA,MAAA,wBAAA,EAAA,mBAAA,CAAA,wBAAA,IAAA,KAAA,CAAA,OAAA,CAAA,MAAA;AACA,MAAA,wBAAA,EAAA,yBAAA;AACA,MAAA,0BAAA,EAAA,mBAAA,CAAA,uCAAA;AACA,MAAA,iBAAA,EAAA,CAAA,+BAAA,CAAA;AACA,MAAA,KAAA,EAAA,mBAAA,CAAA,KAAA;AACA,KAAA,CAAA;AACA,GAAA;AACA;;;;;;;;"}
@@ -30,10 +30,11 @@ function withSentry(
30
30
 
31
31
  const server = (solidStartConfig.server || {}) ;
32
32
  const hooks = server.hooks || {};
33
+ const viteConfig = solidStartConfig.vite;
33
34
  const vite =
34
- typeof solidStartConfig.vite === 'function'
35
- ? (...args) => sentrySolidStartVite.addSentryPluginToVite(solidStartConfig.vite(...args), sentryPluginOptions)
36
- : sentrySolidStartVite.addSentryPluginToVite(solidStartConfig.vite, sentryPluginOptions);
35
+ typeof viteConfig === 'function'
36
+ ? (...args) => sentrySolidStartVite.addSentryPluginToVite(viteConfig(...args), sentryPluginOptions)
37
+ : sentrySolidStartVite.addSentryPluginToVite(viteConfig, sentryPluginOptions);
37
38
 
38
39
  return {
39
40
  ...solidStartConfig,
@@ -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/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
+ {"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/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 viteConfig = solidStartConfig.vite;\n const vite =\n typeof viteConfig === 'function'\n ? (...args: Parameters<typeof viteConfig>) => addSentryPluginToVite(viteConfig(...args), sentryPluginOptions)\n : addSentryPluginToVite(viteConfig, 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;A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AC;AACzC;AACA,SAAS;AACT,OAAO;AACP,KAAK;AACL,GAAG;AACH;;;;"}
@@ -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?.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;;AAE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,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,oBAAA,GAAuB;AAC7B,MAAM,wBAAA,GAA2B;AACjC,MAAM,2BAAA,GAA8B;AACpC,MAAM,mBAAA,GAAsB;;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,kBAAA,GAAqB,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,CAA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A,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 +1 @@
1
- {"version":3,"file":"middleware.js","sources":["../../../src/server/middleware.ts"],"sourcesContent":["import { addNonEnumerableProperty, getTraceMetaTags } 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":";;;;AAQA,SAAS,g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AC,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 { addNonEnumerableProperty, getTraceMetaTags } 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":";;;;AAQA,SAAS,gBAAgB,CAAC,IAAI,EAAkB;AAChD,EAAE,MAAM,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,CAAC,YAAY,CAAC,CAAC;AACpE;AACA,QAAQ,UAAU,CAAC,KAAK,EAAE;AAC1B,OAAO;AACP,KAAK,CAAC;AACN,GAAG;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"solidrouter.js","sources":["../../../src/server/solidrouter.ts"],"sourcesContent":["import type { HashRouter, MemoryRouter, Router as BaseRouter, RouteSectionProps, StaticRouter } from '@solidjs/router';\nimport type { Component, JSX, ParentProps } from 'solid-js';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { mergeProps, splitProps } from 'solid-js';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { createComponent } from 'solid-js/web';\n\n// We use @sentry/solid/solidrouter on the client.\n// On the server, we have to create matching components\n// in structure to avoid hydration errors.\n\n/** Pass-through component in case user didn't specify a root **/\nfunction SentryDefaultRoot(props: ParentProps): JSX.Element {\n return props.children;\n}\n\n/**\n * On the client, router hooks are used in the router's root render prop.\n * This creates a matching structure that's purely pass-through to avoid hydration errors.\n */\nfunction withSentryRouterRoot(Root: Component<RouteSectionProps>): Component<RouteSectionProps> {\n const SentryRouterRoot = (props: RouteSectionProps): JSX.Element => {\n return createComponent(Root, props);\n };\n\n return SentryRouterRoot;\n}\n\nexport type RouterType = typeof BaseRouter | typeof HashRouter | typeof MemoryRouter | typeof StaticRouter;\n\n/**\n * On the client, router hooks are used to start navigation spans.\n * This creates a matching structure that's purely pass-through to avoid hydration errors.\n */\nexport function withSentryRouterRouting(Router: RouterType): RouterType {\n const SentryRouter = (props: Parameters<RouterType>[0]): JSX.Element => {\n const [local, others] = splitProps(props, ['root']);\n // We need to wrap root here in case the user passed in their own root\n const Root = withSentryRouterRoot(local.root ? local.root : SentryDefaultRoot);\n\n return createComponent(Router, mergeProps({ root: Root }, others));\n };\n\n return SentryRouter;\n}\n"],"names":["createComponent","splitProps","mergeProps"],"mappings":";;;;;AAOA;AACA;AACA;;AAEA;AACA,SAAS,iBAAiB,CAAC,KAAK,EAA4B;AAC5D,EAAE,OAAO,KAAK,CAAC,QAAQ;AACvB;;AAEA;AACA;AACA;AACA;AACA,SAAS,oBAAoB,CAAC,IAAI,EAA8D;AAChG,EAAE,MAAM,gBAAA,GAAmB,CAAC,KAAK,KAAqC;AACtE,IAAI,OAAOA,mBAAe,CAAC,IAAI,EAAE,KAAK,CAAC;AACvC,GAAG;;AAEH,EAAE,OAAO,gBAAgB;AACzB;;AAIA;AACA;AACA;AACA;AACO,SAAS,uBAAuB,CAAC,MAAM,EAA0B;AACxE,EAAE,MAAM,YAAA,GAAe,CAAC,KAAK,KAA6C;AAC1E,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,CAAE,GAAEC,kBAAU,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC;AACvD;AACA,IAAI,MAAM,IAAA,GAAO,oBAAoB,CAAC,KAAK,CAAC,IAAK,GAAE,KAAK,CAAC,IAAK,GAAE,iBAAiB,CAAC;;AAElF,IAAI,OAAOD,mBAAe,CAAC,MAAM,EAAEE,kBAAU,CAAC,EAAE,IAAI,EAAE,IAAK,EAAC,EAAE,MAAM,CAAC,CAAC;AACtE,GAAG;;AAEH,EAAE,OAAO,YAAY;AACrB;;;;"}
1
+ {"version":3,"file":"solidrouter.js","sources":["../../../src/server/solidrouter.ts"],"sourcesContent":["import type { HashRouter, MemoryRouter, Router as BaseRouter, RouteSectionProps, StaticRouter } from '@solidjs/router';\nimport type { Component, JSX, ParentProps } from 'solid-js';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { mergeProps, splitProps } from 'solid-js';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { createComponent } from 'solid-js/web';\n\n// We use @sentry/solid/solidrouter on the client.\n// On the server, we have to create matching components\n// in structure to avoid hydration errors.\n\n/** Pass-through component in case user didn't specify a root **/\nfunction SentryDefaultRoot(props: ParentProps): JSX.Element {\n return props.children;\n}\n\n/**\n * On the client, router hooks are used in the router's root render prop.\n * This creates a matching structure that's purely pass-through to avoid hydration errors.\n */\nfunction withSentryRouterRoot(Root: Component<RouteSectionProps>): Component<RouteSectionProps> {\n const SentryRouterRoot = (props: RouteSectionProps): JSX.Element => {\n return createComponent(Root, props);\n };\n\n return SentryRouterRoot;\n}\n\nexport type RouterType = typeof BaseRouter | typeof HashRouter | typeof MemoryRouter | typeof StaticRouter;\n\n/**\n * On the client, router hooks are used to start navigation spans.\n * This creates a matching structure that's purely pass-through to avoid hydration errors.\n */\nexport function withSentryRouterRouting(Router: RouterType): RouterType {\n const SentryRouter = (props: Parameters<RouterType>[0]): JSX.Element => {\n const [local, others] = splitProps(props, ['root']);\n // We need to wrap root here in case the user passed in their own root\n const Root = withSentryRouterRoot(local.root ? local.root : SentryDefaultRoot);\n\n return createComponent(Router, mergeProps({ root: Root }, others));\n };\n\n return SentryRouter;\n}\n"],"names":["createComponent","splitProps","mergeProps"],"mappings":";;;;;AAOA;AACA;AACA;;AAEA;AACA,SAAS,iBAAiB,CAAC,KAAK,EAA4B;AAC5D,EAAE,OAAO,KAAK,CAAC,QAAQ;AACvB;;AAEA;AACA;AACA;AACA;AACA,SAAS,oBAAoB,CAAC,IAAI,EAA8D;AAChG,EAAE,MAAM,gBAAA,GAAmB,CAAC,KAAK,KAAqC;AACtE,IAAI,OAAOA,mBAAe,CAAC,IAAI,EAAE,KAAK,CAAC;AACvC,GAAG;;AAEH,EAAE,OAAO,gBAAgB;AACzB;;AAIA;AACA;AACA;AACA;AACO,SAAS,uBAAuB,CAAC,MAAM,EAA0B;AACxE,EAAE,MAAM,YAAA,GAAe,CAAC,KAAK,KAA6C;AAC1E,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,CAAA,GAAIC,kBAAU,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC;AACvD;AACA,IAAI,MAAM,IAAA,GAAO,oBAAoB,CAAC,KAAK,CAAC,IAAA,GAAO,KAAK,CAAC,IAAA,GAAO,iBAAiB,CAAC;;AAElF,IAAI,OAAOD,mBAAe,CAAC,MAAM,EAAEE,kBAAU,CAAC,EAAE,IAAI,EAAE,IAAA,EAAM,EAAE,MAAM,CAAC,CAAC;AACtE,GAAG;;AAEH,EAAE,OAAO,YAAY;AACrB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../src/server/utils.ts"],"sourcesContent":["import type { EventProcessor, Options } from '@sentry/core';\nimport { logger } from '@sentry/core';\nimport { flush, getGlobalScope } from '@sentry/node';\nimport { DEBUG_BUILD } from '../common/debug-build';\n\n/** Flush the event queue to ensure that events get sent to Sentry before the response is finished and the lambda ends */\nexport async function flushIfServerless(): Promise<void> {\n const isServerless = !!process.env.LAMBDA_TASK_ROOT || !!process.env.VERCEL;\n\n if (isServerless) {\n try {\n DEBUG_BUILD && logger.log('Flushing events...');\n await flush(2000);\n DEBUG_BUILD && logger.log('Done flushing events');\n } catch (e) {\n DEBUG_BUILD && logger.log('Error while flushing events:\\n', e);\n }\n }\n}\n\n/**\n * Determines if a thrown \"error\" is a redirect Response which Solid Start users can throw to redirect to another route.\n * see: https://docs.solidjs.com/solid-router/reference/data-apis/response-helpers#redirect\n * @param error the potential redirect error\n */\nexport function isRedirect(error: unknown): boolean {\n if (error == null || !(error instanceof Response)) {\n return false;\n }\n\n const hasValidLocation = typeof error.headers.get('location') === 'string';\n const hasValidStatus = error.status >= 300 && error.status <= 308;\n return hasValidLocation && hasValidStatus;\n}\n\n/**\n * Adds an event processor to filter out low quality transactions,\n * e.g. to filter out transactions for build assets\n */\nexport function filterLowQualityTransactions(options: Options): void {\n getGlobalScope().addEventProcessor(\n Object.assign(\n (event => {\n if (event.type !== 'transaction') {\n return event;\n }\n // Filter out transactions for build assets\n if (event.transaction?.match(/^GET \\/_build\\//)) {\n options.debug && logger.log('SolidStartLowQualityTransactionsFilter filtered transaction', event.transaction);\n return null;\n }\n return event;\n }) satisfies EventProcessor,\n { id: 'SolidStartLowQualityTransactionsFilter' },\n ),\n );\n}\n"],"names":["DEBUG_BUILD","logger","flush","getGlobalScope"],"mappings":";;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AE;AACzD,UAAU,OAAO,CAAC,KAAM,IAAGF,WAAM,CAAC,GAAG,CAAC,6DAA6D,EAAE,KAAK,CAAC,WAAW,CAAC;AACvH,UAAU,OAAO,IAAI;AACrB;AACA,QAAQ,OAAO,KAAK;AACpB,OAAO;AACP,MAAM,EAAE,EAAE,EAAE,wCAAA,EAA0C;AACtD,KAAK;AACL,GAAG;AACH;;;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../src/server/utils.ts"],"sourcesContent":["import type { EventProcessor, Options } from '@sentry/core';\nimport { logger } from '@sentry/core';\nimport { flush, getGlobalScope } from '@sentry/node';\nimport { DEBUG_BUILD } from '../common/debug-build';\n\n/** Flush the event queue to ensure that events get sent to Sentry before the response is finished and the lambda ends */\nexport async function flushIfServerless(): Promise<void> {\n const isServerless = !!process.env.LAMBDA_TASK_ROOT || !!process.env.VERCEL;\n\n if (isServerless) {\n try {\n DEBUG_BUILD && logger.log('Flushing events...');\n await flush(2000);\n DEBUG_BUILD && logger.log('Done flushing events');\n } catch (e) {\n DEBUG_BUILD && logger.log('Error while flushing events:\\n', e);\n }\n }\n}\n\n/**\n * Determines if a thrown \"error\" is a redirect Response which Solid Start users can throw to redirect to another route.\n * see: https://docs.solidjs.com/solid-router/reference/data-apis/response-helpers#redirect\n * @param error the potential redirect error\n */\nexport function isRedirect(error: unknown): boolean {\n if (error == null || !(error instanceof Response)) {\n return false;\n }\n\n const hasValidLocation = typeof error.headers.get('location') === 'string';\n const hasValidStatus = error.status >= 300 && error.status <= 308;\n return hasValidLocation && hasValidStatus;\n}\n\n/**\n * Adds an event processor to filter out low quality transactions,\n * e.g. to filter out transactions for build assets\n */\nexport function filterLowQualityTransactions(options: Options): void {\n getGlobalScope().addEventProcessor(\n Object.assign(\n (event => {\n if (event.type !== 'transaction') {\n return event;\n }\n // Filter out transactions for build assets\n if (event.transaction?.match(/^GET \\/_build\\//)) {\n options.debug && logger.log('SolidStartLowQualityTransactionsFilter filtered transaction', event.transaction);\n return null;\n }\n return event;\n }) satisfies EventProcessor,\n { id: 'SolidStartLowQualityTransactionsFilter' },\n ),\n );\n}\n"],"names":["DEBUG_BUILD","logger","flush","getGlobalScope"],"mappings":";;;;;;AAKA;AACO,eAAe,iBAAiB,GAAkB;AACzD,EAAE,MAAM,YAAA,GAAe,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAA,IAAoB,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM;;AAE7E,EAAE,IAAI,YAAY,EAAE;AACpB,IAAI,IAAI;AACR,MAAMA,0BAAeC,WAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC;AACrD,MAAM,MAAMC,UAAK,CAAC,IAAI,CAAC;AACvB,MAAMF,0BAAeC,WAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC;AACvD,KAAI,CAAE,OAAO,CAAC,EAAE;AAChB,MAAMD,sBAAA,IAAeC,WAAM,CAAC,GAAG,CAAC,gCAAgC,EAAE,CAAC,CAAC;AACpE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,UAAU,CAAC,KAAK,EAAoB;AACpD,EAAE,IAAI,KAAA,IAAS,IAAA,IAAQ,EAAE,KAAA,YAAiB,QAAQ,CAAC,EAAE;AACrD,IAAI,OAAO,KAAK;AAChB;;AAEA,EAAE,MAAM,gBAAA,GAAmB,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAA,KAAM,QAAQ;AAC5E,EAAE,MAAM,cAAA,GAAiB,KAAK,CAAC,MAAA,IAAU,GAAA,IAAO,KAAK,CAAC,MAAA,IAAU,GAAG;AACnE,EAAE,OAAO,gBAAA,IAAoB,cAAc;AAC3C;;AAEA;AACA;AACA;AACA;AACO,SAAS,4BAA4B,CAAC,OAAO,EAAiB;AACrE,EAAEE,mBAAc,EAAE,CAAC,iBAAiB;AACpC,IAAI,MAAM,CAAC,MAAM;AACjB,OAAO,SAAS;AAChB,QAAQ,IAAI,KAAK,CAAC,IAAA,KAAS,aAAa,EAAE;AAC1C,UAAU,OAAO,KAAK;AACtB;AACA;AACA,QAAQ,IAAI,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,iBAAiB,CAAC,EAAE;AACzD,UAAU,OAAO,CAAC,KAAA,IAASF,WAAM,CAAC,GAAG,CAAC,6DAA6D,EAAE,KAAK,CAAC,WAAW,CAAC;AACvH,UAAU,OAAO,IAAI;AACrB;AACA,QAAQ,OAAO,KAAK;AACpB,OAAO;AACP,MAAM,EAAE,EAAE,EAAE,wCAAA,EAA0C;AACtD,KAAK;AACL,GAAG;AACH;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withServerActionInstrumentation.js","sources":["../../../src/server/withServerActionInstrumentation.ts"],"sourcesContent":["import { handleCallbackErrors, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR } from '@sentry/core';\nimport { captureException, getActiveSpan, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, startSpan } from '@sentry/node';\nimport { flushIfServerless, isRedirect } from './utils';\n\n/**\n * Wraps a server action (functions that use the 'use server' directive)\n * function body with Sentry Error and Performance instrumentation.\n */\nexport async function withServerActionInstrumentation<A extends (...args: unknown[]) => unknown>(\n serverActionName: string,\n callback: A,\n): Promise<ReturnType<A>> {\n const activeSpan = getActiveSpan();\n\n if (activeSpan) {\n const spanData = spanToJSON(activeSpan).data;\n\n // In solid start, server function calls are made to `/_server` which doesn't tell us\n // a lot. We rewrite the span's route to be that of the sever action name but only\n // if the target is `/_server`, otherwise we'd overwrite pageloads on routes that use\n // server actions (which are more meaningful, e.g. a request to `GET /users/5` is more\n // meaningful than overwriting it with `GET doSomeFunctionCall`).\n if (spanData && !spanData['http.route'] && spanData['http.target'] === '/_server') {\n activeSpan.setAttribute('http.route', serverActionName);\n activeSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'component');\n }\n }\n\n try {\n return await startSpan(\n {\n op: 'function.server_action',\n name: serverActionName,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component',\n },\n },\n async span => {\n const result = await handleCallbackErrors(callback, error => {\n if (!isRedirect(error)) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });\n captureException(error, {\n mechanism: {\n handled: false,\n type: 'solidstart',\n },\n });\n }\n });\n\n return result;\n },\n );\n } finally {\n await flushIfServerless();\n }\n}\n"],"names":["getActiveSpan","spanToJSON","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","startSpan","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","handleCallbackErrors","isRedirect","SPAN_STATUS_ERROR","captureException","flushIfServerless"],"mappings":";;;;;;AAIA;AACA;AACA;AACA;AACO,eAAe,+BAA+B;AACrD,EAAE,gBAAgB;AAClB,EAAE,QAAQ;AACV,EAA0B;AAC1B,EAAE,MAAM,UAAA,GAAaA,kBAAa,EAAE;;AAEpC,EAAE,IAAI,UAAU,EAAE;AAClB,IAAI,MAAM,WAAWC,eAAU,CAAC,UAAU,CAAC,CAAC,IAAI;;AAEhD;AACA;AACA;AACA;AACA;AACA,IAAI,IAAI,QAAA,IAAY,CAAC,QAAQ,CAAC,YAAY,CAAE,IAAG,QAAQ,CAAC,aAAa,CAAE,KAAI,UAAU,EAAE;AACvF,MAAM,UAAU,CAAC,YAAY,CAAC,YAAY,EAAE,gBAAgB,CAAC;AAC7D,MAAM,UAAU,CAAC,YAAY,CAACC,qCAAgC,EAAE,WAAW,CAAC;AAC5E;AACA;;AAEA,EAAE,IAAI;AACN,IAAI,OAAO,MAAMC,cAAS;AAC1B,MAAM;AACN,QAAQ,EAAE,EAAE,wBAAwB;AACpC,QAAQ,IAAI,EAAE,gBAAgB;AAC9B,QAAQ,UAAU,EAAE;AACpB,UAAU,CAACC,qCAAgC,GAAG,0BAA0B;AACxE,UAAU,CAACF,qCAAgC,GAAG,WAAW;AACzD,SAAS;AACT,OAAO;AACP,MAAM,MAAM,QAAQ;AACpB,QAAQ,MAAM,SAAS,MAAMG,yBAAoB,CAAC,QAAQ,EAAE,KAAA,IAAS;AACrE,UAAU,IAAI,CAACC,gBAAU,CAAC,KAAK,CAAC,EAAE;AAClC,YAAY,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAEC,sBAAiB,EAAE,OAAO,EAAE,gBAAA,EAAkB,CAAC;AAClF,YAAYC,qBAAgB,CAAC,KAAK,EAAE;AACpC,cAAc,SAAS,EAAE;AACzB,gBAAgB,OAAO,EAAE,KAAK;AAC9B,gBAAgB,IAAI,EAAE,YAAY;AAClC,eAAe;AACf,aAAa,CAAC;AACd;AACA,SAAS,CAAC;;AAEV,QAAQ,OAAO,MAAM;AACrB,OAAO;AACP,KAAK;AACL,YAAY;AACZ,IAAI,MAAMC,uBAAiB,EAAE;AAC7B;AACA;;;;"}
1
+ {"version":3,"file":"withServerActionInstrumentation.js","sources":["../../../src/server/withServerActionInstrumentation.ts"],"sourcesContent":["import { handleCallbackErrors, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR } from '@sentry/core';\nimport { captureException, getActiveSpan, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, startSpan } from '@sentry/node';\nimport { flushIfServerless, isRedirect } from './utils';\n\n/**\n * Wraps a server action (functions that use the 'use server' directive)\n * function body with Sentry Error and Performance instrumentation.\n */\nexport async function withServerActionInstrumentation<A extends (...args: unknown[]) => unknown>(\n serverActionName: string,\n callback: A,\n): Promise<ReturnType<A>> {\n const activeSpan = getActiveSpan();\n\n if (activeSpan) {\n const spanData = spanToJSON(activeSpan).data;\n\n // In solid start, server function calls are made to `/_server` which doesn't tell us\n // a lot. We rewrite the span's route to be that of the sever action name but only\n // if the target is `/_server`, otherwise we'd overwrite pageloads on routes that use\n // server actions (which are more meaningful, e.g. a request to `GET /users/5` is more\n // meaningful than overwriting it with `GET doSomeFunctionCall`).\n if (spanData && !spanData['http.route'] && spanData['http.target'] === '/_server') {\n activeSpan.setAttribute('http.route', serverActionName);\n activeSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'component');\n }\n }\n\n try {\n return await startSpan(\n {\n op: 'function.server_action',\n name: serverActionName,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component',\n },\n },\n async span => {\n const result = await handleCallbackErrors(callback, error => {\n if (!isRedirect(error)) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });\n captureException(error, {\n mechanism: {\n handled: false,\n type: 'solidstart',\n },\n });\n }\n });\n\n return result;\n },\n );\n } finally {\n await flushIfServerless();\n }\n}\n"],"names":["getActiveSpan","spanToJSON","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","startSpan","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","handleCallbackErrors","isRedirect","SPAN_STATUS_ERROR","captureException","flushIfServerless"],"mappings":";;;;;;AAIA;AACA;AACA;AACA;AACO,eAAe,+BAA+B;AACrD,EAAE,gBAAgB;AAClB,EAAE,QAAQ;AACV,EAA0B;AAC1B,EAAE,MAAM,UAAA,GAAaA,kBAAa,EAAE;;AAEpC,EAAE,IAAI,UAAU,EAAE;AAClB,IAAI,MAAM,WAAWC,eAAU,CAAC,UAAU,CAAC,CAAC,IAAI;;AAEhD;AACA;AACA;AACA;AACA;AACA,IAAI,IAAI,QAAA,IAAY,CAAC,QAAQ,CAAC,YAAY,CAAA,IAAK,QAAQ,CAAC,aAAa,CAAA,KAAM,UAAU,EAAE;AACvF,MAAM,UAAU,CAAC,YAAY,CAAC,YAAY,EAAE,gBAAgB,CAAC;AAC7D,MAAM,UAAU,CAAC,YAAY,CAACC,qCAAgC,EAAE,WAAW,CAAC;AAC5E;AACA;;AAEA,EAAE,IAAI;AACN,IAAI,OAAO,MAAMC,cAAS;AAC1B,MAAM;AACN,QAAQ,EAAE,EAAE,wBAAwB;AACpC,QAAQ,IAAI,EAAE,gBAAgB;AAC9B,QAAQ,UAAU,EAAE;AACpB,UAAU,CAACC,qCAAgC,GAAG,0BAA0B;AACxE,UAAU,CAACF,qCAAgC,GAAG,WAAW;AACzD,SAAS;AACT,OAAO;AACP,MAAM,MAAM,QAAQ;AACpB,QAAQ,MAAM,SAAS,MAAMG,yBAAoB,CAAC,QAAQ,EAAE,KAAA,IAAS;AACrE,UAAU,IAAI,CAACC,gBAAU,CAAC,KAAK,CAAC,EAAE;AAClC,YAAY,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAEC,sBAAiB,EAAE,OAAO,EAAE,gBAAA,EAAkB,CAAC;AAClF,YAAYC,qBAAgB,CAAC,KAAK,EAAE;AACpC,cAAc,SAAS,EAAE;AACzB,gBAAgB,OAAO,EAAE,KAAK;AAC9B,gBAAgB,IAAI,EAAE,YAAY;AAClC,eAAe;AACf,aAAa,CAAC;AACd;AACA,SAAS,CAAC;;AAEV,QAAQ,OAAO,MAAM;AACrB,OAAO;AACP,KAAK;AACL,YAAY;AACZ,IAAI,MAAMC,uBAAiB,EAAE;AAC7B;AACA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"buildInstrumentationFile.js","sources":["../../../src/vite/buildInstrumentationFile.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type { Plugin, UserConfig } from 'vite';\nimport type { SentrySolidStartPluginOptions } from './types';\n\n/**\n * A Sentry plugin for SolidStart to build the server\n * `instrument.server.ts` file.\n */\nexport function makeBuildInstrumentationFilePlugin(options: SentrySolidStartPluginOptions = {}): Plugin {\n return {\n name: 'sentry-solidstart-build-instrumentation-file',\n apply: 'build',\n enforce: 'post',\n async config(config: UserConfig, { command }) {\n const instrumentationFilePath = options.instrumentation || './src/instrument.server.ts';\n const router = (config as UserConfig & { router: { target: string; name: string; root: string } }).router;\n const build = config.build || {};\n const rollupOptions = build.rollupOptions || {};\n const input = [...((rollupOptions.input || []) as string[])];\n\n // plugin runs for client, server and sever-fns, we only want to run it for the server once.\n if (command !== 'build' || router.target !== 'server' || router.name === 'server-fns') {\n return config;\n }\n\n try {\n await fs.promises.access(instrumentationFilePath, fs.constants.F_OK);\n } catch (error) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry SolidStart Plugin] Could not access \\`${instrumentationFilePath}\\`, please make sure it exists.`,\n error,\n );\n });\n return config;\n }\n\n input.push(path.resolve(router.root, instrumentationFilePath));\n\n return {\n ...config,\n build: {\n ...build,\n rollupOptions: {\n ...rollupOptions,\n input,\n },\n },\n };\n },\n };\n}\n"],"names":["consoleSandbox"],"mappings":";;;;;;AAMA;AACA;AACA;AACA;AACO,SAAS,kCAAkC,CAAC,OAAO,GAAkC,EAAE,EAAU;AACxG,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,8CAA8C;AACxD,IAAI,KAAK,EAAE,OAAO;AAClB,IAAI,OAAO,EAAE,MAAM;AACnB,IAAI,MAAM,MAAM,CAAC,MAAM,EAAc,EAAE,OAAA,EAAS,EAAE;AAClD,MAAM,MAAM,uBAAwB,GAAE,OAAO,CAAC,eAAA,IAAmB,4BAA4B;AAC7F,MAAM,MAAM,MAAO,GAAE,CAAC,MAAO,GAA4E,MAAM;AAC/G,MAAM,MAAM,QAAQ,MAAM,CAAC,KAAM,IAAG,EAAE;AACtC,MAAM,MAAM,gBAAgB,KAAK,CAAC,aAAc,IAAG,EAAE;AACrD,MAAM,MAAM,KAAA,GAAQ,CAAC,KAAK,aAAa,CAAC,SAAS,EAAE,GAAc,CAAC;;AAElE;AACA,MAAM,IAAI,OAAA,KAAY,OAAA,IAAW,MAAM,CAAC,MAAO,KAAI,YAAY,MAAM,CAAC,IAAK,KAAI,YAAY,EAAE;AAC7F,QAAQ,OAAO,MAAM;AACrB;;AAEA,MAAM,IAAI;AACV,QAAQ,MAAM,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,uBAAuB,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC;AAC5E,OAAQ,CAAA,OAAO,KAAK,EAAE;AACtB,QAAQA,mBAAc,CAAC,MAAM;AAC7B;AACA,UAAU,OAAO,CAAC,IAAI;AACtB,YAAY,CAAC,8CAA8C,EAAE,uBAAuB,CAAC,+BAA+B,CAAC;AACrH,YAAY,KAAK;AACjB,WAAW;AACX,SAAS,CAAC;AACV,QAAQ,OAAO,MAAM;AACrB;;AAEA,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,uBAAuB,CAAC,CAAC;;AAEpE,MAAM,OAAO;AACb,QAAQ,GAAG,MAAM;AACjB,QAAQ,KAAK,EAAE;AACf,UAAU,GAAG,KAAK;AAClB,UAAU,aAAa,EAAE;AACzB,YAAY,GAAG,aAAa;AAC5B,YAAY,KAAK;AACjB,WAAW;AACX,SAAS;AACT,OAAO;AACP,KAAK;AACL,GAAG;AACH;;;;"}
1
+ {"version":3,"file":"buildInstrumentationFile.js","sources":["../../../src/vite/buildInstrumentationFile.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type { Plugin, UserConfig } from 'vite';\nimport type { SentrySolidStartPluginOptions } from './types';\n\n/**\n * A Sentry plugin for SolidStart to build the server\n * `instrument.server.ts` file.\n */\nexport function makeBuildInstrumentationFilePlugin(options: SentrySolidStartPluginOptions = {}): Plugin {\n return {\n name: 'sentry-solidstart-build-instrumentation-file',\n apply: 'build',\n enforce: 'post',\n async config(config: UserConfig, { command }) {\n const instrumentationFilePath = options.instrumentation || './src/instrument.server.ts';\n const router = (config as UserConfig & { router: { target: string; name: string; root: string } }).router;\n const build = config.build || {};\n const rollupOptions = build.rollupOptions || {};\n const input = [...((rollupOptions.input || []) as string[])];\n\n // plugin runs for client, server and sever-fns, we only want to run it for the server once.\n if (command !== 'build' || router.target !== 'server' || router.name === 'server-fns') {\n return config;\n }\n\n try {\n await fs.promises.access(instrumentationFilePath, fs.constants.F_OK);\n } catch (error) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry SolidStart Plugin] Could not access \\`${instrumentationFilePath}\\`, please make sure it exists.`,\n error,\n );\n });\n return config;\n }\n\n input.push(path.resolve(router.root, instrumentationFilePath));\n\n return {\n ...config,\n build: {\n ...build,\n rollupOptions: {\n ...rollupOptions,\n input,\n },\n },\n };\n },\n };\n}\n"],"names":["consoleSandbox"],"mappings":";;;;;;AAMA;AACA;AACA;AACA;AACO,SAAS,kCAAkC,CAAC,OAAO,GAAkC,EAAE,EAAU;AACxG,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,8CAA8C;AACxD,IAAI,KAAK,EAAE,OAAO;AAClB,IAAI,OAAO,EAAE,MAAM;AACnB,IAAI,MAAM,MAAM,CAAC,MAAM,EAAc,EAAE,OAAA,EAAS,EAAE;AAClD,MAAM,MAAM,uBAAA,GAA0B,OAAO,CAAC,eAAA,IAAmB,4BAA4B;AAC7F,MAAM,MAAM,MAAA,GAAS,CAAC,MAAA,GAAmF,MAAM;AAC/G,MAAM,MAAM,QAAQ,MAAM,CAAC,KAAA,IAAS,EAAE;AACtC,MAAM,MAAM,gBAAgB,KAAK,CAAC,aAAA,IAAiB,EAAE;AACrD,MAAM,MAAM,KAAA,GAAQ,CAAC,KAAK,aAAa,CAAC,SAAS,EAAE,GAAc,CAAC;;AAElE;AACA,MAAM,IAAI,OAAA,KAAY,OAAA,IAAW,MAAM,CAAC,MAAA,KAAW,YAAY,MAAM,CAAC,IAAA,KAAS,YAAY,EAAE;AAC7F,QAAQ,OAAO,MAAM;AACrB;;AAEA,MAAM,IAAI;AACV,QAAQ,MAAM,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,uBAAuB,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC;AAC5E,OAAM,CAAE,OAAO,KAAK,EAAE;AACtB,QAAQA,mBAAc,CAAC,MAAM;AAC7B;AACA,UAAU,OAAO,CAAC,IAAI;AACtB,YAAY,CAAC,8CAA8C,EAAE,uBAAuB,CAAC,+BAA+B,CAAC;AACrH,YAAY,KAAK;AACjB,WAAW;AACX,SAAS,CAAC;AACV,QAAQ,OAAO,MAAM;AACrB;;AAEA,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,uBAAuB,CAAC,CAAC;;AAEpE,MAAM,OAAO;AACb,QAAQ,GAAG,MAAM;AACjB,QAAQ,KAAK,EAAE;AACf,UAAU,GAAG,KAAK;AAClB,UAAU,aAAa,EAAE;AACzB,YAAY,GAAG,aAAa;AAC5B,YAAY,KAAK;AACjB,WAAW;AACX,SAAS;AACT,OAAO;AACP,KAAK;AACL,GAAG;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"sentrySolidStartVite.js","sources":["../../../src/vite/sentrySolidStartVite.ts"],"sourcesContent":["import type { Plugin, UserConfig } from 'vite';\nimport { makeBuildInstrumentationFilePlugin } from './buildInstrumentationFile';\nimport { makeAddSentryVitePlugin, makeEnableSourceMapsVitePlugin } from './sourceMaps';\nimport type { SentrySolidStartPluginOptions } from './types';\n\n/**\n * Various Sentry vite plugins to be used for SolidStart.\n */\nexport const sentrySolidStartVite = (options: SentrySolidStartPluginOptions = {}, viteConfig: UserConfig): Plugin[] => {\n const sentryPlugins: Plugin[] = [];\n\n if (options.autoInjectServerSentry !== 'experimental_dynamic-import') {\n sentryPlugins.push(makeBuildInstrumentationFilePlugin(options));\n }\n\n if (process.env.NODE_ENV !== 'development') {\n if (options.sourceMapsUploadOptions?.enabled ?? true) {\n const sourceMapsPlugin = makeAddSentryVitePlugin(options, viteConfig);\n const enableSourceMapsPlugin = makeEnableSourceMapsVitePlugin(options);\n\n sentryPlugins.push(...sourceMapsPlugin, ...enableSourceMapsPlugin);\n }\n }\n\n return sentryPlugins;\n};\n\n/**\n * Helper to add the Sentry SolidStart vite plugin to a vite config.\n */\nexport const addSentryPluginToVite = (config: UserConfig = {}, options: SentrySolidStartPluginOptions): UserConfig => {\n const plugins = Array.isArray(config.plugins) ? [...config.plugins] : [];\n plugins.unshift(sentrySolidStartVite(options, config));\n\n return {\n ...config,\n plugins,\n };\n};\n"],"names":["makeBuildInstrumentationFilePlugin","makeAddSentryVitePlugin","makeEnableSourceMapsVitePlugin"],"mappings":";;;;;AAKA;AACA;AACA;AACO,MAAM,oBAAqB,GAAE,CAAC,OAAO,GAAkC,EAAE,EAAE,UAAU,KAA2B;AACvH,EAAE,MAAM,aAAa,GAAa,EAAE;;AAEpC,EAAE,IAAI,OAAO,CAAC,sBAAuB,KAAI,6BAA6B,EAAE;AACxE,IAAI,aAAa,CAAC,IAAI,CAACA,2DAAkC,CAAC,OAAO,CAAC,CAAC;AACnE;;AAEA,EAAE,IAAI,OAAO,CAAC,GAAG,CAAC,QAAA,KAAa,aAAa,EAAE;AAC9C,IAAI,IAAI,OAAO,CAAC,uBAAuB,EAAE,OAAA,IAAW,IAAI,EAAE;AAC1D,MAAM,MAAM,mBAAmBC,kCAAuB,CAAC,OAAO,EAAE,UAAU,CAAC;AAC3E,MAAM,MAAM,sBAAuB,GAAEC,yCAA8B,CAAC,OAAO,CAAC;;AAE5E,MAAM,aAAa,CAAC,IAAI,CAAC,GAAG,gBAAgB,EAAE,GAAG,sBAAsB,CAAC;AACxE;AACA;;AAEA,EAAE,OAAO,aAAa;AACtB;;AAEA;AACA;AACA;AACO,MAAM,qBAAsB,GAAE,CAAC,MAAM,GAAe,EAAE,EAAE,OAAO,KAAgD;AACtH,EAAE,MAAM,UAAU,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,GAAG,MAAM,CAAC,OAAO,CAAE,GAAE,EAAE;AAC1E,EAAE,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;;AAExD,EAAE,OAAO;AACT,IAAI,GAAG,MAAM;AACb,IAAI,OAAO;AACX,GAAG;AACH;;;;;"}
1
+ {"version":3,"file":"sentrySolidStartVite.js","sources":["../../../src/vite/sentrySolidStartVite.ts"],"sourcesContent":["import type { Plugin, UserConfig } from 'vite';\nimport { makeBuildInstrumentationFilePlugin } from './buildInstrumentationFile';\nimport { makeAddSentryVitePlugin, makeEnableSourceMapsVitePlugin } from './sourceMaps';\nimport type { SentrySolidStartPluginOptions } from './types';\n\n/**\n * Various Sentry vite plugins to be used for SolidStart.\n */\nexport const sentrySolidStartVite = (options: SentrySolidStartPluginOptions = {}, viteConfig: UserConfig): Plugin[] => {\n const sentryPlugins: Plugin[] = [];\n\n if (options.autoInjectServerSentry !== 'experimental_dynamic-import') {\n sentryPlugins.push(makeBuildInstrumentationFilePlugin(options));\n }\n\n if (process.env.NODE_ENV !== 'development') {\n if (options.sourceMapsUploadOptions?.enabled ?? true) {\n const sourceMapsPlugin = makeAddSentryVitePlugin(options, viteConfig);\n const enableSourceMapsPlugin = makeEnableSourceMapsVitePlugin(options);\n\n sentryPlugins.push(...sourceMapsPlugin, ...enableSourceMapsPlugin);\n }\n }\n\n return sentryPlugins;\n};\n\n/**\n * Helper to add the Sentry SolidStart vite plugin to a vite config.\n */\nexport const addSentryPluginToVite = (config: UserConfig = {}, options: SentrySolidStartPluginOptions): UserConfig => {\n const plugins = Array.isArray(config.plugins) ? [...config.plugins] : [];\n plugins.unshift(sentrySolidStartVite(options, config));\n\n return {\n ...config,\n plugins,\n };\n};\n"],"names":["makeBuildInstrumentationFilePlugin","makeAddSentryVitePlugin","makeEnableSourceMapsVitePlugin"],"mappings":";;;;;AAKA;AACA;AACA;AACO,MAAM,oBAAA,GAAuB,CAAC,OAAO,GAAkC,EAAE,EAAE,UAAU,KAA2B;AACvH,EAAE,MAAM,aAAa,GAAa,EAAE;;AAEpC,EAAE,IAAI,OAAO,CAAC,sBAAA,KAA2B,6BAA6B,EAAE;AACxE,IAAI,aAAa,CAAC,IAAI,CAACA,2DAAkC,CAAC,OAAO,CAAC,CAAC;AACnE;;AAEA,EAAE,IAAI,OAAO,CAAC,GAAG,CAAC,QAAA,KAAa,aAAa,EAAE;AAC9C,IAAI,IAAI,OAAO,CAAC,uBAAuB,EAAE,OAAA,IAAW,IAAI,EAAE;AAC1D,MAAM,MAAM,mBAAmBC,kCAAuB,CAAC,OAAO,EAAE,UAAU,CAAC;AAC3E,MAAM,MAAM,sBAAA,GAAyBC,yCAA8B,CAAC,OAAO,CAAC;;AAE5E,MAAM,aAAa,CAAC,IAAI,CAAC,GAAG,gBAAgB,EAAE,GAAG,sBAAsB,CAAC;AACxE;AACA;;AAEA,EAAE,OAAO,aAAa;AACtB;;AAEA;AACA;AACA;AACO,MAAM,qBAAA,GAAwB,CAAC,MAAM,GAAe,EAAE,EAAE,OAAO,KAAgD;AACtH,EAAE,MAAM,UAAU,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,GAAG,MAAM,CAAC,OAAO,CAAA,GAAI,EAAE;AAC1E,EAAE,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;;AAExD,EAAE,OAAO;AACT,IAAI,GAAG,MAAM;AACb,IAAI,OAAO;AACX,GAAG;AACH;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"sourceMaps.js","sources":["../../../src/vite/sourceMaps.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport { sentryVitePlugin } from '@sentry/vite-plugin';\nimport type { Plugin, UserConfig } from 'vite';\nimport type { SentrySolidStartPluginOptions } from './types';\n\n/**\n * A Sentry plugin for adding the @sentry/vite-plugin to automatically upload source maps to Sentry.\n */\nexport function makeAddSentryVitePlugin(options: SentrySolidStartPluginOptions, viteConfig: UserConfig): Plugin[] {\n const { authToken, debug, org, project, sourceMapsUploadOptions } = options;\n\n let updatedFilesToDeleteAfterUpload: string[] | undefined = undefined;\n\n if (\n typeof sourceMapsUploadOptions?.filesToDeleteAfterUpload === 'undefined' &&\n typeof sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps?.filesToDeleteAfterUpload ===\n 'undefined' &&\n // Only if source maps were previously not set, we update the \"filesToDeleteAfterUpload\" (as we override the setting with \"hidden\")\n typeof viteConfig.build?.sourcemap === 'undefined'\n ) {\n // For .output, .vercel, .netlify etc.\n updatedFilesToDeleteAfterUpload = ['.*/**/*.map'];\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Automatically setting \\`sourceMapsUploadOptions.filesToDeleteAfterUpload: ${JSON.stringify(\n updatedFilesToDeleteAfterUpload,\n )}\\` to delete generated source maps after they were uploaded to Sentry.`,\n );\n });\n }\n\n return [\n ...sentryVitePlugin({\n authToken: authToken ?? process.env.SENTRY_AUTH_TOKEN,\n bundleSizeOptimizations: options.bundleSizeOptimizations,\n debug: debug ?? false,\n org: org ?? process.env.SENTRY_ORG,\n project: project ?? process.env.SENTRY_PROJECT,\n sourcemaps: {\n filesToDeleteAfterUpload:\n (sourceMapsUploadOptions?.filesToDeleteAfterUpload ||\n sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps?.filesToDeleteAfterUpload) ??\n updatedFilesToDeleteAfterUpload,\n ...sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps,\n },\n telemetry: sourceMapsUploadOptions?.telemetry ?? true,\n _metaOptions: {\n telemetry: {\n metaFramework: 'solidstart',\n },\n },\n ...sourceMapsUploadOptions?.unstable_sentryVitePluginOptions,\n }),\n ];\n}\n\n/**\n * A Sentry plugin for SolidStart to enable \"hidden\" source maps if they are unset.\n */\nexport function makeEnableSourceMapsVitePlugin(options: SentrySolidStartPluginOptions): Plugin[] {\n return [\n {\n name: 'sentry-solidstart-update-source-map-setting',\n apply: 'build',\n enforce: 'post',\n config(viteConfig) {\n return {\n ...viteConfig,\n build: {\n ...viteConfig.build,\n sourcemap: getUpdatedSourceMapSettings(viteConfig, options),\n },\n };\n },\n },\n ];\n}\n\n/** There are 3 ways to set up source map generation (https://github.com/getsentry/sentry-j avascript/issues/13993)\n *\n * 1. User explicitly disabled source maps\n * - keep this setting (emit a warning that errors won't be unminified in Sentry)\n * - We won't upload anything\n *\n * 2. Users enabled source map generation (true, 'hidden', 'inline').\n * - keep this setting (don't do anything - like deletion - besides uploading)\n *\n * 3. Users didn't set source maps generation\n * - we enable 'hidden' source maps generation\n * - configure `filesToDeleteAfterUpload` to delete all .map files (we emit a log about this)\n *\n * --> only exported for testing\n */\nexport function getUpdatedSourceMapSettings(\n viteConfig: UserConfig,\n sentryPluginOptions?: SentrySolidStartPluginOptions,\n): boolean | 'inline' | 'hidden' {\n viteConfig.build = viteConfig.build || {};\n\n const viteSourceMap = viteConfig?.build?.sourcemap;\n let updatedSourceMapSetting = viteSourceMap;\n\n const settingKey = 'vite.build.sourcemap';\n\n if (viteSourceMap === false) {\n updatedSourceMapSetting = viteSourceMap;\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] Source map generation is currently disabled in your SolidStart configuration (\\`${settingKey}: false \\`). This setting is either a default setting or was explicitly set in your configuration. Sentry won't override this setting. Without source maps, code snippets on the Sentry Issues page will remain minified. To show unminified code, enable source maps in \\`${settingKey}\\` (e.g. by setting them to \\`hidden\\`).`,\n );\n });\n } else if (viteSourceMap && ['hidden', 'inline', true].includes(viteSourceMap)) {\n updatedSourceMapSetting = viteSourceMap;\n\n if (sentryPluginOptions?.debug) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] We discovered \\`${settingKey}\\` is set to \\`${viteSourceMap.toString()}\\`. Sentry will keep this source map setting. This will un-minify the code snippet on the Sentry Issue page.`,\n );\n });\n }\n } else {\n updatedSourceMapSetting = 'hidden';\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Enabled source map generation in the build options with \\`${settingKey}: 'hidden'\\`. The source maps will be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A0B,aAAa;;AAE3C,IAAID,mBAAc,CAAC,MAAM;AACzB;AACA,MAAM,OAAO,CAAC,IAAI;AAClB,QAAQ,CAAC,yFAAyF,EAAE,UAAU,CAAC,2QAA2Q,EAAE,UAAU,CAAC,wCAAwC,CAAC;AAChb,OAAO;AACP,KAAK,CAAC;AACN,SAAS,IAAI,aAAc,IAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;AAClF,IAAI,uBAAA,GAA0B,aAAa;;AAE3C,IAAI,IAAI,mBAAmB,EAAE,KAAK,EAAE;AACpC,MAAMA,mBAAc,CAAC,MAAM;AAC3B;AACA,QAAQ,OAAO,CAAC,GAAG;AACnB,UAAU,CAAC,yBAAyB,EAAE,UAAU,CAAC,eAAe,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAC,4GAA4G,CAAC;AACxM,SAAS;AACT,OAAO,CAAC;AACR;AACA,SAAS;AACT,IAAI,uBAAA,GAA0B,QAAQ;;AAEtC,IAAIA,mBAAc,CAAC,MAAM;AACzB;AACA,MAAM,OAAO,CAAC,GAAG;AACjB,QAAQ,CAAC,mEAAmE,EAAE,UAAU,CAAC,kFAAkF,CAAC;AAC5K,OAAO;AACP,KAAK,CAAC;AACN;;AAEA,EAAE,OAAO,uBAAuB;AAChC;;;;;;"}
1
+ {"version":3,"file":"sourceMaps.js","sources":["../../../src/vite/sourceMaps.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport { sentryVitePlugin } from '@sentry/vite-plugin';\nimport type { Plugin, UserConfig } from 'vite';\nimport type { SentrySolidStartPluginOptions } from './types';\n\n/**\n * A Sentry plugin for adding the @sentry/vite-plugin to automatically upload source maps to Sentry.\n */\nexport function makeAddSentryVitePlugin(options: SentrySolidStartPluginOptions, viteConfig: UserConfig): Plugin[] {\n const { authToken, debug, org, project, sourceMapsUploadOptions } = options;\n\n let updatedFilesToDeleteAfterUpload: string[] | undefined = undefined;\n\n if (\n typeof sourceMapsUploadOptions?.filesToDeleteAfterUpload === 'undefined' &&\n typeof sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps?.filesToDeleteAfterUpload ===\n 'undefined' &&\n // Only if source maps were previously not set, we update the \"filesToDeleteAfterUpload\" (as we override the setting with \"hidden\")\n typeof viteConfig.build?.sourcemap === 'undefined'\n ) {\n // For .output, .vercel, .netlify etc.\n updatedFilesToDeleteAfterUpload = ['.*/**/*.map'];\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Automatically setting \\`sourceMapsUploadOptions.filesToDeleteAfterUpload: ${JSON.stringify(\n updatedFilesToDeleteAfterUpload,\n )}\\` to delete generated source maps after they were uploaded to Sentry.`,\n );\n });\n }\n\n return [\n ...sentryVitePlugin({\n authToken: authToken ?? process.env.SENTRY_AUTH_TOKEN,\n bundleSizeOptimizations: options.bundleSizeOptimizations,\n debug: debug ?? false,\n org: org ?? process.env.SENTRY_ORG,\n project: project ?? process.env.SENTRY_PROJECT,\n sourcemaps: {\n filesToDeleteAfterUpload:\n (sourceMapsUploadOptions?.filesToDeleteAfterUpload ||\n sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps?.filesToDeleteAfterUpload) ??\n updatedFilesToDeleteAfterUpload,\n ...sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps,\n },\n telemetry: sourceMapsUploadOptions?.telemetry ?? true,\n _metaOptions: {\n telemetry: {\n metaFramework: 'solidstart',\n },\n },\n ...sourceMapsUploadOptions?.unstable_sentryVitePluginOptions,\n }),\n ];\n}\n\n/**\n * A Sentry plugin for SolidStart to enable \"hidden\" source maps if they are unset.\n */\nexport function makeEnableSourceMapsVitePlugin(options: SentrySolidStartPluginOptions): Plugin[] {\n return [\n {\n name: 'sentry-solidstart-update-source-map-setting',\n apply: 'build',\n enforce: 'post',\n config(viteConfig) {\n return {\n ...viteConfig,\n build: {\n ...viteConfig.build,\n sourcemap: getUpdatedSourceMapSettings(viteConfig, options),\n },\n };\n },\n },\n ];\n}\n\n/** There are 3 ways to set up source map generation (https://github.com/getsentry/sentry-j avascript/issues/13993)\n *\n * 1. User explicitly disabled source maps\n * - keep this setting (emit a warning that errors won't be unminified in Sentry)\n * - We won't upload anything\n *\n * 2. Users enabled source map generation (true, 'hidden', 'inline').\n * - keep this setting (don't do anything - like deletion - besides uploading)\n *\n * 3. Users didn't set source maps generation\n * - we enable 'hidden' source maps generation\n * - configure `filesToDeleteAfterUpload` to delete all .map files (we emit a log about this)\n *\n * --> only exported for testing\n */\nexport function getUpdatedSourceMapSettings(\n viteConfig: UserConfig,\n sentryPluginOptions?: SentrySolidStartPluginOptions,\n): boolean | 'inline' | 'hidden' {\n viteConfig.build = viteConfig.build || {};\n\n const viteSourceMap = viteConfig?.build?.sourcemap;\n let updatedSourceMapSetting = viteSourceMap;\n\n const settingKey = 'vite.build.sourcemap';\n\n if (viteSourceMap === false) {\n updatedSourceMapSetting = viteSourceMap;\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] Source map generation is currently disabled in your SolidStart configuration (\\`${settingKey}: false \\`). This setting is either a default setting or was explicitly set in your configuration. Sentry won't override this setting. Without source maps, code snippets on the Sentry Issues page will remain minified. To show unminified code, enable source maps in \\`${settingKey}\\` (e.g. by setting them to \\`hidden\\`).`,\n );\n });\n } else if (viteSourceMap && ['hidden', 'inline', true].includes(viteSourceMap)) {\n updatedSourceMapSetting = viteSourceMap;\n\n if (sentryPluginOptions?.debug) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] We discovered \\`${settingKey}\\` is set to \\`${viteSourceMap.toString()}\\`. Sentry will keep this source map setting. This will un-minify the code snippet on the Sentry Issue page.`,\n );\n });\n }\n } else {\n updatedSourceMapSetting = 'hidden';\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Enabled source map generation in the build options with \\`${settingKey}: 'hidden'\\`. The source maps will be deleted after they were uploaded to Sentry.`,\n );\n });\n }\n\n return updatedSourceMapSetting;\n}\n"],"names":["consoleSandbox","sentryVitePlugin"],"mappings":";;;;;AAKA;AACA;AACA;AACO,SAAS,uBAAuB,CAAC,OAAO,EAAiC,UAAU,EAAwB;AAClH,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,uBAAA,EAAwB,GAAI,OAAO;;AAE7E,EAAE,IAAI,+BAA+B,GAAyB,SAAS;;AAEvE,EAAE;AACF,IAAI,OAAO,uBAAuB,EAAE,wBAAA,KAA6B,WAAA;AACjE,IAAI,OAAO,uBAAuB,EAAE,gCAAgC,EAAE,UAAU,EAAE,wBAAA;AAClF,MAAM,WAAA;AACN;AACA,IAAI,OAAO,UAAU,CAAC,KAAK,EAAE,cAAc;AAC3C,IAAI;AACJ;AACA,IAAI,+BAAA,GAAkC,CAAC,aAAa,CAAC;;AAErD,IAAIA,mBAAc,CAAC,MAAM;AACzB;AACA,MAAM,OAAO,CAAC,GAAG;AACjB,QAAQ,CAAC,mFAAmF,EAAE,IAAI,CAAC,SAAS;AAC5G,UAAU,+BAA+B;AACzC,SAAS,CAAC,sEAAsE,CAAC;AACjF,OAAO;AACP,KAAK,CAAC;AACN;;AAEA,EAAE,OAAO;AACT,IAAI,GAAGC,2BAAgB,CAAC;AACxB,MAAM,SAAS,EAAE,SAAA,IAAa,OAAO,CAAC,GAAG,CAAC,iBAAiB;AAC3D,MAAM,uBAAuB,EAAE,OAAO,CAAC,uBAAuB;AAC9D,MAAM,KAAK,EAAE,KAAA,IAAS,KAAK;AAC3B,MAAM,GAAG,EAAE,GAAA,IAAO,OAAO,CAAC,GAAG,CAAC,UAAU;AACxC,MAAM,OAAO,EAAE,OAAA,IAAW,OAAO,CAAC,GAAG,CAAC,cAAc;AACpD,MAAM,UAAU,EAAE;AAClB,QAAQ,wBAAwB;AAChC,UAAU,CAAC,uBAAuB,EAAE,wBAAA;AACpC,Y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AAA,GAA0B,aAAa;;AAE3C,IAAID,mBAAc,CAAC,MAAM;AACzB;AACA,MAAM,OAAO,CAAC,IAAI;AAClB,QAAQ,CAAC,yFAAyF,EAAE,UAAU,CAAC,2QAA2Q,EAAE,UAAU,CAAC,wCAAwC,CAAC;AAChb,OAAO;AACP,KAAK,CAAC;AACN,SAAS,IAAI,aAAA,IAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;AAClF,IAAI,uBAAA,GAA0B,aAAa;;AAE3C,IAAI,IAAI,mBAAmB,EAAE,KAAK,EAAE;AACpC,MAAMA,mBAAc,CAAC,MAAM;AAC3B;AACA,QAAQ,OAAO,CAAC,GAAG;AACnB,UAAU,CAAC,yBAAyB,EAAE,UAAU,CAAC,eAAe,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAC,4GAA4G,CAAC;AACxM,SAAS;AACT,OAAO,CAAC;AACR;AACA,SAAS;AACT,IAAI,uBAAA,GAA0B,QAAQ;;AAEtC,IAAIA,mBAAc,CAAC,MAAM;AACzB;AACA,MAAM,OAAO,CAAC,GAAG;AACjB,QAAQ,CAAC,mEAAmE,EAAE,UAAU,CAAC,kFAAkF,CAAC;AAC5K,OAAO;AACP,KAAK,CAAC;AACN;;AAEA,EAAE,OAAO,uBAAuB;AAChC;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sources":["../../../src/client/sdk.ts"],"sourcesContent":["import type { Client, Integration } from '@sentry/core';\nimport { applySdkMetadata } from '@sentry/core';\nimport type { BrowserOptions } from '@sentry/solid';\nimport {\n browserTracingIntegration,\n getDefaultIntegrations as getDefaultSolidIntegrations,\n init as initSolidSDK,\n} from '@sentry/solid';\n\n// Treeshakable guard to remove all code related to tracing\ndeclare const __SENTRY_TRACING__: boolean;\n\n/**\n * Initializes the client side of the Solid Start SDK.\n */\nexport function init(options: BrowserOptions): Client | undefined {\n const opts = {\n defaultIntegrations: getDefaultIntegrations(options),\n ...options,\n };\n\n applySdkMetadata(opts, 'solidstart', ['solidstart', 'solid']);\n\n return initSolidSDK(opts);\n}\n\nfunction getDefaultIntegrations(options: BrowserOptions): Integration[] {\n const integrations = getDefaultSolidIntegrations(options);\n\n // This evaluates to true unless __SENTRY_TRACING__ is text-replaced with \"false\",\n // in which case everything inside will get tree-shaken away\n if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {\n // We add the default BrowserTracingIntegration here always.\n // We can do this, even if `solidRouterBrowserTracingIntegration` is\n // supplied as integration in `init` by users because it will win\n // over the default integration by virtue of having the same\n // `BrowserTracing` integration name and being added later.\n integrations.push(browserTracingIntegration());\n }\n\n return integrations;\n}\n"],"names":["initSolidSDK","getDefaultSolidIntegrations"],"mappings":";;;AASA;;AAGA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAsC;AAClE,EAAE,MAAM,OAAO;AACf,IAAI,mBAAmB,EAAE,sBAAsB,CAAC,OAAO,CAAC;AACxD,IAAI,GAAG,OAAO;AACd,GAAG;;AAEH,EAAE,gBAAgB,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;;AAE/D,EAAE,OAAOA,MAAY,CAAC,IAAI,CAAC;AAC3B;;AAEA,SAAS,sBAAsB,CAAC,OAAO,EAAiC;AACxE,EAAE,MAAM,YAAa,GAAEC,wBAA2B,CAAC,OAAO,CAAC;;AAE3D;AACA;AACA,EAAE,IAAI,OAAO,kBAAA,KAAuB,WAAY,IAAG,kBAAkB,EAAE;AACvE;AACA;AACA;AACA;AACA;AACA,IAAI,YAAY,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC;AAClD;;AAEA,EAAE,OAAO,YAAY;AACrB;;;;"}
1
+ {"version":3,"file":"sdk.js","sources":["../../../src/client/sdk.ts"],"sourcesContent":["import type { Client, Integration } from '@sentry/core';\nimport { applySdkMetadata } from '@sentry/core';\nimport type { BrowserOptions } from '@sentry/solid';\nimport {\n browserTracingIntegration,\n getDefaultIntegrations as getDefaultSolidIntegrations,\n init as initSolidSDK,\n} from '@sentry/solid';\n\n// Treeshakable guard to remove all code related to tracing\ndeclare const __SENTRY_TRACING__: boolean;\n\n/**\n * Initializes the client side of the Solid Start SDK.\n */\nexport function init(options: BrowserOptions): Client | undefined {\n const opts = {\n defaultIntegrations: getDefaultIntegrations(options),\n ...options,\n };\n\n applySdkMetadata(opts, 'solidstart', ['solidstart', 'solid']);\n\n return initSolidSDK(opts);\n}\n\nfunction getDefaultIntegrations(options: BrowserOptions): Integration[] {\n const integrations = getDefaultSolidIntegrations(options);\n\n // This evaluates to true unless __SENTRY_TRACING__ is text-replaced with \"false\",\n // in which case everything inside will get tree-shaken away\n if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {\n // We add the default BrowserTracingIntegration here always.\n // We can do this, even if `solidRouterBrowserTracingIntegration` is\n // supplied as integration in `init` by users because it will win\n // over the default integration by virtue of having the same\n // `BrowserTracing` integration name and being added later.\n integrations.push(browserTracingIntegration());\n }\n\n return integrations;\n}\n"],"names":["initSolidSDK","getDefaultSolidIntegrations"],"mappings":";;;AASA;;AAGA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAsC;AAClE,EAAE,MAAM,OAAO;AACf,IAAI,mBAAmB,EAAE,sBAAsB,CAAC,OAAO,CAAC;AACxD,IAAI,GAAG,OAAO;AACd,GAAG;;AAEH,EAAE,gBAAgB,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;;AAE/D,EAAE,OAAOA,MAAY,CAAC,IAAI,CAAC;AAC3B;;AAEA,SAAS,sBAAsB,CAAC,OAAO,EAAiC;AACxE,EAAE,MAAM,YAAA,GAAeC,wBAA2B,CAAC,OAAO,CAAC;;AAE3D;AACA;AACA,EAAE,IAAI,OAAO,kBAAA,KAAuB,WAAA,IAAe,kBAAkB,EAAE;AACvE;AACA;AACA;AACA;AACA;AACA,IAAI,YAAY,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC;AAClD;;AAEA,EAAE,OAAO,YAAY;AACrB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"debug-build.js","sources":["../../../src/common/debug-build.ts"],"sourcesContent":["declare const __DEBUG_BUILD__: boolean;\n\n/**\n * 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.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nexport const DEBUG_BUILD = __DEBUG_BUILD__;\n"],"names":[],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACO,MAAM,WAAY,IAAiB,OAAA,gBAAA,KAAA,WAAA,IAAA,gBAAA;;;;"}
1
+ {"version":3,"file":"debug-build.js","sources":["../../../src/common/debug-build.ts"],"sourcesContent":["declare const __DEBUG_BUILD__: boolean;\n\n/**\n * 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.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nexport const DEBUG_BUILD = __DEBUG_BUILD__;\n"],"names":[],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACO,MAAM,WAAA,IAAc,OAAA,gBAAA,KAAA,WAAA,IAAA,gBAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"addInstrumentation.js","sources":["../../../src/config/addInstrumentation.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport * as fs from 'fs';\nimport type { Nitro } from 'nitropack';\nimport * as path from 'path';\nimport type { SentrySolidStartPluginOptions } from '../vite/types';\nimport type { RollupConfig } from './types';\nimport { wrapServerEntryWithDynamicImport } from './wrapServerEntryWithDynamicImport';\n\n// Nitro presets for hosts that only host static files\nexport const staticHostPresets = ['github_pages'];\n// Nitro presets for hosts that use `server.mjs` as opposed to `index.mjs`\nexport const serverFilePresets = ['netlify'];\n\n/**\n * Adds the built `instrument.server.js` file to the output directory.\n *\n * As Sentry also imports the release injection file, this needs to be copied over manually as well.\n * TODO: The mechanism of manually copying those files could maybe be improved\n *\n * This will no-op if no `instrument.server.js` file was found in the\n * build directory.\n */\nexport async function addInstrumentationFileToBuild(nitro: Nitro): Promise<void> {\n nitro.hooks.hook('close', async () => {\n // Static file hosts have no server component so there's nothing to do\n if (staticHostPresets.includes(nitro.options.preset)) {\n return;\n }\n\n const buildDir = nitro.options.buildDir;\n const serverDir = nitro.options.output.serverDir;\n\n try {\n // 1. Create assets directory first (for release-injection-file)\n const assetsServerDir = path.join(serverDir, 'assets');\n if (!fs.existsSync(assetsServerDir)) {\n await fs.promises.mkdir(assetsServerDir, { recursive: true });\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(`[Sentry SolidStart withSentry] Successfully created directory ${assetsServerDir}.`);\n });\n }\n\n // 2. Copy release injection file if available\n try {\n const ssrAssetsPath = path.resolve(buildDir, 'build', 'ssr', 'assets');\n const assetsBuildDir = await fs.promises.readdir(ssrAssetsPath);\n const releaseInjectionFile = assetsBuildDir.find(file =>\n /^_sentry-release-injection-file-.*\\.(js|mjs)$/.test(file),\n );\n\n if (releaseInjectionFile) {\n const releaseSource = path.resolve(ssrAssetsPath, releaseInjectionFile);\n const releaseDestination = path.resolve(assetsServerDir, releaseInjectionFile);\n\n await fs.promises.copyFile(releaseSource, releaseDestination);\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(`[Sentry SolidStart withSentry] Successfully created ${releaseDestination}.`);\n });\n }\n } catch (err) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn('[Sentry SolidStart withSentry] Failed to copy release injection file.', err);\n });\n }\n\n // 3. Copy Sentry server instrumentation file\n const instrumentSource = path.resolve(buildDir, 'build', 'ssr', 'instrument.server.js');\n const instrumentDestination = path.resolve(serverDir, 'instrument.server.mjs');\n\n await fs.promises.copyFile(instrumentSource, instrumentDestination);\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(`[Sentry SolidStart withSentry] Successfully created ${instrumentDestination}.`);\n });\n } catch (error) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn('[Sentry SolidStart withSentry] Failed to add instrumentation file to build.', error);\n });\n }\n });\n}\n\n/**\n * Adds an `instrument.server.mjs` import to the top of the server entry file.\n *\n * This is meant as an escape hatch and should only be used in environments where\n * it's not possible to `--import` the file instead as it comes with a limited\n * tracing experience, only collecting http traces.\n */\nexport async function addSentryTopImport(nitro: Nitro): Promise<void> {\n nitro.hooks.hook('close', async () => {\n const buildPreset = nitro.options.preset;\n const serverDir = nitro.options.output.serverDir;\n\n // Static file hosts have no server component so there's nothing to do\n if (staticHostPresets.includes(buildPreset)) {\n return;\n }\n\n const instrumentationFile = path.resolve(serverDir, 'instrument.server.mjs');\n const serverEntryFileName = serverFilePresets.includes(buildPreset) ? 'server.mjs' : 'index.mjs';\n const serverEntryFile = path.resolve(serverDir, serverEntryFileName);\n\n try {\n await fs.promises.access(instrumentationFile, fs.constants.F_OK);\n } catch (error) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry SolidStart withSentry] Failed to add \\`${instrumentationFile}\\` as top level import to \\`${serverEntryFile}\\`.`,\n error,\n );\n });\n return;\n }\n\n try {\n const content = await fs.promises.readFile(serverEntryFile, 'utf-8');\n const updatedContent = `import './instrument.server.mjs';\\n${content}`;\n await fs.promises.writeFile(serverEntryFile, updatedContent);\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry SolidStart withSentry] Added \\`${instrumentationFile}\\` as top level import to \\`${serverEntryFile}\\`.`,\n );\n });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry SolidStart withSentry] An error occurred when trying to add \\`${instrumentationFile}\\` as top level import to \\`${serverEntryFile}\\`.`,\n error,\n );\n }\n });\n}\n\n/**\n * This function modifies the Rollup configuration to include a plugin that wraps the entry file with a dynamic import (`import()`)\n * and adds the Sentry server config with the static `import` declaration.\n *\n * With this, the Sentry server config can be loaded before all other modules of the application (which is needed for import-in-the-middle).\n * See: https://nodejs.org/api/module.html#enabling\n */\nexport async function addDynamicImportEntryFileWrapper({\n nitro,\n rollupConfig,\n sentryPluginOptions,\n}: {\n nitro: Nitro;\n rollupConfig: RollupConfig;\n sentryPluginOptions: Omit<SentrySolidStartPluginOptions, 'experimental_entrypointWrappedFunctions'> &\n Required<Pick<SentrySolidStartPluginOptions, 'experimental_entrypointWrappedFunctions'>>;\n}): Promise<void> {\n // Static file hosts have no server component so there's nothing to do\n if (staticHostPresets.includes(nitro.options.preset)) {\n return;\n }\n\n const srcDir = nitro.options.srcDir;\n // todo allow other instrumentation paths\n const serverInstrumentationPath = path.resolve(srcDir, 'src', 'instrument.server.ts');\n\n const instrumentationFileName = sentryPluginOptions.instrumentation\n ? path.basename(sentryPluginOptions.instrumentation)\n : '';\n\n rollupConfig.plugins.push(\n wrapServerEntryWithDynamicImport({\n serverConfigFileName: sentryPluginOptions.instrumentation\n ? path.join(path.dirname(instrumentationFileName), path.parse(instrumentationFileName).name)\n : 'instrument.server',\n serverEntrypointFileName: sentryPluginOptions.serverEntrypointFileName || nitro.options.preset,\n resolvedServerConfigPath: serverInstrumentationPath,\n entrypointWrappedFunctions: sentryPluginOptions.experimental_entrypointWrappedFunctions,\n additionalImports: ['import-in-the-middle/hook.mjs'],\n debug: sentryPluginOptions.debug,\n }),\n );\n}\n"],"names":[],"mappings":";;;;;AAQA;AACa,MAAA,iBAAA,GAAoB,CAAC,cAAc;AAChD;AACa,MAAA,iBAAA,GAAoB,CAAC,SAAS;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAe,6BAA6B,CAAC,KAAK,EAAwB;AACjF,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY;AACxC;AACA,IAAI,IAAI,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CA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AA,EAAA,eAAA,CAAA,GAAA,CAAA;AACA,QAAA,KAAA;AACA,OAAA;AACA;AACA,GAAA,CAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAA,gCAAA,CAAA;AACA,EAAA,KAAA;AACA,EAAA,YAAA;AACA,EAAA,mBAAA;AACA;;AAKA,EAAA;AACA;AACA,EAAA,IAAA,iBAAA,CAAA,QAAA,CAAA,KAAA,CAAA,OAAA,CAAA,MAAA,CAAA,EAAA;AACA,IAAA;AACA;;AAEA,EAAA,MAAA,MAAA,GAAA,KAAA,CAAA,OAAA,CAAA,MAAA;AACA;AACA,EAAA,MAAA,yBAAA,GAAA,IAAA,CAAA,OAAA,CAAA,MAAA,EAAA,KAAA,EAAA,sBAAA,CAAA;;AAEA,EAAA,MAAA,uBAAA,GAAA,mBAAA,CAAA;AACA,MAAA,IAAA,CAAA,QAAA,CAAA,mBAAA,CAAA,eAAA;AACA,MAAA,EAAA;;AAEA,EAAA,YAAA,CAAA,OAAA,CAAA,IAAA;AACA,IAAA,gCAAA,CAAA;AACA,MAAA,oBAAA,EAAA,mBAAA,CAAA;AACA,UAAA,IAAA,CAAA,IAAA,CAAA,IAAA,CAAA,OAAA,CAAA,uBAAA,CAAA,EAAA,IAAA,CAAA,KAAA,CAAA,uBAAA,CAAA,CAAA,IAAA;AACA,UAAA,mBAAA;AACA,MAAA,wBAAA,EAAA,mBAAA,CAAA,wBAAA,IAAA,KAAA,CAAA,OAAA,CAAA,MAAA;AACA,MAAA,wBAAA,EAAA,yBAAA;AACA,MAAA,0BAAA,EAAA,mBAAA,CAAA,uCAAA;AACA,MAAA,iBAAA,EAAA,CAAA,+BAAA,CAAA;AACA,MAAA,KAAA,EAAA,mBAAA,CAAA,KAAA;AACA,KAAA,CAAA;AACA,GAAA;AACA;;;;"}
1
+ {"version":3,"file":"addInstrumentation.js","sources":["../../../src/config/addInstrumentation.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport * as fs from 'fs';\nimport type { Nitro } from 'nitropack';\nimport * as path from 'path';\nimport type { SentrySolidStartPluginOptions } from '../vite/types';\nimport type { RollupConfig } from './types';\nimport { wrapServerEntryWithDynamicImport } from './wrapServerEntryWithDynamicImport';\n\n// Nitro presets for hosts that only host static files\nexport const staticHostPresets = ['github_pages'];\n// Nitro presets for hosts that use `server.mjs` as opposed to `index.mjs`\nexport const serverFilePresets = ['netlify'];\n\n/**\n * Adds the built `instrument.server.js` file to the output directory.\n *\n * As Sentry also imports the release injection file, this needs to be copied over manually as well.\n * TODO: The mechanism of manually copying those files could maybe be improved\n *\n * This will no-op if no `instrument.server.js` file was found in the\n * build directory.\n */\nexport async function addInstrumentationFileToBuild(nitro: Nitro): Promise<void> {\n nitro.hooks.hook('close', async () => {\n // Static file hosts have no server component so there's nothing to do\n if (staticHostPresets.includes(nitro.options.preset)) {\n return;\n }\n\n const buildDir = nitro.options.buildDir;\n const serverDir = nitro.options.output.serverDir;\n\n try {\n // 1. Create assets directory first (for release-injection-file)\n const assetsServerDir = path.join(serverDir, 'assets');\n if (!fs.existsSync(assetsServerDir)) {\n await fs.promises.mkdir(assetsServerDir, { recursive: true });\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(`[Sentry SolidStart withSentry] Successfully created directory ${assetsServerDir}.`);\n });\n }\n\n // 2. Copy release injection file if available\n try {\n const ssrAssetsPath = path.resolve(buildDir, 'build', 'ssr', 'assets');\n const assetsBuildDir = await fs.promises.readdir(ssrAssetsPath);\n const releaseInjectionFile = assetsBuildDir.find(file =>\n /^_sentry-release-injection-file-.*\\.(js|mjs)$/.test(file),\n );\n\n if (releaseInjectionFile) {\n const releaseSource = path.resolve(ssrAssetsPath, releaseInjectionFile);\n const releaseDestination = path.resolve(assetsServerDir, releaseInjectionFile);\n\n await fs.promises.copyFile(releaseSource, releaseDestination);\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(`[Sentry SolidStart withSentry] Successfully created ${releaseDestination}.`);\n });\n }\n } catch (err) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn('[Sentry SolidStart withSentry] Failed to copy release injection file.', err);\n });\n }\n\n // 3. Copy Sentry server instrumentation file\n const instrumentSource = path.resolve(buildDir, 'build', 'ssr', 'instrument.server.js');\n const instrumentDestination = path.resolve(serverDir, 'instrument.server.mjs');\n\n await fs.promises.copyFile(instrumentSource, instrumentDestination);\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(`[Sentry SolidStart withSentry] Successfully created ${instrumentDestination}.`);\n });\n } catch (error) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn('[Sentry SolidStart withSentry] Failed to add instrumentation file to build.', error);\n });\n }\n });\n}\n\n/**\n * Adds an `instrument.server.mjs` import to the top of the server entry file.\n *\n * This is meant as an escape hatch and should only be used in environments where\n * it's not possible to `--import` the file instead as it comes with a limited\n * tracing experience, only collecting http traces.\n */\nexport async function addSentryTopImport(nitro: Nitro): Promise<void> {\n nitro.hooks.hook('close', async () => {\n const buildPreset = nitro.options.preset;\n const serverDir = nitro.options.output.serverDir;\n\n // Static file hosts have no server component so there's nothing to do\n if (staticHostPresets.includes(buildPreset)) {\n return;\n }\n\n const instrumentationFile = path.resolve(serverDir, 'instrument.server.mjs');\n const serverEntryFileName = serverFilePresets.includes(buildPreset) ? 'server.mjs' : 'index.mjs';\n const serverEntryFile = path.resolve(serverDir, serverEntryFileName);\n\n try {\n await fs.promises.access(instrumentationFile, fs.constants.F_OK);\n } catch (error) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry SolidStart withSentry] Failed to add \\`${instrumentationFile}\\` as top level import to \\`${serverEntryFile}\\`.`,\n error,\n );\n });\n return;\n }\n\n try {\n const content = await fs.promises.readFile(serverEntryFile, 'utf-8');\n const updatedContent = `import './instrument.server.mjs';\\n${content}`;\n await fs.promises.writeFile(serverEntryFile, updatedContent);\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry SolidStart withSentry] Added \\`${instrumentationFile}\\` as top level import to \\`${serverEntryFile}\\`.`,\n );\n });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry SolidStart withSentry] An error occurred when trying to add \\`${instrumentationFile}\\` as top level import to \\`${serverEntryFile}\\`.`,\n error,\n );\n }\n });\n}\n\n/**\n * This function modifies the Rollup configuration to include a plugin that wraps the entry file with a dynamic import (`import()`)\n * and adds the Sentry server config with the static `import` declaration.\n *\n * With this, the Sentry server config can be loaded before all other modules of the application (which is needed for import-in-the-middle).\n * See: https://nodejs.org/api/module.html#enabling\n */\nexport async function addDynamicImportEntryFileWrapper({\n nitro,\n rollupConfig,\n sentryPluginOptions,\n}: {\n nitro: Nitro;\n rollupConfig: RollupConfig;\n sentryPluginOptions: Omit<SentrySolidStartPluginOptions, 'experimental_entrypointWrappedFunctions'> &\n Required<Pick<SentrySolidStartPluginOptions, 'experimental_entrypointWrappedFunctions'>>;\n}): Promise<void> {\n // Static file hosts have no server component so there's nothing to do\n if (staticHostPresets.includes(nitro.options.preset)) {\n return;\n }\n\n const srcDir = nitro.options.srcDir;\n // todo allow other instrumentation paths\n const serverInstrumentationPath = path.resolve(srcDir, 'src', 'instrument.server.ts');\n\n const instrumentationFileName = sentryPluginOptions.instrumentation\n ? path.basename(sentryPluginOptions.instrumentation)\n : '';\n\n rollupConfig.plugins.push(\n wrapServerEntryWithDynamicImport({\n serverConfigFileName: sentryPluginOptions.instrumentation\n ? path.join(path.dirname(instrumentationFileName), path.parse(instrumentationFileName).name)\n : 'instrument.server',\n serverEntrypointFileName: sentryPluginOptions.serverEntrypointFileName || nitro.options.preset,\n resolvedServerConfigPath: serverInstrumentationPath,\n entrypointWrappedFunctions: sentryPluginOptions.experimental_entrypointWrappedFunctions,\n additionalImports: ['import-in-the-middle/hook.mjs'],\n debug: sentryPluginOptions.debug,\n }),\n );\n}\n"],"names":[],"mappings":";;;;;AAQA;AACO,MAAM,iBAAA,GAAoB,CAAC,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AAA,EAAA,mBAAA,CAAA,uCAAA;AACA,MAAA,iBAAA,EAAA,CAAA,+BAAA,CAAA;AACA,MAAA,KAAA,EAAA,mBAAA,CAAA,KAAA;AACA,KAAA,CAAA;AACA,GAAA;AACA;;;;"}
@@ -28,10 +28,11 @@ function withSentry(
28
28
 
29
29
  const server = (solidStartConfig.server || {}) ;
30
30
  const hooks = server.hooks || {};
31
+ const viteConfig = solidStartConfig.vite;
31
32
  const vite =
32
- typeof solidStartConfig.vite === 'function'
33
- ? (...args) => addSentryPluginToVite(solidStartConfig.vite(...args), sentryPluginOptions)
34
- : addSentryPluginToVite(solidStartConfig.vite, sentryPluginOptions);
33
+ typeof viteConfig === 'function'
34
+ ? (...args) => addSentryPluginToVite(viteConfig(...args), sentryPluginOptions)
35
+ : addSentryPluginToVite(viteConfig, sentryPluginOptions);
35
36
 
36
37
  return {
37
38
  ...solidStartConfig,
@@ -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/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":[],"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;AAC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../../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 viteConfig = solidStartConfig.vite;\n const vite =\n typeof viteConfig === 'function'\n ? (...args: Parameters<typeof viteConfig>) => addSentryPluginToVite(viteConfig(...args), sentryPluginOptions)\n : addSentryPluginToVite(viteConfig, 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":[],"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,MAAA,IAAU,gBAAgB,CAAC,MAAA,IAAU,EAAE,CAAA;AAC/C,EAAE,MAAM,QAAQ,MAAM,CAAC,KAAA,IAAS,EAAE;AAClC,EAAE,MAAM,UAAA,GAAa,gBAAgB,CAAC,IAAI;AAC1C,EAAE,MAAM,IAAA;AACR,IAAI,OAAO,eAAe;AAC1B,QAAQ,CAAC,GAAG,IAAI,KAAoC,qBAAqB,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,EAAE,mBAAmB;AAClH,QAAQ,qBAAqB,CAAC,UAAU,EAAE,mBAAmB,CAAC;;AAE9D,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,sBAAA,KAA2B,6BAA6B,EAAE;AACvG,YAAY,MAAM,gCAAgC,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,mBAAA,EAAqB,CAAC;;AAExG,YAAY,6BAA6B,CAAC,KAAA;AAC1C,cAAc,MAAM,CAAC,GAAG;AACxB,gBAAgB,qHAAqH;AACrI,eAAe;AACf,iBAAiB;AACjB,YAAY,MAAM,6BAA6B,CAAC,KAAK,CAAC;;AAEtD,YAAY,IAAI,6BAA6B,EAAE,sBAAA,KAA2B,kBAAkB,EAAE;AAC9F,cAAc,MAAM,kBAAkB,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 +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?.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":[],"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,MAAA,CAAA;AACA,QAAA,CAAA,MAAA,CAAA,QAAA,CAAA,CAAA,IAAA,EAAA,oBAAA,CAAA,CAAA;AACA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A;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":[],"mappings":";;AAGA;;AAEO,MAAM,oBAAA,GAAuB;AAC7B,MAAM,wBAAA,GAA2B;AACjC,MAAM,2BAAA,GAA8B;AACpC,MAAM,mBAAA,GAAsB;;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,kBAAA,GAAqB,OAAO;;AAEpC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE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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 +1 @@
1
- {"type":"module","version":"9.36.0"}
1
+ {"type":"module","version":"9.37.0"}
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.js","sources":["../../../src/server/middleware.ts"],"sourcesContent":["import { addNonEnumerableProperty, getTraceMetaTags } 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":[],"mappings":";;AAQA,SAAS,gBAAgB,CAAC,IAAI,EAAkB;AAChD,EAAE,MAAM,QAAA,GAAW,gBAAgB,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,IAAI,wBAAwB,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
+ {"version":3,"file":"middleware.js","sources":["../../../src/server/middleware.ts"],"sourcesContent":["import { addNonEnumerableProperty, getTraceMetaTags } 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":[],"mappings":";;AAQA,SAAS,gBAAgB,CAAC,IAAI,EAAkB;AAChD,EAAE,MAAM,QAAA,GAAW,gBAAgB,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,IAAI,wBAAwB,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,IAAA;AAC1B,IAAI,MAAM,OAAA,GAAU,IAAI,WAAW,EAAE;AACrC,IAAI,QAAQ,CAAC,IAAA,GAAO,IAAI,cAAc,CAAC;AACvC,MAAM,KAAK,EAAE,MAAM,UAAA,IAAc;AACjC,QAAQ,WAAW,MAAM,KAAA,IAAS,IAAI,EAAE;AACxC,UAAU,MAAM,OAAO,OAAO,UAAU,QAAA,GAAW,KAAA,GAAQ,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAA,EAAM,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 +1 @@
1
- {"version":3,"file":"solidrouter.js","sources":["../../../src/server/solidrouter.ts"],"sourcesContent":["import type { HashRouter, MemoryRouter, Router as BaseRouter, RouteSectionProps, StaticRouter } from '@solidjs/router';\nimport type { Component, JSX, ParentProps } from 'solid-js';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { mergeProps, splitProps } from 'solid-js';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { createComponent } from 'solid-js/web';\n\n// We use @sentry/solid/solidrouter on the client.\n// On the server, we have to create matching components\n// in structure to avoid hydration errors.\n\n/** Pass-through component in case user didn't specify a root **/\nfunction SentryDefaultRoot(props: ParentProps): JSX.Element {\n return props.children;\n}\n\n/**\n * On the client, router hooks are used in the router's root render prop.\n * This creates a matching structure that's purely pass-through to avoid hydration errors.\n */\nfunction withSentryRouterRoot(Root: Component<RouteSectionProps>): Component<RouteSectionProps> {\n const SentryRouterRoot = (props: RouteSectionProps): JSX.Element => {\n return createComponent(Root, props);\n };\n\n return SentryRouterRoot;\n}\n\nexport type RouterType = typeof BaseRouter | typeof HashRouter | typeof MemoryRouter | typeof StaticRouter;\n\n/**\n * On the client, router hooks are used to start navigation spans.\n * This creates a matching structure that's purely pass-through to avoid hydration errors.\n */\nexport function withSentryRouterRouting(Router: RouterType): RouterType {\n const SentryRouter = (props: Parameters<RouterType>[0]): JSX.Element => {\n const [local, others] = splitProps(props, ['root']);\n // We need to wrap root here in case the user passed in their own root\n const Root = withSentryRouterRoot(local.root ? local.root : SentryDefaultRoot);\n\n return createComponent(Router, mergeProps({ root: Root }, others));\n };\n\n return SentryRouter;\n}\n"],"names":[],"mappings":";;;AAOA;AACA;AACA;;AAEA;AACA,SAAS,iBAAiB,CAAC,KAAK,EAA4B;AAC5D,EAAE,OAAO,KAAK,CAAC,QAAQ;AACvB;;AAEA;AACA;AACA;AACA;AACA,SAAS,oBAAoB,CAAC,IAAI,EAA8D;AAChG,EAAE,MAAM,gBAAA,GAAmB,CAAC,KAAK,KAAqC;AACtE,IAAI,OAAO,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC;AACvC,GAAG;;AAEH,EAAE,OAAO,gBAAgB;AACzB;;AAIA;AACA;AACA;AACA;AACO,SAAS,uBAAuB,CAAC,MAAM,EAA0B;AACxE,EAAE,MAAM,YAAA,GAAe,CAAC,KAAK,KAA6C;AAC1E,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,CAAE,GAAE,UAAU,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC;AACvD;AACA,IAAI,MAAM,IAAA,GAAO,oBAAoB,CAAC,KAAK,CAAC,IAAK,GAAE,KAAK,CAAC,IAAK,GAAE,iBAAiB,CAAC;;AAElF,IAAI,OAAO,eAAe,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,IAAI,EAAE,IAAK,EAAC,EAAE,MAAM,CAAC,CAAC;AACtE,GAAG;;AAEH,EAAE,OAAO,YAAY;AACrB;;;;"}
1
+ {"version":3,"file":"solidrouter.js","sources":["../../../src/server/solidrouter.ts"],"sourcesContent":["import type { HashRouter, MemoryRouter, Router as BaseRouter, RouteSectionProps, StaticRouter } from '@solidjs/router';\nimport type { Component, JSX, ParentProps } from 'solid-js';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { mergeProps, splitProps } from 'solid-js';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { createComponent } from 'solid-js/web';\n\n// We use @sentry/solid/solidrouter on the client.\n// On the server, we have to create matching components\n// in structure to avoid hydration errors.\n\n/** Pass-through component in case user didn't specify a root **/\nfunction SentryDefaultRoot(props: ParentProps): JSX.Element {\n return props.children;\n}\n\n/**\n * On the client, router hooks are used in the router's root render prop.\n * This creates a matching structure that's purely pass-through to avoid hydration errors.\n */\nfunction withSentryRouterRoot(Root: Component<RouteSectionProps>): Component<RouteSectionProps> {\n const SentryRouterRoot = (props: RouteSectionProps): JSX.Element => {\n return createComponent(Root, props);\n };\n\n return SentryRouterRoot;\n}\n\nexport type RouterType = typeof BaseRouter | typeof HashRouter | typeof MemoryRouter | typeof StaticRouter;\n\n/**\n * On the client, router hooks are used to start navigation spans.\n * This creates a matching structure that's purely pass-through to avoid hydration errors.\n */\nexport function withSentryRouterRouting(Router: RouterType): RouterType {\n const SentryRouter = (props: Parameters<RouterType>[0]): JSX.Element => {\n const [local, others] = splitProps(props, ['root']);\n // We need to wrap root here in case the user passed in their own root\n const Root = withSentryRouterRoot(local.root ? local.root : SentryDefaultRoot);\n\n return createComponent(Router, mergeProps({ root: Root }, others));\n };\n\n return SentryRouter;\n}\n"],"names":[],"mappings":";;;AAOA;AACA;AACA;;AAEA;AACA,SAAS,iBAAiB,CAAC,KAAK,EAA4B;AAC5D,EAAE,OAAO,KAAK,CAAC,QAAQ;AACvB;;AAEA;AACA;AACA;AACA;AACA,SAAS,oBAAoB,CAAC,IAAI,EAA8D;AAChG,EAAE,MAAM,gBAAA,GAAmB,CAAC,KAAK,KAAqC;AACtE,IAAI,OAAO,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC;AACvC,GAAG;;AAEH,EAAE,OAAO,gBAAgB;AACzB;;AAIA;AACA;AACA;AACA;AACO,SAAS,uBAAuB,CAAC,MAAM,EAA0B;AACxE,EAAE,MAAM,YAAA,GAAe,CAAC,KAAK,KAA6C;AAC1E,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,CAAA,GAAI,UAAU,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC;AACvD;AACA,IAAI,MAAM,IAAA,GAAO,oBAAoB,CAAC,KAAK,CAAC,IAAA,GAAO,KAAK,CAAC,IAAA,GAAO,iBAAiB,CAAC;;AAElF,IAAI,OAAO,eAAe,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,IAAI,EAAE,IAAA,EAAM,EAAE,MAAM,CAAC,CAAC;AACtE,GAAG;;AAEH,EAAE,OAAO,YAAY;AACrB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../src/server/utils.ts"],"sourcesContent":["import type { EventProcessor, Options } from '@sentry/core';\nimport { logger } from '@sentry/core';\nimport { flush, getGlobalScope } from '@sentry/node';\nimport { DEBUG_BUILD } from '../common/debug-build';\n\n/** Flush the event queue to ensure that events get sent to Sentry before the response is finished and the lambda ends */\nexport async function flushIfServerless(): Promise<void> {\n const isServerless = !!process.env.LAMBDA_TASK_ROOT || !!process.env.VERCEL;\n\n if (isServerless) {\n try {\n DEBUG_BUILD && logger.log('Flushing events...');\n await flush(2000);\n DEBUG_BUILD && logger.log('Done flushing events');\n } catch (e) {\n DEBUG_BUILD && logger.log('Error while flushing events:\\n', e);\n }\n }\n}\n\n/**\n * Determines if a thrown \"error\" is a redirect Response which Solid Start users can throw to redirect to another route.\n * see: https://docs.solidjs.com/solid-router/reference/data-apis/response-helpers#redirect\n * @param error the potential redirect error\n */\nexport function isRedirect(error: unknown): boolean {\n if (error == null || !(error instanceof Response)) {\n return false;\n }\n\n const hasValidLocation = typeof error.headers.get('location') === 'string';\n const hasValidStatus = error.status >= 300 && error.status <= 308;\n return hasValidLocation && hasValidStatus;\n}\n\n/**\n * Adds an event processor to filter out low quality transactions,\n * e.g. to filter out transactions for build assets\n */\nexport function filterLowQualityTransactions(options: Options): void {\n getGlobalScope().addEventProcessor(\n Object.assign(\n (event => {\n if (event.type !== 'transaction') {\n return event;\n }\n // Filter out transactions for build assets\n if (event.transaction?.match(/^GET \\/_build\\//)) {\n options.debug && logger.log('SolidStartLowQualityTransactionsFilter filtered transaction', event.transaction);\n return null;\n }\n return event;\n }) satisfies EventProcessor,\n { id: 'SolidStartLowQualityTransactionsFilter' },\n ),\n );\n}\n"],"names":[],"mappings":";;;;AAKA;AACO,eAAe,iBAAiB,GAAkB;AACzD,EAAE,MAAM,YAAa,GAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAA,IAAoB,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM;;AAE7E,EAAE,IAAI,YAAY,EAAE;AACpB,IAAI,IAAI;AACR,MAAM,eAAe,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC;AACrD,MAAM,MAAM,KAAK,CAAC,IAAI,CAAC;AACvB,MAAM,eAAe,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC;AACvD,KAAM,CAAA,OAAO,CAAC,EAAE;AAChB,MAAM,WAAA,IAAe,MAAM,CAAC,GAAG,CAAC,gCAAgC,EAAE,CAAC,CAAC;AACpE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,UAAU,CAAC,KAAK,EAAoB;AACpD,EAAE,IAAI,KAAM,IAAG,IAAK,IAAG,EAAE,KAAM,YAAW,QAAQ,CAAC,EAAE;AACrD,IAAI,OAAO,KAAK;AAChB;;AAEA,EAAE,MAAM,gBAAA,GAAmB,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAA,KAAM,QAAQ;AAC5E,EAAE,MAAM,cAAA,GAAiB,KAAK,CAAC,MAAA,IAAU,GAAA,IAAO,KAAK,CAAC,MAAA,IAAU,GAAG;AACnE,EAAE,OAAO,gBAAiB,IAAG,cAAc;AAC3C;;AAEA;AACA;AACA;AACA;AACO,SAAS,4BAA4B,CAAC,OAAO,EAAiB;AACrE,EAAE,cAAc,EAAE,CAAC,iBAAiB;AACpC,IAAI,MAAM,CAAC,MAAM;AACjB,OAAO,SAAS;AAChB,QAAQ,IAAI,KAAK,CAAC,IAAK,KAAI,aAAa,EAAE;AAC1C,UAAU,OAAO,KAAK;AACtB;AACA;AACA,QAAQ,IAAI,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,iBAAiB,CAAC,EAAE;AACzD,UAAU,OAAO,CAAC,KAAM,IAAG,MAAM,CAAC,GAAG,CAAC,6DAA6D,EAAE,KAAK,CAAC,WAAW,CAAC;AACvH,UAAU,OAAO,IAAI;AACrB;AACA,QAAQ,OAAO,KAAK;AACpB,OAAO;AACP,MAAM,EAAE,EAAE,EAAE,wCAAA,EAA0C;AACtD,KAAK;AACL,GAAG;AACH;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../src/server/utils.ts"],"sourcesContent":["import type { EventProcessor, Options } from '@sentry/core';\nimport { logger } from '@sentry/core';\nimport { flush, getGlobalScope } from '@sentry/node';\nimport { DEBUG_BUILD } from '../common/debug-build';\n\n/** Flush the event queue to ensure that events get sent to Sentry before the response is finished and the lambda ends */\nexport async function flushIfServerless(): Promise<void> {\n const isServerless = !!process.env.LAMBDA_TASK_ROOT || !!process.env.VERCEL;\n\n if (isServerless) {\n try {\n DEBUG_BUILD && logger.log('Flushing events...');\n await flush(2000);\n DEBUG_BUILD && logger.log('Done flushing events');\n } catch (e) {\n DEBUG_BUILD && logger.log('Error while flushing events:\\n', e);\n }\n }\n}\n\n/**\n * Determines if a thrown \"error\" is a redirect Response which Solid Start users can throw to redirect to another route.\n * see: https://docs.solidjs.com/solid-router/reference/data-apis/response-helpers#redirect\n * @param error the potential redirect error\n */\nexport function isRedirect(error: unknown): boolean {\n if (error == null || !(error instanceof Response)) {\n return false;\n }\n\n const hasValidLocation = typeof error.headers.get('location') === 'string';\n const hasValidStatus = error.status >= 300 && error.status <= 308;\n return hasValidLocation && hasValidStatus;\n}\n\n/**\n * Adds an event processor to filter out low quality transactions,\n * e.g. to filter out transactions for build assets\n */\nexport function filterLowQualityTransactions(options: Options): void {\n getGlobalScope().addEventProcessor(\n Object.assign(\n (event => {\n if (event.type !== 'transaction') {\n return event;\n }\n // Filter out transactions for build assets\n if (event.transaction?.match(/^GET \\/_build\\//)) {\n options.debug && logger.log('SolidStartLowQualityTransactionsFilter filtered transaction', event.transaction);\n return null;\n }\n return event;\n }) satisfies EventProcessor,\n { id: 'SolidStartLowQualityTransactionsFilter' },\n ),\n );\n}\n"],"names":[],"mappings":";;;;AAKA;AACO,eAAe,iBAAiB,GAAkB;AACzD,EAAE,MAAM,YAAA,GAAe,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAA,IAAoB,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM;;AAE7E,EAAE,IAAI,YAAY,EAAE;AACpB,IAAI,IAAI;AACR,MAAM,eAAe,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC;AACrD,MAAM,MAAM,KAAK,CAAC,IAAI,CAAC;AACvB,MAAM,eAAe,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC;AACvD,KAAI,CAAE,OAAO,CAAC,EAAE;AAChB,MAAM,WAAA,IAAe,MAAM,CAAC,GAAG,CAAC,gCAAgC,EAAE,CAAC,CAAC;AACpE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,UAAU,CAAC,KAAK,EAAoB;AACpD,EAAE,IAAI,KAAA,IAAS,IAAA,IAAQ,EAAE,KAAA,YAAiB,QAAQ,CAAC,EAAE;AACrD,IAAI,OAAO,KAAK;AAChB;;AAEA,EAAE,MAAM,gBAAA,GAAmB,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAA,KAAM,QAAQ;AAC5E,EAAE,MAAM,cAAA,GAAiB,KAAK,CAAC,MAAA,IAAU,GAAA,IAAO,KAAK,CAAC,MAAA,IAAU,GAAG;AACnE,EAAE,OAAO,gBAAA,IAAoB,cAAc;AAC3C;;AAEA;AACA;AACA;AACA;AACO,SAAS,4BAA4B,CAAC,OAAO,EAAiB;AACrE,EAAE,cAAc,EAAE,CAAC,iBAAiB;AACpC,IAAI,MAAM,CAAC,MAAM;AACjB,OAAO,SAAS;AAChB,QAAQ,IAAI,KAAK,CAAC,IAAA,KAAS,aAAa,EAAE;AAC1C,UAAU,OAAO,KAAK;AACtB;AACA;AACA,QAAQ,IAAI,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,iBAAiB,CAAC,EAAE;AACzD,UAAU,OAAO,CAAC,KAAA,IAAS,MAAM,CAAC,GAAG,CAAC,6DAA6D,EAAE,KAAK,CAAC,WAAW,CAAC;AACvH,UAAU,OAAO,IAAI;AACrB;AACA,QAAQ,OAAO,KAAK;AACpB,OAAO;AACP,MAAM,EAAE,EAAE,EAAE,wCAAA,EAA0C;AACtD,KAAK;AACL,GAAG;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withServerActionInstrumentation.js","sources":["../../../src/server/withServerActionInstrumentation.ts"],"sourcesContent":["import { handleCallbackErrors, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR } from '@sentry/core';\nimport { captureException, getActiveSpan, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, startSpan } from '@sentry/node';\nimport { flushIfServerless, isRedirect } from './utils';\n\n/**\n * Wraps a server action (functions that use the 'use server' directive)\n * function body with Sentry Error and Performance instrumentation.\n */\nexport async function withServerActionInstrumentation<A extends (...args: unknown[]) => unknown>(\n serverActionName: string,\n callback: A,\n): Promise<ReturnType<A>> {\n const activeSpan = getActiveSpan();\n\n if (activeSpan) {\n const spanData = spanToJSON(activeSpan).data;\n\n // In solid start, server function calls are made to `/_server` which doesn't tell us\n // a lot. We rewrite the span's route to be that of the sever action name but only\n // if the target is `/_server`, otherwise we'd overwrite pageloads on routes that use\n // server actions (which are more meaningful, e.g. a request to `GET /users/5` is more\n // meaningful than overwriting it with `GET doSomeFunctionCall`).\n if (spanData && !spanData['http.route'] && spanData['http.target'] === '/_server') {\n activeSpan.setAttribute('http.route', serverActionName);\n activeSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'component');\n }\n }\n\n try {\n return await startSpan(\n {\n op: 'function.server_action',\n name: serverActionName,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component',\n },\n },\n async span => {\n const result = await handleCallbackErrors(callback, error => {\n if (!isRedirect(error)) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });\n captureException(error, {\n mechanism: {\n handled: false,\n type: 'solidstart',\n },\n });\n }\n });\n\n return result;\n },\n );\n } finally {\n await flushIfServerless();\n }\n}\n"],"names":[],"mappings":";;;;AAIA;AACA;AACA;AACA;AACO,eAAe,+BAA+B;AACrD,EAAE,gBAAgB;AAClB,EAAE,QAAQ;AACV,EAA0B;AAC1B,EAAE,MAAM,UAAA,GAAa,aAAa,EAAE;;AAEpC,EAAE,IAAI,UAAU,EAAE;AAClB,IAAI,MAAM,WAAW,UAAU,CAAC,UAAU,CAAC,CAAC,IAAI;;AAEhD;AACA;AACA;AACA;AACA;AACA,IAAI,IAAI,QAAA,IAAY,CAAC,QAAQ,CAAC,YAAY,CAAE,IAAG,QAAQ,CAAC,aAAa,CAAE,KAAI,UAAU,EAAE;AACvF,MAAM,UAAU,CAAC,YAAY,CAAC,YAAY,EAAE,gBAAgB,CAAC;AAC7D,MAAM,UAAU,CAAC,YAAY,CAAC,gCAAgC,EAAE,WAAW,CAAC;AAC5E;AACA;;AAEA,EAAE,IAAI;AACN,IAAI,OAAO,MAAM,SAAS;AAC1B,MAAM;AACN,QAAQ,EAAE,EAAE,wBAAwB;AACpC,QAAQ,IAAI,EAAE,gBAAgB;AAC9B,QAAQ,UAAU,EAAE;AACpB,UAAU,CAAC,gCAAgC,GAAG,0BAA0B;AACxE,UAAU,CAAC,gCAAgC,GAAG,WAAW;AACzD,SAAS;AACT,OAAO;AACP,MAAM,MAAM,QAAQ;AACpB,QAAQ,MAAM,SAAS,MAAM,oBAAoB,CAAC,QAAQ,EAAE,KAAA,IAAS;AACrE,UAAU,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;AAClC,YAAY,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,gBAAA,EAAkB,CAAC;AAClF,YAAY,gBAAgB,CAAC,KAAK,EAAE;AACpC,cAAc,SAAS,EAAE;AACzB,gBAAgB,OAAO,EAAE,KAAK;AAC9B,gBAAgB,IAAI,EAAE,YAAY;AAClC,eAAe;AACf,aAAa,CAAC;AACd;AACA,SAAS,CAAC;;AAEV,QAAQ,OAAO,MAAM;AACrB,OAAO;AACP,KAAK;AACL,YAAY;AACZ,IAAI,MAAM,iBAAiB,EAAE;AAC7B;AACA;;;;"}
1
+ {"version":3,"file":"withServerActionInstrumentation.js","sources":["../../../src/server/withServerActionInstrumentation.ts"],"sourcesContent":["import { handleCallbackErrors, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR } from '@sentry/core';\nimport { captureException, getActiveSpan, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, startSpan } from '@sentry/node';\nimport { flushIfServerless, isRedirect } from './utils';\n\n/**\n * Wraps a server action (functions that use the 'use server' directive)\n * function body with Sentry Error and Performance instrumentation.\n */\nexport async function withServerActionInstrumentation<A extends (...args: unknown[]) => unknown>(\n serverActionName: string,\n callback: A,\n): Promise<ReturnType<A>> {\n const activeSpan = getActiveSpan();\n\n if (activeSpan) {\n const spanData = spanToJSON(activeSpan).data;\n\n // In solid start, server function calls are made to `/_server` which doesn't tell us\n // a lot. We rewrite the span's route to be that of the sever action name but only\n // if the target is `/_server`, otherwise we'd overwrite pageloads on routes that use\n // server actions (which are more meaningful, e.g. a request to `GET /users/5` is more\n // meaningful than overwriting it with `GET doSomeFunctionCall`).\n if (spanData && !spanData['http.route'] && spanData['http.target'] === '/_server') {\n activeSpan.setAttribute('http.route', serverActionName);\n activeSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'component');\n }\n }\n\n try {\n return await startSpan(\n {\n op: 'function.server_action',\n name: serverActionName,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component',\n },\n },\n async span => {\n const result = await handleCallbackErrors(callback, error => {\n if (!isRedirect(error)) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });\n captureException(error, {\n mechanism: {\n handled: false,\n type: 'solidstart',\n },\n });\n }\n });\n\n return result;\n },\n );\n } finally {\n await flushIfServerless();\n }\n}\n"],"names":[],"mappings":";;;;AAIA;AACA;AACA;AACA;AACO,eAAe,+BAA+B;AACrD,EAAE,gBAAgB;AAClB,EAAE,QAAQ;AACV,EAA0B;AAC1B,EAAE,MAAM,UAAA,GAAa,aAAa,EAAE;;AAEpC,EAAE,IAAI,UAAU,EAAE;AAClB,IAAI,MAAM,WAAW,UAAU,CAAC,UAAU,CAAC,CAAC,IAAI;;AAEhD;AACA;AACA;AACA;AACA;AACA,IAAI,IAAI,QAAA,IAAY,CAAC,QAAQ,CAAC,YAAY,CAAA,IAAK,QAAQ,CAAC,aAAa,CAAA,KAAM,UAAU,EAAE;AACvF,MAAM,UAAU,CAAC,YAAY,CAAC,YAAY,EAAE,gBAAgB,CAAC;AAC7D,MAAM,UAAU,CAAC,YAAY,CAAC,gCAAgC,EAAE,WAAW,CAAC;AAC5E;AACA;;AAEA,EAAE,IAAI;AACN,IAAI,OAAO,MAAM,SAAS;AAC1B,MAAM;AACN,QAAQ,EAAE,EAAE,wBAAwB;AACpC,QAAQ,IAAI,EAAE,gBAAgB;AAC9B,QAAQ,UAAU,EAAE;AACpB,UAAU,CAAC,gCAAgC,GAAG,0BAA0B;AACxE,UAAU,CAAC,gCAAgC,GAAG,WAAW;AACzD,SAAS;AACT,OAAO;AACP,MAAM,MAAM,QAAQ;AACpB,QAAQ,MAAM,SAAS,MAAM,oBAAoB,CAAC,QAAQ,EAAE,KAAA,IAAS;AACrE,UAAU,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;AAClC,YAAY,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,gBAAA,EAAkB,CAAC;AAClF,YAAY,gBAAgB,CAAC,KAAK,EAAE;AACpC,cAAc,SAAS,EAAE;AACzB,gBAAgB,OAAO,EAAE,KAAK;AAC9B,gBAAgB,IAAI,EAAE,YAAY;AAClC,eAAe;AACf,aAAa,CAAC;AACd;AACA,SAAS,CAAC;;AAEV,QAAQ,OAAO,MAAM;AACrB,OAAO;AACP,KAAK;AACL,YAAY;AACZ,IAAI,MAAM,iBAAiB,EAAE;AAC7B;AACA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"buildInstrumentationFile.js","sources":["../../../src/vite/buildInstrumentationFile.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type { Plugin, UserConfig } from 'vite';\nimport type { SentrySolidStartPluginOptions } from './types';\n\n/**\n * A Sentry plugin for SolidStart to build the server\n * `instrument.server.ts` file.\n */\nexport function makeBuildInstrumentationFilePlugin(options: SentrySolidStartPluginOptions = {}): Plugin {\n return {\n name: 'sentry-solidstart-build-instrumentation-file',\n apply: 'build',\n enforce: 'post',\n async config(config: UserConfig, { command }) {\n const instrumentationFilePath = options.instrumentation || './src/instrument.server.ts';\n const router = (config as UserConfig & { router: { target: string; name: string; root: string } }).router;\n const build = config.build || {};\n const rollupOptions = build.rollupOptions || {};\n const input = [...((rollupOptions.input || []) as string[])];\n\n // plugin runs for client, server and sever-fns, we only want to run it for the server once.\n if (command !== 'build' || router.target !== 'server' || router.name === 'server-fns') {\n return config;\n }\n\n try {\n await fs.promises.access(instrumentationFilePath, fs.constants.F_OK);\n } catch (error) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry SolidStart Plugin] Could not access \\`${instrumentationFilePath}\\`, please make sure it exists.`,\n error,\n );\n });\n return config;\n }\n\n input.push(path.resolve(router.root, instrumentationFilePath));\n\n return {\n ...config,\n build: {\n ...build,\n rollupOptions: {\n ...rollupOptions,\n input,\n },\n },\n };\n },\n };\n}\n"],"names":[],"mappings":";;;;AAMA;AACA;AACA;AACA;AACO,SAAS,kCAAkC,CAAC,OAAO,GAAkC,EAAE,EAAU;AACxG,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,8CAA8C;AACxD,IAAI,KAAK,EAAE,OAAO;AAClB,IAAI,OAAO,EAAE,MAAM;AACnB,IAAI,MAAM,MAAM,CAAC,MAAM,EAAc,EAAE,OAAA,EAAS,EAAE;AAClD,MAAM,MAAM,uBAAwB,GAAE,OAAO,CAAC,eAAA,IAAmB,4BAA4B;AAC7F,MAAM,MAAM,MAAO,GAAE,CAAC,MAAO,GAA4E,MAAM;AAC/G,MAAM,MAAM,QAAQ,MAAM,CAAC,KAAM,IAAG,EAAE;AACtC,MAAM,MAAM,gBAAgB,KAAK,CAAC,aAAc,IAAG,EAAE;AACrD,MAAM,MAAM,KAAA,GAAQ,CAAC,KAAK,aAAa,CAAC,SAAS,EAAE,GAAc,CAAC;;AAElE;AACA,MAAM,IAAI,OAAA,KAAY,OAAA,IAAW,MAAM,CAAC,MAAO,KAAI,YAAY,MAAM,CAAC,IAAK,KAAI,YAAY,EAAE;AAC7F,QAAQ,OAAO,MAAM;AACrB;;AAEA,MAAM,IAAI;AACV,QAAQ,MAAM,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,uBAAuB,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC;AAC5E,OAAQ,CAAA,OAAO,KAAK,EAAE;AACtB,QAAQ,cAAc,CAAC,MAAM;AAC7B;AACA,UAAU,OAAO,CAAC,IAAI;AACtB,YAAY,CAAC,8CAA8C,EAAE,uBAAuB,CAAC,+BAA+B,CAAC;AACrH,YAAY,KAAK;AACjB,WAAW;AACX,SAAS,CAAC;AACV,QAAQ,OAAO,MAAM;AACrB;;AAEA,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,uBAAuB,CAAC,CAAC;;AAEpE,MAAM,OAAO;AACb,QAAQ,GAAG,MAAM;AACjB,QAAQ,KAAK,EAAE;AACf,UAAU,GAAG,KAAK;AAClB,UAAU,aAAa,EAAE;AACzB,YAAY,GAAG,aAAa;AAC5B,YAAY,KAAK;AACjB,WAAW;AACX,SAAS;AACT,OAAO;AACP,KAAK;AACL,GAAG;AACH;;;;"}
1
+ {"version":3,"file":"buildInstrumentationFile.js","sources":["../../../src/vite/buildInstrumentationFile.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type { Plugin, UserConfig } from 'vite';\nimport type { SentrySolidStartPluginOptions } from './types';\n\n/**\n * A Sentry plugin for SolidStart to build the server\n * `instrument.server.ts` file.\n */\nexport function makeBuildInstrumentationFilePlugin(options: SentrySolidStartPluginOptions = {}): Plugin {\n return {\n name: 'sentry-solidstart-build-instrumentation-file',\n apply: 'build',\n enforce: 'post',\n async config(config: UserConfig, { command }) {\n const instrumentationFilePath = options.instrumentation || './src/instrument.server.ts';\n const router = (config as UserConfig & { router: { target: string; name: string; root: string } }).router;\n const build = config.build || {};\n const rollupOptions = build.rollupOptions || {};\n const input = [...((rollupOptions.input || []) as string[])];\n\n // plugin runs for client, server and sever-fns, we only want to run it for the server once.\n if (command !== 'build' || router.target !== 'server' || router.name === 'server-fns') {\n return config;\n }\n\n try {\n await fs.promises.access(instrumentationFilePath, fs.constants.F_OK);\n } catch (error) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry SolidStart Plugin] Could not access \\`${instrumentationFilePath}\\`, please make sure it exists.`,\n error,\n );\n });\n return config;\n }\n\n input.push(path.resolve(router.root, instrumentationFilePath));\n\n return {\n ...config,\n build: {\n ...build,\n rollupOptions: {\n ...rollupOptions,\n input,\n },\n },\n };\n },\n };\n}\n"],"names":[],"mappings":";;;;AAMA;AACA;AACA;AACA;AACO,SAAS,kCAAkC,CAAC,OAAO,GAAkC,EAAE,EAAU;AACxG,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,8CAA8C;AACxD,IAAI,KAAK,EAAE,OAAO;AAClB,IAAI,OAAO,EAAE,MAAM;AACnB,IAAI,MAAM,MAAM,CAAC,MAAM,EAAc,EAAE,OAAA,EAAS,EAAE;AAClD,MAAM,MAAM,uBAAA,GAA0B,OAAO,CAAC,eAAA,IAAmB,4BAA4B;AAC7F,MAAM,MAAM,MAAA,GAAS,CAAC,MAAA,GAAmF,MAAM;AAC/G,MAAM,MAAM,QAAQ,MAAM,CAAC,KAAA,IAAS,EAAE;AACtC,MAAM,MAAM,gBAAgB,KAAK,CAAC,aAAA,IAAiB,EAAE;AACrD,MAAM,MAAM,KAAA,GAAQ,CAAC,KAAK,aAAa,CAAC,SAAS,EAAE,GAAc,CAAC;;AAElE;AACA,MAAM,IAAI,OAAA,KAAY,OAAA,IAAW,MAAM,CAAC,MAAA,KAAW,YAAY,MAAM,CAAC,IAAA,KAAS,YAAY,EAAE;AAC7F,QAAQ,OAAO,MAAM;AACrB;;AAEA,MAAM,IAAI;AACV,QAAQ,MAAM,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,uBAAuB,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC;AAC5E,OAAM,CAAE,OAAO,KAAK,EAAE;AACtB,QAAQ,cAAc,CAAC,MAAM;AAC7B;AACA,UAAU,OAAO,CAAC,IAAI;AACtB,YAAY,CAAC,8CAA8C,EAAE,uBAAuB,CAAC,+BAA+B,CAAC;AACrH,YAAY,KAAK;AACjB,WAAW;AACX,SAAS,CAAC;AACV,QAAQ,OAAO,MAAM;AACrB;;AAEA,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,uBAAuB,CAAC,CAAC;;AAEpE,MAAM,OAAO;AACb,QAAQ,GAAG,MAAM;AACjB,QAAQ,KAAK,EAAE;AACf,UAAU,GAAG,KAAK;AAClB,UAAU,aAAa,EAAE;AACzB,YAAY,GAAG,aAAa;AAC5B,YAAY,KAAK;AACjB,WAAW;AACX,SAAS;AACT,OAAO;AACP,KAAK;AACL,GAAG;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"sentrySolidStartVite.js","sources":["../../../src/vite/sentrySolidStartVite.ts"],"sourcesContent":["import type { Plugin, UserConfig } from 'vite';\nimport { makeBuildInstrumentationFilePlugin } from './buildInstrumentationFile';\nimport { makeAddSentryVitePlugin, makeEnableSourceMapsVitePlugin } from './sourceMaps';\nimport type { SentrySolidStartPluginOptions } from './types';\n\n/**\n * Various Sentry vite plugins to be used for SolidStart.\n */\nexport const sentrySolidStartVite = (options: SentrySolidStartPluginOptions = {}, viteConfig: UserConfig): Plugin[] => {\n const sentryPlugins: Plugin[] = [];\n\n if (options.autoInjectServerSentry !== 'experimental_dynamic-import') {\n sentryPlugins.push(makeBuildInstrumentationFilePlugin(options));\n }\n\n if (process.env.NODE_ENV !== 'development') {\n if (options.sourceMapsUploadOptions?.enabled ?? true) {\n const sourceMapsPlugin = makeAddSentryVitePlugin(options, viteConfig);\n const enableSourceMapsPlugin = makeEnableSourceMapsVitePlugin(options);\n\n sentryPlugins.push(...sourceMapsPlugin, ...enableSourceMapsPlugin);\n }\n }\n\n return sentryPlugins;\n};\n\n/**\n * Helper to add the Sentry SolidStart vite plugin to a vite config.\n */\nexport const addSentryPluginToVite = (config: UserConfig = {}, options: SentrySolidStartPluginOptions): UserConfig => {\n const plugins = Array.isArray(config.plugins) ? [...config.plugins] : [];\n plugins.unshift(sentrySolidStartVite(options, config));\n\n return {\n ...config,\n plugins,\n };\n};\n"],"names":[],"mappings":";;;AAKA;AACA;AACA;AACO,MAAM,oBAAqB,GAAE,CAAC,OAAO,GAAkC,EAAE,EAAE,UAAU,KAA2B;AACvH,EAAE,MAAM,aAAa,GAAa,EAAE;;AAEpC,EAAE,IAAI,OAAO,CAAC,sBAAuB,KAAI,6BAA6B,EAAE;AACxE,IAAI,aAAa,CAAC,IAAI,CAAC,kCAAkC,CAAC,OAAO,CAAC,CAAC;AACnE;;AAEA,EAAE,IAAI,OAAO,CAAC,GAAG,CAAC,QAAA,KAAa,aAAa,EAAE;AAC9C,IAAI,IAAI,OAAO,CAAC,uBAAuB,EAAE,OAAA,IAAW,IAAI,EAAE;AAC1D,MAAM,MAAM,mBAAmB,uBAAuB,CAAC,OAAO,EAAE,UAAU,CAAC;AAC3E,MAAM,MAAM,sBAAuB,GAAE,8BAA8B,CAAC,OAAO,CAAC;;AAE5E,MAAM,aAAa,CAAC,IAAI,CAAC,GAAG,gBAAgB,EAAE,GAAG,sBAAsB,CAAC;AACxE;AACA;;AAEA,EAAE,OAAO,aAAa;AACtB;;AAEA;AACA;AACA;AACO,MAAM,qBAAsB,GAAE,CAAC,MAAM,GAAe,EAAE,EAAE,OAAO,KAAgD;AACtH,EAAE,MAAM,UAAU,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,GAAG,MAAM,CAAC,OAAO,CAAE,GAAE,EAAE;AAC1E,EAAE,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;;AAExD,EAAE,OAAO;AACT,IAAI,GAAG,MAAM;AACb,IAAI,OAAO;AACX,GAAG;AACH;;;;"}
1
+ {"version":3,"file":"sentrySolidStartVite.js","sources":["../../../src/vite/sentrySolidStartVite.ts"],"sourcesContent":["import type { Plugin, UserConfig } from 'vite';\nimport { makeBuildInstrumentationFilePlugin } from './buildInstrumentationFile';\nimport { makeAddSentryVitePlugin, makeEnableSourceMapsVitePlugin } from './sourceMaps';\nimport type { SentrySolidStartPluginOptions } from './types';\n\n/**\n * Various Sentry vite plugins to be used for SolidStart.\n */\nexport const sentrySolidStartVite = (options: SentrySolidStartPluginOptions = {}, viteConfig: UserConfig): Plugin[] => {\n const sentryPlugins: Plugin[] = [];\n\n if (options.autoInjectServerSentry !== 'experimental_dynamic-import') {\n sentryPlugins.push(makeBuildInstrumentationFilePlugin(options));\n }\n\n if (process.env.NODE_ENV !== 'development') {\n if (options.sourceMapsUploadOptions?.enabled ?? true) {\n const sourceMapsPlugin = makeAddSentryVitePlugin(options, viteConfig);\n const enableSourceMapsPlugin = makeEnableSourceMapsVitePlugin(options);\n\n sentryPlugins.push(...sourceMapsPlugin, ...enableSourceMapsPlugin);\n }\n }\n\n return sentryPlugins;\n};\n\n/**\n * Helper to add the Sentry SolidStart vite plugin to a vite config.\n */\nexport const addSentryPluginToVite = (config: UserConfig = {}, options: SentrySolidStartPluginOptions): UserConfig => {\n const plugins = Array.isArray(config.plugins) ? [...config.plugins] : [];\n plugins.unshift(sentrySolidStartVite(options, config));\n\n return {\n ...config,\n plugins,\n };\n};\n"],"names":[],"mappings":";;;AAKA;AACA;AACA;AACO,MAAM,oBAAA,GAAuB,CAAC,OAAO,GAAkC,EAAE,EAAE,UAAU,KAA2B;AACvH,EAAE,MAAM,aAAa,GAAa,EAAE;;AAEpC,EAAE,IAAI,OAAO,CAAC,sBAAA,KAA2B,6BAA6B,EAAE;AACxE,IAAI,aAAa,CAAC,IAAI,CAAC,kCAAkC,CAAC,OAAO,CAAC,CAAC;AACnE;;AAEA,EAAE,IAAI,OAAO,CAAC,GAAG,CAAC,QAAA,KAAa,aAAa,EAAE;AAC9C,IAAI,IAAI,OAAO,CAAC,uBAAuB,EAAE,OAAA,IAAW,IAAI,EAAE;AAC1D,MAAM,MAAM,mBAAmB,uBAAuB,CAAC,OAAO,EAAE,UAAU,CAAC;AAC3E,MAAM,MAAM,sBAAA,GAAyB,8BAA8B,CAAC,OAAO,CAAC;;AAE5E,MAAM,aAAa,CAAC,IAAI,CAAC,GAAG,gBAAgB,EAAE,GAAG,sBAAsB,CAAC;AACxE;AACA;;AAEA,EAAE,OAAO,aAAa;AACtB;;AAEA;AACA;AACA;AACO,MAAM,qBAAA,GAAwB,CAAC,MAAM,GAAe,EAAE,EAAE,OAAO,KAAgD;AACtH,EAAE,MAAM,UAAU,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,GAAG,MAAM,CAAC,OAAO,CAAA,GAAI,EAAE;AAC1E,EAAE,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;;AAExD,EAAE,OAAO;AACT,IAAI,GAAG,MAAM;AACb,IAAI,OAAO;AACX,GAAG;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"sourceMaps.js","sources":["../../../src/vite/sourceMaps.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport { sentryVitePlugin } from '@sentry/vite-plugin';\nimport type { Plugin, UserConfig } from 'vite';\nimport type { SentrySolidStartPluginOptions } from './types';\n\n/**\n * A Sentry plugin for adding the @sentry/vite-plugin to automatically upload source maps to Sentry.\n */\nexport function makeAddSentryVitePlugin(options: SentrySolidStartPluginOptions, viteConfig: UserConfig): Plugin[] {\n const { authToken, debug, org, project, sourceMapsUploadOptions } = options;\n\n let updatedFilesToDeleteAfterUpload: string[] | undefined = undefined;\n\n if (\n typeof sourceMapsUploadOptions?.filesToDeleteAfterUpload === 'undefined' &&\n typeof sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps?.filesToDeleteAfterUpload ===\n 'undefined' &&\n // Only if source maps were previously not set, we update the \"filesToDeleteAfterUpload\" (as we override the setting with \"hidden\")\n typeof viteConfig.build?.sourcemap === 'undefined'\n ) {\n // For .output, .vercel, .netlify etc.\n updatedFilesToDeleteAfterUpload = ['.*/**/*.map'];\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Automatically setting \\`sourceMapsUploadOptions.filesToDeleteAfterUpload: ${JSON.stringify(\n updatedFilesToDeleteAfterUpload,\n )}\\` to delete generated source maps after they were uploaded to Sentry.`,\n );\n });\n }\n\n return [\n ...sentryVitePlugin({\n authToken: authToken ?? process.env.SENTRY_AUTH_TOKEN,\n bundleSizeOptimizations: options.bundleSizeOptimizations,\n debug: debug ?? false,\n org: org ?? process.env.SENTRY_ORG,\n project: project ?? process.env.SENTRY_PROJECT,\n sourcemaps: {\n filesToDeleteAfterUpload:\n (sourceMapsUploadOptions?.filesToDeleteAfterUpload ||\n sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps?.filesToDeleteAfterUpload) ??\n updatedFilesToDeleteAfterUpload,\n ...sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps,\n },\n telemetry: sourceMapsUploadOptions?.telemetry ?? true,\n _metaOptions: {\n telemetry: {\n metaFramework: 'solidstart',\n },\n },\n ...sourceMapsUploadOptions?.unstable_sentryVitePluginOptions,\n }),\n ];\n}\n\n/**\n * A Sentry plugin for SolidStart to enable \"hidden\" source maps if they are unset.\n */\nexport function makeEnableSourceMapsVitePlugin(options: SentrySolidStartPluginOptions): Plugin[] {\n return [\n {\n name: 'sentry-solidstart-update-source-map-setting',\n apply: 'build',\n enforce: 'post',\n config(viteConfig) {\n return {\n ...viteConfig,\n build: {\n ...viteConfig.build,\n sourcemap: getUpdatedSourceMapSettings(viteConfig, options),\n },\n };\n },\n },\n ];\n}\n\n/** There are 3 ways to set up source map generation (https://github.com/getsentry/sentry-j avascript/issues/13993)\n *\n * 1. User explicitly disabled source maps\n * - keep this setting (emit a warning that errors won't be unminified in Sentry)\n * - We won't upload anything\n *\n * 2. Users enabled source map generation (true, 'hidden', 'inline').\n * - keep this setting (don't do anything - like deletion - besides uploading)\n *\n * 3. Users didn't set source maps generation\n * - we enable 'hidden' source maps generation\n * - configure `filesToDeleteAfterUpload` to delete all .map files (we emit a log about this)\n *\n * --> only exported for testing\n */\nexport function getUpdatedSourceMapSettings(\n viteConfig: UserConfig,\n sentryPluginOptions?: SentrySolidStartPluginOptions,\n): boolean | 'inline' | 'hidden' {\n viteConfig.build = viteConfig.build || {};\n\n const viteSourceMap = viteConfig?.build?.sourcemap;\n let updatedSourceMapSetting = viteSourceMap;\n\n const settingKey = 'vite.build.sourcemap';\n\n if (viteSourceMap === false) {\n updatedSourceMapSetting = viteSourceMap;\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] Source map generation is currently disabled in your SolidStart configuration (\\`${settingKey}: false \\`). This setting is either a default setting or was explicitly set in your configuration. Sentry won't override this setting. Without source maps, code snippets on the Sentry Issues page will remain minified. To show unminified code, enable source maps in \\`${settingKey}\\` (e.g. by setting them to \\`hidden\\`).`,\n );\n });\n } else if (viteSourceMap && ['hidden', 'inline', true].includes(viteSourceMap)) {\n updatedSourceMapSetting = viteSourceMap;\n\n if (sentryPluginOptions?.debug) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] We discovered \\`${settingKey}\\` is set to \\`${viteSourceMap.toString()}\\`. Sentry will keep this source map setting. This will un-minify the code snippet on the Sentry Issue page.`,\n );\n });\n }\n } else {\n updatedSourceMapSetting = 'hidden';\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Enabled source map generation in the build options with \\`${settingKey}: 'hidden'\\`. The source maps will be deleted after they were uploaded to Sentry.`,\n );\n });\n }\n\n return updatedSourceMapSetting;\n}\n"],"names":[],"mappings":";;;AAKA;AACA;AACA;AACO,SAAS,uBAAuB,CAAC,OAAO,EAAiC,UAA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AC;AAChb,OAAO;AACP,KAAK,CAAC;AACN,SAAS,IAAI,aAAc,IAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;AAClF,IAAI,uBAAA,GAA0B,aAAa;;AAE3C,IAAI,IAAI,mBAAmB,EAAE,KAAK,EAAE;AACpC,MAAM,cAAc,CAAC,MAAM;AAC3B;AACA,QAAQ,OAAO,CAAC,GAAG;AACnB,UAAU,CAAC,yBAAyB,EAAE,UAAU,CAAC,eAAe,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAC,4GAA4G,CAAC;AACxM,SAAS;AACT,OAAO,CAAC;AACR;AACA,SAAS;AACT,IAAI,uBAAA,GAA0B,QAAQ;;AAEtC,IAAI,cAAc,CAAC,MAAM;AACzB;AACA,MAAM,OAAO,CAAC,GAAG;AACjB,QAAQ,CAAC,mEAAmE,EAAE,UAAU,CAAC,kFAAkF,CAAC;AAC5K,OAAO;AACP,KAAK,CAAC;AACN;;AAEA,EAAE,OAAO,uBAAuB;AAChC;;;;"}
1
+ {"version":3,"file":"sourceMaps.js","sources":["../../../src/vite/sourceMaps.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport { sentryVitePlugin } from '@sentry/vite-plugin';\nimport type { Plugin, UserConfig } from 'vite';\nimport type { SentrySolidStartPluginOptions } from './types';\n\n/**\n * A Sentry plugin for adding the @sentry/vite-plugin to automatically upload source maps to Sentry.\n */\nexport function makeAddSentryVitePlugin(options: SentrySolidStartPluginOptions, viteConfig: UserConfig): Plugin[] {\n const { authToken, debug, org, project, sourceMapsUploadOptions } = options;\n\n let updatedFilesToDeleteAfterUpload: string[] | undefined = undefined;\n\n if (\n typeof sourceMapsUploadOptions?.filesToDeleteAfterUpload === 'undefined' &&\n typeof sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps?.filesToDeleteAfterUpload ===\n 'undefined' &&\n // Only if source maps were previously not set, we update the \"filesToDeleteAfterUpload\" (as we override the setting with \"hidden\")\n typeof viteConfig.build?.sourcemap === 'undefined'\n ) {\n // For .output, .vercel, .netlify etc.\n updatedFilesToDeleteAfterUpload = ['.*/**/*.map'];\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Automatically setting \\`sourceMapsUploadOptions.filesToDeleteAfterUpload: ${JSON.stringify(\n updatedFilesToDeleteAfterUpload,\n )}\\` to delete generated source maps after they were uploaded to Sentry.`,\n );\n });\n }\n\n return [\n ...sentryVitePlugin({\n authToken: authToken ?? process.env.SENTRY_AUTH_TOKEN,\n bundleSizeOptimizations: options.bundleSizeOptimizations,\n debug: debug ?? false,\n org: org ?? process.env.SENTRY_ORG,\n project: project ?? process.env.SENTRY_PROJECT,\n sourcemaps: {\n filesToDeleteAfterUpload:\n (sourceMapsUploadOptions?.filesToDeleteAfterUpload ||\n sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps?.filesToDeleteAfterUpload) ??\n updatedFilesToDeleteAfterUpload,\n ...sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps,\n },\n telemetry: sourceMapsUploadOptions?.telemetry ?? true,\n _metaOptions: {\n telemetry: {\n metaFramework: 'solidstart',\n },\n },\n ...sourceMapsUploadOptions?.unstable_sentryVitePluginOptions,\n }),\n ];\n}\n\n/**\n * A Sentry plugin for SolidStart to enable \"hidden\" source maps if they are unset.\n */\nexport function makeEnableSourceMapsVitePlugin(options: SentrySolidStartPluginOptions): Plugin[] {\n return [\n {\n name: 'sentry-solidstart-update-source-map-setting',\n apply: 'build',\n enforce: 'post',\n config(viteConfig) {\n return {\n ...viteConfig,\n build: {\n ...viteConfig.build,\n sourcemap: getUpdatedSourceMapSettings(viteConfig, options),\n },\n };\n },\n },\n ];\n}\n\n/** There are 3 ways to set up source map generation (https://github.com/getsentry/sentry-j avascript/issues/13993)\n *\n * 1. User explicitly disabled source maps\n * - keep this setting (emit a warning that errors won't be unminified in Sentry)\n * - We won't upload anything\n *\n * 2. Users enabled source map generation (true, 'hidden', 'inline').\n * - keep this setting (don't do anything - like deletion - besides uploading)\n *\n * 3. Users didn't set source maps generation\n * - we enable 'hidden' source maps generation\n * - configure `filesToDeleteAfterUpload` to delete all .map files (we emit a log about this)\n *\n * --> only exported for testing\n */\nexport function getUpdatedSourceMapSettings(\n viteConfig: UserConfig,\n sentryPluginOptions?: SentrySolidStartPluginOptions,\n): boolean | 'inline' | 'hidden' {\n viteConfig.build = viteConfig.build || {};\n\n const viteSourceMap = viteConfig?.build?.sourcemap;\n let updatedSourceMapSetting = viteSourceMap;\n\n const settingKey = 'vite.build.sourcemap';\n\n if (viteSourceMap === false) {\n updatedSourceMapSetting = viteSourceMap;\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] Source map generation is currently disabled in your SolidStart configuration (\\`${settingKey}: false \\`). This setting is either a default setting or was explicitly set in your configuration. Sentry won't override this setting. Without source maps, code snippets on the Sentry Issues page will remain minified. To show unminified code, enable source maps in \\`${settingKey}\\` (e.g. by setting them to \\`hidden\\`).`,\n );\n });\n } else if (viteSourceMap && ['hidden', 'inline', true].includes(viteSourceMap)) {\n updatedSourceMapSetting = viteSourceMap;\n\n if (sentryPluginOptions?.debug) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] We discovered \\`${settingKey}\\` is set to \\`${viteSourceMap.toString()}\\`. Sentry will keep this source map setting. This will un-minify the code snippet on the Sentry Issue page.`,\n );\n });\n }\n } else {\n updatedSourceMapSetting = 'hidden';\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Enabled source map generation in the build options with \\`${settingKey}: 'hidden'\\`. The source maps will be deleted after they were uploaded to Sentry.`,\n );\n });\n }\n\n return updatedSourceMapSetting;\n}\n"],"names":[],"mappings":";;;AAKA;AACA;AACA;AACO,SAAS,uBAAuB,CAAC,OAAO,EAAiC,UAAU,EAAwB;AAClH,EAAE,MA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AC;AACN,SAAS,IAAI,aAAA,IAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;AAClF,IAAI,uBAAA,GAA0B,aAAa;;AAE3C,IAAI,IAAI,mBAAmB,EAAE,KAAK,EAAE;AACpC,MAAM,cAAc,CAAC,MAAM;AAC3B;AACA,QAAQ,OAAO,CAAC,GAAG;AACnB,UAAU,CAAC,yBAAyB,EAAE,UAAU,CAAC,eAAe,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAC,4GAA4G,CAAC;AACxM,SAAS;AACT,OAAO,CAAC;AACR;AACA,SAAS;AACT,IAAI,uBAAA,GAA0B,QAAQ;;AAEtC,IAAI,cAAc,CAAC,MAAM;AACzB;AACA,MAAM,OAAO,CAAC,GAAG;AACjB,QAAQ,CAAC,mEAAmE,EAAE,UAAU,CAAC,kFAAkF,CAAC;AAC5K,OAAO;AACP,KAAK,CAAC;AACN;;AAEA,EAAE,OAAO,uBAAuB;AAChC;;;;"}
@@ -3,7 +3,7 @@ import type { Nitro } from 'nitropack';
3
3
  export type RollupConfig = {
4
4
  plugins: unknown[];
5
5
  };
6
- export type SolidStartInlineConfig = Parameters<typeof defineConfig>[0];
6
+ export type SolidStartInlineConfig = NonNullable<Parameters<typeof defineConfig>[0]>;
7
7
  export type SolidStartInlineServerConfig = {
8
8
  hooks?: {
9
9
  close?: () => unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAGvC,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;AAExE,MAAM,MAAM,4BAA4B,GAAG;IACzC,KAAK,CAAC,EAAE;QACN,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC;QACtB,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC;KAC7C,CAAC;CACH,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAGvC,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAErF,MAAM,MAAM,4BAA4B,GAAG;IACzC,KAAK,CAAC,EAAE;QACN,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC;QACtB,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC;KAC7C,CAAC;CACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"withSentry.d.ts","sourceRoot":"","sources":["../../../src/config/withSentry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,eAAe,CAAC;AAMnE,OAAO,KAAK,EAAgB,sBAAsB,EAAgC,MAAM,SAAS,CAAC;AAUlG;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,gBAAgB,oEAA6B,EAC7C,6BAA6B,EAAE,6BAA6B,GAC3D,sBAAsB,CA4CxB"}
1
+ {"version":3,"file":"withSentry.d.ts","sourceRoot":"","sources":["../../../src/config/withSentry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,eAAe,CAAC;AAMnE,OAAO,KAAK,EAAgB,sBAAsB,EAAgC,MAAM,SAAS,CAAC;AAUlG;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,gBAAgB,oEAA6B,EAC7C,6BAA6B,EAAE,6BAA6B,GAC3D,sBAAsB,CA6CxB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/solidstart",
3
- "version": "9.36.0",
3
+ "version": "9.37.0",
4
4
  "description": "Official Sentry SDK for Solid Start",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/solidstart",
@@ -66,9 +66,9 @@
66
66
  }
67
67
  },
68
68
  "dependencies": {
69
- "@sentry/core": "9.36.0",
70
- "@sentry/node": "9.36.0",
71
- "@sentry/solid": "9.36.0",
69
+ "@sentry/core": "9.37.0",
70
+ "@sentry/node": "9.37.0",
71
+ "@sentry/solid": "9.37.0",
72
72
  "@sentry/vite-plugin": "2.22.6"
73
73
  },
74
74
  "devDependencies": {
@@ -77,6 +77,9 @@
77
77
  "@solidjs/testing-library": "0.8.5",
78
78
  "@testing-library/jest-dom": "^6.4.5",
79
79
  "@testing-library/user-event": "^14.5.2",
80
+ "solid-js": "^1.8.4",
81
+ "vinxi": "^0.3.12",
82
+ "vite": "^5.4.11",
80
83
  "vite-plugin-solid": "^2.11.6"
81
84
  },
82
85
  "scripts": {