EANCH-WP-0001 T05 (prep): make root a full barrel for umbrella cutover
The umbrella's DOM tests vi.mock the single @anchor/index barrel (spreading the original and overriding PdfSpikeViewer). To keep the cutover a mechanical specifier swap and preserve those mocks, the evidence-anchor root re-exports the full surface (pure core + PDF adapter), matching the prior @anchor/index. evidence-anchor/pdf remains a focused viewer entry. Viewer code still lives only under src/pdf/ (eslint-enforced). Repo stays green: 30 tests, tc, lint. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
243cb41938
commit
d5c5155df8
3 changed files with 37 additions and 14 deletions
15
README.md
15
README.md
|
|
@ -62,13 +62,14 @@ Boundary rules for the layout (enforced by `eslint.config.js`):
|
|||
are confined to `src/pdf/` — the pure zone (`src/selectors/**`, `src/types.ts`)
|
||||
may not import them;
|
||||
- `src/selectors/` is pure and depends only on `citation-engine` shared types;
|
||||
- the **root** entrypoint (`evidence-anchor`) exposes only the pure surface —
|
||||
`createSelectors`, `resolveSelectors`, the selector/resolution types, and the
|
||||
`DocumentViewerAdapter` contract;
|
||||
- the concrete PDF adapter is reached through the **`evidence-anchor/pdf`**
|
||||
subpath, so pure consumers never pull PDF.js or React into their bundle. That
|
||||
adapter is still the explicitly-named `PdfSpikeViewer` spike; promoting it to
|
||||
a production `PDFViewerAdapter` is registered follow-on work (T06).
|
||||
- the **root** entrypoint (`evidence-anchor`) is the full barrel — selector
|
||||
creation/resolution, the adapter types/contract, and the PDF adapter — so
|
||||
consumers resolve every anchor symbol (and their test `vi.mock(...)` calls)
|
||||
from a single specifier, matching the umbrella's prior `@anchor/index`;
|
||||
- a focused, viewer-free entry is also published at **`evidence-anchor/pdf`**
|
||||
for consumers that want the PDF surface explicitly. The concrete adapter is
|
||||
still the explicitly-named `PdfSpikeViewer` spike; promoting it to a
|
||||
production `PDFViewerAdapter` is registered follow-on work (T06).
|
||||
|
||||
## Public API (target surface)
|
||||
|
||||
|
|
|
|||
34
src/index.ts
34
src/index.ts
|
|
@ -1,16 +1,38 @@
|
|||
// Public entrypoint for `evidence-anchor`.
|
||||
// Public entrypoint for `evidence-anchor` — the full barrel.
|
||||
//
|
||||
// The stable surface consumers depend on:
|
||||
// - adapter-side types + the viewer contract (./types)
|
||||
// - selector creation / resolution (./selectors)
|
||||
// Mirrors the surface the umbrella previously consumed as `@anchor/index`, so
|
||||
// consumers (and their `vi.mock(...)` calls) resolve every anchor symbol from a
|
||||
// single specifier. Viewer *code* still lives only under `src/pdf/` (enforced
|
||||
// by eslint); this barrel merely re-exports it.
|
||||
//
|
||||
// The concrete PDF adapter lives behind the `evidence-anchor/pdf` subpath
|
||||
// (./pdf) so pure consumers do not pull PDF.js or React into their bundle.
|
||||
// A focused, viewer-free entry is also available at `evidence-anchor/pdf` for
|
||||
// consumers that want the PDF surface explicitly — but importing the package
|
||||
// root pulls in the PDF adapter, matching the pre-extraction behaviour.
|
||||
|
||||
// Adapter-side types + the viewer contract.
|
||||
export * from "./types";
|
||||
|
||||
// Selector creation / resolution (pure core).
|
||||
export {
|
||||
createSelectors,
|
||||
resolveSelectors,
|
||||
DEFAULT_CONTEXT_CHARS,
|
||||
type CreateSelectorsOptions,
|
||||
} from "./selectors";
|
||||
|
||||
// PDF adapter + helpers (re-exported from the src/pdf/ boundary).
|
||||
export {
|
||||
PdfSpikeViewer,
|
||||
getHighlightClientRects,
|
||||
selectorsFromPdfCapture,
|
||||
findPdfRectSelector,
|
||||
findTextQuoteSelector,
|
||||
unionRect,
|
||||
runScrollToHighlightJob,
|
||||
DEFAULT_SCROLL_ATTEMPTS,
|
||||
type PdfSpikeViewerProps,
|
||||
type StoredAnnotation,
|
||||
type ScrollToHighlightJob,
|
||||
type ScrollToHighlightDeps,
|
||||
type ScrollToHighlightState,
|
||||
} from "./pdf";
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ implementation remains behind `DocumentViewerAdapter`.
|
|||
|
||||
```task
|
||||
id: EANCH-WP-0001-T05
|
||||
status: wait
|
||||
status: progress
|
||||
priority: high
|
||||
depends_on: [T03, T04]
|
||||
state_hub_task_id: "2fd9bd62-5d79-49b5-aee7-45e0a37313ba"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue