Minor Changes
-
#4324
16cc2e92
Thanks @penalosa! - Update to latestworkerd@1.20231030.0
-
#4322
8a25b7fb
Thanks @dario-piotrowicz! - addunsafeEvalBinding
optionAdd option to leverage the newly introduced
UnsafeEval
workerd binding API,
such API is used to evaluate javascript code at runtime via the providedeval
andnewFunction
methods.The API, for security reasons (as per the workers docs), is not to be use in production but it is intended for local purposes only such as local testing.
To use the binding you need to specify a string value for the
unsafeEvalBinding
, such will be the name of theUnsafeEval
bindings that will be made available in the workerd runtime.For example the following code shows how to set the binding with the
UNSAFE_EVAL
name and evaluate the1+1
string:const mf = new Miniflare({ log, modules: true, script: ` export default { fetch(req, env, ctx) { const two = env.UNSAFE_EVAL.eval('1+1'); return new Response('two = ' + two); // returns 'two = 2' } } `, unsafeEvalBinding: "UNSAFE_EVAL", });
Patch Changes
-
#4397
4f8b3420
Thanks @mrbbot! - fix: rejectMiniflare#ready
promise ifMiniflare#dispose()
called while waiting -
#4428
3637d97a
Thanks @mrbbot! - fix: addminiflare
bin
entryMiniflare 3 doesn't include a CLI anymore, but should log a useful error stating this when running
npx miniflare
. We had a script for this, but it wasn't correctly hooked up. 🤦 This change makes sure the requiredbin
entry exists. -
#4321
29a59d4e
Thanks @mrbbot! - fix: ensureMutex
doesn't report itself as drained if lockedPreviously, Miniflare's
Mutex
implementation would report itself as drained
if there were no waiters, regardless of the locked state. This bug meant that
if you called but didn'tawait
Miniflare#setOptions()
, future calls to
Miniflare#dispatchFetch()
(or any other asynchronousMiniflare
method)
wouldn't wait for the options update to apply and the runtime to restart before
sending requests. This change ensures we wait until the mutex is unlocked before
reporting it as drained. -
#4307
7fbe1937
Thanks @jspspike! - Only output ipv4 addresses when starting -
#4400
76787861
Thanks @mrbbot! - fix: cleanup temporary directory after shutting downworkerd
Previously on exit, Miniflare would attempt to remove its temporary directory
before shutting downworkerd
. This could lead toEBUSY
errors on Windows.
This change ensures we shutdownworkerd
before removing the directory.
Since we can only clean up on a best effort basis when exiting, it also catches
any errors thrown when removing the directory, in case the runtime doesn't
shutdown fast enough.