From 04714fb120debfd7ae9444a3379a8b1ab4e35de5 Mon Sep 17 00:00:00 2001 From: wobsoriano Date: Fri, 16 Dec 2022 09:06:59 -0800 Subject: [PATCH 1/4] fix: File in formdata util not defined --- packages/fetch/src/utils/form-data.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/fetch/src/utils/form-data.js b/packages/fetch/src/utils/form-data.js index 10d7b2b..5ca2679 100644 --- a/packages/fetch/src/utils/form-data.js +++ b/packages/fetch/src/utils/form-data.js @@ -1,7 +1,8 @@ import {randomBytes} from 'crypto'; import { iterateMultipart } from '@web3-storage/multipart-parser'; import { FormData } from '../package.js'; -import {isBlob} from './is.js'; +import { File } from '@web-std/file'; +import { isBlob } from './is.js'; const carriage = '\r\n'; const dashes = '-'.repeat(2); From f58b6275d5970890676f2f9f55bbbe87fd1f22ba Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Wed, 19 Jul 2023 10:13:17 +0100 Subject: [PATCH 2/4] chore: add missing dependency @web-std/file --- packages/fetch/package.json | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/fetch/package.json b/packages/fetch/package.json index c597d68..5aca9c6 100644 --- a/packages/fetch/package.json +++ b/packages/fetch/package.json @@ -74,9 +74,9 @@ "homepage": "https://github.com/web-std/io", "devDependencies": { "@types/chai": "^4.3.0", - "@types/mocha": "^9.1.0", "@types/chai-as-promised": "^7.1.5", "@types/chai-string": "^1.4.2", + "@types/mocha": "^9.1.0", "abort-controller": "^3.0.0", "abortcontroller-polyfill": "^1.7.1", "busboy": "^0.3.1", @@ -93,16 +93,17 @@ "p-timeout": "^3.2.0", "rollup": "^2.26.10", "tsd": "^0.13.1", - "xo": "^0.33.1", - "typescript": "^4.4.4" + "typescript": "^4.4.4", + "xo": "^0.33.1" }, "dependencies": { "@web-std/blob": "^3.0.3", + "@web-std/file": "^3.0.2", "@web-std/form-data": "^3.0.2", "@web-std/stream": "^1.0.1", + "@web3-storage/multipart-parser": "^1.0.0", "data-uri-to-buffer": "^3.0.1", - "mrmime": "^1.0.0", - "@web3-storage/multipart-parser": "^1.0.0" + "mrmime": "^1.0.0" }, "esm": { "sourceMap": true, From 5e882a5a94cdc589a99caa67e2d93a3bfb18970d Mon Sep 17 00:00:00 2001 From: Irakli Gozalishvili Date: Mon, 28 Aug 2023 23:09:52 +0000 Subject: [PATCH 3/4] fix: move dep into package.js --- packages/fetch/src/package.js | 1 + packages/fetch/src/package.ts | 2 +- packages/fetch/src/utils/form-data.js | 3 +-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/fetch/src/package.js b/packages/fetch/src/package.js index cdd8d5b..63ed3da 100644 --- a/packages/fetch/src/package.js +++ b/packages/fetch/src/package.js @@ -1,5 +1,6 @@ export { Blob, ReadableStream } from '@web-std/blob' +export { File } from '@web-std/file' export { FormData } from '@web-std/form-data' diff --git a/packages/fetch/src/package.ts b/packages/fetch/src/package.ts index 993899d..a9c51bc 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 "@web-std/stream" diff --git a/packages/fetch/src/utils/form-data.js b/packages/fetch/src/utils/form-data.js index 87c249f..f9dab0d 100644 --- a/packages/fetch/src/utils/form-data.js +++ b/packages/fetch/src/utils/form-data.js @@ -1,7 +1,6 @@ import {randomBytes} from 'crypto'; import { iterateMultipart } from '@web3-storage/multipart-parser'; -import { FormData } from '../package.js'; -import { File } from '@web-std/file'; +import { FormData, File } from '../package.js'; import { isBlob } from './is.js'; const carriage = '\r\n'; From fcd5da34ec12af359e8e4187368664e8919578f4 Mon Sep 17 00:00:00 2001 From: Irakli Gozalishvili Date: Mon, 28 Aug 2023 23:12:37 +0000 Subject: [PATCH 4/4] chore: re-export File --- packages/fetch/src/lib.js | 2 +- packages/fetch/src/lib.node.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 86dfdb7..e392bd7 100644 --- a/packages/fetch/src/lib.node.js +++ b/packages/fetch/src/lib.node.js @@ -1,6 +1,6 @@ import { fetch as webFetch, Headers as WebHeaders, Request as WebRequest, Response as WebResponse } from "./fetch.js" -export { ReadableStream, Blob, FormData } from './package.js'; +export { ReadableStream, Blob, FormData, File } from './package.js'; // Electron-renderer should get the browser implementation instead of node // Browser configuration is not enough