-
-
Notifications
You must be signed in to change notification settings - Fork 717
feat(parser): support import source #7019
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
Parser conformance results onjs/262
jsx/babel
symbols/microsoft
ts/babel
ts/microsoft
|
🦋 Changeset detectedLatest commit: 3851438 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
CodSpeed Performance ReportMerging #7019 will not alter performanceComparing Summary
Footnotes |
crates/biome_js_parser/tests/js_test_suite/error/import_source_err.js.snap
Outdated
Show resolved
Hide resolved
now the pr is ready~ |
Co-authored-by: Carson McManus <dyc3@users.noreply.github.com>
Caution Review failedThe pull request is closed. WalkthroughThis change set introduces support for the ECMAScript Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Parser
participant Lexer
participant Formatter
User->>Parser: Provide JS code with `import source x from "mod"`
Parser->>Lexer: Tokenize input (recognizes `source` as keyword)
Parser->>Parser: Parse import statement (handles `source` phase)
Parser->>Formatter: Pass parsed AST with optional phase token
Formatter->>User: Output formatted import statement
Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (27)
📒 Files selected for processing (11)
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Summary
closes: #4934
Support Import phase: https://github.com/tc39/proposal-source-phase-imports
The syntax looks like just as follows:
Now TypeScript has not supported this syntax(Related issue: microsoft/TypeScript#61216), but babel and swc has supported.
I have not supported dynamic call like
import.source("xx")
, but i will support in next pr.Test Plan
I add test case for
biome_js_parser
andbiome_js_formatter
, and my test case just refer from babel: https://github.com/babel/babel/tree/main/packages/babel-parser/test/fixtures/experimental/source-phase-importsDocs
Summary by CodeRabbit
New Features
import source
syntax in JavaScript, enabling the use of the stage 3 ECMAScript proposal for importing modules as source.source
keyword in import statements.Bug Fixes
import source
syntax cases.Tests
import source
import statements, increasing test coverage for this syntax.