fix: invalid middleware configs should fail the build (#80221)
In #68638 we intended to fail the build if an invalid matcher
configuration was provided by importing a shared constant from the
static page analysis fn. This worked fine for segment validations for
pages/route handlers. However, the build would incorrectly succeed in
the case of an invalid middleware config, because we were checking too
early (the middleware is evaluated later). This is bad because it would
actually ignore the invalid value, and instead fallback to a greedy
catch-all match, which would invoke middleware for any path.
This updates the return shape of the static page info to signal whether
an invalid configuration was detected rather than relying on a shared
const, and adds errors to the appropriate places so that the build will
correctly fail. This PR includes a test with invalid middleware to
validate the behavior.