@angular/compiler-cli 21.0.0-next.4 → 21.0.0-next.5

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.
@@ -12,7 +12,7 @@ import {
12
12
  formatDiagnostics,
13
13
  performCompilation,
14
14
  readConfiguration
15
- } from "./chunk-IMTR3556.js";
15
+ } from "./chunk-PAVVB3HR.js";
16
16
 
17
17
  // packages/compiler-cli/src/main.js
18
18
  import ts2 from "typescript";
@@ -16,7 +16,7 @@ import {
16
16
  tryParseSignalInputMapping,
17
17
  tryParseSignalModelMapping,
18
18
  tryParseSignalQueryFromInitializer
19
- } from "./chunk-YRHCC62K.js";
19
+ } from "./chunk-WXM53XCM.js";
20
20
 
21
21
  // packages/compiler-cli/src/ngtsc/transform/jit/src/downlevel_decorators_transform.js
22
22
  import ts from "typescript";
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  Context,
10
10
  ExpressionTranslatorVisitor
11
- } from "./chunk-I2BHWRAU.js";
11
+ } from "./chunk-LS5RJ5CS.js";
12
12
 
13
13
  // packages/compiler-cli/linker/src/fatal_linker_error.js
14
14
  var FatalLinkerError = class extends Error {
@@ -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.0.0-next.4";
458
+ var PLACEHOLDER_VERSION = "21.0.0-next.5";
459
459
  function wrapReference(wrapped) {
460
460
  return { value: wrapped, type: wrapped };
461
461
  }
@@ -107,6 +107,9 @@ var ExpressionTranslatorVisitor = class {
107
107
  visitLiteralExpr(ast, _context) {
108
108
  return this.setSourceMapRange(this.factory.createLiteral(ast.value), ast.sourceSpan);
109
109
  }
110
+ visitRegularExpressionLiteral(ast, context) {
111
+ return this.setSourceMapRange(this.factory.createRegularExpressionLiteral(ast.body, ast.flags), ast.sourceSpan);
112
+ }
110
113
  visitLocalizedString(ast, context) {
111
114
  const elements = [createTemplateElement(ast.serializeI18nHead())];
112
115
  const expressions = [];
@@ -4,7 +4,7 @@
4
4
 
5
5
  import {
6
6
  angularJitApplicationTransform
7
- } from "./chunk-TO7TOCP7.js";
7
+ } from "./chunk-FO6ETSOL.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-YRHCC62K.js";
95
+ } from "./chunk-WXM53XCM.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
 
@@ -5,7 +5,7 @@
5
5
  import {
6
6
  Context,
7
7
  ExpressionTranslatorVisitor
8
- } from "./chunk-I2BHWRAU.js";
8
+ } from "./chunk-LS5RJ5CS.js";
9
9
  import {
10
10
  LogicalProjectPath,
11
11
  absoluteFrom,
@@ -4046,6 +4046,9 @@ var TypeTranslatorVisitor = class {
4046
4046
  visitDynamicImportExpr(ast, context) {
4047
4047
  throw new Error("Method not implemented.");
4048
4048
  }
4049
+ visitRegularExpressionLiteral(ast, context) {
4050
+ throw new Error("Method not implemented.");
4051
+ }
4049
4052
  visitNotExpr(ast, context) {
4050
4053
  throw new Error("Method not implemented.");
4051
4054
  }
@@ -4341,6 +4344,9 @@ var TypeScriptAstFactory = class {
4341
4344
  ts23.factory.createVariableDeclaration(variableName, void 0, void 0, initializer ?? void 0)
4342
4345
  ], this.VAR_TYPES[type]));
4343
4346
  }
