esm-imports-analyzer 0.1.0

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 (48) hide show
  1. package/README.md +113 -0
  2. package/dist/analysis/cycle-detector.d.ts +3 -0
  3. package/dist/analysis/cycle-detector.d.ts.map +1 -0
  4. package/dist/analysis/cycle-detector.js +111 -0
  5. package/dist/analysis/cycle-detector.js.map +1 -0
  6. package/dist/analysis/folder-tree.d.ts +3 -0
  7. package/dist/analysis/folder-tree.d.ts.map +1 -0
  8. package/dist/analysis/folder-tree.js +141 -0
  9. package/dist/analysis/folder-tree.js.map +1 -0
  10. package/dist/analysis/grouper.d.ts +4 -0
  11. package/dist/analysis/grouper.d.ts.map +1 -0
  12. package/dist/analysis/grouper.js +156 -0
  13. package/dist/analysis/grouper.js.map +1 -0
  14. package/dist/analysis/timing.d.ts +9 -0
  15. package/dist/analysis/timing.d.ts.map +1 -0
  16. package/dist/analysis/timing.js +37 -0
  17. package/dist/analysis/timing.js.map +1 -0
  18. package/dist/analysis/tree-builder.d.ts +3 -0
  19. package/dist/analysis/tree-builder.d.ts.map +1 -0
  20. package/dist/analysis/tree-builder.js +47 -0
  21. package/dist/analysis/tree-builder.js.map +1 -0
  22. package/dist/cli.d.ts +3 -0
  23. package/dist/cli.d.ts.map +1 -0
  24. package/dist/cli.js +184 -0
  25. package/dist/cli.js.map +1 -0
  26. package/dist/loader/hooks.d.ts +4 -0
  27. package/dist/loader/hooks.d.ts.map +1 -0
  28. package/dist/loader/hooks.js +79 -0
  29. package/dist/loader/hooks.js.map +1 -0
  30. package/dist/loader/register.d.ts +2 -0
  31. package/dist/loader/register.d.ts.map +1 -0
  32. package/dist/loader/register.js +35 -0
  33. package/dist/loader/register.js.map +1 -0
  34. package/dist/report/generator.d.ts +3 -0
  35. package/dist/report/generator.d.ts.map +1 -0
  36. package/dist/report/generator.js +50 -0
  37. package/dist/report/generator.js.map +1 -0
  38. package/dist/report/template.html +146 -0
  39. package/dist/report/ui/cycles-panel.js +80 -0
  40. package/dist/report/ui/filters.js +13 -0
  41. package/dist/report/ui/graph.js +1310 -0
  42. package/dist/report/ui/styles.css +531 -0
  43. package/dist/report/ui/table.js +209 -0
  44. package/dist/types.d.ts +47 -0
  45. package/dist/types.d.ts.map +1 -0
  46. package/dist/types.js +2 -0
  47. package/dist/types.js.map +1 -0
  48. package/package.json +33 -0
@@ -0,0 +1,80 @@
1
+ /* global document */
2
+
3
+ function initCyclesPanel(data, cy) {
4
+ var cyclesList = document.getElementById('cycles-list');
5
+ var clearBtn = document.getElementById('clear-highlight-btn');
6
+ var activeItem = null;
7
+
8
+ if (data.cycles.length === 0) {
9
+ cyclesList.innerHTML = '<div class="no-cycles">No circular dependencies detected</div>';
10
+ clearBtn.style.display = 'none';
11
+ return;
12
+ }
13
+
14
+ function getShortName(url) {
15
+ if (url.startsWith('node:')) return url;
16
+ var parts = url.split('/');
17
+ return parts[parts.length - 1] || url;
18
+ }
19
+
20
+ function getFullPath(url) {
21
+ if (url.startsWith('file://')) return url.slice(7);
22
+ return url;
23
+ }
24
+
25
+ function copyText(text) {
26
+ var ta = document.createElement('textarea');
27
+ ta.value = text;
28
+ ta.style.position = 'fixed';
29
+ ta.style.opacity = '0';
30
+ document.body.appendChild(ta);
31
+ ta.select();
32
+ document.execCommand('copy');
33
+ document.body.removeChild(ta);
34
+ }
35
+
36
+ for (var i = 0; i < data.cycles.length; i++) {
37
+ (function (cycle, index) {
38
+ var item = document.createElement('div');
39
+ item.className = 'cycle-item';
40
+
41
+ var moduleNames = cycle.modules.map(getShortName).join(' \u2192 ');
42
+ item.innerHTML =
43
+ '<div class="cycle-item-header"><span class="cycle-length">' + cycle.length + ' modules</span></div>' +
44
+ '<div class="cycle-modules">' + escapeHtml(moduleNames + ' \u2192 ' + getShortName(cycle.modules[0])) + '</div>';
45
+
46
+ var copyBtn = document.createElement('button');
47
+ copyBtn.className = 'cycle-copy-btn';
48
+ copyBtn.title = 'Copy cycle paths';
49
+ copyBtn.textContent = '\u2398';
50
+ copyBtn.addEventListener('click', function (e) {
51
+ e.stopPropagation();
52
+ var fullPaths = cycle.modules.map(getFullPath);
53
+ fullPaths.push(getFullPath(cycle.modules[0]));
54
+ copyText(fullPaths.join(' \u2192 '));
55
+ });
56
+ item.querySelector('.cycle-item-header').appendChild(copyBtn);
57
+
58
+ item.addEventListener('click', function () {
59
+ if (activeItem) activeItem.classList.remove('active');
60
+ activeItem = item;
61
+ item.classList.add('active');
62
+ highlightCycle(cy, cycle);
63
+ });
64
+
65
+ cyclesList.appendChild(item);
66
+ })(data.cycles[i], i);
67
+ }
68
+
69
+ clearBtn.addEventListener('click', function () {
70
+ if (activeItem) activeItem.classList.remove('active');
71
+ activeItem = null;
72
+ clearHighlights(cy);
73
+ });
74
+
75
+ function escapeHtml(str) {
76
+ var div = document.createElement('div');
77
+ div.textContent = str;
78
+ return div.innerHTML;
79
+ }
80
+ }
@@ -0,0 +1,13 @@
1
+ /* global document */
2
+
3
+ function initFilters(cy, tableApi) {
4
+ var searchInput = document.getElementById('search-input');
5
+
6
+ searchInput.addEventListener('input', function () {
7
+ var query = searchInput.value;
8
+ filterBySearch(cy, query);
9
+ if (tableApi) {
10
+ tableApi.filter(query);
11
+ }
12
+ });
13
+ }