Skip to content

Read and resolve entrypoints.json in RepriseBundle#15

Merged
Kocal merged 1 commit into
symfony:mainfrom
Kocal:feat/reprise-bundle-read
Jul 11, 2026
Merged

Read and resolve entrypoints.json in RepriseBundle#15
Kocal merged 1 commit into
symfony:mainfrom
Kocal:feat/reprise-bundle-read

Conversation

@Kocal

@Kocal Kocal commented Jul 11, 2026

Copy link
Copy Markdown
Member
Q A
Bug fix? no
New feature? yes
Deprecations? no
Issues -
License MIT

This is the read foundation of RepriseBundle (until now an empty stub): it reads and resolves the entrypoints.json the JS plugin emits. No rendering yet -- Twig tags and preload are separate slices coming later.

Adds:

  • Value objects for the self-describing entrypoints.json (Entrypoints, Entry, DevServer) with validating fromArray() factories. Malformed input is rejected with a clear InvalidEntrypointsException.
  • EntrypointsLookup (behind EntrypointsLookupInterface): resolves an entry's js/css/preload/dynamic URLs, deduplicates a chunk shared by several entries within one request (so a shared file isn't emitted twice on one page), exposes the integrity map and the build mode (isProd / dev server), and supports strict and non-strict lookups.
  • ResetAssetsEventListener, which clears the per-request dedup state when the main request finishes. Needed for long-running workers like FrankenPHP or RoadRunner, where state would otherwise leak across requests.
  • Bundle config (output_path, strict_mode) and service wiring. The interface is autowirable, so user code can inject it directly, for example to render an entry several times or for PDF generation, calling reset() between renders.

Also records ADR 0001 (doc/adr/0001-packages-driven-asset-urls.md): asset URLs will be resolved through Symfony's asset Packages at render time (base_path + base_urls), mirroring Webpack Encore, rather than the JS plugin emitting final URLs. The upcoming tag-renderer slice builds on that decision, and it means the JS plugin's entrypoints.json output format will change (relative hashed paths instead of resolved URLs). The reader added here isn't affected: it just returns whatever references the file holds.

Testing: 32 tests, 100% line/method/class coverage on the new code. PHPStan max and PHP-CS-Fixer clean.

@Kocal Kocal changed the title [EntrypointsLookup] Read and resolve entrypoints.json in RepriseBundle Read and resolve entrypoints.json in RepriseBundle Jul 11, 2026
@Kocal Kocal force-pushed the feat/reprise-bundle-read branch from 1b9a3b9 to 98d73f8 Compare July 11, 2026 10:21

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For a next feature

@Kocal Kocal force-pushed the feat/reprise-bundle-read branch from 98d73f8 to 4216388 Compare July 11, 2026 10:28
First slice of the PHP consumer bundle -- the read foundation:

- Value objects for the self-describing entrypoints.json (Entrypoints, Entry,
  DevServer) with validating fromArray() factories.
- EntrypointsLookup (+ interface): resolves an entry's js/css/preload/dynamic URLs,
  deduplicates a chunk shared by several entries within one request, exposes the
  integrity map and the build mode, and supports strict / non-strict lookups.
- ResetAssetsEventListener clears the per-request dedup state when the main request
  finishes (long-running workers).
- Bundle config (output_path, strict_mode) + service wiring; the interface is
  autowirable so user code can inject it (e.g. rendering several times / PDF).

Also record ADR 0001 (doc/adr/): asset URLs will be resolved through symfony/asset
Packages at render time (base_path + base_urls), which the TagRenderer slice builds on.

Rendering (Twig tags, the render event, dev-server client injection) and WebLink
preload land in the next slices.
@Kocal Kocal force-pushed the feat/reprise-bundle-read branch from 4216388 to e51b165 Compare July 11, 2026 10:49
@Kocal Kocal merged commit e361cc7 into symfony:main Jul 11, 2026
20 checks passed
@Kocal Kocal deleted the feat/reprise-bundle-read branch July 11, 2026 11:00
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