Skip to content

Commit 1205ade

Browse files
committed
Remove flatten call
1 parent dcad00f commit 1205ade

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

packages/nitro-utils/src/rollupPlugins/wrapServerEntryWithDynamicImport.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { consoleSandbox, flatten } from '@sentry/utils';
1+
import { consoleSandbox } from '@sentry/core';
22
import type { InputPluginOption } from 'rollup';
33

44
export const SENTRY_WRAPPED_ENTRY = '?sentry-query-wrapped-entry';
@@ -176,18 +176,21 @@ export function constructWrappedFunctionExportQuery(
176176
entrypointWrappedFunctions: string[],
177177
debug?: boolean,
178178
): string {
179+
const functionsToExport: { wrap: string[]; reexport: string[] } = {
180+
wrap: [],
181+
reexport: [],
182+
};
183+
179184
// `exportedBindings` can look like this: `{ '.': [ 'handler' ] }` or `{ '.': [], './firebase-gen-1.mjs': [ 'server' ] }`
180185
// 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);
185190
} else {
186-
functions.reexport.push(currFunctionName);
191+
functionsToExport.reexport.push(fn);
187192
}
188-
return functions;
189-
},
190-
{ wrap: [], reexport: [] } as { wrap: string[]; reexport: string[] },
193+
}),
191194
);
192195

193196
if (debug && functionsToExport.wrap.length === 0) {

0 commit comments

Comments
 (0)