Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to capnp-es #7788

Merged
merged 14 commits into from
Jan 28, 2025
Merged

Switch to capnp-es #7788

merged 14 commits into from
Jan 28, 2025

Conversation

penalosa
Copy link
Contributor

@penalosa penalosa commented Jan 15, 2025

The capnp-ts dependency we use for Miniflare (and for type generation in workerd for constructing and reading the capnp format for the runtime) is blocking workerd upgrading TS versions to 5.7 (and will block Miniflare when we get around to upgrading—we're currently on 5.6). capnp-ts effectively abandoned and hasn't been touched in 4 years, so this PR switches us to use capnp-es. It's a followup to unjs/capnp-es#10.


  • Tests
    • TODO (before merge)
    • Tests included
    • Tests not necessary because: This change is covered by existing tests
  • E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • I don't know
    • Required
    • Not required because:
  • Public documentation
    • TODO (before merge)
    • Cloudflare docs PR(s):
    • Documentation not necessary because: internal packaging change

Copy link

changeset-bot bot commented Jan 15, 2025

🦋 Changeset detected

Latest commit: 12839b4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
miniflare Patch
@cloudflare/pages-shared Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch
wrangler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@penalosa penalosa added the e2e Run wrangler e2e tests on a PR label Jan 20, 2025
@penalosa penalosa force-pushed the penalosa/use-capnp-es branch from 82f3c67 to 47ba5eb Compare January 20, 2025 19:54
@penalosa penalosa marked this pull request as ready for review January 20, 2025 19:55
@penalosa penalosa requested review from a team as code owners January 20, 2025 19:55
@@ -30,8 +30,7 @@
"bootstrap.js"
],
"scripts": {
"build": "node scripts/build.mjs && pnpm run types:build",
"capnp:workerd": "capnpc -o ts src/runtime/config/workerd.capnp",
"build": "capnp-es node_modules/workerd/workerd.capnp -ots && mv node_modules/workerd/workerd.ts src/runtime/config/generated.ts && node scripts/build.mjs && pnpm run types:build",
Copy link
Contributor

Choose a reason for hiding this comment

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

Is mv going to work on Windows?

Generally it is better to put this stuff into a Node.js script I think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

Assuming all the CI checks pass!

const hashBuffer = await crypto.subtle.digest("SHA-256", data.buffer);
const hashBuffer = await crypto.subtle.digest(
"SHA-256",
data.buffer as ArrayBuffer
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this cast now necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Part of this involved upgrading TS to 5.7 from 5.6 for the Miniflare package—I can probably remove that, but it was causing some issues with capnp-es

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

github-actions bot commented Jan 20, 2025

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13000773808/npm-package-wrangler-7788

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/7788/npm-package-wrangler-7788

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13000773808/npm-package-wrangler-7788 dev path/to/script.js
Additional artifacts:

cloudflare-workers-bindings-extension:

wget https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13000773808/npm-package-cloudflare-workers-bindings-extension-7788 -O ./cloudflare-workers-bindings-extension.0.0.0-v8d1a52a72.vsix && code --install-extension ./cloudflare-workers-bindings-extension.0.0.0-v8d1a52a72.vsix

create-cloudflare:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13000773808/npm-package-create-cloudflare-7788 --no-auto-update

@cloudflare/kv-asset-handler:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13000773808/npm-package-cloudflare-kv-asset-handler-7788

miniflare:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13000773808/npm-package-miniflare-7788

@cloudflare/pages-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13000773808/npm-package-cloudflare-pages-shared-7788

@cloudflare/unenv-preset:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13000773808/npm-package-cloudflare-unenv-preset-7788

@cloudflare/vite-plugin:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13000773808/npm-package-cloudflare-vite-plugin-7788

@cloudflare/vitest-pool-workers:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13000773808/npm-package-cloudflare-vitest-pool-workers-7788

@cloudflare/workers-editor-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13000773808/npm-package-cloudflare-workers-editor-shared-7788

@cloudflare/workers-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13000773808/npm-package-cloudflare-workers-shared-7788

@cloudflare/workflows-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13000773808/npm-package-cloudflare-workflows-shared-7788

Note that these links will no longer work once the GitHub Actions artifact expires.


wrangler@3.105.1 includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20250124.0
workerd 1.20250124.0 1.20250124.0
workerd --version 1.20250124.0 2025-01-24

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

@penalosa penalosa force-pushed the penalosa/use-capnp-es branch from 8e9d944 to 95d7afb Compare January 21, 2025 18:18
@penalosa penalosa force-pushed the penalosa/use-capnp-es branch from 95d7afb to 3e97c20 Compare January 27, 2025 18:01
@penalosa penalosa requested a review from a team as a code owner January 27, 2025 18:01
@penalosa penalosa merged commit cf4f47a into main Jan 28, 2025
35 checks passed
@penalosa penalosa deleted the penalosa/use-capnp-es branch January 28, 2025 12:21
@edmundhung edmundhung mentioned this pull request Jan 28, 2025
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e Run wrangler e2e tests on a PR
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants