Skip to content

Conversation

@taylorlee
Copy link
Contributor

@taylorlee taylorlee commented Mar 26, 2025

Summary

  • Clarify which bindings are incompatible with ServiceWorker syntax - "other bindings" is not helpful.
  • Clarify SW interaction with DO - bindings are fine, implementing a DO requires MW
  • Put speed first - don't want people not using restricted bindings to miss benefit to them by skimming.
  • deeplink to images bindings
    Images bindings are hard to find from the main "images" landing page.
    Linking directly to them saves some confusion.

Screenshot

image

Documentation checklist

Images bindings are hard to find from the main "images" landing page.
Linking directly to them saves some confusion.
2. Your Worker will run faster. With service workers, bindings are exposed as globals. This means that for every request, the Workers runtime must create a new JavaScript execution context, which adds overhead and time. Workers written using ES modules can reuse the same execution context across multiple requests.
3. You can [gradually deploy changes to your Worker](/workers/configuration/versions-and-deployments/gradual-deployments/) when you use the ES modules format.
4. You can easily publish Workers using ES modules to `npm`, allowing you to import and reuse Workers within your codebase.
1. Your Worker will run faster. With service workers, bindings are exposed as globals. This means that for every request, the Workers runtime must create a new JavaScript execution context, which adds overhead and time. Workers written using ES modules can reuse the same execution context across multiple requests.
Copy link
Contributor

Choose a reason for hiding this comment

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

Identified issues

  • Vale Style Guide - (Terms-error) Use 'Workers' instead of 'workers'.

Proposed fix

Suggested change
1. Your Worker will run faster. With service workers, bindings are exposed as globals. This means that for every request, the Workers runtime must create a new JavaScript execution context, which adds overhead and time. Workers written using ES modules can reuse the same execution context across multiple requests.
1. Your Workers will run faster. With service workers, bindings are exposed as globals. This means that for every request, the Workers runtime must create a new JavaScript execution context, which adds overhead and time. Workers written using ES modules can reuse the same execution context across multiple requests.

The term 'workers' should be capitalized to 'Workers' to comply with the style guide.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a description about the effects to the singular Worker being migrated.

@hyperlint-ai
Copy link
Contributor

hyperlint-ai bot commented Mar 26, 2025

Howdy and thanks for contributing to our repo. The Cloudflare team reviews new, external PRs within two (2) weeks. If it's been two weeks or longer without any movement, please tag the PR Assignees in a comment.

We review internal PRs within 1 week. If it's something urgent or has been sitting without a comment, start a thread in the Developer Docs space internally.


PR Change Summary

Clarified bindings compatibility with module-worker syntax and improved navigation for image bindings.

  • Specified which bindings are incompatible with ServiceWorker syntax.
  • Emphasized the performance benefits of using ES modules for Workers.
  • Updated links for easier access to image bindings.

Modified Files

  • src/content/docs/workers/reference/migrate-to-module-workers.mdx
  • src/content/docs/workers/runtime-apis/bindings/images.mdx

How can I customize these reviews?

Check out the Hyperlint AI Reviewer docs for more information on how to customize the review.

If you just want to ignore it on this PR, you can add the hyperlint-ignore label to the PR. Future changes won't trigger a Hyperlint review.

Note specifically for link checks, we only check the first 30 links in a file and we cache the results for several hours (for instance, if you just added a page, you might experience this). Our recommendation is to add hyperlint-ignore to the PR to ignore the link check for this PR.

What is Hyperlint?

Hyperlint is an AI agent that helps you write, edit, and maintain your documentation.

Learn more about the Hyperlint AI reviewer and the checks that we can run on your documentation.

@taylorlee taylorlee merged commit 52ddd22 into production Mar 27, 2025
12 checks passed
@taylorlee taylorlee deleted the tlee/update-sw-bindings-doc branch March 27, 2025 15:34
RebeccaTamachiro pushed a commit that referenced this pull request Apr 21, 2025
* [Workers] Clarify which bindings are incompatible with ServiceWorkers

* [Workers] deeplink to images bindings

Images bindings are hard to find from the main "images" landing page.
Linking directly to them saves some confusion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:workers Related to Workers product size/s

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants