-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fc7ef13
commit 5759d0a
Showing
2 changed files
with
64 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { GLOBAL_OBJ } from '@sentry/utils'; | ||
|
||
import type { FutureConfig, ServerBuild } from './types'; | ||
|
||
export type EnhancedGlobal = typeof GLOBAL_OBJ & { | ||
__remixContext?: { | ||
future?: FutureConfig; | ||
}; | ||
}; | ||
|
||
/** | ||
* Get the future flags from the Remix browser context | ||
* | ||
* @returns The future flags | ||
*/ | ||
export function getFutureFlagsBrowser(): FutureConfig | undefined { | ||
const window = GLOBAL_OBJ as EnhancedGlobal; | ||
|
||
if (!window.__remixContext) { | ||
return; | ||
} | ||
|
||
return window.__remixContext.future; | ||
} | ||
|
||
/** | ||
* Get the future flags from the Remix server build | ||
* | ||
* @param build The Remix server build | ||
* | ||
* @returns The future flags | ||
*/ | ||
export function getFutureFlagsServer(build: ServerBuild): FutureConfig | undefined { | ||
return build.future; | ||
} |
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