@intlayer/config
Version:
Retrieve Intlayer configurations and manage environment variables for both server-side and client-side environments.
31 lines (30 loc) • 1.41 kB
TypeScript
import { IntlayerConfig } from "@intlayer/types/config";
//#region src/envVars/envVars.d.ts
/**
* Converts a list of unused NodeType keys into env-var definitions.
* Set to `"false"` so bundlers can eliminate the corresponding plugin code.
*
* @example
* formatNodeTypeToEnvVar(['enumeration'])
* // { 'INTLAYER_NODE_TYPE_ENUMERATION': '"false"' }
*
* formatNodeTypeToEnvVar(['reactNode'], (k) => `process.env.${k}`, (v) => `"${v}"`)
* // { 'process.env.INTLAYER_NODE_TYPE_REACT_NODE': '"false"' }
*/
declare const formatNodeTypeToEnvVar: (nodeTypes: string[], wrapKey?: (key: string) => string, wrapValue?: (value: string) => string) => Record<string, string>;
/**
* Returns env-var definitions for the full Intlayer config to be injected at
* build time. Allows bundlers to dead-code-eliminate unused routing modes,
* rewrite logic, storage mechanisms, and editor code.
*
* @example
* getConfigEnvVars(config)
* // { INTLAYER_ROUTING_MODE: '"prefix-no-default"', INTLAYER_ROUTING_REWRITE_RULES: '"false"', ... }
*
* getConfigEnvVars(config, true)
* // { 'process.env.INTLAYER_ROUTING_MODE': '"prefix-no-default"', ... }
*/
declare const getConfigEnvVars: (config: IntlayerConfig, wrapKey?: (key: string) => string, wrapValue?: (value: string) => string) => Record<string, string>;
//#endregion
export { formatNodeTypeToEnvVar, getConfigEnvVars };
//# sourceMappingURL=envVars.d.ts.map