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`)
|
are confined to `src/pdf/` — the pure zone (`src/selectors/**`, `src/types.ts`)
|
||||||
may not import them;
|
may not import them;
|
||||||
- `src/selectors/` is pure and depends only on `citation-engine` shared types;
|
- `src/selectors/` is pure and depends only on `citation-engine` shared types;
|
||||||
- the **root** entrypoint (`evidence-anchor`) exposes only the pure surface —
|
- the **root** entrypoint (`evidence-anchor`) is the full barrel — selector
|
||||||
`createSelectors`, `resolveSelectors`, the selector/resolution types, and the
|
creation/resolution, the adapter types/contract, and the PDF adapter — so
|
||||||
`DocumentViewerAdapter` contract;
|
consumers resolve every anchor symbol (and their test `vi.mock(...)` calls)
|
||||||
- the concrete PDF adapter is reached through the **`evidence-anchor/pdf`**
|
from a single specifier, matching the umbrella's prior `@anchor/index`;
|
||||||
subpath, so pure consumers never pull PDF.js or React into their bundle. That
|
- a focused, viewer-free entry is also published at **`evidence-anchor/pdf`**
|
||||||
adapter is still the explicitly-named `PdfSpikeViewer` spike; promoting it to
|
for consumers that want the PDF surface explicitly. The concrete adapter is
|
||||||
a production `PDFViewerAdapter` is registered follow-on work (T06).
|
still the explicitly-named `PdfSpikeViewer` spike; promoting it to a
|
||||||
|
production `PDFViewerAdapter` is registered follow-on work (T06).
|
||||||
|
|
||||||
## Public API (target surface)
|
## 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:
|
// Mirrors the surface the umbrella previously consumed as `@anchor/index`, so
|
||||||
// - adapter-side types + the viewer contract (./types)
|
// consumers (and their `vi.mock(...)` calls) resolve every anchor symbol from a
|
||||||
// - selector creation / resolution (./selectors)
|
// 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
|
// A focused, viewer-free entry is also available at `evidence-anchor/pdf` for
|
||||||
// (./pdf) so pure consumers do not pull PDF.js or React into their bundle.
|
// 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";
|
export * from "./types";
|
||||||
|
|
||||||
|
// Selector creation / resolution (pure core).
|
||||||
export {
|
export {
|
||||||
createSelectors,
|
createSelectors,
|
||||||
resolveSelectors,
|
resolveSelectors,
|
||||||
DEFAULT_CONTEXT_CHARS,
|
DEFAULT_CONTEXT_CHARS,
|
||||||
type CreateSelectorsOptions,
|
type CreateSelectorsOptions,
|
||||||
} from "./selectors";
|
} 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
|
```task
|
||||||
id: EANCH-WP-0001-T05
|
id: EANCH-WP-0001-T05
|
||||||
status: wait
|
status: progress
|
||||||
priority: high
|
priority: high
|
||||||
depends_on: [T03, T04]
|
depends_on: [T03, T04]
|
||||||
state_hub_task_id: "2fd9bd62-5d79-49b5-aee7-45e0a37313ba"
|
state_hub_task_id: "2fd9bd62-5d79-49b5-aee7-45e0a37313ba"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue