Skip to content

Support source phase imports - #63915

Open
Oleksandr Tarasiuk (a-tarasyuk) wants to merge 7 commits into
microsoft:mainfrom
a-tarasyuk:feat/61216
Open

Support source phase imports#63915
Oleksandr Tarasiuk (a-tarasyuk) wants to merge 7 commits into
microsoft:mainfrom
a-tarasyuk:feat/61216

Conversation

@a-tarasyuk

@a-tarasyuk Oleksandr Tarasiuk (a-tarasyuk) commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Fixes #61216


This patch adds support for TC39 Source Phase Imports

Copilot AI balanced review requested due to automatic review settings August 20, 2026 13:37
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Aug 20, 2026
@typescript-automation typescript-automation Bot added For Milestone Bug PRs that fix a bug with a specific milestone labels Aug 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds TC39 source-phase import support across parsing, resolution, checking, emit, APIs, and language services.

Changes:

  • Supports static import source and dynamic import.source().
  • Adds phase-aware resolution, WebAssembly typing, diagnostics, and emit behavior.
  • Adds compiler, parser, resolver, API, and fourslash coverage.

Reviewed changes

Copilot reviewed 161 out of 167 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tsc/internal/ast/* Adds source-phase syntax kinds and AST helpers.
tsc/internal/api/encoder/* Encodes and decodes the new phase modifier.
tsc/internal/checker/* Checks syntax and assigns source-module types.
tsc/internal/compiler/* Tracks phase-aware resolutions and Wasm inputs.
tsc/internal/core/compileroptions.go Defines supported module modes.
tsc/internal/diagnostics/* Adds source-import diagnostics.
tsc/internal/fourslash/tests/*sourcePhase* Tests completions, auto-imports, and organization.
tsc/internal/ls/* Integrates source imports with language services.
tsc/internal/module/* Implements phase-aware module resolution and caching.
tsc/internal/parser/* Parses static and dynamic source imports.
tsc/internal/scanner/* Recognizes source as a contextual keyword.
tsc/internal/testutil/tsbaseline/js_emit_baseline.go Includes Wasm files during declaration verification.
tsc/internal/transformers/moduletransforms/commonjsmodule.go Avoids rewriting import.source() as ordinary dynamic import.
tsc/internal/tspath/extension.go Adds the Wasm extension.
tools/scripts/tsc/ast.json Updates AST generation metadata.
packages/typescript/src/* Exposes the new syntax through the TypeScript API.
tsc/testdata/tests/cases/conformance/importSource/* Covers syntax, typing, resolution, emit, and errors.
tsc/testdata/baselines/reference/conformance/importSource* Records expected compiler output.
tsc/testdata/baselines/reference/conformance/importMetaPropertyInvalidInCall.errors.txt Updates import meta-property suggestions.
Files not reviewed (6)
  • tsc/internal/api/encoder/decoder_generated.go: Generated file
  • tsc/internal/api/encoder/encoder_generated.go: Generated file
  • tsc/internal/ast/ast_generated.go: Generated file
  • tsc/internal/ast/kind_generated.go: Generated file
  • tsc/internal/ast/kind_stringer_generated.go: Generated file
  • tsc/internal/diagnostics/diagnostics_generated.go: Generated file

Comment thread tsc/testdata/baselines/reference/conformance/importSource9.js Outdated
@a-tarasyuk
Oleksandr Tarasiuk (a-tarasyuk) force-pushed the feat/61216 branch 3 times, most recently from 90faa2c to c8df015 Compare August 21, 2026 08:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 169 out of 175 changed files in this pull request and generated 1 comment.

Files not reviewed (6)
  • tsc/internal/api/encoder/decoder_generated.go: Generated file
  • tsc/internal/api/encoder/encoder_generated.go: Generated file
  • tsc/internal/ast/ast_generated.go: Generated file
  • tsc/internal/ast/kind_generated.go: Generated file
  • tsc/internal/ast/kind_stringer_generated.go: Generated file
  • tsc/internal/diagnostics/diagnostics_generated.go: Generated file
Suppressed comments (1)

tsc/internal/fourslash/tests/organizeImports_sourcePhase_test.go:44

  • This second use has the same compile error: CodeActionKindSourceSortImports is undefined. Use the TypeScript-specific CodeActionKindSourceSortImportsTs constant so the fourslash test package builds.
		lsproto.CodeActionKindSourceSortImports,

Comment thread tsc/internal/fourslash/tests/organizeImports_sourcePhase_test.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 169 out of 175 changed files in this pull request and generated no new comments.

Files not reviewed (6)
  • tsc/internal/api/encoder/decoder_generated.go: Generated file
  • tsc/internal/api/encoder/encoder_generated.go: Generated file
  • tsc/internal/ast/ast_generated.go: Generated file
  • tsc/internal/ast/kind_generated.go: Generated file
  • tsc/internal/ast/kind_stringer_generated.go: Generated file
  • tsc/internal/diagnostics/diagnostics_generated.go: Generated file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Milestone Bug PRs that fix a bug with a specific milestone

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

Support source phase imports

2 participants