Remove diff from cli-kit/app#7727
Draft
amcaplan wants to merge 1 commit into
Draft
Conversation
Co-Authored-By: Claude <noreply@anthropic.com> 🤖 Generated with [Claude Code](https://claude.ai/code) 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/content-tokens.d.ts@@ -1,5 +1,14 @@
import { OutputMessage } from '../../public/node/output.js';
-import type { Change } from 'diff';
+/**
+ * A single segment of a line-based diff, as consumed by {@link LinesDiffContentToken}.
+ * Structurally a subset of jsdiff's type: unchanged segments have neither
+ * nor set; changed segments set exactly one of them to .
+ */
+export interface LinesDiffSegment {
+ value: string;
+ added?: boolean;
+ removed?: boolean;
+}
export declare abstract class ContentToken<T> {
value: T;
constructor(value: T);
@@ -20,7 +29,7 @@ export declare class CommandContentToken extends ContentToken<OutputMessage> {
export declare class JsonContentToken extends ContentToken<any> {
output(): string;
}
-export declare class LinesDiffContentToken extends ContentToken<Change[]> {
+export declare class LinesDiffContentToken extends ContentToken<LinesDiffSegment[]> {
output(): string[];
}
export declare class ColorContentToken extends ContentToken<OutputMessage> {
packages/cli-kit/dist/public/node/output.d.ts@@ -1,9 +1,9 @@
import { PackageManager } from './node-package-manager.js';
import { AbortSignal } from './abort.js';
import { TokenItem } from './ui.js';
-import { ColorContentToken, CommandContentToken, ContentToken, ErrorContentToken, HeadingContentToken, ItalicContentToken, JsonContentToken, LinesDiffContentToken, LinkContentToken, PathContentToken, RawContentToken, SubHeadingContentToken } from '../../private/node/content-tokens.js';
+import { ColorContentToken, CommandContentToken, ContentToken, ErrorContentToken, HeadingContentToken, ItalicContentToken, JsonContentToken, LinesDiffContentToken, LinesDiffSegment, LinkContentToken, PathContentToken, RawContentToken, SubHeadingContentToken } from '../../private/node/content-tokens.js';
import { Writable } from 'stream';
-import type { Change } from 'diff';
+export type { LinesDiffSegment };
export type Logger = Writable | ((message: string, logLevel?: LogLevel) => void);
export declare class TokenizedString {
value: string;
@@ -28,7 +28,7 @@ export declare const outputToken: {
packagejsonScript(packageManager: PackageManager, scriptName: string, ...scriptArgs: string[]): CommandContentToken;
successIcon(): ColorContentToken;
failIcon(): ErrorContentToken;
- linesDiff(value: Change[]): LinesDiffContentToken;
+ linesDiff(value: LinesDiffSegment[]): LinesDiffContentToken;
};
/**
* Given a command and its arguments, it formats it depending on the package manager.
|
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
difffrom@shopify/app/@shopify/cli-kitWhy:
diff(jsdiff) is a high-churn dependency (58 Dependabot bumps / 24 months). Part of an initiative to cut low-value dependency churn.Replacement: Inlined a faithful line-diff implementation at
packages/app/src/cli/services/app/env/lines-diff.ts.diffpackage produced 0 divergences. That battery is frozen into 13 static parity cases inlines-diff.test.ts.content-tokens.ts/output.tsnow use a local exportedLinesDiffSegmenttype, preserving theoutputToken.linesDiffcontract.Validation:
type-check✅,lint✅,vitest✅ (33/33 tests).🤖 AI-generated draft — needs human review before merge.