PageSourceSearch

https://app.transactency.com/assets/performanceLogger-CBSM28jc.js

js transactency.com collected 2026-10-04 03:54:53 UTC 7,174 bytes, 170 lines download raw bytes

1var __defProp = Object.defineProperty;
2var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4import { l as logger } from "./index-D967GsUD.js";
5class PerformanceLogger {
6  constructor() {
7    __publicField(this, "metrics", []);
8    __publicField(this, "isEnabled", false);
9    __publicField(this, "startTime", performance.now());
10    this.isEnabled = false;
11    if (this.isEnabled) {
12      logger.info("🚀 SUID Performance Logger initialized");
13      this.logAppStart();
14      if (typeof window !== "undefined") {
15        window.addEventListener("beforeunload", () => {
16          logger.info("🔄 Page unloading - Vite connection ending");
17        });
18      }
19    }
20  }
21  logAppStart() {
22    logger.info(`📱 App started at ${(/* @__PURE__ */ new Date()).toISOString()}`);
23    logger.info(`⏱️  Performance monitoring: ${this.isEnabled ? "ENABLED" : "DISABLED"}`);
24  }
25  startComponentLoad(componentName, source = "lazy") {
26    if (!this.isEnabled) return "";
27    const loadId = `${componentName}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
28    const startTime = performance.now();
29    if (source === "page" || source === "route") {
30      logger.info(`🔄 Loading ${source}: ${componentName}`);
31    } else {
32      logger.info(`🔄 Loading SUID component: ${componentName} (${source})`);
33    }
34    this.metrics.push({
35      componentName,
36      loadStartTime: startTime,
37      loadEndTime: 0,
38      loadDuration: 0,
39      source
40    });
41    return loadId;
42  }
43  endComponentLoad(componentName) {
44    if (!this.isEnabled) return;
45    const endTime = performance.now();
46    const metric = this.metrics.find((m) => m.componentName === componentName && m.loadEndTime === 0);
47    if (metric) {
48      metric.loadEndTime = endTime;
49      metric.loadDuration = endTime - metric.loadStartTime;
50      if (metric.source === "page" || metric.source === "route") {
51        logger.info(`✅ ${metric.source} loaded: ${componentName} (${metric.loadDuration.toFixed(2)}ms)`);
52      } else {
53        logger.info(`✅ SUID component loaded: ${componentName}`);
54        logger.info(`   ⏱️  Load duration: ${metric.loadDuration.toFixed(2)}ms`);
55        logger.info(`   📊 Total time since app start: ${(endTime - this.startTime).toFixed(2)}ms`);
56      }
57      if (metric.loadDuration > 50) {
58        console.warn(`⚠️  Slow component detected: ${componentName} took ${metric.loadDuration.toFixed(2)}ms`);
59      }
60    }
61  }
62  logBundleSize(componentName, size) {
63    if (!this.isEnabled) return;
64    const metric = this.metrics.find((m) => m.componentName === componentName);
65    if (metric) {
66      metric.bundleSize = size;
67      logger.info(`📦 Bundle size for ${componentName}: ${(size / 1024).toFixed(2)}KB`);
68    }
69  }
70  logPreloadAttempt(componentName) {
71    if (!this.isEnabled) return;
72    logger.info(`🚀 Preloading SUID component: ${componentName}`);
73    this.startComponentLoad(componentName, "preload");
74  }
75  logPreloadSuccess(componentName) {
76    if (!this.isEnabled) return;
77    logger.info(`✅ Preload successful: ${componentName}`);
78    this.endComponentLoad(componentName);
79  }
80  logPreloadFailure(componentName, error) {
81    if (!this.isEnabled) return;
82    console.warn(`❌ Preload failed: ${componentName}`, error.message);
83    this.metrics = this.metrics.filter((m) => !(m.componentName === componentName && m.source === "preload"));
84  }
85  generateReport() {
86    const completedMetrics = this.metrics.filter((m) => m.loadEndTime > 0);
87    const totalLoadTime = Math.max(...completedMetrics.map((m) => m.loadEndTime)) - this.startTime;
88    const averageLoadTime = completedMetrics.reduce((sum, m) => sum + m.loadDuration, 0) / completedMetrics.length;
89    const slowestComponents = [...completedMetrics].sort((a, b) => b.loadDuration - a.loadDuration).slice(0, 5);
90    const componentsBySource = completedMetrics.reduce((acc, metric) => {
91      if (!acc[metric.source]) acc[metric.source] = [];
92      acc[metric.source].push(metric);
93      return acc;
94    }, {});
95    const timeline = [...completedMetrics].sort((a, b) => a.loadStartTime - b.loadStartTime);
96    return {
97      totalComponents: completedMetrics.length,
98      totalLoadTime,
99      averageLoadTime,
100      slowestComponents,
101      componentsBySource,
102      timeline
103    };
104  }
105  logReport() {
106    if (!this.isEnabled) return;
107    const report = this.generateReport();
108    logger.info("\n📊 SUID Performance Report");
109    logger.info("=".repeat(50));
110    logger.info(`📱 Total components loaded: ${report.totalComponents}`);
111    logger.info(`⏱️  Total load time: ${report.totalLoadTime.toFixed(2)}ms`);
112    logger.info(`📈 Average load time: ${report.averageLoadTime.toFixed(2)}ms`);
113    logger.info("\n🐌 Slowest components:");
114    report.slowestComponents.forEach((metric, index) => {
115      logger.info(`   ${index + 1}. ${metric.componentName}: ${metric.loadDuration.toFixed(2)}ms (${metric.source})`);
116    });
117    logger.info("\n📊 Components by source:");
118    Object.entries(report.componentsBySource).forEach(([source, components]) => {
119      const avgTime = components.reduce((sum, m) => sum + m.loadDuration, 0) / components.length;
120      logger.info(`   ${source}: ${components.length} components, avg ${avgTime.toFixed(2)}ms`);
121    });
122    logger.info("\n⏰ Load timeline:");
123    report.timeline.forEach((metric, index) => {
124      const relativeTime = (metric.loadStartTime - this.startTime).toFixed(2);
125      logger.info(`   ${index + 1}. ${metric.componentName} at ${relativeTime}ms (${metric.loadDuration.toFixed(2)}ms)`);
126    });
127    logger.info("=".repeat(50));
128  }
129  // Method to be called when app is fully loaded
130  onAppFullyLoaded() {
131    if (!this.isEnabled) return;
132    setTimeout(() => {
133      this.logReport();
134    }, 1e3);
135  }
136  // Page and route tracking methods
137  startPageLoad(pageName) {
138    return this.startComponentLoad(pageName, "page");
139  }
140  endPageLoad(pageName) {
141    this.endComponentLoad(pageName);
142  }
143  startRouteTransition(routeName) {
144    if (typeof window !== "undefined" && window.location.hostname === "localhost") {
145      const viteStart = performance.now();
146      logger.info(`⚡ Vite connection started at ${viteStart.toFixed(2)}ms`);
147    }
148    return this.startComponentLoad(routeName, "route");
149  }
150  endRouteTransition(routeName) {
151    this.endComponentLoad(routeName);
152    if (typeof window !== "undefined" && window.location.hostname === "localhost") {
153      const viteEnd = performance.now();
154      logger.info(`⚡ Vite connection completed at ${viteEnd.toFixed(2)}ms`);
155    }
156  }
157  // Component mount/unmount tracking
158  logComponentMount(componentName) {
159    if (!this.isEnabled) return;
160    logger.info(`🔄 Component mounted: ${componentName}`);
161  }
162  logComponentUnmount(componentName) {
163    if (!this.isEnabled) return;
164    logger.info(`🔄 Component unmounted: ${componentName}`);
165  }
166}
167const performanceLogger = new PerformanceLogger();
168export {
169  performanceLogger as p
170};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.