Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: add get trap to Proxy for agnostic prototype access#779

Merged
markstos merged 4 commits intonode-config:masterfrom
daleyjem:feature/proxy-get
Jan 6, 2025
Merged

feat: add get trap to Proxy for agnostic prototype access#779
markstos merged 4 commits intonode-config:masterfrom
daleyjem:feature/proxy-get

Conversation

@daleyjem
Copy link
Contributor

@daleyjem daleyjem commented Dec 18, 2024

Changes

  • Adds get trap in util.makeImmutables Proxy config
  • Add tests to confirm immutability
  • Adds a vows script so that individual test files can be run
  • Adds test to assert serialization with JSON.stringify

@daleyjem daleyjem marked this pull request as draft December 18, 2024 06:09
@daleyjem daleyjem changed the title feat: add Proxy 'get' feat: add Proxy 'get' for bypassing receiver Dec 18, 2024
@daleyjem daleyjem changed the title feat: add Proxy 'get' for bypassing receiver feat: add get trap to Proxy for agnostic prototype access Dec 18, 2024
@daleyjem daleyjem marked this pull request as ready for review December 18, 2024 06:17
@daleyjem daleyjem marked this pull request as draft December 18, 2024 06:21
@daleyjem daleyjem marked this pull request as ready for review December 20, 2024 13:57
@markstos
Copy link
Collaborator

markstos commented Jan 6, 2025

Looks like an excellent approach with maximum immutability and minimal exceptions. Let's try it.

@markstos markstos merged commit 1980004 into node-config:master Jan 6, 2025
@jeremy-daley-kr
Copy link
Contributor

Sweet! Thanks again, @markstos

@markstos
Copy link
Collaborator

markstos commented Jan 7, 2025

@jeremy-daley-kr I found there was a competing PR submitted to handle the binary type mangling:

#762

That PR returns a the binary object as a Uint8Array, while your PR returns the binary object as a Buffer that contains Uint8Array's. This was reflected when I tried to merge both and got this test failure about the different types:

  • secret: Buffer(6) [Uint8Array] [
  • secret: Uint8Array(6) [

Returning Uint8Array(6) seems simpler and preferable. Could you review why this is returning a buffer instead?

@daleyjem
Copy link
Contributor Author

daleyjem commented Jan 8, 2025

@markstos I might be a bit confused what the expected behavior is then, because this is the repo that was linked from @Maia-Everett original issue (#761), and it uses Buffer.from to assert equality:
https://codeberg.org/Linneris/config-yaml-binary-bug/src/branch/main/src/index.js

@daleyjem
Copy link
Contributor Author

daleyjem commented Jan 8, 2025

@markstos Also, I just checked out v3.3.7 (before the Proxy stuff was added), and added the test snippet you linked to... It gives Buffer(6) [Uint8Array].

@daleyjem
Copy link
Contributor Author

daleyjem commented Jan 8, 2025

Since that's a new feature request/breaking change, can you consider publishing a new release in the meantime?

@jeremy-daley-kr
Copy link
Contributor

@markstos Friendly bump ^^

@markstos
Copy link
Collaborator

markstos commented Apr 7, 2025

@jdmarshall has been added as a co-maintainer to help move things along. We are evaluating plans for the next release now. Thanks for your patience with our volunteer team.

@daleyjem
Copy link
Contributor Author

daleyjem commented Apr 7, 2025

@jdmarshall has been added as a co-maintainer to help move things along. We are evaluating plans for the next release now. Thanks for your patience with our volunteer team.

Thanks, @markstos !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] YAML binary type is mangled

3 participants