Skip to content

v.2.1.0 #8

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 12 commits into from
Feb 1, 2024
Merged

v.2.1.0 #8

merged 12 commits into from
Feb 1, 2024

Conversation

soranoo
Copy link
Owner

@soranoo soranoo commented Feb 1, 2024

Summary by CodeRabbit

  • New Features

    • Introduced new configuration options, including removeOriginalCss to control whether original CSS is deleted after obfuscation.
    • Added support for regular expressions in classIgnore, whiteListedFolderPaths, and blackListedFolderPaths.
    • Enhanced selector obfuscation for CSS and JavaScript, including improved handling of React forwardRef components.
    • Added new CLI messaging and deprecation warnings for outdated configuration options.
  • Documentation

    • Extensively updated README with new features, migration guidance, and FAQs.
    • Improved and reformatted upgrade and configuration documentation.
    • Added a new banner, usage notes, and contributor acknowledgments.
  • Bug Fixes

    • Improved handling of CSS selector extraction and obfuscation, including nested selectors and media queries.
  • Refactor

    • Modularized codebase by moving CSS, HTML, and JS handling logic into dedicated handler modules.
    • Updated type definitions and configuration structure for clarity and flexibility.
  • Tests

    • Added comprehensive unit tests for CSS, HTML, and JavaScript handler modules.
    • Updated and streamlined test coverage for new and refactored features.
  • Chores

    • Updated dependencies, scripts, and versioning in project configuration files.
    • Added Prettier configuration and ignore files for consistent code formatting.

Copy link

vercel bot commented Feb 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
next-css-obfuscator ✅ Ready (Inspect) Visit Preview Feb 1, 2024 0:03am

@soranoo soranoo merged commit 858b3f2 into main Feb 1, 2024
Copy link

🎉 This PR is included in version 1.0.0-beta.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

coderabbitai bot commented Apr 25, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update introduces several new modules and test suites, expands configuration and documentation, and refactors major internal logic to improve modularity and clarity. The core CSS and JS obfuscation logic is moved into dedicated handler modules, with new APIs for extracting, mapping, and rewriting selectors and class names. Configuration options are updated to support regular expressions and a new removeOriginalCss flag, while deprecated options are handled with warnings and backward compatibility. Documentation, including the README and migration guides, is extensively revised to reflect new features and configuration changes. Prettier configuration files are added, and the build/test scripts are updated.

Changes

File(s) Change Summary
.prettierignore, .prettierrc Added Prettier configuration and ignore files to define code formatting rules and exclude certain directories and files from formatting.
README.md, docs/upgrade-to-v2.md Extensively updated documentation: added release notes for v2.1.0, revised configuration/migration guides, updated configuration tables and examples, clarified new/removed options, added FAQ entries, improved formatting, and credited contributors.
package.json, demo/next14-app-router/package.json Updated package versions, descriptions, keywords, and scripts; added Prettier as a dev dependency; revised build/test scripts; updated demo dependency versions.
src/types.ts Refactored types: renamed ClassConversion to SelectorConversion; changed several properties to accept strings or RegExps; deprecated and made some properties optional; removed customTailwindDarkModeSelector; added removeOriginalCss property.
src/config.ts Updated default options: changed import path for types, added default regex to contentIgnoreRegexes, removed includeAnyMatchRegexes and excludeAnyMatchRegexes, added removeOriginalCss, removed customTailwindDarkModeSelector.
src/handlers/css.ts, src/handlers/html.ts, src/handlers/js.ts Introduced new handler modules for CSS, HTML, and JS: provide modular APIs for extracting, mapping, and obfuscating selectors and class names in CSS/JS/HTML; handle advanced scenarios like marker classes, regex ignores, and forwardRef components; export new functions for use throughout the codebase.
src/handlers/css.test.ts, src/handlers/html.test.ts, src/handlers/js.test.ts Added comprehensive unit tests for new handler modules, covering CSS selector extraction/obfuscation, HTML tag content extraction by class, and JS forwardRef component parsing and obfuscation.
src/utils.ts Refactored to delegate CSS, HTML, and JS handling to new handler modules; removed internal implementations; updated replaceJsonKeysInFiles and obfuscateKeys signatures; slimmed exported API to utility functions and constants.
src/utils.test.ts Removed tests for utilities now handled by handler modules; retained only tests for core utility functions.
src/index.ts Updated imports and function calls to use new handler APIs and types; added deprecation warnings for old options; merged deprecated regex arrays into new whitelist/blacklist arrays for backward compatibility; passed new removeOriginalCss flag; improved CLI messaging.

Sequence Diagram(s)

sequenceDiagram
    participant CLI
    participant Config
    participant HandlerCSS
    participant HandlerJS
    participant HandlerHTML
    participant Utils

    CLI->>Config: Load options
    Config->>CLI: Return merged options
    CLI->>HandlerCSS: createSelectorConversionJson(options)
    HandlerCSS->>Utils: Extract selectors from CSS files
    HandlerCSS->>HandlerCSS: Generate obfuscated names, save JSON mapping
    CLI->>Utils: replaceJsonKeysInFiles(selectorConversionJson, options)
    Utils->>HandlerCSS: obfuscateCss(selectorConversion, cssPath, removeOriginalCss)
    Utils->>HandlerJS: obfuscateJs(content, key, selectorConversion, ...)
    Utils->>HandlerHTML: findHtmlTagContentsByClass(content, class)
    CLI->>CLI: Log completion and info
Loading

Poem

A bunny hopped through fields of code,
Refactoring modules, lightening the load.
CSS and JS, now handled with care,
Regex and configs floating in the air.
Docs refreshed, tests anew,
Prettier rules to keep things true.
With every hop, the project grew—
Obfuscated, neat, and shiny too!

((\
( -.-)
o_(")(")


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bb90dd0 and 9b51f35.

⛔ Files ignored due to path filters (3)
  • demo/next14-app-router/package-lock.json is excluded by !**/package-lock.json
  • docs/imgs/banner.png is excluded by !**/*.png
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (17)
  • .prettierignore (1 hunks)
  • .prettierrc (1 hunks)
  • README.md (10 hunks)
  • demo/next14-app-router/package.json (2 hunks)
  • docs/upgrade-to-v2.md (1 hunks)
  • package.json (3 hunks)
  • src/config.ts (2 hunks)
  • src/handlers/css.test.ts (1 hunks)
  • src/handlers/css.ts (1 hunks)
  • src/handlers/html.test.ts (1 hunks)
  • src/handlers/html.ts (1 hunks)
  • src/handlers/js.test.ts (1 hunks)
  • src/handlers/js.ts (1 hunks)
  • src/index.ts (4 hunks)
  • src/types.ts (3 hunks)
  • src/utils.test.ts (1 hunks)
  • src/utils.ts (5 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

🎉 This PR is included in version 3.0.0-beta.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant