postcss: Make the resource cache key more stable

By using the input map as the basis, which means the hash will not change if we add/rename/remove options.

This happened in Hugo 0.99, as we added a new options. This is unortunate.

Unfortunately this means that the cache keys for PostCSS will change one more time in 0.100, but will be stable going forward.

Note that we have implemented this pattern in all the other resource transformers.

Updates #9787
This commit is contained in:
Bjørn Erik Pedersen
2022-05-27 17:01:35 +02:00
parent 653ab2cc1f
commit 46a2ea6d0d
3 changed files with 25 additions and 23 deletions

View File

@@ -31,14 +31,14 @@ import (
// Issue 6166
func TestDecodeOptions(t *testing.T) {
c := qt.New(t)
opts1, err := DecodeOptions(map[string]any{
opts1, err := decodeOptions(map[string]any{
"no-map": true,
})
c.Assert(err, qt.IsNil)
c.Assert(opts1.NoMap, qt.Equals, true)
opts2, err := DecodeOptions(map[string]any{
opts2, err := decodeOptions(map[string]any{
"noMap": true,
})