Skip to content

Commit

Permalink
Merge branch 'main' into sujayakar/add-convex-adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusmarminge committed Jan 4, 2025
2 parents 60b055a + e14e353 commit 47a9022
Show file tree
Hide file tree
Showing 289 changed files with 12,202 additions and 9,984 deletions.
11 changes: 0 additions & 11 deletions .changeset/fifty-candles-fix.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/grumpy-spies-hunt.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/large-flowers-allow.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/little-boxes-taste.md

This file was deleted.

10 changes: 10 additions & 0 deletions .changeset/nice-penguins-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"uploadthing": minor
"@uploadthing/svelte": minor
"@uploadthing/react": minor
"@uploadthing/solid": minor
"@uploadthing/expo": minor
"@uploadthing/vue": minor
---

feat: allow custom fetch override
5 changes: 0 additions & 5 deletions .changeset/sixty-monkeys-smell.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/warm-moons-count.md

This file was deleted.

7 changes: 6 additions & 1 deletion .github/release-canary.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,15 @@ async function version() {

// Update dependencies
for (const dep in pkg.dependencies) {
if (versions[dep]) {
if (versions[dep] && pkg.dependencies[dep].startsWith("workspace:")) {
pkg.dependencies[dep] = versions[dep];
}
}
for (const dep in pkg.peerDependencies) {
if (versions[dep] && pkg.peerDependencies[dep].startsWith("workspace:")) {
pkg.peerDependencies[dep] = versions[dep];
}
}

const fmt = prettier.format(JSON.stringify(pkg), { filepath: pkgJsonPath });
fs.writeFileSync(pkgJsonPath, fmt);
Expand Down
10 changes: 7 additions & 3 deletions .github/replace-workspace-protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,21 @@ await Promise.all(
const workspacePkg = await Bun.file("package.json").json();
for (const dep in workspacePkg.dependencies) {
if (dep in packageVersions) {
workspacePkg.dependencies[dep] = packageVersions[dep];
if (workspacePkg.dependencies[dep].startsWith("workspace:")) {
workspacePkg.dependencies[dep] = packageVersions[dep];
}
}
}
for (const dep in workspacePkg.peerDependencies) {
if (dep in packageVersions) {
if (
dep in packageVersions &&
workspacePkg.peerDependencies[dep].startsWith("workspace:")
) {
workspacePkg.peerDependencies[dep] = packageVersions[dep];
}
}

// Remove unnecessary fields
workspacePkg.eslintConfig = undefined;
workspacePkg.devDependencies = undefined;
workspacePkg.scripts = undefined;

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ jobs:

- name: Build
run: pnpm turbo build --filter "./packages/*"

- name: Install Playwright
run: pnpm exec playwright install chromium

- name: Test
run: pnpm run test
env:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pkg-pr-new.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Publish Test Releases
on: [push, pull_request]

env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}

jobs:
build:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ expo-env.d.ts
.data
.idea
*.db
*.timestamp_*

# debug
npm-debug.log*
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.11
22.12
12 changes: 11 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,19 @@
"eslint.workingDirectories": [
"docs",
{ "pattern": "./packages/**" },
{ "pattern": "./examples/**" }
{ "pattern": "./examples/**" },
{ "pattern": "./tooling/**" },
{ "pattern": "./playground/**" },
{ "pattern": "./playground-v6/**" }
],
"eslint.useFlatConfig": true,
"[svelte]": {
"editor.defaultFormatter": "svelte.svelte-vscode"
},
"workbench.colorCustomizations": {
"titleBar.activeBackground": "#a21d1d",
"titleBar.activeForeground": "#FFF0F0",
"titleBar.inactiveBackground": "#612121",
"titleBar.inactiveForeground": "#f5a5a5"
}
}
34 changes: 13 additions & 21 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,31 @@
"browserslist": "defaults, not ie <= 11",
"dependencies": {
"@algolia/autocomplete-core": "^1.17.4",
"@headlessui/react": "^2.1.8",
"@headlessui/tailwindcss": "^0.2.0",
"@heroicons/react": "^2.1.3",
"@headlessui/react": "^2.2.0",
"@headlessui/tailwindcss": "^0.2.1",
"@heroicons/react": "^2.2.0",
"@mdx-js/loader": "^3.0.1",
"@mdx-js/react": "^3.0.1",
"@next/mdx": "^14.2.11",
"@scalar/api-reference-react": "^0.3.37",
"@next/mdx": "^15.1.3",
"@scalar/api-reference-react": "^0.4.8",
"@shikijs/transformers": "^1.17.5",
"@sindresorhus/slugify": "^2.1.1",
"@tailwindcss/typography": "^0.5.10",
"@types/mdast": "^4.0.4",
"@types/mdx": "^2.0.13",
"@types/node": "^20.14.0",
"@types/node": "^22.10.0",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"@types/react-highlight-words": "^0.20.0",
"@uploadthing/react": "workspace:*",
"acorn": "^8.12.1",
"autoprefixer": "^10.4.19",
"clsx": "^2.1.0",
"fast-glob": "^3.3.2",
"flexsearch": "^0.7.43",
"framer-motion": "^11.5.4",
"mdast-util-to-string": "^4.0.0",
"mdx-annotations": "^0.1.4",
"next": "14.2.11",
"motion": "^12.0.0-alpha.2",
"next": "15.1.3",
"next-sitemap": "^4.2.3",
"next-themes": "^0.3.0",
"next-view-transitions": "^0.3.0",
Expand All @@ -49,24 +49,16 @@
"remark-gfm": "^4.0.0",
"remark-mdx": "^3.0.1",
"remark-unwrap-images": "^4.0.0",
"sharp": "0.33.1",
"shiki": "^1.17.5",
"simple-functional-loader": "^1.2.1",
"tailwindcss": "^3.4.1",
"typescript": "^5.5.2",
"tailwindcss": "^3.4.16",
"typescript": "5.7.2",
"unified": "^11.0.5",
"unist-util-filter": "^5.0.1",
"unist-util-visit": "^5.0.0",
"uploadthing": "workspace:*",
"zod": "^3.23.8",
"zustand": "^4.3.2"
},
"devDependencies": {
"@shikijs/transformers": "^1.17.5",
"eslint": "^8.57.0",
"eslint-config-next": "^14.2.1",
"prettier": "^3.3.2",
"prettier-plugin-tailwindcss": "^0.6.5",
"sharp": "0.33.1"
},
"packageManager": "pnpm@9.6.0"
}
}
3 changes: 1 addition & 2 deletions docs/postcss.config.cjs → docs/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module.exports = {
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ApiReferenceReact } from "@scalar/api-reference-react";
import { useTheme } from "next-themes";

