260 Commits
Author SHA1 Message Date
Charles Lyding ee18d57563 refactor(compiler-cli): support external modules, virtual IDs, and type-only import kinds in preprocessor
Bundler-backed AnalysisHost implementations resolve dependencies into both in-bundle modules and
bundle-external dependencies, distinguish runtime imports from type-only imports, and assign opaque
virtual module IDs that are not filesystem paths. Previously, the query engine assumed every
extracted specifier had uniform type-only semantics, treated resolved modules as in-project paths
unless they ended in .d.ts, and computed relative paths across emitted imports and debug metadata.

Classify extracted static imports, re-exports, dynamic import() expressions, and TSImportType
queries with exact ImportKind and type_only flags and forward both on ResolveRequest. Track
authoritative external module flags in FileIdInterner and QueryEngine so external modules pass
external = true to AnalysisHost::load, stay out of ProgramFiles, coordinator roots, and core
compilation, and preserve or rebase their original OwningReference specifiers instead of emitting
paths to resolved external files.

Propagate IdKind onto AnalysisResult, FileUpdate, FileInvalidation, and WASM ModuleRef entry
points. When either side of a reference or a compiled file carries IdKind::Virtual, emit the module
ID verbatim across cross-file import emission, class debug info, and HMR identifiers without path
diffing or rootDir stripping.
2026-11-19 16:40:57 -08:00
Angular Robot 3ef4cb5d43 build: update all non-major dependencies
See associated pull request for more information.
2026-11-19 09:37:07 -08:00
Andrew Scott 7b50ce3be2 refactor(compiler-cli): attribute NgModule scope queries in perf summaries
In normal perf tracing mode, `ngp.rust.Summary` records top-5 `slowest` entries with `file` paths read from each query span's `file` field. That field was populated from `QueryKey::file_id()`, which returns `None` for `NgModuleExportsScope(ReferenceId)` and `NgModuleImportsScope(ReferenceId)`, leaving their `slowest` entries without file paths unless detail mode was enabled.

Add `QueryKey::perf_file_id()` to return `Some(reference_id.file)` for NgModule scope queries as well, and use it in `QueryEngine::execute` when creating the perf span. Keeping `QueryKey::file_id()` unchanged avoids marking NgModule files dirty or emitting them in `invalidatedPaths` when a downstream dependent evicts a cached scope key.
2026-11-18 10:11:35 -08:00
Andrew Scott a9d35bad83 refactor(compiler-cli): support go-to-definition for templateUrl and styleUrls
Add getDefinitionForExpressionAtPosition in the preprocessor language service DefinitionBuilder, matching the ngtsc language service structure, to resolve component templateUrl and styleUrls string literals to their target files.
2026-11-18 10:11:16 -08:00
Andrew Scott b208470321 refactor(compiler-cli): skip redundant didChange notifications in TsGoFacade
Cache the last sent document content in TsGoFacade.ensureDocument and skip sending textDocument/didChange when the content is unchanged, avoiding unnecessary cancellation of concurrent in-flight TypeScript 7 language server requests.
2026-11-18 10:11:16 -08:00
Andrew Scott 6d49c19e22 refactor(compiler-cli): configure VS Code extension host launch for ngp language service
Add VS Code launch and task configurations for launching and debugging the ngp-vscode-ng-language-service extension host in the monorepo, and fix build and runtime resolution issues when running outside Bazel:

- Add 'NGP VSCE: Launch Dev Client' and compound attach configs in .vscode/launch.json and 'NGP VSCE: build' task in .vscode/tasks.json.
- Update ngp-vscode-ng-language-service/build.js to use server/esbuild-tsconfig.json, mark @typescript/native-preview external, and define import.meta.url via banner.
- Update ngp-vscode-ng-language-service/tsconfig.json for TypeScript 7 compatibility (remove baseUrl, use relative paths, and specify node types).
- Resolve platform tsc/tsgo binary via createRequire from @typescript/native-preview/package.json so pnpm workspace layouts work, and await clientReady before sending angular/setTsApiPipe from fallback ts7Client.
- Allow analyzer_loader.ts to locate ng_analyze_wasm.js when walking up from a realpath'd bundle inside bazel-out.
2026-11-18 10:11:16 -08:00
Andrew Scott f442d775f0 build(compiler-cli): update TypeScript 7 language service dependency to 7.1.0-dev
Upgrades the TypeScript 7 dependency in the preprocessor language service
and VS Code extension from the frozen @typescript/[email protected]
package to npm:[email protected], updates binary lookup for
@typescript/typescript-<platform>-<arch> (tsc), updates subpath imports from
/unstable/async to /async, and replaces api.updateSnapshot() with
api.getCurrentLanguageServerSnapshot().
2026-11-18 10:11:16 -08:00
Charles Lyding 0edeb48fba refactor(compiler-cli): gate synchronous preprocessor APIs on synchronous hosts
Asynchronous bundler hosts suspend module resolution and content loading across
pump turns, so synchronous `*_blocking` and single-call FFI entry points cannot
run to completion within a single call. Without explicit host gating, calling a
synchronous entry point against an asynchronous host either infinite-loops or
panics inside WASM instead of reporting the host constraint cleanly.

