lightview 2.0.7 → 2.0.9
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.
- package/README.md +47 -1283
- package/components/actions/button.js +5 -5
- package/components/actions/dropdown.js +6 -6
- package/components/actions/modal.js +9 -9
- package/components/actions/swap.js +5 -5
- package/components/data-display/accordion.js +6 -6
- package/components/data-display/alert.js +6 -6
- package/components/data-display/avatar.js +7 -7
- package/components/data-display/badge.js +5 -5
- package/components/data-display/card.js +7 -7
- package/components/data-display/carousel.js +4 -4
- package/components/data-display/chart.js +8 -8
- package/components/data-display/chat.js +7 -7
- package/components/data-display/collapse.js +5 -5
- package/components/data-display/countdown.js +3 -3
- package/components/data-display/diff.js +6 -6
- package/components/data-display/kbd.js +5 -5
- package/components/data-display/loading.js +5 -5
- package/components/data-display/progress.js +5 -5
- package/components/data-display/radial-progress.js +5 -5
- package/components/data-display/skeleton.js +3 -3
- package/components/data-display/stats.js +9 -9
- package/components/data-display/table.js +9 -9
- package/components/data-display/timeline.js +8 -8
- package/components/data-display/toast.js +3 -3
- package/components/data-display/tooltip.js +3 -3
- package/components/data-input/checkbox.js +5 -5
- package/components/data-input/file-input.js +3 -3
- package/components/data-input/input.js +5 -5
- package/components/data-input/radio.js +9 -9
- package/components/data-input/range.js +3 -3
- package/components/data-input/rating.js +3 -3
- package/components/data-input/select.js +5 -5
- package/components/data-input/textarea.js +3 -3
- package/components/data-input/toggle.js +5 -5
- package/components/layout/divider.js +3 -3
- package/components/layout/drawer.js +7 -7
- package/components/layout/footer.js +5 -5
- package/components/layout/hero.js +5 -5
- package/components/layout/indicator.js +4 -4
- package/components/layout/join.js +4 -4
- package/components/layout/navbar.js +6 -6
- package/components/navigation/breadcrumbs.js +4 -4
- package/components/navigation/dock.js +5 -5
- package/components/navigation/menu.js +6 -6
- package/components/navigation/pagination.js +3 -3
- package/components/navigation/steps.js +4 -4
- package/components/navigation/tabs.js +5 -5
- package/components/theme/theme-switch.js +30 -30
- package/docs/about.html +142 -14
- package/docs/api/computed.html +1 -6
- package/docs/api/effects.html +1 -7
- package/docs/api/elements.html +6 -10
- package/docs/api/enhance.html +1 -6
- package/docs/api/hypermedia.html +154 -22
- package/docs/api/index.html +7 -12
- package/docs/api/nav.html +18 -1
- package/docs/api/signals.html +1 -6
- package/docs/api/state.html +1 -6
- package/docs/assets/js/examplify-sandbox.html +2 -2
- package/docs/assets/js/examplify.js +15 -15
- package/docs/components/accordion.html +4 -4
- package/docs/components/alert.html +4 -4
- package/docs/components/avatar.html +4 -4
- package/docs/components/badge.html +4 -4
- package/docs/components/breadcrumbs.html +3 -3
- package/docs/components/button.html +5 -5
- package/docs/components/card.html +4 -4
- package/docs/components/carousel.html +3 -3
- package/docs/components/chart-area.html +6 -6
- package/docs/components/chart-bar.html +6 -6
- package/docs/components/chart-column.html +6 -6
- package/docs/components/chart-line.html +6 -6
- package/docs/components/chart-pie.html +6 -6
- package/docs/components/chart.html +2 -2
- package/docs/components/chat.html +4 -4
- package/docs/components/checkbox.html +4 -4
- package/docs/components/collapse.html +4 -4
- package/docs/components/countdown.html +4 -4
- package/docs/components/diff.html +3 -3
- package/docs/components/divider.html +3 -3
- package/docs/components/dock.html +3 -3
- package/docs/components/drawer.html +4 -4
- package/docs/components/dropdown.html +4 -4
- package/docs/components/file-input.html +4 -4
- package/docs/components/footer.html +3 -3
- package/docs/components/gallery.html +2 -2
- package/docs/components/hero.html +3 -3
- package/docs/components/index.css +5 -3
- package/docs/components/index.html +4 -4
- package/docs/components/indicator.html +3 -3
- package/docs/components/input.html +4 -4
- package/docs/components/join.html +3 -3
- package/docs/components/kbd.html +3 -3
- package/docs/components/loading.html +4 -4
- package/docs/components/menu.html +4 -4
- package/docs/components/modal.html +4 -4
- package/docs/components/navbar.html +3 -3
- package/docs/components/pagination.html +3 -3
- package/docs/components/progress.html +4 -4
- package/docs/components/radial-progress.html +3 -3
- package/docs/components/radio.html +4 -4
- package/docs/components/range.html +4 -4
- package/docs/components/rating.html +4 -4
- package/docs/components/select.html +4 -4
- package/docs/components/sidebar-setup.js +1 -1
- package/docs/components/skeleton.html +4 -4
- package/docs/components/spinner.html +4 -4
- package/docs/components/stats.html +4 -4
- package/docs/components/steps.html +3 -3
- package/docs/components/swap.html +4 -4
- package/docs/components/switch.html +4 -4
- package/docs/components/table.html +4 -4
- package/docs/components/tabs.html +4 -4
- package/docs/components/text-input.html +4 -4
- package/docs/components/textarea.html +4 -4
- package/docs/components/timeline.html +4 -4
- package/docs/components/toast.html +4 -4
- package/docs/components/toggle.html +4 -4
- package/docs/components/tooltip.html +4 -4
- package/docs/examples/getting-started-example.html +1 -1
- package/docs/examples/index.html +1 -2
- package/docs/getting-started/index.html +105 -14
- package/docs/index.html +2 -11
- package/docs/router-nav.html +13 -0
- package/docs/router.html +60 -17
- package/docs/styles/index.html +2 -7
- package/docs/syntax.html +144 -0
- package/functions/_middleware.js +17 -10
- package/functions/processServerScripts.js +127 -0
- package/index.html +8 -8
- package/lightview-router.js +141 -297
- package/lightview-x.js +604 -573
- package/lightview.js +179 -157
- package/package.json +33 -26
- package/scripts/analysis/README.md +2 -0
- package/scripts/analysis/analyze.js +266 -0
- package/scripts/analysis/latest_metrics.md +185 -0
- package/wrangler.toml +6 -0
- package/docs/playground.html +0 -416
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const acorn = require('acorn');
|
|
3
|
+
const walk = require('acorn-walk');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 2025 LIGHTVIEW CODEBASE METRICS ENGINE
|
|
8
|
+
* Calculates:
|
|
9
|
+
* - Cyclomatic Complexity (Control Flow Paths)
|
|
10
|
+
* - Cognitive Complexity (2025 SonarSource Spec)
|
|
11
|
+
* - Halstead Volume (Operator/Operand Density)
|
|
12
|
+
* - SLOC (Source Lines of Code)
|
|
13
|
+
* - Maintainability Index (MI)
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const TARGET_FILES = [
|
|
17
|
+
'../../lightview.js',
|
|
18
|
+
'../../lightview-x.js',
|
|
19
|
+
'../../lightview-router.js',
|
|
20
|
+
'../../node_modules/react/cjs/react.development.js',
|
|
21
|
+
'../../node_modules/@grucloud/bau/bau.js',
|
|
22
|
+
'../../node_modules/htmx.org/dist/htmx.js',
|
|
23
|
+
'../../node_modules/juris/juris.js'
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
// --- METRIC CALCULATORS ---
|
|
27
|
+
|
|
28
|
+
const getCyclomaticComplexity = (fnNode) => {
|
|
29
|
+
let complexity = 1;
|
|
30
|
+
walk.recursive(fnNode.body, null, {
|
|
31
|
+
IfStatement(node, state, c) { complexity++; c(node.test, state); c(node.consequent, state); if (node.alternate) c(node.alternate, state); },
|
|
32
|
+
ConditionalExpression(node, state, c) { complexity++; c(node.test, state); c(node.consequent, state); c(node.alternate, state); },
|
|
33
|
+
WhileStatement(node, state, c) { complexity++; c(node.test, state); c(node.body, state); },
|
|
34
|
+
DoWhileStatement(node, state, c) { complexity++; c(node.test, state); c(node.body, state); },
|
|
35
|
+
ForStatement(node, state, c) { complexity++; if (node.init) c(node.init, state); if (node.test) c(node.test, state); if (node.update) c(node.update, state); c(node.body, state); },
|
|
36
|
+
ForInStatement(node, state, c) { complexity++; c(node.left, state); c(node.right, state); c(node.body, state); },
|
|
37
|
+
ForOfStatement(node, state, c) { complexity++; c(node.left, state); c(node.right, state); c(node.body, state); },
|
|
38
|
+
LogicalExpression(node, state, c) {
|
|
39
|
+
if (node.operator === '&&' || node.operator === '||' || node.operator === '??') complexity++;
|
|
40
|
+
c(node.left, state); c(node.right, state);
|
|
41
|
+
},
|
|
42
|
+
SwitchCase(node, state, c) { if (node.test) complexity++; if (node.test) c(node.test, state); node.consequent.forEach(n => c(n, state)); },
|
|
43
|
+
CatchClause(node, state, c) { complexity++; if (node.param) c(node.param, state); c(node.body, state); },
|
|
44
|
+
FunctionDeclaration() { }, FunctionExpression() { }, ArrowFunctionExpression() { }
|
|
45
|
+
});
|
|
46
|
+
return complexity;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const getCognitiveComplexity = (fnNode, fnName) => {
|
|
50
|
+
let score = 0;
|
|
51
|
+
const findRecursion = (node) => {
|
|
52
|
+
let count = 0;
|
|
53
|
+
walk.simple(node, {
|
|
54
|
+
CallExpression(call) { if (call.callee.type === 'Identifier' && call.callee.name === fnName) count++; }
|
|
55
|
+
});
|
|
56
|
+
return count;
|
|
57
|
+
};
|
|
58
|
+
const traverse = (n, d) => {
|
|
59
|
+
if (!n) return 0;
|
|
60
|
+
let s = 0;
|
|
61
|
+
switch (n.type) {
|
|
62
|
+
case 'IfStatement':
|
|
63
|
+
s += (1 + d);
|
|
64
|
+
s += traverse(n.test, d);
|
|
65
|
+
s += traverse(n.consequent, d + 1);
|
|
66
|
+
if (n.alternate) {
|
|
67
|
+
s += 1;
|
|
68
|
+
if (n.alternate.type === 'IfStatement') s += traverseBranch(n.alternate, d);
|
|
69
|
+
else s += traverse(n.alternate, d + 1);
|
|
70
|
+
}
|
|
71
|
+
break;
|
|
72
|
+
case 'SwitchStatement': s += (1 + d); n.cases.forEach(c => s += traverse(c, d + 1)); break;
|
|
73
|
+
case 'ForStatement': case 'ForInStatement': case 'ForOfStatement': case 'WhileStatement': case 'DoWhileStatement':
|
|
74
|
+
s += (1 + d); s += traverse(n.body, d + 1); break;
|
|
75
|
+
case 'CatchClause': s += (1 + d); s += traverse(n.body, d + 1); break;
|
|
76
|
+
case 'LogicalExpression': s += 1; break; // Naive: count each operator sequence as 1
|
|
77
|
+
case 'ConditionalExpression': s += 1; s += traverse(n.consequent, d + 1); s += traverse(n.alternate, d + 1); break;
|
|
78
|
+
case 'BreakStatement': case 'ContinueStatement': s += 1; break;
|
|
79
|
+
case 'FunctionDeclaration': case 'FunctionExpression': case 'ArrowFunctionExpression': break;
|
|
80
|
+
default:
|
|
81
|
+
for (const key in n) {
|
|
82
|
+
const c = n[key];
|
|
83
|
+
if (Array.isArray(c)) c.forEach(i => { if (i?.type) s += traverse(i, d); });
|
|
84
|
+
else if (c?.type) s += traverse(c, d);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return s;
|
|
88
|
+
};
|
|
89
|
+
const traverseBranch = (n, d) => {
|
|
90
|
+
let s = 1; s += traverse(n.test, d); s += traverse(n.consequent, d + 1);
|
|
91
|
+
if (n.alternate) {
|
|
92
|
+
if (n.alternate.type === 'IfStatement') s += traverseBranch(n.alternate, d);
|
|
93
|
+
else { s += 1; s += traverse(n.alternate, d + 1); }
|
|
94
|
+
}
|
|
95
|
+
return s;
|
|
96
|
+
};
|
|
97
|
+
if (fnNode.body) {
|
|
98
|
+
score += traverse(fnNode.body, 0);
|
|
99
|
+
score += findRecursion(fnNode.body);
|
|
100
|
+
}
|
|
101
|
+
return score;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const calculateHalstead = (code) => {
|
|
105
|
+
let tokens = [];
|
|
106
|
+
try {
|
|
107
|
+
tokens = [...acorn.tokenizer(code, { ecmaVersion: 'latest' })];
|
|
108
|
+
} catch (e) {
|
|
109
|
+
// Fallback or skip if tokenization fails for complex files
|
|
110
|
+
}
|
|
111
|
+
const operators = new Set(['(', ')', '[', ']', '{', '}', '.', ',', ';', ':', '?', '...', '=', '+=', '-=', '*=', '/=', '==', '===', '!=', '!==', '<', '>', '<=', '>=', '+', '-', '*', '/', '%', '++', '--', '&&', '||', '??', '!', 'typeof', 'let', 'const', 'var', 'if', 'else', 'for', 'while', 'return']);
|
|
112
|
+
let N1 = 0, N2 = 0; const n1set = new Set(), n2set = new Set();
|
|
113
|
+
tokens.forEach(t => {
|
|
114
|
+
const txt = t.value !== undefined ? String(t.value) : t.type.label;
|
|
115
|
+
if (operators.has(txt)) { N1++; n1set.add(txt); } else { N2++; n2set.add(txt); }
|
|
116
|
+
});
|
|
117
|
+
const N = N1 + N2;
|
|
118
|
+
const n = n1set.size + n2set.size;
|
|
119
|
+
const volume = N * Math.log2(n || 1);
|
|
120
|
+
return { volume, n1: n1set.size, n2: n2set.size, N1, N2 };
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const getSLOC = (code) => code.split('\n').filter(l => l.trim().length > 0 && !l.trim().startsWith('//')).length;
|
|
124
|
+
|
|
125
|
+
const calculateMI = (volume, cc, sloc) => {
|
|
126
|
+
// Standard MI formula: 171 - 5.2 * ln(V) - 0.23 * CC - 16.2 * ln(SLOC)
|
|
127
|
+
const mi = 171 - 5.2 * Math.log(volume || 1) - 0.23 * cc - 16.2 * Math.log(sloc || 1);
|
|
128
|
+
return Math.max(0, Math.min(100, (mi * 100) / 171));
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
// --- ANALYSIS CORE ---
|
|
132
|
+
|
|
133
|
+
const analyzeFile = (filePath) => {
|
|
134
|
+
const fullPath = path.resolve(__dirname, filePath);
|
|
135
|
+
if (!fs.existsSync(fullPath)) return { error: `File not found: ${filePath}` };
|
|
136
|
+
|
|
137
|
+
const code = fs.readFileSync(fullPath, 'utf8');
|
|
138
|
+
let ast;
|
|
139
|
+
try {
|
|
140
|
+
ast = acorn.parse(code, { ecmaVersion: 'latest', sourceType: 'script' });
|
|
141
|
+
} catch (e) {
|
|
142
|
+
try {
|
|
143
|
+
ast = acorn.parse(code, { ecmaVersion: 'latest', sourceType: 'module' });
|
|
144
|
+
} catch (e2) {
|
|
145
|
+
return { error: `AST Parse Error: ${e2.message}` };
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
const sloc = getSLOC(code);
|
|
149
|
+
const fileHalstead = calculateHalstead(code);
|
|
150
|
+
|
|
151
|
+
const fns = [];
|
|
152
|
+
walk.ancestor(ast, {
|
|
153
|
+
FunctionDeclaration(node) { fns.push({ node, name: node.id?.name || '<anonymous>' }); },
|
|
154
|
+
FunctionExpression(node, state, anc) {
|
|
155
|
+
let name = '<anonymous>';
|
|
156
|
+
const p = anc[anc.length - 2];
|
|
157
|
+
if (p?.type === 'VariableDeclarator' && p.id?.name) name = p.id.name;
|
|
158
|
+
else if (p?.type === 'Property' && p.key?.name) name = p.key.name;
|
|
159
|
+
else if (p?.type === 'AssignmentExpression' && p.left?.name) name = p.left.name;
|
|
160
|
+
fns.push({ node, name });
|
|
161
|
+
},
|
|
162
|
+
ArrowFunctionExpression(node, state, anc) {
|
|
163
|
+
let name = '<anonymous>';
|
|
164
|
+
const p = anc[anc.length - 2];
|
|
165
|
+
if (p?.type === 'VariableDeclarator' && p.id?.name) name = p.id.name;
|
|
166
|
+
fns.push({ node, name });
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
const results = fns.map(f => {
|
|
171
|
+
const cc = getCyclomaticComplexity(f.node);
|
|
172
|
+
const cog = getCognitiveComplexity(f.node, f.name);
|
|
173
|
+
const fCode = code.slice(f.node.start, f.node.end);
|
|
174
|
+
const h = calculateHalstead(fCode);
|
|
175
|
+
const fSloc = getSLOC(fCode);
|
|
176
|
+
const mi = calculateMI(h.volume, cc, fSloc);
|
|
177
|
+
return { name: f.name, cc, cog, mi, volume: h.volume, sloc: fSloc };
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
return {
|
|
181
|
+
fileName: path.basename(filePath),
|
|
182
|
+
sloc,
|
|
183
|
+
fnCount: fns.length,
|
|
184
|
+
totalVolume: fileHalstead.volume,
|
|
185
|
+
results
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
// --- REPORT GENERATION ---
|
|
190
|
+
|
|
191
|
+
const generateReport = () => {
|
|
192
|
+
let md = "# Codebase Ethics & Complexity Report\n\n";
|
|
193
|
+
md += `Generated on: ${new Date().toLocaleString()}\n\n`;
|
|
194
|
+
|
|
195
|
+
const summaries = [];
|
|
196
|
+
|
|
197
|
+
TARGET_FILES.forEach(file => {
|
|
198
|
+
console.log(`Analyzing ${file}...`);
|
|
199
|
+
const data = analyzeFile(file);
|
|
200
|
+
if (data.error) {
|
|
201
|
+
md += `### !! Error analyzing ${file}: ${data.error}\n\n`;
|
|
202
|
+
summaries.push({
|
|
203
|
+
name: path.basename(file),
|
|
204
|
+
sloc: '-',
|
|
205
|
+
fns: '-',
|
|
206
|
+
mi: 'Error',
|
|
207
|
+
cog: 'Error',
|
|
208
|
+
status: "❌ Error"
|
|
209
|
+
});
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const miScores = data.results.map(r => r.mi);
|
|
214
|
+
const cogScores = data.results.map(r => r.cog);
|
|
215
|
+
|
|
216
|
+
const minMI = miScores.length ? Math.min(...miScores) : 0;
|
|
217
|
+
const avgMI = miScores.length ? miScores.reduce((a, b) => a + b, 0) / miScores.length : 0;
|
|
218
|
+
const maxMI = miScores.length ? Math.max(...miScores) : 0;
|
|
219
|
+
|
|
220
|
+
const minCog = cogScores.length ? Math.min(...cogScores) : 0;
|
|
221
|
+
const avgCog = cogScores.length ? cogScores.reduce((a, b) => a + b, 0) / cogScores.length : 0;
|
|
222
|
+
const maxCog = cogScores.length ? Math.max(...cogScores) : 0;
|
|
223
|
+
|
|
224
|
+
summaries.push({
|
|
225
|
+
name: data.fileName,
|
|
226
|
+
sloc: data.sloc,
|
|
227
|
+
fns: data.fnCount,
|
|
228
|
+
mi: `${minMI.toFixed(1)} / ${avgMI.toFixed(1)} / ${maxMI.toFixed(1)}`,
|
|
229
|
+
cog: `${minCog.toFixed(0)} / ${avgCog.toFixed(1)} / ${maxCog.toFixed(0)}`,
|
|
230
|
+
avgMI,
|
|
231
|
+
status: avgMI > 80 ? "✅ Excellent" : (avgMI > 65 ? "⚖️ Good" : "⚠️ Attention")
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
md += `## Detail: ${data.fileName}\n\n`;
|
|
235
|
+
md += `| Metric | Overall Value |\n| :--- | :--- |\n`;
|
|
236
|
+
md += `| **SLOC** | ${data.sloc} |\n`;
|
|
237
|
+
md += `| **Function Count** | ${data.fnCount} |\n`;
|
|
238
|
+
md += `| **Avg Maintainability** | **${avgMI.toFixed(2)}/100** |\n\n`;
|
|
239
|
+
|
|
240
|
+
md += `### Top 10 High Friction Functions\n`;
|
|
241
|
+
md += `| Function | Cognitive | Cyclomatic | MI | Status |\n| :--- | :--- | :--- | :--- | :--- |\n`;
|
|
242
|
+
|
|
243
|
+
data.results
|
|
244
|
+
.sort((a, b) => b.cog - a.cog)
|
|
245
|
+
.slice(0, 10)
|
|
246
|
+
.forEach(r => {
|
|
247
|
+
const status = r.cog > 25 ? "🛑 Critical" : (r.cog > 15 ? "⚠️ High" : "✅ Clean");
|
|
248
|
+
md += `| \`${r.name}\` | ${r.cog} | ${r.cc} | ${r.mi.toFixed(1)} | ${status} |\n`;
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
md += "\n---\n\n";
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
let summaryHeader = "## Executive Summary\n\n| File | Functions | Maintainability (min/avg/max) | Cognitive (min/avg/max) | Status |\n| :--- | :--- | :--- | :--- | :--- |\n";
|
|
255
|
+
summaries.sort((a, b) => {
|
|
256
|
+
// Optional: sort by status or name. Let's keep TARGET_FILES order if possible, or sort by name.
|
|
257
|
+
return 0; // Keep order of TARGET_FILES
|
|
258
|
+
}).forEach(s => {
|
|
259
|
+
summaryHeader += `| \`${s.name}\` | ${s.fns} | ${s.mi} | ${s.cog} | ${s.status} |\n`;
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
fs.writeFileSync(path.resolve(__dirname, 'latest_metrics.md'), md.replace("# Codebase Ethics & Complexity Report", "# Metrics Report\n\n" + summaryHeader));
|
|
263
|
+
console.log("Analysis complete. Report saved to latest_metrics.md");
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
generateReport();
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# Metrics Report
|
|
2
|
+
|
|
3
|
+
## Executive Summary
|
|
4
|
+
|
|
5
|
+
| File | Functions | Maintainability (min/avg/max) | Cognitive (min/avg/max) | Status |
|
|
6
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
7
|
+
| `lightview.js` | 58 | 7.2 / 65.5 / 92.9 | 0 / 3.4 / 25 | ⚖️ Good |
|
|
8
|
+
| `lightview-x.js` | 104 | 0.0 / 66.7 / 93.5 | 0 / 3.2 / 23 | ⚖️ Good |
|
|
9
|
+
| `lightview-router.js` | 27 | 24.8 / 68.6 / 93.5 | 0 / 2.1 / 19 | ⚖️ Good |
|
|
10
|
+
| `react.development.js` | 109 | 0.0 / 65.2 / 91.5 | 0 / 2.2 / 33 | ⚖️ Good |
|
|
11
|
+
| `bau.js` | 79 | 11.2 / 71.3 / 92.9 | 0 / 1.5 / 20 | ⚖️ Good |
|
|
12
|
+
| `htmx.js` | 335 | 0.0 / 65.3 / 92.9 | 0 / 3.4 / 116 | ⚖️ Good |
|
|
13
|
+
| `juris.js` | 360 | 21.2 / 70.1 / 96.5 | 0 / 2.6 / 51 | ⚖️ Good |
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
Generated on: 12/30/2025, 7:44:35 AM
|
|
17
|
+
|
|
18
|
+
## Detail: lightview.js
|
|
19
|
+
|
|
20
|
+
| Metric | Overall Value |
|
|
21
|
+
| :--- | :--- |
|
|
22
|
+
| **SLOC** | 599 |
|
|
23
|
+
| **Function Count** | 58 |
|
|
24
|
+
| **Avg Maintainability** | **65.52/100** |
|
|
25
|
+
|
|
26
|
+
### Top 10 High Friction Functions
|
|
27
|
+
| Function | Cognitive | Cyclomatic | MI | Status |
|
|
28
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
29
|
+
| `processChildren` | 25 | 19 | 35.1 | ⚠️ High |
|
|
30
|
+
| `makeReactiveAttributes` | 19 | 12 | 38.8 | ⚠️ High |
|
|
31
|
+
| `processComponentResult` | 17 | 15 | 42.0 | ⚠️ High |
|
|
32
|
+
| `enhance` | 13 | 10 | 44.6 | ✅ Clean |
|
|
33
|
+
| `value` | 11 | 11 | 44.2 | ✅ Clean |
|
|
34
|
+
| `processShadowDOM` | 10 | 10 | 43.5 | ✅ Clean |
|
|
35
|
+
| `signal` | 9 | 7 | 40.9 | ✅ Clean |
|
|
36
|
+
| `<anonymous>` | 9 | 9 | 59.0 | ✅ Clean |
|
|
37
|
+
| `<anonymous>` | 9 | 9 | 49.2 | ✅ Clean |
|
|
38
|
+
| `<anonymous>` | 9 | 6 | 7.2 | ✅ Clean |
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Detail: lightview-x.js
|
|
43
|
+
|
|
44
|
+
| Metric | Overall Value |
|
|
45
|
+
| :--- | :--- |
|
|
46
|
+
| **SLOC** | 1012 |
|
|
47
|
+
| **Function Count** | 104 |
|
|
48
|
+
| **Avg Maintainability** | **66.70/100** |
|
|
49
|
+
|
|
50
|
+
### Top 10 High Friction Functions
|
|
51
|
+
| Function | Cognitive | Cyclomatic | MI | Status |
|
|
52
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
53
|
+
| `<anonymous>` | 23 | 20 | 0.0 | ⚠️ High |
|
|
54
|
+
| `state` | 22 | 25 | 39.6 | ⚠️ High |
|
|
55
|
+
| `handleNonStandardHref` | 16 | 12 | 36.5 | ⚠️ High |
|
|
56
|
+
| `registerStyleSheet` | 14 | 8 | 46.5 | ✅ Clean |
|
|
57
|
+
| `removeInsertedContent` | 14 | 7 | 45.5 | ✅ Clean |
|
|
58
|
+
| `convertObjectDOM` | 13 | 12 | 54.0 | ✅ Clean |
|
|
59
|
+
| `<anonymous>` | 13 | 9 | 55.7 | ✅ Clean |
|
|
60
|
+
| `activateReactiveSyntax` | 13 | 10 | 36.9 | ✅ Clean |
|
|
61
|
+
| `<anonymous>` | 12 | 12 | 44.9 | ✅ Clean |
|
|
62
|
+
| `handleSrcAttribute` | 10 | 9 | 47.1 | ✅ Clean |
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Detail: lightview-router.js
|
|
67
|
+
|
|
68
|
+
| Metric | Overall Value |
|
|
69
|
+
| :--- | :--- |
|
|
70
|
+
| **SLOC** | 141 |
|
|
71
|
+
| **Function Count** | 27 |
|
|
72
|
+
| **Avg Maintainability** | **68.59/100** |
|
|
73
|
+
|
|
74
|
+
### Top 10 High Friction Functions
|
|
75
|
+
| Function | Cognitive | Cyclomatic | MI | Status |
|
|
76
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
77
|
+
| `route` | 19 | 10 | 51.6 | ⚠️ High |
|
|
78
|
+
| `normalizePath` | 7 | 8 | 63.1 | ✅ Clean |
|
|
79
|
+
| `<anonymous>` | 5 | 6 | 50.2 | ✅ Clean |
|
|
80
|
+
| `handleRequest` | 5 | 6 | 52.6 | ✅ Clean |
|
|
81
|
+
| `fetchHandler` | 4 | 4 | 64.3 | ✅ Clean |
|
|
82
|
+
| `<anonymous>` | 4 | 4 | 24.8 | ✅ Clean |
|
|
83
|
+
| `base` | 2 | 3 | 65.1 | ✅ Clean |
|
|
84
|
+
| `<anonymous>` | 2 | 4 | 84.4 | ✅ Clean |
|
|
85
|
+
| `use` | 2 | 3 | 63.6 | ✅ Clean |
|
|
86
|
+
| `<anonymous>` | 2 | 4 | 64.7 | ✅ Clean |
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Detail: react.development.js
|
|
91
|
+
|
|
92
|
+
| Metric | Overall Value |
|
|
93
|
+
| :--- | :--- |
|
|
94
|
+
| **SLOC** | 1282 |
|
|
95
|
+
| **Function Count** | 109 |
|
|
96
|
+
| **Avg Maintainability** | **65.19/100** |
|
|
97
|
+
|
|
98
|
+
### Top 10 High Friction Functions
|
|
99
|
+
| Function | Cognitive | Cyclomatic | MI | Status |
|
|
100
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
101
|
+
| `mapIntoArray` | 33 | 39 | 23.6 | 🛑 Critical |
|
|
102
|
+
| `getComponentNameFromType` | 20 | 31 | 34.7 | ⚠️ High |
|
|
103
|
+
| `flushActQueue` | 19 | 7 | 47.0 | ⚠️ High |
|
|
104
|
+
| `<anonymous>` | 19 | 26 | 35.6 | ⚠️ High |
|
|
105
|
+
| `<anonymous>` | 18 | 20 | 35.9 | ⚠️ High |
|
|
106
|
+
| `lazyInitializer` | 9 | 9 | 37.7 | ✅ Clean |
|
|
107
|
+
| `recursivelyFlushAsyncActWork` | 9 | 5 | 51.3 | ✅ Clean |
|
|
108
|
+
| `<anonymous>` | 8 | 9 | 48.2 | ✅ Clean |
|
|
109
|
+
| `<anonymous>` | 7 | 10 | 29.6 | ✅ Clean |
|
|
110
|
+
| `<anonymous>` | 7 | 10 | 0.0 | ✅ Clean |
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Detail: bau.js
|
|
115
|
+
|
|
116
|
+
| Metric | Overall Value |
|
|
117
|
+
| :--- | :--- |
|
|
118
|
+
| **SLOC** | 458 |
|
|
119
|
+
| **Function Count** | 79 |
|
|
120
|
+
| **Avg Maintainability** | **71.26/100** |
|
|
121
|
+
|
|
122
|
+
### Top 10 High Friction Functions
|
|
123
|
+
| Function | Cognitive | Cyclomatic | MI | Status |
|
|
124
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
125
|
+
| `<anonymous>` | 20 | 17 | 34.0 | ⚠️ High |
|
|
126
|
+
| `updateBinding` | 17 | 11 | 40.0 | ⚠️ High |
|
|
127
|
+
| `replaceChildren` | 14 | 8 | 48.2 | ✅ Clean |
|
|
128
|
+
| `add` | 9 | 7 | 53.3 | ✅ Clean |
|
|
129
|
+
| `toDom` | 6 | 5 | 56.8 | ✅ Clean |
|
|
130
|
+
| `get` | 5 | 6 | 49.4 | ✅ Clean |
|
|
131
|
+
| `processDom` | 4 | 4 | 51.1 | ✅ Clean |
|
|
132
|
+
| `val` | 4 | 5 | 58.1 | ✅ Clean |
|
|
133
|
+
| `val` | 4 | 4 | 55.4 | ✅ Clean |
|
|
134
|
+
| `<anonymous>` | 3 | 6 | 49.7 | ✅ Clean |
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Detail: htmx.js
|
|
139
|
+
|
|
140
|
+
| Metric | Overall Value |
|
|
141
|
+
| :--- | :--- |
|
|
142
|
+
| **SLOC** | 4803 |
|
|
143
|
+
| **Function Count** | 335 |
|
|
144
|
+
| **Avg Maintainability** | **65.27/100** |
|
|
145
|
+
|
|
146
|
+
### Top 10 High Friction Functions
|
|
147
|
+
| Function | Cognitive | Cyclomatic | MI | Status |
|
|
148
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
149
|
+
| `issueAjaxRequest` | 116 | 73 | 5.5 | 🛑 Critical |
|
|
150
|
+
| `parseAndCacheTrigger` | 68 | 34 | 28.0 | 🛑 Critical |
|
|
151
|
+
| `doSwap` | 41 | 24 | 26.8 | 🛑 Critical |
|
|
152
|
+
| `eventListener` | 39 | 22 | 33.2 | 🛑 Critical |
|
|
153
|
+
| `handleAjaxResponse` | 34 | 29 | 22.9 | 🛑 Critical |
|
|
154
|
+
| `querySelectorAllExt` | 33 | 26 | 31.9 | 🛑 Critical |
|
|
155
|
+
| `swapWithStyle` | 29 | 16 | 38.3 | 🛑 Critical |
|
|
156
|
+
| `updateScrollState` | 27 | 23 | 39.3 | 🛑 Critical |
|
|
157
|
+
| `maybeGenerateConditional` | 26 | 9 | 42.0 | 🛑 Critical |
|
|
158
|
+
| `getSwapSpecification` | 25 | 19 | 36.1 | ⚠️ High |
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Detail: juris.js
|
|
163
|
+
|
|
164
|
+
| Metric | Overall Value |
|
|
165
|
+
| :--- | :--- |
|
|
166
|
+
| **SLOC** | 2736 |
|
|
167
|
+
| **Function Count** | 360 |
|
|
168
|
+
| **Avg Maintainability** | **70.11/100** |
|
|
169
|
+
|
|
170
|
+
### Top 10 High Friction Functions
|
|
171
|
+
| Function | Cognitive | Cyclomatic | MI | Status |
|
|
172
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
173
|
+
| `<anonymous>` | 51 | 28 | 21.2 | 🛑 Critical |
|
|
174
|
+
| `<anonymous>` | 37 | 33 | 26.4 | 🛑 Critical |
|
|
175
|
+
| `<anonymous>` | 36 | 28 | 31.2 | 🛑 Critical |
|
|
176
|
+
| `<anonymous>` | 24 | 14 | 43.2 | ⚠️ High |
|
|
177
|
+
| `<anonymous>` | 24 | 26 | 28.7 | ⚠️ High |
|
|
178
|
+
| `<anonymous>` | 22 | 12 | 44.1 | ⚠️ High |
|
|
179
|
+
| `<anonymous>` | 20 | 8 | 49.5 | ⚠️ High |
|
|
180
|
+
| `updateChildren` | 19 | 11 | 37.4 | ⚠️ High |
|
|
181
|
+
| `<anonymous>` | 18 | 23 | 38.6 | ⚠️ High |
|
|
182
|
+
| `<anonymous>` | 17 | 9 | 46.3 | ⚠️ High |
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
package/wrangler.toml
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
name = "lightview"
|
|
2
2
|
compatibility_date = "2024-01-01"
|
|
3
3
|
|
|
4
|
+
# Enable eval() and new Function() for SSR script processing
|
|
5
|
+
[unsafe]
|
|
6
|
+
eval = true
|
|
7
|
+
|
|
4
8
|
# [build]
|
|
5
9
|
# command = "npm run build"
|
|
6
10
|
|
|
@@ -8,5 +12,7 @@ compatibility_date = "2024-01-01"
|
|
|
8
12
|
# Note: Static asset headers are now defined in _headers file
|
|
9
13
|
# and the build directory is specified in the deploy command or dashboard.
|
|
10
14
|
|
|
15
|
+
# Assets directory is set via the `wrangler pages dev <directory>` command
|
|
16
|
+
# Uncomment below for Workers mode (not Pages mode):
|
|
11
17
|
[assets]
|
|
12
18
|
directory = "./dist"
|