|
| 1 | +From 24644cc732ec4bf8589715e853067eadd1b52e29 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Workers DevProd < [email protected]> |
| 3 | +Date: Mon, 2 Oct 2023 18:13:34 +0100 |
| 4 | +Subject: [PATCH 01/15] Support viewing files over the network |
| 5 | + |
| 6 | +--- |
| 7 | + front_end/core/sdk/Target.ts | 4 ++++ |
| 8 | + front_end/entrypoints/js_app/js_app.ts | 2 +- |
| 9 | + front_end/panels/sources/sources-meta.ts | 11 ++++++++--- |
| 10 | + tsconfig.json | 3 ++- |
| 11 | + 4 files changed, 15 insertions(+), 5 deletions(-) |
| 12 | + |
| 13 | +diff --git a/front_end/core/sdk/Target.ts b/front_end/core/sdk/Target.ts |
| 14 | +index eed909ea64..5e1778885d 100644 |
| 15 | +--- a/front_end/core/sdk/Target.ts |
| 16 | ++++ b/front_end/core/sdk/Target.ts |
| 17 | +@@ -82,6 +82,9 @@ export class Target extends ProtocolClient.InspectorBackend.TargetBase { |
| 18 | + case Type.Tab: |
| 19 | + this.#capabilitiesMask = Capability.Target | Capability.Tracing; |
| 20 | + break; |
| 21 | ++ case Type.Cloudflare: |
| 22 | ++ this.#capabilitiesMask = Capability.JS | Capability.Network; |
| 23 | ++ break; |
| 24 | + } |
| 25 | + this.#typeInternal = type; |
| 26 | + this.#parentTargetInternal = parentTarget; |
| 27 | +@@ -255,6 +258,7 @@ export enum Type { |
| 28 | + Browser = 'browser', |
| 29 | + AuctionWorklet = 'auction-worklet', |
| 30 | + Tab = 'tab', |
| 31 | ++ Cloudflare = 'cloudflare', |
| 32 | + } |
| 33 | + |
| 34 | + // TODO(crbug.com/1167717): Make this a const enum again |
| 35 | +diff --git a/front_end/entrypoints/js_app/js_app.ts b/front_end/entrypoints/js_app/js_app.ts |
| 36 | +index cafecfa4ba..213ca7fecd 100644 |
| 37 | +--- a/front_end/entrypoints/js_app/js_app.ts |
| 38 | ++++ b/front_end/entrypoints/js_app/js_app.ts |
| 39 | +@@ -38,7 +38,7 @@ export class JsMainImpl implements Common.Runnable.Runnable { |
| 40 | + Host.userMetrics.actionTaken(Host.UserMetrics.Action.ConnectToNodeJSDirectly); |
| 41 | + void SDK.Connections.initMainConnection(async () => { |
| 42 | + const target = SDK.TargetManager.TargetManager.instance().createTarget( |
| 43 | +- 'main', i18nString(UIStrings.main), SDK.Target.Type.Node, null); |
| 44 | ++ 'main', i18nString(UIStrings.main), SDK.Target.Type.Cloudflare, null); |
| 45 | + void target.runtimeAgent().invoke_runIfWaitingForDebugger(); |
| 46 | + }, Components.TargetDetachedDialog.TargetDetachedDialog.webSocketConnectionLost); |
| 47 | + } |
| 48 | +diff --git a/front_end/panels/sources/sources-meta.ts b/front_end/panels/sources/sources-meta.ts |
| 49 | +index a0c126df12..4b8244ea69 100644 |
| 50 | +--- a/front_end/panels/sources/sources-meta.ts |
| 51 | ++++ b/front_end/panels/sources/sources-meta.ts |
| 52 | +@@ -41,6 +41,11 @@ const UIStrings = { |
| 53 | + *@description Title of the 'Snippets' tool in the Snippets Navigator View, which is part of the Sources tool |
| 54 | + */ |
| 55 | + snippets: 'Snippets', |
| 56 | ++ /** |
| 57 | ++ *@description Title of the 'Cloudflare' tool in the Cloudflare Navigator View, which is part of the Sources tool |
| 58 | ++ */ |
| 59 | ++ cloudflare: 'Cloudflare', |
| 60 | ++ /** |
| 61 | + /** |
| 62 | + *@description Command for showing the 'Search' tool |
| 63 | + */ |
| 64 | +@@ -454,14 +459,14 @@ UI.ViewManager.registerViewExtension({ |
| 65 | + |
| 66 | + UI.ViewManager.registerViewExtension({ |
| 67 | + location: UI.ViewManager.ViewLocationValues.NAVIGATOR_VIEW, |
| 68 | +- id: 'navigator-files', |
| 69 | ++ id: 'navigator-network', |
| 70 | + commandPrompt: i18nLazyString(UIStrings.showWorkspace), |
| 71 | +- title: i18nLazyString(UIStrings.workspace), |
| 72 | ++ title: i18nLazyString(UIStrings.cloudflare), |
| 73 | + order: 3, |
| 74 | + persistence: UI.ViewManager.ViewPersistence.PERMANENT, |
| 75 | + async loadView() { |
| 76 | + const Sources = await loadSourcesModule(); |
| 77 | +- return Sources.SourcesNavigator.FilesNavigatorView.instance(); |
| 78 | ++ return Sources.SourcesNavigator.NetworkNavigatorView.instance(); |
| 79 | + }, |
| 80 | + }); |
| 81 | + |
| 82 | +diff --git a/tsconfig.json b/tsconfig.json |
| 83 | +index ac0d4aaf68..29c726e185 100644 |
| 84 | +--- a/tsconfig.json |
| 85 | ++++ b/tsconfig.json |
| 86 | +@@ -16,6 +16,7 @@ |
| 87 | + "inspector_overlay" |
| 88 | + ], |
| 89 | + "exclude": [ |
| 90 | +- "front_end/**/*-legacy.ts" |
| 91 | ++ "front_end/**/*-legacy.ts", |
| 92 | ++ "third_party/**/*.ts" |
| 93 | + ] |
| 94 | + } |
| 95 | +-- |
| 96 | +2.39.3 (Apple Git-145) |
| 97 | + |
0 commit comments