Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
refactor(compiler-cli): implement transform to determine debugName fr…
…om signal functions

Implements a compiler transform that attempts to statically analyze variable names and apply them to usages of signal functions like signal, computed, effect, etc.
  • Loading branch information
AleksanderBodurri committed Jun 3, 2025
commit b7c9b39f3db19bc98daf155ecfe7c3883969ca0f
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.pnpmfile.cjs=-2033668682
adev/shared-docs/pipeline/api-gen/package.json=939673974
modules/package.json=-1315257891
package.json=-1427785430
package.json=288136953
packages/animations/package.json=-678724831
packages/bazel/src/ngc-wrapped/package.json=-239561259
packages/common/package.json=1729763064
Expand All @@ -21,7 +21,7 @@ packages/platform-browser/package.json=-1163479450
packages/router/package.json=860819913
packages/upgrade/package.json=16347051
packages/zone.js/package.json=-1545343303
pnpm-lock.yaml=1473986573
pnpm-lock.yaml=1973457723
pnpm-workspace.yaml=-474716307
tools/bazel/rules_angular_store/package.json=-239561259
yarn.lock=-792031330
yarn.lock=1099737031
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"@babel/generator": "7.27.1",
"@bazel/concatjs": "5.8.1",
"@bazel/esbuild": "5.8.1",
"esbuild": "0.21.4",
"@bazel/jasmine": "5.8.1",
"@bazel/protractor": "5.8.1",
"@bazel/rollup": "5.8.1",
Expand Down
8 changes: 6 additions & 2 deletions packages/compiler-cli/src/ngtsc/core/src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ import {
DtsTransformRegistry,
ivyTransformFactory,
TraitCompiler,
signalMetadataTransform,
} from '../../transform';
import {TemplateTypeCheckerImpl} from '../../typecheck';
import {OptimizeFor, TemplateTypeChecker, TypeCheckingConfig} from '../../typecheck/api';
Expand Down Expand Up @@ -819,7 +820,7 @@ export class NgCompiler {

const defaultImportTracker = new DefaultImportTracker();

const before = [
const before: ts.TransformerFactory<ts.SourceFile>[] = [
ivyTransformFactory(
compilation.traitCompiler,
compilation.reflector,
Expand Down Expand Up @@ -859,7 +860,7 @@ export class NgCompiler {
},
)(ctx);

return (sourceFile) => {
return (sourceFile: ts.SourceFile) => {
if (!sourceFilesWithJit.has(sourceFile.fileName)) {
return sourceFile;
}
Expand All @@ -868,6 +869,9 @@ export class NgCompiler {
});
}

// Typescript transformer to add debugName metadata to signal functions.
before.push(signalMetadataTransform(this.inputProgram));

const afterDeclarations: ts.TransformerFactory<ts.SourceFile>[] = [];

// In local compilation mode we don't make use of .d.ts files for Angular compilation, so their
Expand Down
1 change: 1 addition & 0 deletions packages/compiler-cli/src/ngtsc/transform/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ export {
TraitState,
} from './src/trait';
export {ivyTransformFactory} from './src/transform';
export {signalMetadataTransform} from './src/implicit_signal_debug_name_transform';
Loading