File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import {
22 ENABLE_STATIC_EXPORT ,
3- IS_DEV_ENV ,
43 NEXT_DATA_URL ,
5- VERCEL_ENV ,
6- VERCEL_REGION ,
4+ IS_NOT_VERCEL_RUNTIME_ENV ,
75} from '@/next.constants.mjs' ;
86import type { BlogCategory , BlogPostsRSC } from '@/types' ;
97
108const getBlogData = (
119 cat : BlogCategory ,
1210 page ?: number
1311) : Promise < BlogPostsRSC > => {
14- const IS_NOT_VERCEL_RUNTIME_ENV =
15- ( ! IS_DEV_ENV && VERCEL_ENV && ! VERCEL_REGION ) ||
16- ( ! IS_DEV_ENV && ! VERCEL_ENV ) ;
17-
1812 // When we're using Static Exports the Next.js Server is not running (during build-time)
1913 // hence the self-ingestion APIs will not be available. In this case we want to load
2014 // the data directly within the current thread, which will anyways be loaded only once
Original file line number Diff line number Diff line change 11import {
22 ENABLE_STATIC_EXPORT ,
3- IS_DEV_ENV ,
43 NEXT_DATA_URL ,
5- VERCEL_ENV ,
6- VERCEL_REGION ,
4+ IS_NOT_VERCEL_RUNTIME_ENV ,
75} from '@/next.constants.mjs' ;
86import { availableLocaleCodes } from '@/next.locales.mjs' ;
97import type { DownloadSnippet } from '@/types' ;
@@ -17,10 +15,6 @@ export default async function getDownloadSnippets(
1715 return [ ] ;
1816 }
1917
20- const IS_NOT_VERCEL_RUNTIME_ENV =
21- ( ! IS_DEV_ENV && VERCEL_ENV && ! VERCEL_REGION ) ||
22- ( ! IS_DEV_ENV && ! VERCEL_ENV ) ;
23-
2418 // When we're using Static Exports the Next.js Server is not running (during build-time)
2519 // hence the self-ingestion APIs will not be available. In this case we want to load
2620 // the data directly within the current thread, which will anyways be loaded only once
Original file line number Diff line number Diff line change 11import {
22 ENABLE_STATIC_EXPORT ,
3- IS_DEV_ENV ,
43 NEXT_DATA_URL ,
5- VERCEL_ENV ,
6- VERCEL_REGION ,
4+ IS_NOT_VERCEL_RUNTIME_ENV ,
75} from '@/next.constants.mjs' ;
86import type { NodeRelease } from '@/types' ;
97
108const getReleaseData = ( ) : Promise < Array < NodeRelease > > => {
11- const IS_NOT_VERCEL_RUNTIME_ENV =
12- ( ! IS_DEV_ENV && VERCEL_ENV && ! VERCEL_REGION ) ||
13- ( ! IS_DEV_ENV && ! VERCEL_ENV ) ;
14-
159 // When we're using Static Exports the Next.js Server is not running (during build-time)
1610 // hence the self-ingestion APIs will not be available. In this case we want to load
1711 // the data directly within the current thread, which will anyways be loaded only once
Original file line number Diff line number Diff line change @@ -23,6 +23,18 @@ export const VERCEL_ENV = process.env.VERCEL_ENV || undefined;
2323 */
2424export const VERCEL_REGION = process . env . VERCEL_REGION || undefined ;
2525
26+ /**
27+ * This constant determines if the current environment is NOT a Vercel runtime environment.
28+ *
29+ * The logic is as follows:
30+ * - If we are NOT in a development environment (`!IS_DEV_ENV`) AND:
31+ * - Vercel environment variable (`VERCEL_ENV`) is defined but the Vercel region (`VERCEL_REGION`) is NOT defined, OR
32+ * - Vercel environment variable (`VERCEL_ENV`) is NOT defined at all.
33+ * This helps identify cases where the application is running outside of Vercel's runtime environment.
34+ */
35+ export const IS_NOT_VERCEL_RUNTIME_ENV =
36+ ! IS_DEV_ENV && ( ( VERCEL_ENV && ! VERCEL_REGION ) || ! VERCEL_ENV ) ;
37+
2638/**
2739 * This is used for telling Next.js to do a Static Export Build of the Website
2840 *
You can’t perform that action at this time.
0 commit comments