@angular/core 14.0.0-rc.2 → 14.0.1

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 (35) hide show
  1. package/esm2020/src/di/injector_compatibility.mjs +57 -15
  2. package/esm2020/src/di/interface/provider.mjs +1 -1
  3. package/esm2020/src/di/provider_collection.mjs +32 -2
  4. package/esm2020/src/di/r3_injector.mjs +3 -1
  5. package/esm2020/src/error_handler.mjs +4 -7
  6. package/esm2020/src/errors.mjs +6 -3
  7. package/esm2020/src/metadata/directives.mjs +1 -1
  8. package/esm2020/src/render3/component.mjs +9 -9
  9. package/esm2020/src/render3/definition.mjs +6 -6
  10. package/esm2020/src/render3/features/standalone_feature.mjs +4 -4
  11. package/esm2020/src/render3/instructions/all.mjs +2 -2
  12. package/esm2020/src/render3/instructions/element.mjs +4 -79
  13. package/esm2020/src/render3/instructions/element_validation.mjs +264 -0
  14. package/esm2020/src/render3/instructions/shared.mjs +7 -113
  15. package/esm2020/src/render3/interfaces/definition.mjs +1 -1
  16. package/esm2020/src/render3/jit/module.mjs +2 -2
  17. package/esm2020/src/render3/ng_module_ref.mjs +2 -1
  18. package/esm2020/src/render3/pipe.mjs +20 -6
  19. package/esm2020/src/render3/state.mjs +1 -3
  20. package/esm2020/src/util/errors.mjs +1 -8
  21. package/esm2020/src/version.mjs +1 -1
  22. package/esm2020/testing/src/logger.mjs +3 -3
  23. package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
  24. package/esm2020/testing/src/test_bed.mjs +5 -2
  25. package/fesm2015/core.mjs +630 -471
  26. package/fesm2015/core.mjs.map +1 -1
  27. package/fesm2015/testing.mjs +696 -534
  28. package/fesm2015/testing.mjs.map +1 -1
  29. package/fesm2020/core.mjs +626 -468
  30. package/fesm2020/core.mjs.map +1 -1
  31. package/fesm2020/testing.mjs +701 -540
  32. package/fesm2020/testing.mjs.map +1 -1
  33. package/index.d.ts +80 -33
  34. package/package.json +1 -1
  35. package/testing/index.d.ts +5 -2
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.0-rc.2
2
+ * @license Angular v14.0.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1026,6 +1026,11 @@ export declare interface Component extends Directive {
1026
1026
  * Angular components marked as `standalone` do not need to be declared in an NgModule. Such
1027
1027
  * components directly manage their own template dependencies (components, directives and pipes
1028
1028
  * used in a template) via the imports property.
1029
+ *
1030
+ * More information about standalone components, directives and pipes can be found in [this
1031
+ * guide](guide/standalone-components).
1032
+ *
1033
+ * @developerPreview
1029
1034
  */
1030
1035
  standalone?: boolean;
1031
1036
  /**
@@ -1035,6 +1040,11 @@ export declare interface Component extends Directive {
1035
1040
  *
1036
1041
  * This property is only available for standalone components - specifying it for components
1037
1042
  * declared in an NgModule generates a compilation error.
1043
+ *
1044
+ * More information about standalone components, directives and pipes can be found in [this
1045
+ * guide](guide/standalone-components).
1046
+ *
1047
+ * @developerPreview
1038
1048
  */
1039
1049
  imports?: (Type<any> | any[])[];
1040
1050
  /**
@@ -1043,6 +1053,9 @@ export declare interface Component extends Directive {
1043
1053
  *
1044
1054
  * This property is only available for standalone components - specifying it for components
1045
1055
  * declared in an NgModule generates a compilation error.
1056
+ *
1057
+ * More information about standalone components, directives and pipes can be found in [this
1058
+ * guide](guide/standalone-components).
1046
1059
  */
1047
1060
  schemas?: SchemaMetadata[];
1048
1061
  }
