[Stimulus] Detect preserved /*! ... */ lazy comments and lock deterministic ordering - #10
Merged
Kocal merged 1 commit intoJul 10, 2026
Conversation
/*! ... */ lazy comments and lock deterministic ordering
…ministic ordering
Kocal
force-pushed
the
stimulus-preserved-lazy-comment-and-deterministic-order
branch
from
July 10, 2026 16:43
9b74e6a to
16caeb7
Compare
Kocal
deleted the
stimulus-preserved-lazy-comment-and-deterministic-order
branch
July 10, 2026 16:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reprise's Stimulus virtual module (
assets/src/core/stimulus.ts) reimplements StimulusBundle'sControllersMapGeneratorfor bundlers, since the webpack loader Encore relied on doesn't exist outside webpack. StimulusBundle just merged two small fixes to that PHP generator, so this PR ports both to the TS side. Two commits, one per upstream PR.1. Detect the preserved
/*! stimulusFetch: 'lazy' */comment form (port of symfony/ux#3702)A controller opts into lazy loading by adding a
stimulusFetch: 'lazy'comment above its class. The problem: tsc and esbuild strip regular block comments during minification, but keep "preserved" ones written as/*! ... */. Reprise's lazy-detection regex only matched the plain/* ... */form, so the marker was lost as soon as the controller went through a minifying build. This adds the optional!to the block-comment branch so both forms are detected. New fixture controller + test included.2. Sort local controllers for a deterministic loader output (port of symfony/ux#3703)
Upstream, controllers were iterated in filesystem order, so the generated loader (and its content hash) could shift between builds even with no actual change, breaking cache busting. Reprise already sorts its local controllers (
listLocalControllersends with.sort()), so there's no behavior change here. This commit just adds a regression test that pins the exact emission order, plus a comment explaining why the sort matters.All tests pass (
assets/test), andoxlint/oxfmtare clean. Added a short docs note indoc/index.rstfor the preserved-comment form.