Repository navigation
fix(plugin-gateway): export the documented ./rest and ./ws subpaths - #129
Conversation
The README lists `@wolfstar/plugin-gateway/rest` and `@wolfstar/plugin-gateway/ws`, re-exporting `@discordjs/rest` and `@discordjs/ws` like `@discordjs/next` does, but `package.json#exports` only had `.`, so importing either failed with `ERR_PACKAGE_PATH_NOT_EXPORTED`. Both are now built as their own entrypoints and checked by attw. A test asserts the exports entries and that every export of the original packages is re-exported as the same reference. Refs #121 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RBWEHLtNzWNykJMPqeqqbB
# Conflicts: # packages/plugin-gateway/package.json # packages/plugin-gateway/tsdown.config.ts
◈ PR Lens
Architecture 2 components touched across 5 lanes. Play the interactive walkthrough Data flow No data-flow sequence changed in this PR. View
Tip Run 🪧 More tips
Thanks for using PR Lens! It's built by Coldtea, free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the full diff adding the ./rest and ./ws subpaths to @wolfstar/plugin-gateway.
src/rest.ts/src/ws.ts: new two-line entrypoints re-exporting@discordjs/rest/@discordjs/wsin full (export *).package.json#exports: adds./restand./wsin the same{ import: { types, default } }shape as the existing.and./registerentries.tsdown.config.ts: adds both new files toentryandattwEntrypointsso they get built and type-checked.tests/subpaths.test.ts: asserts theexportsmap shape per subpath, and that every export of the upstream package is re-exported as the identical reference.- Changeset: patch bump for
@wolfstar/plugin-gateway, in the same style as the priorregister-entrypoints.mdchangeset.
I confirmed independently that neither @discordjs/rest nor @discordjs/ws has a default export (checked their built .d.ts), so export * genuinely loses nothing, and that both are already runtime dependencies of the package — no new dependency introduced. RFC #121 item 4 scopes this fix to plugin-gateway only, so leaving plugin-cache/plugin-sharder untouched is correct rather than an oversight. The new subpaths precisely mirror the package's existing ./register convention (exports shape, tsdown config, changeset style, comment style). Mechanical, well-tested, no concerns.
Claude Sonnet | 𝕏

🔗 Linked issue
Part of #121 (item 4: README documents subpaths that are not exported).
🧭 Context
The README's "Subpath exports" section lists
@wolfstar/plugin-gateway/rest(for@discordjs/rest) and@wolfstar/plugin-gateway/ws(for@discordjs/ws).package.json#exportsdidn't define either, so importing them failed withERR_PACKAGE_PATH_NOT_EXPORTED.📚 Description
This adds the two documented subpaths, keeping the README as it is. Each re-exports its package, the way
@discordjs/nextdoes; both packages are already runtime dependencies of the gateway. Each subpath is built as its own entrypoint and checked by attw.export *loses nothing, because neither package has a default export.version, but each one lives in its own entrypoint, so the names don't clash.Key changes
src/rest.ts/src/ws.ts:export * from "@discordjs/rest"/"@discordjs/ws".package.json#exports:./restand./ws, in the same shape as"."and./register.tsdown.config.ts: newentryfiles andattwEntrypoints: [".", "./register", "./rest", "./ws"].tests/subpaths.test.ts: checks theexportsentries, and that every export of@discordjs/rest/@discordjs/wsis re-exported as the same reference (same key set, each valuetoBe).@wolfstar/plugin-gatewaypatch.Type of Change
Pre-flight Checklist
main)pnpm changesetAlso checked:
pnpm lint,pnpm typecheck, and the gateway build (attw and publint clean on.,./register,./rest,./ws). After building,await import('@wolfstar/plugin-gateway/rest' | '/ws' | '/register')resolves from inside the package;/resthas 20 exports and/wshas 23.🤖 Generated with Claude Code
https://claude.ai/code/session_01RBWEHLtNzWNykJMPqeqqbB
Generated by Claude Code