Skip to content

Version 18.0.0

Compare
Choose a tag to compare
@jaydenseric jaydenseric released this 23 Oct 13:44
· 4 commits to master since this release

Major

  • Updated Node.js support to ^18.15.0 || >=20.4.0.

  • Updated the @apollo/client peer dependency to ^3.8.0.

  • Updated the extract-files dependency to v13.

    • React Native is no longer supported out of the box.

      The class ReactNativeFile is no longer exported, or matched by the function isExtractableFile.

      This class was bloating non React Native environments with an extra module, increasing bundle sizes when building and adding an extra step to ESM loading waterfalls in browsers.

      It’s the responsibility of Facebook to adhere to web standards and implement spec-complaint Blob, File, and FormData globals in the React Native environment.

      To migrate, React Native projects that are unable to use the standard globals can manually implement a class ReactNativeFile and match it with a custom function isReactNativeFile for use with the function createUploadLink option isExtractableFile.

    • “Plain” objects in the GraphQL operation that aren’t Object instances (e.g. Object.create(null)) are now also deep cloned when searching for extractable files.

  • Updated dev dependencies, some of which require newer Node.js versions than previously supported.

  • Use the Node.js test runner API and remove the dev dependency test-director.

  • Refactored tests to use the standard AbortController, AbortSignal, File, FormData, and Response APIs available in modern Node.js and removed the dev dependencies abort-controller, formdata-node, and node-fetch.

  • Public modules are now individually listed in the package files and exports fields.

  • Removed the package main index module; deep imports must be used. To migrate:

    - import {
    -   createUploadLink,
    -   formDataAppendFile,
    -   isExtractableFile
    - } from "apollo-upload-client";
    + import createUploadLink from "apollo-upload-client/createUploadLink.mjs";
    + import formDataAppendFile from "apollo-upload-client/formDataAppendFile.mjs";
    + import isExtractableFile from "apollo-upload-client/isExtractableFile.mjs";
  • Shortened public module deep import paths, removing the /public/. To migrate:

    - import createUploadLink from "apollo-upload-client/public/createUploadLink.js";
    + import createUploadLink from "apollo-upload-client/createUploadLink.mjs";
    
    - import formDataAppendFile from "apollo-upload-client/public/formDataAppendFile.js";
    + import formDataAppendFile from "apollo-upload-client/formDataAppendFile.mjs";
    
    - import isExtractableFile from "apollo-upload-client/public/isExtractableFile.js";
    + import isExtractableFile from "apollo-upload-client/isExtractableFile.mjs";
  • The API is now ESM in .mjs files instead of CJS in .js files, accessible via import but not require.

  • Implemented TypeScript types via JSDoc comments.

    Types published in @types/apollo-upload-client should no longer be used.

    Projects must configure TypeScript to use types from the ECMAScript modules that have a // @ts-check comment:

  • Internally, use the function selectHttpOptionsAndBodyInternal that was added in @apollo/client v3.5.5.

Minor

  • Added a new option print for the function createUploadLink, to customize how the GraphQL query or mutation AST prints to a string for transport. It that works like the same option for HttpLink.

Patch

  • Updated dev dependencies.
  • Simplified dev dependencies and config for ESLint.
  • Integrated the ESLint plugin eslint-plugin-optimal-modules.
  • Check TypeScript types via a new package types script.
  • Removed the jsdoc-md dev dependency and the related package scripts, replacing the readme “API” section with a manually written “Exports” section.
  • Updated the package.json field repository to conform to new npm requirements.
  • Updated GitHub Actions CI config:
    • The workflow still triggers on push, but no longer on pull request.
    • The workflow can now be manually triggered.
    • Run tests with Node.js v18, v20, v21.
    • Updated actions/checkout to v4.
    • Updated actions/setup-node to v3.
  • Use the node: URL scheme for Node.js builtin module imports.
  • Reorganized the test file structure.
  • In tests, for objects with the property headers that as of @apollo/client v3.7.0 is a null-prototype object, use the assertion deepEqual instead of deepStrictEqual.
  • Tweaked code for type safety.
  • Updated documentation, including link URLs.
  • Refactored example code in the readme.
  • Removed the readme badges.