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

optimize __createBinding #168

Merged
merged 1 commit into from Feb 8, 2022
Merged

optimize __createBinding #168

merged 1 commit into from Feb 8, 2022

Commits on Jan 14, 2022

  1. optimize __createBinding

    Reflect microsoft/TypeScript#46997:
    
    When the binding is itself one that was created by `__createBinding`,
    re-use its descriptor, which avoids piling multiple levels of getters in
    the case of multiple levels of exports.
    
    In addition, reuse a descriptor if the bindings is marked as
    non-writable and non-configurable, which makes a getter not
    necessary.  (This can be done manually if needed, even though tsc
    doesn't do it now.)
    
    Could be considered as a fix for #165 -- first, this PR prevents piling
    up multiple layers of getters.  Second, it allows a hack of adding
    
        if (typeof exports === "object") exports = Object.freeze(exports);
    
    to avoid getters altogether.  (And in the future, tsc could mark `const`
    exports as non-writable and non-configurable which would make it
    possible to avoid this hack.)
    elibarzilay committed Jan 14, 2022
    Copy the full SHA
    5ad0250 View commit details
    Browse the repository at this point in the history