{"version":3,"sources":["../../src/config/build.ts"],"sourcesContent":["import type { Config, SanitizedConfig } from './types.js'\n\nimport { sanitizeConfig } from './sanitize.js'\n\n/**\n * @description Builds and validates Payload configuration\n * @param config Payload Config\n * @returns Built and sanitized Payload Config\n */\nexport async function buildConfig(config: Config): Promise<SanitizedConfig> {\n  if (Array.isArray(config.plugins)) {\n    const sorted = [...config.plugins].sort((a, b) => (a.order ?? 0) - (b.order ?? 0))\n\n    for (const plugin of sorted) {\n      config = await plugin(config)\n    }\n  }\n\n  return await sanitizeConfig(config)\n}\n"],"names":["sanitizeConfig","buildConfig","config","Array","isArray","plugins","sorted","sort","a","b","order","plugin"],"mappings":"AAEA,SAASA,cAAc,QAAQ,gBAAe;AAE9C;;;;CAIC,GACD,OAAO,eAAeC,YAAYC,MAAc;IAC9C,IAAIC,MAAMC,OAAO,CAACF,OAAOG,OAAO,GAAG;QACjC,MAAMC,SAAS;eAAIJ,OAAOG,OAAO;SAAC,CAACE,IAAI,CAAC,CAACC,GAAGC,IAAM,AAACD,CAAAA,EAAEE,KAAK,IAAI,CAAA,IAAMD,CAAAA,EAAEC,KAAK,IAAI,CAAA;QAE/E,KAAK,MAAMC,UAAUL,OAAQ;YAC3BJ,SAAS,MAAMS,OAAOT;QACxB;IACF;IAEA,OAAO,MAAMF,eAAeE;AAC9B"}