const specUrl = "https://api.uploadthing.com/openapi-spec.json";
// const specUrl = "https://api.ut-staging.com/openapi-spec.json";

const useMutationObserver = (
ref: RefObject<HTMLElement>,
Expand Down
8 changes: 4 additions & 4 deletions docs/src/app/(docs)/api-reference/server/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,10 @@ Environment variables follows the naming convention of `UPLOADTHING_<NAME>`

<Properties>
<Property name="callbackUrl" type="string" since="6.0">
The URL to where your route handler is hosted. This is called via webhook
after your file is uploaded. UploadThing attempts to automatically detect
this value based on the request URL and headers. You can override this if
the automatic detection fails.
The full, absolute URL to where your route handler is hosted. This is called
via webhook after your file is uploaded. UploadThing attempts to
automatically detect this value based on the request URL and headers. You
can override this if the automatic detection fails.
</Property>
<Property
name="token"
Expand Down
22 changes: 16 additions & 6 deletions docs/src/app/(docs)/api-reference/ut-api/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,18 @@ To get started, initialize an instance of `UTApi`.
```ts {{ title: "~/server/uploadthing.ts" }}
import { UTApi } from "uploadthing/server";

export const utapi = new UTApi();
export const utapi = new UTApi({
// ...options,
});
```

### Options

You can configure the SDK either by passing a config object to the
`createRouteHandler` function, or by setting them as environment variables.
Environment variables follows the naming convention of `UPLOADTHING_<NAME>`
,where `<NAME>` is the name of the config option in constant case, e.g.
`UPLOADTHING_LOG_LEVEL`. If both are set, the config object takes precedence.
You can configure the SDK either by passing them as options to the constructor,
or by setting them as environment variables. Environment variables follow the
naming convention of `UPLOADTHING_<NAME>` ,where `<NAME>` is the name of the
config option in constant case, e.g. `UPLOADTHING_LOG_LEVEL`. If both are set,
the config object takes precedence.

<Properties>
<Property
Expand Down Expand Up @@ -355,6 +357,14 @@ Additionally, you may pass some options as a second argument:
all files that have been uploaded to the application your API key corresponds
to.

<Note>
We do not recommend using this as your primary data source. Instead, we
recommend storing the file metadata (key, url, etc) in your database. This
will reduce latency as well as support any query your application might need.
The `listFiles` method is best suited for administrative tasks, one-time data
synchronization, or debugging purposes.
</Note>

```ts
import { utapi } from "~/server/uploadthing.ts";

Expand Down
9 changes: 8 additions & 1 deletion docs/src/app/(docs)/backend-adapters/express/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ of a FileRoute similar to an endpoint, it has:

- Permitted types ["image", "video", etc]
- Max file size
- How many files are allowed to be uploaded
- (Optional) `input` validation to validate client-side data sent to the route
- (Optional) `middleware` to authenticate and tag requests
- `onUploadComplete` callback for when uploads are completed

Expand All @@ -52,10 +54,15 @@ import { createUploadthing, type FileRouter } from "uploadthing/express";
const f = createUploadthing();

export const uploadRouter = {
// Define as many FileRoutes as you like, each with a unique routeSlug
imageUploader: f({
image: {
/**
* For full list of options and defaults and defaults, see the File Route API reference
* @see https://docs.uploadthing.com/file-routes#route-config
*/
maxFileSize: "4MB",
maxFileCount: 4,
maxFileCount: 1,
},
}).onUploadComplete((data) => {
console.log("upload completed", data);
Expand Down
9 changes: 8 additions & 1 deletion docs/src/app/(docs)/backend-adapters/fastify/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ of a FileRoute similar to an endpoint, it has:

- Permitted types ["image", "video", etc]
- Max file size
- How many files are allowed to be uploaded
- (Optional) `input` validation to validate client-side data sent to the route
- (Optional) `middleware` to authenticate and tag requests
- `onUploadComplete` callback for when uploads are completed

Expand All @@ -52,10 +54,15 @@ import { createUploadthing, type FileRouter } from "uploadthing/fastify";
const f = createUploadthing();

export const uploadRouter = {
// Define as many FileRoutes as you like, each with a unique routeSlug
imageUploader: f({
image: {
/**
* For full list of options and defaults, see the File Route API reference
* @see https://docs.uploadthing.com/file-routes#route-config
*/
maxFileSize: "4MB",
maxFileCount: 4,
maxFileCount: 1,
},
}).onUploadComplete((data) => {
console.log("upload completed", data);
Expand Down
9 changes: 8 additions & 1 deletion docs/src/app/(docs)/backend-adapters/fetch/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ of a FileRoute similar to an endpoint, it has:

- Permitted types ["image", "video", etc]
- Max file size
- How many files are allowed to be uploaded
- (Optional) `input` validation to validate client-side data sent to the route
- (Optional) `middleware` to authenticate and tag requests
- `onUploadComplete` callback for when uploads are completed

Expand All @@ -54,10 +56,15 @@ import { createUploadthing, type FileRouter } from "uploadthing/server";
const f = createUploadthing();

export const uploadRouter = {
// Define as many FileRoutes as you like, each with a unique routeSlug
imageUploader: f({
image: {
/**
* For full list of options and defaults, see the File Route API reference
* @see https://docs.uploadthing.com/file-routes#route-config
*/
maxFileSize: "4MB",
maxFileCount: 4,
maxFileCount: 1,
},
}).onUploadComplete((data) => {
console.log("upload completed", data);
Expand Down
9 changes: 8 additions & 1 deletion docs/src/app/(docs)/backend-adapters/h3/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ of a FileRoute similar to an endpoint, it has:

- Permitted types ["image", "video", etc]
- Max file size
- How many files are allowed to be uploaded
- (Optional) `input` validation to validate client-side data sent to the route
- (Optional) `middleware` to authenticate and tag requests
- `onUploadComplete` callback for when uploads are completed

Expand All @@ -56,10 +58,15 @@ import { createUploadthing, type FileRouter } from "uploadthing/h3";
const f = createUploadthing();

export const uploadRouter = {
// Define as many FileRoutes as you like, each with a unique routeSlug
imageUploader: f({
image: {
/**
* For full list of options and defaults, see the File Route API reference
* @see https://docs.uploadthing.com/file-routes#route-config
*/
maxFileSize: "4MB",
maxFileCount: 4,
maxFileCount: 1,
},
}).onUploadComplete((data) => {
console.log("upload completed", data);
Expand Down
Loading

0 comments on commit 47a9022

Please sign in to comment.