@@ -28,6 +28,21 @@ export function SdkOption({
2828 categorySupported = [ ] ,
2929} : Props ) {
3030 const { showBrowserOnly, showServerLikeOnly} = getPlatformHints ( categorySupported ) ;
31+ const { rootNode, path} = serverContext ( ) ;
32+ const currentPlatformOrGuide = getCurrentPlatformOrGuide ( rootNode , path ) ;
33+ const shouldShowEnvVar = ( ) => {
34+ if ( ! currentPlatformOrGuide ) return false ;
35+
36+ const isServerPlatform =
37+ currentPlatformOrGuide . categories ?. includes ( 'server' ) ||
38+ currentPlatformOrGuide . categories ?. includes ( 'serverless' ) ;
39+
40+ const isExcludedPlatform =
41+ currentPlatformOrGuide . key === 'javascript.nextjs' ||
42+ currentPlatformOrGuide . key === 'javascript.svelte' ;
43+
44+ return isServerPlatform && ! isExcludedPlatform ;
45+ } ;
3146
3247 return (
3348 < SdkDefinition name = { name } categorySupported = { categorySupported } >
@@ -39,11 +54,10 @@ export function SdkOption({
3954 { defaultValue && (
4055 < OptionDefRow label = "Default" value = { defaultValue } note = { defaultNote } />
4156 ) }
42- < PlatformCategorySection supported = { [ 'server' , 'serverless' ] } >
43- < PlatformSection notSupported = { [ 'javascript.nextjs' , 'javascript.sveltekit' ] } >
44- { envVar && < OptionDefRow label = "ENV Variable" value = { envVar } /> }
45- </ PlatformSection >
46- </ PlatformCategorySection >
57+
58+ { shouldShowEnvVar ( ) && envVar && (
59+ < OptionDefRow label = "ENV Variable" value = { envVar } />
60+ ) }
4761
4862 { showBrowserOnly && < OptionDefRow label = "Only available on" value = "Client" /> }
4963 { showServerLikeOnly && < OptionDefRow label = "Only available on" value = "Server" /> }
@@ -79,6 +93,8 @@ export function getPlatformHints(categorySupported: PlatformCategory[]) {
7993 const currentPlatformOrGuide = getCurrentPlatformOrGuide ( rootNode , path ) ;
8094 const currentCategories = currentPlatformOrGuide ?. categories || [ ] ;
8195
96+ console . log ( 'yoo' , currentPlatformOrGuide ?. key ) ;
97+
8298 // We only handle browser, server & serverless here for now
8399 const currentIsBrowser = currentCategories . includes ( 'browser' ) ;
84100 const currentIsServer = currentCategories . includes ( 'server' ) ;
0 commit comments