@angular/core 15.0.0-next.4 → 15.0.0-next.6

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 (47) hide show
  1. package/esm2020/src/application_ref.mjs +1 -1
  2. package/esm2020/src/core_private_export.mjs +2 -1
  3. package/esm2020/src/di/index.mjs +2 -2
  4. package/esm2020/src/di/injectable.mjs +1 -1
  5. package/esm2020/src/di/injection_token.mjs +6 -3
  6. package/esm2020/src/di/interface/defs.mjs +1 -1
  7. package/esm2020/src/di/interface/provider.mjs +4 -2
  8. package/esm2020/src/di/provider_collection.mjs +30 -4
  9. package/esm2020/src/di/r3_injector.mjs +4 -6
  10. package/esm2020/src/errors.mjs +1 -1
  11. package/esm2020/src/metadata/directives.mjs +1 -1
  12. package/esm2020/src/metadata/ng_module.mjs +1 -1
  13. package/esm2020/src/render3/component_ref.mjs +20 -10
  14. package/esm2020/src/render3/errors_di.mjs +9 -3
  15. package/esm2020/src/render3/features/host_directives_feature.mjs +101 -9
  16. package/esm2020/src/render3/features/ng_onchanges_feature.mjs +4 -2
  17. package/esm2020/src/render3/instructions/shared.mjs +70 -34
  18. package/esm2020/src/render3/interfaces/definition.mjs +1 -1
  19. package/esm2020/src/render3/jit/directive.mjs +2 -6
  20. package/esm2020/src/render3/jit/module.mjs +2 -2
  21. package/esm2020/src/render3/ng_module_ref.mjs +1 -1
  22. package/esm2020/src/version.mjs +1 -1
  23. package/esm2020/testing/src/logger.mjs +3 -3
  24. package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
  25. package/esm2020/testing/src/test_bed_compiler.mjs +29 -11
  26. package/fesm2015/core.mjs +243 -69
  27. package/fesm2015/core.mjs.map +1 -1
  28. package/fesm2015/testing.mjs +269 -73
  29. package/fesm2015/testing.mjs.map +1 -1
  30. package/fesm2020/core.mjs +243 -69
  31. package/fesm2020/core.mjs.map +1 -1
  32. package/fesm2020/testing.mjs +269 -73
  33. package/fesm2020/testing.mjs.map +1 -1
  34. package/index.d.ts +103 -32
  35. package/package.json +2 -2
  36. package/schematics/migrations/relative-link-resolution/index.d.ts +10 -0
  37. package/schematics/migrations/relative-link-resolution/index.js +68 -0
  38. package/schematics/migrations/relative-link-resolution/util.d.ts +20 -0
  39. package/schematics/migrations/relative-link-resolution/util.js +82 -0
  40. package/schematics/migrations/router-link-with-href/index.d.ts +10 -0
  41. package/schematics/migrations/router-link-with-href/index.js +70 -0
  42. package/schematics/migrations/router-link-with-href/util.d.ts +19 -0
  43. package/schematics/migrations/router-link-with-href/util.js +111 -0
  44. package/schematics/migrations.json +10 -0
  45. package/schematics/utils/typescript/imports.d.ts +10 -0
  46. package/schematics/utils/typescript/imports.js +17 -2
  47. package/testing/index.d.ts +1 -1
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.0.0-next.4
2
+ * @license Angular v15.0.0-next.6
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1029,10 +1029,10 @@ export declare interface Component extends Directive {
1029
1029
  preserveWhitespaces?: boolean;
1030
1030
  /**
1031
1031
  * Angular components marked as `standalone` do not need to be declared in an NgModule. Such
1032
- * components directly manage their own template dependencies (components, directives and pipes
1032
+ * components directly manage their own template dependencies (components, directives, and pipes
1033
1033
  * used in a template) via the imports property.
1034
1034
  *
1035
- * More information about standalone components, directives and pipes can be found in [this
1035
+ * More information about standalone components, directives, and pipes can be found in [this
1036
1036
  * guide](guide/standalone-components).
1037
1037
  *
1038
1038
  * @developerPreview
@@ -1041,12 +1041,12 @@ export declare interface Component extends Directive {
1041
1041
  /**
1042
1042
  * The imports property specifies the standalone component's template dependencies — those
1043
1043
  * directives, components, and pipes that can be used within its template. Standalone components
1044
- * can import other standalone components, directives and pipes as well as existing NgModules.
1044
+ * can import other standalone components, directives, and pipes as well as existing NgModules.
1045
1045
  *
1046
1046
  * This property is only available for standalone components - specifying it for components
1047
1047
  * declared in an NgModule generates a compilation error.
1048
1048
  *
1049
- * More information about standalone components, directives and pipes can be found in [this
1049
+ * More information about standalone components, directives, and pipes can be found in [this
1050
1050
  * guide](guide/standalone-components).
1051
1051
  *
1052
1052
  * @developerPreview
@@ -1059,7 +1059,7 @@ export declare interface Component extends Directive {
1059
1059
  * This property is only available for standalone components - specifying it for components
1060
1060
  * declared in an NgModule generates a compilation error.
1061
1061
  *
1062
- * More information about standalone components, directives and pipes can be found in [this
1062
+ * More information about standalone components, directives, and pipes can be found in [this
1063
1063
  * guide](guide/standalone-components).
1064
1064
  */
1065
1065
  schemas?: SchemaMetadata[];
@@ -1736,7 +1736,7 @@ export declare function createComponent<C>(component: Type<C>, options: {
1736
1736
  * @publicApi
1737
1737
  * @developerPreview
1738
1738
  */
1739
- export declare function createEnvironmentInjector(providers: Array<Provider | ImportedNgModuleProviders>, parent: EnvironmentInjector, debugName?: string | null): EnvironmentInjector;
1739
+ export declare function createEnvironmentInjector(providers: Array<Provider | EnvironmentProviders>, parent: EnvironmentInjector, debugName?: string | null): EnvironmentInjector;
1740
1740
 
1741
1741
  /**
1742
1742
  * Returns a new NgModuleRef instance based on the NgModule class and parent injector provided.
@@ -2384,12 +2384,22 @@ export declare interface Directive {
2384
2384
  * directives don't depend on any "intermediate context" of an NgModule (ex. configured
2385
2385
  * providers).
2386
2386
  *
2387
- * More information about standalone components, directives and pipes can be found in [this
2387
+ * More information about standalone components, directives, and pipes can be found in [this
2388
2388
  * guide](guide/standalone-components).
2389
2389
  *
2390
2390
  * @developerPreview
2391
2391
  */
2392
2392
  standalone?: boolean;
2393
+ /**
2394
+ * Standalone directives that should be applied to the host whenever the directive is matched.
2395
+ * By default none of the inputs or outputs of the host directives will be available on the host,
2396
+ * unless they are specified in the `inputs` or `outputs` properties.
2397
+ */
2398
+ hostDirectives?: (Type<unknown> | {
2399
+ directive: Type<unknown>;
2400
+ inputs?: string[];
2401
+ outputs?: string[];
2402
+ })[];
2393
2403
  }
2394
2404
 
2395
2405
  /**
@@ -2767,6 +2777,25 @@ export declare abstract class EnvironmentInjector implements Injector {
2767
2777
  abstract destroy(): void;
2768
2778
  }
2769
2779
 
2780
+ /**
2781
+ * Encapsulated `Provider`s that are only accepted during creation of an `EnvironmentInjector` (e.g.
2782
+ * in an `NgModule`).
2783
+ *
2784
+ * Using this wrapper type prevents providers which are only designed to work in
2785
+ * application/environment injectors from being accidentally included in
2786
+ * `@Component.providers` and ending up in a component injector.
2787
+ *
2788
+ * This wrapper type prevents access to the `Provider`s inside.
2789
+ *
2790
+ * @see `makeEnvironmentProviders`
2791
+ * @see `importProvidersFrom`
2792
+ *
2793
+ * @publicApi
2794
+ */
2795
+ export declare type EnvironmentProviders = {
2796
+ ɵbrand: 'EnvironmentProviders';
2797
+ };
2798
+
2770
2799
 
2771
2800
  /**
2772
2801
  * Provides a hook for centralized exception handling.
@@ -3281,6 +3310,15 @@ export declare interface HostDecorator {
3281
3310
  new (): Host;
3282
3311
  }
3283
3312
 
3313
+ /**
3314
+ * Mapping between the public aliases of directive bindings and the underlying inputs/outputs that
3315
+ * they represent. Also serves as an allowlist of the inputs/outputs from the host directive that
3316
+ * the author has decided to expose.
3317
+ */
3318
+ declare type HostDirectiveBindingMap = {
3319
+ [publicName: string]: string;
3320
+ };
3321
+
3284
3322
  /** Values that can be used to define a host directive through the `HostDirectivesFeature`. */
3285
3323
  declare type HostDirectiveConfig = Type<unknown> | {
3286
3324
  directive: Type<unknown>;
@@ -3293,15 +3331,17 @@ declare interface HostDirectiveDef<T = unknown> {
3293
3331
  /** Class representing the host directive. */
3294
3332
  directive: Type<T>;
3295
3333
  /** Directive inputs that have been exposed. */
3296
- inputs: {
3297
- [publicName: string]: string;
3298
- };
3334
+ inputs: HostDirectiveBindingMap;
3299
3335
  /** Directive outputs that have been exposed. */
3300
- outputs: {
3301
- [publicName: string]: string;
3302
- };
3336
+ outputs: HostDirectiveBindingMap;
3303
3337
  }
3304
3338
 
3339
+ /**
3340
+ * Mapping between a directive that was used as a host directive
3341
+ * and the configuration that was used to define it as such.
3342
+ */
3343
+ declare type HostDirectiveDefs = Map<ɵDirectiveDef<unknown>, HostDirectiveDef>;
3344
+
3305
3345
  /**
3306
3346
  * Type of the HostListener metadata.
3307
3347
  *
@@ -3639,11 +3679,9 @@ declare const ID = 20;
3639
3679
  * @see `importProvidersFrom`
3640
3680
  *
3641
3681
  * @publicApi
3642
- * @developerPreview
3682
+ * @deprecated replaced by `EnvironmentProviders`
3643
3683
  */
3644
- export declare interface ImportedNgModuleProviders {
3645
- ɵproviders: Provider[];
3646
- }
3684
+ export declare type ImportedNgModuleProviders = EnvironmentProviders;
3647
3685
 
3648
3686
  /**
3649
3687
  * Collects providers from all NgModules and standalone components, including transitively imported
@@ -3686,7 +3724,7 @@ export declare interface ImportedNgModuleProviders {
3686
3724
  * @publicApi
3687
3725
  * @developerPreview
3688
3726
  */
3689
- export declare function importProvidersFrom(...sources: ImportProvidersSource[]): ImportedNgModuleProviders;
3727
+ export declare function importProvidersFrom(...sources: ImportProvidersSource[]): EnvironmentProviders;
3690
3728
 
3691
3729
  /**
3692
3730
  * A source of providers for the `importProvidersFrom` function.
@@ -3806,7 +3844,8 @@ export declare interface Injectable {
3806
3844
  /**
3807
3845
  * Determines which injectors will provide the injectable.
3808
3846
  *
3809
- * - `Type<any>` - associates the injectable with an `@NgModule` or other `InjectorType`,
3847
+ * - `Type<any>` - associates the injectable with an `@NgModule` or other `InjectorType`. This
3848
+ * option is DEPRECATED.
3810
3849
  * - 'null' : Equivalent to `undefined`. The injectable is not provided in any scope automatically
3811
3850
  * and must be added to a `providers` array of an [@NgModule](api/core/NgModule#providers),
3812
3851
  * [@Component](api/core/Directive#providers) or [@Directive](api/core/Directive#providers).
@@ -3817,7 +3856,7 @@ export declare interface Injectable {
3817
3856
  * - 'platform' : A special singleton platform injector shared by all
3818
3857
  * applications on the page.
3819
3858
  * - 'any' : Provides a unique instance in each lazy loaded module while all eagerly loaded
3820
- * modules share one instance.
3859
+ * modules share one instance. This option is DEPRECATED.
3821
3860
  *
3822
3861
  */
3823
3862
  providedIn?: Type<any> | 'root' | 'platform' | 'any' | null;
@@ -3962,8 +4001,11 @@ export declare enum InjectFlags {
3962
4001
  * As you can see in the Tree-shakable InjectionToken example below.
3963
4002
  *
3964
4003
  * Additionally, if a `factory` is specified you can also specify the `providedIn` option, which
3965
- * overrides the above behavior and marks the token as belonging to a particular `@NgModule`. As
3966
- * mentioned above, `'root'` is the default value for `providedIn`.
4004
+ * overrides the above behavior and marks the token as belonging to a particular `@NgModule` (note:
4005
+ * this option is now deprecated). As mentioned above, `'root'` is the default value for
4006
+ * `providedIn`.
4007
+ *
4008
+ * The `providedIn: NgModule` and `providedIn: 'any'` options are deprecated.
3967
4009
  *
3968
4010
  * @usageNotes
3969
4011
  * ### Basic Examples
@@ -4150,7 +4192,7 @@ export declare interface InjectorType<T> extends Type<T> {
4150
4192
  */
4151
4193
  declare interface InjectorTypeWithProviders<T> {
4152
4194
  ngModule: InjectorType<T>;
4153
- providers?: (Type<any> | ValueProvider | ExistingProvider | FactoryProvider | ConstructorProvider | StaticClassProvider | ClassProvider | any[])[];
4195
+ providers?: (Type<any> | ValueProvider | ExistingProvider | FactoryProvider | ConstructorProvider | StaticClassProvider | ClassProvider | EnvironmentProviders | any[])[];
4154
4196
  }
4155
4197
 
4156
4198
  /**
@@ -5137,6 +5179,12 @@ declare const enum LViewFlags {
5137
5179
  IndexWithinInitPhaseReset = 2047
5138
5180
  }
5139
5181
 
5182
+ /**
5183
+ * Wrap an array of `Provider`s into `EnvironmentProviders`, preventing them from being accidentally
5184
+ * referenced in `@Component in a component injector.
5185
+ */
5186
+ export declare function makeEnvironmentProviders(providers: Provider[]): EnvironmentProviders;
5187
+
5140
5188
  /**
5141
5189
  * Use this enum at bootstrap as an option of `bootstrapModule` to define the strategy
5142
5190
  * that the compiler should use in case of missing translations:
@@ -5192,7 +5240,7 @@ export declare class ModuleWithComponentFactories<T> {
5192
5240
  */
5193
5241
  export declare interface ModuleWithProviders<T> {
5194
5242
  ngModule: Type<T>;
5195
- providers?: Provider[];
5243
+ providers?: Array<Provider | EnvironmentProviders>;
5196
5244
  }
5197
5245
 
5198
5246
  declare const MOVED_VIEWS = 9;
@@ -5261,7 +5309,7 @@ export declare interface NgModule {
5261
5309
  * }
5262
5310
  * ```
5263
5311
  */
5264
- providers?: Provider[];
5312
+ providers?: Array<Provider | EnvironmentProviders>;
5265
5313
  /**
5266
5314
  * The set of components, directives, and pipes ([declarables](guide/glossary#declarable))
5267
5315
  * that belong to this module.
@@ -5877,7 +5925,7 @@ export declare interface Pipe {
5877
5925
  * Angular pipes marked as `standalone` do not need to be declared in an NgModule. Such
5878
5926
  * pipes don't depend on any "intermediate context" of an NgModule (ex. configured providers).
5879
5927
  *
5880
- * More information about standalone components, directives and pipes can be found in [this
5928
+ * More information about standalone components, directives, and pipes can be found in [this
5881
5929
  * guide](guide/standalone-components).
5882
5930
  */
5883
5931
  standalone?: boolean;
@@ -6490,7 +6538,7 @@ declare class R3Injector extends EnvironmentInjector {
6490
6538
  get destroyed(): boolean;
6491
6539
  private _destroyed;
6492
6540
  private injectorDefTypes;
6493
- constructor(providers: Array<Provider | ImportedNgModuleProviders>, parent: Injector, source: string | null, scopes: Set<InjectorScope>);
6541
+ constructor(providers: Array<Provider | EnvironmentProviders>, parent: Injector, source: string | null, scopes: Set<InjectorScope>);
6494
6542
  /**
6495
6543
  * Destroy the injector and release references to every instance or provider associated with it.
6496
6544
  *
@@ -7315,6 +7363,12 @@ declare const enum RuntimeErrorCode {
7315
7363
  UNKNOWN_ELEMENT = 304,
7316
7364
  TEMPLATE_STRUCTURE_ERROR = 305,
7317
7365
  INVALID_EVENT_BINDING = 306,
7366
+ HOST_DIRECTIVE_UNRESOLVABLE = 307,
7367
+ HOST_DIRECTIVE_NOT_STANDALONE = 308,
7368
+ DUPLICATE_DIRECTITVE = 309,
7369
+ HOST_DIRECTIVE_COMPONENT = 310,
7370
+ HOST_DIRECTIVE_UNDEFINED_BINDING = 311,
7371
+ HOST_DIRECTIVE_CONFLICTING_ALIAS = 312,
7318
7372
  MULTIPLE_PLATFORMS = 400,
7319
7373
  PLATFORM_NOT_FOUND = 401,
7320
7374
  ERROR_HANDLER_NOT_FOUND = 402,
@@ -10238,8 +10292,13 @@ export declare interface ɵDirectiveDef<T> {
10238
10292
  /**
10239
10293
  * Function that will add the host directives to the list of matches during directive matching.
10240
10294
  * Patched onto the definition by the `HostDirectivesFeature`.
10295
+ * @param currentDef Definition that has been matched.
10296
+ * @param matchedDefs List of all matches for a specified node. Will be mutated to include the
10297
+ * host directives.
10298
+ * @param hostDirectiveDefs Mapping of directive definitions to their host directive
10299
+ * configuration. Host directives will be added to the map as they're being matched to the node.
10241
10300
  */
10242
- findHostDirectiveDefs: ((matches: ɵDirectiveDef<unknown>[], def: ɵDirectiveDef<unknown>, tView: TView, lView: LView, tNode: TElementNode | TContainerNode | TElementContainerNode) => void) | null;
10301
+ findHostDirectiveDefs: ((currentDef: ɵDirectiveDef<unknown>, matchedDefs: ɵDirectiveDef<unknown>[], hostDirectiveDefs: HostDirectiveDefs) => void) | null;
10243
10302
  /** Additional directives to be applied whenever the directive has been matched. */
10244
10303
  hostDirectives: HostDirectiveDef[] | null;
10245
10304
  setInput: (<U extends T>(this: ɵDirectiveDef<U>, instance: U, value: any, publicName: string, privateName: string) => void) | null;
@@ -10416,10 +10475,20 @@ export declare const ɵINJECTOR_SCOPE: InjectionToken<InjectorScope | null>;
10416
10475
  */
10417
10476
  export declare function ɵinternalCreateApplication(config: {
10418
10477
  rootComponent?: Type<unknown>;
10419
- appProviders?: Array<Provider | ImportedNgModuleProviders>;
10478
+ appProviders?: Array<Provider | EnvironmentProviders>;
10420
10479
  platformProviders?: Provider[];
10421
10480
  }): Promise<ApplicationRef>;
10422
10481
 
10482
+ export declare interface ɵInternalEnvironmentProviders extends EnvironmentProviders {
10483
+ ɵproviders: Provider[];
10484
+ /**
10485
+ * If present, indicates that the `EnvironmentProviders` were derived from NgModule providers.
10486
+ *
10487
+ * This is used to produce clearer error messages.
10488
+ */
10489
+ ɵfromNgModule?: true;
10490
+ }
10491
+
10423
10492
  export declare function ɵisBoundToModule<C>(cf: ComponentFactory<C>): boolean;
10424
10493
 
10425
10494
  /**
@@ -10431,6 +10500,8 @@ export declare function ɵisBoundToModule<C>(cf: ComponentFactory<C>): boolean;
10431
10500
  */
10432
10501
  export declare function ɵisDefaultChangeDetectionStrategy(changeDetectionStrategy: ChangeDetectionStrategy): boolean;
10433
10502
 
10503
+ export declare function ɵisEnvironmentProviders(value: Provider | ɵInternalEnvironmentProviders): value is ɵInternalEnvironmentProviders;
10504
+
10434
10505
  export declare function ɵisInjectable(type: any): boolean;
10435
10506
 
10436
10507
  export declare function ɵisListLikeIterable(obj: any): boolean;
@@ -12686,7 +12757,7 @@ export declare function ɵɵgetCurrentView(): OpaqueViewState;
12686
12757
  export declare function ɵɵgetInheritedFactory<T>(type: Type<any>): (type: Type<T>) => T;
12687
12758
 
12688
12759
  /**
12689
- * This feature add the host directives behavior to a directive definition by patching a
12760
+ * This feature adds the host directives behavior to a directive definition by patching a
12690
12761
  * function onto it. The expectation is that the runtime will invoke the function during
12691
12762
  * directive matching.
12692
12763
  *
@@ -12930,7 +13001,7 @@ export declare type ɵɵInjectorDeclaration<T> = unknown;
12930
13001
  * @codeGenApi
12931
13002
  */
12932
13003
  export declare interface ɵɵInjectorDef<T> {
12933
- providers: (Type<any> | ValueProvider | ExistingProvider | FactoryProvider | ConstructorProvider | StaticClassProvider | ClassProvider | any[])[];
13004
+ providers: (Type<any> | ValueProvider | ExistingProvider | FactoryProvider | ConstructorProvider | StaticClassProvider | ClassProvider | EnvironmentProviders | any[])[];
12934
13005
  imports: (InjectorType<any> | InjectorTypeWithProviders<any>)[];
12935
13006
  }
12936
13007
 
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@angular/core",
3
- "version": "15.0.0-next.4",
3
+ "version": "15.0.0-next.6",
4
4
  "description": "Angular - the core framework",
5
5
  "author": "angular",
6
6
  "license": "MIT",
7
7
  "engines": {
8
- "node": "^14.15.0 || >=16.10.0"
8
+ "node": "^14.20.0 || ^16.13.0 || >=18.10.0"
9
9
  },
10
10
  "exports": {
11
11
  "./schematics/*": {
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ /// <amd-module name="@angular/core/schematics/migrations/relative-link-resolution" />
9
+ import { Rule } from '@angular-devkit/schematics';
10
+ export default function (): Rule;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
9
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10
+ return new (P || (P = Promise))(function (resolve, reject) {
11
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
12
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
13
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
14
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
15
+ });
16
+ };
17
+ (function (factory) {
18
+ if (typeof module === "object" && typeof module.exports === "object") {
19
+ var v = factory(require, exports);
20
+ if (v !== undefined) module.exports = v;
21
+ }
22
+ else if (typeof define === "function" && define.amd) {
23
+ define("@angular/core/schematics/migrations/relative-link-resolution", ["require", "exports", "@angular-devkit/schematics", "path", "@angular/core/schematics/utils/project_tsconfig_paths", "@angular/core/schematics/utils/typescript/compiler_host", "@angular/core/schematics/migrations/relative-link-resolution/util"], factory);
24
+ }
25
+ })(function (require, exports) {
26
+ "use strict";
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ const schematics_1 = require("@angular-devkit/schematics");
29
+ const path_1 = require("path");
30
+ const project_tsconfig_paths_1 = require("@angular/core/schematics/utils/project_tsconfig_paths");
31
+ const compiler_host_1 = require("@angular/core/schematics/utils/typescript/compiler_host");
32
+ const util_1 = require("@angular/core/schematics/migrations/relative-link-resolution/util");
33
+ function default_1() {
34
+ return (tree) => __awaiter(this, void 0, void 0, function* () {
35
+ const { buildPaths, testPaths } = yield (0, project_tsconfig_paths_1.getProjectTsConfigPaths)(tree);
36
+ const basePath = process.cwd();
37
+ const allPaths = [...buildPaths, ...testPaths];
38
+ if (!allPaths.length) {
39
+ throw new schematics_1.SchematicsException('Could not find any tsconfig file. ' +
40
+ 'Cannot run a migration to cleanup the deprecated `relativeLinkResolution` config option.');
41
+ }
42
+ for (const tsconfigPath of allPaths) {
43
+ runRelativeLinkResolutionMigration(tree, tsconfigPath, basePath);
44
+ }
45
+ });
46
+ }
47
+ exports.default = default_1;
48
+ function runRelativeLinkResolutionMigration(tree, tsconfigPath, basePath) {
49
+ const { program } = (0, compiler_host_1.createMigrationProgram)(tree, tsconfigPath, basePath);
50
+ const sourceFiles = program.getSourceFiles().filter(sourceFile => (0, compiler_host_1.canMigrateFile)(basePath, sourceFile, program));
51
+ for (const sourceFile of sourceFiles) {
52
+ let update = null;
53
+ const rewriter = (startPos, origLength, text) => {
54
+ if (update === null) {
55
+ // Lazily initialize update, because most files will not require migration.
56
+ update = tree.beginUpdate((0, path_1.relative)(basePath, sourceFile.fileName));
57
+ }
58
+ update.remove(startPos, origLength);
59
+ update.insertLeft(startPos, text);
60
+ };
61
+ (0, util_1.migrateFile)(sourceFile, rewriter);
62
+ if (update !== null) {
63
+ tree.commitUpdate(update);
64
+ }
65
+ }
66
+ }
67
+ });
68
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8u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NlIG1vc3QgZmlsZXMgd2lsbCBub3QgcmVxdWlyZSBtaWdyYXRpb24uXG4gICAgICAgIHVwZGF0ZSA9IHRyZWUuYmVnaW5VcGRhdGUocmVsYXRpdmUoYmFzZVBhdGgsIHNvdXJjZUZpbGUuZmlsZU5hbWUpKTtcbiAgICAgIH1cbiAgICAgIHVwZGF0ZS5yZW1vdmUoc3RhcnRQb3MsIG9yaWdMZW5ndGgpO1xuICAgICAgdXBkYXRlLmluc2VydExlZnQoc3RhcnRQb3MsIHRleHQpO1xuICAgIH07XG5cbiAgICBtaWdyYXRlRmlsZShzb3VyY2VGaWxlLCByZXdyaXRlcik7XG5cbiAgICBpZiAodXBkYXRlICE9PSBudWxsKSB7XG4gICAgICB0cmVlLmNvbW1pdFVwZGF0ZSh1cGRhdGUpO1xuICAgIH1cbiAgfVxufVxuIl19
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ /// <amd-module name="@angular/core/schematics/migrations/relative-link-resolution/util" />
9
+ import ts from 'typescript';
10
+ export interface RewriteEntity {
11
+ startPos: number;
12
+ width: number;
13
+ replacement: string;
14
+ }
15
+ export interface MigratableNode {
16
+ objectLiteral: ts.ObjectLiteralExpression;
17
+ property: ts.ObjectLiteralElementLike;
18
+ }
19
+ export declare type RewriteFn = (startPos: number, origLength: number, text: string) => void;
20
+ export declare function migrateFile(sourceFile: ts.SourceFile, rewriteFn: RewriteFn): void;
@@ -0,0 +1,82 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ (function (factory) {
12
+ if (typeof module === "object" && typeof module.exports === "object") {
13
+ var v = factory(require, exports);
14
+ if (v !== undefined) module.exports = v;
15
+ }
16
+ else if (typeof define === "function" && define.amd) {
17
+ define("@angular/core/schematics/migrations/relative-link-resolution/util", ["require", "exports", "typescript"], factory);
18
+ }
19
+ })(function (require, exports) {
20
+ "use strict";
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.migrateFile = void 0;
23
+ const typescript_1 = __importDefault(require("typescript"));
24
+ const relativeLinkResolution = 'relativeLinkResolution';
25
+ const knownConfigValues = new Set([`'legacy'`, `'corrected'`]);
26
+ function migrateFile(sourceFile, rewriteFn) {
27
+ let rewrites = [];
28
+ const usages = getUsages(sourceFile);
29
+ for (const { objectLiteral, property } of usages) {
30
+ const replacementNode = typescript_1.default.factory.updateObjectLiteralExpression(objectLiteral, objectLiteral.properties.filter(prop => prop !== property));
31
+ const printer = typescript_1.default.createPrinter();
32
+ const replacementText = printer.printNode(typescript_1.default.EmitHint.Unspecified, replacementNode, sourceFile);
33
+ rewrites.push({
34
+ startPos: objectLiteral.getStart(),
35
+ width: objectLiteral.getWidth(),
36
+ replacement: replacementText,
37
+ });
38
+ }
39
+ // Process rewrites last-to-first (based on start pos) to avoid offset shifts during rewrites.
40
+ rewrites = sortByStartPosDescending(rewrites);
41
+ for (const rewrite of rewrites) {
42
+ rewriteFn(rewrite.startPos, rewrite.width, rewrite.replacement);
43
+ }
44
+ }
45
+ exports.migrateFile = migrateFile;
46
+ function getUsages(sourceFile) {
47
+ const usages = [];
48
+ const visitNode = (node) => {
49
+ if (typescript_1.default.isObjectLiteralExpression(node)) {
50
+ // Look for patterns like the following:
51
+ // ```
52
+ // { ... relativeLinkResolution: 'legacy', ... }
53
+ // ```
54
+ // or:
55
+ // ```
56
+ // { ... relativeLinkResolution: 'corrected', ... }
57
+ // ```
58
+ // If the value is unknown (i.e. not 'legacy' or 'corrected'),
59
+ // do not attempt to rewrite (this might be an application-specific
60
+ // configuration, not a part of Router).
61
+ const property = node.properties.find(prop => typescript_1.default.isPropertyAssignment(prop) && typescript_1.default.isIdentifier(prop.name) &&
62
+ prop.name.text === relativeLinkResolution &&
63
+ knownConfigValues.has(prop.initializer.getText()));
64
+ if (property) {
65
+ usages.push({ objectLiteral: node, property });
66
+ }
67
+ }
68
+ typescript_1.default.forEachChild(node, visitNode);
69
+ };
70
+ typescript_1.default.forEachChild(sourceFile, visitNode);
71
+ return usages;
72
+ }
73
+ /**
74
+ * Sort all found usages based on their start positions in the source file in descending order (i.e.
75
+ * last usage goes first on the list, etc). This is needed to avoid shifting offsets in the source
76
+ * file (in case there are multiple usages) as we rewrite symbols.
77
+ */
78
+ function sortByStartPosDescending(rewrites) {
79
+ return rewrites.sort((entityA, entityB) => entityB.startPos - entityA.startPos);
80
+ }
81
+ });
82
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvcmUvc2NoZW1hdGljcy9taWdyYXRpb25zL3JlbGF0aXZlLWxpbmstcmVzb2x1dGlvbi91dGlsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRzs7Ozs7Ozs7Ozs7Ozs7OztJQUVILDREQUE0QjtJQUU1QixNQUFNLHNCQUFzQixHQUFHLHdCQUF3QixDQUFDO0lBQ3hELE1BQU0saUJBQWlCLEdBQUcsSUFBSSxHQUFHLENBQUMsQ0FBQyxVQUFVLEVBQUUsYUFBYSxDQUFDLENBQUMsQ0FBQztJQWUvRCxTQUFnQixXQUFXLENBQUMsVUFBeUIsRUFBRSxTQUFvQjtRQUN6RSxJQUFJLFFBQVEsR0FBb0IsRUFBRSxDQUFDO1FBQ25DLE1BQU0sTUFBTSxHQUFHLFNBQVMsQ0FBQyxVQUFVLENBQUMsQ0FBQztRQUNyQyxLQUFLLE1BQU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W50aXR5QSwgZW50aXR5QikgPT4gZW50aXR5Qi5zdGFydFBvcyAtIGVudGl0eUEuc3RhcnRQb3MpO1xufVxuIl19
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ /// <amd-module name="@angular/core/schematics/migrations/router-link-with-href" />
9
+ import { Rule } from '@angular-devkit/schematics';
10
+ export default function (): Rule;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
9
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10
+ return new (P || (P = Promise))(function (resolve, reject) {
11
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
12
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
13
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
14
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
15
+ });
16
+ };
17
+ (function (factory) {
18
+ if (typeof module === "object" && typeof module.exports === "object") {
19
+ var v = factory(require, exports);
20
+ if (v !== undefined) module.exports = v;
21
+ }
22
+ else if (typeof define === "function" && define.amd) {
23
+ define("@angular/core/schematics/migrations/router-link-with-href", ["require", "exports", "@angular-devkit/schematics", "path", "@angular/core/schematics/utils/project_tsconfig_paths", "@angular/core/schematics/utils/typescript/compiler_host", "@angular/core/schematics/migrations/router-link-with-href/util"], factory);
24
+ }
25
+ })(function (require, exports) {
26
+ "use strict";
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ const schematics_1 = require("@angular-devkit/schematics");
29
+ const path_1 = require("path");
30
+ const project_tsconfig_paths_1 = require("@angular/core/schematics/utils/project_tsconfig_paths");
31
+ const compiler_host_1 = require("@angular/core/schematics/utils/typescript/compiler_host");
32
+ const util_1 = require("@angular/core/schematics/migrations/router-link-with-href/util");
33
+ function default_1() {
34
+ return (tree) => __awaiter(this, void 0, void 0, function* () {
35
+ const { buildPaths, testPaths } = yield (0, project_tsconfig_paths_1.getProjectTsConfigPaths)(tree);
36
+ const basePath = process.cwd();
37
+ const allPaths = [...buildPaths, ...testPaths];
38
+ if (!allPaths.length) {
39
+ throw new schematics_1.SchematicsException('Could not find any tsconfig file. Cannot run the `RouterLinkWithHref` migration.');
40
+ }
41
+ for (const tsconfigPath of allPaths) {
42
+ runRouterLinkWithHrefMigration(tree, tsconfigPath, basePath);
43
+ }
44
+ });
45
+ }
46
+ exports.default = default_1;
47
+ function runRouterLinkWithHrefMigration(tree, tsconfigPath, basePath) {
48
+ const { program } = (0, compiler_host_1.createMigrationProgram)(tree, tsconfigPath, basePath);
49
+ const typeChecker = program.getTypeChecker();
50
+ const sourceFiles = program.getSourceFiles().filter(sourceFile => (0, compiler_host_1.canMigrateFile)(basePath, sourceFile, program));
51
+ for (const sourceFile of sourceFiles) {
52
+ let update = null;
53
+ const rewriter = (startPos, width, text) => {
54
+ if (update === null) {
55
+ // Lazily initialize update, because most files will not require migration.
56
+ update = tree.beginUpdate((0, path_1.relative)(basePath, sourceFile.fileName));
57
+ }
58
+ update.remove(startPos, width);
59
+ if (text !== null) {
60
+ update.insertLeft(startPos, text);
61
+ }
62
+ };
63
+ (0, util_1.migrateFile)(sourceFile, typeChecker, rewriter);
64
+ if (update !== null) {
65
+ tree.commitUpdate(update);
66
+ }
67
+ }
68
+ }
69
+ });
70
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb3JlL3Nj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