@@ -1634,6 +1647,7 @@ declare interface CreateComponentOptions {
1634
1647
  * Create a new environment injector.
1635
1648
  *
1636
1649
  * @publicApi
1650
+ * @developerPreview
1637
1651
  */
1638
1652
  export declare function createEnvironmentInjector(providers: Array<Provider | ImportedNgModuleProviders>, parent?: EnvironmentInjector | null, debugName?: string | null): EnvironmentInjector;
1639
1653
 
@@ -2271,6 +2285,11 @@ export declare interface Directive {
2271
2285
  * Angular directives marked as `standalone` do not need to be declared in an NgModule. Such
2272
2286
  * directives don't depend on any "intermediate context" of an NgModule (ex. configured
2273
2287
  * providers).
2288
+ *
2289
+ * More information about standalone components, directives and pipes can be found in [this
2290
+ * guide](guide/standalone-components).
2291
+ *
2292
+ * @developerPreview
2274
2293
  */
2275
2294
  standalone?: boolean;
2276
2295
  }
@@ -2598,6 +2617,8 @@ export declare const ENVIRONMENT_INITIALIZER: InjectionToken<() => void>;
2598
2617
  /**
2599
2618
  * An `Injector` that's part of the environment injector hierarchy, which exists outside of the
2600
2619
  * component tree.
2620
+ *
2621
+ * @developerPreview
2601
2622
  */
