static-injector 4.0.2 → 5.0.0

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 (179) hide show
  1. package/{import/commonjs → commonjs}/index.js +29 -197
  2. package/{import/es2022 → es2022}/di/interface/defs.js +5 -1
  3. package/{import/es2022 → es2022}/index.js +0 -1
  4. package/{transform/compiler/index.d.ts → es2022/interface/lifecycle_hooks.js} +1 -1
  5. package/{transform/compiler-cli/src/ngtsc/translator/src/api/ast_factory.js → es2022/render3/definition_factory.js} +3 -2
  6. package/es2022/util/decorators.js +31 -0
  7. package/{import/fesm2022 → fesm2022}/index.js +30 -196
  8. package/package.json +17 -14
  9. package/readme.md +35 -13
  10. package/{import/typings → typings}/di/injectable.d.ts +0 -7
  11. package/{import/typings → typings}/index.d.ts +0 -1
  12. package/import/es2022/di/injectable.js +0 -14
  13. package/import/es2022/error_details_base_url.js +0 -19
  14. package/import/es2022/render3/definition_factory.js +0 -14
  15. package/import/es2022/render3/di.js +0 -49
  16. package/import/es2022/render3/error_code.js +0 -30
  17. package/import/es2022/util/array_utils.js +0 -17
  18. package/import/es2022/util/decorators.js +0 -53
  19. package/import/typings/error_details_base_url.d.ts +0 -19
  20. package/import/typings/render3/di.d.ts +0 -12
  21. package/import/typings/render3/error_code.d.ts +0 -24
  22. package/import/typings/util/array_utils.d.ts +0 -25
  23. package/transform/compiler/compiler.d.ts +0 -8
  24. package/transform/compiler/compiler.js +0 -28
  25. package/transform/compiler/index.js +0 -28
  26. package/transform/compiler/public_api.d.ts +0 -13
  27. package/transform/compiler/public_api.js +0 -30
  28. package/transform/compiler/src/compiler.d.ts +0 -5
  29. package/transform/compiler/src/compiler.js +0 -21
  30. package/transform/compiler/src/core.d.ts +0 -25
  31. package/transform/compiler/src/core.js +0 -22
  32. package/transform/compiler/src/injectable_compiler_2.d.ts +0 -23
  33. package/transform/compiler/src/injectable_compiler_2.js +0 -171
  34. package/transform/compiler/src/output/output_ast.d.ts +0 -512
  35. package/transform/compiler/src/output/output_ast.js +0 -1109
  36. package/transform/compiler/src/parse_util.d.ts +0 -50
  37. package/transform/compiler/src/parse_util.js +0 -71
  38. package/transform/compiler/src/render3/partial/api.d.ts +0 -171
  39. package/transform/compiler/src/render3/partial/api.js +0 -18
  40. package/transform/compiler/src/render3/r3_factory.d.ts +0 -82
  41. package/transform/compiler/src/render3/r3_factory.js +0 -225
  42. package/transform/compiler/src/render3/r3_identifiers.d.ts +0 -20
  43. package/transform/compiler/src/render3/r3_identifiers.js +0 -55
  44. package/transform/compiler/src/render3/util.d.ts +0 -85
  45. package/transform/compiler/src/render3/util.js +0 -82
  46. package/transform/compiler/src/render3/view/util.d.ts +0 -24
  47. package/transform/compiler/src/render3/view/util.js +0 -59
  48. package/transform/compiler-cli/src/ngtsc/annotations/common/index.d.ts +0 -3
  49. package/transform/compiler-cli/src/ngtsc/annotations/common/index.js +0 -19
  50. package/transform/compiler-cli/src/ngtsc/annotations/common/src/di.d.ts +0 -37
  51. package/transform/compiler-cli/src/ngtsc/annotations/common/src/di.js +0 -195
  52. package/transform/compiler-cli/src/ngtsc/annotations/common/src/factory.d.ts +0 -11
  53. package/transform/compiler-cli/src/ngtsc/annotations/common/src/factory.js +0 -22
  54. package/transform/compiler-cli/src/ngtsc/annotations/common/src/util.d.ts +0 -64
  55. package/transform/compiler-cli/src/ngtsc/annotations/common/src/util.js +0 -189
  56. package/transform/compiler-cli/src/ngtsc/annotations/src/injectable.d.ts +0 -43
  57. package/transform/compiler-cli/src/ngtsc/annotations/src/injectable.js +0 -277
  58. package/transform/compiler-cli/src/ngtsc/diagnostics/error.d.ts +0 -24
  59. package/transform/compiler-cli/src/ngtsc/diagnostics/error.js +0 -84
  60. package/transform/compiler-cli/src/ngtsc/diagnostics/error_code.d.ts +0 -188
  61. package/transform/compiler-cli/src/ngtsc/diagnostics/error_code.js +0 -206
  62. package/transform/compiler-cli/src/ngtsc/diagnostics/index.d.ts +0 -2
  63. package/transform/compiler-cli/src/ngtsc/diagnostics/index.js +0 -18
  64. package/transform/compiler-cli/src/ngtsc/imports/index.d.ts +0 -1
  65. package/transform/compiler-cli/src/ngtsc/imports/index.js +0 -17
  66. package/transform/compiler-cli/src/ngtsc/imports/src/core.d.ts +0 -36
  67. package/transform/compiler-cli/src/ngtsc/imports/src/core.js +0 -25
  68. package/transform/compiler-cli/src/ngtsc/imports/src/default.d.ts +0 -19
  69. package/transform/compiler-cli/src/ngtsc/imports/src/default.js +0 -27
  70. package/transform/compiler-cli/src/ngtsc/reflection/index.d.ts +0 -3
  71. package/transform/compiler-cli/src/ngtsc/reflection/index.js +0 -19
  72. package/transform/compiler-cli/src/ngtsc/reflection/src/host.d.ts +0 -522
  73. package/transform/compiler-cli/src/ngtsc/reflection/src/host.js +0 -34
  74. package/transform/compiler-cli/src/ngtsc/reflection/src/type_to_value.d.ts +0 -25
  75. package/transform/compiler-cli/src/ngtsc/reflection/src/type_to_value.js +0 -271
  76. package/transform/compiler-cli/src/ngtsc/reflection/src/typescript.d.ts +0 -53
  77. package/transform/compiler-cli/src/ngtsc/reflection/src/typescript.js +0 -393
  78. package/transform/compiler-cli/src/ngtsc/reflection/src/util.d.ts +0 -12
  79. package/transform/compiler-cli/src/ngtsc/reflection/src/util.js +0 -29
  80. package/transform/compiler-cli/src/ngtsc/transform/index.d.ts +0 -2
  81. package/transform/compiler-cli/src/ngtsc/transform/index.js +0 -18
  82. package/transform/compiler-cli/src/ngtsc/transform/src/api.d.ts +0 -115
  83. package/transform/compiler-cli/src/ngtsc/transform/src/api.js +0 -29
  84. package/transform/compiler-cli/src/ngtsc/transform/src/utils.d.ts +0 -15
  85. package/transform/compiler-cli/src/ngtsc/transform/src/utils.js +0 -79
  86. package/transform/compiler-cli/src/ngtsc/translator/index.d.ts +0 -5
  87. package/transform/compiler-cli/src/ngtsc/translator/index.js +0 -21
  88. package/transform/compiler-cli/src/ngtsc/translator/src/api/ast_factory.d.ts +0 -289
  89. package/transform/compiler-cli/src/ngtsc/translator/src/api/import_generator.d.ts +0 -27
  90. package/transform/compiler-cli/src/ngtsc/translator/src/api/import_generator.js +0 -9
  91. package/transform/compiler-cli/src/ngtsc/translator/src/context.d.ts +0 -18
  92. package/transform/compiler-cli/src/ngtsc/translator/src/context.js +0 -28
  93. package/transform/compiler-cli/src/ngtsc/translator/src/import_manager.d.ts +0 -47
  94. package/transform/compiler-cli/src/ngtsc/translator/src/import_manager.js +0 -66
  95. package/transform/compiler-cli/src/ngtsc/translator/src/translator.d.ts +0 -56
  96. package/transform/compiler-cli/src/ngtsc/translator/src/translator.js +0 -270
  97. package/transform/compiler-cli/src/ngtsc/translator/src/ts_util.d.ts +0 -12
  98. package/transform/compiler-cli/src/ngtsc/translator/src/ts_util.js +0 -27
  99. package/transform/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.d.ts +0 -53
  100. package/transform/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.js +0 -250
  101. package/transform/compiler-cli/src/ngtsc/translator/src/typescript_translator.d.ts +0 -13
  102. package/transform/compiler-cli/src/ngtsc/translator/src/typescript_translator.js +0 -21
  103. package/transform/compiler-cli/src/ngtsc/ts_compatibility/index.d.ts +0 -8
  104. package/transform/compiler-cli/src/ngtsc/ts_compatibility/index.js +0 -24
  105. package/transform/compiler-cli/src/ngtsc/ts_compatibility/src/ts_cross_version_utils.d.ts +0 -45
  106. package/transform/compiler-cli/src/ngtsc/ts_compatibility/src/ts_cross_version_utils.js +0 -86
  107. package/transform/compiler-cli/src/ngtsc/util/src/typescript.d.ts +0 -4
  108. package/transform/compiler-cli/src/ngtsc/util/src/typescript.js +0 -16
  109. package/transform/index.d.ts +0 -1
  110. package/transform/index.js +0 -17
  111. package/transform/injectable-transform.d.ts +0 -41
  112. package/transform/injectable-transform.js +0 -245
  113. package/transform/node-Iteration.d.ts +0 -2
  114. package/transform/node-Iteration.js +0 -12
  115. /package/{import/es2022 → es2022}/di/create_injector.js +0 -0
  116. /package/{import/es2022 → es2022}/di/forward_ref.js +0 -0
  117. /package/{import/es2022 → es2022}/di/index.js +0 -0
  118. /package/{import/es2022 → es2022}/di/initializer_token.js +0 -0
  119. /package/{import/es2022 → es2022}/di/inject_switch.js +0 -0
  120. /package/{import/es2022/di/injector_marker.js → es2022/di/injectable.js} +0 -0
  121. /package/{import/es2022 → es2022}/di/injection_token.js +0 -0
  122. /package/{import/es2022 → es2022}/di/injector.js +0 -0
  123. /package/{import/es2022 → es2022}/di/injector_compatibility.js +0 -0
  124. /package/{import/es2022/di/provider_token.js → es2022/di/injector_marker.js} +0 -0
  125. /package/{import/es2022 → es2022}/di/injector_token.js +0 -0
  126. /package/{import/es2022 → es2022}/di/interface/injector.js +0 -0
  127. /package/{import/es2022 → es2022}/di/interface/provider.js +0 -0
  128. /package/{import/es2022 → es2022}/di/internal_tokens.js +0 -0
  129. /package/{import/es2022 → es2022}/di/metadata.js +0 -0
  130. /package/{import/es2022 → es2022}/di/null_injector.js +0 -0
  131. /package/{import/es2022 → es2022}/di/provider_collection.js +0 -0
  132. /package/{import/es2022/interface/lifecycle_hooks.js → es2022/di/provider_token.js} +0 -0
  133. /package/{import/es2022 → es2022}/di/r3_injector.js +0 -0
  134. /package/{import/es2022 → es2022}/di/scope.js +0 -0
  135. /package/{import/es2022 → es2022}/di.js +0 -0
  136. /package/{import/es2022 → es2022}/errors.js +0 -0
  137. /package/{import/es2022 → es2022}/interface/type.js +0 -0
  138. /package/{import/es2022 → es2022}/render3/errors_di.js +0 -0
  139. /package/{import/es2022 → es2022}/render3/fields.js +0 -0
  140. /package/{import/es2022 → es2022}/render3/instructions/di.js +0 -0
  141. /package/{import/es2022 → es2022}/render3/util/stringify_utils.js +0 -0
  142. /package/{import/es2022 → es2022}/util/closure.js +0 -0
  143. /package/{import/es2022 → es2022}/util/empty.js +0 -0
  144. /package/{import/es2022 → es2022}/util/property.js +0 -0
  145. /package/{import/es2022 → es2022}/util/stringify.js +0 -0
  146. /package/{import/typings → typings}/di/create_injector.d.ts +0 -0
  147. /package/{import/typings → typings}/di/forward_ref.d.ts +0 -0
  148. /package/{import/typings → typings}/di/index.d.ts +0 -0
  149. /package/{import/typings → typings}/di/initializer_token.d.ts +0 -0
  150. /package/{import/typings → typings}/di/inject_switch.d.ts +0 -0
  151. /package/{import/typings → typings}/di/injection_token.d.ts +0 -0
  152. /package/{import/typings → typings}/di/injector.d.ts +0 -0
  153. /package/{import/typings → typings}/di/injector_compatibility.d.ts +0 -0
  154. /package/{import/typings → typings}/di/injector_marker.d.ts +0 -0
  155. /package/{import/typings → typings}/di/injector_token.d.ts +0 -0
  156. /package/{import/typings → typings}/di/interface/defs.d.ts +0 -0
  157. /package/{import/typings → typings}/di/interface/injector.d.ts +0 -0
  158. /package/{import/typings → typings}/di/interface/provider.d.ts +0 -0
  159. /package/{import/typings → typings}/di/internal_tokens.d.ts +0 -0
  160. /package/{import/typings → typings}/di/metadata.d.ts +0 -0
  161. /package/{import/typings → typings}/di/null_injector.d.ts +0 -0
  162. /package/{import/typings → typings}/di/provider_collection.d.ts +0 -0
  163. /package/{import/typings → typings}/di/provider_token.d.ts +0 -0
  164. /package/{import/typings → typings}/di/r3_injector.d.ts +0 -0
  165. /package/{import/typings → typings}/di/scope.d.ts +0 -0
  166. /package/{import/typings → typings}/di.d.ts +0 -0
  167. /package/{import/typings → typings}/errors.d.ts +0 -0
  168. /package/{import/typings → typings}/interface/lifecycle_hooks.d.ts +0 -0
  169. /package/{import/typings → typings}/interface/type.d.ts +0 -0
  170. /package/{import/typings → typings}/render3/definition_factory.d.ts +0 -0
  171. /package/{import/typings → typings}/render3/errors_di.d.ts +0 -0
  172. /package/{import/typings → typings}/render3/fields.d.ts +0 -0
  173. /package/{import/typings → typings}/render3/instructions/di.d.ts +0 -0
  174. /package/{import/typings → typings}/render3/util/stringify_utils.d.ts +0 -0
  175. /package/{import/typings → typings}/util/closure.d.ts +0 -0
  176. /package/{import/typings → typings}/util/decorators.d.ts +0 -0
  177. /package/{import/typings → typings}/util/empty.d.ts +0 -0
  178. /package/{import/typings → typings}/util/property.d.ts +0 -0
  179. /package/{import/typings → typings}/util/stringify.d.ts +0 -0
