Enhance mobile review comments with diff previews
- Add syntax-highlighted diff rendering and cached review state - Support pasted/attached images in review comments - Improve mobile review sheet handling for large or partial diffs Co-authored-by: codex <[email protected]>
This commit is contained in:
1 parent
493fbfab91
commit
9bebd283a5
17 files changed
+1569
-577
No files matched your search
+1
-1
@@ -11,7 +11,7 @@
|
||||
"**/routeTree.gen.ts",
|
||||
"apps/web/public/mockServiceWorker.js",
|
||||
"apps/web/src/lib/vendor/qrcodegen.ts",
|
||||
"apps/mobile/uniwind-types.d.ts"
|
||||
"apps/mobile/uniwind-types.d.ts",
|
||||
"*.icon/**"
|
||||
],
|
||||
"sortPackageJson": {}
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
"react-native-reanimated": "4.2.1",
|
||||
"react-native-safe-area-context": "~5.6.2",
|
||||
"react-native-screens": "~4.23.0",
|
||||
"react-native-shiki-engine": "^0.3.9",
|
||||
"react-native-svg": "15.15.3",
|
||||
"react-native-worklets": "0.7.2",
|
||||
"shiki": "^4.0.2",
|
||||
|
||||
@@ -46,6 +46,7 @@ export default function ThreadLayout() {
|
||||
options={{
|
||||
animation: "slide_from_right",
|
||||
contentStyle: sheetStyle,
|
||||
headerBackButtonDisplayMode: "minimal",
|
||||
headerShown: true,
|
||||
headerTitle: "Files changed",
|
||||
headerBackTitle: "",
|
||||
|
||||
@@ -15,6 +15,8 @@ export interface ComposerAttachmentStripProps {
|
||||
readonly imageSize?: number;
|
||||
/** Border radius of each image thumbnail. Defaults to 16. */
|
||||
readonly imageBorderRadius?: number;
|
||||
/** Whether the remove button should sit in its own gutter instead of overlapping the image. */
|
||||
readonly removeButtonPlacement?: "overlay" | "gutter";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -25,6 +27,8 @@ export function ComposerAttachmentStrip(props: ComposerAttachmentStripProps) {
|
||||
const subtleBg = useThemeColor("--color-subtle");
|
||||
const size = props.imageSize ?? 72;
|
||||
const radius = props.imageBorderRadius ?? 16;
|
||||
const removeButtonPlacement = props.removeButtonPlacement ?? "overlay";
|
||||
const removeButtonGutter = removeButtonPlacement === "gutter" ? 10 : 0;
|
||||
|
||||
if (props.attachments.length === 0) {
|
||||
return null;
|
||||
@@ -39,7 +43,14 @@ export function ComposerAttachmentStrip(props: ComposerAttachmentStripProps) {
|
||||
>
|
||||
<View style={{ flexDirection: "row", gap: 10 }}>
|
||||
{props.attachments.map((image) => (
|
||||
<View key={image.id} style={{ position: "relative" }}>
|
||||
<View
|
||||
key={image.id}
|
||||
style={{
|
||||
position: "relative",
|
||||
paddingTop: removeButtonGutter,
|
||||
paddingRight: removeButtonGutter,
|
||||
}}
|
||||
>
|
||||
<Pressable
|
||||
onPress={props.onPressImage ? () => props.onPressImage!(image.previewUri) : undefined}
|
||||
>
|
||||
@@ -57,8 +68,8 @@ export function ComposerAttachmentStrip(props: ComposerAttachmentStripProps) {
|
||||
<Pressable
|
||||
style={{
|
||||
position: "absolute",
|
||||
top: 4,
|
||||
right: 4,
|
||||
top: removeButtonPlacement === "gutter" ? 0 : 4,
|
||||
right: removeButtonPlacement === "gutter" ? 0 : 4,
|
||||
width: 22,
|
||||
height: 22,
|
||||
borderRadius: 11,
|
||||
|
||||
@@ -1,12 +1,29 @@
|
||||
import { useLocalSearchParams, useRouter } from "expo-router";
|
||||
import { SymbolView } from "expo-symbols";
|
||||
import { useMemo, useState } from "react";
|
||||
import { Platform, Pressable, ScrollView, Text as NativeText, View } from "react-native";
|
||||
import { TextInputWrapper } from "expo-paste-input";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import {
|
||||
KeyboardAvoidingView,
|
||||
Platform,
|
||||
Pressable,
|
||||
ScrollView,
|
||||
View,
|
||||
useColorScheme,
|
||||
useWindowDimensions,
|
||||
} from "react-native";
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||
import ImageViewing from "react-native-image-viewing";
|
||||
|
||||
import { AppText as Text, AppTextInput as TextInput } from "../../../components/AppText";
|
||||
import { ComposerAttachmentStrip } from "../../../components/ComposerAttachmentStrip";
|
||||
import { ControlPill } from "../../../components/ControlPill";
|
||||
import { cn } from "../../../lib/cn";
|
||||
import type { DraftComposerImageAttachment } from "../../../lib/composerImages";
|
||||
import { convertPastedImagesToAttachments, pickComposerImages } from "../../../lib/composerImages";
|
||||
import { useThemeColor } from "../../../lib/useThemeColor";
|
||||
import { useNativePaste } from "../../../hooks/useNativePaste";
|
||||
import { setPendingConnectionError } from "../../../state/use-remote-environment-registry";
|
||||
import { appendReviewCommentToDraft } from "../use-thread-composer-state";
|
||||
import {
|
||||
clearReviewCommentTarget,
|
||||
formatReviewCommentContext,
|
||||
@@ -15,28 +32,21 @@ import {
|
||||
getSelectedReviewCommentLines,
|
||||
useReviewCommentTarget,
|
||||
} from "./reviewCommentSelection";
|
||||
import { appendReviewCommentToDraft } from "../use-thread-composer-state";
|
||||
import { changeTone, DiffTokenText } from "./reviewDiffRendering";
|
||||
import {
|
||||
highlightReviewSelectedLines,
|
||||
type ReviewDiffTheme,
|
||||
type ReviewHighlightedToken,
|
||||
} from "./shikiReviewHighlighter";
|
||||
|
||||
const REVIEW_MONO_FONT_FAMILY = Platform.select({
|
||||
ios: "ui-monospace",
|
||||
android: "monospace",
|
||||
default: "monospace",
|
||||
});
|
||||
|
||||
function renderVisibleWhitespace(value: string): string {
|
||||
const expandedTabs = value.replace(/\t/g, " ");
|
||||
return expandedTabs.replace(/^( +)/, (leading) => leading.replaceAll(" ", "\u00A0"));
|
||||
}
|
||||
|
||||
function changeTone(change: "context" | "add" | "delete"): string {
|
||||
if (change === "add") return "bg-emerald-500/12";
|
||||
if (change === "delete") return "bg-rose-500/12";
|
||||
return "bg-card";
|
||||
}
|
||||
const REVIEW_COMMENT_PREVIEW_MAX_LINES = 5;
|
||||
const REVIEW_COMMENT_LINE_HEIGHT = 26;
|
||||
|
||||
export function ReviewCommentComposerSheet() {
|
||||
const router = useRouter();
|
||||
const insets = useSafeAreaInsets();
|
||||
const { width } = useWindowDimensions();
|
||||
const colorScheme = useColorScheme();
|
||||
const iconTint = String(useThemeColor("--color-icon"));
|
||||
const target = useReviewCommentTarget();
|
||||
const { environmentId, threadId } = useLocalSearchParams<{
|
||||
@@ -44,6 +54,11 @@ export function ReviewCommentComposerSheet() {
|
||||
threadId: string;
|
||||
}>();
|
||||
const [commentText, setCommentText] = useState("");
|
||||
const [highlightedLinesById, setHighlightedLinesById] = useState<
|
||||
Record<string, ReadonlyArray<ReviewHighlightedToken>>
|
||||
>({});
|
||||
const [attachments, setAttachments] = useState<ReadonlyArray<DraftComposerImageAttachment>>([]);
|
||||
const [previewImageUri, setPreviewImageUri] = useState<string | null>(null);
|
||||
|
||||
const selectedLines = useMemo(
|
||||
() => (target ? getSelectedReviewCommentLines(target) : []),
|
||||
@@ -53,136 +68,252 @@ export function ReviewCommentComposerSheet() {
|
||||
const lastLine = selectedLines[selectedLines.length - 1] ?? null;
|
||||
const firstNumber = firstLine ? getReviewUnifiedLineNumber(firstLine) : null;
|
||||
const lastNumber = lastLine ? getReviewUnifiedLineNumber(lastLine) : null;
|
||||
const selectedTheme = (colorScheme === "dark" ? "dark" : "light") satisfies ReviewDiffTheme;
|
||||
const canSubmit =
|
||||
commentText.trim().length > 0 && target !== null && !!environmentId && !!threadId;
|
||||
const selectionLabel =
|
||||
selectedLines.length === 1
|
||||
? firstNumber !== null
|
||||
? `Line ${firstNumber}`
|
||||
: "File comment"
|
||||
: firstNumber !== null && lastNumber !== null
|
||||
? `Lines ${firstNumber}-${lastNumber}`
|
||||
: `${selectedLines.length} lines selected`;
|
||||
const previewHeight = Math.max(
|
||||
Math.min(selectedLines.length, REVIEW_COMMENT_PREVIEW_MAX_LINES) * REVIEW_COMMENT_LINE_HEIGHT,
|
||||
REVIEW_COMMENT_LINE_HEIGHT,
|
||||
);
|
||||
const previewViewportWidth = Math.max(width - 40, 280);
|
||||
const handleNativePaste = useNativePaste((uris) => {
|
||||
void (async () => {
|
||||
try {
|
||||
const images = await convertPastedImagesToAttachments({
|
||||
uris,
|
||||
existingCount: attachments.length,
|
||||
});
|
||||
if (images.length > 0) {
|
||||
setAttachments((current) => [...current, ...images]);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("[review comment] error converting pasted images", error);
|
||||
}
|
||||
})();
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!target || selectedLines.length === 0) {
|
||||
setHighlightedLinesById({});
|
||||
return;
|
||||
}
|
||||
|
||||
let cancelled = false;
|
||||
void highlightReviewSelectedLines({
|
||||
filePath: target.filePath,
|
||||
lines: selectedLines,
|
||||
theme: selectedTheme,
|
||||
})
|
||||
.then((next) => {
|
||||
if (!cancelled) {
|
||||
setHighlightedLinesById(next);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
if (!cancelled) {
|
||||
setHighlightedLinesById({});
|
||||
}
|
||||
});
|
||||
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [selectedLines, selectedTheme, target]);
|
||||
|
||||
async function handlePickImages(): Promise<void> {
|
||||
const result = await pickComposerImages({ existingCount: attachments.length });
|
||||
if (result.images.length > 0) {
|
||||
setAttachments((current) => [...current, ...result.images]);
|
||||
}
|
||||
if (result.error) {
|
||||
setPendingConnectionError(result.error);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<ScrollView
|
||||
keyboardShouldPersistTaps="handled"
|
||||
showsVerticalScrollIndicator={false}
|
||||
contentContainerStyle={{
|
||||
paddingHorizontal: 20,
|
||||
paddingTop: 8,
|
||||
paddingBottom: Math.max(insets.bottom, 18) + 18,
|
||||
gap: 16,
|
||||
}}
|
||||
<KeyboardAvoidingView
|
||||
behavior={Platform.OS === "ios" ? "padding" : "height"}
|
||||
keyboardVerticalOffset={Platform.OS === "ios" ? 12 : 0}
|
||||
style={{ flex: 1 }}
|
||||
>
|
||||
<View className="flex-row items-center justify-between py-2">
|
||||
<Pressable
|
||||
className="bg-subtle h-12 w-12 items-center justify-center rounded-full"
|
||||
onPress={() => {
|
||||
clearReviewCommentTarget();
|
||||
router.dismiss();
|
||||
}}
|
||||
>
|
||||
<SymbolView name="xmark" size={18} tintColor={iconTint} type="monochrome" />
|
||||
</Pressable>
|
||||
|
||||
<Text className="text-[18px] font-t3-bold text-foreground">Add Comment</Text>
|
||||
|
||||
<Pressable
|
||||
className={cn(
|
||||
"min-h-[44px] min-w-[124px] items-center justify-center rounded-full px-5",
|
||||
canSubmit ? "bg-foreground" : "border border-border bg-card",
|
||||
)}
|
||||
disabled={!canSubmit}
|
||||
onPress={() => {
|
||||
if (!target || !environmentId || !threadId || commentText.trim().length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
appendReviewCommentToDraft({
|
||||
environmentId,
|
||||
threadId,
|
||||
text: formatReviewCommentContext(target, commentText),
|
||||
});
|
||||
clearReviewCommentTarget();
|
||||
router.dismiss();
|
||||
}}
|
||||
style={{ opacity: canSubmit ? 1 : 0.55 }}
|
||||
>
|
||||
<Text
|
||||
className={cn(
|
||||
"text-[14px] font-t3-bold",
|
||||
canSubmit ? "text-background" : "text-foreground-muted",
|
||||
)}
|
||||
<View
|
||||
style={{
|
||||
flex: 1,
|
||||
paddingHorizontal: 20,
|
||||
paddingTop: 8,
|
||||
paddingBottom: Math.max(insets.bottom, 18) + 18,
|
||||
}}
|
||||
>
|
||||
<View className="flex-row items-center justify-between py-2">
|
||||
<Pressable
|
||||
className="bg-subtle h-12 w-12 items-center justify-center rounded-full"
|
||||
onPress={() => {
|
||||
clearReviewCommentTarget();
|
||||
router.dismiss();
|
||||
}}
|
||||
>
|
||||
Comment
|
||||
</Text>
|
||||
</Pressable>
|
||||
</View>
|
||||
<SymbolView name="xmark" size={18} tintColor={iconTint} type="monochrome" />
|
||||
</Pressable>
|
||||
|
||||
{!target ? (
|
||||
<View className="rounded-[22px] border border-border bg-card px-4 py-5">
|
||||
<Text className="text-[15px] font-t3-bold text-foreground">No selection</Text>
|
||||
<Text className="mt-1 text-[13px] leading-[19px] text-foreground-muted">
|
||||
Select a diff line or range first.
|
||||
</Text>
|
||||
<Text className="text-[18px] font-t3-bold text-foreground">Add Comment</Text>
|
||||
|
||||
<View className="h-12 w-12" />
|
||||
</View>
|
||||
) : (
|
||||
<>
|
||||
<View className="gap-1 rounded-[22px] border border-border bg-card px-4 py-4">
|
||||
<Text className="font-mono text-[13px] leading-[18px] text-foreground">
|
||||
{target.filePath}
|
||||
</Text>
|
||||
<Text className="text-[12px] font-t3-medium text-foreground-muted">
|
||||
{selectedLines.length === 1
|
||||
? firstNumber !== null
|
||||
? `Line ${firstNumber}`
|
||||
: "File comment"
|
||||
: firstNumber !== null && lastNumber !== null
|
||||
? `Lines ${firstNumber}-${lastNumber}`
|
||||
: `${selectedLines.length} lines selected`}
|
||||
|
||||
{!target ? (
|
||||
<View className="rounded-[22px] border border-border bg-card px-4 py-5">
|
||||
<Text className="text-[15px] font-t3-bold text-foreground">No selection</Text>
|
||||
<Text className="mt-1 text-[13px] leading-[19px] text-foreground-muted">
|
||||
Select a diff line or range first.
|
||||
</Text>
|
||||
</View>
|
||||
) : (
|
||||
<View className="flex-1 gap-4">
|
||||
<View className="gap-1 px-1">
|
||||
<Text className="text-[11px] font-t3-bold uppercase text-foreground-muted">
|
||||
{selectionLabel}
|
||||
</Text>
|
||||
<Text
|
||||
className="font-mono text-[12px] leading-[17px] text-foreground-muted"
|
||||
ellipsizeMode="middle"
|
||||
numberOfLines={2}
|
||||
>
|
||||
{target.filePath}
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<View className="overflow-hidden rounded-[22px] border border-border bg-card">
|
||||
{selectedLines.map((line) => {
|
||||
const lineNumber = getReviewUnifiedLineNumber(line);
|
||||
|
||||
return (
|
||||
<View
|
||||
key={line.id}
|
||||
className={cn(
|
||||
"flex-row items-start border-b border-border/60",
|
||||
changeTone(line.change),
|
||||
)}
|
||||
<View className="overflow-hidden rounded-[22px] border border-border bg-card">
|
||||
<ScrollView
|
||||
horizontal
|
||||
bounces={false}
|
||||
keyboardShouldPersistTaps="always"
|
||||
showsHorizontalScrollIndicator={false}
|
||||
>
|
||||
<ScrollView
|
||||
bounces={false}
|
||||
scrollEnabled={selectedLines.length > REVIEW_COMMENT_PREVIEW_MAX_LINES}
|
||||
nestedScrollEnabled
|
||||
keyboardShouldPersistTaps="always"
|
||||
showsVerticalScrollIndicator={
|
||||
selectedLines.length > REVIEW_COMMENT_PREVIEW_MAX_LINES
|
||||
}
|
||||
style={{ height: previewHeight }}
|
||||
>
|
||||
<Text className="w-9 px-1 py-2 text-right text-[11px] font-t3-medium text-foreground-muted">
|
||||
{lineNumber ?? ""}
|
||||
</Text>
|
||||
<Text
|
||||
className="px-0.5 py-2 text-center font-mono text-[12px] text-foreground-muted"
|
||||
style={{ width: 18 }}
|
||||
>
|
||||
{getReviewChangeMarker(line.change)}
|
||||
</Text>
|
||||
<NativeText
|
||||
selectable
|
||||
className="flex-1 px-1 py-2 text-[12px] leading-[19px] text-foreground"
|
||||
style={{ fontFamily: REVIEW_MONO_FONT_FAMILY }}
|
||||
>
|
||||
{renderVisibleWhitespace(line.content || " ")}
|
||||
</NativeText>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
<View style={{ minWidth: previewViewportWidth }}>
|
||||
{selectedLines.map((line) => {
|
||||
const lineNumber = getReviewUnifiedLineNumber(line);
|
||||
|
||||
<View className="gap-2">
|
||||
<Text className="text-[13px] font-t3-bold text-foreground">Comment</Text>
|
||||
<TextInput
|
||||
autoFocus
|
||||
multiline
|
||||
placeholder="Leave a comment..."
|
||||
textAlignVertical="top"
|
||||
value={commentText}
|
||||
onChangeText={setCommentText}
|
||||
className="min-h-[192px] rounded-[20px] px-4 py-3.5 font-sans text-[15px]"
|
||||
/>
|
||||
return (
|
||||
<View
|
||||
key={line.id}
|
||||
className={cn("flex-row items-start", changeTone(line.change))}
|
||||
style={{ height: REVIEW_COMMENT_LINE_HEIGHT }}
|
||||
>
|
||||
<Text className="w-9 px-1 py-1 text-right text-[11px] font-t3-medium text-foreground-muted">
|
||||
{lineNumber ?? ""}
|
||||
</Text>
|
||||
<Text
|
||||
className="px-0.5 py-1 text-center font-mono text-[12px] text-foreground-muted"
|
||||
style={{ width: 18 }}
|
||||
>
|
||||
{getReviewChangeMarker(line.change)}
|
||||
</Text>
|
||||
<View className="min-w-0 flex-1 flex-shrink-0 px-1 py-1">
|
||||
<DiffTokenText
|
||||
fallback={line.content}
|
||||
tokens={highlightedLinesById[line.id] ?? null}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
</ScrollView>
|
||||
</ScrollView>
|
||||
</View>
|
||||
|
||||
<View className="gap-2">
|
||||
<Text className="text-[13px] font-t3-bold text-foreground">Comment</Text>
|
||||
<View
|
||||
className="overflow-hidden rounded-[20px] border border-border bg-card"
|
||||
style={{ height: 172 }}
|
||||
>
|
||||
<View className="flex-1 px-4 pt-3.5">
|
||||
<TextInputWrapper onPaste={handleNativePaste}>
|
||||
<TextInput
|
||||
autoFocus
|
||||
multiline
|
||||
placeholder="Leave a comment..."
|
||||
textAlignVertical="top"
|
||||
value={commentText}
|
||||
onChangeText={setCommentText}
|
||||
className="flex-1 border-0 bg-transparent px-0 py-0 font-sans text-[15px]"
|
||||
/>
|
||||
</TextInputWrapper>
|
||||
</View>
|
||||
{attachments.length > 0 ? (
|
||||
<View className="px-4 pb-3 pt-2">
|
||||
<ComposerAttachmentStrip
|
||||
attachments={attachments}
|
||||
imageBorderRadius={16}
|
||||
imageSize={60}
|
||||
onPressImage={setPreviewImageUri}
|
||||
removeButtonPlacement="gutter"
|
||||
onRemove={(imageId) => {
|
||||
setAttachments((current) =>
|
||||
current.filter((image) => image.id !== imageId),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
) : null}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View className="flex-row items-center gap-3 pt-1">
|
||||
<ControlPill icon="plus" onPress={() => void handlePickImages()} />
|
||||
<View className="flex-1" />
|
||||
<ControlPill
|
||||
icon="arrow.up"
|
||||
label="Comment"
|
||||
variant="primary"
|
||||
disabled={!canSubmit}
|
||||
onPress={() => {
|
||||
if (!target || !environmentId || !threadId || commentText.trim().length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
appendReviewCommentToDraft({
|
||||
environmentId,
|
||||
threadId,
|
||||
text: formatReviewCommentContext(target, commentText),
|
||||
attachments,
|
||||
});
|
||||
setAttachments([]);
|
||||
clearReviewCommentTarget();
|
||||
router.dismiss();
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
</>
|
||||
)}
|
||||
</ScrollView>
|
||||
)}
|
||||
</View>
|
||||
<ImageViewing
|
||||
images={previewImageUri ? [{ uri: previewImageUri }] : []}
|
||||
imageIndex={0}
|
||||
visible={previewImageUri !== null}
|
||||
onRequestClose={() => setPreviewImageUri(null)}
|
||||
swipeToCloseEnabled
|
||||
doubleTapToZoomEnabled
|
||||
/>
|
||||
</KeyboardAvoidingView>
|
||||
);
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -152,3 +152,7 @@ export function formatReviewCommentContext(target: ReviewCommentTarget, comment:
|
||||
"</review_comment>",
|
||||
].join("\n");
|
||||
}
|
||||
|
||||
export function countReviewCommentContexts(value: string): number {
|
||||
return Array.from(value.matchAll(/<review_comment>/g)).length;
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
import { Platform, Text as NativeText } from "react-native";
|
||||
|
||||
import { cn } from "../../../lib/cn";
|
||||
|
||||
import type { ReviewRenderableLineRow } from "./reviewModel";
|
||||
import type { ReviewHighlightedToken } from "./shikiReviewHighlighter";
|
||||
|
||||
export const REVIEW_MONO_FONT_FAMILY = Platform.select({
|
||||
ios: "ui-monospace",
|
||||
android: "monospace",
|
||||
default: "monospace",
|
||||
});
|
||||
|
||||
export function renderVisibleWhitespace(value: string): string {
|
||||
const expandedTabs = value.replace(/\t/g, " ");
|
||||
return expandedTabs.replace(/^( +)/, (leading) => leading.replaceAll(" ", "\u00A0"));
|
||||
}
|
||||
|
||||
export function changeTone(change: ReviewRenderableLineRow["change"]): string {
|
||||
if (change === "add") return "bg-emerald-500/12";
|
||||
if (change === "delete") return "bg-rose-500/12";
|
||||
return "bg-card";
|
||||
}
|
||||
|
||||
export function DiffTokenText(props: {
|
||||
readonly tokens: ReadonlyArray<ReviewHighlightedToken> | null;
|
||||
readonly fallback: string;
|
||||
readonly className?: string;
|
||||
}) {
|
||||
if (!props.tokens || props.tokens.length === 0) {
|
||||
return (
|
||||
<NativeText
|
||||
selectable
|
||||
className={cn("text-[13px] leading-[17px] font-medium text-foreground", props.className)}
|
||||
style={{ fontFamily: REVIEW_MONO_FONT_FAMILY }}
|
||||
>
|
||||
{renderVisibleWhitespace(props.fallback || " ")}
|
||||
</NativeText>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<NativeText
|
||||
selectable
|
||||
className={cn("text-[13px] leading-[17px] font-medium text-foreground", props.className)}
|
||||
style={{ fontFamily: REVIEW_MONO_FONT_FAMILY }}
|
||||
>
|
||||
{(() => {
|
||||
let offset = 0;
|
||||
|
||||
return props.tokens.map((token) => {
|
||||
const start = offset;
|
||||
offset += token.content.length;
|
||||
|
||||
const fontWeight =
|
||||
token.fontStyle !== null && (token.fontStyle & 2) === 2
|
||||
? ("700" as const)
|
||||
: ("500" as const);
|
||||
const fontStyle =
|
||||
token.fontStyle !== null && (token.fontStyle & 1) === 1
|
||||
? ("italic" as const)
|
||||
: ("normal" as const);
|
||||
|
||||
return (
|
||||
<NativeText
|
||||
key={`${start}:${token.content.length}:${token.color ?? ""}:${token.fontStyle ?? ""}`}
|
||||
selectable
|
||||
style={{
|
||||
color: token.color ?? undefined,
|
||||
fontFamily: REVIEW_MONO_FONT_FAMILY,
|
||||
fontWeight,
|
||||
fontStyle,
|
||||
}}
|
||||
>
|
||||
{token.content.length > 0 ? renderVisibleWhitespace(token.content) : " "}
|
||||
</NativeText>
|
||||
);
|
||||
});
|
||||
})()}
|
||||
</NativeText>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
hasTurboModuleProxy,
|
||||
resolveReviewHighlighterEngine,
|
||||
resolveReviewHighlighterEnginePreference,
|
||||
} from "./reviewHighlighterEngine";
|
||||
|
||||
describe("resolveReviewHighlighterEnginePreference", () => {
|
||||
it("defaults invalid values to auto", () => {
|
||||
expect(resolveReviewHighlighterEnginePreference(undefined)).toBe("auto");
|
||||
expect(resolveReviewHighlighterEnginePreference("bogus")).toBe("auto");
|
||||
});
|
||||
|
||||
it("accepts supported values", () => {
|
||||
expect(resolveReviewHighlighterEnginePreference("auto")).toBe("auto");
|
||||
expect(resolveReviewHighlighterEnginePreference("javascript")).toBe("javascript");
|
||||
expect(resolveReviewHighlighterEnginePreference("native")).toBe("native");
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolveReviewHighlighterEngine", () => {
|
||||
it("uses javascript when explicitly requested", () => {
|
||||
expect(resolveReviewHighlighterEngine("javascript", true)).toBe("javascript");
|
||||
expect(resolveReviewHighlighterEngine("javascript", false)).toBe("javascript");
|
||||
});
|
||||
|
||||
it("uses native when available for auto or native preference", () => {
|
||||
expect(resolveReviewHighlighterEngine("auto", true)).toBe("native");
|
||||
expect(resolveReviewHighlighterEngine("native", true)).toBe("native");
|
||||
});
|
||||
|
||||
it("falls back to javascript when native is unavailable", () => {
|
||||
expect(resolveReviewHighlighterEngine("auto", false)).toBe("javascript");
|
||||
expect(resolveReviewHighlighterEngine("native", false)).toBe("javascript");
|
||||
});
|
||||
});
|
||||
|
||||
describe("hasTurboModuleProxy", () => {
|
||||
it("returns false outside a native runtime", () => {
|
||||
expect(hasTurboModuleProxy()).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,36 @@
|
||||
export type ReviewHighlighterEnginePreference = "auto" | "javascript" | "native";
|
||||
export type ReviewHighlighterEngine = "javascript" | "native";
|
||||
|
||||
export function resolveReviewHighlighterEnginePreference(
|
||||
value: string | undefined,
|
||||
): ReviewHighlighterEnginePreference {
|
||||
switch (value) {
|
||||
case "javascript":
|
||||
case "native":
|
||||
case "auto":
|
||||
return value;
|
||||
default:
|
||||
return "auto";
|
||||
}
|
||||
}
|
||||
|
||||
export function resolveReviewHighlighterEngine(
|
||||
preference: ReviewHighlighterEnginePreference,
|
||||
nativeAvailable: boolean,
|
||||
): ReviewHighlighterEngine {
|
||||
if (preference === "javascript") {
|
||||
return "javascript";
|
||||
}
|
||||
|
||||
if (nativeAvailable) {
|
||||
return "native";
|
||||
}
|
||||
|
||||
return "javascript";
|
||||
}
|
||||
|
||||
export function hasTurboModuleProxy(): boolean {
|
||||
const turboModuleProxy = (globalThis as { readonly __turboModuleProxy?: unknown })
|
||||
.__turboModuleProxy;
|
||||
return typeof turboModuleProxy === "function";
|
||||
}
|
||||
@@ -11,7 +11,9 @@ import {
|
||||
buildReviewParsedDiff,
|
||||
buildReviewSectionItems,
|
||||
getDefaultReviewSectionId,
|
||||
getReviewFilePreviewState,
|
||||
getReviewSectionIdForCheckpoint,
|
||||
type ReviewRenderableFile,
|
||||
} from "./reviewModel";
|
||||
|
||||
function makeCheckpoint(
|
||||
@@ -27,6 +29,24 @@ function makeCheckpoint(
|
||||
};
|
||||
}
|
||||
|
||||
function makeRenderableFile(
|
||||
input: Partial<ReviewRenderableFile> & Pick<ReviewRenderableFile, "path">,
|
||||
): ReviewRenderableFile {
|
||||
return {
|
||||
id: input.path,
|
||||
cacheKey: input.path,
|
||||
previousPath: null,
|
||||
changeType: "new",
|
||||
additions: 0,
|
||||
deletions: 0,
|
||||
languageHint: null,
|
||||
additionLines: [],
|
||||
deletionLines: [],
|
||||
rows: [],
|
||||
...input,
|
||||
};
|
||||
}
|
||||
|
||||
describe("buildReviewSectionItems", () => {
|
||||
it("keeps one chip per checkpoint and appends git sources", () => {
|
||||
const checkpoints = [
|
||||
@@ -171,4 +191,44 @@ describe("buildReviewParsedDiff", () => {
|
||||
header: "@@ -1,1 +1,2 @@",
|
||||
});
|
||||
});
|
||||
|
||||
it("suppresses preview for non-text file formats", () => {
|
||||
const preview = getReviewFilePreviewState(
|
||||
makeRenderableFile({
|
||||
path: "apps/mobile/assets/icon.png",
|
||||
}),
|
||||
);
|
||||
|
||||
expect(preview).toMatchObject({
|
||||
kind: "suppressed",
|
||||
reason: "non-text",
|
||||
title: "Non-text file",
|
||||
actionLabel: null,
|
||||
});
|
||||
});
|
||||
|
||||
it("suppresses large diffs until explicitly requested", () => {
|
||||
const preview = getReviewFilePreviewState(
|
||||
makeRenderableFile({
|
||||
path: "apps/mobile/src/big.ts",
|
||||
rows: Array.from({ length: 401 }, (_, index) => ({
|
||||
kind: "line" as const,
|
||||
id: `line-${index}`,
|
||||
change: "add" as const,
|
||||
oldLineNumber: null,
|
||||
newLineNumber: index + 1,
|
||||
content: `const line${index} = ${index};`,
|
||||
additionTokenIndex: index,
|
||||
deletionTokenIndex: null,
|
||||
})),
|
||||
}),
|
||||
);
|
||||
|
||||
expect(preview).toMatchObject({
|
||||
kind: "suppressed",
|
||||
reason: "large",
|
||||
title: "Large diff",
|
||||
actionLabel: "Load diff",
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -48,6 +48,18 @@ export interface ReviewRenderableFile {
|
||||
readonly rows: ReadonlyArray<ReviewRenderableRow>;
|
||||
}
|
||||
|
||||
export type ReviewFilePreviewState =
|
||||
| {
|
||||
readonly kind: "render";
|
||||
}
|
||||
| {
|
||||
readonly kind: "suppressed";
|
||||
readonly reason: "non-text" | "large";
|
||||
readonly title: string;
|
||||
readonly message: string;
|
||||
readonly actionLabel: string | null;
|
||||
};
|
||||
|
||||
export type ReviewParsedDiff =
|
||||
| {
|
||||
readonly kind: "empty";
|
||||
@@ -147,6 +159,50 @@ const FNV_OFFSET_BASIS_32 = 0x811c9dc5;
|
||||
const FNV_PRIME_32 = 0x01000193;
|
||||
const SECONDARY_HASH_SEED = 0x9e3779b9;
|
||||
const SECONDARY_HASH_MULTIPLIER = 0x85ebca6b;
|
||||
const LARGE_DIFF_LINE_THRESHOLD = 400;
|
||||
const LARGE_DIFF_CHARACTER_THRESHOLD = 24_000;
|
||||
const NON_TEXT_FILE_EXTENSIONS = new Set([
|
||||
"png",
|
||||
"jpg",
|
||||
"jpeg",
|
||||
"gif",
|
||||
"webp",
|
||||
"bmp",
|
||||
"ico",
|
||||
"icns",
|
||||
"avif",
|
||||
"heic",
|
||||
"tif",
|
||||
"tiff",
|
||||
"mp3",
|
||||
"wav",
|
||||
"flac",
|
||||
"ogg",
|
||||
"m4a",
|
||||
"aac",
|
||||
"mp4",
|
||||
"mov",
|
||||
"avi",
|
||||
"mkv",
|
||||
"webm",
|
||||
"pdf",
|
||||
"zip",
|
||||
"gz",
|
||||
"tgz",
|
||||
"bz2",
|
||||
"7z",
|
||||
"rar",
|
||||
"woff",
|
||||
"woff2",
|
||||
"ttf",
|
||||
"otf",
|
||||
"eot",
|
||||
"wasm",
|
||||
"exe",
|
||||
"dll",
|
||||
"so",
|
||||
"dylib",
|
||||
]);
|
||||
|
||||
function fnv1a32(input: string, seed: number, multiplier: number): number {
|
||||
let hash = seed >>> 0;
|
||||
@@ -168,6 +224,49 @@ function buildPatchCacheKey(patch: string, scope: string): string {
|
||||
return `${scope}:${normalizedPatch.length}:${primary}:${secondary}`;
|
||||
}
|
||||
|
||||
function getFileExtension(path: string): string | null {
|
||||
const match = /\.([a-z0-9]+)$/i.exec(path);
|
||||
return match?.[1]?.toLowerCase() ?? null;
|
||||
}
|
||||
|
||||
function countReviewRenderableLineRows(file: ReviewRenderableFile): number {
|
||||
return file.rows.reduce((total, row) => total + (row.kind === "line" ? 1 : 0), 0);
|
||||
}
|
||||
|
||||
function countReviewRenderableCharacters(file: ReviewRenderableFile): number {
|
||||
return file.rows.reduce(
|
||||
(total, row) => total + (row.kind === "line" ? row.content.length : row.header.length),
|
||||
0,
|
||||
);
|
||||
}
|
||||
|
||||
export function getReviewFilePreviewState(file: ReviewRenderableFile): ReviewFilePreviewState {
|
||||
const extension = getFileExtension(file.path);
|
||||
if (extension && NON_TEXT_FILE_EXTENSIONS.has(extension)) {
|
||||
return {
|
||||
kind: "suppressed",
|
||||
reason: "non-text",
|
||||
title: "Non-text file",
|
||||
message: "Diff preview is not available for this file format.",
|
||||
actionLabel: null,
|
||||
};
|
||||
}
|
||||
|
||||
const lineCount = countReviewRenderableLineRows(file);
|
||||
const characterCount = countReviewRenderableCharacters(file);
|
||||
if (lineCount > LARGE_DIFF_LINE_THRESHOLD || characterCount > LARGE_DIFF_CHARACTER_THRESHOLD) {
|
||||
return {
|
||||
kind: "suppressed",
|
||||
reason: "large",
|
||||
title: "Large diff",
|
||||
message: "Large diffs are not rendered by default.",
|
||||
actionLabel: "Load diff",
|
||||
};
|
||||
}
|
||||
|
||||
return { kind: "render" };
|
||||
}
|
||||
|
||||
function fallbackHunkHeader(hunk: FileDiffMetadata["hunks"][number]): string {
|
||||
return `@@ -${hunk.deletionStart},${hunk.deletionCount} +${hunk.additionStart},${hunk.additionCount} @@`;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,195 @@
|
||||
import { useAtomValue } from "@effect/atom-react";
|
||||
|
||||
import { EnvironmentId, ThreadId, type GitReviewDiffSection } from "@t3tools/contracts";
|
||||
import { Atom } from "effect/unstable/reactivity";
|
||||
|
||||
import { scopedThreadKey } from "../../../lib/scopedEntities";
|
||||
import { appAtomRegistry } from "../../../state/atom-registry";
|
||||
import { buildReviewParsedDiff, type ReviewParsedDiff } from "./reviewModel";
|
||||
|
||||
const EMPTY_GIT_REVIEW_SECTIONS = Object.freeze<ReadonlyArray<GitReviewDiffSection>>([]);
|
||||
const EMPTY_REVIEW_TURN_DIFFS = Object.freeze<Readonly<Record<string, string>>>({});
|
||||
const EMPTY_REVIEW_SECTION_FILE_IDS = Object.freeze<
|
||||
Readonly<Record<string, ReadonlyArray<string> | undefined>>
|
||||
>({});
|
||||
const EMPTY_REVIEW_GIT_SECTIONS_ATOM = Atom.make(EMPTY_GIT_REVIEW_SECTIONS).pipe(
|
||||
Atom.keepAlive,
|
||||
Atom.withLabel("mobile:review:git-sections:null"),
|
||||
);
|
||||
const EMPTY_REVIEW_TURN_DIFFS_ATOM = Atom.make(EMPTY_REVIEW_TURN_DIFFS).pipe(
|
||||
Atom.keepAlive,
|
||||
Atom.withLabel("mobile:review:turn-diffs:null"),
|
||||
);
|
||||
const EMPTY_REVIEW_SELECTED_SECTION_ID_ATOM = Atom.make<string | null>(null).pipe(
|
||||
Atom.keepAlive,
|
||||
Atom.withLabel("mobile:review:selected-section-id:null"),
|
||||
);
|
||||
const EMPTY_REVIEW_SECTION_FILE_IDS_ATOM = Atom.make(EMPTY_REVIEW_SECTION_FILE_IDS).pipe(
|
||||
Atom.keepAlive,
|
||||
Atom.withLabel("mobile:review:section-file-ids:null"),
|
||||
);
|
||||
|
||||
const reviewGitSectionsByThreadKeyAtom = Atom.family((threadKey: string) =>
|
||||
Atom.make(EMPTY_GIT_REVIEW_SECTIONS).pipe(
|
||||
Atom.keepAlive,
|
||||
Atom.withLabel(`mobile:review:git-sections:${threadKey}`),
|
||||
),
|
||||
);
|
||||
|
||||
const reviewTurnDiffByThreadKeyAtom = Atom.family((threadKey: string) =>
|
||||
Atom.make(EMPTY_REVIEW_TURN_DIFFS).pipe(
|
||||
Atom.keepAlive,
|
||||
Atom.withLabel(`mobile:review:turn-diffs:${threadKey}`),
|
||||
),
|
||||
);
|
||||
|
||||
const reviewSelectedSectionIdByThreadKeyAtom = Atom.family((threadKey: string) =>
|
||||
Atom.make<string | null>(null).pipe(
|
||||
Atom.keepAlive,
|
||||
Atom.withLabel(`mobile:review:selected-section-id:${threadKey}`),
|
||||
),
|
||||
);
|
||||
|
||||
const reviewExpandedFileIdsByThreadKeyAtom = Atom.family((threadKey: string) =>
|
||||
Atom.make(EMPTY_REVIEW_SECTION_FILE_IDS).pipe(
|
||||
Atom.keepAlive,
|
||||
Atom.withLabel(`mobile:review:expanded-file-ids:${threadKey}`),
|
||||
),
|
||||
);
|
||||
|
||||
const reviewRevealedLargeFileIdsByThreadKeyAtom = Atom.family((threadKey: string) =>
|
||||
Atom.make(EMPTY_REVIEW_SECTION_FILE_IDS).pipe(
|
||||
Atom.keepAlive,
|
||||
Atom.withLabel(`mobile:review:revealed-large-file-ids:${threadKey}`),
|
||||
),
|
||||
);
|
||||
|
||||
const reviewParsedDiffBySectionCacheKeyAtom = Atom.family((cacheKey: string) =>
|
||||
Atom.make<{ readonly diff: string | null; readonly parsed: ReviewParsedDiff } | null>(null).pipe(
|
||||
Atom.keepAlive,
|
||||
Atom.withLabel(`mobile:review:parsed-diffs:${cacheKey}`),
|
||||
),
|
||||
);
|
||||
|
||||
function buildThreadKey(input: {
|
||||
readonly environmentId?: string;
|
||||
readonly threadId?: string;
|
||||
}): string | null {
|
||||
return input.environmentId && input.threadId
|
||||
? scopedThreadKey(EnvironmentId.make(input.environmentId), ThreadId.make(input.threadId))
|
||||
: null;
|
||||
}
|
||||
|
||||
function buildSectionCacheKey(threadKey: string, sectionId: string): string {
|
||||
return `${threadKey}:${sectionId}`;
|
||||
}
|
||||
|
||||
export function useReviewCacheForThread(input: {
|
||||
readonly environmentId?: string;
|
||||
readonly threadId?: string;
|
||||
}) {
|
||||
const threadKey = buildThreadKey(input);
|
||||
const gitSections = useAtomValue(
|
||||
threadKey ? reviewGitSectionsByThreadKeyAtom(threadKey) : EMPTY_REVIEW_GIT_SECTIONS_ATOM,
|
||||
);
|
||||
const turnDiffById = useAtomValue(
|
||||
threadKey ? reviewTurnDiffByThreadKeyAtom(threadKey) : EMPTY_REVIEW_TURN_DIFFS_ATOM,
|
||||
);
|
||||
const selectedSectionId = useAtomValue(
|
||||
threadKey
|
||||
? reviewSelectedSectionIdByThreadKeyAtom(threadKey)
|
||||
: EMPTY_REVIEW_SELECTED_SECTION_ID_ATOM,
|
||||
);
|
||||
const expandedFileIdsBySection = useAtomValue(
|
||||
threadKey
|
||||
? reviewExpandedFileIdsByThreadKeyAtom(threadKey)
|
||||
: EMPTY_REVIEW_SECTION_FILE_IDS_ATOM,
|
||||
);
|
||||
const revealedLargeFileIdsBySection = useAtomValue(
|
||||
threadKey
|
||||
? reviewRevealedLargeFileIdsByThreadKeyAtom(threadKey)
|
||||
: EMPTY_REVIEW_SECTION_FILE_IDS_ATOM,
|
||||
);
|
||||
|
||||
return {
|
||||
threadKey,
|
||||
gitSections,
|
||||
turnDiffById,
|
||||
selectedSectionId,
|
||||
expandedFileIdsBySection,
|
||||
revealedLargeFileIdsBySection,
|
||||
};
|
||||
}
|
||||
|
||||
export function setReviewGitSections(
|
||||
threadKey: string,
|
||||
sections: ReadonlyArray<GitReviewDiffSection>,
|
||||
): void {
|
||||
appAtomRegistry.set(reviewGitSectionsByThreadKeyAtom(threadKey), sections);
|
||||
}
|
||||
|
||||
export function setReviewTurnDiff(threadKey: string, sectionId: string, diff: string): void {
|
||||
const atom = reviewTurnDiffByThreadKeyAtom(threadKey);
|
||||
const current = appAtomRegistry.get(atom);
|
||||
appAtomRegistry.set(atom, {
|
||||
...current,
|
||||
[sectionId]: diff,
|
||||
});
|
||||
}
|
||||
|
||||
export function setReviewSelectedSectionId(threadKey: string, sectionId: string | null): void {
|
||||
appAtomRegistry.set(reviewSelectedSectionIdByThreadKeyAtom(threadKey), sectionId);
|
||||
}
|
||||
|
||||
export function updateReviewExpandedFileIds(
|
||||
threadKey: string,
|
||||
sectionId: string,
|
||||
update: (current: ReadonlyArray<string> | undefined) => ReadonlyArray<string> | undefined,
|
||||
): void {
|
||||
const atom = reviewExpandedFileIdsByThreadKeyAtom(threadKey);
|
||||
const current = appAtomRegistry.get(atom);
|
||||
const nextValue = update(current[sectionId]);
|
||||
appAtomRegistry.set(atom, {
|
||||
...current,
|
||||
[sectionId]: nextValue,
|
||||
});
|
||||
}
|
||||
|
||||
export function updateReviewRevealedLargeFileIds(
|
||||
threadKey: string,
|
||||
sectionId: string,
|
||||
update: (current: ReadonlyArray<string> | undefined) => ReadonlyArray<string> | undefined,
|
||||
): void {
|
||||
const atom = reviewRevealedLargeFileIdsByThreadKeyAtom(threadKey);
|
||||
const current = appAtomRegistry.get(atom);
|
||||
const nextValue = update(current[sectionId]);
|
||||
appAtomRegistry.set(atom, {
|
||||
...current,
|
||||
[sectionId]: nextValue,
|
||||
});
|
||||
}
|
||||
|
||||
export function getCachedReviewParsedDiff(input: {
|
||||
readonly threadKey: string | null;
|
||||
readonly sectionId: string | null;
|
||||
readonly diff: string | null | undefined;
|
||||
}): ReviewParsedDiff {
|
||||
if (!input.threadKey || !input.sectionId) {
|
||||
return buildReviewParsedDiff(input.diff, input.sectionId ?? "mobile-review");
|
||||
}
|
||||
|
||||
const cacheKey = buildSectionCacheKey(input.threadKey, input.sectionId);
|
||||
const normalizedDiff = input.diff?.trim() ?? null;
|
||||
const atom = reviewParsedDiffBySectionCacheKeyAtom(cacheKey);
|
||||
const cached = appAtomRegistry.get(atom);
|
||||
if (cached && cached.diff === normalizedDiff) {
|
||||
return cached.parsed;
|
||||
}
|
||||
|
||||
const parsed = buildReviewParsedDiff(input.diff, input.sectionId);
|
||||
appAtomRegistry.set(atom, {
|
||||
diff: normalizedDiff,
|
||||
parsed,
|
||||
});
|
||||
return parsed;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import type { ReviewRenderableFile } from "./reviewModel";
|
||||
import { highlightReviewFile } from "./shikiReviewHighlighter";
|
||||
|
||||
function makeRenderableFile(
|
||||
input: Partial<ReviewRenderableFile> & Pick<ReviewRenderableFile, "path">,
|
||||
): ReviewRenderableFile {
|
||||
return {
|
||||
id: input.path,
|
||||
cacheKey: input.path,
|
||||
previousPath: null,
|
||||
changeType: "new",
|
||||
additions: 0,
|
||||
deletions: 0,
|
||||
languageHint: null,
|
||||
additionLines: [],
|
||||
deletionLines: [],
|
||||
rows: [],
|
||||
...input,
|
||||
};
|
||||
}
|
||||
|
||||
describe("highlightReviewFile", () => {
|
||||
it("preserves one highlighted token row per diff line even without trailing newlines", async () => {
|
||||
const file = makeRenderableFile({
|
||||
path: "apps/mobile/src/example.test.ts",
|
||||
additionLines: [
|
||||
'const items = ["a"];',
|
||||
'expect(items).toEqual(["a"]);',
|
||||
"const next = items.map((item) => item.toUpperCase());",
|
||||
'expect(next).toContain("A");',
|
||||
],
|
||||
});
|
||||
|
||||
const highlighted = await highlightReviewFile(file, "light");
|
||||
|
||||
expect(highlighted.additionLines).toHaveLength(file.additionLines.length);
|
||||
expect(highlighted.additionLines[0]?.some((token) => token.content === "const")).toBe(true);
|
||||
expect(highlighted.additionLines[1]?.some((token) => token.content === "expect")).toBe(true);
|
||||
expect(highlighted.additionLines[2]?.some((token) => token.content === "const")).toBe(true);
|
||||
expect(highlighted.additionLines[3]?.some((token) => token.content === "expect")).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -1,6 +1,12 @@
|
||||
import { getFiletypeFromFileName } from "@pierre/diffs/utils";
|
||||
|
||||
import type { ReviewRenderableFile } from "./reviewModel";
|
||||
import {
|
||||
hasTurboModuleProxy,
|
||||
resolveReviewHighlighterEngine,
|
||||
resolveReviewHighlighterEnginePreference,
|
||||
type ReviewHighlighterEngine,
|
||||
} from "./reviewHighlighterEngine";
|
||||
import type { ReviewRenderableFile, ReviewRenderableLineRow } from "./reviewModel";
|
||||
|
||||
export type ReviewDiffTheme = "light" | "dark";
|
||||
|
||||
@@ -19,8 +25,12 @@ const SHIKI_THEME_BY_SCHEME = {
|
||||
light: "github-light-default",
|
||||
dark: "github-dark-default",
|
||||
} as const;
|
||||
const REVIEW_HIGHLIGHTER_ENGINE_PREFERENCE = resolveReviewHighlighterEnginePreference(
|
||||
process.env.EXPO_PUBLIC_REVIEW_HIGHLIGHTER_ENGINE,
|
||||
);
|
||||
|
||||
const highlightCache = new Map<string, Promise<ReviewHighlightedFile>>();
|
||||
const resolvedHighlightCache = new Map<string, ReviewHighlightedFile>();
|
||||
const loadedLanguages = new Set<string>(["text"]);
|
||||
type ShikiHighlighter = {
|
||||
loadLanguage: (...langs: string[]) => Promise<void>;
|
||||
@@ -30,38 +40,83 @@ type ShikiHighlighter = {
|
||||
) => Promise<Array<Array<{ content: string; color?: string; fontStyle?: number }>>>;
|
||||
};
|
||||
let highlighterPromise: Promise<ShikiHighlighter> | null = null;
|
||||
let activeHighlighterEnginePromise: Promise<ReviewHighlighterEngine> | null = null;
|
||||
|
||||
function cleanLastNewline(value: string): string {
|
||||
function stripTrailingNewline(value: string): string {
|
||||
return value.endsWith("\n") ? value.slice(0, -1) : value;
|
||||
}
|
||||
|
||||
function joinPatchLines(lines: ReadonlyArray<string>): string {
|
||||
if (lines.length === 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return cleanLastNewline(lines.join(""));
|
||||
return lines.map(stripTrailingNewline).join("\n");
|
||||
}
|
||||
|
||||
async function getHighlighter() {
|
||||
if (!highlighterPromise) {
|
||||
highlighterPromise = import("shiki").then(
|
||||
async ({ createHighlighter, createJavaScriptRegexEngine }) => {
|
||||
const highlighter = await createHighlighter({
|
||||
themes: [SHIKI_THEME_BY_SCHEME.light, SHIKI_THEME_BY_SCHEME.dark],
|
||||
langs: [],
|
||||
engine: createJavaScriptRegexEngine(),
|
||||
});
|
||||
return highlighter as unknown as ShikiHighlighter;
|
||||
},
|
||||
);
|
||||
const configuredHighlighterPromise = import("shiki").then(async (shikiModule) => {
|
||||
const nativeRuntimeAvailable = hasTurboModuleProxy();
|
||||
let nativeEngineAvailable = false;
|
||||
|
||||
if (nativeRuntimeAvailable && REVIEW_HIGHLIGHTER_ENGINE_PREFERENCE !== "javascript") {
|
||||
try {
|
||||
const nativeEngineModule = await import("react-native-shiki-engine");
|
||||
nativeEngineAvailable = nativeEngineModule.isNativeEngineAvailable();
|
||||
if (nativeEngineAvailable) {
|
||||
const createHighlighter = shikiModule.createBundledHighlighter({
|
||||
langs: shikiModule.bundledLanguages,
|
||||
themes: shikiModule.bundledThemes,
|
||||
engine: () => nativeEngineModule.createNativeEngine(),
|
||||
});
|
||||
const highlighter = await createHighlighter({
|
||||
themes: [SHIKI_THEME_BY_SCHEME.light, SHIKI_THEME_BY_SCHEME.dark],
|
||||
langs: [],
|
||||
});
|
||||
return {
|
||||
highlighter: highlighter as unknown as ShikiHighlighter,
|
||||
engine: "native" as const,
|
||||
};
|
||||
}
|
||||
} catch {
|
||||
nativeEngineAvailable = false;
|
||||
}
|
||||
}
|
||||
|
||||
const engine = resolveReviewHighlighterEngine(
|
||||
REVIEW_HIGHLIGHTER_ENGINE_PREFERENCE,
|
||||
nativeEngineAvailable,
|
||||
);
|
||||
const createHighlighter = shikiModule.createBundledHighlighter({
|
||||
langs: shikiModule.bundledLanguages,
|
||||
themes: shikiModule.bundledThemes,
|
||||
engine: () => shikiModule.createJavaScriptRegexEngine(),
|
||||
});
|
||||
const highlighter = await createHighlighter({
|
||||
themes: [SHIKI_THEME_BY_SCHEME.light, SHIKI_THEME_BY_SCHEME.dark],
|
||||
langs: [],
|
||||
});
|
||||
return {
|
||||
highlighter: highlighter as unknown as ShikiHighlighter,
|
||||
engine,
|
||||
};
|
||||
});
|
||||
|
||||
highlighterPromise = configuredHighlighterPromise.then((result) => result.highlighter);
|
||||
activeHighlighterEnginePromise = configuredHighlighterPromise.then((result) => result.engine);
|
||||
}
|
||||
|
||||
return highlighterPromise as Promise<ShikiHighlighter>;
|
||||
}
|
||||
|
||||
async function resolveLanguage(file: ReviewRenderableFile): Promise<string> {
|
||||
const candidate = file.languageHint ?? getFiletypeFromFileName(file.path);
|
||||
export async function getActiveReviewHighlighterEngine(): Promise<ReviewHighlighterEngine> {
|
||||
await getHighlighter();
|
||||
return (activeHighlighterEnginePromise ??
|
||||
Promise.resolve("javascript")) as Promise<ReviewHighlighterEngine>;
|
||||
}
|
||||
|
||||
async function resolveLanguageFromPath(
|
||||
path: string,
|
||||
languageHint: string | null = null,
|
||||
): Promise<string> {
|
||||
const candidate = languageHint ?? getFiletypeFromFileName(path);
|
||||
if (!candidate || candidate === "text" || candidate === "ansi") {
|
||||
return "text";
|
||||
}
|
||||
@@ -79,6 +134,10 @@ async function resolveLanguage(file: ReviewRenderableFile): Promise<string> {
|
||||
return candidate;
|
||||
}
|
||||
|
||||
async function resolveLanguage(file: ReviewRenderableFile): Promise<string> {
|
||||
return resolveLanguageFromPath(file.path, file.languageHint);
|
||||
}
|
||||
|
||||
function normalizeHighlightedLines(
|
||||
tokenLines: ReadonlyArray<ReadonlyArray<{ content: string; color?: string; fontStyle?: number }>>,
|
||||
): ReadonlyArray<ReadonlyArray<ReviewHighlightedToken>> {
|
||||
@@ -105,12 +164,27 @@ async function highlightLines(
|
||||
return normalizeHighlightedLines(tokenLines);
|
||||
}
|
||||
|
||||
function getHighlightCacheKey(file: ReviewRenderableFile, theme: ReviewDiffTheme): string {
|
||||
return `${SHIKI_THEME_BY_SCHEME[theme]}:${file.cacheKey}`;
|
||||
}
|
||||
|
||||
export function getCachedHighlightedReviewFile(
|
||||
file: ReviewRenderableFile,
|
||||
theme: ReviewDiffTheme,
|
||||
): ReviewHighlightedFile | null {
|
||||
return resolvedHighlightCache.get(getHighlightCacheKey(file, theme)) ?? null;
|
||||
}
|
||||
|
||||
export async function highlightReviewFile(
|
||||
file: ReviewRenderableFile,
|
||||
theme: ReviewDiffTheme,
|
||||
): Promise<ReviewHighlightedFile> {
|
||||
const shikiTheme = SHIKI_THEME_BY_SCHEME[theme];
|
||||
const cacheKey = `${shikiTheme}:${file.cacheKey}`;
|
||||
const cacheKey = getHighlightCacheKey(file, theme);
|
||||
const resolved = resolvedHighlightCache.get(cacheKey);
|
||||
if (resolved) {
|
||||
return resolved;
|
||||
}
|
||||
const cached = highlightCache.get(cacheKey);
|
||||
if (cached) {
|
||||
return cached;
|
||||
@@ -123,9 +197,52 @@ export async function highlightReviewFile(
|
||||
highlightLines(joinPatchLines(file.deletionLines), language, shikiTheme),
|
||||
]);
|
||||
|
||||
return { additionLines, deletionLines };
|
||||
const highlighted = { additionLines, deletionLines };
|
||||
resolvedHighlightCache.set(cacheKey, highlighted);
|
||||
return highlighted;
|
||||
})();
|
||||
|
||||
highlightCache.set(cacheKey, promise);
|
||||
return promise;
|
||||
}
|
||||
|
||||
export async function highlightReviewSelectedLines(input: {
|
||||
readonly filePath: string;
|
||||
readonly lines: ReadonlyArray<ReviewRenderableLineRow>;
|
||||
readonly theme: ReviewDiffTheme;
|
||||
readonly languageHint?: string | null;
|
||||
}): Promise<Record<string, ReadonlyArray<ReviewHighlightedToken>>> {
|
||||
if (input.lines.length === 0) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const language = await resolveLanguageFromPath(input.filePath, input.languageHint ?? null);
|
||||
const shikiTheme = SHIKI_THEME_BY_SCHEME[input.theme];
|
||||
const additionLikeLines = input.lines
|
||||
.filter((line) => line.change !== "delete")
|
||||
.map((line) => `${line.content}\n`);
|
||||
const deletionLines = input.lines
|
||||
.filter((line) => line.change === "delete")
|
||||
.map((line) => `${line.content}\n`);
|
||||
const [additionTokens, deletionTokens] = await Promise.all([
|
||||
highlightLines(joinPatchLines(additionLikeLines), language, shikiTheme),
|
||||
highlightLines(joinPatchLines(deletionLines), language, shikiTheme),
|
||||
]);
|
||||
|
||||
const tokenMap: Record<string, ReadonlyArray<ReviewHighlightedToken>> = {};
|
||||
let additionIndex = 0;
|
||||
let deletionIndex = 0;
|
||||
|
||||
input.lines.forEach((line) => {
|
||||
if (line.change === "delete") {
|
||||
tokenMap[line.id] = deletionTokens[deletionIndex] ?? [];
|
||||
deletionIndex += 1;
|
||||
return;
|
||||
}
|
||||
|
||||
tokenMap[line.id] = additionTokens[additionIndex] ?? [];
|
||||
additionIndex += 1;
|
||||
});
|
||||
|
||||
return tokenMap;
|
||||
}
|
||||
@@ -93,6 +93,7 @@ export function appendReviewCommentToDraft(input: {
|
||||
readonly environmentId: string;
|
||||
readonly threadId: string;
|
||||
readonly text: string;
|
||||
readonly attachments?: ReadonlyArray<DraftComposerImageAttachment>;
|
||||
}): void {
|
||||
const threadKey = scopedThreadKey(
|
||||
EnvironmentId.make(input.environmentId),
|
||||
@@ -105,6 +106,26 @@ export function appendReviewCommentToDraft(input: {
|
||||
...current,
|
||||
[threadKey]: `${existing}${separator}${input.text}`,
|
||||
});
|
||||
if (input.attachments && input.attachments.length > 0) {
|
||||
appendDraftAttachments(threadKey, input.attachments);
|
||||
}
|
||||
}
|
||||
|
||||
export function useThreadDraftForThread(input: {
|
||||
readonly environmentId?: string;
|
||||
readonly threadId?: string;
|
||||
}) {
|
||||
const draftMessageByThreadKey = useAtomValue(draftMessageByThreadKeyAtom);
|
||||
const draftAttachmentsByThreadKey = useAtomValue(draftAttachmentsByThreadKeyAtom);
|
||||
const threadKey =
|
||||
input.environmentId && input.threadId
|
||||
? scopedThreadKey(EnvironmentId.make(input.environmentId), ThreadId.make(input.threadId))
|
||||
: null;
|
||||
|
||||
return {
|
||||
draftMessage: threadKey ? (draftMessageByThreadKey[threadKey] ?? "") : "",
|
||||
draftAttachments: threadKey ? (draftAttachmentsByThreadKey[threadKey] ?? []) : [],
|
||||
};
|
||||
}
|
||||
|
||||
function clearDraft(threadKey: string): void {
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
"react-native-reanimated": "4.2.1",
|
||||
"react-native-safe-area-context": "~5.6.2",
|
||||
"react-native-screens": "~4.23.0",
|
||||
"react-native-shiki-engine": "^0.3.9",
|
||||
"react-native-svg": "15.15.3",
|
||||
"react-native-worklets": "0.7.2",
|
||||
"shiki": "^4.0.2",
|
||||
@@ -1071,7 +1072,7 @@
|
||||
|
||||
"@shikijs/transformers": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/core": "3.23.0", "@shikijs/types": "3.23.0" } }, "sha512-F9msZVxdF+krQNSdQ4V+Ja5QemeAoTQ2jxt7nJCwhDsdF1JWS3KxIQXA3lQbyKwS3J61oHRUSv4jYWv3CkaKTQ=="],
|
||||
|
||||
"@shikijs/types": ["@shikijs/types@4.0.2", "", { "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" } }, "sha512-qzbeRooUTPnLE+sHD/Z8DStmaDgnbbc/pMrU203950aRqjX/6AFHeDYT+j00y2lPdz0ywJKx7o/7qnqTivtlXg=="],
|
||||
"@shikijs/types": ["@shikijs/types@3.23.0", "", { "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" } }, "sha512-3JZ5HXOZfYjsYSk0yPwBrkupyYSLpAE26Qc0HLghhZNGTZg/SKxXIIgoxOpmmeQP0RRSDJTk1/vPfw9tbw+jSQ=="],
|
||||
|
||||
"@shikijs/vscode-textmate": ["@shikijs/[email protected]", "", {}, "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg=="],
|
||||
|
||||
@@ -2453,6 +2454,8 @@
|
||||
|
||||
"react-native-screens": ["[email protected]", "", { "dependencies": { "react-freeze": "^1.0.0", "warn-once": "^0.1.0" }, "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-XhO3aK0UeLpBn4kLecd+J+EDeRRJlI/Ro9Fze06vo1q163VeYtzfU9QS09/VyDFMWR1qxDC1iazCArTPSFFiPw=="],
|
||||
|
||||
"react-native-shiki-engine": ["[email protected]", "", { "dependencies": { "@shikijs/types": "^3.19.0", "@shikijs/vscode-textmate": "^10.0.2" }, "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-FoCzxk6ODGqbYFXRAgnrZ+ZTt5gbCfvwxxobuvGtvjIAK3GtjV6gOImldgI2hB/oelwqw1gksrFjpN3BqE7jKA=="],
|
||||
|
||||
"react-native-svg": ["[email protected]", "", { "dependencies": { "css-select": "^5.1.0", "css-tree": "^1.1.3", "warn-once": "0.1.1" }, "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-/k4KYwPBLGcx2f5d4FjE+vCScK7QOX14cl2lIASJ28u4slHHtIhL0SZKU7u9qmRBHxTCKPoPBtN6haT1NENJNA=="],
|
||||
|
||||
"react-native-worklets": ["[email protected]", "", { "dependencies": { "@babel/plugin-transform-arrow-functions": "7.27.1", "@babel/plugin-transform-class-properties": "7.27.1", "@babel/plugin-transform-classes": "7.28.4", "@babel/plugin-transform-nullish-coalescing-operator": "7.27.1", "@babel/plugin-transform-optional-chaining": "7.27.1", "@babel/plugin-transform-shorthand-properties": "7.27.1", "@babel/plugin-transform-template-literals": "7.27.1", "@babel/plugin-transform-unicode-regex": "7.27.1", "@babel/preset-typescript": "7.27.1", "convert-source-map": "2.0.0", "semver": "7.7.3" }, "peerDependencies": { "@babel/core": "*", "react": "*", "react-native": "*" } }, "sha512-DuLu1kMV/Uyl9pQHp3hehAlThoLw7Yk2FwRTpzASOmI+cd4845FWn3m2bk9MnjUw8FBRIyhwLqYm2AJaXDXsog=="],
|
||||
@@ -3023,9 +3026,19 @@
|
||||
|
||||
"@rollup/pluginutils/estree-walker": ["[email protected]", "", {}, "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="],
|
||||
|
||||
"@shikijs/transformers/@shikijs/core": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/types": "3.23.0", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4", "hast-util-to-html": "^9.0.5" } }, "sha512-NSWQz0riNb67xthdm5br6lAkvpDJRTgB36fxlo37ZzM2yq0PQFFzbd8psqC2XMPgCzo1fW6cVi18+ArJ44wqgA=="],
|
||||
"@shikijs/core/@shikijs/types": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" } }, "sha512-qzbeRooUTPnLE+sHD/Z8DStmaDgnbbc/pMrU203950aRqjX/6AFHeDYT+j00y2lPdz0ywJKx7o/7qnqTivtlXg=="],
|
||||
|
||||
"@shikijs/transformers/@shikijs/types": ["@shikijs/types@3.23.0", "", { "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" } }, "sha512-3JZ5HXOZfYjsYSk0yPwBrkupyYSLpAE26Qc0HLghhZNGTZg/SKxXIIgoxOpmmeQP0RRSDJTk1/vPfw9tbw+jSQ=="],
|
||||
"@shikijs/engine-javascript/@shikijs/types": ["@shikijs/types@4.0.2", "", { "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" } }, "sha512-qzbeRooUTPnLE+sHD/Z8DStmaDgnbbc/pMrU203950aRqjX/6AFHeDYT+j00y2lPdz0ywJKx7o/7qnqTivtlXg=="],
|
||||
|
||||
"@shikijs/engine-oniguruma/@shikijs/types": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" } }, "sha512-qzbeRooUTPnLE+sHD/Z8DStmaDgnbbc/pMrU203950aRqjX/6AFHeDYT+j00y2lPdz0ywJKx7o/7qnqTivtlXg=="],
|
||||
|
||||
"@shikijs/langs/@shikijs/types": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" } }, "sha512-qzbeRooUTPnLE+sHD/Z8DStmaDgnbbc/pMrU203950aRqjX/6AFHeDYT+j00y2lPdz0ywJKx7o/7qnqTivtlXg=="],
|
||||
|
||||
"@shikijs/primitive/@shikijs/types": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" } }, "sha512-qzbeRooUTPnLE+sHD/Z8DStmaDgnbbc/pMrU203950aRqjX/6AFHeDYT+j00y2lPdz0ywJKx7o/7qnqTivtlXg=="],
|
||||
|
||||
"@shikijs/themes/@shikijs/types": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" } }, "sha512-qzbeRooUTPnLE+sHD/Z8DStmaDgnbbc/pMrU203950aRqjX/6AFHeDYT+j00y2lPdz0ywJKx7o/7qnqTivtlXg=="],
|
||||
|
||||
"@shikijs/transformers/@shikijs/core": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/types": "3.23.0", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4", "hast-util-to-html": "^9.0.5" } }, "sha512-NSWQz0riNb67xthdm5br6lAkvpDJRTgB36fxlo37ZzM2yq0PQFFzbd8psqC2XMPgCzo1fW6cVi18+ArJ44wqgA=="],
|
||||
|
||||
"@tailwindcss/node/tailwindcss": ["[email protected]", "", {}, "sha512-/tBrSQ36vCleJkAOsy9kbNTgaxvGbyOamC30PRePTQe/o1MFwEKHQk4Cn7BNGaPtjp+PuUrByJehM1hgxfq4sw=="],
|
||||
|
||||
@@ -3205,6 +3218,8 @@
|
||||
|
||||
"serialize-error/type-fest": ["[email protected]", "", {}, "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg=="],
|
||||
|
||||
"shiki/@shikijs/types": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" } }, "sha512-qzbeRooUTPnLE+sHD/Z8DStmaDgnbbc/pMrU203950aRqjX/6AFHeDYT+j00y2lPdz0ywJKx7o/7qnqTivtlXg=="],
|
||||
|
||||
"simple-plist/bplist-parser": ["[email protected]", "", { "dependencies": { "big-integer": "1.6.x" } }, "sha512-PyJxiNtA5T2PlLIeBot4lbp7rj4OadzjnMZD/G5zuBNt8ei/yCU7+wW0h2bag9vr8c+/WuRWmSxbqAl9hL1rBA=="],
|
||||
|
||||
"source-map-support/source-map": ["[email protected]", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="],
|
||||
@@ -3275,8 +3290,6 @@
|
||||
|
||||
"@pierre/diffs/shiki/@shikijs/themes": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/types": "3.23.0" } }, "sha512-5qySYa1ZgAT18HR/ypENL9cUSGOeI2x+4IvYJu4JgVJdizn6kG4ia5Q1jDEOi7gTbN4RbuYtmHh0W3eccOrjMA=="],
|
||||
|
||||
"@pierre/diffs/shiki/@shikijs/types": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" } }, "sha512-3JZ5HXOZfYjsYSk0yPwBrkupyYSLpAE26Qc0HLghhZNGTZg/SKxXIIgoxOpmmeQP0RRSDJTk1/vPfw9tbw+jSQ=="],
|
||||
|
||||
"@react-native/babel-preset/babel-plugin-syntax-hermes-parser/hermes-parser": ["[email protected]", "", { "dependencies": { "hermes-estree": "0.32.0" } }, "sha512-g4nBOWFpuiTqjR3LZdRxKUkij9iyveWeuks7INEsMX741f3r9xxrOe8TeQfUxtda0eXmiIFiMQzoeSQEno33Hw=="],
|
||||
|
||||
"@react-native/codegen/glob/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="],
|
||||
|
||||
Reference in new issue
Block a user