Enforce `AnalysisHost::is_synchronous` inside `QueryEngine::block_on_query` and
add fallible `ensure_synchronous_host` checks to `Analyzer`'s synchronous core
helpers (`get_file_content_core`, `get_metadata_for_file_checked`, and
`read_resource_checked`). Route every FFI surface through them so the constraint
is reported as `"synchronous APIs require a synchronous host"` rather than a
panic: the WASM `get_metadata_for_file` and `read_resource` exports return
`Result<Option<String>, String>`, the N-API `getMetadataForFile` and
`readResource` exports return `napi::Result`, and the sidecar RPCs return an
RPC error. The WASM exports also now report a serialization failure as an error
instead of `None`.

`get_file_content_core` is gated even though it reads the filesystem directly,
because the filesystem is not authoritative under an asynchronous host. Until
pump-driven equivalents exist, `getFileContent` and `readResource` are
unavailable under an asynchronous host; pump-driven analysis, metadata queries,
and cache mutations continue working. Behavior under `DefaultFsHost` is
unchanged.
2026-11-18 10:10:59 -08:00
Charles Lyding e0097a81ff refactor(compiler-cli): drive WASM getMetadataForFile through the preprocessor pump loop
Previously, `WasmAnalyzer.getMetadataForFile` called the synchronous
`getMetadataForFile` WASM export directly, stepping the query engine to
completion inside a single FFI call. When an asynchronous `AnalysisHost`
suspends module resolution or content loading across JavaScript round-trips,
blocking inside a single WASM export cannot yield back to the host.

Add `ModuleRef` and `QueryEngine::get_metadata_for_file_id` (tracking whether
`ParseFile` loaded a module on `ParsedFileOwner::loaded` so missing modules
return `None` under asynchronous hosts just as they do under `DefaultFsHost`).
Expose `Analyzer::request_metadata_core` and `WasmAnalyzer::request_metadata`,
emitting `metadataResult` events from `WasmAnalyzer::pump` as oneshot queries
settle.

Update the TypeScript `WasmAnalyzer` adapter so `getMetadataForFile` registers
a pending request via `request_metadata` and resolves through `pumpLoop`
alongside active analysis streams, while cleaning up in-flight requests when
`close()` is called.

Skip `close_stream` for a stream that `close()` already released, so a
consumer still waiting on that stream is rejected with the close error
rather than the engine being called after it was freed. Fail a stream on
an `analysisError` whose message is empty, and report a metadata result
that cannot be serialized as an error instead of dropping the request.
2026-11-17 09:32:43 -08:00
Andrew Scott b2b4b1755c refactor(compiler-cli): skip module_export_map walks when strategy ignores owning references
`propagate_owning_reference_validated` and `resolve_host_directive` resolve a
package entry point and compute its `ModuleExportMap` so declarations and host
directives in `.d.ts` files inherit the package's published specifier and
export name. Under `PrefixImportStrategy`, `uses_owning_reference()` is `false`
and `emit` always derives module specifiers and export names directly from each
symbol's declaring file, ignoring `owning_reference` (matching `ngtsc` omitting
`AbsoluteModuleStrategy` when `_useHostForImportGeneration` is enabled).
2026-11-16 14:41:56 -08:00
Charles Lyding 688ff615af refactor(compiler-cli): expose clearResolutionCache across preprocessor and HybridCompiler
Bundler integrations and workspace reconfigurations can change how module
specifiers resolve without editing any individual source file—for example
when alias tables, export conditions, or package layouts change between
builds. While `invalidate_module_resolution` re-runs previously failed
resolutions after file creation or deletion, callers also need a way to
flush positive cached resolutions without discarding parsed ASTs.

