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

Fix namespaced object export when default is the only one available #4058

Merged
merged 11 commits into from
Nov 15, 2024

Commits on Nov 14, 2024

  1. Refactor to a switch

    This allows us to work with a more go way of working with conditional
    branching.
    ankur22 committed Nov 14, 2024
    Configuration menu
    Copy the full SHA
    68a2440 View commit details
    Browse the repository at this point in the history
  2. Add conversion from default to namspaced object

    If no named exports are available, we want to try and convert the
    default export to named exports. This allows users to work with
    namespaced objects even through the module hasn't been setup to work in
    that way. This is how node works too.
    ankur22 committed Nov 14, 2024
    Configuration menu
    Copy the full SHA
    efb0611 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ac530c6 View commit details
    Browse the repository at this point in the history
  4. Update to work with nil check over len

    This is to stay consistent with other areas of the codebase
    (e.g. toESModuleExports). There could be a valid case where we want
    named to be an empty slice and default be non-nil, and not use this
    feature to convert from default to namespace exports.
    ankur22 committed Nov 14, 2024
    Configuration menu
    Copy the full SHA
    241af93 View commit details
    Browse the repository at this point in the history
  5. Fix slice make

    It needs to be of length 0 to allow for append from 0.
    ankur22 committed Nov 14, 2024
    Configuration menu
    Copy the full SHA
    134399b View commit details
    Browse the repository at this point in the history
  6. Update to work with ToObject instead of cast

    This is a better and safer way to work with an interface{} type when we
    need to retrieve the property values from the object. Since the
    underlying type of Default could be anything, including a sobek.Value,
    it's better to retrieve it as a sobek.Object instead of a casting.
    ankur22 committed Nov 14, 2024
    Configuration menu
    Copy the full SHA
    296f8c2 View commit details
    Browse the repository at this point in the history
  7. Refactor test into a sub test

    This will allow us to create other tests under the StarImport domain.
    ankur22 committed Nov 14, 2024
    Configuration menu
    Copy the full SHA
    502376b View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    b301b49 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    f492b40 View commit details
    Browse the repository at this point in the history

Commits on Nov 15, 2024

  1. Configuration menu
    Copy the full SHA
    37a78c6 View commit details
    Browse the repository at this point in the history
  2. Update comment

    ankur22 committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    636484f View commit details
    Browse the repository at this point in the history