No Description
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.

postinstall.js 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.replaceConsoleLinks = void 0;
  4. const registry_1 = require("../registry");
  5. const types_1 = require("../types");
  6. function replaceConsoleLinks(postinstall) {
  7. const uiRunning = registry_1.EmulatorRegistry.isRunning(types_1.Emulators.UI);
  8. const uiUrl = uiRunning ? registry_1.EmulatorRegistry.url(types_1.Emulators.UI).toString() : "unknown";
  9. let subbedPostinstall = postinstall;
  10. const linkReplacements = new Map([
  11. [
  12. /(http[s]?:\/\/)?console\.firebase\.google\.com\/(u\/[0-9]\/)?project\/[A-Za-z0-9-]+\/storage[A-Za-z0-9\/-]*(?=[\)\]\s])/,
  13. `${uiUrl}${types_1.Emulators.STORAGE}`,
  14. ],
  15. [
  16. /(http[s]?:\/\/)?console\.firebase\.google\.com\/(u\/[0-9]\/)?project\/[A-Za-z0-9-]+\/firestore[A-Za-z0-9\/-]*(?=[\)\]\s])/,
  17. `${uiUrl}${types_1.Emulators.FIRESTORE}`,
  18. ],
  19. [
  20. /(http[s]?:\/\/)?console\.firebase\.google\.com\/(u\/[0-9]\/)?project\/[A-Za-z0-9-]+\/database[A-Za-z0-9\/-]*(?=[\)\]\s])/,
  21. `${uiUrl}${types_1.Emulators.DATABASE}`,
  22. ],
  23. [
  24. /(http[s]?:\/\/)?console\.firebase\.google\.com\/(u\/[0-9]\/)?project\/[A-Za-z0-9-]+\/authentication[A-Za-z0-9\/-]*(?=[\)\]\s])/,
  25. `${uiUrl}${types_1.Emulators.AUTH}`,
  26. ],
  27. [
  28. /(http[s]?:\/\/)?console\.firebase\.google\.com\/(u\/[0-9]\/)?project\/[A-Za-z0-9-]+\/functions[A-Za-z0-9\/-]*(?=[\)\]\s])/,
  29. `${uiUrl}logs`,
  30. ],
  31. [
  32. /(http[s]?:\/\/)?console\.firebase\.google\.com\/(u\/[0-9]\/)?project\/[A-Za-z0-9-]+\/extensions[A-Za-z0-9\/-]*(?=[\)\]\s])/,
  33. `${uiUrl}${types_1.Emulators.EXTENSIONS}`,
  34. ],
  35. ]);
  36. for (const [consoleLinkRegex, replacement] of linkReplacements) {
  37. subbedPostinstall = subbedPostinstall.replace(consoleLinkRegex, replacement);
  38. }
  39. return subbedPostinstall;
  40. }
  41. exports.replaceConsoleLinks = replaceConsoleLinks;