Add `ResolutionCache::clear_all` and `QueryEngine::clear_resolution_cache`
to clear both host-internal and engine-level resolution caches and evict
queries derived from any importer's resolutions while preserving cached
`ParseFile` results. Expose `clear_resolution_cache` on `Analyzer`,
`TestAnalyzer`, `WasmAnalyzer`, and the sidecar JSON-RPC server, returning
the deduplicated list of stale module IDs while preserving virtual module
IDs verbatim instead of normalizing backslashes.

Surface `clearResolutionCache` on `IAnalyzer`, `WasmAnalyzer`,
`NapiAnalyzer`, `SidecarAnalyzer`, and `HybridCompiler`. In `HybridCompiler`,
sequence `clearResolutionCache` through the serialized update queue so
evicted analyses are dropped from the TypeScript file cache, recorded for
incremental emit, and refreshed on the following delta pass.
2026-11-16 13:17:21 -08:00
SkyZeroZx e4807c3c0c fix(compiler-cli): avoid repeating the error code in preprocessor extended diagnostics
The preprocessor's copy of formatExtendedError also prefixed the message with its own error code. It now matches ngtsc and only carries the text and the documentation link.
2026-11-13 16:22:27 -08:00
Charles Lyding 8ee9520035 refactor(compiler-cli): cache module resolutions and track unresolved imports in preprocessor
Previously, `QueryEngine` invoked `AnalysisHost::resolve` directly on every
syntactic dependency scan, cross-file constant evaluation, export-map walk,
and NgModule scope traversal without an engine-level cache. For asynchronous
bundler hosts, repeating identical `(importer, specifier, kind, type_only,
attributes)` lookups across queries and rebuilds would generate redundant
cross-boundary round-trips. In addition, failed module resolutions only
recorded `UNRESOLVED_IMPORTS_FILE_ID` during the Stage-1 static dependency
scan of `.ts` sources. That scan does not resolve the specifiers of `.d.ts`
files, so a failed lookup made from one, such as a re-export to a missing
target, was untracked and not re-run when the target was later created.
Deleting a resolved file also left importers holding stale cached dependency
edges.

Introduce `ResolutionCache` on `QueryEngine` to memoize completed module
resolution outcomes per importer `FileId` and request key while maintaining
both a target-to-importer reverse index and an unresolved-importer index.
Route query-time module lookups through `QueryContext::resolve_request`,
`resolve_from_id`, and `resolve_from_path` so every resolution records the
importer dependency and every failed lookup—including negative cache hits—
records `UNRESOLVED_IMPORTS_FILE_ID`. Classify pure re-exports in
`analyze_file_syntax` with `ImportKind::ReExport` so syntactic dependency
discovery shares cached resolutions with cross-file evaluation and export-map
queries.

On `invalidate_file_id`, drop only the edited importer's cached resolutions
so edits to a leaf module preserve cached resolutions across its importers.
On `FileUpdateType::Deleted`, evict queries derived from importers that had
resolved to the deleted target while keeping their `ParseFile` results
cached. On `invalidate_module_resolution`, stop serving every cached
resolution and re-run importers with previously unresolved specifiers. The
superseded entries are kept as stale rather than dropped, so the reverse
index still covers importers whose queries stay cached and that therefore do
not resolve again, and a lookup that the host answers after the change is
not memoized.

When a host resolution changes a module's `IdKind`, also evict the importers
whose cached resolutions report the previous kind. The resolution that
changed the kind is not memoized, so the query re-run that follows asks the
host again.
2026-11-13 16:02:29 -08:00
Kristiyan Kostadinov 8be02a66d3 refactor(compiler-cli): remove unused serving infrastructure from preprocessor
We had some code we used earlier to check apps against the preprocessor. These changes clean it up since it's not used anymore and it includes dependencies on TypeScript and esbuild.
2026-11-12 10:35:33 +01:00
Angular Robot 9b0d8bc9d5 build: update dependency @angular/compiler to v22.3.0-rc.0
See associated pull request for more information.
2026-11-11 17:01:58 -08:00
aparzialeandMatthieu Riegler e4f67442bb feat(compiler): report unknown property bindings on explicit ng-template elements
Previously, property bindings on `<ng-template>` that were not claimed
by a matched directive were silently ignored by the type checker. This
was inconsistent with how bindings on regular elements are handled.

This check is added behind a temporary compiler flag `checkTypeOfNgTemplateBindings` which will be removed
in the next breaking change window.

