Skip to content

Commit 903fdde

Browse files
committed
fix biome
1 parent d993426 commit 903fdde

File tree

3 files changed

+22
-25
lines changed

3 files changed

+22
-25
lines changed

packages/nuxt/src/vite/addServerConfig.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,16 @@ export function addDynamicImportEntryFileWrapper(
108108
);
109109
}
110110

111-
112111
/**
113112
* A Rollup plugin which wraps the server entry with a dynamic `import()`. This makes it possible to initialize Sentry first
114113
* by using a regular `import` and load the server after that.
115114
* This also works with serverless `handler` functions, as it re-exports the `handler`.
116115
*/
117116
function wrapEntryWithDynamicImport({
118-
resolvedSentryConfigPath,
119-
entrypointWrappedFunctions,
120-
debug,
121-
}: { resolvedSentryConfigPath: string; entrypointWrappedFunctions: string[]; debug?: boolean }): InputPluginOption {
117+
resolvedSentryConfigPath,
118+
entrypointWrappedFunctions,
119+
debug,
120+
}: { resolvedSentryConfigPath: string; entrypointWrappedFunctions: string[]; debug?: boolean }): InputPluginOption {
122121
// In order to correctly import the server config file
123122
// and dynamically import the nitro runtime, we need to
124123
// mark the resolutionId with '\0raw' to fall into the
@@ -154,12 +153,12 @@ function wrapEntryWithDynamicImport({
154153
return resolution.id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)
155154
? resolution.id
156155
: `${resolutionIdPrefix}${resolution.id
157-
// 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)
158-
.concat(SENTRY_WRAPPED_ENTRY)
159-
.concat(
160-
constructWrappedFunctionExportQuery(moduleInfo.exportedBindings, entrypointWrappedFunctions, debug),
161-
)
162-
.concat(QUERY_END_INDICATOR)}`;
156+
// 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)
157+
.concat(SENTRY_WRAPPED_ENTRY)
158+
.concat(
159+
constructWrappedFunctionExportQuery(moduleInfo.exportedBindings, entrypointWrappedFunctions, debug),
160+
)
161+
.concat(QUERY_END_INDICATOR)}`;
163162
}
164163
return null;
165164
},

packages/nuxt/src/vite/utils.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export function findDefaultSdkInitFile(type: 'server' | 'client'): string | unde
2525
return filePaths.find(filename => fs.existsSync(filename));
2626
}
2727

28-
2928
export const SENTRY_WRAPPED_ENTRY = '?sentry-query-wrapped-entry';
3029
export const SENTRY_WRAPPED_FUNCTIONS = '?sentry-query-wrapped-functions=';
3130
export const SENTRY_REEXPORTED_FUNCTIONS = '?sentry-query-reexported-functions=';
@@ -64,19 +63,19 @@ export function extractFunctionReexportQueryParameters(query: string): { wrap: s
6463
const wrap =
6564
wrapMatch && wrapMatch[1]
6665
? wrapMatch[1]
67-
.split(',')
68-
.filter(param => param !== '')
69-
// Sanitize, as code could be injected with another rollup plugin
70-
.map((str: string) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
66+
.split(',')
67+
.filter(param => param !== '')
68+
// Sanitize, as code could be injected with another rollup plugin
69+
.map((str: string) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
7170
: [];
7271

7372
const reexport =
7473
reexportMatch && reexportMatch[1]
7574
? reexportMatch[1]
76-
.split(',')
77-
.filter(param => param !== '' && param !== 'default')
78-
// Sanitize, as code could be injected with another rollup plugin
79-
.map((str: string) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
75+
.split(',')
76+
.filter(param => param !== '' && param !== 'default')
77+
// Sanitize, as code could be injected with another rollup plugin
78+
.map((str: string) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
8079
: [];
8180

8281
return { wrap, reexport };
@@ -139,10 +138,10 @@ export function constructFunctionReExport(pathWithQuery: string, entryId: string
139138
(functionsCode, currFunctionName) =>
140139
functionsCode.concat(
141140
`async function ${currFunctionName}_sentryWrapped(...args) {\n` +
142-
` const res = await import(${JSON.stringify(entryId)});\n` +
143-
` return res.${currFunctionName}.call(this, ...args);\n` +
144-
'}\n' +
145-
`export { ${currFunctionName}_sentryWrapped as ${currFunctionName} };\n`,
141+
` const res = await import(${JSON.stringify(entryId)});\n` +
142+
` return res.${currFunctionName}.call(this, ...args);\n` +
143+
'}\n' +
144+
`export { ${currFunctionName}_sentryWrapped as ${currFunctionName} };\n`,
146145
),
147146
'',
148147
)

packages/nuxt/test/vite/utils.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ describe('findDefaultSdkInitFile', () => {
7070
});
7171
});
7272

73-
7473
describe('removeSentryQueryFromPath', () => {
7574
it('strips the Sentry query part from the path', () => {
7675
const url = `/example/path${SENTRY_WRAPPED_ENTRY}${SENTRY_WRAPPED_FUNCTIONS}foo,${QUERY_END_INDICATOR}`;

0 commit comments

Comments
 (0)