(lines: string, options?: {
readonly expandVariables?: boolean | undefined
readonly preserveEmptyStrings?: boolean | undefined
})
| 1044 | * @since 4.0.0 |
| 1045 | */ |
| 1046 | export function fromDotEnvContents(lines: string, options?: { |
| 1047 | readonly expandVariables?: boolean | undefined |
| 1048 | readonly preserveEmptyStrings?: boolean | undefined |
| 1049 | }): ConfigProvider { |
| 1050 | let env = parseDotEnvContents(lines) |
| 1051 | if (options?.expandVariables) { |
| 1052 | env = dotEnvExpand(env) |
| 1053 | } |
| 1054 | return fromEnvRecord(env, { preserveEmptyStrings: options?.preserveEmptyStrings }) |
| 1055 | } |
| 1056 | |
| 1057 | const DOT_ENV_LINE = |
| 1058 | /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg |
no test coverage detected