@angular/core 19.0.0-next.5 → 19.0.0-next.7

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 +434 -136
  2. package/fesm2022/core.mjs.map +1 -1
  3. package/fesm2022/primitives/event-dispatch.mjs +1 -1
  4. package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
  5. package/fesm2022/primitives/signals.mjs +1 -1
  6. package/fesm2022/primitives/signals.mjs.map +1 -1
  7. package/fesm2022/rxjs-interop.mjs +25 -4
  8. package/fesm2022/rxjs-interop.mjs.map +1 -1
  9. package/fesm2022/testing.mjs +12 -11
  10. package/fesm2022/testing.mjs.map +1 -1
  11. package/index.d.ts +199 -94
  12. package/package.json +1 -1
  13. package/primitives/event-dispatch/index.d.ts +1 -1
  14. package/primitives/signals/index.d.ts +1 -1
  15. package/rxjs-interop/index.d.ts +3 -1
  16. package/schematics/bundles/{compiler_host-ca7ba733.js → checker-637eee78.js} +322 -426
  17. package/schematics/bundles/compiler_host-1e62b899.js +320 -0
  18. package/schematics/bundles/control-flow-migration.js +18 -17
  19. package/schematics/bundles/explicit-standalone-flag.js +25 -18
  20. package/schematics/bundles/{imports-4ac08251.js → imports-44987700.js} +1 -1
  21. package/schematics/bundles/inject-migration.js +10 -29
  22. package/schematics/bundles/leading_space-6e7a8ec6.js +30 -0
  23. package/schematics/bundles/{nodes-0e7d45ca.js → nodes-b12e919a.js} +2 -2
  24. package/schematics/bundles/pending-tasks.js +103 -0
  25. package/schematics/bundles/program-893e3fe7.js +20819 -0
  26. package/schematics/bundles/{project_tsconfig_paths-e9ccccbf.js → project_tsconfig_paths-6c9cde78.js} +1 -1
  27. package/schematics/bundles/route-lazy-loading.js +4 -3
  28. package/schematics/bundles/signal-input-migration.js +32976 -0
  29. package/schematics/bundles/standalone-migration.js +47 -20481
  30. package/schematics/collection.json +6 -0
  31. package/schematics/migrations.json +5 -0
  32. package/schematics/ng-generate/signal-input-migration/schema.json +30 -0
  33. package/testing/index.d.ts +3 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v19.0.0-next.5
3
+ * @license Angular v19.0.0-next.7
4
4
  * (c) 2010-2024 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -8,9 +8,9 @@
8
8
 
9
9
  var ts = require('typescript');
10
10
  require('os');
11
+ var p = require('path');
11
12
  var fs$1 = require('fs');
12
13
  var module$1 = require('module');
13
- var p = require('path');
14
14
  var url = require('url');
15
15
 
16
16
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -34,8 +34,8 @@ function _interopNamespace(e) {
34
34
  }
35
35
 
36
36
  var ts__default = /*#__PURE__*/_interopDefaultLegacy(ts);
37
- var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs$1);
38
37
  var p__namespace = /*#__PURE__*/_interopNamespace(p);
38
+ var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs$1);
39
39
 
40
40
  const _SELECTOR_REGEXP = new RegExp('(\\:not\\()|' + // 1: ":not("
41
41
  '(([\\.\\#]?)[-\\w]+)|' + // 2: "tag"; 3: "."/"#";
@@ -2403,6 +2403,32 @@ class Identifiers {
2403
2403
  name: 'ɵɵdeferPrefetchOnViewport',
2404
2404
  moduleName: CORE,
2405
2405
  }; }
