@angular/language-service 13.0.0-next.5 → 13.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.
- package/bundles/ivy.js +10 -10
- package/bundles/language-service.js +5 -869
- package/package.json +1 -1
package/bundles/ivy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v13.0.0-next.
|
|
2
|
+
* @license Angular v13.0.0-next.6
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -19938,7 +19938,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
19938
19938
|
* Use of this source code is governed by an MIT-style license that can be
|
|
19939
19939
|
* found in the LICENSE file at https://angular.io/license
|
|
19940
19940
|
*/
|
|
19941
|
-
const VERSION$1 = new Version('13.0.0-next.
|
|
19941
|
+
const VERSION$1 = new Version('13.0.0-next.6');
|
|
19942
19942
|
|
|
19943
19943
|
/**
|
|
19944
19944
|
* @license
|
|
@@ -20577,7 +20577,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
20577
20577
|
function compileDeclareClassMetadata(metadata) {
|
|
20578
20578
|
const definitionMap = new DefinitionMap();
|
|
20579
20579
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
20580
|
-
definitionMap.set('version', literal('13.0.0-next.
|
|
20580
|
+
definitionMap.set('version', literal('13.0.0-next.6'));
|
|
20581
20581
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
20582
20582
|
definitionMap.set('type', metadata.type);
|
|
20583
20583
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -20617,7 +20617,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
20617
20617
|
function createDirectiveDefinitionMap(meta) {
|
|
20618
20618
|
const definitionMap = new DefinitionMap();
|
|
20619
20619
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
20620
|
-
definitionMap.set('version', literal('13.0.0-next.
|
|
20620
|
+
definitionMap.set('version', literal('13.0.0-next.6'));
|
|
20621
20621
|
// e.g. `type: MyDirective`
|
|
20622
20622
|
definitionMap.set('type', meta.internalType);
|
|
20623
20623
|
// e.g. `selector: 'some-dir'`
|
|
@@ -20834,7 +20834,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
20834
20834
|
function compileDeclareFactoryFunction(meta) {
|
|
20835
20835
|
const definitionMap = new DefinitionMap();
|
|
20836
20836
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
20837
|
-
definitionMap.set('version', literal('13.0.0-next.
|
|
20837
|
+
definitionMap.set('version', literal('13.0.0-next.6'));
|
|
20838
20838
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
20839
20839
|
definitionMap.set('type', meta.internalType);
|
|
20840
20840
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -20876,7 +20876,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
20876
20876
|
function createInjectableDefinitionMap(meta) {
|
|
20877
20877
|
const definitionMap = new DefinitionMap();
|
|
20878
20878
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
20879
|
-
definitionMap.set('version', literal('13.0.0-next.
|
|
20879
|
+
definitionMap.set('version', literal('13.0.0-next.6'));
|
|
20880
20880
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
20881
20881
|
definitionMap.set('type', meta.internalType);
|
|
20882
20882
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -20955,7 +20955,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
20955
20955
|
function createInjectorDefinitionMap(meta) {
|
|
20956
20956
|
const definitionMap = new DefinitionMap();
|
|
20957
20957
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
20958
|
-
definitionMap.set('version', literal('13.0.0-next.
|
|
20958
|
+
definitionMap.set('version', literal('13.0.0-next.6'));
|
|
20959
20959
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
20960
20960
|
definitionMap.set('type', meta.internalType);
|
|
20961
20961
|
definitionMap.set('providers', meta.providers);
|
|
@@ -20992,7 +20992,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
20992
20992
|
function createNgModuleDefinitionMap(meta) {
|
|
20993
20993
|
const definitionMap = new DefinitionMap();
|
|
20994
20994
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
20995
|
-
definitionMap.set('version', literal('13.0.0-next.
|
|
20995
|
+
definitionMap.set('version', literal('13.0.0-next.6'));
|
|
20996
20996
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
20997
20997
|
definitionMap.set('type', meta.internalType);
|
|
20998
20998
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -21050,7 +21050,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
21050
21050
|
function createPipeDefinitionMap(meta) {
|
|
21051
21051
|
const definitionMap = new DefinitionMap();
|
|
21052
21052
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
|
|
21053
|
-
definitionMap.set('version', literal('13.0.0-next.
|
|
21053
|
+
definitionMap.set('version', literal('13.0.0-next.6'));
|
|
21054
21054
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
21055
21055
|
// e.g. `type: MyPipe`
|
|
21056
21056
|
definitionMap.set('type', meta.internalType);
|
|
@@ -21082,7 +21082,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
21082
21082
|
* Use of this source code is governed by an MIT-style license that can be
|
|
21083
21083
|
* found in the LICENSE file at https://angular.io/license
|
|
21084
21084
|
*/
|
|
21085
|
-
const VERSION$2 = new Version('13.0.0-next.
|
|
21085
|
+
const VERSION$2 = new Version('13.0.0-next.6');
|
|
21086
21086
|
|
|
21087
21087
|
/**
|
|
21088
21088
|
* @license
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v13.0.0-next.
|
|
2
|
+
* @license Angular v13.0.0-next.6
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -21475,7 +21475,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
21475
21475
|
* Use of this source code is governed by an MIT-style license that can be
|
|
21476
21476
|
* found in the LICENSE file at https://angular.io/license
|
|
21477
21477
|
*/
|
|
21478
|
-
const VERSION$1 = new Version('13.0.0-next.
|
|
21478
|
+
const VERSION$1 = new Version('13.0.0-next.6');
|
|
21479
21479
|
|
|
21480
21480
|
/**
|
|
21481
21481
|
* @license
|
|
@@ -32958,12 +32958,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
32958
32958
|
const ERROR_DEBUG_CONTEXT = 'ngDebugContext';
|
|
32959
32959
|
const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
|
|
32960
32960
|
const ERROR_LOGGER = 'ngErrorLogger';
|
|
32961
|
-
function wrappedError(message, originalError) {
|
|
32962
|
-
const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;
|
|
32963
|
-
const error = Error(msg);
|
|
32964
|
-
error[ERROR_ORIGINAL_ERROR] = originalError;
|
|
32965
|
-
return error;
|
|
32966
|
-
}
|
|
32967
32961
|
|
|
32968
32962
|
/**
|
|
32969
32963
|
* @license
|
|
@@ -35794,7 +35788,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
35794
35788
|
}
|
|
35795
35789
|
}
|
|
35796
35790
|
Injector.THROW_IF_NOT_FOUND = THROW_IF_NOT_FOUND;
|
|
35797
|
-
Injector.NULL = new NullInjector();
|
|
35791
|
+
Injector.NULL = ( /* @__PURE__ */new NullInjector());
|
|
35798
35792
|
/** @nocollapse */
|
|
35799
35793
|
Injector.ɵprov = ɵɵdefineInjectable({
|
|
35800
35794
|
token: Injector,
|
|
@@ -36316,864 +36310,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
36316
36310
|
const SWITCH_COMPILE_INJECTABLE__PRE_R3__ = render2CompileInjectable;
|
|
36317
36311
|
const SWITCH_COMPILE_INJECTABLE = SWITCH_COMPILE_INJECTABLE__PRE_R3__;
|
|
36318
36312
|
|
|
36319
|
-
/**
|
|
36320
|
-
* @license
|
|
36321
|
-
* Copyright Google LLC All Rights Reserved.
|
|
36322
|
-
*
|
|
36323
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
36324
|
-
* found in the LICENSE file at https://angular.io/license
|
|
36325
|
-
*/
|
|
36326
|
-
function findFirstClosedCycle(keys) {
|
|
36327
|
-
const res = [];
|
|
36328
|
-
for (let i = 0; i < keys.length; ++i) {
|
|
36329
|
-
if (res.indexOf(keys[i]) > -1) {
|
|
36330
|
-
res.push(keys[i]);
|
|
36331
|
-
return res;
|
|
36332
|
-
}
|
|
36333
|
-
res.push(keys[i]);
|
|
36334
|
-
}
|
|
36335
|
-
return res;
|
|
36336
|
-
}
|
|
36337
|
-
function constructResolvingPath(keys) {
|
|
36338
|
-
if (keys.length > 1) {
|
|
36339
|
-
const reversed = findFirstClosedCycle(keys.slice().reverse());
|
|
36340
|
-
const tokenStrs = reversed.map(k => stringify$1(k.token));
|
|
36341
|
-
return ' (' + tokenStrs.join(' -> ') + ')';
|
|
36342
|
-
}
|
|
36343
|
-
return '';
|
|
36344
|
-
}
|
|
36345
|
-
function injectionError(injector, key, constructResolvingMessage, originalError) {
|
|
36346
|
-
const keys = [key];
|
|
36347
|
-
const errMsg = constructResolvingMessage(keys);
|
|
36348
|
-
const error = (originalError ? wrappedError(errMsg, originalError) : Error(errMsg));
|
|
36349
|
-
error.addKey = addKey;
|
|
36350
|
-
error.keys = keys;
|
|
36351
|
-
error.injectors = [injector];
|
|
36352
|
-
error.constructResolvingMessage = constructResolvingMessage;
|
|
36353
|
-
error[ERROR_ORIGINAL_ERROR] = originalError;
|
|
36354
|
-
return error;
|
|
36355
|
-
}
|
|
36356
|
-
function addKey(injector, key) {
|
|
36357
|
-
this.injectors.push(injector);
|
|
36358
|
-
this.keys.push(key);
|
|
36359
|
-
// Note: This updated message won't be reflected in the `.stack` property
|
|
36360
|
-
this.message = this.constructResolvingMessage(this.keys);
|
|
36361
|
-
}
|
|
36362
|
-
/**
|
|
36363
|
-
* Thrown when trying to retrieve a dependency by key from {@link Injector}, but the
|
|
36364
|
-
* {@link Injector} does not have a {@link Provider} for the given key.
|
|
36365
|
-
*
|
|
36366
|
-
* @usageNotes
|
|
36367
|
-
* ### Example
|
|
36368
|
-
*
|
|
36369
|
-
* ```typescript
|
|
36370
|
-
* class A {
|
|
36371
|
-
* constructor(b:B) {}
|
|
36372
|
-
* }
|
|
36373
|
-
*
|
|
36374
|
-
* expect(() => Injector.resolveAndCreate([A])).toThrowError();
|
|
36375
|
-
* ```
|
|
36376
|
-
*/
|
|
36377
|
-
function noProviderError(injector, key) {
|
|
36378
|
-
return injectionError(injector, key, function (keys) {
|
|
36379
|
-
const first = stringify$1(keys[0].token);
|
|
36380
|
-
return `No provider for ${first}!${constructResolvingPath(keys)}`;
|
|
36381
|
-
});
|
|
36382
|
-
}
|
|
36383
|
-
/**
|
|
36384
|
-
* Thrown when dependencies form a cycle.
|
|
36385
|
-
*
|
|
36386
|
-
* @usageNotes
|
|
36387
|
-
* ### Example
|
|
36388
|
-
*
|
|
36389
|
-
* ```typescript
|
|
36390
|
-
* var injector = Injector.resolveAndCreate([
|
|
36391
|
-
* {provide: "one", useFactory: (two) => "two", deps: [[new Inject("two")]]},
|
|
36392
|
-
* {provide: "two", useFactory: (one) => "one", deps: [[new Inject("one")]]}
|
|
36393
|
-
* ]);
|
|
36394
|
-
*
|
|
36395
|
-
* expect(() => injector.get("one")).toThrowError();
|
|
36396
|
-
* ```
|
|
36397
|
-
*
|
|
36398
|
-
* Retrieving `A` or `B` throws a `CyclicDependencyError` as the graph above cannot be constructed.
|
|
36399
|
-
*/
|
|
36400
|
-
function cyclicDependencyError(injector, key) {
|
|
36401
|
-
return injectionError(injector, key, function (keys) {
|
|
36402
|
-
return `Cannot instantiate cyclic dependency!${constructResolvingPath(keys)}`;
|
|
36403
|
-
});
|
|
36404
|
-
}
|
|
36405
|
-
/**
|
|
36406
|
-
* Thrown when a constructing type returns with an Error.
|
|
36407
|
-
*
|
|
36408
|
-
* The `InstantiationError` class contains the original error plus the dependency graph which caused
|
|
36409
|
-
* this object to be instantiated.
|
|
36410
|
-
*
|
|
36411
|
-
* @usageNotes
|
|
36412
|
-
* ### Example
|
|
36413
|
-
*
|
|
36414
|
-
* ```typescript
|
|
36415
|
-
* class A {
|
|
36416
|
-
* constructor() {
|
|
36417
|
-
* throw new Error('message');
|
|
36418
|
-
* }
|
|
36419
|
-
* }
|
|
36420
|
-
*
|
|
36421
|
-
* var injector = Injector.resolveAndCreate([A]);
|
|
36422
|
-
|
|
36423
|
-
* try {
|
|
36424
|
-
* injector.get(A);
|
|
36425
|
-
* } catch (e) {
|
|
36426
|
-
* expect(e instanceof InstantiationError).toBe(true);
|
|
36427
|
-
* expect(e.originalException.message).toEqual("message");
|
|
36428
|
-
* expect(e.originalStack).toBeDefined();
|
|
36429
|
-
* }
|
|
36430
|
-
* ```
|
|
36431
|
-
*/
|
|
36432
|
-
function instantiationError(injector, originalException, originalStack, key) {
|
|
36433
|
-
return injectionError(injector, key, function (keys) {
|
|
36434
|
-
const first = stringify$1(keys[0].token);
|
|
36435
|
-
return `${originalException.message}: Error during instantiation of ${first}!${constructResolvingPath(keys)}.`;
|
|
36436
|
-
}, originalException);
|
|
36437
|
-
}
|
|
36438
|
-
/**
|
|
36439
|
-
* Thrown when an object other then {@link Provider} (or `Type`) is passed to {@link Injector}
|
|
36440
|
-
* creation.
|
|
36441
|
-
*
|
|
36442
|
-
* @usageNotes
|
|
36443
|
-
* ### Example
|
|
36444
|
-
*
|
|
36445
|
-
* ```typescript
|
|
36446
|
-
* expect(() => Injector.resolveAndCreate(["not a type"])).toThrowError();
|
|
36447
|
-
* ```
|
|
36448
|
-
*/
|
|
36449
|
-
function invalidProviderError(provider) {
|
|
36450
|
-
return Error(`Invalid provider - only instances of Provider and Type are allowed, got: ${provider}`);
|
|
36451
|
-
}
|
|
36452
|
-
/**
|
|
36453
|
-
* Thrown when the class has no annotation information.
|
|
36454
|
-
*
|
|
36455
|
-
* Lack of annotation information prevents the {@link Injector} from determining which dependencies
|
|
36456
|
-
* need to be injected into the constructor.
|
|
36457
|
-
*
|
|
36458
|
-
* @usageNotes
|
|
36459
|
-
* ### Example
|
|
36460
|
-
*
|
|
36461
|
-
* ```typescript
|
|
36462
|
-
* class A {
|
|
36463
|
-
* constructor(b) {}
|
|
36464
|
-
* }
|
|
36465
|
-
*
|
|
36466
|
-
* expect(() => Injector.resolveAndCreate([A])).toThrowError();
|
|
36467
|
-
* ```
|
|
36468
|
-
*
|
|
36469
|
-
* This error is also thrown when the class not marked with {@link Injectable} has parameter types.
|
|
36470
|
-
*
|
|
36471
|
-
* ```typescript
|
|
36472
|
-
* class B {}
|
|
36473
|
-
*
|
|
36474
|
-
* class A {
|
|
36475
|
-
* constructor(b:B) {} // no information about the parameter types of A is available at runtime.
|
|
36476
|
-
* }
|
|
36477
|
-
*
|
|
36478
|
-
* expect(() => Injector.resolveAndCreate([A,B])).toThrowError();
|
|
36479
|
-
* ```
|
|
36480
|
-
*
|
|
36481
|
-
*/
|
|
36482
|
-
function noAnnotationError(typeOrFunc, params) {
|
|
36483
|
-
const signature = [];
|
|
36484
|
-
for (let i = 0, ii = params.length; i < ii; i++) {
|
|
36485
|
-
const parameter = params[i];
|
|
36486
|
-
if (!parameter || parameter.length == 0) {
|
|
36487
|
-
signature.push('?');
|
|
36488
|
-
}
|
|
36489
|
-
else {
|
|
36490
|
-
signature.push(parameter.map(stringify$1).join(' '));
|
|
36491
|
-
}
|
|
36492
|
-
}
|
|
36493
|
-
return Error('Cannot resolve all parameters for \'' + stringify$1(typeOrFunc) + '\'(' +
|
|
36494
|
-
signature.join(', ') + '). ' +
|
|
36495
|
-
'Make sure that all the parameters are decorated with Inject or have valid type annotations and that \'' +
|
|
36496
|
-
stringify$1(typeOrFunc) + '\' is decorated with Injectable.');
|
|
36497
|
-
}
|
|
36498
|
-
/**
|
|
36499
|
-
* Thrown when getting an object by index.
|
|
36500
|
-
*
|
|
36501
|
-
* @usageNotes
|
|
36502
|
-
* ### Example
|
|
36503
|
-
*
|
|
36504
|
-
* ```typescript
|
|
36505
|
-
* class A {}
|
|
36506
|
-
*
|
|
36507
|
-
* var injector = Injector.resolveAndCreate([A]);
|
|
36508
|
-
*
|
|
36509
|
-
* expect(() => injector.getAt(100)).toThrowError();
|
|
36510
|
-
* ```
|
|
36511
|
-
*
|
|
36512
|
-
*/
|
|
36513
|
-
function outOfBoundsError(index) {
|
|
36514
|
-
return Error(`Index ${index} is out-of-bounds.`);
|
|
36515
|
-
}
|
|
36516
|
-
// TODO: add a working example after alpha38 is released
|
|
36517
|
-
/**
|
|
36518
|
-
* Thrown when a multi provider and a regular provider are bound to the same token.
|
|
36519
|
-
*
|
|
36520
|
-
* @usageNotes
|
|
36521
|
-
* ### Example
|
|
36522
|
-
*
|
|
36523
|
-
* ```typescript
|
|
36524
|
-
* expect(() => Injector.resolveAndCreate([
|
|
36525
|
-
* { provide: "Strings", useValue: "string1", multi: true},
|
|
36526
|
-
* { provide: "Strings", useValue: "string2", multi: false}
|
|
36527
|
-
* ])).toThrowError();
|
|
36528
|
-
* ```
|
|
36529
|
-
*/
|
|
36530
|
-
function mixingMultiProvidersWithRegularProvidersError(provider1, provider2) {
|
|
36531
|
-
return Error(`Cannot mix multi providers and regular providers, got: ${provider1} ${provider2}`);
|
|
36532
|
-
}
|
|
36533
|
-
|
|
36534
|
-
/**
|
|
36535
|
-
* @license
|
|
36536
|
-
* Copyright Google LLC All Rights Reserved.
|
|
36537
|
-
*
|
|
36538
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
36539
|
-
* found in the LICENSE file at https://angular.io/license
|
|
36540
|
-
*/
|
|
36541
|
-
/**
|
|
36542
|
-
* A unique object used for retrieving items from the {@link ReflectiveInjector}.
|
|
36543
|
-
*
|
|
36544
|
-
* Keys have:
|
|
36545
|
-
* - a system-wide unique `id`.
|
|
36546
|
-
* - a `token`.
|
|
36547
|
-
*
|
|
36548
|
-
* `Key` is used internally by {@link ReflectiveInjector} because its system-wide unique `id` allows
|
|
36549
|
-
* the
|
|
36550
|
-
* injector to store created objects in a more efficient way.
|
|
36551
|
-
*
|
|
36552
|
-
* `Key` should not be created directly. {@link ReflectiveInjector} creates keys automatically when
|
|
36553
|
-
* resolving
|
|
36554
|
-
* providers.
|
|
36555
|
-
*
|
|
36556
|
-
* @deprecated No replacement
|
|
36557
|
-
* @publicApi
|
|
36558
|
-
*/
|
|
36559
|
-
class ReflectiveKey {
|
|
36560
|
-
/**
|
|
36561
|
-
* Private
|
|
36562
|
-
*/
|
|
36563
|
-
constructor(token, id) {
|
|
36564
|
-
this.token = token;
|
|
36565
|
-
this.id = id;
|
|
36566
|
-
if (!token) {
|
|
36567
|
-
throw new Error('Token must be defined!');
|
|
36568
|
-
}
|
|
36569
|
-
this.displayName = stringify$1(this.token);
|
|
36570
|
-
}
|
|
36571
|
-
/**
|
|
36572
|
-
* Retrieves a `Key` for a token.
|
|
36573
|
-
*/
|
|
36574
|
-
static get(token) {
|
|
36575
|
-
return _globalKeyRegistry.get(resolveForwardRef$1(token));
|
|
36576
|
-
}
|
|
36577
|
-
/**
|
|
36578
|
-
* @returns the number of keys registered in the system.
|
|
36579
|
-
*/
|
|
36580
|
-
static get numberOfKeys() {
|
|
36581
|
-
return _globalKeyRegistry.numberOfKeys;
|
|
36582
|
-
}
|
|
36583
|
-
}
|
|
36584
|
-
class KeyRegistry {
|
|
36585
|
-
constructor() {
|
|
36586
|
-
this._allKeys = new Map();
|
|
36587
|
-
}
|
|
36588
|
-
get(token) {
|
|
36589
|
-
if (token instanceof ReflectiveKey)
|
|
36590
|
-
return token;
|
|
36591
|
-
if (this._allKeys.has(token)) {
|
|
36592
|
-
return this._allKeys.get(token);
|
|
36593
|
-
}
|
|
36594
|
-
const newKey = new ReflectiveKey(token, ReflectiveKey.numberOfKeys);
|
|
36595
|
-
this._allKeys.set(token, newKey);
|
|
36596
|
-
return newKey;
|
|
36597
|
-
}
|
|
36598
|
-
get numberOfKeys() {
|
|
36599
|
-
return this._allKeys.size;
|
|
36600
|
-
}
|
|
36601
|
-
}
|
|
36602
|
-
const _globalKeyRegistry = new KeyRegistry();
|
|
36603
|
-
|
|
36604
|
-
/**
|
|
36605
|
-
* @license
|
|
36606
|
-
* Copyright Google LLC All Rights Reserved.
|
|
36607
|
-
*
|
|
36608
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
36609
|
-
* found in the LICENSE file at https://angular.io/license
|
|
36610
|
-
*/
|
|
36611
|
-
/**
|
|
36612
|
-
* Provides access to reflection data about symbols. Used internally by Angular
|
|
36613
|
-
* to power dependency injection and compilation.
|
|
36614
|
-
*/
|
|
36615
|
-
class Reflector {
|
|
36616
|
-
constructor(reflectionCapabilities) {
|
|
36617
|
-
this.reflectionCapabilities = reflectionCapabilities;
|
|
36618
|
-
}
|
|
36619
|
-
updateCapabilities(caps) {
|
|
36620
|
-
this.reflectionCapabilities = caps;
|
|
36621
|
-
}
|
|
36622
|
-
factory(type) {
|
|
36623
|
-
return this.reflectionCapabilities.factory(type);
|
|
36624
|
-
}
|
|
36625
|
-
parameters(typeOrFunc) {
|
|
36626
|
-
return this.reflectionCapabilities.parameters(typeOrFunc);
|
|
36627
|
-
}
|
|
36628
|
-
annotations(typeOrFunc) {
|
|
36629
|
-
return this.reflectionCapabilities.annotations(typeOrFunc);
|
|
36630
|
-
}
|
|
36631
|
-
propMetadata(typeOrFunc) {
|
|
36632
|
-
return this.reflectionCapabilities.propMetadata(typeOrFunc);
|
|
36633
|
-
}
|
|
36634
|
-
hasLifecycleHook(type, lcProperty) {
|
|
36635
|
-
return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty);
|
|
36636
|
-
}
|
|
36637
|
-
getter(name) {
|
|
36638
|
-
return this.reflectionCapabilities.getter(name);
|
|
36639
|
-
}
|
|
36640
|
-
setter(name) {
|
|
36641
|
-
return this.reflectionCapabilities.setter(name);
|
|
36642
|
-
}
|
|
36643
|
-
method(name) {
|
|
36644
|
-
return this.reflectionCapabilities.method(name);
|
|
36645
|
-
}
|
|
36646
|
-
importUri(type) {
|
|
36647
|
-
return this.reflectionCapabilities.importUri(type);
|
|
36648
|
-
}
|
|
36649
|
-
resourceUri(type) {
|
|
36650
|
-
return this.reflectionCapabilities.resourceUri(type);
|
|
36651
|
-
}
|
|
36652
|
-
resolveIdentifier(name, moduleUrl, members, runtime) {
|
|
36653
|
-
return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, members, runtime);
|
|
36654
|
-
}
|
|
36655
|
-
resolveEnum(identifier, name) {
|
|
36656
|
-
return this.reflectionCapabilities.resolveEnum(identifier, name);
|
|
36657
|
-
}
|
|
36658
|
-
}
|
|
36659
|
-
|
|
36660
|
-
/**
|
|
36661
|
-
* @license
|
|
36662
|
-
* Copyright Google LLC All Rights Reserved.
|
|
36663
|
-
*
|
|
36664
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
36665
|
-
* found in the LICENSE file at https://angular.io/license
|
|
36666
|
-
*/
|
|
36667
|
-
/**
|
|
36668
|
-
* The {@link Reflector} used internally in Angular to access metadata
|
|
36669
|
-
* about symbols.
|
|
36670
|
-
*/
|
|
36671
|
-
const reflector = new Reflector(new ReflectionCapabilities());
|
|
36672
|
-
|
|
36673
|
-
/**
|
|
36674
|
-
* @license
|
|
36675
|
-
* Copyright Google LLC All Rights Reserved.
|
|
36676
|
-
*
|
|
36677
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
36678
|
-
* found in the LICENSE file at https://angular.io/license
|
|
36679
|
-
*/
|
|
36680
|
-
/**
|
|
36681
|
-
* `Dependency` is used by the framework to extend DI.
|
|
36682
|
-
* This is internal to Angular and should not be used directly.
|
|
36683
|
-
*/
|
|
36684
|
-
class ReflectiveDependency {
|
|
36685
|
-
constructor(key, optional, visibility) {
|
|
36686
|
-
this.key = key;
|
|
36687
|
-
this.optional = optional;
|
|
36688
|
-
this.visibility = visibility;
|
|
36689
|
-
}
|
|
36690
|
-
static fromKey(key) {
|
|
36691
|
-
return new ReflectiveDependency(key, false, null);
|
|
36692
|
-
}
|
|
36693
|
-
}
|
|
36694
|
-
const _EMPTY_LIST = [];
|
|
36695
|
-
class ResolvedReflectiveProvider_ {
|
|
36696
|
-
constructor(key, resolvedFactories, multiProvider) {
|
|
36697
|
-
this.key = key;
|
|
36698
|
-
this.resolvedFactories = resolvedFactories;
|
|
36699
|
-
this.multiProvider = multiProvider;
|
|
36700
|
-
this.resolvedFactory = this.resolvedFactories[0];
|
|
36701
|
-
}
|
|
36702
|
-
}
|
|
36703
|
-
/**
|
|
36704
|
-
* An internal resolved representation of a factory function created by resolving `Provider`.
|
|
36705
|
-
* @publicApi
|
|
36706
|
-
*/
|
|
36707
|
-
class ResolvedReflectiveFactory {
|
|
36708
|
-
constructor(
|
|
36709
|
-
/**
|
|
36710
|
-
* Factory function which can return an instance of an object represented by a key.
|
|
36711
|
-
*/
|
|
36712
|
-
factory,
|
|
36713
|
-
/**
|
|
36714
|
-
* Arguments (dependencies) to the `factory` function.
|
|
36715
|
-
*/
|
|
36716
|
-
dependencies) {
|
|
36717
|
-
this.factory = factory;
|
|
36718
|
-
this.dependencies = dependencies;
|
|
36719
|
-
}
|
|
36720
|
-
}
|
|
36721
|
-
/**
|
|
36722
|
-
* Resolve a single provider.
|
|
36723
|
-
*/
|
|
36724
|
-
function resolveReflectiveFactory(provider) {
|
|
36725
|
-
let factoryFn;
|
|
36726
|
-
let resolvedDeps;
|
|
36727
|
-
if (provider.useClass) {
|
|
36728
|
-
const useClass = resolveForwardRef$1(provider.useClass);
|
|
36729
|
-
factoryFn = reflector.factory(useClass);
|
|
36730
|
-
resolvedDeps = _dependenciesFor(useClass);
|
|
36731
|
-
}
|
|
36732
|
-
else if (provider.useExisting) {
|
|
36733
|
-
factoryFn = (aliasInstance) => aliasInstance;
|
|
36734
|
-
resolvedDeps = [ReflectiveDependency.fromKey(ReflectiveKey.get(provider.useExisting))];
|
|
36735
|
-
}
|
|
36736
|
-
else if (provider.useFactory) {
|
|
36737
|
-
factoryFn = provider.useFactory;
|
|
36738
|
-
resolvedDeps = constructDependencies(provider.useFactory, provider.deps);
|
|
36739
|
-
}
|
|
36740
|
-
else {
|
|
36741
|
-
factoryFn = () => provider.useValue;
|
|
36742
|
-
resolvedDeps = _EMPTY_LIST;
|
|
36743
|
-
}
|
|
36744
|
-
return new ResolvedReflectiveFactory(factoryFn, resolvedDeps);
|
|
36745
|
-
}
|
|
36746
|
-
/**
|
|
36747
|
-
* Converts the `Provider` into `ResolvedProvider`.
|
|
36748
|
-
*
|
|
36749
|
-
* `Injector` internally only uses `ResolvedProvider`, `Provider` contains convenience provider
|
|
36750
|
-
* syntax.
|
|
36751
|
-
*/
|
|
36752
|
-
function resolveReflectiveProvider(provider) {
|
|
36753
|
-
return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi || false);
|
|
36754
|
-
}
|
|
36755
|
-
/**
|
|
36756
|
-
* Resolve a list of Providers.
|
|
36757
|
-
*/
|
|
36758
|
-
function resolveReflectiveProviders(providers) {
|
|
36759
|
-
const normalized = _normalizeProviders(providers, []);
|
|
36760
|
-
const resolved = normalized.map(resolveReflectiveProvider);
|
|
36761
|
-
const resolvedProviderMap = mergeResolvedReflectiveProviders(resolved, new Map());
|
|
36762
|
-
return Array.from(resolvedProviderMap.values());
|
|
36763
|
-
}
|
|
36764
|
-
/**
|
|
36765
|
-
* Merges a list of ResolvedProviders into a list where each key is contained exactly once and
|
|
36766
|
-
* multi providers have been merged.
|
|
36767
|
-
*/
|
|
36768
|
-
function mergeResolvedReflectiveProviders(providers, normalizedProvidersMap) {
|
|
36769
|
-
for (let i = 0; i < providers.length; i++) {
|
|
36770
|
-
const provider = providers[i];
|
|
36771
|
-
const existing = normalizedProvidersMap.get(provider.key.id);
|
|
36772
|
-
if (existing) {
|
|
36773
|
-
if (provider.multiProvider !== existing.multiProvider) {
|
|
36774
|
-
throw mixingMultiProvidersWithRegularProvidersError(existing, provider);
|
|
36775
|
-
}
|
|
36776
|
-
if (provider.multiProvider) {
|
|
36777
|
-
for (let j = 0; j < provider.resolvedFactories.length; j++) {
|
|
36778
|
-
existing.resolvedFactories.push(provider.resolvedFactories[j]);
|
|
36779
|
-
}
|
|
36780
|
-
}
|
|
36781
|
-
else {
|
|
36782
|
-
normalizedProvidersMap.set(provider.key.id, provider);
|
|
36783
|
-
}
|
|
36784
|
-
}
|
|
36785
|
-
else {
|
|
36786
|
-
let resolvedProvider;
|
|
36787
|
-
if (provider.multiProvider) {
|
|
36788
|
-
resolvedProvider = new ResolvedReflectiveProvider_(provider.key, provider.resolvedFactories.slice(), provider.multiProvider);
|
|
36789
|
-
}
|
|
36790
|
-
else {
|
|
36791
|
-
resolvedProvider = provider;
|
|
36792
|
-
}
|
|
36793
|
-
normalizedProvidersMap.set(provider.key.id, resolvedProvider);
|
|
36794
|
-
}
|
|
36795
|
-
}
|
|
36796
|
-
return normalizedProvidersMap;
|
|
36797
|
-
}
|
|
36798
|
-
function _normalizeProviders(providers, res) {
|
|
36799
|
-
providers.forEach(b => {
|
|
36800
|
-
if (b instanceof Type$2) {
|
|
36801
|
-
res.push({ provide: b, useClass: b });
|
|
36802
|
-
}
|
|
36803
|
-
else if (b && typeof b == 'object' && b.provide !== undefined) {
|
|
36804
|
-
res.push(b);
|
|
36805
|
-
}
|
|
36806
|
-
else if (Array.isArray(b)) {
|
|
36807
|
-
_normalizeProviders(b, res);
|
|
36808
|
-
}
|
|
36809
|
-
else {
|
|
36810
|
-
throw invalidProviderError(b);
|
|
36811
|
-
}
|
|
36812
|
-
});
|
|
36813
|
-
return res;
|
|
36814
|
-
}
|
|
36815
|
-
function constructDependencies(typeOrFunc, dependencies) {
|
|
36816
|
-
if (!dependencies) {
|
|
36817
|
-
return _dependenciesFor(typeOrFunc);
|
|
36818
|
-
}
|
|
36819
|
-
else {
|
|
36820
|
-
const params = dependencies.map(t => [t]);
|
|
36821
|
-
return dependencies.map(t => _extractToken(typeOrFunc, t, params));
|
|
36822
|
-
}
|
|
36823
|
-
}
|
|
36824
|
-
function _dependenciesFor(typeOrFunc) {
|
|
36825
|
-
const params = reflector.parameters(typeOrFunc);
|
|
36826
|
-
if (!params)
|
|
36827
|
-
return [];
|
|
36828
|
-
if (params.some(p => p == null)) {
|
|
36829
|
-
throw noAnnotationError(typeOrFunc, params);
|
|
36830
|
-
}
|
|
36831
|
-
return params.map(p => _extractToken(typeOrFunc, p, params));
|
|
36832
|
-
}
|
|
36833
|
-
function _extractToken(typeOrFunc, metadata, params) {
|
|
36834
|
-
let token = null;
|
|
36835
|
-
let optional = false;
|
|
36836
|
-
if (!Array.isArray(metadata)) {
|
|
36837
|
-
if (metadata instanceof Inject) {
|
|
36838
|
-
return _createDependency(metadata.token, optional, null);
|
|
36839
|
-
}
|
|
36840
|
-
else {
|
|
36841
|
-
return _createDependency(metadata, optional, null);
|
|
36842
|
-
}
|
|
36843
|
-
}
|
|
36844
|
-
let visibility = null;
|
|
36845
|
-
for (let i = 0; i < metadata.length; ++i) {
|
|
36846
|
-
const paramMetadata = metadata[i];
|
|
36847
|
-
if (paramMetadata instanceof Type$2) {
|
|
36848
|
-
token = paramMetadata;
|
|
36849
|
-
}
|
|
36850
|
-
else if (paramMetadata instanceof Inject) {
|
|
36851
|
-
token = paramMetadata.token;
|
|
36852
|
-
}
|
|
36853
|
-
else if (paramMetadata instanceof Optional) {
|
|
36854
|
-
optional = true;
|
|
36855
|
-
}
|
|
36856
|
-
else if (paramMetadata instanceof Self || paramMetadata instanceof SkipSelf) {
|
|
36857
|
-
visibility = paramMetadata;
|
|
36858
|
-
}
|
|
36859
|
-
else if (paramMetadata instanceof InjectionToken) {
|
|
36860
|
-
token = paramMetadata;
|
|
36861
|
-
}
|
|
36862
|
-
}
|
|
36863
|
-
token = resolveForwardRef$1(token);
|
|
36864
|
-
if (token != null) {
|
|
36865
|
-
return _createDependency(token, optional, visibility);
|
|
36866
|
-
}
|
|
36867
|
-
else {
|
|
36868
|
-
throw noAnnotationError(typeOrFunc, params);
|
|
36869
|
-
}
|
|
36870
|
-
}
|
|
36871
|
-
function _createDependency(token, optional, visibility) {
|
|
36872
|
-
return new ReflectiveDependency(ReflectiveKey.get(token), optional, visibility);
|
|
36873
|
-
}
|
|
36874
|
-
|
|
36875
|
-
/**
|
|
36876
|
-
* @license
|
|
36877
|
-
* Copyright Google LLC All Rights Reserved.
|
|
36878
|
-
*
|
|
36879
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
36880
|
-
* found in the LICENSE file at https://angular.io/license
|
|
36881
|
-
*/
|
|
36882
|
-
// Threshold for the dynamic version
|
|
36883
|
-
const UNDEFINED = {};
|
|
36884
|
-
/**
|
|
36885
|
-
* A ReflectiveDependency injection container used for instantiating objects and resolving
|
|
36886
|
-
* dependencies.
|
|
36887
|
-
*
|
|
36888
|
-
* An `Injector` is a replacement for a `new` operator, which can automatically resolve the
|
|
36889
|
-
* constructor dependencies.
|
|
36890
|
-
*
|
|
36891
|
-
* In typical use, application code asks for the dependencies in the constructor and they are
|
|
36892
|
-
* resolved by the `Injector`.
|
|
36893
|
-
*
|
|
36894
|
-
* @usageNotes
|
|
36895
|
-
* ### Example
|
|
36896
|
-
*
|
|
36897
|
-
* The following example creates an `Injector` configured to create `Engine` and `Car`.
|
|
36898
|
-
*
|
|
36899
|
-
* ```typescript
|
|
36900
|
-
* @Injectable()
|
|
36901
|
-
* class Engine {
|
|
36902
|
-
* }
|
|
36903
|
-
*
|
|
36904
|
-
* @Injectable()
|
|
36905
|
-
* class Car {
|
|
36906
|
-
* constructor(public engine:Engine) {}
|
|
36907
|
-
* }
|
|
36908
|
-
*
|
|
36909
|
-
* var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
|
|
36910
|
-
* var car = injector.get(Car);
|
|
36911
|
-
* expect(car instanceof Car).toBe(true);
|
|
36912
|
-
* expect(car.engine instanceof Engine).toBe(true);
|
|
36913
|
-
* ```
|
|
36914
|
-
*
|
|
36915
|
-
* Notice, we don't use the `new` operator because we explicitly want to have the `Injector`
|
|
36916
|
-
* resolve all of the object's dependencies automatically.
|
|
36917
|
-
*
|
|
36918
|
-
* @deprecated from v5 - slow and brings in a lot of code, Use `Injector.create` instead.
|
|
36919
|
-
* @publicApi
|
|
36920
|
-
*/
|
|
36921
|
-
class ReflectiveInjector {
|
|
36922
|
-
/**
|
|
36923
|
-
* Turns an array of provider definitions into an array of resolved providers.
|
|
36924
|
-
*
|
|
36925
|
-
* A resolution is a process of flattening multiple nested arrays and converting individual
|
|
36926
|
-
* providers into an array of `ResolvedReflectiveProvider`s.
|
|
36927
|
-
*
|
|
36928
|
-
* @usageNotes
|
|
36929
|
-
* ### Example
|
|
36930
|
-
*
|
|
36931
|
-
* ```typescript
|
|
36932
|
-
* @Injectable()
|
|
36933
|
-
* class Engine {
|
|
36934
|
-
* }
|
|
36935
|
-
*
|
|
36936
|
-
* @Injectable()
|
|
36937
|
-
* class Car {
|
|
36938
|
-
* constructor(public engine:Engine) {}
|
|
36939
|
-
* }
|
|
36940
|
-
*
|
|
36941
|
-
* var providers = ReflectiveInjector.resolve([Car, [[Engine]]]);
|
|
36942
|
-
*
|
|
36943
|
-
* expect(providers.length).toEqual(2);
|
|
36944
|
-
*
|
|
36945
|
-
* expect(providers[0] instanceof ResolvedReflectiveProvider).toBe(true);
|
|
36946
|
-
* expect(providers[0].key.displayName).toBe("Car");
|
|
36947
|
-
* expect(providers[0].dependencies.length).toEqual(1);
|
|
36948
|
-
* expect(providers[0].factory).toBeDefined();
|
|
36949
|
-
*
|
|
36950
|
-
* expect(providers[1].key.displayName).toBe("Engine");
|
|
36951
|
-
* });
|
|
36952
|
-
* ```
|
|
36953
|
-
*
|
|
36954
|
-
*/
|
|
36955
|
-
static resolve(providers) {
|
|
36956
|
-
return resolveReflectiveProviders(providers);
|
|
36957
|
-
}
|
|
36958
|
-
/**
|
|
36959
|
-
* Resolves an array of providers and creates an injector from those providers.
|
|
36960
|
-
*
|
|
36961
|
-
* The passed-in providers can be an array of `Type`, `Provider`,
|
|
36962
|
-
* or a recursive array of more providers.
|
|
36963
|
-
*
|
|
36964
|
-
* @usageNotes
|
|
36965
|
-
* ### Example
|
|
36966
|
-
*
|
|
36967
|
-
* ```typescript
|
|
36968
|
-
* @Injectable()
|
|
36969
|
-
* class Engine {
|
|
36970
|
-
* }
|
|
36971
|
-
*
|
|
36972
|
-
* @Injectable()
|
|
36973
|
-
* class Car {
|
|
36974
|
-
* constructor(public engine:Engine) {}
|
|
36975
|
-
* }
|
|
36976
|
-
*
|
|
36977
|
-
* var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
|
|
36978
|
-
* expect(injector.get(Car) instanceof Car).toBe(true);
|
|
36979
|
-
* ```
|
|
36980
|
-
*/
|
|
36981
|
-
static resolveAndCreate(providers, parent) {
|
|
36982
|
-
const ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
|
|
36983
|
-
return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent);
|
|
36984
|
-
}
|
|
36985
|
-
/**
|
|
36986
|
-
* Creates an injector from previously resolved providers.
|
|
36987
|
-
*
|
|
36988
|
-
* This API is the recommended way to construct injectors in performance-sensitive parts.
|
|
36989
|
-
*
|
|
36990
|
-
* @usageNotes
|
|
36991
|
-
* ### Example
|
|
36992
|
-
*
|
|
36993
|
-
* ```typescript
|
|
36994
|
-
* @Injectable()
|
|
36995
|
-
* class Engine {
|
|
36996
|
-
* }
|
|
36997
|
-
*
|
|
36998
|
-
* @Injectable()
|
|
36999
|
-
* class Car {
|
|
37000
|
-
* constructor(public engine:Engine) {}
|
|
37001
|
-
* }
|
|
37002
|
-
*
|
|
37003
|
-
* var providers = ReflectiveInjector.resolve([Car, Engine]);
|
|
37004
|
-
* var injector = ReflectiveInjector.fromResolvedProviders(providers);
|
|
37005
|
-
* expect(injector.get(Car) instanceof Car).toBe(true);
|
|
37006
|
-
* ```
|
|
37007
|
-
*/
|
|
37008
|
-
static fromResolvedProviders(providers, parent) {
|
|
37009
|
-
return new ReflectiveInjector_(providers, parent);
|
|
37010
|
-
}
|
|
37011
|
-
}
|
|
37012
|
-
class ReflectiveInjector_ {
|
|
37013
|
-
/**
|
|
37014
|
-
* Private
|
|
37015
|
-
*/
|
|
37016
|
-
constructor(_providers, _parent) {
|
|
37017
|
-
/** @internal */
|
|
37018
|
-
this._constructionCounter = 0;
|
|
37019
|
-
this._providers = _providers;
|
|
37020
|
-
this.parent = _parent || null;
|
|
37021
|
-
const len = _providers.length;
|
|
37022
|
-
this.keyIds = [];
|
|
37023
|
-
this.objs = [];
|
|
37024
|
-
for (let i = 0; i < len; i++) {
|
|
37025
|
-
this.keyIds[i] = _providers[i].key.id;
|
|
37026
|
-
this.objs[i] = UNDEFINED;
|
|
37027
|
-
}
|
|
37028
|
-
}
|
|
37029
|
-
get(token, notFoundValue = THROW_IF_NOT_FOUND) {
|
|
37030
|
-
return this._getByKey(ReflectiveKey.get(token), null, notFoundValue);
|
|
37031
|
-
}
|
|
37032
|
-
resolveAndCreateChild(providers) {
|
|
37033
|
-
const ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
|
|
37034
|
-
return this.createChildFromResolved(ResolvedReflectiveProviders);
|
|
37035
|
-
}
|
|
37036
|
-
createChildFromResolved(providers) {
|
|
37037
|
-
const inj = new ReflectiveInjector_(providers);
|
|
37038
|
-
inj.parent = this;
|
|
37039
|
-
return inj;
|
|
37040
|
-
}
|
|
37041
|
-
resolveAndInstantiate(provider) {
|
|
37042
|
-
return this.instantiateResolved(ReflectiveInjector.resolve([provider])[0]);
|
|
37043
|
-
}
|
|
37044
|
-
instantiateResolved(provider) {
|
|
37045
|
-
return this._instantiateProvider(provider);
|
|
37046
|
-
}
|
|
37047
|
-
getProviderAtIndex(index) {
|
|
37048
|
-
if (index < 0 || index >= this._providers.length) {
|
|
37049
|
-
throw outOfBoundsError(index);
|
|
37050
|
-
}
|
|
37051
|
-
return this._providers[index];
|
|
37052
|
-
}
|
|
37053
|
-
/** @internal */
|
|
37054
|
-
_new(provider) {
|
|
37055
|
-
if (this._constructionCounter++ > this._getMaxNumberOfObjects()) {
|
|
37056
|
-
throw cyclicDependencyError(this, provider.key);
|
|
37057
|
-
}
|
|
37058
|
-
return this._instantiateProvider(provider);
|
|
37059
|
-
}
|
|
37060
|
-
_getMaxNumberOfObjects() {
|
|
37061
|
-
return this.objs.length;
|
|
37062
|
-
}
|
|
37063
|
-
_instantiateProvider(provider) {
|
|
37064
|
-
if (provider.multiProvider) {
|
|
37065
|
-
const res = [];
|
|
37066
|
-
for (let i = 0; i < provider.resolvedFactories.length; ++i) {
|
|
37067
|
-
res[i] = this._instantiate(provider, provider.resolvedFactories[i]);
|
|
37068
|
-
}
|
|
37069
|
-
return res;
|
|
37070
|
-
}
|
|
37071
|
-
else {
|
|
37072
|
-
return this._instantiate(provider, provider.resolvedFactories[0]);
|
|
37073
|
-
}
|
|
37074
|
-
}
|
|
37075
|
-
_instantiate(provider, ResolvedReflectiveFactory) {
|
|
37076
|
-
const factory = ResolvedReflectiveFactory.factory;
|
|
37077
|
-
let deps;
|
|
37078
|
-
try {
|
|
37079
|
-
deps =
|
|
37080
|
-
ResolvedReflectiveFactory.dependencies.map(dep => this._getByReflectiveDependency(dep));
|
|
37081
|
-
}
|
|
37082
|
-
catch (e) {
|
|
37083
|
-
if (e.addKey) {
|
|
37084
|
-
e.addKey(this, provider.key);
|
|
37085
|
-
}
|
|
37086
|
-
throw e;
|
|
37087
|
-
}
|
|
37088
|
-
let obj;
|
|
37089
|
-
try {
|
|
37090
|
-
obj = factory(...deps);
|
|
37091
|
-
}
|
|
37092
|
-
catch (e) {
|
|
37093
|
-
throw instantiationError(this, e, e.stack, provider.key);
|
|
37094
|
-
}
|
|
37095
|
-
return obj;
|
|
37096
|
-
}
|
|
37097
|
-
_getByReflectiveDependency(dep) {
|
|
37098
|
-
return this._getByKey(dep.key, dep.visibility, dep.optional ? null : THROW_IF_NOT_FOUND);
|
|
37099
|
-
}
|
|
37100
|
-
_getByKey(key, visibility, notFoundValue) {
|
|
37101
|
-
if (key === ReflectiveInjector_.INJECTOR_KEY) {
|
|
37102
|
-
return this;
|
|
37103
|
-
}
|
|
37104
|
-
if (visibility instanceof Self) {
|
|
37105
|
-
return this._getByKeySelf(key, notFoundValue);
|
|
37106
|
-
}
|
|
37107
|
-
else {
|
|
37108
|
-
return this._getByKeyDefault(key, notFoundValue, visibility);
|
|
37109
|
-
}
|
|
37110
|
-
}
|
|
37111
|
-
_getObjByKeyId(keyId) {
|
|
37112
|
-
for (let i = 0; i < this.keyIds.length; i++) {
|
|
37113
|
-
if (this.keyIds[i] === keyId) {
|
|
37114
|
-
if (this.objs[i] === UNDEFINED) {
|
|
37115
|
-
this.objs[i] = this._new(this._providers[i]);
|
|
37116
|
-
}
|
|
37117
|
-
return this.objs[i];
|
|
37118
|
-
}
|
|
37119
|
-
}
|
|
37120
|
-
return UNDEFINED;
|
|
37121
|
-
}
|
|
37122
|
-
/** @internal */
|
|
37123
|
-
_throwOrNull(key, notFoundValue) {
|
|
37124
|
-
if (notFoundValue !== THROW_IF_NOT_FOUND) {
|
|
37125
|
-
return notFoundValue;
|
|
37126
|
-
}
|
|
37127
|
-
else {
|
|
37128
|
-
throw noProviderError(this, key);
|
|
37129
|
-
}
|
|
37130
|
-
}
|
|
37131
|
-
/** @internal */
|
|
37132
|
-
_getByKeySelf(key, notFoundValue) {
|
|
37133
|
-
const obj = this._getObjByKeyId(key.id);
|
|
37134
|
-
return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
|
|
37135
|
-
}
|
|
37136
|
-
/** @internal */
|
|
37137
|
-
_getByKeyDefault(key, notFoundValue, visibility) {
|
|
37138
|
-
let inj;
|
|
37139
|
-
if (visibility instanceof SkipSelf) {
|
|
37140
|
-
inj = this.parent;
|
|
37141
|
-
}
|
|
37142
|
-
else {
|
|
37143
|
-
inj = this;
|
|
37144
|
-
}
|
|
37145
|
-
while (inj instanceof ReflectiveInjector_) {
|
|
37146
|
-
const inj_ = inj;
|
|
37147
|
-
const obj = inj_._getObjByKeyId(key.id);
|
|
37148
|
-
if (obj !== UNDEFINED)
|
|
37149
|
-
return obj;
|
|
37150
|
-
inj = inj_.parent;
|
|
37151
|
-
}
|
|
37152
|
-
if (inj !== null) {
|
|
37153
|
-
return inj.get(key.token, notFoundValue);
|
|
37154
|
-
}
|
|
37155
|
-
else {
|
|
37156
|
-
return this._throwOrNull(key, notFoundValue);
|
|
37157
|
-
}
|
|
37158
|
-
}
|
|
37159
|
-
get displayName() {
|
|
37160
|
-
const providers = _mapProviders(this, (b) => ' "' + b.key.displayName + '" ')
|
|
37161
|
-
.join(', ');
|
|
37162
|
-
return `ReflectiveInjector(providers: [${providers}])`;
|
|
37163
|
-
}
|
|
37164
|
-
toString() {
|
|
37165
|
-
return this.displayName;
|
|
37166
|
-
}
|
|
37167
|
-
}
|
|
37168
|
-
ReflectiveInjector_.INJECTOR_KEY = ReflectiveKey.get(Injector);
|
|
37169
|
-
function _mapProviders(injector, fn) {
|
|
37170
|
-
const res = [];
|
|
37171
|
-
for (let i = 0; i < injector._providers.length; ++i) {
|
|
37172
|
-
res[i] = fn(injector.getProviderAtIndex(i));
|
|
37173
|
-
}
|
|
37174
|
-
return res;
|
|
37175
|
-
}
|
|
37176
|
-
|
|
37177
36313
|
/**
|
|
37178
36314
|
* @license
|
|
37179
36315
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -37397,7 +36533,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
37397
36533
|
*/
|
|
37398
36534
|
class ComponentFactoryResolver {
|
|
37399
36535
|
}
|
|
37400
|
-
ComponentFactoryResolver.NULL = new _NullComponentFactoryResolver();
|
|
36536
|
+
ComponentFactoryResolver.NULL = ( /* @__PURE__ */new _NullComponentFactoryResolver());
|
|
37401
36537
|
class ComponentFactoryBoundToModule extends ComponentFactory {
|
|
37402
36538
|
constructor(factory, ngModule) {
|
|
37403
36539
|
super();
|
|
@@ -37554,7 +36690,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
37554
36690
|
/**
|
|
37555
36691
|
* @publicApi
|
|
37556
36692
|
*/
|
|
37557
|
-
const VERSION$2 = new Version$1('13.0.0-next.
|
|
36693
|
+
const VERSION$2 = new Version$1('13.0.0-next.6');
|
|
37558
36694
|
|
|
37559
36695
|
/**
|
|
37560
36696
|
* @license
|