@angular/core 18.0.0 → 18.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/esm2022/primitives/event-dispatch/index.mjs +4 -2
  2. package/esm2022/primitives/event-dispatch/src/action_resolver.mjs +51 -35
  3. package/esm2022/primitives/event-dispatch/src/dispatcher.mjs +8 -6
  4. package/esm2022/primitives/event-dispatch/src/event.mjs +3 -7
  5. package/esm2022/primitives/event-dispatch/src/event_dispatcher.mjs +128 -0
  6. package/esm2022/primitives/event-dispatch/src/event_type.mjs +85 -1
  7. package/esm2022/primitives/event-dispatch/src/eventcontract.mjs +5 -8
  8. package/esm2022/primitives/signals/src/graph.mjs +6 -5
  9. package/esm2022/src/application/create_application.mjs +8 -3
  10. package/esm2022/src/change_detection/scheduling/ng_zone_scheduling.mjs +5 -14
  11. package/esm2022/src/change_detection/scheduling/zoneless_scheduling_impl.mjs +2 -2
  12. package/esm2022/src/core_private_export.mjs +3 -2
  13. package/esm2022/src/error_details_base_url.mjs +2 -2
  14. package/esm2022/src/errors.mjs +1 -1
  15. package/esm2022/src/event_delegation_utils.mjs +68 -0
  16. package/esm2022/src/hydration/annotate.mjs +24 -8
  17. package/esm2022/src/hydration/api.mjs +2 -2
  18. package/esm2022/src/hydration/event_replay.mjs +55 -81
  19. package/esm2022/src/hydration/tokens.mjs +6 -1
  20. package/esm2022/src/image_performance_warning.mjs +3 -3
  21. package/esm2022/src/platform/platform_ref.mjs +10 -3
  22. package/esm2022/src/render3/component_ref.mjs +1 -1
  23. package/esm2022/src/render3/instructions/listener.mjs +8 -11
  24. package/esm2022/src/render3/instructions/shared.mjs +3 -3
  25. package/esm2022/src/version.mjs +1 -1
  26. package/esm2022/testing/src/logger.mjs +3 -3
  27. package/esm2022/testing/src/test_bed_compiler.mjs +7 -3
  28. package/fesm2022/core.mjs +340 -292
  29. package/fesm2022/core.mjs.map +1 -1
  30. package/fesm2022/primitives/event-dispatch.mjs +1402 -1189
  31. package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
  32. package/fesm2022/primitives/signals.mjs +6 -5
  33. package/fesm2022/primitives/signals.mjs.map +1 -1
  34. package/fesm2022/rxjs-interop.mjs +1 -1
  35. package/fesm2022/testing.mjs +7 -3
  36. package/fesm2022/testing.mjs.map +1 -1
  37. package/index.d.ts +45 -3
  38. package/package.json +2 -2
  39. package/primitives/event-dispatch/index.d.ts +109 -116
  40. package/primitives/signals/index.d.ts +1 -1
  41. package/rxjs-interop/index.d.ts +1 -1
  42. package/schematics/migrations/http-providers/bundle.js +25 -17
  43. package/schematics/migrations/http-providers/bundle.js.map +2 -2
  44. package/schematics/migrations/invalid-two-way-bindings/bundle.js +337 -166
  45. package/schematics/migrations/invalid-two-way-bindings/bundle.js.map +3 -3
  46. package/schematics/ng-generate/control-flow-migration/bundle.js +361 -183
  47. package/schematics/ng-generate/control-flow-migration/bundle.js.map +3 -3
  48. package/schematics/ng-generate/standalone-migration/bundle.js +812 -497
  49. package/schematics/ng-generate/standalone-migration/bundle.js.map +3 -3
  50. package/testing/index.d.ts +1 -1
  51. package/esm2022/src/change_detection/scheduling/flags.mjs +0 -10
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.0.0
2
+ * @license Angular v18.0.2
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -11868,7 +11868,10 @@ export declare const enum ɵAnimationRendererType {
11868
11868
  * @param doc A reference to the current Document instance.
11869
11869
  * @return event types that need to be replayed
11870
11870
  */
11871
- export declare function ɵannotateForHydration(appRef: ApplicationRef, doc: Document): Set<string> | undefined;
11871
+ export declare function ɵannotateForHydration(appRef: ApplicationRef, doc: Document): {
11872
+ regular: Set<string>;
11873
+ capture: Set<string>;
11874
+ };
11872
11875
 
11873
11876
 
11874
11877
  /**
@@ -12071,6 +12074,39 @@ export declare abstract class ɵChangeDetectionScheduler {
12071
12074
  abstract runningTick: boolean;
12072
12075
  }
12073
12076
 
12077
+ export declare class ɵChangeDetectionSchedulerImpl implements ɵChangeDetectionScheduler {
12078
+ private readonly appRef;
12079
+ private readonly taskService;
12080
+ private readonly ngZone;
12081
+ private readonly zonelessEnabled;
12082
+ private readonly disableScheduling;
12083
+ private readonly zoneIsDefined;
12084
+ private readonly schedulerTickApplyArgs;
12085
+ private readonly subscriptions;
12086
+ private cancelScheduledCallback;
12087
+ private shouldRefreshViews;
12088
+ private useMicrotaskScheduler;
12089
+ runningTick: boolean;
12090
+ pendingRenderTaskId: number | null;
12091
+ constructor();
12092
+ notify(source: ɵNotificationSource): void;
12093
+ private shouldScheduleTick;
12094
+ /**
12095
+ * Calls ApplicationRef._tick inside the `NgZone`.
12096
+ *
12097
+ * Calling `tick` directly runs change detection and cancels any change detection that had been
12098
+ * scheduled previously.
12099
+ *
12100
+ * @param shouldRefreshViews Passed directly to `ApplicationRef._tick` and skips straight to
12101
+ * render hooks when `false`.
12102
+ */
12103
+ private tick;
12104
+ ngOnDestroy(): void;
12105
+ private cleanup;
12106
+ static ɵfac: i0.ɵɵFactoryDeclaration<ɵChangeDetectionSchedulerImpl, never>;
12107
+ static ɵprov: i0.ɵɵInjectableDeclaration<ɵChangeDetectionSchedulerImpl>;
12108
+ }
12109
+
12074
12110
  export declare function ɵclearResolutionOfComponentResourcesQueue(): Map<Type<any>, Component>;
