package
No description provided.
npm install @pierre/path-storeGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Estimated unpacked size across 1 packages.
589.9 kB
Includes dependencies.
Registry package owners.
Underlying data structure to be used to power a file tree UI.
For the detailed architecture and implementation plan, see IMPLEMENTATION.md.
Current limitation:
flattenEmptyDirectories flattens single-child directory chains in the
visible projection while leaving canonical topology unchanged. It defaults to
true; pass false to disable it when you want one row per canonical
directory.Current useful API:
initialExpansion can seed directory visibility as 'closed', 'open', or a
numeric depth, with initialExpandedPaths acting as explicit overrides on
top.store.on(...) now emits typed semantic events with:
canonicalChangedprojectionChangedvisibleCountDeltapath, from, and tomarkDirectoryUnloaded(path)beginChildLoad(path)applyChildPatch(attempt, patch)completeChildLoad(attempt)failChildLoad(attempt, errorMessage?)getDirectoryLoadState(path)PathStoreChildPatch.metadata is currently reserved for future async/count
hints and is intentionally ignored in Phase 7A.markDirectoryUnloaded(path) is intentionally narrow in 7A: it only works for
directories that do not currently have known children.isLoading is the fast convenience flagloadState only appears when a directory row is not in the default loaded
stateknownChildCount product behavior remain
deferred to later work.createPathStoreScheduler({ store, ... })chunkBudgetMs is wall time between yields, so awaited createPatch() work
also counts against the same slice budgetstore.cleanup() defaults to stable mode and preserves IDsstore.cleanup({ mode: 'aggressive' }) is explicit and may reset IDs for
denser compactionStaticPathStore:
list(), getVisibleCount(), getVisibleSlice(), expand(), collapse()linux-5x scenariosBenchmark workflow:
bun ws path-store benchmark -- --filter '^visible-middle/linux-5x/200$'bun ws path-store benchmark -- --filter '^visible-middle/linux-5x/200$' --json --samplesbun ws path-store benchmark -- --compare baseline.json candidate.jsonChrome profiler workflow:
bun ws path-store profile:demobun ws path-store profile:demo -- --all-actionsbun ws path-store profile:demo -- --action rename-visible-folder --runs 5bun ws path-store profile:demo -- --workload demo-small --action collapse-folder-above-viewport --visible-count 30 --offset 8bun ws path-store profile:demo -- --workload demo-small --action cooperative-apply-async-patch-yieldy --runs 1Cooperative helper benchmark workflow:
bun ws path-store benchmark -- --preset full --filter '^(async/apply-child-patch/linux-5x/200|cooperative/apply-child-patch/linux-5x/200|cooperative/apply-child-patch-yieldy/linux-5x/200|cooperative/cancel-mid-queue/linux-5x/200)$'bun ws path-store benchmark -- --preset asyncbun ws path-store benchmark -- --preset mutationbun ws path-store benchmark -- --preset cleanupbun ws path-store benchmark -- --preset staticUse --json --samples when you want confidence-aware comparisons for an
automated optimization loop. Compare mode accepts a candidate when the p50
improvement clears the configured threshold and its bootstrap confidence
interval stays on the improvement side.
store.addstore.removestore.movestore.on(modification, …)import {
PathStore,
StaticPathStore,
createPathStoreScheduler,
} from '@pierre/path-store';
const paths = [
'src/components/index.ts',
'src/components/Button.tsx',
'src/components/Checkbox.tsx',
'src/index.ts',
'tmp/', // empty folders end with `/`
'package.json',
'README.md',
];
// Create a new store
const store = new PathStore({
paths,
});
// Listen for modifications
store.on('*', (event) => {
Thank you to @lukasbach for
@headless-tree/core. This project
initially used headless-tree and it many of its ideas still exist in our
implementation. More details and original license in NOTICE.md.