2602
2623
  export declare abstract class EnvironmentInjector implements Injector {
2603
2624
  /**
@@ -3460,6 +3481,7 @@ declare const ID = 20;
3460
3481
  * @see `importProvidersFrom`
3461
3482
  *
3462
3483
  * @publicApi
3484
+ * @developerPreview
3463
3485
  */
3464
3486
  export declare interface ImportedNgModuleProviders {
3465
3487
  ɵproviders: Provider[];
@@ -3473,14 +3495,45 @@ export declare interface ImportedNgModuleProviders {
3473
3495
  * another environment injector (such as a route injector). They should not be used in component
3474
3496
  * providers.
3475
3497
  *
3476
- * @returns The collected providers from the specified list of types.
3498
+ * More information about standalone components can be found in [this
3499
+ * guide](guide/standalone-components).
3500
+ *
3501
+ * @usageNotes
3502
+ * The results of the `importProvidersFrom` call can be used in the `bootstrapApplication` call:
3503
+ *
3504
+ * ```typescript
3505
+ * await bootstrapApplication(RootComponent, {
3506
+ * providers: [
3507
+ * importProvidersFrom(NgModuleOne, NgModuleTwo)
3508
+ * ]
3509
+ * });
3510
+ * ```
3511
+ *
3512
+ * You can also use the `importProvidersFrom` results in the `providers` field of a route, when a
3513
+ * standalone component is used:
3514
+ *
3515
+ * ```typescript
3516
+ * export const ROUTES: Route[] = [
3517
+ * {
3518
+ * path: 'foo',
3519
+ * providers: [
3520
+ * importProvidersFrom(NgModuleOne, NgModuleTwo)
3521
+ * ],
3522
+ * component: YourStandaloneComponent
3523
+ * }
3524
+ * ];
3525
+ * ```
3526
+ *
3527
+ * @returns Collected providers from the specified list of types.
3477
3528
  * @publicApi
3529
+ * @developerPreview
3478
3530
  */
3479
3531
  export declare function importProvidersFrom(...sources: ImportProvidersSource[]): ImportedNgModuleProviders;
3480
3532
 
3481
3533
  /**
3482
3534
  * A source of providers for the `importProvidersFrom` function.
3483
3535
  *
3536
+ * @developerPreview
3484
3537
  * @publicApi
3485
3538
  */
3486
3539
  export declare type ImportProvidersSource = Type<unknown> | ModuleWithProviders<unknown> | Array<ImportProvidersSource>;
@@ -3538,30 +3591,24 @@ export declare interface Inject {
3538
3591
  export declare const Inject: InjectDecorator;
3539
3592
 
3540
3593
  /**
3541
- * Injects a token from the currently active injector.
3542
- *
3543
- * Must be used in the context of a factory function such as one defined for an
3544
- * `InjectionToken`. Throws an error if not called from such a context.
3545
- *
3546
- * Within such a factory function, using this function to request injection of a dependency
3547
- * is faster and more type-safe than providing an additional array of dependencies
3548
- * (as has been common with `useFactory` providers).
3549
- *
3550
- * @param token The injection token for the dependency to be injected.
3551
- * @param flags Optional flags that control how injection is executed.
3552
- * The flags correspond to injection strategies that can be specified with
3553
- * parameter decorators `@Host`, `@Self`, `@SkipSef`, and `@Optional`.
3554
- * @returns the injected value if injection is successful, `null` otherwise.
3555
- *
3556
- * @usageNotes
3557
- *
3558
- * ### Example
3594
+ * @param token A token that represents a dependency that should be injected.
3595
+ * @returns the injected value if operation is successful, `null` otherwise.
3596
+ * @throws if called outside of a supported context.
3559
3597
  *
3560
- * {@example core/di/ts/injector_spec.ts region='ShakableInjectionToken'}
3598
+ * @publicApi
3599
+ */
3600
+ export declare function inject<T>(token: ProviderToken<T>): T;
3601
+
3602
+ /**
3603
+ * @param token A token that represents a dependency that should be injected.
3604
+ * @param flags Control how injection is executed. The flags correspond to injection strategies that
3605
+ * can be specified with parameter decorators `@Host`, `@Self`, `@SkipSelf`, and `@Optional`.
3606
+ * @returns the injected value if operation is successful, `null` otherwise.
3607
+ * @throws if called outside of a supported context.
3561
3608
  *
3562
3609
  * @publicApi
3563
3610
  */
3564
- export declare const inject: typeof ɵɵinject;
3611
+ export declare function inject<T>(token: ProviderToken<T>, flags?: InjectFlags): T | null;
3565
3612
 
3566
3613
  /**
3567
3614
  * Type of the Injectable metadata.
@@ -5602,6 +5649,9 @@ export declare interface Pipe {
5602
5649
  /**
5603
5650
  * Angular pipes marked as `standalone` do not need to be declared in an NgModule. Such
5604
5651
  * pipes don't depend on any "intermediate context" of an NgModule (ex. configured providers).
5652
+ *
5653
+ * More information about standalone components, directives and pipes can be found in [this
5654
+ * guide](guide/standalone-components).
5605
5655
  */
5606
5656
  standalone?: boolean;
5607
5657
  }
@@ -6984,7 +7034,7 @@ declare const enum RuntimeErrorCode {
6984
7034
  CYCLIC_DI_DEPENDENCY = -200,
6985
7035
  PROVIDER_NOT_FOUND = -201,
6986
7036
  INVALID_FACTORY_DEPENDENCY = 202,
6987
- MISSING_INJECTION_CONTEXT = 203,
7037
+ MISSING_INJECTION_CONTEXT = -203,
6988
7038
  INVALID_INJECTION_TOKEN = 204,
6989
7039
  INJECTOR_ALREADY_DESTROYED = 205,
6990
7040
  PROVIDER_IN_WRONG_CONTEXT = 207,
@@ -9643,7 +9693,8 @@ export declare function ɵcompilePipe(type: Type<any>, meta: Pipe): void;
9643
9693
  */
9644
9694
  export declare interface ɵComponentDef<T> extends ɵDirectiveDef<T> {
9645
9695
  /**
9646
- * Runtime unique component ID.
9696
+ * Unique ID for the component. Used in view encapsulation and
9697
+ * to keep track of the injector in standalone components.
9647
9698
  */
9648
9699
  readonly id: string;
9649
9700
  /**
@@ -10190,7 +10241,7 @@ export declare class ɵLContext {
10190
10241
  * renderComponent(AppComponent, {hostFeatures: [LifecycleHooksFeature]});
10191
10242
  * ```
10192
10243
  */
10193
- export declare function ɵLifecycleHooksFeature(component: any, def: ɵComponentDef<any>): void;
10244
+ export declare function ɵLifecycleHooksFeature(): void;
10194
10245
 
10195
10246
  /**
10196
10247
  * Index of each type of locale data from the locale data array
@@ -10815,7 +10866,6 @@ export declare function ɵsetDocument(document: Document | undefined): void;
10815
10866
  */
10816
10867
  export declare function ɵsetLocaleId(localeId: string): void;
10817
10868
 
10818
-
10819
10869
  /**
10820
10870
  * Sets a strict mode for JIT-compiled components to throw an error on unknown elements,
10821
10871
  * instead of just logging the error.
@@ -10854,7 +10904,7 @@ export declare const ɵTESTABILITY_GETTER: InjectionToken<GetTestability>;
10854
10904
 
10855
10905
  /**
10856
10906
  * Compute the pair of transitive scopes (compilation scope and exported scope) for a given type
10857
- * (eaither a NgModule or a standalone component / directive / pipe).
10907
+ * (either a NgModule or a standalone component / directive / pipe).
10858
10908
  */
10859
10909
  export declare function ɵtransitiveScopesFor<T>(type: Type<T>): ɵNgModuleTransitiveScopes;
10860
10910
 
@@ -12387,6 +12437,7 @@ export declare function ɵɵelementContainerStart(index: number, attrsIndex?: nu
12387
12437
  */
12388
12438
  export declare function ɵɵelementEnd(): typeof ɵɵelementEnd;
12389
12439
 
12440
+
12390
12441
  /**
12391
12442
  * Create DOM element. The instruction must later be followed by `elementEnd()` call.
12392
12443
  *
@@ -12598,10 +12649,7 @@ export declare function ɵɵi18nStart(index: number, messageIndex: number, subTe
12598
12649
  export declare function ɵɵInheritDefinitionFeature(definition: ɵDirectiveDef<any> | ɵComponentDef<any>): void;
12599
12650
 
12600
12651
  /**
12601
- * Generated instruction: Injects a token from the currently active injector.
12602
- *
12603
- * Must be used in the context of a factory function such as one defined for an
12604
- * `InjectionToken`. Throws an error if not called from such a context.
12652
+ * Generated instruction: injects a token from the currently active injector.
12605
12653
  *
12606
12654
  * (Additional documentation moved to `inject`, as it is the public API, and an alias for this
12607
12655
  * instruction)
@@ -13680,7 +13728,6 @@ export declare function ɵɵresolveWindow(element: RElement & {
13680
13728
  * @returns Context of the restored OpaqueViewState instance.
13681
13729
  *
13682
13730
  * @codeGenApi
13683
- * @noinline Disable inlining due to issue with Closure in listeners inside embedded views.
13684
13731
  */
13685
13732
  export declare function ɵɵrestoreView<T = any>(viewToRestore: OpaqueViewState): T;
13686
13733
 
@@ -13785,7 +13832,7 @@ export declare function ɵɵsanitizeUrlOrResourceUrl(unsafeUrl: any, tag: string
13785
13832
  *
13786
13833
  * @codeGenApi
13787
13834
  */
13788
- export declare function ɵɵsetComponentScope(type: ɵComponentType<any>, directives: Type<any>[], pipes: Type<any>[]): void;
13835
+ export declare function ɵɵsetComponentScope(type: ɵComponentType<any>, directives: Type<any>[] | (() => Type<any>[]), pipes: Type<any>[] | (() => Type<any>[])): void;
13789
13836
 
13790
13837
  /**
13791
13838
  * Adds the module metadata that is necessary to compute the module's transitive scope to an
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/core",
3
- "version": "14.0.0-rc.2",
3
+ "version": "14.0.1",
4
4
  "description": "Angular - the core framework",
5
5
  "author": "angular",
6
6
  "license": "MIT",
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.0-rc.2
2
+ * @license Angular v14.0.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -187,7 +187,10 @@ export declare function flushMicrotasks(): void;
187
187
  export declare const getTestBed: () => TestBed;
188
188
 
189
189
  /**
190
- * Allows injecting dependencies in `beforeEach()` and `it()`.
190
+ * Allows injecting dependencies in `beforeEach()` and `it()`. Note: this function
191
+ * (imported from the `@angular/core/testing` package) can **only** be used to inject dependencies
192
+ * in tests. To inject dependencies in your application code, use the [`inject`](api/core/inject)
193
+ * function from the `@angular/core` package instead.
191
194
  *
192
195
  * Example:
193
196
  *