-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[AssetMapper] Javascript sequence parser #58999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This PR introduce a tiny JS parser responsible to split the code into distinct parts: * default (code) * comments * enclosed strings By parsing step by step, only analysing what's necessary in parallel of the preg_replace_callback, it may ease the Compiler choice to keep or not an import statement. This also allow us to use a lighter regexp, avoiding any JIT trouble. It was just a game/test at first, but as it seem to work really well, let's open the discussion :) # Conflicts: # src/Symfony/Component/AssetMapper/Compiler/JavaScriptImportPathCompiler.php
Reopen of symfony#54134 after symfony#58944
Hey! To help keep things organized, we don't allow "Draft" pull requests. Could you please click the "ready for review" button or close this PR and open a new one when you are done? Note that a pull request does not have to be "perfect" or "ready for merge" when you first open it. We just want it to be ready for a first review. Cheers! Carsonbot |
I'm traveling for the Thanksgiving holiday, but I'll try to take a look. Thanks. |
src/Symfony/Component/AssetMapper/Compiler/JavaScriptImportPathCompiler.php
Show resolved
Hide resolved
Carson is not joking with the rules... sorry :( |
Third attempt after symfony#54134 and symfony#58999.. this is the good one. I initially started this PR to learn / try things, but it really behaves well.. and _may_ stop (or help stopping) what seems to be a never-ending suite of special cases. Open to any feedback
Third attempt after symfony#54134 and symfony#58999.. this is the good one. I initially started this PR to learn / try things, but it really behaves well.. and _may_ stop (or help stopping) what seems to be a never-ending suite of special cases. Open to any feedback
…nandre) This PR was squashed before being merged into the 7.3 branch. Discussion ---------- [AssetMapper] Detect import with a sequence parser | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #58928 and #58944 (maybe) | License | MIT Third attempt after #54134 and #58999.. this is the good one 👍 I initially started this PR to learn / try things, but it really behaves well.. and _may_ stop (or help stopping) what seems to be a never-ending suite of special cases. Open to any feedback Commits ------- 720c387 [AssetMapper] Detect import with a sequence parser
Reopen of #54134 after #58944