mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
typings: fix JSDoc in ESM loader modules
PR-URL: https://github.com/nodejs/node/pull/48424 Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
This commit is contained in:
@@ -63,6 +63,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.
|
||||
@@ -631,7 +638,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,
|
||||
|
||||
@@ -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<string, any>} 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
|
||||
*/
|
||||
@@ -229,17 +216,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<string, string>} importAssertions Validations for the
|
||||
* module import.
|
||||
* @returns {Promise<ExportedHooks | KeyedExports[]>}
|
||||
* A collection of module export(s) or a list of collections of module
|
||||
* export(s).
|
||||
* @returns {Promise<ModuleExports>}
|
||||
*/
|
||||
async import(specifier, parentURL, importAssertions) {
|
||||
const moduleJob = this.getModuleJob(specifier, parentURL, importAssertions);
|
||||
|
||||
Reference in New Issue
Block a user