Skip to content
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

feat: replace fast-safe-stringify with safe-stable-stringify #17251

Merged
merged 7 commits into from Aug 19, 2022

Conversation

RahulGautamSingh
Copy link
Collaborator

Changes

  • add safe-stable-stringify package

Context

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i though we also replace the existing package

@RahulGautamSingh
Copy link
Collaborator Author

RahulGautamSingh commented Aug 18, 2022

The other package is used at one place only and I am not sure what it is used for my guess is sorting config as well:

return JSON.parse(safeStringify(input));

If we can achieve the same with this package then the exhange is possible;

@viceice
Copy link
Member

viceice commented Aug 18, 2022

The other package is used at one place only and I am not sure what it is used for my guess is sorting config as well:

return JSON.parse(safeStringify(input));

If we can achieve the same with this package then the exhange is possible;

should work, but we probably need to disable key sorting there.

Copy link
Collaborator

@rarkins rarkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We used the fast-safe-stringify package because JSON.stringify() hit circular references sometimes, somehow.

If this replacement reorders objects and is used anywhere we process config then it can reorder config in a problematic way

@RahulGautamSingh
Copy link
Collaborator Author

RahulGautamSingh commented Aug 19, 2022

We can configure the stringify method to not reorder (already done).
About circular reference I am not sure which value we want to set them to, these are the possible ones:

circularValue {string|null|undefined|ErrorConstructor} 
Defines the value for circular references. 
Set to undefined, circular properties are not serialized (array entries are replaced with null). 
Set to Error, to throw on circular references. 
Default: [Circular].

https://github.com/BridgeAR/safe-stable-stringify#stringifyconfigureoptions

@rarkins
Copy link
Collaborator

rarkins commented Aug 19, 2022

null for circular is ok

rarkins
rarkins previously approved these changes Aug 19, 2022
@viceice
Copy link
Member

viceice commented Aug 19, 2022

We can configure the stringify method to not reorder (already done). About circular reference I am not sure which value we want to set them to, these are the possible ones:

circularValue {string|null|undefined|ErrorConstructor} 
Defines the value for circular references. 
Set to undefined, circular properties are not serialized (array entries are replaced with null). 
Set to Error, to throw on circular references. 
Default: [Circular].

https://github.com/BridgeAR/safe-stable-stringify#stringifyconfigureoptions

the old fast-safe-stringify uses same default value, so we should leave it for now

@viceice viceice changed the title chore: add package feat: replace fast-safe-stringify with safe-stable-stringify Aug 19, 2022
viceice
viceice previously approved these changes Aug 19, 2022
@RahulGautamSingh RahulGautamSingh dismissed stale reviews from viceice and rarkins via ead363c August 19, 2022 13:25
@rarkins rarkins merged commit f9b2f81 into renovatebot:main Aug 19, 2022
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 32.166.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants