Skip to content

feat!: add Vite::create() and replace high-arity render-option and manifest-chunk construction with fluent immutable APIs. - #9

Merged
terabytesoftw merged 2 commits into
mainfrom
feat/add-sugar-syntax-fluent-api
Aug 25, 2026
Merged

feat!: add Vite::create() and replace high-arity render-option and manifest-chunk construction with fluent immutable APIs.#9
terabytesoftw merged 2 commits into
mainfrom
feat/add-sugar-syntax-fluent-api

Conversation

@terabytesoftw

Copy link
Copy Markdown
Contributor

Pull Request

  • Breaking change (fix or feature that would cause existing functionality to change)
  • Bugfix (non-breaking change that fixes an issue)
  • CI/build configuration
  • Documentation update
  • New feature (non-breaking change that adds functionality)
  • Refactoring (no functional changes)

@terabytesoftw terabytesoftw added the enhancement New feature or request label Aug 25, 2026
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 95948efb-e8b6-4db2-923f-2fa6afe6f8b1

📥 Commits

Reviewing files that changed from the base of the PR and between 157485b and 80833a6.

📒 Files selected for processing (19)
  • CHANGELOG.md
  • README.md
  • docs/configuration.md
  • docs/examples.md
  • docs/installation.md
  • docs/manifest.md
  • docs/security.md
  • src/Asset/AssetCollection.php
  • src/Html/HtmlRenderOptions.php
  • src/Html/HtmlRenderer.php
  • src/Manifest/ManifestChunk.php
  • src/Manifest/ManifestLoader.php
  • src/Resolver/ManifestAssetResolver.php
  • src/Vite.php
  • tests/ConfigurationTest.php
  • tests/HtmlRendererTest.php
  • tests/ManifestChunkTest.php
  • tests/ManifestLoaderTest.php
  • tests/ViteProductionTest.php
💤 Files with no reviewable changes (1)
  • tests/ViteProductionTest.php

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
🧰 Additional context used
🪛 PHPMD (2.15.0)
src/Vite.php

[error] 24-138: The class Vite has a coupling between objects value of 14. Consider to reduce the number of dependencies under 13. (undefined)

(CouplingBetweenObjects)

tests/ConfigurationTest.php

[warning] 24-195: The class ConfigurationTest has 12 public methods. Consider refactoring ConfigurationTest to keep number of public methods under 10. (undefined)

(TooManyPublicMethods)


[error] 43-47: Avoid using static access to class '\PHPForge\Vite\Vite' in method 'testCreateReturnsConfiguredViteFacade'. (undefined)

(StaticAccess)

src/Manifest/ManifestLoader.php

[warning] 320-379: The method parse() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. (undefined)

(CyclomaticComplexity)

src/Html/HtmlRenderer.php

[error] 57-57: Avoid using static access to class 'PHPForge\Vite\Html\HtmlRenderOptions' in method 'render'. (undefined)

(StaticAccess)

src/Resolver/ManifestAssetResolver.php

[error] 23-222: The class ManifestAssetResolver has a coupling between objects value of 15. Consider to reduce the number of dependencies under 13. (undefined)

(CouplingBetweenObjects)


[warning] 52-131: The method resolve() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. (undefined)

(CyclomaticComplexity)


[warning] 52-131: The method resolve() has an NPath complexity of 210. The configured NPath complexity threshold is 200. (undefined)

(NPathComplexity)

tests/ManifestChunkTest.php

[error] 22-22: Avoid using static access to class '\PHPForge\Vite\Manifest\ManifestChunk' in method 'testConstructorAndFactoryApplyOptionalDefaults'. (undefined)

(StaticAccess)


[warning] 150-253: The method testWithMethodsReturnConfiguredCopyWithoutMutatingOriginal() has 104 lines of code. Current threshold is set to 100. Avoid really long methods. (undefined)

(ExcessiveMethodLength)


