Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[Feature] Metro cache cleanup uses blocking and unsafe recursive deletion

Đang mở Phù hợp với người mới
#3,006 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
node.js, typescript, vscode
Lĩnh vực
devtools, tooling

Hướng nghiên cứu

Tìm lệnh “Clean & Restart Packager” và phương thức tùy chỉnh deleteDirectory() trong mã nguồn của extension. Trước tiên, hãy đọc luồng dọn dẹp và cách xử lý lỗi; xác minh việc dọn dẹp hoàn tất trước khi packager khởi động lại và trường hợp đường dẫn cache không tồn tại được xử lý. Issue không nêu tên tệp hay bài kiểm thử, vì vậy hãy tìm lệnh liên quan và các bài kiểm thử trong repository.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement

Problem

The “Clean & Restart Packager” command currently deletes the Metro cache using a custom recursive deleteDirectory() method.

This implementation has several issues:

  • It uses synchronous filesystem APIs inside an asynchronous workflow, potentially blocking the extension host when the cache contains many files.
  • statSync() follows symbolic links, so recursive traversal may delete files in directories outside the Metro cache.
  • Separate existence checks and deletion operations introduce time-of-check/time-of-use (TOCTOU) races.
  • It duplicates functionality already provided by Node.js.

Proposed solution

Replace the existence check and custom recursive deletion with:

await fs.promises.rm(metroCachePath, {
recursive: true,
force: true,
});

Remove the unused deleteDirectory() method and preserve the existing error handling.

Expected behavior

  • Metro cache cleanup does not use synchronous filesystem APIs.
  • Symbolic links inside the cache are removed without deleting their target contents.
  • A missing cache directory does not cause cleanup to fail.
  • The packager restarts after cleanup completes.
Ngôn ngữ chính
TypeScript
Star
2.7k
Fork
298
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
26

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/vscode-react-native

Tất cả issue của microsoft/vscode-react-native

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.