-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
handle multi-line comments in AssetMapper javascript compiler #58944
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,6 +93,16 @@ public function testCompileFindsCorrectImports(string $input, array $expectedJav | |
|
||
public static function provideCompileTests(): iterable | ||
{ | ||
yield 'import_in_multiline_comment' => [ | ||
'input' => <<<EOF | ||
/** | ||
* <LazyMotion features={() => import('./path/to/domAnimations')} /> | ||
* ``` | ||
*/ | ||
EOF, | ||
'expectedJavaScriptImports' => [], | ||
]; | ||
|
||
Comment on lines
+96
to
+105
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test is already passing on 6.4 and 7.1 (on my machine).. Could you double-check ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then perhaps the test is wrong. The underlying problem is with an API Platform js file, causing this trivial example to fail. symfony new MyApp --webapp && cd MyApp
composer req api
bin/console make:entity -a Task -n
symfony server:start -d
symfony open:local --path=/api There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm just trying to get a "before" / "after" here ;) Without it i cannot be sure if what i'm doing has any effect :) |
||
yield 'standard_symfony_app_js' => [ | ||
'input' => <<<EOF | ||
import './bootstrap.js'; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is broken for multiple reasons:
*
if you split a long expression at the position of a multiplication operator, which is totally valid*
. JSDoc comments follow such convention, but as far as the JS parser is concerned, the*
is just part of the comment text.Anyway, by definition of a multiline comment, you cannot identify that you are inside such a comment by inspecting only the currently line.