mirror of
https://github.com/fancive/obsidian-parallel-reader.git
synced 2026-07-22 06:53:43 +00:00
- anchor.ts: precompute line-offset index once; O(log n) binary-search offsetToLine replaces two O(n) newline-count loops. findLineForAnchor takes an optional lineOffsets param (backward compatible). - cards.ts / generation.ts: build the line-offset index once per document and thread it through all card anchor resolutions (was N cards x ~9 full-document O(n) passes -> 1 O(n) pass + N x O(log n)). - anchor.ts: ASCII-whitespace charCode fast path in normalizeWithMap, deferring to /\s/ only for non-ASCII (exact semantics preserved). - settings.ts: memoize generationFingerprint by settings object identity (WeakMap) — collapses SHA-1 + stableStringify done on every file-open. - view.ts: remove keydown listener in onClose (lifecycle leak fix). Verified: tsc, build, biome, all 28 tests, e2e smoke, branch coverage 100% (new anchor regression tests added). Deferred (higher risk / test-breaking): view full-render->surgical DOM, scroll rebind guard, cache scheduleSave timing — see notes/perf-report.md. Change-Id: I17eef347471bb8233d48164e4453d492f301eac2
49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
JavaScript
const { assert, t } = require('./test-setup');
|
|
|
|
const expectedExports = [
|
|
'cardsToMarkdown',
|
|
'cancellationNoticeKey',
|
|
'summarizeDocument',
|
|
'addIconButton',
|
|
'addTextButton',
|
|
'copyToClipboard',
|
|
'resolveCliPath',
|
|
'runCli',
|
|
'buildPrompts',
|
|
'buildOpenAiChatBody',
|
|
'buildLineOffsets',
|
|
'extractJson',
|
|
'findLineForAnchor',
|
|
'folderPathsForTarget',
|
|
'getApiBaseUrl',
|
|
'generationFingerprint',
|
|
'hasUnsafeBatchFolderSegments',
|
|
'CacheManager',
|
|
'GenerationJobManager',
|
|
'createBatchRunState',
|
|
'modelForApi',
|
|
'activeSectionLine',
|
|
'touchCacheEntry',
|
|
'nextCardIndex',
|
|
'pruneCacheEntries',
|
|
'removeCardAt',
|
|
'activeIndexAfterCardDelete',
|
|
'createRafThrottledHandler',
|
|
'visibleTopProbeY',
|
|
'serializeCacheFile',
|
|
'shouldConfirmRegenerate',
|
|
'translate',
|
|
'updateCardAt',
|
|
'validateBatchFolderInput',
|
|
'normalizeSettings',
|
|
'normalizeStreamingTimeoutMs',
|
|
'normalizeCliTimeoutMs',
|
|
'normalizeCardCount',
|
|
'applyApiProviderPreset',
|
|
];
|
|
|
|
for (const name of expectedExports) {
|
|
assert.strictEqual(typeof t[name], 'function', `test-exports should include ${name}`);
|
|
}
|
|
|
|
console.log('test exports tests passed');
|