This repository was archived by the owner on Mar 13, 2025. It is now read-only.
v1.0.0
Breaking Changes
-
The first and only argument to the
Miniflareconstructor is now an object. Scripts should be specified via thescriptoption for strings and thescriptPathoption for files:// Previous version import vm from "vm"; import { Miniflare } from "miniflare"; const mf1 = new Miniflare( new vm.Script(`addEventListener("fetch", (event) => { ... })`), { kvPersist: true } ); const mf2 = new Miniflare("script.js", { kvPersist: true });
// New version import { Miniflare } from "miniflare"; const mf1 = new Miniflare({ script: `addEventListener("fetch", (event) => { ... })`, kvPersist: true, }); const mf2 = new Miniflare({ scriptPath: "script.js", kvPersist: true, });
-
The
Miniflare.getNamespacemethod has been renamed toMiniflare.getKVNamespace -
Logged errors will now throw a
MiniflareErrorif no log is provided -
When using file system KV persistence, key names are now sanitised to replace special characters such as
:,/, and\. Reading keys containing these characters may now returnnullif a value was stored in the previous version.
Features
- Added support for 📚 Modules (requires
--experimental-vm-modulesflag) - Added support for 📌 Durable Objects
- Added support for ✉️ Web Sockets (client and server)
- Added support for 🛠 Builds (custom builds and
webpack/rustWrangler builds) - Added support for ⚙️ WebAssembly
- Added support for 📄 HTMLRewriter
- Made CLI
scriptparameter optional, it can now be inferred in some cases fromwrangler.toml - Added
hostoption (--host/-Hflag) for restricting hosts the HTTP server listens on - Added
Miniflare.disposemethod for cleaning up file watcher - Added
CF-*headers andcfobject to HTTP server requests - Added
cronproperty to ⏰ Scheduled Events - Added manual triggering for ⏰ Scheduled Events via
/.mf/scheduledHTTP endpoint - Added pretty error page powered by Youch
- Added many more tests
Fixes
- Fixed error if options object (containing
typeandcacheTtlproperties) passed as second parameter to KVgetmethod, closes issue #3 - Fixed error if
ArrayBufferpassed asdatatocrypto.subtle.digest("md5", data) - Fixed handling of
ignoreMethodoption forCachematchanddelete - Disabled edge caching when using Workers Sites, files are now always loaded from disk
- Provide
SetandWeakSetfrom Miniflare's realm to sandbox, removingPromise, so(async () => {})() instanceof Promiseevaluates totrue