@angular/compiler-cli 21.1.0-next.0 → 21.1.0-next.2

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.
@@ -87,7 +87,7 @@ import {
87
87
  toUnredirectedSourceFile,
88
88
  tryParseInitializerApi,
89
89
  untagAllTsFiles
90
- } from "./chunk-IJMZQ3RN.js";
90
+ } from "./chunk-PUEBQK4X.js";
91
91
  import {
92
92
  LogicalFileSystem,
93
93
  absoluteFromSourceFile,
@@ -917,9 +917,10 @@ function getDecoratorInterface(declaration, typeChecker) {
917
917
  function getDecoratorJsDocNode(declaration, typeChecker) {
918
918
  const name = declaration.name.getText();
919
919
  const decoratorInterface = getDecoratorInterface(declaration, typeChecker);
920
- const callSignature = decoratorInterface.members.filter((node) => {
921
- return ts9.isCallSignatureDeclaration(node) && extractRawJsDoc(node);
922
- }).at(-1);
920
+ const callSignaturesWithJsDoc = decoratorInterface.members.filter((node) => {
921
+ return ts9.isCallSignatureDeclaration(node) && !!extractRawJsDoc(node);
922
+ });
923
+ const callSignature = callSignaturesWithJsDoc.sort((a, b) => (extractRawJsDoc(b)?.length ?? 0) - (extractRawJsDoc(a)?.length ?? 0))[0];
923
924
  if (!callSignature || !ts9.isCallSignatureDeclaration(callSignature)) {
924
925
  throw new Error(`No call signature with JsDoc on "${name}Decorator"`);
925
926
  }
@@ -8,7 +8,7 @@ import {
8
8
  TrackedIncrementalBuildStrategy,
9
9
  freshCompilationTicket,
10
10
  incrementalFromCompilerTicket
11
- } from "./chunk-I3BPPTZC.js";
11
+ } from "./chunk-6VDGFZBQ.js";
12
12
  import {
13
13
  ActivePerfRecorder,
14
14
  OptimizeFor,
@@ -18,7 +18,7 @@ import {
18
18
  TsCreateProgramDriver,
19
19
  replaceTsWithNgInErrors,
20
20
  retagAllTsFiles
21
- } from "./chunk-IJMZQ3RN.js";
21
+ } from "./chunk-PUEBQK4X.js";
22
22
  import {
23
23
  absoluteFrom,
24
24
  createFileSystemTsReadDirectoryFn,
@@ -12,7 +12,7 @@ import {
12
12
  formatDiagnostics,
13
13
  performCompilation,
14
14
  readConfiguration
15
- } from "./chunk-Z6AENWVT.js";
15
+ } from "./chunk-ML6J2RBK.js";
16
16
 
17
17
  // packages/compiler-cli/src/main.js
18
18
  import ts2 from "typescript";
@@ -6951,56 +6951,37 @@ function nodeArrayFromDecoratorsArray(decorators) {
6951
6951
 
6952
6952
  // packages/compiler-cli/src/ngtsc/transform/src/implicit_signal_debug_name_transform.js
6953
6953
  import ts32 from "typescript";
6954
- function insertDebugNameIntoCallExpression(callExpression, debugName) {
6955
- const signalExpressionIsRequired = isRequiredSignalFunction(callExpression.expression);
6956
- let configPosition = signalExpressionIsRequired ? 0 : 1;
6957
- const signalExpressionHasNoArguments = callExpression.arguments.length === 0;
6958
- const signalWithObjectOnlyDefinition = isSignalWithObjectOnlyDefinition(callExpression);
6959
- if (signalExpressionHasNoArguments || signalWithObjectOnlyDefinition) {
6960
- configPosition = 0;
6961
- }
6962
- const nodeArgs = Array.from(callExpression.arguments);
6963
- let existingArgument = nodeArgs[configPosition];
6964
- if (existingArgument === void 0) {
6965
- existingArgument = ts32.factory.createObjectLiteralExpression([]);
6966
- }
6967
- if (ts32.isIdentifier(existingArgument)) {
6968
- return callExpression;
6969
- }
6970
- if (!ts32.isObjectLiteralExpression(existingArgument)) {
6971
- return callExpression;
6972
- }
6973
- const properties = Array.from(existingArgument.properties);
6974
- const debugNameExists = properties.some((prop) => ts32.isPropertyAssignment(prop) && ts32.isIdentifier(prop.name) && prop.name.text === "debugName");
6975
- if (debugNameExists) {
6976
- return callExpression;
6954
+ function insertDebugNameIntoCallExpression(node, debugName) {
6955
+ const isRequired = isRequiredSignalFunction(node.expression);
6956
+ const hasNoArgs = node.arguments.length === 0;
6957
+ const configPosition = hasNoArgs || isSignalWithObjectOnlyDefinition(node) || isRequired ? 0 : 1;
6958
+ const existingArg = configPosition >= node.arguments.length ? null : node.arguments[configPosition];
6959
+ if (existingArg !== null && (!ts32.isObjectLiteralExpression(existingArg) || existingArg.properties.some((prop) => ts32.isPropertyAssignment(prop) && ts32.isIdentifier(prop.name) && prop.name.text === "debugName"))) {
6960
+ return node;
6977
6961
  }
6978
- const ngDevModeIdentifier = ts32.factory.createIdentifier("ngDevMode");
6979
6962
  const debugNameProperty = ts32.factory.createPropertyAssignment("debugName", ts32.factory.createStringLiteral(debugName));
6980
- const debugNameObject = ts32.factory.createObjectLiteralExpression([debugNameProperty]);
6981
- const emptyObject = ts32.factory.createObjectLiteralExpression();
6982
- const spreadDebugNameExpression = ts32.factory.createSpreadAssignment(ts32.factory.createParenthesizedExpression(ts32.factory.createConditionalExpression(
6983
- ngDevModeIdentifier,
6984
- void 0,
6985
- // Question token
6986
- debugNameObject,
6987
- void 0,
6988
- // Colon token
6989
- emptyObject
6990
- )));
6991
- const transformedConfigProperties = ts32.factory.createObjectLiteralExpression([
6992
- spreadDebugNameExpression,
6993
- ...properties
6994
- ]);
6995
- let transformedSignalArgs = [];
6996
- if (signalExpressionHasNoArguments && !signalExpressionIsRequired) {
6997
- transformedSignalArgs = [ts32.factory.createIdentifier("undefined"), transformedConfigProperties];
6998
- } else if (signalWithObjectOnlyDefinition || signalExpressionIsRequired) {
6999
- transformedSignalArgs = [transformedConfigProperties];
6963
+ let newArgs;
6964
+ if (existingArg !== null) {
6965
+ const transformedArg = ts32.factory.createObjectLiteralExpression([
6966
+ ts32.factory.createSpreadAssignment(createNgDevModeConditional(ts32.factory.createObjectLiteralExpression([debugNameProperty]), ts32.factory.createObjectLiteralExpression())),
6967
+ ...existingArg.properties
6968
+ ]);
6969
+ newArgs = node.arguments.map((arg) => arg === existingArg ? transformedArg : arg);
7000
6970
  } else {
7001
- transformedSignalArgs = [nodeArgs[0], transformedConfigProperties];
6971
+ const spreadArgs = [];
6972
+ if (hasNoArgs && !isRequired) {
6973
+ spreadArgs.push(ts32.factory.createIdentifier("undefined"));
6974
+ }
6975
+ spreadArgs.push(ts32.factory.createObjectLiteralExpression([debugNameProperty]));
6976
+ newArgs = [
6977
+ ...node.arguments,
6978
+ ts32.factory.createSpreadElement(createNgDevModeConditional(ts32.factory.createArrayLiteralExpression(spreadArgs), ts32.factory.createArrayLiteralExpression()))
6979
+ ];
7002
6980
  }
7003
- return ts32.factory.updateCallExpression(callExpression, callExpression.expression, callExpression.typeArguments, ts32.factory.createNodeArray(transformedSignalArgs));
6981
+ return ts32.factory.updateCallExpression(node, node.expression, node.typeArguments, newArgs);
6982
+ }
6983
+ function createNgDevModeConditional(devModeExpression, prodModeExpression) {
6984
+ return ts32.factory.createParenthesizedExpression(ts32.factory.createConditionalExpression(ts32.factory.createIdentifier("ngDevMode"), void 0, devModeExpression, void 0, prodModeExpression));
7004
6985
  }
7005
6986
  function isVariableDeclarationCase(node) {
7006
6987
  if (!ts32.isVariableDeclaration(node)) {
@@ -15194,10 +15175,11 @@ var formControlOptionalFields = /* @__PURE__ */ new Set([
15194
15175
  "min",
15195
15176
  "minLength"
15196
15177
  ]);
15197
- var TcbNativeFieldDirectiveTypeOp = class extends TcbOp {
15178
+ var TcbNativeFieldOp = class extends TcbOp {
15198
15179
  tcb;
15199
15180
  scope;
15200
15181
  node;
15182
+ inputType;
15201
15183
  /** Bindings that aren't supported on signal form fields. */
15202
15184
  unsupportedBindingFields = /* @__PURE__ */ new Set([
15203
15185
  ...formControlInputFields,
@@ -15206,19 +15188,15 @@ var TcbNativeFieldDirectiveTypeOp = class extends TcbOp {
15206
15188
  "maxlength",
15207
15189
  "minlength"
15208
15190
  ]);
15209
- inputType;
15210
15191
  get optional() {
15211
15192
  return false;
15212
15193
  }
15213
- constructor(tcb, scope, node) {
15194
+ constructor(tcb, scope, node, inputType) {
15214
15195
  super();
15215
15196
  this.tcb = tcb;
15216
15197
  this.scope = scope;
15217
15198
  this.node = node;
15218
- this.inputType = node.name === "input" && node.attributes.find((attr) => attr.name === "type")?.value || null;
15219
- if (this.inputType === "radio") {
15220
- this.unsupportedBindingFields.delete("value");
15221
- }
15199
+ this.inputType = inputType;
15222
15200
  }
15223
15201
  execute() {
15224
15202
  const inputs = this.node instanceof TmplAstHostElement2 ? this.node.bindings : this.node.inputs;
@@ -15227,7 +15205,7 @@ var TcbNativeFieldDirectiveTypeOp = class extends TcbOp {
15227
15205
  return null;
15228
15206
  }
15229
15207
  checkUnsupportedFieldBindings(this.node, this.unsupportedBindingFields, this.tcb);
15230
- const expectedType = this.node instanceof TmplAstElement3 ? this.getExpectedTypeFromDomNode(this.node) : this.getUnsupportedType();
15208
+ const expectedType = this.getExpectedTypeFromDomNode(this.node);
15231
15209
  const value = extractFieldValue(fieldBinding.value, this.tcb, this.scope);
15232
15210
  const id = this.tcb.allocateId();
15233
15211
  const assignment = ts73.factory.createBinaryExpression(id, ts73.SyntaxKind.EqualsToken, value);
@@ -15264,12 +15242,43 @@ var TcbNativeFieldDirectiveTypeOp = class extends TcbOp {
15264
15242
  ts73.factory.createLiteralTypeNode(ts73.factory.createNull())
15265
15243
  ]);
15266
15244
  }
15245
+ const hasDynamicType = this.inputType === null && this.node.inputs.some((input) => (input.type === BindingType3.Property || input.type === BindingType3.Attribute) && input.name === "type");
15246
+ if (hasDynamicType) {
15247
+ return ts73.factory.createUnionTypeNode([
15248
+ ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.StringKeyword),
15249
+ ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.NumberKeyword),
15250
+ ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.BooleanKeyword),
15251
+ ts73.factory.createTypeReferenceNode("Date"),
15252
+ ts73.factory.createLiteralTypeNode(ts73.factory.createNull())
15253
+ ]);
15254
+ }
15267
15255
  return ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.StringKeyword);
15268
15256
  }
15269
15257
  getUnsupportedType() {
15270
15258
  return ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.NeverKeyword);
15271
15259
  }
15272
15260
  };
15261
+ var TcbNativeRadioButtonFieldOp = class extends TcbNativeFieldOp {
15262
+ constructor(tcb, scope, node) {
15263
+ super(tcb, scope, node, "radio");
15264
+ this.unsupportedBindingFields.delete("value");
15265
+ }
15266
+ execute() {
15267
+ super.execute();
15268
+ const valueBinding = this.node.inputs.find((attr) => {
15269
+ return attr.type === BindingType3.Property && attr.name === "value";
15270
+ });
15271
+ if (valueBinding !== void 0) {
15272
+ const id = this.tcb.allocateId();
15273
+ const value = tcbExpression(valueBinding.value, this.tcb, this.scope);
15274
+ const assignment = ts73.factory.createBinaryExpression(id, ts73.SyntaxKind.EqualsToken, value);
15275
+ addParseSpanInfo(assignment, valueBinding.sourceSpan);
15276
+ this.scope.addStatement(tsDeclareVariable(id, ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.StringKeyword)));
15277
+ this.scope.addStatement(ts73.factory.createExpressionStatement(assignment));
15278
+ }
15279
+ return null;
15280
+ }
15281
+ };
15273
15282
  function expandBoundAttributesForField(directive, node, customFieldType) {
15274
15283
  const fieldBinding = node.inputs.find((input) => input.type === BindingType3.Property && input.name === "field");
15275
15284
  if (!fieldBinding) {
@@ -16716,7 +16725,8 @@ var Scope = class _Scope {
16716
16725
  const dirIndex = this.opQueue.push(directiveOp) - 1;
16717
16726
  dirMap.set(dir, dirIndex);
16718
16727
  if (isNativeField(dir, node, allDirectiveMatches)) {
16719
- this.opQueue.push(new TcbNativeFieldDirectiveTypeOp(this.tcb, this, node));
16728
+ const inputType = node.name === "input" && node.attributes.find((attr) => attr.name === "type")?.value || null;
16729
+ this.opQueue.push(inputType === "radio" ? new TcbNativeRadioButtonFieldOp(this.tcb, this, node) : new TcbNativeFieldOp(this.tcb, this, node, inputType));
16720
16730
  }
16721
16731
  this.opQueue.push(new TcbDirectiveInputsOp(this.tcb, this, node, dir, customFieldType));
16722
16732
  }
@@ -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 = "21.1.0-next.0";
458
+ var PLACEHOLDER_VERSION = "21.1.0-next.2";
459
459
  function wrapReference(wrapped) {
460
460
  return { value: wrapped, type: wrapped };
461
461
  }
package/bundles/index.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  isTsDiagnostic,
18
18
  performCompilation,
19
19
  readConfiguration
20
- } from "./chunk-Z6AENWVT.js";
20
+ } from "./chunk-ML6J2RBK.js";
21
21
  import {
22
22
  ConsoleLogger,
23
23
  LogLevel
@@ -34,7 +34,7 @@ import {
34
34
  freshCompilationTicket,
35
35
  incrementalFromStateTicket,
36
36
  isDocEntryWithSourceInfo
37
- } from "./chunk-I3BPPTZC.js";
37
+ } from "./chunk-6VDGFZBQ.js";
38
38
  import {
39
39
  ActivePerfRecorder,
40
40
  ErrorCode,
@@ -46,7 +46,7 @@ import {
46
46
  getInitializerApiJitTransform,
47
47
  isLocalCompilationDiagnostics,
48
48
  ngErrorCode
49
- } from "./chunk-IJMZQ3RN.js";
49
+ } from "./chunk-PUEBQK4X.js";
50
50
  import "./chunk-LS5RJ5CS.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("21.1.0-next.0");
80
+ var VERSION = new Version("21.1.0-next.2");
81
81
 
82
82
  // packages/compiler-cli/private/tooling.js
83
83
  var GLOBAL_DEFS_FOR_TERSER = {
@@ -5,7 +5,7 @@
5
5
  import {
6
6
  DiagnosticCategoryLabel,
7
7
  NgCompiler
8
- } from "../chunk-I3BPPTZC.js";
8
+ } from "../chunk-6VDGFZBQ.js";
9
9
  import {
10
10
  CompilationMode,
11
11
  DtsMetadataReader,
@@ -32,7 +32,7 @@ import {
32
32
  queryDecoratorNames,
33
33
  reflectObjectLiteral,
34
34
  unwrapExpression
35
- } from "../chunk-IJMZQ3RN.js";
35
+ } from "../chunk-PUEBQK4X.js";
36
36
  import "../chunk-LS5RJ5CS.js";
37
37
  import {
38
38
  getFileSystem,
@@ -6,7 +6,7 @@ import {
6
6
  ImportedSymbolsTracker,
7
7
  TypeScriptReflectionHost,
8
8
  getInitializerApiJitTransform
9
- } from "../chunk-IJMZQ3RN.js";
9
+ } from "../chunk-PUEBQK4X.js";
10
10
  import "../chunk-LS5RJ5CS.js";
11
11
  import {
12
12
  InvalidFileSystem,
@@ -4,7 +4,7 @@
4
4
 
5
5
  import {
6
6
  angularJitApplicationTransform
7
- } from "../chunk-IJMZQ3RN.js";
7
+ } from "../chunk-PUEBQK4X.js";
8
8
  import "../chunk-LS5RJ5CS.js";
9
9
  import "../chunk-JEXAXD23.js";
10
10
  import "../chunk-XYYEESKY.js";
@@ -6,12 +6,12 @@
6
6
  import {
7
7
  main,
8
8
  readCommandLineAndConfiguration
9
- } from "../../chunk-TQDACBKM.js";
9
+ } from "../../chunk-OPZT26MK.js";
10
10
  import {
11
11
  EmitFlags
12
- } from "../../chunk-Z6AENWVT.js";
13
- import "../../chunk-I3BPPTZC.js";
14
- import "../../chunk-IJMZQ3RN.js";
12
+ } from "../../chunk-ML6J2RBK.js";
13
+ import "../../chunk-6VDGFZBQ.js";
14
+ import "../../chunk-PUEBQK4X.js";
15
15
  import "../../chunk-LS5RJ5CS.js";
16
16
  import {
17
17
  setFileSystem
@@ -5,10 +5,10 @@
5
5
 
6
6
  import {
7
7
  main
8
- } from "../../chunk-TQDACBKM.js";
9
- import "../../chunk-Z6AENWVT.js";
10
- import "../../chunk-I3BPPTZC.js";
11
- import "../../chunk-IJMZQ3RN.js";
8
+ } from "../../chunk-OPZT26MK.js";
9
+ import "../../chunk-ML6J2RBK.js";
10
+ import "../../chunk-6VDGFZBQ.js";
11
+ import "../../chunk-PUEBQK4X.js";
12
12
  import "../../chunk-LS5RJ5CS.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 = "21.1.0-next.0";
10
+ export declare const PLACEHOLDER_VERSION = "21.1.0-next.2";
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": "21.1.0-next.0",
3
+ "version": "21.1.0-next.2",
4
4
  "description": "Angular - the compiler CLI for Node.js",
5
5
  "typings": "index.d.ts",
6
6
  "bin": {
@@ -33,7 +33,7 @@
33
33
  "@babel/core": "7.28.5",
34
34
  "@jridgewell/sourcemap-codec": "^1.4.14",
35
35
  "reflect-metadata": "^0.2.0",
36
- "chokidar": "^4.0.0",
36
+ "chokidar": "^5.0.0",
37
37
  "convert-source-map": "^1.5.1",
38
38
  "semver": "^7.0.0",
39
39
  "tslib": "^2.3.0",
@@ -43,7 +43,7 @@
43
43
  "typescript": "5.9.3"
44
44
  },
45
45
  "peerDependencies": {
46
- "@angular/compiler": "21.1.0-next.0",
46
+ "@angular/compiler": "21.1.0-next.2",
47
47
  "typescript": ">=5.9 <6.0"
48
48
  },
49
49
  "peerDependenciesMeta": {
@@ -80,6 +80,7 @@ export interface DocEntryWithSourceInfo extends DocEntry {
80
80
  /** Base type for all documentation entities. */
81
81
  export interface DocEntry {
82
82
  entryType: EntryType;
83
+ aliases?: string[];
83
84
  name: string;
84
85
  description: string;
85
86
  rawComment: string;
@@ -18,25 +18,34 @@ export declare const customFormControlBannedInputFields: Set<string>;
18
18
  /**
19
19
  * A `TcbOp` which constructs an instance of the signal forms `Field` directive on a native element.
20
20
  */
21
- export declare class TcbNativeFieldDirectiveTypeOp extends TcbOp {
22
- private tcb;
23
- private scope;
24
- private node;
21
+ export declare class TcbNativeFieldOp extends TcbOp {
22
+ protected tcb: Context;
23
+ protected scope: Scope;
24
+ protected node: TmplAstElement;
25
+ private inputType;
25
26
  /** Bindings that aren't supported on signal form fields. */
26
27
  protected readonly unsupportedBindingFields: Set<string>;
27
- private readonly inputType;
28
28
  get optional(): boolean;
29
- constructor(tcb: Context, scope: Scope, node: TmplAstElement);
29
+ constructor(tcb: Context, scope: Scope, node: TmplAstElement, inputType: string | null);
30
30
  execute(): null;
31
31
  private getExpectedTypeFromDomNode;
32
32
  private getUnsupportedType;
33
33
  }
34
+ /**
35
+ * A variation of the `TcbNativeFieldOp` with specific logic for radio buttons.
36
+ */
37
+ export declare class TcbNativeRadioButtonFieldOp extends TcbNativeFieldOp {
38
+ constructor(tcb: Context, scope: Scope, node: TmplAstElement);
39
+ execute(): null;
40
+ }
34
41
  /** Expands the set of bound inputs with the ones from custom field directives. */
35
42
  export declare function expandBoundAttributesForField(directive: TypeCheckableDirectiveMeta, node: TmplAstTemplate | TmplAstElement | TmplAstComponent | TmplAstDirective, customFieldType: CustomFieldType): TcbBoundAttribute[] | null;
36
43
  export declare function isFieldDirective(meta: TypeCheckableDirectiveMeta): boolean;
37
44
  /** Determines if a directive is a custom field and its type. */
38
45
  export declare function getCustomFieldDirectiveType(meta: TypeCheckableDirectiveMeta): CustomFieldType | null;
39
46
  /** Determines if a directive usage is on a native field. */
40
- export declare function isNativeField(dir: TypeCheckableDirectiveMeta, node: TmplAstNode, allDirectiveMatches: TypeCheckableDirectiveMeta[]): boolean;
47
+ export declare function isNativeField(dir: TypeCheckableDirectiveMeta, node: TmplAstNode, allDirectiveMatches: TypeCheckableDirectiveMeta[]): node is TmplAstElement & {
48
+ name: 'input' | 'select' | 'textarea';
49
+ };
41
50
  /** Checks whether a node has bindings that aren't supported on fields. */
42
51
  export declare function checkUnsupportedFieldBindings(node: DirectiveOwner, unsupportedBindingFields: Set<string>, tcb: Context): void;