import { stringify } from "javascript-stringify";
const ENV_REGEX = /\$env\(([a-zA-Z0-9_]+)\)/;
const replacer = (value, _indent, stringify) => {
    if (typeof value === "string" && ENV_REGEX.test(value)) {
        return value
            .split(new RegExp(ENV_REGEX, "g"))
            .map((varName, i) => i % 2 ? `process.env.${varName}` : varName && JSON.stringify(varName))
            .filter(Boolean)
            .join(" + ");
    }
    return stringify(value);
};
export const stringifyConfig = (val) => stringify(val, replacer, 2);
//# sourceMappingURL=stringify-config.js.map