File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
packages/plugin/src/virtualmodules Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * Virtual module source for perf tracking of Qwik's `componentQrl`.
3+ *
4+ * This module is loaded via the devtools plugin virtual-module registry
5+ * (`virtualmodules/virtualModules.ts`) and is imported from:
6+ * - `virtual:qwik-component-proxy`
7+ */
8+ import perfRuntime from './perfRuntime' ;
9+
10+ const qwikComponentProxy = `${ perfRuntime }
11+ import { componentQrl as originalComponentQrl } from '@qwik.dev/core';
12+
13+ function componentQrl(qrl, options) {
14+ const phase = __qwik_perf_is_server__() ? 'ssr' : 'csr';
15+ const start = performance.now();
16+ let viteId = null;
17+ const component = qrl?.getSymbol?.() || qrl?.$symbol$ || 'unknown';
18+ if(qrl.dev){
19+ viteId = qrl.dev.file.replace(/[^/]*$/, qrl.dev.displayName);
20+ }
21+ const result = originalComponentQrl(qrl, options);
22+ const duration = performance.now() - start;
23+ __qwik_perf_commit_componentqrl__({
24+ component,
25+ phase,
26+ duration,
27+ start,
28+ viteId,
29+ end: start + duration,
30+ });
31+ return result;
32+ }
33+
34+ export { componentQrl };
35+ ` ;
36+
37+ export default qwikComponentProxy ;
38+
39+
You can’t perform that action at this time.
0 commit comments