Skip to content

Commit

Permalink
fix(fetch): fix toFormData imports (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey committed Sep 1, 2023
1 parent 208877b commit d3a1ffd
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/rude-wolves-float.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/web-fetch": patch
---

fix `toFormData` imports
2 changes: 1 addition & 1 deletion packages/fetch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/fetch/src/lib.js
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 2 additions & 2 deletions packages/fetch/src/lib.node.js
Original file line number Diff line number Diff line change
@@ -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.
// For now we always use the polyfill.
1 change: 1 addition & 0 deletions packages/fetch/src/package.js
Original file line number Diff line number Diff line change
@@ -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'


2 changes: 1 addition & 1 deletion packages/fetch/src/package.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const { FormData, Blob } = globalThis
export const { FormData, Blob, File } = globalThis
export { ReadableStream } from "@remix-run/web-stream"


4 changes: 2 additions & 2 deletions packages/fetch/src/utils/form-data.js
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion packages/fetch/test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit d3a1ffd

Please sign in to comment.