Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Handle synthetic tslib and JSX factory imports#780

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jakebailey merged 4 commits intomainfromjabaile/jsx-loading-fixes
Apr 9, 2025

Conversation

jakebailey
Copy link
Member

@jakebaileyjakebailey commentedApr 9, 2025
edited
Loading

Fixes#765
Fixes#767

This implements import helper and JSX factory import node synthesis and resolution. Since the AST node is immutable, we cannot modifySourceFile.Imports. This info is now stored on theProgram rather than at special fixed offsets inimports that's mutated after parse.

This could allow us to reuse ASTs more often, and means we stop having to work around these synthesized imports in other parts of the code (LS features, mainly).

This PR isn't perfect; it turns out we're missing implementations ofmoduleDetection andexternalModuleIndicator, so we're not correctly determining that JSX files are modules because thejsx setting plays a part in determining if a file is a module (yay).

Fixing that will have to be a follow-up PR but that's going to be a lot more invasive. This PR fixes most stuff as it is now.

@@ -0,0 +1,44 @@
--- old.commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=auto).errors.txt
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This is broken because we do not correctly set the module indicators.

@jakebaileyjakebailey changed the titleHandle import helpers and JSX factory importsHandle synthetic tslib and JSX factory importsApr 9, 2025
@jakebaileyjakebaileyforce-pushed thejabaile/jsx-loading-fixes branch from863c22d toecc1236CompareApril 9, 2025 19:27
@jakebaileyjakebailey marked this pull request as ready for reviewApril 9, 2025 19:51
Comment on lines 7 to +8
->notAHelper : Symbol(notAHelper, Decl(tslib.d.ts, --, --))
-
+>notAHelper : Symbol(notAHelper, Decl(tslib.d.ts, 0, 12))
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Funny, Strada's regex here is bad, while in Corsa we "fixed" this.

@jakebailey
Copy link
MemberAuthor

Future TODO: stop using synthetic nodes for this, because we only use them to then plug into module resolution anyway. There's no real reason to use a Node here other than "the code used to work this way and it's not very trivial to change", but changing it will be faster and make the loader lock-free again.

@jakebaileyjakebailey added this pull request to themerge queueApr 9, 2025
Merged via the queue intomain with commita88fef7Apr 9, 2025
23 checks passed
@jakebaileyjakebailey deleted the jabaile/jsx-loading-fixes branchApril 9, 2025 23:36
shinichy pushed a commit to shinichy/typescript-go that referenced this pull requestApr 12, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@andrewbranchandrewbranchandrewbranch approved these changes

@ahejlsbergahejlsbergAwaiting requested review from ahejlsberg

@EricCornelsonEricCornelsonAwaiting requested review from EricCornelson

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

[bug] failing to resolvereact/jsx-runtime when type checking TSX files [bug] JSX support inpreserve mode w/ customjsxImportSource causingTS2875
2 participants
@jakebailey@andrewbranch

[8]ページ先頭

©2009-2025 Movatter.jp