New variables engine by medikoo · Pull Request #8987 · serverless/serverless

Addresses 2.2.0 from #8364 and major part of #7207

  • New implementation of Variables parser and resolver, backed with 100% tests coverage
  • New implementation of variable sources: self, opt, env, strToBool and file
  • Configuration of first variable resolution phase, which attempts to resolve from configured sources before we resolve eventual additional environment variables from .env files
  • Rename old variables fixture to variables-legacy, and introduce new variables fixture

I mark it more as enhancement than refactor, as it's not a 1:1 refactor, but vastly improved resolution logic which changed how some edge cases are handled (e.g. we will no longer support self: variable, and there's built-in reliable prevention of circular references). Additionally it fixes many reported bugs, which were more design bugs of so currently implemented resolver

Fixes: #7921, #7807, #6214, #6022, #6014, #5828, #5759, #5278, #5136, #4837, #4817

Additionally @serverless/test was updated to rely on new resolver: https://github.com/serverless/test/pull/82