Skip to content
Open
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: 20 additions & 0 deletions .changeset/consolidate-miniflare-persist-options.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
"miniflare": major
---

Consolidate persistence and temporary directory options

The per-resource persistence options (`kvPersist`, `r2Persist`, `d1Persist`, `cachePersist`, `durableObjectsPersist`, `workflowsPersist`, `secretsStorePersist`, `analyticsEngineDatasetsPersist`, `streamPersist`, `imagesPersist`, and `helloWorldPersist`) have been removed. The `Miniflare.unsafeGetPersistPaths()` method, which provided the per-resource persistence paths, has also been removed as they can now be stably inferred from the base path.

For consistency and clarity, `defaultPersistRoot` and `defaultProjectTmpPath` have been renamed to `resourcePersistencePath` and `resourceTmpPath`, respectively.

For example:

```js
new Miniflare({
resourcePersistencePath: ".wrangler/state/v3",
resourceTmpPath: ".wrangler/tmp",
});
```

When `resourcePersistencePath` is set, each resource persists to a subdirectory named after its plugin (e.g. `.wrangler/state/v3/kv`). When it is omitted, resources are ephemeral and their data is cleared on dispose.
7 changes: 7 additions & 0 deletions .changeset/drop-cache-warn-usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"miniflare": major
---

Remove the `cacheWarnUsage` option

The `cacheWarnUsage` Worker option, which logged a warning when cache operations were used, has been removed.
5 changes: 5 additions & 0 deletions .changeset/drop-fetch-mock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"miniflare": major
---

Remove the `fetchMock` option and `createFetchMock` export
7 changes: 7 additions & 0 deletions .changeset/drop-https-key-cert-path.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"miniflare": major
---

Remove the `httpsKeyPath` and `httpsCertPath` options

The `httpsKeyPath` and `httpsCertPath` options have been removed. To use a custom certificate, read the files and pass their contents via the existing `httpsKey` and `httpsCert` options.
7 changes: 7 additions & 0 deletions .changeset/drop-live-reload-endpoint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"miniflare": major
---

Drop `/cdn-cgi/mf/reload` live reload endpoint and `liveReload` option

The built-in live reload mechanism has been removed from Miniflare. This included a WebSocket endpoint at `/cdn-cgi/mf/reload`, the `liveReload` option, and the automatic injection of a live reload `<script>` tag into HTML responses. For context, Wrangler and the Vite plugin both implement their own independent live reload mechanisms.
7 changes: 7 additions & 0 deletions .changeset/drop-miniflare-v2-migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"miniflare": major
---

Drop miniflare v2 storage migration

The `migrateDatabase()` helper that migrated KV, R2, and D1 SQLite databases from the miniflare v2/early-v3 storage layout to the current Durable Object-based layout has been removed. This migration path was introduced in 2023 and is no longer needed.
9 changes: 9 additions & 0 deletions .changeset/drop-runtime-stdio-and-structured-logs-option.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"miniflare": major
---

Only support structured workerd logs

The `handleRuntimeStdio` option (for handling the raw `workerd` stdout/stderr streams) and the `structuredWorkerdLogs` option (for toggling structured `workerd` logs) have been removed. Structured logging is now always enabled.

To receive `workerd`'s output, use `handleStructuredLogs`, which is passed parsed structured log entries. When no `handleStructuredLogs` handler is provided, logs are written to the console by default (`warn`/`error` to stderr, everything else to stdout).
7 changes: 7 additions & 0 deletions .changeset/drop-unsafe-sticky-blobs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"miniflare": major
---

Drop the `unsafeStickyBlobs` option

This prevented blob files from being deleted when overwriting or deleting keys, and only existed to support the Durable Object isolated storage feature in `@cloudflare/vitest-pool-workers`, which was removed in 0.13.0. Blobs are now always cleaned up as expected.
5 changes: 5 additions & 0 deletions .changeset/drop-wrapped-bindings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"miniflare": major
---

Remove the `wrappedBindings` option
16 changes: 16 additions & 0 deletions .changeset/miniflare-container-engine-shared-option.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
"miniflare": major
---

Move `containerEngine` from a per-worker option to a top-level option

