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

module: detect ESM syntax by trying to recompile as SourceTextModule #52413

Merged
merged 1 commit into from
Apr 19, 2024

Commits on Apr 18, 2024

  1. module: detect ESM syntax by trying to recompile as SourceTextModule

    Instead of using an async function wrapper, just try compiling code with
    unknown module format as SourceTextModule when it cannot be compiled
    as CJS and the error message indicates that it's worth a retry. If
    it can be parsed as SourceTextModule then it's considered ESM.
    
    Also, move shouldRetryAsESM() to C++ completely so that
    we can reuse it in the CJS module loader for require(esm).
    
    Drive-by: move methods that don't belong to ContextifyContext
    out as static methods and move GetHostDefinedOptions to
    ModuleWrap.
    joyeecheung committed Apr 18, 2024
    Configuration menu
    Copy the full SHA
    14afc5a View commit details
    Browse the repository at this point in the history