-
-
Notifications
You must be signed in to change notification settings - Fork 599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(json)!: log more robustly when JSON parsing fails #1361
Conversation
What's the new error logging look like? |
Here it is now. Note the warning is now actually a warning and not a hard crash, so all the other warnings get properly reported:
|
Shouldn't the build halt when there's a problem parsing a file though? |
I think so too, though I wasn't bold enough to make that change until you mentioned it :-) |
@shellscape would you mind updating the changelog to highlight the fact that this PR changed from this.warn to this.error? The former logs a warning, the latter fails the build, which isn't immediately obvious from
|
you found the PR from the changelog, so the system is working as intended. did this break your build where a parsing failure was previously continuing on? and if so, what use case is there for ignoring that warning? |
i found it after following a link to the changelog in a PR opened by renovate to update @sveltejs/adapter-node an adapter to run sveltekit applications with nodejs. it uses the json plugin as a dependency, so bumping that can be a minor if it was just log formatting, but adding new fails could require a breaking release for that. I was confused why a change in logging was marked as breaking, so i found this by digging. People less careful who might attribute this to breaking some log parsers might just update and wonder why their build suddenly fails. Note: I completely agree with the change itself, was just wondering if there is something that can be improved in documenting it in the changelog. If you think the current entry is fine, i won't bother sending a PR, sorry for the noise. edit: included a link |
thanks for raising your concern. The reason we link to pull requests in the change log is so that authors can describe a change in their own way. that gives contributors some agency. very occasionally we will step in to editorialize a little bit. I don't think we need a change right now, but if more users raise concerns we would definitely rethink that |
Rollup Plugin Name:
parse-json
This PR contains:
Are tests included?
Breaking Changes?
If yes, then include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.
List any relevant issue numbers:
Description
Previously, when JSON failed to parse (say it was transformed by another plugin), you would get a message like below. The json plugin fails to parse, and, because the error message doesn't match the
/[\d]/
regex, you get an uninformative warning message. Even if the regex did match, it would only match the first digit, not the whole line number.