Skip to content

v2.12.0

Compare
Choose a tag to compare
@mrbbot mrbbot released this 14 Feb 12:10
· 57 commits to master since this release
f671590

Features

  • Add support for R2 multipart upload bindings.

  • Add support for dynamic import()s. Closes issue #456, thanks @calebmer.

  • Add support for the new WebSocket() constructor. This is an alternative standard API to fetch-with-Upgrade: websocket for creating WebSocket clients.

  • Add support for the nodejs_compat compatibility flag, specifically the node:assert, node:async_hooks, node:buffer, node:events, and node:util modules. For now, the experimental compatibility flag must also be enabled to use node:assert, node:buffer or node:events. Thanks @GregBrimble for the PR.

  • Extract out types for test environment global helper functions. Add either jest-environment-miniflare/globals or vitest-environment-miniflare/globals to your tsconfig.json's types array to include them. Closes issue #94, thanks @ryan-mars.

    // tsconfig.json
    {
      "compilerOptions": {
        // ...
        "types": [
          "@cloudflare/workers-types",
          // For Jest...
          "jest",
          "jest-environment-miniflare/globals"
          // ...or for Vitest
          "vitest-environment-miniflare/globals"
        ]
      }
    }
  • Allow direct access to Durable Object instances inside testing environments. Thanks @cdrx for the PR. See 🤹 Jest Environment or ⚡️ Vitest Environment for more details.

  • Forward /cdn-cgi/scripts/* to Cloudflare. This allows scripts such as rocket-loader.min.js to be loaded during development. Closes issue #421, thanks @jstevans for the PR

  • Implement structuredClone transfer option for Node.js versions below 17. Note Miniflare's minimum supported Node.js version is still 16.13.0.

  • Set default-on date for streams_enable_constructors and transformstream_enable_standard_constructor compatibility flags to 2022-11-30.

  • Add support for the DurableObjectStorage#sync() method. See cloudflare/workerd#87 for details.

  • Accept multiple keys in R2Bucket#delete(). Closes issue #420, thanks @TateB.

  • Implement the r2_list_honor_include compatibility flag.

  • Add support for the HTTP Range header to R2Bucket#get().

  • Add support for R2 SHA-* checksums, and return these from R2Bucket#{get,head}.

  • Implement the export_commonjs_default/export_commonjs_namespace compatibility flags. Note Miniflare previously implemented export_commonjs_default behaviour for CommonJS modules, but export_commonjs_namespace behaviour for all other types. This change switches everything to the correct export_commonjs_default by default, but allows old behaviour to be enabled by setting export_commonjs_namespace.

  • Add support for D1Database#dump()

  • Add support for meta.{last_row_id,changes} properties on D1 responses

Fixes

  • Fix request body type when mocking fetch requests in testing environments with getMiniflareFetchMock() and via the fetchMock option. Thanks @robertcepa for the PR.
  • Respect the maxBatchSize setting of queue consumers. Thanks @a-robinson for the PR.
  • Fix jest-environment-miniflare's homepage URL. Thanks @aaharu for the PR.
  • Fix typo in R2 documentation. Thanks @aarhus for the PR.
  • Rename queue producer binding class to WorkerQueue, matching the name in the real runtime. This will enable workers-rs to provide queue bindings. Thanks @zebp for the PR.
  • Reset internal body stream when cloning Requests and Responses. This ensures both clones' bodies can be read. Thanks @DSergiu for the PR.
  • Bump npx-import to 1.1.4, fixing require is not defined error when using D1. Closes issue #400, thanks @tgriesser and @geelen.
  • Bump undici to 5.11.0, allowing third-party FormData/Blob Request/Response bodies. Closes issue #351, thanks @yusefnapora.
  • Get CryptoKey class from global scope if available. Fixes 'instanceof' is not an object error in Node.js 19 and above. Closes issue #457, thanks @edevil and @panva.
  • Bump better-sqlite3 to 8.0.1, adding support for Node.js 19.
  • Coerce R2 keys to strings.
  • Fix return type of D1PreparedStatement#raw(). Closes issue cloudflare/workers-sdk#2238, thanks @repository for the PR.
  • Throw when calling D1PreparedStatement#run() with statements that return data. Closes issue #441, thanks @AlexBlokh.
  • Fix D1 response envelope format. Closes issues #442 and cloudflare/workers-sdk#2504, thanks @jiripospisil and @demosjarco.
  • Fix binding/return of BLOB-typed values in D1 operations. Closes cloudflare/workers-sdk#2527, thanks @JoshVazq.
  • Ensure D1Database#{batch,exec}() statements are executed in an implicit transaction. Closes issue #484, thanks @anthonymclaughlin.
  • Ensure only first statements are executed when calling D1PreparedStatement#{first,run,all,raw}()
  • Throw an error when KV expiration values exceed 32-bit signed integer bounds. Closes issue #485, thanks @huw for the PR.
  • Pass through WebSocket abnormal closure code. Closes issue #465, thanks @yw662.