-
Notifications
You must be signed in to change notification settings - Fork 232
fix: resolve 4 bugs in termui #3517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -44,7 +44,7 @@ export function collectDeps(content: string): string[] { | |||||
| const deps = new Set<string>(); | ||||||
| let m: RegExpExecArray | null; | ||||||
| while ((m = re.exec(content)) !== null) deps.add(m[1]!); | ||||||
| return [...deps].sort(); | ||||||
| return [...deps].sort((a, b) => a - b); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "## file list"
git ls-files | rg '(^|/)build-registry(\.test)?\.ts$|scripts/build-registry' || true
echo "## scripts/build-registry.ts outline"
ast-grep outline scripts/build-registry.ts --view compact || true
echo "## scripts/build-registry.ts relevant lines"
sed -n '1,90p' scripts/build-registry.ts
echo "## tests around registry sorting"
sed -n '100,155p' scripts/build-registry.test.ts
echo "## JS runtime behavior for array of strings subtracting"
node - <<'JS'
const deps = ['zebra', 'apple', 'Mango', 'banana'];
console.log(JSON.stringify([
deps.map(v => {
const values = [];
const result = [...deps].sort((a, b) => (values.push([JSON.stringify([a,b]), a-b]), [].sort((a, b) => a - b)(v)).flat())
return undefined;
})
)));
console.log(JSON.stringify({
directSubtractionDemo: deps.map((a,i) => a + ' - ' + deps[i] + ' = ' + (a - deps[i])),
sortBefore: JSON.stringify(deps),
sortMinusComparator: JSON.stringify([...deps].sort((a, b) => a - b)),
naturalSort: JSON.stringify([...deps].sort()),
}))
JSRepository: Karanjot786/TermUI Length of output: 7130 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "## runtime behavior for string comparator and JS/TC semantics"
node - <<'JS'
const src = [
`import { Widget } from '`@termuijs/widgets`';`,
`import { Screen } from '`@termuijs/core`';`,
`import { timerPoolSubscribe } from '`@termuijs/motion`';`,
`import { Widget as W2 } from '`@termuijs/widgets`';`,
].join('\n');
const re = /from\s+['"](`@termuijs`\/[a-z-]+)['"]/g;
const deps = new Set();
let m;
while ((m = re.exec(src)) !== null) deps.add(m[1]);
const list = [...deps];
console.log(JSON.stringify({
directSubtractionDemo: {
a: JSON.stringify('`@termuijs/widgets` - `@termuijs/core` = ' + ('`@termuijs/widgets`' - '`@termuijs/core`')),
comparison: JSON.stringify('`@termuijs/motion`' < '`@termuijs/widgets`')
},
sortWithSubtractionComparator: JSON.stringify([...list].sort((a, b) => a - b)),
defaultStringSort: JSON.stringify([...list].sort()),
expected: JSON.stringify(['`@termuijs/core`', '`@termuijs/motion`', '`@termuijs/widgets`']),
inputOrder: JSON.stringify(list)
}));
JSRepository: Karanjot786/TermUI Length of output: 657 Use a string comparator for dependency identifiers. Line 47 subtracts Proposed fix- return [...deps].sort((a, b) => a - b);
+ return [...deps].sort();📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| } | ||||||
|
|
||||||
| export function toSlug(name: string): string { | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
Fix the malformed
.catchcallback.Line 383 is invalid TypeScript because the arrow function has no parameter list. This prevents
packages/dev-server/src/server.tsfrom parsing. Pass the rejection value toconsole.error:Proposed fix
Static analysis confirms the parser error at Line 383.
📝 Committable suggestion
🧰 Tools
🪛 Biome (2.5.6)
[error] 383-383: Expected a parenthesis '(' but instead found '=>'.
(parse)
🤖 Prompt for AI Agents
Source: Linters/SAST tools