@@ -1,30 +0,0 @@
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
- export class RuntimeError extends Error {
9
- code;
10
- constructor(code, message) {
11
- super(formatRuntimeError(code, message));
12
- this.code = code;
13
- }
14
- }
15
- /* tslint:enable:no-toplevel-property-access */
16
- /** Called to format a runtime error */
17
- export function formatRuntimeError(code, message) {
18
- const fullCode = code ? `NG0${code}: ` : '';
19
- let errorMessage = `${fullCode}${message}`;
20
- // Some runtime errors are still thrown without `ngDevMode` (for example
21
- // `throwProviderNotFoundError`), so we add `ngDevMode` check here to avoid pulling
22
- // `RUNTIME_ERRORS_WITH_GUIDES` symbol into prod bundles.
23
- // TODO: revisit all instances where `RuntimeError` is thrown and see if `ngDevMode` can be added
24
- // there instead to tree-shake more devmode-only code (and eventually remove `ngDevMode` check
25
- // from this code).
26
- // if (ngDevMode && RUNTIME_ERRORS_WITH_GUIDES.has(code)) {
27
- // errorMessage = `${errorMessage}. Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0${code}`;
28
- // }
29
- return errorMessage;
30
- }
@@ -1,17 +0,0 @@
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
- export function deepForEach(input, fn) {
9
- input.forEach((value) => Array.isArray(value) ? deepForEach(value, fn) : fn(value));
10
- }
11
- export function newArray(size, value) {
12
- const list = [];
13
- for (let i = 0; i < size; i++) {
14
- list.push(value);
15
- }
16
- return list;
17
- }
@@ -1,53 +0,0 @@
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
- import { noSideEffects } from './closure';
9
- export const PARAMETERS = '__parameters__';
10
- function makeMetadataCtor(props) {
11
- return function ctor(...args) {
12
- if (props) {
13
- const values = props(...args);
14
- for (const propName in values) {
15
- this[propName] = values[propName];
16
- }
17
- }
18
- };
19
- }
20
- export function makeParamDecorator(name, props, parentClass) {
21
- return noSideEffects(() => {
22
- const metaCtor = makeMetadataCtor(props);
23
- function ParamDecoratorFactory(...args) {
24
- if (this instanceof ParamDecoratorFactory) {
25
- metaCtor.apply(this, args);
26
- return this;
27
- }
28
- const annotationInstance = new ParamDecoratorFactory(...args);
29
- ParamDecorator.annotation = annotationInstance;
30
- return ParamDecorator;
31
- function ParamDecorator(cls, unusedKey, index) {
32
- // Use of Object.defineProperty is important since it creates non-enumerable property which
33
- // prevents the property is copied during subclassing.
34
- const parameters = cls.hasOwnProperty(PARAMETERS)
35
- ? cls[PARAMETERS]
36
- : Object.defineProperty(cls, PARAMETERS, { value: [] })[PARAMETERS];
37
- // there might be gaps if some in between parameters do not have annotations.
38
- // we pad with nulls.
39
- while (parameters.length <= index) {
40
- parameters.push(null);
41
- }
42
- (parameters[index] = parameters[index] || []).push(annotationInstance);
43
- return cls;
44
- }
45
- }
46
- if (parentClass) {
47
- ParamDecoratorFactory.prototype = Object.create(parentClass.prototype);
48
- }
49
- ParamDecoratorFactory.prototype.ngMetadataName = name;
50
- ParamDecoratorFactory.annotationCls = ParamDecoratorFactory;
51
- return ParamDecoratorFactory;
52
- });
53
- }
@@ -1,19 +0,0 @@
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
- /**
9
- * Base URL for the error details page.
10
- *
11
- * Keep this constant in sync across:
12
- * - packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.ts
13
- * - packages/core/src/error_details_base_url.ts
14
- */
15
- export declare const ERROR_DETAILS_PAGE_BASE_URL = "https://angular.io/errors";
16
- /**
17
- * URL for the XSS security documentation.
18
- */
19
- export declare const XSS_SECURITY_URL = "https://g.co/ng/security#xss";
@@ -1,12 +0,0 @@
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
- import { Type } from '../interface/type';
9
- /**
10
- * @codeGenApi
11
- */
12
- export declare function ɵɵgetInheritedFactory<T>(type: Type<any>): (type: Type<T>) => T;
@@ -1,24 +0,0 @@
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
- export declare const enum RuntimeErrorCode {
9
- EXPRESSION_CHANGED_AFTER_CHECKED = "100",
10
- CYCLIC_DI_DEPENDENCY = "200",
11
- PROVIDER_NOT_FOUND = "201",
12
- MULTIPLE_COMPONENTS_MATCH = "300",
13
- EXPORT_NOT_FOUND = "301",
14
- PIPE_NOT_FOUND = "302",
15
- UNKNOWN_BINDING = "303",
16
- UNKNOWN_ELEMENT = "304",
17
- TEMPLATE_STRUCTURE_ERROR = "305"
18
- }
19
- export declare class RuntimeError extends Error {
20
- code: RuntimeErrorCode;
21
- constructor(code: RuntimeErrorCode, message: string);
22
- }
23
- /** Called to format a runtime error */
24
- export declare function formatRuntimeError(code: RuntimeErrorCode, message: string): string;
@@ -1,25 +0,0 @@
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
- export declare function deepForEach<T>(input: (T | any[])[], fn: (value: T) => void): void;
9
- export declare function newArray<T = any>(size: number): T[];
10
- export declare function newArray<T>(size: number, value: T): T[];
11
- /**
12
- * `KeyValueArray` is an array where even positions contain keys and odd positions contain values.
13
- *
14
- * `KeyValueArray` provides a very efficient way of iterating over its contents. For small
15
- * sets (~10) the cost of binary searching an `KeyValueArray` has about the same performance
16
- * characteristics that of a `Map` with significantly better memory footprint.
17
- *
18
- * If used as a `Map` the keys are stored in alphabetical order so that they can be binary searched
19
- * for retrieval.
20
- *
21
- * See: `keyValueArraySet`, `keyValueArrayGet`, `keyValueArrayIndexOf`, `keyValueArrayDelete`.
22
- */
23
- export interface KeyValueArray<VALUE> extends Array<VALUE | string> {
24
- __brand__: 'array-map';
25
- }
@@ -1,8 +0,0 @@
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
- export * from './public_api';
@@ -1,28 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.io/license
8
- */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
- };
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- // This file is not used to build this module. It is only used during editing
25
- // by the TypeScript language service and during build for verification. `ngc`
26
- // replaces this file with production index.ts when it rewrites private symbol
27
- // names.
28
- __exportStar(require("./public_api"), exports);
@@ -1,28 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.io/license
8
- */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
- };
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- // This file is not used to build this module. It is only used during editing
25
- // by the TypeScript language service and during build for verification. `ngc`
26
- // replaces this file with production index.ts when it rewrites private symbol
27
- // names.
28
- __exportStar(require("./compiler"), exports);
@@ -1,13 +0,0 @@
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
- /**
9
- * @module
10
- * @description
11
- * Entry point for all public APIs of this package.
12
- */
13
- export * from './src/compiler';
@@ -1,30 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.io/license
8
- */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
- };
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- /**
25
- * @module
26
- * @description
27
- * Entry point for all public APIs of this package.
28
- */
29
- __exportStar(require("./src/compiler"), exports);
30
- // This file only reexports content of the `src` folder. Keep it that way.
@@ -1,5 +0,0 @@
1
- export * from './injectable_compiler_2';
2
- export * from './render3/r3_factory';
3
- export * from './output/output_ast';
4
- export * from './render3/util';
5
- export * from './parse_util';
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./injectable_compiler_2"), exports);
18
- __exportStar(require("./render3/r3_factory"), exports);
19
- __exportStar(require("./output/output_ast"), exports);
20
- __exportStar(require("./render3/util"), exports);
21
- __exportStar(require("./parse_util"), exports);
@@ -1,25 +0,0 @@
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
- /** Flags describing an input for a directive. */
9
- export declare enum InputFlags {
10
- None = 0,
11
- SignalBased = 1,
12
- HasDecoratorInputTransform = 2
13
- }
14
- /**
15
- * Injection flags for DI.
16
- */
17
- export declare const enum InjectFlags {
18
- Default = 0,
19
- /** Don't descend into ancestors of the node requesting injection. */
20
- Self = 2,
21
- /** Skip the node that is requesting injection. */
22
- SkipSelf = 4,
23
- /** Inject `defaultValue` instead if token not found. */
24
- Optional = 8
25
- }
@@ -1,22 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.io/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.InputFlags = void 0;
11
- // Attention:
12
- // This file duplicates types and values from @angular/core
13
- // so that we are able to make @angular/compiler independent of @angular/core.
14
- // This is important to prevent a build cycle, as @angular/core needs to
15
- // be compiled with the compiler.
16
- /** Flags describing an input for a directive. */
17
- var InputFlags;
18
- (function (InputFlags) {
19
- InputFlags[InputFlags["None"] = 0] = "None";
20
- InputFlags[InputFlags["SignalBased"] = 1] = "SignalBased";
21
- InputFlags[InputFlags["HasDecoratorInputTransform"] = 2] = "HasDecoratorInputTransform";
22
- })(InputFlags || (exports.InputFlags = InputFlags = {}));
@@ -1,23 +0,0 @@
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
- import * as o from './output/output_ast';
9
- import { R3DependencyMetadata } from './render3/r3_factory';
10
- import { MaybeForwardRefExpression, R3CompiledExpression, R3Reference } from './render3/util';
11
- export interface R3InjectableMetadata {
12
- name: string;
13
- type: R3Reference;
14
- typeArgumentCount: number;
15
- providedIn: MaybeForwardRefExpression;
16
- useClass?: MaybeForwardRefExpression;
17
- useFactory?: o.Expression;
18
- useExisting?: MaybeForwardRefExpression;
19
- useValue?: MaybeForwardRefExpression;
20
- deps?: R3DependencyMetadata[];
21
- }
22
- export declare function compileInjectable(meta: R3InjectableMetadata, resolveForwardRefs: boolean): R3CompiledExpression;
23
- export declare function createInjectableType(meta: R3InjectableMetadata): o.ExpressionType;
@@ -1,171 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.io/license
8
- */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
- Object.defineProperty(o, "default", { enumerable: true, value: v });
22
- }) : function(o, v) {
23
- o["default"] = v;
24
- });
25
- var __importStar = (this && this.__importStar) || function (mod) {
26
- if (mod && mod.__esModule) return mod;
27
- var result = {};
28
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
- __setModuleDefault(result, mod);
30
- return result;
31
- };
32
- Object.defineProperty(exports, "__esModule", { value: true });
33
- exports.createInjectableType = exports.compileInjectable = void 0;
34
- const o = __importStar(require("./output/output_ast"));
35
- const r3_factory_1 = require("./render3/r3_factory");
36
- const r3_identifiers_1 = require("./render3/r3_identifiers");
37
- const util_1 = require("./render3/util");
38
- const util_2 = require("./render3/view/util");
39
- function compileInjectable(meta, resolveForwardRefs) {
40
- let result = null;
41
- const factoryMeta = {
42
- name: meta.name,
43
- type: meta.type,
44
- typeArgumentCount: meta.typeArgumentCount,
45
- deps: [],
46
- target: r3_factory_1.FactoryTarget.Injectable,
47
- };
48
- if (meta.useClass !== undefined) {
49
- // meta.useClass has two modes of operation. Either deps are specified, in which case `new` is
50
- // used to instantiate the class with dependencies injected, or deps are not specified and
51
- // the factory of the class is used to instantiate it.
52
- //
53
- // A special case exists for useClass: Type where Type is the injectable type itself and no
54
- // deps are specified, in which case 'useClass' is effectively ignored.
55
- const useClassOnSelf = meta.useClass.expression.isEquivalent(meta.type.value);
56
- let deps = undefined;
57
- if (meta.deps !== undefined) {
58
- deps = meta.deps;
59
- }
60
- if (deps !== undefined) {
61
- // factory: () => new meta.useClass(...deps)
62
- result = (0, r3_factory_1.compileFactoryFunction)({
63
- ...factoryMeta,
64
- delegate: meta.useClass.expression,
65
- delegateDeps: deps,
66
- delegateType: r3_factory_1.R3FactoryDelegateType.Class,
67
- });
68
- }
69
- else if (useClassOnSelf) {
70
- result = (0, r3_factory_1.compileFactoryFunction)(factoryMeta);
71
- }
72
- else {
73
- result = {
74
- statements: [],
75
- expression: delegateToFactory(meta.type.value, meta.useClass.expression, resolveForwardRefs),
76
- };
77
- }
78
- }
79
- else if (meta.useFactory !== undefined) {
80
- if (meta.deps !== undefined) {
81
- result = (0, r3_factory_1.compileFactoryFunction)({
82
- ...factoryMeta,
83
- delegate: meta.useFactory,
84
- delegateDeps: meta.deps || [],
85
- delegateType: r3_factory_1.R3FactoryDelegateType.Function,
86
- });
87
- }
88
- else {
89
- result = {
90
- statements: [],
91
- expression: o.arrowFn([], meta.useFactory.callFn([])),
92
- };
93
- }
94
- }
95
- else if (meta.useValue !== undefined) {
96
- // Note: it's safe to use `meta.useValue` instead of the `USE_VALUE in meta` check used for
97
- // client code because meta.useValue is an Expression which will be defined even if the actual
98
- // value is undefined.
99
- result = (0, r3_factory_1.compileFactoryFunction)({
100
- ...factoryMeta,
101
- expression: meta.useValue.expression,
102
- });
103
- }
104
- else if (meta.useExisting !== undefined) {
105
- // useExisting is an `inject` call on the existing token.
106
- result = (0, r3_factory_1.compileFactoryFunction)({
107
- ...factoryMeta,
108
- expression: o
109
- .importExpr(r3_identifiers_1.Identifiers.inject)
110
- .callFn([meta.useExisting.expression]),
111
- });
112
- }
113
- else {
114
- result = {
115
- statements: [],
116
- expression: delegateToFactory(meta.type.value, meta.type.value, resolveForwardRefs),
117
- };
118
- }
119
- const token = meta.type.value;
120
- const injectableProps = new util_2.DefinitionMap();
121
- injectableProps.set('token', token);
122
- injectableProps.set('factory', result.expression);
123
- // Only generate providedIn property if it has a non-null value
124
- if (meta.providedIn.expression.value !== null) {
125
- injectableProps.set('providedIn', (0, util_1.convertFromMaybeForwardRefExpression)(meta.providedIn));
126
- }
127
- const expression = o
128
- .importExpr(r3_identifiers_1.Identifiers.ɵɵdefineInjectable)
129
- .callFn([injectableProps.toLiteralMap()], undefined, true);
130
- return {
131
- expression,
132
- type: createInjectableType(meta),
133
- statements: result.statements,
134
- };
135
- }
136
- exports.compileInjectable = compileInjectable;
137
- function createInjectableType(meta) {
138
- return new o.ExpressionType(o.importExpr(r3_identifiers_1.Identifiers.InjectableDeclaration, [
139
- (0, util_1.typeWithParameters)(meta.type.type, meta.typeArgumentCount),
140
- ]));
141
- }
142
- exports.createInjectableType = createInjectableType;
143
- function delegateToFactory(type, useType, unwrapForwardRefs) {
144
- if (type.node === useType.node) {
145
- // The types are the same, so we can simply delegate directly to the type's factory.
146
- // ```
147
- // factory: type.ɵfac
148
- // ```
149
- return useType.prop('ɵfac');
150
- }
151
- if (!unwrapForwardRefs) {
152
- // The type is not wrapped in a `forwardRef()`, so we create a simple factory function that
153
- // accepts a sub-type as an argument.
154
- // ```
155
- // factory: function(t) { return useType.ɵfac(t); }
156
- // ```
157
- return createFactoryFunction(useType);
158
- }
159
- // The useType is actually wrapped in a `forwardRef()` so we need to resolve that before
160
- // calling its factory.
161
- // ```
162
- // factory: function(t) { return core.resolveForwardRef(type).ɵfac(t); }
163
- // ```
164
- const unwrappedType = o
165
- .importExpr(r3_identifiers_1.Identifiers.resolveForwardRef)
166
- .callFn([useType]);
167
- return createFactoryFunction(unwrappedType);
168
- }
169
- function createFactoryFunction(type) {
170
- return o.arrowFn([new o.FnParam('t', o.DYNAMIC_TYPE)], type.prop('ɵfac').callFn([o.variable('t')]));
171
- }