When an element with an `animate.leave` binding is detached,
`node_manipulation` eagerly records `{el, declarationView}` in the
module-level `leavingNodes` `WeakMap`. Previously, if `runLeaveAnimations`
resolved an empty class list (such as `''`, `[]`, `null`, or
`undefined`), it pushed a resolver and resolved immediately without
starting `animateLeaveClassRunner`, so `clearLeavingNodes` was never
called and every removed element and its declaration view remained
retained for the lifetime of the `TNode`.
Avoid registering a resolver or adding the view to `allLeavingAnimations`
when `activeClasses` is empty, and clear the tracked `leavingNodes` entry
from `node_animations` once leave animations settle (or when the
animation queue cannot be resolved). Clearing at settlement preserves
`leavingNodes` tracking and `declarationView` while composed or
descendant leave animations are still running, while keeping the cleanup
inside the tree-shaken animation runtime. Also delete empty `TNode`
entries from `leavingNodes` in `cancelLeavingNodes`.
Fixes#72141
Hard-code an explicit `outputSchema` for the implicitly generated signal forms WebMCP tool. This schema accurately describes the simplified success and error object returned by the tool execution, allowing AI agents to confidently interpret the results without hallucination.
Update `ToolDescriptor`, `declareExperimentalWebMcpTool`, and `provideExperimentalWebMcpTools` to explicitly support the `outputSchema` property. This allows tools to specify their expected return format using standard JSON Schema syntax, ensuring that AI agents know exactly how to interpret the tool execution results.
Simplify the output structure of the WebMCP tool for signal forms from a verbose array of content blocks to a simple JSON object containing a boolean success flag and an optional array of error strings. This reduces token usage and provides a more semantic output format for AI agents to consume.
In `mergeWithExistingDefinition`, `directiveDefs` and `pipeDefs` were always
restored from `clone` to preserve remote scopes patched by
`ɵɵsetComponentScope` from an `NgModule` file, which does not re-run during HMR
of the component file.
Standalone components never use `ɵɵsetComponentScope` because their imports are
inlined directly onto the component definition (in `ngtsc`, `handler.ts` keeps
non-self dependencies during HMR and emits the component self-reference only
while used in the template). Always restoring `clone` left removed standalone
directives active, caused swapped or newly added standalone directives to fail
silently and pipes to throw `NG0302`, and broke recursive self-references.
Use `newDef.directiveDefs` and `newDef.pipeDefs` directly for standalone
components (including `null`), while keeping `clone.directiveDefs` and
`clone.pipeDefs` unconditionally for non-standalone components. Add DOM-level
acceptance specs in `hmr_spec.ts`.
In `getParentBlockHydrationQueue`, PR #58722 breaks out of the ancestor loop
before calling `hydrationQueue.unshift(currentBlockId)` when it encounters an
ancestor `@defer` block that is already hydrating. Because of that,
`hydrationQueue` never contains the hydrating ancestor, only the unhydrated
descendants below it.
`triggerHydrationFromBlockName` still contains a `hydrationQueue.shift()` added
in PR #60203 under the assumption that the hydrating parent sat at index 0.
When `parentBlockPromise` is non-null, that shifts off the first unhydrated
child block instead: in a 2-level nested `@defer` block it empties the queue
and drops the replay event, and in a 3-level hierarchy (immediate inside
interaction inside immediate) it drops the middle block so both inner blocks
stay dehydrated.
Remove the stale `hydrationQueue.shift()` call and add regression specs in
`incremental_hydration_spec.ts`.
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.
Previously, GenericKeyFn.keyOf() wrapped string literals and quoted object literal keys in double quotes without length-prefixing or escaping. As a result, distinct array or object literals extracted during the template compiler's pure function optimization phase (such as ['a', 'b'] and ['a","b'], or {'a': 1, 'b': 2} and {'a":1,"b': 2}) produced identical constant pool keys and erroneously shared the same constant factory.
Prefix string literals and quoted object literal keys with their length ("<length>:<value>") in GenericKeyFn.keyOf() so embedded quotes and delimiters cannot cause key collisions without needing to scan or escape the string.
Fixes#71914
Consider the following example:
```ts
@Component({
template: '@for (item of items; track item) {{{ item }}}',
})
class App {
items = {0: 'a', 1: 'b'};
}
```
Prior to this commit, `reconcile()` treated every non-nullish value that is
not an array as an iterable and called `Symbol.iterator` on it without a
check. A plain object therefore failed with a raw `TypeError`:
```
TypeError: t[Symbol.iterator] is not a function
```
That error carries no code, does not mention `@for`, and does not say which
template produced it. In a production build the stack is minified, so error
reporting shows nothing actionable. The same value through `*ngFor` reports
NG02200, which names the problem and suggests the keyvalue pipe, so `@for`
was harder to debug than the API it replaces.
With this commit the same value throws NG0957. Only the message text is
behind `ngDevMode`; the check itself is not, because production is where the
raw error is unreadable today. The array fast path is untouched, and `null`
and `undefined` keep rendering nothing.
The code is negative, which is how this package marks codes that have a
guide on angular.dev, so the fix ships with one.
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.
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.
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.
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.
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().
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.
Consider the following example:
```ts
if (ngDevMode) {
await import('zone.js/plugins/task-tracking');
}
```
Under `moduleResolution: "bundler"`, `"node16"` or `"nodenext"` this fails to
type-check:
```
Could not find a declaration file for module 'zone.js/plugins/task-tracking'.
'.../node_modules/zone.js/fesm2015/task-tracking.js' implicitly has an 'any' type.
```
The `exports` map declares `types` only on the root entry, so every subpath
resolves to a bare `.js` file. Legacy `moduleResolution: "node"` ignores
`exports` and finds files by path, which is why nobody hit this until the
newer resolution modes became common.
Prior to this commit there was nothing a subpath `types` condition could
point at, because the package shipped a single declaration file at its root.
With this commit the build emits one declaration next to each bundle, and
every subpath gets a `types` condition. The bundles patch globals and export
nothing, so each declaration is `export {};` and adds no API surface to
maintain.
Legacy `node` resolution does not change. Those subpaths did not resolve
there before this commit either.
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.
Translated attributes with interpolations in a URL context (e.g.
`<a i18n-href href="{{url}}">` or an `href` inside an ICU case) were
sanitized with the raw `_sanitizeUrl` function, which ignores a
`Sanitizer` provided by the application. All other security contexts
already go through the `ɵɵsanitize*` instructions, as does the
compile-time path for static i18n attributes.
Use `ɵɵsanitizeUrl` for the URL context as well, so a custom
`Sanitizer` is consulted consistently.
Remove setRouterState from the RouterState constructor and call it explicitly in
createEmptyState and at the start of ActivateRoutes.activate instead of during
createRouterState. Thread parentRoute through setupAndRunResources and finalizeResources
so resource setup does not rely on route.parent before activation.
Because createRouterState runs before async work that can still cancel or redirect (and
will move even earlier ahead of resolvers), setting _routerState there mutates reused
ActivatedRoute instances prematurely and leaves their firstChild and children pointing at
an uncommitted or abandoned tree if rollback occurs. Waiting until ActivateRoutes.activate
keeps them on the current tree until activation, matching pre-1f287b9ba7 timing.
`getInputsTypeExpression` in `@angular/compiler` emits `'alias'`, `'required'`, and `'isSignal'` as quoted string-literal property signatures in the `InputMap` type argument of `ɵɵDirectiveDeclaration` and `ɵɵComponentDeclaration` on `ɵdir` and `ɵcmp`. However, `ɵɵDirectiveDeclaration` and `ɵɵComponentDeclaration` in `@angular/core` declared those constraint keys as unquoted identifier property signatures (`{alias: string | null; required: boolean; isSignal?: boolean}`).
In standard TypeScript, quoted and unquoted property signatures are structurally identical. When a property-renaming safety pass rewrites unquoted identifier property signatures in `.d.ts` type literals while preserving quoted string-literal keys, the renamed constraint keys on `InputMap` no longer match the quoted `'alias'`, `'required'`, and `'isSignal'` keys emitted on preprocessed `ɵdir` and `ɵcmp` source declarations, failing `TS2344`.
Quote `'alias'`, `'required'`, and `'isSignal'` in the `InputMap` constraint on `ɵɵDirectiveDeclaration` and `ɵɵComponentDeclaration` so the declaration constraints match the quoted keys emitted by `@angular/compiler`.
`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).
Given this template:
```html
<main>
<span>{{ value }}</span>
</main>
```
During hydration, Angular looks for the text node that the server rendered
inside the `<span>`. If the HTML from the server was changed and this text
node is missing, dev mode throws a clear NG0500 error. But this check only
runs in dev mode.
Prior to this fix, production continued with the missing text node and failed
on the first update of that binding with a raw error that doesn't say what
went wrong:
```
TypeError: Cannot set properties of null (setting 'nodeValue')
```
With this fix, production throws NG0512 during hydration instead.
Note that static text behaves differently. Nothing ever updates it, so it
hydrated without an error before this fix and left a gap in the DOM. It now
throws as well.
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.
The dev-mode warning for a route with an `errorComponent` but no
`withErrorBoundaries()` tracks whether it has fired in a module-level
variable. Spec order then decided whether the warning test saw it, so
it failed whenever another spec hit the same case first.
Add a private reset function and call it before the spec. Also make the
spec count only the matching warnings, since other `console.warn` calls
can run during the test.
Fixes the CI breakage from the previous change.
Gate ResourceContext.data and its initialization in setupAndRunResources behind 3p-only markers so that google3 stops exposing resolved data on ctx.data() ahead of parallelizing route resolvers and route resources.
A route's `errorComponent` is only used when router error boundaries are
enabled with `withErrorBoundaries()`. Without it the property is ignored
silently.
Log a dev-mode warning the first time a route with an `errorComponent`
activates while the feature is not provided.
Also link `withErrorBoundaries`, `Route.errorComponent`,
`ErrorBoundaryOptions` and `ErrorBoundariesFeature` to the error
boundaries guide with `@see`.