index.js 673 B

12345678910111213141516171819202122
  1. // Public API for node-inspector embedders
  2. var url = require('url');
  3. exports.buildInspectorUrl = buildInspectorUrl;
  4. /**
  5. * Build a URL for loading inspector UI in the browser.
  6. * @param {string|undefined} inspectorHost as configured via --web-host
  7. * @param {number} inspectorPort as configured via --web-port
  8. * @param {number} debugPort as configured via --debug in the debugged app
  9. */
  10. function buildInspectorUrl(inspectorHost, inspectorPort, debugPort, fileToShow) {
  11. var parts = {
  12. protocol: 'http',
  13. hostname: inspectorHost || '127.0.0.1',
  14. port: inspectorPort,
  15. pathname: '/debug',
  16. search: '?port=' + debugPort
  17. };
  18. return url.format(parts);
  19. }