12075
12111
 
12076
12112
  /**
@@ -13256,6 +13292,12 @@ export declare const enum ɵProfilerEvent {
13256
13292
  OutputEnd = 7
13257
13293
  }
13258
13294
 
13295
+ /**
13296
+ * Internal token used to verify that `provideZoneChangeDetection` is not used
13297
+ * with the bootstrapModule API.
13298
+ */
13299
+ export declare const ɵPROVIDED_NG_ZONE: InjectionToken<boolean>;
13300
+
13259
13301
  /**
13260
13302
  * An object that contains information about a provider that has been configured
13261
13303
  *
@@ -13489,7 +13531,7 @@ export declare class ɵRuntimeError<T extends number = ɵRuntimeErrorCode> exten
13489
13531
  * angular.io. This extra annotation is needed to avoid introducing a separate set to store
13490
13532
  * error codes which have guides, which might leak into runtime code.
13491
13533
  *
13492
- * Full list of available error guides can be found at https://angular.io/errors.
13534
+ * Full list of available error guides can be found at https://angular.dev/errors.
13493
13535
  *
13494
13536
  * Error code ranges per package:
13495
13537
  * - core (this package): 100-999
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@angular/core",
3
- "version": "18.0.0",
3
+ "version": "18.0.2",
4
4
  "description": "Angular - the core framework",
5
5
  "author": "angular",
6
6
  "license": "MIT",
7
7
  "engines": {
8
- "node": "^18.13.0 || >=20.9.0"
8
+ "node": "^18.19.1 || ^20.11.1 || >=22.0.0"
9
9
  },
10
10
  "exports": {
11
11
  "./schematics/*": {
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license Angular v18.0.0
2
+ * @license Angular v18.0.2
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
 
8
- declare namespace a11yClick {
8
+ declare namespace a11yClickLib {
9
9
  export {
10
10
  updateEventInfoForA11yClick,
11
11
  preventDefaultForA11yClick,
@@ -24,53 +24,14 @@ declare interface ActionInfo {
24
24
 
25
25
  declare type ActionInfoInternal = [name: string, element: Element];
26
26
 
27
- /** Resolves actions for Events. */
28
- declare class ActionResolver {
29
- private a11yClickSupport;
30
- private readonly syntheticMouseEventSupport;
31
- private updateEventInfoForA11yClick?;
32
- private preventDefaultForA11yClick?;
33
- private populateClickOnlyAction?;
34
- constructor({ syntheticMouseEventSupport, }?: {
35
- syntheticMouseEventSupport?: boolean;
36
- });
37
- resolve(eventInfo: eventInfoLib.EventInfo): void;
38
- /**
39
- * Searches for a jsaction that the DOM event maps to and creates an
40
- * object containing event information used for dispatching by
41
- * jsaction.Dispatcher. This method populates the `action` and `actionElement`
42
- * fields of the EventInfo object passed in by finding the first
43
- * jsaction attribute above the target Node of the event, and below
44
- * the container Node, that specifies a jsaction for the event
45
- * type. If no such jsaction is found, then action is undefined.
46
- *
47
- * @param eventInfo `EventInfo` to set `action` and `actionElement` if an
48
- * action is found on any `Element` in the path of the `Event`.
49
- */
50
- private populateAction;
51
- /**
52
- * Accesses the jsaction map on a node and retrieves the name of the
53
- * action the given event is mapped to, if any. It parses the
54
- * attribute value and stores it in a property on the node for
55
- * subsequent retrieval without re-parsing and re-accessing the
56
- * attribute.
57
- *
58
- * @param actionElement The DOM node to retrieve the jsaction map from.
59
- * @param eventInfo `EventInfo` to set `action` and `actionElement` if an
60
- * action is found on the `actionElement`.
61
- */
62
- private populateActionOnElement;
63
- /**
64
- * Parses and caches an element's jsaction element into a map.
65
- *
66
- * This is primarily for internal use.
67
- *
68
- * @param actionElement The DOM node to retrieve the jsaction map from.
69
- * @return Map from event to qualified name of the jsaction bound to it.
70
- */
71
- private parseActions;
72
- addA11yClickSupport(updateEventInfoForA11yClick: typeof a11yClick.updateEventInfoForA11yClick, preventDefaultForA11yClick: typeof a11yClick.preventDefaultForA11yClick, populateClickOnlyAction: typeof a11yClick.populateClickOnlyAction): void;
73
- }
27
+ export declare const Attribute: {
28
+ JSACTION: string;
29
+ OI: string;
30
+ VED: string;
31
+ VET: string;
32
+ JSINSTANCE: string;
33
+ JSTRACK: string;
34
+ };
74
35
 
