mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-15 08:31:14 -07:00
Remove LRUCache class migrating to mnemoist (#16872)
This commit is contained in:
@@ -10,6 +10,7 @@ import os from 'node:os';
|
||||
import pathMod from 'node:path';
|
||||
import * as path from 'node:path';
|
||||
import { useState, useCallback, useEffect, useMemo, useReducer } from 'react';
|
||||
import { LRUCache } from 'mnemonist';
|
||||
import {
|
||||
coreEvents,
|
||||
CoreEvent,
|
||||
@@ -18,7 +19,6 @@ import {
|
||||
type EditorType,
|
||||
getEditorCommand,
|
||||
isGuiEditor,
|
||||
LruCache,
|
||||
} from '@google/gemini-cli-core';
|
||||
import {
|
||||
toCodePoints,
|
||||
@@ -728,7 +728,7 @@ export function getTransformedImagePath(filePath: string): string {
|
||||
return `[Image ${truncatedBase}${extension}]`;
|
||||
}
|
||||
|
||||
const transformationsCache = new LruCache<string, Transformation[]>(
|
||||
const transformationsCache = new LRUCache<string, Transformation[]>(
|
||||
LRU_BUFFER_PERF_CACHE_LIMIT,
|
||||
);
|
||||
|
||||
@@ -881,7 +881,7 @@ interface LineLayoutResult {
|
||||
visualToTransformedMap: number[];
|
||||
}
|
||||
|
||||
const lineLayoutCache = new LruCache<string, LineLayoutResult>(
|
||||
const lineLayoutCache = new LRUCache<string, LineLayoutResult>(
|
||||
LRU_BUFFER_PERF_CACHE_LIMIT,
|
||||
);
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { LruCache } from '@google/gemini-cli-core';
|
||||
import { LRUCache } from 'mnemonist';
|
||||
import type { Transformation } from '../components/shared/text-buffer.js';
|
||||
import { cpLen, cpSlice } from './textUtils.js';
|
||||
import { LRU_BUFFER_PERF_CACHE_LIMIT } from '../constants.js';
|
||||
@@ -20,7 +20,7 @@ export type HighlightToken = {
|
||||
// semicolon, common punctuation, and brackets.
|
||||
const HIGHLIGHT_REGEX = /(^\/[a-zA-Z0-9_-]+|@(?:\\ |[^,\s;!?()[\]{}])+)/g;
|
||||
|
||||
const highlightCache = new LruCache<string, readonly HighlightToken[]>(
|
||||
const highlightCache = new LRUCache<string, readonly HighlightToken[]>(
|
||||
LRU_BUFFER_PERF_CACHE_LIMIT,
|
||||
);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import stripAnsi from 'strip-ansi';
|
||||
import ansiRegex from 'ansi-regex';
|
||||
import { stripVTControlCharacters } from 'node:util';
|
||||
import stringWidth from 'string-width';
|
||||
import { LruCache } from '@google/gemini-cli-core';
|
||||
import { LRUCache } from 'mnemonist';
|
||||
import { LRU_BUFFER_PERF_CACHE_LIMIT } from '../constants.js';
|
||||
|
||||
/**
|
||||
@@ -32,7 +32,7 @@ export const getAsciiArtWidth = (asciiArt: string): number => {
|
||||
|
||||
// Cache for code points
|
||||
const MAX_STRING_LENGTH_TO_CACHE = 1000;
|
||||
const codePointsCache = new LruCache<string, string[]>(
|
||||
const codePointsCache = new LRUCache<string, string[]>(
|
||||
LRU_BUFFER_PERF_CACHE_LIMIT,
|
||||
);
|
||||
|
||||
@@ -123,7 +123,7 @@ export function stripUnsafeCharacters(str: string): string {
|
||||
.join('');
|
||||
}
|
||||
|
||||
const stringWidthCache = new LruCache<string, number>(
|
||||
const stringWidthCache = new LRUCache<string, number>(
|
||||
LRU_BUFFER_PERF_CACHE_LIMIT,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user