`containerEngine` is now a top-level Miniflare option rather than a per-worker option, reflecting that it configures a single container engine for the whole Miniflare instance.

```js
new Miniflare({
containerEngine: "unix:///var/run/docker.sock",
workers: [{ name: "my-worker", script: "..." }],
});
```

Previously it was set inside each worker's options.
7 changes: 7 additions & 0 deletions .changeset/quiet-caches-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@cloudflare/vitest-pool-workers": patch
---

Preserve the deprecated Miniflare `cache` option

Vitest configurations using `cache` continue to work after the internal Miniflare v5 upgrade. The option is translated to `cacheAPI`; new configurations should use `cacheAPI` directly.
17 changes: 17 additions & 0 deletions .changeset/remap-local-testing-paths.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
"miniflare": major
---

Remap local testing paths to avoid collision with production `/cdn-cgi` routes

All miniflare-internal endpoints have moved to more consistent paths. Paths that need to remain reachable over tunnels now live outside `/cdn-cgi/`:

- `/cdn-cgi/platform-proxy` → `/cdn-cgi/local/platform-proxy`
- `/cdn-cgi/handler/scheduled` → `/cdn-cgi/local/scheduled`
- `/cdn-cgi/handler/email` → `/cdn-cgi/local/email`
- `/cdn-cgi/explorer/*` → `/cdn-cgi/local/explorer/*`
- `/cdn-cgi/mf/scheduled` → removed (was already deprecated)
- `/cdn-cgi/mf/stream/*` → `/__cf_local/stream/*`
- `/cdn-cgi/mf/imagedelivery/*` → `/__cf_local/imagedelivery/*`

Wrangler and the Vite plugin will add transparent path rewrites so the old paths continue to work for users of those tools.
7 changes: 7 additions & 0 deletions .changeset/remove-maxretires-typo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"miniflare": major
---

Remove deprecated `maxRetires` typo alias in Queue consumer options

The `maxRetires` option (a typo of `maxRetries`) has been removed from `QueueConsumerOptionsSchema`. Use `maxRetries` instead.
7 changes: 7 additions & 0 deletions .changeset/remove-miniflare-cli-binary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"miniflare": major
---

Remove dummy CLI binary

The `miniflare` bin entry and `bootstrap.js` stub that printed a "use `npx wrangler dev`" error have been removed. This stub has been present since miniflare v3 and is no longer needed.
7 changes: 7 additions & 0 deletions .changeset/remove-supported-compat-date.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"miniflare": major
---

Remove deprecated `supportedCompatibilityDate` export

The `supportedCompatibilityDate` export has been removed. Use `new Date().toISOString().slice(0, 10)` instead.
7 changes: 7 additions & 0 deletions .changeset/rename-cache-option-to-cache-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"miniflare": major
---

Rename the `cache` Worker option to `cacheAPI`

The boolean option controlling whether the Cache API caches anything has been renamed from `cache` to `cacheAPI`. This is to distinguish it from Workers Cache.
18 changes: 18 additions & 0 deletions .changeset/rewrite-legacy-local-testing-paths.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
"wrangler": patch
"@cloudflare/vite-plugin": patch
---

Rewrite local testing paths (`/cdn-cgi/*`)

Miniflare v5 moved its internal local testing endpoints to `/cdn-cgi/local/*` (and `/__cf_local/*` for endpoints that must remain reachable over tunnels) to prevent any potential collision with production routes. `wrangler dev` and the Vite plugin now transparently rewrite the old paths to the new ones, meaning you can continue to use the old paths without issue.

These are the new paths:

- `/cdn-cgi/handler/scheduled` → `/cdn-cgi/local/scheduled`
- `/cdn-cgi/handler/email` → `/cdn-cgi/local/email`
- `/cdn-cgi/explorer/*` → `/cdn-cgi/local/explorer/*`
- `/cdn-cgi/mf/scheduled` → `/cdn-cgi/local/scheduled` (Note `/cdn-cgi/mf/scheduled` is already deprecated)
- `/cdn-cgi/mf/stream/*` → `/__cf_local/stream/*`
- `/cdn-cgi/mf/imagedelivery/*` → `/__cf_local/imagedelivery/*`
- `/cdn-cgi/platform-proxy` → `/cdn-cgi/local/platform-proxy`
7 changes: 7 additions & 0 deletions .changeset/vitest-pool-drop-sticky-blobs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@cloudflare/vitest-pool-workers": patch
---

