Remove form-data from cli-kit/app#7729
Draft
amcaplan wants to merge 1 commit into
Draft
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Differences in type declarationsWe detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:
New type declarationsWe found no new type declarations in this PR Existing type declarationspackages/cli-kit/dist/private/node/api.d.ts@@ -1,4 +1,7 @@
-import { Headers } from 'form-data';
+export interface AnyHeaders {
+ forEach: (callback: (value: any, key: any) => void) => void;
+ get?: (name: string) => string | null;
+}
export type API = 'admin' | 'storefront-renderer' | 'partners' | 'business-platform' | 'app-management';
export declare const allAPIs: API[];
export type NetworkRetryBehaviour = {
@@ -38,7 +41,7 @@ export declare function isTransientNetworkError(error: unknown): boolean;
*/
export declare function isNetworkError(error: unknown): boolean;
export declare function simpleRequestWithDebugLog<T extends {
- headers: Headers;
+ headers: AnyHeaders;
status: number;
}>(requestOptions: RequestOptions<T>, errorHandler?: (error: unknown, requestId: string | undefined) => unknown): Promise<T>;
/**
@@ -59,7 +62,7 @@ export declare function simpleRequestWithDebugLog<T extends {
* @returns The response from the request
*/
export declare function retryAwareRequest<T extends {
- headers: Headers;
+ headers: AnyHeaders;
status: number;
}>(requestOptions: RequestOptions<T>, errorHandler?: (error: unknown, requestId: string | undefined) => unknown, retryOptions?: {
limitRetriesTo?: number;
packages/cli-kit/dist/public/node/http.d.ts@@ -1,5 +1,4 @@
import { NetworkRetryBehaviour } from '../../private/node/api.js';
-import FormData from 'form-data';
import { RequestInfo, RequestInit, Response } from 'node-fetch';
export { FetchError, Request, Response } from 'node-fetch';
/**
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Remove
form-datafrom@shopify/cli-kitWhy: Part of an initiative to cut low-value dependency churn (14 Dependabot bumps / 24 months).
Replacement: Native
FormData(Node ≥ 22.12) + structural typing.api.ts: replaced theform-dataHeaderstype import with a structural type.bundle.ts(GCS upload): kept as a rawPUTwith a manually-setContent-Typeboundary — wire behavior is preserved (verified against existing upload tests).formData()helper now returns a nativeFormData, which drops.getHeaders()and.getBoundary()that theform-datainstance exposed. This is a public-surface change — please confirm no external consumer relies on those methods.Validation:
type-check✅,lint✅,vitest✅ (93 tests, includingdeploy/uploadanddev-session-process).🤖 AI-generated draft — needs human review before merge.