Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: @uploadthing/mime-types exports not supported in Expo #1013

Merged
merged 15 commits into from
Nov 5, 2024
5 changes: 5 additions & 0 deletions .changeset/grumpy-spies-hunt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@uploadthing/mime-types": patch
---

fix: support legacy module resolutions to support Expo
5 changes: 5 additions & 0 deletions .changeset/sixty-monkeys-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"uploadthing": patch
---

chore: only slice file when necessary for resumability
5 changes: 5 additions & 0 deletions docs/src/app/(docs)/api-reference/client/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ function that matches the signature of your file router, which will allow
autocompletion and type checking on endpoint, route input and callback data
types.

<Warning>
Due to difficulties integrating with React Native's `Blob` implementation,
resumable uploads are currently not supported on React Native.
</Warning>

```ts
import { genUploader } from "uploadthing/client";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { EndpointMetadata } from "uploadthing/types";

import type { OurFileRouter } from "../../server/src/router";

const BASE_URL = "http://localhost:3003";
const BASE_URL = "http://localhost:3000";

export const { uploadFiles, createUpload } = genUploader<OurFileRouter>({
url: BASE_URL,
Expand Down
47 changes: 26 additions & 21 deletions packages/mime-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,57 +21,62 @@
},
"./application": {
"import": {
"types": "./dist/application.d.ts",
"default": "./dist/application.js"
"types": "./application/index.d.ts",
"default": "./application/index.js"
},
"require": {
"types": "./dist/application.d.cts",
"default": "./dist/application.cjs"
"types": "./application/index.d.cts",
"default": "./application/index.cjs"
}
},
"./audio": {
"import": {
"types": "./dist/audio.d.ts",
"default": "./dist/audio.js"
"types": "./audio/index.d.ts",
"default": "./audio/index.js"
},
"require": {
"types": "./dist/audio.d.cts",
"default": "./dist/audio.cjs"
"types": "./audio/index.d.cts",
"default": "./audio/index.cjs"
}
},
"./image": {
"import": {
"types": "./dist/image.d.ts",
"default": "./dist/image.js"
"types": "./image/index.d.ts",
"default": "./image/index.js"
},
"require": {
"types": "./dist/image.d.cts",
"default": "./dist/image.cjs"
"types": "./image/index.d.cts",
"default": "./image/index.cjs"
}
},
"./text": {
"import": {
"types": "./dist/text.d.ts",
"default": "./dist/text.js"
"types": "./text/index.d.ts",
"default": "./text/index.js"
},
"require": {
"types": "./dist/text.d.cts",
"default": "./dist/text.cjs"
"types": "./text/index.d.cts",
"default": "./text/index.cjs"
}
},
"./video": {
"import": {
"types": "./dist/video.d.ts",
"default": "./dist/video.js"
"types": "./video/index.d.ts",
"default": "./video/index.js"
},
"require": {
"types": "./dist/video.d.cts",
"default": "./dist/video.cjs"
"types": "./video/index.d.cts",
"default": "./video/index.cjs"
}
}
},
"files": [
"dist"
"application",
"audio",
"dist",
"image",
"text",
"video"
],
"scripts": {
"lint": "eslint src --max-warnings 0",
Expand Down
9 changes: 8 additions & 1 deletion packages/mime-types/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
"extends": ["//"],
"tasks": {
"build": {
"outputs": ["dist/**", "db/**"]
"outputs": [
"application/**",
"audio/**",
"dist/**",
"image/**",
"text/**",
"video/**"
]
}
}
}
2 changes: 1 addition & 1 deletion packages/uploadthing/src/internal/upload.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const uploadWithProgress = (
});

const formData = new FormData();
formData.append("file", file.slice(rangeStart));
formData.append("file", rangeStart > 0 ? file.slice(rangeStart) : file);
xhr.send(formData);

return Micro.sync(() => xhr.abort());
Expand Down
1,212 changes: 756 additions & 456 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

Loading