Stop enabling Miniflare's removed `unsafeStickyBlobs` option

The pool no longer sets the `unsafeStickyBlobs` Miniflare option, which has been removed. This option was only needed for the Durable Object isolated storage feature that was dropped in 0.13.0, so there is no change in behaviour.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": minor
---

Remove `containerEngine` from the worker options returned by `unstable_getMiniflareWorkerOptions`

`unstable_getMiniflareWorkerOptions` no longer includes `containerEngine` in the returned `workerOptions`, since the container engine is a Miniflare instance-wide setting rather than a per-worker one. Callers that build a Miniflare instance from these options should set `containerEngine` at the top level instead.
7 changes: 7 additions & 0 deletions .changeset/zod-v4-miniflare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"miniflare": major
---

Upgrade to zod v4

Miniflare's exported schemas now use zod v4.
12 changes: 3 additions & 9 deletions fixtures/unsafe-external-plugin/src/plugins/unsafe-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,15 @@ export const UNSAFE_SERVICE_PLUGIN: Plugin<
options?.map((binding) => [binding.name, new ProxyNodeBinding()]) ?? []
);
},
async getServices({
options,
tmpPath,
defaultPersistRoot,
unsafeStickyBlobs,
}) {
async getServices({ options, tmpPath, resourcePersistencePath }) {
if (!options || options.length === 0) {
return [];
}

const persistPath = getPersistPath(
UNSAFE_PLUGIN_NAME,
tmpPath,
defaultPersistRoot,
undefined
resourcePersistencePath
);

await fs.mkdir(persistPath, { recursive: true });
Expand Down Expand Up @@ -110,7 +104,7 @@ export const UNSAFE_SERVICE_PLUGIN: Plugin<
name: SharedBindings.MAYBE_SERVICE_LOOPBACK,
service: { name: SERVICE_LOOPBACK },
},
...getMiniflareObjectBindings(unsafeStickyBlobs),
...getMiniflareObjectBindings(),
],
},
} satisfies Service;
Expand Down
5 changes: 2 additions & 3 deletions fixtures/worker-app/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,8 @@ export default {
/**
* Handle a scheduled event.
*
* If developing using `--local` mode, you can trigger this scheduled event via a CURL.
* E.g. `curl "http://localhost:8787/cdn-cgi/mf/scheduled"`.
* See the Miniflare docs: https://miniflare.dev/core/scheduled.
* When developing locally, you can trigger this scheduled event via a CURL.
* E.g. `curl "http://localhost:8787/cdn-cgi/local/scheduled"`.
*/
scheduled(event, env, ctx) {
ctx.waitUntil(Promise.resolve(event.scheduledTime));
Expand Down
2 changes: 1 addition & 1 deletion fixtures/worker-with-resources/tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe("local explorer", () => {
const html = await indexResponse.text();

// Extract JS asset path from the HTML
// The HTML looks like: <script type="module" crossorigin src="/cdn-cgi/explorer/assets/index-xxx.js">
// The HTML looks like: <script type="module" crossorigin src="/cdn-cgi/local/explorer/assets/index-xxx.js">
const jsMatch = html.match(/assets\/index-[^"]+\.js/);
assert(jsMatch, "Expected JS asset path in HTML");
const jsPath = jsMatch[0];
Expand Down
33 changes: 21 additions & 12 deletions packages/local-explorer-ui/src/__e2e__/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { readFile, unlink } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import {
LOCAL_EXPLORER_API_PATH,
LOCAL_EXPLORER_BASE_PATH,
} from "../constants";
import { page, viteUrl, workerUrl } from "./setup";

export { page, viteUrl };
Expand Down Expand Up @@ -57,7 +61,7 @@ export async function seedWorkflow(workflowName: string): Promise<{
const workflowId = `e2e-test-${Date.now()}`;

await fetch(
`${workerUrl}/cdn-cgi/explorer/api/workflows/${workflowName}/instances`,
`${workerUrl}${LOCAL_EXPLORER_API_PATH}/workflows/${workflowName}/instances`,
{
body: JSON.stringify({
id: workflowId,
Expand All @@ -79,9 +83,12 @@ export async function seedWorkflow(workflowName: string): Promise<{
* Delete all instances of a workflow via the explorer API.
*/
export async function cleanupWorkflow(workflowName: string): Promise<void> {
await fetch(`${workerUrl}/cdn-cgi/explorer/api/workflows/${workflowName}`, {
method: "DELETE",
});
await fetch(
`${workerUrl}${LOCAL_EXPLORER_API_PATH}/workflows/${workflowName}`,
{
method: "DELETE",
}
);
}

/**
Expand All @@ -96,15 +103,15 @@ const WAIT_OPTIONS = {
* Navigate to a KV namespace.
*/
export async function navigateToKV(namespaceId: string): Promise<void> {
await navigateTo(`/cdn-cgi/explorer/kv/${namespaceId}`);
await navigateTo(`${LOCAL_EXPLORER_BASE_PATH}/kv/${namespaceId}`);
await waitForPageLoad();
}

/**
* Navigate to an R2 bucket.
*/
export async function navigateToR2Bucket(bucketName: string): Promise<void> {
await navigateTo(`/cdn-cgi/explorer/r2/${bucketName}`);
await navigateTo(`${LOCAL_EXPLORER_BASE_PATH}/r2/${bucketName}`);
await waitForPageLoad();
}

Expand All @@ -116,7 +123,7 @@ export async function navigateToR2Object(
objectKey: string
): Promise<void> {
await navigateTo(
`/cdn-cgi/explorer/r2/${bucketName}/object/${encodeURIComponent(objectKey)}`
`${LOCAL_EXPLORER_BASE_PATH}/r2/${bucketName}/object/${encodeURIComponent(objectKey)}`
);
await waitForPageLoad();
}
Expand All @@ -128,7 +135,7 @@ export async function navigateToD1(
databaseId: string,
table?: string
): Promise<void> {
let path = `/cdn-cgi/explorer/d1/${databaseId}`;
let path = `${LOCAL_EXPLORER_BASE_PATH}/d1/${databaseId}`;
if (table) {
path += `?table=${encodeURIComponent(table)}`;
}
Expand All @@ -141,15 +148,15 @@ export async function navigateToD1(
* Navigate to a Durable Object class.
*/
export async function navigateToDOClass(className: string): Promise<void> {
await navigateTo(`/cdn-cgi/explorer/do/${className}`);
await navigateTo(`${LOCAL_EXPLORER_BASE_PATH}/do/${className}`);
await waitForPageLoad();
}

/**
* Navigate to a Workflow instances list page.
*/
export async function navigateToWorkflow(workflowName: string): Promise<void> {
await navigateTo(`/cdn-cgi/explorer/workflows/${workflowName}`);
await navigateTo(`${LOCAL_EXPLORER_BASE_PATH}/workflows/${workflowName}`);
await waitForPageLoad();
}

Expand All @@ -164,7 +171,7 @@ export async function navigateToDOObject(
objectId: string,
table?: string
): Promise<void> {
let path = `/cdn-cgi/explorer/do/${className}/${objectId}`;
let path = `${LOCAL_EXPLORER_BASE_PATH}/do/${className}/${objectId}`;
if (table) {
path += `?table=${encodeURIComponent(table)}`;
}
Expand Down Expand Up @@ -200,7 +207,9 @@ export async function navigateToDOObjectByName(

// Extract the object ID from the current URL after navigation.
const objectPath = new URL(page.url()).pathname;
const match = objectPath.match(/\/cdn-cgi\/explorer\/do\/[^/]+\/([^/?#]+)/);
const match = objectPath.match(
/\/cdn-cgi\/local\/explorer\/do\/[^/]+\/([^/?#]+)/
);
if (!match || !match[1]) {
throw new Error(`Could not extract object ID from URL path: ${objectPath}`);
}
Expand Down
Loading
Loading