2406
+ static { this.deferHydrateWhen = { name: 'ɵɵdeferHydrateWhen', moduleName: CORE }; }
2407
+ static { this.deferHydrateNever = { name: 'ɵɵdeferHydrateNever', moduleName: CORE }; }
2408
+ static { this.deferHydrateOnIdle = {
2409
+ name: 'ɵɵdeferHydrateOnIdle',
2410
+ moduleName: CORE,
2411
+ }; }
2412
+ static { this.deferHydrateOnImmediate = {
2413
+ name: 'ɵɵdeferHydrateOnImmediate',
2414
+ moduleName: CORE,
2415
+ }; }
2416
+ static { this.deferHydrateOnTimer = {
2417
+ name: 'ɵɵdeferHydrateOnTimer',
2418
+ moduleName: CORE,
2419
+ }; }
2420
+ static { this.deferHydrateOnHover = {
2421
+ name: 'ɵɵdeferHydrateOnHover',
2422
+ moduleName: CORE,
2423
+ }; }
2424
+ static { this.deferHydrateOnInteraction = {
2425
+ name: 'ɵɵdeferHydrateOnInteraction',
2426
+ moduleName: CORE,
2427
+ }; }
2428
+ static { this.deferHydrateOnViewport = {
2429
+ name: 'ɵɵdeferHydrateOnViewport',
2430
+ moduleName: CORE,
2431
+ }; }
2406
2432
  static { this.deferEnableTimerScheduling = {
2407
2433
  name: 'ɵɵdeferEnableTimerScheduling',
2408
2434
  moduleName: CORE,
@@ -4323,49 +4349,52 @@ class Element$1 {
4323
4349
  }
4324
4350
  }
4325
4351
  class DeferredTrigger {
4326
- constructor(nameSpan, sourceSpan, prefetchSpan, whenOrOnSourceSpan) {
4352
+ constructor(nameSpan, sourceSpan, prefetchSpan, whenOrOnSourceSpan, hydrateSpan) {
4327
4353
  this.nameSpan = nameSpan;
4328
4354
  this.sourceSpan = sourceSpan;
4329
4355
  this.prefetchSpan = prefetchSpan;
4330
4356
  this.whenOrOnSourceSpan = whenOrOnSourceSpan;
4357
+ this.hydrateSpan = hydrateSpan;
4331
4358
  }
4332
4359
  visit(visitor) {
4333
4360
  return visitor.visitDeferredTrigger(this);
4334
4361
  }
4335
4362
  }
4336
4363
  class BoundDeferredTrigger extends DeferredTrigger {
4337
- constructor(value, sourceSpan, prefetchSpan, whenSourceSpan) {
4364
+ constructor(value, sourceSpan, prefetchSpan, whenSourceSpan, hydrateSpan) {
4338
4365
  // BoundDeferredTrigger is for 'when' triggers. These aren't really "triggers" and don't have a
4339
4366
  // nameSpan. Trigger names are the built in event triggers like hover, interaction, etc.
4340
- super(/** nameSpan */ null, sourceSpan, prefetchSpan, whenSourceSpan);
4367
+ super(/** nameSpan */ null, sourceSpan, prefetchSpan, whenSourceSpan, hydrateSpan);
4341
4368
  this.value = value;
4342
4369
  }
4343
4370
  }
4371
+ class NeverDeferredTrigger extends DeferredTrigger {
4372
+ }
4344
4373
  class IdleDeferredTrigger extends DeferredTrigger {
4345
4374
  }
4346
4375
  class ImmediateDeferredTrigger extends DeferredTrigger {
4347
4376
  }
4348
4377
  class HoverDeferredTrigger extends DeferredTrigger {
4349
- constructor(reference, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {
4350
- super(nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
4378
+ constructor(reference, nameSpan, sourceSpan, prefetchSpan, onSourceSpan, hydrateSpan) {
4379
+ super(nameSpan, sourceSpan, prefetchSpan, onSourceSpan, hydrateSpan);
4351
4380
  this.reference = reference;
4352
4381
  }
4353
4382
  }
4354
4383
  class TimerDeferredTrigger extends DeferredTrigger {
4355
- constructor(delay, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {
4356
- super(nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
4384
+ constructor(delay, nameSpan, sourceSpan, prefetchSpan, onSourceSpan, hydrateSpan) {
4385
+ super(nameSpan, sourceSpan, prefetchSpan, onSourceSpan, hydrateSpan);
4357
4386
  this.delay = delay;
4358
4387
  }
4359
4388
  }
4360
4389
  class InteractionDeferredTrigger extends DeferredTrigger {
4361
- constructor(reference, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {
4362
- super(nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
4390
+ constructor(reference, nameSpan, sourceSpan, prefetchSpan, onSourceSpan, hydrateSpan) {
4391
+ super(nameSpan, sourceSpan, prefetchSpan, onSourceSpan, hydrateSpan);
4363
4392
  this.reference = reference;
4364
4393
  }
4365
4394
  }
4366
4395
  class ViewportDeferredTrigger extends DeferredTrigger {
4367
- constructor(reference, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {
4368
- super(nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
4396
+ constructor(reference, nameSpan, sourceSpan, prefetchSpan, onSourceSpan, hydrateSpan) {
4397
+ super(nameSpan, sourceSpan, prefetchSpan, onSourceSpan, hydrateSpan);
4369
4398
  this.reference = reference;
4370
4399
  }
4371
4400
  }
@@ -4411,7 +4440,7 @@ class DeferredBlockError extends BlockNode {
4411
4440
  }
4412
4441
  }
4413
4442
  class DeferredBlock extends BlockNode {
4414
- constructor(children, triggers, prefetchTriggers, placeholder, loading, error, nameSpan, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan, i18n) {
4443
+ constructor(children, triggers, prefetchTriggers, hydrateTriggers, placeholder, loading, error, nameSpan, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan, i18n) {
4415
4444
  super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
4416
4445
  this.children = children;
4417
4446
  this.placeholder = placeholder;
@@ -4421,15 +4450,19 @@ class DeferredBlock extends BlockNode {
4421
4450
  this.i18n = i18n;
4422
4451
  this.triggers = triggers;
4423
4452
  this.prefetchTriggers = prefetchTriggers;
4453
+ this.hydrateTriggers = hydrateTriggers;
4424
4454
  // We cache the keys since we know that they won't change and we
4425
4455
  // don't want to enumarate them every time we're traversing the AST.
4426
4456
  this.definedTriggers = Object.keys(triggers);
4427
4457
  this.definedPrefetchTriggers = Object.keys(prefetchTriggers);
4458
+ this.definedHydrateTriggers = Object.keys(hydrateTriggers);
4428
4459
  }
4429
4460
  visit(visitor) {
4430
4461
  return visitor.visitDeferredBlock(this);
4431
4462
  }
4432
4463
  visitAll(visitor) {
4464
+ // Visit the hydrate triggers first to match their insertion order.
4465
+ this.visitTriggers(this.definedHydrateTriggers, this.hydrateTriggers, visitor);
4433
4466
  this.visitTriggers(this.definedTriggers, this.triggers, visitor);
4434
4467
  this.visitTriggers(this.definedPrefetchTriggers, this.prefetchTriggers, visitor);
4435
4468
  visitAll$1(visitor, this.children);
@@ -8037,6 +8070,7 @@ var DeferTriggerKind;
8037
8070
  DeferTriggerKind[DeferTriggerKind["Hover"] = 3] = "Hover";
8038
8071
  DeferTriggerKind[DeferTriggerKind["Interaction"] = 4] = "Interaction";
8039
8072
  DeferTriggerKind[DeferTriggerKind["Viewport"] = 5] = "Viewport";
8073
+ DeferTriggerKind[DeferTriggerKind["Never"] = 6] = "Never";
8040
8074
  })(DeferTriggerKind || (DeferTriggerKind = {}));
8041
8075
  /**
8042
8076
  * Kinds of i18n contexts. They can be created because of root i18n blocks, or ICUs.
@@ -8351,12 +8385,12 @@ function createRepeaterOp(repeaterCreate, targetSlot, collection, sourceSpan) {
8351
8385
  ...TRAIT_DEPENDS_ON_SLOT_CONTEXT,
8352
8386
  };
8353
8387
  }
8354
- function createDeferWhenOp(target, expr, prefetch, sourceSpan) {
8388
+ function createDeferWhenOp(target, expr, modifier, sourceSpan) {
8355
8389
  return {
8356
8390
  kind: OpKind.DeferWhen,
8357
8391
  target,
8358
8392
  expr,
8359
- prefetch,
8393
+ modifier,
8360
8394
  sourceSpan,
8361
8395
  ...NEW_OP,
8362
8396
  ...TRAIT_DEPENDS_ON_SLOT_CONTEXT,
@@ -9911,12 +9945,12 @@ function createDeferOp(xref, main, mainSlot, ownResolverFn, resolverFn, sourceSp
9911
9945
  numSlotsUsed: 2,
9912
9946
  };
9913
9947
  }
9914
- function createDeferOnOp(defer, trigger, prefetch, sourceSpan) {
9948
+ function createDeferOnOp(defer, trigger, modifier, sourceSpan) {
9915
9949
  return {
9916
9950
  kind: OpKind.DeferOn,
9917
9951
  defer,
9918
9952
  trigger,
9919
- prefetch,
9953
+ modifier,
9920
9954
  sourceSpan,
9921
9955
  ...NEW_OP,
9922
9956
  };
@@ -11276,6 +11310,7 @@ function resolveDeferTargetNames(job) {
11276
11310
  function resolveTrigger(deferOwnerView, op, placeholderView) {
11277
11311
  switch (op.trigger.kind) {
11278
11312
  case DeferTriggerKind.Idle:
11313
+ case DeferTriggerKind.Never:
11279
11314
  case DeferTriggerKind.Immediate:
11280
11315
  case DeferTriggerKind.Timer:
11281
11316
  return;
@@ -11335,7 +11370,9 @@ function resolveDeferTargetNames(job) {
11335
11370
  break;
11336
11371
  case OpKind.DeferOn:
11337
11372
  const deferOp = defers.get(op.defer);
11338
- resolveTrigger(unit, op, deferOp.placeholderView);
11373
+ resolveTrigger(unit, op, op.modifier === "hydrate" /* ir.DeferOpModifierKind.HYDRATE */
11374
+ ? deferOp.mainView
11375
+ : deferOp.placeholderView);
11339
11376
  break;
11340
11377
  }
11341
11378
  }
@@ -11756,7 +11793,10 @@ function formatValue(value) {
11756
11793
  // Self-closing tags use a special form that concatenates the start and close tag values.
11757
11794
  if (value.flags & I18nParamValueFlags.OpenTag &&
11758
11795
  value.flags & I18nParamValueFlags.CloseTag) {
11759
- return `${formatValue({ ...value, flags: value.flags & ~I18nParamValueFlags.CloseTag })}${formatValue({ ...value, flags: value.flags & ~I18nParamValueFlags.OpenTag })}`;
11796
+ return `${formatValue({
11797
+ ...value,
11798
+ flags: value.flags & ~I18nParamValueFlags.CloseTag,
11799
+ })}${formatValue({ ...value, flags: value.flags & ~I18nParamValueFlags.OpenTag })}`;
11760
11800
  }
11761
11801
  // If there are no special flags, just return the raw value.
11762
11802
  if (value.flags === I18nParamValueFlags.None) {
@@ -12148,13 +12188,17 @@ class IcuSerializerVisitor {
12148
12188
  visitTagPlaceholder(ph) {
12149
12189
  return ph.isVoid
12150
12190
  ? this.formatPh(ph.startName)
12151
- : `${this.formatPh(ph.startName)}${ph.children.map((child) => child.visit(this)).join('')}${this.formatPh(ph.closeName)}`;
12191
+ : `${this.formatPh(ph.startName)}${ph.children
12192
+ .map((child) => child.visit(this))
12193
+ .join('')}${this.formatPh(ph.closeName)}`;
12152
12194
  }
12153
12195
  visitPlaceholder(ph) {
12154
12196
  return this.formatPh(ph.name);
12155
12197
  }
12156
12198
  visitBlockPlaceholder(ph) {
12157
- return `${this.formatPh(ph.startName)}${ph.children.map((child) => child.visit(this)).join('')}${this.formatPh(ph.closeName)}`;
12199
+ return `${this.formatPh(ph.startName)}${ph.children
12200
+ .map((child) => child.visit(this))
12201
+ .join('')}${this.formatPh(ph.closeName)}`;
12158
12202
  }
12159
12203
  visitIcuPlaceholder(ph, context) {
12160
12204
  return this.formatPh(ph.name);
@@ -19486,13 +19530,17 @@ class GetMsgSerializerVisitor {
19486
19530
  visitTagPlaceholder(ph) {
19487
19531
  return ph.isVoid
19488
19532
  ? this.formatPh(ph.startName)
19489
- : `${this.formatPh(ph.startName)}${ph.children.map((child) => child.visit(this)).join('')}${this.formatPh(ph.closeName)}`;
19533
+ : `${this.formatPh(ph.startName)}${ph.children
19534
+ .map((child) => child.visit(this))
19535
+ .join('')}${this.formatPh(ph.closeName)}`;
19490
19536
  }
19491
19537
  visitPlaceholder(ph) {
19492
19538
  return this.formatPh(ph.name);
19493
19539
  }
19494
19540
  visitBlockPlaceholder(ph) {
19495
- return `${this.formatPh(ph.startName)}${ph.children.map((child) => child.visit(this)).join('')}${this.formatPh(ph.closeName)}`;
19541
+ return `${this.formatPh(ph.startName)}${ph.children
19542
+ .map((child) => child.visit(this))
19543
+ .join('')}${this.formatPh(ph.closeName)}`;
19496
19544
  }
19497
19545
  visitIcuPlaceholder(ph, context) {
19498
19546
  return this.formatPh(ph.name);
@@ -21047,28 +21095,68 @@ function defer(selfSlot, primarySlot, dependencyResolverFn, loadingSlot, placeho
21047
21095
  return call(Identifiers.defer, args, sourceSpan);
21048
21096
  }
21049
21097
  const deferTriggerToR3TriggerInstructionsMap = new Map([
21050
- [DeferTriggerKind.Idle, [Identifiers.deferOnIdle, Identifiers.deferPrefetchOnIdle]],
21098
+ [
21099
+ DeferTriggerKind.Idle,
21100
+ {
21101
+ ["none" /* ir.DeferOpModifierKind.NONE */]: Identifiers.deferOnIdle,
21102
+ ["prefetch" /* ir.DeferOpModifierKind.PREFETCH */]: Identifiers.deferPrefetchOnIdle,
21103
+ ["hydrate" /* ir.DeferOpModifierKind.HYDRATE */]: Identifiers.deferHydrateOnIdle,
21104
+ },
21105
+ ],
21051
21106
  [
21052
21107
  DeferTriggerKind.Immediate,
21053
- [Identifiers.deferOnImmediate, Identifiers.deferPrefetchOnImmediate],
21108
+ {
21109
+ ["none" /* ir.DeferOpModifierKind.NONE */]: Identifiers.deferOnImmediate,
21110
+ ["prefetch" /* ir.DeferOpModifierKind.PREFETCH */]: Identifiers.deferPrefetchOnImmediate,
21111
+ ["hydrate" /* ir.DeferOpModifierKind.HYDRATE */]: Identifiers.deferHydrateOnImmediate,
21112
+ },
21113
+ ],
21114
+ [
21115
+ DeferTriggerKind.Timer,
21116
+ {
21117
+ ["none" /* ir.DeferOpModifierKind.NONE */]: Identifiers.deferOnTimer,
21118
+ ["prefetch" /* ir.DeferOpModifierKind.PREFETCH */]: Identifiers.deferPrefetchOnTimer,
21119
+ ["hydrate" /* ir.DeferOpModifierKind.HYDRATE */]: Identifiers.deferHydrateOnTimer,
21120
+ },
21121
+ ],
21122
+ [
21123
+ DeferTriggerKind.Hover,
21124
+ {
21125
+ ["none" /* ir.DeferOpModifierKind.NONE */]: Identifiers.deferOnHover,
21126
+ ["prefetch" /* ir.DeferOpModifierKind.PREFETCH */]: Identifiers.deferPrefetchOnHover,
21127
+ ["hydrate" /* ir.DeferOpModifierKind.HYDRATE */]: Identifiers.deferHydrateOnHover,
21128
+ },
21054
21129
  ],
21055
- [DeferTriggerKind.Timer, [Identifiers.deferOnTimer, Identifiers.deferPrefetchOnTimer]],
21056
- [DeferTriggerKind.Hover, [Identifiers.deferOnHover, Identifiers.deferPrefetchOnHover]],
21057
21130
  [
21058
21131
  DeferTriggerKind.Interaction,
21059
- [Identifiers.deferOnInteraction, Identifiers.deferPrefetchOnInteraction],
21132
+ {
21133
+ ["none" /* ir.DeferOpModifierKind.NONE */]: Identifiers.deferOnInteraction,
21134
+ ["prefetch" /* ir.DeferOpModifierKind.PREFETCH */]: Identifiers.deferPrefetchOnInteraction,
21135
+ ["hydrate" /* ir.DeferOpModifierKind.HYDRATE */]: Identifiers.deferHydrateOnInteraction,
21136
+ },
21060
21137
  ],
21061
21138
  [
21062
21139
  DeferTriggerKind.Viewport,
21063
- [Identifiers.deferOnViewport, Identifiers.deferPrefetchOnViewport],
21140
+ {
21141
+ ["none" /* ir.DeferOpModifierKind.NONE */]: Identifiers.deferOnViewport,
21142
+ ["prefetch" /* ir.DeferOpModifierKind.PREFETCH */]: Identifiers.deferPrefetchOnViewport,
21143
+ ["hydrate" /* ir.DeferOpModifierKind.HYDRATE */]: Identifiers.deferHydrateOnViewport,
21144
+ },
21145
+ ],
21146
+ [
21147
+ DeferTriggerKind.Never,
21148
+ {
21149
+ ["none" /* ir.DeferOpModifierKind.NONE */]: Identifiers.deferHydrateNever,
21150
+ ["prefetch" /* ir.DeferOpModifierKind.PREFETCH */]: Identifiers.deferHydrateNever,
21151
+ ["hydrate" /* ir.DeferOpModifierKind.HYDRATE */]: Identifiers.deferHydrateNever,
21152
+ },
21064
21153
  ],
21065
21154
  ]);
21066
- function deferOn(trigger, args, prefetch, sourceSpan) {
21067
- const instructions = deferTriggerToR3TriggerInstructionsMap.get(trigger);
21068
- if (instructions === undefined) {
21155
+ function deferOn(trigger, args, modifier, sourceSpan) {
21156
+ const instructionToCall = deferTriggerToR3TriggerInstructionsMap.get(trigger)?.[modifier];
21157
+ if (instructionToCall === undefined) {
21069
21158
  throw new Error(`Unable to determine instruction for trigger ${trigger}`);
21070
21159
  }
21071
- const instructionToCall = prefetch ? instructions[1] : instructions[0];
21072
21160
  return call(instructionToCall, args.map((a) => literal$1(a)), sourceSpan);
21073
21161
  }
21074
21162
  function projectionDef(def) {
@@ -21124,8 +21212,14 @@ function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByF
21124
21212
  function repeater(collection, sourceSpan) {
21125
21213
  return call(Identifiers.repeater, [collection], sourceSpan);
21126
21214
  }
21127
- function deferWhen(prefetch, expr, sourceSpan) {
21128
- return call(prefetch ? Identifiers.deferPrefetchWhen : Identifiers.deferWhen, [expr], sourceSpan);
21215
+ function deferWhen(modifier, expr, sourceSpan) {
21216
+ if (modifier === "prefetch" /* ir.DeferOpModifierKind.PREFETCH */) {
21217
+ return call(Identifiers.deferPrefetchWhen, [expr], sourceSpan);
21218
+ }
21219
+ else if (modifier === "hydrate" /* ir.DeferOpModifierKind.HYDRATE */) {
21220
+ return call(Identifiers.deferHydrateWhen, [expr], sourceSpan);
21221
+ }
21222
+ return call(Identifiers.deferWhen, [expr], sourceSpan);
21129
21223
  }
21130
21224
  function declareLet(slot, sourceSpan) {
21131
21225
  return call(Identifiers.declareLet, [literal$1(slot)], sourceSpan);
@@ -21589,6 +21683,7 @@ function reifyCreateOperations(unit, ops) {
21589
21683
  case OpKind.DeferOn:
21590
21684
  let args = [];
21591
21685
  switch (op.trigger.kind) {
21686
+ case DeferTriggerKind.Never:
21592
21687
  case DeferTriggerKind.Idle:
21593
21688
  case DeferTriggerKind.Immediate:
21594
21689
  break;
@@ -21598,18 +21693,24 @@ function reifyCreateOperations(unit, ops) {
21598
21693
  case DeferTriggerKind.Interaction:
21599
21694
  case DeferTriggerKind.Hover:
21600
21695
  case DeferTriggerKind.Viewport:
21601
- if (op.trigger.targetSlot?.slot == null || op.trigger.targetSlotViewSteps === null) {
21602
- throw new Error(`Slot or view steps not set in trigger reification for trigger kind ${op.trigger.kind}`);
21696
+ // `hydrate` triggers don't support targets.
21697
+ if (op.modifier === "hydrate" /* ir.DeferOpModifierKind.HYDRATE */) {
21698
+ args = [];
21603
21699
  }
21604
- args = [op.trigger.targetSlot.slot];
21605
- if (op.trigger.targetSlotViewSteps !== 0) {
21606
- args.push(op.trigger.targetSlotViewSteps);
21700
+ else {
21701
+ if (op.trigger.targetSlot?.slot == null || op.trigger.targetSlotViewSteps === null) {
21702
+ throw new Error(`Slot or view steps not set in trigger reification for trigger kind ${op.trigger.kind}`);
21703
+ }
21704
+ args = [op.trigger.targetSlot.slot];
21705
+ if (op.trigger.targetSlotViewSteps !== 0) {
21706
+ args.push(op.trigger.targetSlotViewSteps);
21707
+ }
21607
21708
  }
21608
21709
  break;
21609
21710
  default:
21610
21711
  throw new Error(`AssertionError: Unsupported reification of defer trigger kind ${op.trigger.kind}`);
21611
21712
  }
21612
- OpList.replace(op, deferOn(op.trigger.kind, args, op.prefetch, op.sourceSpan));
21713
+ OpList.replace(op, deferOn(op.trigger.kind, args, op.modifier, op.sourceSpan));
21613
21714
  break;
21614
21715
  case OpKind.ProjectionDef:
21615
21716
  OpList.replace(op, projectionDef(op.def));
@@ -21767,7 +21868,7 @@ function reifyUpdateOperations(_unit, ops) {
21767
21868
  OpList.replace(op, repeater(op.collection, op.sourceSpan));
21768
21869
  break;
21769
21870
  case OpKind.DeferWhen:
21770
- OpList.replace(op, deferWhen(op.prefetch, op.expr, op.sourceSpan));
21871
+ OpList.replace(op, deferWhen(op.modifier, op.expr, op.sourceSpan));
21771
21872
  break;
21772
21873
  case OpKind.StoreLet:
21773
21874
  throw new Error(`AssertionError: unexpected storeLet ${op.declaredName}`);
@@ -23550,7 +23651,7 @@ function wrapI18nIcus(job) {
23550
23651
  * Copyright Google LLC All Rights Reserved.
23551
23652
  *
23552
23653
  * Use of this source code is governed by an MIT-style license that can be
23553
- * found in the LICENSE file at https://angular.io/license
23654
+ * found in the LICENSE file at https://angular.dev/license
23554
23655
  */
23555
23656
  /**
23556
23657
  * Removes any `storeLet` calls that aren't referenced outside of the current view.
@@ -23633,7 +23734,7 @@ function generateLocalLetReferences(job) {
23633
23734
  * Copyright Google LLC All Rights Reserved.
23634
23735
  *
23635
23736
  * Use of this source code is governed by an MIT-style license that can be
23636
- * found in the LICENSE file at https://angular.io/license
23737
+ * found in the LICENSE file at https://angular.dev/license
23637
23738
  */
23638
23739
  const phases = [
23639
23740
  { kind: CompilationJobKind.Tmpl, fn: removeContentSelectors },
@@ -24160,73 +24261,81 @@ function ingestDeferBlock(unit, deferBlock) {
24160
24261
  // Configure all defer `on` conditions.
24161
24262
  // TODO: refactor prefetch triggers to use a separate op type, with a shared superclass. This will
24162
24263
  // make it easier to refactor prefetch behavior in the future.
24163
- let prefetch = false;
24164
- let deferOnOps = [];
24165
- let deferWhenOps = [];
24166
- for (const triggers of [deferBlock.triggers, deferBlock.prefetchTriggers]) {
24167
- if (triggers.idle !== undefined) {
24168
- const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Idle }, prefetch, triggers.idle.sourceSpan);
24169
- deferOnOps.push(deferOnOp);
24170
- }
24171
- if (triggers.immediate !== undefined) {
24172
- const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Immediate }, prefetch, triggers.immediate.sourceSpan);
24173
- deferOnOps.push(deferOnOp);
24174
- }
24175
- if (triggers.timer !== undefined) {
24176
- const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Timer, delay: triggers.timer.delay }, prefetch, triggers.timer.sourceSpan);
24177
- deferOnOps.push(deferOnOp);
24178
- }
24179
- if (triggers.hover !== undefined) {
24180
- const deferOnOp = createDeferOnOp(deferXref, {
24181
- kind: DeferTriggerKind.Hover,
24182
- targetName: triggers.hover.reference,
24183
- targetXref: null,
24184
- targetSlot: null,
24185
- targetView: null,
24186
- targetSlotViewSteps: null,
24187
- }, prefetch, triggers.hover.sourceSpan);
24188
- deferOnOps.push(deferOnOp);
24189
- }
24190
- if (triggers.interaction !== undefined) {
24191
- const deferOnOp = createDeferOnOp(deferXref, {
24192
- kind: DeferTriggerKind.Interaction,
24193
- targetName: triggers.interaction.reference,
24194
- targetXref: null,
24195
- targetSlot: null,
24196
- targetView: null,
24197
- targetSlotViewSteps: null,
24198
- }, prefetch, triggers.interaction.sourceSpan);
24199
- deferOnOps.push(deferOnOp);
24200
- }
24201
- if (triggers.viewport !== undefined) {
24202
- const deferOnOp = createDeferOnOp(deferXref, {
24203
- kind: DeferTriggerKind.Viewport,
24204
- targetName: triggers.viewport.reference,
24205
- targetXref: null,
24206
- targetSlot: null,
24207
- targetView: null,
24208
- targetSlotViewSteps: null,
24209
- }, prefetch, triggers.viewport.sourceSpan);
24210
- deferOnOps.push(deferOnOp);
24211
- }
24212
- if (triggers.when !== undefined) {
24213
- if (triggers.when.value instanceof Interpolation$1) {
24214
- // TemplateDefinitionBuilder supports this case, but it's very strange to me. What would it
24215
- // even mean?
24216
- throw new Error(`Unexpected interpolation in defer block when trigger`);
24217
- }
24218
- const deferOnOp = createDeferWhenOp(deferXref, convertAst(triggers.when.value, unit.job, triggers.when.sourceSpan), prefetch, triggers.when.sourceSpan);
24219
- deferWhenOps.push(deferOnOp);
24220
- }
24221
- // If no (non-prefetching) defer triggers were provided, default to `idle`.
24222
- if (deferOnOps.length === 0 && deferWhenOps.length === 0) {
24223
- deferOnOps.push(createDeferOnOp(deferXref, { kind: DeferTriggerKind.Idle }, false, null));
24224
- }
24225
- prefetch = true;
24264
+ const deferOnOps = [];
24265
+ const deferWhenOps = [];
24266
+ // Ingest the hydrate triggers first since they set up all the other triggers during SSR.
24267
+ ingestDeferTriggers("hydrate" /* ir.DeferOpModifierKind.HYDRATE */, deferBlock.hydrateTriggers, deferOnOps, deferWhenOps, unit, deferXref);
24268
+ ingestDeferTriggers("none" /* ir.DeferOpModifierKind.NONE */, deferBlock.triggers, deferOnOps, deferWhenOps, unit, deferXref);
24269
+ ingestDeferTriggers("prefetch" /* ir.DeferOpModifierKind.PREFETCH */, deferBlock.prefetchTriggers, deferOnOps, deferWhenOps, unit, deferXref);
24270
+ // If no (non-prefetching or hydrating) defer triggers were provided, default to `idle`.
24271
+ const hasConcreteTrigger = deferOnOps.some((op) => op.modifier === "none" /* ir.DeferOpModifierKind.NONE */) ||
24272
+ deferWhenOps.some((op) => op.modifier === "none" /* ir.DeferOpModifierKind.NONE */);
24273
+ if (!hasConcreteTrigger) {
24274
+ deferOnOps.push(createDeferOnOp(deferXref, { kind: DeferTriggerKind.Idle }, "none" /* ir.DeferOpModifierKind.NONE */, null));
24226
24275
  }
24227
24276
  unit.create.push(deferOnOps);
24228
24277
  unit.update.push(deferWhenOps);
24229
24278
  }
24279
+ function ingestDeferTriggers(modifier, triggers, onOps, whenOps, unit, deferXref) {
24280
+ if (triggers.idle !== undefined) {
24281
+ const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Idle }, modifier, triggers.idle.sourceSpan);
24282
+ onOps.push(deferOnOp);
24283
+ }
24284
+ if (triggers.immediate !== undefined) {
24285
+ const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Immediate }, modifier, triggers.immediate.sourceSpan);
24286
+ onOps.push(deferOnOp);
24287
+ }
24288
+ if (triggers.timer !== undefined) {
24289
+ const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Timer, delay: triggers.timer.delay }, modifier, triggers.timer.sourceSpan);
24290
+ onOps.push(deferOnOp);
24291
+ }
24292
+ if (triggers.hover !== undefined) {
24293
+ const deferOnOp = createDeferOnOp(deferXref, {
24294
+ kind: DeferTriggerKind.Hover,
24295
+ targetName: triggers.hover.reference,
24296
+ targetXref: null,
24297
+ targetSlot: null,
24298
+ targetView: null,
24299
+ targetSlotViewSteps: null,
24300
+ }, modifier, triggers.hover.sourceSpan);
24301
+ onOps.push(deferOnOp);
24302
+ }
24303
+ if (triggers.interaction !== undefined) {
24304
+ const deferOnOp = createDeferOnOp(deferXref, {
24305
+ kind: DeferTriggerKind.Interaction,
24306
+ targetName: triggers.interaction.reference,
24307
+ targetXref: null,
24308
+ targetSlot: null,
24309
+ targetView: null,
24310
+ targetSlotViewSteps: null,
24311
+ }, modifier, triggers.interaction.sourceSpan);
24312
+ onOps.push(deferOnOp);
24313
+ }
24314
+ if (triggers.viewport !== undefined) {
24315
+ const deferOnOp = createDeferOnOp(deferXref, {
24316
+ kind: DeferTriggerKind.Viewport,
24317
+ targetName: triggers.viewport.reference,
24318
+ targetXref: null,
24319
+ targetSlot: null,
24320
+ targetView: null,
24321
+ targetSlotViewSteps: null,
24322
+ }, modifier, triggers.viewport.sourceSpan);
24323
+ onOps.push(deferOnOp);
24324
+ }
24325
+ if (triggers.never !== undefined) {
24326
+ const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Never }, modifier, triggers.never.sourceSpan);
24327
+ onOps.push(deferOnOp);
24328
+ }
24329
+ if (triggers.when !== undefined) {
24330
+ if (triggers.when.value instanceof Interpolation$1) {
24331
+ // TemplateDefinitionBuilder supports this case, but it's very strange to me. What would it
24332
+ // even mean?
24333
+ throw new Error(`Unexpected interpolation in defer block when trigger`);
24334
+ }
24335
+ const deferOnOp = createDeferWhenOp(deferXref, convertAst(triggers.when.value, unit.job, triggers.when.sourceSpan), modifier, triggers.when.sourceSpan);
24336
+ whenOps.push(deferOnOp);
24337
+ }
24338
+ }
24230
24339
  function ingestIcu(unit, icu) {
24231
24340
  if (icu.i18n instanceof Message && isSingleI18nIcu(icu.i18n)) {
24232
24341
  const xref = unit.job.allocateXrefId();
@@ -25970,12 +26079,29 @@ var OnTriggerType;
25970
26079
  OnTriggerType["IMMEDIATE"] = "immediate";
25971
26080
  OnTriggerType["HOVER"] = "hover";
25972
26081
  OnTriggerType["VIEWPORT"] = "viewport";
26082
+ OnTriggerType["NEVER"] = "never";
25973
26083
  })(OnTriggerType || (OnTriggerType = {}));
25974
26084
  /** Parses a `when` deferred trigger. */
26085
+ function parseNeverTrigger({ expression, sourceSpan }, triggers, errors) {
26086
+ const neverIndex = expression.indexOf('never');
26087
+ const neverSourceSpan = new ParseSourceSpan(sourceSpan.start.moveBy(neverIndex), sourceSpan.start.moveBy(neverIndex + 'never'.length));
26088
+ const prefetchSpan = getPrefetchSpan(expression, sourceSpan);
26089
+ const hydrateSpan = getHydrateSpan(expression, sourceSpan);
26090
+ // This is here just to be safe, we shouldn't enter this function
26091
+ // in the first place if a block doesn't have the "on" keyword.
26092
+ if (neverIndex === -1) {
26093
+ errors.push(new ParseError(sourceSpan, `Could not find "never" keyword in expression`));
26094
+ }
26095
+ else {
26096
+ trackTrigger('never', triggers, errors, new NeverDeferredTrigger(neverSourceSpan, sourceSpan, prefetchSpan, null, hydrateSpan));
26097
+ }
26098
+ }
26099
+ /** Parses a `when` deferred trigger. */
25975
26100
  function parseWhenTrigger({ expression, sourceSpan }, bindingParser, triggers, errors) {
25976
26101
  const whenIndex = expression.indexOf('when');
25977
26102
  const whenSourceSpan = new ParseSourceSpan(sourceSpan.start.moveBy(whenIndex), sourceSpan.start.moveBy(whenIndex + 'when'.length));
25978
26103
  const prefetchSpan = getPrefetchSpan(expression, sourceSpan);
26104
+ const hydrateSpan = getHydrateSpan(expression, sourceSpan);
25979
26105
  // This is here just to be safe, we shouldn't enter this function
25980
26106
  // in the first place if a block doesn't have the "when" keyword.
25981
26107
  if (whenIndex === -1) {
@@ -25984,7 +26110,7 @@ function parseWhenTrigger({ expression, sourceSpan }, bindingParser, triggers, e
25984
26110
  else {
25985
26111
  const start = getTriggerParametersStart(expression, whenIndex + 1);
25986
26112
  const parsed = bindingParser.parseBinding(expression.slice(start), false, sourceSpan, sourceSpan.start.offset + start);
25987
- trackTrigger('when', triggers, errors, new BoundDeferredTrigger(parsed, sourceSpan, prefetchSpan, whenSourceSpan));
26113
+ trackTrigger('when', triggers, errors, new BoundDeferredTrigger(parsed, sourceSpan, prefetchSpan, whenSourceSpan, hydrateSpan));
25988
26114
  }
25989
26115
  }
25990
26116
  /** Parses an `on` trigger */
@@ -25992,6 +26118,7 @@ function parseOnTrigger({ expression, sourceSpan }, triggers, errors, placeholde
25992
26118
  const onIndex = expression.indexOf('on');
25993
26119
  const onSourceSpan = new ParseSourceSpan(sourceSpan.start.moveBy(onIndex), sourceSpan.start.moveBy(onIndex + 'on'.length));
25994
26120
  const prefetchSpan = getPrefetchSpan(expression, sourceSpan);
26121
+ const hydrateSpan = getHydrateSpan(expression, sourceSpan);
25995
26122
  // This is here just to be safe, we shouldn't enter this function
25996
26123
  // in the first place if a block doesn't have the "on" keyword.
25997
26124
  if (onIndex === -1) {
@@ -25999,7 +26126,9 @@ function parseOnTrigger({ expression, sourceSpan }, triggers, errors, placeholde
25999
26126
  }
26000
26127
  else {
26001
26128
  const start = getTriggerParametersStart(expression, onIndex + 1);
26002
- const parser = new OnTriggerParser(expression, start, sourceSpan, triggers, errors, placeholder, prefetchSpan, onSourceSpan);
26129
+ const parser = new OnTriggerParser(expression, start, sourceSpan, triggers, errors, expression.startsWith('hydrate')
26130
+ ? validateHydrateReferenceBasedTrigger
26131
+ : validatePlainReferenceBasedTrigger, placeholder, prefetchSpan, onSourceSpan, hydrateSpan);
26003
26132
  parser.parse();
26004
26133
  }
26005
26134
  }
@@ -26009,16 +26138,24 @@ function getPrefetchSpan(expression, sourceSpan) {
26009
26138
  }
26010
26139
  return new ParseSourceSpan(sourceSpan.start, sourceSpan.start.moveBy('prefetch'.length));
26011
26140
  }
26141
+ function getHydrateSpan(expression, sourceSpan) {
26142
+ if (!expression.startsWith('hydrate')) {
26143
+ return null;
26144
+ }
26145
+ return new ParseSourceSpan(sourceSpan.start, sourceSpan.start.moveBy('hydrate'.length));
26146
+ }
26012
26147
  class OnTriggerParser {
26013
- constructor(expression, start, span, triggers, errors, placeholder, prefetchSpan, onSourceSpan) {
26148
+ constructor(expression, start, span, triggers, errors, validator, placeholder, prefetchSpan, onSourceSpan, hydrateSpan) {
26014
26149
  this.expression = expression;
26015
26150
  this.start = start;
26016
26151
  this.span = span;
26017
26152
  this.triggers = triggers;
26018
26153
  this.errors = errors;
26154
+ this.validator = validator;
26019
26155
  this.placeholder = placeholder;
26020
26156
  this.prefetchSpan = prefetchSpan;
26021
26157
  this.onSourceSpan = onSourceSpan;
26158
+ this.hydrateSpan = hydrateSpan;
26022
26159
  this.index = 0;
26023
26160
  this.tokens = new Lexer().tokenize(expression.slice(start));
26024
26161
  }
@@ -26073,26 +26210,27 @@ class OnTriggerParser {
26073
26210
  const isFirstTrigger = identifier.index === 0;
26074
26211
  const onSourceSpan = isFirstTrigger ? this.onSourceSpan : null;
26075
26212
  const prefetchSourceSpan = isFirstTrigger ? this.prefetchSpan : null;
26213
+ const hydrateSourceSpan = isFirstTrigger ? this.hydrateSpan : null;
26076
26214
  const sourceSpan = new ParseSourceSpan(isFirstTrigger ? this.span.start : triggerNameStartSpan, endSpan);
26077
26215
  try {
26078
26216
  switch (identifier.toString()) {
26079
26217
  case OnTriggerType.IDLE:
26080
- this.trackTrigger('idle', createIdleTrigger(parameters, nameSpan, sourceSpan, prefetchSourceSpan, onSourceSpan));
26218
+ this.trackTrigger('idle', createIdleTrigger(parameters, nameSpan, sourceSpan, prefetchSourceSpan, onSourceSpan, hydrateSourceSpan));
26081
26219
  break;
26082
26220
  case OnTriggerType.TIMER:
26083
- this.trackTrigger('timer', createTimerTrigger(parameters, nameSpan, sourceSpan, this.prefetchSpan, this.onSourceSpan));
26221
+ this.trackTrigger('timer', createTimerTrigger(parameters, nameSpan, sourceSpan, this.prefetchSpan, this.onSourceSpan, this.hydrateSpan));
26084
26222
  break;
26085
26223
  case OnTriggerType.INTERACTION:
26086
- this.trackTrigger('interaction', createInteractionTrigger(parameters, nameSpan, sourceSpan, this.prefetchSpan, this.onSourceSpan, this.placeholder));
26224
+ this.trackTrigger('interaction', createInteractionTrigger(parameters, nameSpan, sourceSpan, this.prefetchSpan, this.onSourceSpan, this.hydrateSpan, this.placeholder, this.validator));
26087
26225
  break;
26088
26226
  case OnTriggerType.IMMEDIATE:
26089
- this.trackTrigger('immediate', createImmediateTrigger(parameters, nameSpan, sourceSpan, this.prefetchSpan, this.onSourceSpan));
26227
+ this.trackTrigger('immediate', createImmediateTrigger(parameters, nameSpan, sourceSpan, this.prefetchSpan, this.onSourceSpan, this.hydrateSpan));
26090
26228
  break;
26091
26229
  case OnTriggerType.HOVER:
26092
- this.trackTrigger('hover', createHoverTrigger(parameters, nameSpan, sourceSpan, this.prefetchSpan, this.onSourceSpan, this.placeholder));
26230
+ this.trackTrigger('hover', createHoverTrigger(parameters, nameSpan, sourceSpan, this.prefetchSpan, this.onSourceSpan, this.hydrateSpan, this.placeholder, this.validator));
26093
26231
  break;
26094
26232
  case OnTriggerType.VIEWPORT:
26095
- this.trackTrigger('viewport', createViewportTrigger(parameters, nameSpan, sourceSpan, this.prefetchSpan, this.onSourceSpan, this.placeholder));
26233
+ this.trackTrigger('viewport', createViewportTrigger(parameters, nameSpan, sourceSpan, this.prefetchSpan, this.onSourceSpan, this.hydrateSpan, this.placeholder, this.validator));
26096
26234
  break;
26097
26235
  default:
26098
26236
  throw new Error(`Unrecognized trigger type "${identifier}"`);
@@ -26182,13 +26320,13 @@ function trackTrigger(name, allTriggers, errors, trigger) {
26182
26320
  allTriggers[name] = trigger;
26183
26321
  }
26184
26322
  }
26185
- function createIdleTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {
26323
+ function createIdleTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSourceSpan, hydrateSpan) {
26186
26324
  if (parameters.length > 0) {
26187
26325
  throw new Error(`"${OnTriggerType.IDLE}" trigger cannot have parameters`);
26188
26326
  }
26189
- return new IdleDeferredTrigger(nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
26327
+ return new IdleDeferredTrigger(nameSpan, sourceSpan, prefetchSpan, onSourceSpan, hydrateSpan);
26190
26328
  }
26191
- function createTimerTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {
26329
+ function createTimerTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSourceSpan, hydrateSpan) {
26192
26330
  if (parameters.length !== 1) {
26193
26331
  throw new Error(`"${OnTriggerType.TIMER}" trigger must have exactly one parameter`);
26194
26332
  }
@@ -26196,27 +26334,33 @@ function createTimerTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSo
26196
26334
  if (delay === null) {
26197
26335
  throw new Error(`Could not parse time value of trigger "${OnTriggerType.TIMER}"`);
26198
26336
  }
26199
- return new TimerDeferredTrigger(delay, nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
26337
+ return new TimerDeferredTrigger(delay, nameSpan, sourceSpan, prefetchSpan, onSourceSpan, hydrateSpan);
26200
26338
  }
26201
- function createImmediateTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {
26339
+ function createImmediateTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSourceSpan, hydrateSpan) {
26202
26340
  if (parameters.length > 0) {
26203
26341
  throw new Error(`"${OnTriggerType.IMMEDIATE}" trigger cannot have parameters`);
26204
26342
  }
26205
- return new ImmediateDeferredTrigger(nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
26343
+ return new ImmediateDeferredTrigger(nameSpan, sourceSpan, prefetchSpan, onSourceSpan, hydrateSpan);
26206
26344
  }
26207
- function createHoverTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSourceSpan, placeholder) {
26208
- validateReferenceBasedTrigger(OnTriggerType.HOVER, parameters, placeholder);
26209
- return new HoverDeferredTrigger(parameters[0] ?? null, nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
26345
+ function createHoverTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSourceSpan, hydrateSpan, placeholder, validator) {
26346
+ validator(OnTriggerType.HOVER, parameters, placeholder);
26347
+ return new HoverDeferredTrigger(parameters[0] ?? null, nameSpan, sourceSpan, prefetchSpan, onSourceSpan, hydrateSpan);
26210
26348
  }
26211
- function createInteractionTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSourceSpan, placeholder) {
26212
- validateReferenceBasedTrigger(OnTriggerType.INTERACTION, parameters, placeholder);
26213
- return new InteractionDeferredTrigger(parameters[0] ?? null, nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
26349
+ function createInteractionTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSourceSpan, hydrateSpan, placeholder, validator) {
26350
+ validator(OnTriggerType.INTERACTION, parameters, placeholder);
26351
+ return new InteractionDeferredTrigger(parameters[0] ?? null, nameSpan, sourceSpan, prefetchSpan, onSourceSpan, hydrateSpan);
26214
26352
  }
26215
- function createViewportTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSourceSpan, placeholder) {
26216
- validateReferenceBasedTrigger(OnTriggerType.VIEWPORT, parameters, placeholder);
26217
- return new ViewportDeferredTrigger(parameters[0] ?? null, nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
26353
+ function createViewportTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSourceSpan, hydrateSpan, placeholder, validator) {
26354
+ validator(OnTriggerType.VIEWPORT, parameters, placeholder);
26355
+ return new ViewportDeferredTrigger(parameters[0] ?? null, nameSpan, sourceSpan, prefetchSpan, onSourceSpan, hydrateSpan);
26218
26356
  }
26219
- function validateReferenceBasedTrigger(type, parameters, placeholder) {
26357
+ /**
26358
+ * Checks whether the structure of a non-hydrate reference-based trigger is valid.
26359
+ * @param type Type of the trigger being validated.
26360
+ * @param parameters Parameters of the trigger.
26361
+ * @param placeholder Placeholder of the defer block.
26362
+ */
26363
+ function validatePlainReferenceBasedTrigger(type, parameters, placeholder) {
26220
26364
  if (parameters.length > 1) {
26221
26365
  throw new Error(`"${type}" trigger can only have zero or one parameters`);
26222
26366
  }
@@ -26230,6 +26374,16 @@ function validateReferenceBasedTrigger(type, parameters, placeholder) {
26230
26374
  }
26231
26375
  }
26232
26376
  }
26377
+ /**
26378
+ * Checks whether the structure of a hydrate trigger is valid.
26379
+ * @param type Type of the trigger being validated.
26380
+ * @param parameters Parameters of the trigger.
26381
+ */
26382
+ function validateHydrateReferenceBasedTrigger(type, parameters) {
26383
+ if (parameters.length > 0) {
26384
+ throw new Error(`Hydration trigger "${type}" cannot have parameters`);
26385
+ }
26386
+ }
26233
26387
  /** Gets the index within an expression at which the trigger parameters start. */
26234
26388
  function getTriggerParametersStart(value, startPosition = 0) {
26235
26389
  let hasFoundSeparator = false;
@@ -26260,6 +26414,12 @@ function parseDeferredTime(value) {
26260
26414
  const PREFETCH_WHEN_PATTERN = /^prefetch\s+when\s/;
26261
26415
  /** Pattern to identify a `prefetch on` trigger. */
26262
26416
  const PREFETCH_ON_PATTERN = /^prefetch\s+on\s/;
26417
+ /** Pattern to identify a `hydrate when` trigger. */
26418
+ const HYDRATE_WHEN_PATTERN = /^hydrate\s+when\s/;
26419
+ /** Pattern to identify a `hydrate on` trigger. */
26420
+ const HYDRATE_ON_PATTERN = /^hydrate\s+on\s/;
26421
+ /** Pattern to identify a `hydrate never` trigger. */
26422
+ const HYDRATE_NEVER_PATTERN = /^hydrate\s+never\s*/;
26263
26423
  /** Pattern to identify a `minimum` parameter in a block. */
26264
26424
  const MINIMUM_PARAMETER_PATTERN = /^minimum\s/;
26265
26425
  /** Pattern to identify a `after` parameter in a block. */
@@ -26279,7 +26439,7 @@ function isConnectedDeferLoopBlock(name) {
26279
26439
  function createDeferredBlock(ast, connectedBlocks, visitor, bindingParser) {
26280
26440
  const errors = [];
26281
26441
  const { placeholder, loading, error } = parseConnectedBlocks(connectedBlocks, errors, visitor);
26282
- const { triggers, prefetchTriggers } = parsePrimaryTriggers(ast.parameters, bindingParser, errors, placeholder);
26442
+ const { triggers, prefetchTriggers, hydrateTriggers } = parsePrimaryTriggers(ast, bindingParser, errors, placeholder);
26283
26443
  // The `defer` block has a main span encompassing all of the connected branches as well.
26284
26444
  let lastEndSourceSpan = ast.endSourceSpan;
26285
26445
  let endOfLastSourceSpan = ast.sourceSpan.end;
@@ -26289,7 +26449,7 @@ function createDeferredBlock(ast, connectedBlocks, visitor, bindingParser) {
26289
26449
  endOfLastSourceSpan = lastConnectedBlock.sourceSpan.end;
26290
26450
  }
26291
26451
  const sourceSpanWithConnectedBlocks = new ParseSourceSpan(ast.sourceSpan.start, endOfLastSourceSpan);
26292
- const node = new DeferredBlock(visitAll(visitor, ast.children, ast.children), triggers, prefetchTriggers, placeholder, loading, error, ast.nameSpan, sourceSpanWithConnectedBlocks, ast.sourceSpan, ast.startSourceSpan, lastEndSourceSpan, ast.i18n);
26452
+ const node = new DeferredBlock(visitAll(visitor, ast.children, ast.children), triggers, prefetchTriggers, hydrateTriggers, placeholder, loading, error, ast.nameSpan, sourceSpanWithConnectedBlocks, ast.sourceSpan, ast.startSourceSpan, lastEndSourceSpan, ast.i18n);
26293
26453
  return { node, errors };
26294
26454
  }
26295
26455
  function parseConnectedBlocks(connectedBlocks, errors, visitor) {
@@ -26390,10 +26550,11 @@ function parseErrorBlock(ast, visitor) {
26390
26550
  }
26391
26551
  return new DeferredBlockError(visitAll(visitor, ast.children, ast.children), ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.i18n);
26392
26552
  }
26393
- function parsePrimaryTriggers(params, bindingParser, errors, placeholder) {
26553
+ function parsePrimaryTriggers(ast, bindingParser, errors, placeholder) {
26394
26554
  const triggers = {};
26395
26555
  const prefetchTriggers = {};
26396
- for (const param of params) {
26556
+ const hydrateTriggers = {};
26557
+ for (const param of ast.parameters) {
26397
26558
  // The lexer ignores the leading spaces so we can assume
26398
26559
  // that the expression starts with a keyword.
26399
26560
  if (WHEN_PARAMETER_PATTERN.test(param.expression)) {
@@ -26408,11 +26569,23 @@ function parsePrimaryTriggers(params, bindingParser, errors, placeholder) {
26408
26569
  else if (PREFETCH_ON_PATTERN.test(param.expression)) {
26409
26570
  parseOnTrigger(param, prefetchTriggers, errors, placeholder);
26410
26571
  }
26572
+ else if (HYDRATE_WHEN_PATTERN.test(param.expression)) {
26573
+ parseWhenTrigger(param, bindingParser, hydrateTriggers, errors);
26574
+ }
26575
+ else if (HYDRATE_ON_PATTERN.test(param.expression)) {
26576
+ parseOnTrigger(param, hydrateTriggers, errors, placeholder);
26577
+ }
26578
+ else if (HYDRATE_NEVER_PATTERN.test(param.expression)) {
26579
+ parseNeverTrigger(param, hydrateTriggers, errors);
26580
+ }
26411
26581
  else {
26412
26582
  errors.push(new ParseError(param.sourceSpan, 'Unrecognized trigger'));
26413
26583
  }
26414
26584
  }
26415
- return { triggers, prefetchTriggers };
26585
+ if (hydrateTriggers.never && Object.keys(hydrateTriggers).length > 1) {
26586
+ errors.push(new ParseError(ast.startSourceSpan, 'Cannot specify additional `hydrate` triggers if `hydrate never` is present'));
26587
+ }
26588
+ return { triggers, prefetchTriggers, hydrateTriggers };
26416
26589
  }
26417
26590
 
26418
26591
  const BIND_NAME_REGEXP = /^(?:(bind-)|(let-)|(ref-|#)|(on-)|(bindon-)|(@))(.*)$/;
@@ -28125,6 +28298,8 @@ class TemplateBinder extends RecursiveAstVisitor {
28125
28298
  this.ingestScopedNode(deferred);
28126
28299
  deferred.triggers.when?.value.visit(this);
28127
28300
  deferred.prefetchTriggers.when?.value.visit(this);
28301
+ deferred.hydrateTriggers.when?.value.visit(this);
28302
+ deferred.hydrateTriggers.never?.visit(this);
28128
28303
  deferred.placeholder && this.visitNode(deferred.placeholder);
28129
28304
  deferred.loading && this.visitNode(deferred.loading);
28130
28305
  deferred.error && this.visitNode(deferred.error);
@@ -29070,7 +29245,7 @@ function publishFacade(global) {
29070
29245
  * @description
29071
29246
  * Entry point for all public APIs of the compiler package.
29072
29247
  */
29073
- new Version('19.0.0-next.5');
29248
+ new Version('19.0.0-next.7');
29074
29249
 
29075
29250
  const _I18N_ATTR = 'i18n';
29076
29251
  const _I18N_ATTR_PREFIX = 'i18n-';
@@ -30414,7 +30589,7 @@ class NodeJSPathManipulation {
30414
30589
  // G3-ESM-MARKER: G3 uses CommonJS, but externally everything in ESM.
30415
30590
  // CommonJS/ESM interop for determining the current file name and containing dir.
30416
30591
  const isCommonJS = typeof __filename !== 'undefined';
30417
- const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('compiler_host-ca7ba733.js', document.baseURI).href));
30592
+ const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('checker-637eee78.js', document.baseURI).href));
30418
30593
  const currentFileName = isCommonJS ? __filename : url.fileURLToPath(currentFileUrl);
30419
30594
  /**
30420
30595
  * A wrapper around the Node.js file-system that supports readonly operations and path manipulation.
@@ -35219,7 +35394,7 @@ class TypeEmitter {
35219
35394
  * Copyright Google LLC All Rights Reserved.
35220
35395
  *
35221
35396
  * Use of this source code is governed by an MIT-style license that can be
35222
- * found in the LICENSE file at https://angular.io/license
35397
+ * found in the LICENSE file at https://angular.dev/license
35223
35398
  */
35224
35399
  /**
35225
35400
  * Creates a TypeScript node representing a numeric value.
@@ -41727,6 +41902,10 @@ class Scope {
41727
41902
  appendDeferredBlock(block) {
41728
41903
  this.appendDeferredTriggers(block, block.triggers);
41729
41904
  this.appendDeferredTriggers(block, block.prefetchTriggers);
41905
+ // Only the `when` hydration trigger needs to be checked.
41906
+ if (block.hydrateTriggers.when) {
41907
+ this.opQueue.push(new TcbExpressionOp(this.tcb, this, block.hydrateTriggers.when.value));
41908
+ }
41730
41909
  this.appendChildren(block);
41731
41910
  if (block.placeholder !== null) {
41732
41911
  this.appendChildren(block.placeholder);
@@ -44201,285 +44380,6 @@ class SingleShimTypeCheckingHost extends SingleFileTypeCheckingHost {
44201
44380
  }
44202
44381
  }
44203
44382
 
44204
- /** Tracks changes that have to be made for specific files. */
44205
- class ChangeTracker {
44206
- _printer;
44207
- _importRemapper;
44208
- _changes = new Map();
44209
- _importManager;
44210
- _quotesCache = new WeakMap();
44211
- constructor(_printer, _importRemapper) {
44212
- this._printer = _printer;
44213
- this._importRemapper = _importRemapper;
44214
- this._importManager = new ImportManager({
44215
- shouldUseSingleQuotes: (file) => this._getQuoteKind(file) === 0 /* QuoteKind.SINGLE */,
44216
- });
44217
- }
44218
- /**
44219
- * Tracks the insertion of some text.
44220
- * @param sourceFile File in which the text is being inserted.
44221
- * @param start Index at which the text is insert.
44222
- * @param text Text to be inserted.
44223
- */
44224
- insertText(sourceFile, index, text) {
44225
- this._trackChange(sourceFile, { start: index, text });
44226
- }
44227
- /**
44228
- * Replaces text within a file.
44229
- * @param sourceFile File in which to replace the text.
44230
- * @param start Index from which to replace the text.
44231
- * @param removeLength Length of the text being replaced.
44232
- * @param text Text to be inserted instead of the old one.
44233
- */
44234
- replaceText(sourceFile, start, removeLength, text) {
44235
- this._trackChange(sourceFile, { start, removeLength, text });
44236
- }
44237
- /**
44238
- * Replaces the text of an AST node with a new one.
44239
- * @param oldNode Node to be replaced.
44240
- * @param newNode New node to be inserted.
44241
- * @param emitHint Hint when formatting the text of the new node.
44242
- * @param sourceFileWhenPrinting File to use when printing out the new node. This is important
44243
- * when copying nodes from one file to another, because TypeScript might not output literal nodes
44244
- * without it.
44245
- */
44246
- replaceNode(oldNode, newNode, emitHint = ts__default["default"].EmitHint.Unspecified, sourceFileWhenPrinting) {
44247
- const sourceFile = oldNode.getSourceFile();
44248
- this.replaceText(sourceFile, oldNode.getStart(), oldNode.getWidth(), this._printer.printNode(emitHint, newNode, sourceFileWhenPrinting || sourceFile));
44249
- }
44250
- /**
44251
- * Removes the text of an AST node from a file.
44252
- * @param node Node whose text should be removed.
44253
- */
44254
- removeNode(node) {
44255
- this._trackChange(node.getSourceFile(), {
44256
- start: node.getStart(),
44257
- removeLength: node.getWidth(),
44258
- text: '',
44259
- });
44260
- }
44261
- /**
44262
- * Adds an import to a file.
44263
- * @param sourceFile File to which to add the import.
44264
- * @param symbolName Symbol being imported.
44265
- * @param moduleName Module from which the symbol is imported.
44266
- * @param alias Alias to use for the import.
44267
- */
44268
- addImport(sourceFile, symbolName, moduleName, alias) {
44269
- if (this._importRemapper) {
44270
- moduleName = this._importRemapper(moduleName, sourceFile.fileName);
44271
- }
44272
- // It's common for paths to be manipulated with Node's `path` utilties which
44273
- // can yield a path with back slashes. Normalize them since outputting such
44274
- // paths will also cause TS to escape the forward slashes.
44275
- moduleName = normalizePath(moduleName);
44276
- if (!this._changes.has(sourceFile)) {
44277
- this._changes.set(sourceFile, []);
44278
- }
44279
- return this._importManager.addImport({
44280
- requestedFile: sourceFile,
44281
- exportSymbolName: symbolName,
44282
- exportModuleSpecifier: moduleName,
44283
- unsafeAliasOverride: alias,
44284
- });
44285
- }
44286
- /**
44287
- * Removes an import from a file.
44288
- * @param sourceFile File from which to remove the import.
44289
- * @param symbolName Original name of the symbol to be removed. Used even if the import is aliased.
44290
- * @param moduleName Module from which the symbol is imported.
44291
- */
44292
- removeImport(sourceFile, symbolName, moduleName) {
44293
- // It's common for paths to be manipulated with Node's `path` utilties which
44294
- // can yield a path with back slashes. Normalize them since outputting such
44295
- // paths will also cause TS to escape the forward slashes.
44296
- moduleName = normalizePath(moduleName);
44297
- if (!this._changes.has(sourceFile)) {
44298
- this._changes.set(sourceFile, []);
44299
- }
44300
- this._importManager.removeImport(sourceFile, symbolName, moduleName);
44301
- }
44302
- /**
44303
- * Gets the changes that should be applied to all the files in the migration.
44304
- * The changes are sorted in the order in which they should be applied.
44305
- */
44306
- recordChanges() {
44307
- this._recordImports();
44308
- return this._changes;
44309
- }
44310
- /**
44311
- * Clear the tracked changes
44312
- */
44313
- clearChanges() {
44314
- this._changes.clear();
44315
- }
44316
- /**
44317
- * Adds a change to a `ChangesByFile` map.
44318
- * @param file File that the change is associated with.
44319
- * @param change Change to be added.
44320
- */
44321
- _trackChange(file, change) {
44322
- const changes = this._changes.get(file);
44323
- if (changes) {
44324
- // Insert the changes in reverse so that they're applied in reverse order.
44325
- // This ensures that the offsets of subsequent changes aren't affected by
44326
- // previous changes changing the file's text.
44327
- const insertIndex = changes.findIndex((current) => current.start <= change.start);
44328
- if (insertIndex === -1) {
44329
- changes.push(change);
44330
- }
44331
- else {
44332
- changes.splice(insertIndex, 0, change);
44333
- }
44334
- }
44335
- else {
44336
- this._changes.set(file, [change]);
44337
- }
44338
- }
44339
- /** Determines what kind of quotes to use for a specific file. */
44340
- _getQuoteKind(sourceFile) {
44341
- if (this._quotesCache.has(sourceFile)) {
44342
- return this._quotesCache.get(sourceFile);
44343
- }
44344
- let kind = 0 /* QuoteKind.SINGLE */;
44345
- for (const statement of sourceFile.statements) {
44346
- if (ts__default["default"].isImportDeclaration(statement) && ts__default["default"].isStringLiteral(statement.moduleSpecifier)) {
44347
- kind = statement.moduleSpecifier.getText()[0] === '"' ? 1 /* QuoteKind.DOUBLE */ : 0 /* QuoteKind.SINGLE */;
44348
- this._quotesCache.set(sourceFile, kind);
44349
- break;
44350
- }
44351
- }
44352
- return kind;
44353
- }
44354
- /** Records the pending import changes from the import manager. */
44355
- _recordImports() {
44356
- const { newImports, updatedImports, deletedImports } = this._importManager.finalize();
44357
- for (const [original, replacement] of updatedImports) {
44358
- this.replaceNode(original, replacement);
44359
- }
44360
- for (const node of deletedImports) {
44361
- this.removeNode(node);
44362
- }
44363
- for (const [sourceFile] of this._changes) {
44364
- const importsToAdd = newImports.get(sourceFile.fileName);
44365
- if (!importsToAdd) {
44366
- continue;
44367
- }
44368
- const importLines = [];
44369
- let lastImport = null;
44370
- for (const statement of sourceFile.statements) {
44371
- if (ts__default["default"].isImportDeclaration(statement)) {
44372
- lastImport = statement;
44373
- }
44374
- }
44375
- for (const decl of importsToAdd) {
44376
- importLines.push(this._printer.printNode(ts__default["default"].EmitHint.Unspecified, decl, sourceFile));
44377
- }
44378
- this.insertText(sourceFile, lastImport ? lastImport.getEnd() : 0, (lastImport ? '\n' : '') + importLines.join('\n'));
44379
- }
44380
- }
44381
- }
44382
- /** Normalizes a path to use posix separators. */
44383
- function normalizePath(path) {
44384
- return path.replace(/\\/g, '/');
44385
- }
44386
-
44387
- function parseTsconfigFile(tsconfigPath, basePath) {
44388
- const { config } = ts__default["default"].readConfigFile(tsconfigPath, ts__default["default"].sys.readFile);
44389
- const parseConfigHost = {
44390
- useCaseSensitiveFileNames: ts__default["default"].sys.useCaseSensitiveFileNames,
44391
- fileExists: ts__default["default"].sys.fileExists,
44392
- readDirectory: ts__default["default"].sys.readDirectory,
44393
- readFile: ts__default["default"].sys.readFile,
44394
- };
44395
- // Throw if incorrect arguments are passed to this function. Passing relative base paths
44396
- // results in root directories not being resolved and in later type checking runtime errors.
44397
- // More details can be found here: https://github.com/microsoft/TypeScript/issues/37731.
44398
- if (!p__namespace.isAbsolute(basePath)) {
44399
- throw Error('Unexpected relative base path has been specified.');
44400
- }
44401
- return ts__default["default"].parseJsonConfigFileContent(config, parseConfigHost, basePath, {});
44402
- }
44403
-
44404
- /**
44405
- * Creates a TypeScript program instance for a TypeScript project within
44406
- * the virtual file system tree.
44407
- * @param tree Virtual file system tree that contains the source files.
44408
- * @param tsconfigPath Virtual file system path that resolves to the TypeScript project.
44409
- * @param basePath Base path for the virtual file system tree.
44410
- * @param fakeFileRead Optional file reader function. Can be used to overwrite files in
44411
- * the TypeScript program, or to add in-memory files (e.g. to add global types).
44412
- * @param additionalFiles Additional file paths that should be added to the program.
44413
- */
44414
- function createMigrationProgram(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles) {
44415
- const { rootNames, options, host } = createProgramOptions(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles);
44416
- return ts__default["default"].createProgram(rootNames, options, host);
44417
- }
44418
- /**
44419
- * Creates the options necessary to instantiate a TypeScript program.
44420
- * @param tree Virtual file system tree that contains the source files.
44421
- * @param tsconfigPath Virtual file system path that resolves to the TypeScript project.
44422
- * @param basePath Base path for the virtual file system tree.
44423
- * @param fakeFileRead Optional file reader function. Can be used to overwrite files in
44424
- * the TypeScript program, or to add in-memory files (e.g. to add global types).
44425
- * @param additionalFiles Additional file paths that should be added to the program.
44426
- * @param optionOverrides Overrides of the parsed compiler options.
44427
- */
44428
- function createProgramOptions(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles, optionOverrides) {
44429
- // Resolve the tsconfig path to an absolute path. This is needed as TypeScript otherwise
44430
- // is not able to resolve root directories in the given tsconfig. More details can be found
44431
- // in the following issue: https://github.com/microsoft/TypeScript/issues/37731.
44432
- tsconfigPath = p.resolve(basePath, tsconfigPath);
44433
- const parsed = parseTsconfigFile(tsconfigPath, p.dirname(tsconfigPath));
44434
- const options = optionOverrides ? { ...parsed.options, ...optionOverrides } : parsed.options;
44435
- const host = createMigrationCompilerHost(tree, options, basePath, fakeFileRead);
44436
- return { rootNames: parsed.fileNames.concat(additionalFiles || []), options, host };
44437
- }
44438
- function createMigrationCompilerHost(tree, options, basePath, fakeRead) {
44439
- const host = ts__default["default"].createCompilerHost(options, true);
44440
- const defaultReadFile = host.readFile;
44441
- // We need to overwrite the host "readFile" method, as we want the TypeScript
44442
- // program to be based on the file contents in the virtual file tree. Otherwise
44443
- // if we run multiple migrations we might have intersecting changes and
44444
- // source files.
44445
- host.readFile = (fileName) => {
44446
- const treeRelativePath = p.relative(basePath, fileName);
44447
- let result = fakeRead?.(treeRelativePath);
44448
- if (typeof result !== 'string') {
44449
- // If the relative path resolved to somewhere outside of the tree, fall back to
44450
- // TypeScript's default file reading function since the `tree` will throw an error.
44451
- result = treeRelativePath.startsWith('..')
44452
- ? defaultReadFile.call(host, fileName)
44453
- : tree.read(treeRelativePath)?.toString();
44454
- }
44455
- // Strip BOM as otherwise TSC methods (Ex: getWidth) will return an offset,
44456
- // which breaks the CLI UpdateRecorder.
44457
- // See: https://github.com/angular/angular/pull/30719
44458
- return typeof result === 'string' ? result.replace(/^\uFEFF/, '') : undefined;
44459
- };
44460
- return host;
44461
- }
44462
- /**
44463
- * Checks whether a file can be migrate by our automated migrations.
44464
- * @param basePath Absolute path to the project.
44465
- * @param sourceFile File being checked.
44466
- * @param program Program that includes the source file.
44467
- */
44468
- function canMigrateFile(basePath, sourceFile, program) {
44469
- // We shouldn't migrate .d.ts files, files from an external library or type checking files.
44470
- if (sourceFile.fileName.endsWith('.ngtypecheck.ts') ||
44471
- sourceFile.isDeclarationFile ||
44472
- program.isSourceFileFromExternalLibrary(sourceFile)) {
44473
- return false;
44474
- }
44475
- // Our migrations are set up to create a `Program` from the project's tsconfig and to migrate all
44476
- // the files within the program. This can include files that are outside of the Angular CLI
44477
- // project. We can't migrate files outside of the project, because our file system interactions
44478
- // go through the CLI's `Tree` which assumes that all files are within the project. See:
44479
- // https://github.com/angular/angular-cli/blob/0b0961c9c233a825b6e4bb59ab7f0790f9b14676/packages/angular_devkit/schematics/src/tree/host-tree.ts#L131
44480
- return !p.relative(basePath, sourceFile.fileName).startsWith('..');
44481
- }
44482
-
44483
44383
  exports.AST = AST;
44484
44384
  exports.ASTWithSource = ASTWithSource;
44485
44385
  exports.AbsoluteModuleStrategy = AbsoluteModuleStrategy;
@@ -44495,7 +44395,6 @@ exports.CR = CR;
44495
44395
  exports.CUSTOM_ELEMENTS_SCHEMA = CUSTOM_ELEMENTS_SCHEMA;
44496
44396
  exports.Call = Call;
44497
44397
  exports.Chain = Chain;
44498
- exports.ChangeTracker = ChangeTracker;
44499
44398
  exports.CloneVisitor = CloneVisitor;
44500
44399
  exports.CompoundMetadataReader = CompoundMetadataReader;
44501
44400
  exports.Conditional = Conditional;
@@ -44590,7 +44489,6 @@ exports.absoluteFromSourceFile = absoluteFromSourceFile;
44590
44489
  exports.arrowFn = arrowFn;
44591
44490
  exports.asLiteral = asLiteral;
44592
44491
  exports.assertSuccessfulReferenceEmit = assertSuccessfulReferenceEmit;
44593
- exports.canMigrateFile = canMigrateFile;
44594
44492
  exports.combineResolvers = combineResolvers;
44595
44493
  exports.compileComponentFromMetadata = compileComponentFromMetadata;
44596
44494
  exports.compileDeferResolverFunction = compileDeferResolverFunction;
@@ -44611,10 +44509,8 @@ exports.createHostDirectivesMappingArray = createHostDirectivesMappingArray;
44611
44509
  exports.createInjectableType = createInjectableType;
44612
44510
  exports.createInjectorType = createInjectorType;
44613
44511
  exports.createMayBeForwardRefExpression = createMayBeForwardRefExpression;
44614
- exports.createMigrationProgram = createMigrationProgram;
44615
44512
  exports.createNgModuleType = createNgModuleType;
44616
44513
  exports.createPipeType = createPipeType;
44617
- exports.createProgramOptions = createProgramOptions;
44618
44514
  exports.createSourceSpan = createSourceSpan;
44619
44515
  exports.decimalDigest = decimalDigest;
44620
44516
  exports.devOnlyGuardedExpression = devOnlyGuardedExpression;
@@ -44655,6 +44551,7 @@ exports.isFatalDiagnosticError = isFatalDiagnosticError;
44655
44551
  exports.isFileShimSourceFile = isFileShimSourceFile;
44656
44552
  exports.isFromDtsFile = isFromDtsFile;
44657
44553
  exports.isHostDirectiveMetaForGlobalMode = isHostDirectiveMetaForGlobalMode;
44554
+ exports.isLocalRelativePath = isLocalRelativePath;
44658
44555
  exports.isNamedClassDeclaration = isNamedClassDeclaration;
44659
44556
  exports.isNonDeclarationTsPath = isNonDeclarationTsPath;
44660
44557
  exports.isShim = isShim;
@@ -44670,7 +44567,6 @@ exports.mapLiteral = mapLiteral;
44670
44567
  exports.ngErrorCode = ngErrorCode;
44671
44568
  exports.nodeDebugInfo = nodeDebugInfo;
44672
44569
  exports.nodeNameForError = nodeNameForError;
44673
- exports.normalizePath = normalizePath;
44674
44570
  exports.parseHostBindings = parseHostBindings;
44675
44571
  exports.parseTemplate = parseTemplate;
44676
44572
  exports.presetImportManagerForceNamespaceImports = presetImportManagerForceNamespaceImports;