From fac37173f64c52f85180a64c5d675a06f6fdd7b2 Mon Sep 17 00:00:00 2001 From: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com> Date: Tue, 7 Jan 2025 13:11:25 +0100 Subject: [PATCH 1/2] esm: fix jsdoc type refs to `ModuleJobBase` in esm/loader --- lib/internal/modules/esm/loader.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/internal/modules/esm/loader.js b/lib/internal/modules/esm/loader.js index 19eac728623939..dd73b0d0e7dc99 100644 --- a/lib/internal/modules/esm/loader.js +++ b/lib/internal/modules/esm/loader.js @@ -54,6 +54,7 @@ const { tracingChannel } = require('diagnostics_channel'); const onImport = tracingChannel('module.import'); /** + * @typedef {import('./module_job.js').ModuleJobBase} ModuleJobBase * @typedef {import('url').URL} URL */ @@ -270,7 +271,7 @@ class ModuleLoader { * @param {string} [parentURL] The URL of the module where the module request is initiated. * It's undefined if it's from the root module. * @param {ImportAttributes} importAttributes Attributes from the import statement or expression. - * @returns {Promise} */ async getModuleJobForImport(specifier, parentURL, importAttributes) { const resolveResult = await this.resolve(specifier, parentURL, importAttributes); @@ -284,7 +285,7 @@ class ModuleLoader { * @param {string} specifier See {@link getModuleJobForImport} * @param {string} [parentURL] See {@link getModuleJobForImport} * @param {ImportAttributes} importAttributes See {@link getModuleJobForImport} - * @returns {Promise} */ getModuleJobForRequireInImportedCJS(specifier, parentURL, importAttributes) { const resolveResult = this.resolveSync(specifier, parentURL, importAttributes); From 9031f3ae098b4610c35ea17163364100a315b19f Mon Sep 17 00:00:00 2001 From: Carlos Espa <43477095+Ceres6@users.noreply.github.com> Date: Fri, 10 Jan 2025 10:51:07 +0100 Subject: [PATCH 2/2] add missing jsdoc imports and defs (#3) --- lib/internal/modules/esm/loader.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/internal/modules/esm/loader.js b/lib/internal/modules/esm/loader.js index dd73b0d0e7dc99..a3b437ade87c75 100644 --- a/lib/internal/modules/esm/loader.js +++ b/lib/internal/modules/esm/loader.js @@ -54,6 +54,7 @@ const { tracingChannel } = require('diagnostics_channel'); const onImport = tracingChannel('module.import'); /** + * @typedef {import('./hooks.js').HooksProxy} HooksProxy * @typedef {import('./module_job.js').ModuleJobBase} ModuleJobBase * @typedef {import('url').URL} URL */ @@ -150,6 +151,7 @@ class ModuleLoader { * to this property and failure to do so will cause undefined * behavior when invoking `import.meta.resolve`. * @see {ModuleLoader.setCustomizations} + * @type {CustomizedModuleLoader} */ #customizations; @@ -203,7 +205,7 @@ class ModuleLoader { * * Calling this function alters how modules are loaded and should be * invoked with care. - * @param {object} customizations + * @param {CustomizedModuleLoader} customizations */ setCustomizations(customizations) { this.#customizations = customizations; @@ -679,7 +681,7 @@ class ModuleLoader { /** * Similar to {@link resolve}, but the results are always synchronously returned. If there are any * asynchronous resolve hooks from module.register(), it will block until the results are returned - * from the loader thread for this to be synchornous. + * from the loader thread for this to be synchronous. * This is here to support `import.meta.resolve()`, `require()` in imported CJS, and * `module.registerHooks()` hooks. *