adobe / react-spectrum

A collection of libraries and tools that help you build adaptive, accessible, and robust user experiences.
https://react-spectrum.adobe.com
Apache License 2.0
12.84k stars 1.11k forks source link

Emit human-readable names for classes, functions, etc. in @internationalized/date package #6808

Open dcastil opened 2 months ago

dcastil commented 2 months ago

Provide a general summary of the feature here

Hey everyone, thanks for the @internationalized/date package, I love it!

When inspecting varying class instances during debugging, e.g. by logging to the console, JS engines usually display the name of the class which helps with figuring out what kind of object I'm dealing with.

Screenshot 2024-07-31 at 14 27 26

However, when I inspect objects from the @internationalized/date package, the class names appear as an ID that isn't human-readable. That makes it more difficult to differentiate between object types, especially if their properties are similar like in the case of CalendarDateTime and ZonedDateTime.

Screenshot 2024-07-31 at 14 31 56

Would be awesome if it were possible to preserve the original class names in the bundle to keep them human-readable during runtime inspection.

🤔 Expected Behavior?

Emit human-readable class names in the bundle which leads to human-readable classes during runtime inspection.

😯 Current Behavior

Class names are replaced with long IDs that makes it difficult to differentiate between the different classes.

💁 Possible Solution

Didn't dig too much into it but there is probably an option to preserve names as much as possible in Parcel. I could also look into it deeper if this is desired.

🔦 Context

I use ZonedDateTime and CalendarDate in a codebase and sometimes log those objects to the console during debugging. That results in those IDs being logged and I have to either log additional info or click into every single object to figure out the class the object belongs to.

💻 Examples

No response

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

reidbarber commented 2 months ago

Related to https://github.com/adobe/react-spectrum/issues/5154