@angular/core 19.1.0-next.2 → 19.1.0-next.4

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.
Files changed (33) hide show
  1. package/fesm2022/core.mjs +511 -109
  2. package/fesm2022/core.mjs.map +1 -1
  3. package/fesm2022/primitives/event-dispatch.mjs +1 -1
  4. package/fesm2022/primitives/signals.mjs +1 -1
  5. package/fesm2022/rxjs-interop.mjs +1 -1
  6. package/fesm2022/testing.mjs +6 -6
  7. package/fesm2022/testing.mjs.map +1 -1
  8. package/index.d.ts +232 -27
  9. package/package.json +1 -1
  10. package/primitives/event-dispatch/index.d.ts +1 -1
  11. package/primitives/signals/index.d.ts +1 -1
  12. package/rxjs-interop/index.d.ts +1 -1
  13. package/schematics/bundles/{checker-c58f97d2.js → checker-884633eb.js} +158 -31
  14. package/schematics/bundles/{combine_units-8b29b7f6.js → combine_units-4a95b1b9.js} +3 -3
  15. package/schematics/bundles/{compiler_host-f5d588fe.js → compiler_host-22f6513d.js} +2 -2
  16. package/schematics/bundles/control-flow-migration.js +3 -3
  17. package/schematics/bundles/explicit-standalone-flag.js +5 -5
  18. package/schematics/bundles/{imports-31a38653.js → imports-abe29092.js} +1 -1
  19. package/schematics/bundles/inject-migration.js +6 -6
  20. package/schematics/bundles/{leading_space-6e7a8ec6.js → leading_space-d190b83b.js} +1 -1
  21. package/schematics/bundles/{migrate_ts_type_references-a8676ec1.js → migrate_ts_type_references-4b11f3f2.js} +5 -5
  22. package/schematics/bundles/{nodes-88c2157f.js → nodes-a9f0b985.js} +2 -2
  23. package/schematics/bundles/output-migration.js +5 -5
  24. package/schematics/bundles/pending-tasks.js +5 -5
  25. package/schematics/bundles/{program-30e02255.js → program-094352ba.js} +30 -23
  26. package/schematics/bundles/{project_tsconfig_paths-6c9cde78.js → project_tsconfig_paths-e9ccccbf.js} +1 -1
  27. package/schematics/bundles/provide-initializer.js +5 -5
  28. package/schematics/bundles/route-lazy-loading.js +4 -4
  29. package/schematics/bundles/signal-input-migration.js +7 -7
  30. package/schematics/bundles/signal-queries-migration.js +7 -7
  31. package/schematics/bundles/signals.js +7 -7
  32. package/schematics/bundles/standalone-migration.js +8 -8
  33. package/testing/index.d.ts +1 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v19.1.0-next.2
3
+ * @license Angular v19.1.0-next.4
4
4
  * (c) 2010-2024 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -2897,6 +2897,10 @@ class Identifiers {
2897
2897
  static declareLet = { name: 'ɵɵdeclareLet', moduleName: CORE };
2898
2898
  static storeLet = { name: 'ɵɵstoreLet', moduleName: CORE };
2899
2899
  static readContextLet = { name: 'ɵɵreadContextLet', moduleName: CORE };
2900
+ static attachSourceLocations = {
2901
+ name: 'ɵɵattachSourceLocations',
2902
+ moduleName: CORE,
2903
+ };
2900
2904
  static NgOnChangesFeature = { name: 'ɵɵNgOnChangesFeature', moduleName: CORE };
2901
2905
  static InheritDefinitionFeature = {
2902
2906
  name: 'ɵɵInheritDefinitionFeature',
@@ -8507,6 +8511,10 @@ var OpKind;
8507
8511
  * A creation op that corresponds to i18n attributes on an element.
8508
8512
  */
8509
8513
  OpKind[OpKind["I18nAttributes"] = 49] = "I18nAttributes";
8514
+ /**
8515
+ * Creation op that attaches the location at which an element was defined in a template to it.
8516
+ */
8517
+ OpKind[OpKind["SourceLocation"] = 50] = "SourceLocation";
8510
8518
  })(OpKind || (OpKind = {}));
