_id
stringlengths 21
254
| text
stringlengths 1
93.7k
| metadata
dict |
---|---|---|
angular/devtools/projects/protocol/index.ts_0_238 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
export * from './src/public-api';
| {
"end_byte": 238,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/protocol/index.ts"
} |
angular/devtools/projects/protocol/src/public-api.ts_0_363 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
/*
* Public API Surface of protocol
*/
export * from './lib/messages';
export * from './lib/message-bus';
export * from './lib/priority-aware-message-bus';
| {
"end_byte": 363,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/protocol/src/public-api.ts"
} |
angular/devtools/projects/protocol/src/lib/priority-aware-message-bus.ts_0_2819 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {MessageBus} from './message-bus';
import {Events, Topic} from './messages';
type ThrottleTopicDuration = {
[method in Topic]?: number;
};
type ThrottledTopics = {
[method in Topic]?: boolean;
};
type TopicsInProgress = {
[method in Topic]?: boolean;
};
const THROTTLE_METHODS: ThrottleTopicDuration = {
getLatestComponentExplorerView: 100,
};
type TopicBlockSequence = {
[method in Topic]?: Topic[];
};
// We can't refresh the view until we've received
// a response with the latest nested properties.
const TOPIC_BLOCK_SEQUENCE: TopicBlockSequence = {
getLatestComponentExplorerView: ['getNestedProperties'],
};
type TopicSequence = {
[method in Topic]?: Topic;
};
const TOPIC_RESPONSE: TopicSequence = {
getNestedProperties: 'nestedProperties',
};
const TOPIC_REQUEST: TopicSequence = {
nestedProperties: 'getNestedProperties',
};
export class PriorityAwareMessageBus extends MessageBus<Events> {
private _throttled: ThrottledTopics = {};
private _inProgress: TopicsInProgress = {};
constructor(
private _bus: MessageBus<Events>,
private _setTimeout: typeof setTimeout = setTimeout,
) {
super();
}
override on<E extends Topic>(topic: E, cb: Events[E]): void {
return this._bus.on(topic, (...args: any) => {
(cb as any)(...args);
this._afterMessage(topic);
});
}
override once<E extends Topic>(topic: E, cb: Events[E]): void {
return this._bus.once(topic, (...args: any) => {
(cb as any)(...args);
this._afterMessage(topic);
});
}
override emit<E extends Topic>(topic: E, args?: Parameters<Events[E]>): boolean {
if (this._throttled[topic]) {
return false;
}
if (TOPIC_RESPONSE[topic]) {
this._inProgress[topic] = true;
}
const blockedBy = TOPIC_BLOCK_SEQUENCE[topic];
if (blockedBy) {
// The source code here is safe.
// TypeScript type inference ignores the null check here.
// tslint:disable-next-line: no-non-null-assertion
for (const blocker of blockedBy!) {
if (this._inProgress[blocker]) {
return false;
}
}
}
if (THROTTLE_METHODS[topic]) {
this._throttled[topic] = true;
this._setTimeout(() => (this._throttled[topic] = false), THROTTLE_METHODS[topic]);
}
return this._bus.emit(topic, args);
}
override destroy(): void {
this._bus.destroy();
}
private _afterMessage(topic: Topic): void {
const request = TOPIC_REQUEST[topic];
if (!request) {
return;
}
if (this._inProgress[request]) {
this._inProgress[request] = false;
}
}
}
| {
"end_byte": 2819,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/protocol/src/lib/priority-aware-message-bus.ts"
} |
angular/devtools/projects/protocol/src/lib/messages.ts_0_7144 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {InjectionToken, InjectOptions, Injector, Type, ViewEncapsulation} from '@angular/core';
export interface DirectiveType {
name: string;
id: number;
}
export interface ComponentType {
name: string;
isElement: boolean;
id: number;
}
export type HydrationStatus =
| null
| {status: 'hydrated' | 'skipped'}
| {
status: 'mismatched';
expectedNodeDetails: string | null;
actualNodeDetails: string | null;
};
export interface DevToolsNode<DirType = DirectiveType, CmpType = ComponentType> {
element: string;
directives: DirType[];
component: CmpType | null;
children: DevToolsNode<DirType, CmpType>[];
nativeElement?: Node;
resolutionPath?: SerializedInjector[];
hydration: HydrationStatus;
}
export interface SerializedInjector {
id: string;
name: string;
type: string;
node?: DevToolsNode;
providers?: number;
}
export interface SerializedProviderRecord {
token: string;
type: 'type' | 'existing' | 'class' | 'value' | 'factory' | 'multi';
multi: boolean;
isViewProvider: boolean;
index?: number | number[];
}
/**
* Duplicate of the InjectedService interface from Angular framework to prevent
* needing to publicly expose the interface from the framework.
*/
export interface InjectedService {
token?: Type<unknown> | InjectionToken<unknown>;
value: unknown;
flags?: InjectOptions;
providedIn: Injector;
}
export type ContainerType = 'WritableSignal' | 'ReadonlySignal' | null;
export enum PropType {
Number,
String,
Null,
Undefined,
Symbol,
HTMLNode,
Boolean,
BigInt,
Function,
Object,
Date,
Array,
Set,
Map,
Unknown,
}
export interface Descriptor {
expandable: boolean;
value?: any;
editable: boolean;
type: PropType;
preview: string;
containerType: ContainerType;
}
export interface DirectivesProperties {
[name: string]: Properties;
}
export interface DirectiveMetadata {
inputs: {[name: string]: string};
outputs: {[name: string]: string};
encapsulation: ViewEncapsulation;
onPush: boolean;
dependencies?: SerializedInjectedService[];
}
export interface SerializedInjectedService {
token: string;
value: string;
position: number[];
flags?: InjectOptions;
resolutionPath?: SerializedInjector[];
}
export interface Properties {
props: {[name: string]: Descriptor};
metadata?: DirectiveMetadata;
}
export type ElementPosition = number[];
export interface DirectivePosition {
element: ElementPosition;
directive?: number;
}
export interface NestedProp {
name: string | number;
children: NestedProp[];
}
export interface ComponentExplorerViewProperties {
[directive: string]: NestedProp[];
}
export enum PropertyQueryTypes {
All,
Specified,
}
export interface AllPropertiesQuery {
type: PropertyQueryTypes.All;
}
export interface SelectedPropertiesQuery {
type: PropertyQueryTypes.Specified;
properties: ComponentExplorerViewProperties;
}
export type PropertyQuery = AllPropertiesQuery | SelectedPropertiesQuery;
export interface ComponentExplorerViewQuery {
selectedElement: ElementPosition;
propertyQuery: PropertyQuery;
}
export interface ComponentExplorerView {
forest: DevToolsNode[];
properties?: DirectivesProperties;
}
export interface LifecycleProfile {
ngOnInit?: number;
ngOnDestroy?: number;
ngOnChanges?: number;
ngDoCheck?: number;
ngAfterContentInit?: number;
ngAfterContentChecked?: number;
ngAfterViewInit?: number;
ngAfterViewChecked?: number;
}
export interface OutputProfile {
[outputName: string]: number;
}
export interface DirectiveProfile {
name: string;
isElement: boolean;
isComponent: boolean;
lifecycle: LifecycleProfile;
outputs: OutputProfile;
changeDetection?: number;
}
export interface ElementProfile {
directives: DirectiveProfile[];
children: ElementProfile[];
}
export interface ProfilerFrame {
source: string;
duration: number;
directives: ElementProfile[];
}
export interface UpdatedStateData {
directiveId: DirectivePosition;
keyPath: string[];
newValue: any;
}
export interface Route {
name: string;
hash: string | null;
path: string;
specificity: string | null;
handler: string;
data: any;
children?: Array<Route>;
isAux: boolean;
}
export interface AngularDetection {
// This is necessary because the runtime
// message listener handles messages globally
// including from other extensions. We don't
// want to set icon and/or popup based on
// a message coming from an unrelated extension.
isAngularDevTools: true;
isIvy: boolean;
isAngular: boolean;
isDebugMode: boolean;
isSupportedAngularVersion: boolean;
}
export type Topic = keyof Events;
export interface InjectorGraphViewQuery {
directivePosition: DirectivePosition;
paramIndex: number;
}
export interface Events {
handshake: () => void;
shutdown: () => void;
queryNgAvailability: () => void;
ngAvailability: (config: {
version: string | undefined;
devMode: boolean;
ivy: boolean;
hydration: boolean;
}) => void;
inspectorStart: () => void;
inspectorEnd: () => void;
getNestedProperties: (position: DirectivePosition, path: string[]) => void;
nestedProperties: (position: DirectivePosition, data: Properties, path: string[]) => void;
setSelectedComponent: (position: ElementPosition) => void;
getRoutes: () => void;
updateRouterTree: (routes: Route[]) => void;
componentTreeDirty: () => void;
getLatestComponentExplorerView: (query?: ComponentExplorerViewQuery) => void;
latestComponentExplorerView: (view: ComponentExplorerView) => void;
updateState: (value: UpdatedStateData) => void;
startProfiling: () => void;
stopProfiling: () => void;
sendProfilerChunk: (results: ProfilerFrame) => void;
profilerResults: (results: ProfilerFrame) => void;
createHighlightOverlay: (position: ElementPosition) => void;
removeHighlightOverlay: () => void;
createHydrationOverlay: () => void;
removeHydrationOverlay: () => void;
highlightComponent: (id: number) => void;
selectComponent: (id: number) => void;
removeComponentHighlight: () => void;
enableTimingAPI: () => void;
disableTimingAPI: () => void;
// todo: type properly
getInjectorProviders: (injector: SerializedInjector) => void;
latestInjectorProviders: (
injector: SerializedInjector,
providers: SerializedProviderRecord[],
) => void;
logProvider: (injector: SerializedInjector, providers: SerializedProviderRecord) => void;
contentScriptConnected: (frameId: number, name: string, url: string) => void;
contentScriptDisconnected: (frameId: number, name: string, url: string) => void;
enableFrameConnection: (frameId: number, tabId: number) => void;
frameConnected: (frameId: number) => void;
detectAngular: (detectionResult: AngularDetection) => void;
backendReady: () => void;
log: (logEvent: {message: string; level: 'log' | 'warn' | 'debug' | 'error'}) => void;
}
| {
"end_byte": 7144,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/protocol/src/lib/messages.ts"
} |
angular/devtools/projects/protocol/src/lib/message-bus.ts_0_552 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
export type Parameters<F> = F extends (...args: infer T) => any ? T : never;
export abstract class MessageBus<T> {
abstract on<E extends keyof T>(topic: E, cb: T[E]): void;
abstract once<E extends keyof T>(topic: E, cb: T[E]): void;
abstract emit<E extends keyof T>(topic: E, args?: Parameters<T[E]>): boolean;
abstract destroy(): void;
}
| {
"end_byte": 552,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/protocol/src/lib/message-bus.ts"
} |
angular/devtools/projects/protocol/src/lib/priority-aware-message-bus.spec.ts_0_2122 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {MessageBus} from './message-bus';
import {Events, Topic} from './messages';
import {PriorityAwareMessageBus} from './priority-aware-message-bus';
class MockMessageBus extends MessageBus<Events> {
cbs: any = {};
override emit(_: Topic, __: any): boolean {
return true;
}
override on(topic: Topic, cb: any): void {
this.cbs[topic] = cb;
}
override once(topic: Topic, cb: any): void {
this.cbs[topic] = cb;
}
override destroy(): void {}
}
describe('PriorityAwareMessageBus', () => {
it('should emit not throttled requests', () => {
const timeout: any = (_: any, __: number) => {};
const bus = new PriorityAwareMessageBus(new MockMessageBus(), timeout);
expect(bus.emit('handshake')).toBeTrue();
expect(bus.emit('inspectorStart')).toBeTrue();
});
it('should throttle `getLatestComponentExplorerView`', () => {
let callback: any;
const timeout: any = (cb: any, _: number) => {
callback = cb;
};
const bus = new PriorityAwareMessageBus(new MockMessageBus(), timeout);
expect(bus.emit('getLatestComponentExplorerView')).toBeTrue();
expect(bus.emit('getLatestComponentExplorerView')).toBeFalse();
expect(bus.emit('getLatestComponentExplorerView')).toBeFalse();
callback();
expect(bus.emit('getLatestComponentExplorerView')).toBeTrue();
});
it('should not emit `getLatestComponentExplorerView` if blocked by `getNestedProperties`', () => {
let callback: any;
const timeout: any = (cb: any, _: number) => {
callback = cb;
};
const mock = new MockMessageBus();
const bus = new PriorityAwareMessageBus(mock, timeout);
bus.on('nestedProperties', () => {});
expect(bus.emit('getNestedProperties')).toBeTrue();
expect(bus.emit('getLatestComponentExplorerView')).toBeFalse();
mock.cbs.nestedProperties();
expect(bus.emit('getLatestComponentExplorerView')).toBeTruthy();
});
});
| {
"end_byte": 2122,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/protocol/src/lib/priority-aware-message-bus.spec.ts"
} |
angular/devtools/projects/shared-utils/README.md_0_105 | # Shared Utilities
This directory contains shared utilities between different Angular DevTools modules.
| {
"end_byte": 105,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shared-utils/README.md"
} |
angular/devtools/projects/shared-utils/BUILD.bazel_0_978 | load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("//devtools/tools:typescript.bzl", "ts_library", "ts_test_library")
load("//devtools/tools:defaults.bzl", "karma_web_test_suite")
package(default_visibility = ["//visibility:public"])
ts_library(
name = "shared_utils_ts",
srcs = glob(
["**/*.ts"],
exclude = [
"**/*.spec.ts",
"src/test.ts",
],
),
deps = [
"//packages/core",
"//packages/platform-browser-dynamic",
"@npm//@types",
],
)
js_library(
name = "shared-utils",
package_name = "shared-utils",
deps = [":shared_utils_ts"],
)
ts_test_library(
name = "shared_utils_test",
srcs = glob(["**/*.spec.ts"]),
deps = [
":shared-utils",
"//packages/core",
"//packages/platform-browser-dynamic",
"@npm//@types",
],
)
karma_web_test_suite(
name = "test",
deps = [
":shared_utils_test",
],
)
| {
"end_byte": 978,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shared-utils/BUILD.bazel"
} |
angular/devtools/projects/shared-utils/index.ts_0_238 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
export * from './src/public-api';
| {
"end_byte": 238,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shared-utils/index.ts"
} |
angular/devtools/projects/shared-utils/src/public-api.ts_0_323 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
/*
* Public API Surface of shared-utils
*/
export * from './lib/shared-utils';
export * from './lib/angular-check';
| {
"end_byte": 323,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shared-utils/src/public-api.ts"
} |
angular/devtools/projects/shared-utils/src/lib/angular-check.spec.ts_0_3134 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {
appIsAngular,
appIsAngularInDevMode,
appIsAngularIvy,
appIsSupportedAngularVersion,
getAngularVersion,
} from './angular-check';
const setNgVersion = (version = '12.0.0'): void =>
document.documentElement.setAttribute('ng-version', version);
const removeNgVersion = (): void => document.documentElement.removeAttribute('ng-version');
describe('angular-check', () => {
afterEach(() => removeNgVersion());
describe('getAngularVersion', () => {
it('should return the angular version', () => {
setNgVersion('11.1.1');
expect(getAngularVersion()).toBe('11.1.1');
});
});
describe('appIsSupportedAngularVersion', () => {
it('should work with g3', () => {
setNgVersion('0.0.0-placeholder');
expect(appIsSupportedAngularVersion()).toBeTrue();
});
it('should work with new versions', () => {
setNgVersion('12.0.0');
expect(appIsSupportedAngularVersion()).toBeTrue();
});
it('should return false for older version', () => {
setNgVersion('9.0.0');
expect(appIsSupportedAngularVersion()).toBeFalse();
});
it('should return false for no version', () => {
expect(appIsSupportedAngularVersion()).toBeFalse();
});
});
describe('appIsAngular', () => {
it('should return true for older version', () => {
setNgVersion('8.0.0');
expect(appIsAngular()).toBeTrue();
});
it('should return false for no version', () => {
expect(appIsAngular()).toBeFalse();
});
});
describe('appIsAngularIvy', () => {
it('should not recognize VE apps', () => {
(window as any).ng = {
probe(): void {},
};
setNgVersion();
expect(appIsAngularIvy()).toBeFalse();
});
it('should not recognize no Angular apps', () => {
expect(appIsAngularIvy()).toBeFalse();
});
it('should recognize Ivy apps', () => {
const el = document.createElement('div');
el.setAttribute('ng-version', '0.0.0-PLACEHOLDER');
(el as any).__ngContext__ = 0;
document.body.append(el);
expect(appIsAngularIvy()).toBeTrue();
el.remove();
});
});
describe('appIsAngularInDevMode', () => {
afterEach(() => {
delete (window as any).ng;
});
it('should detect VE apps', () => {
(window as any).ng = {
probe(): void {},
};
setNgVersion();
expect(appIsAngularInDevMode()).toBeTrue();
});
it('should detect Ivy apps', () => {
(window as any).ng = {
getComponent(): void {},
};
setNgVersion();
expect(appIsAngularInDevMode()).toBeTrue();
});
it('should not detect apps if `ng` is not an object with the right shape', () => {
setNgVersion();
(window as any).ng = {};
expect(appIsAngularInDevMode()).toBeFalse();
(window as any).ng = () => {};
expect(appIsAngularInDevMode()).toBeFalse();
});
});
});
| {
"end_byte": 3134,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shared-utils/src/lib/angular-check.spec.ts"
} |
angular/devtools/projects/shared-utils/src/lib/shared-utils.spec.ts_0_1960 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {arrayEquals} from 'shared-utils';
describe('arrayEquals', () => {
let a: any;
let b: any;
describe('true cases', () => {
afterEach(() => {
expect(arrayEquals(a, b)).toBe(true);
});
it('should return true for empty arrays', () => {
a = [];
b = [];
});
describe('same type array', () => {
it('should return true for arrays with equal value numbers', () => {
a = [0, 1, 2, 3];
b = [0, 1, 2, 3];
});
it('should return true for arrays with equal value strings', () => {
a = ['hello', 'world'];
b = ['hello', 'world'];
});
it('should return true for arrays with equal value booleans', () => {
a = [true, false, false, true];
b = [true, false, false, true];
});
});
});
describe('false cases', () => {
afterEach(() => {
expect(arrayEquals(a, b)).toBe(false);
});
describe('same type array', () => {
it('should return false for arrays of different numbers', () => {
a = [0, 1, 2, 3];
b = [4, 1, 1, 12];
});
it('should return false for arrays of different strings', () => {
a = ['hello', 'world'];
b = ['hello', 'planet'];
});
it('should return false for arrays of different booleans', () => {
a = [true, true, true, false, true, true, false, false];
b = [true, true, false, true, false, true, true, false];
});
});
it('should return false for arrays with different values', () => {
a = [1, 'false', 2, '7'];
b = [true, false, '2', 7];
});
it('should return false for arrays with different lengths', () => {
a = [0, 1, 2, 3];
b = [0, 1, 2, 3, 100];
});
});
});
| {
"end_byte": 1960,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shared-utils/src/lib/shared-utils.spec.ts"
} |
angular/devtools/projects/shared-utils/src/lib/shared-utils.ts_0_666 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
// works with arrays of string, numbers and booleans
export const arrayEquals = (
a: (string | number | boolean)[],
b: (string | number | boolean)[],
): boolean => {
if (a.length !== b.length) {
return false;
}
if (a.length === 0) {
return b.length === 0;
}
let equal;
for (let i = 0; i < a.length; i++) {
equal = i === 0 ? a[i] === b[i] : a[i] === b[i] && equal;
if (!equal) {
break;
}
}
return equal ?? false;
};
| {
"end_byte": 666,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shared-utils/src/lib/shared-utils.ts"
} |
angular/devtools/projects/shared-utils/src/lib/angular-check.ts_0_1984 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {ɵHydratedNode as HydrationNode} from '@angular/core';
declare const ng: any;
export const appIsAngularInDevMode = (): boolean => {
return appIsAngular() && appHasGlobalNgDebugObject();
};
export const appIsAngularIvy = (): boolean => {
const rootElement = (window as any).document.querySelector('[ng-version]');
return typeof rootElement?.__ngContext__ !== 'undefined';
};
export const appIsAngular = (): boolean => {
return !!getAngularVersion();
};
export const appIsSupportedAngularVersion = (): boolean => {
const version = getAngularVersion();
if (!version) {
return false;
}
const major = parseInt(version.toString().split('.')[0], 10);
return appIsAngular() && (major >= 12 || major === 0);
};
/**
* We check if the global `window.ng` is an object and if this object
* has the `getComponent` or `probe` methods attached to it.
*
* `ng.probe` is a view engine method, but to ensure that we correctly
* detect development mode we need to consider older rendering engines.
*
* In some g3 apps processed with Closure, `ng` is a function,
* which means that `typeof ng !== 'undefined'` is not a sufficient check.
*
* @returns if the app has global ng debug object
*/
const appHasGlobalNgDebugObject = (): boolean => {
return (
typeof ng === 'object' &&
(typeof ng.getComponent === 'function' || typeof ng.probe === 'function')
);
};
export const getAngularVersion = (): string | null => {
const el = document.querySelector('[ng-version]');
if (!el) {
return null;
}
return el.getAttribute('ng-version');
};
export function isHydrationEnabled(): boolean {
return Array.from(document.querySelectorAll('[ng-version]')).some(
(rootNode) => (rootNode as HydrationNode)?.__ngDebugHydrationInfo__,
);
}
| {
"end_byte": 1984,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shared-utils/src/lib/angular-check.ts"
} |
angular/devtools/projects/shell-browser/set-version.js_0_1715 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
const chalk = require('chalk');
const {createInterface} = require('readline');
const semver = require('semver');
const {writeFileSync, readFileSync} = require('fs');
const {join} = require('path');
const MANIFEST_PATH = join(__dirname, 'src/manifest/manifest.chrome.json');
const manifest = JSON.parse(readFileSync(MANIFEST_PATH).toString());
// tslint:disable-next-line:no-console
console.log('Current version', chalk.yellow(manifest.version));
// tslint:disable-next-line:no-console
console.log('Current version name', chalk.yellow(manifest.version_name));
const setVersion = (nextVersion) => {
manifest.version = nextVersion;
manifest.version_name = nextVersion;
writeFileSync(MANIFEST_PATH, JSON.stringify(manifest, null, 2));
};
const answerMap = {
yes: true,
y: true,
no: false,
n: false,
};
const rl = createInterface({
input: process.stdin,
output: process.stdout,
});
rl.question(chalk.yellowBright('Set the current version: '), (nextVersion) => {
if (!semver.valid(nextVersion)) {
console.error(chalk.red('Invalid version'));
}
if (semver.gt(nextVersion, manifest.version)) {
rl.close();
setVersion(nextVersion);
return;
}
console.error(chalk.yellow('Next version cannot be smaller or equal to the previous one'));
rl.question('Are you sure you want to continue? (y/n) ', (answer) => {
rl.close();
answer = answer.toLowerCase();
if (!answerMap[answer]) {
throw new Error('Exiting');
}
setVersion(nextVersion);
});
});
| {
"end_byte": 1715,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/set-version.js"
} |
angular/devtools/projects/shell-browser/BUILD.bazel_0_54 | package(default_visibility = ["//visibility:public"])
| {
"end_byte": 54,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/BUILD.bazel"
} |
angular/devtools/projects/shell-browser/src/index.html_0_621 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>ShellChrome</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="assets/icon16.png" />
<link rel="stylesheet" href="./third_party/github.com/google/material-design-icons/material-icons.css">
<link rel="stylesheet" href="./styles.css"></head>
</head>
<body>
<app-root></app-root>
<script src="./packages/zone.js/bundles/zone.umd.js"></script>
<script type="module" src="./bundle/main.js"></script>
</body>
</html>
| {
"end_byte": 621,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/index.html"
} |
angular/devtools/projects/shell-browser/src/main.ts_0_482 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {enableProdMode} from '@angular/core';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {AppModule} from './app/app.module';
enableProdMode();
platformBrowserDynamic()
.bootstrapModule(AppModule)
.catch((err) => console.error(err));
| {
"end_byte": 482,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/main.ts"
} |
angular/devtools/projects/shell-browser/src/devtools.html_0_320 | <!DOCTYPE html>
<html lang="en">
<head>
<title>DevTools</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
</head>
<body>
<script src="devtools_bundle.js"></script>
</body>
</html>
| {
"end_byte": 320,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/devtools.html"
} |
angular/devtools/projects/shell-browser/src/devtools.ts_0_316 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
/// <reference types="chrome"/>
chrome.devtools.panels.create('Angular', 'assets/icon-bw16.png', 'index.html');
| {
"end_byte": 316,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/devtools.ts"
} |
angular/devtools/projects/shell-browser/src/styles.scss_0_72 | @use '../../../styles.scss' as devtools;
body,
html {
height: 100%;
} | {
"end_byte": 72,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/styles.scss"
} |
angular/devtools/projects/shell-browser/src/BUILD.bazel_0_4637 | load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_web")
load("//devtools/tools:ng_module.bzl", "ng_module")
load("//devtools/tools:typescript.bzl", "ts_library")
load("//tools:defaults.bzl", "esbuild")
load("//devtools/tools/esbuild:index.bzl", "LINKER_PROCESSED_FW_PACKAGES")
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
package(default_visibility = ["//visibility:public"])
sass_binary(
name = "shell_common_styles",
src = "styles.scss",
include_paths = ["external/npm/node_modules"],
sourcemap = False,
deps = ["//devtools:global_styles"],
)
sass_binary(
name = "shell_firefox_styles",
src = "styles/firefox_styles.scss",
)
sass_binary(
name = "shell_chrome_styles",
src = "styles/chrome_styles.scss",
)
ts_library(
name = "devtools_ts",
srcs = [
"devtools.ts",
],
deps = [
"@npm//@types/chrome",
],
)
js_library(
name = "devtools",
deps = [":devtools_ts"],
)
ng_module(
name = "src",
srcs = [
"main.ts",
],
deps = [
"//devtools/projects/ng-devtools",
"//devtools/projects/shell-browser/src/app",
"//devtools/projects/shell-browser/src/environments:environment",
"//packages/common",
"//packages/common/http",
"//packages/core",
"//packages/platform-browser-dynamic",
],
)
esbuild(
name = "bundle",
config = "//devtools/tools/esbuild:esbuild_config_esm_prod",
entry_points = [":main.ts"],
minify = True,
platform = "browser",
splitting = False,
# todo(aleksanderbodurri): here we target es2020 explicitly.
# We do this because of a bug caused by https://github.com/evanw/esbuild/issues/2950 and an Angular v16 change
# to how angular static properties are attached to class constructors.
# Targeting esnext or es2022 will cause the static initializer blocks that attach these static properties on class
# constructors to reference a class constructor variable that they do not have access to.
target = "es2020",
deps = LINKER_PROCESSED_FW_PACKAGES + [":src"],
)
esbuild(
name = "devtools_bundle",
config = "//devtools/tools/esbuild:esbuild_config_esm",
entry_point = "devtools.ts",
format = "iife",
minify = True,
platform = "browser",
splitting = False,
# todo(aleksanderbodurri): here we target es2020 explicitly.
# We do this because of a bug caused by https://github.com/evanw/esbuild/issues/2950 and an Angular v16 change
# to how angular static properties are attached to class constructors.
# Targeting esnext or es2022 will cause the static initializer blocks that attach these static properties on class
# constructors to reference a class constructor variable that they do not have access to.
target = "es2020",
deps = [":devtools"],
)
exports_files(["index.html"])
filegroup(
name = "prod_app_static_files",
srcs = [
":index.html",
":shell_chrome_styles",
":shell_common_styles",
":shell_firefox_styles",
"//packages/zone.js/bundles:zone.umd.js",
],
)
string_flag(
name = "flag_browser",
build_setting_default = "chrome",
values = [
"chrome",
"firefox",
],
)
config_setting(
name = "browser_chrome",
flag_values = {":flag_browser": "chrome"},
)
config_setting(
name = "browser_firefox",
flag_values = {":flag_browser": "firefox"},
)
genrule(
name = "copy_manifest",
srcs = select({
":browser_chrome": ["//devtools/projects/shell-browser/src/manifest:manifest.chrome.json"],
":browser_firefox": ["//devtools/projects/shell-browser/src/manifest:manifest.firefox.json"],
}),
outs = ["manifest.json"],
cmd = "cp $< $@",
)
pkg_web(
name = "prodapp",
srcs = [
":bundle",
":copy_manifest",
":devtools_bundle",
":prod_app_static_files",
"//devtools/projects/shell-browser/src:devtools.html",
"//devtools/projects/shell-browser/src/app:backend_bundle",
"//devtools/projects/shell-browser/src/app:background_bundle",
"//devtools/projects/shell-browser/src/app:content_script_bundle",
"//devtools/projects/shell-browser/src/app:detect_angular_for_extension_icon_bundle",
"//devtools/projects/shell-browser/src/app:ng_validate_bundle",
"//devtools/projects/shell-browser/src/assets",
"//devtools/projects/shell-browser/src/popups",
],
additional_root_paths = [
"projects/ng-devtools/src/lib",
],
)
| {
"end_byte": 4637,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/BUILD.bazel"
} |
angular/devtools/projects/shell-browser/src/app/app.component.html_0_28 | <ng-devtools></ng-devtools>
| {
"end_byte": 28,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/app/app.component.html"
} |
angular/devtools/projects/shell-browser/src/app/same-page-message-bus.ts_0_2539 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {Events, MessageBus, Parameters} from 'protocol';
type AnyEventCallback<Ev> = <E extends keyof Ev>(topic: E, args: Parameters<Ev[E]>) => void;
type ListenerFn = (e: MessageEvent) => void;
export class SamePageMessageBus extends MessageBus<Events> {
private _listeners: ListenerFn[] = [];
constructor(
private _source: string,
private _destination: string,
) {
super();
}
onAny(cb: AnyEventCallback<Events>): () => void {
const listener: ListenerFn = (e) => {
if (e.source !== window || !e.data || !e.data.topic || e.data.source !== this._destination) {
return;
}
cb(e.data.topic, e.data.args);
};
window.addEventListener('message', listener);
this._listeners.push(listener);
return () => {
this._listeners.splice(this._listeners.indexOf(listener), 1);
window.removeEventListener('message', listener);
};
}
override on<E extends keyof Events>(topic: E, cb: Events[E]): () => void {
const listener: ListenerFn = (e) => {
if (e.source !== window || !e.data || e.data.source !== this._destination || !e.data.topic) {
return;
}
if (e.data.topic === topic) {
(cb as any).apply(null, e.data.args);
}
};
window.addEventListener('message', listener);
this._listeners.push(listener);
return () => {
this._listeners.splice(this._listeners.indexOf(listener), 1);
window.removeEventListener('message', listener);
};
}
override once<E extends keyof Events>(topic: E, cb: Events[E]): void {
const listener: ListenerFn = (e) => {
if (e.source !== window || !e.data || e.data.source !== this._destination || !e.data.topic) {
return;
}
if (e.data.topic === topic) {
(cb as any).apply(null, e.data.args);
}
window.removeEventListener('message', listener);
};
window.addEventListener('message', listener);
}
override emit<E extends keyof Events>(topic: E, args?: Parameters<Events[E]>): boolean {
window.postMessage(
{
source: this._source,
topic,
args,
__ignore_ng_zone__: true,
},
'*',
);
return true;
}
override destroy(): void {
this._listeners.forEach((l) => window.removeEventListener('message', l));
this._listeners = [];
}
}
| {
"end_byte": 2539,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/app/same-page-message-bus.ts"
} |
angular/devtools/projects/shell-browser/src/app/chrome-application-environment.ts_0_509 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {ApplicationEnvironment, Environment} from 'ng-devtools';
import {environment} from '../environments/environment';
export class ChromeApplicationEnvironment extends ApplicationEnvironment {
frameSelectorEnabled = true;
override get environment(): Environment {
return environment;
}
}
| {
"end_byte": 509,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/app/chrome-application-environment.ts"
} |
angular/devtools/projects/shell-browser/src/app/tab_manager_spec.ts_0_1856 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {DevToolsConnection, TabManager, Tabs} from './tab_manager';
interface MockSender {
url: string;
tab: {
id: number;
};
frameId: number;
}
const TEST_MESSAGE_ONE = {topic: 'test', args: ['test1']};
const TEST_MESSAGE_TWO = {topic: 'test', args: ['test2']};
class MockPort {
onMessageListeners: Function[] = [];
onDisconnectListeners: Function[] = [];
messagesPosted: any[] = [];
name: string;
sender?: MockSender;
constructor(
public properties: {
name: string;
sender?: MockSender;
},
) {
this.name = properties.name;
this.sender = properties.sender;
}
postMessage(message: any): void {
this.messagesPosted.push(message);
}
onMessage = {
addListener: (listener: Function): void => {
this.onMessageListeners.push(listener);
},
removeListener: (listener: Function) => {
this.onMessageListeners = this.onMessageListeners.filter((l) => l !== listener);
},
};
onDisconnect = {
addListener: (listener: Function): void => {
this.onDisconnectListeners.push(listener);
},
};
}
function assertArrayHasObj<T>(array: T[], obj: T) {
expect(array).toContain(jasmine.objectContaining(obj as object));
}
function assertArrayDoesNotHaveObj<T extends object>(array: T[], obj: T) {
expect(array).not.toContain(jasmine.objectContaining(obj));
}
function mockSpyFunction(obj: any, property: string, returnValue: any) {
(obj[property] as any).and.returnValue(() => returnValue);
}
function mockSpyProperty(obj: any, property: string, value: any) {
(Object.getOwnPropertyDescriptor(obj, property)!.get as any).and.returnValue(value);
} | {
"end_byte": 1856,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/app/tab_manager_spec.ts"
} |
angular/devtools/projects/shell-browser/src/app/tab_manager_spec.ts_1858_9380 | describe('Tab Manager - ', () => {
let tabs: Tabs;
const tabId = 12345;
let chromeRuntime: jasmine.SpyObj<typeof chrome.runtime>;
let tabManager: TabManager;
let tab: DevToolsConnection;
let chromeRuntimeOnConnectListeners: ((port: MockPort) => void)[] = [];
function connectToChromeRuntime(port: MockPort): void {
for (const listener of chromeRuntimeOnConnectListeners) {
listener(port);
}
}
function emitMessageToPort(port: MockPort, message: any): void {
for (const listener of port.onMessageListeners) {
listener(message);
}
}
function emitBackendReadyToPort(contentScriptPort: MockPort) {
emitMessageToPort(contentScriptPort, {topic: 'backendReady'});
}
function emitDisconnectToPort(port: MockPort) {
for (const listener of port.onDisconnectListeners) {
listener();
}
}
function createDevToolsPort() {
const port = new MockPort({
name: tabId.toString(),
});
connectToChromeRuntime(port);
return port;
}
beforeEach(() => {
chromeRuntimeOnConnectListeners = [];
chromeRuntime = jasmine.createSpyObj(
'chrome.runtime',
['getManifest', 'getURL'],
['onConnect', 'onDisconnect'],
);
mockSpyFunction(chromeRuntime, 'getManifest', {manifest_version: 3});
mockSpyFunction(chromeRuntime, 'getURL', (path: string) => path);
mockSpyProperty(chromeRuntime, 'onConnect', {
addListener: (listener: (port: MockPort) => void) => {
chromeRuntimeOnConnectListeners.push(listener);
},
});
});
describe('Single Frame', () => {
const testURL = 'http://example.com';
const contentScriptFrameId = 0;
function createContentScriptPort() {
const port = new MockPort({
name: 'Content Script',
sender: {
url: testURL,
tab: {
id: tabId,
},
frameId: contentScriptFrameId,
},
});
connectToChromeRuntime(port);
return port;
}
beforeEach(() => {
tabs = {};
tabManager = TabManager.initialize(tabs, chromeRuntime);
});
async function* eachOrderingOfDevToolsInitialization(): AsyncGenerator<{
tab: DevToolsConnection;
contentScriptPort: MockPort;
devtoolsPort: MockPort;
}> {
{
// Content Script -> Backend Ready -> Devtools
const contentScriptPort = createContentScriptPort();
emitBackendReadyToPort(contentScriptPort);
const devtoolsPort = createDevToolsPort();
const tab = tabs[tabId]!;
await tab.contentScripts[contentScriptFrameId].backendReady;
yield {tab, contentScriptPort, devtoolsPort};
delete tabs[tabId];
}
{
// Content Script -> Devtools -> Backend Ready
const contentScriptPort = createContentScriptPort();
const devtoolsPort = createDevToolsPort();
emitBackendReadyToPort(contentScriptPort);
const tab = tabs[tabId]!;
await tab.contentScripts[contentScriptFrameId].backendReady;
yield {tab, contentScriptPort, devtoolsPort};
delete tabs[tabId];
}
{
// Devtools -> Content Script -> Backend Ready
const devtoolsPort = createDevToolsPort();
const contentScriptPort = createContentScriptPort();
emitBackendReadyToPort(contentScriptPort);
const tab = tabs[tabId]!;
await tab.contentScripts[contentScriptFrameId].backendReady;
yield {tab, contentScriptPort, devtoolsPort};
}
}
it('should setup tab object in the tab manager', async () => {
for await (const {
tab,
contentScriptPort,
devtoolsPort,
} of eachOrderingOfDevToolsInitialization()) {
expect(tab).toBeDefined();
expect(tab!.devtools).toBe(devtoolsPort as unknown as chrome.runtime.Port);
expect(tab!.contentScripts[contentScriptFrameId].port).toBe(
contentScriptPort as unknown as chrome.runtime.Port,
);
}
});
it('should set frame connection as enabled when an enableFrameConnection message is recieved', async () => {
for await (const {tab, devtoolsPort} of eachOrderingOfDevToolsInitialization()) {
expect(tab?.contentScripts[contentScriptFrameId]?.enabled).toBe(false);
emitMessageToPort(devtoolsPort, {
topic: 'enableFrameConnection',
args: [contentScriptFrameId, tabId],
});
expect(tab?.contentScripts[contentScriptFrameId]?.enabled).toBe(true);
assertArrayHasObj(devtoolsPort.messagesPosted, {
topic: 'frameConnected',
args: [contentScriptFrameId],
});
}
});
it('should pipe messages from the content script and devtools script to each other when the content script frame is enabled', async () => {
for await (const {
contentScriptPort,
devtoolsPort,
} of eachOrderingOfDevToolsInitialization()) {
emitMessageToPort(devtoolsPort, {
topic: 'enableFrameConnection',
args: [contentScriptFrameId, tabId],
});
// Verify that the double pipe is set up between the content script and the devtools page.
emitMessageToPort(contentScriptPort, TEST_MESSAGE_ONE);
assertArrayHasObj(devtoolsPort.messagesPosted, TEST_MESSAGE_ONE);
assertArrayDoesNotHaveObj(contentScriptPort.messagesPosted, TEST_MESSAGE_ONE);
emitMessageToPort(devtoolsPort, TEST_MESSAGE_TWO);
assertArrayHasObj(contentScriptPort.messagesPosted, TEST_MESSAGE_TWO);
assertArrayDoesNotHaveObj(devtoolsPort.messagesPosted, TEST_MESSAGE_TWO);
}
});
it('should not pipe messages from the content script and devtools script to each other when the content script frame is disabled', async () => {
for await (const {
tab,
contentScriptPort,
devtoolsPort,
} of eachOrderingOfDevToolsInitialization()) {
expect(tab?.contentScripts[contentScriptFrameId]?.enabled).toBe(false);
emitMessageToPort(contentScriptPort, TEST_MESSAGE_ONE);
assertArrayDoesNotHaveObj(contentScriptPort.messagesPosted, TEST_MESSAGE_ONE);
emitMessageToPort(devtoolsPort, TEST_MESSAGE_TWO);
assertArrayDoesNotHaveObj(devtoolsPort.messagesPosted, TEST_MESSAGE_TWO);
}
});
it('should set backendReady when the contentPort recieves the backendReady message', async () => {
for await (const {
contentScriptPort,
devtoolsPort,
} of eachOrderingOfDevToolsInitialization()) {
emitMessageToPort(devtoolsPort, {
topic: 'enableFrameConnection',
args: [contentScriptFrameId, tabId],
});
assertArrayHasObj(devtoolsPort.messagesPosted, {
topic: 'contentScriptConnected',
args: [contentScriptFrameId, contentScriptPort.name, contentScriptPort.sender!.url],
});
}
});
it('should set tab.devtools to null when the devtoolsPort disconnects', async () => {
for await (const {tab, devtoolsPort} of eachOrderingOfDevToolsInitialization()) {
emitMessageToPort(devtoolsPort, {
topic: 'enableFrameConnection',
args: [contentScriptFrameId, tabId],
});
expect(tab?.contentScripts[contentScriptFrameId]?.enabled).toBe(true);
emitDisconnectToPort(devtoolsPort);
expect(tab.devtools).toBeNull();
expect(tab?.contentScripts[contentScriptFrameId]?.enabled).toBe(false);
}
});
}); | {
"end_byte": 9380,
"start_byte": 1858,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/app/tab_manager_spec.ts"
} |
angular/devtools/projects/shell-browser/src/app/tab_manager_spec.ts_9384_16818 | describe('Multiple Frames', () => {
const topLevelFrameId = 0;
const childFrameId = 1;
function createTopLevelContentScriptPort() {
const port = new MockPort({
name: 'Top level content script',
sender: {
url: 'TEST_URL',
tab: {
id: tabId,
},
frameId: topLevelFrameId,
},
});
connectToChromeRuntime(port);
return port;
}
function createChildContentScriptPort() {
const port = new MockPort({
name: 'Child content script',
sender: {
url: 'TEST_URL_2',
tab: {
id: tabId,
},
frameId: childFrameId,
},
});
connectToChromeRuntime(port);
return port;
}
async function* eachOrderingOfDevToolsInitialization() {
{
// Devtools Connected -> Top Level Content Script Connected -> Top Level Content Script Backend Ready
// -> Child Content Script Connected -> Child Content Script Backend Ready
const devtoolsPort = createDevToolsPort();
const topLevelContentScriptPort = createTopLevelContentScriptPort();
emitBackendReadyToPort(topLevelContentScriptPort);
const childContentScriptPort = createChildContentScriptPort();
emitBackendReadyToPort(childContentScriptPort);
const tab = tabs[tabId]!;
await tab.contentScripts[topLevelFrameId].backendReady;
await tab.contentScripts[childFrameId].backendReady;
yield {tab, topLevelContentScriptPort, childContentScriptPort, devtoolsPort};
delete tabs[tabId];
}
{
// Top Level Content Script Connected -> Top Level Content Script Backend Ready -> Devtools Connected
// -> Child Content Script Connected -> Child Content Script Backend Ready
const topLevelContentScriptPort = createTopLevelContentScriptPort();
emitBackendReadyToPort(topLevelContentScriptPort);
const devtoolsPort = createDevToolsPort();
const childContentScriptPort = createChildContentScriptPort();
emitBackendReadyToPort(childContentScriptPort);
const tab = tabs[tabId]!;
await tab.contentScripts[topLevelFrameId].backendReady;
await tab.contentScripts[childFrameId].backendReady;
yield {tab, topLevelContentScriptPort, childContentScriptPort, devtoolsPort};
delete tabs[tabId];
}
{
// Top Level Content Script Connected -> Top Level Content Script Backend Ready -> Child Content Script Connected
// -> Child Content Script Backend Ready -> Devtools Connected
const topLevelContentScriptPort = createTopLevelContentScriptPort();
emitBackendReadyToPort(topLevelContentScriptPort);
const childContentScriptPort = createChildContentScriptPort();
emitBackendReadyToPort(childContentScriptPort);
const devtoolsPort = createDevToolsPort();
tab = tabs[tabId]!;
await tab.contentScripts[topLevelFrameId].backendReady;
await tab.contentScripts[childFrameId].backendReady;
yield {tab, topLevelContentScriptPort, childContentScriptPort, devtoolsPort};
delete tabs[tabId];
}
{
// Top Level Content Script Connected -> Devtools Connected -> Child Content Script Connected
// -> Top Level Content Script Backend Ready -> Child Content Script Backend Ready
const topLevelContentScriptPort = createTopLevelContentScriptPort();
const devtoolsPort = createDevToolsPort();
const childContentScriptPort = createChildContentScriptPort();
emitBackendReadyToPort(topLevelContentScriptPort);
emitBackendReadyToPort(childContentScriptPort);
const tab = tabs[tabId]!;
await tab.contentScripts[topLevelFrameId].backendReady;
await tab.contentScripts[childFrameId].backendReady;
yield {tab, topLevelContentScriptPort, childContentScriptPort, devtoolsPort};
}
}
beforeEach(() => {
tabs = {};
tabManager = TabManager.initialize(tabs, chromeRuntime);
});
it('should setup tab object in the tab manager', async () => {
for await (const {
tab,
topLevelContentScriptPort,
childContentScriptPort,
devtoolsPort,
} of eachOrderingOfDevToolsInitialization()) {
expect(tab).toBeDefined();
expect(tab!.devtools).toBe(devtoolsPort as unknown as chrome.runtime.Port);
expect(tab!.contentScripts[topLevelFrameId].port).toBe(
topLevelContentScriptPort as unknown as chrome.runtime.Port,
);
expect(tab!.contentScripts[childFrameId].port).toBe(
childContentScriptPort as unknown as chrome.runtime.Port,
);
}
});
it('should setup message and disconnect listeners on devtools and content script ports', async () => {
for await (const {
topLevelContentScriptPort,
childContentScriptPort,
devtoolsPort,
} of eachOrderingOfDevToolsInitialization()) {
expect(topLevelContentScriptPort.onDisconnectListeners.length).toBeGreaterThan(0);
expect(childContentScriptPort.onDisconnectListeners.length).toBeGreaterThan(0);
expect(devtoolsPort.onDisconnectListeners.length).toBeGreaterThan(0);
expect(topLevelContentScriptPort.onMessageListeners.length).toBeGreaterThan(0);
}
});
it('should set the correct frame connection as enabled when an enableFrameConnection message is recieved', async () => {
for await (const {tab, devtoolsPort} of eachOrderingOfDevToolsInitialization()) {
expect(tab?.contentScripts[topLevelFrameId]?.enabled).toBe(false);
expect(tab?.contentScripts[childFrameId]?.enabled).toBe(false);
emitMessageToPort(devtoolsPort, {
topic: 'enableFrameConnection',
args: [topLevelFrameId, tabId],
});
expect(tab?.contentScripts[topLevelFrameId]?.enabled).toBe(true);
expect(tab?.contentScripts[childFrameId]?.enabled).toBe(false);
assertArrayHasObj(devtoolsPort.messagesPosted, {
topic: 'frameConnected',
args: [topLevelFrameId],
});
assertArrayDoesNotHaveObj(devtoolsPort.messagesPosted, {
topic: 'frameConnected',
args: [childFrameId],
});
}
});
it('should pipe messages from the correct content script and devtools script when that content script frame is enabled', async () => {
for await (const {
topLevelContentScriptPort,
childContentScriptPort,
devtoolsPort,
} of eachOrderingOfDevToolsInitialization()) {
emitMessageToPort(devtoolsPort, {
topic: 'enableFrameConnection',
args: [topLevelFrameId, tabId],
});
emitMessageToPort(devtoolsPort, TEST_MESSAGE_ONE);
assertArrayHasObj(topLevelContentScriptPort.messagesPosted, TEST_MESSAGE_ONE);
assertArrayDoesNotHaveObj(childContentScriptPort.messagesPosted, TEST_MESSAGE_ONE);
emitMessageToPort(devtoolsPort, {
topic: 'enableFrameConnection',
args: [childFrameId, tabId],
});
emitMessageToPort(devtoolsPort, TEST_MESSAGE_TWO);
assertArrayHasObj(childContentScriptPort.messagesPosted, TEST_MESSAGE_TWO);
assertArrayDoesNotHaveObj(topLevelContentScriptPort.messagesPosted, TEST_MESSAGE_TWO);
}
});
});
}); | {
"end_byte": 16818,
"start_byte": 9384,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/app/tab_manager_spec.ts"
} |
angular/devtools/projects/shell-browser/src/app/content-script.ts_0_3051 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {ChromeMessageBus} from './chrome-message-bus';
import {SamePageMessageBus} from './same-page-message-bus';
let backgroundDisconnected = false;
let backendInstalled = false;
let backendInitialized = false;
const port = chrome.runtime.connect({
name: `${document.title || location.href}`,
});
const handleDisconnect = (): void => {
// console.log('Background disconnected', new Date());
localMessageBus.emit('shutdown');
localMessageBus.destroy();
chromeMessageBus.destroy();
backgroundDisconnected = true;
};
port.onDisconnect.addListener(handleDisconnect);
const detectAngularMessageBus = new SamePageMessageBus(
`angular-devtools-content-script-${location.href}`,
`angular-devtools-detect-angular-${location.href}`,
);
detectAngularMessageBus.on('detectAngular', (detectionResult) => {
// only install backend once
if (backendInstalled) {
return;
}
if (detectionResult.isAngularDevTools !== true) {
return;
}
if (detectionResult.isAngular !== true) {
return;
}
// Defensive check against non html page. Realistically this should never happen.
if (document.contentType !== 'text/html') {
return;
}
const script = document.createElement('script');
script.src = chrome.runtime.getURL('app/backend_bundle.js');
document.documentElement.appendChild(script);
document.documentElement.removeChild(script);
backendInstalled = true;
});
const localMessageBus = new SamePageMessageBus(
`angular-devtools-content-script-${location.href}`,
`angular-devtools-backend-${location.href}`,
);
const chromeMessageBus = new ChromeMessageBus(port);
const handshakeWithBackend = (): void => {
localMessageBus.emit('handshake');
};
chromeMessageBus.onAny((topic, args) => {
localMessageBus.emit(topic, args);
});
localMessageBus.onAny((topic, args) => {
backendInitialized = true;
chromeMessageBus.emit(topic, args);
});
if (!backendInitialized) {
// tslint:disable-next-line:no-console
console.log('Attempting initialization', new Date());
const retry = () => {
if (backendInitialized || backgroundDisconnected) {
return;
}
handshakeWithBackend();
setTimeout(retry, 500);
};
retry();
}
const proxyEventFromWindowToDevToolsExtension = (event: MessageEvent) => {
if (event.source === window && event.data) {
try {
chrome.runtime.sendMessage(event.data);
} catch (e) {
const {message} = e as Error;
if (message.includes('Extension context invalidated.')) {
console.error(
'Angular DevTools: Disconnecting content script due to invalid extension context. Please reload the page.',
);
window.removeEventListener('message', proxyEventFromWindowToDevToolsExtension);
}
throw e;
}
}
};
window.addEventListener('message', proxyEventFromWindowToDevToolsExtension);
| {
"end_byte": 3051,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/app/content-script.ts"
} |
angular/devtools/projects/shell-browser/src/app/tab_manager.ts_0_7899 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
/// <reference types="chrome"/>
import {Events, Topic} from 'protocol';
export interface ContentScriptConnection {
port: chrome.runtime.Port | null;
enabled: boolean;
frameId: 'devtools' | number;
backendReady?: Promise<void>;
}
export interface DevToolsConnection {
devtools: chrome.runtime.Port | null;
contentScripts: {[name: string]: ContentScriptConnection};
}
function isNumeric(str: string): boolean {
return +str + '' === str;
}
export interface Tabs {
[tabId: string]: DevToolsConnection | undefined;
}
export class TabManager {
constructor(
private tabs: Tabs,
private runtime: typeof chrome.runtime,
) {}
static initialize(tabs: Tabs, runtime: typeof chrome.runtime = chrome.runtime): TabManager {
const manager = new TabManager(tabs, runtime);
manager.initialize();
return manager;
}
private initialize(): void {
this.runtime.onConnect.addListener((port) => {
if (isNumeric(port.name)) {
this.registerDevToolsForTab(port);
return;
}
if (
!port.sender ||
!port.sender.tab ||
port.sender.tab.id === undefined ||
port.sender.frameId === undefined
) {
console.warn('Received a connection from an unknown sender', port);
return;
}
this.registerContentScriptForTab(port);
});
}
private ensureTabExists(tabId: number): void {
this.tabs[tabId] ??= {
devtools: null,
contentScripts: {},
};
}
private registerDevToolsForTab(port: chrome.runtime.Port): void {
// For the devtools page, our port name is the tab id.
const tabId = parseInt(port.name, 10);
this.ensureTabExists(tabId);
const tab = this.tabs[tabId]!;
tab.devtools = port;
tab.devtools.onDisconnect.addListener(() => {
tab.devtools = null;
for (const connection of Object.values(tab.contentScripts)) {
connection.enabled = false;
}
});
// DevTools may register after the content script has already registered. If that's the case,
// we need to set up the double pipe between the devtools and each content script, and send
// the contentScriptConnected message to the devtools page to inform it of all frames on the page.
for (const [frameId, connection] of Object.entries(tab.contentScripts)) {
connection.backendReady!.then(() => {
if (connection.port === null) {
throw new Error(
'Expected Content to have already connected before the backendReady event on the same page.',
);
}
this.doublePipe(tab.devtools, connection);
tab.devtools!.postMessage({
topic: 'contentScriptConnected',
args: [parseInt(frameId, 10), connection.port.name, connection.port.sender!.url],
});
});
}
}
private registerContentScriptForTab(port: chrome.runtime.Port): void {
// A content script connection will have a sender and a tab id.
const sender = port.sender!;
const frameId = sender.frameId!;
const tabId = sender.tab!.id!;
this.ensureTabExists(tabId);
const tab = this.tabs[tabId]!;
if (tab.contentScripts[frameId] === undefined) {
tab.contentScripts[frameId] = {
port: null,
enabled: false,
frameId: -1,
};
}
const contentScript = tab.contentScripts[frameId]!;
contentScript.port = port;
contentScript.frameId = frameId;
contentScript.enabled = contentScript.enabled ?? false;
// When the content script disconnects, clean up the connection state we're storing in the
// background page.
port.onDisconnect.addListener(() => {
delete tab.contentScripts[frameId];
if (Object.keys(tab.contentScripts).length === 0) {
delete this.tabs[tabId];
}
});
contentScript.backendReady = new Promise((resolveBackendReady) => {
const onBackendReady = (message: {topic: string}) => {
if (message.topic === 'backendReady') {
// If DevTools is not yet connected, this resolve will enable devtools to eventually connect to this
// content script (even though the content script connected first)
resolveBackendReady();
// If the devtools connection is already established, set up the double pipe between the
// devtools and the content script.
if (tab.devtools) {
this.doublePipe(tab.devtools, contentScript);
tab.devtools.postMessage({
topic: 'contentScriptConnected',
args: [frameId, contentScript.port!.name, contentScript.port!.sender!.url],
});
}
port.onMessage.removeListener(onBackendReady);
}
};
port.onMessage.addListener(onBackendReady);
port.onDisconnect.addListener(() => {
port.onMessage.removeListener(onBackendReady);
});
});
}
private doublePipe(
devtoolsPort: chrome.runtime.Port | null,
contentScriptConnection: ContentScriptConnection,
): void {
if (devtoolsPort === null) {
throw new Error('DevTools port is equal to null');
}
const contentScriptPort = contentScriptConnection.port;
if (contentScriptPort === null) {
throw new Error('Content script port is equal to null');
}
// tslint:disable-next-line:no-console
console.log('Creating two-way communication channel', Date.now(), this.tabs);
const onDevToolsMessage = (message: {topic: Topic; args: Parameters<Events[Topic]>}) => {
if (message.topic === 'enableFrameConnection') {
if (message.args.length !== 2) {
throw new Error('Expected two arguments for enableFrameConnection');
}
const [frameId, tabId] = message.args as [frameId: number, tabId: number];
if (frameId === contentScriptConnection.frameId) {
const tab = this.tabs[tabId];
if (tab === undefined) {
throw new Error(`Expected tab to be registered with tabId ${tabId}`);
}
for (const frameId of Object.keys(tab.contentScripts)) {
tab.contentScripts[frameId].enabled = false;
}
contentScriptConnection.enabled = true;
devtoolsPort.postMessage({
topic: 'frameConnected',
args: [contentScriptConnection.frameId],
});
}
}
// Do not allow any message to be sent if a content script is not enabled. This is the
// mechanism that lets us select which content script connection Angular Devtools is connected
// to.
if (!contentScriptConnection.enabled) {
return;
}
contentScriptPort.postMessage(message);
};
devtoolsPort.onMessage.addListener(onDevToolsMessage);
const onContentScriptMessage = (message: {topic: Topic; args: Parameters<Events[Topic]>}) => {
// Do not allow any message to be sent if a content script is not enabled. This is the
// mechanism that lets us select which content script connection Angular Devtools is connected
// to.
if (!contentScriptConnection.enabled) {
return;
}
devtoolsPort.postMessage(message);
};
contentScriptPort.onMessage.addListener(onContentScriptMessage);
const shutdownContentScript = () => {
devtoolsPort.onMessage.removeListener(onDevToolsMessage);
devtoolsPort.postMessage({
topic: 'contentScriptDisconnected',
args: [contentScriptConnection.frameId, contentScriptConnection.port!.name],
});
contentScriptPort.onMessage.removeListener(onContentScriptMessage);
};
contentScriptPort.onDisconnect.addListener(() => shutdownContentScript());
}
}
| {
"end_byte": 7899,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/app/tab_manager.ts"
} |
angular/devtools/projects/shell-browser/src/app/app.component.spec.ts_0_1035 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {TestBed, waitForAsync} from '@angular/core/testing';
import {RouterModule} from '@angular/router';
import {ApplicationOperations} from 'ng-devtools';
import {AppComponent} from './app.component';
describe('AppComponent', () => {
beforeEach(waitForAsync(() => {
const applicationOperationsSPy = jasmine.createSpyObj('messageBus', ['viewSource']);
TestBed.configureTestingModule({
declarations: [AppComponent],
imports: [RouterModule.forRoot([])],
providers: [
{
provide: ApplicationOperations,
useClass: applicationOperationsSPy,
},
],
}).compileComponents();
}));
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
});
| {
"end_byte": 1035,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/app/app.component.spec.ts"
} |
angular/devtools/projects/shell-browser/src/app/app.module.ts_0_1702 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {NgModule, NgZone} from '@angular/core';
import {MatSelect} from '@angular/material/select';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {ApplicationEnvironment, ApplicationOperations, DevToolsComponent} from 'ng-devtools';
import {AppComponent} from './app.component';
import {ChromeApplicationEnvironment} from './chrome-application-environment';
import {ChromeApplicationOperations} from './chrome-application-operations';
import {ZoneAwareChromeMessageBus} from './zone-aware-chrome-message-bus';
import {Events, MessageBus, PriorityAwareMessageBus} from 'protocol';
import {FrameManager} from '../../../../projects/ng-devtools/src/lib/frame_manager';
@NgModule({
declarations: [AppComponent],
imports: [BrowserAnimationsModule, DevToolsComponent, MatSelect],
bootstrap: [AppComponent],
providers: [
{provide: FrameManager, useFactory: () => FrameManager.initialize()},
{
provide: ApplicationOperations,
useClass: ChromeApplicationOperations,
},
{
provide: ApplicationEnvironment,
useClass: ChromeApplicationEnvironment,
},
{
provide: MessageBus,
useFactory(ngZone: NgZone): MessageBus<Events> {
const port = chrome.runtime.connect({
name: '' + chrome.devtools.inspectedWindow.tabId,
});
return new PriorityAwareMessageBus(new ZoneAwareChromeMessageBus(port, ngZone));
},
deps: [NgZone],
},
],
})
export class AppModule {}
| {
"end_byte": 1702,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/app/app.module.ts"
} |
angular/devtools/projects/shell-browser/src/app/app.component.ts_0_1572 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {ChangeDetectorRef, Component, inject, OnInit} from '@angular/core';
import {Events, MessageBus} from 'protocol';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
standalone: false,
})
export class AppComponent implements OnInit {
private _cd = inject(ChangeDetectorRef);
private readonly _messageBus = inject<MessageBus<Events>>(MessageBus);
private onProfilingStartedListener = () => {
this._messageBus.emit('enableTimingAPI');
};
private onProfilingStoppedListener = () => {
this._messageBus.emit('disableTimingAPI');
};
ngOnInit(): void {
chrome.devtools.network.onNavigated.addListener(() => {
window.location.reload();
});
const chromeDevToolsPerformance = chrome.devtools.performance;
chromeDevToolsPerformance?.onProfilingStarted?.addListener?.(this.onProfilingStartedListener);
chromeDevToolsPerformance?.onProfilingStopped?.addListener?.(this.onProfilingStoppedListener);
this._cd.detectChanges();
}
ngOnDestroy(): void {
const chromeDevToolsPerformance = chrome.devtools.performance;
chromeDevToolsPerformance?.onProfilingStarted?.removeListener?.(
this.onProfilingStartedListener,
);
chromeDevToolsPerformance?.onProfilingStopped?.removeListener?.(
this.onProfilingStoppedListener,
);
}
}
| {
"end_byte": 1572,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/app/app.component.ts"
} |
angular/devtools/projects/shell-browser/src/app/chrome-message-bus.ts_0_2430 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
/// <reference types="chrome"/>
import {Events, MessageBus, Parameters} from 'protocol';
interface ChromeMessage<T, K extends keyof T> {
topic: K;
args: Parameters<T[K]>;
}
type AnyEventCallback<Ev> = <E extends keyof Ev>(topic: E, args: Parameters<Ev[E]>) => void;
export class ChromeMessageBus extends MessageBus<Events> {
private _disconnected = false;
private _listeners: any[] = [];
constructor(private _port: chrome.runtime.Port) {
super();
_port.onDisconnect.addListener(() => {
// console.log('Disconnected the port');
this._disconnected = true;
});
}
onAny(cb: AnyEventCallback<Events>): () => void {
const listener = (msg: ChromeMessage<Events, keyof Events>): void => {
cb(msg.topic, msg.args);
};
this._port.onMessage.addListener(listener);
this._listeners.push(listener);
return () => {
this._listeners.splice(this._listeners.indexOf(listener), 1);
this._port.onMessage.removeListener(listener);
};
}
override on<E extends keyof Events>(topic: E, cb: Events[E]): () => void {
const listener = (msg: ChromeMessage<Events, keyof Events>): void => {
if (msg.topic === topic) {
(cb as any).apply(null, msg.args);
}
};
this._port.onMessage.addListener(listener);
this._listeners.push(listener);
return () => {
this._listeners.splice(this._listeners.indexOf(listener), 1);
this._port.onMessage.removeListener(listener);
};
}
override once<E extends keyof Events>(topic: E, cb: Events[E]): void {
const listener = (msg: ChromeMessage<Events, keyof Events>) => {
if (msg.topic === topic) {
(cb as any).apply(null, msg.args);
this._port.onMessage.removeListener(listener);
}
};
this._port.onMessage.addListener(listener);
}
override emit<E extends keyof Events>(topic: E, args?: Parameters<Events[E]>): boolean {
if (this._disconnected) {
return false;
}
this._port.postMessage({
topic,
args,
__ignore_ng_zone__: true,
});
return true;
}
override destroy(): void {
this._listeners.forEach((l) => window.removeEventListener('message', l));
this._listeners = [];
}
}
| {
"end_byte": 2430,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/app/chrome-message-bus.ts"
} |
angular/devtools/projects/shell-browser/src/app/background.ts_0_2176 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
/// <reference types="chrome"/>
import {AngularDetection} from 'protocol';
import {TabManager, Tabs} from './tab_manager';
function getPopUpName(ng: AngularDetection): string {
if (!ng.isAngular) {
return 'not-angular.html';
}
if (!ng.isIvy || !ng.isSupportedAngularVersion) {
return 'unsupported.html';
}
if (!ng.isDebugMode) {
return 'production.html';
}
return 'supported.html';
}
if (chrome !== undefined && chrome.runtime !== undefined) {
const isManifestV3 = chrome.runtime.getManifest().manifest_version === 3;
const browserAction = (() => {
// Electron does not expose browserAction object,
// Use empty calls as fallback if they are not defined.
const noopAction = {setIcon: () => {}, setPopup: () => {}};
if (isManifestV3) {
return chrome.action || noopAction;
}
return chrome.browserAction || noopAction;
})();
// By default use the black and white icon.
// Replace it only when we detect an Angular app.
browserAction.setIcon(
{
path: {
16: chrome.runtime.getURL(`assets/icon-bw16.png`),
48: chrome.runtime.getURL(`assets/icon-bw48.png`),
128: chrome.runtime.getURL(`assets/icon-bw128.png`),
},
},
() => {},
);
chrome.runtime.onMessage.addListener((req: AngularDetection, sender) => {
if (!req.isAngularDevTools) {
return;
}
if (sender && sender.tab) {
browserAction.setPopup({
tabId: sender.tab.id,
popup: `popups/${getPopUpName(req)}`,
});
}
if (sender && sender.tab && req.isAngular) {
browserAction.setIcon(
{
tabId: sender.tab.id,
path: {
16: chrome.runtime.getURL(`assets/icon16.png`),
48: chrome.runtime.getURL(`assets/icon48.png`),
128: chrome.runtime.getURL(`assets/icon128.png`),
},
},
() => {},
);
}
});
const tabs = {};
TabManager.initialize(tabs);
}
| {
"end_byte": 2176,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/app/background.ts"
} |
angular/devtools/projects/shell-browser/src/app/chrome-window-extensions.ts_0_3118 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {findNodeFromSerializedPosition} from 'ng-devtools-backend';
import {
buildDirectiveForest,
queryDirectiveForest,
} from '../../../ng-devtools-backend/src/lib/component-tree';
import {ElementPosition} from 'protocol';
export const initializeExtendedWindowOperations = () => {
extendWindowOperations(globalThis, {inspectedApplication: chromeWindowExtensions});
};
const extendWindowOperations = <T extends {}>(target: any, classImpl: T) => {
for (const key of Object.keys(classImpl)) {
if (target[key] != null) {
console.warn(`A window function or object named ${key} would be overwritten`);
}
}
Object.assign(target, classImpl);
};
const chromeWindowExtensions = {
findConstructorByPosition: (
serializedId: string,
directiveIndex: number,
): Element | undefined => {
const node = findNodeFromSerializedPosition(serializedId);
if (node === null) {
console.error(`Cannot find element associated with node ${serializedId}`);
return;
}
if (directiveIndex !== undefined) {
if (node.directives[directiveIndex]) {
return node.directives[directiveIndex].instance.constructor;
} else {
console.error(
`Could not find the directive in the current node at index ${directiveIndex}`,
);
return;
}
}
if (node.component) {
return node.component.instance.constructor;
} else {
console.error('This component has no instance and therefore no constructor');
return;
}
},
findDomElementByPosition: (serializedId: string): Node | undefined => {
const node = findNodeFromSerializedPosition(serializedId);
if (node === null) {
console.error(`Cannot find element associated with node ${serializedId}`);
return undefined;
}
return node.nativeElement;
},
findPropertyByPosition: (args: any): any => {
const {directivePosition, objectPath} = JSON.parse(args) as {
directivePosition: {element: ElementPosition; directive: number};
objectPath: string[];
};
const node = queryDirectiveForest(directivePosition.element, buildDirectiveForest());
if (node === null) {
console.error(`Cannot find element associated with node ${directivePosition}`);
return undefined;
}
const isDirective =
directivePosition.directive !== undefined &&
node.directives[directivePosition.directive] &&
typeof node.directives[directivePosition.directive] === 'object';
if (isDirective) {
return traverseDirective(node.directives[directivePosition.directive].instance, objectPath);
}
if (node.component) {
return traverseDirective(node.component.instance, objectPath);
}
},
};
const traverseDirective = (dir: any, objectPath: string[]): any => {
for (const key of objectPath) {
if (!dir[key]) {
return;
}
dir = dir[key];
}
return dir;
};
| {
"end_byte": 3118,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/app/chrome-window-extensions.ts"
} |
angular/devtools/projects/shell-browser/src/app/BUILD.bazel_0_6207 | load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
load("//devtools/tools:ng_module.bzl", "ng_module")
load("//devtools/tools:typescript.bzl", "ts_library", "ts_test_library")
load("//tools:defaults.bzl", "esbuild")
load("//devtools/tools:defaults.bzl", "karma_web_test_suite")
package(default_visibility = ["//visibility:public"])
sass_binary(
name = "app_component_styles",
src = "app.component.scss",
)
ng_module(
name = "app",
srcs = [
"app.component.ts",
"app.module.ts",
],
angular_assets = [
"app.component.html",
":app_component_styles",
],
deps = [
":chrome_application_environment",
":chrome_application_operations",
":zone_aware_chrome_message_bus",
"//devtools/projects/ng-devtools",
"//devtools/projects/ng-devtools-backend",
"//devtools/projects/ng-devtools-backend/src/lib:component_tree",
"//devtools/projects/ng-devtools-backend/src/lib:highlighter",
"//devtools/projects/protocol",
"//devtools/projects/shell-browser/src/app:backend",
"//devtools/projects/shell-browser/src/app:background",
"//packages/core",
"//packages/platform-browser",
"//packages/platform-browser/animations",
"@npm//@angular/material",
"@npm//rxjs",
],
)
ts_library(
name = "ng_validate",
srcs = [
"ng-validate.ts",
],
deps = [
"@npm//@types/chrome",
],
)
ts_library(
name = "chrome_window_extensions",
srcs = [
"chrome-window-extensions.ts",
],
deps = [
"//devtools/projects/ng-devtools-backend",
"//devtools/projects/ng-devtools-backend/src/lib:component_tree",
"//devtools/projects/protocol",
"@npm//@types",
],
)
ts_library(
name = "chrome_application_environment",
srcs = [
"chrome-application-environment.ts",
],
deps = [
"//devtools/projects/ng-devtools",
"//devtools/projects/shell-browser/src/environments:environment",
"@npm//@types",
],
)
ts_library(
name = "chrome_application_operations",
srcs = [
"chrome-application-operations.ts",
],
deps = [
":chrome_application_environment",
"//devtools/projects/ng-devtools",
"//devtools/projects/protocol",
"//packages/core",
"@npm//@types",
],
)
ts_library(
name = "same_page_message_bus",
srcs = [
"same-page-message-bus.ts",
],
deps = [
"//devtools/projects/protocol",
"//packages/core",
"@npm//@types",
],
)
ts_library(
name = "zone_aware_chrome_message_bus",
srcs = [
"zone-aware-chrome-message-bus.ts",
],
deps = [
":chrome_message_bus",
"//devtools/projects/protocol",
"//packages/core",
"@npm//@types",
],
)
ts_library(
name = "chrome_message_bus",
srcs = [
"chrome-message-bus.ts",
],
deps = [
"//devtools/projects/protocol",
"//packages/core",
"@npm//@types",
],
)
ts_library(
name = "background",
srcs = [
"background.ts",
],
deps = [
":tab_manager",
"//devtools/projects/protocol",
"//devtools/projects/shell-browser/src/app:detect_angular_for_extension_icon",
],
)
ts_library(
name = "tab_manager",
srcs = [
"tab_manager.ts",
],
deps = [
"//devtools/projects/protocol",
],
)
karma_web_test_suite(
name = "tab_manager_test",
deps = [
":tab_manager_test_lib",
],
)
ts_test_library(
name = "tab_manager_test_lib",
srcs = [
"tab_manager_spec.ts",
],
deps = [
":tab_manager",
],
)
ts_library(
name = "backend",
srcs = [
"backend.ts",
],
deps = [
":same_page_message_bus",
"//devtools/projects/ng-devtools-backend",
"//devtools/projects/ng-devtools-backend/src/lib:highlighter",
"//devtools/projects/shell-browser/src/app:chrome_window_extensions",
"@npm//@types",
],
)
ts_library(
name = "content_script",
srcs = [
"content-script.ts",
],
deps = [
":chrome_message_bus",
":same_page_message_bus",
"//devtools/projects/protocol",
"@npm//@types",
],
)
ts_library(
name = "detect_angular_for_extension_icon",
srcs = [
"detect-angular-for-extension-icon.ts",
],
deps = [
":same_page_message_bus",
"//devtools/projects/protocol",
"//devtools/projects/shared-utils",
"@npm//@types",
],
)
esbuild(
name = "detect_angular_for_extension_icon_bundle",
config = "//devtools/tools/esbuild:esbuild_config_iife",
entry_point = "detect-angular-for-extension-icon.ts",
format = "iife",
minify = True,
platform = "browser",
splitting = False,
target = "esnext",
deps = [
":detect_angular_for_extension_icon",
],
)
esbuild(
name = "backend_bundle",
config = "//devtools/tools/esbuild:esbuild_config_iife",
entry_point = "backend.ts",
format = "iife",
minify = True,
platform = "browser",
splitting = False,
target = "esnext",
deps = [
":backend",
],
)
esbuild(
name = "ng_validate_bundle",
config = "//devtools/tools/esbuild:esbuild_config_iife",
entry_point = "ng-validate.ts",
format = "iife",
minify = True,
platform = "browser",
splitting = False,
target = "esnext",
deps = [
":ng_validate",
],
)
esbuild(
name = "background_bundle",
config = "//devtools/tools/esbuild:esbuild_config_iife",
entry_point = "background.ts",
format = "iife",
minify = True,
platform = "browser",
splitting = False,
target = "esnext",
deps = [
":background",
],
)
esbuild(
name = "content_script_bundle",
config = "//devtools/tools/esbuild:esbuild_config_iife",
entry_point = "content-script.ts",
format = "iife",
minify = True,
platform = "browser",
splitting = False,
target = "esnext",
deps = [
":content_script",
],
)
| {
"end_byte": 6207,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/app/BUILD.bazel"
} |
angular/devtools/projects/shell-browser/src/app/chrome-application-operations.ts_0_1414 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
/// <reference types="chrome"/>
import {ApplicationOperations} from 'ng-devtools';
import {DirectivePosition, ElementPosition} from 'protocol';
function runInInspectedWindow(script: string, frameURL?: URL): void {
chrome.devtools.inspectedWindow.eval(script, {frameURL: frameURL?.toString?.()});
}
export class ChromeApplicationOperations extends ApplicationOperations {
override viewSource(position: ElementPosition, directiveIndex?: number, target?: URL): void {
const viewSource = `inspect(inspectedApplication.findConstructorByPosition('${position}', ${directiveIndex}))`;
runInInspectedWindow(viewSource, target);
}
override selectDomElement(position: ElementPosition, target?: URL): void {
const selectDomElement = `inspect(inspectedApplication.findDomElementByPosition('${position}'))`;
runInInspectedWindow(selectDomElement, target);
}
override inspect(directivePosition: DirectivePosition, objectPath: string[], target?: URL): void {
const args = {
directivePosition,
objectPath,
};
const inspect = `inspect(inspectedApplication.findPropertyByPosition('${JSON.stringify(
args,
)}'))`;
runInInspectedWindow(inspect, target);
}
}
| {
"end_byte": 1414,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/app/chrome-application-operations.ts"
} |
angular/devtools/projects/shell-browser/src/app/ng-validate.ts_0_519 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
/// <reference types="chrome"/>
if (document.contentType === 'text/html') {
const script = document.createElement('script');
script.src = chrome.runtime.getURL('app/detect_angular_for_extension_icon_bundle.js');
document.documentElement.appendChild(script);
document.documentElement.removeChild(script);
}
| {
"end_byte": 519,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/app/ng-validate.ts"
} |
angular/devtools/projects/shell-browser/src/app/zone-aware-chrome-message-bus.ts_0_1353 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {NgZone} from '@angular/core';
import {Events, MessageBus, Parameters} from 'protocol';
import {ChromeMessageBus} from './chrome-message-bus';
export class ZoneAwareChromeMessageBus extends MessageBus<Events> {
private _bus: ChromeMessageBus;
constructor(
port: chrome.runtime.Port,
private _ngZone: NgZone,
) {
super();
this._bus = new ChromeMessageBus(port);
}
override on<E extends keyof Events>(topic: E, cb: Events[E]): void {
this._bus.on(
topic,
function (this: ZoneAwareChromeMessageBus): void {
this._ngZone.run(() => (cb as any).apply(null, arguments));
}.bind(this),
);
}
override once<E extends keyof Events>(topic: E, cb: Events[E]): void {
this._bus.once(
topic,
function (this: ZoneAwareChromeMessageBus): void {
this._ngZone.run(() => (cb as any).apply(null, arguments));
}.bind(this),
);
}
override emit<E extends keyof Events>(topic: E, args?: Parameters<Events[E]>): boolean {
this._ngZone.run(() => this._bus.emit(topic, args));
return true;
}
override destroy(): void {
this._bus.destroy();
}
}
| {
"end_byte": 1353,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/app/zone-aware-chrome-message-bus.ts"
} |
angular/devtools/projects/shell-browser/src/app/backend.ts_0_1389 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {initializeMessageBus} from 'ng-devtools-backend';
import {unHighlight} from '../../../ng-devtools-backend/src/lib/highlighter';
import {initializeExtendedWindowOperations} from './chrome-window-extensions';
import {SamePageMessageBus} from './same-page-message-bus';
const messageBus = new SamePageMessageBus(
`angular-devtools-backend-${location.href}`,
`angular-devtools-content-script-${location.href}`,
);
let initialized = false;
messageBus.on('handshake', () => {
if (initialized) {
return;
}
initialized = true;
initializeMessageBus(messageBus);
initializeExtendedWindowOperations();
let inspectorRunning = false;
messageBus.on('inspectorStart', () => {
inspectorRunning = true;
});
messageBus.on('inspectorEnd', () => {
inspectorRunning = false;
});
// handles case when mouse leaves chrome extension too quickly. unHighlight() is not a very
// expensive function and has an if check so it's DOM api call is not called more than necessary
document.addEventListener(
'mousemove',
() => {
if (!inspectorRunning) {
unHighlight();
}
},
false,
);
messageBus.emit('backendReady');
});
| {
"end_byte": 1389,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/app/backend.ts"
} |
angular/devtools/projects/shell-browser/src/app/detect-angular-for-extension-icon.ts_0_1374 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {AngularDetection} from 'protocol';
import {
appIsAngular,
appIsAngularInDevMode,
appIsAngularIvy,
appIsSupportedAngularVersion,
} from 'shared-utils';
import {SamePageMessageBus} from './same-page-message-bus';
const detectAngularMessageBus = new SamePageMessageBus(
`angular-devtools-detect-angular-${location.href}`,
`angular-devtools-content-script-${location.href}`,
);
function detectAngular(win: Window): void {
const isAngular = appIsAngular();
const isSupportedAngularVersion = appIsSupportedAngularVersion();
const isDebugMode = appIsAngularInDevMode();
const isIvy = appIsAngularIvy();
const detection: AngularDetection = {
isIvy,
isAngular,
isDebugMode,
isSupportedAngularVersion,
isAngularDevTools: true,
};
// For the background script to toggle the icon.
win.postMessage(detection, '*');
// For the content script to inject the backend.
detectAngularMessageBus.emit('detectAngular', [
{
isIvy,
isAngular,
isDebugMode,
isSupportedAngularVersion,
isAngularDevTools: true,
},
]);
setTimeout(() => detectAngular(win), 1000);
}
detectAngular(window);
| {
"end_byte": 1374,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/app/detect-angular-for-extension-icon.ts"
} |
angular/devtools/projects/shell-browser/src/environments/environment.ts_0_256 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
export const environment = {
production: true,
};
| {
"end_byte": 256,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/environments/environment.ts"
} |
angular/devtools/projects/shell-browser/src/environments/BUILD.bazel_0_283 | load("//devtools/tools:typescript.bzl", "ts_library")
package(default_visibility = ["//visibility:public"])
ts_library(
name = "environment",
srcs = [
"environment.ts",
],
deps = [
"//devtools/projects/ng-devtools",
"@npm//@types",
],
)
| {
"end_byte": 283,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/environments/BUILD.bazel"
} |
angular/devtools/projects/shell-browser/src/manifest/BUILD.bazel_0_131 | package(default_visibility = ["//visibility:public"])
exports_files([
"manifest.chrome.json",
"manifest.firefox.json",
])
| {
"end_byte": 131,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/manifest/BUILD.bazel"
} |
angular/devtools/projects/shell-browser/src/styles/chrome_styles.scss_0_42 | /** Specific style for Chrome browser */
| {
"end_byte": 42,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/styles/chrome_styles.scss"
} |
angular/devtools/projects/shell-browser/src/styles/firefox_styles.scss_0_43 | /** Specific style for Firefox browser */
| {
"end_byte": 43,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/styles/firefox_styles.scss"
} |
angular/devtools/projects/shell-browser/src/popups/not-angular.html_0_1065 | <html>
<head>
<link href="../third_party/github.com/google/material-design-icons/material-icons.css" rel="stylesheet" />
<style>
* {
margin: 0;
padding: 0;
}
.header-text {
margin: 0px;
text-align: center;
padding-bottom: 8px;
}
.modal-content {
min-width: 300px;
padding: 10px;
}
.icon {
width: 20px;
margin-right: 16px;
}
.message {
display: flex;
align-items: center;
padding: 5px;
}
code {
font-size: 1em;
font-family: monospace;
}
p:not(:last-child) {
margin-bottom: 10px;
}
.material-icons {
color: rgb(107, 107, 107);
margin-right: 7px;
}
</style>
</head>
<body>
<div class="modal-content">
<h4 class="header-text">Angular DevTools</h4>
<div class="message">
<span class="material-icons md-48">cancel</span>
<p>This page is not using Angular, or it has a strict extension policy.
</p>
</div>
</div>
</body>
</html> | {
"end_byte": 1065,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/popups/not-angular.html"
} |
angular/devtools/projects/shell-browser/src/popups/unsupported.html_0_1251 | <html>
<head>
<link href="../third_party/github.com/google/material-design-icons/material-icons.css" rel="stylesheet" />
<style>
* {
margin: 0;
padding: 0;
}
.header-text {
margin: 0px;
text-align: center;
padding-bottom: 8px;
}
.modal-content {
min-width: 300px;
padding: 10px;
}
.icon {
width: 20px;
margin-right: 16px;
}
.message {
padding: 5px;
}
section {
display: flex;
align-items: center;
margin-bottom: 10px;
}
code {
font-size: 1em;
font-family: monospace;
}
p:not(:last-child) {
margin-bottom: 10px;
}
.material-icons {
color: rgb(107, 107, 107);
margin-right: 7px;
}
</style>
</head>
<body>
<div class="modal-content">
<h4 class="header-text">Angular DevTools</h4>
<div class="message">
<section>
<span class="material-icons md-48">check</span>
<p>This page is using Angular.</p>
</section>
<section>
<span class="material-icons md-48">settings</span>
<p>You can use DevTools with Angular v12+</p>
</section>
</div>
</div>
</body>
</html> | {
"end_byte": 1251,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/popups/unsupported.html"
} |
angular/devtools/projects/shell-browser/src/popups/production.html_0_1272 | <html>
<head>
<link href="../third_party/github.com/google/material-design-icons/material-icons.css" rel="stylesheet" />
<style>
* {
margin: 0;
padding: 0;
}
.header-text {
margin: 0px;
text-align: center;
padding-bottom: 8px;
}
.modal-content {
min-width: 300px;
padding: 10px;
}
.icon {
width: 20px;
margin-right: 16px;
}
.message {
display: flex;
align-items: center;
padding: 5px;
}
code {
font-size: 1em;
font-family: monospace;
}
p:not(:last-child) {
margin-bottom: 10px;
}
.material-icons {
color: rgb(107, 107, 107);
margin-right: 10px;
}
</style>
</head>
<body>
<div class="modal-content">
<h4 class="header-text">Angular DevTools</h4>
<div class="message">
<span class="material-icons md-48">settings</span>
<section>
<p>
Angular application running in <a href="https://angular.dev/api/core/enableProdMode">production
mode</a>.
</p>
<p>We recommend using DevTools with apps in dev mode, running
<code>ng serve</code>.</p>
</section>
</div>
</div>
</body>
</html> | {
"end_byte": 1272,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/popups/production.html"
} |
angular/devtools/projects/shell-browser/src/popups/BUILD.bazel_0_118 | package(default_visibility = ["//visibility:public"])
filegroup(
name = "popups",
srcs = glob(["*.html"]),
)
| {
"end_byte": 118,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/popups/BUILD.bazel"
} |
angular/devtools/projects/shell-browser/src/popups/supported.html_0_1432 | <html>
<head>
<link href="../third_party/github.com/google/material-design-icons/material-icons.css" rel="stylesheet" />
<style>
* {
margin: 0;
padding: 0;
}
.header-text {
margin: 0px;
text-align: center;
padding-bottom: 8px;
}
.modal-content {
min-width: 300px;
padding: 10px;
}
.icon {
width: 20px;
margin-right: 16px;
}
.message {
display: flex;
flex-direction: column;
align-items: center;
padding: 5px;
}
.section-content {
display: flex;
justify-content: center;
align-items: center;
}
code {
font-size: 1em;
font-family: monospace;
}
p:not(:last-child) {
margin-bottom: 10px;
}
.material-icons {
color: rgb(107, 107, 107);
margin-right: 7px;
}
</style>
</head>
<body>
<div class="modal-content">
<h4 class="header-text">Angular DevTools</h4>
<div class="message">
<section class="section-content">
<span class="material-icons md-48">check</span>
<p>Angular application running development mode.</p>
</section>
<br />
<section class="section-content">
<span class="material-icons md-48">settings</span>
<p>Open developer tools, and select the Angular tab.</p>
</section>
</div>
</div>
</body>
</html> | {
"end_byte": 1432,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/popups/supported.html"
} |
angular/devtools/projects/shell-browser/src/assets/BUILD.bazel_0_316 | package(default_visibility = ["//:__subpackages__"])
filegroup(
name = "assets",
srcs = glob([
"*.svg",
"**/*.png",
"*.css",
]) + [
"//third_party/github.com/google/material-design-icons",
"//third_party/github.com/google/material-design-icons:LICENSE",
],
)
| {
"end_byte": 316,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/shell-browser/src/assets/BUILD.bazel"
} |
angular/devtools/projects/ng-devtools/README.md_0_259 | # Angular DevTools UI
This module exports the Angular DevTools component. We render the `DevToolsComponent` within an Angular application running in Chrome or Firefox DevTools. This module of the application communicates with the Angular DevTools "backend".
| {
"end_byte": 259,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/README.md"
} |
angular/devtools/projects/ng-devtools/BUILD.bazel_0_874 | load("//devtools/tools:ng_module.bzl", "ng_module")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
package(default_visibility = ["//visibility:public"])
exports_files(["tsconfig.lib.json"])
ng_module(
name = "ng_devtools_ts",
srcs = ["index.ts"],
deps = [
"//devtools/projects/ng-devtools/src",
"//devtools/projects/protocol",
"//packages/animations",
"//packages/common",
"//packages/core",
"//packages/forms",
"//packages/platform-browser-dynamic",
"@npm//@angular/cdk",
"@npm//@angular/material",
"@npm//@types",
"@npm//d3",
"@npm//memo-decorator",
"@npm//ngx-flamegraph",
"@npm//rxjs",
"@npm//webtreemap",
],
)
js_library(
name = "ng-devtools",
package_name = "ng-devtools",
deps = [":ng_devtools_ts"],
)
| {
"end_byte": 874,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/BUILD.bazel"
} |
angular/devtools/projects/ng-devtools/index.ts_0_238 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
export * from './src/public-api';
| {
"end_byte": 238,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/index.ts"
} |
angular/devtools/projects/ng-devtools/src/public-api.ts_0_402 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
/*
* Public API Surface of ng-devtools
*/
export {DevToolsComponent} from './lib/devtools.component';
export * from './lib/application-operations';
export * from './lib/application-environment';
| {
"end_byte": 402,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/public-api.ts"
} |
angular/devtools/projects/ng-devtools/src/BUILD.bazel_0_389 | load("//devtools/tools:ng_module.bzl", "ng_module")
package(default_visibility = ["//visibility:public"])
ng_module(
name = "src",
srcs = ["public-api.ts"],
deps = [
"//devtools/projects/ng-devtools/src/lib",
"//devtools/projects/ng-devtools/src/lib/application-environment",
"//devtools/projects/ng-devtools/src/lib/application-operations",
],
)
| {
"end_byte": 389,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/BUILD.bazel"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools.component.scss_0_3841 | @keyframes pulse {
0% {
box-shadow: 0 0 0 0px rgba(0, 0, 0, 0.2);
}
100% {
box-shadow: 0 0 0 35px rgba(0, 0, 0, 0);
}
}
@keyframes darkmode-pulse {
0% {
box-shadow: 0 0 0 0px rgb(126, 40, 40);
}
100% {
box-shadow: 0 0 0 35px rgba(0, 0, 0, 0);
}
}
:host {
width: 100%;
height: 100%;
display: block;
}
.devtools-wrapper {
width: 100%;
height: 100%;
display: block;
}
:host-context(.dark-theme) {
.devtools-wrapper {
background: #202124;
}
.initializing {
.loading {
animation: darkmode-pulse 1s infinite;
}
}
}
.noselect {
user-select: none;
}
.initializing {
margin: auto;
width: 125px;
height: 100%;
display: flex;
align-items: center;
.loading {
background: url('./images/angular.svg');
border-radius: 50%;
width: 125px;
height: 125px;
float: left;
text-align: center;
animation: pulse 1s infinite;
}
}
.text-message {
font-weight: 500;
font-size: 1.2em;
padding: 5px;
text-align: center;
cursor: help;
.info-icon {
display: inline-block;
font-size: 0.8em;
border-radius: 50%;
border: solid 2px rgb(17, 17, 17);
cursor: pointer;
width: 16px;
height: 16px;
font-weight: bold;
text-align: center;
}
}
:host-context(.dark-theme) {
.info-icon {
border: solid 2px #bcc5ce;
}
a {
color: #bcc5ce;
}
}
:host {
::ng-deep {
.node-hidden, .link-hidden {
display: none;
}
.link {
stroke: #9b9b9b;
stroke-width: 3px;
fill: none;
&.highlighted {
stroke: #4da1ff;
}
}
.injector-graph svg {
cursor: move;
}
.node {
cursor: pointer;
&.highlighted {
.node-container, .node-container:hover {
background: oklch(0.65 0.25 266 / 1);
border-color: white;
color: white;
font-weight: 400;
}
&.selected {
.node-container, .node-container:hover {
color: oklch(0.65 0.25 266 / 1);;
background: white;
border-width: 3px;
border-color: oklch(0.65 0.25 266 / 1);
font-weight: 800;
}
}
}
.node-container {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
color: #000;
font-size: 16px;
box-sizing: border-box;
border-radius: 2px;
border-style: solid;
border-width: 2px;
font-weight: 300;
}
.node-environment {
border: 1px solid #ff7a7e;
background: #f9c2c5;
&:hover {
background: #ff7a7e;
}
}
.node-imported-module {
border-color: #8838f7;
background: #c79eff;
&:hover {
background: #8838f7;
}
}
.node-element {
border-color: #28ab2c;
background: #a7d5a9;
&:hover {
background: #28ab2c;
}
}
.node-null {
border: 1px solid #8b8b8b;
background: white;
}
.node-label {
color: black;
font-weight: 300;
font-size: 18px;
text-align: center;
}
}
}
}
:host-context(.dark-theme) ::ng-deep {
.legend {
background: #2f2c2c;
}
.link {
stroke: #bcc5ce;
fill: none;
&.highlighted {
stroke: #4da1ff;
}
}
.arrow {
fill: white;
}
.node-label {
color: #000;
}
}
.ng-dev-mode-causes {
font-weight: 500;
font-size: 1.2em;
padding: 1rem;
width: 80%;
margin: auto;
border: 1px solid;
border-radius: 16px;
code {
padding: 2px;
color: lightgreen;
background: #3e3e3e;
border-radius: 5px;
}
li {
margin-bottom: 1rem;
}
}
| {
"end_byte": 3841,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools.component.scss"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools.component.html_0_4535 | <div class="devtools mat-typography mat-app-background" style="height: 100%;">
@switch (angularStatus) {
@case (AngularStatus.EXISTS) {
@if (angularIsInDevMode) {
@if (supportedVersion()) {
<div class="devtools-wrapper noselect" [@enterAnimation]>
<ng-devtools-tabs (frameSelected)="inspectFrame($event)" [isHydrationEnabled]="hydration" [angularVersion]="angularVersion()"></ng-devtools-tabs>
</div>
} @else {
<p class="text-message">
Angular Devtools only supports Angular versions 12 and above
</p>
}
} @else {
<p class="text-message" matTooltip="A dev build is when the `optimization` flag is set to `false` in the angular.json config file.">
We detected an application built with production configuration. Angular DevTools only supports development builds.
</p>
<div class="ng-dev-mode-causes">
<p>
If this application was built in development mode, please check if the <code>window.ng</code> global object is available in your
application. If it is missing, then something is preventing Angular from running in development mode properly.
</p>
<ul>
<li>
Are you calling <code>enableProdMode()</code> in your application? Read more about <a target="_blank" href="https://angular.dev/api/core/enableProdMode">enableProdMode()</a> on angular.dev.
</li>
<li>
Is <code>"optimization": true</code> set in your angular.json? Read more about <a target="_blank" href="https://angular.dev/reference/configs/workspace-config#optimization-configuration">optimization configuration</a> on angular.dev.
</li>
<li>
Is <code>"defaultConfiguration": "production"</code> set in your angular.json? Read more about <a target="_blank" href="https://angular.dev/tools/cli/environments#using-environment-specific-variables-in-your-app">default configurations</a> on angular.dev.
</li>
</ul>
<p>
If you are still experiencing problems, you can open an issue with a reproduction on our <a target="_blank" href="https://github.com/angular/angular/issues/new?assignees=&labels=&projects=&template=4-devtools.yaml">issue tracker</a>.
</p>
</div>
}
}
@case (AngularStatus.DOES_NOT_EXIST) {
<p class="text-message not-detected">
<span class="info-icon" matTooltip="You see this message because the app is still loading, or this is not an Angular application">i</span>
Angular application not detected.
</p>
}
@case (AngularStatus.UNKNOWN) {
<div class="initializing">
<div class="loading">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 223 236" width="120">
<g clip-path="url(#a)">
<path fill="url(#b)" d="m222.077 39.192-8.019 125.923L137.387 0l84.69 39.192Zm-53.105 162.825-57.933 33.056-57.934-33.056 11.783-28.556h92.301l11.783 28.556ZM111.039 62.675l30.357 73.803H80.681l30.358-73.803ZM7.937 165.115 0 39.192 84.69 0 7.937 165.115Z"></path>
<path fill="url(#c)" d="m222.077 39.192-8.019 125.923L137.387 0l84.69 39.192Zm-53.105 162.825-57.933 33.056-57.934-33.056 11.783-28.556h92.301l11.783 28.556ZM111.039 62.675l30.357 73.803H80.681l30.358-73.803ZM7.937 165.115 0 39.192 84.69 0 7.937 165.115Z"></path>
</g>
<defs>
<linearGradient id="b" x1="49.009" x2="225.829" y1="213.75" y2="129.722" gradientUnits="userSpaceOnUse">
<stop stop-color="#E40035"></stop>
<stop offset=".24" stop-color="#F60A48"></stop>
<stop offset=".352" stop-color="#F20755"></stop>
<stop offset=".494" stop-color="#DC087D"></stop>
<stop offset=".745" stop-color="#9717E7"></stop>
<stop offset="1" stop-color="#6C00F5"></stop>
</linearGradient>
<linearGradient id="c" x1="41.025" x2="156.741" y1="28.344" y2="160.344" gradientUnits="userSpaceOnUse">
<stop stop-color="#FF31D9"></stop>
<stop offset="1" stop-color="#FF5BE1" stop-opacity="0"></stop>
</linearGradient>
<clipPath id="a">
<path fill="#fff" d="M0 0h223v236H0z"></path>
</clipPath>
</defs>
</svg>
</div>
</div>
}
}
</div>
| {
"end_byte": 4535,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools.component.html"
} |
angular/devtools/projects/ng-devtools/src/lib/frame_manager_spec.ts_0_8698 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {Events, MessageBus} from 'protocol';
import {FrameManager} from './frame_manager';
import {TestBed} from '@angular/core/testing';
import {Frame} from './application-environment';
describe('FrameManager', () => {
let frameManager: FrameManager;
let messageBus: MessageBus<Events>;
let topicToCallback: {[topic: string]: Function | null};
function getFrameFromFrameManager(frameId: number): Frame | undefined {
return frameManager.frames.find((f: Frame) => f.id === frameId);
}
function frameConnected(frameId: number): void {
topicToCallback['frameConnected']!(frameId);
}
function contentScriptConnected(frameId: number, name: string, url: string): void {
topicToCallback['contentScriptConnected']!(frameId, name, url);
}
function contentScriptDisconnected(frameId: number): void {
topicToCallback['contentScriptDisconnected']!(frameId);
}
const topLevelFrameId = 0;
const otherFrameId = 1;
const tabId = 123;
beforeEach(() => {
topicToCallback = {
frameConnected: null,
contentScriptConnected: null,
contentScriptDisconnected: null,
};
messageBus = jasmine.createSpyObj('MessageBus', ['on', 'emit']);
(messageBus.on as any).and.callFake((topic: string, cb: Function) => {
topicToCallback[topic] = cb;
});
(messageBus.emit as any).and.callFake((topic: string, args: any[]) => {
if (topic === 'enableFrameConnection') {
frameConnected(args[0]);
}
});
const testModule = TestBed.configureTestingModule({
providers: [
{provide: MessageBus, useValue: messageBus},
{provide: FrameManager, useFactory: () => FrameManager.initialize(123)},
],
});
frameManager = testModule.inject(FrameManager);
});
it('should add frame when contentScriptConnected event is emitted', () => {
contentScriptConnected(topLevelFrameId, 'name', 'http://localhost:4200/url');
expect(frameManager.frames.length).toBe(1);
expect(frameManager.frames[0].id).toBe(topLevelFrameId);
expect(frameManager.frames[0].name).toBe('name');
expect(frameManager.frames[0].url.toString()).toBe('http://localhost:4200/url');
});
it('should set the selected frame to the first frame when there is only one frame', () => {
contentScriptConnected(topLevelFrameId, 'name', 'http://localhost:4200/url');
expect(frameManager.selectedFrame?.id).toBe(topLevelFrameId);
});
it('should set selected frame when frameConnected event is emitted', () => {
contentScriptConnected(topLevelFrameId, 'name', 'http://localhost:4200/url');
contentScriptConnected(otherFrameId, 'name2', 'http://localhost:4200/url2');
frameConnected(otherFrameId);
expect(frameManager.selectedFrame?.id).toBe(otherFrameId);
});
it('should remove frame when contentScriptDisconnected event is emitted', () => {
contentScriptConnected(topLevelFrameId, 'name', 'http://localhost:4200/url');
contentScriptConnected(otherFrameId, 'name2', 'http://localhost:4200/url2');
expect(frameManager.frames.length).toBe(2);
contentScriptDisconnected(otherFrameId);
expect(frameManager.frames.length).toBe(1);
expect(frameManager.frames[0].id).toBe(topLevelFrameId);
const errorSpy = spyOn(console, 'error');
contentScriptDisconnected(topLevelFrameId);
expect(frameManager.frames.length).toBe(0);
expect(errorSpy).toHaveBeenCalledWith('Angular DevTools is not connected to any frames.');
});
it('should set selected frame to top level frame when contentScriptDisconnected event is emitted for selected frame', () => {
contentScriptConnected(topLevelFrameId, 'name', 'http://localhost:4200/url');
contentScriptConnected(otherFrameId, 'name2', 'http://localhost:4200/url2');
frameConnected(otherFrameId);
expect(frameManager.selectedFrame?.id).toBe(otherFrameId);
contentScriptDisconnected(otherFrameId);
expect(frameManager.selectedFrame?.id).toBe(topLevelFrameId);
});
it('should not set selected frame to top level frame when contentScriptDisconnected event is emitted for non selected frame', () => {
contentScriptConnected(topLevelFrameId, 'name', 'http://localhost:4200/url');
contentScriptConnected(otherFrameId, 'name2', 'http://localhost:4200/url2');
frameConnected(topLevelFrameId);
expect(frameManager.selectedFrame?.id).toBe(topLevelFrameId);
contentScriptDisconnected(otherFrameId);
expect(frameManager.selectedFrame?.id).toBe(topLevelFrameId);
});
it('should not set selected frame to top level frame when contentScriptDisconnected event is emitted for non existing frame', () => {
const nonExistingFrameId = 3;
contentScriptConnected(topLevelFrameId, 'name', 'http://localhost:4200/url');
contentScriptConnected(otherFrameId, 'name2', 'http://localhost:4200/url2');
frameConnected(otherFrameId);
expect(frameManager.selectedFrame?.id).toBe(otherFrameId);
contentScriptDisconnected(nonExistingFrameId);
expect(frameManager.selectedFrame?.id).toBe(otherFrameId);
});
it('isSelectedFrame should return true when frame matches selected frame', () => {
contentScriptConnected(topLevelFrameId, 'name', 'http://localhost:4200/url');
contentScriptConnected(otherFrameId, 'name2', 'http://localhost:4200/url2');
const topLevelFrame = getFrameFromFrameManager(topLevelFrameId);
const otherFrame = getFrameFromFrameManager(otherFrameId);
expect(topLevelFrame).toBeDefined();
expect(otherFrame).toBeDefined();
expect(frameManager.isSelectedFrame(topLevelFrame!)).toBe(true);
});
it('isSelectedFrame should return false when frame does not match selected frame', () => {
contentScriptConnected(topLevelFrameId, 'name', 'http://localhost:4200/url');
contentScriptConnected(otherFrameId, 'name2', 'http://localhost:4200/url2');
const topLevelFrame = getFrameFromFrameManager(topLevelFrameId);
const otherFrame = getFrameFromFrameManager(otherFrameId);
expect(topLevelFrame).toBeDefined();
expect(otherFrame).toBeDefined();
expect(frameManager.isSelectedFrame(otherFrame!)).toBe(false);
});
it('inspectFrame should emit enableFrameConnection message', () => {
contentScriptConnected(topLevelFrameId, 'name', 'http://localhost:4200/url');
const topLevelFrame = getFrameFromFrameManager(topLevelFrameId);
expect(topLevelFrame).toBeDefined();
frameManager.inspectFrame(topLevelFrame!);
expect(messageBus.emit).toHaveBeenCalledWith('enableFrameConnection', [topLevelFrameId, tabId]);
});
it('inspectFrame should set selected frame', () => {
contentScriptConnected(topLevelFrameId, 'name', 'http://localhost:4200/url');
contentScriptConnected(otherFrameId, 'name2', 'https://angular.dev/');
const topLevelFrame = getFrameFromFrameManager(topLevelFrameId);
expect(topLevelFrame).toBeDefined();
frameManager.inspectFrame(topLevelFrame!);
expect(frameManager.selectedFrame?.id).toBe(topLevelFrameId);
});
it('frameHasUniqueUrl should return false when a two frames have the same url', () => {
contentScriptConnected(topLevelFrameId, 'name', 'https://angular.dev/');
contentScriptConnected(otherFrameId, 'name2', 'https://angular.dev/');
expect(frameManager.selectedFrame?.url.toString()).toBe('https://angular.dev/');
expect(frameManager.frameHasUniqueUrl(frameManager.selectedFrame!)).toBe(false);
});
it('frameHasUniqueUrl should return true when only one frame has a given url', () => {
contentScriptConnected(topLevelFrameId, 'name', 'https://angular.dev/');
contentScriptConnected(otherFrameId, 'name', 'https://angular.dev/overview');
expect(frameManager.selectedFrame?.url.toString()).toBe('https://angular.dev/');
expect(frameManager.frameHasUniqueUrl(frameManager.selectedFrame!)).toBe(true);
});
it('frameHasUniqueUrl should not consider url fragments as part of the url comparison', () => {
contentScriptConnected(topLevelFrameId, 'name', 'https://angular.dev/guide/components');
contentScriptConnected(
otherFrameId,
'name',
'https://angular.dev/guide/components#using-components',
);
expect(frameManager.selectedFrame?.url.toString()).toBe('https://angular.dev/guide/components');
expect(frameManager.frameHasUniqueUrl(frameManager.selectedFrame!)).toBe(false);
});
it('frameHasUniqueUrl should return false when frame is null', () => {
expect(frameManager.frameHasUniqueUrl(null)).toBe(false);
});
});
| {
"end_byte": 8698,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/frame_manager_spec.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools_spec.ts_0_3440 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {Component, signal} from '@angular/core';
import {ComponentFixture, TestBed} from '@angular/core/testing';
import {FrameManager} from './frame_manager';
import {DevToolsComponent} from './devtools.component';
import {DevToolsTabsComponent} from './devtools-tabs/devtools-tabs.component';
import {MessageBus} from 'protocol';
@Component({
selector: 'ng-devtools-tabs',
template: '',
standalone: true,
})
export class MockNgDevToolsTabs {}
describe('DevtoolsComponent', () => {
let fixture: ComponentFixture<DevToolsComponent>;
let component: DevToolsComponent;
beforeEach(() => {
const mockMessageBus = jasmine.createSpyObj('MessageBus', ['on', 'emit', 'once']);
TestBed.configureTestingModule({
providers: [{provide: MessageBus, useValue: mockMessageBus}],
}).overrideComponent(DevToolsComponent, {
remove: {imports: [DevToolsTabsComponent], providers: [FrameManager]},
add: {
imports: [MockNgDevToolsTabs],
providers: [{provide: FrameManager, useFactory: () => FrameManager.initialize(123)}],
},
});
fixture = TestBed.createComponent(DevToolsComponent);
component = fixture.componentInstance;
});
it('should render ng devtools tabs when Angular Status is EXISTS and is in dev mode and is supported version', () => {
component.angularStatus = component.AngularStatus.EXISTS;
component.angularIsInDevMode = true;
component.angularVersion = signal('0.0.0');
component.ivy = signal(true);
fixture.detectChanges();
expect(fixture.nativeElement.querySelector('ng-devtools-tabs')).toBeTruthy();
});
it('should render Angular Devtools dev mode only support text when Angular Status is EXISTS and is angular is not in dev mode', () => {
component.angularStatus = component.AngularStatus.EXISTS;
component.angularIsInDevMode = false;
fixture.detectChanges();
expect(fixture.nativeElement.querySelector('.devtools').textContent).toContain(
'We detected an application built with production configuration. Angular DevTools only supports development builds.',
);
});
it('should render version support message when Angular Status is EXISTS and angular version is not supported', () => {
component.angularStatus = component.AngularStatus.EXISTS;
component.angularIsInDevMode = true;
component.angularVersion = signal('1.0.0');
fixture.detectChanges();
expect(fixture.nativeElement.querySelector('.devtools').textContent).toContain(
'Angular Devtools only supports Angular versions 12 and above',
);
});
it('should render Angular application not detected when Angular Status is DOES_NOT_EXIST', () => {
component.angularStatus = component.AngularStatus.DOES_NOT_EXIST;
fixture.detectChanges();
// expect the text to be "Angular application not detected"
expect(fixture.nativeElement.querySelector('.not-detected').textContent).toContain(
'Angular application not detected',
);
});
it('should render loading svg when Angular Status is UNKNOWN', () => {
component.angularStatus = component.AngularStatus.UNKNOWN;
fixture.detectChanges();
expect(fixture.nativeElement.querySelector('.loading svg')).toBeTruthy();
});
});
| {
"end_byte": 3440,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools_spec.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools.component.ts_0_4348 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {animate, style, transition, trigger} from '@angular/animations';
import {Platform} from '@angular/cdk/platform';
import {DOCUMENT} from '@angular/common';
import {
Component,
computed,
inject,
OnDestroy,
OnInit,
signal,
WritableSignal,
} from '@angular/core';
import {Events, MessageBus} from 'protocol';
import {interval} from 'rxjs';
import {FrameManager} from './frame_manager';
import {ThemeService} from './theme-service';
import {MatTooltip, MatTooltipModule} from '@angular/material/tooltip';
import {DevToolsTabsComponent} from './devtools-tabs/devtools-tabs.component';
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
import {Frame} from './application-environment';
const DETECT_ANGULAR_ATTEMPTS = 10;
enum AngularStatus {
/**
* This page may have Angular but we don't know yet. We're still trying to detect it.
*/
UNKNOWN,
/**
* We've given up on trying to detect Angular. We tried ${DETECT_ANGULAR_ATTEMPTS} times and
* failed.
*/
DOES_NOT_EXIST,
/**
* Angular was detected somewhere on the page.
*/
EXISTS,
}
const LAST_SUPPORTED_VERSION = 9;
@Component({
selector: 'ng-devtools',
templateUrl: './devtools.component.html',
styleUrls: ['./devtools.component.scss'],
animations: [
trigger('enterAnimation', [
transition(':enter', [style({opacity: 0}), animate('200ms', style({opacity: 1}))]),
transition(':leave', [style({opacity: 1}), animate('200ms', style({opacity: 0}))]),
]),
],
standalone: true,
imports: [DevToolsTabsComponent, MatTooltip, MatProgressSpinnerModule, MatTooltipModule],
})
export class DevToolsComponent implements OnInit, OnDestroy {
AngularStatus = AngularStatus;
angularStatus: AngularStatus = AngularStatus.UNKNOWN;
angularVersion: WritableSignal<string | undefined> = signal(undefined);
angularIsInDevMode = true;
hydration: boolean = false;
ivy: WritableSignal<boolean | undefined> = signal(undefined);
supportedVersion = computed(() => {
const version = this.angularVersion();
if (!version) {
return false;
}
const majorVersion = parseInt(version.toString().split('.')[0], 10);
// Check that major version is either greater or equal to the last supported version
// or that the major version is 0 for the (0.0.0-PLACEHOLDER) dev build case.
return (majorVersion >= LAST_SUPPORTED_VERSION || majorVersion === 0) && this.ivy();
});
private readonly _firefoxStyleName = 'firefox_styles.css';
private readonly _chromeStyleName = 'chrome_styles.css';
private readonly _messageBus = inject<MessageBus<Events>>(MessageBus);
private readonly _themeService = inject(ThemeService);
private readonly _platform = inject(Platform);
private readonly _document = inject(DOCUMENT);
private readonly _frameManager = inject(FrameManager);
private _interval$ = interval(500).subscribe((attempt) => {
if (attempt === DETECT_ANGULAR_ATTEMPTS) {
this.angularStatus = AngularStatus.DOES_NOT_EXIST;
}
this._messageBus.emit('queryNgAvailability');
});
inspectFrame(frame: Frame) {
this._frameManager.inspectFrame(frame);
}
ngOnInit(): void {
this._themeService.initializeThemeWatcher();
this._messageBus.once('ngAvailability', ({version, devMode, ivy, hydration}) => {
this.angularStatus = version ? AngularStatus.EXISTS : AngularStatus.DOES_NOT_EXIST;
this.angularVersion.set(version);
this.angularIsInDevMode = devMode;
this.ivy.set(ivy);
this._interval$.unsubscribe();
this.hydration = hydration;
});
const browserStyleName = this._platform.FIREFOX
? this._firefoxStyleName
: this._chromeStyleName;
this._loadStyle(browserStyleName);
}
/** Add a style file in header based on fileName */
private _loadStyle(styleName: string) {
const head = this._document.getElementsByTagName('head')[0];
const style = this._document.createElement('link');
style.rel = 'stylesheet';
style.href = `./styles/${styleName}`;
head.appendChild(style);
}
ngOnDestroy(): void {
this._interval$.unsubscribe();
}
}
| {
"end_byte": 4348,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools.component.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/BUILD.bazel_0_2405 | load("//devtools/tools:ng_module.bzl", "ng_module")
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
load("//devtools/tools:typescript.bzl", "ts_test_library")
load("//devtools/tools:defaults.bzl", "karma_web_test_suite")
package(default_visibility = ["//visibility:public"])
sass_binary(
name = "devtools_component_styles",
src = "devtools.component.scss",
)
ng_module(
name = "lib",
srcs = glob(
include = ["*.ts"],
exclude = [
"theme-service.ts",
"frame_manager.ts",
"*_spec.ts",
],
),
angular_assets = [
"devtools.component.html",
":devtools_component_styles",
],
deps = [
":frame_manager",
":theme",
"//devtools/projects/ng-devtools/src/lib/devtools-tabs",
"//devtools/projects/protocol",
"//packages/animations",
"//packages/common",
"//packages/core",
"//packages/forms",
"//packages/platform-browser-dynamic",
"@npm//@angular/cdk",
"@npm//@angular/material",
"@npm//@types",
"@npm//rxjs",
],
)
ts_test_library(
name = "devtools_test",
srcs = ["devtools_spec.ts"],
deps = [
":frame_manager",
":lib",
"//devtools/projects/ng-devtools/src/lib/devtools-tabs",
"//devtools/projects/protocol",
"//packages/core",
"//packages/core/testing",
],
)
karma_web_test_suite(
name = "test",
deps = [
":devtools_test",
],
)
ng_module(
name = "frame_manager",
srcs = glob(
include = ["frame_manager.ts"],
),
deps = [
"//devtools/projects/ng-devtools/src/lib/application-environment",
"//devtools/projects/protocol",
"//packages/core",
],
)
ts_test_library(
name = "test_frame_manager_lib",
srcs = [
"frame_manager_spec.ts",
],
deps = [
":frame_manager",
"//devtools/projects/ng-devtools/src/lib/application-environment",
"//devtools/projects/protocol",
"//packages/core/testing",
],
)
karma_web_test_suite(
name = "test_frame_manager",
deps = [
":test_frame_manager_lib",
],
)
ng_module(
name = "theme",
srcs = glob(
include = ["theme-service.ts"],
),
deps = [
"//packages/core",
"@npm//@types",
"@npm//rxjs",
],
)
| {
"end_byte": 2405,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/BUILD.bazel"
} |
angular/devtools/projects/ng-devtools/src/lib/frame_manager.ts_0_4187 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {Injectable, inject} from '@angular/core';
import {Events, MessageBus} from 'protocol';
import {Frame, TOP_LEVEL_FRAME_ID} from './application-environment';
@Injectable()
export class FrameManager {
private _selectedFrameId: number | null = null;
private _frames = new Map<number, Frame>();
private _inspectedWindowTabId: number | null = null;
private _frameUrlToFrameIds = new Map<string, Set<number>>();
private _messageBus = inject<MessageBus<Events>>(MessageBus);
get frames(): Frame[] {
return Array.from(this._frames.values());
}
get selectedFrame(): Frame | null {
if (this._selectedFrameId === null) {
return null;
}
return this._frames.get(this._selectedFrameId) ?? null;
}
static initialize(inspectedWindowTabIdTestOnly?: number | null) {
const manager = new FrameManager();
manager.initialize(inspectedWindowTabIdTestOnly);
return manager;
}
private initialize(inspectedWindowTabIdTestOnly?: number | null): void {
if (inspectedWindowTabIdTestOnly === undefined) {
this._inspectedWindowTabId = globalThis.chrome.devtools.inspectedWindow.tabId;
} else {
this._inspectedWindowTabId = inspectedWindowTabIdTestOnly;
}
this._messageBus.on('frameConnected', (frameId: number) => {
if (this._frames.has(frameId)) {
this._selectedFrameId = frameId;
}
});
this._messageBus.on('contentScriptConnected', (frameId: number, name: string, url: string) => {
// fragments are not considered when doing URL matching on a page
// https://bugs.chromium.org/p/chromium/issues/detail?id=841429
const urlWithoutHash = new URL(url);
urlWithoutHash.hash = '';
this.addFrame({name, id: frameId, url: urlWithoutHash});
if (this.frames.length === 1) {
this.inspectFrame(this._frames.get(frameId)!);
}
});
this._messageBus.on('contentScriptDisconnected', (frameId: number) => {
if (!this._frames.has(frameId)) {
return;
}
this.removeFrame(this._frames.get(frameId)!);
// Defensive check. This case should never happen, since we're always connected to at least
// the top level frame.
if (this.frames.length === 0) {
this._selectedFrameId = null;
console.error('Angular DevTools is not connected to any frames.');
return;
}
if (frameId === this._selectedFrameId) {
this._selectedFrameId = TOP_LEVEL_FRAME_ID;
this.inspectFrame(this._frames.get(this._selectedFrameId!)!);
return;
}
});
}
isSelectedFrame(frame: Frame): boolean {
return this._selectedFrameId === frame.id;
}
inspectFrame(frame: Frame): void {
if (this._inspectedWindowTabId === null) {
return;
}
if (!this._frames.has(frame.id)) {
throw new Error('Attempted to inspect a frame that is not connected to Angular DevTools.');
}
this._selectedFrameId = null;
this._messageBus.emit('enableFrameConnection', [frame.id, this._inspectedWindowTabId]);
}
frameHasUniqueUrl(frame: Frame | null): boolean {
if (frame === null) {
return false;
}
const frameUrl = frame.url.toString();
const frameIds = this._frameUrlToFrameIds.get(frameUrl) ?? new Set<number>();
return frameIds.size === 1;
}
private addFrame(frame: Frame): void {
this._frames.set(frame.id, frame);
const frameUrl = frame.url.toString();
const frameIdSet = this._frameUrlToFrameIds.get(frameUrl) ?? new Set<number>();
frameIdSet.add(frame.id);
this._frameUrlToFrameIds.set(frameUrl, frameIdSet);
}
private removeFrame(frame: Frame): void {
const frameId = frame.id;
const frameUrl = frame.url.toString();
const urlFrameIds = this._frameUrlToFrameIds.get(frameUrl) ?? new Set<number>();
urlFrameIds.delete(frameId);
if (urlFrameIds.size === 0) {
this._frameUrlToFrameIds.delete(frameUrl);
}
this._frames.delete(frameId);
}
}
| {
"end_byte": 4187,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/frame_manager.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/theme-service.ts_0_1322 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {Injectable, Renderer2, RendererFactory2, signal} from '@angular/core';
export type Theme = 'dark-theme' | 'light-theme';
@Injectable({
providedIn: 'root',
})
export class ThemeService {
private renderer: Renderer2;
readonly currentTheme = signal<Theme>('light-theme');
constructor(private _rendererFactory: RendererFactory2) {
this.renderer = this._rendererFactory.createRenderer(null, null);
this.toggleDarkMode(this._prefersDarkMode);
}
toggleDarkMode(isDark: boolean): void {
const removeClass = isDark ? 'light-theme' : 'dark-theme';
const addClass = !isDark ? 'light-theme' : 'dark-theme';
this.renderer.removeClass(document.body, removeClass);
this.renderer.addClass(document.body, addClass);
this.currentTheme.set(addClass);
}
initializeThemeWatcher(): void {
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {
this.toggleDarkMode(this._prefersDarkMode);
});
}
private get _prefersDarkMode(): boolean {
return window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
}
}
| {
"end_byte": 1322,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/theme-service.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/application-environment/BUILD.bazel_0_271 | load("//devtools/tools:typescript.bzl", "ts_library")
package(default_visibility = ["//visibility:public"])
ts_library(
name = "application-environment",
srcs = ["index.ts"],
deps = [
"//devtools/projects/protocol",
"@npm//@types",
],
)
| {
"end_byte": 271,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/application-environment/BUILD.bazel"
} |
angular/devtools/projects/ng-devtools/src/lib/application-environment/index.ts_0_503 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
export interface Environment {
production: boolean;
}
export const TOP_LEVEL_FRAME_ID = 0;
export interface Frame {
id: number;
name: string;
url: URL;
}
export abstract class ApplicationEnvironment {
abstract get environment(): Environment;
abstract frameSelectorEnabled: boolean;
}
| {
"end_byte": 503,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/application-environment/index.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/devtools-tabs.component.scss_0_2150 | :host {
position: relative;
width: 100%;
height: 100%;
display: block;
}
.hidden {
display: none;
}
ng-injector-tree.hidden {
display: block;
visibility: hidden;
position: absolute;
top: 0;
}
.tab-content {
position: relative;
height: calc(100% - 31px);
}
#nav-buttons {
display: flex;
button {
background: none;
border: none;
cursor: pointer;
opacity: 0.8;
&:active {
opacity: 1
}
}
}
:host-context(.dark-theme) {
#nav-buttons {
button {
color: #fff;
}
}
}
.inspector-active {
color: #1a73e8 !important;
}
#app-angular-version {
align-self: center;
margin-left: auto;
margin-right: 8px;
font-size: 0.8em;
font-weight: bold;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
#version-number {
color: #1b1aa5;
cursor: text;
-moz-user-select: text;
-khtml-user-select: text;
-webkit-user-select: text;
-ms-user-select: text;
user-select: text;
&.unsupported-version {
color: red;
}
}
mat-icon {
font-size: 20px;
display: flex;
justify-content: center;
align-items: center;
}
.mat-mdc-tab-link {
min-width: unset;
line-height: 30px;
height: 30px;
font-size: 13px;
padding: 0px 10px;
opacity: 1;
font-weight: 400;
}
:host-context(.dark-theme) {
#version-number {
color: #5caace;
&.unsupported-version {
color: red;
}
}
.inspector-active {
color: #4688f1 !important;
}
}
@media only screen and (max-width: 700px) {
#app-angular-version {
max-width: 135px;
}
}
@media only screen and (max-width: 420px) {
#app-angular-version {
display: none;
}
}
.mat-mdc-tab-header {
--mdc-secondary-navigation-tab-container-height: 30px;
}
.mat-mdc-menu-item.mdc-list-item {
::ng-deep {
label {
cursor: pointer;
}
}
}
.frame-selector {
background-color: #e2e2e2;
border-radius: 2px;
color: #474747;
border: none;
margin: 4px 4px 2px 4px;
padding: 2px;
outline-offset: -2px;
width: 100px;
font-size: 12px;
}
:host-context(.dark-theme) {
.frame-selector {
background-color: #464646;
color: #fff;
}
}
| {
"end_byte": 2150,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/devtools-tabs.component.scss"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/devtools-tabs.component.html_0_3914 | <nav class="devtools-nav" #navBar mat-tab-nav-bar mat-stretch-tabs="false" [disablePagination]="true" [color]="'accent'" [tabPanel]="tabPanel">
<div id="nav-buttons">
<button (click)="toggleInspector()" matTooltip="Inspect element">
<mat-icon [class.inspector-active]="inspectorRunning()"> pin_end </mat-icon>
</button>
<button [matMenuTriggerFor]="menu" matTooltip="Open settings">
<mat-icon> settings </mat-icon>
</button>
<button [matMenuTriggerFor]="info" matTooltip="Info">
<mat-icon> info </mat-icon>
</button>
</div>
<select matTooltip="Select a frame to inspect with Angular Devtools" class="frame-selector" (change)="emitSelectedFrame($event.target.value)">
@for (frame of frameManager.frames; track frame.id) {
<option [value]="frame.id" [selected]="frameManager.isSelectedFrame(frame)">
@if (frame.id === TOP_LEVEL_FRAME_ID) {
top
} @else {
{{ frame.name }} ({{ frame.id }})
}
</option>
} @empty {
<option value="0" selected>top</option>
}
</select>
@for (tab of tabs(); track $index) {
<a class="mat-tab-link" mat-tab-link (click)="changeTab(tab)" [active]="activeTab() === tab">
{{ tab }}
</a>
}
@if (angularVersion()) {
<section id="app-angular-version">
Angular version:
@if (majorAngularVersion() > 12 || majorAngularVersion() == 0) {
<span id="version-number">
{{ angularVersion() }}
</span>
} @else {
<span
id="version-number"
matTooltip="
Angular Devtools supports Angular versions 12 and above. Some DevTools features may be available in
older versions of Angular, but it is not officially supported.
"
class="unsupported-version"
>
{{ angularVersion() }} (unsupported)
</span>
}
| DevTools: {{ extensionVersion() }}
</section>
}
</nav>
<mat-tab-nav-panel #tabPanel>
@if (!applicationEnvironment.frameSelectorEnabled || frameManager.selectedFrame !== null) {
<div class="tab-content">
<ng-directive-explorer
[showCommentNodes]="showCommentNodes()"
[isHydrationEnabled]="isHydrationEnabled()"
[class.hidden]="activeTab() !== 'Components'"
(toggleInspector)="toggleInspector()"
/>
<ng-profiler [class.hidden]="activeTab() !== 'Profiler'"/>
<ng-router-tree [routes]="routes()" [class.hidden]="activeTab() !== 'Router Tree'"/>
<ng-injector-tree [class.hidden]="activeTab() !== 'Injector Tree'"/>
</div>
}
</mat-tab-nav-panel>
<mat-menu #menu="matMenu">
<div (click)="$event.stopPropagation()">
@if (!profilingNotificationsSupported) {
<label mat-menu-item disableRipple>
<mat-slide-toggle [checked]="timingAPIEnabled()" (change)="toggleTimingAPI()">
Enable timing API
</mat-slide-toggle>
</label>
}
<label mat-menu-item disableRipple>
@let currentTheme = themeService.currentTheme();
<mat-slide-toggle [checked]="currentTheme === 'dark-theme'" (click)="themeService.toggleDarkMode(currentTheme === 'light-theme')">
Dark Mode
</mat-slide-toggle>
</label>
<label mat-menu-item disableRipple>
<mat-slide-toggle [checked]="showCommentNodes()" (change)="showCommentNodes.set($event.checked)">
Show comment nodes
</mat-slide-toggle>
</label>
</div>
</mat-menu>
<mat-menu #info="matMenu">
<a mat-menu-item href="https://angular.dev/tools/devtools" target="_blank">
<mat-icon>library_books</mat-icon>
Guide
</a>
<a mat-menu-item href="https://github.com/angular/angular" target="_blank">
<mat-icon>launch</mat-icon>
GitHub
</a>
<a mat-menu-item href="https://github.com/angular/angular/issues" target="_blank">
<mat-icon>bug_report</mat-icon>
Issues
</a>
</mat-menu>
| {
"end_byte": 3914,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/devtools-tabs.component.html"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/devtools-tabs.spec.ts_0_3710 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {Component} from '@angular/core';
import {TestBed} from '@angular/core/testing';
import {MatMenuModule} from '@angular/material/menu';
import {MatTooltip} from '@angular/material/tooltip';
import {Events, MessageBus} from 'protocol';
import {Subject} from 'rxjs';
import {ApplicationEnvironment} from '../application-environment';
import {Theme, ThemeService} from '../theme-service';
import {DevToolsTabsComponent} from './devtools-tabs.component';
import {TabUpdate} from './tab-update/index';
import {DirectiveExplorerComponent} from './directive-explorer/directive-explorer.component';
import {FrameManager} from '../frame_manager';
@Component({
selector: 'ng-directive-explorer',
template: '',
standalone: true,
imports: [MatTooltip, MatMenuModule],
})
export class MockDirectiveExplorerComponent {}
describe('DevtoolsTabsComponent', () => {
let messageBusMock: MessageBus<Events>;
let applicationEnvironmentMock: ApplicationEnvironment;
let comp: DevToolsTabsComponent;
beforeEach(() => {
messageBusMock = jasmine.createSpyObj('messageBus', ['on', 'once', 'emit', 'destroy']);
applicationEnvironmentMock = jasmine.createSpyObj('applicationEnvironment', ['environment']);
TestBed.configureTestingModule({
imports: [MatTooltip, MatMenuModule, DevToolsTabsComponent],
providers: [
TabUpdate,
{provide: ThemeService, useFactory: () => ({currentTheme: new Subject<Theme>()})},
{provide: MessageBus, useValue: messageBusMock},
{provide: ApplicationEnvironment, useValue: applicationEnvironmentMock},
{provide: FrameManager, useFactory: () => FrameManager.initialize(123)},
],
}).overrideComponent(DevToolsTabsComponent, {
remove: {imports: [DirectiveExplorerComponent]},
add: {imports: [MockDirectiveExplorerComponent]},
});
const fixture = TestBed.createComponent(DevToolsTabsComponent);
comp = fixture.componentInstance;
});
it('should create instance from class', () => {
expect(comp).toBeTruthy();
});
it('toggles inspector flag', () => {
expect(comp.inspectorRunning()).toBe(false);
comp.toggleInspectorState();
expect(comp.inspectorRunning()).toBe(true);
comp.toggleInspectorState();
expect(comp.inspectorRunning()).toBe(false);
});
it('emits inspector event', () => {
comp.toggleInspector();
expect(messageBusMock.emit).toHaveBeenCalledTimes(1);
expect(messageBusMock.emit).toHaveBeenCalledWith('inspectorStart');
comp.toggleInspector();
expect(messageBusMock.emit).toHaveBeenCalledTimes(3);
expect(messageBusMock.emit).toHaveBeenCalledWith('inspectorEnd');
expect(messageBusMock.emit).toHaveBeenCalledWith('removeHighlightOverlay');
});
it('should emit a selectedFrame when emitSelectedFrame is called', () => {
let contentScriptConnected: Function = () => {};
// mock message bus on method with jasmine fake call in order to pick out callback
// and call it with frame
(messageBusMock.on as any).and.callFake((topic: string, cb: Function) => {
if (topic === 'contentScriptConnected') {
contentScriptConnected = cb;
}
});
const frameId = 1;
expect(contentScriptConnected).toEqual(jasmine.any(Function));
contentScriptConnected(frameId, 'name', 'http://localhost:4200/url');
spyOn(comp.frameSelected, 'emit');
comp.emitSelectedFrame('1');
expect(comp.frameSelected.emit).toHaveBeenCalledWith(comp.frameManager.frames[0]);
});
});
| {
"end_byte": 3710,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/devtools-tabs.spec.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/devtools-tabs.component.ts_0_4369 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {Component, computed, inject, input, output, signal} from '@angular/core';
import {MatIcon} from '@angular/material/icon';
import {MatMenu, MatMenuItem, MatMenuTrigger} from '@angular/material/menu';
import {MatSlideToggle} from '@angular/material/slide-toggle';
import {MatTabLink, MatTabNav, MatTabNavPanel} from '@angular/material/tabs';
import {MatTooltip} from '@angular/material/tooltip';
import {Events, MessageBus, Route} from 'protocol';
import {ApplicationEnvironment, Frame, TOP_LEVEL_FRAME_ID} from '../application-environment/index';
import {FrameManager} from '../frame_manager';
import {Theme, ThemeService} from '../theme-service';
import {DirectiveExplorerComponent} from './directive-explorer/directive-explorer.component';
import {InjectorTreeComponent} from './injector-tree/injector-tree.component';
import {ProfilerComponent} from './profiler/profiler.component';
import {RouterTreeComponent} from './router-tree/router-tree.component';
import {TabUpdate} from './tab-update/index';
type Tabs = 'Components' | 'Profiler' | 'Router Tree' | 'Injector Tree';
@Component({
selector: 'ng-devtools-tabs',
templateUrl: './devtools-tabs.component.html',
styleUrls: ['./devtools-tabs.component.scss'],
standalone: true,
imports: [
MatTabNav,
MatTabNavPanel,
MatTooltip,
MatIcon,
MatMenu,
MatMenuItem,
MatMenuTrigger,
MatTabLink,
DirectiveExplorerComponent,
ProfilerComponent,
RouterTreeComponent,
InjectorTreeComponent,
MatSlideToggle,
],
providers: [TabUpdate],
})
export class DevToolsTabsComponent {
readonly isHydrationEnabled = input(false);
readonly frameSelected = output<Frame>();
readonly applicationEnvironment = inject(ApplicationEnvironment);
readonly activeTab = signal<Tabs>('Components');
readonly inspectorRunning = signal(false);
readonly showCommentNodes = signal(false);
readonly timingAPIEnabled = signal(false);
readonly routes = signal<Route[]>([]);
readonly frameManager = inject(FrameManager);
readonly tabs = computed<Tabs[]>(() => {
const alwaysShown: Tabs[] = ['Components', 'Profiler', 'Injector Tree'];
return this.routes().length === 0 ? alwaysShown : [...alwaysShown, 'Router Tree'];
});
profilingNotificationsSupported = Boolean(
(window.chrome?.devtools as any)?.performance?.onProfilingStarted,
);
TOP_LEVEL_FRAME_ID = TOP_LEVEL_FRAME_ID;
readonly angularVersion = input<string | undefined>(undefined);
readonly majorAngularVersion = computed(() => {
const version = this.angularVersion();
if (!version) {
return -1;
}
return parseInt(version.toString().split('.')[0], 10);
});
readonly extensionVersion = signal('Development Build');
public tabUpdate = inject(TabUpdate);
public themeService = inject(ThemeService);
private _messageBus = inject<MessageBus<Events>>(MessageBus);
constructor() {
this._messageBus.on('updateRouterTree', (routes) => {
this.routes.set(routes || []);
});
if (typeof chrome !== 'undefined' && chrome.runtime !== undefined) {
this.extensionVersion.set(chrome.runtime.getManifest().version);
}
}
emitSelectedFrame(frameId: string): void {
const frame = this.frameManager.frames.find((frame) => frame.id === parseInt(frameId, 10));
this.frameSelected.emit(frame!);
}
changeTab(tab: Tabs): void {
this.activeTab.set(tab);
this.tabUpdate.notify(tab);
if (tab === 'Router Tree') {
this._messageBus.emit('getRoutes');
}
}
toggleInspector(): void {
this.toggleInspectorState();
this.emitInspectorEvent();
}
emitInspectorEvent(): void {
if (this.inspectorRunning()) {
this._messageBus.emit('inspectorStart');
} else {
this._messageBus.emit('inspectorEnd');
this._messageBus.emit('removeHighlightOverlay');
}
}
toggleInspectorState(): void {
this.inspectorRunning.update((state) => !state);
}
toggleTimingAPI(): void {
this.timingAPIEnabled.update((state) => !state);
this.timingAPIEnabled()
? this._messageBus.emit('enableTimingAPI')
: this._messageBus.emit('disableTimingAPI');
}
}
| {
"end_byte": 4369,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/devtools-tabs.component.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/BUILD.bazel_0_2330 | load("//devtools/tools:ng_module.bzl", "ng_module")
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
load("//devtools/tools:typescript.bzl", "ts_test_library")
load("//devtools/tools:defaults.bzl", "karma_web_test_suite")
package(default_visibility = ["//visibility:public"])
sass_binary(
name = "devtools_tabs_component_styles",
src = "devtools-tabs.component.scss",
)
ng_module(
name = "devtools-tabs",
srcs = [
"devtools-tabs.component.ts",
],
angular_assets = [
"devtools-tabs.component.html",
":devtools_tabs_component_styles",
],
deps = [
"//devtools/projects/ng-devtools/src/lib:frame_manager",
"//devtools/projects/ng-devtools/src/lib:theme",
"//devtools/projects/ng-devtools/src/lib/application-environment",
"//devtools/projects/ng-devtools/src/lib/devtools-tabs/directive-explorer",
"//devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree:injector_tree",
"//devtools/projects/ng-devtools/src/lib/devtools-tabs/profiler",
"//devtools/projects/ng-devtools/src/lib/devtools-tabs/router-tree",
"//devtools/projects/ng-devtools/src/lib/devtools-tabs/tab-update",
"//devtools/projects/protocol",
"//packages/common",
"//packages/core",
"//packages/core/src/util",
"@npm//@angular/material",
"@npm//@types",
"@npm//rxjs",
],
)
ts_test_library(
name = "devtools_tabs_test",
srcs = ["devtools-tabs.spec.ts"],
deps = [
":devtools-tabs",
"//devtools/projects/ng-devtools/src/lib:frame_manager",
"//devtools/projects/ng-devtools/src/lib:theme",
"//devtools/projects/ng-devtools/src/lib/application-environment",
"//devtools/projects/ng-devtools/src/lib/devtools-tabs/directive-explorer",
"//devtools/projects/ng-devtools/src/lib/devtools-tabs/tab-update",
"//devtools/projects/protocol",
"//packages/common",
"//packages/core",
"//packages/core/src/util",
"//packages/core/testing",
"@npm//@angular/material",
"@npm//rxjs",
],
)
karma_web_test_suite(
name = "test",
deps = [
":devtools_tabs_test",
"//packages/common/http",
"//packages/platform-browser/animations",
],
)
| {
"end_byte": 2330,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/BUILD.bazel"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree.component.ts_0_1212 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {
afterNextRender,
Component,
ElementRef,
inject,
NgZone,
signal,
viewChild,
} from '@angular/core';
import {MatCheckbox} from '@angular/material/checkbox';
import {MatIcon} from '@angular/material/icon';
import {MatTooltip} from '@angular/material/tooltip';
import {
ComponentExplorerView,
DevToolsNode,
Events,
MessageBus,
SerializedInjector,
SerializedProviderRecord,
} from 'protocol';
import {SplitAreaDirective, SplitComponent} from '../../vendor/angular-split/public_api';
import {
InjectorTreeD3Node,
InjectorTreeVisualizer,
} from '../dependency-injection/injector-tree-visualizer';
import {InjectorProvidersComponent} from './injector-providers.component';
import {
filterOutAngularInjectors,
filterOutInjectorsWithNoProviders,
generateEdgeIdsFromNodeIds,
getInjectorIdsToRootFromNode,
grabInjectorPathsFromDirectiveForest,
splitInjectorPathsIntoElementAndEnvironmentPaths,
transformInjectorResolutionPathsIntoTree,
} from './injector-tree-fns'; | {
"end_byte": 1212,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree.component.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree.component.ts_1214_9086 | @Component({
standalone: true,
selector: 'ng-injector-tree',
imports: [
SplitComponent,
SplitAreaDirective,
InjectorProvidersComponent,
MatIcon,
MatTooltip,
MatCheckbox,
],
templateUrl: `./injector-tree.component.html`,
styleUrls: ['./injector-tree.component.scss'],
})
export class InjectorTreeComponent {
private svgContainer = viewChild.required<ElementRef>('svgContainer');
private g = viewChild.required<ElementRef>('mainGroup');
private elementSvgContainer = viewChild.required<ElementRef>('elementSvgContainer');
private elementG = viewChild.required<ElementRef>('elementMainGroup');
private _messageBus = inject(MessageBus) as MessageBus<Events>;
zone = inject(NgZone);
firstRender = true;
readonly selectedNode = signal<InjectorTreeD3Node | null>(null);
rawDirectiveForest: DevToolsNode[] = [];
injectorTreeGraph!: InjectorTreeVisualizer;
elementInjectorTreeGraph!: InjectorTreeVisualizer;
readonly diDebugAPIsAvailable = signal(false);
readonly providers = signal<SerializedProviderRecord[]>([]);
elementToEnvironmentPath: Map<string, SerializedInjector[]> = new Map();
hideInjectorsWithNoProviders = false;
hideFrameworkInjectors = false;
constructor() {
afterNextRender({
write: () => {
this.init();
this.setUpEnvironmentInjectorVisualizer();
this.setUpElementInjectorVisualizer();
},
});
}
private init() {
this._messageBus.on('latestComponentExplorerView', (view: ComponentExplorerView) => {
if (view.forest[0].resolutionPath !== undefined) {
this.diDebugAPIsAvailable.set(true);
this.rawDirectiveForest = view.forest;
this.updateInjectorTreeVisualization(view.forest);
}
});
this._messageBus.on(
'latestInjectorProviders',
(_: SerializedInjector, providers: SerializedProviderRecord[]) => {
this.providers.set(
Array.from(providers).sort((a, b) => {
return a.token.localeCompare(b.token);
}),
);
},
);
this._messageBus.on('highlightComponent', (id: number) => {
const injectorNode = this.getNodeByComponentId(this.elementInjectorTreeGraph, id);
if (injectorNode === null) {
return;
}
this.selectInjectorByNode(injectorNode);
});
}
toggleHideInjectorsWithNoProviders(): void {
this.hideInjectorsWithNoProviders = !this.hideInjectorsWithNoProviders;
this.refreshVisualizer();
}
toggleHideAngularInjectors(): void {
this.hideFrameworkInjectors = !this.hideFrameworkInjectors;
this.refreshVisualizer();
}
private refreshVisualizer(): void {
this.updateInjectorTreeVisualization(this.rawDirectiveForest);
if (this.selectedNode()?.data?.injector?.type === 'environment') {
this.snapToRoot(this.elementInjectorTreeGraph);
}
if (this.selectedNode()) {
this.selectInjectorByNode(this.selectedNode()!);
}
}
/**
*
* Converts the array of resolution paths for every node in the
* directive forest into a tree structure that can be rendered by the
* injector tree visualizer.
*
*/
updateInjectorTreeVisualization(forestWithInjectorPaths: DevToolsNode[]): void {
this.zone.runOutsideAngular(() => {
// At this point we have a forest of directive trees where each node has a resolution path.
// We want to convert this nested forest into an array of resolution paths.
// Our ultimate goal is to convert this array of resolution paths into a tree structure.
// Directive forest -> Array of resolution paths -> Tree of resolution paths
// First, pick out the resolution paths.
let injectorPaths = grabInjectorPathsFromDirectiveForest(forestWithInjectorPaths);
if (this.hideFrameworkInjectors) {
injectorPaths = filterOutAngularInjectors(injectorPaths);
}
if (this.hideInjectorsWithNoProviders) {
injectorPaths = filterOutInjectorsWithNoProviders(injectorPaths);
}
// In Angular we have two types of injectors, element injectors and environment injectors.
// We want to split the resolution paths into two groups, one for each type of injector.
const {elementPaths, environmentPaths, startingElementToEnvironmentPath} =
splitInjectorPathsIntoElementAndEnvironmentPaths(injectorPaths);
this.elementToEnvironmentPath = startingElementToEnvironmentPath;
// Here for our 2 groups of resolution paths, we want to convert them into a tree structure.
const elementInjectorTree = transformInjectorResolutionPathsIntoTree(elementPaths);
const environmentInjectorTree = transformInjectorResolutionPathsIntoTree(environmentPaths);
this.elementInjectorTreeGraph.render(elementInjectorTree);
this.elementInjectorTreeGraph.onNodeClick((_, node) => {
this.selectInjectorByNode(node);
});
this.injectorTreeGraph.render(environmentInjectorTree);
this.injectorTreeGraph.onNodeClick((_, node) => {
this.selectInjectorByNode(node);
});
if (this.firstRender) {
this.snapToRoot(this.injectorTreeGraph);
this.snapToRoot(this.elementInjectorTreeGraph);
}
this.highlightPathFromSelectedInjector();
this.firstRender = false;
});
}
snapToRoot(graph: InjectorTreeVisualizer) {
// wait for CD to run before snapping to root so that svg container can change size.
setTimeout(() => {
if (graph.root?.children) {
graph.snapToNode(graph.root.children[0], 0.7);
}
});
}
snapToNode(node: InjectorTreeD3Node) {
// wait for CD to run before snapping to root so that svg container can change size.
setTimeout(() => {
if (node.data.injector.type === 'element') {
this.elementInjectorTreeGraph.snapToNode(node);
} else if (node.data.injector.type === 'environment') {
this.injectorTreeGraph.snapToNode(node);
}
});
}
checkIfSelectedNodeStillExists(): void {
const selectedNode = this.selectedNode();
if (selectedNode === null) {
this.snapToRoot(this.injectorTreeGraph);
this.snapToRoot(this.elementInjectorTreeGraph);
return;
}
const injector = selectedNode.data.injector;
if (injector.type === 'element') {
const node = this.elementInjectorTreeGraph.getNodeById(injector.id);
if (node) {
this.selectedNode.set(node);
return;
}
}
if (injector.type === 'environment') {
const node = this.injectorTreeGraph.getNodeById(injector.id);
if (node) {
this.selectedNode.set(node);
return;
}
}
this.selectedNode.set(null);
this.snapToRoot(this.injectorTreeGraph);
this.snapToRoot(this.elementInjectorTreeGraph);
}
getNodeByComponentId(graph: InjectorTreeVisualizer, id: number): InjectorTreeD3Node | null {
const graphElement = graph.graphElement;
const element = graphElement.querySelector(`.node[data-component-id="${id}"]`);
if (element === null) {
return null;
}
const injectorId = element.getAttribute('data-id');
if (injectorId === null) {
return null;
}
return graph.getNodeById(injectorId);
}
setUpEnvironmentInjectorVisualizer(): void {
const svg = this.svgContainer()?.nativeElement;
const g = this.g()?.nativeElement;
if (!svg || !g) {
return;
}
this.injectorTreeGraph?.cleanup?.();
this.injectorTreeGraph = new InjectorTreeVisualizer(svg, g);
}
setUpElementInjectorVisualizer(): void {
const svg = this.elementSvgContainer()?.nativeElement;
const g = this.elementG()?.nativeElement;
if (!svg || !g) {
return;
}
this.elementInjectorTreeGraph?.cleanup?.();
this.elementInjectorTreeGraph = new InjectorTreeVisualizer(svg, g, {nodeSeparation: () => 1});
} | {
"end_byte": 9086,
"start_byte": 1214,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree.component.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree.component.ts_9090_12058 | highlightPathFromSelectedInjector(): void {
this.unhighlightAllEdges(this.elementG());
this.unhighlightAllNodes(this.elementG());
this.unhighlightAllEdges(this.g());
this.unhighlightAllNodes(this.g());
this.checkIfSelectedNodeStillExists();
if (this.selectedNode() === null) {
return;
}
if (this.selectedNode()!.data.injector.type === 'element') {
const idsToRoot = getInjectorIdsToRootFromNode(this.selectedNode()!);
idsToRoot.forEach((id) => this.highlightNodeById(this.elementG(), id));
const edgeIds = generateEdgeIdsFromNodeIds(idsToRoot);
edgeIds.forEach((edgeId) => this.highlightEdgeById(this.elementG(), edgeId));
const environmentPath =
this.elementToEnvironmentPath.get(this.selectedNode()!.data.injector.id) ?? [];
environmentPath.forEach((injector) => this.highlightNodeById(this.g(), injector.id));
const environmentEdgeIds = generateEdgeIdsFromNodeIds(
environmentPath.map((injector) => injector.id),
);
environmentEdgeIds.forEach((edgeId) => this.highlightEdgeById(this.g(), edgeId));
} else {
const idsToRoot = getInjectorIdsToRootFromNode(this.selectedNode()!);
idsToRoot.forEach((id) => this.highlightNodeById(this.g(), id));
const edgeIds = generateEdgeIdsFromNodeIds(idsToRoot);
edgeIds.forEach((edgeId) => this.highlightEdgeById(this.g(), edgeId));
}
}
highlightNodeById(graphElement: ElementRef, id: string): void {
const node = graphElement.nativeElement.querySelector(`.node[data-id="${id}"]`);
if (!node) {
return;
}
if (this.selectedNode()!.data.injector.id === id) {
node.classList.add('selected');
}
node.classList.add('highlighted');
}
highlightEdgeById(graphElement: ElementRef, id: string): void {
const edge = graphElement.nativeElement.querySelector(`.link[data-id="${id}"]`);
if (!edge) {
return;
}
edge.classList.add('highlighted');
}
unhighlightAllEdges(graphElement: ElementRef): void {
const edges = graphElement.nativeElement.querySelectorAll('.link');
for (const edge of edges) {
edge.classList.remove('highlighted');
}
}
unhighlightAllNodes(graphElement: ElementRef): void {
const nodes = graphElement.nativeElement.querySelectorAll('.node');
for (const node of nodes) {
node.classList.remove('selected');
node.classList.remove('highlighted');
}
}
selectInjectorByNode(node: InjectorTreeD3Node): void {
this.selectedNode.set(node);
this.highlightPathFromSelectedInjector();
this.snapToNode(this.selectedNode()!);
this.getProviders();
}
getProviders() {
if (this.selectedNode() === null) {
return;
}
const injector = this.selectedNode()!.data.injector;
this._messageBus.emit('getInjectorProviders', [
{
id: injector.id,
type: injector.type,
name: injector.name,
},
]);
}
} | {
"end_byte": 12058,
"start_byte": 9090,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree.component.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree.component.scss_0_3442 | :host {
width: 100%;
height: 100%;
overflow: auto;
position: relative;
}
.hidden {
visibility: hidden;
}
.not-supported {
margin-top: 16px;
}
::ng-deep {
.as-split-gutter-icon {
display: none;
}
}
as-split-area {
overflow: auto !important;
}
:host {
::ng-deep {
.mat-tab-label {
min-width: unset;
line-height: 30px;
height: 30px;
font-size: 13px;
padding: 0px 10px;
opacity: 1;
font-weight: 400;
}
.mat-expansion-panel-header-title {
font-size: 0.8em;
font-family: Menlo, monospace;
}
.mat-expansion-panel-header {
padding: 0 15px;
.documentation {
display: flex;
align-self: center;
text-decoration: none;
}
.docs-link {
color: #000000de;
height: inherit;
width: fit-content;
font-size: initial;
padding-left: 0.1rem;
&:active {
color: #1b1aa5;
}
}
}
.mat-expansion-panel-body {
padding: 0;
}
.mat-tab-label {
// padding: 0;
min-width: unset;
}
.injector-param {
display: flex;
align-items: center;
.details {
display: flex;
text-align: center;
justify-content: center;
width: 200px;
height: 90px;
flex-shrink: 0;
align-items: center;
border-right: 1px solid #e8e8e8;
}
ng-resolution-path {
width: 100%;
overflow: auto;
}
.parameter {
width: 100%;
}
.icon {
display: flex;
cursor: pointer;
mat-icon {
font-size: 18px;
display: flex;
align-items: center;
justify-content: center;
}
&:hover {
opacity: 0.8;
}
}
.parameter-name {
color: #d23a32;
}
.parameter-flag {
a {
display: inline-block;
padding: 0px 6px;
background: #dddddd;
border-radius: 10px;
color: inherit;
text-decoration: none;
&:hover {
background: #c6c6c6;
}
}
}
}
}
}
:host-context(.dark-theme) {
.deps {
background: #161515;
}
}
.deps {
display: flex;
overflow: auto;
background: #f5f5f5;
.dep {
border-top: 1px solid #e8e8e8;
border-bottom: 1px solid #e8e8e8;
border-left: 1px solid #e8e8e8;
padding: 1rem;
&:last-of-type {
border-right: 1px solid #e8e8e8;
}
.dep-header {
text-align: center;
}
}
}
.no-deps {
padding: 1rem;
font-size: .8rem;
}
.providers-title {
width: 100%;
padding-left: 10px;
display: block;
text-overflow: ellipsis;
overflow: hidden;
line-height: 25px;
font-size: 11px;
font-weight: 500;
height: auto;
background: #f5f5f5;
}
:host-context(.dark-theme) {
.providers-title {
background: #161515;
}
.injector-graph {
background: #1a1a1a;
}
}
.injector-hierarchy {
height: 100%;
overflow: hidden;
h2 {
padding: 4px 16px;
margin: 0;
height: 50px;
display: flex;
align-items: center;
border-bottom: 1px solid #777777;
}
}
.injector-graph {
overflow: auto;
background: #f3f3f3;
height: calc(100% - 50px);
}
.hierarchy-ref {
color: currentColor;
text-decoration: none;
}
| {
"end_byte": 3442,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree.component.scss"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree.component.html_0_2454 | @if (!diDebugAPIsAvailable()) {
<p class="not-supported">
This feature is only available on version 17.0.0 or higher of Angular.
</p>
}
<as-split [class.hidden]="!diDebugAPIsAvailable()" unit="pixel" direction="vertical" [gutterSize]="9" [disabled]="true">
<as-split-area size="50">
<mat-checkbox
(change)="toggleHideInjectorsWithNoProviders()"
>
Hide injectors with no providers
</mat-checkbox>
<mat-checkbox
(change)="toggleHideAngularInjectors()"
>
Hide framework injectors
</mat-checkbox>
</as-split-area>
<as-split-area>
<as-split unit="percent" direction="horizontal" [gutterSize]="9">
<as-split-area size="60">
<as-split unit="percent" direction="vertical" [gutterSize]="9">
<as-split-area size="35">
<div class="injector-hierarchy">
<h2>
Environment Hierarchy
<a class="hierarchy-ref" href="https://angular.dev/guide/di/hierarchical-dependency-injection#types-of-injector-hierarchies" target="_blank">
<mat-icon matTooltip="Open docs reference"> open_in_new </mat-icon>
</a>
</h2>
<section #injectorTree class="environment-injectors injector-graph">
<svg #svgContainer>
<g #mainGroup></g>
</svg>
</section>
</div>
</as-split-area>
<as-split-area size="65">
<div class="injector-hierarchy">
<h2>
Element Hierarchy
<a class="hierarchy-ref" href="https://angular.dev/guide/di/hierarchical-dependency-injection#types-of-injector-hierarchies" target="_blank">
<mat-icon matTooltip="Open docs reference"> open_in_new </mat-icon>
</a>
</h2>
<section #elementInjectorTree class="element-injectors injector-graph">
<svg #elementSvgContainer>
<g #elementMainGroup></g>
</svg>
</section>
</div>
</as-split-area>
</as-split>
</as-split-area>
@if (selectedNode() && providers().length > 0) {
<as-split-area size="40" minSize="25">
<ng-injector-providers [injector]="selectedNode()!.data.injector" [providers]="providers()"/>
</as-split-area>
}
</as-split>
</as-split-area>
</as-split>
| {
"end_byte": 2454,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree.component.html"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.ts_0_6124 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {DevToolsNode, SerializedInjector} from 'protocol';
import {
InjectorTreeD3Node,
InjectorTreeNode,
} from '../dependency-injection/injector-tree-visualizer';
export interface InjectorPath {
node: DevToolsNode;
path: SerializedInjector[];
}
export function getInjectorIdsToRootFromNode(node: InjectorTreeD3Node): string[] {
const ids: string[] = [];
let currentNode = node;
while (currentNode) {
ids.push(currentNode.data.injector.id);
currentNode = currentNode.parent!;
}
return ids;
}
export function generateEdgeIdsFromNodeIds(nodeIds: string[]) {
const edgeIds: string[] = [];
for (let i = 0; i < nodeIds.length - 1; i++) {
edgeIds.push(`${nodeIds[i]}-to-${nodeIds[i + 1]}`);
}
return edgeIds;
}
export function equalInjector(a: SerializedInjector, b: SerializedInjector): boolean {
return a.id === b.id;
}
export function findExistingPath(
path: InjectorTreeNode[],
value: SerializedInjector,
): InjectorTreeNode | null {
return path.find((injector) => equalInjector(injector.injector, value)) || null;
}
export function transformInjectorResolutionPathsIntoTree(
injectorPaths: InjectorPath[],
): InjectorTreeNode {
const injectorTree: InjectorTreeNode[] = [];
const injectorIdToNode = new Map<string, DevToolsNode>();
for (const {path: injectorPath, node} of injectorPaths) {
let currentLevel = injectorTree;
for (const [index, injector] of injectorPath.entries()) {
if (injector.type === 'element' && index === injectorPath.length - 1) {
injectorIdToNode.set(injector.id, node);
}
let existingPath = findExistingPath(currentLevel, injector);
if (existingPath) {
currentLevel = existingPath.children;
continue;
}
const next = {
injector: injector,
children: [],
};
next.injector.node = injectorIdToNode.get(next.injector.id);
currentLevel.push(next);
currentLevel = next.children;
}
}
const hiddenRoot = {
injector: {name: '', type: 'hidden', id: 'N/A'},
children: injectorTree,
};
return hiddenRoot as any;
}
export function grabInjectorPathsFromDirectiveForest(
directiveForest: DevToolsNode[],
): InjectorPath[] {
const injectorPaths: InjectorPath[] = [];
const grabInjectorPaths = (node: DevToolsNode) => {
if (node.resolutionPath) {
injectorPaths.push({node, path: node.resolutionPath.slice().reverse()});
}
node.children.forEach((child) => grabInjectorPaths(child));
};
for (const directive of directiveForest) {
grabInjectorPaths(directive);
}
return injectorPaths;
}
export function splitInjectorPathsIntoElementAndEnvironmentPaths(injectorPaths: InjectorPath[]): {
elementPaths: InjectorPath[];
environmentPaths: InjectorPath[];
startingElementToEnvironmentPath: Map<string, SerializedInjector[]>;
} {
const elementPaths: InjectorPath[] = [];
const environmentPaths: InjectorPath[] = [];
const startingElementToEnvironmentPath = new Map<string, SerializedInjector[]>();
injectorPaths.forEach(({node, path}) => {
// split the path into two paths,
// one for the element injector and one for the environment injector
let environmentPath: SerializedInjector[] = [];
let elementPath: SerializedInjector[] = [];
const firstElementIndex = path.findIndex((injector) => injector.type === 'element');
if (firstElementIndex === -1) {
environmentPath = path;
elementPath = [];
} else {
environmentPath = path.slice(0, firstElementIndex);
elementPath = path.slice(firstElementIndex);
}
elementPaths.push({
node,
path: elementPath,
});
environmentPaths.push({
node,
path: environmentPath,
});
if (elementPath[elementPath.length - 1]) {
// reverse each path to get the paths starting from the starting element
startingElementToEnvironmentPath.set(
elementPath[elementPath.length - 1].id,
environmentPath.slice().reverse(),
);
}
});
return {
elementPaths: elementPaths.filter(({path}) =>
path.every((injector) => injector.type === 'element'),
),
environmentPaths,
startingElementToEnvironmentPath,
};
}
const ANGULAR_DIRECTIVES = [
'NgClass',
'NgComponentOutlet',
'NgFor',
'NgForOf',
'NgIf',
'NgOptimizedImage',
'NgPlural',
'NgPluralCase',
'NgStyle',
'NgSwitch',
'NgSwitchCase',
'NgSwitchDefault',
'NgTemplateOutlet',
'AbstractFormGroupDirective',
'CheckboxControlValueAccessor',
'CheckboxRequiredValidator',
'DefaultValueAccessor',
'EmailValidator',
'FormArrayName',
'FormControlDirective',
'FormControlName',
'FormGroupDirective',
'FormGroupName',
'MaxLengthValidator',
'MaxValidator',
'MinLengthValidator',
'MinValidator',
'NgControlStatus',
'NgControlStatusGroup',
'NgForm',
'NgModel',
'NgModelGroup',
'NgSelectOption',
'NumberValueAccessor',
'PatternValidator',
'RadioControlValueAccessor',
'RangeValueAccessor',
'RequiredValidator',
'SelectControlValueAccessor',
'SelectMultipleControlValueAccessor',
'RouterLink',
'RouterLinkActive',
'RouterLinkWithHref',
'RouterOutlet',
'UpgradeComponent',
];
const ignoredAngularInjectors = new Set([
'Null Injector',
...ANGULAR_DIRECTIVES,
...ANGULAR_DIRECTIVES.map((directive) => `_${directive}`),
]);
export function filterOutInjectorsWithNoProviders(injectorPaths: InjectorPath[]): InjectorPath[] {
for (const injectorPath of injectorPaths) {
injectorPath.path = injectorPath.path.filter(
({providers}) => providers === undefined || providers > 0,
);
}
return injectorPaths;
}
export function filterOutAngularInjectors(injectorPaths: InjectorPath[]): InjectorPath[] {
return injectorPaths.map(({node, path}) => {
return {node, path: path.filter((injector) => !ignoredAngularInjectors.has(injector.name))};
});
}
| {
"end_byte": 6124,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-providers.component.ts_0_6056 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {Component, computed, inject, input, signal} from '@angular/core';
import {MatOption} from '@angular/material/core';
import {MatFormField, MatLabel} from '@angular/material/form-field';
import {MatIcon} from '@angular/material/icon';
import {MatInput} from '@angular/material/input';
import {MatSelect} from '@angular/material/select';
import {MatTableModule} from '@angular/material/table';
import {MatTooltip} from '@angular/material/tooltip';
import {Events, MessageBus, SerializedInjector, SerializedProviderRecord} from 'protocol';
@Component({
selector: 'ng-injector-providers',
template: `
<h1>Providers for {{ injector()?.name }}</h1>
@if (injector()) {
<div class="injector-providers">
<mat-form-field appearance="fill" class="form-field-spacer">
<mat-label>Search by token</mat-label>
<input
type="text"
matInput
placeholder="Provider token"
(input)="searchToken.set($event.target.value)"
[value]="searchToken()"
/>
<mat-icon matSuffix (click)="searchToken.set('')">close</mat-icon>
</mat-form-field>
<mat-form-field class="form-field-spacer">
<mat-label>Search by type</mat-label>
<mat-select [value]="searchType()" (selectionChange)="searchType.set($event.value)">
<mat-option>None</mat-option>
@for (type of providerTypes; track type) {
<mat-option [value]="type">{{ $any(providerTypeToLabel)[type] }}</mat-option>
}
</mat-select>
</mat-form-field>
@if (visibleProviders().length > 0) {
<table mat-table [dataSource]="visibleProviders()" class="mat-elevation-z4">
<ng-container matColumnDef="token">
<th mat-header-cell *matHeaderCellDef><h3 class="column-title">Token</h3></th>
<td mat-cell *matCellDef="let provider">{{ provider.token }}</td>
</ng-container>
<ng-container matColumnDef="type">
<th mat-header-cell *matHeaderCellDef><h3 class="column-title">Type</h3></th>
<td mat-cell *matCellDef="let provider">
@if (provider.type === 'multi') { multi (x{{ provider.index.length }}) } @else {
{{ $any(providerTypeToLabel)[provider.type] }}
}
</td>
</ng-container>
<ng-container matColumnDef="isViewProvider">
<th mat-header-cell *matHeaderCellDef><h3 class="column-title">Is View Provider</h3></th>
<td mat-cell *matCellDef="let provider">
<mat-icon>{{ provider.isViewProvider ? 'check_circle' : 'cancel' }}</mat-icon>
</td>
</ng-container>
<ng-container matColumnDef="log">
<th mat-header-cell *matHeaderCellDef><h3 class="column-title"></h3></th>
<td mat-cell *matCellDef="let provider">
<mat-icon
matTooltipPosition="left"
matTooltip="Log provider in console"
class="select"
(click)="select(provider)"
>send</mat-icon
>
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
</table>
}
</div>
}
`,
styles: [
`
.select {
cursor: pointer;
}
:host {
display: block;
padding: 16px;
}
.form-field-spacer {
margin: 0 4px 0 4px;
}
table {
width: 100%;
}
.column-title {
margin: 0;
}
tr.example-detail-row {
height: 0;
}
.example-element-row td {
border-bottom-width: 0;
cursor: pointer;
}
.example-element-detail {
overflow: hidden;
display: flex;
}
.example-element-diagram {
min-width: 80px;
border: 2px solid black;
padding: 8px;
font-weight: lighter;
margin: 8px 0;
height: 104px;
}
.example-element-symbol {
font-weight: bold;
font-size: 40px;
line-height: normal;
}
.example-element-description {
padding: 16px;
}
.example-element-description-attribution {
opacity: 0.5;
}
`,
],
standalone: true,
imports: [
MatTableModule,
MatIcon,
MatTooltip,
MatInput,
MatSelect,
MatFormField,
MatLabel,
MatOption,
],
})
export class InjectorProvidersComponent {
readonly injector = input.required<SerializedInjector>();
readonly providers = input<SerializedProviderRecord[]>([]);
readonly searchToken = signal('');
readonly searchType = signal('');
readonly visibleProviders = computed(() => {
const searchToken = this.searchToken().toLowerCase();
const searchType = this.searchType();
const predicates: ((provider: SerializedProviderRecord) => boolean)[] = [];
searchToken &&
predicates.push((provider) => provider.token.toLowerCase().includes(searchToken));
searchType && predicates.push((provider) => provider.type === searchType);
return this.providers().filter((provider) =>
predicates.every((predicate) => predicate(provider)),
);
});
providerTypeToLabel = {
type: 'Type',
existing: 'useExisting',
factory: 'useFactory',
class: 'useClass',
value: 'useValue',
};
providerTypes = Object.keys(this.providerTypeToLabel);
messageBus = inject<MessageBus<Events>>(MessageBus);
select(row: SerializedProviderRecord) {
const {id, type, name} = this.injector();
this.messageBus.emit('logProvider', [{id, type, name}, row]);
}
get displayedColumns(): string[] {
if (this.injector()?.type === 'element') {
return ['token', 'type', 'isViewProvider', 'log'];
}
return ['token', 'type', 'log'];
}
}
| {
"end_byte": 6056,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-providers.component.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts_0_2728 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {ComponentType, DevToolsNode} from 'protocol';
import {
InjectorTreeD3Node,
InjectorTreeNode,
} from '../dependency-injection/injector-tree-visualizer';
import {
equalInjector,
generateEdgeIdsFromNodeIds,
getInjectorIdsToRootFromNode,
grabInjectorPathsFromDirectiveForest,
InjectorPath,
splitInjectorPathsIntoElementAndEnvironmentPaths,
transformInjectorResolutionPathsIntoTree,
} from './injector-tree-fns';
describe('getInjectorIdsToRootFromNode', () => {
it('should be able to get ids from a node', () => {
const root = {
data: {
injector: {
id: '1',
name: 'root',
type: 'environment',
},
},
};
const child = {
parent: root,
data: {
injector: {
id: '2',
name: 'child',
type: 'environment',
},
},
};
const grandChild = {
parent: child,
data: {
injector: {
id: '3',
name: 'grand child',
type: 'environment',
},
},
};
expect(getInjectorIdsToRootFromNode(root as InjectorTreeD3Node)).toEqual(['1']);
expect(getInjectorIdsToRootFromNode(child as InjectorTreeD3Node)).toEqual(['2', '1']);
expect(getInjectorIdsToRootFromNode(grandChild as InjectorTreeD3Node)).toEqual(['3', '2', '1']);
});
});
describe('generateEdgeIdsFromNodeIds', () => {
it('should be able to generate edge ids from node ids', () => {
const injectorIds = ['1', '2', '3'];
expect(generateEdgeIdsFromNodeIds(injectorIds)).toEqual(['1-to-2', '2-to-3']);
});
it('should be able to generate edge ids from node ids with 1 id', () => {
const injectorIds = ['1'];
expect(generateEdgeIdsFromNodeIds(injectorIds)).toEqual([]);
});
});
describe('equalInjector', () => {
it('should be able to compare injectors', () => {
const injector1 = {
id: '1',
name: 'A',
type: 'environment',
};
const injector2 = {
id: '1',
name: 'B',
type: 'environment',
};
const injector3 = {
id: '2',
name: 'C',
type: 'environment',
};
expect(equalInjector(injector1, injector2)).toEqual(true);
expect(equalInjector(injector2, injector1)).toEqual(true);
expect(equalInjector(injector1, injector3)).toEqual(false);
expect(equalInjector(injector3, injector1)).toEqual(false);
expect(equalInjector(injector2, injector3)).toEqual(false);
expect(equalInjector(injector3, injector2)).toEqual(false);
});
}); | {
"end_byte": 2728,
"start_byte": 0,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts_2730_8983 | describe('transformInjectorResolutionPathsIntoTree', () => {
it('should be able to transform injector paths to a d3 tree', () => {
const injectorPaths: InjectorPath[] = [
{
'node': {
'element': 'app-root',
'component': {'name': 'app-root', 'isElement': false, 'id': 0},
'directives': [],
'hydration': null,
'children': [
{
'element': 'router-outlet',
'component': null,
'directives': [{'name': '_RouterOutlet', 'id': 1}],
'children': [],
'resolutionPath': [
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
{
'element': 'app-demo-component',
'component': {'name': 'app-demo-component', 'isElement': false, 'id': 2},
'hydration': null,
'directives': [],
'children': [
{
'element': 'router-outlet',
'component': null,
'directives': [{'name': '_RouterOutlet', 'id': 3}],
'children': [],
'resolutionPath': [
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
{
'element': 'app-todo-demo',
'component': {'name': 'app-todo-demo', 'isElement': false, 'id': 4},
'directives': [],
'hydration': null,
'children': [
{
'element': 'a',
'component': null,
'directives': [{'name': '_RouterLink', 'id': 5}],
'children': [],
'resolutionPath': [
{'id': '8', 'type': 'element', 'name': '_RouterLink'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
{
'element': 'a',
'component': null,
'directives': [{'name': '_RouterLink', 'id': 6}],
'children': [],
'resolutionPath': [
{'id': '11', 'type': 'element', 'name': '_RouterLink'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
{
'element': 'router-outlet',
'component': null,
'directives': [{'name': '_RouterOutlet', 'id': 7}],
'children': [],
'resolutionPath': [
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
}, | {
"end_byte": 8983,
"start_byte": 2730,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts_9004_17671 | {
'element': 'app-todos',
'component': {'name': 'app-todos', 'isElement': false, 'id': 8},
'hydration': null,
'directives': [],
'children': [
{
'element': 'a',
'component': null,
'directives': [{'name': '_RouterLink', 'id': 9}],
'children': [],
'resolutionPath': [
{'id': '13', 'type': 'element', 'name': '_RouterLink'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
{
'element': 'a',
'component': null,
'directives': [{'name': '_RouterLink', 'id': 10}],
'children': [],
'resolutionPath': [
{'id': '16', 'type': 'element', 'name': '_RouterLink'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
{
'element': 'a',
'component': null,
'directives': [{'name': '_RouterLink', 'id': 11}],
'children': [],
'resolutionPath': [
{'id': '17', 'type': 'element', 'name': '_RouterLink'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
{
'element': 'app-todo',
'component': {'name': 'app-todo', 'isElement': false, 'id': 12},
'directives': [{'name': '_TooltipDirective', 'id': 13}],
'children': [
{
'element': 'div',
'component': null,
'directives': [{'name': '_TooltipDirective', 'id': 14}],
'children': [],
'resolutionPath': [
{'id': '18', 'type': 'element', 'name': '_TooltipDirective'},
{'id': '19', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
],
'resolutionPath': [
{'id': '19', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
}, | {
"end_byte": 17671,
"start_byte": 9004,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts_17696_25960 | {
'element': 'app-todo',
'component': {'name': 'app-todo', 'isElement': false, 'id': 15},
'directives': [{'name': '_TooltipDirective', 'id': 16}],
'hydration': null,
'children': [
{
'element': 'div',
'component': null,
'directives': [{'name': '_TooltipDirective', 'id': 17}],
'children': [],
'resolutionPath': [
{'id': '21', 'type': 'element', 'name': '_TooltipDirective'},
{'id': '22', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
],
'resolutionPath': [
{'id': '22', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
{
'element': '#comment',
'component': null,
'directives': [{'name': '_NgForOf', 'id': 18}],
'children': [],
'resolutionPath': [
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
],
'resolutionPath': [
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
],
'resolutionPath': [
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
{
'element': 'app-heavy',
'component': {'name': 'app-heavy', 'isElement': false, 'id': 20},
'directives': [],
'children': [],
'resolutionPath': [
{'id': '24', 'type': 'element', 'name': '_HeavyComponent'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
], | {
"end_byte": 25960,
"start_byte": 17696,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts_25975_32546 | 'resolutionPath': [
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
],
'resolutionPath': [
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
'path': [{'id': '1', 'type': 'element', 'name': '_AppComponent'}],
},
{
'node': {
'element': 'router-outlet',
'component': null,
'hydration': null,
'directives': [{'name': '_RouterOutlet', 'id': 1}],
'children': [],
'resolutionPath': [
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
'path': [{'id': '1', 'type': 'element', 'name': '_AppComponent'}],
},
{
'node': {
'element': 'app-demo-component',
'component': {'name': 'app-demo-component', 'isElement': false, 'id': 2},
'hydration': null,
'directives': [],
'children': [
{
'element': 'router-outlet',
'component': null,
'directives': [{'name': '_RouterOutlet', 'id': 3}],
'children': [],
'resolutionPath': [
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
{
'element': 'app-todo-demo',
'component': {'name': 'app-todo-demo', 'isElement': false, 'id': 4},
'hydration': null,
'directives': [],
'children': [
{
'element': 'a',
'component': null,
'directives': [{'name': '_RouterLink', 'id': 5}],
'children': [],
'resolutionPath': [
{'id': '8', 'type': 'element', 'name': '_RouterLink'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
{
'element': 'a',
'component': null,
'directives': [{'name': '_RouterLink', 'id': 6}],
'children': [],
'resolutionPath': [
{'id': '11', 'type': 'element', 'name': '_RouterLink'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
{
'element': 'router-outlet',
'component': null,
'directives': [{'name': '_RouterOutlet', 'id': 7}],
'children': [],
'resolutionPath': [
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
}, | {
"end_byte": 32546,
"start_byte": 25975,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts_32563_40734 | {
'element': 'app-todos',
'component': {'name': 'app-todos', 'isElement': false, 'id': 8},
'hydration': null,
'directives': [],
'children': [
{
'element': 'a',
'component': null,
'directives': [{'name': '_RouterLink', 'id': 9}],
'children': [],
'resolutionPath': [
{'id': '13', 'type': 'element', 'name': '_RouterLink'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
{
'element': 'a',
'component': null,
'directives': [{'name': '_RouterLink', 'id': 10}],
'children': [],
'resolutionPath': [
{'id': '16', 'type': 'element', 'name': '_RouterLink'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
{
'element': 'a',
'component': null,
'directives': [{'name': '_RouterLink', 'id': 11}],
'children': [],
'resolutionPath': [
{'id': '17', 'type': 'element', 'name': '_RouterLink'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
{
'element': 'app-todo',
'component': {'name': 'app-todo', 'isElement': false, 'id': 12},
'directives': [{'name': '_TooltipDirective', 'id': 13}],
'hydration': null,
'children': [
{
'element': 'div',
'component': null,
'directives': [{'name': '_TooltipDirective', 'id': 14}],
'children': [],
'resolutionPath': [
{'id': '18', 'type': 'element', 'name': '_TooltipDirective'},
{'id': '19', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
],
'resolutionPath': [
{'id': '19', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
}, | {
"end_byte": 40734,
"start_byte": 32563,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts_40755_48536 | {
'element': 'app-todo',
'component': {'name': 'app-todo', 'isElement': false, 'id': 15},
'directives': [{'name': '_TooltipDirective', 'id': 16}],
'hydration': null,
'children': [
{
'element': 'div',
'component': null,
'directives': [{'name': '_TooltipDirective', 'id': 17}],
'children': [],
'resolutionPath': [
{'id': '21', 'type': 'element', 'name': '_TooltipDirective'},
{'id': '22', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
],
'resolutionPath': [
{'id': '22', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
{
'element': '#comment',
'component': null,
'directives': [{'name': '_NgForOf', 'id': 18}],
'children': [],
'resolutionPath': [
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
],
'resolutionPath': [
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
],
'resolutionPath': [
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
{
'element': 'app-heavy',
'component': {'name': 'app-heavy', 'isElement': false, 'id': 20},
'directives': [],
'children': [],
'resolutionPath': [
{'id': '24', 'type': 'element', 'name': '_HeavyComponent'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
], | {
"end_byte": 48536,
"start_byte": 40755,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts_48547_53774 | 'resolutionPath': [
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
'path': [
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
],
},
{
'node': {
'element': 'router-outlet',
'component': null,
'directives': [{'name': '_RouterOutlet', 'id': 3}],
'hydration': null,
'children': [],
'resolutionPath': [
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
'path': [
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
],
},
{
'node': {
'element': 'app-todo-demo',
'component': {'name': 'app-todo-demo', 'isElement': false, 'id': 4},
'hydration': null,
'directives': [],
'children': [
{
'element': 'a',
'component': null,
'directives': [{'name': '_RouterLink', 'id': 5}],
'children': [],
'resolutionPath': [
{'id': '8', 'type': 'element', 'name': '_RouterLink'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
{
'element': 'a',
'component': null,
'directives': [{'name': '_RouterLink', 'id': 6}],
'children': [],
'resolutionPath': [
{'id': '11', 'type': 'element', 'name': '_RouterLink'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
{
'element': 'router-outlet',
'component': null,
'directives': [{'name': '_RouterOutlet', 'id': 7}],
'children': [],
'resolutionPath': [
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
}, | {
"end_byte": 53774,
"start_byte": 48547,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts_53787_61462 | {
'element': 'app-todos',
'component': {'name': 'app-todos', 'isElement': false, 'id': 8},
'directives': [],
'hydration': null,
'children': [
{
'element': 'a',
'component': null,
'directives': [{'name': '_RouterLink', 'id': 9}],
'children': [],
'resolutionPath': [
{'id': '13', 'type': 'element', 'name': '_RouterLink'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
{
'element': 'a',
'component': null,
'directives': [{'name': '_RouterLink', 'id': 10}],
'children': [],
'resolutionPath': [
{'id': '16', 'type': 'element', 'name': '_RouterLink'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
{
'element': 'a',
'component': null,
'directives': [{'name': '_RouterLink', 'id': 11}],
'children': [],
'resolutionPath': [
{'id': '17', 'type': 'element', 'name': '_RouterLink'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
{
'element': 'app-todo',
'component': {'name': 'app-todo', 'isElement': false, 'id': 12},
'directives': [{'name': '_TooltipDirective', 'id': 13}],
'hydration': null,
'children': [
{
'element': 'div',
'component': null,
'directives': [{'name': '_TooltipDirective', 'id': 14}],
'children': [],
'resolutionPath': [
{'id': '18', 'type': 'element', 'name': '_TooltipDirective'},
{'id': '19', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
],
'resolutionPath': [
{'id': '19', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
}, | {
"end_byte": 61462,
"start_byte": 53787,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts_61479_68189 | {
'element': 'app-todo',
'component': {'name': 'app-todo', 'isElement': false, 'id': 15},
'directives': [{'name': '_TooltipDirective', 'id': 16}],
'hydration': null,
'children': [
{
'element': 'div',
'component': null,
'directives': [{'name': '_TooltipDirective', 'id': 17}],
'children': [],
'resolutionPath': [
{'id': '21', 'type': 'element', 'name': '_TooltipDirective'},
{'id': '22', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
],
'resolutionPath': [
{'id': '22', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
{
'element': '#comment',
'component': null,
'directives': [{'name': '_NgForOf', 'id': 18}],
'children': [],
'resolutionPath': [
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
],
'resolutionPath': [
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
],
'resolutionPath': [
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
'path': [
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
],
}, | {
"end_byte": 68189,
"start_byte": 61479,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts_68196_72023 | {
'node': {
'element': 'a',
'component': null,
'hydration': null,
'directives': [{'name': '_RouterLink', 'id': 5}],
'children': [],
'resolutionPath': [
{'id': '8', 'type': 'element', 'name': '_RouterLink'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
'path': [
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
],
},
{
'node': {
'element': 'a',
'component': null,
'directives': [{'name': '_RouterLink', 'id': 6}],
'children': [],
'resolutionPath': [
{'id': '11', 'type': 'element', 'name': '_RouterLink'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
'hydration': null,
},
'path': [
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
],
},
{
'node': {
'element': 'router-outlet',
'component': null,
'hydration': null,
'directives': [{'name': '_RouterOutlet', 'id': 7}],
'children': [],
'resolutionPath': [
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
'path': [
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
],
}, | {
"end_byte": 72023,
"start_byte": 68196,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts_72030_79227 | {
'node': {
'element': 'app-todos',
'component': {'name': 'app-todos', 'isElement': false, 'id': 8},
'directives': [],
'hydration': null,
'children': [
{
'element': 'a',
'component': null,
'hydration': null,
'directives': [{'name': '_RouterLink', 'id': 9}],
'children': [],
'resolutionPath': [
{'id': '13', 'type': 'element', 'name': '_RouterLink'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
{
'element': 'a',
'component': null,
'hydration': null,
'directives': [{'name': '_RouterLink', 'id': 10}],
'children': [],
'resolutionPath': [
{'id': '16', 'type': 'element', 'name': '_RouterLink'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
{
'element': 'a',
'component': null,
'hydration': null,
'directives': [{'name': '_RouterLink', 'id': 11}],
'children': [],
'resolutionPath': [
{'id': '17', 'type': 'element', 'name': '_RouterLink'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
{
'element': 'app-todo',
'component': {'name': 'app-todo', 'isElement': false, 'id': 12},
'directives': [{'name': '_TooltipDirective', 'id': 13}],
'hydration': null,
'children': [
{
'element': 'div',
'component': null,
'directives': [{'name': '_TooltipDirective', 'id': 14}],
'hydration': null,
'children': [],
'resolutionPath': [
{'id': '18', 'type': 'element', 'name': '_TooltipDirective'},
{'id': '19', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
],
'resolutionPath': [
{'id': '19', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
}, | {
"end_byte": 79227,
"start_byte": 72030,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts_79240_86446 | {
'element': 'app-todo',
'component': {'name': 'app-todo', 'isElement': false, 'id': 15},
'directives': [{'name': '_TooltipDirective', 'id': 16}],
'hydration': null,
'children': [
{
'element': 'div',
'component': null,
'directives': [{'name': '_TooltipDirective', 'id': 17}],
'hydration': null,
'children': [],
'resolutionPath': [
{'id': '21', 'type': 'element', 'name': '_TooltipDirective'},
{'id': '22', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
],
'resolutionPath': [
{'id': '22', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
{
'element': '#comment',
'component': null,
'directives': [{'name': '_NgForOf', 'id': 18}],
'hydration': null,
'children': [],
'resolutionPath': [
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
],
'resolutionPath': [
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
'path': [
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
],
},
{
'node': {
'element': 'a',
'component': null,
'hydration': null,
'directives': [{'name': '_RouterLink', 'id': 9}],
'children': [],
'resolutionPath': [
{'id': '13', 'type': 'element', 'name': '_RouterLink'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
'path': [
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
],
}, | {
"end_byte": 86446,
"start_byte": 79240,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts_86453_92802 | {
'node': {
'element': 'a',
'component': null,
'hydration': null,
'directives': [{'name': '_RouterLink', 'id': 10}],
'children': [],
'resolutionPath': [
{'id': '16', 'type': 'element', 'name': '_RouterLink'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
'path': [
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
],
},
{
'node': {
'element': 'a',
'component': null,
'hydration': null,
'directives': [{'name': '_RouterLink', 'id': 11}],
'children': [],
'resolutionPath': [
{'id': '17', 'type': 'element', 'name': '_RouterLink'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
'path': [
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
],
},
{
'node': {
'element': 'app-todo',
'component': {'name': 'app-todo', 'isElement': false, 'id': 12},
'directives': [{'name': '_TooltipDirective', 'id': 13}],
'hydration': null,
'children': [
{
'element': 'div',
'component': null,
'directives': [{'name': '_TooltipDirective', 'id': 14}],
'hydration': null,
'children': [],
'resolutionPath': [
{'id': '18', 'type': 'element', 'name': '_TooltipDirective'},
{'id': '19', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
],
'resolutionPath': [
{'id': '19', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
'path': [
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '19', 'type': 'element', 'name': '_TodoComponent'},
],
}, | {
"end_byte": 92802,
"start_byte": 86453,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts_92809_99740 | {
'node': {
'element': 'div',
'component': null,
'hydration': null,
'directives': [{'name': '_TooltipDirective', 'id': 14}],
'children': [],
'resolutionPath': [
{'id': '18', 'type': 'element', 'name': '_TooltipDirective'},
{'id': '19', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
'path': [
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '19', 'type': 'element', 'name': '_TodoComponent'},
{'id': '18', 'type': 'element', 'name': '_TooltipDirective'},
],
},
{
'node': {
'element': 'app-todo',
'component': {'name': 'app-todo', 'isElement': false, 'id': 15},
'directives': [{'name': '_TooltipDirective', 'id': 16}],
'hydration': null,
'children': [
{
'element': 'div',
'component': null,
'directives': [{'name': '_TooltipDirective', 'id': 17}],
'children': [],
'hydration': null,
'resolutionPath': [
{'id': '21', 'type': 'element', 'name': '_TooltipDirective'},
{'id': '22', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
],
'resolutionPath': [
{'id': '22', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
'path': [
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '22', 'type': 'element', 'name': '_TodoComponent'},
],
},
{
'node': {
'element': 'div',
'component': null,
'hydration': null,
'directives': [{'name': '_TooltipDirective', 'id': 17}],
'children': [],
'resolutionPath': [
{'id': '21', 'type': 'element', 'name': '_TooltipDirective'},
{'id': '22', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
'path': [
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '22', 'type': 'element', 'name': '_TodoComponent'},
{'id': '21', 'type': 'element', 'name': '_TooltipDirective'},
],
}, | {
"end_byte": 99740,
"start_byte": 92809,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts_99747_102392 | {
'node': {
'element': '#comment',
'component': null,
'hydration': null,
'directives': [{'name': '_NgForOf', 'id': 18}],
'children': [],
'resolutionPath': [
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
'path': [
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
],
},
{
'node': {
'element': 'app-heavy',
'hydration': null,
'component': {'name': 'app-heavy', 'isElement': false, 'id': 20},
'directives': [],
'children': [],
'resolutionPath': [
{'id': '24', 'type': 'element', 'name': '_HeavyComponent'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
'path': [
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '24', 'type': 'element', 'name': '_HeavyComponent'},
],
},
]; | {
"end_byte": 102392,
"start_byte": 99747,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts_102398_109147 | const expected: InjectorTreeNode = {
'injector': {'name': '', 'type': 'hidden', 'id': 'N/A'},
'children': [
{
'injector': {
'id': '1',
'type': 'element',
'name': '_AppComponent',
'node': {
'element': 'app-root',
'hydration': null,
'component': {'name': 'app-root', 'isElement': false, 'id': 0},
'directives': [],
'children': [
{
'element': 'router-outlet',
'component': null,
'hydration': null,
'directives': [{'name': '_RouterOutlet', 'id': 1}],
'children': [],
'resolutionPath': [
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
{
'element': 'app-demo-component',
'component': {'name': 'app-demo-component', 'isElement': false, 'id': 2},
'directives': [],
'hydration': null,
'children': [
{
'element': 'router-outlet',
'component': null,
'hydration': null,
'directives': [{'name': '_RouterOutlet', 'id': 3}],
'children': [],
'resolutionPath': [
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
{
'element': 'app-todo-demo',
'component': {'name': 'app-todo-demo', 'isElement': false, 'id': 4},
'directives': [],
'hydration': null,
'children': [
{
'element': 'a',
'component': null,
'hydration': null,
'directives': [{'name': '_RouterLink', 'id': 5}],
'children': [],
'resolutionPath': [
{'id': '8', 'type': 'element', 'name': '_RouterLink'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
{
'element': 'a',
'component': null,
'hydration': null,
'directives': [{'name': '_RouterLink', 'id': 6}],
'children': [],
'resolutionPath': [
{'id': '11', 'type': 'element', 'name': '_RouterLink'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
{
'element': 'router-outlet',
'component': null,
'hydration': null,
'directives': [{'name': '_RouterOutlet', 'id': 7}],
'children': [],
'resolutionPath': [
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
}, | {
"end_byte": 109147,
"start_byte": 102398,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts_109172_118335 | {
'element': 'app-todos',
'component': {'name': 'app-todos', 'isElement': false, 'id': 8},
'directives': [],
'hydration': null,
'children': [
{
'element': 'a',
'component': null,
'hydration': null,
'directives': [{'name': '_RouterLink', 'id': 9}],
'children': [],
'resolutionPath': [
{'id': '13', 'type': 'element', 'name': '_RouterLink'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
{
'element': 'a',
'component': null,
'hydration': null,
'directives': [{'name': '_RouterLink', 'id': 10}],
'children': [],
'resolutionPath': [
{'id': '16', 'type': 'element', 'name': '_RouterLink'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
{
'element': 'a',
'component': null,
'hydration': null,
'directives': [{'name': '_RouterLink', 'id': 11}],
'children': [],
'resolutionPath': [
{'id': '17', 'type': 'element', 'name': '_RouterLink'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
{
'element': 'app-todo',
'component': {'name': 'app-todo', 'isElement': false, 'id': 12},
'directives': [{'name': '_TooltipDirective', 'id': 13}],
'hydration': null,
'children': [
{
'element': 'div',
'component': null,
'hydration': null,
'directives': [{'name': '_TooltipDirective', 'id': 14}],
'children': [],
'resolutionPath': [
{'id': '18', 'type': 'element', 'name': '_TooltipDirective'},
{'id': '19', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
],
'resolutionPath': [
{'id': '19', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
}, | {
"end_byte": 118335,
"start_byte": 109172,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts_118364_127112 | {
'element': 'app-todo',
'component': {'name': 'app-todo', 'isElement': false, 'id': 15},
'directives': [{'name': '_TooltipDirective', 'id': 16}],
'hydration': null,
'children': [
{
'element': 'div',
'component': null,
'hydration': null,
'directives': [{'name': '_TooltipDirective', 'id': 17}],
'children': [],
'resolutionPath': [
{'id': '21', 'type': 'element', 'name': '_TooltipDirective'},
{'id': '22', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
],
'resolutionPath': [
{'id': '22', 'type': 'element', 'name': '_TodoComponent'},
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
{
'element': '#comment',
'component': null,
'directives': [{'name': '_NgForOf', 'id': 18}],
'hydration': null,
'children': [],
'resolutionPath': [
{'id': '20', 'type': 'element', 'name': '_NgForOf'},
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
],
'resolutionPath': [
{'id': '14', 'type': 'element', 'name': '_TodosComponent'},
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '15', 'type': 'environment', 'name': '_HomeModule'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
],
'resolutionPath': [
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
{
'element': 'app-heavy',
'component': {'name': 'app-heavy', 'isElement': false, 'id': 20},
'directives': [],
'children': [],
'hydration': null,
'resolutionPath': [
{'id': '24', 'type': 'element', 'name': '_HeavyComponent'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
], | {
"end_byte": 127112,
"start_byte": 118364,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts"
} |
angular/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts_127131_133880 | 'resolutionPath': [
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
],
'resolutionPath': [
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
},
'children': [
{
'injector': {
'id': '6',
'type': 'element',
'name': '_DemoAppComponent',
'node': {
'element': 'app-demo-component',
'component': {'name': 'app-demo-component', 'isElement': false, 'id': 2},
'directives': [],
'hydration': null,
'children': [
{
'element': 'router-outlet',
'component': null,
'directives': [{'name': '_RouterOutlet', 'id': 3}],
'children': [],
'hydration': null,
'resolutionPath': [
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
{
'element': 'app-todo-demo',
'component': {'name': 'app-todo-demo', 'isElement': false, 'id': 4},
'directives': [],
'hydration': null,
'children': [
{
'element': 'a',
'component': null,
'hydration': null,
'directives': [{'name': '_RouterLink', 'id': 5}],
'children': [],
'resolutionPath': [
{'id': '8', 'type': 'element', 'name': '_RouterLink'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
{
'element': 'a',
'component': null,
'directives': [{'name': '_RouterLink', 'id': 6}],
'children': [],
'hydration': null,
'resolutionPath': [
{'id': '11', 'type': 'element', 'name': '_RouterLink'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
},
{
'element': 'router-outlet',
'component': null,
'directives': [{'name': '_RouterOutlet', 'id': 7}],
'children': [],
'hydration': null,
'resolutionPath': [
{'id': '12', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '9', 'type': 'element', 'name': '_AppTodoComponent'},
{'id': '5', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '6', 'type': 'element', 'name': '_DemoAppComponent'},
{'id': '0', 'type': 'element', 'name': '_RouterOutlet'},
{'id': '1', 'type': 'element', 'name': '_AppComponent'},
{'id': '10', 'type': 'environment', 'name': '_AppModule'},
{'id': '7', 'type': 'environment', 'name': '_DemoAppModule'},
{'id': '2', 'type': 'environment', 'name': '_AppModule'},
{'id': '3', 'type': 'environment', 'name': 'Platform: core'},
{'id': '4', 'type': 'null', 'name': 'Null Injector'},
],
}, | {
"end_byte": 133880,
"start_byte": 127131,
"url": "https://github.com/angular/angular/blob/main/devtools/projects/ng-devtools/src/lib/devtools-tabs/injector-tree/injector-tree-fns.spec.ts"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.