75
36
  /**
76
37
  * Provides a factory function for bootstrapping an event contract on a
@@ -113,62 +74,8 @@ declare function createEventInfo({ eventType, event, targetElement, container, t
113
74
  */
114
75
  declare function createEventInfoFromParameters(eventType: string, event: Event, targetElement: Element, container: Element, timestamp: number, action?: ActionInfoInternal, isReplay?: boolean, a11yClickKey?: boolean): EventInfo;
115
76
 
116
- /**
117
- * Receives a DOM event, determines the jsaction associated with the source
118
- * element of the DOM event, and invokes the handler associated with the
119
- * jsaction.
120
- */
121
- export declare class Dispatcher {
122
- private readonly dispatchDelegate;
123
- private actionResolver?;
124
- /** The replayer function to be called when there are queued events. */
125
- private eventReplayer;
126
- /** Whether the event replay is scheduled. */
127
- private eventReplayScheduled;
128
- /** The queue of events. */
129
- private readonly replayEventInfoWrappers;
130
- /**
131
- * Options are:
132
- * - `eventReplayer`: When the event contract dispatches replay events
133
- * to the Dispatcher, the Dispatcher collects them and in the next tick
134
- * dispatches them to the `eventReplayer`. Defaults to dispatching to `dispatchDelegate`.
135
- * @param dispatchDelegate A function that should handle dispatching an `EventInfoWrapper` to handlers.
136
- */
137
- constructor(dispatchDelegate: (eventInfoWrapper: EventInfoWrapper) => void, { actionResolver, eventReplayer, }?: {
138
- actionResolver?: ActionResolver;
139
- eventReplayer?: Replayer;
140
- });
141
- /**
142
- * Receives an event or the event queue from the EventContract. The event
143
- * queue is copied and it attempts to replay.
144
- * If event info is passed in it looks for an action handler that can handle
145
- * the given event. If there is no handler registered queues the event and
146
- * checks if a loader is registered for the given namespace. If so, calls it.
147
- *
148
- * Alternatively, if in global dispatch mode, calls all registered global
149
- * handlers for the appropriate event type.
150
- *
151
- * The three functionalities of this call are deliberately not split into
152
- * three methods (and then declared as an abstract interface), because the
153
- * interface is used by EventContract, which lives in a different jsbinary.
154
- * Therefore the interface between the three is defined entirely in terms that
155
- * are invariant under jscompiler processing (Function and Array, as opposed
156
- * to a custom type with method names).
157
- *
158
- * @param eventInfo The info for the event that triggered this call or the
159
- * queue of events from EventContract.
160
- */
161
- dispatch(eventInfo: EventInfo): void;
162
- /**
163
- * Schedules an `EventInfoWrapper` for replay. The replaying will happen in its own
164
- * stack once the current flow cedes control. This is done to mimic
165
- * browser event handling.
166
- */
167
- private scheduleEventInfoWrapperReplay;
168
- }
169
-
170
77
  /** A function that is called to handle events captured by the EventContract. */
