Skip to content

Conversation

@widoz
Copy link
Member

@widoz widoz commented Nov 1, 2025

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

Allow to have a predefined configuration for each asset created and registered through the WebPack Manifest Loader

What is the current behavior? (You can also link to an open issue here)

When we want to use the WebPack Manifest Loader, we luckly have to refine the asset configuration in some manner, e.g. to set multiple locations, to set a version, to disable the enqueue and so on...

What is the new behavior (if this is a feature change)?

We can take advantage of the Manifest Plugin generate callback, a callback giving us the possibility to customize the output generated by the WebPack plugin. Thanks to that, we can generate a manifest where the handle value isn't just a file path, but an object holding the configuration later on we'll serve to the AssetFactory.

This permit us to avoid to manipulate the asset before the registration happen, delegating to the WebpackManifestLoader this task.

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

No, the implementation is still supporting the previous manifest structure, but add support for the new object configuration.

Other information

  • Refactored WebpackManifestLoader and AbstractWebpackLoader to handle array-based manifest entries with custom configuration.
  • Updated AssetFactory to support type-safe configurations combining AssetConfig and AssetExtensionConfig.
  • Introduced new test cases for custom manifest configurations.
  • Enhanced documentation to detail alternative manifest formats and examples.

- Refactored `WebpackManifestLoader` and `AbstractWebpackLoader` to handle array-based manifest entries with custom configuration.
- Updated `AssetFactory` to support type-safe configurations combining `AssetConfig` and `AssetExtensionConfig`.
- Introduced new test cases for custom manifest configurations.
- Enhanced documentation to detail alternative manifest formats and examples.
@widoz widoz requested a review from Chrico November 1, 2025 17:25
…ackManifestLoader` for improved asset handling

- Renamed `sanitizeHandle` to `normalizeHandle` for clarity.
- Adjusted `handleAsArray` to streamline configuration processing and include exception handling.
- Updated `AssetFactory` usage to a static call for better readability.
@codecov
Copy link

codecov bot commented Nov 11, 2025

Codecov Report

❌ Patch coverage is 94.73684% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.22%. Comparing base (a8a8ba8) to head (1226fda).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/Loader/WebpackManifestLoader.php 93.10% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master      #66      +/-   ##
============================================
+ Coverage     86.79%   87.22%   +0.43%     
- Complexity      315      334      +19     
============================================
  Files            27       27              
  Lines           901      955      +54     
============================================
+ Hits            782      833      +51     
- Misses          119      122       +3     
Flag Coverage Δ
unittests 87.22% <94.73%> (+0.43%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@widoz
Copy link
Member Author

widoz commented Nov 11, 2025

Hi @Chrico
I've made the changes, thank you for the review.

…consistency with static-based asset resolution
…for consistency with instance-based asset resolution

- Updated `AbstractWebpackLoader` and `WebpackManifestLoader` to use the instance method `resolveClassByExtension`.
@widoz widoz merged commit c842144 into master Nov 11, 2025
12 checks passed
@widoz widoz deleted the feature/allow-assets-configuration-from-manifest branch November 11, 2025 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants