Skip to content

[4.x] Deprecate PreloadManager::prerender() and add modulepreload() - #17

Open
Hackwar wants to merge 1 commit into
joomla-framework:4.x-devfrom
Hackwar:4.x-deprecate-prerender
Open

Hackwar wants to merge 1 commit into
joomla-framework:4.x-devfrom
Hackwar:4.x-deprecate-prerender

Conversation

@Hackwar

@Hackwar Hackwar commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary of Changes

Browsers no longer prerender pages for rel=prerender: Chromium only prefetches the resource ("NoState Prefetch") and moved prerendering to the Speculation Rules API, while Firefox and Safari never supported it. At the same time the package has no helper for modulepreload, the relation for ES modules.

This PR:

  • deprecates PreloadManager::prerender() for removal in 5.0 (@deprecated plus trigger_deprecation()); link($uri, 'prerender') keeps working for anyone who still wants the header entry;
  • adds PreloadManager::modulepreload();
  • adds symfony/deprecation-contracts (^2|^3, as in joomla/event) to require for trigger_deprecation().

Testing Instructions

php vendor/bin/phpunit. testModulepreload covers the new helper; testPrerender now also expects the deprecation message (#[IgnoreDeprecations] + expectUserDeprecationMessage()). Both fail without the change in src/.

Documentation Changes Required

docs/classes/PreloadManager.md: new "Preload a JavaScript module" section, deprecation note in "Prerender a resource". The removal itself is documented in docs/v4-to-v5-update.md by the 5.x PR that removes the method.

The owner's docs PR #12 says in docs/overview.md ("Things to know before you build on this" → modulepreload is missing.) that there is no helper and recommends link($uri, 'modulepreload'), and lists prerender among the helpers; that paragraph needs adjusting when the second of the two PRs is merged.

Related to #14 (both add use PHPUnit\Framework\Attributes\TestDox; at the same place in tests/PreloadManagerTest.php; expect a small conflict there when the second one is merged).

🤖 Generated with Claude Code

Browsers no longer prerender pages for rel=prerender: Chromium only
prefetches the resource and moved prerendering to the Speculation Rules
API, Firefox and Safari never supported it. The helper is deprecated for
removal in 5.0. modulepreload, the relation for ES modules, had no
helper and gets one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant