-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(nextjs): Make Next.js types isomorphic #6707
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
Changes from all commits
7e5765a
a91da16
9fb471d
89f5e79
0ec7960
7af6c7b
14469f6
4a6acd7
2be79a5
77078ca
7417c54
22a2009
7774fa5
339f4bc
74d845e
6b033d4
7337595
837fe92
8f837a4
f8e6d72
ce5df30
c35b7d7
c594c2f
490ce16
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export type { SentryWebpackPluginOptions } from './types'; | ||
export { withSentryConfig } from './withSentryConfig'; |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './config'; | ||
export * from './server'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* eslint-disable import/export */ | ||
|
||
// We export everything from both the client part of the SDK and from the server part. Some of the exports collide, | ||
// which is not allowed, unless we redifine the colliding exports in this file - which we do below. | ||
export * from './config'; | ||
export * from './client'; | ||
export * from './server'; | ||
|
||
import type { Integration, Options, StackParser } from '@sentry/types'; | ||
|
||
import type { BrowserOptions } from './client'; | ||
import * as clientSdk from './client'; | ||
import type { NodeOptions } from './server'; | ||
import * as serverSdk from './server'; | ||
|
||
/** Initializes Sentry Next.js SDK */ | ||
export declare function init(options: Options | BrowserOptions | NodeOptions): void; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. l: Can this just be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I would also do it that way but we defined it as such up until now and didn't want this PR to turn into a breaking change. |
||
|
||
// We export a merged Integrations object so that users can (at least typing-wise) use all integrations everywhere. | ||
export const Integrations = { ...clientSdk.Integrations, ...serverSdk.Integrations }; | ||
AbhiPrasad marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
export declare const defaultIntegrations: Integration[]; | ||
export declare const defaultStackParser: StackParser; | ||
|
||
// This variable is not a runtime variable but just a type to tell typescript that the methods below can either come | ||
// from the client SDK or from the server SDK. TypeScript is smart enough to understand that these resolve to the same | ||
// methods from `@sentry/core`. | ||
declare const runtime: 'client' | 'server'; | ||
|
||
export const close = runtime === 'client' ? clientSdk.close : serverSdk.close; | ||
export const flush = runtime === 'client' ? clientSdk.flush : serverSdk.flush; | ||
export const lastEventId = runtime === 'client' ? clientSdk.lastEventId : serverSdk.lastEventId; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { NEXT_PHASE_PRODUCTION_BUILD } from './phases'; | ||
import { PHASE_PRODUCTION_BUILD } from 'next/constants'; | ||
|
||
/** | ||
* Decide if the currently running process is part of the build phase or happening at runtime. | ||
*/ | ||
export function isBuild(): boolean { | ||
return process.env.NEXT_PHASE === NEXT_PHASE_PRODUCTION_BUILD; | ||
return process.env.NEXT_PHASE === PHASE_PRODUCTION_BUILD; | ||
} |
Uh oh!
There was an error while loading. Please reload this page.