https://github.com/angular/angular
Revision 98d262fd27795014ee3988b08d3c48a0dfb63c40 authored by AleksanderBodurri on 22 May 2023, 18:51:36 UTC, committed by Alex Rickabaugh on 01 August 2023, 18:44:40 UTC
This commit introduces 3 new APIs.

getDependenciesFromInstantiation:
- Given an injector and a token that was instantiated by that injector, discover all of the things were injected in the instance of that token
- This API is meant to enable recursive inspection of dependencies. Dependencies returned by this API include which injector they were providedIn, which enables the continous use of getDependenciesFromInstantiation to determine the dependencies of dependencies

getInjectorProviders:
- Given an injector, discover all of the providers that were configured in that injector.
- This API returns information on the configured providers of an injector, including the import path that leads to the container that the provider originated from (NgModule or standalone directive). This enables fine grained inspection to determine where a specific provider comes from.

getInjectorParent:
- Given an injector, discover the parent of that injector.
- This function is meant to be used recursively to discover the entire resolution path from a starting injector to the NullInjector.

These APIs were designed to be used together. For example, getInjectorParent can be used to discover the structure of an injector hierarchy. Once that's done, getInjectorProviders can be used to determine the providers of each injector in that hierarchy.

Another example: getDependenciesFromInstantiation can be used to discover the dependencies of a specific injector constructed instance. From there, we can use getInjectorParent to discover the injector resolution path and map each dependency to a path from the starting injector to the injector that it was provided in.

PR Close #48639
1 parent 4d92080
History
Tip revision: 98d262fd27795014ee3988b08d3c48a0dfb63c40 authored by AleksanderBodurri on 22 May 2023, 18:51:36 UTC
feat(core): create injector debugging APIs (#48639)
Tip revision: 98d262f
File Mode Size
.circleci
.devcontainer
.github
.husky
.ng-dev
.vscode
.yarn
aio
devtools
docs
goldens
integration
modules
packages
scripts
third_party
tools
.bazelignore -rw-r--r-- 1.5 KB
.bazelrc -rw-r--r-- 7.7 KB
.bazelversion -rw-r--r-- 6 bytes
.clang-format -rw-r--r-- 73 bytes
.editorconfig -rw-r--r-- 245 bytes
.gitattributes -rw-r--r-- 146 bytes
.gitignore -rw-r--r-- 948 bytes
.gitmessage -rw-r--r-- 7.2 KB
.mailmap -rw-r--r-- 51 bytes
.npmrc -rw-r--r-- 21 bytes
.nvmrc -rw-r--r-- 8 bytes
.prettierrc -rw-r--r-- 157 bytes
.pullapprove.yml -rw-r--r-- 51.3 KB
.yarnrc -rw-r--r-- 130 bytes
BUILD.bazel -rw-r--r-- 2.5 KB
CHANGELOG.md -rw-r--r-- 183.4 KB
CHANGELOG_ARCHIVE.md -rw-r--r-- 997.0 KB
CODE_OF_CONDUCT.md -rw-r--r-- 3.6 KB
CONTRIBUTING.md -rw-r--r-- 15.7 KB
LICENSE -rw-r--r-- 1.1 KB
README.md -rw-r--r-- 5.0 KB
SECURITY.md -rw-r--r-- 403 bytes
WORKSPACE -rw-r--r-- 8.8 KB
browser-providers.conf.d.ts -rw-r--r-- 387 bytes
browser-providers.conf.js -rw-r--r-- 1.9 KB
gulpfile.js -rw-r--r-- 572 bytes
karma-js.conf.js -rw-r--r-- 6.0 KB
package.json -rw-r--r-- 9.1 KB
packages.bzl -rw-r--r-- 3.1 KB
renovate.json -rw-r--r-- 3.0 KB
tsconfig-tslint.json -rw-r--r-- 171 bytes
tslint.json -rw-r--r-- 5.1 KB
yarn.bzl -rw-r--r-- 77 bytes
yarn.lock -rw-r--r-- 773.9 KB
yarn.lock.readme.md -rw-r--r-- 1.3 KB

README.md

back to top