blob: 934b71b38087ed4308363c8834ce4704f2baa882 [file] [log] [blame]
Tim van der Lippe67872d62021-11-30 14:00:171// Copyright 2018 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4import '../shell/shell.js';
Nancy Li1c659192022-09-16 09:19:305import '../../panels/mobile_throttling/mobile_throttling-meta.js';
Nancy Li6db489b2024-04-22 15:26:316import '../../panels/js_timeline/js_timeline-meta.js';
Chengzhong Wu78987972025-01-21 11:21:387import '../../panels/network/network-meta.js';
Nancy Li6db489b2024-04-22 15:26:318
Tim van der Lippe67872d62021-11-30 14:00:179import * as Common from '../../core/common/common.js';
Nancy Li6db489b2024-04-22 15:26:3110import * as i18n from '../../core/i18n/i18n.js';
Tim van der Lippe67872d62021-11-30 14:00:1711import * as Root from '../../core/root/root.js';
Nancy Li6db489b2024-04-22 15:26:3112import type * as Sources from '../../panels/sources/sources.js';
13import * as UI from '../../ui/legacy/legacy.js';
Tim van der Lippe67872d62021-11-30 14:00:1714import * as Main from '../main/main.js';
15
Benedikt Meurer586a9a52024-12-27 10:28:2116import {NodeConnectionsPanel} from './NodeConnectionsPanel.js'; // eslint-disable-line rulesdir/es-modules-import
17import {NodeMainImpl} from './NodeMain.js'; // eslint-disable-line rulesdir/es-modules-import
Tim van der Lippe67872d62021-11-30 14:00:1718
19const UIStrings = {
20 /**
Jack Franklinfd72c072022-12-21 11:45:0121 *@description Text that refers to the network connection
22 */
Tim van der Lippe67872d62021-11-30 14:00:1723 connection: 'Connection',
24 /**
Jack Franklinfd72c072022-12-21 11:45:0125 *@description A tag of Node.js Connection Panel that can be searched in the command menu
26 */
Tim van der Lippe67872d62021-11-30 14:00:1727 node: 'node',
28 /**
29 *@description Command for showing the Connection tool
30 */
31 showConnection: 'Show Connection',
32 /**
33 *@description Title of the 'Node' tool in the Network Navigator View, which is part of the Sources tool
Jack Franklinfd72c072022-12-21 11:45:0134 */
Tim van der Lippe67872d62021-11-30 14:00:1735 networkTitle: 'Node',
36 /**
37 *@description Command for showing the 'Node' tool in the Network Navigator View, which is part of the Sources tool
Jack Franklinfd72c072022-12-21 11:45:0138 */
Andrés Olivares0650b4a2022-10-19 10:16:5939 showNode: 'Show Node',
Ergun Erdogmus5efc7e92025-02-21 11:36:5040} as const;
Tim van der Lippe67872d62021-11-30 14:00:1741
42const str_ = i18n.i18n.registerUIStrings('entrypoints/node_app/node_app.ts', UIStrings);
43const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
44
45let loadedSourcesModule: (typeof Sources|undefined);
46
47async function loadSourcesModule(): Promise<typeof Sources> {
48 if (!loadedSourcesModule) {
49 loadedSourcesModule = await import('../../panels/sources/sources.js');
50 }
51 return loadedSourcesModule;
52}
53
54UI.ViewManager.registerViewExtension({
55 location: UI.ViewManager.ViewLocationValues.PANEL,
56 id: 'node-connection',
57 title: i18nLazyString(UIStrings.connection),
58 commandPrompt: i18nLazyString(UIStrings.showConnection),
59 order: 0,
60 async loadView() {
Benedikt Meurerb66670f2023-12-11 14:56:0661 return new NodeConnectionsPanel();
Tim van der Lippe67872d62021-11-30 14:00:1762 },
63 tags: [i18nLazyString(UIStrings.node)],
64});
65
66UI.ViewManager.registerViewExtension({
67 location: UI.ViewManager.ViewLocationValues.NAVIGATOR_VIEW,
68 id: 'navigator-network',
69 title: i18nLazyString(UIStrings.networkTitle),
70 commandPrompt: i18nLazyString(UIStrings.showNode),
71 order: 2,
72 persistence: UI.ViewManager.ViewPersistence.PERMANENT,
73 async loadView() {
74 const Sources = await loadSourcesModule();
75 return Sources.SourcesNavigator.NetworkNavigatorView.instance();
76 },
77});
78
Nikolay Vitkovd36860c2025-02-19 17:50:2779// @ts-expect-error Exposed for legacy layout tests
Tim van der Lipped3b32d52021-12-02 12:55:5680self.runtime = Root.Runtime.Runtime.instance({forceNew: true});
Tim van der Lippe67872d62021-11-30 14:00:1781Common.Runnable.registerEarlyInitializationRunnable(NodeMainImpl.instance);
82new Main.MainImpl.MainImpl();