ttsc 0.34.0 → 0.34.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ttsc",
3
- "version": "0.34.0",
3
+ "version": "0.34.1",
4
4
  "description": "General-purpose TypeScript-Go compiler, runtime, plugin host, and LSP host.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -64,13 +64,13 @@
64
64
  },
65
65
  "optionalDependencies": {
66
66
  "fsevents": "^2.3.3",
67
- "@ttsc/linux-x64": "0.34.0",
68
- "@ttsc/linux-arm": "0.34.0",
69
- "@ttsc/linux-arm64": "0.34.0",
70
- "@ttsc/darwin-arm64": "0.34.0",
71
- "@ttsc/win32-x64": "0.34.0",
72
- "@ttsc/win32-arm64": "0.34.0",
73
- "@ttsc/darwin-x64": "0.34.0"
67
+ "@ttsc/linux-x64": "0.34.1",
68
+ "@ttsc/darwin-x64": "0.34.1",
69
+ "@ttsc/linux-arm64": "0.34.1",
70
+ "@ttsc/win32-x64": "0.34.1",
71
+ "@ttsc/darwin-arm64": "0.34.1",
72
+ "@ttsc/linux-arm": "0.34.1",
73
+ "@ttsc/win32-arm64": "0.34.1"
74
74
  },
75
75
  "sideEffects": [
76
76
  "./lib/register.js",
@@ -3,6 +3,7 @@
3
3
  package compiler
4
4
 
5
5
  import (
6
+ "slices"
6
7
  "time"
7
8
 
8
9
  "github.com/microsoft/TypeScript/tsc/internal/ast"
@@ -84,8 +85,11 @@ type ProgramResolutionTask struct {
84
85
  redirectedReference module.ResolvedProjectReference
85
86
  }
86
87
 
87
- // ProgramResolutionTasks returns every cached module and type-reference
88
- // resolution, including unresolved entries and automatic type directives.
88
+ // ProgramResolutionTasks returns cached filesystem module and type-reference
89
+ // resolutions, including unresolved entries and automatic type directives.
90
+ // Source-local ambient module sentinels are excluded because the compiler
91
+ // resolves them from source content without a filesystem query. Imports of
92
+ // the same name from other sources and external-module augmentations remain.
89
93
  // A nil Program returns nil. Returned tasks retain Program option and redirect
90
94
  // pointers; the caller owns their storage and must preserve that context.
91
95
  // Enumeration order follows compiler maps and is not sorted. TargetFile is
@@ -93,12 +97,12 @@ type ProgramResolutionTask struct {
93
97
  // initialize referenced configs' input/output maps and query a native realpath
94
98
  // for a preserved symlink redirect; it does not replay module resolution.
95
99
  //
96
- // @evidence contracts/common.md#principled-implementation Enumerating the resident compiler's module and type-directive caches retains both successes and failures; containing paths recover loaded-source or semantic-config spelling, and expected results include package, target and link identity.
100
+ // @evidence contracts/common.md#principled-implementation Enumerating the resident compiler's module and type-directive caches retains filesystem successes and failures while excluding names in the containing source's AmbientModuleNames, matching fileLoader's local-ambient branch. Their declarations remain source-content inputs; other sources and external-module augmentations retain their filesystem tasks. Containing paths recover loaded-source or semantic-config spelling, and expected results include package, target and link identity.
97
101
  // @evidence contracts/common.md#clear-and-simple-design One append closure shares task construction across both compiler cache traversals, while private helpers own source-redirect and project-reference context reconstruction.
98
- // @evidence contracts/common.md#prohibited-implementation-shortcuts The inferred-types filename is the compiler's automatic-directive context, and recovering its lexical directory addresses actual case-canonical cache keys without relaxing result comparison.
102
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts Source-local AmbientModuleNames membership mirrors the compiler's skipped lookup, not a consumer name or an empty-result filter; genuine unresolved tasks remain. The inferred-types filename is the compiler's automatic-directive context, and recovering its lexical directory addresses actual case-canonical cache keys without relaxing result comparison.
99
103
  // @evidence contracts/common.md#meaningful-documentation Native prose states cache coverage, nil behavior and retained Program-pointer lifetime; task fields document the lexical-versus-loaded path distinctions.
100
104
  // @evidence contracts/portability.md#os-neutral-implementation Compiler canonical cache keys are not replayed as lexical filenames: source/config context restores spelling, and redirects use actual filesystem Realpath plus Program case policy rather than OS guesses.
101
- // @evidence contracts/performance.md#efficient-algorithms Two cache traversals append one task per resolution and share one reference-context snapshot. Additional work includes reference-graph traversal, source/output map scans and first-use output-path construction, path hashing/canonicalization and selected native Realpath queries for symlink context. Map/string backing and referenced config/source population matter beyond just the returned task count; extraction does not independently replay imports.
105
+ // @evidence contracts/performance.md#efficient-algorithms Two cache traversals append one task per filesystem resolution and share one reference-context snapshot. Each module entry looks up its containing source and scans that source's ambient names, matching upstream's membership procedure without another retained index. Additional work includes reference-graph traversal, source/output map scans and first-use output-path construction, path hashing/canonicalization and selected native Realpath queries for symlink context. Map/string backing and referenced config/source population matter beyond just the returned task count; extraction does not independently replay imports.
102
106
  // @evidence contracts/performance.md#reuse-equivalent-work Cached resident resolutions and one shared project-reference context are reused across tasks from the same Program, preserving their option and redirect identity rather than sharing across changed programs.
103
107
  // @evidence contracts/performance.md#bound-retention-and-release-resources The returned task slice retains option, expected-result strings and redirect metadata, plus a shared context's directory set and output-to-reference map when present. These pointers can keep parsed project/config/source graphs reachable beyond the shallow map size. First-use input/output maps remain owned by referenced configs; invocation-local traversal/snapshot containers add no independent historical registry or running task, and callers bound how long they retain the result.
104
108
  func ProgramResolutionTasks(program *Program) []ProgramResolutionTask {
@@ -154,6 +158,11 @@ func ProgramResolutionTasks(program *Program) []ProgramResolutionTask {
154
158
  })
155
159
  }
156
160
  program.ForEachResolvedModule(func(resolution *module.ResolvedModule, name string, mode core.ResolutionMode, filePath tspath.PathKey) {
161
+ // fileLoader records local ambient names as empty cache sentinels without
162
+ // asking the filesystem resolver. Their source content owns the proof.
163
+ if source := program.GetSourceFileByPath(filePath); source != nil && slices.Contains(source.AmbientModuleNames, name) {
164
+ return
165
+ }
157
166
  appendTask(ProgramResolutionKindModule, name, mode, filePath, moduleResolutionResult(resolution), resolution)
158
167
  }, nil)
159
168
  program.ForEachResolvedTypeReferenceDirective(func(resolution *module.ResolvedTypeReferenceDirective, name string, mode core.ResolutionMode, filePath tspath.PathKey) {