utils/web_ui/dist/text.js
Krzysztof kuhy Rudnicki 53f281620e web_ui: commit the real tsc output so dist-fresh can pass
`web-ui-tests` has been red since 6714d13 and the cause was not a stale dist/:
the content is byte-identical. Every one of the 16 files differed only by a
trailing newline that tsc does not emit.

Where the newline came from: at 03bf1ed the subproject config had no exclude,
so pre-commit's end-of-file-fixer appended a newline to each generated file.
eaa5683 added `exclude: ^web_ui/dist/` to stop that recurring, but did not
revert the newlines already committed -- leaving a dist/ that no `pnpm build`
can ever reproduce, and therefore a job that could never go green.

It looked fine locally because `tsc -b` is incremental: with a warm
tsconfig.tsbuildinfo it skips emit entirely, so `pnpm build` was a no-op and
printed no diff. CI has no cache, always emits, and always failed. Deleting
tsbuildinfo reproduces the failure locally in one command.

Verified: after deleting tsbuildinfo and all of dist/, a from-scratch
`pnpm build` reproduces exactly what is committed here -- `git diff
--exit-code -- dist` is clean, which is the assertion CI makes. pnpm lint
passes and pnpm coverage is 84 tests, 100% statements/branches/functions.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CFSGeWxHPY5rHUGrPqhcmG
2026-08-22 16:19:09 +02:00

27 lines
967 B
JavaScript

/**
* Small text helpers shared by the consumers' filter layers.
*
* Hand-rolled rather than pulling in Fuse.js, matching the house posture of no
* runtime dependencies for things this small.
*/
/**
* Case-insensitive subsequence match: every character of `query` appears in
* `target`, in order, though not necessarily adjacently. An empty query matches
* everything, so callers can pass the raw search box value straight through.
*
* dufs-cloud called this `fuzzyMatch` and awesome-mcp-explorer `matchesFuzzy`;
* the implementations were identical apart from identifier names.
*/
export function fuzzyMatch(query, target) {
if (query === "")
return true;
const q = query.toLowerCase();
const t = target.toLowerCase();
let index = 0;
for (let scan = 0; scan < t.length && index < q.length; scan++) {
if (t[scan] === q[index])
index++;
}
return index === q.length;
}
//# sourceMappingURL=text.js.map