index.js
function resolveEntry(options) {
  const cwd = options.cwd;
  const pkg = options.pkg;
  let entries = [];
  if (is.array(options.entry)) entries = options.entry;
  if (is.string(options.entry)) entries.push(options.entry);

  const result = new Set();

  try {
    // set the entry that module exports
    result.add(require.resolve(cwd));
  } catch (_) {
    // ignore
  }

  for (let entry of entries) {
    const dir = path.join(cwd, entry);
    // if entry is directory, find all js in the directory
    if (fs.existsSync(dir) && fs.statSync(dir).isDirectory()) {
      entry = path.join(entry, '**/*.js');
    }
    const files = glob.sync(entry, { cwd });
    for (const file of files) {
      result.add(path.join(cwd, file));
    }
  }

  if (pkg.bin) {
    const keys = Object.keys(pkg.bin);
    for (const key of keys) {
      result.add(path.join(cwd, pkg.bin[key]));
    }
  }

  const dts = path.join(cwd, 'index.d.ts');
  if (fs.existsSync(dts)) {
    result.add(dts);
  }

  return Array.from(result);
}
function resolveEntry(options) {
  const cwd = options.cwd;
  const pkg = options.pkg;
  let entries = [];
  if (is.array(options.entry)) entries = options.entry;
  if (is.string(options.entry)) entries.push(options.entry);

  const result = new Set();

  try {
    // set the entry that module exports
    result.add(require.resolve(cwd));
  } catch (_) {
    // ignore
  }

  for (let entry of entries) {
    const dir = path.join(cwd, entry);
    // if entry is directory, find all js in the directory
    if (fs.existsSync(dir) && fs.statSync(dir).isDirectory()) {
      entry = path.join(entry, '**/*.js');
    }
    const files = glob.sync(entry, { cwd });
    for (const file of files) {
      result.add(path.join(cwd, file));
    }
  }

  if (pkg.bin) {
    const keys = Object.keys(pkg.bin);
    for (const key of keys) {
      result.add(path.join(cwd, pkg.bin[key]));
    }
  }

  const dts = path.join(cwd, 'index.d.ts');
  if (fs.existsSync(dts)) {
    result.add(dts);
  }

  return Array.from(result);
}
function resolveEntry ( options ) { const cwd = options . cwd ; const pkg = options . pkg ; let entries = [ ] ; if ( is . array ( options . entry ) ) entries = options . entry ; if ( is . string ( options . entry ) ) entries . push ( options . entry ) ; const result = new Set ( ) ; try { // set the entry that module exports result . add ( require . resolve ( cwd ) ) ; } catch ( _ ) { // ignore } for ( let entry of entries ) { const dir = path . join ( cwd , entry ) ; // if entry is directory, find all js in the directory if ( fs . existsSync ( dir ) && fs . statSync ( dir ) . isDirectory ( ) ) { entry = path . join ( entry , '**/*.js' ) ; } const files = glob . sync ( entry , { cwd } ) ; for ( const file of files ) { result . add ( path . join ( cwd , file ) ) ; } } if ( pkg . bin ) { const keys = Object . keys ( pkg . bin ) ; for ( const key of keys ) { result . add ( path . join ( cwd , pkg . bin [ key ] ) ) ; } } const dts = path . join ( cwd , 'index.d.ts' ) ; if ( fs . existsSync ( dts ) ) { result . add ( dts ) ; } return Array . from ( result ) ; }
return entries with fullpath based on options.entry
return entries with fullpath based on options . entry