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

[Miniflare 3] Minor assorted doc fixups #743

Merged
merged 7 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions docs/src/content/core/compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ order: 8

## Compatibility Dates

Like the Workers runtime, Miniflare uses compatibility dates to opt-into
backwards-incompatible changes from a specific date. If one isn't set, it will
default to some time far in the past.
Miniflare uses compatibility dates to opt-into backwards-incompatible changes
from a specific date. If one isn't set, it will default to some time far in the
past.

import ConfigTabs from "../components/mdx/config-tabs";

Expand All @@ -33,17 +33,3 @@ const mf = new Miniflare({
],
});
```

Specifically Miniflare supports the following flags:

- `nodejs_compat` (specifically the `node:assert`, `node:async_hooks`,
`node:buffer`, `node:events`, `node:util` modules)
- [`transformstream_enable_standard_constructor`/`transformstream_disable_standard_constructor`](https://developers.cloudflare.com/workers/platform/compatibility-dates#compliant-transformstream-constructor)
- [`streams_enable_constructors`/`streams_disable_constructors`](https://developers.cloudflare.com/workers/platform/compatibility-dates#streams-constructors)
- [`export_commonjs_default`/`export_commonjs_namespace`](https://developers.cloudflare.com/workers/platform/compatibility-dates#commonjs-modules-do-not-export-a-module-namespace)
- [`r2_list_honor_include`](https://developers.cloudflare.com/workers/platform/compatibility-dates#r2-bucket-list-respects-the-include-option)
- [`global_navigator`/`no_global_navigator`](https://developers.cloudflare.com/workers/platform/compatibility-dates#global-navigator)
- [`durable_object_fetch_requires_full_url`/`durable_object_fetch_allows_relative_url`](https://developers.cloudflare.com/workers/platform/compatibility-dates#durable-object-stubfetch-requires-a-full-url)
- [`fetch_refuses_unknown_protocols`/`fetch_treats_unknown_protocols_as_http`](https://developers.cloudflare.com/workers/platform/compatibility-dates#fetch-improperly-interprets-unknown-protocols-as-http)
- [`formdata_parser_supports_files`/`formdata_parser_converts_files_to_strings`](https://developers.cloudflare.com/workers/platform/compatibility-dates#formdata-parsing-supports-file)
- [`html_rewriter_treats_esi_include_as_void_tag`](https://developers.cloudflare.com/workers/platform/compatibility-dates#htmlrewriter-handling-of-esiinclude)
20 changes: 0 additions & 20 deletions docs/src/content/core/html-rewriter.md

This file was deleted.

32 changes: 4 additions & 28 deletions docs/src/content/core/standards.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,6 @@ order: 6
- [Using Streams](https://developers.cloudflare.com/workers/learning/using-streams)
- [Web Crypto Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto)

Miniflare supports the following Web Standards in its sandbox:

- **Console:** `console.*`
- **Timers:** `setTimeout`, `setInterval`, `clearTimeout`, `clearInterval`,
`queueMicrotask`, `AbortSignal.timeout`, `scheduler.wait`
- **Base64:** `atob`, `btoa`
- **Web Crypto**: `crypto.getRandomValues`, `crypto.randomUUID`,
`crypto.subtle.*` (with support for `MD5` digests and `NODE-ED25519`
signatures), `crypto.DigestStream`
- **Encoding:** `TextEncoder`, `TextDecoder`
- **Fetch:** `fetch`, `Headers` (including
[non-standard `getAll` method](https://developers.cloudflare.com/workers/runtime-apis/headers#differences)),
`Request`, `Response`, `FormData`, `Blob`, `File`, `URL`, `URLPattern`,
`URLSearchParams` (powered by [`undici`](https://github.com/nodejs/undici/))
- **Streams:** `ByteLengthQueuingStrategy`, `CountQueuingStrategy`,
`ReadableByteStreamController`, `ReadableStream`, `ReadableStreamBYOBReader`
(including non-standard `readAtLeast` method), `ReadableStreamBYOBRequest`,
`ReadableStreamDefaultController`, `ReadableStreamDefaultReader`,
`TransformStream`, `TransformStreamDefaultController`, `WritableStream`,
`WritableStreamDefaultController`, `WritableStreamDefaultWriter`,
`IdentityTransformStream`, `FixedLengthStream`, `CompressionStream`,
`DecompressionStream`, `TextEncoderStream`, `TextDecoderStream`
- **Events:** `Event`, `EventTarget`, `AbortController`, `AbortSignal`
- **Event Types:** `fetch`, `scheduled`, `unhandledrejection`,
`rejectionhandled`
- **Misc:** `structuredClone`, `navigator`

## Mocking Outbound `fetch` Requests

When using the API, Miniflare allows you to substitute custom `Response`s for
Expand Down Expand Up @@ -91,7 +64,10 @@ console.log(await res.text()); // "response:Mocked response!"

## Subrequests

Miniflare does not support limiting the amount of [subrequests](https://developers.cloudflare.com/workers/platform/limits#account-plan-limits). Please keep this in mind if you make a large amount of subrequests from your Worker.
Miniflare does not support limiting the amount of
[subrequests](https://developers.cloudflare.com/workers/platform/limits#account-plan-limits).
Please keep this in mind if you make a large amount of subrequests from your
Worker.

## Global Functionality Limits

Expand Down
7 changes: 3 additions & 4 deletions docs/src/content/core/web-sockets.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ order: 4

## Server

When using the `createServer` method, Miniflare will always upgrade
Web Socket connections. The worker must then respond with a status
`101 Switching Protocols` response including a `webSocket`. For example, the
worker below implements an echo WebSocket server:
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:

```js
export default {
Expand Down
Binary file modified docs/src/content/developing/debugger-webstorm-node-run.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/src/content/developing/debugger-webstorm-settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 12 additions & 10 deletions docs/src/content/developing/debugger.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ order: 4

# 🐛 Attaching a Debugger

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.
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.

If you're building your worker beforehand (e.g. with esbuild, Webpack, Rollup),
make sure you're outputting
Expand All @@ -19,7 +19,8 @@ proceeding.

The easiest way to debug a Worker in VSCode is to create a new configuration.

Open the **Run and Debug** menu in the VSCode activity bar and create a `.vscode/launch.json` file that contains the following:
Open the **Run and Debug** menu in the VSCode activity bar and create a
`.vscode/launch.json` file that contains the following:

```json
---
Expand All @@ -41,9 +42,8 @@ filename: .vscode/launch.json
}
```

From the **Run and Debug** menu in the activity bar, select the
`Miniflare` configuration, and click the green play button to start
debugging.
From the **Run and Debug** menu in the activity bar, select the `Miniflare`
configuration, and click the green play button to start debugging.

## WebStorm

Expand All @@ -52,8 +52,8 @@ Create a new configuration, by clicking **Add Configuration** in the top right.
![WebStorm add configuration button](./debugger-webstorm-node-add.png)

Click the **plus** button in the top left of the popup and create a new
**Node.js/Chrome** configuration. Set the **Host** field to
`localhost` and the **Port** field to `9229`. Then click **OK**.
**Node.js/Chrome** configuration. Set the **Host** field to `localhost` and the
**Port** field to `9229`. Then click **OK**.

![WebStorm Node.js debug configuration](./debugger-webstorm-settings.png)

Expand All @@ -64,4 +64,6 @@ debugging.

## DevTools

Breakpoints can also be added via the Wranger DevTools. For more information, [read the guide](https://developers.cloudflare.com/workers/observability/local-development-and-testing/#devtools) in the Cloudflare Workers docs.
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)
in the Cloudflare Workers docs.
Loading