|
1 | | -import { consoleSandbox, flatten } from '@sentry/utils'; |
| 1 | +import { consoleSandbox } from '@sentry/core'; |
2 | 2 | import type { InputPluginOption } from 'rollup'; |
3 | 3 |
|
4 | 4 | export const SENTRY_WRAPPED_ENTRY = '?sentry-query-wrapped-entry'; |
@@ -176,18 +176,21 @@ export function constructWrappedFunctionExportQuery( |
176 | 176 | entrypointWrappedFunctions: string[], |
177 | 177 | debug?: boolean, |
178 | 178 | ): string { |
| 179 | + const functionsToExport: { wrap: string[]; reexport: string[] } = { |
| 180 | + wrap: [], |
| 181 | + reexport: [], |
| 182 | + }; |
| 183 | + |
179 | 184 | // `exportedBindings` can look like this: `{ '.': [ 'handler' ] }` or `{ '.': [], './firebase-gen-1.mjs': [ 'server' ] }` |
180 | 185 | // The key `.` refers to exports within the current file, while other keys show from where exports were imported first. |
181 | | - const functionsToExport = flatten(Object.values(exportedBindings || {})).reduce( |
182 | | - (functions, currFunctionName) => { |
183 | | - if (entrypointWrappedFunctions.includes(currFunctionName)) { |
184 | | - functions.wrap.push(currFunctionName); |
| 186 | + Object.values(exportedBindings || {}).forEach(functions => |
| 187 | + functions.forEach(fn => { |
| 188 | + if (entrypointWrappedFunctions.includes(fn)) { |
| 189 | + functionsToExport.wrap.push(fn); |
185 | 190 | } else { |
186 | | - functions.reexport.push(currFunctionName); |
| 191 | + functionsToExport.reexport.push(fn); |
187 | 192 | } |
188 | | - return functions; |
189 | | - }, |
190 | | - { wrap: [], reexport: [] } as { wrap: string[]; reexport: string[] }, |
| 193 | + }), |
191 | 194 | ); |
192 | 195 |
|
193 | 196 | if (debug && functionsToExport.wrap.length === 0) { |
|
0 commit comments