code: function fn() {
          try {
              const files = fs.readdirSync(dir);
              for (const file of files) {
                  const fullpath = path.resolve(dir, file);
                  const stat = fs.statSync(fullpath);
                  if (stat.isFile() === false && stat.isDirectory() === false) continue;
                  if (stat.isDirectory()) {
                      app.recursiveDir(fullpath, callback, filter, async, needRequire);
                      continue;
                  }
                  const parse = path.parse(fullpath);
                  if (typeof filter === 'function') {
                      if (!filter(parse)) continue;
                  } else {
                      if (!parse || parse.ext !== '.js') continue;
                  }
                  if (typeof callback === 'function') {
                      callback(needRequire ? require(fullpath) : null, parse);
                  }
              }
          } catch (e) {
              console.error(e);
          }
      }
docs: 执行函数