171
- declare type Dispatcher_2 = (eventInfo: eventInfoLib.EventInfo, globalDispatch?: boolean) => void;
78
+ declare type Dispatcher = (eventInfo: eventInfoLib.EventInfo, globalDispatch?: boolean) => void;
172
79
 
173
80
  /**
174
81
  * Defines the early jsaction data types.
@@ -234,7 +141,7 @@ export declare class EventContract implements UnrenamedEventContract {
234
141
  private queuedEventInfos;
235
142
  /** Whether to add an a11y click listener. */
236
143
  private addA11yClickListener;
237
- ecaacs?: (updateEventInfoForA11yClick: typeof a11yClick.updateEventInfoForA11yClick, preventDefaultForA11yClick: typeof a11yClick.preventDefaultForA11yClick, populateClickOnlyAction: typeof a11yClick.populateClickOnlyAction) => void;
144
+ ecaacs?: (updateEventInfoForA11yClick: typeof a11yClickLib.updateEventInfoForA11yClick, preventDefaultForA11yClick: typeof a11yClickLib.preventDefaultForA11yClick, populateClickOnlyAction: typeof a11yClickLib.populateClickOnlyAction) => void;
238
145
  constructor(containerManager: EventContractContainerManager, useActionResolver?: boolean);
239
146
  private handleEvent;
240
147
  /**
@@ -285,13 +192,13 @@ export declare class EventContract implements UnrenamedEventContract {
285
192
  * @param dispatcher The dispatcher function.
286
193
  * @param restriction
287
194
  */
