nuxt-devtools-observatory 0.1.30 → 0.1.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +117 -30
  2. package/client/.env.example +2 -1
  3. package/client/dist/assets/index-5Wl1XYRH.js +17 -0
  4. package/client/dist/assets/index-DT_QUiIh.css +1 -0
  5. package/client/dist/index.html +2 -2
  6. package/client/src/App.vue +4 -0
  7. package/client/src/components/Flamegraph.vue +442 -0
  8. package/client/src/components/SpanInspector.vue +446 -0
  9. package/client/src/components/TraceFilter.vue +342 -0
  10. package/client/src/components/WaterfallView.vue +443 -0
  11. package/client/src/composables/composable-search.ts +124 -0
  12. package/client/src/composables/trace-render-aggregation.ts +254 -0
  13. package/client/src/composables/useExportImport.ts +63 -0
  14. package/client/src/composables/useTraceFilter.ts +160 -0
  15. package/client/src/stores/observatory.ts +13 -1
  16. package/client/src/views/ComposableTracker.vue +65 -30
  17. package/client/src/views/RenderHeatmap.vue +63 -1
  18. package/client/src/views/TraceViewer.vue +1212 -0
  19. package/client/src/views/TransitionTimeline.vue +1 -6
  20. package/dist/module.d.mts +5 -0
  21. package/dist/module.json +1 -1
  22. package/dist/module.mjs +31 -45
  23. package/dist/runtime/composables/composable-registry.d.ts +19 -0
  24. package/dist/runtime/composables/composable-registry.js +63 -5
  25. package/dist/runtime/composables/render-registry.js +74 -110
  26. package/dist/runtime/composables/transition-registry.js +103 -28
  27. package/dist/runtime/instrumentation/asyncData.d.ts +9 -0
  28. package/dist/runtime/instrumentation/asyncData.js +49 -0
  29. package/dist/runtime/instrumentation/component.d.ts +2 -0
  30. package/dist/runtime/instrumentation/component.js +126 -0
  31. package/dist/runtime/instrumentation/fetch.d.ts +2 -0
  32. package/dist/runtime/instrumentation/fetch.js +89 -0
  33. package/dist/runtime/instrumentation/route.d.ts +6 -0
  34. package/dist/runtime/instrumentation/route.js +41 -0
  35. package/dist/runtime/nitro/fetch-capture.d.ts +1 -2
  36. package/dist/runtime/nitro/fetch-capture.js +85 -7
  37. package/dist/runtime/nitro/ssr-trace-store.d.ts +85 -0
  38. package/dist/runtime/nitro/ssr-trace-store.js +84 -0
  39. package/dist/runtime/plugin.js +82 -2
  40. package/dist/runtime/tracing/context.d.ts +9 -0
  41. package/dist/runtime/tracing/context.js +15 -0
  42. package/dist/runtime/tracing/trace.d.ts +25 -0
  43. package/dist/runtime/tracing/trace.js +0 -0
  44. package/dist/runtime/tracing/traceStore.d.ts +39 -0
  45. package/dist/runtime/tracing/traceStore.js +101 -0
  46. package/dist/runtime/tracing/tracing.d.ts +27 -0
  47. package/dist/runtime/tracing/tracing.js +48 -0
  48. package/package.json +5 -1
  49. package/client/.env +0 -16
  50. package/client/dist/assets/index-BCaKoHBH.js +0 -17
  51. package/client/dist/assets/index-BmGW_M3W.css +0 -1
@@ -2,6 +2,8 @@
2
2
  import { computed, defineComponent, h, ref, watch, type VNode } from 'vue'
3
3
  import { useResizablePane } from '@observatory-client/composables/useResizablePane'
4
4
  import { useObservatoryData, openInEditor as openInEditorFromStore } from '@observatory-client/stores/observatory'
5
+ import { exportJson, importJson } from '@observatory-client/composables/useExportImport'
6
+ import type { ObservatoryExportFile } from '@observatory-client/composables/useExportImport'
5
7
  import type { RenderEntry, RenderEvent } from '@observatory/types/snapshot'
6
8
 
