Skip to content

fix(sveltekit): Explicitly export Node SDK exports #7644

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions packages/sveltekit/src/index.client.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
export * from './client';

/**
* This const serves no purpose besides being an identifier for this file that the SDK multiplexer loader can use to
* determine that this is in fact a file that wants to be multiplexed.
*/
export const _SENTRY_SDK_MULTIPLEXER = true;
8 changes: 0 additions & 8 deletions packages/sveltekit/src/index.server.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
export * from './server';
export * from './config';

// This file is the main entrypoint on the server and/or when the package is `require`d

/**
* This const serves no purpose besides being an identifier for this file that the SDK multiplexer loader can use to
* determine that this is in fact a file that wants to be multiplexed.
*/
export const _SENTRY_SDK_MULTIPLEXER = true;
50 changes: 50 additions & 0 deletions packages/sveltekit/src/server/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,55 @@
// Node SDK exports
// Unfortunately, we cannot `exprt * from '@sentry/node'` because in prod builds,
// Vite puts these exports into a `default` property (Sentry.default) rather than
// on the top - level namespace.
// Hence, we export everything from the Node SDK explicitly:
export {
addGlobalEventProcessor,
addBreadcrumb,
captureException,
captureEvent,
captureMessage,
configureScope,
createTransport,
extractTraceparentData,
getActiveTransaction,
getHubFromCarrier,
getCurrentHub,
Hub,
makeMain,
Scope,
startTransaction,
SDK_VERSION,
setContext,
setExtra,
setExtras,
setTag,
setTags,
setUser,
spanStatusfromHttpCode,
trace,
withScope,
autoDiscoverNodePerformanceMonitoringIntegrations,
makeNodeTransport,
defaultIntegrations,
defaultStackParser,
lastEventId,
flush,
close,
getSentryRelease,
addRequestDataToEvent,
DEFAULT_USER_INCLUDES,
extractRequestData,
deepReadDirSync,
Integrations,
Handlers,
} from '@sentry/node';

// We can still leave this for the carrier init and type exports
export * from '@sentry/node';

// -------------------------
// SvelteKit SDK exports:
export { init } from './sdk';
export { handleErrorWithSentry } from './handleError';
export { wrapLoadWithSentry } from './load';
Expand Down