Skip to content

feat!: split cloud transports into ./google and ./sharepoint subpath exports#21

Merged
llbbl merged 1 commit into
mainfrom
feat/subpath-exports
Jul 26, 2026
Merged

feat!: split cloud transports into ./google and ./sharepoint subpath exports#21
llbbl merged 1 commit into
mainfrom
feat/subpath-exports

Conversation

@llbbl

@llbbl llbbl commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Splits the package into three entry points: . (conversion core, Transport contract, LocalFileTransport — no third-party SDK), ./google, and ./sharepoint.
  • BREAKING: cloud transports are no longer exported from the root. Import GoogleDriveTransport from polydoc-core/google and SharePointTransport from polydoc-core/sharepoint. Safe to do now since the package has never published.
  • Adds packaging validation (attw --pack + publint --strict) to CI and a regression guard that walks the built JS/declaration graphs to keep SDKs out of the root.

Changes

Subpath Exports

  • src/index.ts: Root entry point now exports only the conversion core, the Transport contract, and LocalFileTransport. Cloud transports removed.
  • src/google.ts: New ./google subpath entry point exporting GoogleDriveTransport and Google-specific types, plus a re-export of the shared contract (Transport, TransportError, TransportErrorCode, DOCX_MIME_TYPE).
  • src/sharepoint.ts: New ./sharepoint subpath entry point exporting SharePointTransport and SharePoint-specific types, plus the same shared-contract re-export.
  • package.json: Adds exports map for the three entry points with default conditions, typesVersions for node10-era type resolution, and an explicit ./package.json export. Bundle size measurement: root entry point dropped from 164 modules / ~497ms to 44 modules / ~133ms, and no longer loads @azure/msal-node.

Build System

  • .github/workflows/ci.yml: Adds check:package step running attw --pack and publint --strict. Packaging breakage (wrong export map, missing types, dual-package hazards) is invisible to lint/typecheck/tests and only surfaces for a consumer after publish.

Tests

  • tests/entrypoints.test.ts: New regression guard that walks the built JS and declaration graphs from each entry point, failing the suite if an SDK leaks back into the root — including via a lazy await import() or a type-only re-export.
  • tests/support/: Probe scripts backing the entry-point test (module-load recording, entry-point probing, shared-bindings probing).
  • tests/index.test.ts: Updated for the new root export surface.

Documentation

  • CHANGELOG.md: Documents the breaking change and the new subpath layout.
  • README.md: Updated import examples for the three entry points.

Dependencies

  • pnpm-lock.yaml: Updated for attw and publint dev dependencies.

Notes

Follow-up not addressed here: the tarball ships .js.map / .d.ts.map but not src/, so sources dangles and declarationMap go-to-definition is dead for consumers. Pre-existing, being filed separately.

Test plan

  • pnpm check passes (biome, tsc, 235 vitest tests, build, attw --pack, publint --strict)
  • js-ts-code-reviewer PASS after two review rounds

Closes #13

…exports

Three entry points now exist instead of one:

- `.` — conversion core, the Transport contract, and LocalFileTransport.
  No third-party SDK in the dependency graph.
- `./google` — GoogleDriveTransport and Google-specific types.
- `./sharepoint` — SharePointTransport and SharePoint-specific types.

BREAKING CHANGE: the cloud transports are no longer exported from the
root entry point. Import them from their subpaths instead:

  import { GoogleDriveTransport } from "polydoc-core/google"
  import { SharePointTransport } from "polydoc-core/sharepoint"

This is safe to do now because the package has never been published,
so there are no existing consumers to migrate.

Measured result: the root entry point dropped from 164 modules /
~497ms to 44 modules / ~133ms, and no longer loads `@azure/msal-node`.

Both transport subpaths re-export the shared contract (`Transport`,
`TransportError`, `TransportErrorCode`, `DOCX_MIME_TYPE`) so a
subpath-only consumer can catch and inspect errors without reaching
into the root package.

package.json now declares `typesVersions` for node10-era type
resolution, `default` conditions on each export, and an explicit
`./package.json` export.

CI gains a `check:package` step running `attw --pack` and `publint
--strict`, since packaging breakage (wrong export map, missing
types, dual-package hazards) is invisible to lint, typecheck, and
unit tests, and only surfaces for a consumer after publish.

Added a regression guard, tests/entrypoints.test.ts, that walks both
the built JS and declaration graphs from each entry point. It fails
the suite if an SDK ever leaks back into the root — including via a
lazy `await import()` or a type-only re-export.

BREAKING CHANGE: cloud transports moved out of the package root.
`GoogleDriveTransport` and `SharePointTransport` (and their
associated types) must now be imported from `polydoc-core/google`
and `polydoc-core/sharepoint` respectively instead of `polydoc-core`.

Closes #13
@llbbl
llbbl merged commit 15c9ae0 into main Jul 26, 2026
4 checks passed
@llbbl
llbbl deleted the feat/subpath-exports branch July 26, 2026 13:23
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.

Subpath exports so transports are opt-in

1 participant