Skip to content

Commit e9c9d18

Browse files
aduh95RafaelGSS
authored andcommittedJul 3, 2023
typings: fix JSDoc in ESM loader modules
PR-URL: #48424 Reviewed-By: Jacob Smith <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]>
1 parent 5ebe3a4 commit e9c9d18

File tree

2 files changed

+10
-21
lines changed

2 files changed

+10
-21
lines changed
 

‎lib/internal/modules/esm/hooks.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ let debug = require('internal/util/debuglog').debuglog('esm', (fn) => {
6363
});
6464

6565

66+
/**
67+
* @typedef {object} ExportedHooks
68+
* @property {Function} globalPreload Global preload hook.
69+
* @property {Function} resolve Resolve hook.
70+
* @property {Function} load Load hook.
71+
*/
72+
6673
/**
6774
* @typedef {object} KeyedHook
6875
* @property {Function} fn The hook function.
@@ -631,7 +638,7 @@ ObjectSetPrototypeOf(HooksProxy.prototype, null);
631638
/**
632639
* A utility function to pluck the hooks from a user-defined loader.
633640
* @param {import('./loader.js).ModuleExports} exports
634-
* @returns {import('./loader.js).ExportedHooks}
641+
* @returns {ExportedHooks}
635642
*/
636643
function pluckHooks({
637644
globalPreload,

‎lib/internal/modules/esm/loader.js

+2-20
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,10 @@ function getTranslators() {
3939
*/
4040
let hooksProxy;
4141

42-
/**
43-
* @typedef {object} ExportedHooks
44-
* @property {Function} globalPreload Global preload hook.
45-
* @property {Function} resolve Resolve hook.
46-
* @property {Function} load Load hook.
47-
*/
48-
4942
/**
5043
* @typedef {Record<string, any>} ModuleExports
5144
*/
5245

53-
/**
54-
* @typedef {object} KeyedExports
55-
* @property {ModuleExports} exports The contents of the module.
56-
* @property {URL['href']} url The URL of the module.
57-
*/
58-
5946
/**
6047
* @typedef {'builtin'|'commonjs'|'json'|'module'|'wasm'} ModuleFormat
6148
*/
@@ -229,17 +216,12 @@ class DefaultModuleLoader {
229216

230217
/**
231218
* This method is usually called indirectly as part of the loading processes.
232-
* Internally, it is used directly to add loaders. Use directly with caution.
233-
*
234-
* This method must NOT be renamed: it functions as a dynamic import on a
235-
* loader module.
219+
* Use directly with caution.
236220
* @param {string} specifier The first parameter of an `import()` expression.
237221
* @param {string} parentURL Path of the parent importing the module.
238222
* @param {Record<string, string>} importAssertions Validations for the
239223
* module import.
240-
* @returns {Promise<ExportedHooks | KeyedExports[]>}
241-
* A collection of module export(s) or a list of collections of module
242-
* export(s).
224+
* @returns {Promise<ModuleExports>}
243225
*/
244226
async import(specifier, parentURL, importAssertions) {
245227
const moduleJob = this.getModuleJob(specifier, parentURL, importAssertions);

0 commit comments

Comments
 (0)
Please sign in to comment.