8511
8519
  /**
8512
8520
  * Distinguishes different kinds of IR expressions.
@@ -10048,6 +10056,7 @@ function transformExpressionsInOp(op, transform, flags) {
10048
10056
  case OpKind.I18nAttributes:
10049
10057
  case OpKind.IcuPlaceholder:
10050
10058
  case OpKind.DeclareLet:
10059
+ case OpKind.SourceLocation:
10051
10060
  // These operations contain no expressions.
10052
10061
  break;
10053
10062
  default:
@@ -10835,6 +10844,15 @@ function createI18nAttributesOp(xref, handle, target) {
10835
10844
  ...TRAIT_CONSUMES_SLOT,
10836
10845
  };
10837
10846
  }
10847
+ /** Create a `SourceLocationOp`. */
10848
+ function createSourceLocationOp(templatePath, locations) {
10849
+ return {
10850
+ kind: OpKind.SourceLocation,
10851
+ templatePath,
10852
+ locations,
10853
+ ...NEW_OP,
10854
+ };
10855
+ }
10838
10856
 
10839
10857
  function createHostPropertyOp(name, expression, isAnimationTrigger, i18nContext, securityContext, sourceSpan) {
10840
10858
  return {
@@ -10897,12 +10915,16 @@ class ComponentCompilationJob extends CompilationJob {
10897
10915
  i18nUseExternalIds;
10898
10916
  deferMeta;
10899
10917
  allDeferrableDepsFn;
10900
- constructor(componentName, pool, compatibility, relativeContextFilePath, i18nUseExternalIds, deferMeta, allDeferrableDepsFn) {
10918
+ relativeTemplatePath;
10919
+ enableDebugLocations;
10920
+ constructor(componentName, pool, compatibility, relativeContextFilePath, i18nUseExternalIds, deferMeta, allDeferrableDepsFn, relativeTemplatePath, enableDebugLocations) {
10901
10921
  super(componentName, pool, compatibility);
10902
10922
  this.relativeContextFilePath = relativeContextFilePath;
10903
10923
  this.i18nUseExternalIds = i18nUseExternalIds;
10904
10924
  this.deferMeta = deferMeta;
10905
10925
  this.allDeferrableDepsFn = allDeferrableDepsFn;
10926
+ this.relativeTemplatePath = relativeTemplatePath;
10927
+ this.enableDebugLocations = enableDebugLocations;
10906
10928
  this.root = new ViewCompilationUnit(this, this.allocateXrefId(), null);
10907
10929
  this.views.set(this.root.xref, this.root);
10908
10930
  }
@@ -22393,6 +22415,9 @@ function syntheticHostProperty(name, expression, sourceSpan) {
22393
22415
  function pureFunction(varOffset, fn, args) {
22394
22416
  return callVariadicInstructionExpr(PURE_FUNCTION_CONFIG, [literal$1(varOffset), fn], args, [], null);
22395
22417
  }
22418
+ function attachSourceLocation(templatePath, locations) {
22419
+ return call(Identifiers.attachSourceLocations, [literal$1(templatePath), locations], null);
22420
+ }
22396
22421
  /**
22397
22422
  * Collates the string an expression arguments for an interpolation instruction.
22398
22423
  */
@@ -22807,6 +22832,20 @@ function reifyCreateOperations(unit, ops) {
22807
22832
  }
22808
22833
  OpList.replace(op, repeaterCreate(op.handle.slot, repeaterView.fnName, op.decls, op.vars, op.tag, op.attributes, op.trackByFn, op.usesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, op.emptyTag, op.emptyAttributes, op.wholeSourceSpan));
22809
22834
  break;
22835
+ case OpKind.SourceLocation:
22836
+ const locationsLiteral = literalArr(op.locations.map(({ targetSlot, offset, line, column }) => {
22837
+ if (targetSlot.slot === null) {
22838
+ throw new Error('No slot was assigned for source location');
22839
+ }
22840
+ return literalArr([
22841
+ literal$1(targetSlot.slot),
22842
+ literal$1(offset),
22843
+ literal$1(line),
22844
+ literal$1(column),
22845
+ ]);
22846
+ }));
22847
+ OpList.replace(op, attachSourceLocation(op.templatePath, locationsLiteral));
22848
+ break;
22810
22849
  case OpKind.Statement:
22811
22850
  // Pass statement operations directly through.
22812
22851
  break;
@@ -24766,6 +24805,33 @@ function generateLocalLetReferences(job) {
24766
24805
  }
24767
24806
  }
24768
24807
 
24808
+ /**
24809
+ * Locates all of the elements defined in a creation block and outputs an op
24810
+ * that will expose their definition location in the DOM.
24811
+ */
24812
+ function attachSourceLocations(job) {
24813
+ if (!job.enableDebugLocations || job.relativeTemplatePath === null) {
24814
+ return;
24815
+ }
24816
+ for (const unit of job.units) {
24817
+ const locations = [];
24818
+ for (const op of unit.create) {
24819
+ if (op.kind === OpKind.ElementStart || op.kind === OpKind.Element) {
24820
+ const start = op.startSourceSpan.start;
24821
+ locations.push({
24822
+ targetSlot: op.handle,
24823
+ offset: start.offset,
24824
+ line: start.line,
24825
+ column: start.col,
24826
+ });
24827
+ }
24828
+ }
24829
+ if (locations.length > 0) {
24830
+ unit.create.push(createSourceLocationOp(job.relativeTemplatePath, locations));
24831
+ }
24832
+ }
24833
+ }
24834
+
24769
24835
  /**
24770
24836
  *
24771
24837
  * @license
@@ -24835,6 +24901,7 @@ const phases = [
24835
24901
  { kind: CompilationJobKind.Tmpl, fn: mergeNextContextExpressions },
24836
24902
  { kind: CompilationJobKind.Tmpl, fn: generateNgContainerOps },
24837
24903
  { kind: CompilationJobKind.Tmpl, fn: collapseEmptyInstructions },
24904
+ { kind: CompilationJobKind.Tmpl, fn: attachSourceLocations },
24838
24905
  { kind: CompilationJobKind.Tmpl, fn: disableBindings$1 },
24839
24906
  { kind: CompilationJobKind.Both, fn: extractPureFunctions },
24840
24907
  { kind: CompilationJobKind.Both, fn: reify },
@@ -24953,8 +25020,8 @@ function isSingleI18nIcu(meta) {
24953
25020
  * representation.
24954
25021
  * TODO: Refactor more of the ingestion code into phases.
24955
25022
  */
24956
- function ingestComponent(componentName, template, constantPool, relativeContextFilePath, i18nUseExternalIds, deferMeta, allDeferrableDepsFn) {
24957
- const job = new ComponentCompilationJob(componentName, constantPool, compatibilityMode, relativeContextFilePath, i18nUseExternalIds, deferMeta, allDeferrableDepsFn);
25023
+ function ingestComponent(componentName, template, constantPool, relativeContextFilePath, i18nUseExternalIds, deferMeta, allDeferrableDepsFn, relativeTemplatePath, enableDebugLocations) {
25024
+ const job = new ComponentCompilationJob(componentName, constantPool, compatibilityMode, relativeContextFilePath, i18nUseExternalIds, deferMeta, allDeferrableDepsFn, relativeTemplatePath, enableDebugLocations);
24958
25025
  ingestNodes(job.root, template);
24959
25026
  return job;
24960
25027
  }
@@ -25978,6 +26045,26 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
25978
26045
  return null;
25979
26046
  }
25980
26047
 
26048
+ /*!
26049
+ * @license
26050
+ * Copyright Google LLC All Rights Reserved.
26051
+ *
26052
+ * Use of this source code is governed by an MIT-style license that can be
26053
+ * found in the LICENSE file at https://angular.dev/license
26054
+ */
26055
+ /**
26056
+ * Whether to produce instructions that will attach the source location to each DOM node.
26057
+ *
26058
+ * !!!Important!!! at the time of writing this flag isn't exposed externally, but internal debug
26059
+ * tools enable it via a local change. Any modifications to this flag need to update the
26060
+ * internal tooling as well.
26061
+ */
26062
+ let ENABLE_TEMPLATE_SOURCE_LOCATIONS = false;
26063
+ /** Gets whether template source locations are enabled. */
26064
+ function getTemplateSourceLocationsEnabled() {
26065
+ return ENABLE_TEMPLATE_SOURCE_LOCATIONS;
26066
+ }
26067
+
25981
26068
  // if (rf & flags) { .. }
25982
26069
  function renderFlagCheckIfStmt(flags, statements) {
25983
26070
  return ifStmt(variable(RENDER_FLAGS).bitwiseAnd(literal$1(flags), null, false), statements);
@@ -28412,7 +28499,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
28412
28499
  allDeferrableDepsFn = variable(fnName);
28413
28500
  }
28414
28501
  // First the template is ingested into IR:
28415
- const tpl = ingestComponent(meta.name, meta.template.nodes, constantPool, meta.relativeContextFilePath, meta.i18nUseExternalIds, meta.defer, allDeferrableDepsFn);
28502
+ const tpl = ingestComponent(meta.name, meta.template.nodes, constantPool, meta.relativeContextFilePath, meta.i18nUseExternalIds, meta.defer, allDeferrableDepsFn, meta.relativeTemplatePath, getTemplateSourceLocationsEnabled());
28416
28503
  // Then the IR is transformed to prepare it for cod egeneration.
28417
28504
  transform(tpl, CompilationJobKind.Tmpl);
28418
28505
  // Finally we emit the template function:
@@ -29791,6 +29878,7 @@ class CompilerFacadeImpl {
29791
29878
  viewProviders: facade.viewProviders != null ? new WrappedNodeExpr(facade.viewProviders) : null,
29792
29879
  relativeContextFilePath: '',
29793
29880
  i18nUseExternalIds: true,
29881
+ relativeTemplatePath: null,
29794
29882
  };
29795
29883
  const jitExpressionSourceMap = `ng:///${facade.name}.js`;
29796
29884
  return this.compileComponentFromMeta(angularCoreEnv, jitExpressionSourceMap, meta);
@@ -30046,6 +30134,7 @@ function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMap
30046
30134
  declarationListEmitMode: 2 /* DeclarationListEmitMode.ClosureResolved */,
30047
30135
  relativeContextFilePath: '',
30048
30136
  i18nUseExternalIds: true,
30137
+ relativeTemplatePath: null,
30049
30138
  };
30050
30139
  }
30051
30140
  function convertDeclarationFacadeToMetadata(declaration) {
@@ -30321,7 +30410,7 @@ function publishFacade(global) {
30321
30410
  * @description
30322
30411
  * Entry point for all public APIs of the compiler package.
30323
30412
  */
30324
- new Version('19.1.0-next.2');
30413
+ new Version('19.1.0-next.4');
30325
30414
 
30326
30415
  const _I18N_ATTR = 'i18n';
30327
30416
  const _I18N_ATTR_PREFIX = 'i18n-';
@@ -31729,7 +31818,7 @@ class NodeJSPathManipulation {
31729
31818
  // G3-ESM-MARKER: G3 uses CommonJS, but externally everything in ESM.
31730
31819
  // CommonJS/ESM interop for determining the current file name and containing dir.
31731
31820
  const isCommonJS = typeof __filename !== 'undefined';
31732
- const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT' && document.currentScript.src || new URL('checker-c58f97d2.js', document.baseURI).href));
31821
+ const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT' && document.currentScript.src || new URL('checker-884633eb.js', document.baseURI).href));
31733
31822
  const currentFileName = isCommonJS ? __filename : url.fileURLToPath(currentFileUrl);
31734
31823
  /**
31735
31824
  * A wrapper around the Node.js file-system that supports readonly operations and path manipulation.
@@ -33226,6 +33315,13 @@ class TypeScriptReflectionHost {
33226
33315
  }
33227
33316
  }
33228
33317
  class TypeEntityToDeclarationError extends Error {
33318
+ constructor(message) {
33319
+ super(message);
33320
+ // Extending `Error` ends up breaking some internal tests. This appears to be a known issue
33321
+ // when extending errors in TS and the workaround is to explicitly set the prototype.
33322
+ // https://stackoverflow.com/questions/41102060/typescript-extending-error-class
33323
+ Object.setPrototypeOf(this, new.target.prototype);
33324
+ }
33229
33325
  }
33230
33326
  /**
33231
33327
  * @throws {TypeEntityToDeclarationError} if the type cannot be converted
@@ -38423,7 +38519,7 @@ class Chunk {
38423
38519
  // ' test'.trim()
38424
38520
  // split -> ' ' + 'test'
38425
38521
  // ✔️ edit -> '' + 'test'
38426
- // ✖️ edit -> 'test' + ''
38522
+ // ✖️ edit -> 'test' + ''
38427
38523
  // TODO is this block necessary?...
38428
38524
  newChunk.edit('', false);
38429
38525
  this.content = '';
@@ -38670,6 +38766,7 @@ class Mappings {
38670
38766
  this.raw[this.generatedCodeLine] = this.rawSegments = [];
38671
38767
  this.generatedCodeColumn = 0;
38672
38768
  first = true;
38769
+ charInHiresBoundary = false;
38673
38770
  } else {
38674
38771
  if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
38675
38772
  const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
@@ -38747,6 +38844,7 @@ class MagicString {
38747
38844
  storedNames: { writable: true, value: {} },
38748
38845
  indentStr: { writable: true, value: undefined },
38749
38846
  ignoreList: { writable: true, value: options.ignoreList },
38847
+ offset: { writable: true, value: options.offset || 0 },
38750
38848
  });
38751
38849
 
38752
38850
  this.byStart[0] = chunk;
@@ -38765,6 +38863,8 @@ class MagicString {
38765
38863
  }
38766
38864
 
38767
38865
  appendLeft(index, content) {
38866
+ index = index + this.offset;
38867
+
38768
38868
  if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
38769
38869
 
38770
38870
  this._split(index);
@@ -38780,6 +38880,8 @@ class MagicString {
38780
38880
  }
38781
38881
 
38782
38882
  appendRight(index, content) {
38883
+ index = index + this.offset;
38884
+
38783
38885
  if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
38784
38886
 
38785
38887
  this._split(index);
@@ -38795,7 +38897,7 @@ class MagicString {
38795
38897
  }
38796
38898
 
38797
38899
  clone() {
38798
- const cloned = new MagicString(this.original, { filename: this.filename });
38900
+ const cloned = new MagicString(this.original, { filename: this.filename, offset: this.offset });
38799
38901
 
38800
38902
  let originalChunk = this.firstChunk;
38801
38903
  let clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone());
@@ -38993,7 +39095,7 @@ class MagicString {
38993
39095
  if (!warned.insertLeft) {
38994
39096
  console.warn(
38995
39097
  'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead',
38996
- ); // eslint-disable-line no-console
39098
+ );
38997
39099
  warned.insertLeft = true;
38998
39100
  }
38999
39101
 
@@ -39004,7 +39106,7 @@ class MagicString {
39004
39106
  if (!warned.insertRight) {
39005
39107
  console.warn(
39006
39108
  'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead',
39007
- ); // eslint-disable-line no-console
39109
+ );
39008
39110
  warned.insertRight = true;
39009
39111
  }
39010
39112
 
@@ -39012,6 +39114,10 @@ class MagicString {
39012
39114
  }
39013
39115
 
39014
39116
  move(start, end, index) {
39117
+ start = start + this.offset;
39118
+ end = end + this.offset;
39119
+ index = index + this.offset;
39120
+
39015
39121
  if (index >= start && index <= end) throw new Error('Cannot move a selection inside itself');
39016
39122
 
39017
39123
  this._split(start);
@@ -39054,6 +39160,9 @@ class MagicString {
39054
39160
  }
39055
39161
 
39056
39162
  update(start, end, content, options) {
39163
+ start = start + this.offset;
39164
+ end = end + this.offset;
39165
+
39057
39166
  if (typeof content !== 'string') throw new TypeError('replacement content must be a string');
39058
39167
 
39059
39168
  if (this.original.length !== 0) {
@@ -39074,7 +39183,7 @@ class MagicString {
39074
39183
  if (!warned.storeName) {
39075
39184
  console.warn(
39076
39185
  'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string',
39077
- ); // eslint-disable-line no-console
39186
+ );
39078
39187
  warned.storeName = true;
39079
39188
  }
39080
39189
 
@@ -39125,6 +39234,8 @@ class MagicString {
39125
39234
  }
39126
39235
 
39127
39236
  prependLeft(index, content) {
39237
+ index = index + this.offset;
39238
+
39128
39239
  if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
39129
39240
 
39130
39241
  this._split(index);
@@ -39140,6 +39251,8 @@ class MagicString {
39140
39251
  }
39141
39252
 
39142
39253
  prependRight(index, content) {
39254
+ index = index + this.offset;
39255
+
39143
39256
  if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
39144
39257
 
39145
39258
  this._split(index);
@@ -39155,6 +39268,9 @@ class MagicString {
39155
39268
  }
39156
39269
 
39157
39270
  remove(start, end) {
39271
+ start = start + this.offset;
39272
+ end = end + this.offset;
39273
+
39158
39274
  if (this.original.length !== 0) {
39159
39275
  while (start < 0) start += this.original.length;
39160
39276
  while (end < 0) end += this.original.length;
@@ -39181,6 +39297,9 @@ class MagicString {
39181
39297
  }
39182
39298
 
39183
39299
  reset(start, end) {
39300
+ start = start + this.offset;
39301
+ end = end + this.offset;
39302
+
39184
39303
  if (this.original.length !== 0) {
39185
39304
  while (start < 0) start += this.original.length;
39186
39305
  while (end < 0) end += this.original.length;
@@ -39245,7 +39364,10 @@ class MagicString {
39245
39364
  return this.intro + lineStr;
39246
39365
  }
39247
39366
 
39248
- slice(start = 0, end = this.original.length) {
39367
+ slice(start = 0, end = this.original.length - this.offset) {
39368
+ start = start + this.offset;
39369
+ end = end + this.offset;
39370
+
39249
39371
  if (this.original.length !== 0) {
39250
39372
  while (start < 0) start += this.original.length;
39251
39373
  while (end < 0) end += this.original.length;
@@ -39481,11 +39603,7 @@ class MagicString {
39481
39603
  if (match.index != null) {
39482
39604
  const replacement = getReplacement(match, this.original);
39483
39605
  if (replacement !== match[0]) {
39484
- this.overwrite(
39485
- match.index,
39486
- match.index + match[0].length,
39487
- replacement
39488
- );
39606
+ this.overwrite(match.index, match.index + match[0].length, replacement);
39489
39607
  }
39490
39608
  }
39491
39609
  });
@@ -39494,11 +39612,7 @@ class MagicString {
39494
39612
  if (match && match.index != null) {
39495
39613
  const replacement = getReplacement(match, this.original);
39496
39614
  if (replacement !== match[0]) {
39497
- this.overwrite(
39498
- match.index,
39499
- match.index + match[0].length,
39500
- replacement
39501
- );
39615
+ this.overwrite(match.index, match.index + match[0].length, replacement);
39502
39616
  }
39503
39617
  }
39504
39618
  }
@@ -39533,8 +39647,7 @@ class MagicString {
39533
39647
  index = original.indexOf(string, index + stringLength)
39534
39648
  ) {
39535
39649
  const previous = original.slice(index, index + stringLength);
39536
- if (previous !== replacement)
39537
- this.overwrite(index, index + stringLength, replacement);
39650
+ if (previous !== replacement) this.overwrite(index, index + stringLength, replacement);
39538
39651
  }
39539
39652
 
39540
39653
  return this;
@@ -42255,7 +42368,7 @@ class TcbDirectiveOutputsOp extends TcbOp {
42255
42368
  }
42256
42369
  if (this.tcb.env.config.checkTypeOfOutputEvents && output.name.endsWith('Change')) {
42257
42370
  const inputName = output.name.slice(0, -6);
42258
- isSplitTwoWayBinding(inputName, output, this.node.inputs, this.tcb);
42371
+ checkSplitTwoWayBinding(inputName, output, this.node.inputs, this.tcb);
42259
42372
  }
42260
42373
  // TODO(alxhub): consider supporting multiple fields with the same property name for outputs.
42261
42374
  const field = outputs.getByBindingPropertyName(output.name)[0].classPropertyName;
@@ -42323,7 +42436,7 @@ class TcbUnclaimedOutputsOp extends TcbOp {
42323
42436
  }
42324
42437
  if (this.tcb.env.config.checkTypeOfOutputEvents && output.name.endsWith('Change')) {
42325
42438
  const inputName = output.name.slice(0, -6);
42326
- if (isSplitTwoWayBinding(inputName, output, this.element.inputs, this.tcb)) {
42439
+ if (checkSplitTwoWayBinding(inputName, output, this.element.inputs, this.tcb)) {
42327
42440
  // Skip this event handler as the error was already handled.
42328
42441
  continue;
42329
42442
  }
@@ -43611,6 +43724,20 @@ const EVENT_PARAMETER = '$event';
43611
43724
  */
43612
43725
  function tcbCreateEventHandler(event, tcb, scope, eventType) {
43613
43726
  const handler = tcbEventHandlerExpression(event.handler, tcb, scope);
43727
+ const statements = [];
43728
+ // TODO(crisbeto): remove the `checkTwoWayBoundEvents` check in v20.
43729
+ if (event.type === exports.ParsedEventType.TwoWay && tcb.env.config.checkTwoWayBoundEvents) {
43730
+ // If we're dealing with a two-way event, we create a variable initialized to the unwrapped
43731
+ // signal value of the expression and then we assign `$event` to it. Note that in most cases
43732
+ // this will already be covered by the corresponding input binding, however it allows us to
43733
+ // handle the case where the input has a wider type than the output (see #58971).
43734
+ const target = tcb.allocateId();
43735
+ const assignment = ts__default["default"].factory.createBinaryExpression(target, ts__default["default"].SyntaxKind.EqualsToken, ts__default["default"].factory.createIdentifier(EVENT_PARAMETER));
43736
+ statements.push(tsCreateVariable(target, tcb.env.config.allowSignalsInTwoWayBindings ? unwrapWritableSignal(handler, tcb) : handler), ts__default["default"].factory.createExpressionStatement(assignment));
43737
+ }
43738
+ else {
43739
+ statements.push(ts__default["default"].factory.createExpressionStatement(handler));
43740
+ }
43614
43741
  let eventParamType;
43615
43742
  if (eventType === 0 /* EventParamType.Infer */) {
43616
43743
  eventParamType = undefined;
@@ -43624,10 +43751,10 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
43624
43751
  // Obtain all guards that have been applied to the scope and its parents, as they have to be
43625
43752
  // repeated within the handler function for their narrowing to be in effect within the handler.
43626
43753
  const guards = scope.guards();
43627
- let body = ts__default["default"].factory.createExpressionStatement(handler);
43754
+ let body = ts__default["default"].factory.createBlock(statements);
43628
43755
  if (guards !== null) {
43629
43756
  // Wrap the body in an `if` statement containing all guards that have to be applied.
43630
- body = ts__default["default"].factory.createIfStatement(guards, body);
43757
+ body = ts__default["default"].factory.createBlock([ts__default["default"].factory.createIfStatement(guards, body)]);
43631
43758
  }
43632
43759
  const eventParam = ts__default["default"].factory.createParameterDeclaration(
43633
43760
  /* modifiers */ undefined,
@@ -43643,7 +43770,7 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
43643
43770
  /* parameters */ [eventParam],
43644
43771
  /* type */ ts__default["default"].factory.createKeywordTypeNode(ts__default["default"].SyntaxKind.AnyKeyword),
43645
43772
  /* equalsGreaterThanToken */ undefined,
43646
- /* body */ ts__default["default"].factory.createBlock([body]));
43773
+ /* body */ body);
43647
43774
  }
43648
43775
  /**
43649
43776
  * Similar to `tcbExpression`, this function converts the provided `AST` expression into a
@@ -43654,7 +43781,7 @@ function tcbEventHandlerExpression(ast, tcb, scope) {
43654
43781
  const translator = new TcbEventHandlerTranslator(tcb, scope);
43655
43782
  return translator.translate(ast);
43656
43783
  }
43657
- function isSplitTwoWayBinding(inputName, output, inputs, tcb) {
43784
+ function checkSplitTwoWayBinding(inputName, output, inputs, tcb) {
43658
43785
  const input = inputs.find((input) => input.name === inputName);
43659
43786
  if (input === undefined || input.sourceSpan !== output.sourceSpan) {
43660
43787
  return false;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v19.1.0-next.2
3
+ * @license Angular v19.1.0-next.4
4
4
  * (c) 2010-2024 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -10,8 +10,8 @@ var core = require('@angular-devkit/core');
10
10
  var posixPath = require('node:path/posix');
11
11
  var os = require('os');
12
12
  var ts = require('typescript');
13
- var checker = require('./checker-c58f97d2.js');
14
- var program = require('./program-30e02255.js');
13
+ var checker = require('./checker-884633eb.js');
14
+ var program = require('./program-094352ba.js');
15
15
  require('path');
16
16
 
17
17
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v19.1.0-next.2
3
+ * @license Angular v19.1.0-next.4
4
4
  * (c) 2010-2024 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
7
7
  'use strict';
8
8
 
9
9
  var ts = require('typescript');
10
- var checker = require('./checker-c58f97d2.js');
10
+ var checker = require('./checker-884633eb.js');
11
11
  require('os');
12
12
  var p = require('path');
13
13
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v19.1.0-next.2
3
+ * @license Angular v19.1.0-next.4
4
4
  * (c) 2010-2024 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -10,8 +10,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
10
10
 
11
11
  var schematics = require('@angular-devkit/schematics');
12
12
  var p = require('path');
13
- var compiler_host = require('./compiler_host-f5d588fe.js');
14
- var checker = require('./checker-c58f97d2.js');
13
+ var compiler_host = require('./compiler_host-22f6513d.js');
14
+ var checker = require('./checker-884633eb.js');
15
15
  var ts = require('typescript');
16
16
  require('os');
17
17
  require('fs');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v19.1.0-next.2
3
+ * @license Angular v19.1.0-next.4
4
4
  * (c) 2010-2024 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -10,12 +10,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
10
10
 
11
11
  var schematics = require('@angular-devkit/schematics');
12
12
  var p = require('path');
13
- var project_tsconfig_paths = require('./project_tsconfig_paths-6c9cde78.js');
14
- var compiler_host = require('./compiler_host-f5d588fe.js');
13
+ var project_tsconfig_paths = require('./project_tsconfig_paths-e9ccccbf.js');
14
+ var compiler_host = require('./compiler_host-22f6513d.js');
15
15
  var ts = require('typescript');
16
- var imports = require('./imports-31a38653.js');
16
+ var imports = require('./imports-abe29092.js');
17
17
  require('@angular-devkit/core');
18
- require('./checker-c58f97d2.js');
18
+ require('./checker-884633eb.js');
19
19
  require('os');
20
20
  require('fs');
21
21
  require('module');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v19.1.0-next.2
3
+ * @license Angular v19.1.0-next.4
4
4
  * (c) 2010-2024 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v19.1.0-next.2
3
+ * @license Angular v19.1.0-next.4
4
4
  * (c) 2010-2024 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -10,12 +10,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
10
10
 
11
11
  var schematics = require('@angular-devkit/schematics');
12
12
  var p = require('path');
13
- var compiler_host = require('./compiler_host-f5d588fe.js');
13
+ var compiler_host = require('./compiler_host-22f6513d.js');
14
14
  var ts = require('typescript');
15
- var nodes = require('./nodes-88c2157f.js');
16
- var imports = require('./imports-31a38653.js');
17
- var leading_space = require('./leading_space-6e7a8ec6.js');
18
- require('./checker-c58f97d2.js');
15
+ var nodes = require('./nodes-a9f0b985.js');
16
+ var imports = require('./imports-abe29092.js');
17
+ var leading_space = require('./leading_space-d190b83b.js');
18
+ require('./checker-884633eb.js');
19
19
  require('os');
20
20
  require('fs');
21
21
  require('module');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v19.1.0-next.2
3
+ * @license Angular v19.1.0-next.4
4
4
  * (c) 2010-2024 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -1,18 +1,18 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v19.1.0-next.2
3
+ * @license Angular v19.1.0-next.4
4
4
  * (c) 2010-2024 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
7
7
  'use strict';
8
8
 
9
- var checker = require('./checker-c58f97d2.js');
9
+ var checker = require('./checker-884633eb.js');
10
10
  var ts = require('typescript');
11
11
  require('os');
12
12
  var assert = require('assert');
13
- var combine_units = require('./combine_units-8b29b7f6.js');
14
- var leading_space = require('./leading_space-6e7a8ec6.js');
15
- require('./program-30e02255.js');
13
+ var combine_units = require('./combine_units-4a95b1b9.js');
14
+ var leading_space = require('./leading_space-d190b83b.js');
15
+ require('./program-094352ba.js');
16
16
  require('path');
17
17
 
18
18
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v19.1.0-next.2
3
+ * @license Angular v19.1.0-next.4
4
4
  * (c) 2010-2024 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
7
7
  'use strict';
8
8
 
9
9
  var ts = require('typescript');
10
- var imports = require('./imports-31a38653.js');
10
+ var imports = require('./imports-abe29092.js');
11
11
 
12
12
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
13