288
- registerDispatcher(dispatcher: Dispatcher_2, restriction: Restriction): void;
195
+ registerDispatcher(dispatcher: Dispatcher, restriction: Restriction): void;
289
196
  /**
290
197
  * Unrenamed alias for registerDispatcher. Necessary for any codebases that
291
198
  * split the `EventContract` and `Dispatcher` code into different compilation
292
199
  * units.
293
200
  */
294
- ecrd(dispatcher: Dispatcher_2, restriction: Restriction): void;
201
+ ecrd(dispatcher: Dispatcher, restriction: Restriction): void;
295
202
  /**
296
203
  * Adds a11y click support to the given `EventContract`. Meant to be called in
297
204
  * the same compilation unit as the `EventContract`.
@@ -353,6 +260,23 @@ export declare type EventContractTracker<T> = {
353
260
  };
354
261
  };
355
262
 
263
+ /**
264
+ * A dispatcher that uses browser-based `Event` semantics, for example bubbling, `stopPropagation`,
265
+ * `currentTarget`, etc.
266
+ */
267
+ export declare class EventDispatcher {
268
+ private readonly dispatchDelegate;
269
+ private readonly actionResolver;
270
+ private readonly dispatcher;
271
+ constructor(dispatchDelegate: (event: Event, actionName: string) => void);
272
+ /**
273
+ * The entrypoint for the `EventContract` dispatch.
274
+ */
275
+ dispatch(eventInfo: EventInfo): void;
276
+ /** Internal method that does basic disaptching. */
277
+ private dispatchToDelegate;
278
+ }
279
+
356
280
  /**
357
281
  * A function that handles an event dispatched from the browser.
358
282
  *
@@ -469,6 +393,11 @@ export declare class EventInfoWrapper {
469
393
  clone(): EventInfoWrapper;
470
394
  }
471
395
 
396
+ /** Extra event phases beyond what the browser provides. */
397
+ export declare const EventPhase: {
398
+ REPLAY: number;
399
+ };
400
+
472
401
  /** Added for readability when accessing stable property names. */
473
402
  declare function getA11yClickKey(eventInfo: EventInfo): boolean | undefined;
474
403
 
@@ -502,6 +431,62 @@ declare function getTargetElement(eventInfo: EventInfo): Element;
502
431
  /** Added for readability when accessing stable property names. */
503
432
  declare function getTimestamp(eventInfo: EventInfo): number;
504
433
 
434
+ /**
435
+ *
436
+ * Decides whether or not an event type is an event that only has a capture phase.
437
+ *
438
+ * @param eventType
439
+ * @returns bool
440
+ */
441
+ export declare const isCaptureEvent: (eventType: string) => boolean;
442
+
443
+ /**
444
+ * Detects whether a given event type is supported by JSAction.
445
+ */
446
+ export declare const isSupportedEvent: (eventType: string) => boolean;
447
+
448
+ /**
449
+ * The jsaction attribute defines a mapping of a DOM event to a
450
+ * generic event (aka jsaction), to which the actual event handlers
451
+ * that implement the behavior of the application are bound. The
452
+ * value is a semicolon separated list of colon separated pairs of
453
+ * an optional DOM event name and a jsaction name. If the optional
454
+ * DOM event name is omitted, 'click' is assumed. The jsaction names
455
+ * are dot separated pairs of a namespace and a simple jsaction
456
+ * name.
457
+ *
458
+ * See grammar in README.md for expected syntax in the attribute value.
459
+ */
460
+ export declare const JSACTION = "jsaction";
461
+
462
+ /**
463
+ * Support for iteration on reprocessing.
464
+ *
465
+ * Used by ActionFlow.
466
+ */
467
+ export declare const JSINSTANCE = "jsinstance";
468
+
469
+ /**
470
+ * All click jsactions that happen on the element that carries this
471
+ * attribute or its descendants are automatically logged.
472
+ * Impressions of jsactions on these elements are tracked too, if
473
+ * requested by the impression() method of ActionFlow.
474
+ *
475
+ * Used by ActionFlow.
476
+ */
477
+ export declare const JSTRACK = "jstrack";
478
+
479
+ /**
480
+ * The oi attribute is a log impression tag for impression logging
481
+ * and action tracking. For an element that carries a jsaction
482
+ * attribute, the element is identified for the purpose of
483
+ * impression logging and click tracking by the dot separated path
484
+ * of all oi attributes in the chain of ancestors of the element.
485
+ *
486
+ * Used by ActionFlow.
487
+ */
488
+ export declare const OI = "oi";
489
+
505
490
  /**
506
491
  * Sets the `action` to `clickonly` for a click event that is not an a11y click
507
492
  * and if there is not already a click action.
@@ -520,13 +505,7 @@ declare function preventDefaultForA11yClick(eventInfo: eventInfoLib.EventInfo):
520
505
  * Registers deferred functionality for an EventContract and a Jsaction
521
506
  * Dispatcher.
522
507
  */
