Skip to content

Bundle fork of capnweb directly - #99

Merged
ryanrasti merged 1 commit into
mainfrom
capnweb-bundled
Aug 6, 2026
Merged

Bundle fork of capnweb directly#99
ryanrasti merged 1 commit into
mainfrom
capnweb-bundled

Conversation

@ryanrasti

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the Typegres packaging and documentation so the project’s fork of capnweb is bundled into typegres/capnweb (rather than requiring consumers to install/import capnweb directly), including a Workers-specific build routed via export conditions.

Changes:

  • Force-bundle capnweb in the library build and add a workerd-conditioned typegres/capnweb export that resolves a Workers-compatible bundle.
  • Re-export the needed capnweb surface from typegres/capnweb and update examples/docs to import from typegres/capnweb only.
  • Strengthen README snippet testing by installing from a real packed tarball (to match published-consumer resolution) and add coverage for the new RPC README section.

Reviewed changes

Copilot reviewed 10 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tsdown.config.ts Forces bundling of capnweb and adds a workerd-conditioned shim build.
src/readme.test.ts Switches working-tree install to npm pack tarball and adds RPC section execution assertions.
src/capnweb/shim.ts Re-exports capnweb runtime surface from typegres/capnweb to keep a single effective copy in consumer code.
README.md Adds an RPC section and documents importing Cap’n Web APIs from typegres/capnweb (not capnweb).
package.json Routes typegres/capnweb via conditional exports and moves capnweb to devDependencies.
package-lock.json Updates lockfile to reflect capnweb as dev-only.
examples/chat/worker/chat-do.ts Updates imports to use typegres/capnweb.
examples/chat/tests/facet-spike.test.ts Updates imports to use typegres/capnweb.
examples/chat/tests/capabilities.test.ts Updates imports to use typegres/capnweb.
examples/chat/src/rpc.ts Updates imports to use typegres/capnweb.
examples/chat/package.json Removes direct capnweb dependency.
examples/chat/package-lock.json Updates lockfile after removing capnweb dependency.
Files not reviewed (1)
  • examples/chat/package-lock.json: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/readme.test.ts
Comment on lines +59 to +66
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "typegres-pack-"));
const { stdout } = await execFileP(
"npm",
["pack", "--pack-destination", dir, "--silent"],
{ cwd: REPO_ROOT },
);
return path.join(dir, stdout.trim().split("\n").pop()!);
})();
`capnweb` was a runtime dependency with a `file:packages/capnweb`
specifier, while `files: ["dist"]` meant `packages/` never shipped. npm
resolves that by creating node_modules/capnweb as a symlink to a path
that doesn't exist inside the installed package, so `npm install
typegres` exits 0 and `import "typegres/capnweb"` then dies with
ERR_MODULE_NOT_FOUND. The one feature the README lists as shipped, and
the foundation of examples/chat, did not work for any consumer.

capnweb is now bundled into the entry point. It can't be an ordinary
dependency until cloudflare/capnweb#162 lands: the shim needs five
commits that aren't in the published 0.6.1 (closure serialization,
synchronous replay, zero-arg closures, getLocalTarget).
@ryanrasti
ryanrasti merged commit 0af7580 into main Aug 6, 2026
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.

2 participants