[error] 152-152: Avoid using static access to class '\PHPForge\Vite\Manifest\ManifestChunk' in method 'testWithMethodsReturnConfiguredCopyWithoutMutatingOriginal'. (undefined)

(StaticAccess)

src/Html/HtmlRenderOptions.php

[warning] 29-29: Avoid excessively long variable names like $inlineModuleAttributes. Keep variable name length under 20. (undefined)

(LongVariable)


[warning] 34-34: Avoid excessively long variable names like $modulePreloadAttributes. Keep variable name length under 20. (undefined)

(LongVariable)


[warning] 39-39: Avoid excessively long variable names like $moduleScriptAttributes. Keep variable name length under 20. (undefined)

(LongVariable)


[error] 176-176: Avoid using static access to class '\Closure' in method 'withAttributeProvider'. (undefined)

(StaticAccess)

src/Manifest/ManifestChunk.php

[error] 211-211: The method withDynamicEntry has a boolean flag argument $isDynamicEntry, which is a certain sign of a Single Responsibility Principle violation. (undefined)

(BooleanArgumentFlag)


[error] 241-241: The method withEntry has a boolean flag argument $isEntry, which is a certain sign of a Single Responsibility Principle violation. (undefined)

(BooleanArgumentFlag)

tests/HtmlRendererTest.php

[warning] 21-433: The class HtmlRendererTest has 13 public methods. Consider refactoring HtmlRendererTest to keep number of public methods under 10. (undefined)

(TooManyPublicMethods)


[error] 25-25: Avoid using static access to class '\PHPForge\Vite\Html\HtmlRenderOptions' in method 'testFactoryCreatesDefaultOptions'. (undefined)

(StaticAccess)


[warning] 173-294: The method testOptionsModifiersReturnNewConfiguredInstances() has 122 lines of code. Current threshold is set to 100. Avoid really long methods. (undefined)

(ExcessiveMethodLength)


[error] 175-175: Avoid using static access to class '\PHPForge\Vite\Html\HtmlRenderOptions' in method 'testOptionsModifiersReturnNewConfiguredInstances'. (undefined)

(StaticAccess)


[warning] 181-181: Avoid excessively long variable names like $withAttributeProvider. Keep variable name length under 20. (undefined)

(LongVariable)


[warning] 182-182: Avoid excessively long variable names like $withInlineModuleAttributes. Keep variable name length under 20. (undefined)

(LongVariable)


[warning] 183-183: Avoid excessively long variable names like $withModulePreloadAttributes. Keep variable name length under 20. (undefined)

(LongVariable)


[warning] 184-184: Avoid excessively long variable names like $withModuleScriptAttributes. Keep variable name length under 20. (undefined)

(LongVariable)


[warning] 187-187: Avoid excessively long variable names like $withStylesheetAttributes. Keep variable name length under 20. (undefined)

(LongVariable)

tests/ManifestLoaderTest.php

[warning] 36-349: The class ManifestLoaderTest has 11 public methods. Consider refactoring ManifestLoaderTest to keep number of public methods under 10. (undefined)

(TooManyPublicMethods)

🔇 Additional comments (18)
src/Asset/AssetCollection.php (1)

79-79: LGTM!

Also applies to: 169-169

src/Vite.php (1)

94-112: LGTM!

tests/ConfigurationTest.php (1)

10-10: LGTM!

Also applies to: 19-19, 35-65

src/Manifest/ManifestLoader.php (1)

100-100: LGTM!

Also applies to: 348-362

src/Resolver/ManifestAssetResolver.php (1)

71-71: LGTM!

Also applies to: 155-155, 176-176, 199-199

tests/ManifestLoaderTest.php (1)

51-53: LGTM!

Also applies to: 132-132, 158-203

docs/manifest.md (1)

27-30: LGTM!

Also applies to: 47-48

src/Html/HtmlRenderOptions.php (1)

18-54: LGTM!

Also applies to: 95-163, 165-224, 226-278

