@angular/compiler-cli 21.2.0-next.1 → 21.2.0-next.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 = "21.2.0-next.1";
458
+ var PLACEHOLDER_VERSION = "21.2.0-next.3";
459
459
  function wrapReference(wrapped) {
460
460
  return { value: wrapped, type: wrapped };
461
461
  }
@@ -551,6 +551,7 @@ function toR3DirectiveMeta(metaObj, code, sourceUrl, version) {
551
551
  lifecycle: {
552
552
  usesOnChanges: metaObj.has("usesOnChanges") ? metaObj.getBoolean("usesOnChanges") : false
553
553
  },
554
+ controlCreate: metaObj.has("controlCreate") ? toControlCreate(metaObj.getObject("controlCreate")) : null,
554
555
  name: typeName,
555
556
  usesInheritance: metaObj.has("usesInheritance") ? metaObj.getBoolean("usesInheritance") : false,
556
557
  isStandalone: metaObj.has("isStandalone") ? metaObj.getBoolean("isStandalone") : getDefaultStandaloneValue(version),
@@ -572,6 +573,12 @@ function toInputMapping(value, key) {
572
573
  }
573
574
  return parseLegacyInputPartialOutput(key, value);
574
575
  }
576
+ function toControlCreate(controlCreate) {
577
+ const passThroughValue = controlCreate.getValue("passThroughInput");
578
+ return {
579
+ passThroughInput: passThroughValue.isNull() ? null : passThroughValue.getString()
580
+ };
581
+ }
575
582
  function parseLegacyInputPartialOutput(key, value) {
576
583
  if (value.isString()) {
577
584
  return {
@@ -12,7 +12,7 @@ import {
12
12
  formatDiagnostics,
13
13
  performCompilation,
14
14
  readConfiguration
15
- } from "./chunk-AWHYBEL3.js";
15
+ } from "./chunk-RBFYX33W.js";
16
16
 
17
17
  // packages/compiler-cli/src/main.js
18
18
  import ts2 from "typescript";
@@ -8,7 +8,7 @@ import {
8
8
  TrackedIncrementalBuildStrategy,
9
9
  freshCompilationTicket,
10
10
  incrementalFromCompilerTicket
11
- } from "./chunk-S44BUT6J.js";
11
+ } from "./chunk-REXDVAT6.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-TOPNFXNB.js";
21
+ } from "./chunk-TAXP3SCS.js";
22
22
  import {
23
23
  absoluteFrom,
24
24
  createFileSystemTsReadDirectoryFn,
@@ -88,7 +88,7 @@ import {
88
88
  toUnredirectedSourceFile,
89
89
  tryParseInitializerApi,
90
90
  untagAllTsFiles
91
- } from "./chunk-TOPNFXNB.js";
91
+ } from "./chunk-TAXP3SCS.js";
92
92
  import {
93
93
  LogicalFileSystem,
94
94
  absoluteFromSourceFile,
@@ -162,12 +162,32 @@ function extractJsDocTags(node) {
162
162
  return ts.getJSDocTags(escapedNode).map((t) => {
163
163
  return {
164
164
  name: t.tagName.getText(),
165
- // In TS 5.9, ts.getTextOfJSDocComment still strips "http" from comments breaking any absolute links in @see blocks.
166
- // eg: @see https://angular.dev
167
- comment: unescapeAngularDecorators(ts.getTextOfJSDocComment(t.comment) ?? "")
165
+ comment: unescapeAngularDecorators(getJSDocTagComment(t) ?? "")
168
166
  };
169
167
  });
170
168
  }
169
+ function getJSDocTagComment(tag) {
170
+ const comment = tag.comment;
171
+ if (comment === void 0)
172
+ return void 0;
173
+ if (typeof comment === "string") {
174
+ if (comment.startsWith("://")) {
175
+ const rawText = tag.getText();
176
+ if (rawText.includes("https" + comment)) {
177
+ return "https" + comment;
178
+ }
179
+ if (rawText.includes("http" + comment)) {
180
+ return "http" + comment;
181
+ }
182
+ }
183
+ return comment;
184
+ }
185
+ let text = ts.getTextOfJSDocComment(comment);
186
+ if (text) {
187
+ text = text.replace(/ \(\)\}$/, "()}");
188
+ }
189
+ return text;
190
+ }
171
191
  function extractJsDocDescription(node) {
172
192
  const escapedNode = getEscapedNode(node);
173
193
  const commentOrTag = ts.getJSDocCommentsAndTags(escapedNode).find((d) => {
@@ -319,12 +339,17 @@ function extractReturnType(signature, typeChecker) {
319
339
  if (signature?.declaration?.type && ts3.isTypePredicateNode(signature.declaration.type)) {
320
340
  return signature.declaration.type.getText();
321
341
  }
322
- return typeChecker.typeToString(
323
- typeChecker.getReturnTypeOfSignature(signature),
342
+ const returnType = typeChecker.getReturnTypeOfSignature(signature);
343
+ const returnTypeString = typeChecker.typeToString(
344
+ returnType,
324
345
  void 0,
325
346
  // This ensures that e.g. `T | undefined` is not reduced to `T`.
326
347
  ts3.TypeFormatFlags.NoTypeReduction | ts3.TypeFormatFlags.NoTruncation
327
348
  );
349
+ if (returnTypeString === "any" && signature.declaration?.type && signature.declaration.type.kind !== ts3.SyntaxKind.AnyKeyword) {
350
+ return signature.declaration.type.getText();
351
+ }
352
+ return returnTypeString;
328
353
  }
329
354
  function findImplementationOfFunction(node, typeChecker) {
330
355
  if (node.body !== void 0 || node.name === void 0) {
@@ -3356,7 +3381,7 @@ var factory10 = {
3356
3381
  };
3357
3382
 
3358
3383
  // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/uninvoked_function_in_event_binding/index.js
3359
- import { ASTWithSource as ASTWithSource3, Call, Chain, Conditional, ParsedEventType, PropertyRead as PropertyRead3, SafeCall as SafeCall2, SafePropertyRead as SafePropertyRead2, TmplAstBoundEvent as TmplAstBoundEvent2 } from "@angular/compiler";
3384
+ import { ASTWithSource as ASTWithSource3, Call, Chain, Conditional, ParsedEventType, PropertyRead as PropertyRead3, ArrowFunction, SafeCall as SafeCall2, SafePropertyRead as SafePropertyRead2, TmplAstBoundEvent as TmplAstBoundEvent2 } from "@angular/compiler";
3360
3385
  var UninvokedFunctionInEventBindingSpec = class extends TemplateCheckWithVisitor {
3361
3386
  code = ErrorCode.UNINVOKED_FUNCTION_IN_EVENT_BINDING;
3362
3387
  visitNode(ctx, component, node) {
@@ -3381,6 +3406,10 @@ function assertExpressionInvoked(expression, component, node, expressionText, ct
3381
3406
  if (expression instanceof Call || expression instanceof SafeCall2) {
3382
3407
  return [];
3383
3408
  }
3409
+ if (expression instanceof ArrowFunction) {
3410
+ const errorString = "Arrow function will not be invoked in this event listener. Did you intend to call a method?";
3411
+ return [ctx.makeTemplateDiagnostic(node.sourceSpan, errorString)];
3412
+ }
3384
3413
  if (!(expression instanceof PropertyRead3) && !(expression instanceof SafePropertyRead2)) {
3385
3414
  return [];
3386
3415
  }
@@ -229,7 +229,7 @@ var COMPILER_ERRORS_WITH_GUIDES = /* @__PURE__ */ new Set([
229
229
  import { VERSION } from "@angular/compiler";
230
230
  var DOC_PAGE_BASE_URL = (() => {
231
231
  const full = VERSION.full;
232
- const isPreRelease = full.includes("-next") || full.includes("-rc") || full === "21.2.0-next.1";
232
+ const isPreRelease = full.includes("-next") || full.includes("-rc") || full === "21.2.0-next.3";
233
233
  const prefix = isPreRelease ? "next" : `v${VERSION.major}`;
234
234
  return `https://${prefix}.angular.dev`;
235
235
  })();
@@ -2648,7 +2648,7 @@ function resolveProvidersRequiringFactory(rawProviders, reflector, evaluator) {
2648
2648
  });
2649
2649
  return providers;
2650
2650
  }
2651
- function wrapTypeReference(reflector, clazz) {
2651
+ function wrapTypeReference(clazz) {
2652
2652
  const value = new WrappedNodeExpr2(clazz.name);
2653
2653
  const type = value;
2654
2654
  return { value, type };
@@ -8219,6 +8219,7 @@ function extractDirectiveMetadata(clazz, decorator, reflector, importTracker, ev
8219
8219
  const host = extractHostBindings(decoratedElements, evaluator, coreModule, compilationMode, hostBindingNodes, directive);
8220
8220
  const providers = directive.has("providers") ? new WrappedNodeExpr6(annotateForClosureCompiler ? wrapFunctionExpressionsInParens(directive.get("providers")) : directive.get("providers")) : null;
8221
8221
  const usesOnChanges = members.some((member) => !member.isStatic && member.kind === ClassMemberKind.Method && member.name === "ngOnChanges");
8222
+ const controlCreate = extractControlDirectiveDefinition(members);
8222
8223
  let exportAs = null;
8223
8224
  if (directive.has("exportAs")) {
8224
8225
  const expr = directive.get("exportAs");
@@ -8255,7 +8256,7 @@ function extractDirectiveMetadata(clazz, decorator, reflector, importTracker, ev
8255
8256
  }
8256
8257
  const usesInheritance = reflector.hasBaseClass(clazz);
8257
8258
  const sourceFile = clazz.getSourceFile();
8258
- const type = wrapTypeReference(reflector, clazz);
8259
+ const type = wrapTypeReference(clazz);
8259
8260
  const rawHostDirectives = directive.get("hostDirectives") || null;
8260
8261
  const hostDirectives = rawHostDirectives === null ? null : extractHostDirectives(rawHostDirectives, evaluator, reflector, compilationMode, createForwardRefResolver(isCore), emitDeclarationOnly);
8261
8262
  if (compilationMode !== CompilationMode.LOCAL && hostDirectives !== null) {
@@ -8284,6 +8285,7 @@ function extractDirectiveMetadata(clazz, decorator, reflector, importTracker, ev
8284
8285
  typeArgumentCount: reflector.getGenericArityOfClass(clazz) || 0,
8285
8286
  typeSourceSpan: createSourceSpan(clazz.name),
8286
8287
  usesInheritance,
8288
+ controlCreate,
8287
8289
  exportAs,
8288
8290
  providers,
8289
8291
  isStandalone,
@@ -8870,6 +8872,21 @@ function assertEmittableInputType(type, contextFile, reflector, refEmitter) {
8870
8872
  node.forEachChild(walk);
8871
8873
  })(type);
8872
8874
  }
8875
+ function extractControlDirectiveDefinition(members) {
8876
+ const controlCreateMember = members.find((member) => !member.isStatic && member.kind === ClassMemberKind.Method && member.name === "\u0275ngControlCreate");
8877
+ if (controlCreateMember === void 0 || controlCreateMember.node === null || !ts40.isMethodDeclaration(controlCreateMember.node)) {
8878
+ return null;
8879
+ }
8880
+ const { node } = controlCreateMember;
8881
+ if (node.parameters.length === 0 || node.parameters[0].type === void 0 || !ts40.isTypeReferenceNode(node.parameters[0].type)) {
8882
+ return { passThroughInput: null };
8883
+ }
8884
+ const type = node.parameters[0].type;
8885
+ if (type.typeArguments?.length !== 1 || !ts40.isLiteralTypeNode(type.typeArguments[0]) || !ts40.isStringLiteral(type.typeArguments[0].literal)) {
8886
+ return { passThroughInput: null };
8887
+ }
8888
+ return { passThroughInput: type.typeArguments[0].literal.text };
8889
+ }
8873
8890
  function parseQueriesOfClassFields(members, reflector, importTracker, evaluator, isCore) {
8874
8891
  const viewQueries = [];
8875
8892
  const contentQueries = [];
@@ -15397,7 +15414,7 @@ function isFieldDirective(meta) {
15397
15414
  if (meta.ref.bestGuessOwningModule?.specifier === "@angular/forms/signals") {
15398
15415
  return true;
15399
15416
  }
15400
- return ts73.isClassDeclaration(meta.ref.node) && meta.ref.node.members.some((member) => ts73.isPropertyDeclaration(member) && ts73.isComputedPropertyName(member.name) && ts73.isIdentifier(member.name.expression) && member.name.expression.text === "\u0275CONTROL");
15417
+ return ts73.isClassDeclaration(meta.ref.node) && meta.ref.node.members.some((member) => ts73.isPropertyDeclaration(member) && ts73.isComputedPropertyName(member.name) && ts73.isIdentifier(member.name.expression) && member.name.expression.text === "\u0275NgFieldDirective");
15401
15418
  }
15402
15419
  function getSyntheticFieldBoundInput(dir, inputName, fieldPropertyName, fieldBinding, customFieldType) {
15403
15420
  const inputs = dir.inputs.getByBindingPropertyName(inputName);
@@ -20044,7 +20061,7 @@ var NgModuleDecoratorHandler = class {
20044
20061
  const exports = exportRefs.map((exp) => this._toR3Reference(exp.getOriginForDiagnostics(meta, node.name), exp, valueContext));
20045
20062
  const isForwardReference = (ref) => isExpressionForwardReference(ref.value, node.name, valueContext);
20046
20063
  const containsForwardDecls = bootstrap.some(isForwardReference) || declarations.some(isForwardReference) || imports.some(isForwardReference) || exports.some(isForwardReference);
20047
- const type = wrapTypeReference(this.reflector, node);
20064
+ const type = wrapTypeReference(node);
20048
20065
  let ngModuleMetadata;
20049
20066
  if (allowUnresolvedReferences) {
20050
20067
  ngModuleMetadata = {
@@ -22474,7 +22491,7 @@ var InjectableDecoratorHandler = class {
22474
22491
  };
22475
22492
  function extractInjectableMetadata(clazz, decorator, reflector) {
22476
22493
  const name = clazz.name.text;
22477
- const type = wrapTypeReference(reflector, clazz);
22494
+ const type = wrapTypeReference(clazz);
22478
22495
  const typeArgumentCount = reflector.getGenericArityOfClass(clazz) || 0;
22479
22496
  if (decorator.args === null) {
22480
22497
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_NOT_CALLED, decorator.node, "@Injectable must be called");
@@ -22676,7 +22693,7 @@ var PipeDecoratorHandler = class {
22676
22693
  analyze(clazz, decorator) {
22677
22694
  this.perf.eventCount(PerfEvent.AnalyzePipe);
22678
22695
  const name = clazz.name.text;
22679
- const type = wrapTypeReference(this.reflector, clazz);
22696
+ const type = wrapTypeReference(clazz);
22680
22697
  if (decorator.args === null) {
22681
22698
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_NOT_CALLED, decorator.node, `@Pipe must be called`);
22682
22699
  }
package/bundles/index.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  isTsDiagnostic,
18
18
  performCompilation,
19
19
  readConfiguration
20
- } from "./chunk-AWHYBEL3.js";
20
+ } from "./chunk-RBFYX33W.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-S44BUT6J.js";
37
+ } from "./chunk-REXDVAT6.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-TOPNFXNB.js";
49
+ } from "./chunk-TAXP3SCS.js";
50
50
  import "./chunk-CSUVPNMK.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.2.0-next.1");
80
+ var VERSION = new Version("21.2.0-next.3");
81
81
 
82
82
  // packages/compiler-cli/private/tooling.js
83
83
  var GLOBAL_DEFS_FOR_TERSER = {
@@ -8,7 +8,7 @@ import {
8
8
  LinkerEnvironment,
9
9
  assert,
10
10
  isFatalLinkerError
11
- } from "../../chunk-IGJURDT5.js";
11
+ } from "../../chunk-FLWAEX6T.js";
12
12
  import {
13
13
  ConsoleLogger,
14
14
  LogLevel
@@ -10,7 +10,7 @@ import {
10
10
  assert,
11
11
  isFatalLinkerError,
12
12
  needsLinking
13
- } from "../chunk-IGJURDT5.js";
13
+ } from "../chunk-FLWAEX6T.js";
14
14
  import "../chunk-HYJ2H3FU.js";
15
15
  import "../chunk-CSUVPNMK.js";
16
16
  import "../chunk-G7GFT6BU.js";
@@ -5,7 +5,7 @@
5
5
  import {
6
6
  DiagnosticCategoryLabel,
7
7
  NgCompiler
8
- } from "../chunk-S44BUT6J.js";
8
+ } from "../chunk-REXDVAT6.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-TOPNFXNB.js";
35
+ } from "../chunk-TAXP3SCS.js";
36
36
  import "../chunk-CSUVPNMK.js";
37
37
  import {
38
38
  getFileSystem,
@@ -6,7 +6,7 @@ import {
6
6
  ImportedSymbolsTracker,
7
7
  TypeScriptReflectionHost,
8
8
  getInitializerApiJitTransform
9
- } from "../chunk-TOPNFXNB.js";
9
+ } from "../chunk-TAXP3SCS.js";
10
10
  import "../chunk-CSUVPNMK.js";
11
11
  import {
12
12
  InvalidFileSystem,
@@ -415,8 +415,9 @@ var FS_ALL = [FS_OS_X, FS_WINDOWS, FS_UNIX, FS_NATIVE];
415
415
  function runInEachFileSystemFn(callback) {
416
416
  FS_ALL.forEach((os2) => runInFileSystem(os2, callback, false));
417
417
  }
418
+ var counter = 0;
418
419
  function runInFileSystem(os2, callback, error) {
419
- describe(`<<FileSystem: ${os2}>>`, () => {
420
+ describe(`<<FileSystem: ${os2}>>/${counter++}`, () => {
420
421
  beforeEach(() => initMockFileSystem(os2));
421
422
  afterEach(() => setFileSystem(new InvalidFileSystem()));
422
423
  callback(os2);
@@ -4,7 +4,7 @@
4
4
 
5
5
  import {
6
6
  angularJitApplicationTransform
7
- } from "../chunk-TOPNFXNB.js";
7
+ } from "../chunk-TAXP3SCS.js";
8
8
  import "../chunk-CSUVPNMK.js";
9
9
  import "../chunk-CEBE44Q5.js";
10
10
  import "../chunk-XYYEESKY.js";
@@ -6,12 +6,12 @@
6
6
  import {
7
7
  main,
8
8
  readCommandLineAndConfiguration
9
- } from "../../chunk-NCMKPMS2.js";
9
+ } from "../../chunk-PT6VYMWK.js";
10
10
  import {
11
11
  EmitFlags
12
- } from "../../chunk-AWHYBEL3.js";
13
- import "../../chunk-S44BUT6J.js";
14
- import "../../chunk-TOPNFXNB.js";
12
+ } from "../../chunk-RBFYX33W.js";
13
+ import "../../chunk-REXDVAT6.js";
14
+ import "../../chunk-TAXP3SCS.js";
15
15
  import "../../chunk-CSUVPNMK.js";
16
16
  import {
17
17
  setFileSystem
@@ -5,10 +5,10 @@
5
5
 
6
6
  import {
7
7
  main
8
- } from "../../chunk-NCMKPMS2.js";
9
- import "../../chunk-AWHYBEL3.js";
10
- import "../../chunk-S44BUT6J.js";
11
- import "../../chunk-TOPNFXNB.js";
8
+ } from "../../chunk-PT6VYMWK.js";
9
+ import "../../chunk-RBFYX33W.js";
10
+ import "../../chunk-REXDVAT6.js";
11
+ import "../../chunk-TAXP3SCS.js";
12
12
  import "../../chunk-CSUVPNMK.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.2.0-next.1";
10
+ export declare const PLACEHOLDER_VERSION = "21.2.0-next.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": "21.2.0-next.1",
3
+ "version": "21.2.0-next.3",
4
4
  "description": "Angular - the compiler CLI for Node.js",
5
5
  "typings": "index.d.ts",
6
6
  "bin": {
@@ -30,7 +30,7 @@
30
30
  }
31
31
  },
32
32
  "dependencies": {
33
- "@babel/core": "7.28.6",
33
+ "@babel/core": "7.29.0",
34
34
  "@jridgewell/sourcemap-codec": "^1.4.14",
35
35
  "reflect-metadata": "^0.2.0",
36
36
  "chokidar": "^5.0.0",
@@ -43,7 +43,7 @@
43
43
  "typescript": "5.9.3"
44
44
  },
45
45
  "peerDependencies": {
46
- "@angular/compiler": "21.2.0-next.1",
46
+ "@angular/compiler": "21.2.0-next.3",
47
47
  "typescript": ">=5.9 <6.0"
48
48
  },
49
49
  "peerDependenciesMeta": {
@@ -104,7 +104,7 @@ export declare function resolveProvidersRequiringFactory(rawProviders: ts.Expres
104
104
  * The `value` is the exported declaration of the class from its source file.
105
105
  * The `type` is an expression that would be used in the typings (.d.ts) files.
106
106
  */
107
- export declare function wrapTypeReference(reflector: ReflectionHost, clazz: ClassDeclaration): R3Reference;
107
+ export declare function wrapTypeReference(clazz: ClassDeclaration): R3Reference;
108
108
  /** Creates a ParseSourceSpan for a TypeScript node. */
109
109
  export declare function createSourceSpan(node: ts.Node): ParseSourceSpan;
110
110
  /**