chore(deps): upgrade to Electron 43, Vite 8, Vitest 5 and pin Node 24
Electron 33.4.11 -> 43.8.10, electron-vite 6, Vite 8.3.8, Vitest 5.1.0, Node engines 24.x. Electron 43 made clipboard text read/write asynchronous, so text insertion, selected-text capture and the popup copy channel now await it; includes the async restore regression test. Evidence: docs/evidence/2026-11-17-backlog-operations.md (GAP-SEC-01).
This commit is contained in:
parent
876e72ea2f
commit
e0b1ceaa75
16 changed files with 2755 additions and 3544 deletions
|
|
@ -23,13 +23,14 @@
|
|||
"@supabase/ssr": "^0.10.0",
|
||||
"@supabase/supabase-js": "^2.103.0",
|
||||
"lucide-react": "^1.33.0",
|
||||
"next": "16.3.1",
|
||||
"next": "16.4.6",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.13.0",
|
||||
"@types/node": "^24.0.0",
|
||||
"@types/react": "^19.0.0",
|
||||
"@types/react-dom": "^19.0.0"
|
||||
"@types/react-dom": "^19.0.0",
|
||||
"vitest": "^5.1.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ export default defineConfig({
|
|||
'@': path.resolve(__dirname, './src'),
|
||||
},
|
||||
},
|
||||
esbuild: {
|
||||
jsx: 'automatic',
|
||||
oxc: {
|
||||
jsx: { runtime: 'automatic' },
|
||||
},
|
||||
test: {
|
||||
globals: false,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ productName: D3RO Voice
|
|||
copyright: Copyright © 2026 D3RO
|
||||
# monorepo(npm workspaces)에서 electron이 루트 node_modules로 호이스팅되어
|
||||
# 자동 감지가 실패하는 문제를 피하려고 명시적으로 버전 고정.
|
||||
electronVersion: "33.4.11"
|
||||
electronVersion: "43.8.10"
|
||||
# 설치 크기 절감 — 지원 로케일만 포함한다
|
||||
electronLanguages:
|
||||
- ko
|
||||
|
|
|
|||
|
|
@ -37,16 +37,16 @@
|
|||
"@electron-toolkit/tsconfig": "^1.0.1",
|
||||
"@playwright/test": "^1.62.1",
|
||||
"@types/better-sqlite3": "^7.6.13",
|
||||
"@types/node": "^22.13.0",
|
||||
"@types/node": "^24.0.0",
|
||||
"@types/react": "^19.0.0",
|
||||
"@types/react-dom": "^19.0.0",
|
||||
"@types/ws": "^8.18.1",
|
||||
"@vitejs/plugin-react": "^4.3.0",
|
||||
"electron": "33.4.11",
|
||||
"@vitejs/plugin-react": "^6.3.0",
|
||||
"electron": "43.8.10",
|
||||
"electron-builder": "^26.8.1",
|
||||
"electron-vite": "^2.3.0",
|
||||
"vite": "^5.4.0",
|
||||
"vitest": "^2.1.0"
|
||||
"electron-vite": "^6.0.0",
|
||||
"vite": "^8.3.8",
|
||||
"vitest": "^5.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@d3ro/core": "*",
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ export class ScreenContextService {
|
|||
// 1. 기존 클립보드 저장 + 온전히 되돌릴 수 있는지 판정 (삽입과 같은 정책)
|
||||
// 탐색기에서 복사한 파일·Excel 셀처럼 다 되돌릴 수 없으면 캡처를 건너뛴다 — 부가 문맥 하나 때문에
|
||||
// 사용자가 복사해 둔 것을 지우면 안 된다(예전엔 파일 복사본이 '비어 있음'으로 보여 clear() 됐다).
|
||||
const restore = planClipboardRestore(captureClipboard(port))
|
||||
const restore = planClipboardRestore(await captureClipboard(port))
|
||||
if (restore.kind === 'unrestorable' || (restore.kind === 'write' && restore.dropped.length > 0)) {
|
||||
logger.info('선택 텍스트 캡처 건너뜀: 클립보드를 온전히 되돌릴 수 없다')
|
||||
return null
|
||||
|
|
@ -271,7 +271,7 @@ export class ScreenContextService {
|
|||
await this._sleep(150)
|
||||
|
||||
// 5. 클립보드에서 텍스트 읽기
|
||||
const text = port.readText()
|
||||
const text = await port.readText()
|
||||
|
||||
// 6. 클립보드 복원
|
||||
this._restoreClipboard(restore)
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ export class TextInsertService extends EventEmitter {
|
|||
*/
|
||||
private async _insertViaClipboard(text: string): Promise<InsertMethod> {
|
||||
// 1. 기존 클립보드 저장 + 복원 가능성 판정
|
||||
const snapshot = this.saveClipboard()
|
||||
const snapshot = await this.saveClipboard()
|
||||
const plan = planClipboardRestore(snapshot)
|
||||
if (plan.kind === 'unrestorable') {
|
||||
logger.info(
|
||||
|
|
@ -225,7 +225,7 @@ export class TextInsertService extends EventEmitter {
|
|||
|
||||
try {
|
||||
// 2. 클립보드에 텍스트 설정
|
||||
this._clipboard.writeText(text)
|
||||
await this._clipboard.writeText(text)
|
||||
|
||||
// 짧은 지연: 일부 앱이 클립보드 변경을 받아들일 시간 필요
|
||||
await this._sleep(20)
|
||||
|
|
@ -239,14 +239,14 @@ export class TextInsertService extends EventEmitter {
|
|||
await this._sleep(250)
|
||||
|
||||
// 5. 클립보드 복원 (원래 내용으로 되돌림)
|
||||
if (this._restoreIfStillOurs(text, snapshot)) {
|
||||
if (await this._restoreIfStillOurs(text, snapshot)) {
|
||||
this.emit('clipboard-restored', {})
|
||||
}
|
||||
return 'clipboard'
|
||||
} catch (error) {
|
||||
// 실패 시에도 클립보드 복원 시도
|
||||
try {
|
||||
this._restoreIfStillOurs(text, snapshot)
|
||||
await this._restoreIfStillOurs(text, snapshot)
|
||||
} catch {
|
||||
logger.warn('Failed to restore clipboard after insert error')
|
||||
}
|
||||
|
|
@ -258,8 +258,8 @@ export class TextInsertService extends EventEmitter {
|
|||
* 클립보드가 아직 우리가 넣은 텍스트일 때만 되돌린다. 그 사이 사용자가 새로 복사했다면
|
||||
* 그 내용을 덮어쓰지 않는다 (writeText 자체가 실패한 경우도 여기서 걸러진다).
|
||||
*/
|
||||
private _restoreIfStillOurs(text: string, snapshot: ClipboardSnapshot<ClipboardImage>): boolean {
|
||||
if (this._clipboard.readText() !== text) {
|
||||
private async _restoreIfStillOurs(text: string, snapshot: ClipboardSnapshot<ClipboardImage>): Promise<boolean> {
|
||||
if (await this._clipboard.readText() !== text) {
|
||||
logger.debug('Clipboard changed during insert; skipping restore')
|
||||
return false
|
||||
}
|
||||
|
|
@ -277,7 +277,7 @@ export class TextInsertService extends EventEmitter {
|
|||
/**
|
||||
* 현재 클립보드 상태를 모든 포맷으로 캡처한다.
|
||||
*/
|
||||
saveClipboard(): ClipboardSnapshot<ClipboardImage> {
|
||||
saveClipboard(): Promise<ClipboardSnapshot<ClipboardImage>> {
|
||||
return captureClipboard(this._clipboard)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export interface ClipboardWriteData<TImage extends ClipboardImage> {
|
|||
/** 클립보드 IO 포트. 운영은 Electron clipboard, 테스트는 메모리 구현을 꽂는다. */
|
||||
export interface ClipboardPort<TImage extends ClipboardImage = ClipboardImage> {
|
||||
availableFormats(): string[]
|
||||
readText(): string
|
||||
readText(): string | Promise<string>
|
||||
readHTML(): string
|
||||
readRTF(): string
|
||||
readImage(): TImage
|
||||
|
|
@ -88,9 +88,9 @@ export function isStandardClipboardFormat(format: string): boolean {
|
|||
export const UNKNOWN_FORMATS = '<unknown>'
|
||||
|
||||
/** 현재 클립보드의 모든 포맷을 캡처한다. */
|
||||
export function captureClipboard<TImage extends ClipboardImage>(
|
||||
export async function captureClipboard<TImage extends ClipboardImage>(
|
||||
port: ClipboardPort<TImage>
|
||||
): ClipboardSnapshot<TImage> {
|
||||
): Promise<ClipboardSnapshot<TImage>> {
|
||||
const buffers: ClipboardBufferEntry[] = []
|
||||
const unreadable: string[] = []
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ export function captureClipboard<TImage extends ClipboardImage>(
|
|||
|
||||
return {
|
||||
formats,
|
||||
text: port.readText() || null,
|
||||
text: (await port.readText()) || null,
|
||||
html: port.readHTML() || null,
|
||||
rtf: port.readRTF() || null,
|
||||
image: image && !image.isEmpty() ? image : null,
|
||||
|
|
|
|||
|
|
@ -1072,5 +1072,7 @@ export function reapplyThemeToAllPopups(): void {
|
|||
// ── clipboard:copy IPC (ResultPopup에서 사용) ─────────
|
||||
|
||||
ipcMain.on(IPC_CHANNELS.CLIPBOARD.COPY, (_event, text: string) => {
|
||||
clipboard.writeText(text)
|
||||
void Promise.resolve(clipboard.writeText(text)).catch((error: unknown) => {
|
||||
logger.error('Clipboard copy failed', error)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ import {
|
|||
LEARNING_EXCLUDED_APPS,
|
||||
isAppScopedLearning,
|
||||
TERMINAL_APPS,
|
||||
isAppExcluded,
|
||||
isLearnablePhrase,
|
||||
withoutPlaceholderText,
|
||||
emptyFocusSnapshot
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ function makeKeyboard(clip: MemoryClipboard, pasted: string[], typed: string[]):
|
|||
return {
|
||||
backspace: vi.fn(async () => undefined),
|
||||
paste: vi.fn(async () => {
|
||||
pasted.push(clip.readText())
|
||||
pasted.push(await clip.readText())
|
||||
}),
|
||||
type: vi.fn(async (text: string) => {
|
||||
typed.push(text)
|
||||
|
|
@ -129,6 +129,19 @@ describe('TextInsertService 클립보드 복원 (redteam r1-2)', () => {
|
|||
expect(result.success).toBe(true)
|
||||
})
|
||||
|
||||
it('비동기 클립보드 읽기가 끝난 뒤 원본을 복원한다', async () => {
|
||||
const clip = new MemoryClipboard()
|
||||
clip.text = 'original'
|
||||
vi.spyOn(clip, 'readText').mockImplementation(() => Promise.resolve(clip.text))
|
||||
const { service, pasted } = makeService(clip)
|
||||
|
||||
const result = await service.insertText('dictated', 'clipboard')
|
||||
|
||||
expect(pasted).toEqual(['dictated'])
|
||||
expect(result.method).toBe('clipboard')
|
||||
expect(clip.text).toBe('original')
|
||||
})
|
||||
|
||||
it('Word/브라우저 서식(텍스트+HTML+RTF+이미지)을 모두 되돌린다', async () => {
|
||||
const clip = new MemoryClipboard()
|
||||
const img = new FakeImage(false, 'table-picture')
|
||||
|
|
@ -293,12 +306,12 @@ describe('clipboard-snapshot 정책', () => {
|
|||
expect(isStandardClipboardFormat('FileNameW')).toBe(false)
|
||||
})
|
||||
|
||||
it('표준 내용이 있으면 함께 쓰고, 같이 쓸 수 없는 포맷은 dropped 로 보고한다', () => {
|
||||
it('표준 내용이 있으면 함께 쓰고, 같이 쓸 수 없는 포맷은 dropped 로 보고한다', async () => {
|
||||
const clip = new MemoryClipboard()
|
||||
clip.text = 't'
|
||||
clip.html = 'h'
|
||||
clip.buffers.set('vscode-editor-data', Buffer.from('{}'))
|
||||
const plan = planClipboardRestore(captureClipboard(clip))
|
||||
const plan = planClipboardRestore(await captureClipboard(clip))
|
||||
expect(plan).toEqual({
|
||||
kind: 'write',
|
||||
data: { text: 't', html: 'h' },
|
||||
|
|
@ -306,37 +319,37 @@ describe('clipboard-snapshot 정책', () => {
|
|||
})
|
||||
})
|
||||
|
||||
it('사용자 정의 포맷이 여럿이면 되돌릴 수 없다고 판정한다 (clear 금지)', () => {
|
||||
it('사용자 정의 포맷이 여럿이면 되돌릴 수 없다고 판정한다 (clear 금지)', async () => {
|
||||
const clip = new MemoryClipboard()
|
||||
clip.buffers.set('A', Buffer.from('a'))
|
||||
clip.buffers.set('B', Buffer.from('b'))
|
||||
expect(planClipboardRestore(captureClipboard(clip)).kind).toBe('unrestorable')
|
||||
expect(planClipboardRestore(await captureClipboard(clip)).kind).toBe('unrestorable')
|
||||
})
|
||||
|
||||
it('readBuffer 가 예외를 던지는 포맷은 읽지 못한 포맷으로 분류한다', () => {
|
||||
it('readBuffer 가 예외를 던지는 포맷은 읽지 못한 포맷으로 분류한다', async () => {
|
||||
const clip = new MemoryClipboard()
|
||||
clip.opaque = ['weird']
|
||||
vi.spyOn(clip, 'readBuffer').mockImplementation(() => {
|
||||
throw new Error('nope')
|
||||
})
|
||||
const snap = captureClipboard(clip)
|
||||
const snap = await captureClipboard(clip)
|
||||
expect(snap.unreadable).toEqual(['weird'])
|
||||
expect(planClipboardRestore(snap).kind).toBe('unrestorable')
|
||||
})
|
||||
|
||||
it('availableFormats 가 실패하면 비어 있다고 가정하지 않는다', () => {
|
||||
it('availableFormats 가 실패하면 비어 있다고 가정하지 않는다', async () => {
|
||||
const clip = new MemoryClipboard()
|
||||
vi.spyOn(clip, 'availableFormats').mockImplementation(() => {
|
||||
throw new Error('locked')
|
||||
})
|
||||
const snap = captureClipboard(clip)
|
||||
const snap = await captureClipboard(clip)
|
||||
expect(snap.unreadable).toEqual([UNKNOWN_FORMATS])
|
||||
expect(planClipboardRestore(snap).kind).toBe('unrestorable')
|
||||
})
|
||||
|
||||
it('표준 포맷만 광고되고 내용이 비었으면 clear 로 되돌린다', () => {
|
||||
it('표준 포맷만 광고되고 내용이 비었으면 clear 로 되돌린다', async () => {
|
||||
const clip = new MemoryClipboard()
|
||||
vi.spyOn(clip, 'availableFormats').mockReturnValue(['text/plain'])
|
||||
expect(planClipboardRestore(captureClipboard(clip))).toEqual({ kind: 'clear' })
|
||||
expect(planClipboardRestore(await captureClipboard(clip))).toEqual({ kind: 'clear' })
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@
|
|||
"@supabase/ssr": "^0.10.0",
|
||||
"@supabase/supabase-js": "^2.103.0",
|
||||
"lucide-react": "^1.33.0",
|
||||
"mermaid": "^11.14.0",
|
||||
"next": "16.3.1",
|
||||
"mermaid": "^12.3.0",
|
||||
"next": "16.4.6",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
"react-markdown": "^10.1.0",
|
||||
|
|
@ -37,9 +37,9 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.62.1",
|
||||
"@types/node": "^22.13.0",
|
||||
"@types/node": "^24.0.0",
|
||||
"@types/react": "^19.0.0",
|
||||
"@types/react-dom": "^19.0.0",
|
||||
"vitest": "^2.1.0"
|
||||
"vitest": "^5.1.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ export default defineConfig({
|
|||
'@': path.resolve(__dirname, './src'),
|
||||
},
|
||||
},
|
||||
esbuild: {
|
||||
jsx: 'automatic',
|
||||
oxc: {
|
||||
jsx: { runtime: 'automatic' },
|
||||
},
|
||||
test: {
|
||||
globals: false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue