diff --git a/.changeset/rude-wolves-float.md b/.changeset/rude-wolves-float.md new file mode 100644 index 0000000..1cff19d --- /dev/null +++ b/.changeset/rude-wolves-float.md @@ -0,0 +1,5 @@ +--- +"@remix-run/web-fetch": patch +--- + +fix `toFormData` imports diff --git a/packages/fetch/package.json b/packages/fetch/package.json index 9929596..0029a0e 100644 --- a/packages/fetch/package.json +++ b/packages/fetch/package.json @@ -96,7 +96,7 @@ "xo": "^0.33.1" }, "dependencies": { - "@remix-run/web-blob": "^3.0.5", + "@remix-run/web-file": "^3.0.3", "@remix-run/web-form-data": "^3.0.5", "@remix-run/web-stream": "^1.0.4", "@web3-storage/multipart-parser": "^1.0.0", diff --git a/packages/fetch/src/lib.js b/packages/fetch/src/lib.js index d46bdc8..a5aa83e 100644 --- a/packages/fetch/src/lib.js +++ b/packages/fetch/src/lib.js @@ -1,4 +1,4 @@ // On the web we just export native fetch implementation -export { ReadableStream, Blob, FormData } from './package.js'; +export { ReadableStream, Blob, FormData, File } from './package.js'; export const { Headers, Request, Response } = globalThis; export default globalThis.fetch.bind(globalThis) diff --git a/packages/fetch/src/lib.node.js b/packages/fetch/src/lib.node.js index 90e30df..062b92e 100644 --- a/packages/fetch/src/lib.node.js +++ b/packages/fetch/src/lib.node.js @@ -1,5 +1,5 @@ export { default, fetch, Headers, Request, Response } from "./fetch.js"; -export { ReadableStream, Blob, FormData } from './package.js'; +export { ReadableStream, Blob, FormData, File } from './package.js'; // Node 18+ introduces fetch API globally and it doesn't support our use-cases yet. -// For now we always use the polyfill. \ No newline at end of file +// For now we always use the polyfill. diff --git a/packages/fetch/src/package.js b/packages/fetch/src/package.js index b95f939..60d7378 100644 --- a/packages/fetch/src/package.js +++ b/packages/fetch/src/package.js @@ -1,5 +1,6 @@ export { Blob, ReadableStream } from '@remix-run/web-blob' +export { File } from '@remix-run/web-file' export { FormData } from '@remix-run/web-form-data' diff --git a/packages/fetch/src/package.ts b/packages/fetch/src/package.ts index 015a6f4..ee39622 100644 --- a/packages/fetch/src/package.ts +++ b/packages/fetch/src/package.ts @@ -1,4 +1,4 @@ -export const { FormData, Blob } = globalThis +export const { FormData, Blob, File } = globalThis export { ReadableStream } from "@remix-run/web-stream" diff --git a/packages/fetch/src/utils/form-data.js b/packages/fetch/src/utils/form-data.js index d499f79..535c698 100644 --- a/packages/fetch/src/utils/form-data.js +++ b/packages/fetch/src/utils/form-data.js @@ -1,7 +1,7 @@ import {randomBytes} from 'crypto'; import { iterateMultipart } from '@web3-storage/multipart-parser'; -import { FormData } from '../package.js'; -import {isBlob} from './is.js'; +import { FormData, File } from '../package.js'; +import { isBlob } from './is.js'; const carriage = '\r\n'; const dashes = '-'.repeat(2); diff --git a/packages/fetch/test/main.js b/packages/fetch/test/main.js index b2d638d..9388bce 100644 --- a/packages/fetch/test/main.js +++ b/packages/fetch/test/main.js @@ -21,7 +21,7 @@ import { ReadableStream } from "../src/package.js"; const AbortControllerPolyfill = abortControllerPolyfill.AbortController; // Test subjects -import { Blob } from "@remix-run/web-blob"; +import { Blob } from "@remix-run/web-file"; import fetch, { Headers, Request, Response } from "@remix-run/web-fetch"; import { FetchError } from "../src/errors/fetch-error.js";