UNPKG

2.4 kBTypeScriptView Raw
1/**
2 * This should only be necessary when you or a package mutates the environment variables.
3 * The `mainFn` / `mainTestFn` / `mainBenchFn` / ... will call this function by default
4 * after loading your `.env` file.
5 *
6 * Accessing an environment variable via `process.env.XXXX` is relatively slow compared
7 * to direct property access. As can be seen in the following benchmark:
8 *
9 * ```txt
10 * property access 500000000 iterations 0 ns/op
11 * process.env access 5000000 iterations 246 ns/op
12 * ```
13 *
14 * See this thread: https://github.com/nodejs/node/issues/3104 for more information.
15 *
16 * @since 0.1.0
17 * @summary Repopulate the cached environment copy.
18 *
19 * @returns {void}
20 */
21export function refreshEnvironmentCache(): void;
22/**
23 * Returns true when the `NODE_ENV` variable is not set, or when it does not equal to
24 * `development`. This allows for a 'safe by default' experience.
25 *
26 * @since 0.1.0
27 *
28 * @returns {boolean}
29 */
30export function isProduction(): boolean;
31/**
32 * Returns true when `NODE_ENV` is explicitly set to 'development' or when the
33 * environment variable `IS_STAGING` is explicitly set to 'true'.
34 *
35 * @since 0.1.0
36 *
37 * @returns {boolean}
38 */
39export function isStaging(): boolean;
40/**
41 * Try to calculate the CORS_URL environment variable from the APP_URL environment
42 * variable. Assumes the APP_URL is in the following format: http(s)://api.xxx.xx.com and
43 * generates the following CORS_URL value: http(s)://xxx.xx.com.
44 * If the APP_URL host only contains xxx.com the CORS_URL value will be equivalent.
45 *
46 * Refreshing the environment cache via `refreshEnvironmentCache` is not necessary.
47 *
48 * @since 0.1.0
49 *
50 * @returns {void}
51 */
52export function calculateCorsUrlFromAppUrl(): void;
53/**
54 * Try to calculate the COOKIE_URL environment variable from the APP_URL environment
55 * variable. Assumes the APP_URL is in the following format: http(s)://api.xxx.xx.com and
56 * generates the following COOKIE_URL value: xxx.xx.com.
57 * If the APP_URL host only contains xxx.com the CORS_URL value will be equivalent.
58 *
59 * Refreshing the environment cache via `refreshEnvironmentCache` is not necessary.
60 *
61 * @since 0.1.0
62 *
63 * @returns {void}
64 */
65export function calculateCookieUrlFromAppUrl(): void;
66/**
67 * Cached process.env
68 *
69 * @type {Record<string, string>}
70 */
71export let environment: Record<string, string>;
72//# sourceMappingURL=env.d.ts.map
\No newline at end of file