Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com>
  • Loading branch information
penalosa and hyperlint-ai[bot] authored Dec 11, 2024
1 parent 8399376 commit 58f0dd6
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/content/docs/workers/miniflare/core/fetch.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ Whenever an HTTP request is made, a `Request` object is dispatched to your worke
[`cf` object](/workers/runtime-apis/request#incomingrequestcfproperties).
Miniflare will log the method, path, status, and the time it took to respond.

If the worker throws an error whilst generating a response, an error page
If the Worker throws an error whilst generating a response, an error page
containing the stack trace is returned instead. You can use
[🗺 Source Maps](/developing/source-maps) to make these point to your source
files.

## Dispatching Events

When using the API, the `dispatchFetch` function can be used to dispatch `fetch`
events to your worker. This can be used for testing responses. `dispatchFetch`
events to your Worker. This can be used for testing responses. `dispatchFetch`
has the same API as the regular `fetch` method: it either takes a `Request`
object, or a URL and optional `RequestInit` object:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ $ curl "http://localhost:8787/todos/update/1" -H "Host: api.mf"
```

When using the API, Miniflare will use the request's URL to determine which
worker to dispatch to.
Worker to dispatch to.

```js
// Dispatches to the "api" worker
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/workers/miniflare/core/queues.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ order: 8
title: "🚥 Queues"
---

- [Queues Reference](https://developers.cloudflare.com/queues/)
- [Queues Reference](/queues/)

## Producers

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/workers/miniflare/core/scheduled.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ $ curl "http://localhost:8787/cdn-cgi/mf/scheduled?cron=*+*+*+*+*"
## Dispatching Events

When using the API, the `getWorker` function can be used to dispatch
`scheduled` events to your worker. This can be used for testing responses. It
`scheduled` events to your Worker. This can be used for testing responses. It
takes optional `scheduledTime` and `cron` parameters, which default to the
current time and the empty string respectively. It will return a promise which
resolves to an array containing data returned by all waited promises:
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/workers/miniflare/core/standards.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ title: "🕸 Web Standards"
When using the API, Miniflare allows you to substitute custom `Response`s for
`fetch()` calls using `undici`'s
[`MockAgent` API](https://undici.nodejs.org/#/docs/api/MockAgent?id=mockagentgetorigin).
This is useful for testing workers that make HTTP requests to other services. To
This is useful for testing Workers that make HTTP requests to other services. To
enable `fetch` mocking, create a
[`MockAgent`](https://undici.nodejs.org/#/docs/api/MockAgent?id=mockagentgetorigin)
using the `createFetchMock()` function, then set this using the `fetchMock`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ const mf = new Miniflare({

## Globals

Injecting arbitrary globals is not supported by [workerd](https://github.com/cloudflare/workerd). If you're using a service worker, bindings will be injected as globals, but these must be JSON-serialisable.
Injecting arbitrary globals is not supported by [workerd](https://github.com/cloudflare/workerd). If you're using a service Worker, bindings will be injected as globals, but these must be JSON-serialisable.
4 changes: 2 additions & 2 deletions src/content/docs/workers/miniflare/core/web-sockets.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ title: "✉️ WebSockets"

## Server

Miniflare will always upgrade Web Socket connections. The worker must respond
Miniflare will always upgrade Web Socket connections. The Worker must respond
with a status `101 Switching Protocols` response including a `webSocket`. For
example, the worker below implements an echo WebSocket server:
example, the Worker below implements an echo WebSocket server:

```js
export default {
Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/workers/miniflare/developing/debugger.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: "🐛 Attaching a Debugger"
This documentation describes breakpoint debugging when using Miniflare directly, which is only relevant for advanced use cases. Instead, most users should refer to the [Workers Observability documentation for how to set this up when using Wrangler](/workers/observability/dev-tools/breakpoints/).
:::

You can use regular Node.js tools to debug your workers. Setting breakpoints,
You can use regular Node.js tools to debug your Workers. Setting breakpoints,
watching values and inspecting the call stack are all examples of things you can
do with a debugger.

Expand Down Expand Up @@ -63,5 +63,5 @@ debugging.
## DevTools

Breakpoints can also be added via the Workers DevTools. For more information,
[read the guide](https://developers.cloudflare.com/workers/observability/local-development-and-testing/#devtools)
[read the guide](/workers/observability/local-development-and-testing/#devtools)
in the Cloudflare Workers docs.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ order: 2
title: ⚡️ Live Reload
---

Miniflare automatically refreshes your browser when your worker script
Miniflare automatically refreshes your browser when your Worker script
changes when `liveReload` is set to `true`.

```js
Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/workers/miniflare/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ This documentation describes the Miniflare API, which is only relevant for advan
[**Cloudflare Workers**](https://workers.cloudflare.com/). It's written in
TypeScript, and runs your code in a sandbox implementing Workers' runtime APIs.

- 🎉 **Fun:** develop workers easily with detailed logging, file watching and
- 🎉 **Fun:** develop Workers easily with detailed logging, file watching and
pretty error pages supporting source maps.
- 🔋 **Full-featured:** supports most Workers features, including KV, Durable
Objects, WebSockets, modules and more.
-**Fully-local:** test and develop Workers without an internet connection.
-**Fully-local:** test and develop Workers without an Internet connection.
Reload code on change quickly.

<LinkButton href="https://github.com/cloudflare/workers-sdk/tree/main/packages/miniflare">
Expand Down
8 changes: 4 additions & 4 deletions src/content/docs/workers/miniflare/migrations/from-v2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: ⬆️Migrating from Version 2

Miniflare v3 now uses [`workerd`](https://github.com/cloudflare/workerd), the
open-source Cloudflare Workers runtime. This is the same runtime that's deployed
on Cloudflares network, giving bug-for-bug compatibility and practically
on Cloudflare's network, giving bug-for-bug compatibility and practically
eliminating behavior mismatches. Refer to the
[Miniflare v3](https://blog.cloudflare.com/miniflare-and-workerd/) and
[Wrangler v3 announcements](https://blog.cloudflare.com/wrangler3/) for more
Expand All @@ -28,7 +28,7 @@ please open an issue on

## API Changes

We have tried to keep Miniflare v3s API close to Miniflare v2 where possible,
We have tried to keep Miniflare v3's API close to Miniflare v2 where possible,
but many options and methods have been removed or changed with the switch to the
open-source `workerd` runtime.

Expand Down Expand Up @@ -75,7 +75,7 @@ open-source `workerd` runtime.
`scriptPath` option to specify your script instead.
- `watch`
- Miniflare's API is primarily intended for testing use cases, where file
watching isn't usually required. This option was here to enable Miniflares
watching isn't usually required. This option was here to enable Miniflare's
CLI which has now been removed. If you need to watch files, consider using a
separate file watcher like
[`fs.watch()`](https://nodejs.org/api/fs.html#fswatchfilename-options-listener)
Expand Down Expand Up @@ -108,7 +108,7 @@ open-source `workerd` runtime.

const message = "The count is ";
const mf = new Miniflare({
// Options shared between workers such as HTTP and persistence configuration
// Options shared between Workers such as HTTP and persistence configuration
// should always be defined at the top level.
host: "0.0.0.0",
port: 8787,
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/workers/miniflare/storage/cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const mf = new Miniflare({

## Manipulating Outside Workers

For testing, it can be useful to put/match data from cache outside a worker. You
For testing, it can be useful to put/match data from cache outside a Worker. You
can do this with the `getCaches` method:

```js {23,24,25,26,27,28,29,30,31,32}
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/workers/miniflare/storage/d1.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const mf = new Miniflare({
## Working with D1 Databases

For testing, it can be useful to put/get data from D1 storage
bound to a worker. You can do this with the `getD1Database` method:
bound to a Worker. You can do this with the `getD1Database` method:

```js
const db = await mf.getD1Database("DB");
Expand Down

0 comments on commit 58f0dd6

Please sign in to comment.