Skip to content

Commit d3a1ffd

Browse files
fix(fetch): fix toFormData imports (#46)
1 parent 208877b commit d3a1ffd

File tree

8 files changed

+14
-8
lines changed

8 files changed

+14
-8
lines changed

.changeset/rude-wolves-float.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@remix-run/web-fetch": patch
3+
---
4+
5+
fix `toFormData` imports

packages/fetch/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
"xo": "^0.33.1"
9797
},
9898
"dependencies": {
99-
"@remix-run/web-blob": "^3.0.5",
99+
"@remix-run/web-file": "^3.0.3",
100100
"@remix-run/web-form-data": "^3.0.5",
101101
"@remix-run/web-stream": "^1.0.4",
102102
"@web3-storage/multipart-parser": "^1.0.0",

packages/fetch/src/lib.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// On the web we just export native fetch implementation
2-
export { ReadableStream, Blob, FormData } from './package.js';
2+
export { ReadableStream, Blob, FormData, File } from './package.js';
33
export const { Headers, Request, Response } = globalThis;
44
export default globalThis.fetch.bind(globalThis)

packages/fetch/src/lib.node.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export { default, fetch, Headers, Request, Response } from "./fetch.js";
22

3-
export { ReadableStream, Blob, FormData } from './package.js';
3+
export { ReadableStream, Blob, FormData, File } from './package.js';
44
// Node 18+ introduces fetch API globally and it doesn't support our use-cases yet.
5-
// For now we always use the polyfill.
5+
// For now we always use the polyfill.

packages/fetch/src/package.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
export { Blob, ReadableStream } from '@remix-run/web-blob'
3+
export { File } from '@remix-run/web-file'
34
export { FormData } from '@remix-run/web-form-data'
45

56

packages/fetch/src/package.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const { FormData, Blob } = globalThis
1+
export const { FormData, Blob, File } = globalThis
22
export { ReadableStream } from "@remix-run/web-stream"
33

44

packages/fetch/src/utils/form-data.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {randomBytes} from 'crypto';
22
import { iterateMultipart } from '@web3-storage/multipart-parser';
3-
import { FormData } from '../package.js';
4-
import {isBlob} from './is.js';
3+
import { FormData, File } from '../package.js';
4+
import { isBlob } from './is.js';
55

66
const carriage = '\r\n';
77
const dashes = '-'.repeat(2);

packages/fetch/test/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { ReadableStream } from "../src/package.js";
2121
const AbortControllerPolyfill = abortControllerPolyfill.AbortController;
2222

2323
// Test subjects
24-
import { Blob } from "@remix-run/web-blob";
24+
import { Blob } from "@remix-run/web-file";
2525

2626
import fetch, { Headers, Request, Response } from "@remix-run/web-fetch";
2727
import { FetchError } from "../src/errors/fetch-error.js";

0 commit comments

Comments
 (0)