diff --git a/lib/internal/modules/esm/hooks.js b/lib/internal/modules/esm/hooks.js index 3a01f7ffb71014..5112ece845219d 100644 --- a/lib/internal/modules/esm/hooks.js +++ b/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/lib/internal/modules/esm/loader.js b/lib/internal/modules/esm/loader.js index 2c48702a3816ff..9eb05c020cbe20 100644 --- a/lib/internal/modules/esm/loader.js +++ b/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);