523
- export declare function registerDispatcher(eventContract: UnrenamedEventContract, dispatcher: Dispatcher): void;
524
-
525
- /**
526
- * A replayer is a function that is called when there are queued events,
527
- * either from the `EventContract` or when there are no detected handlers.
528
- */
529
- declare type Replayer = (eventInfoWrappers: EventInfoWrapper[]) => void;
508
+ export declare function registerDispatcher(eventContract: UnrenamedEventContract, dispatcher: EventDispatcher): void;
530
509
 
531
510
 
532
511
  /**
@@ -567,8 +546,8 @@ declare function setTimestamp(eventInfo: EventInfo, timestamp: number): void;
567
546
  * The API of an EventContract that is safe to call from any compilation unit.
568
547
  */
569
548
  declare interface UnrenamedEventContract {
570
- ecrd(dispatcher: Dispatcher_2, restriction: Restriction): void;
571
- ecaacs?: (updateEventInfoForA11yClick: typeof a11yClick.updateEventInfoForA11yClick, preventDefaultForA11yClick: typeof a11yClick.preventDefaultForA11yClick, populateClickOnlyAction: typeof a11yClick.populateClickOnlyAction) => void;
549
+ ecrd(dispatcher: Dispatcher, restriction: Restriction): void;
550
+ ecaacs?: (updateEventInfoForA11yClick: typeof a11yClickLib.updateEventInfoForA11yClick, preventDefaultForA11yClick: typeof a11yClickLib.preventDefaultForA11yClick, populateClickOnlyAction: typeof a11yClickLib.populateClickOnlyAction) => void;
572
551
  }
573
552
 
574
553
  /** Added for readability when accessing stable property names. */
@@ -580,4 +559,18 @@ declare function unsetAction(eventInfo: EventInfo): void;
580
559
  */
581
560
  declare function updateEventInfoForA11yClick(eventInfo: eventInfoLib.EventInfo): void;
582
561
 
562
+ /**
563
+ * The ved attribute is an encoded ClickTrackingCGI proto to track
564
+ * visual elements.
565
+ *
566
+ * Used by ActionFlow.
567
+ */
568
+ export declare const VED = "ved";
569
+
570
+ /**
571
+ * The vet attribute is the visual element type used to identify tracked
572
+ * visual elements.
573
+ */
574
+ export declare const VET = "vet";
575
+
583
576
  export { }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.0.0
2
+ * @license Angular v18.0.2
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.0.0
2
+ * @license Angular v18.0.2
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -60,7 +60,7 @@ var __async = (__this, __arguments, generator) => {
60
60
  });
61
61
  };
62
62
 
63
- // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/migrations/http-providers/index.mjs
63
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/migrations/http-providers/index.mjs
64
64
  var http_providers_exports = {};
