From 5b3fb438e3f9f88b4679688af5c1bf191b0b254a Mon Sep 17 00:00:00 2001 From: Sergey Chernyshev Date: Thu, 25 Apr 2024 01:54:53 +0200 Subject: [PATCH] typings: fix JSDoc in ESM loader modules PR-URL: https://github.com/nodejs/node/pull/48424 Backport-PR-URL: https://github.com/nodejs/node/pull/50669 Reviewed-By: Jacob Smith Reviewed-By: Mohammed Keyvanzadeh Reviewed-By: Mestery Reviewed-By: Geoffrey Booth --- .../lib/internal/modules/esm/hooks.js | 9 +++++++- .../lib/internal/modules/esm/loader.js | 22 ++----------------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/graal-nodejs/lib/internal/modules/esm/hooks.js b/graal-nodejs/lib/internal/modules/esm/hooks.js index 3a01f7ffb71..5112ece8452 100644 --- a/graal-nodejs/lib/internal/modules/esm/hooks.js +++ b/graal-nodejs/lib/internal/modules/esm/hooks.js @@ -62,6 +62,13 @@ let debug = require('internal/util/debuglog').debuglog('esm', (fn) => { }); +/** + * @typedef {object} ExportedHooks + * @property {Function} globalPreload Global preload hook. + * @property {Function} resolve Resolve hook. + * @property {Function} load Load hook. + */ + /** * @typedef {object} KeyedHook * @property {Function} fn The hook function. @@ -630,7 +637,7 @@ ObjectSetPrototypeOf(HooksProxy.prototype, null); /** * A utility function to pluck the hooks from a user-defined loader. * @param {import('./loader.js).ModuleExports} exports - * @returns {import('./loader.js).ExportedHooks} + * @returns {ExportedHooks} */ function pluckHooks({ globalPreload, diff --git a/graal-nodejs/lib/internal/modules/esm/loader.js b/graal-nodejs/lib/internal/modules/esm/loader.js index 2c48702a381..9eb05c020cb 100644 --- a/graal-nodejs/lib/internal/modules/esm/loader.js +++ b/graal-nodejs/lib/internal/modules/esm/loader.js @@ -39,23 +39,10 @@ function getTranslators() { */ let hooksProxy; -/** - * @typedef {object} ExportedHooks - * @property {Function} globalPreload Global preload hook. - * @property {Function} resolve Resolve hook. - * @property {Function} load Load hook. - */ - /** * @typedef {Record} ModuleExports */ -/** - * @typedef {object} KeyedExports - * @property {ModuleExports} exports The contents of the module. - * @property {URL['href']} url The URL of the module. - */ - /** * @typedef {'builtin'|'commonjs'|'json'|'module'|'wasm'} ModuleFormat */ @@ -239,17 +226,12 @@ class DefaultModuleLoader { /** * This method is usually called indirectly as part of the loading processes. - * Internally, it is used directly to add loaders. Use directly with caution. - * - * This method must NOT be renamed: it functions as a dynamic import on a - * loader module. + * Use directly with caution. * @param {string} specifier The first parameter of an `import()` expression. * @param {string} parentURL Path of the parent importing the module. * @param {Record} importAssertions Validations for the * module import. - * @returns {Promise} - * A collection of module export(s) or a list of collections of module - * export(s). + * @returns {Promise} */ async import(specifier, parentURL, importAssertions) { const moduleJob = this.getModuleJob(specifier, parentURL, importAssertions);