src/Html/HtmlRenderer.php (1)

57-65: LGTM!

Also applies to: 86-89

tests/HtmlRendererTest.php (1)

16-57: LGTM!

Also applies to: 88-88, 98-304, 319-332, 369-369, 389-389, 401-401, 419-419, 431-431

docs/configuration.md (1)

52-52: LGTM!

Also applies to: 62-64, 103-113

docs/security.md (1)

22-29: LGTM!

Also applies to: 56-56

src/Manifest/ManifestChunk.php (1)

13-120: LGTM!

Also applies to: 133-292

tests/ManifestChunkTest.php (1)

12-16: LGTM!

Also applies to: 17-62, 72-148, 150-253

CHANGELOG.md (1)

8-11: LGTM!

README.md (1)

40-40: LGTM!

Also applies to: 67-67, 84-84, 115-115

docs/examples.md (1)

45-45: LGTM!

Also applies to: 125-125, 170-170

docs/installation.md (1)

17-17: LGTM!


📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added Vite::create() for simpler configuration and setup.
    • Added fluent, immutable configuration for HTML rendering options.
    • Added fluent construction and accessors for manifest chunks.
    • Improved type consistency for asset collection methods.
  • Documentation

    • Updated installation instructions and examples for version 0.2.
    • Documented factory-based setup, rendering options, manifest chunks, and security configuration.
    • Updated the project status and badge information.

Walkthrough

The release updates version references to 0.2, adds Vite::create(), replaces high-arity constructors with fluent immutable APIs for render options and manifest chunks, updates consumers and tests, and revises documentation.

Changes

Rendering and facade APIs

Layer / File(s) Summary
Rendering options and Vite facade
src/Html/HtmlRenderOptions.php, src/Html/HtmlRenderer.php, src/Vite.php, src/Asset/AssetCollection.php, tests/HtmlRendererTest.php, tests/ConfigurationTest.php, docs/configuration.md, docs/security.md
HtmlRenderOptions now provides factory, getter, and clone-based modifier methods. HtmlRenderer uses the accessors. Vite::create() forwards construction arguments. AssetCollection uses covariant self return types.
Manifest chunk pipeline
src/Manifest/ManifestChunk.php, src/Manifest/ManifestLoader.php, src/Resolver/ManifestAssetResolver.php, tests/ManifestChunkTest.php, tests/ManifestLoaderTest.php, docs/manifest.md
ManifestChunk now uses a reduced constructor, optional defaults, getters, and immutable modifiers. Manifest loading, resolution, tests, and documentation use the accessor API.
Release and usage documentation
CHANGELOG.md, README.md, docs/examples.md, docs/installation.md, tests/ViteProductionTest.php
Version references change to 0.2, examples use Vite::create(), installation documentation requires ^0.2, and the README badge changes to StyleCI.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to 80833

The change is merge-ready after normal checks and review; no actionable merge-blocking risk remains.

Poem

A rabbit hops through fluent code,
With copied options neatly showed.
Chunks sprout getters, clean and bright,
Vite creates the path just right.
Tests and docs now match the flight.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 70.15% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 67 functions across 11 files. (7 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main breaking changes: adding Vite::create() and replacing high-arity construction with fluent immutable APIs.
Description check ✅ Passed The description identifies the pull request as a breaking change, which matches the stated objectives and changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 70.15% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 67 functions across 11 files. (7 skipped: 7 unsupported.)

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/add-sugar-syntax-fluent-api

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

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (4853e9a) to head (80833a6).
⚠️ Report is 5 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##                main        #9   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity       208       239   +31     
===========================================
  Files             19        19           
  Lines            516       606   +90     
===========================================
+ Hits             516       606   +90     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@terabytesoftw
terabytesoftw merged commit bbc3c0a into main Aug 25, 2026
43 checks passed
@terabytesoftw
terabytesoftw deleted the feat/add-sugar-syntax-fluent-api branch August 25, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant