Tim van der Lippe | 67872d6 | 2021-11-30 14:00:17 | [diff] [blame] | 1 | // 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. |
| 4 | import '../shell/shell.js'; |
Nancy Li | 1c65919 | 2022-09-16 09:19:30 | [diff] [blame] | 5 | import '../../panels/mobile_throttling/mobile_throttling-meta.js'; |
Nancy Li | 6db489b | 2024-04-22 15:26:31 | [diff] [blame] | 6 | import '../../panels/js_timeline/js_timeline-meta.js'; |
Chengzhong Wu | 7898797 | 2025-01-21 11:21:38 | [diff] [blame] | 7 | import '../../panels/network/network-meta.js'; |
Nancy Li | 6db489b | 2024-04-22 15:26:31 | [diff] [blame] | 8 | |
Tim van der Lippe | 67872d6 | 2021-11-30 14:00:17 | [diff] [blame] | 9 | import * as Common from '../../core/common/common.js'; |
Nancy Li | 6db489b | 2024-04-22 15:26:31 | [diff] [blame] | 10 | import * as i18n from '../../core/i18n/i18n.js'; |
Tim van der Lippe | 67872d6 | 2021-11-30 14:00:17 | [diff] [blame] | 11 | import * as Root from '../../core/root/root.js'; |
Nancy Li | 6db489b | 2024-04-22 15:26:31 | [diff] [blame] | 12 | import type * as Sources from '../../panels/sources/sources.js'; |
| 13 | import * as UI from '../../ui/legacy/legacy.js'; |
Tim van der Lippe | 67872d6 | 2021-11-30 14:00:17 | [diff] [blame] | 14 | import * as Main from '../main/main.js'; |
| 15 | |
Benedikt Meurer | 586a9a5 | 2024-12-27 10:28:21 | [diff] [blame] | 16 | import {NodeConnectionsPanel} from './NodeConnectionsPanel.js'; // eslint-disable-line rulesdir/es-modules-import |
| 17 | import {NodeMainImpl} from './NodeMain.js'; // eslint-disable-line rulesdir/es-modules-import |
Tim van der Lippe | 67872d6 | 2021-11-30 14:00:17 | [diff] [blame] | 18 | |
| 19 | const UIStrings = { |
| 20 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 21 | *@description Text that refers to the network connection |
| 22 | */ |
Tim van der Lippe | 67872d6 | 2021-11-30 14:00:17 | [diff] [blame] | 23 | connection: 'Connection', |
| 24 | /** |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 25 | *@description A tag of Node.js Connection Panel that can be searched in the command menu |
| 26 | */ |
Tim van der Lippe | 67872d6 | 2021-11-30 14:00:17 | [diff] [blame] | 27 | 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 Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 34 | */ |
Tim van der Lippe | 67872d6 | 2021-11-30 14:00:17 | [diff] [blame] | 35 | networkTitle: 'Node', |
| 36 | /** |
| 37 | *@description Command for showing the 'Node' tool in the Network Navigator View, which is part of the Sources tool |
Jack Franklin | fd72c07 | 2022-12-21 11:45:01 | [diff] [blame] | 38 | */ |
Andrés Olivares | 0650b4a | 2022-10-19 10:16:59 | [diff] [blame] | 39 | showNode: 'Show Node', |
Ergun Erdogmus | 5efc7e9 | 2025-02-21 11:36:50 | [diff] [blame] | 40 | } as const; |
Tim van der Lippe | 67872d6 | 2021-11-30 14:00:17 | [diff] [blame] | 41 | |
| 42 | const str_ = i18n.i18n.registerUIStrings('entrypoints/node_app/node_app.ts', UIStrings); |
| 43 | const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_); |
| 44 | |
| 45 | let loadedSourcesModule: (typeof Sources|undefined); |
| 46 | |
| 47 | async function loadSourcesModule(): Promise<typeof Sources> { |
| 48 | if (!loadedSourcesModule) { |
| 49 | loadedSourcesModule = await import('../../panels/sources/sources.js'); |
| 50 | } |
| 51 | return loadedSourcesModule; |
| 52 | } |
| 53 | |
| 54 | UI.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 Meurer | b66670f | 2023-12-11 14:56:06 | [diff] [blame] | 61 | return new NodeConnectionsPanel(); |
Tim van der Lippe | 67872d6 | 2021-11-30 14:00:17 | [diff] [blame] | 62 | }, |
| 63 | tags: [i18nLazyString(UIStrings.node)], |
| 64 | }); |
| 65 | |
| 66 | UI.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 Vitkov | d36860c | 2025-02-19 17:50:27 | [diff] [blame] | 79 | // @ts-expect-error Exposed for legacy layout tests |
Tim van der Lippe | d3b32d5 | 2021-12-02 12:55:56 | [diff] [blame] | 80 | self.runtime = Root.Runtime.Runtime.instance({forceNew: true}); |
Tim van der Lippe | 67872d6 | 2021-11-30 14:00:17 | [diff] [blame] | 81 | Common.Runnable.registerEarlyInitializationRunnable(NodeMainImpl.instance); |
| 82 | new Main.MainImpl.MainImpl(); |