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

chore: bump react peer dep and bunchee #1102

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@types/react": "18.3.3",
"@uploadthing/eslint-config": "workspace:*",
"@uploadthing/tsconfig": "workspace:*",
"bunchee": "^5.6.2",
"bunchee": "^6.1.2",
"eslint": "^8.57.0",
"expo-constants": "^15.4.5",
"expo-document-picker": "^12.0.1",
Expand All @@ -52,10 +52,10 @@
"wait-on": "^7.2.0"
},
"peerDependencies": {
"expo-constants": "^15.4.5",
"expo-document-picker": "^11.0.0 || ^12.0.0",
"expo-image-picker": "^14.0.0 || ^15.0.0",
"react": "^17.0.2 || ^18.0.0",
"expo-constants": "*",
"expo-document-picker": "*",
"expo-image-picker": "*",
Comment on lines +55 to +57
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Keep the current version constraints for expo dependencies

Based on the codebase analysis, I recommend keeping the current version constraints instead of using "*" for the following reasons:

  • These expo packages are actively used in the codebase:
    • expo-constants is imported in packages/expo/src/index.ts and examples/minimal-expo/lib/trpc.tsx
    • expo-document-picker is used in packages/expo/src/document-picker.ts
    • expo-image-picker is used in packages/expo/src/image-picker.ts

The current version constraints in devDependencies are:

  • expo-constants: ^15.4.5
  • expo-document-picker: ^12.0.1
  • expo-image-picker: ^15.0.4

These provide a good balance between stability (minimum version) and flexibility (caret range for updates). Using "*" could lead to unexpected breaking changes as these packages have major version jumps (current latest versions are 17.0.3, 13.0.1, and 16.0.3 respectively).

🔗 Analysis chain

Consider maintaining version constraints for expo dependencies

Relaxing all expo peer dependencies to "*" removes version constraints which could lead to compatibility issues. Consider maintaining minimum version bounds while allowing flexibility for newer versions.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check latest versions and changelogs for expo packages
for pkg in expo-constants expo-document-picker expo-image-picker; do
  echo "Checking $pkg..."
  curl -s "https://registry.npmjs.org/$pkg" | jq -r '.["dist-tags"].latest'
done

Length of output: 689


Script:

#!/bin/bash
# Check for actual usage of these expo packages in the codebase
echo "Searching for expo-constants usage..."
rg "expo-constants" -B2 -A2

echo -e "\nSearching for expo-document-picker usage..."
rg "expo-document-picker" -B2 -A2

echo -e "\nSearching for expo-image-picker usage..."
rg "expo-image-picker" -B2 -A2

Length of output: 13672

"react": "^17.0.2 || ^18.0.0 || ^19.0.0",
"react-native": "*",
"uploadthing": "^7.2.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/mime-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"devDependencies": {
"@uploadthing/eslint-config": "workspace:*",
"@uploadthing/tsconfig": "workspace:*",
"bunchee": "^5.6.2",
"bunchee": "^6.1.2",
"eslint": "^8.57.0",
"typescript": "^5.5.2"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
},
"peerDependencies": {
"next": "*",
"react": "^17.0.2 || ^18.0.0",
"react": "^17.0.2 || ^18.0.0 || ^19.0.0",
"uploadthing": "^7.2.0"
},
"peerDependenciesMeta": {
Expand All @@ -82,7 +82,7 @@
"@uploadthing/eslint-config": "workspace:*",
"@uploadthing/tsconfig": "workspace:*",
"@vitest/browser": "2.1.2",
"bunchee": "^5.6.2",
"bunchee": "^6.1.2",
"concurrently": "^8.2.2",
"eslint": "^8.57.0",
"next": "14.2.11",
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@types/react": "18.3.3",
"@uploadthing/eslint-config": "workspace:",
"@uploadthing/tsconfig": "workspace:",
"bunchee": "^5.6.2",
"bunchee": "^6.1.2",
"eslint": "^8.57.0",
"react": "18.3.1",
"solid-js": "^1.8.23",
Expand Down
27 changes: 4 additions & 23 deletions packages/uploadthing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,25 +113,15 @@
"./types": {
"types": "./types/index.d.ts",
"default": "./types/index.js"
},
"./internal/types": {
"import": {
"types": "./internal/types.d.ts",
"default": "./internal/types.js"
},
"require": {
"types": "./internal/types.d.cts",
"default": "./internal/types.cjs"
}
}
},
"files": [
"dist",
"client",
"effect-platform",
"express",
"fastify",
"h3",
"internal",
"next",
"next-legacy",
"remix",
Expand All @@ -145,7 +135,7 @@
"scripts": {
"lint": "eslint src test --max-warnings 0",
"build": "bunchee --tsconfig tsconfig.build.json",
"clean": "git clean -xdf client express fastify h3 internal next next-legacy server tw node_modules",
"clean": "git clean -xdf .turbo client effect-platform express fastify h3 next next-legacy remix server types tw node_modules",
"dev": "wait-on ../shared/dist/index.d.ts && bunchee -w --tsconfig tsconfig.build.json --no-clean",
"prepack": "bun ../../.github/replace-workspace-protocol.ts",
"typecheck": "tsc --noEmit"
Expand All @@ -166,10 +156,9 @@
"@uploadthing/eslint-config": "workspace:*",
"@uploadthing/tsconfig": "workspace:*",
"body-parser": "^1.20.2",
"bunchee": "^5.6.2",
"bunchee": "^6.1.2",
"eslint": "^8.57.0",
"express": "^4.18.2",
"fastify": "^4.26.1",
"h3": "^1.11.1",
"next": "14.2.11",
"nuxt": "^3.11.2",
Expand All @@ -185,21 +174,13 @@
},
"peerDependencies": {
"express": "*",
"fastify": "*",
"h3": "*",
"next": "*",
"tailwindcss": ""
"tailwindcss": "*"
},
"peerDependenciesMeta": {
"next": {
"optional": true
},
"express": {
"optional": true
},
"fastify": {
"optional": true
},
"h3": {
"optional": true
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export { version as UPLOADTHING_VERSION } from "../../package.json";
* process.env.UPLOADTHING_TOKEN = "foo"
* Config.string("token"); // Config<"foo">
*/
const envProvider = ConfigProvider.fromEnv().pipe(
const envProvider = /** #__PURE__ */ ConfigProvider.fromEnv().pipe(
ConfigProvider.orElse(() =>
ConfigProvider.fromMap(
new Map(
Expand Down Expand Up @@ -50,7 +50,7 @@ export const configProvider = (options: unknown) =>
ConfigProvider.orElse(() => envProvider),
);

export const IsDevelopment = Config.boolean("isDev").pipe(
export const IsDevelopment = /** #__PURE__ */ Config.boolean("isDev").pipe(
Config.orElse(() =>
Config.succeed(
typeof process !== "undefined" ? process.env.NODE_ENV : undefined,
Expand All @@ -59,7 +59,10 @@ export const IsDevelopment = Config.boolean("isDev").pipe(
Config.withDefault(false),
);

export const UTToken = S.Config("token", UploadThingToken).pipe(
export const UTToken = /** #__PURE__ */ S.Config(
"token",
UploadThingToken,
).pipe(
Effect.catchTags({
ConfigError: (e) =>
new UploadThingError({
Expand All @@ -73,13 +76,13 @@ export const UTToken = S.Config("token", UploadThingToken).pipe(
}),
);

export const ApiUrl = Config.string("apiUrl").pipe(
export const ApiUrl = /** #__PURE__ */ Config.string("apiUrl").pipe(
Config.withDefault("https://api.uploadthing.com"),
Config.mapAttempt((_) => new URL(_)),
Config.map((url) => url.href.replace(/\/$/, "")),
);

export const IngestUrl = Effect.gen(function* () {
export const IngestUrl = /** #__PURE__ */ Effect.gen(function* () {
const { regions, ingestHost } = yield* UTToken;
const region = regions[0]; // Currently only support 1 region per app

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ import {
import { UTFiles } from "./types";
import type { AdapterFnArgs, AnyFileRoute, UTEvents } from "./types";

export class AdapterArguments extends Context.Tag(
"uploadthing/AdapterArguments",
)<AdapterArguments, AdapterFnArgs<any, any, any>>() {}
export class AdapterArguments
extends /** #__PURE__ */ Context.Tag("uploadthing/AdapterArguments")<
AdapterArguments,
AdapterFnArgs<any, any, any>
>() {}

export const makeAdapterHandler = <Args extends any[]>(
makeAdapterArgs: (
Expand Down
152 changes: 152 additions & 0 deletions packages/uploadthing/src/_internal/shared-schemas.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
import * as S from "effect/Schema";

import type { Json } from "@uploadthing/shared";
import { ValidACLs, ValidContentDispositions } from "@uploadthing/shared";

export const ContentDispositionSchema = /** #__PURE__ */ S.Literal(
...ValidContentDispositions,
);
export const ACLSchema = /** #__PURE__ */ S.Literal(...ValidACLs);

/**
* Valid options for the `?actionType` query param
*/
export const ActionType = /** #__PURE__ */ S.Literal("upload");

/**
* Valid options for the `uploadthing-hook` header
* for requests coming from UT server
*/
export const UploadThingHook = /** #__PURE__ */ S.Literal("callback", "error");

/**
* =============================================================================
* =========================== Configuration ===================================
* =============================================================================
*/
const DecodeString = /** #__PURE__ */ S.transform(
S.Uint8ArrayFromSelf,
S.String,
{
decode: (data) => new TextDecoder().decode(data),
encode: (data) => new TextEncoder().encode(data),
},
);

export const ParsedToken = /** #__PURE__ */ S.Struct({
apiKey: S.Redacted(S.String.pipe(S.startsWith("sk_"))),
appId: S.String,
regions: S.NonEmptyArray(S.String),
ingestHost: S.String.pipe(
S.optionalWith({ default: () => "ingest.uploadthing.com" }),
),
});

export const UploadThingToken = /** #__PURE__ */ S.Uint8ArrayFromBase64.pipe(
S.compose(DecodeString),
S.compose(S.parseJson(ParsedToken)),
);

/**
* =============================================================================
* ======================== File Type Hierarchy ===============================
* =============================================================================
*/

/**
* Properties from the web File object, this is what the client sends when initiating an upload
*/
export class FileUploadData
extends /** #__PURE__ */ S.Class<FileUploadData>("FileUploadData")({
name: S.String,
size: S.Number,
type: S.String,
lastModified: S.Number.pipe(S.optional),
}) {}

/**
* `.middleware()` can add a customId to the incoming file data
*/
export class FileUploadDataWithCustomId
extends /** #__PURE__ */ FileUploadData.extend<FileUploadDataWithCustomId>(
"FileUploadDataWithCustomId",
)({
customId: S.NullOr(S.String),
}) {}

/**
* When files are uploaded, we get back
* - a key
* - a direct URL for the file
* - an app-specific URL for the file (useful for scoping eg. for optimization allowed origins)
* - the hash (md5-hex) of the uploaded file's contents
*/
export class UploadedFileData
extends /** #__PURE__ */ FileUploadDataWithCustomId.extend<UploadedFileData>(
"UploadedFileData",
)({
key: S.String,
url: S.String,
appUrl: S.String,
fileHash: S.String,
}) {}

/**
* When the client has uploaded a file and polled for data returned by `.onUploadComplete()`
*/
export interface ClientUploadedFileData<T>
extends /** #__PURE__ */ UploadedFileData {
/**
* Matches what's returned from the serverside `onUploadComplete` callback
*/
readonly serverData: T;
}

/**
* =============================================================================
* ======================== Server Response Schemas ============================
* =============================================================================
*/

export class NewPresignedUrl
extends /** #__PURE__ */ S.Class<NewPresignedUrl>("NewPresignedUrl")({
url: S.String,
key: S.String,
customId: S.NullOr(S.String),
name: S.String,
}) {}

export class MetadataFetchStreamPart
extends /** #__PURE__ */ S.Class<MetadataFetchStreamPart>(
"MetadataFetchStreamPart",
)({
payload: S.String,
signature: S.String,
hook: UploadThingHook,
}) {}

export class MetadataFetchResponse
extends /** #__PURE__ */ S.Class<MetadataFetchResponse>(
"MetadataFetchResponse",
)({
ok: S.Boolean,
}) {}

export class CallbackResultResponse
extends /** #__PURE__ */ S.Class<CallbackResultResponse>(
"CallbackResultResponse",
)({
ok: S.Boolean,
}) {}

/**
* =============================================================================
* ======================== Client Action Payloads ============================
* =============================================================================
*/

export class UploadActionPayload
extends /** #__PURE__ */ S.Class<UploadActionPayload>("UploadActionPayload")({
files: S.Array(FileUploadData),
input: S.Unknown as S.Schema<Json>,
}) {}
8 changes: 4 additions & 4 deletions packages/uploadthing/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import {
} from "@uploadthing/shared";

import * as pkgJson from "../package.json";
import type { Deferred } from "./internal/deferred";
import { createDeferred } from "./internal/deferred";
import { uploadFile, uploadFilesInternal } from "./internal/upload.browser";
import { createUTReporter } from "./internal/ut-reporter";
import type { Deferred } from "./_internal/deferred";
import { createDeferred } from "./_internal/deferred";
import { uploadFile, uploadFilesInternal } from "./_internal/upload.browser";
import { createUTReporter } from "./_internal/ut-reporter";
import type {
ClientUploadedFileData,
CreateUploadOptions,
Expand Down
10 changes: 5 additions & 5 deletions packages/uploadthing/src/effect-platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import * as Layer from "effect/Layer";

import type { Json } from "@uploadthing/shared";

import { configProvider } from "./internal/config";
import { AdapterArguments, createRequestHandler } from "./internal/handler";
import type { CreateBuilderOptions } from "./internal/upload-builder";
import { createBuilder } from "./internal/upload-builder";
import { configProvider } from "./_internal/config";
import { AdapterArguments, createRequestHandler } from "./_internal/handler";
import type { CreateBuilderOptions } from "./_internal/upload-builder";
import { createBuilder } from "./_internal/upload-builder";
import type { FileRouter, RouteHandlerConfig } from "./types";

export { UTFiles } from "./internal/types";
export { UTFiles } from "./_internal/types";
export type { FileRouter };

type AdapterArgs = {
Expand Down
10 changes: 5 additions & 5 deletions packages/uploadthing/src/express.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import { Router as ExpressRouter } from "express";

import type { Json } from "@uploadthing/shared";

import { makeAdapterHandler } from "./internal/handler";
import { getPostBody, toWebRequest } from "./internal/to-web-request";
import type { CreateBuilderOptions } from "./internal/upload-builder";
import { createBuilder } from "./internal/upload-builder";
import { makeAdapterHandler } from "./_internal/handler";
import { getPostBody, toWebRequest } from "./_internal/to-web-request";
import type { CreateBuilderOptions } from "./_internal/upload-builder";
import { createBuilder } from "./_internal/upload-builder";
import type { FileRouter, RouteHandlerOptions } from "./types";

export { UTFiles } from "./internal/types";
export { UTFiles } from "./_internal/types";
export type { FileRouter };

type AdapterArgs = {
Expand Down
Loading
Loading