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

esm: add initialize hook #1

Closed
wants to merge 4 commits into from

Commits on Jul 18, 2023

  1. src: fix nullptr access on realm

    Adding the per-realm binding data tracking introduced a call to a realm
    method when realm was potentially null. This is triggered whenever the
    function is called from `ContextifyContext::New` which passes `nullptr`
    as the `realm`.
    
    PR-URL: nodejs#48802
    Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
    Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
    Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
    Reviewed-By: Tobias Nießen <tniessen@tnie.de>
    jkrems authored Jul 18, 2023
    Configuration menu
    Copy the full SHA
    567e32b View commit details
    Browse the repository at this point in the history

Commits on Jul 19, 2023

  1. doc: refactor node-api support matrix

    - refactor table so that it does not grow for
      every new version of Node.js
    - refer to latest version of table as the canonical
      reference
    - add info for Node-API v9
    
    Refs: nodejs#48277
    
    Signed-off-by: Michael Dawson <mdawson@devrus.com>
    PR-URL: nodejs#48774
    Reviewed-By: Richard Lau <rlau@redhat.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    mhdawson authored Jul 19, 2023
    Configuration menu
    Copy the full SHA
    38cc538 View commit details
    Browse the repository at this point in the history
  2. esm: unflag Module.register and allow nested loader import()

    Major functional changes:
    
    - Allow `import()` to work within loaders that require other loaders,
    - Unflag the use of `Module.register`.
    
    A new interface `Customizations` has been created in order to unify
    `ModuleLoader` (previously `DefaultModuleLoader`), `Hooks` and
    `CustomizedModuleLoader` all of which now implement it:
    
    ```ts
    interface LoadResult {
      format: ModuleFormat;
      source: ModuleSource;
    }
    
    interface ResolveResult {
      format: string;
      url: URL['href'];
    }
    
    interface Customizations {
      allowImportMetaResolve: boolean;
      load(url: string, context: object): Promise<LoadResult>
      resolve(
        originalSpecifier:
        string, parentURL: string,
        importAssertions: Record<string, string>
      ): Promise<ResolveResult>
      resolveSync(
        originalSpecifier:
        string, parentURL: string,
        importAssertions: Record<string, string>
      ) ResolveResult;
      register(specifier: string, parentUrl: string): any;
      forceLoadHooks(): void;
      importMetaInitialize(meta, context, loader): void;
    }
    ```
    
    The `ModuleLoader` class now has `setCustomizations` which takes an
    object of this shape and delegates its responsibilities to this object
    if present.
    
    Note that two properties `allowImportMetaResolve` and `resolveSync`
    exist now as a mechanism for `import.meta.resolve` – since `Hooks`
    does not implement `resolveSync` other loaders cannot use
    `import.meta.resolve`; `allowImportMetaResolve` is a way of checking
    for that case instead of invoking `resolveSync` and erroring.
    
    Fixes nodejs#48515
    Closes nodejs#48439
    
    PR-URL: nodejs#48559
    Reviewed-By: Jacob Smith <jacob@frende.me>
    Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
    izaakschroeder authored Jul 19, 2023
    Configuration menu
    Copy the full SHA
    a2fc4a3 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ddfa9d4 View commit details
    Browse the repository at this point in the history