65
65
  __export(http_providers_exports, {
66
66
  default: () => http_providers_default
@@ -69,7 +69,7 @@ module.exports = __toCommonJS(http_providers_exports);
69
69
  var import_schematics = require("@angular-devkit/schematics");
70
70
  var import_path3 = require("path");
71
71
 
72
- // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/project_tsconfig_paths.mjs
72
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/project_tsconfig_paths.mjs
73
73
  var import_core = require("@angular-devkit/core");
74
74
  function getProjectTsConfigPaths(tree) {
75
75
  return __async(this, null, function* () {
@@ -149,11 +149,11 @@ function getWorkspace(tree) {
149
149
  });
150
150
  }
151
151
 
152
- // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
152
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
153
153
  var import_path = require("path");
154
154
  var import_typescript2 = __toESM(require("typescript"), 1);
155
155
 
156
- // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/parse_tsconfig.mjs
156
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/typescript/parse_tsconfig.mjs
157
157
  var path = __toESM(require("path"), 1);
158
158
  var import_typescript = __toESM(require("typescript"), 1);
159
159
  function parseTsconfigFile(tsconfigPath, basePath) {
@@ -170,7 +170,7 @@ function parseTsconfigFile(tsconfigPath, basePath) {
170
170
  return import_typescript.default.parseJsonConfigFileContent(config, parseConfigHost, basePath, {});
171
171
  }
172
172
 
173
- // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
173
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
174
174
  function createMigrationProgram(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles) {
175
175
  const { rootNames, options, host } = createProgramOptions(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles);
176
176
  return import_typescript2.default.createProgram(rootNames, options, host);
@@ -203,13 +203,13 @@ function canMigrateFile(basePath, sourceFile, program) {
203
203
  return !(0, import_path.relative)(basePath, sourceFile.fileName).startsWith("..");
204
204
  }
205
205
 
206
- // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/migrations/http-providers/utils.mjs
206
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/migrations/http-providers/utils.mjs
207
207
  var import_typescript7 = __toESM(require("typescript"), 1);
208
208
 
209
- // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/change_tracker.mjs
209
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/change_tracker.mjs
210
210
  var import_typescript4 = __toESM(require("typescript"), 1);
211
211
 
212
- // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/import_manager.mjs
212
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/import_manager.mjs
213
213
  var import_path2 = require("path");
214
214
  var import_typescript3 = __toESM(require("typescript"), 1);
215
215
  var ImportManager = class {
@@ -393,7 +393,7 @@ ${text}`;
393
393
  }
394
394
  };
395
395
 
396
- // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/change_tracker.mjs
396
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/change_tracker.mjs
397
397
  var ChangeTracker = class {
398
398
  constructor(_printer, _importRemapper) {
399
399
  __publicField(this, "_printer");
@@ -456,10 +456,10 @@ function normalizePath(path2) {
456
456
  return path2.replace(/\\/g, "/");
457
457
  }
458
458
 
459
- // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/decorators.mjs
459
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/typescript/decorators.mjs
460
460
  var import_typescript6 = __toESM(require("typescript"), 1);
461
461
 
462
- // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/imports.mjs
462
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/typescript/imports.mjs
463
463
  var import_typescript5 = __toESM(require("typescript"), 1);
464
464
  function getImportOfIdentifier(typeChecker, node) {
465
465
  const symbol = typeChecker.getSymbolAtLocation(node);
@@ -519,7 +519,7 @@ function findImportSpecifier(nodes, specifierName) {
519
519
  });
520
520
  }
521
521
 
522
- // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/decorators.mjs
522
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/typescript/decorators.mjs
523
523
  function getCallDecoratorImport(typeChecker, decorator) {
524
524
  if (!import_typescript6.default.isCallExpression(decorator.expression) || !import_typescript6.default.isIdentifier(decorator.expression.expression)) {
525
525
  return null;
@@ -528,7 +528,7 @@ function getCallDecoratorImport(typeChecker, decorator) {
528
528
  return getImportOfIdentifier(typeChecker, identifier);
529
529
  }
530
530
 
531
- // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/ng_decorators.mjs
531
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/ng_decorators.mjs
532
532
  function getAngularDecorators(typeChecker, decorators) {
533
533
  return decorators.map((node) => ({ node, importData: getCallDecoratorImport(typeChecker, node) })).filter(({ importData }) => importData && importData.importModule.startsWith("@angular/")).map(({ node, importData }) => ({
534
534
  node,
@@ -538,7 +538,7 @@ function getAngularDecorators(typeChecker, decorators) {
538
538
  }));
539
539
  }
540
540
 
541
- // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/migrations/http-providers/utils.mjs
541
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/migrations/http-providers/utils.mjs
542
542
  var HTTP_CLIENT_MODULE = "HttpClientModule";
543
543
  var HTTP_CLIENT_XSRF_MODULE = "HttpClientXsrfModule";
544
544
  var HTTP_CLIENT_JSONP_MODULE = "HttpClientJsonpModule";
@@ -571,7 +571,7 @@ function migrateFile(sourceFile, typeChecker, rewriteFn) {
571
571
  if (import_typescript7.default.isClassDeclaration(node)) {
572
572
  const decorators = getAngularDecorators(typeChecker, import_typescript7.default.getDecorators(node) || []);
573
573
  decorators.forEach((decorator) => {
574
- migrateDecorator(decorator, commonHttpIdentifiers, commonHttpTestingIdentifiers, addedImports, changeTracker);
574
+ migrateDecorator(decorator, commonHttpIdentifiers, commonHttpTestingIdentifiers, addedImports, changeTracker, sourceFile);
575
575
  });
576
576
  }
577
577
  migrateTestingModuleImports(node, commonHttpIdentifiers, commonHttpTestingIdentifiers, addedImports, changeTracker);
@@ -610,7 +610,7 @@ function migrateFile(sourceFile, typeChecker, rewriteFn) {
610
610
  }
611
611
  }
612
612
  }
613
- function migrateDecorator(decorator, commonHttpIdentifiers, commonHttpTestingIdentifiers, addedImports, changeTracker) {
613
+ function migrateDecorator(decorator, commonHttpIdentifiers, commonHttpTestingIdentifiers, addedImports, changeTracker, sourceFile) {
614
614
  var _a;
615
615
  if (decorator.name !== "NgModule" && decorator.name !== "Component" || decorator.node.expression.arguments.length < 1) {
616
616
  return;
@@ -627,6 +627,14 @@ function migrateDecorator(decorator, commonHttpIdentifiers, commonHttpTestingIde
627
627
  if (!importedModules) {
628
628
  return;
629
629
  }
630
+ const isComponent = decorator.name === "Component";
631
+ if (isComponent && importedModules.client) {
632
+ const httpClientModuleIdentifier = importedModules.client;
633
+ const commentText = "\n// TODO: `HttpClientModule` should not be imported into a component directly.\n// Please refactor the code to add `provideHttpClient()` call to the provider list in the\n// application bootstrap logic and remove the `HttpClientModule` import from this component.\n";
634
+ import_typescript7.default.addSyntheticLeadingComment(httpClientModuleIdentifier, import_typescript7.default.SyntaxKind.SingleLineCommentTrivia, commentText, true);
635
+ changeTracker.insertText(sourceFile, httpClientModuleIdentifier.getStart(), commentText);
636
+ return;
637
+ }
630
638
  const addedProviders = /* @__PURE__ */ new Set();
631
639
  const commonHttpAddedImports = addedImports.get(COMMON_HTTP);
632
640
  commonHttpAddedImports == null ? void 0 : commonHttpAddedImports.add(PROVIDE_HTTP_CLIENT);
@@ -818,7 +826,7 @@ function updateTestBedConfiguration(configureTestingModuleArgs, newImports, newP
818
826
  ]);
819
827
  }
820
828
 
821
- // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/migrations/http-providers/index.mjs
829
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/migrations/http-providers/index.mjs
822
830
  function http_providers_default() {
823
831
  return (tree) => __async(this, null, function* () {
824
832
  const { buildPaths, testPaths } = yield getProjectTsConfigPaths(tree);