function resolvePkgMainFile(pkg) {
        // es2015 is another option for mainFile here
        // but its very uncommon and im not sure what priority it takes
        //
        // this list is ordered, we try resolve `browser` first, then `module` and finally fall back to
        // `main`
        const mainFileNames = ['browser', 'module', 'main'];
        for (const mainFile of mainFileNames) {
            const resolvedMainFile = resolveMainFile(pkg, mainFile);
            if (resolvedMainFile) {
                return resolvedMainFile;
            }
        }
        // if we cant find any correct file references from the pkg
        // then we just try looking around for common patterns
        const maybeRootIndex = findEntryFile(pkg, 'index.js');
        if (maybeRootIndex) {
            return maybeRootIndex;
        }
        const maybeSelfNamedIndex = findEntryFile(pkg, `${pkg._name}.js`);
        if (maybeSelfNamedIndex) {
            return maybeSelfNamedIndex;
        }
        // none of the methods we tried resulted in a file
        log_verbose(`could not find entry point for npm package ${pkg._name}`);
        // at this point there's nothing left for us to try, so return nothing
        return undefined;
    }
/**
     * Tries to resolve the mainFile from a given pkg
     * This uses seveal mainFileNames in priority to find a correct usable file
     * @param {any} pkg
     * @returns {string | undefined}
     */
Tries to resolve the mainFile from a given pkg
This uses seveal mainFileNames in priority to find a correct usable file
@param {any} pkg
@returns {string | undefined}
Tries to resolve the mainFile from a given pkg This uses seveal mainFileNames in priority to find a correct usable file @param { any } pkg @returns { string | undefined }
function resolvePkgMainFile(pkg) {
         this list is ordered, we try resolve `browser` first, then `module` and finally fall back to
         `main`
        const mainFileNames = ['browser', 'module', 'main'];
        for (const mainFile of mainFileNames) {
            const resolvedMainFile = resolveMainFile(pkg, mainFile);
            if (resolvedMainFile) {
                return resolvedMainFile;
            }
        }
         if we cant find any correct file references from the pkg
         then we just try looking around for common patterns
        const maybeRootIndex = findEntryFile(pkg, 'index.js');
        if (maybeRootIndex) {
            return maybeRootIndex;
        }
        const maybeSelfNamedIndex = findEntryFile(pkg, `${pkg._name}.js`);
        if (maybeSelfNamedIndex) {
            return maybeSelfNamedIndex;
        }
         none of the methods we tried resulted in a file
        log_verbose(`could not find entry point for npm package ${pkg._name}`);
         at this point there's nothing left for us to try, so return nothing
        return undefined;
    }
function resolvePkgMainFile ( pkg ) { const mainFileNames = [ 'browser' , 'module' , 'main' ] ; for ( const mainFile of mainFileNames ) { const resolvedMainFile = resolveMainFile ( pkg , mainFile ) ; if ( resolvedMainFile ) { return resolvedMainFile ; } } const maybeRootIndex = findEntryFile ( pkg , 'index.js' ) ; if ( maybeRootIndex ) { return maybeRootIndex ; } const maybeSelfNamedIndex = findEntryFile ( pkg , ` ${ pkg . _name } ` ) ; if ( maybeSelfNamedIndex ) { return maybeSelfNamedIndex ; } log_verbose ( ` ${ pkg . _name } ` ) ; return undefined ; }
Tries to resolve the mainFile from a given pkg
 This uses seveal mainFileNames in priority to find a correct usable file
 @param {any} pkg
 @returns {string | undefined}
Tries to resolve the mainFile from a given pkg This uses seveal mainFileNames in priority to find a correct usable file @param { any } pkg @returns { string | undefined }
// es2015 is another option for mainFile here // but its very uncommon and im not sure what priority it takes // // this list is ordered, we try resolve `browser` first, then `module` and finally fall back to // `main` // if we cant find any correct file references from the pkg // then we just try looking around for common patterns // none of the methods we tried resulted in a file // at this point there's nothing left for us to try, so return nothing