github cloudflare/workers-sdk miniflare@3.20231030.0

latest releases: wrangler@3.63.1, @cloudflare/vitest-pool-workers@0.4.9, wrangler@3.63.0...
7 months ago

Minor Changes

  • #4324 16cc2e92 Thanks @penalosa! - Update to latest workerd@1.20231030.0

  • #4322 8a25b7fb Thanks @dario-piotrowicz! - add unsafeEvalBinding option

    Add option to leverage the newly introduced UnsafeEval workerd binding API,
    such API is used to evaluate javascript code at runtime via the provided eval and newFunction 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 the UnsafeEval 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 the 1+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: reject Miniflare#ready promise if Miniflare#dispose() called while waiting

  • #4428 3637d97a Thanks @mrbbot! - fix: add miniflare bin entry

    Miniflare 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 required bin entry exists.

  • #4321 29a59d4e Thanks @mrbbot! - fix: ensure Mutex doesn't report itself as drained if locked

    Previously, 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't await Miniflare#setOptions(), future calls to
    Miniflare#dispatchFetch() (or any other asynchronous Miniflare 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 down workerd

    Previously on exit, Miniflare would attempt to remove its temporary directory
    before shutting down workerd. This could lead to EBUSY errors on Windows.
    This change ensures we shutdown workerd 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.

Don't miss a new workers-sdk release

NewReleases is sending notifications on new releases.