Skip to content

Add exports field for granular imports#1523

Open
jbuckner wants to merge 1 commit intomasterfrom
fix/package-exports
Open

Add exports field for granular imports#1523
jbuckner wants to merge 1 commit intomasterfrom
fix/package-exports

Conversation

@jbuckner
Copy link
Copy Markdown
Contributor

Summary

Add an exports field to package.json enabling consumers to import specific parts of BookReader:

import '@internetarchive/bookreader'               // full shell (unchanged)
import '@internetarchive/bookreader/core'           // BookReader class only
import '@internetarchive/bookreader/jquery'          // jQuery wrapper
import '@internetarchive/bookreader/plugins/search/plugin.search.js'  // individual plugin
import '@internetarchive/bookreader/styles'          // BookReader.css

Problem

Currently, the only entry point is the full ia-bookreader shell. Consumers who want to use BookReader core with a custom shell, or who need to import jQuery/plugins separately for loading order control, have to use deep path imports that aren't guaranteed by the package contract.

Test plan

  • Verify import '@internetarchive/bookreader' still works (default entry)
  • Verify import '@internetarchive/bookreader/core' imports BookReader class
  • Verify import '@internetarchive/bookreader/jquery' sets up jQuery globals

🤖 Generated with Claude Code

Allow consumers to import specific parts of BookReader without
pulling in the full ia-bookreader shell:

  import '@internetarchive/bookreader'           // full shell
  import '@internetarchive/bookreader/core'      // BookReader class
  import '@internetarchive/bookreader/jquery'     // jQuery wrapper
  import '@internetarchive/bookreader/plugins/...' // individual plugins
  import '@internetarchive/bookreader/styles'     // BookReader.css

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.70%. Comparing base (f910ef7) to head (bd51d01).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1523   +/-   ##
=======================================
  Coverage   69.70%   69.70%           
=======================================
  Files          65       65           
  Lines        5373     5373           
  Branches     1182     1182           
=======================================
  Hits         3745     3745           
  Misses       1594     1594           
  Partials       34       34           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant