Skip to content

feat: support regexp and function of output.clean #10207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 28, 2025
Merged

Conversation

LingyuCoder
Copy link
Contributor

Summary

close #7822

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@LingyuCoder LingyuCoder requested review from SyMind and Copilot April 27, 2025 08:37
@github-actions github-actions bot added release: feature release: feature related release(mr only) team The issue/pr is created by the member of Rspack. labels Apr 27, 2025
Copy link

netlify bot commented Apr 27, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 617ada0
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/680e1336388dc1000865b5ac

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for regular expressions and function callbacks in the clean options, addressing issue 7822. Key changes include removing legacy test files, updating type definitions and Zod schemas for clean options, and refactoring file system trimming logic to use a new KeepPattern abstraction.

Reviewed Changes

Copilot reviewed 11 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/webpack-test/configCases/clean/ignore-rx/test.filter.js Removed legacy test file for regex-based clean ignore
tests/webpack-test/configCases/clean/ignore-fn/test.filter.js Removed legacy test file for function-based clean ignore
packages/rspack/src/config/zod.ts Updated the Zod schema to accept RegExp, string, or function for the clean.keep option
packages/rspack/src/config/types.ts Extended the Clean type to support RegExp and function values
packages/rspack/etc/core.api.md Updated API documentation for the Clean type
crates/rspack_core/src/utils/fs_trim.rs Refactored file system trimming to use a new KeepPattern enum for matching kept files/folders
crates/rspack_core/src/options/clean_options.rs Extended CleanOptions to include KeepRegex and KeepFunc variants and made keep() async
crates/rspack_core/src/compiler/mod.rs Updated clean file removal logic to handle new clean options asynchronously
crates/node_binding/src/raw_options/raw_output.rs Adjusted raw options conversion to leverage the updated CleanOptions
crates/node_binding/src/clean_options.rs Updated the N-API clean options to support string, RegExp, and function inputs
Files not reviewed (2)
  • website/docs/en/config/output.mdx: Language not supported
  • website/docs/zh/config/output.mdx: Language not supported

Copy link

codspeed-hq bot commented Apr 27, 2025

CodSpeed Performance Report

Merging #10207 will not alter performance

Comparing feat/improve-clean (617ada0) with main (d71a6ab)

🎉 Hooray! codspeed-node just leveled up to 4.0.1!

A heads-up, this is a breaking change and it might affect your current performance baseline a bit. But here's the exciting part - it's packed with new, cool features and promises improved result stability 🥳!
Curious about what's new? Visit our releases page to delve into all the awesome details about this new version.

Summary

✅ 11 untouched benchmarks

@LingyuCoder LingyuCoder merged commit 9529e0a into main Apr 28, 2025
34 checks passed
@LingyuCoder LingyuCoder deleted the feat/improve-clean branch April 28, 2025 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release: feature release: feature related release(mr only) team The issue/pr is created by the member of Rspack.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Webpack's output.clean supports the useful option to optionally keep some files around
2 participants