When the flag is enabled, the type checker will report an error for any property binding on an `<ng-template>` that is not matched by a directive.

Fixes #69322

Co-authored-by: Matthieu Riegler <[email protected]>
2026-11-11 15:41:43 -08:00
aparziale 08d41a9e94 fix(compiler-cli): suggest ngProjectAs in control flow content projection diagnostic
Previously, the NG8011 diagnostic suggested wrapping the content of the control
flow block in an `<ng-container/>` that matches the slot selector. This
suggestion is misleading: for element selectors (e.g. `select="my-title"`) a
plain `<ng-container>` can never match the slot, and the actual solution,
`ngProjectAs`, was never mentioned.

The suggestion now shows the exact `<ng-container ngProjectAs="...">` usage for
the matched slot selector and clarifies when to use it versus splitting the
content across multiple blocks, aligning the message with the NG8011 error page
on angular.dev.

Fixes #59398
2026-11-11 13:56:11 -08:00
Andrew Scott 94771961a6 refactor(compiler-cli): remove synchronous *Sync preprocessor APIs
Remove the synchronous *Sync methods and sync-only fallbacks from
HybridCompiler, IAnalyzer, DependencyTemplates, processor, indexer,
SidecarAnalyzer, WasmAnalyzer, and NapiAnalyzer.
2026-11-11 13:49:47 -08:00
Andrew Scott e1e0e3aa6e refactor(compiler-cli): migrate preprocessor language-service and tests to async APIs
Migrate preprocessor language-service, ngp-vscode-ng-language-service,
preprocessor tests, and ngp_test_driver to use the async HybridCompiler
and IAnalyzer methods instead of synchronous *Sync lookups.
2026-11-11 13:49:47 -08:00
Andrew Scott 05b3b6e87a refactor(compiler-cli): exclude output directories from hybrid preprocessor tsconfig globs
When a tsconfig has no `exclude` (including through `extends`), TypeScript skips `outDir` and `declarationDir` while expanding `include` globs. ng-analyze didn't, so emitted `.d.ts` and `.js` files inside the project could get picked up as sources.
2026-11-11 12:28:30 -08:00
Matthieu Riegler 37c1919831 refactor(compiler-cli): remove dependencies on deprecated webmcp packages
We don't need them any more.
2026-11-11 11:49:59 -08:00
Charles Lyding ba7d313030 refactor(compiler-cli): drop filesystem type parameter from preprocessor query engine
After routing module resolution, component resource resolution, and file
loading through `AnalysisHost`, the `Fs` type parameter on `QueryEngine`
and `QueryContext` no longer described any state the engine holds. It
survived only as a `PhantomData` marker, yet it still forced roughly a
hundred query, evaluator, analyzer, and compiler functions to carry a
`ResourceResolverFs + Clone + 'static` bound and kept the engine's types
tied to the filesystem implementation that hosts are meant to abstract
away.

Make `QueryEngine`, `QueryContext`, and the `QueryCtx` aliases concrete
types and remove the marker field, then drop the bound from every
function, method, and helper type that existed only to thread it
through, including the NgModule scope `ScopeEnv` and `Resolver`, the
streaming coordinator, and `DirtyFilesSnapshot`. The filesystem type now
appears only on the `new`, `new_with_options`, and `new_default`
constructors that wrap a filesystem and resolver in a `DefaultFsHost`, so
existing callers infer it as before, while `new_with_host` and
`new_default_with_host` accept any host directly. Tests that named
`QueryEngine<OverlayFileSystem>` now use the plain engine type, and
imports left unused by the removal are dropped.

Also reword the preprocessor contributor guideline on paths and module
resolution to describe the host boundary: analysis code resolves and
loads only through `AnalysisHost`, only host implementations touch a
filesystem or `oxc_resolver`, path arithmetic applies solely to
path-backed module IDs, and the TypeScript code-generation layer remains
a pure consumer of pre-resolved metadata. There is no change in
behavior.
2026-11-11 10:26:46 -08:00
Alex Rickabaugh 98b0f3b720 refactor(core): remove signal components prototype
Removes the unfinished prototype for signal-based components and directives
(the internal `signals: true` decorator flag):

* `@Directive`/`@Component` no longer accept the internal `signals` option.
* The compiler no longer reads it (ngtsc, JIT, linker, hybrid preprocessor)
  and no longer emits `signals: true` in definitions, `isSignal: true` in
  partial declarations, or the trailing `IsSignal` type argument of
  `ɵɵDirectiveDeclaration`/`ɵɵComponentDeclaration`.
