-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(nextjs): Make Next.js types isomorphic (#6707)
- Loading branch information
Showing
41 changed files
with
124 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
5 changes: 2 additions & 3 deletions
5
packages/nextjs/src/utils/tunnelRoute.ts → packages/nextjs/src/client/tunnelRoute.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './config'; | ||
export * from './server'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
||
// 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 }; | ||
|
||
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
packages/nextjs/src/utils/isBuild.ts → packages/nextjs/src/server/utils/isBuild.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...nfig/wrappers/withSentryGetStaticProps.ts → ...js/src/server/withSentryGetStaticProps.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...entryServerSideDocumentGetInitialProps.ts → ...entryServerSideDocumentGetInitialProps.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.