Skip to content

Commit

Permalink
esm: improve JSDoc annotation of internal functions
Browse files Browse the repository at this point in the history
Co-authored-by: Geoffrey Booth <webadmin@geoffreybooth.com>
  • Loading branch information
GeoffreyBooth committed Oct 1, 2023
1 parent 092fb9f commit c4ea796
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/internal/modules/run_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function resolveMainPath(main) {

/**
* Determine whether the main entry point should be loaded through the ESM Loader.
* @param {string} mainPath Absolute path to the main entry point
* @param {string} mainPath - Absolute path to the main entry point
*/
function shouldUseESMLoader(mainPath) {
/**
Expand All @@ -57,7 +57,7 @@ function shouldUseESMLoader(mainPath) {

/**
* Run the main entry point through the ESM Loader.
* @param {string} mainPath Absolute path to the main entry point
* @param {string} mainPath - Absolute path for the main entry point
*/
function runMainESM(mainPath) {
const { loadESM } = require('internal/process/esm_loader');
Expand All @@ -72,7 +72,7 @@ function runMainESM(mainPath) {

/**
* Handle process exit events around the main entry point promise.
* @param {Promise} promise Main entry point promise
* @param {Promise} promise - Main entry point promise
*/
async function handleMainPromise(promise) {
const {
Expand All @@ -90,7 +90,8 @@ async function handleMainPromise(promise) {
* Parse the CLI main entry point string and run it.
* For backwards compatibility, we have to run a bunch of monkey-patchable code that belongs to the CJS loader (exposed
* by `require('module')`) even when the entry point is ESM.
* @param {string} main CLI main entry point string
* Because of backwards compatibility, this function is exposed publicly via `import { runMain } from 'node:module'`.
* @param {string} main - Resolved absolute path for the main entry point, if found
*/
function executeUserEntryPoint(main = process.argv[1]) {
const resolvedMain = resolveMainPath(main);
Expand Down

0 comments on commit c4ea796

Please sign in to comment.