* The runtime drops `DirectiveDef.signals`/`ComponentDef.signals`,
  `LViewFlags.SignalView` and the internal `ComponentMirror.isSignal`.

Signal inputs, model inputs and signal queries (input/query-level `isSignal`)
are unaffected.
2026-11-11 09:10:56 -08:00
Alex Rickabaugh ae9c706d14 refactor(compiler): remove selectorless prototype
Removes the experimental "selectorless" template syntax (`<MyComp>` / `@Dir(...)`)
which was never shipped. This deletes:

- compiler: lexer/parser support for component and directive tokens, the
  html `Component`/`Directive` nodes and the R3 `Component`/`Directive`
  (`TmplAstComponent`/`TmplAstDirective`) nodes together with their visitor
  methods and the `directives` field on elements/templates, the
  `selectorlessEnabled`/`enableSelectorless` parse options, direct pipe
  references (`BindingPipeType`), selectorless reference validation, the
  selectorless paths in the binder (`referencedDirectiveExists`),
  type-check ops, indexer, i18n and template pipeline.
- compiler-cli: the `_enableSelectorless` option, selectorless component
  analysis and `SelectorlessScope`, deferred selectorless dependencies,
  selectorless template symbols, out-of-band diagnostics and the related
  error codes (2024, 2025, 2026, 8018), the linker option, and the
  preprocessor/ng-analyze selectorless analysis.
- language-service: selectorless definitions, quick info, references and
  rename.
- the selectorless runtime and compiler tests.

`SelectorlessMatcher` is kept since it is used to match foreign components
(`foreignImports`) by tag name.
2026-11-11 09:10:56 -08:00
Charles Lyding 1eba558934 refactor(compiler-cli): route preprocessor query engine I/O through AnalysisHost
Even with `AnalysisHost` and `DefaultFsHost` available, `QueryEngine`,
component resource loaders, and cross-file constant evaluation still held
a concrete filesystem and `oxc_resolver` instance and performed synchronous
file reads and specifier lookups directly. That prevented asynchronous,
filesystem-free bundler hosts from driving analysis and left synchronous
helper entry points able to bypass the host boundary.

Replace `fs` and `resolver` on `QueryEngine` with `Arc<dyn AnalysisHost>`,
retaining a temporary `PhantomData` marker for `Fs` so generic parameter
removal across query and evaluator signatures stays isolated to a separate
follow-up change. Existing constructors wrap `DefaultFsHost` to preserve
current behavior, while `new_with_host` and `new_default_with_host` allow
injecting custom asynchronous hosts directly.

Route file parsing, syntax-level static and dynamic dependency discovery,
ambient `.d.ts` scanning, local-compilation extra import checks, export-map
traversal, host-directive package resolution, and cross-file symbol chasing
through `AnalysisHost`, deleting the synchronous `resolve_specifier` helper
so future call sites cannot bypass the host. Convert Stage-1 and Stage-2
component `templateUrl` and `styleUrl` loading to asynchronous host calls
that concurrently resolve resources and static/dynamic module specifiers in
a single wave, fall back to `AnalysisHost::load` when inline resource text
is omitted, and exclude `external` modules from the program closure while
still reading their metadata on demand.

Ambient global lookups read the tsconfig's `.d.ts` files through the host
as well, so they become asynchronous, and the lock that serializes their
scan is now an async mutex, held across host loads without blocking a pool
thread.

When a host resolution reports a different `IdKind` for a module that is
already interned, the host still wins, but whatever was computed under the
previous kind is now evicted. Queries still running at that point are not
in the reverse index yet, so any that read the module re-run before
returning, letting every caller see a result computed under the current
kind. A host that keeps flipping a module's kind stops the re-runs after
three, and the last result is returned without being cached.
2026-11-11 08:36:46 -08:00
Andrew Scott b89e88eb8c refactor(compiler-cli): support incremental invalidation and dependency prefetch in sidecar mode
Update the preprocessor sidecar and incremental pipeline so persistent
builds can reuse HybridCompiler and SidecarAnalyzer across runs:

- Convert numeric FileUpdateType values to string enum variant names in
  SidecarAnalyzer.invalidateFiles to match ng-analyze's serde JSON
  representation (same as WasmAnalyzer) and preserve workspaceName in
  compilerOptions.
