v1.0.0
Breaking Changes
-
The first and only argument to the
Miniflare
constructor is now an object. Scripts should be specified via thescript
option for strings and thescriptPath
option 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.getNamespace
method has been renamed toMiniflare.getKVNamespace
-
Logged errors will now throw a
MiniflareError
if 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 returnnull
if a value was stored in the previous version.
Features
- Added support for 📚 Modules (requires
--experimental-vm-modules
flag) - Added support for 📌 Durable Objects
- Added support for ✉️ Web Sockets (client and server)
- Added support for 🛠 Builds (custom builds and
webpack
/rust
Wrangler builds) - Added support for ⚙️ WebAssembly
- Added support for 📄 HTMLRewriter
- Made CLI
script
parameter optional, it can now be inferred in some cases fromwrangler.toml
- Added
host
option (--host
/-H
flag) for restricting hosts the HTTP server listens on - Added
Miniflare.dispose
method for cleaning up file watcher - Added
CF-*
headers andcf
object to HTTP server requests - Added
cron
property to ⏰ Scheduled Events - Added manual triggering for ⏰ Scheduled Events via
/.mf/scheduled
HTTP endpoint - Added pretty error page powered by Youch
- Added many more tests
Fixes
- Fixed error if options object (containing
type
andcacheTtl
properties) passed as second parameter to KVget
method, closes issue #3 - Fixed error if
ArrayBuffer
passed asdata
tocrypto.subtle.digest("md5", data)
- Fixed handling of
ignoreMethod
option forCache
match
anddelete
- Disabled edge caching when using Workers Sites, files are now always loaded from disk
- Provide
Set
andWeakSet
from Miniflare's realm to sandbox, removingPromise
, so(async () => {})() instanceof Promise
evaluates totrue