7
9
  interface ComponentNode {
@@ -197,6 +199,7 @@ const activeThreshold = computed({
197
199
  })
198
200
  const activeHotOnly = ref(false)
199
201
  const frozen = ref(false)
202
+ const isImportedSnapshot = ref(false)
200
203
  const search = ref('')
201
204
  const activeSelectedId = ref<string | null>(null)
202
205
  const activeRootId = ref<string | null>(null)
@@ -671,6 +674,7 @@ function updateSearch(event: Event) {
671
674
  function toggleFreeze() {
672
675
  if (frozen.value) {
673
676
  frozen.value = false
677
+ isImportedSnapshot.value = false
674
678
  frozenSnapshot.value = []
675
679
 
676
680
  return
@@ -680,6 +684,45 @@ function toggleFreeze() {
680
684
  frozen.value = true
681
685
  }
682
686
 
687
+ function handleExport() {
688
+ exportJson(`observatory-renders-${Date.now()}.json`, {
689
+ type: 'observatory-renders',
690
+ version: '1',
691
+ exportedAt: Date.now(),
692
+ count: displayEntries.value.length,
693
+ data: displayEntries.value,
694
+ })
695
+ }
696
+
697
+ async function handleImport() {
698
+ let parsed: unknown
699
+
700
+ try {
701
+ parsed = await importJson()
702
+ } catch (err) {
703
+ if (err instanceof Error && err.message !== 'cancelled') {
704
+ alert(`Import failed: ${err.message}`)
705
+ }
706
+ return
707
+ }
708
+
709
+ const file = parsed as ObservatoryExportFile<RenderEntry>
710
+
711
+ if (
712
+ file?.type !== 'observatory-renders' ||
713
+ file?.version !== '1' ||
714
+ !Array.isArray(file?.data) ||
715
+ (file.data.length > 0 && (file.data[0]?.uid === undefined || !file.data[0]?.name || !file.data[0]?.file))
716
+ ) {
717
+ alert('Invalid observatory renders file.')
718
+ return
719
+ }
720
+
721
+ frozenSnapshot.value = file.data
722
+ frozen.value = true
723
+ isImportedSnapshot.value = true
724
+ }
725
+
683
726
  function basename(file: string) {
684
727
  return (
685
728
  file
@@ -732,8 +775,10 @@ function formatTimestamp(t: number): string {
732
775
  <option v-for="r in knownRoutes" :key="r" :value="r">{{ r }}</option>
733
776
  </select>
734
777
  <button :class="{ active: frozen }" class="render-heatmap__freeze tracker-toolbar__spacer" @click="toggleFreeze">
735
- {{ frozen ? 'unfreeze' : 'freeze snapshot' }}
778
+ {{ frozen && isImportedSnapshot ? 'unfreeze (imported)' : frozen ? 'unfreeze' : 'freeze snapshot' }}
736
779
  </button>
780
+ <button class="render-heatmap__action-btn" title="Export render data as JSON" @click="handleExport">↓ export</button>
781
+ <button class="render-heatmap__action-btn" title="Import render data from JSON file" @click="handleImport">↑ import</button>
737
782
  </div>
738
783
 
739
784
  <div class="render-heatmap__stats tracker-stats-row">
@@ -952,6 +997,23 @@ function formatTimestamp(t: number): string {
952
997
  width: 90px;
953
998
  }
954
999
 
1000
+ .render-heatmap__action-btn {
1001
+ padding: 3px 8px;
1002
+ background: none;
1003
+ border: 1px solid var(--border);
1004
+ color: var(--text-secondary);
1005
+ cursor: pointer;
1006
+ font-size: 11px;
1007
+ border-radius: 3px;
1008
+ transition: all 0.12s;
1009
+ font-family: var(--mono);
1010
+ }
1011
+
1012
+ .render-heatmap__action-btn:hover {
1013
+ background: var(--bg-secondary);
1014
+ color: var(--text);
1015
+ }
1016
+
955
1017
  .stat-sub {
956
1018
  margin-top: var(--tracker-space-1);
957
1019
  font-size: var(--tracker-font-size-sm);