File tree Expand file tree Collapse file tree 2 files changed +64
-0
lines changed Expand file tree Collapse file tree 2 files changed +64
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { GLOBAL_OBJ } from '@sentry/utils' ;
2
+
3
+ import type { FutureConfig , ServerBuild } from './types' ;
4
+
5
+ export type EnhancedGlobal = typeof GLOBAL_OBJ & {
6
+ __remixContext ?: {
7
+ future ?: FutureConfig ;
8
+ } ;
9
+ } ;
10
+
11
+ /**
12
+ * Get the future flags from the Remix browser context
13
+ *
14
+ * @returns The future flags
15
+ */
16
+ export function getFutureFlagsBrowser ( ) : FutureConfig | undefined {
17
+ const window = GLOBAL_OBJ as EnhancedGlobal ;
18
+
19
+ if ( ! window . __remixContext ) {
20
+ return ;
21
+ }
22
+
23
+ return window . __remixContext . future ;
24
+ }
25
+
26
+ /**
27
+ * Get the future flags from the Remix server build
28
+ *
29
+ * @param build The Remix server build
30
+ *
31
+ * @returns The future flags
32
+ */
33
+ export function getFutureFlagsServer ( build : ServerBuild ) : FutureConfig | undefined {
34
+ return build . future ;
35
+ }
Original file line number Diff line number Diff line change @@ -14,6 +14,34 @@ import type * as Express from 'express';
14
14
import type { Agent } from 'https' ;
15
15
import type { ComponentType } from 'react' ;
16
16
17
+ type Dev = {
18
+ command ?: string ;
19
+ scheme ?: string ;
20
+ host ?: string ;
21
+ port ?: number ;
22
+ restart ?: boolean ;
23
+ tlsKey ?: string ;
24
+ tlsCert ?: string ;
25
+ } ;
26
+
27
+ export interface FutureConfig {
28
+ unstable_dev : boolean | Dev ;
29
+ /** @deprecated Use the `postcss` config option instead */
30
+ unstable_postcss : boolean ;
31
+ /** @deprecated Use the `tailwind` config option instead */
32
+ unstable_tailwind : boolean ;
33
+ v2_errorBoundary : boolean ;
34
+ v2_headers : boolean ;
35
+ v2_meta : boolean ;
36
+ v2_normalizeFormMethod : boolean ;
37
+ v2_routeConvention : boolean ;
38
+ }
39
+
40
+ export interface RemixConfig {
41
+ [ key : string ] : any ;
42
+ future : FutureConfig ;
43
+ }
44
+
17
45
export type RemixRequestState = {
18
46
method : string ;
19
47
redirect : RequestRedirect ;
@@ -133,6 +161,7 @@ export interface ServerBuild {
133
161
assets : AssetsManifest ;
134
162
publicPath ?: string ;
135
163
assetsBuildDirectory ?: string ;
164
+ future ?: FutureConfig ;
136
165
}
137
166
138
167
export interface HandleDocumentRequestFunction {
You can’t perform that action at this time.
0 commit comments