- Prefetch cross-file component dependency metadata and record it in
  HybridCompiler.metadataByFile before computing bound fingerprints in
  ensureBoundWithMetadata so sidecar mode can compute bound fingerprints
  without falling back to synchronous getMetadataForFileSync.
- Add HybridCompiler.applyInvalidations and cache reused source maps
  across persistent run() invocations in ngp.ts.
2026-11-11 08:25:33 -08:00
Kristiyan Kostadinov 50142d36f3 refactor(compiler-cli): remove remaining references to ngtsc in preprocessor
Removes the last remaining imports of `@angular/compiler-cli` from the preprocessor.
2026-11-11 16:01:26 +01:00
Kristiyan Kostadinov 8c103c6302 refactor(compiler-cli): don't depend on ngtsc for error codes
Now that the error codes source of truth is within the preprocessor, we don't need to depend on ngtsc for it.
2026-11-11 11:00:51 +01:00
Matthew Beck d3dedf53e4 fix(compiler-cli): avoid names used in the file for generated namespace imports in ngp
ngtsc's `ImportManager` names the `n`th generated namespace import `i<n>` and
passes it through the helper from `createGenerateUniqueIdentifierHelper`
(`translator/src/import_manager/check_unique_identifier_name.ts`), which moves it
to `i<n>_1`, `i<n>_2`, ... while the name is in the source file's `identifiers`
table or was already generated. TypeScript's parser fills that table with the
text of every identifier token, at any depth (`internIdentifier` in `parser.ts`).
So a nested arrow parameter `i0` moves the `@angular/core` import to `i0_1` in
both the JS and the `.d.ts`.

ngp always used `i0`, `i1`, ..., which gave different output and, for a
top-level `const i0`, a compile error because the generated references resolved
to the user's binding.

The analyzer now applies ngtsc's rule restricted to bindings
(`analyzer::imports::namespace_alias_conflicts`): the name of every symbol in
oxc's symbol table, at any depth and in any space, and of every reference that
resolves to no declaration (a global), keeping those shaped like a generated
alias. These are all the names a generated reference could resolve to instead
of the import, and reading them takes about 3% of the time a walk over every
AST node does. Generated imports only come with a compiled class, so a file
without one skips the check. The names are reported as
`AnalysisResult.namespaceAliasConflicts`, and both `ExpressionPrinter` and
`TcbImportManager` (via `generateTcbCode` when `requiresInline` is `true`, for
inline `.ngtypecheck.ts` files in `processor.ts` and `hybrid_compiler.ts`) apply
the same `allocateNamespaceAlias` helper against them so the `.ng.ts` (and from
it both JS and `.d.ts`) and inline TCBs avoid colliding with the file.

Names in the `identifiers` table that aren't bindings don't count: property and
member names, labels, JSX tag and attribute names, the foreign name in an import
or export specifier, index signature parameter names, string literals used as a
property name, element-access argument or module name, and identifiers in JSDoc.
None of them can capture a generated reference, so the output compiles, but for
them ngtsc picks a different name in both the JS and the `.d.ts`. They're listed
as a `TODO(parity)`.

ngp also reused a namespace import already in the file whose alias looked like a
generated one. ngtsc never reuses an existing import for generated code: both its
Ivy and declaration transforms use `presetImportManagerForceNamespaceImports`
(`disableOriginalSourceFileReuse: true`, `transform/src/transform.ts` and
`transform/src/declaration.ts`). That reuse is removed, so a user-written
`import * as i0 from '@angular/core'` now gets a separate `i0_1` import, as in
ngtsc.
2026-11-11 10:16:57 +01:00
Matthew Beck 7932b39528 test(compiler-cli): cover generated namespace import names that collide with the file
ngtsc names the namespace imports it generates `i0`, `i1`, ... and moves one to
`i0_1` when the source file already uses the name anywhere, including a nested
parameter. It also never reuses an import the file already has, even a namespace
import named like its own.

The `namespace_alias_collisions` golden case pins the generated names for a
top-level declaration, a nested arrow parameter, user-written namespace imports
named `i0` and `i1`, and a name used only as a property name. A golden's `.ng.ts`
is what both the JS and the `.d.ts` are compiled from, so it pins the names in
both.

ngp always emits `i0`/`i1` and reuses a user-written `i0`/`i1` namespace import,
so the golden holds the plain or reused names. For the top-level `const i0` the
output doesn't type-check, which `typecheck_goldens_spec.ts` lists as a known
failure.
2026-11-11 10:16:57 +01:00