4347
+ createRegularExpressionLiteral(body, flags) {
4348
+ return ts23.factory.createRegularExpressionLiteral(`/${body}/${flags ?? ""}`);
4349
+ }
4344
4350
  setSourceMapRange(node, sourceMapRange) {
4345
4351
  if (sourceMapRange === null) {
4346
4352
  return node;
@@ -10984,7 +10990,7 @@ var CompletionEngine = class {
10984
10990
  // packages/compiler-cli/src/ngtsc/typecheck/src/context.js
10985
10991
  import { ParseSourceFile as ParseSourceFile2 } from "@angular/compiler";
10986
10992
 
10987
- // node_modules/.aspect_rules_js/magic-string@0.30.18/node_modules/magic-string/dist/magic-string.es.mjs
10993
+ // node_modules/.aspect_rules_js/magic-string@0.30.19/node_modules/magic-string/dist/magic-string.es.mjs
10988
10994
  import { encode } from "@jridgewell/sourcemap-codec";
10989
10995
  var BitSet = class _BitSet {
10990
10996
  constructor(arg) {
@@ -11434,6 +11440,9 @@ var MagicString = class _MagicString {
11434
11440
  if (chunk.outro.length)
11435
11441
  mappings.advance(chunk.outro);
11436
11442
  });
11443
+ if (this.outro) {
11444
+ mappings.advance(this.outro);
11445
+ }
11437
11446
  return {
11438
11447
  file: options.file ? options.file.split(/[/\\]/).pop() : void 0,
11439
11448
  sources: [
@@ -11996,7 +12005,12 @@ var MagicString = class _MagicString {
11996
12005
  const { original } = this;
11997
12006
  const index = original.indexOf(string);
11998
12007
  if (index !== -1) {
11999
- this.overwrite(index, index + string.length, replacement);
12008
+ if (typeof replacement === "function") {
12009
+ replacement = replacement(string, index, original);
12010
+ }
12011
+ if (string !== replacement) {
12012
+ this.overwrite(index, index + string.length, replacement);
12013
+ }
12000
12014
  }
12001
12015
  return this;
12002
12016
  }
@@ -12011,8 +12025,12 @@ var MagicString = class _MagicString {
12011
12025
  const stringLength = string.length;
12012
12026
  for (let index = original.indexOf(string); index !== -1; index = original.indexOf(string, index + stringLength)) {
12013
12027
  const previous = original.slice(index, index + stringLength);
12014
- if (previous !== replacement)
12015
- this.overwrite(index, index + stringLength, replacement);
12028
+ let _replacement = replacement;
12029
+ if (typeof replacement === "function") {
12030
+ _replacement = replacement(previous, index, original);
12031
+ }
12032
+ if (previous !== _replacement)
12033
+ this.overwrite(index, index + stringLength, _replacement);
12016
12034
  }
12017
12035
  return this;
12018
12036
  }
@@ -13303,6 +13321,9 @@ var AstTranslator = class {
13303
13321
  visitThisReceiver(ast) {
13304
13322
  throw new Error("Method not implemented.");
13305
13323
  }
13324
+ visitRegularExpressionLiteral(ast, context) {
13325
+ return wrapForTypeChecker(ts59.factory.createRegularExpressionLiteral(`/${ast.body}/${ast.flags ?? ""}`));
13326
+ }
13306
13327
  visitInterpolation(ast) {
13307
13328
  return ast.expressions.reduce((lhs, ast2) => ts59.factory.createBinaryExpression(lhs, ts59.SyntaxKind.PlusToken, wrapForTypeChecker(this.translate(ast2))), ts59.factory.createStringLiteral(""));
13308
13329
  }
@@ -13571,6 +13592,9 @@ var VeSafeLhsInferenceBugDetector = class _VeSafeLhsInferenceBugDetector {
13571
13592
  visitParenthesizedExpression(ast, context) {
13572
13593
  return ast.expression.visit(this);
13573
13594
  }
13595
+ visitRegularExpressionLiteral(ast, context) {
13596
+ return false;
13597
+ }
13574
13598
  };
13575
13599
 
13576
13600
  // packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.js
@@ -21072,11 +21096,12 @@ var ComponentDecoratorHandler = class {
21072
21096
  for (const [_, deps] of resolution.deferPerBlockDependencies) {
21073
21097
  for (const deferBlockDep of deps) {
21074
21098
  const node = deferBlockDep.declaration.node;
21075
- const importDecl = resolution.deferrableDeclToImportDecl.get(node) ?? null;
21076
- if (importDecl !== null && this.deferredSymbolTracker.canDefer(importDecl)) {
21099
+ const importInfo = resolution.deferrableDeclToImportDecl.get(node) ?? null;
21100
+ if (importInfo !== null && this.deferredSymbolTracker.canDefer(importInfo.node)) {
21077
21101
  deferBlockDep.isDeferrable = true;
21078
- deferBlockDep.importPath = importDecl.moduleSpecifier.text;
21079
- deferBlockDep.isDefaultImport = isDefaultImport(importDecl);
21102
+ deferBlockDep.symbolName = importInfo.name;
21103
+ deferBlockDep.importPath = importInfo.from;
21104
+ deferBlockDep.isDefaultImport = isDefaultImport(importInfo.node);
21080
21105
  if (!seenDeps.has(node)) {
21081
21106
  seenDeps.add(node);
21082
21107
  deferrableTypes.push(deferBlockDep);
@@ -21219,7 +21244,7 @@ var ComponentDecoratorHandler = class {
21219
21244
  if (dirMeta === null && pipeMeta === null) {
21220
21245
  return;
21221
21246
  }
21222
- resolutionData.deferrableDeclToImportDecl.set(decl.node, imp.node);
21247
+ resolutionData.deferrableDeclToImportDecl.set(decl.node, imp);
21223
21248
  this.deferredSymbolTracker.markAsDeferrableCandidate(node, imp.node, componentClassDecl, isDeferredImport);
21224
21249
  }
21225
21250
  compileDeferBlocks(resolution) {
package/bundles/index.js CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  isTsDiagnostic,
29
29
  performCompilation,
30
30
  readConfiguration
31
- } from "./chunk-IMTR3556.js";
31
+ } from "./chunk-PAVVB3HR.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-TO7TOCP7.js";
40
+ } from "./chunk-FO6ETSOL.js";
41
41
  import {
42
42
  ActivePerfRecorder,
43
43
  ErrorCode,
@@ -46,8 +46,8 @@ import {
46
46
  TsCreateProgramDriver,
47
47
  isLocalCompilationDiagnostics,
48
48
  ngErrorCode
49
- } from "./chunk-YRHCC62K.js";
50
- import "./chunk-I2BHWRAU.js";
49
+ } from "./chunk-WXM53XCM.js";
50
+ import "./chunk-LS5RJ5CS.js";
51
51
  import {
52
52
  InvalidFileSystem,
53
53
  LogicalFileSystem,
@@ -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.0.0-next.4");
80
+ var VERSION = new Version("21.0.0-next.5");
81
81
 
82
82
  // packages/compiler-cli/private/tooling.js
83
83
  var GLOBAL_DEFS_FOR_TERSER = {
@@ -8,13 +8,13 @@ import {
8
8
  LinkerEnvironment,
9
9
  assert,
10
10
  isFatalLinkerError
11
- } from "../../chunk-BPDNYZBC.js";
11
+ } from "../../chunk-KZHANLEJ.js";
12
12
  import {
13
13
  ConsoleLogger,
14
14
  LogLevel
15
15
  } from "../../chunk-6HOSNZU5.js";
16
16
  import "../../chunk-HYJ2H3FU.js";
17
- import "../../chunk-I2BHWRAU.js";
17
+ import "../../chunk-LS5RJ5CS.js";
18
18
  import {
19
19
  NodeJSFileSystem
20
20
  } from "../../chunk-XYYEESKY.js";
@@ -163,6 +163,9 @@ var BabelAstFactory = class {
163
163
  t.variableDeclarator(t.identifier(variableName), initializer)
164
164
  ]);
165
165
  }
166
+ createRegularExpressionLiteral(body, flags) {
167
+ return t.regExpLiteral(body, flags ?? void 0);
168
+ }
166
169
  setSourceMapRange(node, sourceMapRange) {
167
170
  if (sourceMapRange === null) {
168
171
  return node;
@@ -10,9 +10,9 @@ import {
10
10
  assert,
11
11
  isFatalLinkerError,
12
12
  needsLinking
13
- } from "../chunk-BPDNYZBC.js";
13
+ } from "../chunk-KZHANLEJ.js";
14
14
  import "../chunk-HYJ2H3FU.js";
15
- import "../chunk-I2BHWRAU.js";
15
+ import "../chunk-LS5RJ5CS.js";
16
16
  import "../chunk-G7GFT6BU.js";
17
17
  export {
18
18
  DEFAULT_LINKER_OPTIONS,
@@ -13,8 +13,8 @@ import {
13
13
  TypeScriptReflectionHost,
14
14
  createForwardRefResolver,
15
15
  reflectObjectLiteral
16
- } from "../chunk-YRHCC62K.js";
17
- import "../chunk-I2BHWRAU.js";
16
+ } from "../chunk-WXM53XCM.js";
17
+ import "../chunk-LS5RJ5CS.js";
18
18
  import "../chunk-GWZQLAGK.js";
19
19
  import "../chunk-XYYEESKY.js";
20
20
  import "../chunk-G7GFT6BU.js";
@@ -4,9 +4,9 @@
4
4
 
5
5
  import {
6
6
  angularJitApplicationTransform
7
- } from "../chunk-TO7TOCP7.js";
8
- import "../chunk-YRHCC62K.js";
9
- import "../chunk-I2BHWRAU.js";
7
+ } from "../chunk-FO6ETSOL.js";
8
+ import "../chunk-WXM53XCM.js";
9
+ import "../chunk-LS5RJ5CS.js";
10
10
  import "../chunk-GWZQLAGK.js";
11
11
  import "../chunk-XYYEESKY.js";
12
12
  import "../chunk-G7GFT6BU.js";
@@ -6,13 +6,13 @@
6
6
  import {
7
7
  main,
8
8
  readCommandLineAndConfiguration
9
- } from "../../chunk-COFK26OM.js";
9
+ } from "../../chunk-4OZZORXD.js";
10
10
  import {
11
11
  EmitFlags
12
- } from "../../chunk-IMTR3556.js";
13
- import "../../chunk-TO7TOCP7.js";
14
- import "../../chunk-YRHCC62K.js";
15
- import "../../chunk-I2BHWRAU.js";
12
+ } from "../../chunk-PAVVB3HR.js";
13
+ import "../../chunk-FO6ETSOL.js";
14
+ import "../../chunk-WXM53XCM.js";
15
+ import "../../chunk-LS5RJ5CS.js";
16
16
  import {
17
17
  setFileSystem
18
18
  } from "../../chunk-GWZQLAGK.js";
@@ -5,11 +5,11 @@
5
5
 
6
6
  import {
7
7
  main
8
- } from "../../chunk-COFK26OM.js";
9
- import "../../chunk-IMTR3556.js";
10
- import "../../chunk-TO7TOCP7.js";
11
- import "../../chunk-YRHCC62K.js";
12
- import "../../chunk-I2BHWRAU.js";
8
+ } from "../../chunk-4OZZORXD.js";
9
+ import "../../chunk-PAVVB3HR.js";
10
+ import "../../chunk-FO6ETSOL.js";
11
+ import "../../chunk-WXM53XCM.js";
12
+ import "../../chunk-LS5RJ5CS.js";
13
13
  import {
14
14
  setFileSystem
15
15
  } from "../../chunk-GWZQLAGK.js";
@@ -44,5 +44,6 @@ export declare class BabelAstFactory implements AstFactory<t.Statement, t.Expres
44
44
  createVoidExpression(expression: t.Expression): t.Expression;
45
45
  createUnaryExpression: typeof t.unaryExpression;
46
46
  createVariableDeclaration(variableName: string, initializer: t.Expression | null, type: VariableDeclarationType): t.Statement;
47
+ createRegularExpressionLiteral(body: string, flags: string | null): t.Expression;
47
48
  setSourceMapRange<T extends t.Statement | t.Expression | t.TemplateElement>(node: T, sourceMapRange: SourceMapRange | null): T;
48
49
  }
@@ -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.0.0-next.4";
10
+ export declare const PLACEHOLDER_VERSION = "21.0.0-next.5";
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.0.0-next.4",
3
+ "version": "21.0.0-next.5",
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": "21.0.0-next.4",
51
+ "@angular/compiler": "21.0.0-next.5",
52
52
  "typescript": ">=5.9 <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.
@@ -219,6 +219,13 @@ export interface AstFactory<TStatement, TExpression> {
219
219
  * @param type whether this variable should be declared as `var`, `let` or `const`.
220
220
  */
221
221
  createVariableDeclaration(variableName: string, initializer: TExpression | null, type: VariableDeclarationType): TStatement;
222
+ /**
223
+ * Create a regular expression literal (e.g. `/\d+/g`).
224
+ *
225
+ * @param body Body of the regex.
226
+ * @param flags Flags of the regex, if any.
227
+ */
228
+ createRegularExpressionLiteral(body: string, flags: string | null): TExpression;
222
229
  /**
223
230
  * Attach a source map range to the given node.
224
231
  *
@@ -35,6 +35,7 @@ export declare class ExpressionTranslatorVisitor<TFile, TStatement, TExpression>
35
35
  visitTemplateLiteralExpr(ast: o.TemplateLiteralExpr, context: Context): TExpression;
36
36
  visitInstantiateExpr(ast: o.InstantiateExpr, context: Context): TExpression;
37
37
  visitLiteralExpr(ast: o.LiteralExpr, _context: Context): TExpression;
38
+ visitRegularExpressionLiteral(ast: o.outputAst.RegularExpressionLiteral, context: any): TExpression;
38
39
  visitLocalizedString(ast: o.LocalizedString, context: Context): TExpression;
39
40
  private createTaggedTemplateExpression;
40
41
  /**
@@ -45,6 +45,7 @@ export declare class TypeScriptAstFactory implements AstFactory<ts.Statement, ts
45
45
  createVoidExpression: (expression: ts.Expression) => ts.VoidExpression;
46
46
  createUnaryExpression(operator: UnaryOperator, operand: ts.Expression): ts.Expression;
47
47
  createVariableDeclaration(variableName: string, initializer: ts.Expression | null, type: VariableDeclarationType): ts.Statement;
48
+ createRegularExpressionLiteral(body: string, flags: string | null): ts.Expression;
48
49
  setSourceMapRange<T extends ts.Node>(node: T, sourceMapRange: SourceMapRange | null): T;
49
50
  }
50
51
  export declare function createTemplateMiddle(cooked: string, raw: string): ts.TemplateMiddle;