@sentry/solidstart 11.13.0 → 11.14.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.
- package/build/cjs/config/withSentry.js +1 -1
- package/build/cjs/config/withSentry.js.map +1 -1
- package/build/cjs/config/wrapServerEntryWithDynamicImport.js +3 -3
- package/build/cjs/config/wrapServerEntryWithDynamicImport.js.map +1 -1
- package/build/cjs/vite/sentrySolidStart.js +1 -1
- package/build/cjs/vite/sentrySolidStart.js.map +1 -1
- package/build/cjs/vite/sentrySolidStartVite.js +1 -1
- package/build/cjs/vite/sentrySolidStartVite.js.map +1 -1
- package/build/esm/config/withSentry.js +2 -2
- package/build/esm/config/withSentry.js.map +1 -1
- package/build/esm/config/wrapServerEntryWithDynamicImport.js +4 -4
- package/build/esm/config/wrapServerEntryWithDynamicImport.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/vite/sentrySolidStart.js +2 -2
- package/build/esm/vite/sentrySolidStart.js.map +1 -1
- package/build/esm/vite/sentrySolidStartVite.js +2 -2
- package/build/esm/vite/sentrySolidStartVite.js.map +1 -1
- package/build/types/config/utils.d.ts.map +1 -1
- package/build/types/config/withSentry.d.ts.map +1 -1
- package/build/types/vite/sentrySolidStart.d.ts.map +1 -1
- package/package.json +10 -10
|
@@ -37,7 +37,7 @@ function withSentry(solidStartConfig = {}, sentrySolidStartPluginOptions) {
|
|
|
37
37
|
const sentryRollupConfig = rollupConfig;
|
|
38
38
|
if (tunnelBasePath) sentryRollupConfig.plugins.push({
|
|
39
39
|
name: "sentry-solidstart-tunnel-base-path",
|
|
40
|
-
banner: `globalThis.${require_tunnel.TUNNEL_BASE_PATH_GLOBAL} = ${
|
|
40
|
+
banner: `globalThis.${require_tunnel.TUNNEL_BASE_PATH_GLOBAL} = ${(0, _sentry_core.stringifyForCodeInjection)(tunnelBasePath)};`
|
|
41
41
|
});
|
|
42
42
|
if (addBuildTimeInstrumentation) sentryRollupConfig.plugins.push((0, _sentry_server_utils_orchestrion_rollup.sentryOrchestrionPlugin)({ buildTimeInstrumentation: sentryPluginOptions.buildTimeInstrumentation }), (0, _sentry_server_utils_orchestrion_rollup.sentryCommonJSInteropPlugin)());
|
|
43
43
|
if (sentrySolidStartPluginOptions?.autoInjectServerSentry === "experimental_dynamic-import") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withSentry.js","names":["normalizeTunnelBasePath","GLOBAL_OBJ","TUNNEL_BASE_PATH_GLOBAL","addSentryPluginToVite","sentryOrchestrionPlugin","sentryCommonJSInteropPlugin","addDynamicImportEntryFileWrapper","debug","addInstrumentationFileToBuild","addSentryTopImport","INSTRUMENTED_MODULE_NAMES","commonJSInteropOptions","fileURLToPath"],"sources":["../../../src/config/withSentry.ts"],"sourcesContent":["import { fileURLToPath } from 'node:url';\nimport {
|
|
1
|
+
{"version":3,"file":"withSentry.js","names":["normalizeTunnelBasePath","GLOBAL_OBJ","TUNNEL_BASE_PATH_GLOBAL","addSentryPluginToVite","stringifyForCodeInjection","sentryOrchestrionPlugin","sentryCommonJSInteropPlugin","addDynamicImportEntryFileWrapper","debug","addInstrumentationFileToBuild","addSentryTopImport","INSTRUMENTED_MODULE_NAMES","commonJSInteropOptions","fileURLToPath"],"sources":["../../../src/config/withSentry.ts"],"sourcesContent":["import { fileURLToPath } from 'node:url';\nimport {\n _INTERNAL_normalizeTunnelBasePath as normalizeTunnelBasePath,\n debug,\n GLOBAL_OBJ,\n stringifyForCodeInjection,\n} from '@sentry/core';\nimport { INSTRUMENTED_MODULE_NAMES } from '@sentry/server-utils/orchestrion/config';\nimport {\n commonJSInteropOptions,\n sentryCommonJSInteropPlugin,\n sentryOrchestrionPlugin,\n} from '@sentry/server-utils/orchestrion/rollup';\nimport type { Nitro, NitroConfig } from 'nitropack';\nimport { TUNNEL_BASE_PATH_GLOBAL } from '../common/tunnel';\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\n// ioredis requires this CommonJS helper to be bundled with it. Leaving it\n// external makes Nitro resolve the default export as a namespace object.\nconst IORedisDependencies = ['standard-as-callback'];\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 // Requests reach the tunnel with `server.baseURL` still in front, so both sides serve it under that.\n const tunnelBasePath = normalizeTunnelBasePath(\n (server as SolidStartInlineServerConfig & { baseURL?: string }).baseURL,\n );\n // vinxi's dev server runs Nitro in this process, so the tunnel plugin can read it from here in dev.\n if (tunnelBasePath) {\n (GLOBAL_OBJ as { [TUNNEL_BASE_PATH_GLOBAL]?: string })[TUNNEL_BASE_PATH_GLOBAL] = tunnelBasePath;\n }\n\n const viteConfig = solidStartConfig.vite;\n const vite =\n typeof viteConfig === 'function'\n ? (...args: Parameters<typeof viteConfig>) =>\n addSentryPluginToVite(viteConfig(...args), sentryPluginOptions, tunnelBasePath)\n : addSentryPluginToVite(viteConfig, sentryPluginOptions, tunnelBasePath);\n\n const addBuildTimeInstrumentation = sentryPluginOptions.buildTimeInstrumentation !== false;\n\n // Use a module so we don't override preset hooks.\n const sentryNitroModule = (nitro: Nitro) => {\n nitro.hooks.hook('rollup:before', async (nitro, rollupConfig) => {\n // Nitro types the `rollup:before` hook's `rollupConfig.plugins` as `string[]` (plugin paths),\n // but at runtime it holds resolved plugin objects we can push onto, so narrow to our own shape.\n const sentryRollupConfig = rollupConfig as unknown as RollupConfig;\n\n if (tunnelBasePath) {\n // The built server runs in another process, so the tunnel plugin reads the base path from the bundle.\n sentryRollupConfig.plugins.push({\n name: 'sentry-solidstart-tunnel-base-path',\n banner: `globalThis.${TUNNEL_BASE_PATH_GLOBAL} = ${stringifyForCodeInjection(tunnelBasePath)};`,\n });\n }\n\n if (addBuildTimeInstrumentation) {\n sentryRollupConfig.plugins.push(\n sentryOrchestrionPlugin({ buildTimeInstrumentation: sentryPluginOptions.buildTimeInstrumentation }),\n sentryCommonJSInteropPlugin(),\n );\n }\n\n if (sentrySolidStartPluginOptions?.autoInjectServerSentry === 'experimental_dynamic-import') {\n await addDynamicImportEntryFileWrapper({\n nitro,\n rollupConfig: sentryRollupConfig,\n sentryPluginOptions,\n });\n\n sentrySolidStartPluginOptions.debug &&\n debug.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 };\n\n const existingModules = (server as SolidStartInlineServerConfig & { modules?: unknown[] }).modules || [];\n\n // An externalized dependency never passes through the orchestrion code transform, so force-inline\n // the instrumented modules. This has to be set statically on the Nitro config (not in a hook)\n // because externalization is a resolution-time decision made before Rollup normalizes `external`.\n let externals = (server as SolidStartInlineServerConfig & { externals?: { inline?: string[] } }).externals;\n let commonJS = (server as SolidStartInlineServerConfig & { commonJS?: NitroConfig['commonJS'] }).commonJS;\n if (addBuildTimeInstrumentation) {\n const existingInline = externals?.inline || [];\n externals = {\n ...externals,\n inline: [...new Set([...existingInline, ...INSTRUMENTED_MODULE_NAMES, ...IORedisDependencies])],\n };\n\n // The inlined drivers `require()` CommonJS dependencies that stay external. Fix the interop\n // for those requires (see `commonJSInteropOptions`). User-provided options win.\n commonJS = { ...commonJSInteropOptions(), ...commonJS };\n }\n\n return {\n ...solidStartConfig,\n vite,\n server: {\n ...server,\n externals,\n commonJS,\n modules: [...existingModules, sentryNitroModule],\n // Through `server.plugins`, since vinxi's dev server ignores plugins that Nitro modules add.\n plugins: [...(server.plugins || []), getTunnelPluginPath()],\n },\n };\n}\n\nfunction getTunnelPluginPath(): string {\n const url = new URL('../nitro/tunnelPlugin.js', import.meta.url);\n\n // `import.meta.url` is a file URL in the built package, but not in every test environment.\n return url.protocol === 'file:' ? fileURLToPath(url) : url.pathname;\n}\n"],"mappings":";;;;;;;;AA0BA,MAAM,sBAAsB,CAAC,sBAAsB;AAEnD,MAAM,uCAIuF,EAC3F,yCAAyC;CAAC;CAAW;CAAW;AAAQ,EAC1E;;;;;;;;;;AAWA,SAAgB,WACd,mBAA2C,CAAC,GAC5C,+BACwB;CACxB,MAAM,sBAAsB;EAC1B,GAAG;EACH,GAAG;CACL;CAEA,MAAM,SAAU,iBAAiB,UAAU,CAAC;CAE5C,MAAM,kBAAA,GAAiBA,aAAAA,kCAAAA,CACpB,OAA+D,OAClE;CAEA,IAAI,gBACDC,aAAAA,WAAsDC,eAAAA,2BAA2B;CAGpF,MAAM,aAAa,iBAAiB;CACpC,MAAM,OACJ,OAAO,eAAe,cACjB,GAAG,SACFC,6BAAAA,sBAAsB,WAAW,GAAG,IAAI,GAAG,qBAAqB,cAAc,IAChFA,6BAAAA,sBAAsB,YAAY,qBAAqB,cAAc;CAE3E,MAAM,8BAA8B,oBAAoB,6BAA6B;CAGrF,MAAM,qBAAqB,UAA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8B;CACrC,MAAM,MAAM,IAAI,IAAI,4BAAA,QAAA,KAAA,CAAA,CAAA,cAAA,UAAA,CAAA,CAAA,IAA2C;CAG/D,OAAO,IAAI,aAAa,WAAA,GAAUC,SAAAA,cAAAA,CAAc,GAAG,IAAI,IAAI;AAC7D"}
|
|
@@ -92,7 +92,7 @@ function wrapServerEntryWithDynamicImport(config) {
|
|
|
92
92
|
const entryIdUrl = (0, node_url.pathToFileURL)(entryId).href;
|
|
93
93
|
const configUrl = (0, node_url.pathToFileURL)(resolvedServerConfigPath).href;
|
|
94
94
|
const reExportedFunctions = id.includes("?sentry-query-wrapped-functions=") || id.includes("?sentry-query-reexported-functions=") ? constructFunctionReExport(id, entryIdUrl) : "";
|
|
95
|
-
return `import ${
|
|
95
|
+
return `import ${(0, _sentry_core.stringifyForCodeInjection)(configUrl)};\nimport(${(0, _sentry_core.stringifyForCodeInjection)(entryIdUrl)});\n${reExportedFunctions}\n`;
|
|
96
96
|
}
|
|
97
97
|
return null;
|
|
98
98
|
}
|
|
@@ -150,8 +150,8 @@ function constructWrappedFunctionExportQuery(exportedBindings, entrypointWrapped
|
|
|
150
150
|
*/
|
|
151
151
|
function constructFunctionReExport(pathWithQuery, entryId) {
|
|
152
152
|
const { wrap: wrapFunctions, reexport: reexportFunctions } = extractFunctionReexportQueryParameters(pathWithQuery);
|
|
153
|
-
return wrapFunctions.reduce((functionsCode, currFunctionName) => functionsCode.concat(`async function ${currFunctionName}_sentryWrapped(...args) {\n const res = await import(${
|
|
154
|
-
export { ${currFunctionName}_sentryWrapped as ${currFunctionName} };\n`), "").concat(reexportFunctions.reduce((functionsCode, currFunctionName) => functionsCode.concat(`export { ${currFunctionName} } from ${
|
|
153
|
+
return wrapFunctions.reduce((functionsCode, currFunctionName) => functionsCode.concat(`async function ${currFunctionName}_sentryWrapped(...args) {\n const res = await import(${(0, _sentry_core.stringifyForCodeInjection)(entryId)});\n return res.${currFunctionName}.call(this, ...args);\n}
|
|
154
|
+
export { ${currFunctionName}_sentryWrapped as ${currFunctionName} };\n`), "").concat(reexportFunctions.reduce((functionsCode, currFunctionName) => functionsCode.concat(`export { ${currFunctionName} } from ${(0, _sentry_core.stringifyForCodeInjection)(entryId)};`), ""));
|
|
155
155
|
}
|
|
156
156
|
exports.QUERY_END_INDICATOR = QUERY_END_INDICATOR;
|
|
157
157
|
exports.SENTRY_REEXPORTED_FUNCTIONS = SENTRY_REEXPORTED_FUNCTIONS;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapServerEntryWithDynamicImport.js","names":["fileURLToPath","basename","pathToFileURL","consoleSandbox"],"sources":["../../../src/config/wrapServerEntryWithDynamicImport.ts"],"sourcesContent":["import { basename } from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport { 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\n/**\n * `load()` emits `file://` specifiers because Node's ESM loader rejects bare Windows\n * paths (`ERR_UNSUPPORTED_ESM_URL_SCHEME`), but Rollup's resolver only understands\n * filesystem paths. Returns `undefined` for a malformed `file://` URL.\n *\n * **Only exported for testing**\n */\nexport function toResolvablePath(source: string): { path: string; wasFileUrl: boolean } | undefined {\n if (!source.startsWith('file://')) {\n return { path: source, wasFileUrl: false };\n }\n if (source === 'file://' || source === 'file:///') {\n return undefined;\n }\n try {\n const filePath = fileURLToPath(source);\n if (!filePath || filePath === '/' || filePath === '\\\\') {\n return undefined;\n }\n return { path: filePath, wasFileUrl: true };\n } catch {\n return undefined;\n }\n}\n\nconst CONFIG_EXTENSIONS = ['.ts', '.js', '.mjs', '.cjs', '.mts', '.cts'];\n\nfunction isServerConfigFile(sourcePath: string, resolvedPath: string, configFileName: string): boolean {\n if (sourcePath === resolvedPath) {\n return true;\n }\n const name = basename(sourcePath);\n return name === configFileName || CONFIG_EXTENSIONS.some(ext => name === `${configFileName}${ext}`);\n}\n\nexport type WrapServerEntryPluginOptions = {\n serverEntrypointFileName: string;\n serverConfigFileName: string;\n resolvedServerConfigPath: string;\n entrypointWrappedFunctions: 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.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 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 // `load()` emits `file://` specifiers because Node's ESM loader rejects bare Windows paths,\n // but Rollup's resolver only understands filesystem paths.\n const resolvable = toResolvablePath(source);\n if (!resolvable) {\n return null;\n }\n const { path: normalizedSource, wasFileUrl } = resolvable;\n\n if (isServerConfigFile(normalizedSource, resolvedServerConfigPath, serverConfigFileName)) {\n return { id: normalizedSource, moduleSideEffects: true };\n }\n\n if (\n options.isEntry &&\n normalizedSource.includes(serverEntrypointFileName) &&\n normalizedSource.includes('.mjs') &&\n !normalizedSource.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)\n ) {\n const resolution = await this.resolve(normalizedSource, 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\n // Pass isEntry:false to avoid double-wrapping (normalizedSource lacks query suffix).\n if (wasFileUrl) {\n const resolved = await this.resolve(normalizedSource, importer, { ...options, isEntry: false });\n if (resolved) return resolved;\n return { id: normalizedSource };\n }\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 const entryIdUrl = pathToFileURL(entryId).href;\n const configUrl = pathToFileURL(resolvedServerConfigPath).href;\n\n // Use entryIdUrl so Node's runtime ESM loader receives file:// on Windows; Rollup normalizes it in resolveId.\n // Mostly useful for serverless `handler` functions\n const reExportedFunctions =\n id.includes(SENTRY_WRAPPED_FUNCTIONS) || id.includes(SENTRY_REEXPORTED_FUNCTIONS)\n ? constructFunctionReExport(id, entryIdUrl)\n : '';\n\n return (\n // Regular `import` of the Sentry config\n `import ${JSON.stringify(configUrl)};\\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(entryIdUrl)});\\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 // oxlint-disable-next-line 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 // oxlint-disable-next-line sdk/no-regexp-constructor\n const wrapRegex = new RegExp(\n `\\\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR}|\\\\${SENTRY_REEXPORTED_FUNCTIONS})`,\n );\n // oxlint-disable-next-line 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"],"mappings":";;;;;AAOA,MAAa,uBAAuB;AACpC,MAAa,2BAA2B;AACxC,MAAa,8BAA8B;AAC3C,MAAa,sBAAsB;;;;;;;;AASnC,SAAgB,iBAAiB,QAAmE;CAClG,IAAI,CAAC,OAAO,WAAW,SAAS,GAC9B,OAAO;EAAE,MAAM;EAAQ,YAAY;CAAM;CAE3C,IAAI,WAAW,aAAa,WAAW,YACrC;CAEF,IAAI;EACF,MAAM,YAAA,GAAWA,SAAAA,cAAAA,CAAc,MAAM;EACrC,IAAI,CAAC,YAAY,aAAa,OAAO,aAAa,MAChD;EAEF,OAAO;GAAE,MAAM;GAAU,YAAY;EAAK;CAC5C,QAAQ;EACN;CACF;AACF;AAEA,MAAM,oBAAoB;CAAC;CAAO;CAAO;CAAQ;CAAQ;CAAQ;AAAM;AAEvE,SAAS,mBAAmB,YAAoB,cAAsB,gBAAiC;CACrG,IAAI,eAAe,cACjB,OAAO;CAET,MAAM,QAAA,GAAOC,UAAAA,SAAAA,CAAS,UAAU;CAChC,OAAO,SAAS,kBAAkB,kBAAkB,MAAK,QAAO,SAAS,GAAG,iBAAiB,KAAK;AACpG;;;;;;;;;;;;;AAsBA,SAAgB,iCAAiC,QAAyD;CACxG,MAAM,EACJ,sBACA,0BACA,0BACA,4BACA,UACE;CAMJ,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CAEA,IAAI,SAAS,kBAAkB,KAAK,WAAW,GAC7CC,CAAAA,GAAAA,aAAAA,eAAAA,OAEE,QAAQ,KACN,wLACF,CACF;CAUF,OAAO,CAPW,kBAAkB,KAAK,SACrC,GAAG,2BAA2B,kBAAkB,KAAK,KAAK,GAAG,MAC7D,IACkB,kBAAkB,SAAS,SAC7C,GAAG,8BAA8B,kBAAkB,SAAS,KAAK,GAAG,MACpE,EAE4B,CAAC,CAAC,KAAK,EAAE;AAC3C;;;;;;AAOA,SAAgB,0BAA0B,eAAuB,SAAyB;CACxF,MAAM,EAAE,MAAM,eAAe,UAAU,sBAAsB,uCAAuC,aAAa;CAEjH,OAAO,cACJ,QACE,eAAe,qBACd,cAAc,OACZ,kBAAkB,iBAAiB,wDACH,KAAK,UAAU,OAAO,EAAE,mBACtC,iBAAiB;WAErB,iBAAiB,oBAAoB,iBAAiB,MACtE,GACF,EACF,CAAC,CACA,OACC,kBAAkB,QACf,eAAe,qBACd,cAAc,OAAO,YAAY,iBAAiB,UAAU,KAAK,UAAU,OAAO,EAAE,EAAE,GACxF,EACF,CACF;AACJ"}
|
|
1
|
+
{"version":3,"file":"wrapServerEntryWithDynamicImport.js","names":["fileURLToPath","basename","pathToFileURL","stringifyForCodeInjection","consoleSandbox"],"sources":["../../../src/config/wrapServerEntryWithDynamicImport.ts"],"sourcesContent":["import { basename } from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport { consoleSandbox, stringifyForCodeInjection } 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\n/**\n * `load()` emits `file://` specifiers because Node's ESM loader rejects bare Windows\n * paths (`ERR_UNSUPPORTED_ESM_URL_SCHEME`), but Rollup's resolver only understands\n * filesystem paths. Returns `undefined` for a malformed `file://` URL.\n *\n * **Only exported for testing**\n */\nexport function toResolvablePath(source: string): { path: string; wasFileUrl: boolean } | undefined {\n if (!source.startsWith('file://')) {\n return { path: source, wasFileUrl: false };\n }\n if (source === 'file://' || source === 'file:///') {\n return undefined;\n }\n try {\n const filePath = fileURLToPath(source);\n if (!filePath || filePath === '/' || filePath === '\\\\') {\n return undefined;\n }\n return { path: filePath, wasFileUrl: true };\n } catch {\n return undefined;\n }\n}\n\nconst CONFIG_EXTENSIONS = ['.ts', '.js', '.mjs', '.cjs', '.mts', '.cts'];\n\nfunction isServerConfigFile(sourcePath: string, resolvedPath: string, configFileName: string): boolean {\n if (sourcePath === resolvedPath) {\n return true;\n }\n const name = basename(sourcePath);\n return name === configFileName || CONFIG_EXTENSIONS.some(ext => name === `${configFileName}${ext}`);\n}\n\nexport type WrapServerEntryPluginOptions = {\n serverEntrypointFileName: string;\n serverConfigFileName: string;\n resolvedServerConfigPath: string;\n entrypointWrappedFunctions: 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.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 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 // `load()` emits `file://` specifiers because Node's ESM loader rejects bare Windows paths,\n // but Rollup's resolver only understands filesystem paths.\n const resolvable = toResolvablePath(source);\n if (!resolvable) {\n return null;\n }\n const { path: normalizedSource, wasFileUrl } = resolvable;\n\n if (isServerConfigFile(normalizedSource, resolvedServerConfigPath, serverConfigFileName)) {\n return { id: normalizedSource, moduleSideEffects: true };\n }\n\n if (\n options.isEntry &&\n normalizedSource.includes(serverEntrypointFileName) &&\n normalizedSource.includes('.mjs') &&\n !normalizedSource.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)\n ) {\n const resolution = await this.resolve(normalizedSource, 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\n // Pass isEntry:false to avoid double-wrapping (normalizedSource lacks query suffix).\n if (wasFileUrl) {\n const resolved = await this.resolve(normalizedSource, importer, { ...options, isEntry: false });\n if (resolved) return resolved;\n return { id: normalizedSource };\n }\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 const entryIdUrl = pathToFileURL(entryId).href;\n const configUrl = pathToFileURL(resolvedServerConfigPath).href;\n\n // Use entryIdUrl so Node's runtime ESM loader receives file:// on Windows; Rollup normalizes it in resolveId.\n // Mostly useful for serverless `handler` functions\n const reExportedFunctions =\n id.includes(SENTRY_WRAPPED_FUNCTIONS) || id.includes(SENTRY_REEXPORTED_FUNCTIONS)\n ? constructFunctionReExport(id, entryIdUrl)\n : '';\n\n return (\n // Regular `import` of the Sentry config\n `import ${stringifyForCodeInjection(configUrl)};\\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(${stringifyForCodeInjection(entryIdUrl)});\\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 // oxlint-disable-next-line 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 // oxlint-disable-next-line sdk/no-regexp-constructor\n const wrapRegex = new RegExp(\n `\\\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR}|\\\\${SENTRY_REEXPORTED_FUNCTIONS})`,\n );\n // oxlint-disable-next-line 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(${stringifyForCodeInjection(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 ${stringifyForCodeInjection(entryId)};`),\n '',\n ),\n );\n}\n"],"mappings":";;;;;AAOA,MAAa,uBAAuB;AACpC,MAAa,2BAA2B;AACxC,MAAa,8BAA8B;AAC3C,MAAa,sBAAsB;;;;;;;;AASnC,SAAgB,iBAAiB,QAAmE;CAClG,IAAI,CAAC,OAAO,WAAW,SAAS,GAC9B,OAAO;EAAE,MAAM;EAAQ,YAAY;CAAM;CAE3C,IAAI,WAAW,aAAa,WAAW,YACrC;CAEF,IAAI;EACF,MAAM,YAAA,GAAWA,SAAAA,cAAAA,CAAc,MAAM;EACrC,IAAI,CAAC,YAAY,aAAa,OAAO,aAAa,MAChD;E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entryNitroPlugin(options) {
|
|
|
74
74
|
const userNitro = userConfig.nitro;
|
|
75
75
|
const tunnelBasePath = (0, _sentry_core._INTERNAL_normalizeTunnelBasePath)(userConfig.server?.baseURL || userConfig.base);
|
|
76
76
|
return {
|
|
77
|
-
define: { __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__:
|
|
77
|
+
define: { __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__: (0, _sentry_core.stringifyForCodeInjection)(tunnelBasePath) },
|
|
78
78
|
nitro: {
|
|
79
79
|
...(0, _sentry_nitro.setupSentryNitroModule)({
|
|
80
80
|
sourcemap: userNitro?.sourcemap,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentrySolidStart.js","names":["warnOnRemovedBuildOptions","sentryOrchestrionPlugin","makeAddSentryVitePluginSolidStart2","makeEnableSourceMapsVitePlugin","normalizeTunnelBasePath","setupSentryNitroModule"],"sources":["../../../src/vite/sentrySolidStart.ts"],"sourcesContent":["import {\n type BuildTimeOptionsBase,\n
|
|
1
|
+
{"version":3,"file":"sentrySolidStart.js","names":["warnOnRemovedBuildOptions","sentryOrchestrionPlugin","makeAddSentryVitePluginSolidStart2","makeEnableSourceMapsVitePlugin","normalizeTunnelBasePath","stringifyForCodeInjection","setupSentryNitroModule"],"sources":["../../../src/vite/sentrySolidStart.ts"],"sourcesContent":["import {\n _INTERNAL_normalizeTunnelBasePath as normalizeTunnelBasePath,\n type BuildTimeOptionsBase,\n stringifyForCodeInjection,\n warnOnRemovedBuildOptions,\n} from '@sentry/core';\nimport { setupSentryNitroModule } from '@sentry/nitro';\nimport { sentryOrchestrionPlugin } from '@sentry/server-utils/orchestrion/vite';\nimport type { Plugin, UserConfig } from 'vite';\nimport { makeAddSentryVitePluginSolidStart2, makeEnableSourceMapsVitePlugin } from './sourceMaps';\n\n/**\n * Build-time options for the Sentry SolidStart SDK on SolidStart 2.\n */\nexport type SentrySolidStartOptions = BuildTimeOptionsBase;\n\n/**\n * Vite plugins for the Sentry SolidStart SDK. Requires SolidStart 2.\n *\n * On SolidStart 1, use `withSentry` in `app.config.ts` instead.\n *\n * @example\n * ```typescript\n * // vite.config.ts\n * import { sentrySolidStart } from '@sentry/solidstart/vite';\n * import { solidStart } from '@solidjs/start/config';\n * import { nitro } from 'nitro/vite';\n * import { defineConfig } from 'vite';\n *\n * export default defineConfig({\n * plugins: [\n * solidStart(),\n * sentrySolidStart({\n * org: 'your-org',\n * project: 'your-project',\n * }),\n * nitro(),\n * ],\n * });\n * ```\n *\n * @param options - Options to configure the Sentry Vite plugins\n * @returns An array of Vite plugins\n */\nexport function sentrySolidStart(options: SentrySolidStartOptions = {}): Plugin[] {\n warnOnRemovedBuildOptions(options, ['unstable_sentryVitePluginOptions']);\n\n const plugins: Plugin[] = [makeSentryNitroPlugin(options), makeServerEntryPlugin()];\n\n // Only the Nitro and server entry plugins are dev-safe; the Nitro module handles `dev` itself.\n if (process.env.NODE_ENV === 'development') {\n return plugins;\n }\n\n // Injects `diagnostics_channel` publishers into instrumented deps at build time, which is what\n // lets `Sentry.init()` run from a bundled Nitro plugin rather than an `--import` preload.\n plugins.push(sentryOrchestrionPlugin({ buildTimeInstrumentation: options.buildTimeInstrumentation }));\n\n if (options.sourcemaps?.disable !== true) {\n plugins.push(...makeAddSentryVitePluginSolidStart2(options), ...makeEnableSourceMapsVitePlugin(options));\n }\n\n return plugins;\n}\n\nconst SERVER_RUNTIME_CONDITION = 'sentry-solidstart-runtime';\n\n/**\n * Resolves `@sentry/solidstart` in server environments to the entry without the deprecated SolidStart 1\n * `withSentry`. Its build-time imports (Sentry CLI, oxc-parser) otherwise end up in the server output:\n * Nitro traces their native files, and Rolldown still emits the CLI's dynamic-import chunks after\n * tree-shaking the code that imports them.\n */\nfunction makeServerEntryPlugin(): Plugin {\n return {\n name: 'sentry-solidstart-server-entry',\n configEnvironment(name, config) {\n // Vite concatenates the returned conditions onto these. If none are set yet, returning one would\n // replace Vite's defaults, so leave resolution alone.\n if (name === 'client' || config.consumer === 'client' || !config.resolve?.conditions) {\n return;\n }\n\n return { resolve: { conditions: [SERVER_RUNTIME_CONDITION] } };\n },\n };\n}\n\n// Nitro's `NitroConfig` only matches `@sentry/nitro`'s when both resolve the same `nitro` install,\n// which is not guaranteed, so the key stays opaque rather than coupling the two copies.\ntype ViteConfigWithNitro = UserConfig & {\n nitro?: Record<string, unknown>;\n server?: UserConfig['server'] & { baseURL?: string };\n};\n\n/**\n * Delivers everything only Nitro can reach — server source maps, runtime hooks, the\n * `sourcemapMinify` opt-out — through Vite's `nitro` key, and the app's base path to the browser SDK.\n *\n * `setupSentryNitroModule` is handed only the keys it reads, never the user's whole config, so what\n * comes back is purely Sentry's additions. Vite concatenates arrays when merging a `config` return\n * value, so echoing the user's own `modules`/`plugins` back would duplicate every entry.\n *\n * `enforce: 'pre'` is load-bearing: Nitro creates its instance inside its own `config` hook, so a\n * normal-priority hook sorting after it would be read too late and silently ignored.\n */\nfunction makeSentryNitroPlugin(options: SentrySolidStartOptions): Plugin {\n return {\n name: 'sentry-solidstart-nitro',\n enforce: 'pre',\n config(userConfig: ViteConfigWithNitro) {\n const userNitro = userConfig.nitro;\n // SolidStart serves the app under Vite's `base` (or `server.baseURL`), not Nitro's `baseURL`, so the browser\n // and the server both serve the managed tunnel under it.\n const tunnelBasePath = normalizeTunnelBasePath(userConfig.server?.baseURL || userConfig.base);\n\n return {\n define: { __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__: stringifyForCodeInjection(tunnelBasePath) },\n nitro: {\n ...(setupSentryNitroModule(\n // `sourcemap` decides whether Sentry enables its own; `tracingChannel` is left as the user set it.\n { sourcemap: userNitro?.sourcemap, tracingChannel: userNitro?.tracingChannel } as Parameters<\n typeof setupSentryNitroModule\n >[0],\n options,\n ) as Record<string, unknown>),\n // `@sentry/nitro` serves the tunnel under this instead of Nitro's `baseURL`.\n ...(tunnelBasePath && { runtimeConfig: { sentryTunnelBasePath: tunnelBasePath } }),\n },\n } as Omit<UserConfig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F;EACF;CACF;AACF"}
|
|
@@ -9,7 +9,7 @@ const sentrySolidStartVite = (options = {}, viteConfig, tunnelBasePath = "") =>
|
|
|
9
9
|
(0, _sentry_core.warnOnRemovedBuildOptions)(options, ["unstable_sentryVitePluginOptions"]);
|
|
10
10
|
const sentryPlugins = [{
|
|
11
11
|
name: "sentry-solidstart-tunnel-base-path",
|
|
12
|
-
config: () => ({ define: { __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__:
|
|
12
|
+
config: () => ({ define: { __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__: (0, _sentry_core.stringifyForCodeInjection)(tunnelBasePath) } })
|
|
13
13
|
}];
|
|
14
14
|
if (options.autoInjectServerSentry !== "experimental_dynamic-import") sentryPlugins.push(require_buildInstrumentationFile.makeBuildInstrumentationFilePlugin(options));
|
|
15
15
|
if (process.env.NODE_ENV !== "development") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentrySolidStartVite.js","names":["warnOnRemovedBuildOptions","makeBuildInstrumentationFilePlugin","makeAddSentryVitePlugin","makeEnableSourceMapsVitePlugin"],"sources":["../../../src/vite/sentrySolidStartVite.ts"],"sourcesContent":["import { warnOnRemovedBuildOptions } from '@sentry/core';\nimport 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 = (\n options: SentrySolidStartPluginOptions = {},\n viteConfig: UserConfig,\n tunnelBasePath = '',\n): Plugin[] => {\n warnOnRemovedBuildOptions(options, ['unstable_sentryVitePluginOptions']);\n\n const sentryPlugins: Plugin[] = [\n {\n name: 'sentry-solidstart-tunnel-base-path',\n // Serves the browser's managed tunnel under `server.baseURL`, like every other route of the app.\n config: () => ({\n define: { __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__:
|
|
1
|
+
{"version":3,"file":"sentrySolidStartVite.js","names":["warnOnRemovedBuildOptions","stringifyForCodeInjection","makeBuildInstrumentationFilePlugin","makeAddSentryVitePlugin","makeEnableSourceMapsVitePlugin"],"sources":["../../../src/vite/sentrySolidStartVite.ts"],"sourcesContent":["import { stringifyForCodeInjection, warnOnRemovedBuildOptions } from '@sentry/core';\nimport 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 = (\n options: SentrySolidStartPluginOptions = {},\n viteConfig: UserConfig,\n tunnelBasePath = '',\n): Plugin[] => {\n warnOnRemovedBuildOptions(options, ['unstable_sentryVitePluginOptions']);\n\n const sentryPlugins: Plugin[] = [\n {\n name: 'sentry-solidstart-tunnel-base-path',\n // Serves the browser's managed tunnel under `server.baseURL`, like every other route of the app.\n config: () => ({\n define: { __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__: stringifyForCodeInjection(tunnelBasePath) },\n }),\n },\n ];\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.sourcemaps?.disable !== 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 = (\n config: UserConfig = {},\n options: SentrySolidStartPluginOptions,\n tunnelBasePath?: string,\n): UserConfig => {\n const plugins = Array.isArray(config.plugins) ? [...config.plugins] : [];\n plugins.unshift(sentrySolidStartVite(options, config, tunnelBasePath));\n\n return {\n ...config,\n plugins,\n };\n};\n"],"mappings":";;;;;;;AASA,MAAa,wBACX,UAAyC,CAAC,GAC1C,YACA,iBAAiB,OACJ;CACbA,CAAAA,GAAAA,aAAAA,0BAAAA,CAA0B,SAAS,CAAC,kCAAkC,CAAC;CAEvE,MAAM,gBAA0B,CAC9B;EACE,MAAM;EAEN,eAAe,EACb,QAAQ,EAAE,yCAAA,GAAwCC,aAAAA,0BAAAA,CAA0B,cAAc,EAAE,EAC9F;CACF,CACF;CAEA,IAAI,QAAQ,2BAA2B,+BACrC,cAAc,KAAKC,iCAAAA,mCAAmC,OAAO,CAAC;CAGhE,IAAA,QAAA,IAAA,aAA6B,eACvB;MAAA,QAAQ,YAAY,YAAY,MAAM;GACxC,MAAM,mBAAmBC,mBAAAA,wBAAwB,SAAS,UAAU;GACpE,MAAM,yBAAyBC,mBAAAA,+BAA+B,OAAO;GAErE,cAAc,KAAK,GAAG,kBAAkB,GAAG,sBAAsB;EACnE;;CAGF,OAAO;AACT;;;;AAKA,MAAa,yBACX,SAAqB,CAAC,GACtB,SACA,mBACe;CACf,MAAM,UAAU,MAAM,QAAQ,OAAO,OAAO,IAAI,CAAC,GAAG,OAAO,OAAO,IAAI,CAAC;CACvE,QAAQ,QAAQ,qBAAqB,SAAS,QAAQ,cAAc,CAAC;CAErE,OAAO;EACL,GAAG;EACH;CACF;AACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TUNNEL_BASE_PATH_GLOBAL } from "../common/tunnel.js";
|
|
2
2
|
import { addSentryPluginToVite } from "../vite/sentrySolidStartVite.js";
|
|
3
3
|
import { addDynamicImportEntryFileWrapper, addInstrumentationFileToBuild, addSentryTopImport } from "./addInstrumentation.js";
|
|
4
|
-
import { GLOBAL_OBJ, _INTERNAL_normalizeTunnelBasePath, debug } from "@sentry/core";
|
|
4
|
+
import { GLOBAL_OBJ, _INTERNAL_normalizeTunnelBasePath, debug, stringifyForCodeInjection } from "@sentry/core";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { INSTRUMENTED_MODULE_NAMES } from "@sentry/server-utils/orchestrion/config";
|
|
7
7
|
import { commonJSInteropOptions, sentryCommonJSInteropPlugin, sentryOrchestrionPlugin } from "@sentry/server-utils/orchestrion/rollup";
|
|
@@ -37,7 +37,7 @@ function withSentry(solidStartConfig = {}, sentrySolidStartPluginOptions) {
|
|
|
37
37
|
const sentryRollupConfig = rollupConfig;
|
|
38
38
|
if (tunnelBasePath) sentryRollupConfig.plugins.push({
|
|
39
39
|
name: "sentry-solidstart-tunnel-base-path",
|
|
40
|
-
banner: `globalThis.${TUNNEL_BASE_PATH_GLOBAL} = ${
|
|
40
|
+
banner: `globalThis.${TUNNEL_BASE_PATH_GLOBAL} = ${stringifyForCodeInjection(tunnelBasePath)};`
|
|
41
41
|
});
|
|
42
42
|
if (addBuildTimeInstrumentation) sentryRollupConfig.plugins.push(sentryOrchestrionPlugin({ buildTimeInstrumentation: sentryPluginOptions.buildTimeInstrumentation }), sentryCommonJSInteropPlugin());
|
|
43
43
|
if (sentrySolidStartPluginOptions?.autoInjectServerSentry === "experimental_dynamic-import") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withSentry.js","names":["normalizeTunnelBasePath"],"sources":["../../../src/config/withSentry.ts"],"sourcesContent":["import { fileURLToPath } from 'node:url';\nimport {
|
|
1
|
+
{"version":3,"file":"withSentry.js","names":["normalizeTunnelBasePath"],"sources":["../../../src/config/withSentry.ts"],"sourcesContent":["import { fileURLToPath } from 'node:url';\nimport {\n _INTERNAL_normalizeTunnelBasePath as normalizeTunnelBasePath,\n debug,\n GLOBAL_OBJ,\n stringifyForCodeInjection,\n} from '@sentry/core';\nimport { INSTRUMENTED_MODULE_NAMES } from '@sentry/server-utils/orchestrion/config';\nimport {\n commonJSInteropOptions,\n sentryCommonJSInteropPlugin,\n sentryOrchestrionPlugin,\n} from '@sentry/server-utils/orchestrion/rollup';\nimport type { Nitro, NitroConfig } from 'nitropack';\nimport { TUNNEL_BASE_PATH_GLOBAL } from '../common/tunnel';\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\n// ioredis requires this CommonJS helper to be bundled with it. Leaving it\n// external makes Nitro resolve the default export as a namespace object.\nconst IORedisDependencies = ['standard-as-callback'];\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 // Requests reach the tunnel with `server.baseURL` still in front, so both sides serve it under that.\n const tunnelBasePath = normalizeTunnelBasePath(\n (server as SolidStartInlineServerConfig & { baseURL?: string }).baseURL,\n );\n // vinxi's dev server runs Nitro in this process, so the tunnel plugin can read it from here in dev.\n if (tunnelBasePath) {\n (GLOBAL_OBJ as { [TUNNEL_BASE_PATH_GLOBAL]?: string })[TUNNEL_BASE_PATH_GLOBAL] = tunnelBasePath;\n }\n\n const viteConfig = solidStartConfig.vite;\n const vite =\n typeof viteConfig === 'function'\n ? (...args: Parameters<typeof viteConfig>) =>\n addSentryPluginToVite(viteConfig(...args), sentryPluginOptions, tunnelBasePath)\n : addSentryPluginToVite(viteConfig, sentryPluginOptions, tunnelBasePath);\n\n const addBuildTimeInstrumentation = sentryPluginOptions.buildTimeInstrumentation !== false;\n\n // Use a module so we don't override preset hooks.\n const sentryNitroModule = (nitro: Nitro) => {\n nitro.hooks.hook('rollup:before', async (nitro, rollupConfig) => {\n // Nitro types the `rollup:before` hook's `rollupConfig.plugins` as `string[]` (plugin paths),\n // but at runtime it holds resolved plugin objects we can push onto, so narrow to our own shape.\n const sentryRollupConfig = rollupConfig as unknown as RollupConfig;\n\n if (tunnelBasePath) {\n // The built server runs in another process, so the tunnel plugin reads the base path from the bundle.\n sentryRollupConfig.plugins.push({\n name: 'sentry-solidstart-tunnel-base-path',\n banner: `globalThis.${TUNNEL_BASE_PATH_GLOBAL} = ${stringifyForCodeInjection(tunnelBasePath)};`,\n });\n }\n\n if (addBuildTimeInstrumentation) {\n sentryRollupConfig.plugins.push(\n sentryOrchestrionPlugin({ buildTimeInstrumentation: sentryPluginOptions.buildTimeInstrumentation }),\n sentryCommonJSInteropPlugin(),\n );\n }\n\n if (sentrySolidStartPluginOptions?.autoInjectServerSentry === 'experimental_dynamic-import') {\n await addDynamicImportEntryFileWrapper({\n nitro,\n rollupConfig: sentryRollupConfig,\n sentryPluginOptions,\n });\n\n sentrySolidStartPluginOptions.debug &&\n debug.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 };\n\n const existingModules = (server as SolidStartInlineServerConfig & { modules?: unknown[] }).modules || [];\n\n // An externalized dependency never passes through the orchestrion code transform, so force-inline\n // the instrumented modules. This has to be set statically on the Nitro config (not in a hook)\n // because externalization is a resolution-time decision made before Rollup normalizes `external`.\n let externals = (server as SolidStartInlineServerConfig & { externals?: { inline?: string[] } }).externals;\n let commonJS = (server as SolidStartInlineServerConfig & { commonJS?: NitroConfig['commonJS'] }).commonJS;\n if (addBuildTimeInstrumentation) {\n const existingInline = externals?.inline || [];\n externals = {\n ...externals,\n inline: [...new Set([...existingInline, ...INSTRUMENTED_MODULE_NAMES, ...IORedisDependencies])],\n };\n\n // The inlined drivers `require()` CommonJS dependencies that stay external. Fix the interop\n // for those requires (see `commonJSInteropOptions`). User-provided options win.\n commonJS = { ...commonJSInteropOptions(), ...commonJS };\n }\n\n return {\n ...solidStartConfig,\n vite,\n server: {\n ...server,\n externals,\n commonJS,\n modules: [...existingModules, sentryNitroModule],\n // Through `server.plugins`, since vinxi's dev server ignores plugins that Nitro modules add.\n plugins: [...(server.plugins || []), getTunnelPluginPath()],\n },\n };\n}\n\nfunction getTunnelPluginPath(): string {\n const url = new URL('../nitro/tunnelPlugin.js', import.meta.url);\n\n // `import.meta.url` is a file URL in the built package, but not in every test environment.\n return url.protocol === 'file:' ? fileURLToPath(url) : url.pathname;\n}\n"],"mappings":";;;;;;;;AA0BA,MAAM,sBAAsB,CAAC,sBAAsB;AAEnD,MAAM,uCAIuF,EAC3F,yCAAyC;CAAC;CAAW;CAAW;AAAQ,EAC1E;;;;;;;;;;AAWA,SAAgB,WACd,mBAA2C,CAAC,GAC5C,+BACwB;CACxB,MAAM,sBAAsB;EAC1B,GAAG;EACH,GAAG;CACL;CAEA,MAAM,SAAU,iBAAiB,UAAU,CAAC;CAE5C,MAAM,iBAAiBA,kCACpB,OAA+D,OAClE;CAEA,IAAI,gBACD,WAAsD,2BAA2B;CAGpF,MAAM,aAAa,iBAAiB;CACpC,MAAM,OACJ,OAAO,eAAe,cACjB,GAAG,SACF,sBAAsB,WAAW,GAAG,IAAI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I,IAAI,4BAA4B,YAAY,GAAG;CAG/D,OAAO,IAAI,aAAa,UAAU,cAAc,GAAG,IAAI,IAAI;AAC7D"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { consoleSandbox } from "@sentry/core";
|
|
1
|
+
import { consoleSandbox, stringifyForCodeInjection } from "@sentry/core";
|
|
2
2
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
3
3
|
import { basename } from "node:path";
|
|
4
4
|
// src/config/wrapServerEntryWithDynamicImport.ts
|
|
@@ -92,7 +92,7 @@ function wrapServerEntryWithDynamicImport(config) {
|
|
|
92
92
|
const entryIdUrl = pathToFileURL(entryId).href;
|
|
93
93
|
const configUrl = pathToFileURL(resolvedServerConfigPath).href;
|
|
94
94
|
const reExportedFunctions = id.includes("?sentry-query-wrapped-functions=") || id.includes("?sentry-query-reexported-functions=") ? constructFunctionReExport(id, entryIdUrl) : "";
|
|
95
|
-
return `import ${
|
|
95
|
+
return `import ${stringifyForCodeInjection(configUrl)};\nimport(${stringifyForCodeInjection(entryIdUrl)});\n${reExportedFunctions}\n`;
|
|
96
96
|
}
|
|
97
97
|
return null;
|
|
98
98
|
}
|
|
@@ -150,8 +150,8 @@ function constructWrappedFunctionExportQuery(exportedBindings, entrypointWrapped
|
|
|
150
150
|
*/
|
|
151
151
|
function constructFunctionReExport(pathWithQuery, entryId) {
|
|
152
152
|
const { wrap: wrapFunctions, reexport: reexportFunctions } = extractFunctionReexportQueryParameters(pathWithQuery);
|
|
153
|
-
return wrapFunctions.reduce((functionsCode, currFunctionName) => functionsCode.concat(`async function ${currFunctionName}_sentryWrapped(...args) {\n const res = await import(${
|
|
154
|
-
export { ${currFunctionName}_sentryWrapped as ${currFunctionName} };\n`), "").concat(reexportFunctions.reduce((functionsCode, currFunctionName) => functionsCode.concat(`export { ${currFunctionName} } from ${
|
|
153
|
+
return wrapFunctions.reduce((functionsCode, currFunctionName) => functionsCode.concat(`async function ${currFunctionName}_sentryWrapped(...args) {\n const res = await import(${stringifyForCodeInjection(entryId)});\n return res.${currFunctionName}.call(this, ...args);\n}
|
|
154
|
+
export { ${currFunctionName}_sentryWrapped as ${currFunctionName} };\n`), "").concat(reexportFunctions.reduce((functionsCode, currFunctionName) => functionsCode.concat(`export { ${currFunctionName} } from ${stringifyForCodeInjection(entryId)};`), ""));
|
|
155
155
|
}
|
|
156
156
|
export { QUERY_END_INDICATOR, SENTRY_REEXPORTED_FUNCTIONS, SENTRY_WRAPPED_ENTRY, SENTRY_WRAPPED_FUNCTIONS, constructFunctionReExport, constructWrappedFunctionExportQuery, extractFunctionReexportQueryParameters, removeSentryQueryFromPath, toResolvablePath, wrapServerEntryWithDynamicImport };
|
|
157
157
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapServerEntryWithDynamicImport.js","names":[],"sources":["../../../src/config/wrapServerEntryWithDynamicImport.ts"],"sourcesContent":["import { basename } from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport { 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\n/**\n * `load()` emits `file://` specifiers because Node's ESM loader rejects bare Windows\n * paths (`ERR_UNSUPPORTED_ESM_URL_SCHEME`), but Rollup's resolver only understands\n * filesystem paths. Returns `undefined` for a malformed `file://` URL.\n *\n * **Only exported for testing**\n */\nexport function toResolvablePath(source: string): { path: string; wasFileUrl: boolean } | undefined {\n if (!source.startsWith('file://')) {\n return { path: source, wasFileUrl: false };\n }\n if (source === 'file://' || source === 'file:///') {\n return undefined;\n }\n try {\n const filePath = fileURLToPath(source);\n if (!filePath || filePath === '/' || filePath === '\\\\') {\n return undefined;\n }\n return { path: filePath, wasFileUrl: true };\n } catch {\n return undefined;\n }\n}\n\nconst CONFIG_EXTENSIONS = ['.ts', '.js', '.mjs', '.cjs', '.mts', '.cts'];\n\nfunction isServerConfigFile(sourcePath: string, resolvedPath: string, configFileName: string): boolean {\n if (sourcePath === resolvedPath) {\n return true;\n }\n const name = basename(sourcePath);\n return name === configFileName || CONFIG_EXTENSIONS.some(ext => name === `${configFileName}${ext}`);\n}\n\nexport type WrapServerEntryPluginOptions = {\n serverEntrypointFileName: string;\n serverConfigFileName: string;\n resolvedServerConfigPath: string;\n entrypointWrappedFunctions: 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.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 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 // `load()` emits `file://` specifiers because Node's ESM loader rejects bare Windows paths,\n // but Rollup's resolver only understands filesystem paths.\n const resolvable = toResolvablePath(source);\n if (!resolvable) {\n return null;\n }\n const { path: normalizedSource, wasFileUrl } = resolvable;\n\n if (isServerConfigFile(normalizedSource, resolvedServerConfigPath, serverConfigFileName)) {\n return { id: normalizedSource, moduleSideEffects: true };\n }\n\n if (\n options.isEntry &&\n normalizedSource.includes(serverEntrypointFileName) &&\n normalizedSource.includes('.mjs') &&\n !normalizedSource.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)\n ) {\n const resolution = await this.resolve(normalizedSource, 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\n // Pass isEntry:false to avoid double-wrapping (normalizedSource lacks query suffix).\n if (wasFileUrl) {\n const resolved = await this.resolve(normalizedSource, importer, { ...options, isEntry: false });\n if (resolved) return resolved;\n return { id: normalizedSource };\n }\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 const entryIdUrl = pathToFileURL(entryId).href;\n const configUrl = pathToFileURL(resolvedServerConfigPath).href;\n\n // Use entryIdUrl so Node's runtime ESM loader receives file:// on Windows; Rollup normalizes it in resolveId.\n // Mostly useful for serverless `handler` functions\n const reExportedFunctions =\n id.includes(SENTRY_WRAPPED_FUNCTIONS) || id.includes(SENTRY_REEXPORTED_FUNCTIONS)\n ? constructFunctionReExport(id, entryIdUrl)\n : '';\n\n return (\n // Regular `import` of the Sentry config\n `import ${JSON.stringify(configUrl)};\\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(entryIdUrl)});\\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 // oxlint-disable-next-line 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 // oxlint-disable-next-line sdk/no-regexp-constructor\n const wrapRegex = new RegExp(\n `\\\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR}|\\\\${SENTRY_REEXPORTED_FUNCTIONS})`,\n );\n // oxlint-disable-next-line 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"],"mappings":";;;;;AAOA,MAAa,uBAAuB;AACpC,MAAa,2BAA2B;AACxC,MAAa,8BAA8B;AAC3C,MAAa,sBAAsB;;;;;;;;AASnC,SAAgB,iBAAiB,QAAmE;CAClG,IAAI,CAAC,OAAO,WAAW,SAAS,GAC9B,OAAO;EAAE,MAAM;EAAQ,YAAY;CAAM;CAE3C,IAAI,WAAW,aAAa,WAAW,YACrC;CAEF,IAAI;EACF,MAAM,WAAW,cAAc,MAAM;EACrC,IAAI,CAAC,YAAY,aAAa,OAAO,aAAa,MAChD;EAEF,OAAO;GAAE,MAAM;GAAU,YAAY;EAAK;CAC5C,QAAQ;EACN;CACF;AACF;AAEA,MAAM,oBAAoB;CAAC;CAAO;CAAO;CAAQ;CAAQ;CAAQ;AAAM;AAEvE,SAAS,mBAAmB,YAAoB,cAAsB,gBAAiC;CACrG,IAAI,eAAe,cACjB,OAAO;CAET,MAAM,OAAO,SAAS,UAAU;CAChC,OAAO,SAAS,kBAAkB,kBAAkB,MAAK,QAAO,SAAS,GAAG,iBAAiB,KAAK;AACpG;;;;;;;;;;;;;AA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B,SAAS,KAAK,EAAE;CAEtC,CAAC,CACH;CAEA,IAAI,SAAS,kBAAkB,KAAK,WAAW,GAC7C,qBAEE,QAAQ,KACN,wLACF,CACF;CAUF,OAAO,CAPW,kBAAkB,KAAK,SACrC,GAAG,2BAA2B,kBAAkB,KAAK,KAAK,GAAG,MAC7D,IACkB,kBAAkB,SAAS,SAC7C,GAAG,8BAA8B,kBAAkB,SAAS,KAAK,GAAG,MACpE,EAE4B,CAAC,CAAC,KAAK,EAAE;AAC3C;;;;;;AAOA,SAAgB,0BAA0B,eAAuB,SAAyB;CACxF,MAAM,EAAE,MAAM,eAAe,UAAU,sBAAsB,uCAAuC,aAAa;CAEjH,OAAO,cACJ,QACE,eAAe,qBACd,cAAc,OACZ,kBAAkB,iBAAiB,wDACH,KAAK,UAAU,OAAO,EAAE,mBACtC,iBAAiB;WAErB,iBAAiB,oBAAoB,iBAAiB,MACtE,GACF,EACF,CAAC,CACA,OACC,kBAAkB,QACf,eAAe,qBACd,cAAc,OAAO,YAAY,iBAAiB,UAAU,KAAK,UAAU,OAAO,EAAE,EAAE,GACxF,EACF,CACF;AACJ"}
|
|
1
|
+
{"version":3,"file":"wrapServerEntryWithDynamicImport.js","names":[],"sources":["../../../src/config/wrapServerEntryWithDynamicImport.ts"],"sourcesContent":["import { basename } from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport { consoleSandbox, stringifyForCodeInjection } 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\n/**\n * `load()` emits `file://` specifiers because Node's ESM loader rejects bare Windows\n * paths (`ERR_UNSUPPORTED_ESM_URL_SCHEME`), but Rollup's resolver only understands\n * filesystem paths. Returns `undefined` for a malformed `file://` URL.\n *\n * **Only exported for testing**\n */\nexport function toResolvablePath(source: string): { path: string; wasFileUrl: boolean } | undefined {\n if (!source.startsWith('file://')) {\n return { path: source, wasFileUrl: false };\n }\n if (source === 'file://' || source === 'file:///') {\n return undefined;\n }\n try {\n const filePath = fileURLToPath(source);\n if (!filePath || filePath === '/' || filePath === '\\\\') {\n return undefined;\n }\n return { path: filePath, wasFileUrl: true };\n } catch {\n return undefined;\n }\n}\n\nconst CONFIG_EXTENSIONS = ['.ts', '.js', '.mjs', '.cjs', '.mts', '.cts'];\n\nfunction isServerConfigFile(sourcePath: string, resolvedPath: string, configFileName: string): boolean {\n if (sourcePath === resolvedPath) {\n return true;\n }\n const name = basename(sourcePath);\n return name === configFileName || CONFIG_EXTENSIONS.some(ext => name === `${configFileName}${ext}`);\n}\n\nexport type WrapServerEntryPluginOptions = {\n serverEntrypointFileName: string;\n serverConfigFileName: string;\n resolvedServerConfigPath: string;\n entrypointWrappedFunctions: 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.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 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 // `load()` emits `file://` specifiers because Node's ESM loader rejects bare Windows paths,\n // but Rollup's resolver only understands filesystem paths.\n const resolvable = toResolvablePath(source);\n if (!resolvable) {\n return null;\n }\n const { path: normalizedSource, wasFileUrl } = resolvable;\n\n if (isServerConfigFile(normalizedSource, resolvedServerConfigPath, serverConfigFileName)) {\n return { id: normalizedSource, moduleSideEffects: true };\n }\n\n if (\n options.isEntry &&\n normalizedSource.includes(serverEntrypointFileName) &&\n normalizedSource.includes('.mjs') &&\n !normalizedSource.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)\n ) {\n const resolution = await this.resolve(normalizedSource, 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\n // Pass isEntry:false to avoid double-wrapping (normalizedSource lacks query suffix).\n if (wasFileUrl) {\n const resolved = await this.resolve(normalizedSource, importer, { ...options, isEntry: false });\n if (resolved) return resolved;\n return { id: normalizedSource };\n }\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 const entryIdUrl = pathToFileURL(entryId).href;\n const configUrl = pathToFileURL(resolvedServerConfigPath).href;\n\n // Use entryIdUrl so Node's runtime ESM loader receives file:// on Windows; Rollup normalizes it in resolveId.\n // Mostly useful for serverless `handler` functions\n const reExportedFunctions =\n id.includes(SENTRY_WRAPPED_FUNCTIONS) || id.includes(SENTRY_REEXPORTED_FUNCTIONS)\n ? constructFunctionReExport(id, entryIdUrl)\n : '';\n\n return (\n // Regular `import` of the Sentry config\n `import ${stringifyForCodeInjection(configUrl)};\\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(${stringifyForCodeInjection(entryIdUrl)});\\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 // oxlint-disable-next-line 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 // oxlint-disable-next-line sdk/no-regexp-constructor\n const wrapRegex = new RegExp(\n `\\\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR}|\\\\${SENTRY_REEXPORTED_FUNCTIONS})`,\n );\n // oxlint-disable-next-line 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(${stringifyForCodeInjection(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 ${stringifyForCodeInjection(entryId)};`),\n '',\n ),\n );\n}\n"],"mappings":";;;;;AAOA,MAAa,uBAAuB;AACpC,MAAa,2BAA2B;AACxC,MAAa,8BAA8B;AAC3C,MAAa,sBAAsB;;;;;;;;AASnC,SAAgB,iBAAiB,QAAmE;CAClG,IAAI,CAAC,OAAO,WAAW,SAAS,GAC9B,OAAO;EAAE,MAAM;EAAQ,YAAY;CAAM;CAE3C,IAAI,WAAW,aAAa,WAAW,YACrC;CAEF,IAAI;EACF,MAAM,WAAW,cAAc,MAAM;EACrC,IAAI,CAAC,YAAY,aAAa,OAAO,aAAa,MAChD;EAEF,OAAO;GAAE,MAAM;GAAU,YAAY;EAAK;CAC5C,QAAQ;EACN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C1B;;;;;;;;AASA,SAAgB,oCACd,kBACA,4BACA,OACQ;CACR,MAAM,oBAA4D;EAChE,MAAM,CAAC;EACP,UAAU,CAAC;CACb;CAIA,OAAO,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,SAAQ,cAC5C,UAAU,SAAQ,OAAM;EACtB,IAAI,2BAA2B,SAAS,EAAE,GACxC,kBAAkB,KAAK,KAAK,EAAE;OAE9B,kBAAkB,SAAS,KAAK,EAAE;CAEtC,CAAC,CACH;CAEA,IAAI,SAAS,kBAAkB,KAAK,WAAW,GAC7C,qBAEE,QAAQ,KACN,wLACF,CACF;CAUF,OAAO,CAPW,kBAAkB,KAAK,SACrC,GAAG,2BAA2B,kBAAkB,KAAK,KAAK,GAAG,MAC7D,IACkB,kBAAkB,SAAS,SAC7C,GAAG,8BAA8B,kBAAkB,SAAS,KAAK,GAAG,MACpE,EAE4B,CAAC,CAAC,KAAK,EAAE;AAC3C;;;;;;AAOA,SAAgB,0BAA0B,eAAuB,SAAyB;CACxF,MAAM,EAAE,MAAM,eAAe,UAAU,sBAAsB,uCAAuC,aAAa;CAEjH,OAAO,cACJ,QACE,eAAe,qBACd,cAAc,OACZ,kBAAkB,iBAAiB,wDACH,0BAA0B,OAAO,EAAE,mBACjD,iBAAiB;WAErB,iBAAiB,oBAAoB,iBAAiB,MACtE,GACF,EACF,CAAC,CACA,OACC,kBAAkB,QACf,eAAe,qBACd,cAAc,OAAO,YAAY,iBAAiB,UAAU,0BAA0B,OAAO,EAAE,EAAE,GACnG,EACF,CACF;AACJ"}
|
package/build/esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"11.
|
|
1
|
+
{"type":"module","version":"11.14.0"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { makeAddSentryVitePluginSolidStart2, makeEnableSourceMapsVitePlugin } from "./sourceMaps.js";
|
|
2
|
-
import { _INTERNAL_normalizeTunnelBasePath, warnOnRemovedBuildOptions } from "@sentry/core";
|
|
2
|
+
import { _INTERNAL_normalizeTunnelBasePath, stringifyForCodeInjection, warnOnRemovedBuildOptions } from "@sentry/core";
|
|
3
3
|
import { setupSentryNitroModule } from "@sentry/nitro";
|
|
4
4
|
import { sentryOrchestrionPlugin } from "@sentry/server-utils/orchestrion/vite";
|
|
5
5
|
// src/vite/sentrySolidStart.ts
|
|
@@ -74,7 +74,7 @@ function makeSentryNitroPlugin(options) {
|
|
|
74
74
|
const userNitro = userConfig.nitro;
|
|
75
75
|
const tunnelBasePath = _INTERNAL_normalizeTunnelBasePath(userConfig.server?.baseURL || userConfig.base);
|
|
76
76
|
return {
|
|
77
|
-
define: { __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__:
|
|
77
|
+
define: { __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__: stringifyForCodeInjection(tunnelBasePath) },
|
|
78
78
|
nitro: {
|
|
79
79
|
...setupSentryNitroModule({
|
|
80
80
|
sourcemap: userNitro?.sourcemap,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentrySolidStart.js","names":["normalizeTunnelBasePath"],"sources":["../../../src/vite/sentrySolidStart.ts"],"sourcesContent":["import {\n type BuildTimeOptionsBase,\n
|
|
1
|
+
{"version":3,"file":"sentrySolidStart.js","names":["normalizeTunnelBasePath"],"sources":["../../../src/vite/sentrySolidStart.ts"],"sourcesContent":["import {\n _INTERNAL_normalizeTunnelBasePath as normalizeTunnelBasePath,\n type BuildTimeOptionsBase,\n stringifyForCodeInjection,\n warnOnRemovedBuildOptions,\n} from '@sentry/core';\nimport { setupSentryNitroModule } from '@sentry/nitro';\nimport { sentryOrchestrionPlugin } from '@sentry/server-utils/orchestrion/vite';\nimport type { Plugin, UserConfig } from 'vite';\nimport { makeAddSentryVitePluginSolidStart2, makeEnableSourceMapsVitePlugin } from './sourceMaps';\n\n/**\n * Build-time options for the Sentry SolidStart SDK on SolidStart 2.\n */\nexport type SentrySolidStartOptions = BuildTimeOptionsBase;\n\n/**\n * Vite plugins for the Sentry SolidStart SDK. Requires SolidStart 2.\n *\n * On SolidStart 1, use `withSentry` in `app.config.ts` instead.\n *\n * @example\n * ```typescript\n * // vite.config.ts\n * import { sentrySolidStart } from '@sentry/solidstart/vite';\n * import { solidStart } from '@solidjs/start/config';\n * import { nitro } from 'nitro/vite';\n * import { defineConfig } from 'vite';\n *\n * export default defineConfig({\n * plugins: [\n * solidStart(),\n * sentrySolidStart({\n * org: 'your-org',\n * project: 'your-project',\n * }),\n * nitro(),\n * ],\n * });\n * ```\n *\n * @param options - Options to configure the Sentry Vite plugins\n * @returns An array of Vite plugins\n */\nexport function sentrySolidStart(options: SentrySolidStartOptions = {}): Plugin[] {\n warnOnRemovedBuildOptions(options, ['unstable_sentryVitePluginOptions']);\n\n const plugins: Plugin[] = [makeSentryNitroPlugin(options), makeServerEntryPlugin()];\n\n // Only the Nitro and server entry plugins are dev-safe; the Nitro module handles `dev` itself.\n if (process.env.NODE_ENV === 'development') {\n return plugins;\n }\n\n // Injects `diagnostics_channel` publishers into instrumented deps at build time, which is what\n // lets `Sentry.init()` run from a bundled Nitro plugin rather than an `--import` preload.\n plugins.push(sentryOrchestrionPlugin({ buildTimeInstrumentation: options.buildTimeInstrumentation }));\n\n if (options.sourcemaps?.disable !== true) {\n plugins.push(...makeAddSentryVitePluginSolidStart2(options), ...makeEnableSourceMapsVitePlugin(options));\n }\n\n return plugins;\n}\n\nconst SERVER_RUNTIME_CONDITION = 'sentry-solidstart-runtime';\n\n/**\n * Resolves `@sentry/solidstart` in server environments to the entry without the deprecated SolidStart 1\n * `withSentry`. Its build-time imports (Sentry CLI, oxc-parser) otherwise end up in the server output:\n * Nitro traces their native files, and Rolldown still emits the CLI's dynamic-import chunks after\n * tree-shaking the code that imports them.\n */\nfunction makeServerEntryPlugin(): Plugin {\n return {\n name: 'sentry-solidstart-server-entry',\n configEnvironment(name, config) {\n // Vite concatenates the returned conditions onto these. If none are set yet, returning one would\n // replace Vite's defaults, so leave resolution alone.\n if (name === 'client' || config.consumer === 'client' || !config.resolve?.conditions) {\n return;\n }\n\n return { resolve: { conditions: [SERVER_RUNTIME_CONDITION] } };\n },\n };\n}\n\n// Nitro's `NitroConfig` only matches `@sentry/nitro`'s when both resolve the same `nitro` install,\n// which is not guaranteed, so the key stays opaque rather than coupling the two copies.\ntype ViteConfigWithNitro = UserConfig & {\n nitro?: Record<string, unknown>;\n server?: UserConfig['server'] & { baseURL?: string };\n};\n\n/**\n * Delivers everything only Nitro can reach — server source maps, runtime hooks, the\n * `sourcemapMinify` opt-out — through Vite's `nitro` key, and the app's base path to the browser SDK.\n *\n * `setupSentryNitroModule` is handed only the keys it reads, never the user's whole config, so what\n * comes back is purely Sentry's additions. Vite concatenates arrays when merging a `config` return\n * value, so echoing the user's own `modules`/`plugins` back would duplicate every entry.\n *\n * `enforce: 'pre'` is load-bearing: Nitro creates its instance inside its own `config` hook, so a\n * normal-priority hook sorting after it would be read too late and silently ignored.\n */\nfunction makeSentryNitroPlugin(options: SentrySolidStartOptions): Plugin {\n return {\n name: 'sentry-solidstart-nitro',\n enforce: 'pre',\n config(userConfig: ViteConfigWithNitro) {\n const userNitro = userConfig.nitro;\n // SolidStart serves the app under Vite's `base` (or `server.baseURL`), not Nitro's `baseURL`, so the browser\n // and the server both serve the managed tunnel under it.\n const tunnelBasePath = normalizeTunnelBasePath(userConfig.server?.baseURL || userConfig.base);\n\n return {\n define: { __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__: stringifyForCodeInjection(tunnelBasePath) },\n nitro: {\n ...(setupSentryNitroModule(\n // `sourcemap` decides whether Sentry enables its own; `tracingChannel` is left as the user set it.\n { sourcemap: userNitro?.sourcemap, tracingChannel: userNitro?.tracingChannel } as Parameters<\n typeof setupSentryNitroModule\n >[0],\n options,\n ) as Record<string, unknown>),\n // `@sentry/nitro` serves the tunnel under this instead of Nitro's `baseURL`.\n ...(tunnelBasePath && { runtimeConfig: { sentryTunnelBasePath: tunnelBasePath } }),\n },\n }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ryVitePlugin, makeEnableSourceMapsVitePlugin } from "./sourceMaps.js";
|
|
3
|
-
import { warnOnRemovedBuildOptions } from "@sentry/core";
|
|
3
|
+
import { stringifyForCodeInjection, warnOnRemovedBuildOptions } from "@sentry/core";
|
|
4
4
|
// src/vite/sentrySolidStartVite.ts
|
|
5
5
|
/**
|
|
6
6
|
* Various Sentry vite plugins to be used for SolidStart.
|
|
@@ -9,7 +9,7 @@ const sentrySolidStartVite = (options = {}, viteConfig, tunnelBasePath = "") =>
|
|
|
9
9
|
warnOnRemovedBuildOptions(options, ["unstable_sentryVitePluginOptions"]);
|
|
10
10
|
const sentryPlugins = [{
|
|
11
11
|
name: "sentry-solidstart-tunnel-base-path",
|
|
12
|
-
config: () => ({ define: { __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__:
|
|
12
|
+
config: () => ({ define: { __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__: stringifyForCodeInjection(tunnelBasePath) } })
|
|
13
13
|
}];
|
|
14
14
|
if (options.autoInjectServerSentry !== "experimental_dynamic-import") sentryPlugins.push(makeBuildInstrumentationFilePlugin(options));
|
|
15
15
|
if (process.env.NODE_ENV !== "development") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentrySolidStartVite.js","names":[],"sources":["../../../src/vite/sentrySolidStartVite.ts"],"sourcesContent":["import { warnOnRemovedBuildOptions } from '@sentry/core';\nimport 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 = (\n options: SentrySolidStartPluginOptions = {},\n viteConfig: UserConfig,\n tunnelBasePath = '',\n): Plugin[] => {\n warnOnRemovedBuildOptions(options, ['unstable_sentryVitePluginOptions']);\n\n const sentryPlugins: Plugin[] = [\n {\n name: 'sentry-solidstart-tunnel-base-path',\n // Serves the browser's managed tunnel under `server.baseURL`, like every other route of the app.\n config: () => ({\n define: { __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__:
|
|
1
|
+
{"version":3,"file":"sentrySolidStartVite.js","names":[],"sources":["../../../src/vite/sentrySolidStartVite.ts"],"sourcesContent":["import { stringifyForCodeInjection, warnOnRemovedBuildOptions } from '@sentry/core';\nimport 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 = (\n options: SentrySolidStartPluginOptions = {},\n viteConfig: UserConfig,\n tunnelBasePath = '',\n): Plugin[] => {\n warnOnRemovedBuildOptions(options, ['unstable_sentryVitePluginOptions']);\n\n const sentryPlugins: Plugin[] = [\n {\n name: 'sentry-solidstart-tunnel-base-path',\n // Serves the browser's managed tunnel under `server.baseURL`, like every other route of the app.\n config: () => ({\n define: { __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__: stringifyForCodeInjection(tunnelBasePath) },\n }),\n },\n ];\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.sourcemaps?.disable !== 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 = (\n config: UserConfig = {},\n options: SentrySolidStartPluginOptions,\n tunnelBasePath?: string,\n): UserConfig => {\n const plugins = Array.isArray(config.plugins) ? [...config.plugins] : [];\n plugins.unshift(sentrySolidStartVite(options, config, tunnelBasePath));\n\n return {\n ...config,\n plugins,\n };\n};\n"],"mappings":";;;;;;;AASA,MAAa,wBACX,UAAyC,CAAC,GAC1C,YACA,iBAAiB,OACJ;CACb,0BAA0B,SAAS,CAAC,kCAAkC,CAAC;CAEvE,MAAM,gBAA0B,CAC9B;EACE,MAAM;EAEN,eAAe,EACb,QAAQ,EAAE,wCAAwC,0BAA0B,cAAc,EAAE,EAC9F;CACF,CACF;CAEA,IAAI,QAAQ,2BAA2B,+BACrC,cAAc,KAAK,mCAAmC,OAAO,CAAC;CAGhE,IAAA,QAAA,IAAA,aAA6B,eACvB;MAAA,QAAQ,YAAY,YAAY,MAAM;GACxC,MAAM,mBAAmB,wBAAwB,SAAS,UAAU;GACpE,MAAM,yBAAyB,+BAA+B,OAAO;GAErE,cAAc,KAAK,GAAG,kBAAkB,GAAG,sBAAsB;EACnE;;CAGF,OAAO;AACT;;;;AAKA,MAAa,yBACX,SAAqB,CAAC,GACtB,SACA,mBACe;CACf,MAAM,UAAU,MAAM,QAAQ,OAAO,OAAO,IAAI,CAAC,GAAG,OAAO,OAAO,IAAI,CAAC;CACvE,QAAQ,QAAQ,qBAAqB,SAAS,QAAQ,cAAc,CAAC;CAErE,OAAO;EACL,GAAG;EACH;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/config/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/config/utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,gCAAgC,CAAC;AAClE,eAAO,MAAM,wBAAwB,qCAAqC,CAAC;AAC3E,eAAO,MAAM,2BAA2B,wCAAwC,CAAC;AACjF,eAAO,MAAM,mBAAmB,qBAAqB,CAAC;AAEtD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI7D;AAED;;;;;GAKG;AACH,wBAAgB,sCAAsC,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CA2B5G;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAsBxF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withSentry.d.ts","sourceRoot":"","sources":["../../../src/config/withSentry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"withSentry.d.ts","sourceRoot":"","sources":["../../../src/config/withSentry.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,eAAe,CAAC;AAMnE,OAAO,KAAK,EAAgB,sBAAsB,EAAgC,MAAM,SAAS,CAAC;AAclG;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,gBAAgB,EAAE,sBAAsB,YAAK,EAC7C,6BAA6B,EAAE,6BAA6B,GAC3D,sBAAsB,CAmGxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentrySolidStart.d.ts","sourceRoot":"","sources":["../../../src/vite/sentrySolidStart.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"sentrySolidStart.d.ts","sourceRoot":"","sources":["../../../src/vite/sentrySolidStart.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oBAAoB,EAG1B,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAAE,MAAM,EAAc,MAAM,MAAM,CAAC;AAG/C;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,uBAA4B,GAAG,MAAM,EAAE,CAmBhF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/solidstart",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.14.0",
|
|
4
4
|
"description": "Official Sentry SDK for Solid Start",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -87,19 +87,19 @@
|
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@sentry/core": "11.
|
|
91
|
-
"@sentry/nitro": "11.
|
|
92
|
-
"@sentry/node": "11.
|
|
93
|
-
"@sentry/server-runtime-injection": "11.
|
|
94
|
-
"@sentry/server-utils": "11.
|
|
95
|
-
"@sentry/solid": "11.
|
|
96
|
-
"@sentry/bundler-plugins": "11.
|
|
90
|
+
"@sentry/core": "11.14.0",
|
|
91
|
+
"@sentry/nitro": "11.14.0",
|
|
92
|
+
"@sentry/node": "11.14.0",
|
|
93
|
+
"@sentry/server-runtime-injection": "11.14.0",
|
|
94
|
+
"@sentry/server-utils": "11.14.0",
|
|
95
|
+
"@sentry/solid": "11.14.0",
|
|
96
|
+
"@sentry/bundler-plugins": "11.14.0",
|
|
97
97
|
"@sentry/conventions": "0.33.0",
|
|
98
98
|
"h3": "^1.15.10"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
|
-
"@sentry-internal/rollup-utils": "11.
|
|
102
|
-
"@sentry/browser": "11.
|
|
101
|
+
"@sentry-internal/rollup-utils": "11.14.0",
|
|
102
|
+
"@sentry/browser": "11.14.0",
|
|
103
103
|
"@solidjs/router": "^1.0.0",
|
|
104
104
|
"@solidjs/start": "^1.3.2",
|
|
105
105
|
"@solidjs/testing-library": "0.8.5",
|