You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
427 B

4 years ago
  1. module.exports = function (_require) {
  2. _require = _require || require
  3. var main = _require.main
  4. if (main && isIISNode(main)) return handleIISNode(main)
  5. else return main ? main.filename : process.cwd()
  6. }
  7. function isIISNode (main) {
  8. return /\\iisnode\\/.test(main.filename)
  9. }
  10. function handleIISNode (main) {
  11. if (!main.children.length) {
  12. return main.filename
  13. } else {
  14. return main.children[0].filename
  15. }
  16. }