postcss: Fix import error handling

Note that we will now fail if `inlineImports` is enabled and we cannot resolve an import.

You can work around this by either:

* Use url imports or imports with media queries.
* Set `skipInlineImportsNotFound=true` in the options

Also get the argument order in the different NewFileError* funcs in line.

Fixes #9895
This commit is contained in:
Bjørn Erik Pedersen
2022-05-14 15:51:04 +02:00
parent c2fa0a3320
commit 4b189d8fd9
20 changed files with 159 additions and 43 deletions

View File

@@ -588,7 +588,7 @@ func (p *pageState) wrapError(err error) error {
}
}
return herrors.NewFileErrorFromFile(err, filename, filename, p.s.SourceSpec.Fs.Source, herrors.NopLineMatcher)
return herrors.NewFileErrorFromFile(err, filename, p.s.SourceSpec.Fs.Source, herrors.NopLineMatcher)
}
@@ -788,7 +788,7 @@ func (p *pageState) outputFormat() (f output.Format) {
func (p *pageState) parseError(err error, input []byte, offset int) error {
pos := p.posFromInput(input, offset)
return herrors.NewFileError(p.File().Filename(), err).UpdatePosition(pos)
return herrors.NewFileError(err, p.File().Filename()).UpdatePosition(pos)
}
func (p *pageState) pathOrTitle() string {