@angular/compiler-cli 20.3.1 → 20.3.3

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.
@@ -455,7 +455,7 @@ import { compileDirectiveFromMetadata, makeBindingParser, ParseLocation, ParseSo
455
455
  // packages/compiler-cli/linker/src/file_linker/partial_linkers/util.js
456
456
  import { createMayBeForwardRefExpression, outputAst as o2 } from "@angular/compiler";
457
457
  import semver from "semver";
458
- var PLACEHOLDER_VERSION = "20.3.1";
458
+ var PLACEHOLDER_VERSION = "20.3.3";
459
459
  function wrapReference(wrapped) {
460
460
  return { value: wrapped, type: wrapped };
461
461
  }
@@ -12,7 +12,7 @@ import {
12
12
  formatDiagnostics,
13
13
  performCompilation,
14
14
  readConfiguration
15
- } from "./chunk-EWP5PK2E.js";
15
+ } from "./chunk-WNPSVVUI.js";
16
16
 
17
17
  // packages/compiler-cli/src/main.js
18
18
  import ts2 from "typescript";
@@ -6818,13 +6818,15 @@ function nodeArrayFromDecoratorsArray(decorators) {
6818
6818
  // packages/compiler-cli/src/ngtsc/transform/src/implicit_signal_debug_name_transform.js
6819
6819
  import ts32 from "typescript";
6820
6820
  function insertDebugNameIntoCallExpression(callExpression, debugName) {
6821
- const signalExpressionHasNoArguments = callExpression.arguments.length === 0;
6822
6821
  const signalExpressionIsRequired = isRequiredSignalFunction(callExpression.expression);
6823
6822
  let configPosition = signalExpressionIsRequired ? 0 : 1;
6824
- if (signalExpressionHasNoArguments) {
6823
+ const nodeArgs = Array.from(callExpression.arguments);
6824
+ const signalExpressionHasNoArguments = callExpression.arguments.length === 0;
6825
+ const isLinkedSignal = callExpression.expression.getText() === "linkedSignal";
6826
+ const isComputationLinkedSignal = isLinkedSignal && nodeArgs[0].kind === ts32.SyntaxKind.ObjectLiteralExpression;
6827
+ if (signalExpressionHasNoArguments || isComputationLinkedSignal) {
6825
6828
  configPosition = 0;
6826
6829
  }
6827
- const nodeArgs = Array.from(callExpression.arguments);
6828
6830
  let existingArgument = nodeArgs[configPosition];
6829
6831
  if (existingArgument === void 0) {
6830
6832
  existingArgument = ts32.factory.createObjectLiteralExpression([]);
@@ -6866,7 +6868,7 @@ function insertDebugNameIntoCallExpression(callExpression, debugName) {
6866
6868
  nonDevModeCase
6867
6869
  )));
6868
6870
  let transformedSignalArgs;
6869
- if (signalExpressionIsRequired || signalExpressionHasNoArguments) {
6871
+ if (signalExpressionIsRequired || signalExpressionHasNoArguments || isComputationLinkedSignal) {
6870
6872
  transformedSignalArgs = ts32.factory.createNodeArray([spreadElementContainingUpdatedOptions]);
6871
6873
  } else {
6872
6874
  transformedSignalArgs = ts32.factory.createNodeArray([
@@ -6956,6 +6958,7 @@ function expressionIsUsingAngularCoreImportedSymbol(program, expression) {
6956
6958
  var signalFunctions = /* @__PURE__ */ new Set([
6957
6959
  "signal",
6958
6960
  "computed",
6961
+ "linkedSignal",
6959
6962
  "input",
6960
6963
  "model",
6961
6964
  "viewChild",
@@ -10983,7 +10986,7 @@ var CompletionEngine = class {
10983
10986
  // packages/compiler-cli/src/ngtsc/typecheck/src/context.js
10984
10987
  import { ParseSourceFile as ParseSourceFile2 } from "@angular/compiler";
10985
10988
 
10986
- // node_modules/.aspect_rules_js/magic-string@0.30.18/node_modules/magic-string/dist/magic-string.es.mjs
10989
+ // node_modules/.aspect_rules_js/magic-string@0.30.19/node_modules/magic-string/dist/magic-string.es.mjs
10987
10990
  import { encode } from "@jridgewell/sourcemap-codec";
10988
10991
  var BitSet = class _BitSet {
10989
10992
  constructor(arg) {
@@ -11433,6 +11436,9 @@ var MagicString = class _MagicString {
11433
11436
  if (chunk.outro.length)
11434
11437
  mappings.advance(chunk.outro);
11435
11438
  });
11439
+ if (this.outro) {
11440
+ mappings.advance(this.outro);
11441
+ }
11436
11442
  return {
11437
11443
  file: options.file ? options.file.split(/[/\\]/).pop() : void 0,
11438
11444
  sources: [
@@ -11995,7 +12001,12 @@ var MagicString = class _MagicString {
11995
12001
  const { original } = this;
11996
12002
  const index = original.indexOf(string);
11997
12003
  if (index !== -1) {
11998
- this.overwrite(index, index + string.length, replacement);
12004
+ if (typeof replacement === "function") {
12005
+ replacement = replacement(string, index, original);
12006
+ }
12007
+ if (string !== replacement) {
12008
+ this.overwrite(index, index + string.length, replacement);
12009
+ }
11999
12010
  }
12000
12011
  return this;
12001
12012
  }
@@ -12010,8 +12021,12 @@ var MagicString = class _MagicString {
12010
12021
  const stringLength = string.length;
12011
12022
  for (let index = original.indexOf(string); index !== -1; index = original.indexOf(string, index + stringLength)) {
12012
12023
  const previous = original.slice(index, index + stringLength);
12013
- if (previous !== replacement)
12014
- this.overwrite(index, index + stringLength, replacement);
12024
+ let _replacement = replacement;
12025
+ if (typeof replacement === "function") {
12026
+ _replacement = replacement(previous, index, original);
12027
+ }
12028
+ if (previous !== _replacement)
12029
+ this.overwrite(index, index + stringLength, _replacement);
12015
12030
  }
12016
12031
  return this;
12017
12032
  }
@@ -21071,11 +21086,12 @@ var ComponentDecoratorHandler = class {
21071
21086
  for (const [_, deps] of resolution.deferPerBlockDependencies) {
21072
21087
  for (const deferBlockDep of deps) {
21073
21088
  const node = deferBlockDep.declaration.node;
21074
- const importDecl = resolution.deferrableDeclToImportDecl.get(node) ?? null;
21075
- if (importDecl !== null && this.deferredSymbolTracker.canDefer(importDecl)) {
21089
+ const importInfo = resolution.deferrableDeclToImportDecl.get(node) ?? null;
21090
+ if (importInfo !== null && this.deferredSymbolTracker.canDefer(importInfo.node)) {
21076
21091
  deferBlockDep.isDeferrable = true;
21077
- deferBlockDep.importPath = importDecl.moduleSpecifier.text;
21078
- deferBlockDep.isDefaultImport = isDefaultImport(importDecl);
21092
+ deferBlockDep.symbolName = importInfo.name;
21093
+ deferBlockDep.importPath = importInfo.from;
21094
+ deferBlockDep.isDefaultImport = isDefaultImport(importInfo.node);
21079
21095
  if (!seenDeps.has(node)) {
21080
21096
  seenDeps.add(node);
21081
21097
  deferrableTypes.push(deferBlockDep);
@@ -21218,7 +21234,7 @@ var ComponentDecoratorHandler = class {
21218
21234
  if (dirMeta === null && pipeMeta === null) {
21219
21235
  return;
21220
21236
  }
21221
- resolutionData.deferrableDeclToImportDecl.set(decl.node, imp.node);
21237
+ resolutionData.deferrableDeclToImportDecl.set(decl.node, imp);
21222
21238
  this.deferredSymbolTracker.markAsDeferrableCandidate(node, imp.node, componentClassDecl, isDeferredImport);
21223
21239
  }
21224
21240
  compileDeferBlocks(resolution) {
@@ -4,7 +4,7 @@
4
4
 
5
5
  import {
6
6
  angularJitApplicationTransform
7
- } from "./chunk-LBDATQBA.js";
7
+ } from "./chunk-Y3D2VBHK.js";
8
8
  import {
9
9
  AbsoluteModuleStrategy,
10
10
  ActivePerfRecorder,
@@ -92,7 +92,7 @@ import {
92
92
  toUnredirectedSourceFile,
93
93
  tryParseInitializerApi,
94
94
  untagAllTsFiles
95
- } from "./chunk-HQSSDNAP.js";
95
+ } from "./chunk-SZUJOV4Y.js";
96
96
  import {
97
97
  LogicalFileSystem,
98
98
  absoluteFrom,
@@ -3146,14 +3146,23 @@ var factory6 = {
3146
3146
  };
3147
3147
 
3148
3148
  // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/optional_chain_not_nullable/index.js
3149
- import { SafeCall, SafeKeyedRead, SafePropertyRead } from "@angular/compiler";
3149
+ import { KeyedRead, SafeCall, SafeKeyedRead, SafePropertyRead } from "@angular/compiler";
3150
3150
  import ts20 from "typescript";
3151
3151
  var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
3152
+ noUncheckedIndexedAccess;
3152
3153
  canVisitStructuralAttributes = false;
3153
3154
  code = ErrorCode.OPTIONAL_CHAIN_NOT_NULLABLE;
3155
+ constructor(noUncheckedIndexedAccess) {
3156
+ super();
3157
+ this.noUncheckedIndexedAccess = noUncheckedIndexedAccess;
3158
+ }
3154
3159
  visitNode(ctx, component, node) {
3155
- if (!(node instanceof SafeCall) && !(node instanceof SafePropertyRead) && !(node instanceof SafeKeyedRead))
3160
+ if (!(node instanceof SafeCall) && !(node instanceof SafePropertyRead) && !(node instanceof SafeKeyedRead)) {
3156
3161
  return [];
3162
+ }
3163
+ if (node.receiver instanceof KeyedRead && !this.noUncheckedIndexedAccess) {
3164
+ return [];
3165
+ }
3157
3166
  const symbolLeft = ctx.templateTypeChecker.getSymbolOfNode(node.receiver, component);
3158
3167
  if (symbolLeft === null || symbolLeft.kind !== SymbolKind.Expression) {
3159
3168
  return [];
@@ -3185,7 +3194,8 @@ var factory7 = {
3185
3194
  if (!strictNullChecks) {
3186
3195
  return null;
3187
3196
  }
3188
- return new OptionalChainNotNullableCheck();
3197
+ const noUncheckedIndexedAccess = !!options.noUncheckedIndexedAccess;
3198
+ return new OptionalChainNotNullableCheck(noUncheckedIndexedAccess);
3189
3199
  }
3190
3200
  };
3191
3201
 
@@ -16,7 +16,7 @@ import {
16
16
  tryParseSignalInputMapping,
17
17
  tryParseSignalModelMapping,
18
18
  tryParseSignalQueryFromInitializer
19
- } from "./chunk-HQSSDNAP.js";
19
+ } from "./chunk-SZUJOV4Y.js";
20
20
 
21
21
  // packages/compiler-cli/src/ngtsc/transform/jit/src/downlevel_decorators_transform.js
22
22
  import ts from "typescript";
package/bundles/index.js CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  isTsDiagnostic,
29
29
  performCompilation,
30
30
  readConfiguration
31
- } from "./chunk-EWP5PK2E.js";
31
+ } from "./chunk-WNPSVVUI.js";
32
32
  import {
33
33
  ConsoleLogger,
34
34
  LogLevel
@@ -37,7 +37,7 @@ import {
37
37
  angularJitApplicationTransform,
38
38
  getDownlevelDecoratorsTransform,
39
39
  getInitializerApiJitTransform
40
- } from "./chunk-LBDATQBA.js";
40
+ } from "./chunk-Y3D2VBHK.js";
41
41
  import {
42
42
  ActivePerfRecorder,
43
43
  ErrorCode,
@@ -46,7 +46,7 @@ import {
46
46
  TsCreateProgramDriver,
47
47
  isLocalCompilationDiagnostics,
48
48
  ngErrorCode
49
- } from "./chunk-HQSSDNAP.js";
49
+ } from "./chunk-SZUJOV4Y.js";
50
50
  import "./chunk-I2BHWRAU.js";
51
51
  import {
52
52
  InvalidFileSystem,
@@ -77,7 +77,7 @@ import "./chunk-G7GFT6BU.js";
77
77
 
78
78
  // packages/compiler-cli/src/version.js
79
79
  import { Version } from "@angular/compiler";
80
- var VERSION = new Version("20.3.1");
80
+ var VERSION = new Version("20.3.3");
81
81
 
82
82
  // packages/compiler-cli/private/tooling.js
83
83
  var GLOBAL_DEFS_FOR_TERSER = {
@@ -13,7 +13,7 @@ import {
13
13
  TypeScriptReflectionHost,
14
14
  createForwardRefResolver,
15
15
  reflectObjectLiteral
16
- } from "../chunk-HQSSDNAP.js";
16
+ } from "../chunk-SZUJOV4Y.js";
17
17
  import "../chunk-I2BHWRAU.js";
18
18
  import "../chunk-GWZQLAGK.js";
19
19
  import "../chunk-XYYEESKY.js";
@@ -4,8 +4,8 @@
4
4
 
5
5
  import {
6
6
  angularJitApplicationTransform
7
- } from "../chunk-LBDATQBA.js";
8
- import "../chunk-HQSSDNAP.js";
7
+ } from "../chunk-Y3D2VBHK.js";
8
+ import "../chunk-SZUJOV4Y.js";
9
9
  import "../chunk-I2BHWRAU.js";
10
10
  import "../chunk-GWZQLAGK.js";
11
11
  import "../chunk-XYYEESKY.js";
@@ -6,12 +6,12 @@
6
6
  import {
7
7
  main,
8
8
  readCommandLineAndConfiguration
9
- } from "../../chunk-WIZYXMS6.js";
9
+ } from "../../chunk-JKYMLCNY.js";
10
10
  import {
11
11
  EmitFlags
12
- } from "../../chunk-EWP5PK2E.js";
13
- import "../../chunk-LBDATQBA.js";
14
- import "../../chunk-HQSSDNAP.js";
12
+ } from "../../chunk-WNPSVVUI.js";
13
+ import "../../chunk-Y3D2VBHK.js";
14
+ import "../../chunk-SZUJOV4Y.js";
15
15
  import "../../chunk-I2BHWRAU.js";
16
16
  import {
17
17
  setFileSystem
@@ -5,10 +5,10 @@
5
5
 
6
6
  import {
7
7
  main
8
- } from "../../chunk-WIZYXMS6.js";
9
- import "../../chunk-EWP5PK2E.js";
10
- import "../../chunk-LBDATQBA.js";
11
- import "../../chunk-HQSSDNAP.js";
8
+ } from "../../chunk-JKYMLCNY.js";
9
+ import "../../chunk-WNPSVVUI.js";
10
+ import "../../chunk-Y3D2VBHK.js";
11
+ import "../../chunk-SZUJOV4Y.js";
12
12
  import "../../chunk-I2BHWRAU.js";
13
13
  import {
14
14
  setFileSystem
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { MaybeForwardRefExpression, outputAst as o, R3DeclareDependencyMetadata, R3DependencyMetadata, R3Reference } from '@angular/compiler';
9
9
  import { AstObject, AstValue } from '../../ast/ast_value';
10
- export declare const PLACEHOLDER_VERSION = "20.3.1";
10
+ export declare const PLACEHOLDER_VERSION = "20.3.3";
11
11
  export declare function wrapReference<TExpression>(wrapped: o.WrappedNodeExpr<TExpression>): R3Reference;
12
12
  /**
13
13
  * Parses the value of an enum from the AST value's symbol name.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/compiler-cli",
3
- "version": "20.3.1",
3
+ "version": "20.3.3",
4
4
  "description": "Angular - the compiler CLI for Node.js",
5
5
  "typings": "index.d.ts",
6
6
  "bin": {
@@ -48,7 +48,7 @@
48
48
  "yargs": "^18.0.0"
49
49
  },
50
50
  "peerDependencies": {
51
- "@angular/compiler": "20.3.1",
51
+ "@angular/compiler": "20.3.3",
52
52
  "typescript": ">=5.8 <6.0"
53
53
  },
54
54
  "peerDependenciesMeta": {
@@ -9,7 +9,7 @@ import { LegacyAnimationTriggerNames, DeclarationListEmitMode, DeferBlockDepsEmi
9
9
  import ts from 'typescript';
10
10
  import { Reference } from '../../../imports';
11
11
  import { ClassPropertyMapping, DirectiveResources, DirectiveTypeCheckMeta, HostDirectiveMeta, InputMapping } from '../../../metadata';
12
- import { ClassDeclaration } from '../../../reflection';
12
+ import { ClassDeclaration, Import } from '../../../reflection';
13
13
  import { SubsetOfKeys } from '../../../util/src/typescript';
14
14
  import { ParsedTemplateWithSource, StyleUrlMeta } from './resources';
15
15
  import { HostBindingNodes } from '../../directive';
@@ -84,10 +84,11 @@ export interface ComponentResolutionData {
84
84
  declarationListEmitMode: DeclarationListEmitMode;
85
85
  /**
86
86
  * Map of all types that can be defer loaded (ts.ClassDeclaration) ->
87
- * corresponding import declaration (ts.ImportDeclaration) within
88
- * the current source file.
87
+ * corresponding import information (reflection `Import`) within
88
+ * the current source file. The `Import` preserves the exported name
89
+ * as seen by the importing module so aliasing is handled correctly.
89
90
  */
90
- deferrableDeclToImportDecl: Map<ClassDeclaration, ts.ImportDeclaration>;
91
+ deferrableDeclToImportDecl: Map<ClassDeclaration, Import>;
91
92
  /**
92
93
  * Map of `@defer` blocks -> their corresponding dependencies.
93
94
  * Required to compile the defer resolver function in `PerBlock` mode.