Skip to content

Commit ee61ad8

Browse files
committed
chore: Fix a wrong rebase
1 parent 06971c5 commit ee61ad8

2 files changed

Lines changed: 19 additions & 9 deletions

File tree

packages/server-utils/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@
117117
"@apm-js-collab/code-transformer": "^0.18.0",
118118
"@apm-js-collab/tracing-hooks": "^0.11.0",
119119
"@sentry/conventions": "^0.16.0",
120-
"@sentry/core": "10.65.0"
120+
"@sentry/core": "10.65.0",
121+
"magic-string": "~0.30.0"
121122
},
122123
"devDependencies": {
123124
"@types/node": "^18.19.1",

packages/server-utils/src/orchestrion/bundler/vite.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@ import codeTransformer from '@apm-js-collab/code-transformer-bundler-plugins/vit
1919
import MagicString from 'magic-string';
2020
import { createRequire } from 'node:module';
2121
import { dirname, resolve } from 'node:path';
22-
import { INSTRUMENTED_MODULE_NAMES, SENTRY_INSTRUMENTATIONS } from '../config';
22+
import { instrumentedModuleNames } from '../config';
23+
import type { PluginOptions } from './options';
24+
import { orchestrionTransformOptions } from './options';
2325

2426
// `vite` types live in the package's ESM-only subpath; under Node16 module
2527
// resolution with TS treating @sentry/server-utils as CJS, importing them produces a
2628
// false positive. We don't need the runtime value for typing — `UnknownPlugin`
2729
// is sufficient — so we omit the import entirely.
2830

29-
export interface SentryOrchestrionPluginOptions {
31+
export interface SentryOrchestrionPluginOptions extends PluginOptions {
3032
/**
3133
* Whether to register the SDK's channel-subscriber integrations.
3234
*
@@ -92,14 +94,15 @@ export interface SentryOrchestrionPluginOptions {
9294
* ```
9395
*/
9496
export function sentryOrchestrionPlugin(options: SentryOrchestrionPluginOptions = {}): UnknownPlugin[] {
95-
const codeTransformerPlugins = codeTransformer({ instrumentations: SENTRY_INSTRUMENTATIONS });
97+
const transformOptions = orchestrionTransformOptions(options);
98+
const codeTransformerPlugins = codeTransformer(transformOptions);
9699
const codeTransformerArray: UnknownPlugin[] = Array.isArray(codeTransformerPlugins)
97100
? codeTransformerPlugins
98101
: [codeTransformerPlugins];
99102
const serverCodeTransformerArray = codeTransformerArray.map(plugin => serverEnvironmentOnly(plugin));
100103

101104
return [
102-
bundlerMarkerPlugin({ hasRegistrationPlugin: !!options.registerIntegrations }),
105+
bundlerMarkerPlugin({ hasRegistrationPlugin: !!options.registerIntegrations, transformOptions }),
103106
...(options.registerIntegrations ? [registerIntegrationsPlugin()] : []),
104107
...serverCodeTransformerArray,
105108
];
@@ -250,7 +253,13 @@ function registerIntegrationsPlugin(): UnknownPlugin {
250253
const MARKER_MODULE_ID = 'virtual:@sentry/orchestrion-marker';
251254
const RESOLVED_MARKER_MODULE_ID = `\0${MARKER_MODULE_ID}`;
252255

253-
function bundlerMarkerPlugin({ hasRegistrationPlugin }: { hasRegistrationPlugin: boolean }): UnknownPlugin {
256+
function bundlerMarkerPlugin({
257+
hasRegistrationPlugin,
258+
transformOptions,
259+
}: {
260+
hasRegistrationPlugin: boolean;
261+
transformOptions: ReturnType<typeof orchestrionTransformOptions>;
262+
}): UnknownPlugin {
254263
const banner = [
255264
'globalThis.__SENTRY_ORCHESTRION__ = (globalThis.__SENTRY_ORCHESTRION__ || {});',
256265
'globalThis.__SENTRY_ORCHESTRION__.bundler = true;',
@@ -287,7 +296,7 @@ function bundlerMarkerPlugin({ hasRegistrationPlugin }: { hasRegistrationPlugin:
287296
// diagnostics_channel calls never get injected. Vite merges array
288297
// `noExternal` entries with the user's config, so we don't overwrite
289298
// their additions.
290-
return { ssr: { noExternal: INSTRUMENTED_MODULE_NAMES } };
299+
return { ssr: { noExternal: instrumentedModuleNames(transformOptions.instrumentations) } };
291300
},
292301
configEnvironment(this: { meta?: { rolldownVersion?: string } } | undefined, name: string): unknown {
293302
if (name === 'client') return undefined;
@@ -309,7 +318,7 @@ function bundlerMarkerPlugin({ hasRegistrationPlugin }: { hasRegistrationPlugin:
309318
return {
310319
optimizeDeps: {
311320
rolldownOptions: {
312-
plugins: [codeTransformerRollup({ instrumentations: SENTRY_INSTRUMENTATIONS })],
321+
plugins: [codeTransformerRollup(transformOptions)],
313322
},
314323
},
315324
};
@@ -318,7 +327,7 @@ function bundlerMarkerPlugin({ hasRegistrationPlugin }: { hasRegistrationPlugin:
318327
return {
319328
optimizeDeps: {
320329
esbuildOptions: {
321-
plugins: [codeTransformerEsbuild({ instrumentations: SENTRY_INSTRUMENTATIONS })],
330+
plugins: [codeTransformerEsbuild(transformOptions)],
322331
},
323332
},
324333
};

0 commit comments

Comments
 (0)